@eluvio/elv-client-js 3.2.0 → 3.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var a in n)("object"==typeof exports?exports:e)[a]=n[a]}}(global,(function(){return function(e){var t={};function n(a){if(t[a])return t[a].exports;var r=t[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(a,r,function(t){return e[t]}.bind(null,r));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=158)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(98);t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.MISSING_NEW="MISSING_NEW",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.NUMERIC_FAULT="NUMERIC_FAULT",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION";var r=!1,A=!1;function i(e,n,r){if(A)throw new Error("unknown error");n||(n=t.UNKNOWN_ERROR),r||(r={});var i=[];Object.keys(r).forEach((function(e){try{i.push(e+"="+JSON.stringify(r[e]))}catch(t){i.push(e+"="+JSON.stringify(r[e].toString()))}})),i.push("version="+a.version);var o=e;i.length&&(e+=" ("+i.join(", ")+")");var s=new Error(e);throw s.reason=o,s.code=n,Object.keys(r).forEach((function(e){s[e]=r[e]})),s}t.throwError=i,t.checkNew=function(e,n){e instanceof n||i("missing new",t.MISSING_NEW,{name:n.name})},t.checkArgumentCount=function(e,n,a){a||(a=""),e<n&&i("missing argument"+a,t.MISSING_ARGUMENT,{count:e,expectedCount:n}),e>n&&i("too many arguments"+a,t.UNEXPECTED_ARGUMENT,{count:e,expectedCount:n})},t.setCensorship=function(e,n){r&&i("error censorship permanent",t.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),A=!!e,r=!!n},t.checkNormalize=function(){try{if(["NFD","NFC","NFKD","NFKC"].forEach((function(e){try{"test".normalize(e)}catch(t){throw new Error("missing "+e)}})),String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){i("platform missing String.prototype.normalize",t.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:e.message})}};var o={debug:1,default:2,info:2,warn:3,error:4,off:5},s=o.default;function p(e,t){s>o[e]||console.log.apply(console,t)}function d(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];p("warn",e)}t.setLogLevel=function(e){var t=o[e];null!=t?s=t:d("invliad log level - "+e)},t.warn=d,t.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];p("info",e)}},function(e,t,n){"use strict";function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var A=r(n(0));function i(e){return!!e.toHexString}function o(e){return e.slice?e:(e.slice=function(){var t=Array.prototype.slice.call(arguments);return o(new Uint8Array(Array.prototype.slice.apply(e,t)))},e)}function s(e){if(!e||parseInt(String(e.length))!=e.length||"string"==typeof e)return!1;for(var t=0;t<e.length;t++){var n=e[t];if(n<0||n>=256||parseInt(String(n))!=n)return!1}return!0}function p(e){if(null==e&&A.throwError("cannot convert null value to array",A.INVALID_ARGUMENT,{arg:"value",value:e}),i(e)&&(e=e.toHexString()),"string"==typeof e){var t=e.match(/^(0x)?[0-9a-fA-F]*$/);t||A.throwError("invalid hexidecimal string",A.INVALID_ARGUMENT,{arg:"value",value:e}),"0x"!==t[1]&&A.throwError("hex string must have 0x prefix",A.INVALID_ARGUMENT,{arg:"value",value:e}),(e=e.substring(2)).length%2&&(e="0"+e);for(var n=[],r=0;r<e.length;r+=2)n.push(parseInt(e.substr(r,2),16));return o(new Uint8Array(n))}return s(e)?o(new Uint8Array(e)):(A.throwError("invalid arrayify value",null,{arg:"value",value:e,type:a(e)}),null)}function d(e){for(var t=[],n=0,a=0;a<e.length;a++){var r=p(e[a]);t.push(r),n+=r.length}var A=new Uint8Array(n),i=0;for(a=0;a<t.length;a++)A.set(t[a],i),i+=t[a].length;return o(A)}function c(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}t.isHexable=i,t.isArrayish=s,t.arrayify=p,t.concat=d,t.stripZeros=function(e){var t=p(e);if(0===t.length)return t;for(var n=0;0===t[n];)n++;return n&&(t=t.slice(n)),t},t.padZeros=function(e,t){if(t<(e=p(e)).length)throw new Error("cannot pad");var n=new Uint8Array(t);return n.set(e,t-e.length),o(n)},t.isHexString=c;function u(e){if(i(e))return e.toHexString();if("number"==typeof e){e<0&&A.throwError("cannot hexlify negative value",A.INVALID_ARGUMENT,{arg:"value",value:e}),e>=9007199254740991&&A.throwError("out-of-range",A.NUMERIC_FAULT,{operartion:"hexlify",fault:"out-of-safe-range"});for(var t="";e;)t="0123456789abcdef"[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("string"==typeof e){var n=e.match(/^(0x)?[0-9a-fA-F]*$/);return n||A.throwError("invalid hexidecimal string",A.INVALID_ARGUMENT,{arg:"value",value:e}),"0x"!==n[1]&&A.throwError("hex string must have 0x prefix",A.INVALID_ARGUMENT,{arg:"value",value:e}),e.length%2&&(e="0x0"+e.substring(2)),e}if(s(e)){for(var a=[],r=0;r<e.length;r++){var o=e[r];a.push("0123456789abcdef"[(240&o)>>4]+"0123456789abcdef"[15&o])}return"0x"+a.join("")}return A.throwError("invalid hexlify value",null,{arg:"value",value:e}),"never"}function l(e,t){for(c(e)||A.throwError("invalid hex string",A.INVALID_ARGUMENT,{arg:"value",value:e});e.length<2*t+2;)e="0x0"+e.substring(2);return e}function g(e){var t,n=0,a="0x",r="0x";if((t=e)&&null!=t.r&&null!=t.s){null==e.v&&null==e.recoveryParam&&A.throwError("at least on of recoveryParam or v must be specified",A.INVALID_ARGUMENT,{argument:"signature",value:e}),a=l(e.r,32),r=l(e.s,32),"string"==typeof(n=e.v)&&(n=parseInt(n,16));var i=e.recoveryParam;null==i&&null!=e.v&&(i=1-n%2),n=27+i}else{var o=p(e);if(65!==o.length)throw new Error("invalid signature");a=u(o.slice(0,32)),r=u(o.slice(32,64)),27!==(n=o[64])&&28!==n&&(n=27+n%2)}return{r:a,s:r,recoveryParam:n-27,v:n}}t.hexlify=u,t.hexDataLength=function(e){return c(e)&&e.length%2==0?(e.length-2)/2:null},t.hexDataSlice=function(e,t,n){return c(e)||A.throwError("invalid hex data",A.INVALID_ARGUMENT,{arg:"value",value:e}),e.length%2!=0&&A.throwError("hex data length must be even",A.INVALID_ARGUMENT,{arg:"value",value:e}),t=2+2*t,null!=n?"0x"+e.substring(t,2+2*n):"0x"+e.substring(t)},t.hexStripZeros=function(e){for(c(e)||A.throwError("invalid hex string",A.INVALID_ARGUMENT,{arg:"value",value:e});e.length>3&&"0x0"===e.substring(0,3);)e="0x"+e.substring(3);return e},t.hexZeroPad=l,t.splitSignature=g,t.joinSignature=function(e){return u(d([(e=g(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}},function(e,t,n){(function(e){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e,a){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function A(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var o;"object"===t(e)?e.exports=i:a.BN=i,i.BN=i,i.wordSize=26;try{o=n(28).Buffer}catch(e){}function s(e,t,n){for(var a=0,A=Math.min(e.length,n),i=0,o=t;o<A;o++){var s,p=e.charCodeAt(o)-48;a<<=4,a|=s=p>=49&&p<=54?p-49+10:p>=17&&p<=22?p-17+10:p,i|=s}return r(!(240&i),"Invalid character in "+e),a}function p(e,t,n,a){for(var A=0,i=0,o=Math.min(e.length,n),s=t;s<o;s++){var p=e.charCodeAt(s)-48;A*=a,i=p>=49?p-49+10:p>=17?p-17+10:p,r(p>=0&&i<a,"Invalid character"),A+=i}return A}function d(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}function c(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}i.isBN=function(e){return e instanceof i||null!==e&&"object"===t(e)&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,n,a){if("number"==typeof e)return this._initNumber(e,n,a);if("object"===t(e))return this._initArray(e,n,a);"hex"===n&&(n=16),r(n===(0|n)&&n>=2&&n<=36);var A=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&A++,16===n?this._parseHex(e,A):this._parseBase(e,n,A),"-"===e[0]&&(this.negative=1),this._strip(),"le"===a&&this._initArray(this.toArray(),n,a)},i.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},i.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var a=0;a<this.length;a++)this.words[a]=0;var A,i,o=0;if("be"===n)for(a=e.length-1,A=0;a>=0;a-=3)i=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[A]|=i<<o&67108863,this.words[A+1]=i>>>26-o&67108863,(o+=24)>=26&&(o-=26,A++);else if("le"===n)for(a=0,A=0;a<e.length;a+=3)i=e[a]|e[a+1]<<8|e[a+2]<<16,this.words[A]|=i<<o&67108863,this.words[A+1]=i>>>26-o&67108863,(o+=24)>=26&&(o-=26,A++);return this._strip()},i.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var a,r,A=0;for(n=e.length-6,a=0;n>=t;n-=6)r=s(e,n,n+6),this.words[a]|=r<<A&67108863,this.words[a+1]|=r>>>26-A&4194303,(A+=24)>=26&&(A-=26,a++);n+6!==t&&(r=s(e,t,n+6),this.words[a]|=r<<A&67108863,this.words[a+1]|=r>>>26-A&4194303),this._strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var a=0,r=1;r<=67108863;r*=t)a++;a--,r=r/t|0;for(var A=e.length-n,i=A%a,o=Math.min(A,A-i)+n,s=0,d=n;d<o;d+=a)s=p(e,d,d+a,t),this.imuln(r),this.words[0]+s<67108864?this.words[0]+=s:this._iaddn(s);if(0!==i){var c=1;for(s=p(e,d,e.length,t),d=0;d<i;d++)c*=t;this.imuln(c),this.words[0]+s<67108864?this.words[0]+=s:this._iaddn(s)}},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){d(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for?i.prototype[Symbol.for("nodejs.util.inspect.custom")]=c:i.prototype.inspect=c;var u=["","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],g=[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];i.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var a=0,A=0,i=0;i<this.length;i++){var o=this.words[i],s=(16777215&(o<<a|A)).toString(16);n=0!==(A=o>>>24-a&16777215)||i!==this.length-1?u[6-s.length]+s+n:s+n,(a+=2)>=26&&(a-=26,i--)}for(0!==A&&(n=A.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var p=l[e],d=g[e];n="";var c=this.clone();for(c.negative=0;!c.isZero();){var f=c.modrn(d).toString(e);n=(c=c.idivn(d)).isZero()?f+n:u[p-f.length]+f+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function f(e,t,n){n.negative=t.negative^e.negative;var a=e.length+t.length|0;n.length=a,a=a-1|0;var r=0|e.words[0],A=0|t.words[0],i=r*A,o=67108863&i,s=i/67108864|0;n.words[0]=o;for(var p=1;p<a;p++){for(var d=s>>>26,c=67108863&s,u=Math.min(p,t.length-1),l=Math.max(0,p-e.length+1);l<=u;l++){var g=p-l|0;d+=(i=(r=0|e.words[g])*(A=0|t.words[l])+c)/67108864|0,c=67108863&i}n.words[p]=0|c,s=0|d}return 0!==s?n.words[p]=0|s:n.length--,n._strip()}i.prototype.toArrayLike=function(e,t,n){this._strip();var a=this.byteLength(),A=n||Math.max(1,a);r(a<=A,"byte array longer than desired length"),r(A>0,"Requested array length <= 0");var i=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,A);return this["_toArrayLike"+("le"===t?"LE":"BE")](i,a),i},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,a=0,r=0,A=0;r<this.length;r++){var i=this.words[r]<<A|a;e[n++]=255&i,n<e.length&&(e[n++]=i>>8&255),n<e.length&&(e[n++]=i>>16&255),6===A?(n<e.length&&(e[n++]=i>>24&255),a=0,A=0):(a=i>>>24,A+=2)}if(n<e.length)for(e[n++]=a;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,a=0,r=0,A=0;r<this.length;r++){var i=this.words[r]<<A|a;e[n--]=255&i,n>=0&&(e[n--]=i>>8&255),n>=0&&(e[n--]=i>>16&255),6===A?(n>=0&&(e[n--]=i>>24&255),a=0,A=0):(a=i>>>24,A+=2)}if(n>=0)for(e[n--]=a;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var a=0;a<n.length;a++)this.words[a]=t.words[a]^n.words[a];if(this!==t)for(;a<t.length;a++)this.words[a]=t.words[a];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var a=0;a<t;a++)this.words[a]=67108863&~this.words[a];return n>0&&(this.words[a]=~this.words[a]&67108863>>26-n),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,a=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<a:this.words[n]&~(1<<a),this._strip()},i.prototype.iadd=function(e){var t,n,a;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,a=e):(n=e,a=this);for(var r=0,A=0;A<a.length;A++)t=(0|n.words[A])+(0|a.words[A])+r,this.words[A]=67108863&t,r=t>>>26;for(;0!==r&&A<n.length;A++)t=(0|n.words[A])+r,this.words[A]=67108863&t,r=t>>>26;if(this.length=n.length,0!==r)this.words[this.length]=r,this.length++;else if(n!==this)for(;A<n.length;A++)this.words[A]=n.words[A];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,a,r=this.cmp(e);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;r>0?(n=this,a=e):(n=e,a=this);for(var A=0,i=0;i<a.length;i++)A=(t=(0|n.words[i])-(0|a.words[i])+A)>>26,this.words[i]=67108863&t;for(;0!==A&&i<n.length;i++)A=(t=(0|n.words[i])+A)>>26,this.words[i]=67108863&t;if(0===A&&i<n.length&&n!==this)for(;i<n.length;i++)this.words[i]=n.words[i];return this.length=Math.max(this.length,i),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var I=function(e,t,n){var a,r,A,i=e.words,o=t.words,s=n.words,p=0,d=0|i[0],c=8191&d,u=d>>>13,l=0|i[1],g=8191&l,f=l>>>13,I=0|i[2],h=8191&I,y=I>>>13,m=0|i[3],C=8191&m,B=m>>>13,E=0|i[4],b=8191&E,Q=E>>>13,v=0|i[5],w=8191&v,D=v>>>13,M=0|i[6],S=8191&M,k=M>>>13,x=0|i[7],R=8191&x,N=x>>>13,F=0|i[8],_=8191&F,T=F>>>13,H=0|i[9],L=8191&H,G=H>>>13,U=0|o[0],O=8191&U,P=U>>>13,Y=0|o[1],J=8191&Y,j=Y>>>13,K=0|o[2],q=8191&K,V=K>>>13,z=0|o[3],Z=8191&z,X=z>>>13,W=0|o[4],$=8191&W,ee=W>>>13,te=0|o[5],ne=8191&te,ae=te>>>13,re=0|o[6],Ae=8191&re,ie=re>>>13,oe=0|o[7],se=8191&oe,pe=oe>>>13,de=0|o[8],ce=8191&de,ue=de>>>13,le=0|o[9],ge=8191&le,fe=le>>>13;n.negative=e.negative^t.negative,n.length=19;var Ie=(p+(a=Math.imul(c,O))|0)+((8191&(r=(r=Math.imul(c,P))+Math.imul(u,O)|0))<<13)|0;p=((A=Math.imul(u,P))+(r>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,a=Math.imul(g,O),r=(r=Math.imul(g,P))+Math.imul(f,O)|0,A=Math.imul(f,P);var he=(p+(a=a+Math.imul(c,J)|0)|0)+((8191&(r=(r=r+Math.imul(c,j)|0)+Math.imul(u,J)|0))<<13)|0;p=((A=A+Math.imul(u,j)|0)+(r>>>13)|0)+(he>>>26)|0,he&=67108863,a=Math.imul(h,O),r=(r=Math.imul(h,P))+Math.imul(y,O)|0,A=Math.imul(y,P),a=a+Math.imul(g,J)|0,r=(r=r+Math.imul(g,j)|0)+Math.imul(f,J)|0,A=A+Math.imul(f,j)|0;var ye=(p+(a=a+Math.imul(c,q)|0)|0)+((8191&(r=(r=r+Math.imul(c,V)|0)+Math.imul(u,q)|0))<<13)|0;p=((A=A+Math.imul(u,V)|0)+(r>>>13)|0)+(ye>>>26)|0,ye&=67108863,a=Math.imul(C,O),r=(r=Math.imul(C,P))+Math.imul(B,O)|0,A=Math.imul(B,P),a=a+Math.imul(h,J)|0,r=(r=r+Math.imul(h,j)|0)+Math.imul(y,J)|0,A=A+Math.imul(y,j)|0,a=a+Math.imul(g,q)|0,r=(r=r+Math.imul(g,V)|0)+Math.imul(f,q)|0,A=A+Math.imul(f,V)|0;var me=(p+(a=a+Math.imul(c,Z)|0)|0)+((8191&(r=(r=r+Math.imul(c,X)|0)+Math.imul(u,Z)|0))<<13)|0;p=((A=A+Math.imul(u,X)|0)+(r>>>13)|0)+(me>>>26)|0,me&=67108863,a=Math.imul(b,O),r=(r=Math.imul(b,P))+Math.imul(Q,O)|0,A=Math.imul(Q,P),a=a+Math.imul(C,J)|0,r=(r=r+Math.imul(C,j)|0)+Math.imul(B,J)|0,A=A+Math.imul(B,j)|0,a=a+Math.imul(h,q)|0,r=(r=r+Math.imul(h,V)|0)+Math.imul(y,q)|0,A=A+Math.imul(y,V)|0,a=a+Math.imul(g,Z)|0,r=(r=r+Math.imul(g,X)|0)+Math.imul(f,Z)|0,A=A+Math.imul(f,X)|0;var Ce=(p+(a=a+Math.imul(c,$)|0)|0)+((8191&(r=(r=r+Math.imul(c,ee)|0)+Math.imul(u,$)|0))<<13)|0;p=((A=A+Math.imul(u,ee)|0)+(r>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,a=Math.imul(w,O),r=(r=Math.imul(w,P))+Math.imul(D,O)|0,A=Math.imul(D,P),a=a+Math.imul(b,J)|0,r=(r=r+Math.imul(b,j)|0)+Math.imul(Q,J)|0,A=A+Math.imul(Q,j)|0,a=a+Math.imul(C,q)|0,r=(r=r+Math.imul(C,V)|0)+Math.imul(B,q)|0,A=A+Math.imul(B,V)|0,a=a+Math.imul(h,Z)|0,r=(r=r+Math.imul(h,X)|0)+Math.imul(y,Z)|0,A=A+Math.imul(y,X)|0,a=a+Math.imul(g,$)|0,r=(r=r+Math.imul(g,ee)|0)+Math.imul(f,$)|0,A=A+Math.imul(f,ee)|0;var Be=(p+(a=a+Math.imul(c,ne)|0)|0)+((8191&(r=(r=r+Math.imul(c,ae)|0)+Math.imul(u,ne)|0))<<13)|0;p=((A=A+Math.imul(u,ae)|0)+(r>>>13)|0)+(Be>>>26)|0,Be&=67108863,a=Math.imul(S,O),r=(r=Math.imul(S,P))+Math.imul(k,O)|0,A=Math.imul(k,P),a=a+Math.imul(w,J)|0,r=(r=r+Math.imul(w,j)|0)+Math.imul(D,J)|0,A=A+Math.imul(D,j)|0,a=a+Math.imul(b,q)|0,r=(r=r+Math.imul(b,V)|0)+Math.imul(Q,q)|0,A=A+Math.imul(Q,V)|0,a=a+Math.imul(C,Z)|0,r=(r=r+Math.imul(C,X)|0)+Math.imul(B,Z)|0,A=A+Math.imul(B,X)|0,a=a+Math.imul(h,$)|0,r=(r=r+Math.imul(h,ee)|0)+Math.imul(y,$)|0,A=A+Math.imul(y,ee)|0,a=a+Math.imul(g,ne)|0,r=(r=r+Math.imul(g,ae)|0)+Math.imul(f,ne)|0,A=A+Math.imul(f,ae)|0;var Ee=(p+(a=a+Math.imul(c,Ae)|0)|0)+((8191&(r=(r=r+Math.imul(c,ie)|0)+Math.imul(u,Ae)|0))<<13)|0;p=((A=A+Math.imul(u,ie)|0)+(r>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,a=Math.imul(R,O),r=(r=Math.imul(R,P))+Math.imul(N,O)|0,A=Math.imul(N,P),a=a+Math.imul(S,J)|0,r=(r=r+Math.imul(S,j)|0)+Math.imul(k,J)|0,A=A+Math.imul(k,j)|0,a=a+Math.imul(w,q)|0,r=(r=r+Math.imul(w,V)|0)+Math.imul(D,q)|0,A=A+Math.imul(D,V)|0,a=a+Math.imul(b,Z)|0,r=(r=r+Math.imul(b,X)|0)+Math.imul(Q,Z)|0,A=A+Math.imul(Q,X)|0,a=a+Math.imul(C,$)|0,r=(r=r+Math.imul(C,ee)|0)+Math.imul(B,$)|0,A=A+Math.imul(B,ee)|0,a=a+Math.imul(h,ne)|0,r=(r=r+Math.imul(h,ae)|0)+Math.imul(y,ne)|0,A=A+Math.imul(y,ae)|0,a=a+Math.imul(g,Ae)|0,r=(r=r+Math.imul(g,ie)|0)+Math.imul(f,Ae)|0,A=A+Math.imul(f,ie)|0;var be=(p+(a=a+Math.imul(c,se)|0)|0)+((8191&(r=(r=r+Math.imul(c,pe)|0)+Math.imul(u,se)|0))<<13)|0;p=((A=A+Math.imul(u,pe)|0)+(r>>>13)|0)+(be>>>26)|0,be&=67108863,a=Math.imul(_,O),r=(r=Math.imul(_,P))+Math.imul(T,O)|0,A=Math.imul(T,P),a=a+Math.imul(R,J)|0,r=(r=r+Math.imul(R,j)|0)+Math.imul(N,J)|0,A=A+Math.imul(N,j)|0,a=a+Math.imul(S,q)|0,r=(r=r+Math.imul(S,V)|0)+Math.imul(k,q)|0,A=A+Math.imul(k,V)|0,a=a+Math.imul(w,Z)|0,r=(r=r+Math.imul(w,X)|0)+Math.imul(D,Z)|0,A=A+Math.imul(D,X)|0,a=a+Math.imul(b,$)|0,r=(r=r+Math.imul(b,ee)|0)+Math.imul(Q,$)|0,A=A+Math.imul(Q,ee)|0,a=a+Math.imul(C,ne)|0,r=(r=r+Math.imul(C,ae)|0)+Math.imul(B,ne)|0,A=A+Math.imul(B,ae)|0,a=a+Math.imul(h,Ae)|0,r=(r=r+Math.imul(h,ie)|0)+Math.imul(y,Ae)|0,A=A+Math.imul(y,ie)|0,a=a+Math.imul(g,se)|0,r=(r=r+Math.imul(g,pe)|0)+Math.imul(f,se)|0,A=A+Math.imul(f,pe)|0;var Qe=(p+(a=a+Math.imul(c,ce)|0)|0)+((8191&(r=(r=r+Math.imul(c,ue)|0)+Math.imul(u,ce)|0))<<13)|0;p=((A=A+Math.imul(u,ue)|0)+(r>>>13)|0)+(Qe>>>26)|0,Qe&=67108863,a=Math.imul(L,O),r=(r=Math.imul(L,P))+Math.imul(G,O)|0,A=Math.imul(G,P),a=a+Math.imul(_,J)|0,r=(r=r+Math.imul(_,j)|0)+Math.imul(T,J)|0,A=A+Math.imul(T,j)|0,a=a+Math.imul(R,q)|0,r=(r=r+Math.imul(R,V)|0)+Math.imul(N,q)|0,A=A+Math.imul(N,V)|0,a=a+Math.imul(S,Z)|0,r=(r=r+Math.imul(S,X)|0)+Math.imul(k,Z)|0,A=A+Math.imul(k,X)|0,a=a+Math.imul(w,$)|0,r=(r=r+Math.imul(w,ee)|0)+Math.imul(D,$)|0,A=A+Math.imul(D,ee)|0,a=a+Math.imul(b,ne)|0,r=(r=r+Math.imul(b,ae)|0)+Math.imul(Q,ne)|0,A=A+Math.imul(Q,ae)|0,a=a+Math.imul(C,Ae)|0,r=(r=r+Math.imul(C,ie)|0)+Math.imul(B,Ae)|0,A=A+Math.imul(B,ie)|0,a=a+Math.imul(h,se)|0,r=(r=r+Math.imul(h,pe)|0)+Math.imul(y,se)|0,A=A+Math.imul(y,pe)|0,a=a+Math.imul(g,ce)|0,r=(r=r+Math.imul(g,ue)|0)+Math.imul(f,ce)|0,A=A+Math.imul(f,ue)|0;var ve=(p+(a=a+Math.imul(c,ge)|0)|0)+((8191&(r=(r=r+Math.imul(c,fe)|0)+Math.imul(u,ge)|0))<<13)|0;p=((A=A+Math.imul(u,fe)|0)+(r>>>13)|0)+(ve>>>26)|0,ve&=67108863,a=Math.imul(L,J),r=(r=Math.imul(L,j))+Math.imul(G,J)|0,A=Math.imul(G,j),a=a+Math.imul(_,q)|0,r=(r=r+Math.imul(_,V)|0)+Math.imul(T,q)|0,A=A+Math.imul(T,V)|0,a=a+Math.imul(R,Z)|0,r=(r=r+Math.imul(R,X)|0)+Math.imul(N,Z)|0,A=A+Math.imul(N,X)|0,a=a+Math.imul(S,$)|0,r=(r=r+Math.imul(S,ee)|0)+Math.imul(k,$)|0,A=A+Math.imul(k,ee)|0,a=a+Math.imul(w,ne)|0,r=(r=r+Math.imul(w,ae)|0)+Math.imul(D,ne)|0,A=A+Math.imul(D,ae)|0,a=a+Math.imul(b,Ae)|0,r=(r=r+Math.imul(b,ie)|0)+Math.imul(Q,Ae)|0,A=A+Math.imul(Q,ie)|0,a=a+Math.imul(C,se)|0,r=(r=r+Math.imul(C,pe)|0)+Math.imul(B,se)|0,A=A+Math.imul(B,pe)|0,a=a+Math.imul(h,ce)|0,r=(r=r+Math.imul(h,ue)|0)+Math.imul(y,ce)|0,A=A+Math.imul(y,ue)|0;var we=(p+(a=a+Math.imul(g,ge)|0)|0)+((8191&(r=(r=r+Math.imul(g,fe)|0)+Math.imul(f,ge)|0))<<13)|0;p=((A=A+Math.imul(f,fe)|0)+(r>>>13)|0)+(we>>>26)|0,we&=67108863,a=Math.imul(L,q),r=(r=Math.imul(L,V))+Math.imul(G,q)|0,A=Math.imul(G,V),a=a+Math.imul(_,Z)|0,r=(r=r+Math.imul(_,X)|0)+Math.imul(T,Z)|0,A=A+Math.imul(T,X)|0,a=a+Math.imul(R,$)|0,r=(r=r+Math.imul(R,ee)|0)+Math.imul(N,$)|0,A=A+Math.imul(N,ee)|0,a=a+Math.imul(S,ne)|0,r=(r=r+Math.imul(S,ae)|0)+Math.imul(k,ne)|0,A=A+Math.imul(k,ae)|0,a=a+Math.imul(w,Ae)|0,r=(r=r+Math.imul(w,ie)|0)+Math.imul(D,Ae)|0,A=A+Math.imul(D,ie)|0,a=a+Math.imul(b,se)|0,r=(r=r+Math.imul(b,pe)|0)+Math.imul(Q,se)|0,A=A+Math.imul(Q,pe)|0,a=a+Math.imul(C,ce)|0,r=(r=r+Math.imul(C,ue)|0)+Math.imul(B,ce)|0,A=A+Math.imul(B,ue)|0;var De=(p+(a=a+Math.imul(h,ge)|0)|0)+((8191&(r=(r=r+Math.imul(h,fe)|0)+Math.imul(y,ge)|0))<<13)|0;p=((A=A+Math.imul(y,fe)|0)+(r>>>13)|0)+(De>>>26)|0,De&=67108863,a=Math.imul(L,Z),r=(r=Math.imul(L,X))+Math.imul(G,Z)|0,A=Math.imul(G,X),a=a+Math.imul(_,$)|0,r=(r=r+Math.imul(_,ee)|0)+Math.imul(T,$)|0,A=A+Math.imul(T,ee)|0,a=a+Math.imul(R,ne)|0,r=(r=r+Math.imul(R,ae)|0)+Math.imul(N,ne)|0,A=A+Math.imul(N,ae)|0,a=a+Math.imul(S,Ae)|0,r=(r=r+Math.imul(S,ie)|0)+Math.imul(k,Ae)|0,A=A+Math.imul(k,ie)|0,a=a+Math.imul(w,se)|0,r=(r=r+Math.imul(w,pe)|0)+Math.imul(D,se)|0,A=A+Math.imul(D,pe)|0,a=a+Math.imul(b,ce)|0,r=(r=r+Math.imul(b,ue)|0)+Math.imul(Q,ce)|0,A=A+Math.imul(Q,ue)|0;var Me=(p+(a=a+Math.imul(C,ge)|0)|0)+((8191&(r=(r=r+Math.imul(C,fe)|0)+Math.imul(B,ge)|0))<<13)|0;p=((A=A+Math.imul(B,fe)|0)+(r>>>13)|0)+(Me>>>26)|0,Me&=67108863,a=Math.imul(L,$),r=(r=Math.imul(L,ee))+Math.imul(G,$)|0,A=Math.imul(G,ee),a=a+Math.imul(_,ne)|0,r=(r=r+Math.imul(_,ae)|0)+Math.imul(T,ne)|0,A=A+Math.imul(T,ae)|0,a=a+Math.imul(R,Ae)|0,r=(r=r+Math.imul(R,ie)|0)+Math.imul(N,Ae)|0,A=A+Math.imul(N,ie)|0,a=a+Math.imul(S,se)|0,r=(r=r+Math.imul(S,pe)|0)+Math.imul(k,se)|0,A=A+Math.imul(k,pe)|0,a=a+Math.imul(w,ce)|0,r=(r=r+Math.imul(w,ue)|0)+Math.imul(D,ce)|0,A=A+Math.imul(D,ue)|0;var Se=(p+(a=a+Math.imul(b,ge)|0)|0)+((8191&(r=(r=r+Math.imul(b,fe)|0)+Math.imul(Q,ge)|0))<<13)|0;p=((A=A+Math.imul(Q,fe)|0)+(r>>>13)|0)+(Se>>>26)|0,Se&=67108863,a=Math.imul(L,ne),r=(r=Math.imul(L,ae))+Math.imul(G,ne)|0,A=Math.imul(G,ae),a=a+Math.imul(_,Ae)|0,r=(r=r+Math.imul(_,ie)|0)+Math.imul(T,Ae)|0,A=A+Math.imul(T,ie)|0,a=a+Math.imul(R,se)|0,r=(r=r+Math.imul(R,pe)|0)+Math.imul(N,se)|0,A=A+Math.imul(N,pe)|0,a=a+Math.imul(S,ce)|0,r=(r=r+Math.imul(S,ue)|0)+Math.imul(k,ce)|0,A=A+Math.imul(k,ue)|0;var ke=(p+(a=a+Math.imul(w,ge)|0)|0)+((8191&(r=(r=r+Math.imul(w,fe)|0)+Math.imul(D,ge)|0))<<13)|0;p=((A=A+Math.imul(D,fe)|0)+(r>>>13)|0)+(ke>>>26)|0,ke&=67108863,a=Math.imul(L,Ae),r=(r=Math.imul(L,ie))+Math.imul(G,Ae)|0,A=Math.imul(G,ie),a=a+Math.imul(_,se)|0,r=(r=r+Math.imul(_,pe)|0)+Math.imul(T,se)|0,A=A+Math.imul(T,pe)|0,a=a+Math.imul(R,ce)|0,r=(r=r+Math.imul(R,ue)|0)+Math.imul(N,ce)|0,A=A+Math.imul(N,ue)|0;var xe=(p+(a=a+Math.imul(S,ge)|0)|0)+((8191&(r=(r=r+Math.imul(S,fe)|0)+Math.imul(k,ge)|0))<<13)|0;p=((A=A+Math.imul(k,fe)|0)+(r>>>13)|0)+(xe>>>26)|0,xe&=67108863,a=Math.imul(L,se),r=(r=Math.imul(L,pe))+Math.imul(G,se)|0,A=Math.imul(G,pe),a=a+Math.imul(_,ce)|0,r=(r=r+Math.imul(_,ue)|0)+Math.imul(T,ce)|0,A=A+Math.imul(T,ue)|0;var Re=(p+(a=a+Math.imul(R,ge)|0)|0)+((8191&(r=(r=r+Math.imul(R,fe)|0)+Math.imul(N,ge)|0))<<13)|0;p=((A=A+Math.imul(N,fe)|0)+(r>>>13)|0)+(Re>>>26)|0,Re&=67108863,a=Math.imul(L,ce),r=(r=Math.imul(L,ue))+Math.imul(G,ce)|0,A=Math.imul(G,ue);var Ne=(p+(a=a+Math.imul(_,ge)|0)|0)+((8191&(r=(r=r+Math.imul(_,fe)|0)+Math.imul(T,ge)|0))<<13)|0;p=((A=A+Math.imul(T,fe)|0)+(r>>>13)|0)+(Ne>>>26)|0,Ne&=67108863;var Fe=(p+(a=Math.imul(L,ge))|0)+((8191&(r=(r=Math.imul(L,fe))+Math.imul(G,ge)|0))<<13)|0;return p=((A=Math.imul(G,fe))+(r>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,s[0]=Ie,s[1]=he,s[2]=ye,s[3]=me,s[4]=Ce,s[5]=Be,s[6]=Ee,s[7]=be,s[8]=Qe,s[9]=ve,s[10]=we,s[11]=De,s[12]=Me,s[13]=Se,s[14]=ke,s[15]=xe,s[16]=Re,s[17]=Ne,s[18]=Fe,0!==p&&(s[19]=p,n.length++),n};function h(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var a=0,r=0,A=0;A<n.length-1;A++){var i=r;r=0;for(var o=67108863&a,s=Math.min(A,t.length-1),p=Math.max(0,A-e.length+1);p<=s;p++){var d=A-p,c=(0|e.words[d])*(0|t.words[p]),u=67108863&c;o=67108863&(u=u+o|0),r+=(i=(i=i+(c/67108864|0)|0)+(u>>>26)|0)>>>26,i&=67108863}n.words[A]=o,a=i,i=r}return 0!==a?n.words[A]=a:n.length--,n._strip()}function y(e,t,n){return h(e,t,n)}function m(e,t){this.x=e,this.y=t}Math.imul||(I=f),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?I(this,e,t):n<63?f(this,e,t):n<1024?h(this,e,t):y(this,e,t)},m.prototype.makeRBT=function(e){for(var t=new Array(e),n=i.prototype._countBits(e)-1,a=0;a<e;a++)t[a]=this.revBin(a,n,e);return t},m.prototype.revBin=function(e,t,n){if(0===e||e===n-1)return e;for(var a=0,r=0;r<t;r++)a|=(1&e)<<t-r-1,e>>=1;return a},m.prototype.permute=function(e,t,n,a,r,A){for(var i=0;i<A;i++)a[i]=t[e[i]],r[i]=n[e[i]]},m.prototype.transform=function(e,t,n,a,r,A){this.permute(A,e,t,n,a,r);for(var i=1;i<r;i<<=1)for(var o=i<<1,s=Math.cos(2*Math.PI/o),p=Math.sin(2*Math.PI/o),d=0;d<r;d+=o)for(var c=s,u=p,l=0;l<i;l++){var g=n[d+l],f=a[d+l],I=n[d+l+i],h=a[d+l+i],y=c*I-u*h;h=c*h+u*I,I=y,n[d+l]=g+I,a[d+l]=f+h,n[d+l+i]=g-I,a[d+l+i]=f-h,l!==o&&(y=s*c-p*u,u=s*u+p*c,c=y)}},m.prototype.guessLen13b=function(e,t){var n=1|Math.max(t,e),a=1&n,r=0;for(n=n/2|0;n;n>>>=1)r++;return 1<<r+1+a},m.prototype.conjugate=function(e,t,n){if(!(n<=1))for(var a=0;a<n/2;a++){var r=e[a];e[a]=e[n-a-1],e[n-a-1]=r,r=t[a],t[a]=-t[n-a-1],t[n-a-1]=-r}},m.prototype.normalize13b=function(e,t){for(var n=0,a=0;a<t/2;a++){var r=8192*Math.round(e[2*a+1]/t)+Math.round(e[2*a]/t)+n;e[a]=67108863&r,n=r<67108864?0:r/67108864|0}return e},m.prototype.convert13b=function(e,t,n,a){for(var A=0,i=0;i<t;i++)A+=0|e[i],n[2*i]=8191&A,A>>>=13,n[2*i+1]=8191&A,A>>>=13;for(i=2*t;i<a;++i)n[i]=0;r(0===A),r(0==(-8192&A))},m.prototype.stub=function(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=0;return t},m.prototype.mulp=function(e,t,n){var a=2*this.guessLen13b(e.length,t.length),r=this.makeRBT(a),A=this.stub(a),i=new Array(a),o=new Array(a),s=new Array(a),p=new Array(a),d=new Array(a),c=new Array(a),u=n.words;u.length=a,this.convert13b(e.words,e.length,i,a),this.convert13b(t.words,t.length,p,a),this.transform(i,A,o,s,a,r),this.transform(p,A,d,c,a,r);for(var l=0;l<a;l++){var g=o[l]*d[l]-s[l]*c[l];s[l]=o[l]*c[l]+s[l]*d[l],o[l]=g}return this.conjugate(o,s,a),this.transform(o,s,u,A,a,r),this.conjugate(u,A,a),this.normalize13b(u,a),n.negative=e.negative^t.negative,n.length=e.length+t.length,n._strip()},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),y(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),r("number"==typeof e),r(e<67108864);for(var n=0,a=0;a<this.length;a++){var A=(0|this.words[a])*e,i=(67108863&A)+(67108863&n);n>>=26,n+=A/67108864|0,n+=i>>>26,this.words[a]=67108863&i}return 0!==n&&(this.words[a]=n,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var a=n/26|0,r=n%26;t[n]=e.words[a]>>>r&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,a=0;a<t.length&&0===t[a];a++,n=n.sqr());if(++a<t.length)for(var r=n.sqr();a<t.length;a++,r=r.sqr())0!==t[a]&&(n=n.mul(r));return n},i.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,a=(e-n)/26,A=67108863>>>26-n<<26-n;if(0!==n){var i=0;for(t=0;t<this.length;t++){var o=this.words[t]&A,s=(0|this.words[t])-o<<n;this.words[t]=s|i,i=o>>>26-n}i&&(this.words[t]=i,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t<a;t++)this.words[t]=0;this.length+=a}return this._strip()},i.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,n){var a;r("number"==typeof e&&e>=0),a=t?(t-t%26)/26:0;var A=e%26,i=Math.min((e-A)/26,this.length),o=67108863^67108863>>>A<<A,s=n;if(a-=i,a=Math.max(0,a),s){for(var p=0;p<i;p++)s.words[p]=this.words[p];s.length=i}if(0===i);else if(this.length>i)for(this.length-=i,p=0;p<this.length;p++)this.words[p]=this.words[p+i];else this.words[0]=0,this.length=1;var d=0;for(p=this.length-1;p>=0&&(0!==d||p>=a);p--){var c=0|this.words[p];this.words[p]=d<<26-A|c>>>A,d=c&o}return s&&0!==d&&(s.words[s.length++]=d),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,a=1<<t;return!(this.length<=n)&&!!(this.words[n]&a)},i.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var a=67108863^67108863>>>t<<t;this.words[this.length-1]&=a}return this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,n){var a,A,i=e.length+n;this._expand(i);var o=0;for(a=0;a<e.length;a++){A=(0|this.words[a+n])+o;var s=(0|e.words[a])*t;o=((A-=67108863&s)>>26)-(s/67108864|0),this.words[a+n]=67108863&A}for(;a<this.length-n;a++)o=(A=(0|this.words[a+n])+o)>>26,this.words[a+n]=67108863&A;if(0===o)return this._strip();for(r(-1===o),o=0,a=0;a<this.length;a++)o=(A=-(0|this.words[a])+o)>>26,this.words[a]=67108863&A;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),a=this.clone(),r=e,A=0|r.words[r.length-1];0!==(n=26-this._countBits(A))&&(r=r.ushln(n),a.iushln(n),A=0|r.words[r.length-1]);var o,s=a.length-r.length;if("mod"!==t){(o=new i(null)).length=s+1,o.words=new Array(o.length);for(var p=0;p<o.length;p++)o.words[p]=0}var d=a.clone()._ishlnsubmul(r,1,s);0===d.negative&&(a=d,o&&(o.words[s]=1));for(var c=s-1;c>=0;c--){var u=67108864*(0|a.words[r.length+c])+(0|a.words[r.length+c-1]);for(u=Math.min(u/A|0,67108863),a._ishlnsubmul(r,u,c);0!==a.negative;)u--,a.negative=0,a._ishlnsubmul(r,1,c),a.isZero()||(a.negative^=1);o&&(o.words[c]=u)}return o&&o._strip(),a._strip(),"div"!==t&&0!==n&&a.iushrn(n),{div:o||null,mod:a}},i.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(A=o.mod.neg(),n&&0!==A.negative&&A.iadd(e)),{div:a,mod:A}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(A=o.mod.neg(),n&&0!==A.negative&&A.isub(e)),{div:o.div,mod:A}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var a,A,o},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),r=e.andln(1),A=n.cmp(a);return A<0||1===r&&0===A?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,a=0,A=this.length-1;A>=0;A--)a=(n*a+(0|this.words[A]))%e;return t?-a:a},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,a=this.length-1;a>=0;a--){var A=(0|this.words[a])+67108864*n;this.words[a]=A/e|0,n=A%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new i(1),A=new i(0),o=new i(0),s=new i(1),p=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++p;for(var d=n.clone(),c=t.clone();!t.isZero();){for(var u=0,l=1;0==(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)(a.isOdd()||A.isOdd())&&(a.iadd(d),A.isub(c)),a.iushrn(1),A.iushrn(1);for(var g=0,f=1;0==(n.words[0]&f)&&g<26;++g,f<<=1);if(g>0)for(n.iushrn(g);g-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(d),s.isub(c)),o.iushrn(1),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(o),A.isub(s)):(n.isub(t),o.isub(a),s.isub(A))}return{a:o,b:s,gcd:n.iushln(p)}},i.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,A=new i(1),o=new i(0),s=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var p=0,d=1;0==(t.words[0]&d)&&p<26;++p,d<<=1);if(p>0)for(t.iushrn(p);p-- >0;)A.isOdd()&&A.iadd(s),A.iushrn(1);for(var c=0,u=1;0==(n.words[0]&u)&&c<26;++c,u<<=1);if(c>0)for(n.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(n)>=0?(t.isub(n),A.isub(o)):(n.isub(t),o.isub(A))}return(a=0===t.cmpn(1)?A:o).cmpn(0)<0&&a.iadd(e),a},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var a=0;t.isEven()&&n.isEven();a++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var r=t.cmp(n);if(r<0){var A=t;t=n,n=A}else if(0===r||0===n.cmpn(1))break;t.isub(n)}return n.iushln(a)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,a=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=a,this;for(var A=a,i=n;0!==A&&i<this.length;i++){var o=0|this.words[i];A=(o+=A)>>>26,o&=67108863,this.words[i]=o}return 0!==A&&(this.words[i]=A,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:a<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var a=0|this.words[n],r=0|e.words[n];if(a!==r){a<r?t=-1:a>r&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new w(e)},i.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var C={k256:null,p224:null,p192:null,p25519:null};function B(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function E(){B.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){B.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function Q(){B.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function v(){B.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function D(e){w.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}B.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},B.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t<this.n?-1:n.ucmp(this.p);return 0===a?(n.words[0]=0,n.length=1):a>0?n.isub(this.p):n._strip(),n},B.prototype.split=function(e,t){e.iushrn(this.n,0,t)},B.prototype.imulK=function(e){return e.imul(this.k)},A(E,B),E.prototype.split=function(e,t){for(var n=Math.min(e.length,9),a=0;a<n;a++)t.words[a]=e.words[a];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var r=e.words[9];for(t.words[t.length++]=4194303&r,a=10;a<e.length;a++){var A=0|e.words[a];e.words[a-10]=(4194303&A)<<4|r>>>22,r=A}r>>>=22,e.words[a-10]=r,0===r&&e.length>10?e.length-=10:e.length-=9},E.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var a=0|e.words[n];t+=977*a,e.words[n]=67108863&t,t=64*a+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},A(b,B),A(Q,B),A(v,B),v.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var a=19*(0|e.words[n])+t,r=67108863&a;a>>>=26,e.words[n]=r,t=a}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(C[e])return C[e];var t;if("k256"===e)t=new E;else if("p224"===e)t=new b;else if("p192"===e)t=new Q;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new v}return C[e]=t,t},w.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},w.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},w.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(d(e,e.umod(this.m)._forceRed(this)),e)},w.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},w.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},w.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},w.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},w.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},w.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},w.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},w.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},w.prototype.isqr=function(e){return this.imul(e,e.clone())},w.prototype.sqr=function(e){return this.mul(e,e)},w.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new i(1)).iushrn(2);return this.pow(e,n)}for(var a=this.m.subn(1),A=0;!a.isZero()&&0===a.andln(1);)A++,a.iushrn(1);r(!a.isZero());var o=new i(1).toRed(this),s=o.redNeg(),p=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new i(2*d*d).toRed(this);0!==this.pow(d,p).cmp(s);)d.redIAdd(s);for(var c=this.pow(d,a),u=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),g=A;0!==l.cmp(o);){for(var f=l,I=0;0!==f.cmp(o);I++)f=f.redSqr();r(I<g);var h=this.pow(c,new i(1).iushln(g-I-1));u=u.redMul(h),c=h.redSqr(),l=l.redMul(c),g=I}return u},w.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},w.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=e;for(var a=2;a<n.length;a++)n[a]=this.mul(n[a-1],e);var r=n[0],A=0,o=0,s=t.bitLength()%26;for(0===s&&(s=26),a=t.length-1;a>=0;a--){for(var p=t.words[a],d=s-1;d>=0;d--){var c=p>>d&1;r!==n[0]&&(r=this.sqr(r)),0!==c||0!==A?(A<<=1,A|=c,(4===++o||0===a&&0===d)&&(r=this.mul(r,n[A]),o=0,A=0)):o=0}s=26}return r},w.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},w.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new D(e)},A(D,w),D.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},D.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},D.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),a=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),r=n.isub(a).iushrn(this.shift),A=r;return r.cmp(this.m)>=0?A=r.isub(this.m):r.cmpn(0)<0&&(A=r.iadd(this.m)),A._forceRed(this)},D.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),a=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),r=n.isub(a).iushrn(this.shift),A=r;return r.cmp(this.m)>=0?A=r.isub(this.m):r.cmpn(0)<0&&(A=r.iadd(this.m)),A._forceRed(this)},D.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,this)}).call(this,n(12)(e))},function(e,t){e.exports=require("crypto")},function(e,t,n){try{var a=n(41);if("function"!=typeof a.inherits)throw"";e.exports=a.inherits}catch(t){e.exports=n(170)}},function(e,t,n){"use strict";function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var A=r(n(0));function i(e,t,n){Object.defineProperty(e,t,{enumerable:!0,value:n,writable:!1})}function o(e,t){return e&&e._ethersType===t}t.defineReadOnly=i,t.setType=function(e,t){Object.defineProperty(e,"_ethersType",{configurable:!1,value:t,writable:!1})},t.isType=o,t.resolveProperties=function(e){var t={},n=[];return Object.keys(e).forEach((function(a){var r=e[a];r instanceof Promise?n.push(r.then((function(e){return t[a]=e,null}))):t[a]=r})),Promise.all(n).then((function(){return t}))},t.checkProperties=function(e,t){e&&"object"===a(e)||A.throwError("invalid object",A.INVALID_ARGUMENT,{argument:"object",value:e}),Object.keys(e).forEach((function(n){t[n]||A.throwError("invalid object key - "+n,A.INVALID_ARGUMENT,{argument:"transaction",value:e,key:n})}))},t.shallowCopy=function(e){var t={};for(var n in e)t[n]=e[n];return t};var s={boolean:!0,number:!0,string:!0};t.deepCopy=function e(t,n){if(null==t||s[a(t)])return t;if(Array.isArray(t)){var r=t.map((function(t){return e(t,n)}));return n&&Object.freeze(r),r}if("object"===a(t)){if(o(t,"BigNumber"))return t;if(o(t,"Description"))return t;if(o(t,"Indexed"))return t;r={};for(var A in t){var p=t[A];void 0!==p&&i(r,A,e(p,n))}return n&&Object.freeze(r),r}if("function"==typeof t)return t;throw new Error("Cannot deepCopy "+a(t))},t.inheritable=function e(t){return function(n){var a,r;r=t,(a=n).super_=r,a.prototype=Object.create(r.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),i(n,"inherits",e(n))}}},function(e,t,n){e.exports=n(162)},function(e,t){e.exports=require("stream")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a,r=n(31),A=n(0),i=n(1);function o(e,t){void 0===t&&(t=a.current),t!=a.current&&(A.checkNormalize(),e=e.normalize(t));for(var n=[],r=0;r<e.length;r++){var o=e.charCodeAt(r);if(o<128)n.push(o);else if(o<2048)n.push(o>>6|192),n.push(63&o|128);else if(55296==(64512&o)){r++;var s=e.charCodeAt(r);if(r>=e.length||56320!=(64512&s))throw new Error("invalid utf-8 string");o=65536+((1023&o)<<10)+(1023&s),n.push(o>>18|240),n.push(o>>12&63|128),n.push(o>>6&63|128),n.push(63&o|128)}else n.push(o>>12|224),n.push(o>>6&63|128),n.push(63&o|128)}return i.arrayify(n)}function s(e,t){e=i.arrayify(e);for(var n="",a=0;a<e.length;){var r=e[a++];if(r>>7!=0){var A=null,o=null;if(192==(224&r))A=1,o=127;else if(224==(240&r))A=2,o=2047;else{if(240!=(248&r)){if(!t){if(128==(192&r))throw new Error("invalid utf8 byte sequence; unexpected continuation byte");throw new Error("invalid utf8 byte sequence; invalid prefix")}continue}A=3,o=65535}if(a+A>e.length){if(!t)throw new Error("invalid utf8 byte sequence; too short");for(;a<e.length&&e[a]>>6==2;a++);}else{for(var s=r&(1<<8-A-1)-1,p=0;p<A;p++){var d=e[a];if(128!=(192&d)){s=null;break}s=s<<6|63&d,a++}if(null!==s)if(s<=o){if(!t)throw new Error("invalid utf8 byte sequence; overlong")}else if(s>1114111){if(!t)throw new Error("invalid utf8 byte sequence; out-of-range")}else if(s>=55296&&s<=57343){if(!t)throw new Error("invalid utf8 byte sequence; utf-16 surrogate")}else s<=65535?n+=String.fromCharCode(s):(s-=65536,n+=String.fromCharCode(55296+(s>>10&1023),56320+(1023&s)));else if(!t)throw new Error("invalid utf8 byte sequence; invalid continuation byte")}}else n+=String.fromCharCode(r)}return n}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(a=t.UnicodeNormalizationForm||(t.UnicodeNormalizationForm={})),t.toUtf8Bytes=o,t.toUtf8String=s,t.formatBytes32String=function(e){var t=o(e);if(t.length>31)throw new Error("bytes32 string must be less than 32 bytes");return i.hexlify(i.concat([t,r.HashZero]).slice(0,32))},t.parseBytes32String=function(e){var t=i.arrayify(e);if(32!==t.length)throw new Error("invalid bytes32 - not 32 bytes long");if(0!==t[31])throw new Error("invalid bytes32 string - no null terminator");for(var n=31;0===t[n-1];)n--;return s(t.slice(0,n))}},function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=n,n.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)}},function(e,t,n){var a=n(28),r=a.Buffer;function A(e,t){for(var n in e)t[n]=e[n]}function i(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=a:(A(a,t),t.Buffer=i),i.prototype=Object.create(r.prototype),A(r,i),i.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},i.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var a=r(e);return void 0!==t?"string"==typeof n?a.fill(t,n):a.fill(t):a.fill(0),a},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a.SlowBuffer(e)}},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";var a=t,r=n(2),A=n(9),i=n(72);a.assert=A,a.toArray=i.toArray,a.zero2=i.zero2,a.toHex=i.toHex,a.encode=i.encode,a.getNAF=function(e,t,n){var a=new Array(Math.max(e.bitLength(),n)+1);a.fill(0);for(var r=1<<t+1,A=e.clone(),i=0;i<a.length;i++){var o,s=A.andln(r-1);A.isOdd()?(o=s>(r>>1)-1?(r>>1)-s:s,A.isubn(o)):o=0,a[i]=o,A.iushrn(1)}return a},a.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var a=0,r=0;e.cmpn(-a)>0||t.cmpn(-r)>0;){var A,i,o,s=e.andln(3)+a&3,p=t.andln(3)+r&3;if(3===s&&(s=-1),3===p&&(p=-1),0==(1&s))A=0;else A=3!==(o=e.andln(7)+a&7)&&5!==o||2!==p?s:-s;if(n[0].push(A),0==(1&p))i=0;else i=3!==(o=t.andln(7)+r&7)&&5!==o||2!==s?p:-p;n[1].push(i),2*a===A+1&&(a=1-a),2*r===i+1&&(r=1-r),e.iushrn(1),t.iushrn(1)}return n},a.cachedProperty=function(e,t,n){var a="_"+t;e.prototype[t]=function(){return void 0!==this[a]?this[a]:this[a]=n.call(this)}},a.parseBytes=function(e){return"string"==typeof e?a.toArray(e,"hex"):e},a.intFromLE=function(e){return new r(e,"hex","le")}},function(e,t,n){"use strict";var a=t,r=n(2),A=n(9),i=n(72);a.assert=A,a.toArray=i.toArray,a.zero2=i.zero2,a.toHex=i.toHex,a.encode=i.encode,a.getNAF=function(e,t,n){var a=new Array(Math.max(e.bitLength(),n)+1);a.fill(0);for(var r=1<<t+1,A=e.clone(),i=0;i<a.length;i++){var o,s=A.andln(r-1);A.isOdd()?(o=s>(r>>1)-1?(r>>1)-s:s,A.isubn(o)):o=0,a[i]=o,A.iushrn(1)}return a},a.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var a,r=0,A=0;e.cmpn(-r)>0||t.cmpn(-A)>0;){var i,o,s=e.andln(3)+r&3,p=t.andln(3)+A&3;3===s&&(s=-1),3===p&&(p=-1),i=0==(1&s)?0:3!==(a=e.andln(7)+r&7)&&5!==a||2!==p?s:-s,n[0].push(i),o=0==(1&p)?0:3!==(a=t.andln(7)+A&7)&&5!==a||2!==s?p:-p,n[1].push(o),2*r===i+1&&(r=1-r),2*A===o+1&&(A=1-A),e.iushrn(1),t.iushrn(1)}return n},a.cachedProperty=function(e,t,n){var a="_"+t;e.prototype[t]=function(){return void 0!==this[a]?this[a]:this[a]=n.call(this)}},a.parseBytes=function(e){return"string"==typeof e?a.toArray(e,"hex"):e},a.intFromLE=function(e){return new r(e,"hex","le")}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var A=a(n(2)),i=n(1),o=n(5),s=r(n(0)),p=new A.default.BN(-1);function d(e){var t=e.toString(16);return"-"===t[0]?t.length%2==0?"-0x0"+t.substring(1):"-0x"+t.substring(1):t.length%2==1?"0x0"+t:"0x"+t}function c(e){return l(f(e))}function u(e){return new g(d(e))}function l(e){var t=e._hex;return"-"===t[0]?new A.default.BN(t.substring(3),16).mul(p):new A.default.BN(t.substring(2),16)}var g=function(){function e(t){if(s.checkNew(this,e),o.setType(this,"BigNumber"),"string"==typeof t)i.isHexString(t)?("0x"==t&&(t="0x0"),o.defineReadOnly(this,"_hex",t)):"-"===t[0]&&i.isHexString(t.substring(1))?o.defineReadOnly(this,"_hex",t):t.match(/^-?[0-9]*$/)?(""==t&&(t="0"),o.defineReadOnly(this,"_hex",d(new A.default.BN(t)))):s.throwError("invalid BigNumber string value",s.INVALID_ARGUMENT,{arg:"value",value:t});else if("number"==typeof t){parseInt(String(t))!==t&&s.throwError("underflow",s.NUMERIC_FAULT,{operation:"setValue",fault:"underflow",value:t,outputValue:parseInt(String(t))});try{o.defineReadOnly(this,"_hex",d(new A.default.BN(t)))}catch(e){s.throwError("overflow",s.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:e.message})}}else t instanceof e?o.defineReadOnly(this,"_hex",t._hex):t.toHexString?o.defineReadOnly(this,"_hex",d(c(t.toHexString()))):t._hex&&i.isHexString(t._hex)?o.defineReadOnly(this,"_hex",t._hex):i.isArrayish(t)?o.defineReadOnly(this,"_hex",d(new A.default.BN(i.hexlify(t).substring(2),16))):s.throwError("invalid BigNumber value",s.INVALID_ARGUMENT,{arg:"value",value:t})}return e.prototype.fromTwos=function(e){return u(l(this).fromTwos(e))},e.prototype.toTwos=function(e){return u(l(this).toTwos(e))},e.prototype.abs=function(){return"-"===this._hex[0]?u(l(this).mul(p)):this},e.prototype.add=function(e){return u(l(this).add(c(e)))},e.prototype.sub=function(e){return u(l(this).sub(c(e)))},e.prototype.div=function(e){return f(e).isZero()&&s.throwError("division by zero",s.NUMERIC_FAULT,{operation:"divide",fault:"division by zero"}),u(l(this).div(c(e)))},e.prototype.mul=function(e){return u(l(this).mul(c(e)))},e.prototype.mod=function(e){return u(l(this).mod(c(e)))},e.prototype.pow=function(e){return u(l(this).pow(c(e)))},e.prototype.maskn=function(e){return u(l(this).maskn(e))},e.prototype.eq=function(e){return l(this).eq(c(e))},e.prototype.lt=function(e){return l(this).lt(c(e))},e.prototype.lte=function(e){return l(this).lte(c(e))},e.prototype.gt=function(e){return l(this).gt(c(e))},e.prototype.gte=function(e){return l(this).gte(c(e))},e.prototype.isZero=function(){return l(this).isZero()},e.prototype.toNumber=function(){try{return l(this).toNumber()}catch(e){s.throwError("overflow",s.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:e.message})}return null},e.prototype.toString=function(){return l(this).toString(10)},e.prototype.toHexString=function(){return this._hex},e.isBigNumber=function(e){return o.isType(e,"BigNumber")},e}();function f(e){return g.isBigNumber(e)?e:new g(e)}t.BigNumber=g,t.bigNumberify=f},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(2)),A=n(1),i=n(22),o=n(48),s=n(0);function p(e){"string"==typeof e&&e.match(/^0x[0-9A-Fa-f]{40}$/)||s.throwError("invalid address",s.INVALID_ARGUMENT,{arg:"address",value:e});for(var t=(e=e.toLowerCase()).substring(2).split(""),n=new Uint8Array(40),a=0;a<40;a++)n[a]=t[a].charCodeAt(0);n=A.arrayify(i.keccak256(n));for(var r=0;r<40;r+=2)n[r>>1]>>4>=8&&(t[r]=t[r].toUpperCase()),(15&n[r>>1])>=8&&(t[r+1]=t[r+1].toUpperCase());return"0x"+t.join("")}for(var d={},c=0;c<10;c++)d[String(c)]=String(c);for(c=0;c<26;c++)d[String.fromCharCode(65+c)]=String(10+c);var u,l=Math.floor((u=9007199254740991,Math.log10?Math.log10(u):Math.log(u)/Math.LN10));function g(e){e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00";var t="";for(e.split("").forEach((function(e){t+=d[e]}));t.length>=l;){var n=t.substring(0,l);t=parseInt(n,10)%97+t.substring(n.length)}for(var a=String(98-parseInt(t,10)%97);a.length<2;)a="0"+a;return a}function f(e){var t=null;if("string"!=typeof e&&s.throwError("invalid address",s.INVALID_ARGUMENT,{arg:"address",value:e}),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=p(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&s.throwError("bad address checksum",s.INVALID_ARGUMENT,{arg:"address",value:e});else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==g(e)&&s.throwError("bad icap checksum",s.INVALID_ARGUMENT,{arg:"address",value:e}),t=new r.default.BN(e.substring(4),36).toString(16);t.length<40;)t="0"+t;t=p("0x"+t)}else s.throwError("invalid address",s.INVALID_ARGUMENT,{arg:"address",value:e});return t}t.getAddress=f,t.getIcapAddress=function(e){for(var t=new r.default.BN(f(e).substring(2),16).toString(36).toUpperCase();t.length<30;)t="0"+t;return"XE"+g("XE00"+t)+t},t.getContractAddress=function(e){if(!e.from)throw new Error("missing from address");var t=e.nonce;return f("0x"+i.keccak256(o.encode([f(e.from),A.stripZeros(A.hexlify(t))])).substring(26))},t.getCreate2Address=function(e){var t=e.initCodeHash;e.initCode&&(t?i.keccak256(e.initCode)!==t&&s.throwError("initCode/initCodeHash mismatch",s.INVALID_ARGUMENT,{arg:"options",value:e}):t=i.keccak256(e.initCode)),t||s.throwError("missing initCode or initCodeHash",s.INVALID_ARGUMENT,{arg:"options",value:e});var n=f(e.from),a=A.arrayify(e.salt);return 32!==a.length&&s.throwError("invalid salt",s.INVALID_ARGUMENT,{arg:"options",value:e}),f("0x"+i.keccak256(A.concat(["0xff",n,a,t])).substring(26))}},function(e,t,n){"use strict";var a=n(9),r=n(4);function A(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function i(e){return 1===e.length?"0"+e:e}function o(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=r,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),a=0;a<e.length;a+=2)n.push(parseInt(e[a]+e[a+1],16))}else for(var a=0;a<e.length;a++){var r=e.charCodeAt(a),A=r>>8,i=255&r;A?n.push(A,i):n.push(i)}else for(a=0;a<e.length;a++)n[a]=0|e[a];return n},t.toHex=function(e){for(var t="",n=0;n<e.length;n++)t+=i(e[n].toString(16));return t},t.htonl=A,t.toHex32=function(e,t){for(var n="",a=0;a<e.length;a++){var r=e[a];"little"===t&&(r=A(r)),n+=o(r.toString(16))}return n},t.zero2=i,t.zero8=o,t.join32=function(e,t,n,r){var A=n-t;a(A%4==0);for(var i=new Array(A/4),o=0,s=t;o<i.length;o++,s+=4){var p;p="big"===r?e[s]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3]:e[s+3]<<24|e[s+2]<<16|e[s+1]<<8|e[s],i[o]=p>>>0}return i},t.split32=function(e,t){for(var n=new Array(4*e.length),a=0,r=0;a<e.length;a++,r+=4){var A=e[a];"big"===t?(n[r]=A>>>24,n[r+1]=A>>>16&255,n[r+2]=A>>>8&255,n[r+3]=255&A):(n[r+3]=A>>>24,n[r+2]=A>>>16&255,n[r+1]=A>>>8&255,n[r]=255&A)}return n},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<<t|e>>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,n){return e+t+n>>>0},t.sum32_4=function(e,t,n,a){return e+t+n+a>>>0},t.sum32_5=function(e,t,n,a,r){return e+t+n+a+r>>>0},t.sum64=function(e,t,n,a){var r=e[t],A=a+e[t+1]>>>0,i=(A<a?1:0)+n+r;e[t]=i>>>0,e[t+1]=A},t.sum64_hi=function(e,t,n,a){return(t+a>>>0<t?1:0)+e+n>>>0},t.sum64_lo=function(e,t,n,a){return t+a>>>0},t.sum64_4_hi=function(e,t,n,a,r,A,i,o){var s=0,p=t;return s+=(p=p+a>>>0)<t?1:0,s+=(p=p+A>>>0)<A?1:0,e+n+r+i+(s+=(p=p+o>>>0)<o?1:0)>>>0},t.sum64_4_lo=function(e,t,n,a,r,A,i,o){return t+a+A+o>>>0},t.sum64_5_hi=function(e,t,n,a,r,A,i,o,s,p){var d=0,c=t;return d+=(c=c+a>>>0)<t?1:0,d+=(c=c+A>>>0)<A?1:0,d+=(c=c+o>>>0)<o?1:0,e+n+r+i+s+(d+=(c=c+p>>>0)<p?1:0)>>>0},t.sum64_5_lo=function(e,t,n,a,r,A,i,o,s,p){return t+a+A+o+p>>>0},t.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},t.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},t.shr64_hi=function(e,t,n){return e>>>n},t.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0}},function(e,t,n){"use strict";var a=n(9),r=n(4);function A(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function i(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function o(e){return 1===e.length?"0"+e:e}function s(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=r,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16))}else for(var a=0,r=0;r<e.length;r++){var i=e.charCodeAt(r);i<128?n[a++]=i:i<2048?(n[a++]=i>>6|192,n[a++]=63&i|128):A(e,r)?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++r)),n[a++]=i>>18|240,n[a++]=i>>12&63|128,n[a++]=i>>6&63|128,n[a++]=63&i|128):(n[a++]=i>>12|224,n[a++]=i>>6&63|128,n[a++]=63&i|128)}else for(r=0;r<e.length;r++)n[r]=0|e[r];return n},t.toHex=function(e){for(var t="",n=0;n<e.length;n++)t+=o(e[n].toString(16));return t},t.htonl=i,t.toHex32=function(e,t){for(var n="",a=0;a<e.length;a++){var r=e[a];"little"===t&&(r=i(r)),n+=s(r.toString(16))}return n},t.zero2=o,t.zero8=s,t.join32=function(e,t,n,r){var A=n-t;a(A%4==0);for(var i=new Array(A/4),o=0,s=t;o<i.length;o++,s+=4){var p;p="big"===r?e[s]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3]:e[s+3]<<24|e[s+2]<<16|e[s+1]<<8|e[s],i[o]=p>>>0}return i},t.split32=function(e,t){for(var n=new Array(4*e.length),a=0,r=0;a<e.length;a++,r+=4){var A=e[a];"big"===t?(n[r]=A>>>24,n[r+1]=A>>>16&255,n[r+2]=A>>>8&255,n[r+3]=255&A):(n[r+3]=A>>>24,n[r+2]=A>>>16&255,n[r+1]=A>>>8&255,n[r]=255&A)}return n},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<<t|e>>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,n){return e+t+n>>>0},t.sum32_4=function(e,t,n,a){return e+t+n+a>>>0},t.sum32_5=function(e,t,n,a,r){return e+t+n+a+r>>>0},t.sum64=function(e,t,n,a){var r=e[t],A=a+e[t+1]>>>0,i=(A<a?1:0)+n+r;e[t]=i>>>0,e[t+1]=A},t.sum64_hi=function(e,t,n,a){return(t+a>>>0<t?1:0)+e+n>>>0},t.sum64_lo=function(e,t,n,a){return t+a>>>0},t.sum64_4_hi=function(e,t,n,a,r,A,i,o){var s=0,p=t;return s+=(p=p+a>>>0)<t?1:0,s+=(p=p+A>>>0)<A?1:0,e+n+r+i+(s+=(p=p+o>>>0)<o?1:0)>>>0},t.sum64_4_lo=function(e,t,n,a,r,A,i,o){return t+a+A+o>>>0},t.sum64_5_hi=function(e,t,n,a,r,A,i,o,s,p){var d=0,c=t;return d+=(c=c+a>>>0)<t?1:0,d+=(c=c+A>>>0)<A?1:0,d+=(c=c+o>>>0)<o?1:0,e+n+r+i+s+(d+=(c=c+p>>>0)<p?1:0)>>>0},t.sum64_5_lo=function(e,t,n,a,r,A,i,o,s,p){return t+a+A+o+p>>>0},t.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},t.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},t.shr64_hi=function(e,t,n){return e>>>n},t.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}e.exports=function(e,t,a){return t&&n(e.prototype,t),a&&n(e,a),e}},function(e,t,n){"use strict";var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(97));t.ethers=r,function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(97))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(164),r=n(1);t.keccak256=function(e){return"0x"+a.keccak_256(r.arrayify(e))}},function(e,t,n){"use strict";var a=n(113),r=n(222),A={ftp:21,file:null,gopher:70,http:80,https:443,ws:80,wss:443},i=Symbol("failure");function o(e){return a.ucs2.decode(e).length}function s(e,t){var n=e[t];return isNaN(n)?void 0:String.fromCodePoint(n)}function p(e){return e>=48&&e<=57}function d(e){return e>=65&&e<=90||e>=97&&e<=122}function c(e){return p(e)||e>=65&&e<=70||e>=97&&e<=102}function u(e){return"."===e||"%2e"===e.toLowerCase()}function l(e){return 2===e.length&&d(e.codePointAt(0))&&(":"===e[1]||"|"===e[1])}function g(e){return void 0!==A[e]}function f(e){return g(e.scheme)}function I(e){var t=e.toString(16).toUpperCase();return 1===t.length&&(t="0"+t),"%"+t}function h(e){return e<=31||e>126}var y=new Set([32,34,35,60,62,63,96,123,125]);function m(e){return h(e)||y.has(e)}var C=new Set([47,58,59,61,64,91,92,93,94,124]);function B(e){return m(e)||C.has(e)}function E(e,t){var n=String.fromCodePoint(e);return t(e)?function(e){for(var t=new Buffer(e),n="",a=0;a<t.length;++a)n+=I(t[a]);return n}(n):n}function b(e){var t=10;return e.length>=2&&"0"===e.charAt(0)&&"x"===e.charAt(1).toLowerCase()?(e=e.substring(2),t=16):e.length>=2&&"0"===e.charAt(0)&&(e=e.substring(1),t=8),""===e?0:(10===t?/[^0-9]/:16===t?/[^0-9A-Fa-f]/:/[^0-7]/).test(e)?i:parseInt(e,t)}function Q(e,t){if("["===e[0])return"]"!==e[e.length-1]?i:function(e){var t=[0,0,0,0,0,0,0,0],n=0,r=null,A=0;if(58===(e=a.ucs2.decode(e))[A]){if(58!==e[A+1])return i;A+=2,r=++n}for(;A<e.length;){if(8===n)return i;if(58!==e[A]){for(var o=0,d=0;d<4&&c(e[A]);)o=16*o+parseInt(s(e,A),16),++A,++d;if(46===e[A]){if(0===d)return i;if(A-=d,n>6)return i;for(var u=0;void 0!==e[A];){var l=null;if(u>0){if(!(46===e[A]&&u<4))return i;++A}if(!p(e[A]))return i;for(;p(e[A]);){var g=parseInt(s(e,A));if(null===l)l=g;else{if(0===l)return i;l=10*l+g}if(l>255)return i;++A}t[n]=256*t[n]+l,2!==++u&&4!==u||++n}if(4!==u)return i;break}if(58===e[A]){if(void 0===e[++A])return i}else if(void 0!==e[A])return i;t[n]=o,++n}else{if(null!==r)return i;++A,r=++n}}if(null!==r){var f=n-r;for(n=7;0!==n&&f>0;){var I=t[r+f-1];t[r+f-1]=t[n],t[n]=I,--n,--f}}else if(null===r&&8!==n)return i;return t}(e.substring(1,e.length-1));if(!t)return function(e){if(t=e,-1!==t.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/))return i;var t;for(var n="",r=a.ucs2.decode(e),A=0;A<r.length;++A)n+=E(r[A],h);return n}(e);var n=function(e){for(var t=new Buffer(e),n=[],a=0;a<t.length;++a)37!==t[a]?n.push(t[a]):37===t[a]&&c(t[a+1])&&c(t[a+2])?(n.push(parseInt(t.slice(a+1,a+3).toString(),16)),a+=2):n.push(t[a]);return new Buffer(n).toString()}(e),A=r.toASCII(n,!1,r.PROCESSING_OPTIONS.NONTRANSITIONAL,!1);if(null===A)return i;if(-1!==A.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/))return i;var o=function(e){var t=e.split(".");if(""===t[t.length-1]&&t.length>1&&t.pop(),t.length>4)return e;var n=[],a=!0,r=!1,A=void 0;try{for(var o,s=t[Symbol.iterator]();!(a=(o=s.next()).done);a=!0){var p=o.value;if(""===p)return e;var d=b(p);if(d===i)return e;n.push(d)}}catch(e){r=!0,A=e}finally{try{a||null==s.return||s.return()}finally{if(r)throw A}}for(var c=0;c<n.length-1;++c)if(n[c]>255)return i;if(n[n.length-1]>=Math.pow(256,5-n.length))return i;for(var u=n.pop(),l=0,g=0,f=n;g<f.length;g++){u+=f[g]*Math.pow(256,3-l),++l}return u}(A);return"number"==typeof o||o===i?o:A}function v(e){return"number"==typeof e?function(e){for(var t="",n=e,a=1;a<=4;++a)t=String(n%256)+t,4!==a&&(t="."+t),n=Math.floor(n/256);return t}(e):e instanceof Array?"["+function(e){for(var t="",n=function(e){for(var t=null,n=1,a=null,r=0,A=0;A<e.length;++A)0!==e[A]?(r>n&&(t=a,n=r),a=null,r=0):(null===a&&(a=A),++r);r>n&&(t=a,n=r);return{idx:t,len:n}}(e).idx,a=!1,r=0;r<=7;++r){if(!a||0!==e[r])if(a&&(a=!1),n!==r)t+=e[r].toString(16),7!==r&&(t+=":");else t+=0===r?"::":":",a=!0}return t}(e)+"]":e}function w(e){var t,n=e.path;0!==n.length&&("file"===e.scheme&&1===n.length&&(t=n[0],/^[A-Za-z]:$/.test(t))||n.pop())}function D(e){return""!==e.username||""!==e.password}function M(e,t,n,r,A){if(this.pointer=0,this.input=e,this.base=t||null,this.encodingOverride=n||"utf-8",this.stateOverride=A,this.url=r,this.failure=!1,this.parseError=!1,!this.url){this.url={scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,cannotBeABaseURL:!1};var o=function(e){return e.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g,"")}(this.input);o!==this.input&&(this.parseError=!0),this.input=o}var s=function(e){return e.replace(/\u0009|\u000A|\u000D/g,"")}(this.input);for(s!==this.input&&(this.parseError=!0),this.input=s,this.state=A||"scheme start",this.buffer="",this.atFlag=!1,this.arrFlag=!1,this.passwordTokenSeenFlag=!1,this.input=a.ucs2.decode(this.input);this.pointer<=this.input.length;++this.pointer){var p=this.input[this.pointer],d=isNaN(p)?void 0:String.fromCodePoint(p),c=this["parse "+this.state](p,d);if(!c)break;if(c===i){this.failure=!0;break}}}M.prototype["parse scheme start"]=function(e,t){if(d(e))this.buffer+=t.toLowerCase(),this.state="scheme";else{if(this.stateOverride)return this.parseError=!0,i;this.state="no scheme",--this.pointer}return!0},M.prototype["parse scheme"]=function(e,t){if(function(e){return d(e)||p(e)}(e)||43===e||45===e||46===e)this.buffer+=t.toLowerCase();else if(58===e){if(this.stateOverride){if(f(this.url)&&!g(this.buffer))return!1;if(!f(this.url)&&g(this.buffer))return!1;if((D(this.url)||null!==this.url.port)&&"file"===this.buffer)return!1;if("file"===this.url.scheme&&(""===this.url.host||null===this.url.host))return!1}if(this.url.scheme=this.buffer,this.buffer="",this.stateOverride)return!1;"file"===this.url.scheme?(47===this.input[this.pointer+1]&&47===this.input[this.pointer+2]||(this.parseError=!0),this.state="file"):f(this.url)&&null!==this.base&&this.base.scheme===this.url.scheme?this.state="special relative or authority":f(this.url)?this.state="special authority slashes":47===this.input[this.pointer+1]?(this.state="path or authority",++this.pointer):(this.url.cannotBeABaseURL=!0,this.url.path.push(""),this.state="cannot-be-a-base-URL path")}else{if(this.stateOverride)return this.parseError=!0,i;this.buffer="",this.state="no scheme",this.pointer=-1}return!0},M.prototype["parse no scheme"]=function(e){return null===this.base||this.base.cannotBeABaseURL&&35!==e?i:(this.base.cannotBeABaseURL&&35===e?(this.url.scheme=this.base.scheme,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.url.cannotBeABaseURL=!0,this.state="fragment"):"file"===this.base.scheme?(this.state="file",--this.pointer):(this.state="relative",--this.pointer),!0)},M.prototype["parse special relative or authority"]=function(e){return 47===e&&47===this.input[this.pointer+1]?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="relative",--this.pointer),!0},M.prototype["parse path or authority"]=function(e){return 47===e?this.state="authority":(this.state="path",--this.pointer),!0},M.prototype["parse relative"]=function(e){return this.url.scheme=this.base.scheme,isNaN(e)?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query):47===e?this.state="relative slash":63===e?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query="",this.state="query"):35===e?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.state="fragment"):f(this.url)&&92===e?(this.parseError=!0,this.state="relative slash"):(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(0,this.base.path.length-1),this.state="path",--this.pointer),!0},M.prototype["parse relative slash"]=function(e){return!f(this.url)||47!==e&&92!==e?47===e?this.state="authority":(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.state="path",--this.pointer):(92===e&&(this.parseError=!0),this.state="special authority ignore slashes"),!0},M.prototype["parse special authority slashes"]=function(e){return 47===e&&47===this.input[this.pointer+1]?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="special authority ignore slashes",--this.pointer),!0},M.prototype["parse special authority ignore slashes"]=function(e){return 47!==e&&92!==e?(this.state="authority",--this.pointer):this.parseError=!0,!0},M.prototype["parse authority"]=function(e,t){if(64===e){this.parseError=!0,this.atFlag&&(this.buffer="%40"+this.buffer),this.atFlag=!0;for(var n=o(this.buffer),a=0;a<n;++a){var r=this.buffer.codePointAt(a);if(58!==r||this.passwordTokenSeenFlag){var A=E(r,B);this.passwordTokenSeenFlag?this.url.password+=A:this.url.username+=A}else this.passwordTokenSeenFlag=!0}this.buffer=""}else if(isNaN(e)||47===e||63===e||35===e||f(this.url)&&92===e){if(this.atFlag&&""===this.buffer)return this.parseError=!0,i;this.pointer-=o(this.buffer)+1,this.buffer="",this.state="host"}else this.buffer+=t;return!0},M.prototype["parse hostname"]=M.prototype["parse host"]=function(e,t){if(this.stateOverride&&"file"===this.url.scheme)--this.pointer,this.state="file host";else if(58!==e||this.arrFlag)if(isNaN(e)||47===e||63===e||35===e||f(this.url)&&92===e){if(--this.pointer,f(this.url)&&""===this.buffer)return this.parseError=!0,i;if(this.stateOverride&&""===this.buffer&&(D(this.url)||null!==this.url.port))return this.parseError=!0,!1;var n=Q(this.buffer,f(this.url));if(n===i)return i;if(this.url.host=n,this.buffer="",this.state="path start",this.stateOverride)return!1}else 91===e?this.arrFlag=!0:93===e&&(this.arrFlag=!1),this.buffer+=t;else{if(""===this.buffer)return this.parseError=!0,i;var a=Q(this.buffer,f(this.url));if(a===i)return i;if(this.url.host=a,this.buffer="",this.state="port","hostname"===this.stateOverride)return!1}return!0},M.prototype["parse port"]=function(e,t){if(p(e))this.buffer+=t;else{if(!(isNaN(e)||47===e||63===e||35===e||f(this.url)&&92===e||this.stateOverride))return this.parseError=!0,i;if(""!==this.buffer){var n=parseInt(this.buffer);if(n>Math.pow(2,16)-1)return this.parseError=!0,i;this.url.port=n===(a=this.url.scheme,A[a])?null:n,this.buffer=""}if(this.stateOverride)return!1;this.state="path start",--this.pointer}var a;return!0};var S=new Set([47,92,63,35]);M.prototype["parse file"]=function(e){var t,n;return this.url.scheme="file",47===e||92===e?(92===e&&(this.parseError=!0),this.state="file slash"):null!==this.base&&"file"===this.base.scheme?isNaN(e)?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query):63===e?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query="",this.state="query"):35===e?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.state="fragment"):(this.input.length-this.pointer-1==0||(t=e,n=this.input[this.pointer+1],!d(t)||58!==n&&124!==n)||this.input.length-this.pointer-1>=2&&!S.has(this.input[this.pointer+2])?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),w(this.url)):this.parseError=!0,this.state="path",--this.pointer):(this.state="path",--this.pointer),!0},M.prototype["parse file slash"]=function(e){var t;return 47===e||92===e?(92===e&&(this.parseError=!0),this.state="file host"):(null!==this.base&&"file"===this.base.scheme&&(2===(t=this.base.path[0]).length&&d(t.codePointAt(0))&&":"===t[1]?this.url.path.push(this.base.path[0]):this.url.host=this.base.host),this.state="path",--this.pointer),!0},M.prototype["parse file host"]=function(e,t){if(isNaN(e)||47===e||92===e||63===e||35===e)if(--this.pointer,!this.stateOverride&&l(this.buffer))this.parseError=!0,this.state="path";else if(""===this.buffer){if(this.url.host="",this.stateOverride)return!1;this.state="path start"}else{var n=Q(this.buffer,f(this.url));if(n===i)return i;if("localhost"===n&&(n=""),this.url.host=n,this.stateOverride)return!1;this.buffer="",this.state="path start"}else this.buffer+=t;return!0},M.prototype["parse path start"]=function(e){return f(this.url)?(92===e&&(this.parseError=!0),this.state="path",47!==e&&92!==e&&--this.pointer):this.stateOverride||63!==e?this.stateOverride||35!==e?void 0!==e&&(this.state="path",47!==e&&--this.pointer):(this.url.fragment="",this.state="fragment"):(this.url.query="",this.state="query"),!0},M.prototype["parse path"]=function(e){if(isNaN(e)||47===e||f(this.url)&&92===e||!this.stateOverride&&(63===e||35===e)){if(f(this.url)&&92===e&&(this.parseError=!0),".."===(t=(t=this.buffer).toLowerCase())||"%2e."===t||".%2e"===t||"%2e%2e"===t?(w(this.url),47===e||f(this.url)&&92===e||this.url.path.push("")):!u(this.buffer)||47===e||f(this.url)&&92===e?u(this.buffer)||("file"===this.url.scheme&&0===this.url.path.length&&l(this.buffer)&&(""!==this.url.host&&null!==this.url.host&&(this.parseError=!0,this.url.host=""),this.buffer=this.buffer[0]+":"),this.url.path.push(this.buffer)):this.url.path.push(""),this.buffer="","file"===this.url.scheme&&(void 0===e||63===e||35===e))for(;this.url.path.length>1&&""===this.url.path[0];)this.parseError=!0,this.url.path.shift();63===e&&(this.url.query="",this.state="query"),35===e&&(this.url.fragment="",this.state="fragment")}else 37!==e||c(this.input[this.pointer+1])&&c(this.input[this.pointer+2])||(this.parseError=!0),this.buffer+=E(e,m);var t;return!0},M.prototype["parse cannot-be-a-base-URL path"]=function(e){return 63===e?(this.url.query="",this.state="query"):35===e?(this.url.fragment="",this.state="fragment"):(isNaN(e)||37===e||(this.parseError=!0),37!==e||c(this.input[this.pointer+1])&&c(this.input[this.pointer+2])||(this.parseError=!0),isNaN(e)||(this.url.path[0]=this.url.path[0]+E(e,h))),!0},M.prototype["parse query"]=function(e,t){if(isNaN(e)||!this.stateOverride&&35===e){f(this.url)&&"ws"!==this.url.scheme&&"wss"!==this.url.scheme||(this.encodingOverride="utf-8");for(var n=new Buffer(this.buffer),a=0;a<n.length;++a)n[a]<33||n[a]>126||34===n[a]||35===n[a]||60===n[a]||62===n[a]?this.url.query+=I(n[a]):this.url.query+=String.fromCodePoint(n[a]);this.buffer="",35===e&&(this.url.fragment="",this.state="fragment")}else 37!==e||c(this.input[this.pointer+1])&&c(this.input[this.pointer+2])||(this.parseError=!0),this.buffer+=t;return!0},M.prototype["parse fragment"]=function(e){return isNaN(e)||(0===e?this.parseError=!0:(37!==e||c(this.input[this.pointer+1])&&c(this.input[this.pointer+2])||(this.parseError=!0),this.url.fragment+=E(e,h))),!0},e.exports.serializeURL=function(e,t){var n=e.scheme+":";if(null!==e.host?(n+="//",""===e.username&&""===e.password||(n+=e.username,""!==e.password&&(n+=":"+e.password),n+="@"),n+=v(e.host),null!==e.port&&(n+=":"+e.port)):null===e.host&&"file"===e.scheme&&(n+="//"),e.cannotBeABaseURL)n+=e.path[0];else{var a=!0,r=!1,A=void 0;try{for(var i,o=e.path[Symbol.iterator]();!(a=(i=o.next()).done);a=!0){n+="/"+i.value}}catch(e){r=!0,A=e}finally{try{a||null==o.return||o.return()}finally{if(r)throw A}}}return null!==e.query&&(n+="?"+e.query),t||null===e.fragment||(n+="#"+e.fragment),n},e.exports.serializeURLOrigin=function(t){switch(t.scheme){case"blob":try{return e.exports.serializeURLOrigin(e.exports.parseURL(t.path[0]))}catch(e){return"null"}case"ftp":case"gopher":case"http":case"https":case"ws":case"wss":return n={scheme:t.scheme,host:t.host,port:t.port},a=n.scheme+"://",a+=v(n.host),null!==n.port&&(a+=":"+n.port),a;case"file":return"file://";default:return"null"}var n,a},e.exports.basicURLParse=function(e,t){void 0===t&&(t={});var n=new M(e,t.baseURL,t.encodingOverride,t.url,t.stateOverride);return n.failure?"failure":n.url},e.exports.setTheUsername=function(e,t){e.username="";for(var n=a.ucs2.decode(t),r=0;r<n.length;++r)e.username+=E(n[r],B)},e.exports.setThePassword=function(e,t){e.password="";for(var n=a.ucs2.decode(t),r=0;r<n.length;++r)e.password+=E(n[r],B)},e.exports.serializeHost=v,e.exports.cannotHaveAUsernamePasswordPort=function(e){return null===e.host||""===e.host||e.cannotBeABaseURL||"file"===e.scheme},e.exports.serializeInteger=function(e){return String(e)},e.exports.parseURL=function(t,n){return void 0===n&&(n={}),e.exports.basicURLParse(t,{baseURL:n.baseURL,encodingOverride:n.encodingOverride})}},function(e,t,n){var a=n(33),r=n(6),A=n(11),i=n(224),o=this;function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}"undefined"==typeof Buffer&&(Buffer=n(69).Buffer);var p=n(114),d=n(229).default,c=n(230),u=n(70),l=n(115),g=n(21).utils,f=g.keccak256,I=g.getAddress,h={name:"Utils",nullAddress:"0x0000000000000000000000000000000000000000",weiPerEther:new d("1000000000000000000"),ToBigNumber:function(e){return new d(e)},WeiToEther:function(e){return h.ToBigNumber(e).div(h.weiPerEther)},EtherToWei:function(e){return h.ToBigNumber(e).times(h.weiPerEther)},FormatAddress:function(e){return e&&"string"==typeof e?((e=e.trim()).startsWith("0x")||(e="0x"+e),e.toLowerCase()):""},FormatSignature:function(e){return e=e.replace("0x",""),"ES256K_"+p.encode(Buffer.from(e,"hex"))},DecodeVersionHash:function(e){if(!e.startsWith("hq__")&&!e.startsWith("tq__"))throw new Error('Invalid version hash: "'.concat(e,'"'));e=e.slice(4);var t=h.FromB58(e),n=t.slice(0,32),a=n.toString("hex");t=t.slice(32);for(var r=0;t[r]>=128;)r++;r++;var A=t.slice(0,r),i=c.decode(A);return t=t.slice(r),{digest:a,size:i,objectId:"iq__"+h.B58(t),partHash:"hqp_"+h.B58(Buffer.concat([n,A]))}},DecodeSignedToken:function(e){var t=h.FromB58(e.slice(6)),n="0x".concat(t.slice(0,65).toString("hex")),a=JSON.parse(Buffer.from(l.inflateRaw(t.slice(65))).toString("utf-8"));return a.adr=h.FormatAddress("0x".concat(Buffer.from(a.adr,"base64").toString("hex"))),{payload:a,signature:n}},DecodeWriteToken:function(e){if(e.length<4)throw new Error('Invalid write token: ["'.concat(e,'"] (unknown prefix)'));var t;if(e.startsWith("tqw__")?(t="tq__",e=e.slice(5)):(t=e.slice(0,4),e=e.slice(4)),0===e.length)throw new Error('Invalid write token: ["'.concat(e,'"] (too short)'));switch(t){case"tqw_":case"tq__":case"tqpw":case"tqp_":case"tlro":break;default:throw new Error('Invalid write token: ["'.concat(e,'"] (unknown prefix)'))}var n,a,r,A,i,o=h.FromB58(e);function s(e,t){var n,a,r=c.decode(o,0),A=c.decode.bytes;return a=e?0===(n=o.slice(A+1,r+A)).length?"":t+h.B58(n):"0x"+(n=o.slice(A,r+A)).toString("hex"),o=o.slice(r+A),a}switch(t){case"tqw_":case"tqpw":n="0x"+o.toString("hex");break;case"tlro":case"tq__":a=s(!0,"iq__"),r=s(!0,"inod"),n=s(!1,"");break;case"tqp_":if(o.length<3)throw new Error('Invalid write token: ["'.concat(e,'"] (token truncated)'));A=o[0],i=o[1],o=o.slice(2),n=s(!1,"");break;default:throw new Error('Invalid write token: ["'.concat(e,'"] (unknown prefix)'))}return{tokenType:t,tokenId:n,objectId:a,nodeId:r,scheme:A,flags:i}},AddressToHash:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e=e.replace(t?"0x04":"0x",""),p.encode(Buffer.from(e,"hex"))},AddressToSpaceId:function(e){return"ispc"+h.AddressToHash(e)},AddressToLibraryId:function(e){return"ilib"+h.AddressToHash(e)},AddressToObjectId:function(e){return"iq__"+h.AddressToHash(e)},HashToAddress:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e=t?e:e.substr(4),h.FormatAddress((t?"0x04":"0x")+p.decode(e).toString("hex"))},EqualAddress:function(e,t){return!(!e||!t)&&h.FormatAddress(e)===h.FormatAddress(t)},EqualHash:function(e,t){return!(!e||!t)&&(!(e.length<=4||t.length<=4)&&h.HashToAddress(e)===h.HashToAddress(t))},ValidAddress:function(e){try{return I(e),!0}catch(e){return o.Log(e),!1}},ValidHash:function(e){return h.ValidAddress(h.HashToAddress(e))},ToBytes32:function(e){return"0x"+e.split("").map((function(e){return e.charCodeAt(0).toString(16)})).join("").slice(0,64).padEnd(64,"0")},BufferToArrayBuffer:function(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)},B64:function(e){return Buffer.from(e,"utf-8").toString("base64")},FromB64:function(e){return Buffer.from(e,"base64").toString("utf-8")},FromB64URL:function(e){var t=(e=e.replace(/-/g,"+").replace(/_/g,"/")).length%4;if(t){if(1===t)throw new Error("InvalidLengthError: Input base64url string is the wrong length to determine padding");e+=new Array(5-t).join("=")}return h.FromB64(e)},B58:function(e){return p.encode(Buffer.from(e))},FromB58:function(e){return p.decode(e)},FromB58ToStr:function(e){return(new TextDecoder).decode(h.FromB58(e))},DecodeAuthorizationToken:function(e){var t=(e=decodeURIComponent(e)).split("."),n=i(t,2),a=n[0],r=n[1];return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){A(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},a=JSON.parse(h.FromB64(a)),{signature:r})},LimitedMap:function(e,t,n){var A,i,o,s,p;return r.async((function(d){for(;;)switch(d.prev=d.next){case 0:return A=0,i=!1,o=function(){var e;return r.async((function(t){for(;;)switch(t.prev=t.next){case 0:if(!i){t.next=5;break}return t.next=3,r.awrap(new Promise((function(e){return setTimeout(e,10)})));case 3:t.next=0;break;case 5:return i=!0,e=A,A+=1,i=!1,t.abrupt("return",e);case 10:case"end":return t.stop()}}))},s=[],p=0,d.abrupt("return",new Promise((function(A,i){a(Array(e||1)).forEach((function(){var e;return r.async((function(a){for(;;)switch(a.prev=a.next){case 0:return p+=1,a.next=3,r.awrap(o());case 3:e=a.sent;case 4:if(!(e<t.length)){a.next=19;break}return a.prev=5,a.next=8,r.awrap(n(t[e],e));case 8:s[e]=a.sent,a.next=14;break;case 11:a.prev=11,a.t0=a.catch(5),i(a.t0);case 14:return a.next=16,r.awrap(o());case 16:e=a.sent,a.next=4;break;case 19:0===(p-=1)&&A(s);case 21:case"end":return a.stop()}}),null,null,[[5,11]])}))})));case 6:case"end":return d.stop()}}))},ResponseToJson:function(e){return r.async((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",h.ResponseToFormat("json",e));case 1:case"end":return t.stop()}}))},ResponseToFormat:function(e,t){return r.async((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,r.awrap(t);case 2:t=n.sent,n.t0=e.toLowerCase(),n.next="json"===n.t0?6:"text"===n.t0?9:"blob"===n.t0?12:"arraybuffer"===n.t0?15:"formdata"===n.t0?18:"buffer"===n.t0?21:24;break;case 6:return n.next=8,r.awrap(t.json());case 8:return n.abrupt("return",n.sent);case 9:return n.next=11,r.awrap(t.text());case 11:return n.abrupt("return",n.sent);case 12:return n.next=14,r.awrap(t.blob());case 14:return n.abrupt("return",n.sent);case 15:return n.next=17,r.awrap(t.arrayBuffer());case 17:return n.abrupt("return",n.sent);case 18:return n.next=20,r.awrap(t.formData());case 20:return n.abrupt("return",n.sent);case 21:return n.next=23,r.awrap(t.buffer());case 23:return n.abrupt("return",n.sent);case 24:return n.abrupt("return",t);case 25:case"end":return n.stop()}}))},ResizeImage:function(e){var t=e.imageUrl,n=e.height;return!t||t&&!t.startsWith("http")?t:(t=u(t).removeSearch("height").removeSearch("header-x_image_height"),n&&!isNaN(parseInt(n))&&t.addSearch("height",parseInt(n)),t.toString())},SafeTraverse:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];if(!e)return e;1===n.length&&Array.isArray(n[0])&&(n=n[0]);for(var r=e,A=0;A<n.length;A++)if(void 0===(r=r[n[A]]))return;return r},IsCloneable:function(e){if(Object(e)!==e)return!0;switch({}.toString.call(e).slice(8,-1)){case"Boolean":case"Number":case"String":case"Date":case"RegExp":case"Blob":case"FileList":case"ImageData":case"ImageBitmap":case"ArrayBuffer":return!0;case"Array":case"Object":return Object.keys(e).every((function(t){return h.IsCloneable(e[t])}));case"Map":return a(e.keys()).every(h.IsCloneable)&&a(e.values()).every(h.IsCloneable);case"Set":return a(e.keys()).every(h.IsCloneable);default:return!1}},MakeClonable:function(e){if(h.IsCloneable(e))return e;if(Buffer.isBuffer(e))return h.BufferToArrayBuffer(e);switch({}.toString.call(e).slice(8,-1)){case"Response":case"Function":return;case"Boolean":case"Number":case"String":case"Date":case"RegExp":case"Blob":case"FileList":case"ImageData":case"ImageBitmap":case"ArrayBuffer":return e;case"Array":return e.map((function(e){return h.MakeClonable(e)}));case"Set":return new Set(Array.from(e.keys()).map((function(e){return h.MakeClonable(e)})));case"Map":var t=new Map;return Array.from(e.keys()).forEach((function(n){var a=h.MakeClonable(e.get(n));a&&t.set(n,a)})),t;case"Error":return e.message;case"Object":var n={};return Object.keys(e).map((function(t){var a=h.MakeClonable(e[t]);a&&(n[t]=a)})),n;default:return JSON.parse(JSON.stringify(e))}},PublicKeyToAddress:function(e){var t=new Uint8Array(Buffer.from(e.replace("0x04",""),"hex")),n="0x"+f(t).slice(26);return h.FormatAddress(n)},PLATFORM_NODE:"node",PLATFORM_WEB:"web",PLATFORM_REACT_NATIVE:"react-native",Platform:function(){return"undefined"!=typeof navigator&&"ReactNative"===navigator.product?h.PLATFORM_REACT_NATIVE:"undefined"!=typeof process&&void 0!==process.versions&&void 0!==process.versions.node?h.PLATFORM_NODE:h.PLATFORM_WEB}};e.exports=h},function(e,t,n){var a,r,A;function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}A=function(){function e(e){var t=[];if(0===e.length)return"";if("string"!=typeof e[0])throw new TypeError("Url must be a string. Received "+e[0]);if(e[0].match(/^[^/:]+:\/*$/)&&e.length>1){var n=e.shift();e[0]=n+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var a=0;a<e.length;a++){var r=e[a];if("string"!=typeof r)throw new TypeError("Url must be a string. Received "+r);""!==r&&(a>0&&(r=r.replace(/^[\/]+/,"")),r=a<e.length-1?r.replace(/[\/]+$/,""):r.replace(/[\/]+$/,"/"),t.push(r))}var A=t.join("/"),i=(A=A.replace(/\/(\?|&|#[^!])/g,"$1")).split("?");return A=i.shift()+(i.length>0?"?":"")+i.join("&")}return function(){return e("object"===i(arguments[0])?arguments[0]:[].slice.call(arguments))}},e.exports?e.exports=A():void 0===(r="function"==typeof(a=A)?a.call(t,n,t,e):a)||(e.exports=r)},function(e,t,n){var a=n(24);t.ValidatePresence=function(e,t){if(!t)throw Error("".concat(e," not specified"))},t.ValidateLibrary=function(e){if(!e)throw Error("Library ID not specified");if(!e.toString().startsWith("i"))throw Error("Invalid library ID: ".concat(e))},t.ValidateObject=function(e){if(!e)throw Error("Object ID not specified");if(!e.toString().startsWith("i"))throw Error("Invalid object ID: ".concat(e))},t.ValidateVersion=function(e){if(!e)throw Error("Version hash not specified");if(!e.toString().startsWith("h"))throw Error("Invalid version hash: ".concat(e))},t.ValidateWriteToken=function(e){if(!e)throw Error("Write token not specified");if(!e.toString().startsWith("t"))throw Error("Invalid write token: ".concat(e))},t.ValidatePartHash=function(e){if(!e)throw Error("Part hash not specified");if(!e.toString().startsWith("hqp_")&&!e.toString().startsWith("hqpe"))throw Error("Invalid part hash: ".concat(e))},t.ValidateParameters=function(e){var n=e.libraryId,a=e.objectId,r=e.versionHash;r?t.ValidateVersion(r):(t.ValidateLibrary(n),t.ValidateObject(a))},t.ValidateAddress=function(e){if(!e)throw Error("Address not specified");if(!/^(0x)?[0-9a-f]{40}$/i.test(e.toLowerCase()))throw Error("Invalid address: ".concat(e));return a.FormatAddress(e)},t.ValidatePermission=function(e){if(e&&"full-access"!==e&&"no-access"!==e)throw Error("Invalid profile permission: ".concat(e));return e},t.ValidateDate=function(e){if(e){if(isNaN(new Date(e)))throw Error("Invalid date: ".concat(e));return new Date(e).getTime()}}},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=a=function(e){return n(e)}:e.exports=a=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":n(e)},a(t)}e.exports=a},function(e,t){e.exports=require("buffer")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(34),r=n(5);t.check=function(e){for(var t=[],n=0;n<2048;n++){var r=e.getWord(n);if(n!==e.getWordIndex(r))return"0x";t.push(r)}return a.id(t.join("\n")+"\n")};var A=function(){function e(e){r.defineReadOnly(this,"locale",e)}return e.prototype.split=function(e){return e.toLowerCase().split(/ +/g)},e.prototype.join=function(e){return e.join(" ")},e}();t.Wordlist=A,t.register=function(e,t){t||(t=e.locale)}},function(e,t){e.exports=require("zlib")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(15);t.AddressZero="0x0000000000000000000000000000000000000000";t.HashZero="0x0000000000000000000000000000000000000000000000000000000000000000";t.EtherSymbol="Ξ";var r=a.bigNumberify(-1);t.NegativeOne=r;var A=a.bigNumberify(0);t.Zero=A;var i=a.bigNumberify(1);t.One=i;var o=a.bigNumberify(2);t.Two=o;var s=a.bigNumberify("1000000000000000000");t.WeiPerEther=s;var p=a.bigNumberify("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");t.MaxUint256=p},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}e.exports=function(e){var t=n(e);return null!=e&&("object"==t||"function"==t)}},function(e,t,n){var a=n(159),r=n(160),A=n(161);e.exports=function(e){return a(e)||r(e)||A()}},function(e,t,n){"use strict";var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(0)),A=n(1),i=n(8),o=n(22),s=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]),p=new RegExp("^((.*)\\.)?([^.]+)$"),d=new RegExp("^[a-z0-9.-]*$");t.namehash=function(e){"string"!=typeof e&&r.throwError("invalid address - "+String(e),r.INVALID_ARGUMENT,{argument:"name",value:e}),(e=e.toLowerCase()).match(d)||r.throwError("contains invalid UseSTD3ASCIIRules characters",r.INVALID_ARGUMENT,{argument:"name",value:e});for(var t=s;e.length;){var n=e.match(p),a=i.toUtf8Bytes(n[3]);t=o.keccak256(A.concat([t,o.keccak256(a)])),e=n[2]||""}return A.hexlify(t)},t.id=function(e){return o.keccak256(i.toUtf8Bytes(e))},t.hashMessage=function(e){return o.keccak256(A.concat([i.toUtf8Bytes("Ethereum Signed Message:\n"),i.toUtf8Bytes(String(e.length)),"string"==typeof e?i.toUtf8Bytes(e):e]))}},function(e,t,n){var a=n(6),r=n(19),A=n(20),i=n(70),o="undefined"!=typeof fetch?fetch:n(80).default,s=n(44).LogMessage,p=function(){"use strict";function e(t){var n=t.uris,a=t.debug;r(this,e),this.uris=n,this.uriIndex=0,this.debug=a,this.draftURIs={}}return A(e,[{key:"Log",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];s(this,e,t)}}]),A(e,[{key:"BaseURI",value:function(){return new i(this.uris[this.uriIndex])}},{key:"RecordWriteToken",value:function(e){this.draftURIs[e]=this.BaseURI()}},{key:"RequestHeaders",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.Accept||(t.Accept="application/json"),"JSON"===e?t["Content-type"]="application/json":"BINARY"===e&&(t["Content-type"]="application/octet-stream"),t}},{key:"Request",value:function(t){var n,r,A,i,o,s,p,d,c,u,l,g,f,I,h,y,m,C,B,E,b,Q,v,w;return a.async((function(D){for(;;)switch(D.prev=D.next){case 0:return n=t.method,r=t.path,A=t.queryParams,i=void 0===A?{}:A,o=t.body,s=t.bodyType,p=void 0===s?"JSON":s,d=t.headers,c=void 0===d?{}:d,u=t.attempts,l=void 0===u?0:u,g=t.failover,f=void 0===g||g,I=t.forceFailover,h=void 0!==I&&I,y=this.BaseURI(),m=r.replace(/^\//,"").match(/(qlibs\/ilib[a-zA-Z0-9]+|q|qid)\/(tqw_[a-zA-Z0-9]+)/),(C=m?m[2]:void 0)&&(this.draftURIs[C]?y=this.draftURIs[C]:this.draftURIs[C]=y),B=y.path(r).query(i).hash(""),E={method:n,headers:this.RequestHeaders(p,c)},"POST"!==n&&"PUT"!==n&&"DELETE"!==n||(o&&"JSON"===p?E.body=JSON.stringify(o):o&&(E.body=o)),D.prev=8,D.next=11,a.awrap(e.Fetch(B.toString(),E));case 11:b=D.sent,D.next=17;break;case 14:D.prev=14,D.t0=D.catch(8),b={ok:!1,status:500,statusText:"ElvClient Error: "+D.t0.message,url:B.toString(),stack:D.t0.stack};case 17:if(b.ok){D.next=40;break}if(!(!C&&(f&&parseInt(b.status)>=500||h)&&l<this.uris.length)){D.next=24;break}return this.Log("HttpClient failing over from ".concat(this.BaseURI(),": ").concat(l+1," attempts"),!0),this.uriIndex=(this.uriIndex+1)%this.uris.length,D.next=23,a.awrap(this.Request({method:n,path:r,queryParams:i,body:o,bodyType:p,headers:c,attempts:l+1,forceFailover:h}));case 23:return D.abrupt("return",D.sent);case 24:if(Q=b.headers&&b.headers.get("content-type")||"",v="",!b.text||!b.json){D.next=37;break}if(!Q.includes("application/json")){D.next=33;break}return D.next=30,a.awrap(b.json());case 30:D.t1=D.sent,D.next=36;break;case 33:return D.next=35,a.awrap(b.text());case 35:D.t1=D.sent;case 36:v=D.t1;case 37:throw w={name:"ElvHttpClientError",status:b.status,statusText:b.statusText,message:b.statusText,url:B.toString(),body:v,requestParams:E},this.Log(JSON.stringify(w,null,2),!0),w;case 40:return this.Log("".concat(b.status," - ").concat(n," ").concat(B.toString())),D.abrupt("return",b);case 42:case"end":return D.stop()}}),null,this,[[8,14]])}},{key:"URL",value:function(e){var t=e.path,n=e.queryParams,a=void 0===n?{}:n;return this.BaseURI().path(t).query(a).hash("").toString()}}],[{key:"Fetch",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return o(e,t)}}]),e}();e.exports=p},function(e,t,n){function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r=n(120),A="object"==("undefined"==typeof self?"undefined":a(self))&&self&&self.Object===Object&&self,i=r||A||Function("return this")();e.exports=i},function(e,t,n){"use strict";function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){return!t||"object"!==a(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function A(e){return(A=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var o={};function s(e,t,n){n||(n=Error);var a=function(e){function n(e,a,i){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),r(this,A(n).call(this,function(e,n,a){return"string"==typeof t?t:t(e,n,a)}(e,a,i)))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(n,e),n}(n);a.prototype.name=n.name,a.prototype.code=e,o[e]=a}function p(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map((function(e){return String(e)})),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}s("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),s("ERR_INVALID_ARG_TYPE",(function(e,t,n){var r,A,i,o;if("string"==typeof t&&(A="not ",t.substr(!i||i<0?0:+i,A.length)===A)?(r="must not be",t=t.replace(/^not /,"")):r="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}(e," argument"))o="The ".concat(e," ").concat(r," ").concat(p(t,"type"));else{var s=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}(e,".")?"property":"argument";o='The "'.concat(e,'" ').concat(s," ").concat(r," ").concat(p(t,"type"))}return o+=". Received type ".concat(a(n))}),TypeError),s("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),s("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),s("ERR_STREAM_PREMATURE_CLOSE","Premature close"),s("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),s("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),s("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),s("ERR_STREAM_WRITE_AFTER_END","write after end"),s("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),s("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),s("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=o},function(e,t,n){"use strict";var a=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=p;var r=n(136),A=n(140);n(4)(p,r);for(var i=a(A.prototype),o=0;o<i.length;o++){var s=i[o];p.prototype[s]||(p.prototype[s]=A.prototype[s])}function p(e){if(!(this instanceof p))return new p(e);r.call(this,e),A.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",d)))}function d(){this._writableState.ended||process.nextTick(c,this)}function c(e){e.end()}Object.defineProperty(p.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(p.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(p.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(p.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},function(e,t){e.exports=require("url")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(5),r=function(){function e(){a.setType(this,"Provider")}return e.isProvider=function(e){return a.isType(e,"Provider")},e}();t.Provider=r},function(e,t){e.exports=require("util")},function(e,t,n){"use strict";var a=n(17),r=n(9);function A(){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}t.BlockHash=A,A.prototype.update=function(e,t){if(e=a.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=a.join32(e,0,e.length-n,this.endian);for(var r=0;r<e.length;r+=this._delta32)this._update(e,r,r+this._delta32)}return this},A.prototype.digest=function(e){return this.update(this._pad()),r(null===this.pending),this._digest(e)},A.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,n=t-(e+this.padLength)%t,a=new Array(n+this.padLength);a[0]=128;for(var r=1;r<n;r++)a[r]=0;if(e<<=3,"big"===this.endian){for(var A=8;A<this.padLength;A++)a[r++]=0;a[r++]=0,a[r++]=0,a[r++]=0,a[r++]=0,a[r++]=e>>>24&255,a[r++]=e>>>16&255,a[r++]=e>>>8&255,a[r++]=255&e}else for(a[r++]=255&e,a[r++]=e>>>8&255,a[r++]=e>>>16&255,a[r++]=e>>>24&255,a[r++]=0,a[r++]=0,a[r++]=0,a[r++]=0,A=8;A<this.padLength;A++)a[r++]=0;return a}},function(e,t,n){"use strict";var a=n(18),r=n(9);function A(){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}t.BlockHash=A,A.prototype.update=function(e,t){if(e=a.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=a.join32(e,0,e.length-n,this.endian);for(var r=0;r<e.length;r+=this._delta32)this._update(e,r,r+this._delta32)}return this},A.prototype.digest=function(e){return this.update(this._pad()),r(null===this.pending),this._digest(e)},A.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,n=t-(e+this.padLength)%t,a=new Array(n+this.padLength);a[0]=128;for(var r=1;r<n;r++)a[r]=0;if(e<<=3,"big"===this.endian){for(var A=8;A<this.padLength;A++)a[r++]=0;a[r++]=0,a[r++]=0,a[r++]=0,a[r++]=0,a[r++]=e>>>24&255,a[r++]=e>>>16&255,a[r++]=e>>>8&255,a[r++]=255&e}else for(a[r++]=255&e,a[r++]=e>>>8&255,a[r++]=e>>>16&255,a[r++]=e>>>24&255,a[r++]=0,a[r++]=0,a[r++]=0,a[r++]=0,A=8;A<this.padLength;A++)a[r++]=0;return a}},function(e,t,n){var a=n(27),r=function(e,t){return"object"===a(t)&&"function"==typeof t[e]?t[e]:null},A=function(e){return"object"===a(e)?JSON.stringify(e):e};e.exports={LogMessage:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e.debug){var a=r("log",e.debugOptions),i=r("error",e.debugOptions),o="(elv-client-js#".concat(e.constructor.name,")"),s="\n".concat(o," ").concat(A(t),"\n");n?i?i(o,t):console.error(s):a?a(o,t):console.log(s)}}}},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}e.exports=function(e){return null!=e&&"object"==n(e)}},function(e,t,n){var a=t;a.bignum=n(2),a.define=n(362).define,a.base=n(47),a.constants=n(150),a.decoders=n(367),a.encoders=n(369)},function(e,t,n){var a=t;a.Reporter=n(364).Reporter,a.DecoderBuffer=n(149).DecoderBuffer,a.EncoderBuffer=n(149).EncoderBuffer,a.Node=n(365)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1);function r(e){for(var t=[];e;)t.unshift(255&e),e>>=8;return t}function A(e,t,n){for(var a=0,r=0;r<n;r++)a=256*a+e[t+r];return a}function i(e,t,n,a){for(var r=[];n<t+1+a;){var A=o(e,n);if(r.push(A.result),(n+=A.consumed)>t+1+a)throw new Error("invalid rlp")}return{consumed:1+a,result:r}}function o(e,t){if(0===e.length)throw new Error("invalid rlp data");if(e[t]>=248){if(t+1+(n=e[t]-247)>e.length)throw new Error("too short");if(t+1+n+(r=A(e,t+1,n))>e.length)throw new Error("to short");return i(e,t,t+1+n,n+r)}if(e[t]>=192){if(t+1+(r=e[t]-192)>e.length)throw new Error("invalid rlp data");return i(e,t,t+1,r)}if(e[t]>=184){var n;if(t+1+(n=e[t]-183)>e.length)throw new Error("invalid rlp data");if(t+1+n+(r=A(e,t+1,n))>e.length)throw new Error("invalid rlp data");return{consumed:1+n+r,result:a.hexlify(e.slice(t+1+n,t+1+n+r))}}if(e[t]>=128){var r;if(t+1+(r=e[t]-128)>e.length)throw new Error("invalid rlp data");return{consumed:1+r,result:a.hexlify(e.slice(t+1,t+1+r))}}return{consumed:1,result:a.hexlify(e[t])}}t.encode=function(e){return a.hexlify(function e(t){if(Array.isArray(t)){var n=[];return t.forEach((function(t){n=n.concat(e(t))})),n.length<=55?(n.unshift(192+n.length),n):((A=r(n.length)).unshift(247+A.length),A.concat(n))}var A,i=Array.prototype.slice.call(a.arrayify(t));return 1===i.length&&i[0]<=127?i:i.length<=55?(i.unshift(128+i.length),i):((A=r(i.length)).unshift(183+A.length),A.concat(i))}(e))},t.decode=function(e){var t=a.arrayify(e),n=o(t,0);if(n.consumed!==t.length)throw new Error("invalid rlp data");return n.result}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(5),r=function(){function e(){a.setType(this,"Signer")}return e.isSigner=function(e){return a.isType(e,"Signer")},e}();t.Signer=r},function(e,t,n){"use strict";var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(0)),A=n(100),i=n(166),o=n(1),s=n(15),p=n(8),d=n(101),c=n(102),u=n(5),l=n(51),g=n(76),f=s.bigNumberify("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),I=p.toUtf8Bytes("Bitcoin seed");function h(e){return(1<<e)-1<<8-e}function y(e){return o.hexZeroPad(o.hexlify(e),32)}function m(e){var t=o.hexDataSlice(g.sha256(g.sha256(e)),0,4);return i.Base58.encode(o.concat([e,t]))}var C={};t.defaultPath="m/44'/60'/0'/0/0";var B=function(){function e(t,n,a,A,i,s,p,d,c){if(r.checkNew(this,e),t!==C)throw new Error("HDNode constructor cannot be called directly");if(n){var f=new l.KeyPair(n);u.defineReadOnly(this,"privateKey",f.privateKey),u.defineReadOnly(this,"publicKey",f.compressedPublicKey)}else u.defineReadOnly(this,"privateKey",null),u.defineReadOnly(this,"publicKey",o.hexlify(a));u.defineReadOnly(this,"parentFingerprint",A),u.defineReadOnly(this,"fingerprint",o.hexDataSlice(g.ripemd160(g.sha256(this.publicKey)),0,4)),u.defineReadOnly(this,"address",l.computeAddress(this.publicKey)),u.defineReadOnly(this,"chainCode",i),u.defineReadOnly(this,"index",s),u.defineReadOnly(this,"depth",p),u.defineReadOnly(this,"mnemonic",d),u.defineReadOnly(this,"path",c),u.setType(this,"HDNode")}return Object.defineProperty(e.prototype,"extendedKey",{get:function(){if(this.depth>=256)throw new Error("Depth too large!");return m(o.concat([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",o.hexlify(this.depth),this.parentFingerprint,o.hexZeroPad(o.hexlify(this.index),4),this.chainCode,null!=this.privateKey?o.concat(["0x00",this.privateKey]):this.publicKey]))},enumerable:!0,configurable:!0}),e.prototype.neuter=function(){return new e(C,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,null,this.path)},e.prototype._derive=function(t){if(t>4294967295)throw new Error("invalid index - "+String(t));var n=this.path;n&&(n+="/"+(2147483647&t));var a=new Uint8Array(37);if(2147483648&t){if(!this.privateKey)throw new Error("cannot derive child of neutered node");a.set(o.arrayify(this.privateKey),1),n&&(n+="'")}else a.set(o.arrayify(this.publicKey));for(var r=24;r>=0;r-=8)a[33+(r>>3)]=t>>24-r&255;var A=c.computeHmac(c.SupportedAlgorithms.sha512,this.chainCode,a),i=A.slice(0,32),p=A.slice(32),d=null,u=null;this.privateKey?d=y(s.bigNumberify(i).add(this.privateKey).mod(f)):u=new l.KeyPair(o.hexlify(i))._addPoint(this.publicKey);return new e(C,d,u,this.fingerprint,y(p),t,this.depth+1,this.mnemonic,n)},e.prototype.derivePath=function(e){var t=e.split("/");if(0===t.length||"m"===t[0]&&0!==this.depth)throw new Error("invalid path - "+e);"m"===t[0]&&t.shift();for(var n=this,a=0;a<t.length;a++){var r=t[a];if(r.match(/^[0-9]+'$/)){if((A=parseInt(r.substring(0,r.length-1)))>=2147483648)throw new Error("invalid path index - "+r);n=n._derive(2147483648+A)}else{if(!r.match(/^[0-9]+$/))throw new Error("invalid path component - "+r);var A;if((A=parseInt(r))>=2147483648)throw new Error("invalid path index - "+r);n=n._derive(A)}}return n},e.isHDNode=function(e){return u.isType(e,"HDNode")},e}();function E(e,t){var n=o.arrayify(e);if(n.length<16||n.length>64)throw new Error("invalid seed");var a=o.arrayify(c.computeHmac(c.SupportedAlgorithms.sha512,I,n));return new B(C,y(a.slice(0,32)),null,"0x00000000",y(a.slice(32)),0,0,t,"m")}function b(e,t){t||(t="");var n=p.toUtf8Bytes("mnemonic"+t,p.UnicodeNormalizationForm.NFKD);return o.hexlify(d.pbkdf2(p.toUtf8Bytes(e,p.UnicodeNormalizationForm.NFKD),n,2048,64,"sha512"))}function Q(e,t){t||(t=A.langEn),r.checkNormalize();var n=t.split(e);if(n.length%3!=0)throw new Error("invalid mnemonic");for(var a=o.arrayify(new Uint8Array(Math.ceil(11*n.length/8))),i=0,s=0;s<n.length;s++){var p=t.getWordIndex(n[s].normalize("NFKD"));if(-1===p)throw new Error("invalid mnemonic");for(var d=0;d<11;d++)p&1<<10-d&&(a[i>>3]|=1<<7-i%8),i++}var c=32*n.length/3,u=h(n.length/3),l=o.arrayify(g.sha256(a.slice(0,c/8)))[0];if((l&=u)!==(a[a.length-1]&u))throw new Error("invalid checksum");return o.hexlify(a.slice(0,c/8))}function v(e,t){if((e=o.arrayify(e)).length%4!=0||e.length<16||e.length>32)throw new Error("invalid entropy");for(var n=[0],a=11,r=0;r<e.length;r++)a>8?(n[n.length-1]<<=8,n[n.length-1]|=e[r],a-=8):(n[n.length-1]<<=a,n[n.length-1]|=e[r]>>8-a,n.push(e[r]&(1<<8-a)-1),a+=3);var i=o.arrayify(g.sha256(e))[0],s=e.length/4;return i&=h(s),n[n.length-1]<<=s,n[n.length-1]|=i>>8-s,t||(t=A.langEn),t.join(n.map((function(e){return t.getWord(e)})))}t.HDNode=B,t.fromExtendedKey=function(e){var t=i.Base58.decode(e);82===t.length&&m(t.slice(0,78))===e||r.throwError("invalid extended key",r.INVALID_ARGUMENT,{argument:"extendedKey",value:"[REDACTED]"});var n=t[4],a=o.hexlify(t.slice(5,9)),A=parseInt(o.hexlify(t.slice(9,13)).substring(2),16),s=o.hexlify(t.slice(13,45)),p=t.slice(45,78);switch(o.hexlify(t.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new B(C,null,o.hexlify(p),a,s,A,n,null,null);case"0x0488ade4":case"0x04358394":if(0!==p[0])break;return new B(C,o.hexlify(p.slice(1)),null,a,s,A,n,null,null)}return r.throwError("invalid extended key",r.INVALID_ARGUMENT,{argument:"extendedKey",value:"[REDACTED]"})},t.fromMnemonic=function(e,t,n){return E(b(e=v(Q(e,t),t),n),e)},t.fromSeed=function(e){return E(e,null)},t.mnemonicToSeed=b,t.mnemonicToEntropy=Q,t.entropyToMnemonic=v,t.isValidMnemonic=function(e,t){try{return Q(e,t),!0}catch(e){}return!1}},function(e,t,n){"use strict";var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var r=n(167),A=n(16),i=n(1),o=n(34),s=n(22),p=n(5),d=a(n(0)),c=null;function u(){return c||(c=new r.ec("secp256k1")),c}var l=function(){function e(e){var t=u().keyFromPrivate(i.arrayify(e));p.defineReadOnly(this,"privateKey",i.hexlify(t.priv.toArray("be",32))),p.defineReadOnly(this,"publicKey","0x"+t.getPublic(!1,"hex")),p.defineReadOnly(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),p.defineReadOnly(this,"publicKeyBytes",t.getPublic().encode(null,!0))}return e.prototype.sign=function(e){var t=u().keyFromPrivate(i.arrayify(this.privateKey)).sign(i.arrayify(e),{canonical:!0});return{recoveryParam:t.recoveryParam,r:i.hexZeroPad("0x"+t.r.toString(16),32),s:i.hexZeroPad("0x"+t.s.toString(16),32),v:27+t.recoveryParam}},e.prototype.computeSharedSecret=function(e){var t=u().keyFromPrivate(i.arrayify(this.privateKey)),n=u().keyFromPublic(i.arrayify(g(e)));return i.hexZeroPad("0x"+t.derive(n.getPublic()).toString(16),32)},e.prototype._addPoint=function(e){var t=u().keyFromPublic(i.arrayify(this.publicKey)),n=u().keyFromPublic(i.arrayify(e));return"0x"+t.pub.add(n.pub).encodeCompressed("hex")},e}();function g(e,t){var n=i.arrayify(e);if(32===n.length){var a=new l(n);return t?a.compressedPublicKey:a.publicKey}return 33===n.length?t?i.hexlify(n):"0x"+u().keyFromPublic(n).getPublic(!1,"hex"):65===n.length?t?"0x"+u().keyFromPublic(n).getPublic(!0,"hex"):i.hexlify(n):(d.throwError("invalid public or private key",d.INVALID_ARGUMENT,{arg:"key",value:"[REDACTED]"}),null)}function f(e){var t="0x"+g(e).slice(4);return A.getAddress("0x"+s.keccak256(t).substring(26))}function I(e,t){var n=i.splitSignature(t),a={r:i.arrayify(n.r),s:i.arrayify(n.s)};return"0x"+u().recoverPubKey(i.arrayify(e),a,n.recoveryParam).encode("hex",!1)}function h(e,t){return f(I(i.arrayify(e),t))}t.KeyPair=l,t.computePublicKey=g,t.computeAddress=f,t.recoverPublicKey=I,t.recoverAddress=h,t.verifyMessage=function(e,t){return h(o.hashMessage(e),t)}},function(e,t,n){function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r;function A(e){this.rand=e}if(e.exports=function(e){return r||(r=new A(null)),r.generate(e)},e.exports.Rand=A,A.prototype.generate=function(e){return this._rand(e)},A.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;n<t.length;n++)t[n]=this.rand.getByte();return t},"object"===("undefined"==typeof self?"undefined":a(self)))self.crypto&&self.crypto.getRandomValues?A.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?A.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"===("undefined"==typeof window?"undefined":a(window))&&(A.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var i=n(3);if("function"!=typeof i.randomBytes)throw new Error("Not supported");A.prototype._rand=function(e){return i.randomBytes(e)}}catch(e){}},function(e,t,n){"use strict";var a=n(2),r=n(13),A=r.getNAF,i=r.getJSF,o=r.assert;function s(e,t){this.type=e,this.p=new a(t.p,16),this.red=t.prime?a.red(t.prime):a.mont(this.p),this.zero=new a(0).toRed(this.red),this.one=new a(1).toRed(this.red),this.two=new a(2).toRed(this.red),this.n=t.n&&new a(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function p(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=s,s.prototype.point=function(){throw new Error("Not implemented")},s.prototype.validate=function(){throw new Error("Not implemented")},s.prototype._fixedNafMul=function(e,t){o(e.precomputed);var n=e._getDoubles(),a=A(t,1,this._bitLength),r=(1<<n.step+1)-(n.step%2==0?2:1);r/=3;for(var i=[],s=0;s<a.length;s+=n.step){var p=0;for(t=s+n.step-1;t>=s;t--)p=(p<<1)+a[t];i.push(p)}for(var d=this.jpoint(null,null,null),c=this.jpoint(null,null,null),u=r;u>0;u--){for(s=0;s<i.length;s++){(p=i[s])===u?c=c.mixedAdd(n.points[s]):p===-u&&(c=c.mixedAdd(n.points[s].neg()))}d=d.add(c)}return d.toP()},s.prototype._wnafMul=function(e,t){var n=4,a=e._getNAFPoints(n);n=a.wnd;for(var r=a.points,i=A(t,n,this._bitLength),s=this.jpoint(null,null,null),p=i.length-1;p>=0;p--){for(t=0;p>=0&&0===i[p];p--)t++;if(p>=0&&t++,s=s.dblp(t),p<0)break;var d=i[p];o(0!==d),s="affine"===e.type?d>0?s.mixedAdd(r[d-1>>1]):s.mixedAdd(r[-d-1>>1].neg()):d>0?s.add(r[d-1>>1]):s.add(r[-d-1>>1].neg())}return"affine"===e.type?s.toP():s},s.prototype._wnafMulAdd=function(e,t,n,a,r){for(var o=this._wnafT1,s=this._wnafT2,p=this._wnafT3,d=0,c=0;c<a;c++){var u=(v=t[c])._getNAFPoints(e);o[c]=u.wnd,s[c]=u.points}for(c=a-1;c>=1;c-=2){var l=c-1,g=c;if(1===o[l]&&1===o[g]){var f=[t[l],null,null,t[g]];0===t[l].y.cmp(t[g].y)?(f[1]=t[l].add(t[g]),f[2]=t[l].toJ().mixedAdd(t[g].neg())):0===t[l].y.cmp(t[g].y.redNeg())?(f[1]=t[l].toJ().mixedAdd(t[g]),f[2]=t[l].add(t[g].neg())):(f[1]=t[l].toJ().mixedAdd(t[g]),f[2]=t[l].toJ().mixedAdd(t[g].neg()));var I=[-3,-1,-5,-7,0,7,5,1,3],h=i(n[l],n[g]);d=Math.max(h[0].length,d),p[l]=new Array(d),p[g]=new Array(d);for(var y=0;y<d;y++){var m=0|h[0][y],C=0|h[1][y];p[l][y]=I[3*(m+1)+(C+1)],p[g][y]=0,s[l]=f}}else p[l]=A(n[l],o[l],this._bitLength),p[g]=A(n[g],o[g],this._bitLength),d=Math.max(p[l].length,d),d=Math.max(p[g].length,d)}var B=this.jpoint(null,null,null),E=this._wnafT4;for(c=d;c>=0;c--){for(var b=0;c>=0;){var Q=!0;for(y=0;y<a;y++)E[y]=0|p[y][c],0!==E[y]&&(Q=!1);if(!Q)break;b++,c--}if(c>=0&&b++,B=B.dblp(b),c<0)break;for(y=0;y<a;y++){var v,w=E[y];0!==w&&(w>0?v=s[y][w-1>>1]:w<0&&(v=s[y][-w-1>>1].neg()),B="affine"===v.type?B.mixedAdd(v):B.add(v))}}for(c=0;c<a;c++)s[c]=null;return r?B:B.toP()},s.BasePoint=p,p.prototype.eq=function(){throw new Error("Not implemented")},p.prototype.validate=function(){return this.curve.validate(this)},s.prototype.decodePoint=function(e,t){e=r.toArray(e,t);var n=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*n)return 6===e[0]?o(e[e.length-1]%2==0):7===e[0]&&o(e[e.length-1]%2==1),this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));if((2===e[0]||3===e[0])&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),3===e[0]);throw new Error("Unknown point format")},p.prototype.encodeCompressed=function(e){return this.encode(e,!0)},p.prototype._encode=function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))},p.prototype.encode=function(e,t){return r.encode(this._encode(t),e)},p.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},p.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},p.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],a=this,r=0;r<t;r+=e){for(var A=0;A<e;A++)a=a.dbl();n.push(a)}return{step:e,points:n}},p.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,a=1===n?null:this.dbl(),r=1;r<n;r++)t[r]=t[r-1].add(a);return{wnd:e,points:t}},p.prototype._getBeta=function(){return null},p.prototype.dblp=function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t}},function(e,t,n){"use strict";var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var r=n(31),A=a(n(0)),i=n(51),o=n(16),s=n(15),p=n(1),d=n(22),c=n(5),u=a(n(48)),l=n(40);function g(e){return"0x"===e?r.Zero:s.bigNumberify(e)}var f=[{name:"nonce",maxLength:32},{name:"gasPrice",maxLength:32},{name:"gasLimit",maxLength:32},{name:"to",length:20},{name:"value",maxLength:32},{name:"data"}],I={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0};t.serialize=function(e,t){c.checkProperties(e,I);var n=[];f.forEach((function(t){var a=e[t.name]||[];a=p.arrayify(p.hexlify(a)),t.length&&a.length!==t.length&&a.length>0&&A.throwError("invalid length for "+t.name,A.INVALID_ARGUMENT,{arg:"transaction"+t.name,value:a}),t.maxLength&&(a=p.stripZeros(a)).length>t.maxLength&&A.throwError("invalid length for "+t.name,A.INVALID_ARGUMENT,{arg:"transaction"+t.name,value:a}),n.push(p.hexlify(a))})),null!=e.chainId&&0!==e.chainId&&(n.push(p.hexlify(e.chainId)),n.push("0x"),n.push("0x"));var a=u.encode(n);if(!t)return a;var r=p.splitSignature(t),i=27+r.recoveryParam;return 9===n.length&&(n.pop(),n.pop(),n.pop(),i+=2*e.chainId+8),n.push(p.hexlify(i)),n.push(p.stripZeros(p.arrayify(r.r))),n.push(p.stripZeros(p.arrayify(r.s))),u.encode(n)},t.parse=function(e){var t=u.decode(e);9!==t.length&&6!==t.length&&A.throwError("invalid raw transaction",A.INVALID_ARGUMENT,{arg:"rawTransactin",value:e});var n,a={nonce:g(t[0]).toNumber(),gasPrice:g(t[1]),gasLimit:g(t[2]),to:(n=t[3],"0x"===n?null:o.getAddress(n)),value:g(t[4]),data:t[5],chainId:0};if(6===t.length)return a;try{a.v=s.bigNumberify(t[6]).toNumber()}catch(e){return A.info(e),a}if(a.r=p.hexZeroPad(t[7],32),a.s=p.hexZeroPad(t[8],32),s.bigNumberify(a.r).isZero()&&s.bigNumberify(a.s).isZero())a.chainId=a.v,a.v=0;else{a.chainId=Math.floor((a.v-35)/2),a.chainId<0&&(a.chainId=0);var r=a.v-27,c=t.slice(0,6);0!==a.chainId&&(c.push(p.hexlify(a.chainId)),c.push("0x"),c.push("0x"),r-=2*a.chainId+8);var l=d.keccak256(u.encode(c));try{a.from=i.recoverAddress(l,{r:p.hexlify(a.r),s:p.hexlify(a.s),recoveryParam:r})}catch(e){A.info(e)}a.hash=d.keccak256(e)}return a},t.populateTransaction=function(e,t,n){l.Provider.isProvider(t)||A.throwError("missing provider",A.INVALID_ARGUMENT,{argument:"provider",value:t}),c.checkProperties(e,I);var a=c.shallowCopy(e);if(null!=a.to&&(a.to=t.resolveName(a.to)),null==a.gasPrice&&(a.gasPrice=t.getGasPrice()),null==a.nonce&&(a.nonce=t.getTransactionCount(n)),null==a.gasLimit){var r=c.shallowCopy(a);r.from=n,a.gasLimit=t.estimateGas(r)}return null==a.chainId&&(a.chainId=t.getNetwork().then((function(e){return e.chainId}))),c.resolveProperties(a)}},function(e,t,n){"use strict";function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r,A=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var o=n(16),s=n(15),p=n(1),d=n(31),c=n(34),u=n(56),l=n(5),g=n(48),f=n(54),I=n(8),h=n(57),y=i(n(0)),m=n(40);function C(e,t){var n={};for(var a in e)try{var r=e[a](t[a]);void 0!==r&&(n[a]=r)}catch(e){throw e.checkKey=a,e.checkValue=t[a],e}return n}function B(e,t){return function(n){return null==n?t:e(n)}}function E(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");var n=[];return t.forEach((function(t){n.push(e(t))})),n}}function b(e,t){return"string"==typeof e&&(t||"0x"===e.substring(0,2)||(e="0x"+e),32===p.hexDataLength(e))?e.toLowerCase():(y.throwError("invalid hash",y.INVALID_ARGUMENT,{arg:"hash",value:e}),null)}function Q(e){return s.bigNumberify(e).toNumber()}function v(e){if(!p.isHexString(e))throw new Error("invalid uint256");for(;e.length<66;)e="0x0"+e.substring(2);return e}function w(e){if(null==e)return"latest";if("earliest"===e)return"0x0";if("latest"===e||"pending"===e)return e;if("number"==typeof e)return p.hexStripZeros(p.hexlify(e));if(p.isHexString(e))return p.hexStripZeros(e);throw new Error("invalid blockTag")}var D={hash:b,blockHash:B(b,null),blockNumber:B(Q,null),transactionIndex:B(Q,null),confirmations:B(Q,null),from:o.getAddress,gasPrice:s.bigNumberify,gasLimit:s.bigNumberify,to:B(o.getAddress,null),value:s.bigNumberify,nonce:Q,data:p.hexlify,r:B(v),s:B(v),v:B(Q),creates:B(o.getAddress,null),raw:B(p.hexlify)};function M(e){if(null!=e.gas&&null==e.gasLimit&&(e.gasLimit=e.gas),e.to&&s.bigNumberify(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),null!=e.input&&null==e.data&&(e.data=e.input),null==e.to&&null==e.creates&&(e.creates=o.getContractAddress(e)),!e.raw&&e.v&&e.r&&e.s){var t=[p.stripZeros(p.hexlify(e.nonce)),p.stripZeros(p.hexlify(e.gasPrice)),p.stripZeros(p.hexlify(e.gasLimit)),e.to||"0x",p.stripZeros(p.hexlify(e.value||"0x")),p.hexlify(e.data||"0x"),p.stripZeros(p.hexlify(e.v||"0x")),p.stripZeros(p.hexlify(e.r)),p.stripZeros(p.hexlify(e.s))];e.raw=g.encode(t)}var n=C(D,e),a=e.networkId;return null!=e.chainId&&null==a&&null==n.v&&(a=e.chainId),p.isHexString(a)&&(a=s.bigNumberify(a).toNumber()),"number"!=typeof a&&null!=n.v&&((a=(n.v-35)/2)<0&&(a=0),a=parseInt(a)),"number"!=typeof a&&(a=0),n.networkId=a,null==n.chainId&&null!=a&&(n.chainId=a),n.blockHash&&"x"===n.blockHash.replace(/0/g,"")&&(n.blockHash=null),n}var S={hash:b,parentHash:b,number:Q,timestamp:Q,nonce:B(p.hexlify),difficulty:function(e){var t=s.bigNumberify(e);try{return t.toNumber()}catch(e){}return null},gasLimit:s.bigNumberify,gasUsed:s.bigNumberify,miner:o.getAddress,extraData:p.hexlify,transactions:B(E(b))},k=l.shallowCopy(S);function x(e,t){return null!=e.author&&null==e.miner&&(e.miner=e.author),C(t?k:S,e)}k.transactions=B(E(M));var R={from:B(o.getAddress),nonce:B(Q),gasLimit:B(s.bigNumberify),gasPrice:B(s.bigNumberify),to:B(o.getAddress),value:B(s.bigNumberify),data:B(p.hexlify)};function N(e){return C(R,e)}var F={transactionLogIndex:B(Q),transactionIndex:Q,blockNumber:Q,transactionHash:b,address:o.getAddress,topics:E(b),data:p.hexlify,logIndex:Q,blockHash:b};var _={to:B(o.getAddress,null),from:B(o.getAddress,null),contractAddress:B(o.getAddress,null),transactionIndex:Q,root:B(b),gasUsed:s.bigNumberify,logsBloom:B(p.hexlify),blockHash:b,transactionHash:b,logs:E((function(e){return C(F,e)})),blockNumber:Q,confirmations:B(Q,null),cumulativeGasUsed:s.bigNumberify,status:B(Q)};function T(e){return Array.isArray(e)?e.forEach((function(e){T(e)})):null!=e&&b(e),e}var H={fromBlock:B(w,void 0),toBlock:B(w,void 0),address:B(o.getAddress,void 0),topics:B(T,void 0)},L={blockHash:B(b,void 0),address:B(o.getAddress,void 0),topics:B(T,void 0)};function G(e){return e&&e.blockHash?C(L,e):C(H,e)}var U={blockNumber:B(Q),blockHash:B(b),transactionIndex:Q,removed:B((function(e){if("boolean"==typeof e)return e;if("string"==typeof e){if("true"===e)return!0;if("false"===e)return!1}throw new Error("invaid boolean - "+e)})),address:o.getAddress,data:function(e,t){return function(n){return n?e(n):t}}(p.hexlify,"0x"),topics:E(b),transactionHash:b,logIndex:Q};function O(e){return C(U,e)}function P(e){return e.map((function(e){return"string"==typeof e?e:Array.isArray(e)?(e.forEach((function(e){null!==e&&32!==p.hexDataLength(e)&&y.throwError("invalid topic",y.INVALID_ARGUMENT,{argument:"topic",value:e})})),e.join(",")):null===e?"":y.throwError("invalid topic value",y.INVALID_ARGUMENT,{argument:"topic",value:e})})).join("&")}function Y(e){if("string"==typeof e){if(20===p.hexDataLength(e))return"address:"+o.getAddress(e);if(e=e.toLowerCase(),32===p.hexDataLength(e))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter::"+P(e);if(e&&"object"===a(e))return"filter:"+(e.address||"")+":"+P(e.topics||[])}throw new Error("invalid event - "+e)}function J(){return(new Date).getTime()}var j=function(e){function t(t){var n=e.call(this)||this;if(y.checkNew(n,m.Provider),t instanceof Promise)l.defineReadOnly(n,"ready",t.then((function(e){return l.defineReadOnly(n,"_network",e),e}))),n.ready.catch((function(e){}));else{var a=u.getNetwork(null==t?"homestead":t);a?(l.defineReadOnly(n,"_network",a),l.defineReadOnly(n,"ready",Promise.resolve(n._network))):y.throwError("invalid network",y.INVALID_ARGUMENT,{arg:"network",value:t})}return n._lastBlockNumber=-2,n._balances={},n._events=[],n._pollingInterval=4e3,n._emitted={block:-2},n._fastQueryDate=0,n}return A(t,e),t.prototype._doPoll=function(){var e=this;this.getBlockNumber().then((function(t){if(e.polling&&(e._setFastBlockNumber(t),t!==e._lastBlockNumber)){-2===e._emitted.block&&(e._emitted.block=t-1);for(var n=e._emitted.block+1;n<=t;n++)e.emit("block",n);e._emitted.block!==t&&(e._emitted.block=t,Object.keys(e._emitted).forEach((function(n){if("block"!==n){var a=e._emitted[n];"pending"!==a&&t-a>12&&delete e._emitted[n]}}))),-2===e._lastBlockNumber&&(e._lastBlockNumber=t-1);var a={},r={};return e._events.forEach((function(e){r[e.tag]=!0})),Object.keys(r).forEach((function(n){var r=n.split(":");switch(r[0]){case"tx":var A=r[1];e.getTransactionReceipt(A).then((function(t){return t&&null!=t.blockNumber?(e._emitted["t:"+A]=t.blockNumber,e.emit(A,t),null):null})).catch((function(t){e.emit("error",t)}));break;case"address":var i=r[1];e._balances[i]&&(a[i]=e._balances[i]),e.getBalance(i,"latest").then((function(t){var n=e._balances[i];if(!n||!t.eq(n))return e._balances[i]=t,e.emit(i,t),null})).catch((function(t){e.emit("error",t)}));break;case"filter":var o=r[2].split(/&/g).map((function(e){var t=e.split(",");return 1===t.length?""===t[0]?null:e:t.map((function(e){return""===e?null:e}))})),s={address:r[1],fromBlock:e._lastBlockNumber+1,toBlock:t,topics:o};s.address||delete s.address,e.getLogs(s).then((function(t){if(0!==t.length)return t.forEach((function(t){e._emitted["b:"+t.blockHash]=t.blockNumber,e._emitted["t:"+t.transactionHash]=t.blockNumber,e.emit(s,t)})),null})).catch((function(t){e.emit("error",t)}))}})),e._lastBlockNumber=t,e._balances=a,null}})).catch((function(e){})),this.doPoll()},t.prototype.resetEventsBlock=function(e){this._lastBlockNumber=e-1,this.polling&&this._doPoll()},Object.defineProperty(t.prototype,"network",{get:function(){return this._network},enumerable:!0,configurable:!0}),t.prototype.getNetwork=function(){return this.ready},Object.defineProperty(t.prototype,"blockNumber",{get:function(){return this._fastBlockNumber},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"polling",{get:function(){return null!=this._poller},set:function(e){var t=this;setTimeout((function(){e&&!t._poller?(t._poller=setInterval(t._doPoll.bind(t),t.pollingInterval),t._doPoll()):!e&&t._poller&&(clearInterval(t._poller),t._poller=null)}),0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pollingInterval",{get:function(){return this._pollingInterval},set:function(e){var t=this;if("number"!=typeof e||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval((function(){t._doPoll()}),this._pollingInterval))},enumerable:!0,configurable:!0}),t.prototype._getFastBlockNumber=function(){var e=this,t=J();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then((function(t){return(null==e._fastBlockNumber||t>e._fastBlockNumber)&&(e._fastBlockNumber=t),e._fastBlockNumber}))),this._fastBlockNumberPromise},t.prototype._setFastBlockNumber=function(e){null!=this._fastBlockNumber&&e<this._fastBlockNumber||(this._fastQueryDate=J(),(null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))},t.prototype.waitForTransaction=function(e,t){var n=this;return null==t&&(t=1),this.getTransactionReceipt(e).then((function(a){return 0===t||a&&a.confirmations>=t?a:new Promise((function(a){n.on(e,(function r(A){A.confirmations<t||(n.removeListener(e,r),a(A))}))}))}))},t.prototype.getBlockNumber=function(){var e=this;return this.ready.then((function(){return e.perform("getBlockNumber",{}).then((function(t){var n=parseInt(t);if(n!=t)throw new Error("invalid response - getBlockNumber");return e._setFastBlockNumber(n),n}))}))},t.prototype.getGasPrice=function(){var e=this;return this.ready.then((function(){return e.perform("getGasPrice",{}).then((function(e){return s.bigNumberify(e)}))}))},t.prototype.getBalance=function(e,t){var n=this;return this.ready.then((function(){return l.resolveProperties({addressOrName:e,blockTag:t}).then((function(e){var t=e.addressOrName,a=e.blockTag;return n._getAddress(t).then((function(e){var t={address:e,blockTag:w(a)};return n.perform("getBalance",t).then((function(e){return s.bigNumberify(e)}))}))}))}))},t.prototype.getTransactionCount=function(e,t){var n=this;return this.ready.then((function(){return l.resolveProperties({addressOrName:e,blockTag:t}).then((function(e){var t=e.addressOrName,a=e.blockTag;return n._getAddress(t).then((function(e){var t={address:e,blockTag:w(a)};return n.perform("getTransactionCount",t).then((function(e){return s.bigNumberify(e).toNumber()}))}))}))}))},t.prototype.getCode=function(e,t){var n=this;return this.ready.then((function(){return l.resolveProperties({addressOrName:e,blockTag:t}).then((function(e){var t=e.addressOrName,a=e.blockTag;return n._getAddress(t).then((function(e){var t={address:e,blockTag:w(a)};return n.perform("getCode",t).then((function(e){return p.hexlify(e)}))}))}))}))},t.prototype.getStorageAt=function(e,t,n){var a=this;return this.ready.then((function(){return l.resolveProperties({addressOrName:e,position:t,blockTag:n}).then((function(e){var t=e.addressOrName,n=e.position,r=e.blockTag;return a._getAddress(t).then((function(e){var t={address:e,blockTag:w(r),position:p.hexStripZeros(p.hexlify(n))};return a.perform("getStorageAt",t).then((function(e){return p.hexlify(e)}))}))}))}))},t.prototype.sendTransaction=function(e){var t=this;return this.ready.then((function(){return l.resolveProperties({signedTransaction:e}).then((function(e){var n=e.signedTransaction,a={signedTransaction:p.hexlify(n)};return t.perform("sendTransaction",a).then((function(e){return t._wrapTransaction(f.parse(n),e)}),(function(e){throw e.transaction=f.parse(n),e.transaction.hash&&(e.transactionHash=e.transaction.hash),e}))}))}))},t.prototype._wrapTransaction=function(e,t){var n=this;if(null!=t&&32!==p.hexDataLength(t))throw new Error("invalid response - sendTransaction");var a=e;return null!=t&&e.hash!==t&&y.throwError("Transaction hash mismatch from Provider.sendTransaction.",y.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),a.wait=function(t){return 0!==t&&(n._emitted["t:"+e.hash]="pending"),n.waitForTransaction(e.hash,t).then((function(a){return null==a&&0===t?null:(n._emitted["t:"+e.hash]=a.blockNumber,0===a.status&&y.throwError("transaction failed",y.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e}),a)}))},a},t.prototype.call=function(e,t){var n=this,a=l.shallowCopy(e);return this.ready.then((function(){return l.resolveProperties({blockTag:t,tx:a}).then((function(e){var t=e.blockTag,a=e.tx;return n._resolveNames(a,["to","from"]).then((function(e){var a={blockTag:w(t),transaction:N(e)};return n.perform("call",a).then((function(e){return p.hexlify(e)}))}))}))}))},t.prototype.estimateGas=function(e){var t=this,n={to:e.to,from:e.from,data:e.data,gasPrice:e.gasPrice,value:e.value};return this.ready.then((function(){return l.resolveProperties(n).then((function(e){return t._resolveNames(e,["to","from"]).then((function(e){var n={transaction:N(e)};return t.perform("estimateGas",n).then((function(e){return s.bigNumberify(e)}))}))}))}))},t.prototype.getBlock=function(e,t){var n=this;return this.ready.then((function(){return l.resolveProperties({blockHashOrBlockTag:e}).then((function(e){var a=e.blockHashOrBlockTag;try{var r=p.hexlify(a);if(32===p.hexDataLength(r))return h.poll((function(){return n.perform("getBlock",{blockHash:r,includeTransactions:!!t}).then((function(e){return null==e?null==n._emitted["b:"+r]?null:void 0:x(e,t)}))}),{onceBlock:n})}catch(e){}try{var A=-128,i=w(a);return p.isHexString(i)&&(A=parseInt(i.substring(2),16)),h.poll((function(){return n.perform("getBlock",{blockTag:i,includeTransactions:!!t}).then((function(e){if(null==e){if(A<=n._emitted.block)return;return null}return x(e,t)}))}),{onceBlock:n})}catch(e){}throw new Error("invalid block hash or block tag")}))}))},t.prototype.getTransaction=function(e){var n=this;return this.ready.then((function(){return l.resolveProperties({transactionHash:e}).then((function(e){var a=e.transactionHash,r={transactionHash:b(a,!0)};return h.poll((function(){return n.perform("getTransaction",r).then((function(e){if(null==e)return null==n._emitted["t:"+a]?null:void 0;var r=t.checkTransactionResponse(e);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations)return n._getFastBlockNumber().then((function(e){var t=e-r.blockNumber+1;return t<=0&&(t=1),r.confirmations=t,n._wrapTransaction(r)}));return n._wrapTransaction(r)}))}),{onceBlock:n})}))}))},t.prototype.getTransactionReceipt=function(e){var t=this;return this.ready.then((function(){return l.resolveProperties({transactionHash:e}).then((function(e){var n=e.transactionHash,a={transactionHash:b(n,!0)};return h.poll((function(){return t.perform("getTransactionReceipt",a).then((function(e){if(null==e)return null==t._emitted["t:"+n]?null:void 0;if(null!=e.blockHash){var a=function(e){var t=C(_,e);return t.logs.forEach((function(e,t){null==e.transactionLogIndex&&(e.transactionLogIndex=t)})),null!=e.status&&(t.byzantium=!0),t}(e);if(null==a.blockNumber)a.confirmations=0;else if(null==a.confirmations)return t._getFastBlockNumber().then((function(e){var t=e-a.blockNumber+1;return t<=0&&(t=1),a.confirmations=t,a}));return a}}))}),{onceBlock:t})}))}))},t.prototype.getLogs=function(e){var t=this;return this.ready.then((function(){return l.resolveProperties(e).then((function(e){return t._resolveNames(e,["address"]).then((function(e){var n={filter:G(e)};return t.perform("getLogs",n).then((function(e){return E(O)(e)}))}))}))}))},t.prototype.getEtherPrice=function(){var e=this;return this.ready.then((function(){return e.perform("getEtherPrice",{}).then((function(e){return e}))}))},t.prototype._getAddress=function(e){return this.resolveName(e).then((function(t){return null==t&&y.throwError("ENS name not configured",y.UNSUPPORTED_OPERATION,{operation:"resolveName("+JSON.stringify(e)+")"}),t}))},t.prototype._resolveNames=function(e,t){var n=[],a=l.shallowCopy(e);return t.forEach((function(e){null!=a[e]&&n.push(this._getAddress(a[e]).then((function(t){a[e]=t})))}),this),Promise.all(n).then((function(){return a}))},t.prototype._getResolver=function(e){var t=this;return this.getNetwork().then((function(n){n.ensAddress||y.throwError("network does not support ENS",y.UNSUPPORTED_OPERATION,{operation:"ENS",network:n.name});var a="0x0178b8bf"+c.namehash(e).substring(2),r={to:n.ensAddress,data:a};return t.call(r).then((function(e){if(32!==p.hexDataLength(e))return null;var t=o.getAddress(p.hexDataSlice(e,12));return t===d.AddressZero?null:t}))}))},t.prototype.resolveName=function(e){var t=this;if(e instanceof Promise)return e.then((function(e){return t.resolveName(e)}));try{return Promise.resolve(o.getAddress(e))}catch(t){if(p.isHexString(e))throw t}var n=this,a=c.namehash(e);return this._getResolver(e).then((function(e){if(null==e)return null;var t={to:e,data:"0x3b3b57de"+a.substring(2)};return n.call(t)})).then((function(e){if(32!==p.hexDataLength(e))return null;var t=o.getAddress(p.hexDataSlice(e,12));return t===d.AddressZero?null:t}))},t.prototype.lookupAddress=function(e){var t=this;if(e instanceof Promise)return e.then((function(e){return t.lookupAddress(e)}));var n=(e=o.getAddress(e)).substring(2)+".addr.reverse",a=c.namehash(n),r=this;return this._getResolver(n).then((function(e){if(!e)return null;var t={to:e,data:"0x691f3431"+a.substring(2)};return r.call(t)})).then((function(t){if(null==t)return null;if((t=t.substring(2)).length<64)return null;if((t=t.substring(64)).length<64)return null;var n=s.bigNumberify("0x"+t.substring(0,64)).toNumber();if(2*n>(t=t.substring(64)).length)return null;var a=I.toUtf8String("0x"+t.substring(0,2*n));return r.resolveName(a).then((function(t){return t!=e?null:a}))}))},t.checkTransactionResponse=function(e){return M(e)},t.prototype.doPoll=function(){},t.prototype.perform=function(e,t){return y.throwError(e+" not implemented",y.NOT_IMPLEMENTED,{operation:e}),null},t.prototype._startPending=function(){y.warn("WARNING: this provider does not support pending events")},t.prototype._stopPending=function(){},t.prototype._addEventListener=function(e,t,n){this._events.push({tag:Y(e),listener:t,once:n}),"pending"===e&&this._startPending(),this.polling=!0},t.prototype.on=function(e,t){return this._addEventListener(e,t,!1),this},t.prototype.once=function(e,t){return this._addEventListener(e,t,!0),this},t.prototype.addEventListener=function(e,t){return this.on(e,t)},t.prototype.emit=function(e){for(var t=this,n=[],a=1;a<arguments.length;a++)n[a-1]=arguments[a];var r=!1,A=Y(e);return this._events=this._events.filter((function(e){return e.tag!==A||(setTimeout((function(){e.listener.apply(t,n)}),0),r=!0,!e.once)})),0===this.listenerCount()&&(this.polling=!1),r},t.prototype.listenerCount=function(e){if(!e)return this._events.length;var t=Y(e);return this._events.filter((function(e){return e.tag===t})).length},t.prototype.listeners=function(e){var t=Y(e);return this._events.filter((function(e){return e.tag===t})).map((function(e){return e.listener}))},t.prototype.removeAllListeners=function(e){if(null==e)this._events=[],this._stopPending();else{var t=Y(e);this._events=this._events.filter((function(e){return e.tag!==t})),"pending"===e&&this._stopPending()}return 0===this._events.length&&(this.polling=!1),this},t.prototype.removeListener=function(e,t){var n=!1,a=Y(e);return this._events=this._events.filter((function(e){return e.tag!==a||e.listener!=t||(!!n||(n=!0,!1))})),"pending"===e&&0===this.listenerCount("pending")&&this._stopPending(),0===this.listenerCount()&&(this.polling=!1),this},t}(m.Provider);t.BaseProvider=j,l.defineReadOnly(m.Provider,"inherits",l.inheritable(m.Provider))},function(e,t,n){"use strict";var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(0));function A(e){return function(t){var n=[];return t.InfuraProvider&&n.push(new t.InfuraProvider(e)),t.EtherscanProvider&&n.push(new t.EtherscanProvider(e)),0===n.length?null:t.FallbackProvider?new t.FallbackProvider(n):n[0]}}function i(e,t){return function(n){return n.JsonRpcProvider?new n.JsonRpcProvider(e,t):null}}var o={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:A("homestead")},s={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:A("ropsten")},p={unspecified:{chainId:0,name:"unspecified"},homestead:o,mainnet:o,morden:{chainId:2,name:"morden"},ropsten:s,testnet:s,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:A("rinkeby")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:A("goerli")},kovan:{chainId:42,name:"kovan",_defaultProvider:A("kovan")},classic:{chainId:61,name:"classic",_defaultProvider:i("https://web3.gastracker.io","classic")},classicTestnet:{chainId:62,name:"classicTestnet",_defaultProvider:i("https://web3.gastracker.io/morden","classicTestnet")}};t.getNetwork=function(e){if(null==e)return null;if("number"==typeof e){for(var t in p){var n=p[t];if(n.chainId===e)return{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress||null,_defaultProvider:n._defaultProvider||null}}return{chainId:e,name:"unknown"}}if("string"==typeof e){var a=p[e];return null==a?null:{name:a.name,chainId:a.chainId,ensAddress:a.ensAddress,_defaultProvider:a._defaultProvider||null}}var A=p[e.name];return A?(0!==e.chainId&&e.chainId!==A.chainId&&r.throwError("network chainId mismatch",r.INVALID_ARGUMENT,{arg:"network",value:e}),{name:e.name,chainId:A.chainId,ensAddress:e.ensAddress||A.ensAddress||null,_defaultProvider:e._defaultProvider||A._defaultProvider||null}):("number"!=typeof e.chainId&&r.throwError("invalid network chainId",r.INVALID_ARGUMENT,{arg:"network",value:e}),e)}},function(e,t,n){"use strict";function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var A=n(198),i=n(112),o=n(5),s=n(8),p=r(n(0));t.fetchJson=function(e,t,n){var r={},o=null,d=12e4;if("string"==typeof e)o=e;else if("object"===a(e)){if(null==e.url&&p.throwError("missing URL",p.MISSING_ARGUMENT,{arg:"url"}),o=e.url,"number"==typeof e.timeout&&e.timeout>0&&(d=e.timeout),e.headers)for(var c in e.headers)r[c.toLowerCase()]={key:c,value:String(e.headers[c])};if(null!=e.user&&null!=e.password){"https:"!==o.substring(0,6)&&!0!==e.allowInsecure&&p.throwError("basic authentication requires a secure https url",p.INVALID_ARGUMENT,{arg:"url",url:o,user:e.user,password:"[REDACTED]"});var u=e.user+":"+e.password;r.authorization={key:"Authorization",value:"Basic "+i.encode(s.toUtf8Bytes(u))}}}return new Promise((function(e,a){var i=new A.XMLHttpRequest,s=null;s=setTimeout((function(){null!=s&&(s=null,a(new Error("timeout")),setTimeout((function(){i.abort()}),0))}),d);var p=function(){null!=s&&(clearTimeout(s),s=null)};t?(i.open("POST",o,!0),r["content-type"]={key:"Content-Type",value:"application/json"}):i.open("GET",o,!0),Object.keys(r).forEach((function(e){var t=r[e];i.setRequestHeader(t.key,t.value)})),i.onreadystatechange=function(){if(4===i.readyState){if(200!=i.status){p();var r=new Error("invalid response - "+i.status);return r.statusCode=i.status,i.responseText&&(r.responseText=i.responseText),void a(r)}var A=null;try{A=JSON.parse(i.responseText)}catch(r){p();var s=new Error("invalid json response");return s.orginialError=r,s.responseText=i.responseText,null!=t&&(s.requestBody=t),s.url=o,void a(s)}if(n)try{A=n(A)}catch(r){return p(),r.url=o,r.body=t,r.responseText=i.responseText,void a(r)}p(),e(A)}},i.onerror=function(e){p(),a(e)};try{null!=t?i.send(t):i.send()}catch(e){p();var c=new Error("connection error");c.error=e,a(c)}}))},t.poll=function(e,t){return t||(t={}),null==(t=o.shallowCopy(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise((function(n,a){var r=null,A=!1,i=function(){return!A&&(A=!0,r&&clearTimeout(r),!0)};t.timeout&&(r=setTimeout((function(){i()&&a(new Error("timeout"))}),t.timeout));var o=t.fastRetry||null,s=0;!function r(){return e().then((function(e){if(void 0!==e)i()&&n(e);else if(t.onceBlock)t.onceBlock.once("block",r);else if(!A){s++;var a=t.interval*parseInt(String(Math.random()*Math.pow(2,s)));a<t.floor&&(a=t.floor),a>t.ceiling&&(a=t.ceiling),o&&(s--,a=o,o=null),setTimeout(r,a)}return null}),(function(e){i()&&a(e)}))}()}))}},function(e,t,n){"use strict";var a,r=this&&this.__extends||(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),A=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var i=n(55),o=n(49),s=A(n(0)),p=n(16),d=n(1),c=n(56),u=n(5),l=n(8),g=n(57);function f(e){if(e.error){var t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function I(e){return e?e.toLowerCase():e}var h={},y=42,m=function(e){function t(n,a,r){var A=e.call(this)||this;if(s.checkNew(A,t),n!==h)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");return u.defineReadOnly(A,"provider",a),r?"string"==typeof r?u.defineReadOnly(A,"_address",p.getAddress(r)):"number"==typeof r?u.defineReadOnly(A,"_index",r):s.throwError("invalid address or index",s.INVALID_ARGUMENT,{argument:"addressOrIndex",value:r}):u.defineReadOnly(A,"_index",0),A}return r(t,e),t.prototype.getAddress=function(){var e=this;return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((function(t){return t.length<=e._index&&s.throwError("unknown account #"+e._index,s.UNSUPPORTED_OPERATION,{operation:"getAddress"}),e._address=p.getAddress(t[e._index]),e._address}))},t.prototype.getBalance=function(e){return this.provider.getBalance(this.getAddress(),e)},t.prototype.getTransactionCount=function(e){return this.provider.getTransactionCount(this.getAddress(),e)},t.prototype.sendUncheckedTransaction=function(e){var t=this;e=u.shallowCopy(e);var n=this.getAddress().then((function(e){return e&&(e=e.toLowerCase()),e}));if(null==e.gasLimit){var a=u.shallowCopy(e);a.from=n,e.gasLimit=this.provider.estimateGas(a)}return Promise.all([u.resolveProperties(e),n]).then((function(e){var n=e[0],a=B.hexlifyTransaction(n);return a.from=e[1],t.provider.send("eth_sendTransaction",[a]).then((function(e){return e}),(function(e){throw e.responseText&&(e.responseText.indexOf("insufficient funds")>=0&&s.throwError("insufficient funds",s.INSUFFICIENT_FUNDS,{transaction:n}),e.responseText.indexOf("nonce too low")>=0&&s.throwError("nonce has already been used",s.NONCE_EXPIRED,{transaction:n}),e.responseText.indexOf("replacement transaction underpriced")>=0&&s.throwError("replacement fee too low",s.REPLACEMENT_UNDERPRICED,{transaction:n})),e}))}))},t.prototype.sendTransaction=function(e){var t=this;return this.sendUncheckedTransaction(e).then((function(e){return g.poll((function(){return t.provider.getTransaction(e).then((function(n){if(null!==n)return t.provider._wrapTransaction(n,e)}))}),{fastRetry:250,onceBlock:t.provider}).catch((function(t){throw t.transactionHash=e,t}))}))},t.prototype.signMessage=function(e){var t=this,n="string"==typeof e?l.toUtf8Bytes(e):e;return this.getAddress().then((function(e){return t.provider.send("eth_sign",[e.toLowerCase(),d.hexlify(n)])}))},t.prototype.unlock=function(e){var t=this.provider;return this.getAddress().then((function(n){return t.send("personal_unlockAccount",[n.toLowerCase(),e,null])}))},t}(o.Signer);t.JsonRpcSigner=m;var C={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0},B=function(e){function t(n,a){var r=this;if("string"==typeof n&&null===a&&c.getNetwork(n)&&(a=n,n=null),a)r=e.call(this,a)||this;else{var A=new Promise((function(e,t){setTimeout((function(){r.send("net_version",[]).then((function(t){return e(c.getNetwork(parseInt(t)))})).catch((function(e){t(e)}))}))}));r=e.call(this,A)||this}return s.checkNew(r,t),n||(n="http://localhost:8545"),r.connection="string"==typeof n?{url:n}:n,r}return r(t,e),t.prototype.getSigner=function(e){return new m(h,this,e)},t.prototype.listAccounts=function(){return this.send("eth_accounts",[]).then((function(e){return e.map((function(e){return p.getAddress(e)}))}))},t.prototype.send=function(e,t){var n=this,a={method:e,params:t,id:y++,jsonrpc:"2.0"};return g.fetchJson(this.connection,JSON.stringify(a),f).then((function(e){return n.emit("debug",{action:"send",request:a,response:e,provider:n}),e}))},t.prototype.perform=function(e,n){switch(e){case"getBlockNumber":return this.send("eth_blockNumber",[]);case"getGasPrice":return this.send("eth_gasPrice",[]);case"getBalance":return this.send("eth_getBalance",[I(n.address),n.blockTag]);case"getTransactionCount":return this.send("eth_getTransactionCount",[I(n.address),n.blockTag]);case"getCode":return this.send("eth_getCode",[I(n.address),n.blockTag]);case"getStorageAt":return this.send("eth_getStorageAt",[I(n.address),n.position,n.blockTag]);case"sendTransaction":return this.send("eth_sendRawTransaction",[n.signedTransaction]).catch((function(e){throw e.responseText&&(e.responseText.indexOf("insufficient funds")>0&&s.throwError("insufficient funds",s.INSUFFICIENT_FUNDS,{}),e.responseText.indexOf("nonce too low")>0&&s.throwError("nonce has already been used",s.NONCE_EXPIRED,{}),e.responseText.indexOf("replacement transaction underpriced")>0&&s.throwError("replacement fee too low",s.REPLACEMENT_UNDERPRICED,{})),e}));case"getBlock":return n.blockTag?this.send("eth_getBlockByNumber",[n.blockTag,!!n.includeTransactions]):n.blockHash?this.send("eth_getBlockByHash",[n.blockHash,!!n.includeTransactions]):Promise.reject(new Error("invalid block tag or block hash"));case"getTransaction":return this.send("eth_getTransactionByHash",[n.transactionHash]);case"getTransactionReceipt":return this.send("eth_getTransactionReceipt",[n.transactionHash]);case"call":return this.send("eth_call",[t.hexlifyTransaction(n.transaction,{from:!0}),n.blockTag]);case"estimateGas":return this.send("eth_estimateGas",[t.hexlifyTransaction(n.transaction,{from:!0})]);case"getLogs":return n.filter&&null!=n.filter.address&&(n.filter.address=I(n.filter.address)),this.send("eth_getLogs",[n.filter])}return s.throwError(e+" not implemented",s.NOT_IMPLEMENTED,{operation:e}),null},t.prototype._startPending=function(){if(null==this._pendingFilter){var e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then((function(n){return function a(){e.send("eth_getFilterChanges",[n]).then((function(n){if(e._pendingFilter!=t)return null;var a=Promise.resolve();return n.forEach((function(t){e._emitted["t:"+t.toLowerCase()]="pending",a=a.then((function(){return e.getTransaction(t).then((function(t){return e.emit("pending",t),null}))}))})),a.then((function(){return e=1e3,new Promise((function(t){setTimeout((function(){t()}),e)}));var e}))})).then((function(){if(e._pendingFilter==t)return setTimeout((function(){a()}),0),null;e.send("eth_uninstallFilter",[n])})).catch((function(e){}))}(),n})).catch((function(e){}))}},t.prototype._stopPending=function(){this._pendingFilter=null},t.hexlifyTransaction=function(e,t){var n=u.shallowCopy(C);if(t)for(var a in t)t[a]&&(n[a]=!0);u.checkProperties(e,n);var r={};return["gasLimit","gasPrice","nonce","value"].forEach((function(t){if(null!=e[t]){var n=d.hexStripZeros(d.hexlify(e[t]));"gasLimit"===t&&(t="gas"),r[t]=n}})),["from","to","data"].forEach((function(t){null!=e[t]&&(r[t]=d.hexlify(e[t]))})),r},t}(i.BaseProvider);t.JsonRpcProvider=B},function(e,t,n){var a=n(259),r=n(260),A=n(261),i=n(262),o=n(263);function s(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var a=e[t];this.set(a[0],a[1])}}s.prototype.clear=a,s.prototype.delete=r,s.prototype.get=A,s.prototype.has=i,s.prototype.set=o,e.exports=s},function(e,t,n){var a=n(61);e.exports=function(e,t){for(var n=e.length;n--;)if(a(e[n][0],t))return n;return-1}},function(e,t){e.exports=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,n){var a=n(119),r=n(270),A=n(271),i=a?a.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?r(e):A(e)}},function(e,t,n){var a=n(81)(Object,"create");e.exports=a},function(e,t,n){var a=n(285);e.exports=function(e,t){var n=e.__data__;return a(t)?n["string"==typeof t?"string":"hash"]:n.map}},function(e,t,n){e.exports=n(3).randomBytes},function(e,t,n){e.exports=n(3).createHash},function(e,t,n){"use strict";var a=n(2),r=n(14),A=r.getNAF,i=r.getJSF,o=r.assert;function s(e,t){this.type=e,this.p=new a(t.p,16),this.red=t.prime?a.red(t.prime):a.mont(this.p),this.zero=new a(0).toRed(this.red),this.one=new a(1).toRed(this.red),this.two=new a(2).toRed(this.red),this.n=t.n&&new a(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function p(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=s,s.prototype.point=function(){throw new Error("Not implemented")},s.prototype.validate=function(){throw new Error("Not implemented")},s.prototype._fixedNafMul=function(e,t){o(e.precomputed);var n=e._getDoubles(),a=A(t,1,this._bitLength),r=(1<<n.step+1)-(n.step%2==0?2:1);r/=3;var i,s,p=[];for(i=0;i<a.length;i+=n.step){s=0;for(var d=i+n.step-1;d>=i;d--)s=(s<<1)+a[d];p.push(s)}for(var c=this.jpoint(null,null,null),u=this.jpoint(null,null,null),l=r;l>0;l--){for(i=0;i<p.length;i++)(s=p[i])===l?u=u.mixedAdd(n.points[i]):s===-l&&(u=u.mixedAdd(n.points[i].neg()));c=c.add(u)}return c.toP()},s.prototype._wnafMul=function(e,t){var n=4,a=e._getNAFPoints(n);n=a.wnd;for(var r=a.points,i=A(t,n,this._bitLength),s=this.jpoint(null,null,null),p=i.length-1;p>=0;p--){for(var d=0;p>=0&&0===i[p];p--)d++;if(p>=0&&d++,s=s.dblp(d),p<0)break;var c=i[p];o(0!==c),s="affine"===e.type?c>0?s.mixedAdd(r[c-1>>1]):s.mixedAdd(r[-c-1>>1].neg()):c>0?s.add(r[c-1>>1]):s.add(r[-c-1>>1].neg())}return"affine"===e.type?s.toP():s},s.prototype._wnafMulAdd=function(e,t,n,a,r){var o,s,p,d=this._wnafT1,c=this._wnafT2,u=this._wnafT3,l=0;for(o=0;o<a;o++){var g=(p=t[o])._getNAFPoints(e);d[o]=g.wnd,c[o]=g.points}for(o=a-1;o>=1;o-=2){var f=o-1,I=o;if(1===d[f]&&1===d[I]){var h=[t[f],null,null,t[I]];0===t[f].y.cmp(t[I].y)?(h[1]=t[f].add(t[I]),h[2]=t[f].toJ().mixedAdd(t[I].neg())):0===t[f].y.cmp(t[I].y.redNeg())?(h[1]=t[f].toJ().mixedAdd(t[I]),h[2]=t[f].add(t[I].neg())):(h[1]=t[f].toJ().mixedAdd(t[I]),h[2]=t[f].toJ().mixedAdd(t[I].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],m=i(n[f],n[I]);for(l=Math.max(m[0].length,l),u[f]=new Array(l),u[I]=new Array(l),s=0;s<l;s++){var C=0|m[0][s],B=0|m[1][s];u[f][s]=y[3*(C+1)+(B+1)],u[I][s]=0,c[f]=h}}else u[f]=A(n[f],d[f],this._bitLength),u[I]=A(n[I],d[I],this._bitLength),l=Math.max(u[f].length,l),l=Math.max(u[I].length,l)}var E=this.jpoint(null,null,null),b=this._wnafT4;for(o=l;o>=0;o--){for(var Q=0;o>=0;){var v=!0;for(s=0;s<a;s++)b[s]=0|u[s][o],0!==b[s]&&(v=!1);if(!v)break;Q++,o--}if(o>=0&&Q++,E=E.dblp(Q),o<0)break;for(s=0;s<a;s++){var w=b[s];0!==w&&(w>0?p=c[s][w-1>>1]:w<0&&(p=c[s][-w-1>>1].neg()),E="affine"===p.type?E.mixedAdd(p):E.add(p))}}for(o=0;o<a;o++)c[o]=null;return r?E:E.toP()},s.BasePoint=p,p.prototype.eq=function(){throw new Error("Not implemented")},p.prototype.validate=function(){return this.curve.validate(this)},s.prototype.decodePoint=function(e,t){e=r.toArray(e,t);var n=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*n)return 6===e[0]?o(e[e.length-1]%2==0):7===e[0]&&o(e[e.length-1]%2==1),this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));if((2===e[0]||3===e[0])&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),3===e[0]);throw new Error("Unknown point format")},p.prototype.encodeCompressed=function(e){return this.encode(e,!0)},p.prototype._encode=function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))},p.prototype.encode=function(e,t){return r.encode(this._encode(t),e)},p.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},p.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},p.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],a=this,r=0;r<t;r+=e){for(var A=0;A<e;A++)a=a.dbl();n.push(a)}return{step:e,points:n}},p.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,a=1===n?null:this.dbl(),r=1;r<n;r++)t[r]=t[r-1].add(a);return{wnd:e,points:t}},p.prototype._getBeta=function(){return null},p.prototype.dblp=function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t}},function(e,t){e.exports=require("http")},function(e,t,n){"use strict";
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var a in n)("object"==typeof exports?exports:e)[a]=n[a]}}(global,(function(){return function(e){var t={};function n(a){if(t[a])return t[a].exports;var r=t[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(a,r,function(t){return e[t]}.bind(null,r));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=158)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(98);t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.MISSING_NEW="MISSING_NEW",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.NUMERIC_FAULT="NUMERIC_FAULT",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION";var r=!1,A=!1;function i(e,n,r){if(A)throw new Error("unknown error");n||(n=t.UNKNOWN_ERROR),r||(r={});var i=[];Object.keys(r).forEach((function(e){try{i.push(e+"="+JSON.stringify(r[e]))}catch(t){i.push(e+"="+JSON.stringify(r[e].toString()))}})),i.push("version="+a.version);var o=e;i.length&&(e+=" ("+i.join(", ")+")");var s=new Error(e);throw s.reason=o,s.code=n,Object.keys(r).forEach((function(e){s[e]=r[e]})),s}t.throwError=i,t.checkNew=function(e,n){e instanceof n||i("missing new",t.MISSING_NEW,{name:n.name})},t.checkArgumentCount=function(e,n,a){a||(a=""),e<n&&i("missing argument"+a,t.MISSING_ARGUMENT,{count:e,expectedCount:n}),e>n&&i("too many arguments"+a,t.UNEXPECTED_ARGUMENT,{count:e,expectedCount:n})},t.setCensorship=function(e,n){r&&i("error censorship permanent",t.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),A=!!e,r=!!n},t.checkNormalize=function(){try{if(["NFD","NFC","NFKD","NFKC"].forEach((function(e){try{"test".normalize(e)}catch(t){throw new Error("missing "+e)}})),String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){i("platform missing String.prototype.normalize",t.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:e.message})}};var o={debug:1,default:2,info:2,warn:3,error:4,off:5},s=o.default;function p(e,t){s>o[e]||console.log.apply(console,t)}function d(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];p("warn",e)}t.setLogLevel=function(e){var t=o[e];null!=t?s=t:d("invliad log level - "+e)},t.warn=d,t.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];p("info",e)}},function(e,t,n){"use strict";function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var A=r(n(0));function i(e){return!!e.toHexString}function o(e){return e.slice?e:(e.slice=function(){var t=Array.prototype.slice.call(arguments);return o(new Uint8Array(Array.prototype.slice.apply(e,t)))},e)}function s(e){if(!e||parseInt(String(e.length))!=e.length||"string"==typeof e)return!1;for(var t=0;t<e.length;t++){var n=e[t];if(n<0||n>=256||parseInt(String(n))!=n)return!1}return!0}function p(e){if(null==e&&A.throwError("cannot convert null value to array",A.INVALID_ARGUMENT,{arg:"value",value:e}),i(e)&&(e=e.toHexString()),"string"==typeof e){var t=e.match(/^(0x)?[0-9a-fA-F]*$/);t||A.throwError("invalid hexidecimal string",A.INVALID_ARGUMENT,{arg:"value",value:e}),"0x"!==t[1]&&A.throwError("hex string must have 0x prefix",A.INVALID_ARGUMENT,{arg:"value",value:e}),(e=e.substring(2)).length%2&&(e="0"+e);for(var n=[],r=0;r<e.length;r+=2)n.push(parseInt(e.substr(r,2),16));return o(new Uint8Array(n))}return s(e)?o(new Uint8Array(e)):(A.throwError("invalid arrayify value",null,{arg:"value",value:e,type:a(e)}),null)}function d(e){for(var t=[],n=0,a=0;a<e.length;a++){var r=p(e[a]);t.push(r),n+=r.length}var A=new Uint8Array(n),i=0;for(a=0;a<t.length;a++)A.set(t[a],i),i+=t[a].length;return o(A)}function c(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}t.isHexable=i,t.isArrayish=s,t.arrayify=p,t.concat=d,t.stripZeros=function(e){var t=p(e);if(0===t.length)return t;for(var n=0;0===t[n];)n++;return n&&(t=t.slice(n)),t},t.padZeros=function(e,t){if(t<(e=p(e)).length)throw new Error("cannot pad");var n=new Uint8Array(t);return n.set(e,t-e.length),o(n)},t.isHexString=c;function u(e){if(i(e))return e.toHexString();if("number"==typeof e){e<0&&A.throwError("cannot hexlify negative value",A.INVALID_ARGUMENT,{arg:"value",value:e}),e>=9007199254740991&&A.throwError("out-of-range",A.NUMERIC_FAULT,{operartion:"hexlify",fault:"out-of-safe-range"});for(var t="";e;)t="0123456789abcdef"[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("string"==typeof e){var n=e.match(/^(0x)?[0-9a-fA-F]*$/);return n||A.throwError("invalid hexidecimal string",A.INVALID_ARGUMENT,{arg:"value",value:e}),"0x"!==n[1]&&A.throwError("hex string must have 0x prefix",A.INVALID_ARGUMENT,{arg:"value",value:e}),e.length%2&&(e="0x0"+e.substring(2)),e}if(s(e)){for(var a=[],r=0;r<e.length;r++){var o=e[r];a.push("0123456789abcdef"[(240&o)>>4]+"0123456789abcdef"[15&o])}return"0x"+a.join("")}return A.throwError("invalid hexlify value",null,{arg:"value",value:e}),"never"}function l(e,t){for(c(e)||A.throwError("invalid hex string",A.INVALID_ARGUMENT,{arg:"value",value:e});e.length<2*t+2;)e="0x0"+e.substring(2);return e}function g(e){var t,n=0,a="0x",r="0x";if((t=e)&&null!=t.r&&null!=t.s){null==e.v&&null==e.recoveryParam&&A.throwError("at least on of recoveryParam or v must be specified",A.INVALID_ARGUMENT,{argument:"signature",value:e}),a=l(e.r,32),r=l(e.s,32),"string"==typeof(n=e.v)&&(n=parseInt(n,16));var i=e.recoveryParam;null==i&&null!=e.v&&(i=1-n%2),n=27+i}else{var o=p(e);if(65!==o.length)throw new Error("invalid signature");a=u(o.slice(0,32)),r=u(o.slice(32,64)),27!==(n=o[64])&&28!==n&&(n=27+n%2)}return{r:a,s:r,recoveryParam:n-27,v:n}}t.hexlify=u,t.hexDataLength=function(e){return c(e)&&e.length%2==0?(e.length-2)/2:null},t.hexDataSlice=function(e,t,n){return c(e)||A.throwError("invalid hex data",A.INVALID_ARGUMENT,{arg:"value",value:e}),e.length%2!=0&&A.throwError("hex data length must be even",A.INVALID_ARGUMENT,{arg:"value",value:e}),t=2+2*t,null!=n?"0x"+e.substring(t,2+2*n):"0x"+e.substring(t)},t.hexStripZeros=function(e){for(c(e)||A.throwError("invalid hex string",A.INVALID_ARGUMENT,{arg:"value",value:e});e.length>3&&"0x0"===e.substring(0,3);)e="0x"+e.substring(3);return e},t.hexZeroPad=l,t.splitSignature=g,t.joinSignature=function(e){return u(d([(e=g(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}},function(e,t,n){(function(e){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e,a){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function A(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var o;"object"===t(e)?e.exports=i:a.BN=i,i.BN=i,i.wordSize=26;try{o=n(28).Buffer}catch(e){}function s(e,t,n){for(var a=0,A=Math.min(e.length,n),i=0,o=t;o<A;o++){var s,p=e.charCodeAt(o)-48;a<<=4,a|=s=p>=49&&p<=54?p-49+10:p>=17&&p<=22?p-17+10:p,i|=s}return r(!(240&i),"Invalid character in "+e),a}function p(e,t,n,a){for(var A=0,i=0,o=Math.min(e.length,n),s=t;s<o;s++){var p=e.charCodeAt(s)-48;A*=a,i=p>=49?p-49+10:p>=17?p-17+10:p,r(p>=0&&i<a,"Invalid character"),A+=i}return A}function d(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}function c(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}i.isBN=function(e){return e instanceof i||null!==e&&"object"===t(e)&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,n,a){if("number"==typeof e)return this._initNumber(e,n,a);if("object"===t(e))return this._initArray(e,n,a);"hex"===n&&(n=16),r(n===(0|n)&&n>=2&&n<=36);var A=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&A++,16===n?this._parseHex(e,A):this._parseBase(e,n,A),"-"===e[0]&&(this.negative=1),this._strip(),"le"===a&&this._initArray(this.toArray(),n,a)},i.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},i.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var a=0;a<this.length;a++)this.words[a]=0;var A,i,o=0;if("be"===n)for(a=e.length-1,A=0;a>=0;a-=3)i=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[A]|=i<<o&67108863,this.words[A+1]=i>>>26-o&67108863,(o+=24)>=26&&(o-=26,A++);else if("le"===n)for(a=0,A=0;a<e.length;a+=3)i=e[a]|e[a+1]<<8|e[a+2]<<16,this.words[A]|=i<<o&67108863,this.words[A+1]=i>>>26-o&67108863,(o+=24)>=26&&(o-=26,A++);return this._strip()},i.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var a,r,A=0;for(n=e.length-6,a=0;n>=t;n-=6)r=s(e,n,n+6),this.words[a]|=r<<A&67108863,this.words[a+1]|=r>>>26-A&4194303,(A+=24)>=26&&(A-=26,a++);n+6!==t&&(r=s(e,t,n+6),this.words[a]|=r<<A&67108863,this.words[a+1]|=r>>>26-A&4194303),this._strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var a=0,r=1;r<=67108863;r*=t)a++;a--,r=r/t|0;for(var A=e.length-n,i=A%a,o=Math.min(A,A-i)+n,s=0,d=n;d<o;d+=a)s=p(e,d,d+a,t),this.imuln(r),this.words[0]+s<67108864?this.words[0]+=s:this._iaddn(s);if(0!==i){var c=1;for(s=p(e,d,e.length,t),d=0;d<i;d++)c*=t;this.imuln(c),this.words[0]+s<67108864?this.words[0]+=s:this._iaddn(s)}},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){d(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for?i.prototype[Symbol.for("nodejs.util.inspect.custom")]=c:i.prototype.inspect=c;var u=["","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],g=[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];i.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var a=0,A=0,i=0;i<this.length;i++){var o=this.words[i],s=(16777215&(o<<a|A)).toString(16);n=0!==(A=o>>>24-a&16777215)||i!==this.length-1?u[6-s.length]+s+n:s+n,(a+=2)>=26&&(a-=26,i--)}for(0!==A&&(n=A.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var p=l[e],d=g[e];n="";var c=this.clone();for(c.negative=0;!c.isZero();){var f=c.modrn(d).toString(e);n=(c=c.idivn(d)).isZero()?f+n:u[p-f.length]+f+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function f(e,t,n){n.negative=t.negative^e.negative;var a=e.length+t.length|0;n.length=a,a=a-1|0;var r=0|e.words[0],A=0|t.words[0],i=r*A,o=67108863&i,s=i/67108864|0;n.words[0]=o;for(var p=1;p<a;p++){for(var d=s>>>26,c=67108863&s,u=Math.min(p,t.length-1),l=Math.max(0,p-e.length+1);l<=u;l++){var g=p-l|0;d+=(i=(r=0|e.words[g])*(A=0|t.words[l])+c)/67108864|0,c=67108863&i}n.words[p]=0|c,s=0|d}return 0!==s?n.words[p]=0|s:n.length--,n._strip()}i.prototype.toArrayLike=function(e,t,n){this._strip();var a=this.byteLength(),A=n||Math.max(1,a);r(a<=A,"byte array longer than desired length"),r(A>0,"Requested array length <= 0");var i=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,A);return this["_toArrayLike"+("le"===t?"LE":"BE")](i,a),i},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,a=0,r=0,A=0;r<this.length;r++){var i=this.words[r]<<A|a;e[n++]=255&i,n<e.length&&(e[n++]=i>>8&255),n<e.length&&(e[n++]=i>>16&255),6===A?(n<e.length&&(e[n++]=i>>24&255),a=0,A=0):(a=i>>>24,A+=2)}if(n<e.length)for(e[n++]=a;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,a=0,r=0,A=0;r<this.length;r++){var i=this.words[r]<<A|a;e[n--]=255&i,n>=0&&(e[n--]=i>>8&255),n>=0&&(e[n--]=i>>16&255),6===A?(n>=0&&(e[n--]=i>>24&255),a=0,A=0):(a=i>>>24,A+=2)}if(n>=0)for(e[n--]=a;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var a=0;a<n.length;a++)this.words[a]=t.words[a]^n.words[a];if(this!==t)for(;a<t.length;a++)this.words[a]=t.words[a];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var a=0;a<t;a++)this.words[a]=67108863&~this.words[a];return n>0&&(this.words[a]=~this.words[a]&67108863>>26-n),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,a=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<a:this.words[n]&~(1<<a),this._strip()},i.prototype.iadd=function(e){var t,n,a;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,a=e):(n=e,a=this);for(var r=0,A=0;A<a.length;A++)t=(0|n.words[A])+(0|a.words[A])+r,this.words[A]=67108863&t,r=t>>>26;for(;0!==r&&A<n.length;A++)t=(0|n.words[A])+r,this.words[A]=67108863&t,r=t>>>26;if(this.length=n.length,0!==r)this.words[this.length]=r,this.length++;else if(n!==this)for(;A<n.length;A++)this.words[A]=n.words[A];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,a,r=this.cmp(e);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;r>0?(n=this,a=e):(n=e,a=this);for(var A=0,i=0;i<a.length;i++)A=(t=(0|n.words[i])-(0|a.words[i])+A)>>26,this.words[i]=67108863&t;for(;0!==A&&i<n.length;i++)A=(t=(0|n.words[i])+A)>>26,this.words[i]=67108863&t;if(0===A&&i<n.length&&n!==this)for(;i<n.length;i++)this.words[i]=n.words[i];return this.length=Math.max(this.length,i),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var I=function(e,t,n){var a,r,A,i=e.words,o=t.words,s=n.words,p=0,d=0|i[0],c=8191&d,u=d>>>13,l=0|i[1],g=8191&l,f=l>>>13,I=0|i[2],h=8191&I,y=I>>>13,m=0|i[3],C=8191&m,B=m>>>13,E=0|i[4],b=8191&E,Q=E>>>13,v=0|i[5],w=8191&v,D=v>>>13,M=0|i[6],S=8191&M,k=M>>>13,x=0|i[7],R=8191&x,N=x>>>13,F=0|i[8],_=8191&F,T=F>>>13,H=0|i[9],L=8191&H,G=H>>>13,U=0|o[0],O=8191&U,P=U>>>13,Y=0|o[1],J=8191&Y,j=Y>>>13,K=0|o[2],q=8191&K,V=K>>>13,z=0|o[3],Z=8191&z,X=z>>>13,W=0|o[4],$=8191&W,ee=W>>>13,te=0|o[5],ne=8191&te,ae=te>>>13,re=0|o[6],Ae=8191&re,ie=re>>>13,oe=0|o[7],se=8191&oe,pe=oe>>>13,de=0|o[8],ce=8191&de,ue=de>>>13,le=0|o[9],ge=8191&le,fe=le>>>13;n.negative=e.negative^t.negative,n.length=19;var Ie=(p+(a=Math.imul(c,O))|0)+((8191&(r=(r=Math.imul(c,P))+Math.imul(u,O)|0))<<13)|0;p=((A=Math.imul(u,P))+(r>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,a=Math.imul(g,O),r=(r=Math.imul(g,P))+Math.imul(f,O)|0,A=Math.imul(f,P);var he=(p+(a=a+Math.imul(c,J)|0)|0)+((8191&(r=(r=r+Math.imul(c,j)|0)+Math.imul(u,J)|0))<<13)|0;p=((A=A+Math.imul(u,j)|0)+(r>>>13)|0)+(he>>>26)|0,he&=67108863,a=Math.imul(h,O),r=(r=Math.imul(h,P))+Math.imul(y,O)|0,A=Math.imul(y,P),a=a+Math.imul(g,J)|0,r=(r=r+Math.imul(g,j)|0)+Math.imul(f,J)|0,A=A+Math.imul(f,j)|0;var ye=(p+(a=a+Math.imul(c,q)|0)|0)+((8191&(r=(r=r+Math.imul(c,V)|0)+Math.imul(u,q)|0))<<13)|0;p=((A=A+Math.imul(u,V)|0)+(r>>>13)|0)+(ye>>>26)|0,ye&=67108863,a=Math.imul(C,O),r=(r=Math.imul(C,P))+Math.imul(B,O)|0,A=Math.imul(B,P),a=a+Math.imul(h,J)|0,r=(r=r+Math.imul(h,j)|0)+Math.imul(y,J)|0,A=A+Math.imul(y,j)|0,a=a+Math.imul(g,q)|0,r=(r=r+Math.imul(g,V)|0)+Math.imul(f,q)|0,A=A+Math.imul(f,V)|0;var me=(p+(a=a+Math.imul(c,Z)|0)|0)+((8191&(r=(r=r+Math.imul(c,X)|0)+Math.imul(u,Z)|0))<<13)|0;p=((A=A+Math.imul(u,X)|0)+(r>>>13)|0)+(me>>>26)|0,me&=67108863,a=Math.imul(b,O),r=(r=Math.imul(b,P))+Math.imul(Q,O)|0,A=Math.imul(Q,P),a=a+Math.imul(C,J)|0,r=(r=r+Math.imul(C,j)|0)+Math.imul(B,J)|0,A=A+Math.imul(B,j)|0,a=a+Math.imul(h,q)|0,r=(r=r+Math.imul(h,V)|0)+Math.imul(y,q)|0,A=A+Math.imul(y,V)|0,a=a+Math.imul(g,Z)|0,r=(r=r+Math.imul(g,X)|0)+Math.imul(f,Z)|0,A=A+Math.imul(f,X)|0;var Ce=(p+(a=a+Math.imul(c,$)|0)|0)+((8191&(r=(r=r+Math.imul(c,ee)|0)+Math.imul(u,$)|0))<<13)|0;p=((A=A+Math.imul(u,ee)|0)+(r>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,a=Math.imul(w,O),r=(r=Math.imul(w,P))+Math.imul(D,O)|0,A=Math.imul(D,P),a=a+Math.imul(b,J)|0,r=(r=r+Math.imul(b,j)|0)+Math.imul(Q,J)|0,A=A+Math.imul(Q,j)|0,a=a+Math.imul(C,q)|0,r=(r=r+Math.imul(C,V)|0)+Math.imul(B,q)|0,A=A+Math.imul(B,V)|0,a=a+Math.imul(h,Z)|0,r=(r=r+Math.imul(h,X)|0)+Math.imul(y,Z)|0,A=A+Math.imul(y,X)|0,a=a+Math.imul(g,$)|0,r=(r=r+Math.imul(g,ee)|0)+Math.imul(f,$)|0,A=A+Math.imul(f,ee)|0;var Be=(p+(a=a+Math.imul(c,ne)|0)|0)+((8191&(r=(r=r+Math.imul(c,ae)|0)+Math.imul(u,ne)|0))<<13)|0;p=((A=A+Math.imul(u,ae)|0)+(r>>>13)|0)+(Be>>>26)|0,Be&=67108863,a=Math.imul(S,O),r=(r=Math.imul(S,P))+Math.imul(k,O)|0,A=Math.imul(k,P),a=a+Math.imul(w,J)|0,r=(r=r+Math.imul(w,j)|0)+Math.imul(D,J)|0,A=A+Math.imul(D,j)|0,a=a+Math.imul(b,q)|0,r=(r=r+Math.imul(b,V)|0)+Math.imul(Q,q)|0,A=A+Math.imul(Q,V)|0,a=a+Math.imul(C,Z)|0,r=(r=r+Math.imul(C,X)|0)+Math.imul(B,Z)|0,A=A+Math.imul(B,X)|0,a=a+Math.imul(h,$)|0,r=(r=r+Math.imul(h,ee)|0)+Math.imul(y,$)|0,A=A+Math.imul(y,ee)|0,a=a+Math.imul(g,ne)|0,r=(r=r+Math.imul(g,ae)|0)+Math.imul(f,ne)|0,A=A+Math.imul(f,ae)|0;var Ee=(p+(a=a+Math.imul(c,Ae)|0)|0)+((8191&(r=(r=r+Math.imul(c,ie)|0)+Math.imul(u,Ae)|0))<<13)|0;p=((A=A+Math.imul(u,ie)|0)+(r>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,a=Math.imul(R,O),r=(r=Math.imul(R,P))+Math.imul(N,O)|0,A=Math.imul(N,P),a=a+Math.imul(S,J)|0,r=(r=r+Math.imul(S,j)|0)+Math.imul(k,J)|0,A=A+Math.imul(k,j)|0,a=a+Math.imul(w,q)|0,r=(r=r+Math.imul(w,V)|0)+Math.imul(D,q)|0,A=A+Math.imul(D,V)|0,a=a+Math.imul(b,Z)|0,r=(r=r+Math.imul(b,X)|0)+Math.imul(Q,Z)|0,A=A+Math.imul(Q,X)|0,a=a+Math.imul(C,$)|0,r=(r=r+Math.imul(C,ee)|0)+Math.imul(B,$)|0,A=A+Math.imul(B,ee)|0,a=a+Math.imul(h,ne)|0,r=(r=r+Math.imul(h,ae)|0)+Math.imul(y,ne)|0,A=A+Math.imul(y,ae)|0,a=a+Math.imul(g,Ae)|0,r=(r=r+Math.imul(g,ie)|0)+Math.imul(f,Ae)|0,A=A+Math.imul(f,ie)|0;var be=(p+(a=a+Math.imul(c,se)|0)|0)+((8191&(r=(r=r+Math.imul(c,pe)|0)+Math.imul(u,se)|0))<<13)|0;p=((A=A+Math.imul(u,pe)|0)+(r>>>13)|0)+(be>>>26)|0,be&=67108863,a=Math.imul(_,O),r=(r=Math.imul(_,P))+Math.imul(T,O)|0,A=Math.imul(T,P),a=a+Math.imul(R,J)|0,r=(r=r+Math.imul(R,j)|0)+Math.imul(N,J)|0,A=A+Math.imul(N,j)|0,a=a+Math.imul(S,q)|0,r=(r=r+Math.imul(S,V)|0)+Math.imul(k,q)|0,A=A+Math.imul(k,V)|0,a=a+Math.imul(w,Z)|0,r=(r=r+Math.imul(w,X)|0)+Math.imul(D,Z)|0,A=A+Math.imul(D,X)|0,a=a+Math.imul(b,$)|0,r=(r=r+Math.imul(b,ee)|0)+Math.imul(Q,$)|0,A=A+Math.imul(Q,ee)|0,a=a+Math.imul(C,ne)|0,r=(r=r+Math.imul(C,ae)|0)+Math.imul(B,ne)|0,A=A+Math.imul(B,ae)|0,a=a+Math.imul(h,Ae)|0,r=(r=r+Math.imul(h,ie)|0)+Math.imul(y,Ae)|0,A=A+Math.imul(y,ie)|0,a=a+Math.imul(g,se)|0,r=(r=r+Math.imul(g,pe)|0)+Math.imul(f,se)|0,A=A+Math.imul(f,pe)|0;var Qe=(p+(a=a+Math.imul(c,ce)|0)|0)+((8191&(r=(r=r+Math.imul(c,ue)|0)+Math.imul(u,ce)|0))<<13)|0;p=((A=A+Math.imul(u,ue)|0)+(r>>>13)|0)+(Qe>>>26)|0,Qe&=67108863,a=Math.imul(L,O),r=(r=Math.imul(L,P))+Math.imul(G,O)|0,A=Math.imul(G,P),a=a+Math.imul(_,J)|0,r=(r=r+Math.imul(_,j)|0)+Math.imul(T,J)|0,A=A+Math.imul(T,j)|0,a=a+Math.imul(R,q)|0,r=(r=r+Math.imul(R,V)|0)+Math.imul(N,q)|0,A=A+Math.imul(N,V)|0,a=a+Math.imul(S,Z)|0,r=(r=r+Math.imul(S,X)|0)+Math.imul(k,Z)|0,A=A+Math.imul(k,X)|0,a=a+Math.imul(w,$)|0,r=(r=r+Math.imul(w,ee)|0)+Math.imul(D,$)|0,A=A+Math.imul(D,ee)|0,a=a+Math.imul(b,ne)|0,r=(r=r+Math.imul(b,ae)|0)+Math.imul(Q,ne)|0,A=A+Math.imul(Q,ae)|0,a=a+Math.imul(C,Ae)|0,r=(r=r+Math.imul(C,ie)|0)+Math.imul(B,Ae)|0,A=A+Math.imul(B,ie)|0,a=a+Math.imul(h,se)|0,r=(r=r+Math.imul(h,pe)|0)+Math.imul(y,se)|0,A=A+Math.imul(y,pe)|0,a=a+Math.imul(g,ce)|0,r=(r=r+Math.imul(g,ue)|0)+Math.imul(f,ce)|0,A=A+Math.imul(f,ue)|0;var ve=(p+(a=a+Math.imul(c,ge)|0)|0)+((8191&(r=(r=r+Math.imul(c,fe)|0)+Math.imul(u,ge)|0))<<13)|0;p=((A=A+Math.imul(u,fe)|0)+(r>>>13)|0)+(ve>>>26)|0,ve&=67108863,a=Math.imul(L,J),r=(r=Math.imul(L,j))+Math.imul(G,J)|0,A=Math.imul(G,j),a=a+Math.imul(_,q)|0,r=(r=r+Math.imul(_,V)|0)+Math.imul(T,q)|0,A=A+Math.imul(T,V)|0,a=a+Math.imul(R,Z)|0,r=(r=r+Math.imul(R,X)|0)+Math.imul(N,Z)|0,A=A+Math.imul(N,X)|0,a=a+Math.imul(S,$)|0,r=(r=r+Math.imul(S,ee)|0)+Math.imul(k,$)|0,A=A+Math.imul(k,ee)|0,a=a+Math.imul(w,ne)|0,r=(r=r+Math.imul(w,ae)|0)+Math.imul(D,ne)|0,A=A+Math.imul(D,ae)|0,a=a+Math.imul(b,Ae)|0,r=(r=r+Math.imul(b,ie)|0)+Math.imul(Q,Ae)|0,A=A+Math.imul(Q,ie)|0,a=a+Math.imul(C,se)|0,r=(r=r+Math.imul(C,pe)|0)+Math.imul(B,se)|0,A=A+Math.imul(B,pe)|0,a=a+Math.imul(h,ce)|0,r=(r=r+Math.imul(h,ue)|0)+Math.imul(y,ce)|0,A=A+Math.imul(y,ue)|0;var we=(p+(a=a+Math.imul(g,ge)|0)|0)+((8191&(r=(r=r+Math.imul(g,fe)|0)+Math.imul(f,ge)|0))<<13)|0;p=((A=A+Math.imul(f,fe)|0)+(r>>>13)|0)+(we>>>26)|0,we&=67108863,a=Math.imul(L,q),r=(r=Math.imul(L,V))+Math.imul(G,q)|0,A=Math.imul(G,V),a=a+Math.imul(_,Z)|0,r=(r=r+Math.imul(_,X)|0)+Math.imul(T,Z)|0,A=A+Math.imul(T,X)|0,a=a+Math.imul(R,$)|0,r=(r=r+Math.imul(R,ee)|0)+Math.imul(N,$)|0,A=A+Math.imul(N,ee)|0,a=a+Math.imul(S,ne)|0,r=(r=r+Math.imul(S,ae)|0)+Math.imul(k,ne)|0,A=A+Math.imul(k,ae)|0,a=a+Math.imul(w,Ae)|0,r=(r=r+Math.imul(w,ie)|0)+Math.imul(D,Ae)|0,A=A+Math.imul(D,ie)|0,a=a+Math.imul(b,se)|0,r=(r=r+Math.imul(b,pe)|0)+Math.imul(Q,se)|0,A=A+Math.imul(Q,pe)|0,a=a+Math.imul(C,ce)|0,r=(r=r+Math.imul(C,ue)|0)+Math.imul(B,ce)|0,A=A+Math.imul(B,ue)|0;var De=(p+(a=a+Math.imul(h,ge)|0)|0)+((8191&(r=(r=r+Math.imul(h,fe)|0)+Math.imul(y,ge)|0))<<13)|0;p=((A=A+Math.imul(y,fe)|0)+(r>>>13)|0)+(De>>>26)|0,De&=67108863,a=Math.imul(L,Z),r=(r=Math.imul(L,X))+Math.imul(G,Z)|0,A=Math.imul(G,X),a=a+Math.imul(_,$)|0,r=(r=r+Math.imul(_,ee)|0)+Math.imul(T,$)|0,A=A+Math.imul(T,ee)|0,a=a+Math.imul(R,ne)|0,r=(r=r+Math.imul(R,ae)|0)+Math.imul(N,ne)|0,A=A+Math.imul(N,ae)|0,a=a+Math.imul(S,Ae)|0,r=(r=r+Math.imul(S,ie)|0)+Math.imul(k,Ae)|0,A=A+Math.imul(k,ie)|0,a=a+Math.imul(w,se)|0,r=(r=r+Math.imul(w,pe)|0)+Math.imul(D,se)|0,A=A+Math.imul(D,pe)|0,a=a+Math.imul(b,ce)|0,r=(r=r+Math.imul(b,ue)|0)+Math.imul(Q,ce)|0,A=A+Math.imul(Q,ue)|0;var Me=(p+(a=a+Math.imul(C,ge)|0)|0)+((8191&(r=(r=r+Math.imul(C,fe)|0)+Math.imul(B,ge)|0))<<13)|0;p=((A=A+Math.imul(B,fe)|0)+(r>>>13)|0)+(Me>>>26)|0,Me&=67108863,a=Math.imul(L,$),r=(r=Math.imul(L,ee))+Math.imul(G,$)|0,A=Math.imul(G,ee),a=a+Math.imul(_,ne)|0,r=(r=r+Math.imul(_,ae)|0)+Math.imul(T,ne)|0,A=A+Math.imul(T,ae)|0,a=a+Math.imul(R,Ae)|0,r=(r=r+Math.imul(R,ie)|0)+Math.imul(N,Ae)|0,A=A+Math.imul(N,ie)|0,a=a+Math.imul(S,se)|0,r=(r=r+Math.imul(S,pe)|0)+Math.imul(k,se)|0,A=A+Math.imul(k,pe)|0,a=a+Math.imul(w,ce)|0,r=(r=r+Math.imul(w,ue)|0)+Math.imul(D,ce)|0,A=A+Math.imul(D,ue)|0;var Se=(p+(a=a+Math.imul(b,ge)|0)|0)+((8191&(r=(r=r+Math.imul(b,fe)|0)+Math.imul(Q,ge)|0))<<13)|0;p=((A=A+Math.imul(Q,fe)|0)+(r>>>13)|0)+(Se>>>26)|0,Se&=67108863,a=Math.imul(L,ne),r=(r=Math.imul(L,ae))+Math.imul(G,ne)|0,A=Math.imul(G,ae),a=a+Math.imul(_,Ae)|0,r=(r=r+Math.imul(_,ie)|0)+Math.imul(T,Ae)|0,A=A+Math.imul(T,ie)|0,a=a+Math.imul(R,se)|0,r=(r=r+Math.imul(R,pe)|0)+Math.imul(N,se)|0,A=A+Math.imul(N,pe)|0,a=a+Math.imul(S,ce)|0,r=(r=r+Math.imul(S,ue)|0)+Math.imul(k,ce)|0,A=A+Math.imul(k,ue)|0;var ke=(p+(a=a+Math.imul(w,ge)|0)|0)+((8191&(r=(r=r+Math.imul(w,fe)|0)+Math.imul(D,ge)|0))<<13)|0;p=((A=A+Math.imul(D,fe)|0)+(r>>>13)|0)+(ke>>>26)|0,ke&=67108863,a=Math.imul(L,Ae),r=(r=Math.imul(L,ie))+Math.imul(G,Ae)|0,A=Math.imul(G,ie),a=a+Math.imul(_,se)|0,r=(r=r+Math.imul(_,pe)|0)+Math.imul(T,se)|0,A=A+Math.imul(T,pe)|0,a=a+Math.imul(R,ce)|0,r=(r=r+Math.imul(R,ue)|0)+Math.imul(N,ce)|0,A=A+Math.imul(N,ue)|0;var xe=(p+(a=a+Math.imul(S,ge)|0)|0)+((8191&(r=(r=r+Math.imul(S,fe)|0)+Math.imul(k,ge)|0))<<13)|0;p=((A=A+Math.imul(k,fe)|0)+(r>>>13)|0)+(xe>>>26)|0,xe&=67108863,a=Math.imul(L,se),r=(r=Math.imul(L,pe))+Math.imul(G,se)|0,A=Math.imul(G,pe),a=a+Math.imul(_,ce)|0,r=(r=r+Math.imul(_,ue)|0)+Math.imul(T,ce)|0,A=A+Math.imul(T,ue)|0;var Re=(p+(a=a+Math.imul(R,ge)|0)|0)+((8191&(r=(r=r+Math.imul(R,fe)|0)+Math.imul(N,ge)|0))<<13)|0;p=((A=A+Math.imul(N,fe)|0)+(r>>>13)|0)+(Re>>>26)|0,Re&=67108863,a=Math.imul(L,ce),r=(r=Math.imul(L,ue))+Math.imul(G,ce)|0,A=Math.imul(G,ue);var Ne=(p+(a=a+Math.imul(_,ge)|0)|0)+((8191&(r=(r=r+Math.imul(_,fe)|0)+Math.imul(T,ge)|0))<<13)|0;p=((A=A+Math.imul(T,fe)|0)+(r>>>13)|0)+(Ne>>>26)|0,Ne&=67108863;var Fe=(p+(a=Math.imul(L,ge))|0)+((8191&(r=(r=Math.imul(L,fe))+Math.imul(G,ge)|0))<<13)|0;return p=((A=Math.imul(G,fe))+(r>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,s[0]=Ie,s[1]=he,s[2]=ye,s[3]=me,s[4]=Ce,s[5]=Be,s[6]=Ee,s[7]=be,s[8]=Qe,s[9]=ve,s[10]=we,s[11]=De,s[12]=Me,s[13]=Se,s[14]=ke,s[15]=xe,s[16]=Re,s[17]=Ne,s[18]=Fe,0!==p&&(s[19]=p,n.length++),n};function h(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var a=0,r=0,A=0;A<n.length-1;A++){var i=r;r=0;for(var o=67108863&a,s=Math.min(A,t.length-1),p=Math.max(0,A-e.length+1);p<=s;p++){var d=A-p,c=(0|e.words[d])*(0|t.words[p]),u=67108863&c;o=67108863&(u=u+o|0),r+=(i=(i=i+(c/67108864|0)|0)+(u>>>26)|0)>>>26,i&=67108863}n.words[A]=o,a=i,i=r}return 0!==a?n.words[A]=a:n.length--,n._strip()}function y(e,t,n){return h(e,t,n)}function m(e,t){this.x=e,this.y=t}Math.imul||(I=f),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?I(this,e,t):n<63?f(this,e,t):n<1024?h(this,e,t):y(this,e,t)},m.prototype.makeRBT=function(e){for(var t=new Array(e),n=i.prototype._countBits(e)-1,a=0;a<e;a++)t[a]=this.revBin(a,n,e);return t},m.prototype.revBin=function(e,t,n){if(0===e||e===n-1)return e;for(var a=0,r=0;r<t;r++)a|=(1&e)<<t-r-1,e>>=1;return a},m.prototype.permute=function(e,t,n,a,r,A){for(var i=0;i<A;i++)a[i]=t[e[i]],r[i]=n[e[i]]},m.prototype.transform=function(e,t,n,a,r,A){this.permute(A,e,t,n,a,r);for(var i=1;i<r;i<<=1)for(var o=i<<1,s=Math.cos(2*Math.PI/o),p=Math.sin(2*Math.PI/o),d=0;d<r;d+=o)for(var c=s,u=p,l=0;l<i;l++){var g=n[d+l],f=a[d+l],I=n[d+l+i],h=a[d+l+i],y=c*I-u*h;h=c*h+u*I,I=y,n[d+l]=g+I,a[d+l]=f+h,n[d+l+i]=g-I,a[d+l+i]=f-h,l!==o&&(y=s*c-p*u,u=s*u+p*c,c=y)}},m.prototype.guessLen13b=function(e,t){var n=1|Math.max(t,e),a=1&n,r=0;for(n=n/2|0;n;n>>>=1)r++;return 1<<r+1+a},m.prototype.conjugate=function(e,t,n){if(!(n<=1))for(var a=0;a<n/2;a++){var r=e[a];e[a]=e[n-a-1],e[n-a-1]=r,r=t[a],t[a]=-t[n-a-1],t[n-a-1]=-r}},m.prototype.normalize13b=function(e,t){for(var n=0,a=0;a<t/2;a++){var r=8192*Math.round(e[2*a+1]/t)+Math.round(e[2*a]/t)+n;e[a]=67108863&r,n=r<67108864?0:r/67108864|0}return e},m.prototype.convert13b=function(e,t,n,a){for(var A=0,i=0;i<t;i++)A+=0|e[i],n[2*i]=8191&A,A>>>=13,n[2*i+1]=8191&A,A>>>=13;for(i=2*t;i<a;++i)n[i]=0;r(0===A),r(0==(-8192&A))},m.prototype.stub=function(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=0;return t},m.prototype.mulp=function(e,t,n){var a=2*this.guessLen13b(e.length,t.length),r=this.makeRBT(a),A=this.stub(a),i=new Array(a),o=new Array(a),s=new Array(a),p=new Array(a),d=new Array(a),c=new Array(a),u=n.words;u.length=a,this.convert13b(e.words,e.length,i,a),this.convert13b(t.words,t.length,p,a),this.transform(i,A,o,s,a,r),this.transform(p,A,d,c,a,r);for(var l=0;l<a;l++){var g=o[l]*d[l]-s[l]*c[l];s[l]=o[l]*c[l]+s[l]*d[l],o[l]=g}return this.conjugate(o,s,a),this.transform(o,s,u,A,a,r),this.conjugate(u,A,a),this.normalize13b(u,a),n.negative=e.negative^t.negative,n.length=e.length+t.length,n._strip()},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),y(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),r("number"==typeof e),r(e<67108864);for(var n=0,a=0;a<this.length;a++){var A=(0|this.words[a])*e,i=(67108863&A)+(67108863&n);n>>=26,n+=A/67108864|0,n+=i>>>26,this.words[a]=67108863&i}return 0!==n&&(this.words[a]=n,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var a=n/26|0,r=n%26;t[n]=e.words[a]>>>r&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,a=0;a<t.length&&0===t[a];a++,n=n.sqr());if(++a<t.length)for(var r=n.sqr();a<t.length;a++,r=r.sqr())0!==t[a]&&(n=n.mul(r));return n},i.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,a=(e-n)/26,A=67108863>>>26-n<<26-n;if(0!==n){var i=0;for(t=0;t<this.length;t++){var o=this.words[t]&A,s=(0|this.words[t])-o<<n;this.words[t]=s|i,i=o>>>26-n}i&&(this.words[t]=i,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t<a;t++)this.words[t]=0;this.length+=a}return this._strip()},i.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,n){var a;r("number"==typeof e&&e>=0),a=t?(t-t%26)/26:0;var A=e%26,i=Math.min((e-A)/26,this.length),o=67108863^67108863>>>A<<A,s=n;if(a-=i,a=Math.max(0,a),s){for(var p=0;p<i;p++)s.words[p]=this.words[p];s.length=i}if(0===i);else if(this.length>i)for(this.length-=i,p=0;p<this.length;p++)this.words[p]=this.words[p+i];else this.words[0]=0,this.length=1;var d=0;for(p=this.length-1;p>=0&&(0!==d||p>=a);p--){var c=0|this.words[p];this.words[p]=d<<26-A|c>>>A,d=c&o}return s&&0!==d&&(s.words[s.length++]=d),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,a=1<<t;return!(this.length<=n)&&!!(this.words[n]&a)},i.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var a=67108863^67108863>>>t<<t;this.words[this.length-1]&=a}return this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,n){var a,A,i=e.length+n;this._expand(i);var o=0;for(a=0;a<e.length;a++){A=(0|this.words[a+n])+o;var s=(0|e.words[a])*t;o=((A-=67108863&s)>>26)-(s/67108864|0),this.words[a+n]=67108863&A}for(;a<this.length-n;a++)o=(A=(0|this.words[a+n])+o)>>26,this.words[a+n]=67108863&A;if(0===o)return this._strip();for(r(-1===o),o=0,a=0;a<this.length;a++)o=(A=-(0|this.words[a])+o)>>26,this.words[a]=67108863&A;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),a=this.clone(),r=e,A=0|r.words[r.length-1];0!==(n=26-this._countBits(A))&&(r=r.ushln(n),a.iushln(n),A=0|r.words[r.length-1]);var o,s=a.length-r.length;if("mod"!==t){(o=new i(null)).length=s+1,o.words=new Array(o.length);for(var p=0;p<o.length;p++)o.words[p]=0}var d=a.clone()._ishlnsubmul(r,1,s);0===d.negative&&(a=d,o&&(o.words[s]=1));for(var c=s-1;c>=0;c--){var u=67108864*(0|a.words[r.length+c])+(0|a.words[r.length+c-1]);for(u=Math.min(u/A|0,67108863),a._ishlnsubmul(r,u,c);0!==a.negative;)u--,a.negative=0,a._ishlnsubmul(r,1,c),a.isZero()||(a.negative^=1);o&&(o.words[c]=u)}return o&&o._strip(),a._strip(),"div"!==t&&0!==n&&a.iushrn(n),{div:o||null,mod:a}},i.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(A=o.mod.neg(),n&&0!==A.negative&&A.iadd(e)),{div:a,mod:A}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(A=o.mod.neg(),n&&0!==A.negative&&A.isub(e)),{div:o.div,mod:A}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var a,A,o},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),r=e.andln(1),A=n.cmp(a);return A<0||1===r&&0===A?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,a=0,A=this.length-1;A>=0;A--)a=(n*a+(0|this.words[A]))%e;return t?-a:a},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,a=this.length-1;a>=0;a--){var A=(0|this.words[a])+67108864*n;this.words[a]=A/e|0,n=A%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new i(1),A=new i(0),o=new i(0),s=new i(1),p=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++p;for(var d=n.clone(),c=t.clone();!t.isZero();){for(var u=0,l=1;0==(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)(a.isOdd()||A.isOdd())&&(a.iadd(d),A.isub(c)),a.iushrn(1),A.iushrn(1);for(var g=0,f=1;0==(n.words[0]&f)&&g<26;++g,f<<=1);if(g>0)for(n.iushrn(g);g-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(d),s.isub(c)),o.iushrn(1),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(o),A.isub(s)):(n.isub(t),o.isub(a),s.isub(A))}return{a:o,b:s,gcd:n.iushln(p)}},i.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,A=new i(1),o=new i(0),s=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var p=0,d=1;0==(t.words[0]&d)&&p<26;++p,d<<=1);if(p>0)for(t.iushrn(p);p-- >0;)A.isOdd()&&A.iadd(s),A.iushrn(1);for(var c=0,u=1;0==(n.words[0]&u)&&c<26;++c,u<<=1);if(c>0)for(n.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(n)>=0?(t.isub(n),A.isub(o)):(n.isub(t),o.isub(A))}return(a=0===t.cmpn(1)?A:o).cmpn(0)<0&&a.iadd(e),a},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var a=0;t.isEven()&&n.isEven();a++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var r=t.cmp(n);if(r<0){var A=t;t=n,n=A}else if(0===r||0===n.cmpn(1))break;t.isub(n)}return n.iushln(a)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,a=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=a,this;for(var A=a,i=n;0!==A&&i<this.length;i++){var o=0|this.words[i];A=(o+=A)>>>26,o&=67108863,this.words[i]=o}return 0!==A&&(this.words[i]=A,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:a<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var a=0|this.words[n],r=0|e.words[n];if(a!==r){a<r?t=-1:a>r&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new w(e)},i.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var C={k256:null,p224:null,p192:null,p25519:null};function B(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function E(){B.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){B.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function Q(){B.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function v(){B.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function D(e){w.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}B.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},B.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t<this.n?-1:n.ucmp(this.p);return 0===a?(n.words[0]=0,n.length=1):a>0?n.isub(this.p):n._strip(),n},B.prototype.split=function(e,t){e.iushrn(this.n,0,t)},B.prototype.imulK=function(e){return e.imul(this.k)},A(E,B),E.prototype.split=function(e,t){for(var n=Math.min(e.length,9),a=0;a<n;a++)t.words[a]=e.words[a];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var r=e.words[9];for(t.words[t.length++]=4194303&r,a=10;a<e.length;a++){var A=0|e.words[a];e.words[a-10]=(4194303&A)<<4|r>>>22,r=A}r>>>=22,e.words[a-10]=r,0===r&&e.length>10?e.length-=10:e.length-=9},E.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var a=0|e.words[n];t+=977*a,e.words[n]=67108863&t,t=64*a+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},A(b,B),A(Q,B),A(v,B),v.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var a=19*(0|e.words[n])+t,r=67108863&a;a>>>=26,e.words[n]=r,t=a}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(C[e])return C[e];var t;if("k256"===e)t=new E;else if("p224"===e)t=new b;else if("p192"===e)t=new Q;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new v}return C[e]=t,t},w.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},w.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},w.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(d(e,e.umod(this.m)._forceRed(this)),e)},w.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},w.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},w.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},w.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},w.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},w.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},w.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},w.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},w.prototype.isqr=function(e){return this.imul(e,e.clone())},w.prototype.sqr=function(e){return this.mul(e,e)},w.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new i(1)).iushrn(2);return this.pow(e,n)}for(var a=this.m.subn(1),A=0;!a.isZero()&&0===a.andln(1);)A++,a.iushrn(1);r(!a.isZero());var o=new i(1).toRed(this),s=o.redNeg(),p=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new i(2*d*d).toRed(this);0!==this.pow(d,p).cmp(s);)d.redIAdd(s);for(var c=this.pow(d,a),u=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),g=A;0!==l.cmp(o);){for(var f=l,I=0;0!==f.cmp(o);I++)f=f.redSqr();r(I<g);var h=this.pow(c,new i(1).iushln(g-I-1));u=u.redMul(h),c=h.redSqr(),l=l.redMul(c),g=I}return u},w.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},w.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=e;for(var a=2;a<n.length;a++)n[a]=this.mul(n[a-1],e);var r=n[0],A=0,o=0,s=t.bitLength()%26;for(0===s&&(s=26),a=t.length-1;a>=0;a--){for(var p=t.words[a],d=s-1;d>=0;d--){var c=p>>d&1;r!==n[0]&&(r=this.sqr(r)),0!==c||0!==A?(A<<=1,A|=c,(4===++o||0===a&&0===d)&&(r=this.mul(r,n[A]),o=0,A=0)):o=0}s=26}return r},w.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},w.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new D(e)},A(D,w),D.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},D.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},D.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),a=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),r=n.isub(a).iushrn(this.shift),A=r;return r.cmp(this.m)>=0?A=r.isub(this.m):r.cmpn(0)<0&&(A=r.iadd(this.m)),A._forceRed(this)},D.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),a=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),r=n.isub(a).iushrn(this.shift),A=r;return r.cmp(this.m)>=0?A=r.isub(this.m):r.cmpn(0)<0&&(A=r.iadd(this.m)),A._forceRed(this)},D.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,this)}).call(this,n(12)(e))},function(e,t){e.exports=require("crypto")},function(e,t,n){try{var a=n(41);if("function"!=typeof a.inherits)throw"";e.exports=a.inherits}catch(t){e.exports=n(170)}},function(e,t,n){"use strict";function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var A=r(n(0));function i(e,t,n){Object.defineProperty(e,t,{enumerable:!0,value:n,writable:!1})}function o(e,t){return e&&e._ethersType===t}t.defineReadOnly=i,t.setType=function(e,t){Object.defineProperty(e,"_ethersType",{configurable:!1,value:t,writable:!1})},t.isType=o,t.resolveProperties=function(e){var t={},n=[];return Object.keys(e).forEach((function(a){var r=e[a];r instanceof Promise?n.push(r.then((function(e){return t[a]=e,null}))):t[a]=r})),Promise.all(n).then((function(){return t}))},t.checkProperties=function(e,t){e&&"object"===a(e)||A.throwError("invalid object",A.INVALID_ARGUMENT,{argument:"object",value:e}),Object.keys(e).forEach((function(n){t[n]||A.throwError("invalid object key - "+n,A.INVALID_ARGUMENT,{argument:"transaction",value:e,key:n})}))},t.shallowCopy=function(e){var t={};for(var n in e)t[n]=e[n];return t};var s={boolean:!0,number:!0,string:!0};t.deepCopy=function e(t,n){if(null==t||s[a(t)])return t;if(Array.isArray(t)){var r=t.map((function(t){return e(t,n)}));return n&&Object.freeze(r),r}if("object"===a(t)){if(o(t,"BigNumber"))return t;if(o(t,"Description"))return t;if(o(t,"Indexed"))return t;r={};for(var A in t){var p=t[A];void 0!==p&&i(r,A,e(p,n))}return n&&Object.freeze(r),r}if("function"==typeof t)return t;throw new Error("Cannot deepCopy "+a(t))},t.inheritable=function e(t){return function(n){var a,r;r=t,(a=n).super_=r,a.prototype=Object.create(r.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),i(n,"inherits",e(n))}}},function(e,t,n){e.exports=n(162)},function(e,t){e.exports=require("stream")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a,r=n(31),A=n(0),i=n(1);function o(e,t){void 0===t&&(t=a.current),t!=a.current&&(A.checkNormalize(),e=e.normalize(t));for(var n=[],r=0;r<e.length;r++){var o=e.charCodeAt(r);if(o<128)n.push(o);else if(o<2048)n.push(o>>6|192),n.push(63&o|128);else if(55296==(64512&o)){r++;var s=e.charCodeAt(r);if(r>=e.length||56320!=(64512&s))throw new Error("invalid utf-8 string");o=65536+((1023&o)<<10)+(1023&s),n.push(o>>18|240),n.push(o>>12&63|128),n.push(o>>6&63|128),n.push(63&o|128)}else n.push(o>>12|224),n.push(o>>6&63|128),n.push(63&o|128)}return i.arrayify(n)}function s(e,t){e=i.arrayify(e);for(var n="",a=0;a<e.length;){var r=e[a++];if(r>>7!=0){var A=null,o=null;if(192==(224&r))A=1,o=127;else if(224==(240&r))A=2,o=2047;else{if(240!=(248&r)){if(!t){if(128==(192&r))throw new Error("invalid utf8 byte sequence; unexpected continuation byte");throw new Error("invalid utf8 byte sequence; invalid prefix")}continue}A=3,o=65535}if(a+A>e.length){if(!t)throw new Error("invalid utf8 byte sequence; too short");for(;a<e.length&&e[a]>>6==2;a++);}else{for(var s=r&(1<<8-A-1)-1,p=0;p<A;p++){var d=e[a];if(128!=(192&d)){s=null;break}s=s<<6|63&d,a++}if(null!==s)if(s<=o){if(!t)throw new Error("invalid utf8 byte sequence; overlong")}else if(s>1114111){if(!t)throw new Error("invalid utf8 byte sequence; out-of-range")}else if(s>=55296&&s<=57343){if(!t)throw new Error("invalid utf8 byte sequence; utf-16 surrogate")}else s<=65535?n+=String.fromCharCode(s):(s-=65536,n+=String.fromCharCode(55296+(s>>10&1023),56320+(1023&s)));else if(!t)throw new Error("invalid utf8 byte sequence; invalid continuation byte")}}else n+=String.fromCharCode(r)}return n}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(a=t.UnicodeNormalizationForm||(t.UnicodeNormalizationForm={})),t.toUtf8Bytes=o,t.toUtf8String=s,t.formatBytes32String=function(e){var t=o(e);if(t.length>31)throw new Error("bytes32 string must be less than 32 bytes");return i.hexlify(i.concat([t,r.HashZero]).slice(0,32))},t.parseBytes32String=function(e){var t=i.arrayify(e);if(32!==t.length)throw new Error("invalid bytes32 - not 32 bytes long");if(0!==t[31])throw new Error("invalid bytes32 string - no null terminator");for(var n=31;0===t[n-1];)n--;return s(t.slice(0,n))}},function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=n,n.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)}},function(e,t,n){var a=n(28),r=a.Buffer;function A(e,t){for(var n in e)t[n]=e[n]}function i(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=a:(A(a,t),t.Buffer=i),i.prototype=Object.create(r.prototype),A(r,i),i.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},i.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var a=r(e);return void 0!==t?"string"==typeof n?a.fill(t,n):a.fill(t):a.fill(0),a},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a.SlowBuffer(e)}},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";var a=t,r=n(2),A=n(9),i=n(72);a.assert=A,a.toArray=i.toArray,a.zero2=i.zero2,a.toHex=i.toHex,a.encode=i.encode,a.getNAF=function(e,t,n){var a=new Array(Math.max(e.bitLength(),n)+1);a.fill(0);for(var r=1<<t+1,A=e.clone(),i=0;i<a.length;i++){var o,s=A.andln(r-1);A.isOdd()?(o=s>(r>>1)-1?(r>>1)-s:s,A.isubn(o)):o=0,a[i]=o,A.iushrn(1)}return a},a.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var a=0,r=0;e.cmpn(-a)>0||t.cmpn(-r)>0;){var A,i,o,s=e.andln(3)+a&3,p=t.andln(3)+r&3;if(3===s&&(s=-1),3===p&&(p=-1),0==(1&s))A=0;else A=3!==(o=e.andln(7)+a&7)&&5!==o||2!==p?s:-s;if(n[0].push(A),0==(1&p))i=0;else i=3!==(o=t.andln(7)+r&7)&&5!==o||2!==s?p:-p;n[1].push(i),2*a===A+1&&(a=1-a),2*r===i+1&&(r=1-r),e.iushrn(1),t.iushrn(1)}return n},a.cachedProperty=function(e,t,n){var a="_"+t;e.prototype[t]=function(){return void 0!==this[a]?this[a]:this[a]=n.call(this)}},a.parseBytes=function(e){return"string"==typeof e?a.toArray(e,"hex"):e},a.intFromLE=function(e){return new r(e,"hex","le")}},function(e,t,n){"use strict";var a=t,r=n(2),A=n(9),i=n(72);a.assert=A,a.toArray=i.toArray,a.zero2=i.zero2,a.toHex=i.toHex,a.encode=i.encode,a.getNAF=function(e,t,n){var a=new Array(Math.max(e.bitLength(),n)+1);a.fill(0);for(var r=1<<t+1,A=e.clone(),i=0;i<a.length;i++){var o,s=A.andln(r-1);A.isOdd()?(o=s>(r>>1)-1?(r>>1)-s:s,A.isubn(o)):o=0,a[i]=o,A.iushrn(1)}return a},a.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var a,r=0,A=0;e.cmpn(-r)>0||t.cmpn(-A)>0;){var i,o,s=e.andln(3)+r&3,p=t.andln(3)+A&3;3===s&&(s=-1),3===p&&(p=-1),i=0==(1&s)?0:3!==(a=e.andln(7)+r&7)&&5!==a||2!==p?s:-s,n[0].push(i),o=0==(1&p)?0:3!==(a=t.andln(7)+A&7)&&5!==a||2!==s?p:-p,n[1].push(o),2*r===i+1&&(r=1-r),2*A===o+1&&(A=1-A),e.iushrn(1),t.iushrn(1)}return n},a.cachedProperty=function(e,t,n){var a="_"+t;e.prototype[t]=function(){return void 0!==this[a]?this[a]:this[a]=n.call(this)}},a.parseBytes=function(e){return"string"==typeof e?a.toArray(e,"hex"):e},a.intFromLE=function(e){return new r(e,"hex","le")}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var A=a(n(2)),i=n(1),o=n(5),s=r(n(0)),p=new A.default.BN(-1);function d(e){var t=e.toString(16);return"-"===t[0]?t.length%2==0?"-0x0"+t.substring(1):"-0x"+t.substring(1):t.length%2==1?"0x0"+t:"0x"+t}function c(e){return l(f(e))}function u(e){return new g(d(e))}function l(e){var t=e._hex;return"-"===t[0]?new A.default.BN(t.substring(3),16).mul(p):new A.default.BN(t.substring(2),16)}var g=function(){function e(t){if(s.checkNew(this,e),o.setType(this,"BigNumber"),"string"==typeof t)i.isHexString(t)?("0x"==t&&(t="0x0"),o.defineReadOnly(this,"_hex",t)):"-"===t[0]&&i.isHexString(t.substring(1))?o.defineReadOnly(this,"_hex",t):t.match(/^-?[0-9]*$/)?(""==t&&(t="0"),o.defineReadOnly(this,"_hex",d(new A.default.BN(t)))):s.throwError("invalid BigNumber string value",s.INVALID_ARGUMENT,{arg:"value",value:t});else if("number"==typeof t){parseInt(String(t))!==t&&s.throwError("underflow",s.NUMERIC_FAULT,{operation:"setValue",fault:"underflow",value:t,outputValue:parseInt(String(t))});try{o.defineReadOnly(this,"_hex",d(new A.default.BN(t)))}catch(e){s.throwError("overflow",s.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:e.message})}}else t instanceof e?o.defineReadOnly(this,"_hex",t._hex):t.toHexString?o.defineReadOnly(this,"_hex",d(c(t.toHexString()))):t._hex&&i.isHexString(t._hex)?o.defineReadOnly(this,"_hex",t._hex):i.isArrayish(t)?o.defineReadOnly(this,"_hex",d(new A.default.BN(i.hexlify(t).substring(2),16))):s.throwError("invalid BigNumber value",s.INVALID_ARGUMENT,{arg:"value",value:t})}return e.prototype.fromTwos=function(e){return u(l(this).fromTwos(e))},e.prototype.toTwos=function(e){return u(l(this).toTwos(e))},e.prototype.abs=function(){return"-"===this._hex[0]?u(l(this).mul(p)):this},e.prototype.add=function(e){return u(l(this).add(c(e)))},e.prototype.sub=function(e){return u(l(this).sub(c(e)))},e.prototype.div=function(e){return f(e).isZero()&&s.throwError("division by zero",s.NUMERIC_FAULT,{operation:"divide",fault:"division by zero"}),u(l(this).div(c(e)))},e.prototype.mul=function(e){return u(l(this).mul(c(e)))},e.prototype.mod=function(e){return u(l(this).mod(c(e)))},e.prototype.pow=function(e){return u(l(this).pow(c(e)))},e.prototype.maskn=function(e){return u(l(this).maskn(e))},e.prototype.eq=function(e){return l(this).eq(c(e))},e.prototype.lt=function(e){return l(this).lt(c(e))},e.prototype.lte=function(e){return l(this).lte(c(e))},e.prototype.gt=function(e){return l(this).gt(c(e))},e.prototype.gte=function(e){return l(this).gte(c(e))},e.prototype.isZero=function(){return l(this).isZero()},e.prototype.toNumber=function(){try{return l(this).toNumber()}catch(e){s.throwError("overflow",s.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:e.message})}return null},e.prototype.toString=function(){return l(this).toString(10)},e.prototype.toHexString=function(){return this._hex},e.isBigNumber=function(e){return o.isType(e,"BigNumber")},e}();function f(e){return g.isBigNumber(e)?e:new g(e)}t.BigNumber=g,t.bigNumberify=f},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(2)),A=n(1),i=n(22),o=n(48),s=n(0);function p(e){"string"==typeof e&&e.match(/^0x[0-9A-Fa-f]{40}$/)||s.throwError("invalid address",s.INVALID_ARGUMENT,{arg:"address",value:e});for(var t=(e=e.toLowerCase()).substring(2).split(""),n=new Uint8Array(40),a=0;a<40;a++)n[a]=t[a].charCodeAt(0);n=A.arrayify(i.keccak256(n));for(var r=0;r<40;r+=2)n[r>>1]>>4>=8&&(t[r]=t[r].toUpperCase()),(15&n[r>>1])>=8&&(t[r+1]=t[r+1].toUpperCase());return"0x"+t.join("")}for(var d={},c=0;c<10;c++)d[String(c)]=String(c);for(c=0;c<26;c++)d[String.fromCharCode(65+c)]=String(10+c);var u,l=Math.floor((u=9007199254740991,Math.log10?Math.log10(u):Math.log(u)/Math.LN10));function g(e){e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00";var t="";for(e.split("").forEach((function(e){t+=d[e]}));t.length>=l;){var n=t.substring(0,l);t=parseInt(n,10)%97+t.substring(n.length)}for(var a=String(98-parseInt(t,10)%97);a.length<2;)a="0"+a;return a}function f(e){var t=null;if("string"!=typeof e&&s.throwError("invalid address",s.INVALID_ARGUMENT,{arg:"address",value:e}),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=p(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&s.throwError("bad address checksum",s.INVALID_ARGUMENT,{arg:"address",value:e});else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==g(e)&&s.throwError("bad icap checksum",s.INVALID_ARGUMENT,{arg:"address",value:e}),t=new r.default.BN(e.substring(4),36).toString(16);t.length<40;)t="0"+t;t=p("0x"+t)}else s.throwError("invalid address",s.INVALID_ARGUMENT,{arg:"address",value:e});return t}t.getAddress=f,t.getIcapAddress=function(e){for(var t=new r.default.BN(f(e).substring(2),16).toString(36).toUpperCase();t.length<30;)t="0"+t;return"XE"+g("XE00"+t)+t},t.getContractAddress=function(e){if(!e.from)throw new Error("missing from address");var t=e.nonce;return f("0x"+i.keccak256(o.encode([f(e.from),A.stripZeros(A.hexlify(t))])).substring(26))},t.getCreate2Address=function(e){var t=e.initCodeHash;e.initCode&&(t?i.keccak256(e.initCode)!==t&&s.throwError("initCode/initCodeHash mismatch",s.INVALID_ARGUMENT,{arg:"options",value:e}):t=i.keccak256(e.initCode)),t||s.throwError("missing initCode or initCodeHash",s.INVALID_ARGUMENT,{arg:"options",value:e});var n=f(e.from),a=A.arrayify(e.salt);return 32!==a.length&&s.throwError("invalid salt",s.INVALID_ARGUMENT,{arg:"options",value:e}),f("0x"+i.keccak256(A.concat(["0xff",n,a,t])).substring(26))}},function(e,t,n){"use strict";var a=n(9),r=n(4);function A(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function i(e){return 1===e.length?"0"+e:e}function o(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=r,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),a=0;a<e.length;a+=2)n.push(parseInt(e[a]+e[a+1],16))}else for(var a=0;a<e.length;a++){var r=e.charCodeAt(a),A=r>>8,i=255&r;A?n.push(A,i):n.push(i)}else for(a=0;a<e.length;a++)n[a]=0|e[a];return n},t.toHex=function(e){for(var t="",n=0;n<e.length;n++)t+=i(e[n].toString(16));return t},t.htonl=A,t.toHex32=function(e,t){for(var n="",a=0;a<e.length;a++){var r=e[a];"little"===t&&(r=A(r)),n+=o(r.toString(16))}return n},t.zero2=i,t.zero8=o,t.join32=function(e,t,n,r){var A=n-t;a(A%4==0);for(var i=new Array(A/4),o=0,s=t;o<i.length;o++,s+=4){var p;p="big"===r?e[s]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3]:e[s+3]<<24|e[s+2]<<16|e[s+1]<<8|e[s],i[o]=p>>>0}return i},t.split32=function(e,t){for(var n=new Array(4*e.length),a=0,r=0;a<e.length;a++,r+=4){var A=e[a];"big"===t?(n[r]=A>>>24,n[r+1]=A>>>16&255,n[r+2]=A>>>8&255,n[r+3]=255&A):(n[r+3]=A>>>24,n[r+2]=A>>>16&255,n[r+1]=A>>>8&255,n[r]=255&A)}return n},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<<t|e>>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,n){return e+t+n>>>0},t.sum32_4=function(e,t,n,a){return e+t+n+a>>>0},t.sum32_5=function(e,t,n,a,r){return e+t+n+a+r>>>0},t.sum64=function(e,t,n,a){var r=e[t],A=a+e[t+1]>>>0,i=(A<a?1:0)+n+r;e[t]=i>>>0,e[t+1]=A},t.sum64_hi=function(e,t,n,a){return(t+a>>>0<t?1:0)+e+n>>>0},t.sum64_lo=function(e,t,n,a){return t+a>>>0},t.sum64_4_hi=function(e,t,n,a,r,A,i,o){var s=0,p=t;return s+=(p=p+a>>>0)<t?1:0,s+=(p=p+A>>>0)<A?1:0,e+n+r+i+(s+=(p=p+o>>>0)<o?1:0)>>>0},t.sum64_4_lo=function(e,t,n,a,r,A,i,o){return t+a+A+o>>>0},t.sum64_5_hi=function(e,t,n,a,r,A,i,o,s,p){var d=0,c=t;return d+=(c=c+a>>>0)<t?1:0,d+=(c=c+A>>>0)<A?1:0,d+=(c=c+o>>>0)<o?1:0,e+n+r+i+s+(d+=(c=c+p>>>0)<p?1:0)>>>0},t.sum64_5_lo=function(e,t,n,a,r,A,i,o,s,p){return t+a+A+o+p>>>0},t.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},t.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},t.shr64_hi=function(e,t,n){return e>>>n},t.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0}},function(e,t,n){"use strict";var a=n(9),r=n(4);function A(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function i(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function o(e){return 1===e.length?"0"+e:e}function s(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=r,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16))}else for(var a=0,r=0;r<e.length;r++){var i=e.charCodeAt(r);i<128?n[a++]=i:i<2048?(n[a++]=i>>6|192,n[a++]=63&i|128):A(e,r)?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++r)),n[a++]=i>>18|240,n[a++]=i>>12&63|128,n[a++]=i>>6&63|128,n[a++]=63&i|128):(n[a++]=i>>12|224,n[a++]=i>>6&63|128,n[a++]=63&i|128)}else for(r=0;r<e.length;r++)n[r]=0|e[r];return n},t.toHex=function(e){for(var t="",n=0;n<e.length;n++)t+=o(e[n].toString(16));return t},t.htonl=i,t.toHex32=function(e,t){for(var n="",a=0;a<e.length;a++){var r=e[a];"little"===t&&(r=i(r)),n+=s(r.toString(16))}return n},t.zero2=o,t.zero8=s,t.join32=function(e,t,n,r){var A=n-t;a(A%4==0);for(var i=new Array(A/4),o=0,s=t;o<i.length;o++,s+=4){var p;p="big"===r?e[s]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3]:e[s+3]<<24|e[s+2]<<16|e[s+1]<<8|e[s],i[o]=p>>>0}return i},t.split32=function(e,t){for(var n=new Array(4*e.length),a=0,r=0;a<e.length;a++,r+=4){var A=e[a];"big"===t?(n[r]=A>>>24,n[r+1]=A>>>16&255,n[r+2]=A>>>8&255,n[r+3]=255&A):(n[r+3]=A>>>24,n[r+2]=A>>>16&255,n[r+1]=A>>>8&255,n[r]=255&A)}return n},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<<t|e>>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,n){return e+t+n>>>0},t.sum32_4=function(e,t,n,a){return e+t+n+a>>>0},t.sum32_5=function(e,t,n,a,r){return e+t+n+a+r>>>0},t.sum64=function(e,t,n,a){var r=e[t],A=a+e[t+1]>>>0,i=(A<a?1:0)+n+r;e[t]=i>>>0,e[t+1]=A},t.sum64_hi=function(e,t,n,a){return(t+a>>>0<t?1:0)+e+n>>>0},t.sum64_lo=function(e,t,n,a){return t+a>>>0},t.sum64_4_hi=function(e,t,n,a,r,A,i,o){var s=0,p=t;return s+=(p=p+a>>>0)<t?1:0,s+=(p=p+A>>>0)<A?1:0,e+n+r+i+(s+=(p=p+o>>>0)<o?1:0)>>>0},t.sum64_4_lo=function(e,t,n,a,r,A,i,o){return t+a+A+o>>>0},t.sum64_5_hi=function(e,t,n,a,r,A,i,o,s,p){var d=0,c=t;return d+=(c=c+a>>>0)<t?1:0,d+=(c=c+A>>>0)<A?1:0,d+=(c=c+o>>>0)<o?1:0,e+n+r+i+s+(d+=(c=c+p>>>0)<p?1:0)>>>0},t.sum64_5_lo=function(e,t,n,a,r,A,i,o,s,p){return t+a+A+o+p>>>0},t.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},t.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},t.shr64_hi=function(e,t,n){return e>>>n},t.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}e.exports=function(e,t,a){return t&&n(e.prototype,t),a&&n(e,a),e}},function(e,t,n){"use strict";var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(97));t.ethers=r,function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(97))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(164),r=n(1);t.keccak256=function(e){return"0x"+a.keccak_256(r.arrayify(e))}},function(e,t,n){"use strict";var a=n(113),r=n(222),A={ftp:21,file:null,gopher:70,http:80,https:443,ws:80,wss:443},i=Symbol("failure");function o(e){return a.ucs2.decode(e).length}function s(e,t){var n=e[t];return isNaN(n)?void 0:String.fromCodePoint(n)}function p(e){return e>=48&&e<=57}function d(e){return e>=65&&e<=90||e>=97&&e<=122}function c(e){return p(e)||e>=65&&e<=70||e>=97&&e<=102}function u(e){return"."===e||"%2e"===e.toLowerCase()}function l(e){return 2===e.length&&d(e.codePointAt(0))&&(":"===e[1]||"|"===e[1])}function g(e){return void 0!==A[e]}function f(e){return g(e.scheme)}function I(e){var t=e.toString(16).toUpperCase();return 1===t.length&&(t="0"+t),"%"+t}function h(e){return e<=31||e>126}var y=new Set([32,34,35,60,62,63,96,123,125]);function m(e){return h(e)||y.has(e)}var C=new Set([47,58,59,61,64,91,92,93,94,124]);function B(e){return m(e)||C.has(e)}function E(e,t){var n=String.fromCodePoint(e);return t(e)?function(e){for(var t=new Buffer(e),n="",a=0;a<t.length;++a)n+=I(t[a]);return n}(n):n}function b(e){var t=10;return e.length>=2&&"0"===e.charAt(0)&&"x"===e.charAt(1).toLowerCase()?(e=e.substring(2),t=16):e.length>=2&&"0"===e.charAt(0)&&(e=e.substring(1),t=8),""===e?0:(10===t?/[^0-9]/:16===t?/[^0-9A-Fa-f]/:/[^0-7]/).test(e)?i:parseInt(e,t)}function Q(e,t){if("["===e[0])return"]"!==e[e.length-1]?i:function(e){var t=[0,0,0,0,0,0,0,0],n=0,r=null,A=0;if(58===(e=a.ucs2.decode(e))[A]){if(58!==e[A+1])return i;A+=2,r=++n}for(;A<e.length;){if(8===n)return i;if(58!==e[A]){for(var o=0,d=0;d<4&&c(e[A]);)o=16*o+parseInt(s(e,A),16),++A,++d;if(46===e[A]){if(0===d)return i;if(A-=d,n>6)return i;for(var u=0;void 0!==e[A];){var l=null;if(u>0){if(!(46===e[A]&&u<4))return i;++A}if(!p(e[A]))return i;for(;p(e[A]);){var g=parseInt(s(e,A));if(null===l)l=g;else{if(0===l)return i;l=10*l+g}if(l>255)return i;++A}t[n]=256*t[n]+l,2!==++u&&4!==u||++n}if(4!==u)return i;break}if(58===e[A]){if(void 0===e[++A])return i}else if(void 0!==e[A])return i;t[n]=o,++n}else{if(null!==r)return i;++A,r=++n}}if(null!==r){var f=n-r;for(n=7;0!==n&&f>0;){var I=t[r+f-1];t[r+f-1]=t[n],t[n]=I,--n,--f}}else if(null===r&&8!==n)return i;return t}(e.substring(1,e.length-1));if(!t)return function(e){if(t=e,-1!==t.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/))return i;var t;for(var n="",r=a.ucs2.decode(e),A=0;A<r.length;++A)n+=E(r[A],h);return n}(e);var n=function(e){for(var t=new Buffer(e),n=[],a=0;a<t.length;++a)37!==t[a]?n.push(t[a]):37===t[a]&&c(t[a+1])&&c(t[a+2])?(n.push(parseInt(t.slice(a+1,a+3).toString(),16)),a+=2):n.push(t[a]);return new Buffer(n).toString()}(e),A=r.toASCII(n,!1,r.PROCESSING_OPTIONS.NONTRANSITIONAL,!1);if(null===A)return i;if(-1!==A.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/))return i;var o=function(e){var t=e.split(".");if(""===t[t.length-1]&&t.length>1&&t.pop(),t.length>4)return e;var n=[],a=!0,r=!1,A=void 0;try{for(var o,s=t[Symbol.iterator]();!(a=(o=s.next()).done);a=!0){var p=o.value;if(""===p)return e;var d=b(p);if(d===i)return e;n.push(d)}}catch(e){r=!0,A=e}finally{try{a||null==s.return||s.return()}finally{if(r)throw A}}for(var c=0;c<n.length-1;++c)if(n[c]>255)return i;if(n[n.length-1]>=Math.pow(256,5-n.length))return i;for(var u=n.pop(),l=0,g=0,f=n;g<f.length;g++){u+=f[g]*Math.pow(256,3-l),++l}return u}(A);return"number"==typeof o||o===i?o:A}function v(e){return"number"==typeof e?function(e){for(var t="",n=e,a=1;a<=4;++a)t=String(n%256)+t,4!==a&&(t="."+t),n=Math.floor(n/256);return t}(e):e instanceof Array?"["+function(e){for(var t="",n=function(e){for(var t=null,n=1,a=null,r=0,A=0;A<e.length;++A)0!==e[A]?(r>n&&(t=a,n=r),a=null,r=0):(null===a&&(a=A),++r);r>n&&(t=a,n=r);return{idx:t,len:n}}(e).idx,a=!1,r=0;r<=7;++r){if(!a||0!==e[r])if(a&&(a=!1),n!==r)t+=e[r].toString(16),7!==r&&(t+=":");else t+=0===r?"::":":",a=!0}return t}(e)+"]":e}function w(e){var t,n=e.path;0!==n.length&&("file"===e.scheme&&1===n.length&&(t=n[0],/^[A-Za-z]:$/.test(t))||n.pop())}function D(e){return""!==e.username||""!==e.password}function M(e,t,n,r,A){if(this.pointer=0,this.input=e,this.base=t||null,this.encodingOverride=n||"utf-8",this.stateOverride=A,this.url=r,this.failure=!1,this.parseError=!1,!this.url){this.url={scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,cannotBeABaseURL:!1};var o=function(e){return e.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g,"")}(this.input);o!==this.input&&(this.parseError=!0),this.input=o}var s=function(e){return e.replace(/\u0009|\u000A|\u000D/g,"")}(this.input);for(s!==this.input&&(this.parseError=!0),this.input=s,this.state=A||"scheme start",this.buffer="",this.atFlag=!1,this.arrFlag=!1,this.passwordTokenSeenFlag=!1,this.input=a.ucs2.decode(this.input);this.pointer<=this.input.length;++this.pointer){var p=this.input[this.pointer],d=isNaN(p)?void 0:String.fromCodePoint(p),c=this["parse "+this.state](p,d);if(!c)break;if(c===i){this.failure=!0;break}}}M.prototype["parse scheme start"]=function(e,t){if(d(e))this.buffer+=t.toLowerCase(),this.state="scheme";else{if(this.stateOverride)return this.parseError=!0,i;this.state="no scheme",--this.pointer}return!0},M.prototype["parse scheme"]=function(e,t){if(function(e){return d(e)||p(e)}(e)||43===e||45===e||46===e)this.buffer+=t.toLowerCase();else if(58===e){if(this.stateOverride){if(f(this.url)&&!g(this.buffer))return!1;if(!f(this.url)&&g(this.buffer))return!1;if((D(this.url)||null!==this.url.port)&&"file"===this.buffer)return!1;if("file"===this.url.scheme&&(""===this.url.host||null===this.url.host))return!1}if(this.url.scheme=this.buffer,this.buffer="",this.stateOverride)return!1;"file"===this.url.scheme?(47===this.input[this.pointer+1]&&47===this.input[this.pointer+2]||(this.parseError=!0),this.state="file"):f(this.url)&&null!==this.base&&this.base.scheme===this.url.scheme?this.state="special relative or authority":f(this.url)?this.state="special authority slashes":47===this.input[this.pointer+1]?(this.state="path or authority",++this.pointer):(this.url.cannotBeABaseURL=!0,this.url.path.push(""),this.state="cannot-be-a-base-URL path")}else{if(this.stateOverride)return this.parseError=!0,i;this.buffer="",this.state="no scheme",this.pointer=-1}return!0},M.prototype["parse no scheme"]=function(e){return null===this.base||this.base.cannotBeABaseURL&&35!==e?i:(this.base.cannotBeABaseURL&&35===e?(this.url.scheme=this.base.scheme,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.url.cannotBeABaseURL=!0,this.state="fragment"):"file"===this.base.scheme?(this.state="file",--this.pointer):(this.state="relative",--this.pointer),!0)},M.prototype["parse special relative or authority"]=function(e){return 47===e&&47===this.input[this.pointer+1]?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="relative",--this.pointer),!0},M.prototype["parse path or authority"]=function(e){return 47===e?this.state="authority":(this.state="path",--this.pointer),!0},M.prototype["parse relative"]=function(e){return this.url.scheme=this.base.scheme,isNaN(e)?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query):47===e?this.state="relative slash":63===e?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query="",this.state="query"):35===e?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.state="fragment"):f(this.url)&&92===e?(this.parseError=!0,this.state="relative slash"):(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(0,this.base.path.length-1),this.state="path",--this.pointer),!0},M.prototype["parse relative slash"]=function(e){return!f(this.url)||47!==e&&92!==e?47===e?this.state="authority":(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.state="path",--this.pointer):(92===e&&(this.parseError=!0),this.state="special authority ignore slashes"),!0},M.prototype["parse special authority slashes"]=function(e){return 47===e&&47===this.input[this.pointer+1]?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="special authority ignore slashes",--this.pointer),!0},M.prototype["parse special authority ignore slashes"]=function(e){return 47!==e&&92!==e?(this.state="authority",--this.pointer):this.parseError=!0,!0},M.prototype["parse authority"]=function(e,t){if(64===e){this.parseError=!0,this.atFlag&&(this.buffer="%40"+this.buffer),this.atFlag=!0;for(var n=o(this.buffer),a=0;a<n;++a){var r=this.buffer.codePointAt(a);if(58!==r||this.passwordTokenSeenFlag){var A=E(r,B);this.passwordTokenSeenFlag?this.url.password+=A:this.url.username+=A}else this.passwordTokenSeenFlag=!0}this.buffer=""}else if(isNaN(e)||47===e||63===e||35===e||f(this.url)&&92===e){if(this.atFlag&&""===this.buffer)return this.parseError=!0,i;this.pointer-=o(this.buffer)+1,this.buffer="",this.state="host"}else this.buffer+=t;return!0},M.prototype["parse hostname"]=M.prototype["parse host"]=function(e,t){if(this.stateOverride&&"file"===this.url.scheme)--this.pointer,this.state="file host";else if(58!==e||this.arrFlag)if(isNaN(e)||47===e||63===e||35===e||f(this.url)&&92===e){if(--this.pointer,f(this.url)&&""===this.buffer)return this.parseError=!0,i;if(this.stateOverride&&""===this.buffer&&(D(this.url)||null!==this.url.port))return this.parseError=!0,!1;var n=Q(this.buffer,f(this.url));if(n===i)return i;if(this.url.host=n,this.buffer="",this.state="path start",this.stateOverride)return!1}else 91===e?this.arrFlag=!0:93===e&&(this.arrFlag=!1),this.buffer+=t;else{if(""===this.buffer)return this.parseError=!0,i;var a=Q(this.buffer,f(this.url));if(a===i)return i;if(this.url.host=a,this.buffer="",this.state="port","hostname"===this.stateOverride)return!1}return!0},M.prototype["parse port"]=function(e,t){if(p(e))this.buffer+=t;else{if(!(isNaN(e)||47===e||63===e||35===e||f(this.url)&&92===e||this.stateOverride))return this.parseError=!0,i;if(""!==this.buffer){var n=parseInt(this.buffer);if(n>Math.pow(2,16)-1)return this.parseError=!0,i;this.url.port=n===(a=this.url.scheme,A[a])?null:n,this.buffer=""}if(this.stateOverride)return!1;this.state="path start",--this.pointer}var a;return!0};var S=new Set([47,92,63,35]);M.prototype["parse file"]=function(e){var t,n;return this.url.scheme="file",47===e||92===e?(92===e&&(this.parseError=!0),this.state="file slash"):null!==this.base&&"file"===this.base.scheme?isNaN(e)?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query):63===e?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query="",this.state="query"):35===e?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.state="fragment"):(this.input.length-this.pointer-1==0||(t=e,n=this.input[this.pointer+1],!d(t)||58!==n&&124!==n)||this.input.length-this.pointer-1>=2&&!S.has(this.input[this.pointer+2])?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),w(this.url)):this.parseError=!0,this.state="path",--this.pointer):(this.state="path",--this.pointer),!0},M.prototype["parse file slash"]=function(e){var t;return 47===e||92===e?(92===e&&(this.parseError=!0),this.state="file host"):(null!==this.base&&"file"===this.base.scheme&&(2===(t=this.base.path[0]).length&&d(t.codePointAt(0))&&":"===t[1]?this.url.path.push(this.base.path[0]):this.url.host=this.base.host),this.state="path",--this.pointer),!0},M.prototype["parse file host"]=function(e,t){if(isNaN(e)||47===e||92===e||63===e||35===e)if(--this.pointer,!this.stateOverride&&l(this.buffer))this.parseError=!0,this.state="path";else if(""===this.buffer){if(this.url.host="",this.stateOverride)return!1;this.state="path start"}else{var n=Q(this.buffer,f(this.url));if(n===i)return i;if("localhost"===n&&(n=""),this.url.host=n,this.stateOverride)return!1;this.buffer="",this.state="path start"}else this.buffer+=t;return!0},M.prototype["parse path start"]=function(e){return f(this.url)?(92===e&&(this.parseError=!0),this.state="path",47!==e&&92!==e&&--this.pointer):this.stateOverride||63!==e?this.stateOverride||35!==e?void 0!==e&&(this.state="path",47!==e&&--this.pointer):(this.url.fragment="",this.state="fragment"):(this.url.query="",this.state="query"),!0},M.prototype["parse path"]=function(e){if(isNaN(e)||47===e||f(this.url)&&92===e||!this.stateOverride&&(63===e||35===e)){if(f(this.url)&&92===e&&(this.parseError=!0),".."===(t=(t=this.buffer).toLowerCase())||"%2e."===t||".%2e"===t||"%2e%2e"===t?(w(this.url),47===e||f(this.url)&&92===e||this.url.path.push("")):!u(this.buffer)||47===e||f(this.url)&&92===e?u(this.buffer)||("file"===this.url.scheme&&0===this.url.path.length&&l(this.buffer)&&(""!==this.url.host&&null!==this.url.host&&(this.parseError=!0,this.url.host=""),this.buffer=this.buffer[0]+":"),this.url.path.push(this.buffer)):this.url.path.push(""),this.buffer="","file"===this.url.scheme&&(void 0===e||63===e||35===e))for(;this.url.path.length>1&&""===this.url.path[0];)this.parseError=!0,this.url.path.shift();63===e&&(this.url.query="",this.state="query"),35===e&&(this.url.fragment="",this.state="fragment")}else 37!==e||c(this.input[this.pointer+1])&&c(this.input[this.pointer+2])||(this.parseError=!0),this.buffer+=E(e,m);var t;return!0},M.prototype["parse cannot-be-a-base-URL path"]=function(e){return 63===e?(this.url.query="",this.state="query"):35===e?(this.url.fragment="",this.state="fragment"):(isNaN(e)||37===e||(this.parseError=!0),37!==e||c(this.input[this.pointer+1])&&c(this.input[this.pointer+2])||(this.parseError=!0),isNaN(e)||(this.url.path[0]=this.url.path[0]+E(e,h))),!0},M.prototype["parse query"]=function(e,t){if(isNaN(e)||!this.stateOverride&&35===e){f(this.url)&&"ws"!==this.url.scheme&&"wss"!==this.url.scheme||(this.encodingOverride="utf-8");for(var n=new Buffer(this.buffer),a=0;a<n.length;++a)n[a]<33||n[a]>126||34===n[a]||35===n[a]||60===n[a]||62===n[a]?this.url.query+=I(n[a]):this.url.query+=String.fromCodePoint(n[a]);this.buffer="",35===e&&(this.url.fragment="",this.state="fragment")}else 37!==e||c(this.input[this.pointer+1])&&c(this.input[this.pointer+2])||(this.parseError=!0),this.buffer+=t;return!0},M.prototype["parse fragment"]=function(e){return isNaN(e)||(0===e?this.parseError=!0:(37!==e||c(this.input[this.pointer+1])&&c(this.input[this.pointer+2])||(this.parseError=!0),this.url.fragment+=E(e,h))),!0},e.exports.serializeURL=function(e,t){var n=e.scheme+":";if(null!==e.host?(n+="//",""===e.username&&""===e.password||(n+=e.username,""!==e.password&&(n+=":"+e.password),n+="@"),n+=v(e.host),null!==e.port&&(n+=":"+e.port)):null===e.host&&"file"===e.scheme&&(n+="//"),e.cannotBeABaseURL)n+=e.path[0];else{var a=!0,r=!1,A=void 0;try{for(var i,o=e.path[Symbol.iterator]();!(a=(i=o.next()).done);a=!0){n+="/"+i.value}}catch(e){r=!0,A=e}finally{try{a||null==o.return||o.return()}finally{if(r)throw A}}}return null!==e.query&&(n+="?"+e.query),t||null===e.fragment||(n+="#"+e.fragment),n},e.exports.serializeURLOrigin=function(t){switch(t.scheme){case"blob":try{return e.exports.serializeURLOrigin(e.exports.parseURL(t.path[0]))}catch(e){return"null"}case"ftp":case"gopher":case"http":case"https":case"ws":case"wss":return n={scheme:t.scheme,host:t.host,port:t.port},a=n.scheme+"://",a+=v(n.host),null!==n.port&&(a+=":"+n.port),a;case"file":return"file://";default:return"null"}var n,a},e.exports.basicURLParse=function(e,t){void 0===t&&(t={});var n=new M(e,t.baseURL,t.encodingOverride,t.url,t.stateOverride);return n.failure?"failure":n.url},e.exports.setTheUsername=function(e,t){e.username="";for(var n=a.ucs2.decode(t),r=0;r<n.length;++r)e.username+=E(n[r],B)},e.exports.setThePassword=function(e,t){e.password="";for(var n=a.ucs2.decode(t),r=0;r<n.length;++r)e.password+=E(n[r],B)},e.exports.serializeHost=v,e.exports.cannotHaveAUsernamePasswordPort=function(e){return null===e.host||""===e.host||e.cannotBeABaseURL||"file"===e.scheme},e.exports.serializeInteger=function(e){return String(e)},e.exports.parseURL=function(t,n){return void 0===n&&(n={}),e.exports.basicURLParse(t,{baseURL:n.baseURL,encodingOverride:n.encodingOverride})}},function(e,t,n){var a=n(33),r=n(6),A=n(11),i=n(224),o=this;function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}"undefined"==typeof Buffer&&(Buffer=n(69).Buffer);var p=n(114),d=n(229).default,c=n(230),u=n(70),l=n(115),g=n(21).utils,f=g.keccak256,I=g.getAddress,h={name:"Utils",nullAddress:"0x0000000000000000000000000000000000000000",weiPerEther:new d("1000000000000000000"),ToBigNumber:function(e){return new d(e)},WeiToEther:function(e){return h.ToBigNumber(e).div(h.weiPerEther)},EtherToWei:function(e){return h.ToBigNumber(e).times(h.weiPerEther)},FormatAddress:function(e){return e&&"string"==typeof e?((e=e.trim()).startsWith("0x")||(e="0x"+e),e.toLowerCase()):""},FormatSignature:function(e){return e=e.replace("0x",""),"ES256K_"+p.encode(Buffer.from(e,"hex"))},DecodeVersionHash:function(e){if(!e.startsWith("hq__")&&!e.startsWith("tq__"))throw new Error('Invalid version hash: "'.concat(e,'"'));e=e.slice(4);var t=h.FromB58(e),n=t.slice(0,32),a=n.toString("hex");t=t.slice(32);for(var r=0;t[r]>=128;)r++;r++;var A=t.slice(0,r),i=c.decode(A);return t=t.slice(r),{digest:a,size:i,objectId:"iq__"+h.B58(t),partHash:"hqp_"+h.B58(Buffer.concat([n,A]))}},DecodeSignedToken:function(e){var t=h.FromB58(e.slice(6)),n="0x".concat(t.slice(0,65).toString("hex")),a=JSON.parse(Buffer.from(l.inflateRaw(t.slice(65))).toString("utf-8"));return a.adr=h.FormatAddress("0x".concat(Buffer.from(a.adr,"base64").toString("hex"))),{payload:a,signature:n}},DecodeWriteToken:function(e){if(e.length<4)throw new Error('Invalid write token: ["'.concat(e,'"] (unknown prefix)'));var t;if(e.startsWith("tqw__")?(t="tq__",e=e.slice(5)):(t=e.slice(0,4),e=e.slice(4)),0===e.length)throw new Error('Invalid write token: ["'.concat(e,'"] (too short)'));switch(t){case"tqw_":case"tq__":case"tqpw":case"tqp_":case"tlro":break;default:throw new Error('Invalid write token: ["'.concat(e,'"] (unknown prefix)'))}var n,a,r,A,i,o=h.FromB58(e);function s(e,t){var n,a,r=c.decode(o,0),A=c.decode.bytes;return a=e?0===(n=o.slice(A+1,r+A)).length?"":t+h.B58(n):"0x"+(n=o.slice(A,r+A)).toString("hex"),o=o.slice(r+A),a}switch(t){case"tqw_":case"tqpw":n="0x"+o.toString("hex");break;case"tlro":case"tq__":a=s(!0,"iq__"),r=s(!0,"inod"),n=s(!1,"");break;case"tqp_":if(o.length<3)throw new Error('Invalid write token: ["'.concat(e,'"] (token truncated)'));A=o[0],i=o[1],o=o.slice(2),n=s(!1,"");break;default:throw new Error('Invalid write token: ["'.concat(e,'"] (unknown prefix)'))}return{tokenType:t,tokenId:n,objectId:a,nodeId:r,scheme:A,flags:i}},AddressToHash:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e=e.replace(t?"0x04":"0x",""),p.encode(Buffer.from(e,"hex"))},AddressToSpaceId:function(e){return"ispc"+h.AddressToHash(e)},AddressToLibraryId:function(e){return"ilib"+h.AddressToHash(e)},AddressToObjectId:function(e){return"iq__"+h.AddressToHash(e)},HashToAddress:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e=t?e:e.substr(4),h.FormatAddress((t?"0x04":"0x")+p.decode(e).toString("hex"))},EqualAddress:function(e,t){return!(!e||!t)&&h.FormatAddress(e)===h.FormatAddress(t)},EqualHash:function(e,t){return!(!e||!t)&&(!(e.length<=4||t.length<=4)&&h.HashToAddress(e)===h.HashToAddress(t))},ValidAddress:function(e){try{return I(e),!0}catch(e){return o.Log(e),!1}},ValidHash:function(e){return h.ValidAddress(h.HashToAddress(e))},ToBytes32:function(e){return"0x"+e.split("").map((function(e){return e.charCodeAt(0).toString(16)})).join("").slice(0,64).padEnd(64,"0")},BufferToArrayBuffer:function(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)},B64:function(e){return Buffer.from(e,"utf-8").toString("base64")},FromB64:function(e){return Buffer.from(e,"base64").toString("utf-8")},B58:function(e){return p.encode(Buffer.from(e))},FromB58:function(e){return p.decode(e)},DecodeAuthorizationToken:function(e){var t=(e=decodeURIComponent(e)).split("."),n=i(t,2),a=n[0],r=n[1];return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){A(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},a=JSON.parse(h.FromB64(a)),{signature:r})},LimitedMap:function(e,t,n){var A,i,o,s,p;return r.async((function(d){for(;;)switch(d.prev=d.next){case 0:return A=0,i=!1,o=function(){var e;return r.async((function(t){for(;;)switch(t.prev=t.next){case 0:if(!i){t.next=5;break}return t.next=3,r.awrap(new Promise((function(e){return setTimeout(e,10)})));case 3:t.next=0;break;case 5:return i=!0,e=A,A+=1,i=!1,t.abrupt("return",e);case 10:case"end":return t.stop()}}))},s=[],p=0,d.abrupt("return",new Promise((function(A,i){a(Array(e||1)).forEach((function(){var e;return r.async((function(a){for(;;)switch(a.prev=a.next){case 0:return p+=1,a.next=3,r.awrap(o());case 3:e=a.sent;case 4:if(!(e<t.length)){a.next=19;break}return a.prev=5,a.next=8,r.awrap(n(t[e],e));case 8:s[e]=a.sent,a.next=14;break;case 11:a.prev=11,a.t0=a.catch(5),i(a.t0);case 14:return a.next=16,r.awrap(o());case 16:e=a.sent,a.next=4;break;case 19:0===(p-=1)&&A(s);case 21:case"end":return a.stop()}}),null,null,[[5,11]])}))})));case 6:case"end":return d.stop()}}))},ResponseToJson:function(e){return r.async((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",h.ResponseToFormat("json",e));case 1:case"end":return t.stop()}}))},ResponseToFormat:function(e,t){return r.async((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,r.awrap(t);case 2:t=n.sent,n.t0=e.toLowerCase(),n.next="json"===n.t0?6:"text"===n.t0?9:"blob"===n.t0?12:"arraybuffer"===n.t0?15:"formdata"===n.t0?18:"buffer"===n.t0?21:24;break;case 6:return n.next=8,r.awrap(t.json());case 8:return n.abrupt("return",n.sent);case 9:return n.next=11,r.awrap(t.text());case 11:return n.abrupt("return",n.sent);case 12:return n.next=14,r.awrap(t.blob());case 14:return n.abrupt("return",n.sent);case 15:return n.next=17,r.awrap(t.arrayBuffer());case 17:return n.abrupt("return",n.sent);case 18:return n.next=20,r.awrap(t.formData());case 20:return n.abrupt("return",n.sent);case 21:return n.next=23,r.awrap(t.buffer());case 23:return n.abrupt("return",n.sent);case 24:return n.abrupt("return",t);case 25:case"end":return n.stop()}}))},ResizeImage:function(e){var t=e.imageUrl,n=e.height;return!t||t&&!t.startsWith("http")?t:(t=u(t).removeSearch("height").removeSearch("header-x_image_height"),n&&!isNaN(parseInt(n))&&t.addSearch("height",parseInt(n)),t.toString())},SafeTraverse:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];if(!e)return e;1===n.length&&Array.isArray(n[0])&&(n=n[0]);for(var r=e,A=0;A<n.length;A++)if(void 0===(r=r[n[A]]))return;return r},IsCloneable:function(e){if(Object(e)!==e)return!0;switch({}.toString.call(e).slice(8,-1)){case"Boolean":case"Number":case"String":case"Date":case"RegExp":case"Blob":case"FileList":case"ImageData":case"ImageBitmap":case"ArrayBuffer":return!0;case"Array":case"Object":return Object.keys(e).every((function(t){return h.IsCloneable(e[t])}));case"Map":return a(e.keys()).every(h.IsCloneable)&&a(e.values()).every(h.IsCloneable);case"Set":return a(e.keys()).every(h.IsCloneable);default:return!1}},MakeClonable:function(e){if(h.IsCloneable(e))return e;if(Buffer.isBuffer(e))return h.BufferToArrayBuffer(e);switch({}.toString.call(e).slice(8,-1)){case"Response":case"Function":return;case"Boolean":case"Number":case"String":case"Date":case"RegExp":case"Blob":case"FileList":case"ImageData":case"ImageBitmap":case"ArrayBuffer":return e;case"Array":return e.map((function(e){return h.MakeClonable(e)}));case"Set":return new Set(Array.from(e.keys()).map((function(e){return h.MakeClonable(e)})));case"Map":var t=new Map;return Array.from(e.keys()).forEach((function(n){var a=h.MakeClonable(e.get(n));a&&t.set(n,a)})),t;case"Error":return e.message;case"Object":var n={};return Object.keys(e).map((function(t){var a=h.MakeClonable(e[t]);a&&(n[t]=a)})),n;default:return JSON.parse(JSON.stringify(e))}},PublicKeyToAddress:function(e){var t=new Uint8Array(Buffer.from(e.replace("0x04",""),"hex")),n="0x"+f(t).slice(26);return h.FormatAddress(n)},PLATFORM_NODE:"node",PLATFORM_WEB:"web",PLATFORM_REACT_NATIVE:"react-native",Platform:function(){return"undefined"!=typeof navigator&&"ReactNative"===navigator.product?h.PLATFORM_REACT_NATIVE:"undefined"!=typeof process&&void 0!==process.versions&&void 0!==process.versions.node?h.PLATFORM_NODE:h.PLATFORM_WEB}};e.exports=h},function(e,t,n){var a,r,A;function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}A=function(){function e(e){var t=[];if(0===e.length)return"";if("string"!=typeof e[0])throw new TypeError("Url must be a string. Received "+e[0]);if(e[0].match(/^[^/:]+:\/*$/)&&e.length>1){var n=e.shift();e[0]=n+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var a=0;a<e.length;a++){var r=e[a];if("string"!=typeof r)throw new TypeError("Url must be a string. Received "+r);""!==r&&(a>0&&(r=r.replace(/^[\/]+/,"")),r=a<e.length-1?r.replace(/[\/]+$/,""):r.replace(/[\/]+$/,"/"),t.push(r))}var A=t.join("/"),i=(A=A.replace(/\/(\?|&|#[^!])/g,"$1")).split("?");return A=i.shift()+(i.length>0?"?":"")+i.join("&")}return function(){return e("object"===i(arguments[0])?arguments[0]:[].slice.call(arguments))}},e.exports?e.exports=A():void 0===(r="function"==typeof(a=A)?a.call(t,n,t,e):a)||(e.exports=r)},function(e,t,n){var a=n(24);t.ValidatePresence=function(e,t){if(!t)throw Error("".concat(e," not specified"))},t.ValidateLibrary=function(e){if(!e)throw Error("Library ID not specified");if(!e.toString().startsWith("i"))throw Error("Invalid library ID: ".concat(e))},t.ValidateObject=function(e){if(!e)throw Error("Object ID not specified");if(!e.toString().startsWith("i"))throw Error("Invalid object ID: ".concat(e))},t.ValidateVersion=function(e){if(!e)throw Error("Version hash not specified");if(!e.toString().startsWith("h"))throw Error("Invalid version hash: ".concat(e))},t.ValidateWriteToken=function(e){if(!e)throw Error("Write token not specified");if(!e.toString().startsWith("t"))throw Error("Invalid write token: ".concat(e))},t.ValidatePartHash=function(e){if(!e)throw Error("Part hash not specified");if(!e.toString().startsWith("hqp_")&&!e.toString().startsWith("hqpe"))throw Error("Invalid part hash: ".concat(e))},t.ValidateParameters=function(e){var n=e.libraryId,a=e.objectId,r=e.versionHash;r?t.ValidateVersion(r):(t.ValidateLibrary(n),t.ValidateObject(a))},t.ValidateAddress=function(e){if(!e)throw Error("Address not specified");if(!/^(0x)?[0-9a-f]{40}$/i.test(e.toLowerCase()))throw Error("Invalid address: ".concat(e));return a.FormatAddress(e)},t.ValidatePermission=function(e){if(e&&"full-access"!==e&&"no-access"!==e)throw Error("Invalid profile permission: ".concat(e));return e},t.ValidateDate=function(e){if(e){if(isNaN(new Date(e)))throw Error("Invalid date: ".concat(e));return new Date(e).getTime()}}},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=a=function(e){return n(e)}:e.exports=a=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":n(e)},a(t)}e.exports=a},function(e,t){e.exports=require("buffer")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(34),r=n(5);t.check=function(e){for(var t=[],n=0;n<2048;n++){var r=e.getWord(n);if(n!==e.getWordIndex(r))return"0x";t.push(r)}return a.id(t.join("\n")+"\n")};var A=function(){function e(e){r.defineReadOnly(this,"locale",e)}return e.prototype.split=function(e){return e.toLowerCase().split(/ +/g)},e.prototype.join=function(e){return e.join(" ")},e}();t.Wordlist=A,t.register=function(e,t){t||(t=e.locale)}},function(e,t){e.exports=require("zlib")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(15);t.AddressZero="0x0000000000000000000000000000000000000000";t.HashZero="0x0000000000000000000000000000000000000000000000000000000000000000";t.EtherSymbol="Ξ";var r=a.bigNumberify(-1);t.NegativeOne=r;var A=a.bigNumberify(0);t.Zero=A;var i=a.bigNumberify(1);t.One=i;var o=a.bigNumberify(2);t.Two=o;var s=a.bigNumberify("1000000000000000000");t.WeiPerEther=s;var p=a.bigNumberify("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");t.MaxUint256=p},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}e.exports=function(e){var t=n(e);return null!=e&&("object"==t||"function"==t)}},function(e,t,n){var a=n(159),r=n(160),A=n(161);e.exports=function(e){return a(e)||r(e)||A()}},function(e,t,n){"use strict";var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(0)),A=n(1),i=n(8),o=n(22),s=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]),p=new RegExp("^((.*)\\.)?([^.]+)$"),d=new RegExp("^[a-z0-9.-]*$");t.namehash=function(e){"string"!=typeof e&&r.throwError("invalid address - "+String(e),r.INVALID_ARGUMENT,{argument:"name",value:e}),(e=e.toLowerCase()).match(d)||r.throwError("contains invalid UseSTD3ASCIIRules characters",r.INVALID_ARGUMENT,{argument:"name",value:e});for(var t=s;e.length;){var n=e.match(p),a=i.toUtf8Bytes(n[3]);t=o.keccak256(A.concat([t,o.keccak256(a)])),e=n[2]||""}return A.hexlify(t)},t.id=function(e){return o.keccak256(i.toUtf8Bytes(e))},t.hashMessage=function(e){return o.keccak256(A.concat([i.toUtf8Bytes("Ethereum Signed Message:\n"),i.toUtf8Bytes(String(e.length)),"string"==typeof e?i.toUtf8Bytes(e):e]))}},function(e,t,n){var a=n(6),r=n(19),A=n(20),i=n(70),o="undefined"!=typeof fetch?fetch:n(80).default,s=n(44).LogMessage,p=function(){"use strict";function e(t){var n=t.uris,a=t.debug;r(this,e),this.uris=n,this.uriIndex=0,this.debug=a,this.draftURIs={}}return A(e,[{key:"Log",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];s(this,e,t)}}]),A(e,[{key:"BaseURI",value:function(){return new i(this.uris[this.uriIndex])}},{key:"RecordWriteToken",value:function(e){this.draftURIs[e]=this.BaseURI()}},{key:"RequestHeaders",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.Accept||(t.Accept="application/json"),"JSON"===e?t["Content-type"]="application/json":"BINARY"===e&&(t["Content-type"]="application/octet-stream"),t}},{key:"Request",value:function(t){var n,r,A,i,o,s,p,d,c,u,l,g,f,I,h,y,m,C,B,E,b,Q,v,w;return a.async((function(D){for(;;)switch(D.prev=D.next){case 0:return n=t.method,r=t.path,A=t.queryParams,i=void 0===A?{}:A,o=t.body,s=t.bodyType,p=void 0===s?"JSON":s,d=t.headers,c=void 0===d?{}:d,u=t.attempts,l=void 0===u?0:u,g=t.failover,f=void 0===g||g,I=t.forceFailover,h=void 0!==I&&I,y=this.BaseURI(),m=r.replace(/^\//,"").match(/(qlibs\/ilib[a-zA-Z0-9]+|q|qid)\/(tqw_[a-zA-Z0-9]+)/),(C=m?m[2]:void 0)&&(this.draftURIs[C]?y=this.draftURIs[C]:this.draftURIs[C]=y),B=y.path(r).query(i).hash(""),E={method:n,headers:this.RequestHeaders(p,c)},"POST"!==n&&"PUT"!==n&&"DELETE"!==n||(o&&"JSON"===p?E.body=JSON.stringify(o):o&&(E.body=o)),D.prev=8,D.next=11,a.awrap(e.Fetch(B.toString(),E));case 11:b=D.sent,D.next=17;break;case 14:D.prev=14,D.t0=D.catch(8),b={ok:!1,status:500,statusText:"ElvClient Error: "+D.t0.message,url:B.toString(),stack:D.t0.stack};case 17:if(b.ok){D.next=40;break}if(!(!C&&(f&&parseInt(b.status)>=500||h)&&l<this.uris.length)){D.next=24;break}return this.Log("HttpClient failing over from ".concat(this.BaseURI(),": ").concat(l+1," attempts"),!0),this.uriIndex=(this.uriIndex+1)%this.uris.length,D.next=23,a.awrap(this.Request({method:n,path:r,queryParams:i,body:o,bodyType:p,headers:c,attempts:l+1,forceFailover:h}));case 23:return D.abrupt("return",D.sent);case 24:if(Q=b.headers&&b.headers.get("content-type")||"",v="",!b.text||!b.json){D.next=37;break}if(!Q.includes("application/json")){D.next=33;break}return D.next=30,a.awrap(b.json());case 30:D.t1=D.sent,D.next=36;break;case 33:return D.next=35,a.awrap(b.text());case 35:D.t1=D.sent;case 36:v=D.t1;case 37:throw w={name:"ElvHttpClientError",status:b.status,statusText:b.statusText,message:b.statusText,url:B.toString(),body:v,requestParams:E},this.Log(JSON.stringify(w,null,2),!0),w;case 40:return this.Log("".concat(b.status," - ").concat(n," ").concat(B.toString())),D.abrupt("return",b);case 42:case"end":return D.stop()}}),null,this,[[8,14]])}},{key:"URL",value:function(e){var t=e.path,n=e.queryParams,a=void 0===n?{}:n;return this.BaseURI().path(t).query(a).hash("").toString()}}],[{key:"Fetch",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return o(e,t)}}]),e}();e.exports=p},function(e,t,n){function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r=n(120),A="object"==("undefined"==typeof self?"undefined":a(self))&&self&&self.Object===Object&&self,i=r||A||Function("return this")();e.exports=i},function(e,t,n){"use strict";function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){return!t||"object"!==a(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function A(e){return(A=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var o={};function s(e,t,n){n||(n=Error);var a=function(e){function n(e,a,i){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),r(this,A(n).call(this,function(e,n,a){return"string"==typeof t?t:t(e,n,a)}(e,a,i)))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(n,e),n}(n);a.prototype.name=n.name,a.prototype.code=e,o[e]=a}function p(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map((function(e){return String(e)})),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}s("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),s("ERR_INVALID_ARG_TYPE",(function(e,t,n){var r,A,i,o;if("string"==typeof t&&(A="not ",t.substr(!i||i<0?0:+i,A.length)===A)?(r="must not be",t=t.replace(/^not /,"")):r="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}(e," argument"))o="The ".concat(e," ").concat(r," ").concat(p(t,"type"));else{var s=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}(e,".")?"property":"argument";o='The "'.concat(e,'" ').concat(s," ").concat(r," ").concat(p(t,"type"))}return o+=". Received type ".concat(a(n))}),TypeError),s("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),s("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),s("ERR_STREAM_PREMATURE_CLOSE","Premature close"),s("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),s("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),s("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),s("ERR_STREAM_WRITE_AFTER_END","write after end"),s("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),s("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),s("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=o},function(e,t,n){"use strict";var a=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=p;var r=n(136),A=n(140);n(4)(p,r);for(var i=a(A.prototype),o=0;o<i.length;o++){var s=i[o];p.prototype[s]||(p.prototype[s]=A.prototype[s])}function p(e){if(!(this instanceof p))return new p(e);r.call(this,e),A.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",d)))}function d(){this._writableState.ended||process.nextTick(c,this)}function c(e){e.end()}Object.defineProperty(p.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(p.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(p.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(p.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},function(e,t){e.exports=require("url")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(5),r=function(){function e(){a.setType(this,"Provider")}return e.isProvider=function(e){return a.isType(e,"Provider")},e}();t.Provider=r},function(e,t){e.exports=require("util")},function(e,t,n){"use strict";var a=n(17),r=n(9);function A(){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}t.BlockHash=A,A.prototype.update=function(e,t){if(e=a.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=a.join32(e,0,e.length-n,this.endian);for(var r=0;r<e.length;r+=this._delta32)this._update(e,r,r+this._delta32)}return this},A.prototype.digest=function(e){return this.update(this._pad()),r(null===this.pending),this._digest(e)},A.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,n=t-(e+this.padLength)%t,a=new Array(n+this.padLength);a[0]=128;for(var r=1;r<n;r++)a[r]=0;if(e<<=3,"big"===this.endian){for(var A=8;A<this.padLength;A++)a[r++]=0;a[r++]=0,a[r++]=0,a[r++]=0,a[r++]=0,a[r++]=e>>>24&255,a[r++]=e>>>16&255,a[r++]=e>>>8&255,a[r++]=255&e}else for(a[r++]=255&e,a[r++]=e>>>8&255,a[r++]=e>>>16&255,a[r++]=e>>>24&255,a[r++]=0,a[r++]=0,a[r++]=0,a[r++]=0,A=8;A<this.padLength;A++)a[r++]=0;return a}},function(e,t,n){"use strict";var a=n(18),r=n(9);function A(){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}t.BlockHash=A,A.prototype.update=function(e,t){if(e=a.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=a.join32(e,0,e.length-n,this.endian);for(var r=0;r<e.length;r+=this._delta32)this._update(e,r,r+this._delta32)}return this},A.prototype.digest=function(e){return this.update(this._pad()),r(null===this.pending),this._digest(e)},A.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,n=t-(e+this.padLength)%t,a=new Array(n+this.padLength);a[0]=128;for(var r=1;r<n;r++)a[r]=0;if(e<<=3,"big"===this.endian){for(var A=8;A<this.padLength;A++)a[r++]=0;a[r++]=0,a[r++]=0,a[r++]=0,a[r++]=0,a[r++]=e>>>24&255,a[r++]=e>>>16&255,a[r++]=e>>>8&255,a[r++]=255&e}else for(a[r++]=255&e,a[r++]=e>>>8&255,a[r++]=e>>>16&255,a[r++]=e>>>24&255,a[r++]=0,a[r++]=0,a[r++]=0,a[r++]=0,A=8;A<this.padLength;A++)a[r++]=0;return a}},function(e,t,n){var a=n(27),r=function(e,t){return"object"===a(t)&&"function"==typeof t[e]?t[e]:null},A=function(e){return"object"===a(e)?JSON.stringify(e):e};e.exports={LogMessage:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e.debug){var a=r("log",e.debugOptions),i=r("error",e.debugOptions),o="(elv-client-js#".concat(e.constructor.name,")"),s="\n".concat(o," ").concat(A(t),"\n");n?i?i(o,t):console.error(s):a?a(o,t):console.log(s)}}}},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}e.exports=function(e){return null!=e&&"object"==n(e)}},function(e,t,n){var a=t;a.bignum=n(2),a.define=n(362).define,a.base=n(47),a.constants=n(150),a.decoders=n(367),a.encoders=n(369)},function(e,t,n){var a=t;a.Reporter=n(364).Reporter,a.DecoderBuffer=n(149).DecoderBuffer,a.EncoderBuffer=n(149).EncoderBuffer,a.Node=n(365)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1);function r(e){for(var t=[];e;)t.unshift(255&e),e>>=8;return t}function A(e,t,n){for(var a=0,r=0;r<n;r++)a=256*a+e[t+r];return a}function i(e,t,n,a){for(var r=[];n<t+1+a;){var A=o(e,n);if(r.push(A.result),(n+=A.consumed)>t+1+a)throw new Error("invalid rlp")}return{consumed:1+a,result:r}}function o(e,t){if(0===e.length)throw new Error("invalid rlp data");if(e[t]>=248){if(t+1+(n=e[t]-247)>e.length)throw new Error("too short");if(t+1+n+(r=A(e,t+1,n))>e.length)throw new Error("to short");return i(e,t,t+1+n,n+r)}if(e[t]>=192){if(t+1+(r=e[t]-192)>e.length)throw new Error("invalid rlp data");return i(e,t,t+1,r)}if(e[t]>=184){var n;if(t+1+(n=e[t]-183)>e.length)throw new Error("invalid rlp data");if(t+1+n+(r=A(e,t+1,n))>e.length)throw new Error("invalid rlp data");return{consumed:1+n+r,result:a.hexlify(e.slice(t+1+n,t+1+n+r))}}if(e[t]>=128){var r;if(t+1+(r=e[t]-128)>e.length)throw new Error("invalid rlp data");return{consumed:1+r,result:a.hexlify(e.slice(t+1,t+1+r))}}return{consumed:1,result:a.hexlify(e[t])}}t.encode=function(e){return a.hexlify(function e(t){if(Array.isArray(t)){var n=[];return t.forEach((function(t){n=n.concat(e(t))})),n.length<=55?(n.unshift(192+n.length),n):((A=r(n.length)).unshift(247+A.length),A.concat(n))}var A,i=Array.prototype.slice.call(a.arrayify(t));return 1===i.length&&i[0]<=127?i:i.length<=55?(i.unshift(128+i.length),i):((A=r(i.length)).unshift(183+A.length),A.concat(i))}(e))},t.decode=function(e){var t=a.arrayify(e),n=o(t,0);if(n.consumed!==t.length)throw new Error("invalid rlp data");return n.result}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(5),r=function(){function e(){a.setType(this,"Signer")}return e.isSigner=function(e){return a.isType(e,"Signer")},e}();t.Signer=r},function(e,t,n){"use strict";var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(0)),A=n(100),i=n(166),o=n(1),s=n(15),p=n(8),d=n(101),c=n(102),u=n(5),l=n(51),g=n(76),f=s.bigNumberify("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),I=p.toUtf8Bytes("Bitcoin seed");function h(e){return(1<<e)-1<<8-e}function y(e){return o.hexZeroPad(o.hexlify(e),32)}function m(e){var t=o.hexDataSlice(g.sha256(g.sha256(e)),0,4);return i.Base58.encode(o.concat([e,t]))}var C={};t.defaultPath="m/44'/60'/0'/0/0";var B=function(){function e(t,n,a,A,i,s,p,d,c){if(r.checkNew(this,e),t!==C)throw new Error("HDNode constructor cannot be called directly");if(n){var f=new l.KeyPair(n);u.defineReadOnly(this,"privateKey",f.privateKey),u.defineReadOnly(this,"publicKey",f.compressedPublicKey)}else u.defineReadOnly(this,"privateKey",null),u.defineReadOnly(this,"publicKey",o.hexlify(a));u.defineReadOnly(this,"parentFingerprint",A),u.defineReadOnly(this,"fingerprint",o.hexDataSlice(g.ripemd160(g.sha256(this.publicKey)),0,4)),u.defineReadOnly(this,"address",l.computeAddress(this.publicKey)),u.defineReadOnly(this,"chainCode",i),u.defineReadOnly(this,"index",s),u.defineReadOnly(this,"depth",p),u.defineReadOnly(this,"mnemonic",d),u.defineReadOnly(this,"path",c),u.setType(this,"HDNode")}return Object.defineProperty(e.prototype,"extendedKey",{get:function(){if(this.depth>=256)throw new Error("Depth too large!");return m(o.concat([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",o.hexlify(this.depth),this.parentFingerprint,o.hexZeroPad(o.hexlify(this.index),4),this.chainCode,null!=this.privateKey?o.concat(["0x00",this.privateKey]):this.publicKey]))},enumerable:!0,configurable:!0}),e.prototype.neuter=function(){return new e(C,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,null,this.path)},e.prototype._derive=function(t){if(t>4294967295)throw new Error("invalid index - "+String(t));var n=this.path;n&&(n+="/"+(2147483647&t));var a=new Uint8Array(37);if(2147483648&t){if(!this.privateKey)throw new Error("cannot derive child of neutered node");a.set(o.arrayify(this.privateKey),1),n&&(n+="'")}else a.set(o.arrayify(this.publicKey));for(var r=24;r>=0;r-=8)a[33+(r>>3)]=t>>24-r&255;var A=c.computeHmac(c.SupportedAlgorithms.sha512,this.chainCode,a),i=A.slice(0,32),p=A.slice(32),d=null,u=null;this.privateKey?d=y(s.bigNumberify(i).add(this.privateKey).mod(f)):u=new l.KeyPair(o.hexlify(i))._addPoint(this.publicKey);return new e(C,d,u,this.fingerprint,y(p),t,this.depth+1,this.mnemonic,n)},e.prototype.derivePath=function(e){var t=e.split("/");if(0===t.length||"m"===t[0]&&0!==this.depth)throw new Error("invalid path - "+e);"m"===t[0]&&t.shift();for(var n=this,a=0;a<t.length;a++){var r=t[a];if(r.match(/^[0-9]+'$/)){if((A=parseInt(r.substring(0,r.length-1)))>=2147483648)throw new Error("invalid path index - "+r);n=n._derive(2147483648+A)}else{if(!r.match(/^[0-9]+$/))throw new Error("invalid path component - "+r);var A;if((A=parseInt(r))>=2147483648)throw new Error("invalid path index - "+r);n=n._derive(A)}}return n},e.isHDNode=function(e){return u.isType(e,"HDNode")},e}();function E(e,t){var n=o.arrayify(e);if(n.length<16||n.length>64)throw new Error("invalid seed");var a=o.arrayify(c.computeHmac(c.SupportedAlgorithms.sha512,I,n));return new B(C,y(a.slice(0,32)),null,"0x00000000",y(a.slice(32)),0,0,t,"m")}function b(e,t){t||(t="");var n=p.toUtf8Bytes("mnemonic"+t,p.UnicodeNormalizationForm.NFKD);return o.hexlify(d.pbkdf2(p.toUtf8Bytes(e,p.UnicodeNormalizationForm.NFKD),n,2048,64,"sha512"))}function Q(e,t){t||(t=A.langEn),r.checkNormalize();var n=t.split(e);if(n.length%3!=0)throw new Error("invalid mnemonic");for(var a=o.arrayify(new Uint8Array(Math.ceil(11*n.length/8))),i=0,s=0;s<n.length;s++){var p=t.getWordIndex(n[s].normalize("NFKD"));if(-1===p)throw new Error("invalid mnemonic");for(var d=0;d<11;d++)p&1<<10-d&&(a[i>>3]|=1<<7-i%8),i++}var c=32*n.length/3,u=h(n.length/3),l=o.arrayify(g.sha256(a.slice(0,c/8)))[0];if((l&=u)!==(a[a.length-1]&u))throw new Error("invalid checksum");return o.hexlify(a.slice(0,c/8))}function v(e,t){if((e=o.arrayify(e)).length%4!=0||e.length<16||e.length>32)throw new Error("invalid entropy");for(var n=[0],a=11,r=0;r<e.length;r++)a>8?(n[n.length-1]<<=8,n[n.length-1]|=e[r],a-=8):(n[n.length-1]<<=a,n[n.length-1]|=e[r]>>8-a,n.push(e[r]&(1<<8-a)-1),a+=3);var i=o.arrayify(g.sha256(e))[0],s=e.length/4;return i&=h(s),n[n.length-1]<<=s,n[n.length-1]|=i>>8-s,t||(t=A.langEn),t.join(n.map((function(e){return t.getWord(e)})))}t.HDNode=B,t.fromExtendedKey=function(e){var t=i.Base58.decode(e);82===t.length&&m(t.slice(0,78))===e||r.throwError("invalid extended key",r.INVALID_ARGUMENT,{argument:"extendedKey",value:"[REDACTED]"});var n=t[4],a=o.hexlify(t.slice(5,9)),A=parseInt(o.hexlify(t.slice(9,13)).substring(2),16),s=o.hexlify(t.slice(13,45)),p=t.slice(45,78);switch(o.hexlify(t.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new B(C,null,o.hexlify(p),a,s,A,n,null,null);case"0x0488ade4":case"0x04358394":if(0!==p[0])break;return new B(C,o.hexlify(p.slice(1)),null,a,s,A,n,null,null)}return r.throwError("invalid extended key",r.INVALID_ARGUMENT,{argument:"extendedKey",value:"[REDACTED]"})},t.fromMnemonic=function(e,t,n){return E(b(e=v(Q(e,t),t),n),e)},t.fromSeed=function(e){return E(e,null)},t.mnemonicToSeed=b,t.mnemonicToEntropy=Q,t.entropyToMnemonic=v,t.isValidMnemonic=function(e,t){try{return Q(e,t),!0}catch(e){}return!1}},function(e,t,n){"use strict";var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var r=n(167),A=n(16),i=n(1),o=n(34),s=n(22),p=n(5),d=a(n(0)),c=null;function u(){return c||(c=new r.ec("secp256k1")),c}var l=function(){function e(e){var t=u().keyFromPrivate(i.arrayify(e));p.defineReadOnly(this,"privateKey",i.hexlify(t.priv.toArray("be",32))),p.defineReadOnly(this,"publicKey","0x"+t.getPublic(!1,"hex")),p.defineReadOnly(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),p.defineReadOnly(this,"publicKeyBytes",t.getPublic().encode(null,!0))}return e.prototype.sign=function(e){var t=u().keyFromPrivate(i.arrayify(this.privateKey)).sign(i.arrayify(e),{canonical:!0});return{recoveryParam:t.recoveryParam,r:i.hexZeroPad("0x"+t.r.toString(16),32),s:i.hexZeroPad("0x"+t.s.toString(16),32),v:27+t.recoveryParam}},e.prototype.computeSharedSecret=function(e){var t=u().keyFromPrivate(i.arrayify(this.privateKey)),n=u().keyFromPublic(i.arrayify(g(e)));return i.hexZeroPad("0x"+t.derive(n.getPublic()).toString(16),32)},e.prototype._addPoint=function(e){var t=u().keyFromPublic(i.arrayify(this.publicKey)),n=u().keyFromPublic(i.arrayify(e));return"0x"+t.pub.add(n.pub).encodeCompressed("hex")},e}();function g(e,t){var n=i.arrayify(e);if(32===n.length){var a=new l(n);return t?a.compressedPublicKey:a.publicKey}return 33===n.length?t?i.hexlify(n):"0x"+u().keyFromPublic(n).getPublic(!1,"hex"):65===n.length?t?"0x"+u().keyFromPublic(n).getPublic(!0,"hex"):i.hexlify(n):(d.throwError("invalid public or private key",d.INVALID_ARGUMENT,{arg:"key",value:"[REDACTED]"}),null)}function f(e){var t="0x"+g(e).slice(4);return A.getAddress("0x"+s.keccak256(t).substring(26))}function I(e,t){var n=i.splitSignature(t),a={r:i.arrayify(n.r),s:i.arrayify(n.s)};return"0x"+u().recoverPubKey(i.arrayify(e),a,n.recoveryParam).encode("hex",!1)}function h(e,t){return f(I(i.arrayify(e),t))}t.KeyPair=l,t.computePublicKey=g,t.computeAddress=f,t.recoverPublicKey=I,t.recoverAddress=h,t.verifyMessage=function(e,t){return h(o.hashMessage(e),t)}},function(e,t,n){function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r;function A(e){this.rand=e}if(e.exports=function(e){return r||(r=new A(null)),r.generate(e)},e.exports.Rand=A,A.prototype.generate=function(e){return this._rand(e)},A.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;n<t.length;n++)t[n]=this.rand.getByte();return t},"object"===("undefined"==typeof self?"undefined":a(self)))self.crypto&&self.crypto.getRandomValues?A.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?A.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"===("undefined"==typeof window?"undefined":a(window))&&(A.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var i=n(3);if("function"!=typeof i.randomBytes)throw new Error("Not supported");A.prototype._rand=function(e){return i.randomBytes(e)}}catch(e){}},function(e,t,n){"use strict";var a=n(2),r=n(13),A=r.getNAF,i=r.getJSF,o=r.assert;function s(e,t){this.type=e,this.p=new a(t.p,16),this.red=t.prime?a.red(t.prime):a.mont(this.p),this.zero=new a(0).toRed(this.red),this.one=new a(1).toRed(this.red),this.two=new a(2).toRed(this.red),this.n=t.n&&new a(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function p(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=s,s.prototype.point=function(){throw new Error("Not implemented")},s.prototype.validate=function(){throw new Error("Not implemented")},s.prototype._fixedNafMul=function(e,t){o(e.precomputed);var n=e._getDoubles(),a=A(t,1,this._bitLength),r=(1<<n.step+1)-(n.step%2==0?2:1);r/=3;for(var i=[],s=0;s<a.length;s+=n.step){var p=0;for(t=s+n.step-1;t>=s;t--)p=(p<<1)+a[t];i.push(p)}for(var d=this.jpoint(null,null,null),c=this.jpoint(null,null,null),u=r;u>0;u--){for(s=0;s<i.length;s++){(p=i[s])===u?c=c.mixedAdd(n.points[s]):p===-u&&(c=c.mixedAdd(n.points[s].neg()))}d=d.add(c)}return d.toP()},s.prototype._wnafMul=function(e,t){var n=4,a=e._getNAFPoints(n);n=a.wnd;for(var r=a.points,i=A(t,n,this._bitLength),s=this.jpoint(null,null,null),p=i.length-1;p>=0;p--){for(t=0;p>=0&&0===i[p];p--)t++;if(p>=0&&t++,s=s.dblp(t),p<0)break;var d=i[p];o(0!==d),s="affine"===e.type?d>0?s.mixedAdd(r[d-1>>1]):s.mixedAdd(r[-d-1>>1].neg()):d>0?s.add(r[d-1>>1]):s.add(r[-d-1>>1].neg())}return"affine"===e.type?s.toP():s},s.prototype._wnafMulAdd=function(e,t,n,a,r){for(var o=this._wnafT1,s=this._wnafT2,p=this._wnafT3,d=0,c=0;c<a;c++){var u=(v=t[c])._getNAFPoints(e);o[c]=u.wnd,s[c]=u.points}for(c=a-1;c>=1;c-=2){var l=c-1,g=c;if(1===o[l]&&1===o[g]){var f=[t[l],null,null,t[g]];0===t[l].y.cmp(t[g].y)?(f[1]=t[l].add(t[g]),f[2]=t[l].toJ().mixedAdd(t[g].neg())):0===t[l].y.cmp(t[g].y.redNeg())?(f[1]=t[l].toJ().mixedAdd(t[g]),f[2]=t[l].add(t[g].neg())):(f[1]=t[l].toJ().mixedAdd(t[g]),f[2]=t[l].toJ().mixedAdd(t[g].neg()));var I=[-3,-1,-5,-7,0,7,5,1,3],h=i(n[l],n[g]);d=Math.max(h[0].length,d),p[l]=new Array(d),p[g]=new Array(d);for(var y=0;y<d;y++){var m=0|h[0][y],C=0|h[1][y];p[l][y]=I[3*(m+1)+(C+1)],p[g][y]=0,s[l]=f}}else p[l]=A(n[l],o[l],this._bitLength),p[g]=A(n[g],o[g],this._bitLength),d=Math.max(p[l].length,d),d=Math.max(p[g].length,d)}var B=this.jpoint(null,null,null),E=this._wnafT4;for(c=d;c>=0;c--){for(var b=0;c>=0;){var Q=!0;for(y=0;y<a;y++)E[y]=0|p[y][c],0!==E[y]&&(Q=!1);if(!Q)break;b++,c--}if(c>=0&&b++,B=B.dblp(b),c<0)break;for(y=0;y<a;y++){var v,w=E[y];0!==w&&(w>0?v=s[y][w-1>>1]:w<0&&(v=s[y][-w-1>>1].neg()),B="affine"===v.type?B.mixedAdd(v):B.add(v))}}for(c=0;c<a;c++)s[c]=null;return r?B:B.toP()},s.BasePoint=p,p.prototype.eq=function(){throw new Error("Not implemented")},p.prototype.validate=function(){return this.curve.validate(this)},s.prototype.decodePoint=function(e,t){e=r.toArray(e,t);var n=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*n)return 6===e[0]?o(e[e.length-1]%2==0):7===e[0]&&o(e[e.length-1]%2==1),this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));if((2===e[0]||3===e[0])&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),3===e[0]);throw new Error("Unknown point format")},p.prototype.encodeCompressed=function(e){return this.encode(e,!0)},p.prototype._encode=function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))},p.prototype.encode=function(e,t){return r.encode(this._encode(t),e)},p.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},p.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},p.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],a=this,r=0;r<t;r+=e){for(var A=0;A<e;A++)a=a.dbl();n.push(a)}return{step:e,points:n}},p.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,a=1===n?null:this.dbl(),r=1;r<n;r++)t[r]=t[r-1].add(a);return{wnd:e,points:t}},p.prototype._getBeta=function(){return null},p.prototype.dblp=function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t}},function(e,t,n){"use strict";var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var r=n(31),A=a(n(0)),i=n(51),o=n(16),s=n(15),p=n(1),d=n(22),c=n(5),u=a(n(48)),l=n(40);function g(e){return"0x"===e?r.Zero:s.bigNumberify(e)}var f=[{name:"nonce",maxLength:32},{name:"gasPrice",maxLength:32},{name:"gasLimit",maxLength:32},{name:"to",length:20},{name:"value",maxLength:32},{name:"data"}],I={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0};t.serialize=function(e,t){c.checkProperties(e,I);var n=[];f.forEach((function(t){var a=e[t.name]||[];a=p.arrayify(p.hexlify(a)),t.length&&a.length!==t.length&&a.length>0&&A.throwError("invalid length for "+t.name,A.INVALID_ARGUMENT,{arg:"transaction"+t.name,value:a}),t.maxLength&&(a=p.stripZeros(a)).length>t.maxLength&&A.throwError("invalid length for "+t.name,A.INVALID_ARGUMENT,{arg:"transaction"+t.name,value:a}),n.push(p.hexlify(a))})),null!=e.chainId&&0!==e.chainId&&(n.push(p.hexlify(e.chainId)),n.push("0x"),n.push("0x"));var a=u.encode(n);if(!t)return a;var r=p.splitSignature(t),i=27+r.recoveryParam;return 9===n.length&&(n.pop(),n.pop(),n.pop(),i+=2*e.chainId+8),n.push(p.hexlify(i)),n.push(p.stripZeros(p.arrayify(r.r))),n.push(p.stripZeros(p.arrayify(r.s))),u.encode(n)},t.parse=function(e){var t=u.decode(e);9!==t.length&&6!==t.length&&A.throwError("invalid raw transaction",A.INVALID_ARGUMENT,{arg:"rawTransactin",value:e});var n,a={nonce:g(t[0]).toNumber(),gasPrice:g(t[1]),gasLimit:g(t[2]),to:(n=t[3],"0x"===n?null:o.getAddress(n)),value:g(t[4]),data:t[5],chainId:0};if(6===t.length)return a;try{a.v=s.bigNumberify(t[6]).toNumber()}catch(e){return A.info(e),a}if(a.r=p.hexZeroPad(t[7],32),a.s=p.hexZeroPad(t[8],32),s.bigNumberify(a.r).isZero()&&s.bigNumberify(a.s).isZero())a.chainId=a.v,a.v=0;else{a.chainId=Math.floor((a.v-35)/2),a.chainId<0&&(a.chainId=0);var r=a.v-27,c=t.slice(0,6);0!==a.chainId&&(c.push(p.hexlify(a.chainId)),c.push("0x"),c.push("0x"),r-=2*a.chainId+8);var l=d.keccak256(u.encode(c));try{a.from=i.recoverAddress(l,{r:p.hexlify(a.r),s:p.hexlify(a.s),recoveryParam:r})}catch(e){A.info(e)}a.hash=d.keccak256(e)}return a},t.populateTransaction=function(e,t,n){l.Provider.isProvider(t)||A.throwError("missing provider",A.INVALID_ARGUMENT,{argument:"provider",value:t}),c.checkProperties(e,I);var a=c.shallowCopy(e);if(null!=a.to&&(a.to=t.resolveName(a.to)),null==a.gasPrice&&(a.gasPrice=t.getGasPrice()),null==a.nonce&&(a.nonce=t.getTransactionCount(n)),null==a.gasLimit){var r=c.shallowCopy(a);r.from=n,a.gasLimit=t.estimateGas(r)}return null==a.chainId&&(a.chainId=t.getNetwork().then((function(e){return e.chainId}))),c.resolveProperties(a)}},function(e,t,n){"use strict";function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r,A=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var o=n(16),s=n(15),p=n(1),d=n(31),c=n(34),u=n(56),l=n(5),g=n(48),f=n(54),I=n(8),h=n(57),y=i(n(0)),m=n(40);function C(e,t){var n={};for(var a in e)try{var r=e[a](t[a]);void 0!==r&&(n[a]=r)}catch(e){throw e.checkKey=a,e.checkValue=t[a],e}return n}function B(e,t){return function(n){return null==n?t:e(n)}}function E(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");var n=[];return t.forEach((function(t){n.push(e(t))})),n}}function b(e,t){return"string"==typeof e&&(t||"0x"===e.substring(0,2)||(e="0x"+e),32===p.hexDataLength(e))?e.toLowerCase():(y.throwError("invalid hash",y.INVALID_ARGUMENT,{arg:"hash",value:e}),null)}function Q(e){return s.bigNumberify(e).toNumber()}function v(e){if(!p.isHexString(e))throw new Error("invalid uint256");for(;e.length<66;)e="0x0"+e.substring(2);return e}function w(e){if(null==e)return"latest";if("earliest"===e)return"0x0";if("latest"===e||"pending"===e)return e;if("number"==typeof e)return p.hexStripZeros(p.hexlify(e));if(p.isHexString(e))return p.hexStripZeros(e);throw new Error("invalid blockTag")}var D={hash:b,blockHash:B(b,null),blockNumber:B(Q,null),transactionIndex:B(Q,null),confirmations:B(Q,null),from:o.getAddress,gasPrice:s.bigNumberify,gasLimit:s.bigNumberify,to:B(o.getAddress,null),value:s.bigNumberify,nonce:Q,data:p.hexlify,r:B(v),s:B(v),v:B(Q),creates:B(o.getAddress,null),raw:B(p.hexlify)};function M(e){if(null!=e.gas&&null==e.gasLimit&&(e.gasLimit=e.gas),e.to&&s.bigNumberify(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),null!=e.input&&null==e.data&&(e.data=e.input),null==e.to&&null==e.creates&&(e.creates=o.getContractAddress(e)),!e.raw&&e.v&&e.r&&e.s){var t=[p.stripZeros(p.hexlify(e.nonce)),p.stripZeros(p.hexlify(e.gasPrice)),p.stripZeros(p.hexlify(e.gasLimit)),e.to||"0x",p.stripZeros(p.hexlify(e.value||"0x")),p.hexlify(e.data||"0x"),p.stripZeros(p.hexlify(e.v||"0x")),p.stripZeros(p.hexlify(e.r)),p.stripZeros(p.hexlify(e.s))];e.raw=g.encode(t)}var n=C(D,e),a=e.networkId;return null!=e.chainId&&null==a&&null==n.v&&(a=e.chainId),p.isHexString(a)&&(a=s.bigNumberify(a).toNumber()),"number"!=typeof a&&null!=n.v&&((a=(n.v-35)/2)<0&&(a=0),a=parseInt(a)),"number"!=typeof a&&(a=0),n.networkId=a,null==n.chainId&&null!=a&&(n.chainId=a),n.blockHash&&"x"===n.blockHash.replace(/0/g,"")&&(n.blockHash=null),n}var S={hash:b,parentHash:b,number:Q,timestamp:Q,nonce:B(p.hexlify),difficulty:function(e){var t=s.bigNumberify(e);try{return t.toNumber()}catch(e){}return null},gasLimit:s.bigNumberify,gasUsed:s.bigNumberify,miner:o.getAddress,extraData:p.hexlify,transactions:B(E(b))},k=l.shallowCopy(S);function x(e,t){return null!=e.author&&null==e.miner&&(e.miner=e.author),C(t?k:S,e)}k.transactions=B(E(M));var R={from:B(o.getAddress),nonce:B(Q),gasLimit:B(s.bigNumberify),gasPrice:B(s.bigNumberify),to:B(o.getAddress),value:B(s.bigNumberify),data:B(p.hexlify)};function N(e){return C(R,e)}var F={transactionLogIndex:B(Q),transactionIndex:Q,blockNumber:Q,transactionHash:b,address:o.getAddress,topics:E(b),data:p.hexlify,logIndex:Q,blockHash:b};var _={to:B(o.getAddress,null),from:B(o.getAddress,null),contractAddress:B(o.getAddress,null),transactionIndex:Q,root:B(b),gasUsed:s.bigNumberify,logsBloom:B(p.hexlify),blockHash:b,transactionHash:b,logs:E((function(e){return C(F,e)})),blockNumber:Q,confirmations:B(Q,null),cumulativeGasUsed:s.bigNumberify,status:B(Q)};function T(e){return Array.isArray(e)?e.forEach((function(e){T(e)})):null!=e&&b(e),e}var H={fromBlock:B(w,void 0),toBlock:B(w,void 0),address:B(o.getAddress,void 0),topics:B(T,void 0)},L={blockHash:B(b,void 0),address:B(o.getAddress,void 0),topics:B(T,void 0)};function G(e){return e&&e.blockHash?C(L,e):C(H,e)}var U={blockNumber:B(Q),blockHash:B(b),transactionIndex:Q,removed:B((function(e){if("boolean"==typeof e)return e;if("string"==typeof e){if("true"===e)return!0;if("false"===e)return!1}throw new Error("invaid boolean - "+e)})),address:o.getAddress,data:function(e,t){return function(n){return n?e(n):t}}(p.hexlify,"0x"),topics:E(b),transactionHash:b,logIndex:Q};function O(e){return C(U,e)}function P(e){return e.map((function(e){return"string"==typeof e?e:Array.isArray(e)?(e.forEach((function(e){null!==e&&32!==p.hexDataLength(e)&&y.throwError("invalid topic",y.INVALID_ARGUMENT,{argument:"topic",value:e})})),e.join(",")):null===e?"":y.throwError("invalid topic value",y.INVALID_ARGUMENT,{argument:"topic",value:e})})).join("&")}function Y(e){if("string"==typeof e){if(20===p.hexDataLength(e))return"address:"+o.getAddress(e);if(e=e.toLowerCase(),32===p.hexDataLength(e))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter::"+P(e);if(e&&"object"===a(e))return"filter:"+(e.address||"")+":"+P(e.topics||[])}throw new Error("invalid event - "+e)}function J(){return(new Date).getTime()}var j=function(e){function t(t){var n=e.call(this)||this;if(y.checkNew(n,m.Provider),t instanceof Promise)l.defineReadOnly(n,"ready",t.then((function(e){return l.defineReadOnly(n,"_network",e),e}))),n.ready.catch((function(e){}));else{var a=u.getNetwork(null==t?"homestead":t);a?(l.defineReadOnly(n,"_network",a),l.defineReadOnly(n,"ready",Promise.resolve(n._network))):y.throwError("invalid network",y.INVALID_ARGUMENT,{arg:"network",value:t})}return n._lastBlockNumber=-2,n._balances={},n._events=[],n._pollingInterval=4e3,n._emitted={block:-2},n._fastQueryDate=0,n}return A(t,e),t.prototype._doPoll=function(){var e=this;this.getBlockNumber().then((function(t){if(e.polling&&(e._setFastBlockNumber(t),t!==e._lastBlockNumber)){-2===e._emitted.block&&(e._emitted.block=t-1);for(var n=e._emitted.block+1;n<=t;n++)e.emit("block",n);e._emitted.block!==t&&(e._emitted.block=t,Object.keys(e._emitted).forEach((function(n){if("block"!==n){var a=e._emitted[n];"pending"!==a&&t-a>12&&delete e._emitted[n]}}))),-2===e._lastBlockNumber&&(e._lastBlockNumber=t-1);var a={},r={};return e._events.forEach((function(e){r[e.tag]=!0})),Object.keys(r).forEach((function(n){var r=n.split(":");switch(r[0]){case"tx":var A=r[1];e.getTransactionReceipt(A).then((function(t){return t&&null!=t.blockNumber?(e._emitted["t:"+A]=t.blockNumber,e.emit(A,t),null):null})).catch((function(t){e.emit("error",t)}));break;case"address":var i=r[1];e._balances[i]&&(a[i]=e._balances[i]),e.getBalance(i,"latest").then((function(t){var n=e._balances[i];if(!n||!t.eq(n))return e._balances[i]=t,e.emit(i,t),null})).catch((function(t){e.emit("error",t)}));break;case"filter":var o=r[2].split(/&/g).map((function(e){var t=e.split(",");return 1===t.length?""===t[0]?null:e:t.map((function(e){return""===e?null:e}))})),s={address:r[1],fromBlock:e._lastBlockNumber+1,toBlock:t,topics:o};s.address||delete s.address,e.getLogs(s).then((function(t){if(0!==t.length)return t.forEach((function(t){e._emitted["b:"+t.blockHash]=t.blockNumber,e._emitted["t:"+t.transactionHash]=t.blockNumber,e.emit(s,t)})),null})).catch((function(t){e.emit("error",t)}))}})),e._lastBlockNumber=t,e._balances=a,null}})).catch((function(e){})),this.doPoll()},t.prototype.resetEventsBlock=function(e){this._lastBlockNumber=e-1,this.polling&&this._doPoll()},Object.defineProperty(t.prototype,"network",{get:function(){return this._network},enumerable:!0,configurable:!0}),t.prototype.getNetwork=function(){return this.ready},Object.defineProperty(t.prototype,"blockNumber",{get:function(){return this._fastBlockNumber},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"polling",{get:function(){return null!=this._poller},set:function(e){var t=this;setTimeout((function(){e&&!t._poller?(t._poller=setInterval(t._doPoll.bind(t),t.pollingInterval),t._doPoll()):!e&&t._poller&&(clearInterval(t._poller),t._poller=null)}),0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pollingInterval",{get:function(){return this._pollingInterval},set:function(e){var t=this;if("number"!=typeof e||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval((function(){t._doPoll()}),this._pollingInterval))},enumerable:!0,configurable:!0}),t.prototype._getFastBlockNumber=function(){var e=this,t=J();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then((function(t){return(null==e._fastBlockNumber||t>e._fastBlockNumber)&&(e._fastBlockNumber=t),e._fastBlockNumber}))),this._fastBlockNumberPromise},t.prototype._setFastBlockNumber=function(e){null!=this._fastBlockNumber&&e<this._fastBlockNumber||(this._fastQueryDate=J(),(null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))},t.prototype.waitForTransaction=function(e,t){var n=this;return null==t&&(t=1),this.getTransactionReceipt(e).then((function(a){return 0===t||a&&a.confirmations>=t?a:new Promise((function(a){n.on(e,(function r(A){A.confirmations<t||(n.removeListener(e,r),a(A))}))}))}))},t.prototype.getBlockNumber=function(){var e=this;return this.ready.then((function(){return e.perform("getBlockNumber",{}).then((function(t){var n=parseInt(t);if(n!=t)throw new Error("invalid response - getBlockNumber");return e._setFastBlockNumber(n),n}))}))},t.prototype.getGasPrice=function(){var e=this;return this.ready.then((function(){return e.perform("getGasPrice",{}).then((function(e){return s.bigNumberify(e)}))}))},t.prototype.getBalance=function(e,t){var n=this;return this.ready.then((function(){return l.resolveProperties({addressOrName:e,blockTag:t}).then((function(e){var t=e.addressOrName,a=e.blockTag;return n._getAddress(t).then((function(e){var t={address:e,blockTag:w(a)};return n.perform("getBalance",t).then((function(e){return s.bigNumberify(e)}))}))}))}))},t.prototype.getTransactionCount=function(e,t){var n=this;return this.ready.then((function(){return l.resolveProperties({addressOrName:e,blockTag:t}).then((function(e){var t=e.addressOrName,a=e.blockTag;return n._getAddress(t).then((function(e){var t={address:e,blockTag:w(a)};return n.perform("getTransactionCount",t).then((function(e){return s.bigNumberify(e).toNumber()}))}))}))}))},t.prototype.getCode=function(e,t){var n=this;return this.ready.then((function(){return l.resolveProperties({addressOrName:e,blockTag:t}).then((function(e){var t=e.addressOrName,a=e.blockTag;return n._getAddress(t).then((function(e){var t={address:e,blockTag:w(a)};return n.perform("getCode",t).then((function(e){return p.hexlify(e)}))}))}))}))},t.prototype.getStorageAt=function(e,t,n){var a=this;return this.ready.then((function(){return l.resolveProperties({addressOrName:e,position:t,blockTag:n}).then((function(e){var t=e.addressOrName,n=e.position,r=e.blockTag;return a._getAddress(t).then((function(e){var t={address:e,blockTag:w(r),position:p.hexStripZeros(p.hexlify(n))};return a.perform("getStorageAt",t).then((function(e){return p.hexlify(e)}))}))}))}))},t.prototype.sendTransaction=function(e){var t=this;return this.ready.then((function(){return l.resolveProperties({signedTransaction:e}).then((function(e){var n=e.signedTransaction,a={signedTransaction:p.hexlify(n)};return t.perform("sendTransaction",a).then((function(e){return t._wrapTransaction(f.parse(n),e)}),(function(e){throw e.transaction=f.parse(n),e.transaction.hash&&(e.transactionHash=e.transaction.hash),e}))}))}))},t.prototype._wrapTransaction=function(e,t){var n=this;if(null!=t&&32!==p.hexDataLength(t))throw new Error("invalid response - sendTransaction");var a=e;return null!=t&&e.hash!==t&&y.throwError("Transaction hash mismatch from Provider.sendTransaction.",y.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),a.wait=function(t){return 0!==t&&(n._emitted["t:"+e.hash]="pending"),n.waitForTransaction(e.hash,t).then((function(a){return null==a&&0===t?null:(n._emitted["t:"+e.hash]=a.blockNumber,0===a.status&&y.throwError("transaction failed",y.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e}),a)}))},a},t.prototype.call=function(e,t){var n=this,a=l.shallowCopy(e);return this.ready.then((function(){return l.resolveProperties({blockTag:t,tx:a}).then((function(e){var t=e.blockTag,a=e.tx;return n._resolveNames(a,["to","from"]).then((function(e){var a={blockTag:w(t),transaction:N(e)};return n.perform("call",a).then((function(e){return p.hexlify(e)}))}))}))}))},t.prototype.estimateGas=function(e){var t=this,n={to:e.to,from:e.from,data:e.data,gasPrice:e.gasPrice,value:e.value};return this.ready.then((function(){return l.resolveProperties(n).then((function(e){return t._resolveNames(e,["to","from"]).then((function(e){var n={transaction:N(e)};return t.perform("estimateGas",n).then((function(e){return s.bigNumberify(e)}))}))}))}))},t.prototype.getBlock=function(e,t){var n=this;return this.ready.then((function(){return l.resolveProperties({blockHashOrBlockTag:e}).then((function(e){var a=e.blockHashOrBlockTag;try{var r=p.hexlify(a);if(32===p.hexDataLength(r))return h.poll((function(){return n.perform("getBlock",{blockHash:r,includeTransactions:!!t}).then((function(e){return null==e?null==n._emitted["b:"+r]?null:void 0:x(e,t)}))}),{onceBlock:n})}catch(e){}try{var A=-128,i=w(a);return p.isHexString(i)&&(A=parseInt(i.substring(2),16)),h.poll((function(){return n.perform("getBlock",{blockTag:i,includeTransactions:!!t}).then((function(e){if(null==e){if(A<=n._emitted.block)return;return null}return x(e,t)}))}),{onceBlock:n})}catch(e){}throw new Error("invalid block hash or block tag")}))}))},t.prototype.getTransaction=function(e){var n=this;return this.ready.then((function(){return l.resolveProperties({transactionHash:e}).then((function(e){var a=e.transactionHash,r={transactionHash:b(a,!0)};return h.poll((function(){return n.perform("getTransaction",r).then((function(e){if(null==e)return null==n._emitted["t:"+a]?null:void 0;var r=t.checkTransactionResponse(e);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations)return n._getFastBlockNumber().then((function(e){var t=e-r.blockNumber+1;return t<=0&&(t=1),r.confirmations=t,n._wrapTransaction(r)}));return n._wrapTransaction(r)}))}),{onceBlock:n})}))}))},t.prototype.getTransactionReceipt=function(e){var t=this;return this.ready.then((function(){return l.resolveProperties({transactionHash:e}).then((function(e){var n=e.transactionHash,a={transactionHash:b(n,!0)};return h.poll((function(){return t.perform("getTransactionReceipt",a).then((function(e){if(null==e)return null==t._emitted["t:"+n]?null:void 0;if(null!=e.blockHash){var a=function(e){var t=C(_,e);return t.logs.forEach((function(e,t){null==e.transactionLogIndex&&(e.transactionLogIndex=t)})),null!=e.status&&(t.byzantium=!0),t}(e);if(null==a.blockNumber)a.confirmations=0;else if(null==a.confirmations)return t._getFastBlockNumber().then((function(e){var t=e-a.blockNumber+1;return t<=0&&(t=1),a.confirmations=t,a}));return a}}))}),{onceBlock:t})}))}))},t.prototype.getLogs=function(e){var t=this;return this.ready.then((function(){return l.resolveProperties(e).then((function(e){return t._resolveNames(e,["address"]).then((function(e){var n={filter:G(e)};return t.perform("getLogs",n).then((function(e){return E(O)(e)}))}))}))}))},t.prototype.getEtherPrice=function(){var e=this;return this.ready.then((function(){return e.perform("getEtherPrice",{}).then((function(e){return e}))}))},t.prototype._getAddress=function(e){return this.resolveName(e).then((function(t){return null==t&&y.throwError("ENS name not configured",y.UNSUPPORTED_OPERATION,{operation:"resolveName("+JSON.stringify(e)+")"}),t}))},t.prototype._resolveNames=function(e,t){var n=[],a=l.shallowCopy(e);return t.forEach((function(e){null!=a[e]&&n.push(this._getAddress(a[e]).then((function(t){a[e]=t})))}),this),Promise.all(n).then((function(){return a}))},t.prototype._getResolver=function(e){var t=this;return this.getNetwork().then((function(n){n.ensAddress||y.throwError("network does not support ENS",y.UNSUPPORTED_OPERATION,{operation:"ENS",network:n.name});var a="0x0178b8bf"+c.namehash(e).substring(2),r={to:n.ensAddress,data:a};return t.call(r).then((function(e){if(32!==p.hexDataLength(e))return null;var t=o.getAddress(p.hexDataSlice(e,12));return t===d.AddressZero?null:t}))}))},t.prototype.resolveName=function(e){var t=this;if(e instanceof Promise)return e.then((function(e){return t.resolveName(e)}));try{return Promise.resolve(o.getAddress(e))}catch(t){if(p.isHexString(e))throw t}var n=this,a=c.namehash(e);return this._getResolver(e).then((function(e){if(null==e)return null;var t={to:e,data:"0x3b3b57de"+a.substring(2)};return n.call(t)})).then((function(e){if(32!==p.hexDataLength(e))return null;var t=o.getAddress(p.hexDataSlice(e,12));return t===d.AddressZero?null:t}))},t.prototype.lookupAddress=function(e){var t=this;if(e instanceof Promise)return e.then((function(e){return t.lookupAddress(e)}));var n=(e=o.getAddress(e)).substring(2)+".addr.reverse",a=c.namehash(n),r=this;return this._getResolver(n).then((function(e){if(!e)return null;var t={to:e,data:"0x691f3431"+a.substring(2)};return r.call(t)})).then((function(t){if(null==t)return null;if((t=t.substring(2)).length<64)return null;if((t=t.substring(64)).length<64)return null;var n=s.bigNumberify("0x"+t.substring(0,64)).toNumber();if(2*n>(t=t.substring(64)).length)return null;var a=I.toUtf8String("0x"+t.substring(0,2*n));return r.resolveName(a).then((function(t){return t!=e?null:a}))}))},t.checkTransactionResponse=function(e){return M(e)},t.prototype.doPoll=function(){},t.prototype.perform=function(e,t){return y.throwError(e+" not implemented",y.NOT_IMPLEMENTED,{operation:e}),null},t.prototype._startPending=function(){y.warn("WARNING: this provider does not support pending events")},t.prototype._stopPending=function(){},t.prototype._addEventListener=function(e,t,n){this._events.push({tag:Y(e),listener:t,once:n}),"pending"===e&&this._startPending(),this.polling=!0},t.prototype.on=function(e,t){return this._addEventListener(e,t,!1),this},t.prototype.once=function(e,t){return this._addEventListener(e,t,!0),this},t.prototype.addEventListener=function(e,t){return this.on(e,t)},t.prototype.emit=function(e){for(var t=this,n=[],a=1;a<arguments.length;a++)n[a-1]=arguments[a];var r=!1,A=Y(e);return this._events=this._events.filter((function(e){return e.tag!==A||(setTimeout((function(){e.listener.apply(t,n)}),0),r=!0,!e.once)})),0===this.listenerCount()&&(this.polling=!1),r},t.prototype.listenerCount=function(e){if(!e)return this._events.length;var t=Y(e);return this._events.filter((function(e){return e.tag===t})).length},t.prototype.listeners=function(e){var t=Y(e);return this._events.filter((function(e){return e.tag===t})).map((function(e){return e.listener}))},t.prototype.removeAllListeners=function(e){if(null==e)this._events=[],this._stopPending();else{var t=Y(e);this._events=this._events.filter((function(e){return e.tag!==t})),"pending"===e&&this._stopPending()}return 0===this._events.length&&(this.polling=!1),this},t.prototype.removeListener=function(e,t){var n=!1,a=Y(e);return this._events=this._events.filter((function(e){return e.tag!==a||e.listener!=t||(!!n||(n=!0,!1))})),"pending"===e&&0===this.listenerCount("pending")&&this._stopPending(),0===this.listenerCount()&&(this.polling=!1),this},t}(m.Provider);t.BaseProvider=j,l.defineReadOnly(m.Provider,"inherits",l.inheritable(m.Provider))},function(e,t,n){"use strict";var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(0));function A(e){return function(t){var n=[];return t.InfuraProvider&&n.push(new t.InfuraProvider(e)),t.EtherscanProvider&&n.push(new t.EtherscanProvider(e)),0===n.length?null:t.FallbackProvider?new t.FallbackProvider(n):n[0]}}function i(e,t){return function(n){return n.JsonRpcProvider?new n.JsonRpcProvider(e,t):null}}var o={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:A("homestead")},s={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:A("ropsten")},p={unspecified:{chainId:0,name:"unspecified"},homestead:o,mainnet:o,morden:{chainId:2,name:"morden"},ropsten:s,testnet:s,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:A("rinkeby")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:A("goerli")},kovan:{chainId:42,name:"kovan",_defaultProvider:A("kovan")},classic:{chainId:61,name:"classic",_defaultProvider:i("https://web3.gastracker.io","classic")},classicTestnet:{chainId:62,name:"classicTestnet",_defaultProvider:i("https://web3.gastracker.io/morden","classicTestnet")}};t.getNetwork=function(e){if(null==e)return null;if("number"==typeof e){for(var t in p){var n=p[t];if(n.chainId===e)return{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress||null,_defaultProvider:n._defaultProvider||null}}return{chainId:e,name:"unknown"}}if("string"==typeof e){var a=p[e];return null==a?null:{name:a.name,chainId:a.chainId,ensAddress:a.ensAddress,_defaultProvider:a._defaultProvider||null}}var A=p[e.name];return A?(0!==e.chainId&&e.chainId!==A.chainId&&r.throwError("network chainId mismatch",r.INVALID_ARGUMENT,{arg:"network",value:e}),{name:e.name,chainId:A.chainId,ensAddress:e.ensAddress||A.ensAddress||null,_defaultProvider:e._defaultProvider||A._defaultProvider||null}):("number"!=typeof e.chainId&&r.throwError("invalid network chainId",r.INVALID_ARGUMENT,{arg:"network",value:e}),e)}},function(e,t,n){"use strict";function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var A=n(198),i=n(112),o=n(5),s=n(8),p=r(n(0));t.fetchJson=function(e,t,n){var r={},o=null,d=12e4;if("string"==typeof e)o=e;else if("object"===a(e)){if(null==e.url&&p.throwError("missing URL",p.MISSING_ARGUMENT,{arg:"url"}),o=e.url,"number"==typeof e.timeout&&e.timeout>0&&(d=e.timeout),e.headers)for(var c in e.headers)r[c.toLowerCase()]={key:c,value:String(e.headers[c])};if(null!=e.user&&null!=e.password){"https:"!==o.substring(0,6)&&!0!==e.allowInsecure&&p.throwError("basic authentication requires a secure https url",p.INVALID_ARGUMENT,{arg:"url",url:o,user:e.user,password:"[REDACTED]"});var u=e.user+":"+e.password;r.authorization={key:"Authorization",value:"Basic "+i.encode(s.toUtf8Bytes(u))}}}return new Promise((function(e,a){var i=new A.XMLHttpRequest,s=null;s=setTimeout((function(){null!=s&&(s=null,a(new Error("timeout")),setTimeout((function(){i.abort()}),0))}),d);var p=function(){null!=s&&(clearTimeout(s),s=null)};t?(i.open("POST",o,!0),r["content-type"]={key:"Content-Type",value:"application/json"}):i.open("GET",o,!0),Object.keys(r).forEach((function(e){var t=r[e];i.setRequestHeader(t.key,t.value)})),i.onreadystatechange=function(){if(4===i.readyState){if(200!=i.status){p();var r=new Error("invalid response - "+i.status);return r.statusCode=i.status,i.responseText&&(r.responseText=i.responseText),void a(r)}var A=null;try{A=JSON.parse(i.responseText)}catch(r){p();var s=new Error("invalid json response");return s.orginialError=r,s.responseText=i.responseText,null!=t&&(s.requestBody=t),s.url=o,void a(s)}if(n)try{A=n(A)}catch(r){return p(),r.url=o,r.body=t,r.responseText=i.responseText,void a(r)}p(),e(A)}},i.onerror=function(e){p(),a(e)};try{null!=t?i.send(t):i.send()}catch(e){p();var c=new Error("connection error");c.error=e,a(c)}}))},t.poll=function(e,t){return t||(t={}),null==(t=o.shallowCopy(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise((function(n,a){var r=null,A=!1,i=function(){return!A&&(A=!0,r&&clearTimeout(r),!0)};t.timeout&&(r=setTimeout((function(){i()&&a(new Error("timeout"))}),t.timeout));var o=t.fastRetry||null,s=0;!function r(){return e().then((function(e){if(void 0!==e)i()&&n(e);else if(t.onceBlock)t.onceBlock.once("block",r);else if(!A){s++;var a=t.interval*parseInt(String(Math.random()*Math.pow(2,s)));a<t.floor&&(a=t.floor),a>t.ceiling&&(a=t.ceiling),o&&(s--,a=o,o=null),setTimeout(r,a)}return null}),(function(e){i()&&a(e)}))}()}))}},function(e,t,n){"use strict";var a,r=this&&this.__extends||(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),A=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var i=n(55),o=n(49),s=A(n(0)),p=n(16),d=n(1),c=n(56),u=n(5),l=n(8),g=n(57);function f(e){if(e.error){var t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function I(e){return e?e.toLowerCase():e}var h={},y=42,m=function(e){function t(n,a,r){var A=e.call(this)||this;if(s.checkNew(A,t),n!==h)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");return u.defineReadOnly(A,"provider",a),r?"string"==typeof r?u.defineReadOnly(A,"_address",p.getAddress(r)):"number"==typeof r?u.defineReadOnly(A,"_index",r):s.throwError("invalid address or index",s.INVALID_ARGUMENT,{argument:"addressOrIndex",value:r}):u.defineReadOnly(A,"_index",0),A}return r(t,e),t.prototype.getAddress=function(){var e=this;return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((function(t){return t.length<=e._index&&s.throwError("unknown account #"+e._index,s.UNSUPPORTED_OPERATION,{operation:"getAddress"}),e._address=p.getAddress(t[e._index]),e._address}))},t.prototype.getBalance=function(e){return this.provider.getBalance(this.getAddress(),e)},t.prototype.getTransactionCount=function(e){return this.provider.getTransactionCount(this.getAddress(),e)},t.prototype.sendUncheckedTransaction=function(e){var t=this;e=u.shallowCopy(e);var n=this.getAddress().then((function(e){return e&&(e=e.toLowerCase()),e}));if(null==e.gasLimit){var a=u.shallowCopy(e);a.from=n,e.gasLimit=this.provider.estimateGas(a)}return Promise.all([u.resolveProperties(e),n]).then((function(e){var n=e[0],a=B.hexlifyTransaction(n);return a.from=e[1],t.provider.send("eth_sendTransaction",[a]).then((function(e){return e}),(function(e){throw e.responseText&&(e.responseText.indexOf("insufficient funds")>=0&&s.throwError("insufficient funds",s.INSUFFICIENT_FUNDS,{transaction:n}),e.responseText.indexOf("nonce too low")>=0&&s.throwError("nonce has already been used",s.NONCE_EXPIRED,{transaction:n}),e.responseText.indexOf("replacement transaction underpriced")>=0&&s.throwError("replacement fee too low",s.REPLACEMENT_UNDERPRICED,{transaction:n})),e}))}))},t.prototype.sendTransaction=function(e){var t=this;return this.sendUncheckedTransaction(e).then((function(e){return g.poll((function(){return t.provider.getTransaction(e).then((function(n){if(null!==n)return t.provider._wrapTransaction(n,e)}))}),{fastRetry:250,onceBlock:t.provider}).catch((function(t){throw t.transactionHash=e,t}))}))},t.prototype.signMessage=function(e){var t=this,n="string"==typeof e?l.toUtf8Bytes(e):e;return this.getAddress().then((function(e){return t.provider.send("eth_sign",[e.toLowerCase(),d.hexlify(n)])}))},t.prototype.unlock=function(e){var t=this.provider;return this.getAddress().then((function(n){return t.send("personal_unlockAccount",[n.toLowerCase(),e,null])}))},t}(o.Signer);t.JsonRpcSigner=m;var C={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0},B=function(e){function t(n,a){var r=this;if("string"==typeof n&&null===a&&c.getNetwork(n)&&(a=n,n=null),a)r=e.call(this,a)||this;else{var A=new Promise((function(e,t){setTimeout((function(){r.send("net_version",[]).then((function(t){return e(c.getNetwork(parseInt(t)))})).catch((function(e){t(e)}))}))}));r=e.call(this,A)||this}return s.checkNew(r,t),n||(n="http://localhost:8545"),r.connection="string"==typeof n?{url:n}:n,r}return r(t,e),t.prototype.getSigner=function(e){return new m(h,this,e)},t.prototype.listAccounts=function(){return this.send("eth_accounts",[]).then((function(e){return e.map((function(e){return p.getAddress(e)}))}))},t.prototype.send=function(e,t){var n=this,a={method:e,params:t,id:y++,jsonrpc:"2.0"};return g.fetchJson(this.connection,JSON.stringify(a),f).then((function(e){return n.emit("debug",{action:"send",request:a,response:e,provider:n}),e}))},t.prototype.perform=function(e,n){switch(e){case"getBlockNumber":return this.send("eth_blockNumber",[]);case"getGasPrice":return this.send("eth_gasPrice",[]);case"getBalance":return this.send("eth_getBalance",[I(n.address),n.blockTag]);case"getTransactionCount":return this.send("eth_getTransactionCount",[I(n.address),n.blockTag]);case"getCode":return this.send("eth_getCode",[I(n.address),n.blockTag]);case"getStorageAt":return this.send("eth_getStorageAt",[I(n.address),n.position,n.blockTag]);case"sendTransaction":return this.send("eth_sendRawTransaction",[n.signedTransaction]).catch((function(e){throw e.responseText&&(e.responseText.indexOf("insufficient funds")>0&&s.throwError("insufficient funds",s.INSUFFICIENT_FUNDS,{}),e.responseText.indexOf("nonce too low")>0&&s.throwError("nonce has already been used",s.NONCE_EXPIRED,{}),e.responseText.indexOf("replacement transaction underpriced")>0&&s.throwError("replacement fee too low",s.REPLACEMENT_UNDERPRICED,{})),e}));case"getBlock":return n.blockTag?this.send("eth_getBlockByNumber",[n.blockTag,!!n.includeTransactions]):n.blockHash?this.send("eth_getBlockByHash",[n.blockHash,!!n.includeTransactions]):Promise.reject(new Error("invalid block tag or block hash"));case"getTransaction":return this.send("eth_getTransactionByHash",[n.transactionHash]);case"getTransactionReceipt":return this.send("eth_getTransactionReceipt",[n.transactionHash]);case"call":return this.send("eth_call",[t.hexlifyTransaction(n.transaction,{from:!0}),n.blockTag]);case"estimateGas":return this.send("eth_estimateGas",[t.hexlifyTransaction(n.transaction,{from:!0})]);case"getLogs":return n.filter&&null!=n.filter.address&&(n.filter.address=I(n.filter.address)),this.send("eth_getLogs",[n.filter])}return s.throwError(e+" not implemented",s.NOT_IMPLEMENTED,{operation:e}),null},t.prototype._startPending=function(){if(null==this._pendingFilter){var e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then((function(n){return function a(){e.send("eth_getFilterChanges",[n]).then((function(n){if(e._pendingFilter!=t)return null;var a=Promise.resolve();return n.forEach((function(t){e._emitted["t:"+t.toLowerCase()]="pending",a=a.then((function(){return e.getTransaction(t).then((function(t){return e.emit("pending",t),null}))}))})),a.then((function(){return e=1e3,new Promise((function(t){setTimeout((function(){t()}),e)}));var e}))})).then((function(){if(e._pendingFilter==t)return setTimeout((function(){a()}),0),null;e.send("eth_uninstallFilter",[n])})).catch((function(e){}))}(),n})).catch((function(e){}))}},t.prototype._stopPending=function(){this._pendingFilter=null},t.hexlifyTransaction=function(e,t){var n=u.shallowCopy(C);if(t)for(var a in t)t[a]&&(n[a]=!0);u.checkProperties(e,n);var r={};return["gasLimit","gasPrice","nonce","value"].forEach((function(t){if(null!=e[t]){var n=d.hexStripZeros(d.hexlify(e[t]));"gasLimit"===t&&(t="gas"),r[t]=n}})),["from","to","data"].forEach((function(t){null!=e[t]&&(r[t]=d.hexlify(e[t]))})),r},t}(i.BaseProvider);t.JsonRpcProvider=B},function(e,t,n){var a=n(259),r=n(260),A=n(261),i=n(262),o=n(263);function s(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var a=e[t];this.set(a[0],a[1])}}s.prototype.clear=a,s.prototype.delete=r,s.prototype.get=A,s.prototype.has=i,s.prototype.set=o,e.exports=s},function(e,t,n){var a=n(61);e.exports=function(e,t){for(var n=e.length;n--;)if(a(e[n][0],t))return n;return-1}},function(e,t){e.exports=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,n){var a=n(119),r=n(270),A=n(271),i=a?a.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?r(e):A(e)}},function(e,t,n){var a=n(81)(Object,"create");e.exports=a},function(e,t,n){var a=n(285);e.exports=function(e,t){var n=e.__data__;return a(t)?n["string"==typeof t?"string":"hash"]:n.map}},function(e,t,n){e.exports=n(3).randomBytes},function(e,t,n){e.exports=n(3).createHash},function(e,t,n){"use strict";var a=n(2),r=n(14),A=r.getNAF,i=r.getJSF,o=r.assert;function s(e,t){this.type=e,this.p=new a(t.p,16),this.red=t.prime?a.red(t.prime):a.mont(this.p),this.zero=new a(0).toRed(this.red),this.one=new a(1).toRed(this.red),this.two=new a(2).toRed(this.red),this.n=t.n&&new a(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function p(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=s,s.prototype.point=function(){throw new Error("Not implemented")},s.prototype.validate=function(){throw new Error("Not implemented")},s.prototype._fixedNafMul=function(e,t){o(e.precomputed);var n=e._getDoubles(),a=A(t,1,this._bitLength),r=(1<<n.step+1)-(n.step%2==0?2:1);r/=3;var i,s,p=[];for(i=0;i<a.length;i+=n.step){s=0;for(var d=i+n.step-1;d>=i;d--)s=(s<<1)+a[d];p.push(s)}for(var c=this.jpoint(null,null,null),u=this.jpoint(null,null,null),l=r;l>0;l--){for(i=0;i<p.length;i++)(s=p[i])===l?u=u.mixedAdd(n.points[i]):s===-l&&(u=u.mixedAdd(n.points[i].neg()));c=c.add(u)}return c.toP()},s.prototype._wnafMul=function(e,t){var n=4,a=e._getNAFPoints(n);n=a.wnd;for(var r=a.points,i=A(t,n,this._bitLength),s=this.jpoint(null,null,null),p=i.length-1;p>=0;p--){for(var d=0;p>=0&&0===i[p];p--)d++;if(p>=0&&d++,s=s.dblp(d),p<0)break;var c=i[p];o(0!==c),s="affine"===e.type?c>0?s.mixedAdd(r[c-1>>1]):s.mixedAdd(r[-c-1>>1].neg()):c>0?s.add(r[c-1>>1]):s.add(r[-c-1>>1].neg())}return"affine"===e.type?s.toP():s},s.prototype._wnafMulAdd=function(e,t,n,a,r){var o,s,p,d=this._wnafT1,c=this._wnafT2,u=this._wnafT3,l=0;for(o=0;o<a;o++){var g=(p=t[o])._getNAFPoints(e);d[o]=g.wnd,c[o]=g.points}for(o=a-1;o>=1;o-=2){var f=o-1,I=o;if(1===d[f]&&1===d[I]){var h=[t[f],null,null,t[I]];0===t[f].y.cmp(t[I].y)?(h[1]=t[f].add(t[I]),h[2]=t[f].toJ().mixedAdd(t[I].neg())):0===t[f].y.cmp(t[I].y.redNeg())?(h[1]=t[f].toJ().mixedAdd(t[I]),h[2]=t[f].add(t[I].neg())):(h[1]=t[f].toJ().mixedAdd(t[I]),h[2]=t[f].toJ().mixedAdd(t[I].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],m=i(n[f],n[I]);for(l=Math.max(m[0].length,l),u[f]=new Array(l),u[I]=new Array(l),s=0;s<l;s++){var C=0|m[0][s],B=0|m[1][s];u[f][s]=y[3*(C+1)+(B+1)],u[I][s]=0,c[f]=h}}else u[f]=A(n[f],d[f],this._bitLength),u[I]=A(n[I],d[I],this._bitLength),l=Math.max(u[f].length,l),l=Math.max(u[I].length,l)}var E=this.jpoint(null,null,null),b=this._wnafT4;for(o=l;o>=0;o--){for(var Q=0;o>=0;){var v=!0;for(s=0;s<a;s++)b[s]=0|u[s][o],0!==b[s]&&(v=!1);if(!v)break;Q++,o--}if(o>=0&&Q++,E=E.dblp(Q),o<0)break;for(s=0;s<a;s++){var w=b[s];0!==w&&(w>0?p=c[s][w-1>>1]:w<0&&(p=c[s][-w-1>>1].neg()),E="affine"===p.type?E.mixedAdd(p):E.add(p))}}for(o=0;o<a;o++)c[o]=null;return r?E:E.toP()},s.BasePoint=p,p.prototype.eq=function(){throw new Error("Not implemented")},p.prototype.validate=function(){return this.curve.validate(this)},s.prototype.decodePoint=function(e,t){e=r.toArray(e,t);var n=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*n)return 6===e[0]?o(e[e.length-1]%2==0):7===e[0]&&o(e[e.length-1]%2==1),this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));if((2===e[0]||3===e[0])&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),3===e[0]);throw new Error("Unknown point format")},p.prototype.encodeCompressed=function(e){return this.encode(e,!0)},p.prototype._encode=function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))},p.prototype.encode=function(e,t){return r.encode(this._encode(t),e)},p.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},p.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},p.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],a=this,r=0;r<t;r+=e){for(var A=0;A<e;A++)a=a.dbl();n.push(a)}return{step:e,points:n}},p.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,a=1===n?null:this.dbl(),r=1;r<n;r++)t[r]=t[r-1].add(a);return{wnd:e,points:t}},p.prototype._getBeta=function(){return null},p.prototype.dblp=function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t}},function(e,t){e.exports=require("http")},function(e,t,n){"use strict";
2
2
  /*!
3
3
  * The buffer module from node.js, for the browser.
4
4
  *