diff --git a/app/app/urls.py b/app/app/urls.py index e1f859f6c09..477fe02d490 100644 --- a/app/app/urls.py +++ b/app/app/urls.py @@ -71,6 +71,7 @@ url('^api/v1/bounty/fulfill', dashboard.views.fulfill_bounty_v1, name='fulfill_bounty_v1'), path('api/v1/bounty//close', dashboard.views.close_bounty_v1, name='close_bounty_v1'), path('api/v1/bounty/payout/', dashboard.views.payout_bounty_v1, name='payout_bounty_v1'), + path('api/v1/reverse-proxy/', dashboard.views.reverse_proxy_rpc_v1, name='payout_tx_forwarder_v1'), re_path(r'.*api/v0.1/video/presence$', townsquare.views.video_presence, name='video_presence'), # inbox diff --git a/app/assets/v2/images/chains/casper.svg b/app/assets/v2/images/chains/casper.svg new file mode 100644 index 00000000000..2b7301558a4 --- /dev/null +++ b/app/assets/v2/images/chains/casper.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/assets/v2/js/lib/casper/casper_js_sdk.js b/app/assets/v2/js/lib/casper/casper_js_sdk.js new file mode 100644 index 00000000000..fc647d386c6 --- /dev/null +++ b/app/assets/v2/js/lib/casper/casper_js_sdk.js @@ -0,0 +1 @@ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).casper=e()}}(function(){return function(){return function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var c=r[a]={exports:{}};t[a][0].call(c.exports,function(e){return i(t[a][1][e]||e)},c,c.exports,e,t,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a0&&(10===arguments[0]?c||(c=!0,u.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?u.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",a.Logger.errors.UNEXPECTED_ARGUMENT,{}):u.throwError("BigNumber.toString does not accept parameters",a.Logger.errors.UNEXPECTED_ARGUMENT,{})),p(this).toString(10)},e.prototype.toHexString=function(){return this._hex},e.prototype.toJSON=function(e){return{type:"BigNumber",hex:this.toHexString()}},e.from=function(t){if(t instanceof e)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new e(f,l(t)):t.match(/^-?[0-9]+$/)?new e(f,l(new i(t))):u.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&y("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&y("overflow","BigNumber.from",t),e.from(String(t));var r,n=t;if("bigint"==typeof n)return e.from(n.toString());if(o.isBytes(n))return e.from(o.hexlify(n));if(n)if(n.toHexString){if("string"==typeof(r=n.toHexString()))return e.from(r)}else if(null==(r=n._hex)&&"BigNumber"===n.type&&(r=n.hex),"string"==typeof r&&(o.isHexString(r)||"-"===r[0]&&o.isHexString(r.substring(1))))return e.from(r);return u.throwArgumentError("invalid BigNumber value","value",t)},e.isBigNumber=function(e){return!(!e||!e._isBigNumber)},e}();function l(e){if("string"!=typeof e)return l(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&u.throwArgumentError("invalid hex","value",e),"0x00"===(e=l(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function d(e){return h.from(l(e))}function p(e){var t=h.from(e).toHexString();return"-"===t[0]?new i("-"+t.substring(3),16):new i(t.substring(2),16)}function y(e,t,r){var n={fault:e,operation:t};return null!=r&&(n.value=r),u.throwError(e,a.Logger.errors.NUMERIC_FAULT,n)}r.BigNumber=h,r._base36To16=function(e){return new i(e,36).toString(16)},r._base16To36=function(e){return new i(e,16).toString(36)}},{"./_version":1,"@ethersproject/bytes":6,"@ethersproject/logger":13,"bn.js":45}],3:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.FixedNumber=r.FixedFormat=r.parseFixed=r.formatFixed=void 0;var n=e("@ethersproject/bytes"),i=e("@ethersproject/logger"),o=e("./_version"),a=new i.Logger(o.version),s=e("./bignumber"),u={},f=s.BigNumber.from(0),c=s.BigNumber.from(-1);function h(e,t,r,n){var o={fault:t,operation:r};return void 0!==n&&(o.value=n),a.throwError(e,i.Logger.errors.NUMERIC_FAULT,o)}for(var l="0";l.length<256;)l+=l;function d(e){if("number"!=typeof e)try{e=s.BigNumber.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+l.substring(0,e):a.throwArgumentError("invalid decimal size","decimals",e)}function p(e,t){null==t&&(t=0);var r=d(t),n=(e=s.BigNumber.from(e)).lt(f);n&&(e=e.mul(c));for(var i=e.mod(r).toString();i.length2&&a.throwArgumentError("too many decimal points","value",e);var o=i[0],u=i[1];for(o||(o="0"),u||(u="0"),u.length>r.length-1&&h("fractional component exceeds decimals","underflow","parseFixed");u.length80&&a.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new e(u,r,n,i)},e}();r.FixedFormat=b;var m=function(){function e(t,r,n,o){var s=this.constructor;a.checkNew(s,e),t!==u&&a.throwError("cannot use FixedNumber constructor; use FixedNumber.from",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=o,this._hex=r,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}return e.prototype._checkFormat=function(e){this.format.name!==e.format.name&&a.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)},e.prototype.addUnsafe=function(t){this._checkFormat(t);var r=y(this._value,this.format.decimals),n=y(t._value,t.format.decimals);return e.fromValue(r.add(n),this.format.decimals,this.format)},e.prototype.subUnsafe=function(t){this._checkFormat(t);var r=y(this._value,this.format.decimals),n=y(t._value,t.format.decimals);return e.fromValue(r.sub(n),this.format.decimals,this.format)},e.prototype.mulUnsafe=function(t){this._checkFormat(t);var r=y(this._value,this.format.decimals),n=y(t._value,t.format.decimals);return e.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)},e.prototype.divUnsafe=function(t){this._checkFormat(t);var r=y(this._value,this.format.decimals),n=y(t._value,t.format.decimals);return e.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)},e.prototype.floor=function(){var t=this.toString().split("."),r=e.from(t[0],this.format),n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(v)),r},e.prototype.ceiling=function(){var t=this.toString().split("."),r=e.from(t[0],this.format),n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(v)),r},e.prototype.round=function(t){null==t&&(t=0);var r=this.toString().split(".");if((t<0||t>80||t%1)&&a.throwArgumentError("invalid decimal count","decimals",t),r[1].length<=t)return this;var n=e.from("1"+l.substring(0,t));return this.mulUnsafe(n).addUnsafe(g).floor().divUnsafe(n)},e.prototype.isZero=function(){return"0.0"===this._value},e.prototype.isNegative=function(){return"-"===this._value[0]},e.prototype.toString=function(){return this._value},e.prototype.toHexString=function(e){if(null==e)return this._hex;e%8&&a.throwArgumentError("invalid byte width","width",e);var t=s.BigNumber.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return n.hexZeroPad(t,e/8)},e.prototype.toUnsafeFloat=function(){return parseFloat(this.toString())},e.prototype.toFormat=function(t){return e.fromString(this._value,t)},e.fromValue=function(t,r,n){return null!=n||null==r||s.isBigNumberish(r)||(n=r,r=null),null==r&&(r=0),null==n&&(n="fixed"),e.fromString(p(t,r),b.from(n))},e.fromString=function(t,r){null==r&&(r="fixed");var i=b.from(r),o=y(t,i.decimals);!i.signed&&o.lt(f)&&h("unsigned value cannot be negative","overflow","value",t);var a=null;i.signed?a=o.toTwos(i.width).toHexString():(a=o.toHexString(),a=n.hexZeroPad(a,i.width/8));var s=p(o,i.decimals);return new e(u,a,s,i)},e.fromBytes=function(t,r){null==r&&(r="fixed");var i=b.from(r);if(n.arrayify(t).length>i.width/8)throw new Error("overflow");var o=s.BigNumber.from(t);i.signed&&(o=o.fromTwos(i.width));var a=o.toTwos((i.signed?0:1)+i.width).toHexString(),f=p(o,i.decimals);return new e(u,a,f,i)},e.from=function(t,r){if("string"==typeof t)return e.fromString(t,r);if(n.isBytes(t))return e.fromBytes(t,r);try{return e.fromValue(t,0,r)}catch(e){if(e.code!==i.Logger.errors.INVALID_ARGUMENT)throw e}return a.throwArgumentError("invalid FixedNumber value","value",t)},e.isFixedNumber=function(e){return!(!e||!e._isFixedNumber)},e}();r.FixedNumber=m;var v=m.from(1),g=m.from("0.5")},{"./_version":1,"./bignumber":2,"@ethersproject/bytes":6,"@ethersproject/logger":13}],4:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r._base36To16=r._base16To36=r.parseFixed=r.FixedNumber=r.FixedFormat=r.formatFixed=r.BigNumber=void 0;var n=e("./bignumber");Object.defineProperty(r,"BigNumber",{enumerable:!0,get:function(){return n.BigNumber}});var i=e("./fixednumber");Object.defineProperty(r,"formatFixed",{enumerable:!0,get:function(){return i.formatFixed}}),Object.defineProperty(r,"FixedFormat",{enumerable:!0,get:function(){return i.FixedFormat}}),Object.defineProperty(r,"FixedNumber",{enumerable:!0,get:function(){return i.FixedNumber}}),Object.defineProperty(r,"parseFixed",{enumerable:!0,get:function(){return i.parseFixed}});var o=e("./bignumber");Object.defineProperty(r,"_base16To36",{enumerable:!0,get:function(){return o._base16To36}}),Object.defineProperty(r,"_base36To16",{enumerable:!0,get:function(){return o._base36To16}})},{"./bignumber":2,"./fixednumber":3}],5:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.version=void 0,r.version="bytes/5.1.0"},{}],6:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.joinSignature=r.splitSignature=r.hexZeroPad=r.hexStripZeros=r.hexValue=r.hexConcat=r.hexDataSlice=r.hexDataLength=r.hexlify=r.isHexString=r.zeroPad=r.stripZeros=r.concat=r.arrayify=r.isBytes=r.isBytesLike=void 0;var n=e("@ethersproject/logger"),i=e("./_version"),o=new n.Logger(i.version);function a(e){return!!e.toHexString}function s(e){return e.slice?e:(e.slice=function(){var t=Array.prototype.slice.call(arguments);return s(new Uint8Array(Array.prototype.slice.apply(e,t)))},e)}function u(e){return d(e)&&!(e.length%2)||f(e)}function f(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(null==e.length)return!1;for(var t=0;t=256||r%1)return!1}return!0}function c(e,t){if(t||(t={}),"number"==typeof e){o.checkSafeUint53(e,"invalid arrayify value");for(var r=[];e;)r.unshift(255&e),e=parseInt(String(e/256));return 0===r.length&&r.push(0),s(new Uint8Array(r))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),a(e)&&(e=e.toHexString()),d(e)){var n=e.substring(2);n.length%2&&("left"===t.hexPad?n="0x0"+n.substring(2):"right"===t.hexPad?n+="0":o.throwArgumentError("hex data is odd-length","value",e));r=[];for(var i=0;it&&o.throwArgumentError("value out of range","value",arguments[0]);var r=new Uint8Array(t);return r.set(e,t-e.length),s(r)}function d(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}r.isBytesLike=u,r.isBytes=f,r.arrayify=c,r.concat=h,r.stripZeros=function(e){var t=c(e);if(0===t.length)return t;for(var r=0;r>4]+p[15&s]}return n}return o.throwArgumentError("invalid hexlify value","value",e)}function b(e){"string"!=typeof e&&(e=y(e)),d(e)||o.throwArgumentError("invalid hex string","value",e),e=e.substring(2);for(var t=0;t2*t+2&&o.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function v(e){var t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0};if(u(e)){var r=c(e);65!==r.length&&o.throwArgumentError("invalid signature string; must be 65 bytes","signature",e),t.r=y(r.slice(0,32)),t.s=y(r.slice(32,64)),t.v=r[64],t.v<27&&(0===t.v||1===t.v?t.v+=27:o.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=y(r.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){var n=l(c(t._vs),32);t._vs=y(n);var i=n[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=i:t.recoveryParam!==i&&o.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),n[0]&=127;var a=y(n);null==t.s?t.s=a:t.s!==a&&o.throwArgumentError("signature v mismatch _vs","signature",e)}null==t.recoveryParam?null==t.v?o.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2:null==t.v?t.v=27+t.recoveryParam:t.recoveryParam!==1-t.v%2&&o.throwArgumentError("signature recoveryParam mismatch v","signature",e),null!=t.r&&d(t.r)?t.r=m(t.r,32):o.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&d(t.s)?t.s=m(t.s,32):o.throwArgumentError("signature missing or invalid s","signature",e);var s=c(t.s);s[0]>=128&&o.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(s[0]|=128);var f=y(s);t._vs&&(d(t._vs)||o.throwArgumentError("signature invalid _vs","signature",e),t._vs=m(t._vs,32)),null==t._vs?t._vs=f:t._vs!==f&&o.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t}r.hexlify=y,r.hexDataLength=function(e){if("string"!=typeof e)e=y(e);else if(!d(e)||e.length%2)return null;return(e.length-2)/2},r.hexDataSlice=function(e,t,r){return"string"!=typeof e?e=y(e):(!d(e)||e.length%2)&&o.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)},r.hexConcat=function(e){var t="0x";return e.forEach(function(e){t+=y(e).substring(2)}),t},r.hexValue=function(e){var t=b(y(e,{hexPad:"left"}));return"0x"===t?"0x0":t},r.hexStripZeros=b,r.hexZeroPad=m,r.splitSignature=v,r.joinSignature=function(e){return y(h([(e=v(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}},{"./_version":5,"@ethersproject/logger":13}],7:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.AddressZero=void 0,r.AddressZero="0x0000000000000000000000000000000000000000"},{}],8:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.MaxUint256=r.WeiPerEther=r.Two=r.One=r.Zero=r.NegativeOne=void 0;var n=e("@ethersproject/bignumber"),i=n.BigNumber.from(-1);r.NegativeOne=i;var o=n.BigNumber.from(0);r.Zero=o;var a=n.BigNumber.from(1);r.One=a;var s=n.BigNumber.from(2);r.Two=s;var u=n.BigNumber.from("1000000000000000000");r.WeiPerEther=u;var f=n.BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");r.MaxUint256=f},{"@ethersproject/bignumber":4}],9:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.HashZero=void 0,r.HashZero="0x0000000000000000000000000000000000000000000000000000000000000000"},{}],10:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.EtherSymbol=r.HashZero=r.MaxUint256=r.WeiPerEther=r.Two=r.One=r.Zero=r.NegativeOne=r.AddressZero=void 0;var n=e("./addresses");Object.defineProperty(r,"AddressZero",{enumerable:!0,get:function(){return n.AddressZero}});var i=e("./bignumbers");Object.defineProperty(r,"NegativeOne",{enumerable:!0,get:function(){return i.NegativeOne}}),Object.defineProperty(r,"Zero",{enumerable:!0,get:function(){return i.Zero}}),Object.defineProperty(r,"One",{enumerable:!0,get:function(){return i.One}}),Object.defineProperty(r,"Two",{enumerable:!0,get:function(){return i.Two}}),Object.defineProperty(r,"WeiPerEther",{enumerable:!0,get:function(){return i.WeiPerEther}}),Object.defineProperty(r,"MaxUint256",{enumerable:!0,get:function(){return i.MaxUint256}});var o=e("./hashes");Object.defineProperty(r,"HashZero",{enumerable:!0,get:function(){return o.HashZero}});var a=e("./strings");Object.defineProperty(r,"EtherSymbol",{enumerable:!0,get:function(){return a.EtherSymbol}})},{"./addresses":7,"./bignumbers":8,"./hashes":9,"./strings":11}],11:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.EtherSymbol=void 0,r.EtherSymbol="Ξ"},{}],12:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.version=void 0,r.version="logger/5.1.0"},{}],13:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Logger=r.ErrorCode=r.LogLevel=void 0;var n=!1,i=!1,o={debug:1,default:2,info:2,warning:3,error:4,off:5},a=o.default,s=e("./_version"),u=null;var f,c,h=function(){try{var e=[];if(["NFD","NFC","NFKD","NFKC"].forEach(function(t){try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}}),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(f=r.LogLevel||(r.LogLevel={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT"}(c=r.ErrorCode||(r.ErrorCode={}));var l=function(){function e(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}return e.prototype._log=function(e,t){var r=e.toLowerCase();null==o[r]&&this.throwArgumentError("invalid log level name","logLevel",e),a>o[r]||console.log.apply(console,t)},e.prototype.debug=function(){for(var t=[],r=0;r=9007199254740991)&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))},e.prototype.checkArgumentCount=function(t,r,n){n=n?": "+n:"",tr&&this.throwError("too many arguments"+n,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})},e.prototype.checkNew=function(t,r){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})},e.prototype.checkAbstract=function(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})},e.globalLogger=function(){return u||(u=new e(s.version)),u},e.setCensorship=function(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),n){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}i=!!t,n=!!r},e.setLogLevel=function(t){var r=o[t.toLowerCase()];null!=r?a=r:e.globalLogger().warn("invalid log level - "+t)},e.from=function(t){return new e(t)},e.errors=c,e.levels=f,e}();r.Logger=l},{"./_version":12}],14:[function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function s(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}u((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0)return n[0]},e.prototype.resolveRes=function(e,t){var r,n=e.id,o=e.error,a=this.pendingRequest[n];return a?(delete this.pendingRequest[n],this.processResult(e,a),void this.transportEventChannel.emit("response",e)):void 0!==n||void 0!==o?(o&&(r=i.convertJSONToRPCError(e)),t&&o&&r&&this.transportEventChannel.emit("error",r),r):void this.transportEventChannel.emit("notification",e)},e.prototype.setRequestTimeout=function(e,t,r){var n=this;setTimeout(function(){delete n.pendingRequest[e],r(new i.JSONRPCError("Request timeout request took longer than "+t+" ms to resolve",i.ERR_TIMEOUT))},t)},e}();r.TransportRequestManager=o},{"../Error":15,events:303}],25:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function s(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}u((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]>6],i=0==(32&r);if(31==(31&r)){let n=r;for(r=0;128==(128&n);){if(n=e.readUInt8(t),e.isError(n))return n;r<<=7,r|=127&n}}else r&=31;return{cls:n,primitive:i,tag:r,tagStr:s.tag[r]}}function h(e,t,r){let n=e.readUInt8(r);if(e.isError(n))return n;if(!t&&128===n)return null;if(0==(128&n))return n;const i=127&n;if(i>4)return e.error("length octect is too long");n=0;for(let t=0;t=31)return n.error("Multi-octet tag encoding unsupported");t||(i|=32);return i|=a.tagClassByName[r||"universal"]<<6}(e,t,r,this.reporter);if(n.length<128){const e=i.alloc(2);return e[0]=o,e[1]=n.length,this._createEncoderBuffer([e,n])}let s=1;for(let e=n.length;e>=256;e>>=8)s++;const u=i.alloc(2+s);u[0]=o,u[1]=128|s;for(let e=1+s,t=n.length;t>0;e--,t>>=8)u[e]=255&t;return this._createEncoderBuffer([u,n])},u.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){const t=i.alloc(2*e.length);for(let r=0;r=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}let n=0;for(let t=0;t=128;r>>=7)n++}const o=i.alloc(n);let a=o.length-1;for(let t=e.length-1;t>=0;t--){let r=e[t];for(o[a--]=127&r;(r>>=7)>0;)o[a--]=128|127&r}return this._createEncoderBuffer(o)},u.prototype._encodeTime=function(e,t){let r;const n=new Date(e);return"gentime"===t?r=[f(n.getUTCFullYear()),f(n.getUTCMonth()+1),f(n.getUTCDate()),f(n.getUTCHours()),f(n.getUTCMinutes()),f(n.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[f(n.getUTCFullYear()%100),f(n.getUTCMonth()+1),f(n.getUTCDate()),f(n.getUTCHours()),f(n.getUTCMinutes()),f(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},u.prototype._encodeNull=function(){return this._createEncoderBuffer("")},u.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!i.isBuffer(e)){const t=e.toArray();!e.sign&&128&t[0]&&t.unshift(0),e=i.from(t)}if(i.isBuffer(e)){let t=e.length;0===e.length&&t++;const r=i.alloc(t);return e.copy(r),0===e.length&&(r[0]=0),this._createEncoderBuffer(r)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let r=1;for(let t=e;t>=256;t>>=8)r++;const n=new Array(r);for(let t=n.length-1;t>=0;t--)n[t]=255&e,e>>=8;return 128&n[0]&&n.unshift(0),this._createEncoderBuffer(i.from(n))},u.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},u.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},u.prototype._skipDefault=function(e,t,r){const n=this._baseState;let i;if(null===n.default)return!1;const o=e.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,t,r).join()),o.length!==n.defaultBuffer.length)return!1;for(i=0;i=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r>>0,c=new Uint8Array(a);e[r];){var h=t[e.charCodeAt(r)];if(255===h)return;for(var l=0,d=a-1;(0!==h||l>>0,c[d]=h%256>>>0,h=h/256>>>0;if(0!==h)throw new Error("Non-zero carry");o=l,r++}if(" "!==e[r]){for(var p=a-o;p!==a&&0===c[p];)p++;var y=n.allocUnsafe(i+(a-p));y.fill(0,0,i);for(var b=i;p!==a;)y[b++]=c[p++];return y}}}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=n.from(t)),!n.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,i=0,o=0,a=t.length;o!==a&&0===t[o];)o++,r++;for(var f=(a-o)*c+1>>>0,h=new Uint8Array(f);o!==a;){for(var l=t[o],d=0,p=f-1;(0!==l||d>>0,h[p]=l%s>>>0,l=l/s>>>0;if(0!==l)throw new Error("Non-zero carry");i=d,o++}for(var y=f-i;y!==f&&0===h[y];)y++;for(var b=u.repeat(r);y=4294967296&&i++,e[t]=n,e[t+1]=i}function o(e,t,r,n){var i=e[t]+r;r<0&&(i+=4294967296);var o=e[t+1]+n;i>=4294967296&&o++,e[t]=i,e[t+1]=o}function a(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function s(e,t,r,n,a,s){var u=h[a],f=h[a+1],l=h[s],d=h[s+1];i(c,e,t),o(c,e,u,f);var p=c[n]^c[e],y=c[n+1]^c[e+1];c[n]=y,c[n+1]=p,i(c,r,n),p=c[t]^c[r],y=c[t+1]^c[r+1],c[t]=p>>>24^y<<8,c[t+1]=y>>>24^p<<8,i(c,e,t),o(c,e,l,d),p=c[n]^c[e],y=c[n+1]^c[e+1],c[n]=p>>>16^y<<16,c[n+1]=y>>>16^p<<16,i(c,r,n),p=c[t]^c[r],y=c[t+1]^c[r+1],c[t]=y>>>31^p<<1,c[t+1]=p>>>31^y<<1}var u=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),f=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map(function(e){return 2*e})),c=new Uint32Array(32),h=new Uint32Array(32);function l(e,t){var r=0;for(r=0;r<16;r++)c[r]=e.h[r],c[r+16]=u[r];for(c[24]=c[24]^e.t,c[25]=c[25]^e.t/4294967296,t&&(c[28]=~c[28],c[29]=~c[29]),r=0;r<32;r++)h[r]=a(e.b,4*r);for(r=0;r<12;r++)s(0,8,16,24,f[16*r+0],f[16*r+1]),s(2,10,18,26,f[16*r+2],f[16*r+3]),s(4,12,20,28,f[16*r+4],f[16*r+5]),s(6,14,22,30,f[16*r+6],f[16*r+7]),s(0,10,20,30,f[16*r+8],f[16*r+9]),s(2,12,22,24,f[16*r+10],f[16*r+11]),s(4,14,16,26,f[16*r+12],f[16*r+13]),s(6,8,18,28,f[16*r+14],f[16*r+15]);for(r=0;r<16;r++)e.h[r]=e.h[r]^c[r]^c[r+16]}function d(e,t){if(0===e||e>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");for(var r={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e},n=0;n<16;n++)r.h[n]=u[n];var i=t?t.length:0;return r.h[0]^=16842752^i<<8^e,t&&(p(r,t),r.c=128),r}function p(e,t){for(var r=0;r>2]>>8*(3&r);return t}function b(e,t,r){r=r||64,e=n.normalizeInput(e);var i=d(r,t);return p(i,e),y(i)}t.exports={blake2b:b,blake2bHex:function(e,t,r){var i=b(e,t,r);return n.toHex(i)},blake2bInit:d,blake2bUpdate:p,blake2bFinal:y}},{"./util":44}],42:[function(e,t,r){var n=e("./util");function i(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function o(e,t,r,n,i,o){f[e]=f[e]+f[t]+i,f[n]=a(f[n]^f[e],16),f[r]=f[r]+f[n],f[t]=a(f[t]^f[r],12),f[e]=f[e]+f[t]+o,f[n]=a(f[n]^f[e],8),f[r]=f[r]+f[n],f[t]=a(f[t]^f[r],7)}function a(e,t){return e>>>t^e<<32-t}var s=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),f=new Uint32Array(16),c=new Uint32Array(16);function h(e,t){var r=0;for(r=0;r<8;r++)f[r]=e.h[r],f[r+8]=s[r];for(f[12]^=e.t,f[13]^=e.t/4294967296,t&&(f[14]=~f[14]),r=0;r<16;r++)c[r]=i(e.b,4*r);for(r=0;r<10;r++)o(0,4,8,12,c[u[16*r+0]],c[u[16*r+1]]),o(1,5,9,13,c[u[16*r+2]],c[u[16*r+3]]),o(2,6,10,14,c[u[16*r+4]],c[u[16*r+5]]),o(3,7,11,15,c[u[16*r+6]],c[u[16*r+7]]),o(0,5,10,15,c[u[16*r+8]],c[u[16*r+9]]),o(1,6,11,12,c[u[16*r+10]],c[u[16*r+11]]),o(2,7,8,13,c[u[16*r+12]],c[u[16*r+13]]),o(3,4,9,14,c[u[16*r+14]],c[u[16*r+15]]);for(r=0;r<8;r++)e.h[r]^=f[r]^f[r+8]}function l(e,t){if(!(e>0&&e<=32))throw new Error("Incorrect output length, should be in [1, 32]");var r=t?t.length:0;if(t&&!(r>0&&r<=32))throw new Error("Incorrect key length, should be in [1, 32]");var n={h:new Uint32Array(s),b:new Uint32Array(64),c:0,t:0,outlen:e};return n.h[0]^=16842752^r<<8^e,r>0&&(d(n,t),n.c=64),n}function d(e,t){for(var r=0;r>2]>>8*(3&r)&255;return t}function y(e,t,r){r=r||32,e=n.normalizeInput(e);var i=l(r,t);return d(i,e),p(i)}t.exports={blake2s:y,blake2sHex:function(e,t,r){var i=y(e,t,r);return n.toHex(i)},blake2sInit:l,blake2sUpdate:d,blake2sFinal:p}},{"./util":44}],43:[function(e,t,r){var n=e("./blake2b"),i=e("./blake2s");t.exports={blake2b:n.blake2b,blake2bHex:n.blake2bHex,blake2bInit:n.blake2bInit,blake2bUpdate:n.blake2bUpdate,blake2bFinal:n.blake2bFinal,blake2s:i.blake2s,blake2sHex:i.blake2sHex,blake2sInit:i.blake2sInit,blake2sUpdate:i.blake2sUpdate,blake2sFinal:i.blake2sFinal}},{"./blake2b":41,"./blake2s":42}],44:[function(e,t,r){(function(e){(function(){var r="Input must be an string, Buffer or Uint8Array";function n(e){return(4294967296+e).toString(16).substring(1)}t.exports={normalizeInput:function(t){var n;if(t instanceof Uint8Array)n=t;else if(t instanceof e)n=new Uint8Array(t);else{if("string"!=typeof t)throw new Error(r);n=new Uint8Array(e.from(t,"utf8"))}return n},toHex:function(e){return Array.prototype.map.call(e,function(e){return(e<16?"0":"")+e.toString(16)}).join("")},debugPrint:function(e,t,r){for(var i="\n"+e+" = ",o=0;o=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(e,t,r){var n=s(e,r);return r-1>=t&&(n|=s(e,r-1)<<4),n}function f(e,t,r,n){for(var i=0,o=Math.min(e.length,r),a=t;a=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)i=u(e,t,n)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(e.length-t)%2==0?t+1:t;n=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var f=1;f>>26,h=67108863&u,l=Math.min(f,t.length-1),d=Math.max(0,f-e.length+1);d<=l;d++){var p=f-d|0;c+=(a=(i=0|e.words[p])*(o=0|t.words[d])+h)/67108864|0,h=67108863&a}r.words[f]=0|h,u=0|c}return 0!==u?r.words[f]=0|u:r.length--,r.strip()}o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a>>24-i&16777215)||a!==this.length-1?c[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var f=h[e],d=l[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modn(d).toString(e);r=(p=p.idivn(d)).isZero()?y+r:c[f-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return n(void 0!==a),this.toArrayLike(a,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===t,f=new e(o),c=this.clone();if(u){for(s=0;!c.isZero();s++)a=c.andln(255),c.iushrn(8),f[s]=a;for(;s=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,d=0|a[1],p=8191&d,y=d>>>13,b=0|a[2],m=8191&b,v=b>>>13,g=0|a[3],w=8191&g,_=g>>>13,M=0|a[4],S=8191&M,E=M>>>13,A=0|a[5],k=8191&A,B=A>>>13,T=0|a[6],j=8191&T,x=T>>>13,P=0|a[7],O=8191&P,R=P>>>13,I=0|a[8],C=8191&I,N=I>>>13,U=0|a[9],D=8191&U,L=U>>>13,K=0|s[0],z=8191&K,q=K>>>13,H=0|s[1],F=8191&H,V=H>>>13,W=0|s[2],J=8191&W,Z=W>>>13,G=0|s[3],X=8191&G,Y=G>>>13,$=0|s[4],Q=8191&$,ee=$>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,fe=se>>>13,ce=0|s[8],he=8191&ce,le=ce>>>13,de=0|s[9],pe=8191&de,ye=de>>>13;r.negative=e.negative^t.negative,r.length=19;var be=(f+(n=Math.imul(h,z))|0)+((8191&(i=(i=Math.imul(h,q))+Math.imul(l,z)|0))<<13)|0;f=((o=Math.imul(l,q))+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(p,z),i=(i=Math.imul(p,q))+Math.imul(y,z)|0,o=Math.imul(y,q);var me=(f+(n=n+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(l,F)|0))<<13)|0;f=((o=o+Math.imul(l,V)|0)+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(m,z),i=(i=Math.imul(m,q))+Math.imul(v,z)|0,o=Math.imul(v,q),n=n+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var ve=(f+(n=n+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,Z)|0)+Math.imul(l,J)|0))<<13)|0;f=((o=o+Math.imul(l,Z)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(w,z),i=(i=Math.imul(w,q))+Math.imul(_,z)|0,o=Math.imul(_,q),n=n+Math.imul(m,F)|0,i=(i=i+Math.imul(m,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,Z)|0;var ge=(f+(n=n+Math.imul(h,X)|0)|0)+((8191&(i=(i=i+Math.imul(h,Y)|0)+Math.imul(l,X)|0))<<13)|0;f=((o=o+Math.imul(l,Y)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(S,z),i=(i=Math.imul(S,q))+Math.imul(E,z)|0,o=Math.imul(E,q),n=n+Math.imul(w,F)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(_,F)|0,o=o+Math.imul(_,V)|0,n=n+Math.imul(m,J)|0,i=(i=i+Math.imul(m,Z)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,Z)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,Y)|0;var we=(f+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(l,Q)|0))<<13)|0;f=((o=o+Math.imul(l,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(k,z),i=(i=Math.imul(k,q))+Math.imul(B,z)|0,o=Math.imul(B,q),n=n+Math.imul(S,F)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(E,F)|0,o=o+Math.imul(E,V)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Z)|0,n=n+Math.imul(m,X)|0,i=(i=i+Math.imul(m,Y)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,Y)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,ee)|0;var _e=(f+(n=n+Math.imul(h,re)|0)|0)+((8191&(i=(i=i+Math.imul(h,ne)|0)+Math.imul(l,re)|0))<<13)|0;f=((o=o+Math.imul(l,ne)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(j,z),i=(i=Math.imul(j,q))+Math.imul(x,z)|0,o=Math.imul(x,q),n=n+Math.imul(k,F)|0,i=(i=i+Math.imul(k,V)|0)+Math.imul(B,F)|0,o=o+Math.imul(B,V)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,Z)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Z)|0,n=n+Math.imul(w,X)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,ee)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(y,re)|0,o=o+Math.imul(y,ne)|0;var Me=(f+(n=n+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,ae)|0)+Math.imul(l,oe)|0))<<13)|0;f=((o=o+Math.imul(l,ae)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(O,z),i=(i=Math.imul(O,q))+Math.imul(R,z)|0,o=Math.imul(R,q),n=n+Math.imul(j,F)|0,i=(i=i+Math.imul(j,V)|0)+Math.imul(x,F)|0,o=o+Math.imul(x,V)|0,n=n+Math.imul(k,J)|0,i=(i=i+Math.imul(k,Z)|0)+Math.imul(B,J)|0,o=o+Math.imul(B,Z)|0,n=n+Math.imul(S,X)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,Y)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(m,re)|0,i=(i=i+Math.imul(m,ne)|0)+Math.imul(v,re)|0,o=o+Math.imul(v,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0;var Se=(f+(n=n+Math.imul(h,ue)|0)|0)+((8191&(i=(i=i+Math.imul(h,fe)|0)+Math.imul(l,ue)|0))<<13)|0;f=((o=o+Math.imul(l,fe)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(C,z),i=(i=Math.imul(C,q))+Math.imul(N,z)|0,o=Math.imul(N,q),n=n+Math.imul(O,F)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(R,F)|0,o=o+Math.imul(R,V)|0,n=n+Math.imul(j,J)|0,i=(i=i+Math.imul(j,Z)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Z)|0,n=n+Math.imul(k,X)|0,i=(i=i+Math.imul(k,Y)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(m,oe)|0,i=(i=i+Math.imul(m,ae)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,ae)|0,n=n+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,fe)|0;var Ee=(f+(n=n+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,le)|0)+Math.imul(l,he)|0))<<13)|0;f=((o=o+Math.imul(l,le)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(D,z),i=(i=Math.imul(D,q))+Math.imul(L,z)|0,o=Math.imul(L,q),n=n+Math.imul(C,F)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,V)|0,n=n+Math.imul(O,J)|0,i=(i=i+Math.imul(O,Z)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,Z)|0,n=n+Math.imul(j,X)|0,i=(i=i+Math.imul(j,Y)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,Y)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,ee)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,ee)|0,n=n+Math.imul(S,re)|0,i=(i=i+Math.imul(S,ne)|0)+Math.imul(E,re)|0,o=o+Math.imul(E,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,n=n+Math.imul(m,ue)|0,i=(i=i+Math.imul(m,fe)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,fe)|0,n=n+Math.imul(p,he)|0,i=(i=i+Math.imul(p,le)|0)+Math.imul(y,he)|0,o=o+Math.imul(y,le)|0;var Ae=(f+(n=n+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,ye)|0)+Math.imul(l,pe)|0))<<13)|0;f=((o=o+Math.imul(l,ye)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(D,F),i=(i=Math.imul(D,V))+Math.imul(L,F)|0,o=Math.imul(L,V),n=n+Math.imul(C,J)|0,i=(i=i+Math.imul(C,Z)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,Z)|0,n=n+Math.imul(O,X)|0,i=(i=i+Math.imul(O,Y)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,Y)|0,n=n+Math.imul(j,Q)|0,i=(i=i+Math.imul(j,ee)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,ee)|0,n=n+Math.imul(k,re)|0,i=(i=i+Math.imul(k,ne)|0)+Math.imul(B,re)|0,o=o+Math.imul(B,ne)|0,n=n+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,ae)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,ae)|0,n=n+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(_,ue)|0,o=o+Math.imul(_,fe)|0,n=n+Math.imul(m,he)|0,i=(i=i+Math.imul(m,le)|0)+Math.imul(v,he)|0,o=o+Math.imul(v,le)|0;var ke=(f+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ye)|0)+Math.imul(y,pe)|0))<<13)|0;f=((o=o+Math.imul(y,ye)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,Z))+Math.imul(L,J)|0,o=Math.imul(L,Z),n=n+Math.imul(C,X)|0,i=(i=i+Math.imul(C,Y)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,Y)|0,n=n+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,ee)|0,n=n+Math.imul(j,re)|0,i=(i=i+Math.imul(j,ne)|0)+Math.imul(x,re)|0,o=o+Math.imul(x,ne)|0,n=n+Math.imul(k,oe)|0,i=(i=i+Math.imul(k,ae)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,ae)|0,n=n+Math.imul(S,ue)|0,i=(i=i+Math.imul(S,fe)|0)+Math.imul(E,ue)|0,o=o+Math.imul(E,fe)|0,n=n+Math.imul(w,he)|0,i=(i=i+Math.imul(w,le)|0)+Math.imul(_,he)|0,o=o+Math.imul(_,le)|0;var Be=(f+(n=n+Math.imul(m,pe)|0)|0)+((8191&(i=(i=i+Math.imul(m,ye)|0)+Math.imul(v,pe)|0))<<13)|0;f=((o=o+Math.imul(v,ye)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863,n=Math.imul(D,X),i=(i=Math.imul(D,Y))+Math.imul(L,X)|0,o=Math.imul(L,Y),n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,ee)|0,n=n+Math.imul(O,re)|0,i=(i=i+Math.imul(O,ne)|0)+Math.imul(R,re)|0,o=o+Math.imul(R,ne)|0,n=n+Math.imul(j,oe)|0,i=(i=i+Math.imul(j,ae)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,ae)|0,n=n+Math.imul(k,ue)|0,i=(i=i+Math.imul(k,fe)|0)+Math.imul(B,ue)|0,o=o+Math.imul(B,fe)|0,n=n+Math.imul(S,he)|0,i=(i=i+Math.imul(S,le)|0)+Math.imul(E,he)|0,o=o+Math.imul(E,le)|0;var Te=(f+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ye)|0)+Math.imul(_,pe)|0))<<13)|0;f=((o=o+Math.imul(_,ye)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,ee))+Math.imul(L,Q)|0,o=Math.imul(L,ee),n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(N,re)|0,o=o+Math.imul(N,ne)|0,n=n+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,ae)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,ae)|0,n=n+Math.imul(j,ue)|0,i=(i=i+Math.imul(j,fe)|0)+Math.imul(x,ue)|0,o=o+Math.imul(x,fe)|0,n=n+Math.imul(k,he)|0,i=(i=i+Math.imul(k,le)|0)+Math.imul(B,he)|0,o=o+Math.imul(B,le)|0;var je=(f+(n=n+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,ye)|0)+Math.imul(E,pe)|0))<<13)|0;f=((o=o+Math.imul(E,ye)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,n=Math.imul(D,re),i=(i=Math.imul(D,ne))+Math.imul(L,re)|0,o=Math.imul(L,ne),n=n+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,ae)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,ae)|0,n=n+Math.imul(O,ue)|0,i=(i=i+Math.imul(O,fe)|0)+Math.imul(R,ue)|0,o=o+Math.imul(R,fe)|0,n=n+Math.imul(j,he)|0,i=(i=i+Math.imul(j,le)|0)+Math.imul(x,he)|0,o=o+Math.imul(x,le)|0;var xe=(f+(n=n+Math.imul(k,pe)|0)|0)+((8191&(i=(i=i+Math.imul(k,ye)|0)+Math.imul(B,pe)|0))<<13)|0;f=((o=o+Math.imul(B,ye)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(D,oe),i=(i=Math.imul(D,ae))+Math.imul(L,oe)|0,o=Math.imul(L,ae),n=n+Math.imul(C,ue)|0,i=(i=i+Math.imul(C,fe)|0)+Math.imul(N,ue)|0,o=o+Math.imul(N,fe)|0,n=n+Math.imul(O,he)|0,i=(i=i+Math.imul(O,le)|0)+Math.imul(R,he)|0,o=o+Math.imul(R,le)|0;var Pe=(f+(n=n+Math.imul(j,pe)|0)|0)+((8191&(i=(i=i+Math.imul(j,ye)|0)+Math.imul(x,pe)|0))<<13)|0;f=((o=o+Math.imul(x,ye)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(D,ue),i=(i=Math.imul(D,fe))+Math.imul(L,ue)|0,o=Math.imul(L,fe),n=n+Math.imul(C,he)|0,i=(i=i+Math.imul(C,le)|0)+Math.imul(N,he)|0,o=o+Math.imul(N,le)|0;var Oe=(f+(n=n+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,ye)|0)+Math.imul(R,pe)|0))<<13)|0;f=((o=o+Math.imul(R,ye)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(D,he),i=(i=Math.imul(D,le))+Math.imul(L,he)|0,o=Math.imul(L,le);var Re=(f+(n=n+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,ye)|0)+Math.imul(N,pe)|0))<<13)|0;f=((o=o+Math.imul(N,ye)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ie=(f+(n=Math.imul(D,pe))|0)+((8191&(i=(i=Math.imul(D,ye))+Math.imul(L,pe)|0))<<13)|0;return f=((o=Math.imul(L,ye))+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,u[0]=be,u[1]=me,u[2]=ve,u[3]=ge,u[4]=we,u[5]=_e,u[6]=Me,u[7]=Se,u[8]=Ee,u[9]=Ae,u[10]=ke,u[11]=Be,u[12]=Te,u[13]=je,u[14]=xe,u[15]=Pe,u[16]=Oe,u[17]=Re,u[18]=Ie,0!==f&&(u[19]=f,r.length++),r};function y(e,t,r){return(new b).mulp(e,t,r)}function b(e,t){this.x=e,this.y=t}Math.imul||(p=d),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?p(this,e,t):r<63?d(this,e,t):r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):y(this,e,t)},b.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n>=1;return n},b.prototype.permute=function(e,t,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*t;a>=26,t+=i/67108864|0,t+=o>>>26,this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,f=0;f=0&&(0!==c||f>=i);f--){var h=0|this.words[f];this.words[f]=c<<26-o|h>>>o,c=h&s}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,u=n.length-i.length;if("mod"!==t){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var f=0;f=0;h--){var l=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(l=Math.min(l/a|0,67108863),n._ishlnsubmul(i,l,h);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},o.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),f=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++f;for(var c=r.clone(),h=t.clone();!t.isZero();){for(var l=0,d=1;0==(t.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(t.iushrn(l);l-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(c),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(c),u.isub(h)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(s),a.isub(u)):(r.isub(t),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:r.iushln(f)}},o.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new o(1),s=new o(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var f=0,c=1;0==(t.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(t.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,l=1;0==(r.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new S(e)},o.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var m={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function E(e){S.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},i(g,v),g.prototype.split=function(e,t){for(var r=Math.min(e.length,9),n=0;n>>22,i=o}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},g.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(m[e])return m[e];var t;if("k256"===e)t=new g;else if("p224"===e)t=new w;else if("p192"===e)t=new _;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new M}return m[e]=t,t},S.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),f=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new o(2*c*c).toRed(this);0!==this.pow(c,f).cmp(u);)c.redIAdd(u);for(var h=this.pow(c,i),l=this.pow(e,i.addn(1).iushrn(1)),d=this.pow(e,i),p=a;0!==d.cmp(s);){for(var y=d,b=0;0!==y.cmp(s);b++)y=y.redSqr();n(b=0;n--){for(var f=t.words[n],c=u-1;c>=0;c--){var h=f>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4===++s||0===n&&0===c)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}u=26}return i},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new E(e)},i(E,S),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this)},{buffer:222}],46:[function(e,t,r){var n;function i(e){this.rand=e}if(t.exports=function(e){return n||(n=new i(null)),n.generate(e)},t.exports.Rand=i,i.prototype.generate=function(e){return this._rand(e)},i.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;rr)?t=("rmd160"===e?new u:f(e)).update(t).digest():t.lengths?t=e(t):t.length0&&e.compare(u)<0);var t}function l(e){var t=new Uint8Array(e);return void 0===o.getRandomValues?n.from(s.randomBytes(e)):(o.getRandomValues(t),n.from(t))}function d(e){return new Promise(function(t){var r=s.createHash("sha512").update(e).digest();t(new Uint8Array(r))})}function p(e){return function(t,r,i){return new Promise(function(o){if(a){return a.importKey("raw",r,{name:"AES-CBC"},!1,[e]).then(function(r){var n={name:"AES-CBC",iv:t};return a[e](n,r,i)}).then(function(e){o(n.from(new Uint8Array(e)))})}if("encrypt"===e){var u=s.createCipheriv("aes-256-cbc",r,t);let e=u.update(i),a=u.final();o(n.concat([e,a]))}else if("decrypt"===e){var f=s.createDecipheriv("aes-256-cbc",r,t);let e=f.update(i),a=f.final();o(n.concat([e,a]))}})}}var y=p("encrypt"),b=p("decrypt");r.generatePrivate=function(){for(var e=l(32);!h(e);)e=l(32);return e};var m=r.getPublic=function(e){return c(32===e.length,"Bad private key"),c(h(e),"Bad private key"),n.from(i.keyFromPrivate(e).getPublic("arr"))};r.getPublicCompressed=function(e){c(32===e.length,"Bad private key"),c(h(e),"Bad private key");return n.from(i.keyFromPrivate(e).getPublic(!0,"arr"))};r.sign=function(e,t){return new Promise(function(r){c(32===e.length,"Bad private key"),c(h(e),"Bad private key"),c(t.length>0,"Message should not be empty"),c(t.length<=32,"Message is too long"),r(n.from(i.sign(t,e,{canonical:!0}).toDER()))})},r.verify=function(e,t,r){return new Promise(function(n,o){c(65===e.length||33===e.length,"Bad public key"),65===e.length&&c(4===e[0],"Bad public key"),33===e.length&&c(2===e[0]||3===e[0],"Bad public key"),c(t.length>0,"Message should not be empty"),c(t.length<=32,"Message is too long"),i.verify(t,r,e)?n(null):o(new Error("Bad signature"))})};var v=r.derive=function(e,t){return new Promise(function(r){c(n.isBuffer(e),"Bad private key"),c(n.isBuffer(t),"Bad public key"),c(32===e.length,"Bad private key"),c(h(e),"Bad private key"),c(65===t.length||33===t.length,"Bad public key"),65===t.length&&c(4===t[0],"Bad public key"),33===t.length&&c(2===t[0]||3===t[0],"Bad public key");var o=i.keyFromPrivate(e),a=i.keyFromPublic(t),s=o.derive(a.getPublic());r(n.from(s.toArray()))})};r.encrypt=function(e,t,r){var i,o,a,u;return r=r||{},new Promise(function(t){for(var n=r.ephemPrivateKey||l(32);!h(n);)n=r.ephemPrivateKey||l(32);o=m(n),t(v(n,e))}).then(function(e){return d(e)}).then(function(e){i=r.iv||l(16);var n=e.slice(0,32);return u=e.slice(32),y(i,n,t)}).then(function(e){a=e;var t,r,f=n.concat([i,o,a]);return t=u,r=f,new Promise(function(e){var i=s.createHmac("sha256",n.from(t));i.update(r),e(i.digest())})}).then(function(e){return{iv:i,ephemPublicKey:o,ciphertext:a,mac:e}})},r.decrypt=function(e,t){var r;return v(e,t.ephemPublicKey).then(function(e){return d(e)}).then(function(e){r=e.slice(0,32);var i,o,a,u=e.slice(32),f=n.concat([t.iv,t.ephemPublicKey,t.ciphertext]);return i=u,o=f,a=t.mac,new Promise(function(e){var t=s.createHmac("sha256",n.from(i));t.update(o),e(function(e,t){if(e.length!==t.length)return!1;for(var r=0,n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function f(e,t){this.curve=e,this.type=t,this.precomputed=null}t.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(e,t){s(e.precomputed);var r=e._getDoubles(),n=o(t,1,this._bitLength),i=(1<=a;c--)u=(u<<1)+n[c];f.push(u)}for(var h=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=i;d>0;d--){for(a=0;a=0;f--){for(var c=0;f>=0&&0===a[f];f--)c++;if(f>=0&&c++,u=u.dblp(c),f<0)break;var h=a[f];s(0!==h),u="affine"===e.type?h>0?u.mixedAdd(i[h-1>>1]):u.mixedAdd(i[-h-1>>1].neg()):h>0?u.add(i[h-1>>1]):u.add(i[-h-1>>1].neg())}return"affine"===e.type?u.toP():u},u.prototype._wnafMulAdd=function(e,t,r,n,i){var s,u,f,c=this._wnafT1,h=this._wnafT2,l=this._wnafT3,d=0;for(s=0;s=1;s-=2){var y=s-1,b=s;if(1===c[y]&&1===c[b]){var m=[t[y],null,null,t[b]];0===t[y].y.cmp(t[b].y)?(m[1]=t[y].add(t[b]),m[2]=t[y].toJ().mixedAdd(t[b].neg())):0===t[y].y.cmp(t[b].y.redNeg())?(m[1]=t[y].toJ().mixedAdd(t[b]),m[2]=t[y].add(t[b].neg())):(m[1]=t[y].toJ().mixedAdd(t[b]),m[2]=t[y].toJ().mixedAdd(t[b].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],g=a(r[y],r[b]);for(d=Math.max(g[0].length,d),l[y]=new Array(d),l[b]=new Array(d),u=0;u=0;s--){for(var E=0;s>=0;){var A=!0;for(u=0;u=0&&E++,M=M.dblp(E),s<0)break;for(u=0;u0?f=h[u][k-1>>1]:k<0&&(f=h[u][-k-1>>1].neg()),M="affine"===f.type?M.mixedAdd(f):M.add(f))}}for(s=0;s=Math.ceil((e.bitLength()+1)/t.step)},f.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i":""},f.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},f.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=n.redAdd(t),a=o.redSub(r),s=n.redSub(t),u=i.redMul(a),f=o.redMul(s),c=i.redMul(s),h=a.redMul(o);return this.curve.point(u,f,h,c)},f.prototype._projDbl=function(){var e,t,r,n,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var f=(n=this.curve._mulA(s)).redAdd(u);this.zOne?(e=a.redSub(s).redSub(u).redMul(f.redSub(this.curve.two)),t=f.redMul(n.redSub(u)),r=f.redSqr().redSub(f).redSub(f)):(i=this.z.redSqr(),o=f.redSub(i).redISub(i),e=a.redSub(s).redISub(u).redMul(o),t=f.redMul(n.redSub(u)),r=f.redMul(o))}else n=s.redAdd(u),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),e=this.curve._mulC(a.redISub(n)).redMul(o),t=this.curve._mulC(n).redMul(s.redISub(u)),r=n.redMul(o);return this.curve.point(e,t,r)},f.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},f.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=r.redSub(t),a=i.redSub(n),s=i.redAdd(n),u=r.redAdd(t),f=o.redMul(a),c=s.redMul(u),h=o.redMul(u),l=a.redMul(s);return this.curve.point(f,c,l,h)},f.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),o=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(o).redMul(a),u=i.redSub(s),f=i.redAdd(s),c=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a),h=n.redMul(u).redMul(c);return this.curve.twisted?(t=n.redMul(f).redMul(a.redSub(this.curve._mulA(o))),r=u.redMul(f)):(t=n.redMul(f).redMul(a.redSub(o)),r=this.curve._mulC(u).redMul(f)),this.curve.point(h,t,r)},f.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},f.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},f.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},f.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},f.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},f.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},f.prototype.getX=function(){return this.normalize(),this.x.fromRed()},f.prototype.getY=function(){return this.normalize(),this.y.fromRed()},f.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},f.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},f.prototype.toP=f.prototype.normalize,f.prototype.mixedAdd=f.prototype.add},{"../utils":70,"./base":57,"bn.js":45,inherits:97}],59:[function(e,t,r){"use strict";var n=r;n.base=e("./base"),n.short=e("./short"),n.mont=e("./mont"),n.edwards=e("./edwards")},{"./base":57,"./edwards":58,"./mont":60,"./short":61}],60:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("inherits"),o=e("./base"),a=e("../utils");function s(e){o.call(this,"mont",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(e,t,r){o.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(t,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(s,o),t.exports=s,s.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},i(u,o.BasePoint),s.prototype.decodePoint=function(e,t){return this.point(a.toArray(e,t),1)},s.prototype.point=function(e,t){return new u(this,e,t)},s.prototype.pointFromJSON=function(e){return u.fromJSON(this,e)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(e,t){return new u(e,t[0],t[1]||e.one)},u.prototype.inspect=function(){return this.isInfinity()?"":""},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(r),a=i.redMul(n),s=t.z.redMul(o.redAdd(a).redSqr()),u=t.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},u.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../utils":70,"./base":57,"bn.js":45,inherits:97}],61:[function(e,t,r){"use strict";var n=e("../utils"),i=e("bn.js"),o=e("inherits"),a=e("./base"),s=n.assert;function u(e){a.call(this,"short",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function f(e,t,r,n){a.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(t,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function c(e,t,r,n){a.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(t,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,a),t.exports=u,u.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new i(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new i(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?r=o[0]:(r=o[1],s(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map(function(e){return{a:new i(e.a,16),b:new i(e.b,16)}}):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:i.mont(e),r=new i(2).toRed(t).redInvm(),n=r.redNeg(),o=new i(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},u.prototype._getEndoBasis=function(e){for(var t,r,n,o,a,s,u,f,c,h=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=e,d=this.n.clone(),p=new i(1),y=new i(0),b=new i(0),m=new i(1),v=0;0!==l.cmpn(0);){var g=d.div(l);f=d.sub(g.mul(l)),c=b.sub(g.mul(p));var w=m.sub(g.mul(y));if(!n&&f.cmp(h)<0)t=u.neg(),r=p,n=f.neg(),o=c;else if(n&&2==++v)break;u=f,d=l,l=f,b=p,p=c,m=y,y=w}a=f.neg(),s=c;var _=n.sqr().add(o.sqr());return a.sqr().add(s.sqr()).cmp(_)>=0&&(a=t,s=r),n.negative&&(n=n.neg(),o=o.neg()),a.negative&&(a=a.neg(),s=s.neg()),[{a:n,b:o},{a:a,b:s}]},u.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),u=i.mul(r.b),f=o.mul(n.b);return{k1:e.sub(a).sub(s),k2:u.add(f).neg()}},u.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(t&&!o||!t&&o)&&(n=n.redNeg()),this.point(e,n)},u.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},f.prototype.isInfinity=function(){return this.inf},f.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},f.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},f.prototype.getX=function(){return this.x.fromRed()},f.prototype.getY=function(){return this.y.fromRed()},f.prototype.mul=function(e){return e=new i(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},f.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},f.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},f.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},f.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},f.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(c,a.BasePoint),u.prototype.jpoint=function(e,t,r){return new c(this,e,t,r)},c.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},c.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},c.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=n.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=s.redSqr(),c=f.redMul(s),h=n.redMul(f),l=u.redSqr().redIAdd(c).redISub(h).redISub(h),d=u.redMul(h.redISub(l)).redISub(o.redMul(c)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(l,d,p)},c.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),f=u.redMul(a),c=r.redMul(u),h=s.redSqr().redIAdd(f).redISub(c).redISub(c),l=s.redMul(c.redISub(h)).redISub(i.redMul(f)),d=this.z.redMul(a);return this.curve.jpoint(h,l,d)},c.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../utils":70,"./base":57,"bn.js":45,inherits:97}],62:[function(e,t,r){"use strict";var n,i=r,o=e("hash.js"),a=e("./curve"),s=e("./utils").assert;function u(e){"short"===e.type?this.curve=new a.short(e):"edwards"===e.type?this.curve=new a.edwards(e):this.curve=new a.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function f(e,t){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var r=new u(t);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=u,f("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),f("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),f("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),f("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),f("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),f("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),f("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=e("./precomputed/secp256k1")}catch(e){n=void 0}f("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},{"./curve":59,"./precomputed/secp256k1":69,"./utils":70,"hash.js":83}],63:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("hmac-drbg"),o=e("../utils"),a=e("../curves"),s=e("brorand"),u=o.assert,f=e("./key"),c=e("./signature");function h(e){if(!(this instanceof h))return new h(e);"string"==typeof e&&(u(Object.prototype.hasOwnProperty.call(a,e),"Unknown curve "+e),e=a[e]),e instanceof a.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}t.exports=h,h.prototype.keyPair=function(e){return new f(this,e)},h.prototype.keyFromPrivate=function(e,t){return f.fromPrivate(this,e,t)},h.prototype.keyFromPublic=function(e,t){return f.fromPublic(this,e,t)},h.prototype.genKeyPair=function(e){e||(e={});for(var t=new i({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||s(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new n(2));;){var a=new n(t.generate(r));if(!(a.cmp(o)>0))return a.iaddn(1),this.keyFromPrivate(a)}},h.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},h.prototype.sign=function(e,t,r,o){"object"==typeof r&&(o=r,r=null),o||(o={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new n(e,16));for(var a=this.n.byteLength(),s=t.getPrivate().toArray("be",a),u=e.toArray("be",a),f=new i({hash:this.hash,entropy:s,nonce:u,pers:o.pers,persEnc:o.persEnc||"utf8"}),h=this.n.sub(new n(1)),l=0;;l++){var d=o.k?o.k(l):new n(f.generate(this.n.byteLength()));if(!((d=this._truncateToN(d,!0)).cmpn(1)<=0||d.cmp(h)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var y=p.getX(),b=y.umod(this.n);if(0!==b.cmpn(0)){var m=d.invm(this.n).mul(b.mul(t.getPrivate()).iadd(e));if(0!==(m=m.umod(this.n)).cmpn(0)){var v=(p.getY().isOdd()?1:0)|(0!==y.cmp(b)?2:0);return o.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),v^=1),new c({r:b,s:m,recoveryParam:v})}}}}}},h.prototype.verify=function(e,t,r,i){e=this._truncateToN(new n(e,16)),r=this.keyFromPublic(r,i);var o=(t=new c(t,"hex")).r,a=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var s,u=a.invm(this.n),f=u.mul(e).umod(this.n),h=u.mul(o).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(f,r.getPublic(),h)).isInfinity()&&s.eqXToP(o):!(s=this.g.mulAdd(f,r.getPublic(),h)).isInfinity()&&0===s.getX().umod(this.n).cmp(o)},h.prototype.recoverPubKey=function(e,t,r,i){u((3&r)===r,"The recovery param is more than two bits"),t=new c(t,i);var o=this.n,a=new n(e),s=t.r,f=t.s,h=1&r,l=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");s=l?this.curve.pointFromX(s.add(this.curve.n),h):this.curve.pointFromX(s,h);var d=t.r.invm(o),p=o.sub(a).mul(d).umod(o),y=f.mul(d).umod(o);return this.g.mulAdd(p,s,y)},h.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new c(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},{"../curves":62,"../utils":70,"./key":64,"./signature":65,"bn.js":45,brorand:46,"hmac-drbg":95}],64:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("../utils").assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}t.exports=o,o.fromPublic=function(e,t,r){return t instanceof o?t:new o(e,{pub:t,pubEnc:r})},o.fromPrivate=function(e,t,r){return t instanceof o?t:new o(e,{priv:t,privEnc:r})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.validate()||i(e.validate(),"public point not validated"),e.mul(this.priv).getX()},o.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){return""}},{"../utils":70,"bn.js":45}],65:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("../utils"),o=i.assert;function a(e,t){if(e instanceof a)return e;this._importDER(e,t)||(o(e.r&&e.s,"Signature without r or s"),this.r=new n(e.r,16),this.s=new n(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function s(){this.place=0}function u(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,a=t.place;o>>=0;return!(i<=127)&&(t.place=a,i)}function f(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}t.exports=a,a.prototype._importDER=function(e,t){e=i.toArray(e,t);var r=new s;if(48!==e[r.place++])return!1;var o=u(e,r);if(!1===o)return!1;if(o+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var a=u(e,r);if(!1===a)return!1;var f=e.slice(r.place,a+r.place);if(r.place+=a,2!==e[r.place++])return!1;var c=u(e,r);if(!1===c)return!1;if(e.length!==c+r.place)return!1;var h=e.slice(r.place,c+r.place);if(0===f[0]){if(!(128&f[1]))return!1;f=f.slice(1)}if(0===h[0]){if(!(128&h[1]))return!1;h=h.slice(1)}return this.r=new n(f),this.s=new n(h),this.recoveryParam=null,!0},a.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=f(t),r=f(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];c(n,t.length),(n=n.concat(t)).push(2),c(n,r.length);var o=n.concat(r),a=[48];return c(a,o.length),a=a.concat(o),i.encode(a,e)}},{"../utils":70,"bn.js":45}],66:[function(e,t,r){"use strict";var n=e("hash.js"),i=e("../curves"),o=e("../utils"),a=o.assert,s=o.parseBytes,u=e("./key"),f=e("./signature");function c(e){if(a("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof c))return new c(e);e=i[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}t.exports=c,c.prototype.sign=function(e,t){e=s(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),o=this.encodePoint(i),a=this.hashInt(o,r.pubBytes(),e).mul(r.priv()),u=n.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:u,Rencoded:o})},c.prototype.verify=function(e,t,r){e=s(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(o)},c.prototype.hashInt=function(){for(var e=this.hash(),t=0;t(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,n[a]=s,o.iushrn(1)}return n},n.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var a,s,u=e.andln(3)+i&3,f=t.andln(3)+o&3;3===u&&(u=-1),3===f&&(f=-1),a=0==(1&u)?0:3!=(n=e.andln(7)+i&7)&&5!==n||2!==f?u:-u,r[0].push(a),s=0==(1&f)?0:3!=(n=t.andln(7)+o&7)&&5!==n||2!==u?f:-f,r[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},n.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(e){return"string"==typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new i(e,"hex","le")}},{"bn.js":45,"minimalistic-assert":103,"minimalistic-crypto-utils":104}],71:[function(e,t,r){t.exports={_args:[["elliptic@6.5.4","/Users/apple/casper"]],_from:"elliptic@6.5.4",_id:"elliptic@6.5.4",_inBundle:!1,_integrity:"sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==",_location:"/elliptic",_phantomChildren:{},_requested:{type:"version",registry:!0,raw:"elliptic@6.5.4",name:"elliptic",escapedName:"elliptic",rawSpec:"6.5.4",saveSpec:null,fetchSpec:"6.5.4"},_requiredBy:["/browserify-sign","/create-ecdh","/eccrypto","/eccrypto/secp256k1","/key-encoder","/secp256k1"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz",_spec:"6.5.4",_where:"/Users/apple/casper",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},description:"EC cryptography",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},files:["lib"],homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",test:"npm run lint && npm run unit",unit:"istanbul test _mocha --reporter=spec test/index.js",version:"grunt dist && git add dist/"},version:"6.5.4"}},{}],72:[function(e,t,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.createHashFunction=function(t){return function(r){var n=t();return n.update(r),e.from(n.digest())}}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:266}],73:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./vendor/hdkey-without-crypto");r.HDKey=n},{"./vendor/hdkey-without-crypto":78}],74:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("hash.js/lib/hash/ripemd").ripemd160,i=e("../hash-utils");r.ripemd160=i.createHashFunction(function(){return new n})},{"../hash-utils":72,"hash.js/lib/hash/ripemd":86}],75:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("hash.js/lib/hash/sha/256"),i=e("../hash-utils");r.sha256=i.createHashFunction(function(){return new n})},{"../hash-utils":72,"hash.js/lib/hash/sha/256":90}],76:[function(e,t,r){(function(t){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../ripemd160"),i=e("../sha256");r.createHmac=e("create-hmac"),r.randomBytes=e("randombytes");var o=function(){function e(e){this.hashFunction=e,this.buffers=[]}return e.prototype.update=function(e){if(!t.isBuffer(e))throw new Error("hdkey-crypto shim is outdated");return this.buffers.push(e),this},e.prototype.digest=function(e){if(e)throw new Error("hdkey-crypto shim is outdated");return this.hashFunction(t.concat(this.buffers))},e}();r.createHash=function(e){if("ripemd160"===e)return new o(n.ripemd160);if("sha256"===e)return new o(i.sha256);throw new Error("hdkey-crypto shim is outdated")}}).call(this)}).call(this,e("buffer").Buffer)},{"../ripemd160":74,"../sha256":75,buffer:266,"create-hmac":53,randombytes:105}],77:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),function(e){for(var t in e)r.hasOwnProperty(t)||(r[t]=e[t])}(e("../../shims/hdkey-secp256k1v3"))},{"../../shims/hdkey-secp256k1v3":81}],78:[function(e,t,r){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var i=n(e("assert")),o=n(e("safe-buffer")),a=n(e("bs58check")),s=e("../shims/hdkey-crypto"),u=e("../shims/hdkey-secp256k1v3"),f=o.Buffer,c=f.from("Bitcoin seed","utf8"),h=78,l={private:76066276,public:76067358};function d(e){this.versions=e||l,this.depth=0,this.index=0,this._privateKey=null,this._publicKey=null,this.chainCode=null,this._fingerprint=0,this.parentFingerprint=0}function p(e,t,r){var n=f.allocUnsafe(h);n.writeUInt32BE(t,0),n.writeUInt8(e.depth,4);var i=e.depth?e.parentFingerprint:0;return n.writeUInt32BE(i,5),n.writeUInt32BE(e.index,9),e.chainCode.copy(n,13),r.copy(n,45),n}function y(e){var t=s.createHash("sha256").update(e).digest();return s.createHash("ripemd160").update(t).digest()}Object.defineProperty(d.prototype,"fingerprint",{get:function(){return this._fingerprint}}),Object.defineProperty(d.prototype,"identifier",{get:function(){return this._identifier}}),Object.defineProperty(d.prototype,"pubKeyHash",{get:function(){return this.identifier}}),Object.defineProperty(d.prototype,"privateKey",{get:function(){return this._privateKey},set:function(e){i.equal(e.length,32,"Private key must be 32 bytes."),i(!0===u.privateKeyVerify(e),"Invalid private key"),this._privateKey=e,this._publicKey=u.publicKeyCreate(e,!0),this._identifier=y(this.publicKey),this._fingerprint=this._identifier.slice(0,4).readUInt32BE(0)}}),Object.defineProperty(d.prototype,"publicKey",{get:function(){return this._publicKey},set:function(e){i(33===e.length||65===e.length,"Public key must be 33 or 65 bytes."),i(!0===u.publicKeyVerify(e),"Invalid public key"),this._publicKey=u.publicKeyConvert(e,!0),this._identifier=y(this.publicKey),this._fingerprint=this._identifier.slice(0,4).readUInt32BE(0),this._privateKey=null}}),Object.defineProperty(d.prototype,"privateExtendedKey",{get:function(){return this._privateKey?a.encode(p(this,this.versions.private,f.concat([f.alloc(1,0),this.privateKey]))):null}}),Object.defineProperty(d.prototype,"publicExtendedKey",{get:function(){return a.encode(p(this,this.versions.public,this.publicKey))}}),d.prototype.derive=function(e){if("m"===e||"M"===e||"m'"===e||"M'"===e)return this;var t=e.split("/"),r=this;return t.forEach(function(e,t){if(0!==t){var n=e.length>1&&"'"===e[e.length-1],o=parseInt(e,10);i(o<2147483648,"Invalid index"),n&&(o+=2147483648),r=r.deriveChild(o)}else i(/^[mM]{1}/.test(e),'Path must start with "m" or "M"')}),r},d.prototype.deriveChild=function(e){var t,r=e>=2147483648,n=f.allocUnsafe(4);if(n.writeUInt32BE(e,0),r){i(this.privateKey,"Could not derive hardened child key");var o=this.privateKey,a=f.alloc(1,0);o=f.concat([a,o]),t=f.concat([o,n])}else t=f.concat([this.publicKey,n]);var c=s.createHmac("sha512",this.chainCode).update(t).digest(),h=c.slice(0,32),l=c.slice(32),p=new d(this.versions);if(this.privateKey)try{p.privateKey=u.privateKeyTweakAdd(this.privateKey,h)}catch(t){return this.deriveChild(e+1)}else try{p.publicKey=u.publicKeyTweakAdd(this.publicKey,h,!0)}catch(t){return this.deriveChild(e+1)}return p.chainCode=l,p.depth=this.depth+1,p.parentFingerprint=this.fingerprint,p.index=e,p},d.prototype.sign=function(e){return u.sign(e,this.privateKey).signature},d.prototype.verify=function(e,t){return u.verify(e,t,this.publicKey)},d.prototype.wipePrivateData=function(){return this._privateKey&&s.randomBytes(this._privateKey.length).copy(this._privateKey),this._privateKey=null,this},d.prototype.toJSON=function(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}},d.fromMasterSeed=function(e,t){var r=s.createHmac("sha512",c).update(e).digest(),n=r.slice(0,32),i=r.slice(32),o=new d(t);return o.chainCode=i,o.privateKey=n,o},d.fromExtendedKey=function(e,t){var r=new d(t=t||l),n=a.decode(e),o=n.readUInt32BE(0);i(o===t.private||o===t.public,"Version mismatch: does not match private or public"),r.depth=n.readUInt8(4),r.parentFingerprint=n.readUInt32BE(5),r.index=n.readUInt32BE(9),r.chainCode=n.slice(13,45);var s=n.slice(45);return 0===s.readUInt8(0)?(i(o===t.private,"Version mismatch: version does not match private"),r.privateKey=s.slice(1)):(i(o===t.public,"Version mismatch: version does not match public"),r.publicKey=s),r},d.fromJSON=function(e){return d.fromExtendedKey(e.xpriv)},d.HARDENED_OFFSET=2147483648;var b=d;t.exports=b},{"../shims/hdkey-crypto":76,"../shims/hdkey-secp256k1v3":77,assert:215,bs58check:49,"safe-buffer":122}],79:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("randombytes");r.getRandomBytes=function(e){return new Promise(function(t,r){n(e,function(e,n){e?r(e):t(n)})})},r.getRandomBytesSync=function(e){return n(e)}},{randombytes:105}],80:[function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function s(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}u((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=this._blockSize;){for(var o=this._blockOffset;o0;++a)this._length[a]+=s,(s=this._length[a]/4294967296|0)>0&&(this._length[a]-=4294967296*s);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},o.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=o},{inherits:97,"readable-stream":120,"safe-buffer":122}],83:[function(e,t,r){var n=r;n.utils=e("./hash/utils"),n.common=e("./hash/common"),n.sha=e("./hash/sha"),n.ripemd=e("./hash/ripemd"),n.hmac=e("./hash/hmac"),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},{"./hash/common":84,"./hash/hmac":85,"./hash/ripemd":86,"./hash/sha":87,"./hash/utils":94}],84:[function(e,t,r){"use strict";var n=e("./utils"),i=e("minimalistic-assert");function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}r.BlockHash=o,o.prototype.update=function(e,t){if(e=n.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=n.join32(e,0,e.length-r,this.endian);for(var i=0;i>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;othis.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t>>3},r.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},{"../utils":94}],94:[function(e,t,r){"use strict";var n=e("minimalistic-assert"),i=e("inherits");function o(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function a(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function s(e){return 1===e.length?"0"+e:e}function u(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}r.inherits=i,r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i>6|192,r[n++]=63&a|128):o(e,i)?(a=65536+((1023&a)<<10)+(1023&e.charCodeAt(++i)),r[n++]=a>>18|240,r[n++]=a>>12&63|128,r[n++]=a>>6&63|128,r[n++]=63&a|128):(r[n++]=a>>12|224,r[n++]=a>>6&63|128,r[n++]=63&a|128)}else for(i=0;i>>0}return a},r.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},r.rotr32=function(e,t){return e>>>t|e<<32-t},r.rotl32=function(e,t){return e<>>32-t},r.sum32=function(e,t){return e+t>>>0},r.sum32_3=function(e,t,r){return e+t+r>>>0},r.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},r.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},r.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,a=(o>>0,e[t+1]=o},r.sum64_hi=function(e,t,r,n){return(t+n>>>0>>0},r.sum64_lo=function(e,t,r,n){return t+n>>>0},r.sum64_4_hi=function(e,t,r,n,i,o,a,s){var u=0,f=t;return u+=(f=f+n>>>0)>>0)>>0)>>0},r.sum64_4_lo=function(e,t,r,n,i,o,a,s){return t+n+o+s>>>0},r.sum64_5_hi=function(e,t,r,n,i,o,a,s,u,f){var c=0,h=t;return c+=(h=h+n>>>0)>>0)>>0)>>0)>>0},r.sum64_5_lo=function(e,t,r,n,i,o,a,s,u,f){return t+n+o+s+f>>>0},r.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},r.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},r.shr64_hi=function(e,t,r){return e>>>r},r.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},{inherits:97,"minimalistic-assert":103}],95:[function(e,t,r){"use strict";var n=e("hash.js"),i=e("minimalistic-crypto-utils"),o=e("minimalistic-assert");function a(e){if(!(this instanceof a))return new a(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=i.toArray(e.entropy,e.entropyEnc||"hex"),r=i.toArray(e.nonce,e.nonceEnc||"hex"),n=i.toArray(e.pers,e.persEnc||"hex");o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}t.exports=a,a.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},a.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length2&&e<11?"دقائق":"دقيقة"},s:function(e){return 1===e?"ثانية":"ثواني"},ms:function(e){return 1===e?"جزء من الثانية":"أجزاء من الثانية"},decimal:","},bg:{y:function(e){return["години","година","години"][u(e)]},mo:function(e){return["месеца","месец","месеца"][u(e)]},w:function(e){return["седмици","седмица","седмици"][u(e)]},d:function(e){return["дни","ден","дни"][u(e)]},h:function(e){return["часа","час","часа"][u(e)]},m:function(e){return["минути","минута","минути"][u(e)]},s:function(e){return["секунди","секунда","секунди"][u(e)]},ms:function(e){return["милисекунди","милисекунда","милисекунди"][u(e)]},decimal:","},ca:{y:function(e){return"any"+(1===e?"":"s")},mo:function(e){return"mes"+(1===e?"":"os")},w:function(e){return"setman"+(1===e?"a":"es")},d:function(e){return"di"+(1===e?"a":"es")},h:function(e){return"hor"+(1===e?"a":"es")},m:function(e){return"minut"+(1===e?"":"s")},s:function(e){return"segon"+(1===e?"":"s")},ms:function(e){return"milisegon"+(1===e?"":"s")},decimal:","},cs:{y:function(e){return["rok","roku","roky","let"][f(e)]},mo:function(e){return["měsíc","měsíce","měsíce","měsíců"][f(e)]},w:function(e){return["týden","týdne","týdny","týdnů"][f(e)]},d:function(e){return["den","dne","dny","dní"][f(e)]},h:function(e){return["hodina","hodiny","hodiny","hodin"][f(e)]},m:function(e){return["minuta","minuty","minuty","minut"][f(e)]},s:function(e){return["sekunda","sekundy","sekundy","sekund"][f(e)]},ms:function(e){return["milisekunda","milisekundy","milisekundy","milisekund"][f(e)]},decimal:","},da:{y:"år",mo:function(e){return"måned"+(1===e?"":"er")},w:function(e){return"uge"+(1===e?"":"r")},d:function(e){return"dag"+(1===e?"":"e")},h:function(e){return"time"+(1===e?"":"r")},m:function(e){return"minut"+(1===e?"":"ter")},s:function(e){return"sekund"+(1===e?"":"er")},ms:function(e){return"millisekund"+(1===e?"":"er")},decimal:","},de:{y:function(e){return"Jahr"+(1===e?"":"e")},mo:function(e){return"Monat"+(1===e?"":"e")},w:function(e){return"Woche"+(1===e?"":"n")},d:function(e){return"Tag"+(1===e?"":"e")},h:function(e){return"Stunde"+(1===e?"":"n")},m:function(e){return"Minute"+(1===e?"":"n")},s:function(e){return"Sekunde"+(1===e?"":"n")},ms:function(e){return"Millisekunde"+(1===e?"":"n")},decimal:","},el:e,en:{y:function(e){return"year"+(1===e?"":"s")},mo:function(e){return"month"+(1===e?"":"s")},w:function(e){return"week"+(1===e?"":"s")},d:function(e){return"day"+(1===e?"":"s")},h:function(e){return"hour"+(1===e?"":"s")},m:function(e){return"minute"+(1===e?"":"s")},s:function(e){return"second"+(1===e?"":"s")},ms:function(e){return"millisecond"+(1===e?"":"s")},decimal:"."},es:{y:function(e){return"año"+(1===e?"":"s")},mo:function(e){return"mes"+(1===e?"":"es")},w:function(e){return"semana"+(1===e?"":"s")},d:function(e){return"día"+(1===e?"":"s")},h:function(e){return"hora"+(1===e?"":"s")},m:function(e){return"minuto"+(1===e?"":"s")},s:function(e){return"segundo"+(1===e?"":"s")},ms:function(e){return"milisegundo"+(1===e?"":"s")},decimal:","},et:{y:function(e){return"aasta"+(1===e?"":"t")},mo:function(e){return"kuu"+(1===e?"":"d")},w:function(e){return"nädal"+(1===e?"":"at")},d:function(e){return"päev"+(1===e?"":"a")},h:function(e){return"tund"+(1===e?"":"i")},m:function(e){return"minut"+(1===e?"":"it")},s:function(e){return"sekund"+(1===e?"":"it")},ms:function(e){return"millisekund"+(1===e?"":"it")},decimal:","},fa:{y:"سال",mo:"ماه",w:"هفته",d:"روز",h:"ساعت",m:"دقیقه",s:"ثانیه",ms:"میلی ثانیه",decimal:"."},fi:{y:function(e){return 1===e?"vuosi":"vuotta"},mo:function(e){return 1===e?"kuukausi":"kuukautta"},w:function(e){return"viikko"+(1===e?"":"a")},d:function(e){return"päivä"+(1===e?"":"ä")},h:function(e){return"tunti"+(1===e?"":"a")},m:function(e){return"minuutti"+(1===e?"":"a")},s:function(e){return"sekunti"+(1===e?"":"a")},ms:function(e){return"millisekunti"+(1===e?"":"a")},decimal:","},fo:{y:"ár",mo:function(e){return 1===e?"mánaður":"mánaðir"},w:function(e){return 1===e?"vika":"vikur"},d:function(e){return 1===e?"dagur":"dagar"},h:function(e){return 1===e?"tími":"tímar"},m:function(e){return 1===e?"minuttur":"minuttir"},s:"sekund",ms:"millisekund",decimal:","},fr:{y:function(e){return"an"+(e>=2?"s":"")},mo:"mois",w:function(e){return"semaine"+(e>=2?"s":"")},d:function(e){return"jour"+(e>=2?"s":"")},h:function(e){return"heure"+(e>=2?"s":"")},m:function(e){return"minute"+(e>=2?"s":"")},s:function(e){return"seconde"+(e>=2?"s":"")},ms:function(e){return"milliseconde"+(e>=2?"s":"")},decimal:","},gr:e,he:{y:function(e){return 1===e?"שנה":"שנים"},mo:function(e){return 1===e?"חודש":"חודשים"},w:function(e){return 1===e?"שבוע":"שבועות"},d:function(e){return 1===e?"יום":"ימים"},h:function(e){return 1===e?"שעה":"שעות"},m:function(e){return 1===e?"דקה":"דקות"},s:function(e){return 1===e?"שניה":"שניות"},ms:function(e){return 1===e?"מילישנייה":"מילישניות"},decimal:"."},hr:{y:function(e){return e%10==2||e%10==3||e%10==4?"godine":"godina"},mo:function(e){return 1===e?"mjesec":2===e||3===e||4===e?"mjeseca":"mjeseci"},w:function(e){return e%10==1&&11!==e?"tjedan":"tjedna"},d:function(e){return 1===e?"dan":"dana"},h:function(e){return 1===e?"sat":2===e||3===e||4===e?"sata":"sati"},m:function(e){var t=e%10;return 2!==t&&3!==t&&4!==t||!(e<10||e>14)?"minuta":"minute"},s:function(e){var t=e%10;return 5===t||Math.floor(e)===e&&e>=10&&e<=19?"sekundi":1===t?"sekunda":2===t||3===t||4===t?"sekunde":"sekundi"},ms:function(e){return 1===e?"milisekunda":e%10==2||e%10==3||e%10==4?"milisekunde":"milisekundi"},decimal:","},hi:{y:"साल",mo:function(e){return 1===e?"महीना":"महीने"},w:function(e){return 1===e?"हफ़्ता":"हफ्ते"},d:"दिन",h:function(e){return 1===e?"घंटा":"घंटे"},m:"मिनट",s:"सेकंड",ms:"मिलीसेकंड",decimal:"."},hu:{y:"év",mo:"hónap",w:"hét",d:"nap",h:"óra",m:"perc",s:"másodperc",ms:"ezredmásodperc",decimal:","},id:{y:"tahun",mo:"bulan",w:"minggu",d:"hari",h:"jam",m:"menit",s:"detik",ms:"milidetik",decimal:"."},is:{y:"ár",mo:function(e){return"mánuð"+(1===e?"ur":"ir")},w:function(e){return"vik"+(1===e?"a":"ur")},d:function(e){return"dag"+(1===e?"ur":"ar")},h:function(e){return"klukkutím"+(1===e?"i":"ar")},m:function(e){return"mínút"+(1===e?"a":"ur")},s:function(e){return"sekúnd"+(1===e?"a":"ur")},ms:function(e){return"millisekúnd"+(1===e?"a":"ur")},decimal:"."},it:{y:function(e){return"ann"+(1===e?"o":"i")},mo:function(e){return"mes"+(1===e?"e":"i")},w:function(e){return"settiman"+(1===e?"a":"e")},d:function(e){return"giorn"+(1===e?"o":"i")},h:function(e){return"or"+(1===e?"a":"e")},m:function(e){return"minut"+(1===e?"o":"i")},s:function(e){return"second"+(1===e?"o":"i")},ms:function(e){return"millisecond"+(1===e?"o":"i")},decimal:","},ja:{y:"年",mo:"月",w:"週",d:"日",h:"時間",m:"分",s:"秒",ms:"ミリ秒",decimal:"."},ko:{y:"년",mo:"개월",w:"주일",d:"일",h:"시간",m:"분",s:"초",ms:"밀리 초",decimal:"."},lo:{y:"ປີ",mo:"ເດືອນ",w:"ອາທິດ",d:"ມື້",h:"ຊົ່ວໂມງ",m:"ນາທີ",s:"ວິນາທີ",ms:"ມິນລິວິນາທີ",decimal:","},lt:{y:function(e){return e%10==0||e%100>=10&&e%100<=20?"metų":"metai"},mo:function(e){return["mėnuo","mėnesiai","mėnesių"][c(e)]},w:function(e){return["savaitė","savaitės","savaičių"][c(e)]},d:function(e){return["diena","dienos","dienų"][c(e)]},h:function(e){return["valanda","valandos","valandų"][c(e)]},m:function(e){return["minutė","minutės","minučių"][c(e)]},s:function(e){return["sekundė","sekundės","sekundžių"][c(e)]},ms:function(e){return["milisekundė","milisekundės","milisekundžių"][c(e)]},decimal:","},lv:{y:function(e){return h(e)?"gads":"gadi"},mo:function(e){return h(e)?"mēnesis":"mēneši"},w:function(e){return h(e)?"nedēļa":"nedēļas"},d:function(e){return h(e)?"diena":"dienas"},h:function(e){return h(e)?"stunda":"stundas"},m:function(e){return h(e)?"minūte":"minūtes"},s:function(e){return h(e)?"sekunde":"sekundes"},ms:function(e){return h(e)?"milisekunde":"milisekundes"},decimal:","},ms:{y:"tahun",mo:"bulan",w:"minggu",d:"hari",h:"jam",m:"minit",s:"saat",ms:"milisaat",decimal:"."},nl:{y:"jaar",mo:function(e){return 1===e?"maand":"maanden"},w:function(e){return 1===e?"week":"weken"},d:function(e){return 1===e?"dag":"dagen"},h:"uur",m:function(e){return 1===e?"minuut":"minuten"},s:function(e){return 1===e?"seconde":"seconden"},ms:function(e){return 1===e?"milliseconde":"milliseconden"},decimal:","},no:{y:"år",mo:function(e){return"måned"+(1===e?"":"er")},w:function(e){return"uke"+(1===e?"":"r")},d:function(e){return"dag"+(1===e?"":"er")},h:function(e){return"time"+(1===e?"":"r")},m:function(e){return"minutt"+(1===e?"":"er")},s:function(e){return"sekund"+(1===e?"":"er")},ms:function(e){return"millisekund"+(1===e?"":"er")},decimal:","},pl:{y:function(e){return["rok","roku","lata","lat"][s(e)]},mo:function(e){return["miesiąc","miesiąca","miesiące","miesięcy"][s(e)]},w:function(e){return["tydzień","tygodnia","tygodnie","tygodni"][s(e)]},d:function(e){return["dzień","dnia","dni","dni"][s(e)]},h:function(e){return["godzina","godziny","godziny","godzin"][s(e)]},m:function(e){return["minuta","minuty","minuty","minut"][s(e)]},s:function(e){return["sekunda","sekundy","sekundy","sekund"][s(e)]},ms:function(e){return["milisekunda","milisekundy","milisekundy","milisekund"][s(e)]},decimal:","},pt:{y:function(e){return"ano"+(1===e?"":"s")},mo:function(e){return 1===e?"mês":"meses"},w:function(e){return"semana"+(1===e?"":"s")},d:function(e){return"dia"+(1===e?"":"s")},h:function(e){return"hora"+(1===e?"":"s")},m:function(e){return"minuto"+(1===e?"":"s")},s:function(e){return"segundo"+(1===e?"":"s")},ms:function(e){return"milissegundo"+(1===e?"":"s")},decimal:","},ro:{y:function(e){return 1===e?"an":"ani"},mo:function(e){return 1===e?"lună":"luni"},w:function(e){return 1===e?"săptămână":"săptămâni"},d:function(e){return 1===e?"zi":"zile"},h:function(e){return 1===e?"oră":"ore"},m:function(e){return 1===e?"minut":"minute"},s:function(e){return 1===e?"secundă":"secunde"},ms:function(e){return 1===e?"milisecundă":"milisecunde"},decimal:","},ru:{y:function(e){return["лет","год","года"][u(e)]},mo:function(e){return["месяцев","месяц","месяца"][u(e)]},w:function(e){return["недель","неделя","недели"][u(e)]},d:function(e){return["дней","день","дня"][u(e)]},h:function(e){return["часов","час","часа"][u(e)]},m:function(e){return["минут","минута","минуты"][u(e)]},s:function(e){return["секунд","секунда","секунды"][u(e)]},ms:function(e){return["миллисекунд","миллисекунда","миллисекунды"][u(e)]},decimal:","},uk:{y:function(e){return["років","рік","роки"][u(e)]},mo:function(e){return["місяців","місяць","місяці"][u(e)]},w:function(e){return["тижнів","тиждень","тижні"][u(e)]},d:function(e){return["днів","день","дні"][u(e)]},h:function(e){return["годин","година","години"][u(e)]},m:function(e){return["хвилин","хвилина","хвилини"][u(e)]},s:function(e){return["секунд","секунда","секунди"][u(e)]},ms:function(e){return["мілісекунд","мілісекунда","мілісекунди"][u(e)]},decimal:","},ur:{y:"سال",mo:function(e){return 1===e?"مہینہ":"مہینے"},w:function(e){return 1===e?"ہفتہ":"ہفتے"},d:"دن",h:function(e){return 1===e?"گھنٹہ":"گھنٹے"},m:"منٹ",s:"سیکنڈ",ms:"ملی سیکنڈ",decimal:"."},sk:{y:function(e){return["rok","roky","roky","rokov"][f(e)]},mo:function(e){return["mesiac","mesiace","mesiace","mesiacov"][f(e)]},w:function(e){return["týždeň","týždne","týždne","týždňov"][f(e)]},d:function(e){return["deň","dni","dni","dní"][f(e)]},h:function(e){return["hodina","hodiny","hodiny","hodín"][f(e)]},m:function(e){return["minúta","minúty","minúty","minút"][f(e)]},s:function(e){return["sekunda","sekundy","sekundy","sekúnd"][f(e)]},ms:function(e){return["milisekunda","milisekundy","milisekundy","milisekúnd"][f(e)]},decimal:","},sl:{y:function(e){return e%10==1?"leto":e%100==2?"leti":e%100==3||e%100==4||Math.floor(e)!==e&&e%100<=5?"leta":"let"},mo:function(e){return e%10==1?"mesec":e%100==2||Math.floor(e)!==e&&e%100<=5?"meseca":e%10==3||e%10==4?"mesece":"mesecev"},w:function(e){return e%10==1?"teden":e%10==2||Math.floor(e)!==e&&e%100<=4?"tedna":e%10==3||e%10==4?"tedne":"tednov"},d:function(e){return e%100==1?"dan":"dni"},h:function(e){return e%10==1?"ura":e%100==2?"uri":e%10==3||e%10==4||Math.floor(e)!==e?"ure":"ur"},m:function(e){return e%10==1?"minuta":e%10==2?"minuti":e%10==3||e%10==4||Math.floor(e)!==e&&e%100<=4?"minute":"minut"},s:function(e){return e%10==1?"sekunda":e%100==2?"sekundi":e%100==3||e%100==4||Math.floor(e)!==e?"sekunde":"sekund"},ms:function(e){return e%10==1?"milisekunda":e%100==2?"milisekundi":e%100==3||e%100==4||Math.floor(e)!==e?"milisekunde":"milisekund"},decimal:","},sv:{y:"år",mo:function(e){return"månad"+(1===e?"":"er")},w:function(e){return"veck"+(1===e?"a":"or")},d:function(e){return"dag"+(1===e?"":"ar")},h:function(e){return"timm"+(1===e?"e":"ar")},m:function(e){return"minut"+(1===e?"":"er")},s:function(e){return"sekund"+(1===e?"":"er")},ms:function(e){return"millisekund"+(1===e?"":"er")},decimal:","},sw:{y:function(e){return 1===e?"mwaka":"miaka"},mo:function(e){return 1===e?"mwezi":"miezi"},w:"wiki",d:function(e){return 1===e?"siku":"masiku"},h:function(e){return 1===e?"saa":"masaa"},m:"dakika",s:"sekunde",ms:"milisekunde",decimal:"."},tr:{y:"yıl",mo:"ay",w:"hafta",d:"gün",h:"saat",m:"dakika",s:"saniye",ms:"milisaniye",decimal:","},th:{y:"ปี",mo:"เดือน",w:"สัปดาห์",d:"วัน",h:"ชั่วโมง",m:"นาที",s:"วินาที",ms:"มิลลิวินาที",decimal:"."},vi:{y:"năm",mo:"tháng",w:"tuần",d:"ngày",h:"giờ",m:"phút",s:"giây",ms:"mili giây",decimal:","},zh_CN:{y:"年",mo:"个月",w:"周",d:"天",h:"小时",m:"分钟",s:"秒",ms:"毫秒",decimal:"."},zh_TW:{y:"年",mo:"個月",w:"周",d:"天",h:"小時",m:"分鐘",s:"秒",ms:"毫秒",decimal:"."}};function n(e){var t=function(e,n){return function(e,t){var n,i,a;e=Math.abs(e);var s,u,f,c=function(e){var t=[e.language];if(d(e,"fallbacks")){if(!l(e.fallbacks)||!e.fallbacks.length)throw new Error("fallbacks must be an array with at least one element");t=t.concat(e.fallbacks)}for(var n=0;n=0&&((a=h[n]).unitCount=Math.round(a.unitCount),0!==n);n--)m=h[n-1],b=t.unitMeasures[m.unitName]/t.unitMeasures[a.unitName],(a.unitCount%b==0||t.largest&&t.largest-12)return g.slice(0,-1).join(t.delimiter)+(t.serialComma?",":"")+t.conjunction+g.slice(-1)}(e,a({},t,n||{}))};return a(t,{language:"en",delimiter:", ",spacer:" ",conjunction:"",serialComma:!0,units:["y","mo","w","d","h","m","s"],languages:{},round:!1,unitMeasures:{y:315576e5,mo:26298e5,w:6048e5,d:864e5,h:36e5,m:6e4,s:1e3,ms:1}},e)}var i=n({});function o(e,t,r,n){var i;i=d(n,"decimal")?n.decimal:d(r,"decimal")?r.decimal:".";var o,a=e.toString().replace(".",i),s=r[t];return o="function"==typeof s?s(e):s,a+n.spacer+o}function a(e){for(var t,r=1;r=2&&e%10<=4&&!(e%100>10&&e%100<20)?2:3}function u(e){return Math.floor(e)!==e?2:e%100>=5&&e%100<=20||e%10>=5&&e%10<=9||e%10==0?0:e%10==1?1:e>1?2:0}function f(e){return 1===e?0:Math.floor(e)!==e?1:e%10>=2&&e%10<=4&&e%100<10?2:3}function c(e){return 1===e||e%10==1&&e%100>20?0:Math.floor(e)!==e||e%10>=2&&e%100>20||e%10>=2&&e%100<10?1:2}function h(e){return e%10==1&&e%100!=11}var l=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function d(e,t){return Object.prototype.hasOwnProperty.call(e,t)}i.getSupportedLanguages=function(){var e=[];for(var t in r)d(r,t)&&"gr"!==t&&e.push(t);return e},i.humanizer=n,void 0!==t&&t.exports?t.exports=i:this.humanizeDuration=i}()},{}],97:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},{}],98:[function(e,t,r){e("whatwg-fetch"),t.exports=self.fetch.bind(self)},{"whatwg-fetch":180}],99:[function(e,t,r){(function(e){(function(){var r=null;"undefined"!=typeof WebSocket?r=WebSocket:"undefined"!=typeof MozWebSocket?r=MozWebSocket:void 0!==e?r=e.WebSocket||e.MozWebSocket:"undefined"!=typeof window?r=window.WebSocket||window.MozWebSocket:"undefined"!=typeof self&&(r=self.WebSocket||self.MozWebSocket),t.exports=r}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],100:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=e("./key-encoder");r.default=n.default},{"./key-encoder":101}],101:[function(e,t,r){(function(t){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=e("elliptic"),i=e("asn1.js"),o=e("bn.js"),a=i.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").explicit(0).objid().optional(),this.key("publicKey").explicit(1).bitstr().optional())}),s=i.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("curve").objid()),this.key("pub").bitstr())}),u={secp256k1:{curveParameters:[1,3,132,0,10],privatePEMOptions:{label:"EC PRIVATE KEY"},publicPEMOptions:{label:"PUBLIC KEY"},curve:new n.ec("secp256k1")}};class f{constructor(e){if("string"==typeof e){if("secp256k1"!==e)throw new Error("Unknown curve "+e);e=u[e]}this.options=e,this.algorithmID=[1,2,840,10045,2,1]}privateKeyObject(e,r){const n={version:new o(1),privateKey:t.from(e,"hex"),parameters:this.options.curveParameters};return r&&(n.publicKey={unused:0,data:t.from(r,"hex")}),n}publicKeyObject(e){return{algorithm:{id:this.algorithmID,curve:this.options.curveParameters},pub:{unused:0,data:t.from(e,"hex")}}}encodePrivate(e,r,n){let i;if("raw"===r){if("string"!=typeof e)throw"private key must be a string";let t=this.options.curve.keyFromPrivate(e,"hex").getPublic("hex");i=this.privateKeyObject(e,t)}else if("der"===r){if("string"!=typeof e);else{if("string"!=typeof e)throw"private key must be a buffer or a string";e=t.from(e,"hex")}i=a.decode(e,"der")}else{if("pem"!==r)throw"invalid private key format";if("string"!=typeof e)throw"private key must be a string";i=a.decode(e,"pem",this.options.privatePEMOptions)}if("raw"===n)return i.privateKey.toString("hex");if("der"===n)return a.encode(i,"der").toString("hex");if("pem"===n)return a.encode(i,"pem",this.options.privatePEMOptions);throw"invalid destination format for private key"}encodePublic(e,r,n){let i;if("raw"===r){if("string"!=typeof e)throw"public key must be a string";i=this.publicKeyObject(e)}else if("der"===r){if("string"!=typeof e);else{if("string"!=typeof e)throw"public key must be a buffer or a string";e=t.from(e,"hex")}i=s.decode(e,"der")}else{if("pem"!==r)throw"invalid public key format";if("string"!=typeof e)throw"public key must be a string";i=s.decode(e,"pem",this.options.publicPEMOptions)}if("raw"===n)return i.pub.data.toString("hex");if("der"===n)return s.encode(i,"der").toString("hex");if("pem"===n)return s.encode(i,"pem",this.options.publicPEMOptions);throw"invalid destination format for public key"}}r.default=f,f.ECPrivateKeyASN=a,f.SubjectPublicKeyInfoASN=s}).call(this)}).call(this,e("buffer").Buffer)},{"asn1.js":26,"bn.js":45,buffer:266,elliptic:56}],102:[function(e,t,r){"use strict";var n=e("inherits"),i=e("hash-base"),o=e("safe-buffer").Buffer,a=new Array(16);function s(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(e,t){return e<>>32-t}function f(e,t,r,n,i,o,a){return u(e+(t&r|~t&n)+i+o|0,a)+t|0}function c(e,t,r,n,i,o,a){return u(e+(t&n|r&~n)+i+o|0,a)+t|0}function h(e,t,r,n,i,o,a){return u(e+(t^r^n)+i+o|0,a)+t|0}function l(e,t,r,n,i,o,a){return u(e+(r^(t|~n))+i+o|0,a)+t|0}n(s,i),s.prototype._update=function(){for(var e=a,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,o=this._d;r=f(r,n,i,o,e[0],3614090360,7),o=f(o,r,n,i,e[1],3905402710,12),i=f(i,o,r,n,e[2],606105819,17),n=f(n,i,o,r,e[3],3250441966,22),r=f(r,n,i,o,e[4],4118548399,7),o=f(o,r,n,i,e[5],1200080426,12),i=f(i,o,r,n,e[6],2821735955,17),n=f(n,i,o,r,e[7],4249261313,22),r=f(r,n,i,o,e[8],1770035416,7),o=f(o,r,n,i,e[9],2336552879,12),i=f(i,o,r,n,e[10],4294925233,17),n=f(n,i,o,r,e[11],2304563134,22),r=f(r,n,i,o,e[12],1804603682,7),o=f(o,r,n,i,e[13],4254626195,12),i=f(i,o,r,n,e[14],2792965006,17),r=c(r,n=f(n,i,o,r,e[15],1236535329,22),i,o,e[1],4129170786,5),o=c(o,r,n,i,e[6],3225465664,9),i=c(i,o,r,n,e[11],643717713,14),n=c(n,i,o,r,e[0],3921069994,20),r=c(r,n,i,o,e[5],3593408605,5),o=c(o,r,n,i,e[10],38016083,9),i=c(i,o,r,n,e[15],3634488961,14),n=c(n,i,o,r,e[4],3889429448,20),r=c(r,n,i,o,e[9],568446438,5),o=c(o,r,n,i,e[14],3275163606,9),i=c(i,o,r,n,e[3],4107603335,14),n=c(n,i,o,r,e[8],1163531501,20),r=c(r,n,i,o,e[13],2850285829,5),o=c(o,r,n,i,e[2],4243563512,9),i=c(i,o,r,n,e[7],1735328473,14),r=h(r,n=c(n,i,o,r,e[12],2368359562,20),i,o,e[5],4294588738,4),o=h(o,r,n,i,e[8],2272392833,11),i=h(i,o,r,n,e[11],1839030562,16),n=h(n,i,o,r,e[14],4259657740,23),r=h(r,n,i,o,e[1],2763975236,4),o=h(o,r,n,i,e[4],1272893353,11),i=h(i,o,r,n,e[7],4139469664,16),n=h(n,i,o,r,e[10],3200236656,23),r=h(r,n,i,o,e[13],681279174,4),o=h(o,r,n,i,e[0],3936430074,11),i=h(i,o,r,n,e[3],3572445317,16),n=h(n,i,o,r,e[6],76029189,23),r=h(r,n,i,o,e[9],3654602809,4),o=h(o,r,n,i,e[12],3873151461,11),i=h(i,o,r,n,e[15],530742520,16),r=l(r,n=h(n,i,o,r,e[2],3299628645,23),i,o,e[0],4096336452,6),o=l(o,r,n,i,e[7],1126891415,10),i=l(i,o,r,n,e[14],2878612391,15),n=l(n,i,o,r,e[5],4237533241,21),r=l(r,n,i,o,e[12],1700485571,6),o=l(o,r,n,i,e[3],2399980690,10),i=l(i,o,r,n,e[10],4293915773,15),n=l(n,i,o,r,e[1],2240044497,21),r=l(r,n,i,o,e[8],1873313359,6),o=l(o,r,n,i,e[15],4264355552,10),i=l(i,o,r,n,e[6],2734768916,15),n=l(n,i,o,r,e[13],1309151649,21),r=l(r,n,i,o,e[4],4149444226,6),o=l(o,r,n,i,e[11],3174756917,10),i=l(i,o,r,n,e[2],718787259,15),n=l(n,i,o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},s.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=o.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},t.exports=s},{"hash-base":82,inherits:97,"safe-buffer":122}],103:[function(e,t,r){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}t.exports=n,n.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},{}],104:[function(e,t,r){"use strict";var n=r;function i(e){return 1===e.length?"0"+e:e}function o(e){for(var t="",r=0;r>8,a=255&i;o?r.push(o,a):r.push(a)}return r},n.zero2=i,n.toHex=o,n.encode=function(e,t){return"hex"===t?o(e):e}},{}],105:[function(e,t,r){(function(r,n){(function(){"use strict";var i=65536,o=4294967295;var a=e("safe-buffer").Buffer,s=n.crypto||n.msCrypto;s&&s.getRandomValues?t.exports=function(e,t){if(e>o)throw new RangeError("requested too many random bytes");var n=a.allocUnsafe(e);if(e>0)if(e>i)for(var u=0;u2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}i("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),i("ERR_INVALID_ARG_TYPE",function(e,t,r){var n,i,a,s;if("string"==typeof t&&(i="not ",t.substr(!a||a<0?0:+a,i.length)===i)?(n="must not be",t=t.replace(/^not /,"")):n="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))s="The ".concat(e," ").concat(n," ").concat(o(t,"type"));else{var u=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";s='The "'.concat(e,'" ').concat(u," ").concat(n," ").concat(o(t,"type"))}return s+=". Received type ".concat(typeof r)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],107:[function(e,t,r){(function(r){(function(){"use strict";var n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};t.exports=f;var i=e("./_stream_readable"),o=e("./_stream_writable");e("inherits")(f,i);for(var a=n(o.prototype),s=0;s0)if("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===s.prototype||(t=function(e){return s.from(e)}(t)),n)a.endEmitted?M(e,new _):B(e,a,t,!0);else if(a.ended)M(e,new g);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(t=a.decoder.write(t),a.objectMode||0!==t.length?B(e,a,t,!1):O(e,a)):B(e,a,t,!1)}else n||(a.reading=!1,O(e,a));return!a.ended&&(a.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function x(e){var t=e._readableState;f("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(f("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(P,e))}function P(e){var t=e._readableState;f("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,U(e)}function O(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(R,e,t))}function R(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function C(e){f("readable nexttick read 0"),e.read(0)}function N(e,t){f("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),U(e),t.flowing&&!t.reading&&e.read(0)}function U(e){var t=e._readableState;for(f("flow",t.flowing);t.flowing&&null!==e.read(););}function D(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function L(e){var t=e._readableState;f("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(K,t,e))}function K(e,t){if(f("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function z(e,t){for(var r=0,n=e.length;r=t.highWaterMark:t.length>0)||t.ended))return f("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?L(this):x(this),null;if(0===(e=j(e,t))&&t.ended)return 0===t.length&&L(this),null;var n,i=t.needReadable;return f("need readable",i),(0===t.length||t.length-e0?D(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&L(this)),null!==n&&this.emit("data",n),n},A.prototype._read=function(e){M(this,new w("_read()"))},A.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,f("pipe count=%d opts=%j",i.pipesCount,t);var a=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?u:b;function s(t,r){f("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,f("cleanup"),e.removeListener("close",p),e.removeListener("finish",y),e.removeListener("drain",c),e.removeListener("error",d),e.removeListener("unpipe",s),n.removeListener("end",u),n.removeListener("end",b),n.removeListener("data",l),h=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||c())}function u(){f("onend"),e.end()}i.endEmitted?r.nextTick(a):n.once("end",a),e.on("unpipe",s);var c=function(e){return function(){var t=e._readableState;f("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,U(e))}}(n);e.on("drain",c);var h=!1;function l(t){f("ondata");var r=e.write(t);f("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==z(i.pipes,e))&&!h&&(f("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function d(t){f("onerror",t),b(),e.removeListener("error",d),0===o(e,"error")&&M(e,t)}function p(){e.removeListener("finish",y),b()}function y(){f("onfinish"),e.removeListener("close",p),b()}function b(){f("unpipe"),n.unpipe(e)}return n.on("data",l),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",d),e.once("close",p),e.once("finish",y),e.emit("pipe",n),i.flowing||(f("pipe resume"),n.resume()),e},A.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,f("on readable",i.length,i.reading),i.length?x(this):i.reading||r.nextTick(C,this))),n},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(e,t){var n=a.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(I,this),n},A.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||r.nextTick(I,this),t},A.prototype.resume=function(){var e=this._readableState;return e.flowing||(f("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(N,e,t))}(this,e)),e.paused=!1,this},A.prototype.pause=function(){return f("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(f("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},A.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",function(){if(f("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){(f("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o-1))throw new _(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(e,t,r){r(new y("_write()"))},A.prototype._writev=null,A.prototype.end=function(e,t,n){var i=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,t,n){t.ending=!0,P(e,t),n&&(t.finished?r.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,i,n),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),A.prototype.destroy=h.destroy,A.prototype._undestroy=h.undestroy,A.prototype._destroy=function(e,t){t(e)}}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":106,"./_stream_duplex":107,"./internal/streams/destroy":114,"./internal/streams/state":118,"./internal/streams/stream":119,_process:353,buffer:266,inherits:97,"util-deprecate":179}],112:[function(e,t,r){(function(r){(function(){"use strict";var n;function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o=e("./end-of-stream"),a=Symbol("lastResolve"),s=Symbol("lastReject"),u=Symbol("error"),f=Symbol("ended"),c=Symbol("lastPromise"),h=Symbol("handlePromise"),l=Symbol("stream");function d(e,t){return{value:e,done:t}}function p(e){var t=e[a];if(null!==t){var r=e[l].read();null!==r&&(e[c]=null,e[a]=null,e[s]=null,t(d(r,!1)))}}var y=Object.getPrototypeOf(function(){}),b=Object.setPrototypeOf((i(n={get stream(){return this[l]},next:function(){var e=this,t=this[u];if(null!==t)return Promise.reject(t);if(this[f])return Promise.resolve(d(void 0,!0));if(this[l].destroyed)return new Promise(function(t,n){r.nextTick(function(){e[u]?n(e[u]):t(d(void 0,!0))})});var n,i=this[c];if(i)n=new Promise(function(e,t){return function(r,n){e.then(function(){t[f]?r(d(void 0,!0)):t[h](r,n)},n)}}(i,this));else{var o=this[l].read();if(null!==o)return Promise.resolve(d(o,!1));n=new Promise(this[h])}return this[c]=n,n}},Symbol.asyncIterator,function(){return this}),i(n,"return",function(){var e=this;return new Promise(function(t,r){e[l].destroy(null,function(e){e?r(e):t(d(void 0,!0))})})}),n),y);t.exports=function(e){var t,n=Object.create(b,(i(t={},l,{value:e,writable:!0}),i(t,a,{value:null,writable:!0}),i(t,s,{value:null,writable:!0}),i(t,u,{value:null,writable:!0}),i(t,f,{value:e._readableState.endEmitted,writable:!0}),i(t,h,{value:function(e,t){var r=n[l].read();r?(n[c]=null,n[a]=null,n[s]=null,e(d(r,!1))):(n[a]=e,n[s]=t)},writable:!0}),t));return n[c]=null,o(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=n[s];return null!==t&&(n[c]=null,n[a]=null,n[s]=null,t(e)),void(n[u]=e)}var r=n[a];null!==r&&(n[c]=null,n[a]=null,n[s]=null,r(d(void 0,!0))),n[f]=!0}),e.on("readable",function(e){r.nextTick(p,e)}.bind(null,n)),n}}).call(this)}).call(this,e("_process"))},{"./end-of-stream":115,_process:353}],113:[function(e,t,r){"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){for(var r=0;r0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return a.alloc(0);for(var t,r,n,i=a.allocUnsafe(e>>>0),o=this.head,s=0;o;)t=o.data,r=i,n=s,a.prototype.copy.call(t,r,n),s+=o.data.length,o=o.next;return i}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return s(this,function(e){for(var t=1;t0,function(e){c||(c=e),e&&l.forEach(u),o||(l.forEach(u),h(c))})});return r.reduce(f)}},{"../../../errors":106,"./end-of-stream":115}],118:[function(e,t,r){"use strict";var n=e("../../../errors").codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(e,t,r,i){var o=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},{"../../../errors":106}],119:[function(e,t,r){t.exports=e("events").EventEmitter},{events:303}],120:[function(e,t,r){(r=t.exports=e("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=e("./lib/_stream_writable.js"),r.Duplex=e("./lib/_stream_duplex.js"),r.Transform=e("./lib/_stream_transform.js"),r.PassThrough=e("./lib/_stream_passthrough.js"),r.finished=e("./lib/internal/streams/end-of-stream.js"),r.pipeline=e("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":107,"./lib/_stream_passthrough.js":108,"./lib/_stream_readable.js":109,"./lib/_stream_transform.js":110,"./lib/_stream_writable.js":111,"./lib/internal/streams/end-of-stream.js":115,"./lib/internal/streams/pipeline.js":117}],121:[function(e,t,r){"use strict";var n=e("buffer").Buffer,i=e("inherits"),o=e("hash-base"),a=new Array(16),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],u=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],f=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],c=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],h=[0,1518500249,1859775393,2400959708,2840853838],l=[1352829926,1548603684,1836072691,2053994217,0];function d(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(e,t){return e<>>32-t}function y(e,t,r,n,i,o,a,s){return p(e+(t^r^n)+o+a|0,s)+i|0}function b(e,t,r,n,i,o,a,s){return p(e+(t&r|~t&n)+o+a|0,s)+i|0}function m(e,t,r,n,i,o,a,s){return p(e+((t|~r)^n)+o+a|0,s)+i|0}function v(e,t,r,n,i,o,a,s){return p(e+(t&n|r&~n)+o+a|0,s)+i|0}function g(e,t,r,n,i,o,a,s){return p(e+(t^(r|~n))+o+a|0,s)+i|0}i(d,o),d.prototype._update=function(){for(var e=a,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,d=0|this._e,w=0|this._a,_=0|this._b,M=0|this._c,S=0|this._d,E=0|this._e,A=0;A<80;A+=1){var k,B;A<16?(k=y(r,n,i,o,d,e[s[A]],h[0],f[A]),B=g(w,_,M,S,E,e[u[A]],l[0],c[A])):A<32?(k=b(r,n,i,o,d,e[s[A]],h[1],f[A]),B=v(w,_,M,S,E,e[u[A]],l[1],c[A])):A<48?(k=m(r,n,i,o,d,e[s[A]],h[2],f[A]),B=m(w,_,M,S,E,e[u[A]],l[2],c[A])):A<64?(k=v(r,n,i,o,d,e[s[A]],h[3],f[A]),B=b(w,_,M,S,E,e[u[A]],l[3],c[A])):(k=g(r,n,i,o,d,e[s[A]],h[4],f[A]),B=y(w,_,M,S,E,e[u[A]],l[4],c[A])),r=d,d=o,o=p(i,10),i=n,n=k,w=E,E=S,S=p(M,10),M=_,_=B}var T=this._b+i+S|0;this._b=this._c+o+E|0,this._c=this._d+d+w|0,this._d=this._e+r+_|0,this._e=this._a+n+M|0,this._a=T},d.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=n.alloc?n.alloc(20):new n(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},t.exports=d},{buffer:266,"hash-base":82,inherits:97}],122:[function(e,t,r){var n=e("buffer"),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,r),r.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},{buffer:266}],123:[function(e,t,r){(function(r){(function(){"use strict";var n,i=e("buffer"),o=i.Buffer,a={};for(n in i)i.hasOwnProperty(n)&&"SlowBuffer"!==n&&"Buffer"!==n&&(a[n]=i[n]);var s=a.Buffer={};for(n in o)o.hasOwnProperty(n)&&"allocUnsafe"!==n&&"allocUnsafeSlow"!==n&&(s[n]=o[n]);if(a.Buffer.prototype=o.prototype,s.from&&s.from!==Uint8Array.from||(s.from=function(e,t,r){if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof e);if(e&&void 0===e.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);return o(e,t,r)}),s.alloc||(s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError('The "size" argument must be of type number. Received type '+typeof e);if(e<0||e>=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var n=o(e);return t&&0!==t.length?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n}),!a.kStringMaxLength)try{a.kStringMaxLength=r.binding("buffer").kStringMaxLength}catch(e){}a.constants||(a.constants={MAX_LENGTH:a.kMaxLength},a.kStringMaxLength&&(a.constants.MAX_STRING_LENGTH=a.kStringMaxLength)),t.exports=a}).call(this)}).call(this,e("_process"))},{_process:353,buffer:266}],124:[function(e,t,r){t.exports=e("./lib")(e("./lib/elliptic"))},{"./lib":126,"./lib/elliptic":125}],125:[function(e,t,r){const n=new(0,e("elliptic").ec)("secp256k1"),i=n.curve,o=i.n.constructor;function a(e){const t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:function(e,t){let r=new o(t);if(r.cmp(i.p)>=0)return null;let a=(r=r.toRed(i.red)).redSqr().redIMul(r).redIAdd(i.b).redSqrt();return 3===e!==a.isOdd()&&(a=a.redNeg()),n.keyPair({pub:{x:r,y:a}})}(t,e.subarray(1,33));case 4:case 6:case 7:return 65!==e.length?null:function(e,t,r){let a=new o(t),s=new o(r);if(a.cmp(i.p)>=0||s.cmp(i.p)>=0)return null;if(a=a.toRed(i.red),s=s.toRed(i.red),(6===e||7===e)&&s.isOdd()!==(7===e))return null;const u=a.redSqr().redIMul(a);return s.redSqr().redISub(u.redIAdd(i.b)).isZero()?n.keyPair({pub:{x:a,y:s}}):null}(t,e.subarray(1,33),e.subarray(33,65));default:return null}}function s(e,t){const r=t.encode(null,33===e.length);for(let t=0;t0,privateKeyVerify(e){const t=new o(e);return t.cmp(i.n)<0&&!t.isZero()?0:1},privateKeyNegate(e){const t=new o(e),r=i.n.sub(t).umod(i.n).toArrayLike(Uint8Array,"be",32);return e.set(r),0},privateKeyTweakAdd(e,t){const r=new o(t);if(r.cmp(i.n)>=0)return 1;if(r.iadd(new o(e)),r.cmp(i.n)>=0&&r.isub(i.n),r.isZero())return 1;const n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},privateKeyTweakMul(e,t){let r=new o(t);if(r.cmp(i.n)>=0||r.isZero())return 1;r.imul(new o(e)),r.cmp(i.n)>=0&&(r=r.umod(i.n));const n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},publicKeyVerify:e=>null===a(e)?1:0,publicKeyCreate(e,t){const r=new o(t);return r.cmp(i.n)>=0||r.isZero()?1:(s(e,n.keyFromPrivate(t).getPublic()),0)},publicKeyConvert(e,t){const r=a(t);return null===r?1:(s(e,r.getPublic()),0)},publicKeyNegate(e,t){const r=a(t);if(null===r)return 1;const n=r.getPublic();return n.y=n.y.redNeg(),s(e,n),0},publicKeyCombine(e,t){const r=new Array(t.length);for(let e=0;e=0)return 2;const u=n.getPublic().add(i.g.mul(r));return u.isInfinity()?2:(s(e,u),0)},publicKeyTweakMul(e,t,r){const n=a(t);return null===n?1:(r=new o(r)).cmp(i.n)>=0||r.isZero()?2:(s(e,n.getPublic().mul(r)),0)},signatureNormalize(e){const t=new o(e.subarray(0,32)),r=new o(e.subarray(32,64));return t.cmp(i.n)>=0||r.cmp(i.n)>=0?1:(1===r.cmp(n.nh)&&e.set(i.n.sub(r).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,t){const r=t.subarray(0,32),n=t.subarray(32,64);if(new o(r).cmp(i.n)>=0)return 1;if(new o(n).cmp(i.n)>=0)return 1;const{output:a}=e;let s=a.subarray(4,37);s[0]=0,s.set(r,1);let u=33,f=0;for(;u>1&&0===s[f]&&!(128&s[f+1]);--u,++f);if(128&(s=s.subarray(f))[0])return 1;if(u>1&&0===s[0]&&!(128&s[1]))return 1;let c=a.subarray(39,72);c[0]=0,c.set(n,1);let h=33,l=0;for(;h>1&&0===c[l]&&!(128&c[l+1]);--h,++l);return 128&(c=c.subarray(l))[0]?1:h>1&&0===c[0]&&!(128&c[1])?1:(e.outputlen=6+u+h,a[0]=48,a[1]=e.outputlen-2,a[2]=2,a[3]=s.length,a.set(s,4),a[4+u]=2,a[5+u]=c.length,a.set(c,6+u),0)},signatureImport(e,t){if(t.length<8)return 1;if(t.length>72)return 1;if(48!==t[0])return 1;if(t[1]!==t.length-2)return 1;if(2!==t[2])return 1;const r=t[3];if(0===r)return 1;if(5+r>=t.length)return 1;if(2!==t[4+r])return 1;const n=t[5+r];if(0===n)return 1;if(6+r+n!==t.length)return 1;if(128&t[4])return 1;if(r>1&&0===t[4]&&!(128&t[5]))return 1;if(128&t[r+6])return 1;if(n>1&&0===t[r+6]&&!(128&t[r+7]))return 1;let a=t.subarray(4,4+r);if(33===a.length&&0===a[0]&&(a=a.subarray(1)),a.length>32)return 1;let s=t.subarray(6+r);if(33===s.length&&0===s[0]&&(s=s.slice(1)),s.length>32)throw new Error("S length is too long");let u=new o(a);u.cmp(i.n)>=0&&(u=new o(0));let f=new o(t.subarray(6+r));return f.cmp(i.n)>=0&&(f=new o(0)),e.set(u.toArrayLike(Uint8Array,"be",32),0),e.set(f.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,t,r,a,s){if(s){const e=s;s=(n=>{const i=e(t,r,null,a,n);if(!(i instanceof Uint8Array&&32===i.length))throw new Error("This is the way");return new o(i)})}const u=new o(r);if(u.cmp(i.n)>=0||u.isZero())return 1;let f;try{f=n.sign(t,r,{canonical:!0,k:s,pers:a})}catch(e){return 1}return e.signature.set(f.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(f.s.toArrayLike(Uint8Array,"be",32),32),e.recid=f.recoveryParam,0},ecdsaVerify(e,t,r){const s={r:e.subarray(0,32),s:e.subarray(32,64)},u=new o(s.r),f=new o(s.s);if(u.cmp(i.n)>=0||f.cmp(i.n)>=0)return 1;if(1===f.cmp(n.nh)||u.isZero()||f.isZero())return 3;const c=a(r);if(null===c)return 2;const h=c.getPublic();return n.verify(t,s,h)?0:3},ecdsaRecover(e,t,r,a){const u={r:t.slice(0,32),s:t.slice(32,64)},f=new o(u.r),c=new o(u.s);if(f.cmp(i.n)>=0||c.cmp(i.n)>=0)return 1;if(f.isZero()||c.isZero())return 2;let h;try{h=n.recoverPubKey(a,u,r)}catch(e){return 2}return s(e,h),0},ecdh(e,t,r,s,u,f,c){const h=a(t);if(null===h)return 1;const l=new o(r);if(l.cmp(i.n)>=0||l.isZero())return 2;const d=h.getPublic().mul(l);if(void 0===u){const t=d.encode(null,!0),r=n.hash().update(t).digest();for(let t=0;t<32;++t)e[t]=r[t]}else{f||(f=new Uint8Array(32));const t=d.getX().toArray("be",32);for(let e=0;e<32;++e)f[e]=t[e];c||(c=new Uint8Array(32));const r=d.getY().toArray("be",32);for(let e=0;e<32;++e)c[e]=r[e];const n=u(f,c,s);if(!(n instanceof Uint8Array&&n.length===e.length))return 2;e.set(n)}return 0}}},{elliptic:56}],126:[function(e,t,r){const n="Impossible case. Please create issue.",i="The tweak was out of range or the resulted private key is invalid",o="The tweak was out of range or equal to zero",a="Unknow error on context randomization",s="Private Key is invalid",u="Public Key could not be parsed",f="Public Key serialization error",c="The sum of the public keys is not valid",h="Signature could not be parsed",l="The nonce generation function failed, or the private key was invalid",d="Public key could not be recover",p="Scalar was invalid (zero or overflow)";function y(e,t){if(!e)throw new Error(t)}function b(e,t,r){if(y(t instanceof Uint8Array,`Expected ${e} to be an Uint8Array`),void 0!==r)if(Array.isArray(r)){const n=`Expected ${e} to be an Uint8Array with length [${r.join(", ")}]`;y(r.includes(t.length),n)}else{const n=`Expected ${e} to be an Uint8Array with length ${r}`;y(t.length===r,n)}}function m(e){y("Boolean"===g(e),"Expected compressed to be a Boolean")}function v(e=(e=>new Uint8Array(e)),t){return"function"==typeof e&&(e=e(t)),b("output",e,t),e}function g(e){return Object.prototype.toString.call(e).slice(8,-1)}t.exports=(e=>({contextRandomize(t){switch(y(null===t||t instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==t&&b("seed",t,32),e.contextRandomize(t)){case 1:throw new Error(a)}},privateKeyVerify:t=>(b("private key",t,32),0===e.privateKeyVerify(t)),privateKeyNegate(t){switch(b("private key",t,32),e.privateKeyNegate(t)){case 0:return t;case 1:throw new Error(n)}},privateKeyTweakAdd(t,r){switch(b("private key",t,32),b("tweak",r,32),e.privateKeyTweakAdd(t,r)){case 0:return t;case 1:throw new Error(i)}},privateKeyTweakMul(t,r){switch(b("private key",t,32),b("tweak",r,32),e.privateKeyTweakMul(t,r)){case 0:return t;case 1:throw new Error(o)}},publicKeyVerify:t=>(b("public key",t,[33,65]),0===e.publicKeyVerify(t)),publicKeyCreate(t,r=!0,n){switch(b("private key",t,32),m(r),n=v(n,r?33:65),e.publicKeyCreate(n,t)){case 0:return n;case 1:throw new Error(s);case 2:throw new Error(f)}},publicKeyConvert(t,r=!0,n){switch(b("public key",t,[33,65]),m(r),n=v(n,r?33:65),e.publicKeyConvert(n,t)){case 0:return n;case 1:throw new Error(u);case 2:throw new Error(f)}},publicKeyNegate(t,r=!0,i){switch(b("public key",t,[33,65]),m(r),i=v(i,r?33:65),e.publicKeyNegate(i,t)){case 0:return i;case 1:throw new Error(u);case 2:throw new Error(n);case 3:throw new Error(f)}},publicKeyCombine(t,r=!0,n){y(Array.isArray(t),"Expected public keys to be an Array"),y(t.length>0,"Expected public keys array will have more than zero items");for(const e of t)b("public key",e,[33,65]);switch(m(r),n=v(n,r?33:65),e.publicKeyCombine(n,t)){case 0:return n;case 1:throw new Error(u);case 2:throw new Error(c);case 3:throw new Error(f)}},publicKeyTweakAdd(t,r,n=!0,o){switch(b("public key",t,[33,65]),b("tweak",r,32),m(n),o=v(o,n?33:65),e.publicKeyTweakAdd(o,t,r)){case 0:return o;case 1:throw new Error(u);case 2:throw new Error(i)}},publicKeyTweakMul(t,r,n=!0,i){switch(b("public key",t,[33,65]),b("tweak",r,32),m(n),i=v(i,n?33:65),e.publicKeyTweakMul(i,t,r)){case 0:return i;case 1:throw new Error(u);case 2:throw new Error(o)}},signatureNormalize(t){switch(b("signature",t,64),e.signatureNormalize(t)){case 0:return t;case 1:throw new Error(h)}},signatureExport(t,r){b("signature",t,64);const i={output:r=v(r,72),outputlen:72};switch(e.signatureExport(i,t)){case 0:return r.slice(0,i.outputlen);case 1:throw new Error(h);case 2:throw new Error(n)}},signatureImport(t,r){switch(b("signature",t),r=v(r,64),e.signatureImport(r,t)){case 0:return r;case 1:throw new Error(h);case 2:throw new Error(n)}},ecdsaSign(t,r,i={},o){b("message",t,32),b("private key",r,32),y("Object"===g(i),"Expected options to be an Object"),void 0!==i.data&&b("options.data",i.data),void 0!==i.noncefn&&y("Function"===g(i.noncefn),"Expected options.noncefn to be a Function");const a={signature:o=v(o,64),recid:null};switch(e.ecdsaSign(a,t,r,i.data,i.noncefn)){case 0:return a;case 1:throw new Error(l);case 2:throw new Error(n)}},ecdsaVerify(t,r,n){switch(b("signature",t,64),b("message",r,32),b("public key",n,[33,65]),e.ecdsaVerify(t,r,n)){case 0:return!0;case 3:return!1;case 1:throw new Error(h);case 2:throw new Error(u)}},ecdsaRecover(t,r,i,o=!0,a){switch(b("signature",t,64),y("Number"===g(r)&&r>=0&&r<=3,"Expected recovery id to be a Number within interval [0, 3]"),b("message",i,32),m(o),a=v(a,o?33:65),e.ecdsaRecover(a,t,r,i)){case 0:return a;case 1:throw new Error(h);case 2:throw new Error(d);case 3:throw new Error(n)}},ecdh(t,r,n={},i){switch(b("public key",t,[33,65]),b("private key",r,32),y("Object"===g(n),"Expected options to be an Object"),void 0!==n.data&&b("options.data",n.data),void 0!==n.hashfn?(y("Function"===g(n.hashfn),"Expected options.hashfn to be a Function"),void 0!==n.xbuf&&b("options.xbuf",n.xbuf,32),void 0!==n.ybuf&&b("options.ybuf",n.ybuf,32),b("output",i)):i=v(i,32),e.ecdh(i,t,r,n.data,n.hashfn,n.xbuf,n.ybuf)){case 0:return i;case 1:throw new Error(u);case 2:throw new Error(p)}}}))},{}],127:[function(e,t,r){var n=e("safe-buffer").Buffer;function i(e,t){this._block=n.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}i.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=n.from(e,t));for(var r=this._block,i=this._blockSize,o=e.length,a=this._len,s=0;s=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=i},{"safe-buffer":122}],128:[function(e,t,r){(r=t.exports=function(e){e=e.toLowerCase();var t=r[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t}).sha=e("./sha"),r.sha1=e("./sha1"),r.sha224=e("./sha224"),r.sha256=e("./sha256"),r.sha384=e("./sha384"),r.sha512=e("./sha512")},{"./sha":129,"./sha1":130,"./sha224":131,"./sha256":132,"./sha384":133,"./sha512":134}],129:[function(e,t,r){var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,i.call(this,64,56)}function f(e){return e<<30|e>>>2}function c(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,h=0;h<16;++h)r[h]=e.readInt32BE(4*h);for(;h<80;++h)r[h]=r[h-3]^r[h-8]^r[h-14]^r[h-16];for(var l=0;l<80;++l){var d=~~(l/20),p=0|((t=n)<<5|t>>>27)+c(d,i,o,s)+u+r[l]+a[d];u=s,s=o,o=f(i),i=n,n=p}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=u},{"./hash":127,inherits:97,"safe-buffer":122}],130:[function(e,t,r){var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,i.call(this,64,56)}function f(e){return e<<5|e>>>27}function c(e){return e<<30|e>>>2}function h(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,l=0;l<16;++l)r[l]=e.readInt32BE(4*l);for(;l<80;++l)r[l]=(t=r[l-3]^r[l-8]^r[l-14]^r[l-16])<<1|t>>>31;for(var d=0;d<80;++d){var p=~~(d/20),y=f(n)+h(p,i,o,s)+u+r[d]+a[p]|0;u=s,s=o,o=c(i),i=n,n=y}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=u},{"./hash":127,inherits:97,"safe-buffer":122}],131:[function(e,t,r){var n=e("inherits"),i=e("./sha256"),o=e("./hash"),a=e("safe-buffer").Buffer,s=new Array(64);function u(){this.init(),this._w=s,o.call(this,64,56)}n(u,i),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var e=a.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},t.exports=u},{"./hash":127,"./sha256":132,inherits:97,"safe-buffer":122}],132:[function(e,t,r){var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function u(){this.init(),this._w=s,i.call(this,64,56)}function f(e,t,r){return r^e&(t^r)}function c(e,t,r){return e&t|r&(e|t)}function h(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function l(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function d(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}n(u,i),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,p=0|this._f,y=0|this._g,b=0|this._h,m=0;m<16;++m)r[m]=e.readInt32BE(4*m);for(;m<64;++m)r[m]=0|(((t=r[m-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[m-7]+d(r[m-15])+r[m-16];for(var v=0;v<64;++v){var g=b+l(u)+f(u,p,y)+a[v]+r[v]|0,w=h(n)+c(n,i,o)|0;b=y,y=p,p=u,u=s+g|0,s=o,o=i,i=n,n=g+w|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0,this._f=p+this._f|0,this._g=y+this._g|0,this._h=b+this._h|0},u.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},t.exports=u},{"./hash":127,inherits:97,"safe-buffer":122}],133:[function(e,t,r){var n=e("inherits"),i=e("./sha512"),o=e("./hash"),a=e("safe-buffer").Buffer,s=new Array(160);function u(){this.init(),this._w=s,o.call(this,128,112)}n(u,i),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var e=a.allocUnsafe(48);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},t.exports=u},{"./hash":127,"./sha512":134,inherits:97,"safe-buffer":122}],134:[function(e,t,r){var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,a=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],s=new Array(160);function u(){this.init(),this._w=s,i.call(this,128,112)}function f(e,t,r){return r^e&(t^r)}function c(e,t,r){return e&t|r&(e|t)}function h(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function l(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function d(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function p(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function y(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function b(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function m(e,t){return e>>>0>>0?1:0}n(u,i),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(e){for(var t=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,s=0|this._eh,u=0|this._fh,v=0|this._gh,g=0|this._hh,w=0|this._al,_=0|this._bl,M=0|this._cl,S=0|this._dl,E=0|this._el,A=0|this._fl,k=0|this._gl,B=0|this._hl,T=0;T<32;T+=2)t[T]=e.readInt32BE(4*T),t[T+1]=e.readInt32BE(4*T+4);for(;T<160;T+=2){var j=t[T-30],x=t[T-30+1],P=d(j,x),O=p(x,j),R=y(j=t[T-4],x=t[T-4+1]),I=b(x,j),C=t[T-14],N=t[T-14+1],U=t[T-32],D=t[T-32+1],L=O+N|0,K=P+C+m(L,O)|0;K=(K=K+R+m(L=L+I|0,I)|0)+U+m(L=L+D|0,D)|0,t[T]=K,t[T+1]=L}for(var z=0;z<160;z+=2){K=t[z],L=t[z+1];var q=c(r,n,i),H=c(w,_,M),F=h(r,w),V=h(w,r),W=l(s,E),J=l(E,s),Z=a[z],G=a[z+1],X=f(s,u,v),Y=f(E,A,k),$=B+J|0,Q=g+W+m($,B)|0;Q=(Q=(Q=Q+X+m($=$+Y|0,Y)|0)+Z+m($=$+G|0,G)|0)+K+m($=$+L|0,L)|0;var ee=V+H|0,te=F+q+m(ee,V)|0;g=v,B=k,v=u,k=A,u=s,A=E,s=o+Q+m(E=S+$|0,S)|0,o=i,S=M,i=n,M=_,n=r,_=w,r=Q+te+m(w=$+ee|0,$)|0}this._al=this._al+w|0,this._bl=this._bl+_|0,this._cl=this._cl+M|0,this._dl=this._dl+S|0,this._el=this._el+E|0,this._fl=this._fl+A|0,this._gl=this._gl+k|0,this._hl=this._hl+B|0,this._ah=this._ah+r+m(this._al,w)|0,this._bh=this._bh+n+m(this._bl,_)|0,this._ch=this._ch+i+m(this._cl,M)|0,this._dh=this._dh+o+m(this._dl,S)|0,this._eh=this._eh+s+m(this._el,E)|0,this._fh=this._fh+u+m(this._fl,A)|0,this._gh=this._gh+v+m(this._gl,k)|0,this._hh=this._hh+g+m(this._hl,B)|0},u.prototype._hash=function(){var e=o.allocUnsafe(64);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},t.exports=u},{"./hash":127,inherits:97,"safe-buffer":122}],135:[function(e,t,r){"use strict";var n=e("safe-buffer").Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=f,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=c,this.end=h,t=3;break;default:return this.write=l,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function f(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function c(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function h(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function l(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}r.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return i>0&&(e.lastNeed=i-1),i;if(--n=0)return i>0&&(e.lastNeed=i-2),i;if(--n=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},{"safe-buffer":122}],136:[function(e,t,r){!function(n){if("object"==typeof t&&"object"==typeof t.exports){var i=n(e,r);void 0!==i&&(t.exports=i)}else 0}(function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=e("tslib");r.__exportStar(e("./result"),t),r.__exportStar(e("./option"),t)})},{"./option":137,"./result":138,tslib:140}],137:[function(e,t,r){!function(n){if("object"==typeof t&&"object"==typeof t.exports){var i=n(e,r);void 0!==i&&(t.exports=i)}else 0}(function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Option=t.Some=t.None=void 0;var r=e("./utils"),n=function(){function e(){this.some=!1,this.none=!0}return e.prototype[Symbol.iterator]=function(){return{next:function(){return{done:!0,value:void 0}}}},e.prototype.unwrapOr=function(e){return e},e.prototype.expect=function(e){throw new Error(""+e)},e.prototype.unwrap=function(){throw new Error("Tried to unwrap None")},e.prototype.map=function(e){return this},e.prototype.andThen=function(e){return this},e.prototype.toString=function(){return"None"},e}();t.None=new n,Object.freeze(t.None);var i=function(){function e(t){if(!(this instanceof e))return new e(t);this.some=!0,this.none=!1,this.val=t}return e.prototype[Symbol.iterator]=function(){var e=Object(this.val);return Symbol.iterator in e?e[Symbol.iterator]():{next:function(){return{done:!0,value:void 0}}}},e.prototype.unwrapOr=function(e){return this.val},e.prototype.expect=function(e){return this.val},e.prototype.unwrap=function(){return this.val},e.prototype.map=function(e){return t.Some(e(this.val))},e.prototype.andThen=function(e){return e(this.val)},e.prototype.safeUnwrap=function(){return this.val},e.prototype.toString=function(){return"Some("+r.toString(this.val)+")"},e.EMPTY=new e(void 0),e}();t.Some=i,function(e){e.all=function(){for(var e=[],r=0;r=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},a=function(e,t){return function(r,n){t(r,n,e)}},s=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},u=function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function s(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}u((n=n.apply(e,t||[])).next())})},f=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},l=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},d=function(){for(var e=[],t=0;t1||s(e,t)})})}function s(e,t){try{(r=i[e](t)).value instanceof y?Promise.resolve(r.value.v).then(u,f):c(o[0][2],r)}catch(e){c(o[0][3],e)}var r}function u(e){s("next",e)}function f(e){s("throw",e)}function c(e,t){e(t),o.shift(),o.length&&s(o[0][0],o[0][1])}},m=function(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,i){t[n]=e[n]?function(t){return(r=!r)?{value:y(e[n](t)),done:"return"===n}:i?i(t):t}:i}},v=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=h(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,i){(function(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)})(n,i,(t=e[r](t)).done,t.value)})}}},g=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},w=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t},_=function(e){return e&&e.__esModule?e:{default:e}},M=function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},S=function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},e("__extends",r),e("__assign",n),e("__rest",i),e("__decorate",o),e("__param",a),e("__metadata",s),e("__awaiter",u),e("__generator",f),e("__exportStar",c),e("__createBinding",E),e("__values",h),e("__read",l),e("__spread",d),e("__spreadArrays",p),e("__await",y),e("__asyncGenerator",b),e("__asyncDelegator",m),e("__asyncValues",v),e("__makeTemplateObject",g),e("__importStar",w),e("__importDefault",_),e("__classPrivateFieldGet",M),e("__classPrivateFieldSet",S)})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],141:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ByteArray=function(e){return new Uint8Array(e)},r.HalfArray=function(e){return new Uint16Array(e)},r.WordArray=function(e){return new Uint32Array(e)},r.IntArray=function(e){return new Int32Array(e)},r.NumArray=function(e){return new Float64Array(e)}},{}],142:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./array"),i=e("./hash");r.auth=function(e,t){var r=n.ByteArray(32);return r.set(s(e,t).subarray(0,32)),r};var o=128,a=64;function s(e,t){var r,s,u=n.ByteArray(o+Math.max(a,e.length));for(t.length>o&&(t=i.hash(t)),r=0;r64)throw new Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");for(var r=n.WordArray(16),i=0;i<16;i++)r[i]=s[i];var a=t?t.length:0;r[0]^=16842752^a<<8^e;var u={b:n.ByteArray(128),h:r,t:0,c:0,outlen:e};return t&&(o(u,t),u.c=128),u}function o(e,t){for(var r=0;r>2]>>8*(3&r);return t}r.blake2b=function(e,t,r){void 0===r&&(r=64);var n=i(r,t);return o(n,e),a(n)},r.blake2b_init=i,r.blake2b_update=o,r.blake2b_final=a;var s=n.WordArray([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),u=n.ByteArray([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map(function(e){return 2*e})),f=n.WordArray(32),c=n.WordArray(32);function h(e,t){var r;for(r=0;r<16;r++)f[r]=e.h[r],f[r+16]=s[r];for(f[24]=f[24]^e.t,f[25]=f[25]^e.t/4294967296,t&&(f[28]=~f[28],f[29]=~f[29]),r=0;r<32;r++)c[r]=p(e.b,4*r);for(r=0;r<12;r++)y(0,8,16,24,u[16*r+0],u[16*r+1]),y(2,10,18,26,u[16*r+2],u[16*r+3]),y(4,12,20,28,u[16*r+4],u[16*r+5]),y(6,14,22,30,u[16*r+6],u[16*r+7]),y(0,10,20,30,u[16*r+8],u[16*r+9]),y(2,12,22,24,u[16*r+10],u[16*r+11]),y(4,14,16,26,u[16*r+12],u[16*r+13]),y(6,8,18,28,u[16*r+14],u[16*r+15]);for(r=0;r<16;r++)e.h[r]=e.h[r]^f[r]^f[r+16]}function l(e,t,r){var n=e[t]+e[r],i=e[t+1]+e[r+1];n>=4294967296&&i++,e[t]=n,e[t+1]=i}function d(e,t,r,n){var i=e[t]+r;r<0&&(i+=4294967296);var o=e[t+1]+n;i>=4294967296&&o++,e[t]=i,e[t+1]=o}function p(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function y(e,t,r,n,i,o){var a=c[i],s=c[i+1],u=c[o],h=c[o+1];l(f,e,t),d(f,e,a,s);var p=f[n]^f[e],y=f[n+1]^f[e+1];f[n]=y,f[n+1]=p,l(f,r,n),p=f[t]^f[r],y=f[t+1]^f[r+1],f[t]=p>>>24^y<<8,f[t+1]=y>>>24^p<<8,l(f,e,t),d(f,e,u,h),p=f[n]^f[e],y=f[n+1]^f[e+1],f[n]=p>>>16^y<<16,f[n+1]=y>>>16^p<<16,l(f,r,n),p=f[t]^f[r],y=f[t+1]^f[r+1],f[t]=y>>>31^p<<1,f[t+1]=p>>>31^y<<1}},{"./array":141}],144:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./array");function i(e,t){if(!(e>0&&e<=32))throw new Error("Incorrect output length, should be in [1, 32]");var r=t?t.length:0;if(t&&!(r>0&&r<=32))throw new Error("Incorrect key length, should be in [1, 32]");var i={h:n.WordArray(s),b:n.WordArray(64),c:0,t:0,outlen:e};return i.h[0]^=16842752^r<<8^e,r&&(o(i,t),i.c=64),i}function o(e,t){for(var r=0;r>2]>>8*(3&r)&255;return t}r.blake2s=function(e,t,r){void 0===r&&(r=32);var n=i(r,t);return o(n,e),a(n)},r.blake2s_init=i,r.blake2s_update=o,r.blake2s_final=a;var s=n.WordArray([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=n.ByteArray([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),f=n.WordArray(16),c=n.WordArray(16);function h(e,t){var r=0;for(r=0;r<8;r++)f[r]=e.h[r],f[r+8]=s[r];for(f[12]^=e.t,f[13]^=e.t/4294967296,t&&(f[14]=~f[14]),r=0;r<16;r++)c[r]=l(e.b,4*r);for(r=0;r<10;r++)d(0,4,8,12,c[u[16*r+0]],c[u[16*r+1]]),d(1,5,9,13,c[u[16*r+2]],c[u[16*r+3]]),d(2,6,10,14,c[u[16*r+4]],c[u[16*r+5]]),d(3,7,11,15,c[u[16*r+6]],c[u[16*r+7]]),d(0,5,10,15,c[u[16*r+8]],c[u[16*r+9]]),d(1,6,11,12,c[u[16*r+10]],c[u[16*r+11]]),d(2,7,8,13,c[u[16*r+12]],c[u[16*r+13]]),d(3,4,9,14,c[u[16*r+14]],c[u[16*r+15]]);for(r=0;r<8;r++)e.h[r]^=f[r]^f[r+8]}function l(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function d(e,t,r,n,i,o){f[e]=f[e]+f[t]+i,f[n]=p(f[n]^f[e],16),f[r]=f[r]+f[n],f[t]=p(f[t]^f[r],12),f[e]=f[e]+f[t]+o,f[n]=p(f[n]^f[e],8),f[r]=f[r]+f[n],f[t]=p(f[t]^f[r],7)}function p(e,t){return e>>>t^e<<32-t}},{"./array":141}],145:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./array"),i=e("./core"),o=e("./random"),a=e("./salsa20"),s=e("./scalarmult"),u=e("./secretbox"),f=e("./check");function c(e,t){f.checkArrayTypes(e,t),f.checkBoxLengths(e,t);var r=n.ByteArray(32);return function(e,t,r){var o=n.ByteArray(32);s._scalarMult(o,r,t),a._hsalsa20(e,i._0,o,a._sigma)}(r,e,t),r}r.box=function(e,t,r,n){var i=c(r,n);return u.secretbox(e,t,i)},r.box_before=c,r.box_after=u.secretbox,r.box_open=function(e,t,r,n){var i=c(r,n);return u.secretbox_open(e,t,i)},r.box_open_after=u.secretbox_open,r.box_keyPair=function(){var e,t,r=n.ByteArray(32),i=n.ByteArray(32);return e=r,t=i,o._randomBytes(t,32),s._scalarMult_base(e,t),{publicKey:r,secretKey:i}},r.box_keyPair_fromSecretKey=function(e){if(f.checkArrayTypes(e),32!==e.length)throw new Error("bad secret key size");var t=n.ByteArray(32);return s._scalarMult_base(t,e),{publicKey:t,secretKey:n.ByteArray(e)}}},{"./array":141,"./check":146,"./core":150,"./random":155,"./salsa20":156,"./scalarmult":157,"./secretbox":159}],146:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.checkLengths=function(e,t){if(32!=e.length)throw new Error("bad key size");if(24!=t.length)throw new Error("bad nonce size")},r.checkBoxLengths=function(e,t){if(32!=e.length)throw new Error("bad public key size");if(32!=t.length)throw new Error("bad secret key size")},r.checkArrayTypes=function(){for(var e=[],t=0;t>8),t[i+1]=a(15&e[r]);return o.apply(void 0,t)},r.decodeHex=function(e){i.validateHex(e);for(var t=n.ByteArray(e.length>>1),r=0;r>16&1),u[r-1]&=65535;u[15]=f[15]-32767-(u[14]>>16&1),i=u[15]>>16&1,u[14]&=65535,s(f,u,1-i)}for(r=0;r<16;r++)e[2*r]=255&f[r],e[2*r+1]=f[r]>>8}r.set25519=function(e,t){for(var r=0;r<16;r++)e[r]=0|t[r]},r.sel25519=s,r.pack25519=u,r.neq25519=function(e,t){var r=n.ByteArray(32),o=n.ByteArray(32);return u(r,e),u(o,t),i._verify_32(r,0,o,0)},r.par25519=function(e){var t=n.ByteArray(32);return u(t,e),1&t[0]},r.unpack25519=function(e,t){for(var r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767},r.inv25519=function(e,t){var r,n=o.gf();for(r=0;r<16;r++)n[r]=t[r];for(r=253;r>=0;r--)o.S(n,n),2!==r&&4!==r&&o.M(n,n,t);for(r=0;r<16;r++)e[r]=n[r]}},{"./array":141,"./core":150,"./verify":162}],152:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./array"),i=e("./check");function o(e,t,r){var i,o=n.IntArray(8),a=n.IntArray(8),f=n.ByteArray(256),c=r;for(o[0]=1779033703,o[1]=3144134277,o[2]=1013904242,o[3]=2773480762,o[4]=1359893119,o[5]=2600822924,o[6]=528734635,o[7]=1541459225,a[0]=4089235720,a[1]=2227873595,a[2]=4271175723,a[3]=1595750129,a[4]=2917565137,a[5]=725511199,a[6]=4215389547,a[7]=327033209,s(o,a,t,r),r%=128,i=0;i=128;){for(E=0;E<16;E++)A=8*E+X,O[E]=r[A+0]<<24|r[A+1]<<16|r[A+2]<<8|r[A+3],R[E]=r[A+4]<<24|r[A+5]<<16|r[A+6]<<8|r[A+7];for(E=0;E<80;E++)if(o=I,s=C,u=N,f=U,c=D,h=L,l=K,z,p=q,y=H,b=F,m=V,v=W,g=J,w=Z,G,T=65535&(B=G),j=B>>>16,x=65535&(k=z),P=k>>>16,T+=65535&(B=(W>>>14|D<<18)^(W>>>18|D<<14)^(D>>>9|W<<23)),j+=B>>>16,x+=65535&(k=(D>>>14|W<<18)^(D>>>18|W<<14)^(W>>>9|D<<23)),P+=k>>>16,T+=65535&(B=W&J^~W&Z),j+=B>>>16,x+=65535&(k=D&L^~D&K),P+=k>>>16,k=a[2*E],T+=65535&(B=a[2*E+1]),j+=B>>>16,x+=65535&k,P+=k>>>16,k=O[E%16],j+=(B=R[E%16])>>>16,x+=65535&k,P+=k>>>16,x+=(j+=(T+=65535&B)>>>16)>>>16,T=65535&(B=S=65535&T|j<<16),j=B>>>16,x=65535&(k=M=65535&x|(P+=x>>>16)<<16),P=k>>>16,T+=65535&(B=(q>>>28|I<<4)^(I>>>2|q<<30)^(I>>>7|q<<25)),j+=B>>>16,x+=65535&(k=(I>>>28|q<<4)^(q>>>2|I<<30)^(q>>>7|I<<25)),P+=k>>>16,j+=(B=q&H^q&F^H&F)>>>16,x+=65535&(k=I&C^I&N^C&N),P+=k>>>16,d=65535&(x+=(j+=(T+=65535&B)>>>16)>>>16)|(P+=x>>>16)<<16,_=65535&T|j<<16,T=65535&(B=m),j=B>>>16,x=65535&(k=f),P=k>>>16,j+=(B=S)>>>16,x+=65535&(k=M),P+=k>>>16,C=o,N=s,U=u,D=f=65535&(x+=(j+=(T+=65535&B)>>>16)>>>16)|(P+=x>>>16)<<16,L=c,K=h,z=l,I=d,H=p,F=y,V=b,W=m=65535&T|j<<16,J=v,Z=g,G=w,q=_,E%16==15)for(A=0;A<16;A++)k=O[A],T=65535&(B=R[A]),j=B>>>16,x=65535&k,P=k>>>16,k=O[(A+9)%16],T+=65535&(B=R[(A+9)%16]),j+=B>>>16,x+=65535&k,P+=k>>>16,M=O[(A+1)%16],T+=65535&(B=((S=R[(A+1)%16])>>>1|M<<31)^(S>>>8|M<<24)^(S>>>7|M<<25)),j+=B>>>16,x+=65535&(k=(M>>>1|S<<31)^(M>>>8|S<<24)^M>>>7),P+=k>>>16,M=O[(A+14)%16],j+=(B=((S=R[(A+14)%16])>>>19|M<<13)^(M>>>29|S<<3)^(S>>>6|M<<26))>>>16,x+=65535&(k=(M>>>19|S<<13)^(S>>>29|M<<3)^M>>>6),P+=k>>>16,P+=(x+=(j+=(T+=65535&B)>>>16)>>>16)>>>16,O[A]=65535&x|P<<16,R[A]=65535&T|j<<16;T=65535&(B=q),j=B>>>16,x=65535&(k=I),P=k>>>16,k=e[0],j+=(B=t[0])>>>16,x+=65535&k,P+=k>>>16,P+=(x+=(j+=(T+=65535&B)>>>16)>>>16)>>>16,e[0]=I=65535&x|P<<16,t[0]=q=65535&T|j<<16,T=65535&(B=H),j=B>>>16,x=65535&(k=C),P=k>>>16,k=e[1],j+=(B=t[1])>>>16,x+=65535&k,P+=k>>>16,P+=(x+=(j+=(T+=65535&B)>>>16)>>>16)>>>16,e[1]=C=65535&x|P<<16,t[1]=H=65535&T|j<<16,T=65535&(B=F),j=B>>>16,x=65535&(k=N),P=k>>>16,k=e[2],j+=(B=t[2])>>>16,x+=65535&k,P+=k>>>16,P+=(x+=(j+=(T+=65535&B)>>>16)>>>16)>>>16,e[2]=N=65535&x|P<<16,t[2]=F=65535&T|j<<16,T=65535&(B=V),j=B>>>16,x=65535&(k=U),P=k>>>16,k=e[3],j+=(B=t[3])>>>16,x+=65535&k,P+=k>>>16,P+=(x+=(j+=(T+=65535&B)>>>16)>>>16)>>>16,e[3]=U=65535&x|P<<16,t[3]=V=65535&T|j<<16,T=65535&(B=W),j=B>>>16,x=65535&(k=D),P=k>>>16,k=e[4],j+=(B=t[4])>>>16,x+=65535&k,P+=k>>>16,P+=(x+=(j+=(T+=65535&B)>>>16)>>>16)>>>16,e[4]=D=65535&x|P<<16,t[4]=W=65535&T|j<<16,T=65535&(B=J),j=B>>>16,x=65535&(k=L),P=k>>>16,k=e[5],j+=(B=t[5])>>>16,x+=65535&k,P+=k>>>16,P+=(x+=(j+=(T+=65535&B)>>>16)>>>16)>>>16,e[5]=L=65535&x|P<<16,t[5]=J=65535&T|j<<16,T=65535&(B=Z),j=B>>>16,x=65535&(k=K),P=k>>>16,k=e[6],j+=(B=t[6])>>>16,x+=65535&k,P+=k>>>16,P+=(x+=(j+=(T+=65535&B)>>>16)>>>16)>>>16,e[6]=K=65535&x|P<<16,t[6]=Z=65535&T|j<<16,T=65535&(B=G),j=B>>>16,x=65535&(k=z),P=k>>>16,k=e[7],j+=(B=t[7])>>>16,x+=65535&k,P+=k>>>16,P+=(x+=(j+=(T+=65535&B)>>>16)>>>16)>>>16,e[7]=z=65535&x|P<<16,t[7]=G=65535&T|j<<16,X+=128,i-=128}return i}function u(e,t,r,n){e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r,e[t+4]=n>>24&255,e[t+5]=n>>16&255,e[t+6]=n>>8&255,e[t+7]=255&n}},{"./array":141,"./check":146}],153:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("tslib");n.__exportStar(e("./array"),r),n.__exportStar(e("./validate"),r),n.__exportStar(e("./convert"),r),n.__exportStar(e("./verify"),r),n.__exportStar(e("./random"),r),n.__exportStar(e("./scalarmult"),r),n.__exportStar(e("./secretbox"),r),n.__exportStar(e("./box"),r),n.__exportStar(e("./sign"),r),n.__exportStar(e("./hash"),r),n.__exportStar(e("./auth"),r),n.__exportStar(e("./blake2s"),r),n.__exportStar(e("./blake2b"),r),n.__exportStar(e("./sealedbox"),r)},{"./array":141,"./auth":142,"./blake2b":143,"./blake2s":144,"./box":145,"./convert":149,"./hash":152,"./random":155,"./scalarmult":157,"./sealedbox":158,"./secretbox":159,"./sign":160,"./validate":161,"./verify":162,tslib:140}],154:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./array");function i(e,t,r,n){for(var i,o,a,s,u,f,c,h,l,d,p,y,b,m,v,g,w,_,M,S=e.fin?0:2048,E=e.h,A=e.r,k=E[0],B=E[1],T=E[2],j=E[3],x=E[4],P=E[5],O=E[6],R=E[7],I=E[8],C=E[9],N=A[0],U=A[1],D=A[2],L=A[3],K=A[4],z=A[5],q=A[6],H=A[7],F=A[8],V=A[9];n>=16;)d=l=0,d+=(k+=8191&(i=255&t[r+0]|(255&t[r+1])<<8))*N,d+=(B+=8191&(i>>>13|(o=255&t[r+2]|(255&t[r+3])<<8)<<3))*(5*V),d+=(T+=8191&(o>>>10|(a=255&t[r+4]|(255&t[r+5])<<8)<<6))*(5*F),d+=(j+=8191&(a>>>7|(s=255&t[r+6]|(255&t[r+7])<<8)<<9))*(5*H),l=(d+=(x+=8191&(s>>>4|(u=255&t[r+8]|(255&t[r+9])<<8)<<12))*(5*q))>>>13,d&=8191,d+=(P+=u>>>1&8191)*(5*z),d+=(O+=8191&(u>>>14|(f=255&t[r+10]|(255&t[r+11])<<8)<<2))*(5*K),d+=(R+=8191&(f>>>11|(c=255&t[r+12]|(255&t[r+13])<<8)<<5))*(5*L),d+=(I+=8191&(c>>>8|(h=255&t[r+14]|(255&t[r+15])<<8)<<8))*(5*D),p=l+=(d+=(C+=h>>>5|S)*(5*U))>>>13,p+=k*U,p+=B*N,p+=T*(5*V),p+=j*(5*F),l=(p+=x*(5*H))>>>13,p&=8191,p+=P*(5*q),p+=O*(5*z),p+=R*(5*K),p+=I*(5*L),l+=(p+=C*(5*D))>>>13,p&=8191,y=l,y+=k*D,y+=B*U,y+=T*N,y+=j*(5*V),l=(y+=x*(5*F))>>>13,y&=8191,y+=P*(5*H),y+=O*(5*q),y+=R*(5*z),y+=I*(5*K),b=l+=(y+=C*(5*L))>>>13,b+=k*L,b+=B*D,b+=T*U,b+=j*N,l=(b+=x*(5*V))>>>13,b&=8191,b+=P*(5*F),b+=O*(5*H),b+=R*(5*q),b+=I*(5*z),m=l+=(b+=C*(5*K))>>>13,m+=k*K,m+=B*L,m+=T*D,m+=j*U,l=(m+=x*N)>>>13,m&=8191,m+=P*(5*V),m+=O*(5*F),m+=R*(5*H),m+=I*(5*q),v=l+=(m+=C*(5*z))>>>13,v+=k*z,v+=B*K,v+=T*L,v+=j*D,l=(v+=x*U)>>>13,v&=8191,v+=P*N,v+=O*(5*V),v+=R*(5*F),v+=I*(5*H),g=l+=(v+=C*(5*q))>>>13,g+=k*q,g+=B*z,g+=T*K,g+=j*L,l=(g+=x*D)>>>13,g&=8191,g+=P*U,g+=O*N,g+=R*(5*V),g+=I*(5*F),w=l+=(g+=C*(5*H))>>>13,w+=k*H,w+=B*q,w+=T*z,w+=j*K,l=(w+=x*L)>>>13,w&=8191,w+=P*D,w+=O*U,w+=R*N,w+=I*(5*V),_=l+=(w+=C*(5*F))>>>13,_+=k*F,_+=B*H,_+=T*q,_+=j*z,l=(_+=x*K)>>>13,_&=8191,_+=P*L,_+=O*D,_+=R*U,_+=I*N,M=l+=(_+=C*(5*V))>>>13,M+=k*V,M+=B*F,M+=T*H,M+=j*q,l=(M+=x*z)>>>13,M&=8191,M+=P*K,M+=O*L,M+=R*D,M+=I*U,k=d=8191&(l=(l=((l+=(M+=C*N)>>>13)<<2)+l|0)+(d&=8191)|0),B=p+=l>>>=13,T=y&=8191,j=b&=8191,x=m&=8191,P=v&=8191,O=g&=8191,R=w&=8191,I=_&=8191,C=M&=8191,r+=16,n-=16;E[0]=k,E[1]=B,E[2]=T,E[3]=j,E[4]=x,E[5]=P,E[6]=O,E[7]=R,E[8]=I,E[9]=C}r.poly1305_init=function(e){var t,r,i,o,a,s,u,f,c=n.HalfArray(10),h=n.HalfArray(8);return t=255&e[0]|(255&e[1])<<8,c[0]=8191&t,r=255&e[2]|(255&e[3])<<8,c[1]=8191&(t>>>13|r<<3),i=255&e[4]|(255&e[5])<<8,c[2]=7939&(r>>>10|i<<6),o=255&e[6]|(255&e[7])<<8,c[3]=8191&(i>>>7|o<<9),a=255&e[8]|(255&e[9])<<8,c[4]=255&(o>>>4|a<<12),c[5]=a>>>1&8190,s=255&e[10]|(255&e[11])<<8,c[6]=8191&(a>>>14|s<<2),u=255&e[12]|(255&e[13])<<8,c[7]=8065&(s>>>11|u<<5),f=255&e[14]|(255&e[15])<<8,c[8]=8191&(u>>>8|f<<8),c[9]=f>>>5&127,h[0]=255&e[16]|(255&e[17])<<8,h[1]=255&e[18]|(255&e[19])<<8,h[2]=255&e[20]|(255&e[21])<<8,h[3]=255&e[22]|(255&e[23])<<8,h[4]=255&e[24]|(255&e[25])<<8,h[5]=255&e[26]|(255&e[27])<<8,h[6]=255&e[28]|(255&e[29])<<8,h[7]=255&e[30]|(255&e[31])<<8,{buffer:n.ByteArray(16),r:c,h:n.HalfArray(10),pad:h,leftover:0,fin:0}},r.poly1305_blocks=i,r.poly1305_finish=function(e,t,r){var o,a,s,u,f=n.HalfArray(10),c=e.buffer,h=e.h,l=e.pad,d=e.leftover;if(d){for(u=d,c[u++]=1;u<16;u++)c[u]=0;e.fin=1,i(e,c,0,16)}for(o=h[1]>>>13,h[1]&=8191,u=2;u<10;u++)h[u]+=o,o=h[u]>>>13,h[u]&=8191;for(h[0]+=5*o,o=h[0]>>>13,h[0]&=8191,h[1]+=o,o=h[1]>>>13,h[1]&=8191,h[2]+=o,f[0]=h[0]+5,o=f[0]>>>13,f[0]&=8191,u=1;u<10;u++)f[u]=h[u]+o,o=f[u]>>>13,f[u]&=8191;for(f[9]-=8192,a=(1^o)-1,u=0;u<10;u++)f[u]&=a;for(a=~a,u=0;u<10;u++)h[u]=h[u]&a|f[u];for(h[0]=65535&(h[0]|h[1]<<13),h[1]=65535&(h[1]>>>3|h[2]<<10),h[2]=65535&(h[2]>>>6|h[3]<<7),h[3]=65535&(h[3]>>>9|h[4]<<4),h[4]=65535&(h[4]>>>12|h[5]<<1|h[6]<<14),h[5]=65535&(h[6]>>>2|h[7]<<11),h[6]=65535&(h[7]>>>5|h[8]<<8),h[7]=65535&(h[8]>>>8|h[9]<<5),s=h[0]+l[0],h[0]=65535&s,u=1;u<8;u++)s=(h[u]+l[u]|0)+(s>>>16)|0,h[u]=65535&s;t[r+0]=h[0]>>>0&255,t[r+1]=h[0]>>>8&255,t[r+2]=h[1]>>>0&255,t[r+3]=h[1]>>>8&255,t[r+4]=h[2]>>>0&255,t[r+5]=h[2]>>>8&255,t[r+6]=h[3]>>>0&255,t[r+7]=h[3]>>>8&255,t[r+8]=h[4]>>>0&255,t[r+9]=h[4]>>>8&255,t[r+10]=h[5]>>>0&255,t[r+11]=h[5]>>>8&255,t[r+12]=h[6]>>>0&255,t[r+13]=h[6]>>>8&255,t[r+14]=h[7]>>>0&255,t[r+15]=h[7]>>>8&255},r.poly1305_update=function(e,t,r,n){var o,a,s=e.buffer;if(e.leftover){for((a=16-e.leftover)>n&&(a=n),o=0;o=16&&(i(e,t,r,a=n-n%16),r+=a,n-=a),n){for(o=0;o>>25)+_|0)<<9|i>>>23)+A|0)<<13|i>>>19)+j|0)<<18|i>>>14,k^=(i=(M^=(i=(I^=(i=(x^=(i=k+M|0)<<7|i>>>25)+k|0)<<9|i>>>23)+x|0)<<13|i>>>19)+I|0)<<18|i>>>14,P^=(i=(B^=(i=(S^=(i=(C^=(i=P+B|0)<<7|i>>>25)+P|0)<<9|i>>>23)+C|0)<<13|i>>>19)+S|0)<<18|i>>>14,N^=(i=(O^=(i=(T^=(i=(E^=(i=N+O|0)<<7|i>>>25)+N|0)<<9|i>>>23)+E|0)<<13|i>>>19)+T|0)<<18|i>>>14,_^=(i=(E^=(i=(S^=(i=(M^=(i=_+E|0)<<7|i>>>25)+_|0)<<9|i>>>23)+M|0)<<13|i>>>19)+S|0)<<18|i>>>14,k^=(i=(A^=(i=(T^=(i=(B^=(i=k+A|0)<<7|i>>>25)+k|0)<<9|i>>>23)+B|0)<<13|i>>>19)+T|0)<<18|i>>>14,P^=(i=(x^=(i=(j^=(i=(O^=(i=P+x|0)<<7|i>>>25)+P|0)<<9|i>>>23)+O|0)<<13|i>>>19)+j|0)<<18|i>>>14,N^=(i=(C^=(i=(I^=(i=(R^=(i=N+C|0)<<7|i>>>25)+N|0)<<9|i>>>23)+R|0)<<13|i>>>19)+I|0)<<18|i>>>14;_=_+o|0,M=M+a|0,S=S+s|0,E=E+u|0,A=A+f|0,k=k+c|0,B=B+h|0,T=T+l|0,j=j+d|0,x=x+p|0,P=P+y|0,O=O+b|0,R=R+m|0,I=I+v|0,C=C+g|0,N=N+w|0,e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=M>>>0&255,e[5]=M>>>8&255,e[6]=M>>>16&255,e[7]=M>>>24&255,e[8]=S>>>0&255,e[9]=S>>>8&255,e[10]=S>>>16&255,e[11]=S>>>24&255,e[12]=E>>>0&255,e[13]=E>>>8&255,e[14]=E>>>16&255,e[15]=E>>>24&255,e[16]=A>>>0&255,e[17]=A>>>8&255,e[18]=A>>>16&255,e[19]=A>>>24&255,e[20]=k>>>0&255,e[21]=k>>>8&255,e[22]=k>>>16&255,e[23]=k>>>24&255,e[24]=B>>>0&255,e[25]=B>>>8&255,e[26]=B>>>16&255,e[27]=B>>>24&255,e[28]=T>>>0&255,e[29]=T>>>8&255,e[30]=T>>>16&255,e[31]=T>>>24&255,e[32]=j>>>0&255,e[33]=j>>>8&255,e[34]=j>>>16&255,e[35]=j>>>24&255,e[36]=x>>>0&255,e[37]=x>>>8&255,e[38]=x>>>16&255,e[39]=x>>>24&255,e[40]=P>>>0&255,e[41]=P>>>8&255,e[42]=P>>>16&255,e[43]=P>>>24&255,e[44]=O>>>0&255,e[45]=O>>>8&255,e[46]=O>>>16&255,e[47]=O>>>24&255,e[48]=R>>>0&255,e[49]=R>>>8&255,e[50]=R>>>16&255,e[51]=R>>>24&255,e[52]=I>>>0&255,e[53]=I>>>8&255,e[54]=I>>>16&255,e[55]=I>>>24&255,e[56]=C>>>0&255,e[57]=C>>>8&255,e[58]=C>>>16&255,e[59]=C>>>24&255,e[60]=N>>>0&255,e[61]=N>>>8&255,e[62]=N>>>16&255,e[63]=N>>>24&255}function o(e,t,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,u=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,f=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,c=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,h=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,l=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,d=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,y=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,b=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,m=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,v=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,g=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=0;_<20;_+=2)o^=(i=(m^=(i=(d^=(i=(f^=(i=o+m|0)<<7|i>>>25)+o|0)<<9|i>>>23)+f|0)<<13|i>>>19)+d|0)<<18|i>>>14,c^=(i=(a^=(i=(v^=(i=(p^=(i=c+a|0)<<7|i>>>25)+c|0)<<9|i>>>23)+p|0)<<13|i>>>19)+v|0)<<18|i>>>14,y^=(i=(h^=(i=(s^=(i=(g^=(i=y+h|0)<<7|i>>>25)+y|0)<<9|i>>>23)+g|0)<<13|i>>>19)+s|0)<<18|i>>>14,w^=(i=(b^=(i=(l^=(i=(u^=(i=w+b|0)<<7|i>>>25)+w|0)<<9|i>>>23)+u|0)<<13|i>>>19)+l|0)<<18|i>>>14,o^=(i=(u^=(i=(s^=(i=(a^=(i=o+u|0)<<7|i>>>25)+o|0)<<9|i>>>23)+a|0)<<13|i>>>19)+s|0)<<18|i>>>14,c^=(i=(f^=(i=(l^=(i=(h^=(i=c+f|0)<<7|i>>>25)+c|0)<<9|i>>>23)+h|0)<<13|i>>>19)+l|0)<<18|i>>>14,y^=(i=(p^=(i=(d^=(i=(b^=(i=y+p|0)<<7|i>>>25)+y|0)<<9|i>>>23)+b|0)<<13|i>>>19)+d|0)<<18|i>>>14,w^=(i=(g^=(i=(v^=(i=(m^=(i=w+g|0)<<7|i>>>25)+w|0)<<9|i>>>23)+m|0)<<13|i>>>19)+v|0)<<18|i>>>14;e[0]=o>>>0&255,e[1]=o>>>8&255,e[2]=o>>>16&255,e[3]=o>>>24&255,e[4]=c>>>0&255,e[5]=c>>>8&255,e[6]=c>>>16&255,e[7]=c>>>24&255,e[8]=y>>>0&255,e[9]=y>>>8&255,e[10]=y>>>16&255,e[11]=y>>>24&255,e[12]=w>>>0&255,e[13]=w>>>8&255,e[14]=w>>>16&255,e[15]=w>>>24&255,e[16]=h>>>0&255,e[17]=h>>>8&255,e[18]=h>>>16&255,e[19]=h>>>24&255,e[20]=l>>>0&255,e[21]=l>>>8&255,e[22]=l>>>16&255,e[23]=l>>>24&255,e[24]=d>>>0&255,e[25]=d>>>8&255,e[26]=d>>>16&255,e[27]=d>>>24&255,e[28]=p>>>0&255,e[29]=p>>>8&255,e[30]=p>>>16&255,e[31]=p>>>24&255}r._salsa20=i,r._hsalsa20=o,r._sigma=n.ByteArray([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]),r._stream=function(e,t,a,s,u){var f=n.ByteArray(32),c=n.ByteArray(8);o(f,s,u,r._sigma);for(var h=0;h<8;h++)c[h]=s[h+16];return function(e,t,o,a,s){var u,f,c=n.ByteArray(16),h=n.ByteArray(64);for(f=0;f<16;f++)c[f]=0;for(f=0;f<8;f++)c[f]=a[f];for(;o>=64;){for(i(h,c,s,r._sigma),f=0;f<64;f++)e[t+f]=h[f];for(u=1,f=8;f<16;f++)u=u+(255&c[f])|0,c[f]=255&u,u>>>=8;o-=64,t+=64}if(o>0)for(i(h,c,s,r._sigma),f=0;f=64;){for(i(d,l,f,r._sigma),h=0;h<64;h++)e[t+h]=o[a+h]^d[h];for(c=1,h=8;h<16;h++)c=c+(255&l[h])|0,l[h]=255&c,c>>>=8;s-=64,t+=64,a+=64}if(s>0)for(i(d,l,f,r._sigma),h=0;h=0;--s)a=u[s>>>3]>>>(7&s)&1,o.sel25519(c,h,a),o.sel25519(l,d,a),i.A(p,c,l),i.Z(c,c,l),i.A(l,h,d),i.Z(h,h,d),i.S(d,p),i.S(y,c),i.M(c,l,c),i.M(l,h,p),i.A(p,c,l),i.Z(c,c,l),i.S(h,c),i.Z(l,d,y),i.M(c,l,i._121665),i.A(c,c,d),i.M(l,l,c),i.M(c,d,y),i.M(d,h,f),i.S(h,p),o.sel25519(c,h,a),o.sel25519(l,d,a);for(s=0;s<16;s++)f[s+16]=c[s],f[s+32]=l[s],f[s+48]=h[s],f[s+64]=d[s];var b=f.subarray(32),m=f.subarray(16);return o.inv25519(b,b),i.M(m,m,b),o.pack25519(e,m),0}function u(e,t){return s(e,t,i._9)}r.scalarMult=function(e,t){if(a.checkArrayTypes(e,t),32!==e.length)throw new Error("bad n size");if(32!==t.length)throw new Error("bad p size");var r=n.ByteArray(32);return s(r,e,t),r},r.scalarMult_base=function(e){if(a.checkArrayTypes(e),32!==e.length)throw new Error("bad n size");var t=n.ByteArray(32);return u(t,e),t},r._scalarMult=s,r._scalarMult_base=u},{"./array":141,"./check":146,"./core":150,"./curve25519":151}],158:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./array"),i=e("./box"),o=e("./blake2b");function a(e,t){var r=o.blake2b_init(24);return o.blake2b_update(r,e),o.blake2b_update(r,t),o.blake2b_final(r)}r.sealedbox=function(e,t){var r=n.ByteArray(48+e.length),o=i.box_keyPair();r.set(o.publicKey);var s=a(o.publicKey,t),u=i.box(e,s,t,o.secretKey);r.set(u,o.publicKey.length);for(var f=0;f=0;r--)o.S(n,n),1!==r&&o.M(n,n,t);for(r=0;r<16;r++)e[r]=n[r]}(r,r),o.M(r,r,i),o.M(r,r,a),o.M(r,r,a),o.M(e[0],r,a),o.S(n,e[0]),o.M(n,n,a),s.neq25519(n,i)&&o.M(e[0],e[0],o.I);if(o.S(n,e[0]),o.M(n,n,a),s.neq25519(n,i))return-1;s.par25519(e[0])===t[31]>>7&&o.Z(e[0],o.gf0,e[0]);return o.M(e[3],e[0],e[1]),0}(m,a))return-1;for(f=0;f=0;--i)w(e,t,n=r[i/8|0]>>(7&i)&1),g(t,e),g(e,e),w(e,t,n)}function y(e,t){var r=o.gf(),n=o.gf(),i=o.gf();s.inv25519(i,t[2]),o.M(r,t[0],i),o.M(n,t[1],i),s.pack25519(e,n),e[31]^=s.par25519(r)<<7}function b(e){var t,r=n.NumArray(64);for(t=0;t<64;t++)r[t]=e[t];for(t=0;t<64;t++)e[t]=0;v(e,r)}r.sign=c,r.sign_open=function(e,t){if(f.checkArrayTypes(e,t),32!==t.length)throw new Error("bad public key size");var r=n.ByteArray(e.length),i=l(r,e,e.length,t);if(!(i<0)){for(var o=n.ByteArray(i),a=0;a=0},r.sign_keyPair=function(){var e=n.ByteArray(32),t=n.ByteArray(64);return h(e,t,!1),{publicKey:e,secretKey:t}},r.sign_keyPair_fromSecretKey=function(e){if(f.checkArrayTypes(e),64!==e.length)throw new Error("bad secret key size");for(var t=n.ByteArray(32),r=0;r=32;--n){for(r=0,i=n-32,o=n-12;i>8,t[i]-=256*r;t[i]+=r,t[n]=0}for(r=0,i=0;i<32;i++)t[i]+=r-(t[31]>>4)*m[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=r*m[i];for(n=0;n<32;n++)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function g(e,t){var r=o.gf(),n=o.gf(),i=o.gf(),a=o.gf(),s=o.gf(),u=o.gf(),f=o.gf(),c=o.gf(),h=o.gf();o.Z(r,e[1],e[0]),o.Z(h,t[1],t[0]),o.M(r,r,h),o.A(n,e[0],e[1]),o.A(h,t[0],t[1]),o.M(n,n,h),o.M(i,e[3],t[3]),o.M(i,i,o.D2),o.M(a,e[2],t[2]),o.A(a,a,a),o.Z(s,n,r),o.Z(u,a,i),o.A(f,a,i),o.A(c,n,r),o.M(e[0],s,u),o.M(e[1],c,f),o.M(e[2],f,u),o.M(e[3],s,c)}function w(e,t,r){for(var n=0;n<4;n++)s.sel25519(e[n],t[n],r)}},{"./array":141,"./check":146,"./core":150,"./curve25519":151,"./hash":152,"./random":155,"./verify":162}],161:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.validateBase64=function(e){if(!/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e))throw new TypeError("invalid base64 string")},r.validateHex=function(e){if(!/^(?:[A-Fa-f0-9]{2})+$/.test(e))throw new TypeError("invalid hex string")}},{}],162:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./check");function i(e,t,r,n,i){var o,a=0;for(o=0;o>>8)-1}r._verify_16=function(e,t,r,n){return i(e,t,r,n,16)},r._verify_32=function(e,t,r,n){return i(e,t,r,n,32)},r.verify=function(e,t){return n.checkArrayTypes(e,t),e.length>0&&t.length>0&&e.length==t.length&&0==i(e,0,t,0,e.length)}},{"./check":146}],163:[function(e,t,r){(function(e){(function(){!function(e,r){"use strict";void 0!==t&&t.exports?t.exports=r():e.nacl?e.nacl.util=r():(e.nacl={},e.nacl.util=r())}(this,function(){"use strict";var t={};function r(e){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e))throw new TypeError("invalid encoding")}return t.decodeUTF8=function(e){if("string"!=typeof e)throw new TypeError("expected string");var t,r=unescape(encodeURIComponent(e)),n=new Uint8Array(r.length);for(t=0;t=2&&'"'===e[0]&&'"'===e[e.length-1];if(t===Date){var i=!isNaN(Number(e.trim()));return!n&&!i}return r&&!n}r.LAZY_TYPE_EXPLANATION="If the type is not yet defined, for example due to circular references, add '() => ' before it. E.g. @jsonMember(() => Foo)",r.MISSING_REFLECT_CONF_MSG='Make sure that you have both "experimentalDecorators" and "emitDecoratorMetadata" enabled in your tsconfig.json',r.isDirectlySerializableNativeType=function(e){return-1!==[Date,Number,String,Boolean].indexOf(e)},r.isDirectlyDeserializableNativeType=function(e){return-1!==[Number,String,Boolean].indexOf(e)},r.isTypeTypedArray=function(e){return-1!==[Float32Array,Float64Array,Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array].indexOf(e)},r.isObject=o,r.shouldOmitParseString=a,r.parseToJSObject=function(e,t){return"string"!=typeof e||a(e,t)?e:JSON.parse(e)},r.isSubtypeOf=function(e,t){return e===t||e.prototype instanceof t},r.logError=function(e){for(var t=[],r=1;r-1}).reduce(function(t,r){return t[r]=e[r],t},{});return Object.keys(t).length>0?t:void 0},r.getDefaultOptionOf=o,r.getOptionValue=function(e,t){return null!=t&&null!=t[e]?t[e]:o(e)},r.mergeOptions=function(e,t){return null==t?e:n(n({},e),t)}},{}],174:[function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r-1};function o(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function a(e){return"string"!=typeof e&&(e=String(e)),e}function s(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r.iterable&&(t[Symbol.iterator]=function(){return t}),t}function u(e){this.map={},e instanceof u?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function f(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function c(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function h(e){var t=new FileReader,r=c(t);return t.readAsArrayBuffer(e),r}function l(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function d(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:r.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:r.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():r.arrayBuffer&&r.blob&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=l(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||i(e))?this._bodyArrayBuffer=l(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var e=f(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=f(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(h)}),this.text=function(){var e,t,r,n=f(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=c(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n-1?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var o=/([?&])_=[^&]*/;if(o.test(this.url))this.url=this.url.replace(o,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function b(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(i))}}),t}function m(e,t){if(!(this instanceof m))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new u(t.headers),this.url=t.url||"",this._initBody(e)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},d.call(y.prototype),d.call(m.prototype),m.prototype.clone=function(){return new m(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},m.error=function(){var e=new m(null,{status:0,statusText:""});return e.type="error",e};var v=[301,302,303,307,308];m.redirect=function(e,t){if(-1===v.indexOf(t))throw new RangeError("Invalid status code");return new m(null,{status:t,headers:{location:e}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function g(n,i){return new Promise(function(o,s){var f=new y(n,i);if(f.signal&&f.signal.aborted)return s(new e.DOMException("Aborted","AbortError"));var c=new XMLHttpRequest;function h(){c.abort()}c.onload=function(){var e,t,r={status:c.status,statusText:c.statusText,headers:(e=c.getAllResponseHeaders()||"",t=new u,e.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e}).forEach(function(e){var r=e.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();t.append(n,i)}}),t)};r.url="responseURL"in c?c.responseURL:r.headers.get("X-Request-URL");var n="response"in c?c.response:c.responseText;setTimeout(function(){o(new m(n,r))},0)},c.onerror=function(){setTimeout(function(){s(new TypeError("Network request failed"))},0)},c.ontimeout=function(){setTimeout(function(){s(new TypeError("Network request failed"))},0)},c.onabort=function(){setTimeout(function(){s(new e.DOMException("Aborted","AbortError"))},0)},c.open(f.method,function(e){try{return""===e&&t.location.href?t.location.href:e}catch(t){return e}}(f.url),!0),"include"===f.credentials?c.withCredentials=!0:"omit"===f.credentials&&(c.withCredentials=!1),"responseType"in c&&(r.blob?c.responseType="blob":r.arrayBuffer&&f.headers.get("Content-Type")&&-1!==f.headers.get("Content-Type").indexOf("application/octet-stream")&&(c.responseType="arraybuffer")),!i||"object"!=typeof i.headers||i.headers instanceof u?f.headers.forEach(function(e,t){c.setRequestHeader(t,e)}):Object.getOwnPropertyNames(i.headers).forEach(function(e){c.setRequestHeader(e,a(i.headers[e]))}),f.signal&&(f.signal.addEventListener("abort",h),c.onreadystatechange=function(){4===c.readyState&&f.signal.removeEventListener("abort",h)}),c.send(void 0===f._bodyInit?null:f._bodyInit)})}g.polyfill=!0,t.fetch||(t.fetch=g,t.Headers=u,t.Request=y,t.Response=m),e.Headers=u,e.Request=y,e.Response=m,e.fetch=g,Object.defineProperty(e,"__esModule",{value:!0})}("object"==typeof r&&void 0!==t?r:n.WHATWGFetch={})},{}],181:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),i(e("./services"),r),i(e("./lib"),r);var o=e("./lib/Conversions");Object.defineProperty(r,"base64to16",{enumerable:!0,get:function(){return o.base64to16}}),Object.defineProperty(r,"encodeBase16",{enumerable:!0,get:function(){return o.encodeBase16}}),Object.defineProperty(r,"decodeBase16",{enumerable:!0,get:function(){return o.decodeBase16}}),Object.defineProperty(r,"encodeBase64",{enumerable:!0,get:function(){return o.encodeBase64}}),Object.defineProperty(r,"decodeBase64",{enumerable:!0,get:function(){return o.decodeBase64}})},{"./lib":194,"./lib/Conversions":186,"./services":198}],182:[function(e,t,r){(function(t){(function(){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(r,"__esModule",{value:!0}),r.URef=r.AccessRights=r.KeyValue=r.AccountHash=r.KeyVariant=r.CLValue=r.CLTypedAndToBytesHelper=r.CLTypeHelper=r.OptionType=r.MapValue=r.PublicKey=r.Tuple3=r.Tuple2=r.Tuple1=r.List=r.fromBytesByCLType=r.StringValue=r.Unit=r.U512=r.U128=r.I64=r.U64=r.I32=r.U32=r.U8=r.Bool=r.Result=r.FromBytesError=r.SimpleType=r.staticImplements=r.CLTypedAndToBytes=void 0;var s=e("@ethersproject/bytes"),u=e("./byterepr"),f=e("@ethersproject/bignumber"),c=e("./Conversions"),h=e("./option"),l=e("./Contracts"),d=e("./Keys"),p=e("typedjson"),y=function(){function e(){}return e.prototype.clTypeEncoded=function(){return G.toBytesHelper(this.clType())},e}();function b(){return function(e){}}r.CLTypedAndToBytes=y,r.staticImplements=b;var m,v,g;!function(e){e[e.Bool=0]="Bool",e[e.I32=1]="I32",e[e.I64=2]="I64",e[e.U8=3]="U8",e[e.U32=4]="U32",e[e.U64=5]="U64",e[e.U128=6]="U128",e[e.U256=7]="U256",e[e.U512=8]="U512",e[e.Unit=9]="Unit",e[e.String=10]="String",e[e.Key=11]="Key",e[e.URef=12]="URef",e[e.PublicKey=22]="PublicKey"}(m=r.SimpleType||(r.SimpleType={})),function(e){e[e.Option=13]="Option",e[e.List=14]="List",e[e.ByteArray=15]="ByteArray",e[e.Result=16]="Result",e[e.Map=17]="Map",e[e.Tuple1=18]="Tuple1",e[e.Tuple2=19]="Tuple2",e[e.Tuple3=20]="Tuple3",e[e.Any=21]="Any"}(v||(v={})),function(e){e[e.Ok=0]="Ok",e[e.EarlyEndOfStream=1]="EarlyEndOfStream",e[e.FormattingError=2]="FormattingError"}(g=r.FromBytesError||(r.FromBytesError={}));var w=function(){function e(e,t,r){this.val=e,this.rem=t,this.error=r}return e.Err=function(t){return new e(null,null,t)},e.Ok=function(t,r){return new e(t,r,g.Ok)},e.prototype.remainder=function(){if(null===this.rem)throw new Error("Don't have remainder");return this.rem},e.prototype.value=function(){if(!this.hasValue())throw new Error("Don't have value");return this.val},e.prototype.hasValue=function(){return null!==this.val},e.prototype.hasError=function(){return this.error!==g.Ok},e}();r.Result=w;var _=function(e){function t(t){var r=e.call(this)||this;return r.val=t,r}var r;return i(t,e),r=t,t.prototype.toBytes=function(){return new Uint8Array([this.val?1:0])},t.prototype.clType=function(){return m.Bool},t.fromBytes=function(e){return 0===e.length?w.Err(g.EarlyEndOfStream):1===e[0]?w.Ok(new r(!0),e.subarray(1)):0===e[0]?w.Ok(new r(!1),e.subarray(1)):w.Err(g.FormattingError)},t=r=o([function(e){},a("design:paramtypes",[Boolean])],t)}(y);r.Bool=_;var M=function(e){function t(t,r,n){var i=e.call(this)||this;return i.toBytes=function(){return u.toBytesNumber(i.bitSize,i.signed,i.val)},i.name=(r?"i":"u")+t,i.bitSize=t,i.signed=r,i.val=f.BigNumber.from(n),i}return i(t,e),t}(y),S=function(e){function t(t){return e.call(this,8,!1,t)||this}var r;return i(t,e),r=t,t.prototype.clType=function(){return m.U8},t.fromBytes=function(e){return 0===e.length?w.Err(g.EarlyEndOfStream):w.Ok(new r(e[0]),e.subarray(1))},t=r=o([function(e){},a("design:paramtypes",[Number])],t)}(M);r.U8=S;var E=function(e){function r(t){return e.call(this,32,!1,t)||this}var n;return i(r,e),n=r,r.prototype.clType=function(){return m.U32},r.fromBytes=function(e){if(e.length<4)return w.Err(g.EarlyEndOfStream);var r=t.from(e.subarray(0,4)).readUInt32LE(0);return w.Ok(new n(r),e.subarray(4))},r=n=o([function(e){},a("design:paramtypes",[Number])],r)}(M);r.U32=E;var A=function(e){function r(t){return e.call(this,32,!0,t)||this}var n;return i(r,e),n=r,r.prototype.clType=function(){return m.I32},r.fromBytes=function(e){if(e.length<4)return w.Err(g.EarlyEndOfStream);var r=t.from(e.subarray(0,4)).readInt32LE(0);return w.Ok(new n(r),e.subarray(4))},r=n=o([function(e){},a("design:paramtypes",[Number])],r)}(M);r.I32=A;var k=function(e){function t(t){return e.call(this,64,!1,t)||this}var r;return i(t,e),r=t,t.prototype.clType=function(){return m.U64},t.fromBytes=function(e){var t=Uint8Array.from(e);if(e.length<8)return w.Err(g.EarlyEndOfStream);var n=t.subarray(0,8),i=t.subarray(8);return w.Ok(new r(f.BigNumber.from(n.reverse())),i)},t=r=o([function(e){},a("design:paramtypes",[Object])],t)}(M);r.U64=k;var B=function(e){function t(t){return e.call(this,64,!0,t)||this}var r;return i(t,e),r=t,t.prototype.clType=function(){return m.I64},t.fromBytes=function(e){if(e.length<8)return w.Err(g.EarlyEndOfStream);var t=Uint8Array.from(e),n=t.subarray(0,8),i=t.subarray(8);return w.Ok(new r(f.BigNumber.from(n.reverse()).fromTwos(64)),i)},t=r=o([function(e){},a("design:paramtypes",[Object])],t)}(M);r.I64=B;var T=function(e){function t(t){return e.call(this,128,!1,t)||this}return i(t,e),t.prototype.clType=function(){return m.U128},t.fromBytes=function(e){return z(e,128)},t=o([function(e){},a("design:paramtypes",[Object])],t)}(M);r.U128=T;var j=function(e){function t(t){return e.call(this,256,!1,t)||this}return i(t,e),t.prototype.clType=function(){return m.U256},t.fromBytes=function(e){return z(e,256)},t=o([function(e){},a("design:paramtypes",[Object])],t)}(M),x=function(e){function t(t){return e.call(this,512,!1,t)||this}return i(t,e),t.prototype.clType=function(){return m.U512},t.fromBytes=function(e){return z(e,512)},t=o([function(e){},a("design:paramtypes",[Object])],t)}(M);r.U512=x;var P=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}var r;return i(t,e),r=t,t.prototype.clType=function(){return m.Unit},t.prototype.toBytes=function(){return Uint8Array.from([])},t.fromBytes=function(e){return w.Ok(new r,e)},t=r=o([function(e){}],t)}(y);r.Unit=P;var O=function(e){function r(t){var r=e.call(this)||this;return r.val=t,r.toBytes=function(){return u.toBytesString(r.val)},r}var n;return i(r,e),n=r,r.prototype.clType=function(){return m.String},r.fromBytes=function(e){var r=E.fromBytes(e);if(r.hasError())return w.Err(r.error);var i=r.value().val.toNumber(),o=t.from(r.remainder().subarray(0,i)).toString("utf8");return w.Ok(new n(o),r.remainder().subarray(i))},r=n=o([function(e){},a("design:paramtypes",[String])],r)}(y);r.StringValue=O,r.fromBytesByCLType=function(e,t){return e instanceof H?I.fromBytes(e,t):e instanceof W?C.fromBytes(e,t):e instanceof J?N.fromBytes(e,t):e instanceof Z?U.fromBytes(e,t):e instanceof F?K.fromBytes(t):e instanceof V?L.fromBytes(e,t):e instanceof q?h.Option.fromBytes(e,t):R(e,t)};var R=function(e,t){var r;switch(e){case m.Bool:r=_.fromBytes(t);break;case m.I32:r=A.fromBytes(t);break;case m.I64:r=B.fromBytes(t);break;case m.U8:r=S.fromBytes(t);break;case m.U32:r=E.fromBytes(t);break;case m.U64:r=k.fromBytes(t);break;case m.U128:r=T.fromBytes(t);break;case m.U256:r=j.fromBytes(t);break;case m.U512:r=x.fromBytes(t);break;case m.Unit:r=P.fromBytes(t);break;case m.String:r=O.fromBytes(t);break;case m.Key:r=ne.fromBytes(t);break;case m.URef:r=oe.fromBytes(t);break;case m.PublicKey:r=D.fromBytes(t);break;default:r=w.Err(g.FormattingError)}return r.hasError()?w.Err(r.error):w.Ok(r.value(),r.remainder())},I=function(e){function t(t){var r=e.call(this)||this;if(r.vec=t,0===t.length)throw new Error("Can't create instance for empty list");return r}return i(t,e),t.prototype.clType=function(){return G.list(this.vec[0].clType())},t.prototype.toBytes=function(){return u.toBytesVecT(this.vec)},t.fromBytes=function(e,n){var i=E.fromBytes(n);if(i.hasError())return w.Err(i.error);for(var o=i.value().val.toNumber(),a=[],s=i.remainder(),u=0;ur)return w.Err(g.FormattingError);if(o+1>e.length)return w.Err(g.EarlyEndOfStream);n=0===o?[0]:i.subarray(1,1+o);var a=i.subarray(1+o);return 128===t?w.Ok(new T(f.BigNumber.from(n.reverse())),a):256===t?w.Ok(new j(f.BigNumber.from(n.reverse())),a):512===t?w.Ok(new x(f.BigNumber.from(n.reverse())),a):w.Err(g.FormattingError)},q=function(){function e(e){this.innerType=e,this.tag=v.Option}return e.prototype.toJSON=function(){var t,r=Y(this.innerType);return(t={})[e.TypeId]=r,t},e.TypeId="Option",e}();r.OptionType=q;var H=function(){function e(e){this.tag=v.List,this.innerType=e}return e.prototype.toJSON=function(){var t,r=Y(this.innerType);return(t={})[e.TypeId]=r,t},e.TypeId="List",e}(),F=function(){function e(e){this.size=e,this.tag=v.ByteArray}return e.prototype.toJSON=function(){var t;return(t={})[e.TypeId]=this.size,t},e.TypeId="ByteArray",e}(),V=function(){function e(e,t){this.keyType=e,this.valueType=t,this.tag=v.Map}return e.prototype.toJSON=function(){var t;return(t={})[e.TypeId]={key:Y(this.keyType),value:Y(this.valueType)},t},e.TypeId="Map",e}(),W=function(){function e(e){this.t0=e,this.tag=v.Tuple1}return e.prototype.toJSON=function(){var t,r=Y(this.t0);return(t={})[e.TypeId]=r,t},e.TypeId="Tuple1",e}(),J=function(){function e(e,t){this.t0=e,this.t1=t,this.tag=v.Tuple2}return e.prototype.toJSON=function(){var t,r=Y(this.t0),n=Y(this.t1);return(t={})[e.TypeId]=[r,n],t},e.TypeId="Tuple2",e}(),Z=function(){function e(e,t,r){this.t0=e,this.t1=t,this.t2=r,this.tag=v.Tuple3}return e.prototype.toJSON=function(){var t,r=Y(this.t0),n=Y(this.t1),i=Y(this.t2);return(t={})[e.TypeId]=[r,n,i],t},e.TypeId="Tuple3",e}(),G=function(){function e(){}return e.u8=function(){return m.U8},e.u32=function(){return m.U32},e.u64=function(){return m.U64},e.u128=function(){return m.U128},e.u256=function(){return m.U256},e.u512=function(){return m.U512},e.i32=function(){return m.I32},e.i64=function(){return m.I64},e.bool=function(){return m.Bool},e.unit=function(){return m.Unit},e.string=function(){return m.String},e.key=function(){return m.Key},e.publicKey=function(){return m.PublicKey},e.uRef=function(){return m.URef},e.option=function(e){return new q(e)},e.list=function(e){return new H(e)},e.byteArray=function(e){return new F(e)},e.map=function(e,t){return new V(e,t)},e.tuple1=function(e){return new W(e)},e.tuple2=function(e,t){return new J(e,t)},e.tuple3=function(e,t,r){return new Z(e,t,r)},e.fromBytes=function(t){if(t.length<1)return w.Err(g.EarlyEndOfStream);var r=t[0],n=t.subarray(1);switch(r){case m.Bool:case m.I32:case m.I64:case m.U8:case m.U32:case m.U64:case m.U256:case m.U512:case m.Unit:case m.String:case m.Key:case m.URef:case m.PublicKey:return w.Ok(r,n);case v.Option:return(s=e.fromBytes(n)).hasError()?w.Err(s.error):w.Ok(e.option(s.value()),s.remainder());case v.List:return(s=e.fromBytes(n)).hasError()?w.Err(s.error):w.Ok(e.list(s.value()),s.remainder());case v.ByteArray:var i=E.fromBytes(n);return i.hasError()?w.Err(i.error):w.Ok(e.byteArray(i.value().val.toNumber()),i.remainder());case v.Result:throw new Error("Result type is unsupported now");case v.Map:var o=e.fromBytes(n);if(o.hasError())return w.Err(o.error);var a=e.fromBytes(o.remainder());return a.hasError()?w.Err(a.error):w.Ok(e.map(o.value(),a.value()),a.remainder());case v.Tuple1:var s;return(s=e.fromBytes(n)).hasError()?w.Err(s.error):w.Ok(e.tuple1(s.value()),s.remainder());case v.Tuple2:return(u=e.fromBytes(n)).hasError()?w.Err(u.error):(f=e.fromBytes(u.remainder())).hasError()?w.Err(f.error):w.Ok(e.tuple2(u.value(),f.value()),f.remainder());case v.Tuple3:var u,f;if((u=e.fromBytes(n)).hasError())return w.Err(u.error);if((f=e.fromBytes(u.remainder())).hasError())return w.Err(f.error);var c=e.fromBytes(u.remainder());return c.hasError()?w.Err(c.error):w.Ok(e.tuple3(u.value(),f.value(),c.value()),c.remainder());case v.Any:throw new Error("Any type is unsupported now");default:return w.Err(g.FormattingError)}},e.toBytesHelper=function(t){if(t instanceof H)return s.concat([Uint8Array.from([t.tag]),e.toBytesHelper(t.innerType)]);if(t instanceof W)return s.concat([Uint8Array.from([t.tag]),e.toBytesHelper(t.t0)]);if(t instanceof J)return s.concat([Uint8Array.from([t.tag]),e.toBytesHelper(t.t0),e.toBytesHelper(t.t1)]);if(t instanceof Z)return s.concat([Uint8Array.from([t.tag]),e.toBytesHelper(t.t0),e.toBytesHelper(t.t1),e.toBytesHelper(t.t2)]);if(t instanceof F)return s.concat([Uint8Array.from([t.tag]),u.toBytesU32(t.size)]);if(t instanceof V)return s.concat([Uint8Array.from([t.tag]),e.toBytesHelper(t.keyType),e.toBytesHelper(t.valueType)]);if(t instanceof q)return s.concat([Uint8Array.from([t.tag]),e.toBytesHelper(t.innerType)]);switch(t){case m.Bool:case m.I32:case m.I64:case m.U8:case m.U32:case m.U64:case m.U128:case m.U256:case m.U512:case m.Unit:case m.String:case m.Key:case m.URef:case m.PublicKey:return Uint8Array.from([t]);default:throw new Error("Wrong type")}},e}();r.CLTypeHelper=G;var X=function(){function e(){}return e.list=function(e){return new I(e)},e.tuple1=function(e){return new C(e)},e.tuple2=function(e,t){return new N(e,t)},e.tuple3=function(e,t,r){return new U(e,t,r)},e.option=function(e,t){return new h.Option(e,t)},e.map=function(e){return new L(e)},e.publicKey=function(e){return D.fromEd25519(e)},e.bytes=function(e){return new K(e)},e.bool=function(e){return new _(e)},e.u8=function(e){return new S(e)},e.u32=function(e){return new E(e)},e.i32=function(e){return new A(e)},e.u64=function(e){return new k(e)},e.i64=function(e){return new B(e)},e.u128=function(e){return new T(e)},e.u256=function(e){return new j(e)},e.u512=function(e){return new x(e)},e.unit=function(){return new P},e.string=function(e){return new O(e)},e}();r.CLTypedAndToBytesHelper=X;var Y=function(e){return e instanceof H||e instanceof W||e instanceof J||e instanceof Z||e instanceof F||e instanceof V||e instanceof q?e.toJSON():function(e){switch(e){case m.Bool:return"Bool";case m.I32:return"I32";case m.I64:return"I64";case m.U8:return"U8";case m.U32:return"U32";case m.U64:return"U64";case m.U128:return"U128";case m.U256:return"U256";case m.U512:return"U512";case m.Unit:return"Unit";case m.String:return"String";case m.Key:return"Key";case m.URef:return"URef";case m.PublicKey:return"PublicKey"}}(e)},$=function(e){if("string"==typeof e)return function(e){switch(e){case"Bool":return m.Bool;case"I32":return m.I32;case"I64":return m.I64;case"U8":return m.U8;case"U32":return m.U32;case"U64":return m.U64;case"U128":return m.U128;case"U256":return m.U256;case"U512":return m.U512;case"Unit":return m.Unit;case"String":return m.String;case"Key":return m.Key;case"URef":return m.URef;case"PublicKey":return m.PublicKey;default:throw new Error("The type "+e+" is not supported")}}(e);if(typeof e==typeof{}){if(H.TypeId in e){var t=$(e[H.TypeId]);return G.list(t)}if(W.TypeId in e){var r=$(e[W.TypeId][0]);return G.tuple1(r)}if(J.TypeId in e){var n=e[J.TypeId],i=(r=$(n[0]),$(n[1]));return G.tuple2(r,i)}if(Z.TypeId in e){n=e[J.TypeId],r=$(n[0]),i=$(n[1]);var o=$(n[2]);return G.tuple3(r,i,o)}if(F.TypeId in e){var a=e[F.TypeId];return G.byteArray(a)}if(q.TypeId in e){t=$(e[q.TypeId]);return G.option(t)}if(V.TypeId in e){var s=$(e[V.TypeId].key),u=$(e[V.TypeId].value);return G.map(s,u)}throw new Error("The type "+e+" is not supported")}throw new Error("The type "+e+" is not supported")};function Q(e,t){var n=r.fromBytesByCLType(e.clType,c.decodeBase16(e.bytes));return te.fromT(n.value())}var ee,te=function(){function e(e,t){this.value=e,this.clType=t,this.bytes=c.encodeBase16(this.value.toBytes())}var t;return t=e,e.prototype.clValueBytes=function(){return this.value.toBytes()},e.fromT=function(e){return new t(e,e.clType())},e.prototype.toBytes=function(){return s.concat([u.toBytesArrayU8(this.clValueBytes()),G.toBytesHelper(this.clType)])},e.fromBytes=function(e){var n=K.fromBytes(e);if(n.hasError())return w.Err(n.error);var i=G.fromBytes(n.remainder());if(i.hasError())return w.Err(i.error);var o=r.fromBytesByCLType(i.value(),n.value().rawBytes),a=new t(o.value(),i.value());return w.Ok(a,i.remainder())},e.prototype.reconstruct=function(){var e=r.fromBytesByCLType(this.clType,c.decodeBase16(this.bytes));if(e.hasError())throw new Error("Failed to deserialize CLValue");this.value=e.value()},e.list=function(e){return t.fromT(new I(e))},e.tuple1=function(e){return t.fromT(new C(e))},e.tuple2=function(e,r){return t.fromT(new N(e,r))},e.tuple3=function(e,r,n){return t.fromT(new U(e,r,n))},e.option=function(e,r){return t.fromT(new h.Option(e,r))},e.map=function(e){return t.fromT(new L(e))},e.publicKey=function(e){return t.fromT(e)},e.byteArray=function(e){return t.fromT(new K(e))},e.prototype.isBigNumber=function(){return this.clType===m.U8||this.clType===m.I32||this.clType===m.I64||this.clType===m.U32||this.clType===m.U64||this.clType===m.U128||this.clType===m.U256||this.clType===m.U512},e.prototype.asBigNumber=function(){if(this.isBigNumber()){var e=this.value;return f.BigNumber.from(e.val)}throw new Error("The CLValue is not an instance of BigNumber")},e.prototype.isBoolean=function(){return this.clType===m.Bool},e.prototype.asBoolean=function(){if(!this.isBoolean())throw new Error("The CLValue is not an instance of Boolean");return this.value.val},e.prototype.isString=function(){return this.clType===m.String},e.prototype.asString=function(){if(!this.isString())throw new Error("The CLValue is not an instance of String");return this.value.val},e.prototype.isPublicKey=function(){return this.clType===m.PublicKey},e.prototype.asPublicKey=function(){if(!this.isPublicKey())throw new Error("The CLValue is not an instance of PublicKey");return this.value},e.prototype.isKey=function(){return this.clType===m.Key},e.prototype.asKey=function(){if(!this.isKey())throw new Error("The CLValue is not an instance of Key");return this.value},e.prototype.isURef=function(){return this.clType===m.URef},e.prototype.asURef=function(){if(!this.isURef())throw new Error("The CLValue is not an instance of URef");return this.value},e.prototype.isBytesArray=function(){return this.clType instanceof F},e.prototype.asBytesArray=function(){if(!this.isBytesArray())throw new Error("The CLValue is not an instance of BytesArray");return this.value.toBytes()},e.prototype.isOption=function(){return this.clType instanceof q},e.prototype.asOption=function(){if(!this.isOption())throw new Error("The CLValue is not an instance of Option");return this.value},e.prototype.isList=function(){return this.clType instanceof H},e.prototype.asList=function(){if(!this.isList())throw new Error("The CLValue is not an instance of List");var e=this.clType,r=I.fromBytes(e,this.clValueBytes());if(r.hasError())throw new Error("The CLValue can not be parsed to list.");return r.value().vec.map(function(e){return t.fromT(e)})},e.bool=function(e){return t.fromT(new _(e))},e.u8=function(e){return t.fromT(new S(e))},e.u32=function(e){return t.fromT(new E(e))},e.i32=function(e){return t.fromT(new A(e))},e.u64=function(e){return t.fromT(new k(e))},e.i64=function(e){return t.fromT(new B(e))},e.u128=function(e){return t.fromT(new T(e))},e.u256=function(e){return t.fromT(new j(e))},e.u512=function(e){return t.fromT(new x(e))},e.unit=function(){return t.fromT(new P)},e.string=function(e){return t.fromT(new O(e))},e.key=function(e){return t.fromT(e)},e.uref=function(e){return t.fromT(e)},e.stringList=function(e){var r=X.list(e.map(function(e){return X.string(e)}));return new t(r,G.list(m.String))},o([p.jsonMember({name:"cl_type",serializer:Y,deserializer:$}),a("design:type",Object)],e.prototype,"clType",void 0),o([p.jsonMember({constructor:String}),a("design:type",String)],e.prototype,"bytes",void 0),o([p.jsonMember({serializer:function(e){return"null"},deserializer:function(e){return null}}),a("design:type",Object)],e.prototype,"parsed",void 0),e=t=o([p.jsonObject({initializer:function(e,t){return Q(e)}}),a("design:paramtypes",[y,Object])],e)}();r.CLValue=te,function(e){e[e.ACCOUNT_ID=0]="ACCOUNT_ID",e[e.HASH_ID=1]="HASH_ID",e[e.UREF_ID=2]="UREF_ID"}(ee=r.KeyVariant||(r.KeyVariant={}));var re=function(e){function t(t){var r=e.call(this)||this;return r.bytes=t,r}var r;return i(t,e),r=t,t.prototype.toBytes=function(){return this.bytes},t.prototype.clType=function(){return G.byteArray(32)},t.fromBytes=function(e){if(e.length<32)return w.Err(g.EarlyEndOfStream);var t=e.subarray(0,32),n=new r(t);return w.Ok(n,e.subarray(32))},t=r=o([function(e){},a("design:paramtypes",[Uint8Array])],t)}(y);r.AccountHash=re;var ne=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}var r;return i(t,e),r=t,t.prototype.isHash=function(){return this.variant===ee.HASH_ID},t.prototype.isURef=function(){return this.variant===ee.UREF_ID},t.prototype.isAccount=function(){return this.variant===ee.ACCOUNT_ID},t.fromURef=function(e){var t=new r;return t.variant=ee.UREF_ID,t.uRef=e,t},t.fromHash=function(e){var t=new r;return t.variant=ee.HASH_ID,t.hash=e,t},t.fromAccount=function(e){var t=new r;return t.variant=ee.ACCOUNT_ID,t.account=e,t},t.prototype.clType=function(){return m.Key},t.prototype.toBytes=function(){if(this.variant===ee.ACCOUNT_ID)return s.concat([Uint8Array.from([this.variant]),this.account.toBytes()]);if(this.variant===ee.HASH_ID)return s.concat([Uint8Array.from([this.variant]),this.hash]);if(this.variant===ee.UREF_ID)return s.concat([Uint8Array.from([this.variant]),this.uRef.toBytes()]);throw new Error("Unknown variant")},t.fromBytes=function(e){if(e.length<1)return w.Err(g.EarlyEndOfStream);var t=e[0],n=1;if(t===ee.HASH_ID){var i=e.subarray(n,32+n);n+=32;var o=r.fromHash(i);return w.Ok(o,e.subarray(n))}if(t===ee.UREF_ID){var a=e.subarray(1),s=oe.fromBytes(a);if(s.hasError())return w.Err(s.error);o=r.fromURef(s.value());return w.Ok(o,s.remainder())}if(t===ee.ACCOUNT_ID){var u=e.subarray(1),f=re.fromBytes(u);if(f.hasError())return w.Err(f.error);o=r.fromAccount(f.value());return w.Ok(o,f.remainder())}return w.Err(g.FormattingError)},t=r=o([function(e){}],t)}(y);r.KeyValue=ne;var ie="uref-";!function(e){e[e.None=0]="None",e[e.READ=1]="READ",e[e.WRITE=2]="WRITE",e[e.ADD=4]="ADD",e[e.READ_WRITE=3]="READ_WRITE",e[e.READ_ADD=5]="READ_ADD",e[e.ADD_WRITE=6]="ADD_WRITE",e[e.READ_ADD_WRITE=7]="READ_ADD_WRITE"}(r.AccessRights||(r.AccessRights={}));var oe=function(e){function t(t,r){var n=e.call(this)||this;if(n.uRefAddr=t,n.accessRights=r,32!==n.uRefAddr.byteLength)throw new Error("The length of URefAddr should be 32");return n}var r;return i(t,e),r=t,t.fromFormattedStr=function(e){if(!e.startsWith(ie))throw new Error("prefix is not 'uref-'");var t=e.substring(ie.length).split("-",2);if(2!==t.length)throw new Error("no access rights as suffix");var n=c.decodeBase16(t[0]),i=parseInt(t[1],8);return new r(n,i)},t.prototype.toFormattedStr=function(){return[ie,c.encodeBase16(this.uRefAddr),this.accessRights.toString(8)].join("-")},t.prototype.toBytes=function(){return s.concat([this.uRefAddr,Uint8Array.from([this.accessRights])])},t.prototype.clType=function(){return G.uRef()},t.fromBytes=function(e){if(e.length<33)return w.Err(g.EarlyEndOfStream);var t=e.subarray(0,32),n=e[32],i=new r(t,n);return w.Ok(i,e.subarray(33))},t=r=o([function(e){},a("design:paramtypes",[Uint8Array,Number])],t)}(y);r.URef=oe}).call(this)}).call(this,e("buffer").Buffer)},{"./Contracts":185,"./Conversions":186,"./Keys":188,"./byterepr":193,"./option":195,"@ethersproject/bignumber":4,"@ethersproject/bytes":6,buffer:266,typedjson:166}],183:[function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function s(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}u((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.deployToBytes=r.validateDeploy=r.deploySizeInBytes=r.addArgToDeploy=r.deployFromJson=r.deployToJson=r.standardPayment=r.setSignature=r.signDeploy=r.makeDeploy=r.DeployParams=r.ContractType=r.serializeApprovals=r.serializeBody=r.serializeHeader=r.Deploy=r.ExecutableDeployItem=r.Transfer=r.StoredVersionedContractByHash=r.StoredVersionedContractByName=r.StoredContractByName=r.StoredContractByHash=r.ModuleBytes=r.Approval=r.DeployHeader=r.UniqAddress=r.dehumanizerTTL=r.humanizerTTL=void 0;var u=e("@ethersproject/bytes"),f=s(e("blakejs")),c=e("./option"),h=e("./Conversions"),l=s(e("humanize-duration")),d=e("./CLValue"),p=e("./byterepr"),y=e("./RuntimeArgs"),b=e("./index"),m=e("./Keys"),v=e("@ethersproject/bignumber"),g=e("typedjson"),w=e("tweetnacl-ts"),_=e("ts-results"),M=l.default.humanizer({spacer:"",serialComma:!1,conjunction:" ",delimiter:" ",language:"shortEn",languages:{shortEn:{d:function(){return"day"},h:function(){return"h"},m:function(){return"m"},s:function(){return"s"},ms:function(){return"ms"}}}}),S=function(e){return h.encodeBase16(e)},E=function(e){return h.decodeBase16(e)};r.humanizerTTL=function(e){return M(e)},r.dehumanizerTTL=function(e){return e.split(" ").map(function(e){if(e.includes("ms"))return Number(e.replace("ms",""));if(e.includes("s")&&!e.includes("m"))return 1e3*Number(e.replace("s",""));if(e.includes("m")&&!e.includes("s"))return 60*Number(e.replace("m",""))*1e3;if(e.includes("h"))return 60*Number(e.replace("h",""))*60*1e3;if(e.includes("day"))return 24*Number(e.replace("day",""))*60*60*1e3;throw Error("Unsuported TTL unit")}).reduce(function(e,t){return e+t})};var A=function(){function e(e,t){if(!(e instanceof d.PublicKey))throw new Error("publicKey is not an instance of PublicKey");var r=v.BigNumber.from(t);if(r.gt("18446744073709551615"))throw new Error("transferId max value is U64");this.transferId=r,this.publicKey=e}return e.prototype.toString=function(){return this.publicKey.toAccountHex()+"-"+this.transferId.toHexString()},e.fromString=function(t){var r=t.split("-"),n=r[0],i=r[1];return new e(d.PublicKey.fromHex(n),i)},e}();r.UniqAddress=A;var k=function(){function e(e,t,r,n,i,o,a){this.account=e,this.timestamp=t,this.ttl=r,this.gasPrice=n,this.bodyHash=i,this.dependencies=o,this.chainName=a}return e.prototype.toBytes=function(){return u.concat([this.account.toBytes(),p.toBytesU64(this.timestamp),p.toBytesU64(this.ttl),p.toBytesU64(this.gasPrice),p.toBytesDeployHash(this.bodyHash),p.toBytesVecT(this.dependencies.map(function(e){return new B(e)})),p.toBytesString(this.chainName)])},o([g.jsonMember({serializer:function(e){return e.toAccountHex()},deserializer:function(e){return d.PublicKey.fromHex(e)}}),a("design:type",d.PublicKey)],e.prototype,"account",void 0),o([g.jsonMember({serializer:function(e){return new Date(e).toISOString()},deserializer:function(e){return Date.parse(e)}}),a("design:type",Number)],e.prototype,"timestamp",void 0),o([g.jsonMember({serializer:r.humanizerTTL,deserializer:r.dehumanizerTTL}),a("design:type",Number)],e.prototype,"ttl",void 0),o([g.jsonMember({constructor:Number,name:"gas_price"}),a("design:type",Number)],e.prototype,"gasPrice",void 0),o([g.jsonMember({name:"body_hash",serializer:S,deserializer:E}),a("design:type",Uint8Array)],e.prototype,"bodyHash",void 0),o([g.jsonArrayMember(w.ByteArray,{serializer:function(e){return e.map(function(e){return S(e)})},deserializer:function(e){return e.map(function(e){return E(e)})}}),a("design:type",Array)],e.prototype,"dependencies",void 0),o([g.jsonMember({name:"chain_name",constructor:String}),a("design:type",String)],e.prototype,"chainName",void 0),e=o([g.jsonObject,a("design:paramtypes",[d.PublicKey,Number,Number,Number,Uint8Array,Array,String])],e)}();r.DeployHeader=k;var B=function(){function e(e){this.hash=e}return e.prototype.toBytes=function(){return p.toBytesDeployHash(this.hash)},e}(),T=function(){function e(){}return o([g.jsonMember({constructor:String}),a("design:type",String)],e.prototype,"signer",void 0),o([g.jsonMember({constructor:String}),a("design:type",String)],e.prototype,"signature",void 0),e=o([g.jsonObject],e)}();r.Approval=T;var j=function(){function e(){}return e.prototype.getArgByName=function(e){return this.args.args.get(e)},e.prototype.setArg=function(e,t){this.args.args.set(e,t)},e}(),x=function(e){var t={args:e};return new g.TypedJSON(y.RuntimeArgs).parse(t)},P=function(e){var t=new g.TypedJSON(y.RuntimeArgs).toPlainJson(e);return Object.values(t)[0]},O=function(e){function t(t,r){var n=e.call(this)||this;return n.tag=0,n.moduleBytes=t,n.args=r,n}return i(t,e),t.prototype.toBytes=function(){return u.concat([Uint8Array.from([this.tag]),p.toBytesArrayU8(this.moduleBytes),p.toBytesBytesArray(this.args.toBytes())])},o([g.jsonMember({name:"module_bytes",serializer:S,deserializer:E}),a("design:type",Uint8Array)],t.prototype,"moduleBytes",void 0),o([g.jsonMember({deserializer:x,serializer:P}),a("design:type",y.RuntimeArgs)],t.prototype,"args",void 0),t=o([g.jsonObject,a("design:paramtypes",[Uint8Array,y.RuntimeArgs])],t)}(j);r.ModuleBytes=O;var R=function(e){function t(t,r,n){var i=e.call(this)||this;return i.tag=1,i.entryPoint=r,i.args=n,i.hash=t,i}return i(t,e),t.prototype.toBytes=function(){return u.concat([Uint8Array.from([this.tag]),p.toBytesBytesArray(this.hash),p.toBytesString(this.entryPoint),p.toBytesBytesArray(this.args.toBytes())])},o([g.jsonMember({serializer:S,deserializer:E}),a("design:type",Uint8Array)],t.prototype,"hash",void 0),o([g.jsonMember({name:"entry_point",constructor:String}),a("design:type",String)],t.prototype,"entryPoint",void 0),o([g.jsonMember({deserializer:x,serializer:P}),a("design:type",y.RuntimeArgs)],t.prototype,"args",void 0),t=o([g.jsonObject,a("design:paramtypes",[Uint8Array,String,y.RuntimeArgs])],t)}(j);r.StoredContractByHash=R;var I=function(e){function t(t,r,n){var i=e.call(this)||this;return i.tag=2,i.name=t,i.entryPoint=r,i.args=n,i}return i(t,e),t.prototype.toBytes=function(){return u.concat([Uint8Array.from([this.tag]),p.toBytesString(this.name),p.toBytesString(this.entryPoint),p.toBytesBytesArray(this.args.toBytes())])},o([g.jsonMember({constructor:String}),a("design:type",String)],t.prototype,"name",void 0),o([g.jsonMember({name:"entry_point",constructor:String}),a("design:type",String)],t.prototype,"entryPoint",void 0),o([g.jsonMember({deserializer:x,serializer:P}),a("design:type",y.RuntimeArgs)],t.prototype,"args",void 0),t=o([g.jsonObject,a("design:paramtypes",[String,String,y.RuntimeArgs])],t)}(j);r.StoredContractByName=I;var C=function(e){function t(t,r,n,i){var o=e.call(this)||this;return o.tag=4,o.name=t,o.version=r,o.entryPoint=n,o.args=i,o}return i(t,e),t.prototype.toBytes=function(){var e;return e=null===this.version?new c.Option(null,d.CLTypeHelper.u32()):new c.Option(new d.U32(this.version)),u.concat([Uint8Array.from([this.tag]),p.toBytesString(this.name),e.toBytes(),p.toBytesString(this.entryPoint),p.toBytesBytesArray(this.args.toBytes())])},o([g.jsonMember({constructor:String}),a("design:type",String)],t.prototype,"name",void 0),o([g.jsonMember({constructor:Number,preserveNull:!0}),a("design:type",Object)],t.prototype,"version",void 0),o([g.jsonMember({name:"entry_point",constructor:String}),a("design:type",String)],t.prototype,"entryPoint",void 0),o([g.jsonMember({deserializer:x,serializer:P}),a("design:type",y.RuntimeArgs)],t.prototype,"args",void 0),t=o([g.jsonObject,a("design:paramtypes",[String,Object,String,y.RuntimeArgs])],t)}(j);r.StoredVersionedContractByName=C;var N=function(e){function t(t,r,n,i){var o=e.call(this)||this;return o.tag=3,o.hash=t,o.version=r,o.entryPoint=n,o.args=i,o}return i(t,e),t.prototype.toBytes=function(){var e;return e=null===this.version?new c.Option(null,d.CLTypeHelper.u32()):new c.Option(new d.U32(this.version)),u.concat([Uint8Array.from([this.tag]),p.toBytesBytesArray(this.hash),e.toBytes(),p.toBytesString(this.entryPoint),p.toBytesBytesArray(this.args.toBytes())])},o([g.jsonMember({serializer:S,deserializer:E}),a("design:type",Uint8Array)],t.prototype,"hash",void 0),o([g.jsonMember({constructor:Number,preserveNull:!0}),a("design:type",Object)],t.prototype,"version",void 0),o([g.jsonMember({name:"entry_point",constructor:String}),a("design:type",String)],t.prototype,"entryPoint",void 0),o([g.jsonMember({deserializer:x,serializer:P}),a("design:type",y.RuntimeArgs)],t.prototype,"args",void 0),t=o([g.jsonObject,a("design:paramtypes",[Uint8Array,Object,String,y.RuntimeArgs])],t)}(j);r.StoredVersionedContractByHash=N;var U=function(e){function t(t){var r=e.call(this)||this;return r.tag=5,r.args=t,r}return i(t,e),t.prototype.toBytes=function(){return u.concat([Uint8Array.from([this.tag]),p.toBytesBytesArray(this.args.toBytes())])},o([g.jsonMember({deserializer:x,serializer:P}),a("design:type",y.RuntimeArgs)],t.prototype,"args",void 0),t=o([g.jsonObject,a("design:paramtypes",[y.RuntimeArgs])],t)}(j);r.Transfer=U;var D=function(){function e(){}var t;return t=e,e.prototype.toBytes=function(){if(this.isModuleBytes())return this.moduleBytes.toBytes();if(this.isStoredContractByHash())return this.storedContractByHash.toBytes();if(this.isStoredContractByName())return this.storedContractByName.toBytes();if(this.isStoredVersionContractByHash())return this.storedVersionedContractByHash.toBytes();if(this.isStoredVersionContractByName())return this.storedVersionedContractByName.toBytes();if(this.isTransfer())return this.transfer.toBytes();throw new Error("failed to serialize ExecutableDeployItemJsonWrapper")},e.prototype.getArgByName=function(e){if(this.isModuleBytes())return this.moduleBytes.getArgByName(e);if(this.isStoredContractByHash())return this.storedContractByHash.getArgByName(e);if(this.isStoredContractByName())return this.storedContractByName.getArgByName(e);if(this.isStoredVersionContractByHash())return this.storedVersionedContractByHash.getArgByName(e);if(this.isStoredVersionContractByName())return this.storedVersionedContractByName.getArgByName(e);if(this.isTransfer())return this.transfer.getArgByName(e);throw new Error("failed to serialize ExecutableDeployItemJsonWrapper")},e.prototype.setArg=function(e,t){if(this.isModuleBytes())return this.moduleBytes.setArg(e,t);if(this.isStoredContractByHash())return this.storedContractByHash.setArg(e,t);if(this.isStoredContractByName())return this.storedContractByName.setArg(e,t);if(this.isStoredVersionContractByHash())return this.storedVersionedContractByHash.setArg(e,t);if(this.isStoredVersionContractByName())return this.storedVersionedContractByName.setArg(e,t);if(this.isTransfer())return this.transfer.setArg(e,t);throw new Error("failed to serialize ExecutableDeployItemJsonWrapper")},e.fromExecutableDeployItemInternal=function(e){var r=new t;switch(e.tag){case 0:r.moduleBytes=e;break;case 1:r.storedContractByHash=e;break;case 2:r.storedContractByName=e;break;case 3:r.storedVersionedContractByHash=e;break;case 4:r.storedVersionedContractByName=e;break;case 5:r.transfer=e}return r},e.newModuleBytes=function(e,r){return t.fromExecutableDeployItemInternal(new O(e,r))},e.newStoredContractByHash=function(e,r,n){return t.fromExecutableDeployItemInternal(new R(e,r,n))},e.newStoredContractByName=function(e,r,n){return t.fromExecutableDeployItemInternal(new I(e,r,n))},e.newStoredVersionContractByHash=function(e,r,n,i){return t.fromExecutableDeployItemInternal(new N(e,r,n,i))},e.newStoredVersionContractByName=function(e,r,n,i){return t.fromExecutableDeployItemInternal(new C(e,r,n,i))},e.newTransfer=function(e,r,n,i){void 0===n&&(n=null);var o=y.RuntimeArgs.fromMap({});if(o.insert("amount",d.CLValue.u512(e)),n&&o.insert("source",d.CLValue.uref(n)),r instanceof b.URef)o.insert("target",d.CLValue.uref(r));else{if(!(r instanceof d.PublicKey))throw new Error("Please specify target");o.insert("target",d.CLValue.byteArray(r.toAccountHash()))}if(void 0===i)throw new Error("transfer-id missing in new transfer.");return o.insert("id",d.CLValue.option(d.CLTypedAndToBytesHelper.u64(i),d.CLTypeHelper.u64())),t.fromExecutableDeployItemInternal(new U(o))},e.newTransferWithOptionalTransferId=function(e,r,n,i){var o=y.RuntimeArgs.fromMap({});if(o.insert("amount",d.CLValue.u512(e)),n&&o.insert("source",d.CLValue.uref(n)),r instanceof b.URef)o.insert("target",d.CLValue.uref(r));else{if(!(r instanceof d.PublicKey))throw new Error("Please specify target");o.insert("target",d.CLValue.byteArray(r.toAccountHash()))}return null!=i?o.insert("id",d.CLValue.option(d.CLTypedAndToBytesHelper.u64(i),d.CLTypeHelper.u64())):o.insert("id",d.CLValue.option(null,d.CLTypeHelper.u64())),t.fromExecutableDeployItemInternal(new U(o))},e.newTransferToUniqAddress=function(e,t,r,n,i,o,a,s){void 0===o&&(o=1),void 0===a&&(a=18e5);var u=new b.DeployUtil.DeployParams(e,i,o,a),f=b.DeployUtil.standardPayment(n),c=b.DeployUtil.ExecutableDeployItem.newTransfer(r,t.publicKey,s,t.transferId);return b.DeployUtil.makeDeploy(u,c,f)},e.prototype.isModuleBytes=function(){return!!this.moduleBytes},e.prototype.asModuleBytes=function(){return this.moduleBytes},e.prototype.isStoredContractByHash=function(){return!!this.storedContractByHash},e.prototype.asStoredContractByHash=function(){return this.storedContractByHash},e.prototype.isStoredContractByName=function(){return!!this.storedContractByName},e.prototype.asStoredContractByName=function(){return this.storedContractByName},e.prototype.isStoredVersionContractByName=function(){return!!this.storedVersionedContractByName},e.prototype.asStoredVersionContractByName=function(){return this.storedVersionedContractByName},e.prototype.isStoredVersionContractByHash=function(){return!!this.storedVersionedContractByHash},e.prototype.asStoredVersionContractByHash=function(){return this.storedVersionedContractByHash},e.prototype.isTransfer=function(){return!!this.transfer},e.prototype.asTransfer=function(){return this.transfer},o([g.jsonMember({name:"ModuleBytes",constructor:O}),a("design:type",O)],e.prototype,"moduleBytes",void 0),o([g.jsonMember({name:"StoredContractByHash",constructor:R}),a("design:type",R)],e.prototype,"storedContractByHash",void 0),o([g.jsonMember({name:"StoredContractByName",constructor:I}),a("design:type",I)],e.prototype,"storedContractByName",void 0),o([g.jsonMember({name:"StoredVersionedContractByHash",constructor:N}),a("design:type",N)],e.prototype,"storedVersionedContractByHash",void 0),o([g.jsonMember({name:"StoredVersionedContractByName",constructor:C}),a("design:type",C)],e.prototype,"storedVersionedContractByName",void 0),o([g.jsonMember({name:"Transfer",constructor:U}),a("design:type",U)],e.prototype,"transfer",void 0),e=t=o([g.jsonObject],e)}();r.ExecutableDeployItem=D;var L=function(){function e(e,t,r,n,i){this.approvals=i,this.session=n,this.payment=r,this.header=t,this.hash=e}return e.prototype.isTransfer=function(){return this.session.isTransfer()},e.prototype.isStandardPayment=function(){var e;return!!this.payment.isModuleBytes()&&0===(null===(e=this.payment.asModuleBytes())||void 0===e?void 0:e.moduleBytes.length)},o([g.jsonMember({serializer:S,deserializer:E}),a("design:type",Uint8Array)],e.prototype,"hash",void 0),o([g.jsonMember({constructor:k}),a("design:type",k)],e.prototype,"header",void 0),o([g.jsonMember({constructor:D}),a("design:type",D)],e.prototype,"payment",void 0),o([g.jsonMember({constructor:D}),a("design:type",D)],e.prototype,"session",void 0),o([g.jsonArrayMember(T),a("design:type",Array)],e.prototype,"approvals",void 0),e=o([g.jsonObject,a("design:paramtypes",[Uint8Array,k,D,D,Array])],e)}();r.Deploy=L,r.serializeHeader=function(e){return e.toBytes()},r.serializeBody=function(e,t){return u.concat([e.toBytes(),t.toBytes()])},r.serializeApprovals=function(e){var r=p.toBytesU32(e.length),n=u.concat(e.map(function(e){return u.concat([Uint8Array.from(t.from(e.signer,"hex")),Uint8Array.from(t.from(e.signature,"hex"))])}));return u.concat([r,n])},function(e){e.WASM="WASM",e.Hash="Hash",e.Name="Name"}(r.ContractType||(r.ContractType={}));var K=function(){return function(e,t,r,n,i,o){void 0===r&&(r=1),void 0===n&&(n=18e5),void 0===i&&(i=[]),this.accountPublicKey=e,this.chainName=t,this.gasPrice=r,this.ttl=n,this.dependencies=i,this.timestamp=o,this.dependencies=i.filter(function(e){return i.filter(function(t){return h.encodeBase16(e)===h.encodeBase16(t)}).length<2}),o||(this.timestamp=Date.now())}}();function z(e,t,n){var i=r.serializeBody(n,t),o=f.default.blake2b(i,null,32),a=new k(e.accountPublicKey,e.timestamp,e.ttl,e.gasPrice,o,e.dependencies,e.chainName),s=r.serializeHeader(a),u=f.default.blake2b(s,null,32);return new L(u,a,n,t,[])}r.DeployParams=K,r.makeDeploy=z,r.signDeploy=function(e,t){var r=new T,n=t.sign(e.hash);switch(r.signer=t.accountHex(),t.signatureAlgorithm){case m.SignatureAlgorithm.Ed25519:r.signature=b.Keys.Ed25519.accountHex(n);break;case m.SignatureAlgorithm.Secp256K1:r.signature=b.Keys.Secp256K1.accountHex(n)}return e.approvals.push(r),e},r.setSignature=function(e,t,r){var n=new T;switch(n.signer=r.toAccountHex(),r.signatureAlgorithm()){case m.SignatureAlgorithm.Ed25519:n.signature=b.Keys.Ed25519.accountHex(t);break;case m.SignatureAlgorithm.Secp256K1:n.signature=b.Keys.Secp256K1.accountHex(t)}return e.approvals.push(n),e},r.standardPayment=function(e){var t=y.RuntimeArgs.fromMap({amount:d.CLValue.u512(e.toString())});return D.newModuleBytes(Uint8Array.from([]),t)},r.deployToJson=function(e){return{deploy:new g.TypedJSON(L).toPlainJson(e)}},r.deployFromJson=function(e){var t=new g.TypedJSON(L).parse(e.deploy);if(void 0!==t&&r.validateDeploy(t).ok)return t},r.addArgToDeploy=function(e,t,r){if(0!==e.approvals.length)throw Error("Can not add argument to already signed deploy.");var n=new b.DeployUtil.DeployParams(e.header.account,e.header.chainName,e.header.gasPrice,e.header.ttl,e.header.dependencies,e.header.timestamp),i=e.session;return i.setArg(t,r),z(n,i,e.payment)},r.deploySizeInBytes=function(e){var t=e.hash.length,n=r.serializeBody(e.payment,e.session).length;return t+r.serializeHeader(e.header).length+n+e.approvals.map(function(e){return(e.signature.length+e.signer.length)/2}).reduce(function(e,t){return e+t},0)},r.validateDeploy=function(e){var t=r.serializeBody(e.payment,e.session),n=f.default.blake2b(t,null,32);if(!q(e.header.bodyHash,n))return _.Err("Invalid deploy: bodyHash missmatch. Expected: "+n+", \n got: "+e.header.bodyHash+".");var i=r.serializeHeader(e.header),o=f.default.blake2b(i,null,32);return q(e.hash,o)?_.Ok(e):_.Err("Invalid deploy: hash missmatch. Expected: "+o+", \n got: "+e.hash+".")};var q=function(e,t){return e.length===t.length&&e.every(function(e,r){return e===t[r]})};r.deployToBytes=function(e){return u.concat([r.serializeHeader(e.header),e.hash,r.serializeBody(e.payment,e.session),r.serializeApprovals(e.approvals)])}}).call(this)}).call(this,e("buffer").Buffer)},{"./CLValue":182,"./Conversions":186,"./Keys":188,"./RuntimeArgs":189,"./byterepr":193,"./index":194,"./option":195,"@ethersproject/bignumber":4,"@ethersproject/bytes":6,blakejs:43,buffer:266,"humanize-duration":96,"ts-results":136,"tweetnacl-ts":153,typedjson:166}],188:[function(e,t,r){(function(t){(function(){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&o(t,e,r);return a(t,e),t},u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.Secp256K1=r.Ed25519=r.AsymmetricKey=r.readBase64WithPEM=r.SignatureAlgorithm=void 0;var f,c=s(e("fs")),h=s(e("tweetnacl-ts")),l=e("tweetnacl-util"),d=e("../index"),p=e("../lib/index"),y=e("./Contracts"),b=u(e("eccrypto")),m=s(e("ethereum-cryptography/secp256k1")),v=u(e("key-encoder")),g=e("ethereum-cryptography/sha256"),w=new v.default("secp256k1");function _(e,r){var n=t.from([0]),i=t.concat([t.from(e),n]);return 0===r.length?t.from([]):y.byteHash(t.concat([i,t.from(r)]))}function M(e){var t=e.split(/\r?\n/).filter(function(e){return!e.startsWith("---")}).join("").trim();return l.decodeBase64(t)}!function(e){e.Ed25519="ed25519",e.Secp256K1="secp256k1"}(f=r.SignatureAlgorithm||(r.SignatureAlgorithm={})),r.readBase64WithPEM=M;var S=function(){function e(e,t,r){this.publicKey=p.PublicKey.from(e,r),this.privateKey=t,this.signatureAlgorithm=r}return e.prototype.accountHash=function(){return this.publicKey.toAccountHash()},e.prototype.accountHex=function(){return this.publicKey.toAccountHex()},e.prototype.toPem=function(e,t){return"-----BEGIN "+e+"-----\n"+t+"\n-----END "+e+"-----\n"},e}();r.AsymmetricKey=S;var E=function(e){function r(t){return e.call(this,t.publicKey,t.secretKey,f.Ed25519)||this}return i(r,e),r.new=function(){return new r(h.sign_keyPair())},r.accountHex=function(e){return"01"+d.encodeBase16(e)},r.parseKeyFiles=function(e,n){var i=r.parsePublicKeyFile(e),o=r.parsePrivateKeyFile(n);return new r({publicKey:i,secretKey:t.concat([o,i])})},r.accountHash=function(e){return _(f.Ed25519,e)},r.parseKeyPair=function(e,t){var n=r.parsePublicKey(e),i=r.parsePrivateKey(t),o=new Uint8Array(n.length+i.length);return o.set(i),o.set(n,i.length),new r({publicKey:n,secretKey:o})},r.parsePrivateKeyFile=function(e){return r.parsePrivateKey(r.readBase64File(e))},r.parsePublicKeyFile=function(e){return r.parsePublicKey(r.readBase64File(e))},r.parsePrivateKey=function(e){return r.parseKey(e,0,32)},r.parsePublicKey=function(e){return r.parseKey(e,32,64)},r.readBase64WithPEM=function(e){return M(e)},r.readBase64File=function(e){var t=c.readFileSync(e).toString();return r.readBase64WithPEM(t)},r.parseKey=function(e,r,n){var i=e.length,o=32===i?e:64===i?t.from(e).slice(r,n):i>32&&i<64?t.from(e).slice(i%32):null;if(null==o||32!==o.length)throw Error("Unexpected key length: "+i);return o},r.prototype.exportPrivateKeyInPem=function(){var e=t.from([48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32]),n=d.encodeBase64(t.concat([e,t.from(r.parsePrivateKey(this.privateKey))]));return this.toPem("PRIVATE KEY",n)},r.prototype.exportPublicKeyInPem=function(){var e=t.from([48,42,48,5,6,3,43,101,112,3,33,0]),r=d.encodeBase64(t.concat([e,t.from(this.publicKey.rawPublicKey)]));return this.toPem("PUBLIC KEY",r)},r.prototype.sign=function(e){return h.sign_detached(e,this.privateKey)},r.prototype.verify=function(e,t){return h.sign_detached_verify(t,e,this.publicKey.rawPublicKey)},r.privateToPublicKey=function(e){return 64===e.length?h.sign_keyPair_fromSecretKey(e).publicKey:h.sign_keyPair_fromSeed(e).publicKey},r.loadKeyPairFromPrivateFile=function(e){var t=r.parsePrivateKeyFile(e),n=r.privateToPublicKey(t);return r.parseKeyPair(n,t)},r}(S);r.Ed25519=E;var A=function(e){function r(t,r){return e.call(this,t,r,f.Secp256K1)||this}return i(r,e),r.new=function(){var e=b.default.generatePrivate();return new r(Uint8Array.from(b.default.getPublicCompressed(e)),e)},r.parseKeyFiles=function(e,t){var n=r.parsePublicKeyFile(e),i=r.parsePrivateKeyFile(t);return new r(n,i)},r.accountHash=function(e){return _(f.Secp256K1,e)},r.accountHex=function(e){return"02"+d.encodeBase16(e)},r.parseKeyPair=function(e,t,n){var i=r.parsePublicKey(e,n),o=r.parsePrivateKey(t,n);return new r(i,o)},r.parsePrivateKeyFile=function(e){return r.parsePrivateKey(r.readBase64File(e))},r.parsePublicKeyFile=function(e){return r.parsePublicKey(r.readBase64File(e))},r.parsePrivateKey=function(e,r){var n;return void 0===r&&(r="der"),n="der"===r?w.encodePrivate(t.from(e),"der","raw"):d.encodeBase16(e),t.from(n,"hex")},r.parsePublicKey=function(e,r){var n;return void 0===r&&(r="der"),n="der"===r?w.encodePublic(t.from(e),"der","raw"):d.encodeBase16(e),Uint8Array.from(t.from(n,"hex"))},r.readBase64WithPEM=function(e){return M(e)},r.readBase64File=function(e){var t=c.readFileSync(e).toString();return r.readBase64WithPEM(t)},r.prototype.exportPrivateKeyInPem=function(){return w.encodePrivate(d.encodeBase16(this.privateKey),"raw","pem")},r.prototype.exportPublicKeyInPem=function(){return w.encodePublic(d.encodeBase16(this.publicKey.rawPublicKey),"raw","pem")},r.prototype.sign=function(e){return m.ecdsaSign(g.sha256(t.from(e)),this.privateKey).signature},r.prototype.verify=function(e,r){return m.ecdsaVerify(e,g.sha256(t.from(r)),this.publicKey.rawPublicKey)},r.privateToPublicKey=function(e){return m.publicKeyCreate(e,!0)},r.loadKeyPairFromPrivateFile=function(e){var t=r.parsePrivateKeyFile(e),n=r.privateToPublicKey(t);return r.parseKeyPair(n,t,"raw")},r.deriveIndex=function(e,t){return e.deriveIndex(t)},r}(S);r.Secp256K1=A}).call(this)}).call(this,e("buffer").Buffer)},{"../index":181,"../lib/index":194,"./Contracts":185,buffer:266,eccrypto:55,"ethereum-cryptography/secp256k1":80,"ethereum-cryptography/sha256":75,fs:199,"key-encoder":100,"tweetnacl-ts":153,"tweetnacl-util":163}],189:[function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(r,"__esModule",{value:!0}),r.RuntimeArgs=r.NamedArg=void 0;var o=e("./byterepr"),a=e("./CLValue"),s=e("@ethersproject/bytes"),u=e("typedjson"),f=function(){function e(e,t){this.name=e,this.value=t}return e.prototype.toBytes=function(){var e=o.toBytesString(this.name),t=this.value.toBytes();return s.concat([e,t])},e.fromBytes=function(t){var r=a.StringValue.fromBytes(t);if(r.hasError())return a.Result.Err(r.error);var n=a.CLValue.fromBytes(r.remainder());return n.hasError()?a.Result.Err(n.error):a.Result.Ok(new e(r.value().val,n.value()),n.remainder())},e}();r.NamedArg=f;var c=function(e){var t=new u.TypedJSON(a.CLValue);return new Map(Array.from(e,function(e){var r=e[0],n=e[1];return[r,t.parse(n)]}))},h=function(e){var t=new u.TypedJSON(a.CLValue);return Array.from(e,function(e){var r=e[0],n=e[1];return[r,t.toPlainJson(n)]})},l=function(){function e(e){this.args=e}var t;return t=e,e.fromMap=function(e){var r=new Map(Object.keys(e).map(function(t){return[t,e[t]]}));return new t(r)},e.fromNamedArgs=function(e){var r=e.reduce(function(e,t){return e[t.name]=t.value,e},{});return t.fromMap(r)},e.prototype.insert=function(e,t){this.args.set(e,t)},e.prototype.toBytes=function(){var e=Array.from(this.args.entries()).map(function(e){return new f(e[0],e[1])});return o.toBytesVecT(e)},e.fromBytes=function(e){var r=a.U32.fromBytes(e);if(r.hasError())return a.Result.Err(r.error);for(var n=r.value().val.toNumber(),i=r.remainder(),o=[],s=0;s0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(r,"__esModule",{value:!0}),r.StoredValue=r.ContractMetadataJson=r.EraInfoJson=r.SeigniorageAllocation=r.DeployInfoJson=r.TransferJson=void 0;var o=e("typedjson"),a=e("./CLValue"),s=function(){function e(){}return n([o.jsonMember({constructor:String}),i("design:type",String)],e.prototype,"name",void 0),n([o.jsonMember({constructor:String}),i("design:type",String)],e.prototype,"key",void 0),e=n([o.jsonObject],e)}(),u=function(){function e(){}return n([o.jsonMember({name:"account_hash",constructor:String}),i("design:type",String)],e.prototype,"accountHash",void 0),n([o.jsonMember({constructor:Number}),i("design:type",Number)],e.prototype,"weight",void 0),e=n([o.jsonObject],e)}(),f=function(){function e(){}return n([o.jsonMember({constructor:Number}),i("design:type",Number)],e.prototype,"deployment",void 0),n([o.jsonMember({name:"key_management",constructor:Number}),i("design:type",Number)],e.prototype,"keyManagement",void 0),e=n([o.jsonObject],e)}(),c=function(){function e(){}return e.prototype.accountHash=function(){return this._accountHash},n([o.jsonMember({name:"account_hash",constructor:String}),i("design:type",String)],e.prototype,"_accountHash",void 0),n([o.jsonArrayMember(s,{name:"named_keys"}),i("design:type",Array)],e.prototype,"namedKeys",void 0),n([o.jsonMember({name:"main_purse",constructor:String}),i("design:type",String)],e.prototype,"mainPurse",void 0),n([o.jsonArrayMember(u,{name:"associated_keys"}),i("design:type",Array)],e.prototype,"associatedKeys",void 0),n([o.jsonMember({name:"action_thresholds",constructor:f}),i("design:type",f)],e.prototype,"actionThresholds",void 0),e=n([o.jsonObject],e)}(),h=function(){function e(){}return n([o.jsonMember({name:"deploy_hash",constructor:String}),i("design:type",String)],e.prototype,"deployHash",void 0),n([o.jsonMember({constructor:String}),i("design:type",String)],e.prototype,"from",void 0),n([o.jsonMember({constructor:String}),i("design:type",String)],e.prototype,"source",void 0),n([o.jsonMember({constructor:String}),i("design:type",String)],e.prototype,"target",void 0),n([o.jsonMember({constructor:String}),i("design:type",String)],e.prototype,"amount",void 0),n([o.jsonMember({constructor:String}),i("design:type",String)],e.prototype,"gas",void 0),n([o.jsonMember({constructor:String,preserveNull:!0}),i("design:type",Object)],e.prototype,"id",void 0),e=n([o.jsonObject],e)}();r.TransferJson=h;var l=function(){function e(){}return n([o.jsonMember({name:"deploy_hash",constructor:String}),i("design:type",String)],e.prototype,"deployHash",void 0),n([o.jsonArrayMember(String),i("design:type",Array)],e.prototype,"transfers",void 0),n([o.jsonMember({constructor:String}),i("design:type",String)],e.prototype,"from",void 0),n([o.jsonMember({constructor:String}),i("design:type",String)],e.prototype,"source",void 0),n([o.jsonMember({constructor:String}),i("design:type",String)],e.prototype,"gas",void 0),e=n([o.jsonObject],e)}();r.DeployInfoJson=l;var d=function(){function e(){}return n([o.jsonMember({name:"validator_public_key",constructor:String}),i("design:type",String)],e.prototype,"validatorPublicKey",void 0),n([o.jsonMember({constructor:String}),i("design:type",String)],e.prototype,"amount",void 0),e=n([o.jsonObject],e)}(),p=function(){function e(){}return n([o.jsonMember({name:"delegator_public_key",constructor:String}),i("design:type",String)],e.prototype,"delegatorPublicKey",void 0),n([o.jsonMember({name:"validator_public_key",constructor:String}),i("design:type",String)],e.prototype,"validatorPublicKey",void 0),n([o.jsonMember({constructor:String}),i("design:type",String)],e.prototype,"amount",void 0),e=n([o.jsonObject],e)}(),y=function(){function e(){}return n([o.jsonMember({constructor:d}),i("design:type",d)],e.prototype,"Validator",void 0),n([o.jsonMember({constructor:p}),i("design:type",p)],e.prototype,"Delegator",void 0),e=n([o.jsonObject],e)}();r.SeigniorageAllocation=y;var b=function(){function e(){}return n([o.jsonArrayMember(y,{name:"seigniorage_allocations"}),i("design:type",Array)],e.prototype,"seigniorageAllocations",void 0),e=n([o.jsonObject],e)}();r.EraInfoJson=b;var m=function(){function e(){}return n([o.jsonMember({name:"contract_package_hash",constructor:String}),i("design:type",String)],e.prototype,"contractPackageHash",void 0),n([o.jsonMember({name:"contract_wasm_hash",constructor:String}),i("design:type",String)],e.prototype,"contractWasmHash",void 0),n([o.jsonMember({name:"protocol_version",constructor:String}),i("design:type",String)],e.prototype,"protocolVersion",void 0),e=n([o.jsonObject],e)}();r.ContractMetadataJson=m;var v=function(){function e(){}return n([o.jsonMember({constructor:a.CLValue}),i("design:type",a.CLValue)],e.prototype,"CLValue",void 0),n([o.jsonMember({constructor:c}),i("design:type",c)],e.prototype,"Account",void 0),n([o.jsonMember({constructor:String}),i("design:type",String)],e.prototype,"ContractWASM",void 0),n([o.jsonMember({constructor:m}),i("design:type",m)],e.prototype,"Contract",void 0),n([o.jsonMember({constructor:String}),i("design:type",String)],e.prototype,"ContractPackage",void 0),n([o.jsonMember({constructor:h}),i("design:type",h)],e.prototype,"Transfer",void 0),n([o.jsonMember({constructor:l}),i("design:type",l)],e.prototype,"DeployInfo",void 0),n([o.jsonMember({constructor:b}),i("design:type",b)],e.prototype,"EraInfo",void 0),e=n([o.jsonObject],e)}();r.StoredValue=v},{"./CLValue":182,typedjson:166}],193:[function(e,t,r){(function(t){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.toBytesStringList=r.toBytesVecT=r.toBytesBytesArray=r.toBytesArrayU8=r.toBytesString=r.toBytesU512=r.toBytesDeployHash=r.toBytesU256=r.toBytesU128=r.toBytesI64=r.toBytesU64=r.toBytesU32=r.toBytesI32=r.toBytesU8=r.toBytesNumber=void 0;var n=e("@ethersproject/bignumber"),i=e("@ethersproject/constants"),o=e("@ethersproject/bytes"),a=e("./CLValue");function s(e){return r.toBytesNumber(32,!1,e)}function u(e){return e}function f(e){var t=e.map(function(e){return e.toBytes()});return t.splice(0,0,s(e.length)),o.concat(t)}r.toBytesNumber=function(e,t,r){var a=n.BigNumber.from(r),s=i.MaxUint256.mask(e);if(t){var u=s.mask(e-1);if(a.gt(u)||a.lt(u.add(i.One).mul(i.NegativeOne)))throw new Error("value out-of-bounds, value: "+r)}else if(a.lt(i.Zero)||a.gt(s.mask(e)))throw new Error("value out-of-bounds, value: "+r);a=a.toTwos(e).mask(e);var f=o.arrayify(a);if(a.gte(0)){if(e>64)return o.concat([f,Uint8Array.from([f.length])]).reverse();var c=e/8;return o.concat([f.reverse(),new Uint8Array(c-f.length)])}return f.reverse()},r.toBytesU8=function(e){return r.toBytesNumber(8,!1,e)},r.toBytesI32=function(e){return r.toBytesNumber(32,!0,e)},r.toBytesU32=s,r.toBytesU64=function(e){return r.toBytesNumber(64,!1,e)},r.toBytesI64=function(e){return r.toBytesNumber(64,!0,e)},r.toBytesU128=function(e){return r.toBytesNumber(128,!1,e)},r.toBytesU256=function(e){return r.toBytesNumber(256,!1,e)},r.toBytesDeployHash=function(e){return u(e)},r.toBytesU512=function(e){return r.toBytesNumber(512,!1,e)},r.toBytesString=function(e){var r=Uint8Array.from(t.from(e));return o.concat([s(r.byteLength),r])},r.toBytesArrayU8=function(e){return o.concat([s(e.length),e])},r.toBytesBytesArray=u,r.toBytesVecT=f,r.toBytesStringList=function(e){return f(e.map(function(e){return a.CLValue.string(e)}))}}).call(this)}).call(this,e("buffer").Buffer)},{"./CLValue":182,"@ethersproject/bignumber":4,"@ethersproject/bytes":6,"@ethersproject/constants":10,buffer:266}],194:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),r.Signer=r.DeployUtil=r.Serialization=r.Keys=r.Contracts=void 0;var s=o(e("./Contracts"));r.Contracts=s;var u=o(e("./DeployUtil"));r.DeployUtil=u;var f=o(e("./Keys"));r.Keys=f;var c=o(e("./Serialization"));r.Serialization=c;var h=o(e("./Signer"));r.Signer=h,a(e("./CLValue"),r),a(e("./RuntimeArgs"),r),a(e("./CasperClient"),r),a(e("./option"),r)},{"./CLValue":182,"./CasperClient":183,"./Contracts":185,"./DeployUtil":187,"./Keys":188,"./RuntimeArgs":189,"./Serialization":190,"./Signer":191,"./option":195}],195:[function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0}),r.Option=void 0;var o=e("./CLValue"),a=e("@ethersproject/bytes"),s=function(e){function t(t,r){var n=e.call(this)||this;if(n.t=t,null===t){if(!r)throw new Error("You had to assign innerType for None");n.innerType=r}else n.innerType=t.clType();return n}return i(t,e),t.prototype.isNone=function(){return null===this.t},t.prototype.isSome=function(){return null!==this.t},t.prototype.getSome=function(){if(!this.isSome())throw new Error("Value is None");return o.CLValue.fromT(this.t)},t.prototype.toBytes=function(){return null===this.t?Uint8Array.from([0]):a.concat([Uint8Array.from([1]),this.t.toBytes()])},t.prototype.clType=function(){return o.CLTypeHelper.option(this.innerType)},t.fromBytes=function(e,r){var n=o.U8.fromBytes(r);if(n.hasError())return o.Result.Err(n.error);var i=n.value().val.toNumber();if(0===i)return o.Result.Ok(new t(null,e.innerType),n.remainder());if(1===i){var a=o.fromBytesByCLType(e.innerType,n.remainder());return a.hasError()?o.Result.Err(a.error):o.Result.Ok(new t(a.value(),e.innerType),a.remainder())}return o.Result.Err(o.FromBytesError.FormattingError)},t}(o.CLTypedAndToBytes);r.Option=s},{"./CLValue":182,"@ethersproject/bytes":6}],196:[function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function s(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}u((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1048576)throw Error("Deploy can not be send, because it's too large: "+t+" bytes. Max size is 1 megabyte.");return[4,this.client.request({method:"account_put_deploy",params:s.deployToJson(e)})];case 1:return[2,r.sent()]}})})},e}();r.CasperServiceByJsonRPC=h},{"..":181,"../lib/DeployUtil":187,"../lib/StoredValue":192,"@ethersproject/bignumber":4,"@open-rpc/client-js":18,typedjson:166}],198:[function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),i(e("./CasperServiceByJsonRPC"),r),i(e("./BalanceServiceByJsonRPC"),r)},{"./BalanceServiceByJsonRPC":196,"./CasperServiceByJsonRPC":197}],199:[function(e,t,r){},{}],200:[function(e,t,r){arguments[4][26][0].apply(r,arguments)},{"./asn1/api":201,"./asn1/base":203,"./asn1/constants":207,"./asn1/decoders":209,"./asn1/encoders":212,"bn.js":214,dup:26}],201:[function(e,t,r){arguments[4][27][0].apply(r,arguments)},{"./decoders":209,"./encoders":212,dup:27,inherits:335}],202:[function(e,t,r){arguments[4][28][0].apply(r,arguments)},{"../base/reporter":205,dup:28,inherits:335,"safer-buffer":365}],203:[function(e,t,r){arguments[4][29][0].apply(r,arguments)},{"./buffer":202,"./node":204,"./reporter":205,dup:29}],204:[function(e,t,r){arguments[4][30][0].apply(r,arguments)},{"../base/buffer":202,"../base/reporter":205,dup:30,"minimalistic-assert":339}],205:[function(e,t,r){arguments[4][31][0].apply(r,arguments)},{dup:31,inherits:335}],206:[function(e,t,r){arguments[4][32][0].apply(r,arguments)},{dup:32}],207:[function(e,t,r){arguments[4][33][0].apply(r,arguments)},{"./der":206,dup:33}],208:[function(e,t,r){arguments[4][34][0].apply(r,arguments)},{"../base/buffer":202,"../base/node":204,"../constants/der":206,"bn.js":214,dup:34,inherits:335}],209:[function(e,t,r){arguments[4][35][0].apply(r,arguments)},{"./der":208,"./pem":210,dup:35}],210:[function(e,t,r){arguments[4][36][0].apply(r,arguments)},{"./der":208,dup:36,inherits:335,"safer-buffer":365}],211:[function(e,t,r){arguments[4][37][0].apply(r,arguments)},{"../base/node":204,"../constants/der":206,dup:37,inherits:335,"safer-buffer":365}],212:[function(e,t,r){arguments[4][38][0].apply(r,arguments)},{"./der":211,"./pem":213,dup:38}],213:[function(e,t,r){arguments[4][39][0].apply(r,arguments)},{"./der":211,dup:39,inherits:335}],214:[function(e,t,r){arguments[4][45][0].apply(r,arguments)},{buffer:222,dup:45}],215:[function(e,t,r){(function(r){(function(){"use strict";var n=e("object-assign");function i(e,t){if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i=0;f--)if(c[f]!==h[f])return!1;for(f=c.length-1;f>=0;f--)if(s=c[f],!g(e[s],t[s],r,n))return!1;return!0}(e,t,r,n))}return r?e===t:e==t}function w(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function _(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function M(e,t,r,n){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(e){var t;try{e()}catch(e){t=e}return t}(t),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),e&&!i&&m(i,r,"Missing expected exception"+n);var o="string"==typeof n,s=!e&&i&&!r;if((!e&&a.isError(i)&&o&&_(i,r)||s)&&m(i,r,"Got unwanted exception"+n),e&&i&&r&&!_(i,r)||!e&&i)throw i}l.AssertionError=function(e){var t;this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=y(b((t=this).actual),128)+" "+t.operator+" "+y(b(t.expected),128),this.generatedMessage=!0);var r=e.stackStartFunction||m;if(Error.captureStackTrace)Error.captureStackTrace(this,r);else{var n=new Error;if(n.stack){var i=n.stack,o=p(r),a=i.indexOf("\n"+o);if(a>=0){var s=i.indexOf("\n",a+1);i=i.substring(s+1)}this.stack=i}}},a.inherits(l.AssertionError,Error),l.fail=m,l.ok=v,l.equal=function(e,t,r){e!=t&&m(e,t,r,"==",l.equal)},l.notEqual=function(e,t,r){e==t&&m(e,t,r,"!=",l.notEqual)},l.deepEqual=function(e,t,r){g(e,t,!1)||m(e,t,r,"deepEqual",l.deepEqual)},l.deepStrictEqual=function(e,t,r){g(e,t,!0)||m(e,t,r,"deepStrictEqual",l.deepStrictEqual)},l.notDeepEqual=function(e,t,r){g(e,t,!1)&&m(e,t,r,"notDeepEqual",l.notDeepEqual)},l.notDeepStrictEqual=function e(t,r,n){g(t,r,!0)&&m(t,r,n,"notDeepStrictEqual",e)},l.strictEqual=function(e,t,r){e!==t&&m(e,t,r,"===",l.strictEqual)},l.notStrictEqual=function(e,t,r){e===t&&m(e,t,r,"!==",l.notStrictEqual)},l.throws=function(e,t,r){M(!0,e,t,r)},l.doesNotThrow=function(e,t,r){M(!1,e,t,r)},l.ifError=function(e){if(e)throw e},l.strict=n(function e(t,r){t||m(t,!0,r,"==",e)},l,{equal:l.strictEqual,deepEqual:l.deepStrictEqual,notEqual:l.notStrictEqual,notDeepEqual:l.notDeepStrictEqual}),l.strict.strict=l.strict;var S=Object.keys||function(e){var t=[];for(var r in e)s.call(e,r)&&t.push(r);return t}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"object-assign":341,"util/":218}],216:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},{}],217:[function(e,t,r){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],218:[function(e,t,r){(function(t,n){(function(){var i=/%[sdj%]/g;r.format=function(e){if(!m(e)){for(var t=[],r=0;r=o)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),u=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),p(t)?n.showHidden=t:t&&r._extend(n,t),v(n.showHidden)&&(n.showHidden=!1),v(n.depth)&&(n.depth=2),v(n.colors)&&(n.colors=!1),v(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),c(n,e,n.depth)}function u(e,t){var r=s.styles[t];return r?"["+s.colors[r][0]+"m"+e+"["+s.colors[r][1]+"m":e}function f(e,t){return e}function c(e,t,n){if(e.customInspect&&t&&S(t.inspect)&&t.inspect!==r.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(n,e);return m(i)||(i=c(e,i,n)),i}var o=function(e,t){if(v(t))return e.stylize("undefined","undefined");if(m(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(b(t))return e.stylize(""+t,"number");if(p(t))return e.stylize(""+t,"boolean");if(y(t))return e.stylize("null","null")}(e,t);if(o)return o;var a=Object.keys(t),s=function(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(t)),M(t)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return h(t);if(0===a.length){if(S(t)){var u=t.name?": "+t.name:"";return e.stylize("[Function"+u+"]","special")}if(g(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(_(t))return e.stylize(Date.prototype.toString.call(t),"date");if(M(t))return h(t)}var f,w="",E=!1,A=["{","}"];(d(t)&&(E=!0,A=["[","]"]),S(t))&&(w=" [Function"+(t.name?": "+t.name:"")+"]");return g(t)&&(w=" "+RegExp.prototype.toString.call(t)),_(t)&&(w=" "+Date.prototype.toUTCString.call(t)),M(t)&&(w=" "+h(t)),0!==a.length||E&&0!=t.length?n<0?g(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),f=E?function(e,t,r,n,i){for(var o=[],a=0,s=t.length;a=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(f,w,A)):A[0]+w+A[1]}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,r,n,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),B(n,i)||(a="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=y(r)?c(e,u.value,null):c(e,u.value,r-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n")):s=e.stylize("[Circular]","special")),v(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function d(e){return Array.isArray(e)}function p(e){return"boolean"==typeof e}function y(e){return null===e}function b(e){return"number"==typeof e}function m(e){return"string"==typeof e}function v(e){return void 0===e}function g(e){return w(e)&&"[object RegExp]"===E(e)}function w(e){return"object"==typeof e&&null!==e}function _(e){return w(e)&&"[object Date]"===E(e)}function M(e){return w(e)&&("[object Error]"===E(e)||e instanceof Error)}function S(e){return"function"==typeof e}function E(e){return Object.prototype.toString.call(e)}function A(e){return e<10?"0"+e.toString(10):e.toString(10)}r.debuglog=function(e){if(v(o)&&(o=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!a[e])if(new RegExp("\\b"+e+"\\b","i").test(o)){var n=t.pid;a[e]=function(){var t=r.format.apply(r,arguments);console.error("%s %d: %s",e,n,t)}}else a[e]=function(){};return a[e]},r.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=d,r.isBoolean=p,r.isNull=y,r.isNullOrUndefined=function(e){return null==e},r.isNumber=b,r.isString=m,r.isSymbol=function(e){return"symbol"==typeof e},r.isUndefined=v,r.isRegExp=g,r.isObject=w,r.isDate=_,r.isError=M,r.isFunction=S,r.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},r.isBuffer=e("./support/isBuffer");var k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function B(e,t){return Object.prototype.hasOwnProperty.call(e,t)}r.log=function(){var e,t;console.log("%s - %s",(e=new Date,t=[A(e.getHours()),A(e.getMinutes()),A(e.getSeconds())].join(":"),[e.getDate(),k[e.getMonth()],t].join(" ")),r.format.apply(r,arguments))},r.inherits=e("inherits"),r._extend=function(e,t){if(!t||!w(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":217,_process:353,inherits:216}],219:[function(e,t,r){"use strict";r.byteLength=function(e){var t=f(e),r=t[0],n=t[1];return 3*(r+n)/4-n},r.toByteArray=function(e){var t,r,n=f(e),a=n[0],s=n[1],u=new o(function(e,t,r){return 3*(t+r)/4-r}(0,a,s)),c=0,h=s>0?a-4:a;for(r=0;r>16&255,u[c++]=t>>8&255,u[c++]=255&t;2===s&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[c++]=255&t);1===s&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t);return u},r.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],a=0,s=r-i;as?s:a+16383));1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,r){for(var i,o,a=[],s=t;s>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],220:[function(e,t,r){!function(t,r){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof t?t.exports=o:r.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:e("buffer").Buffer}catch(e){}function s(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function u(e,t,r){var n=s(e,r);return r-1>=t&&(n|=s(e,r-1)<<4),n}function f(e,t,r,i){for(var o=0,a=0,s=Math.min(e.length,r),u=t;u=49?f-49+10:f>=17?f-17+10:f,n(f>=0&&a0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)i=u(e,t,n)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(e.length-t)%2==0?t+1:t;n=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch(e){o.prototype.inspect=h}else o.prototype.inspect=h;function h(){return(this.red?""}var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[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],p=[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];o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a>>24-i&16777215)||a!==this.length-1?l[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var f=d[e],c=p[e];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var y=h.modrn(c).toString(e);r=(h=h.idivn(c)).isZero()?y+r:l[f-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},a&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(a,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function y(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var f=1;f>>26,h=67108863&u,l=Math.min(f,t.length-1),d=Math.max(0,f-e.length+1);d<=l;d++){var p=f-d|0;c+=(a=(i=0|e.words[p])*(o=0|t.words[d])+h)/67108864|0,h=67108863&a}r.words[f]=0|h,u=0|c}return 0!==u?r.words[f]=0|u:r.length--,r._strip()}o.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},o.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r=0&&(e[r--]=a>>8&255),r>=0&&(e[r--]=a>>16&255),6===o?(r>=0&&(e[r--]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,d=0|a[1],p=8191&d,y=d>>>13,b=0|a[2],m=8191&b,v=b>>>13,g=0|a[3],w=8191&g,_=g>>>13,M=0|a[4],S=8191&M,E=M>>>13,A=0|a[5],k=8191&A,B=A>>>13,T=0|a[6],j=8191&T,x=T>>>13,P=0|a[7],O=8191&P,R=P>>>13,I=0|a[8],C=8191&I,N=I>>>13,U=0|a[9],D=8191&U,L=U>>>13,K=0|s[0],z=8191&K,q=K>>>13,H=0|s[1],F=8191&H,V=H>>>13,W=0|s[2],J=8191&W,Z=W>>>13,G=0|s[3],X=8191&G,Y=G>>>13,$=0|s[4],Q=8191&$,ee=$>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,fe=se>>>13,ce=0|s[8],he=8191&ce,le=ce>>>13,de=0|s[9],pe=8191&de,ye=de>>>13;r.negative=e.negative^t.negative,r.length=19;var be=(f+(n=Math.imul(h,z))|0)+((8191&(i=(i=Math.imul(h,q))+Math.imul(l,z)|0))<<13)|0;f=((o=Math.imul(l,q))+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(p,z),i=(i=Math.imul(p,q))+Math.imul(y,z)|0,o=Math.imul(y,q);var me=(f+(n=n+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(l,F)|0))<<13)|0;f=((o=o+Math.imul(l,V)|0)+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(m,z),i=(i=Math.imul(m,q))+Math.imul(v,z)|0,o=Math.imul(v,q),n=n+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var ve=(f+(n=n+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,Z)|0)+Math.imul(l,J)|0))<<13)|0;f=((o=o+Math.imul(l,Z)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(w,z),i=(i=Math.imul(w,q))+Math.imul(_,z)|0,o=Math.imul(_,q),n=n+Math.imul(m,F)|0,i=(i=i+Math.imul(m,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,Z)|0;var ge=(f+(n=n+Math.imul(h,X)|0)|0)+((8191&(i=(i=i+Math.imul(h,Y)|0)+Math.imul(l,X)|0))<<13)|0;f=((o=o+Math.imul(l,Y)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(S,z),i=(i=Math.imul(S,q))+Math.imul(E,z)|0,o=Math.imul(E,q),n=n+Math.imul(w,F)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(_,F)|0,o=o+Math.imul(_,V)|0,n=n+Math.imul(m,J)|0,i=(i=i+Math.imul(m,Z)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,Z)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,Y)|0;var we=(f+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(l,Q)|0))<<13)|0;f=((o=o+Math.imul(l,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(k,z),i=(i=Math.imul(k,q))+Math.imul(B,z)|0,o=Math.imul(B,q),n=n+Math.imul(S,F)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(E,F)|0,o=o+Math.imul(E,V)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Z)|0,n=n+Math.imul(m,X)|0,i=(i=i+Math.imul(m,Y)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,Y)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,ee)|0;var _e=(f+(n=n+Math.imul(h,re)|0)|0)+((8191&(i=(i=i+Math.imul(h,ne)|0)+Math.imul(l,re)|0))<<13)|0;f=((o=o+Math.imul(l,ne)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(j,z),i=(i=Math.imul(j,q))+Math.imul(x,z)|0,o=Math.imul(x,q),n=n+Math.imul(k,F)|0,i=(i=i+Math.imul(k,V)|0)+Math.imul(B,F)|0,o=o+Math.imul(B,V)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,Z)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Z)|0,n=n+Math.imul(w,X)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,ee)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(y,re)|0,o=o+Math.imul(y,ne)|0;var Me=(f+(n=n+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,ae)|0)+Math.imul(l,oe)|0))<<13)|0;f=((o=o+Math.imul(l,ae)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(O,z),i=(i=Math.imul(O,q))+Math.imul(R,z)|0,o=Math.imul(R,q),n=n+Math.imul(j,F)|0,i=(i=i+Math.imul(j,V)|0)+Math.imul(x,F)|0,o=o+Math.imul(x,V)|0,n=n+Math.imul(k,J)|0,i=(i=i+Math.imul(k,Z)|0)+Math.imul(B,J)|0,o=o+Math.imul(B,Z)|0,n=n+Math.imul(S,X)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,Y)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(m,re)|0,i=(i=i+Math.imul(m,ne)|0)+Math.imul(v,re)|0,o=o+Math.imul(v,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0;var Se=(f+(n=n+Math.imul(h,ue)|0)|0)+((8191&(i=(i=i+Math.imul(h,fe)|0)+Math.imul(l,ue)|0))<<13)|0;f=((o=o+Math.imul(l,fe)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(C,z),i=(i=Math.imul(C,q))+Math.imul(N,z)|0,o=Math.imul(N,q),n=n+Math.imul(O,F)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(R,F)|0,o=o+Math.imul(R,V)|0,n=n+Math.imul(j,J)|0,i=(i=i+Math.imul(j,Z)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,Z)|0,n=n+Math.imul(k,X)|0,i=(i=i+Math.imul(k,Y)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(m,oe)|0,i=(i=i+Math.imul(m,ae)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,ae)|0,n=n+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,fe)|0;var Ee=(f+(n=n+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,le)|0)+Math.imul(l,he)|0))<<13)|0;f=((o=o+Math.imul(l,le)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(D,z),i=(i=Math.imul(D,q))+Math.imul(L,z)|0,o=Math.imul(L,q),n=n+Math.imul(C,F)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,V)|0,n=n+Math.imul(O,J)|0,i=(i=i+Math.imul(O,Z)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,Z)|0,n=n+Math.imul(j,X)|0,i=(i=i+Math.imul(j,Y)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,Y)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,ee)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,ee)|0,n=n+Math.imul(S,re)|0,i=(i=i+Math.imul(S,ne)|0)+Math.imul(E,re)|0,o=o+Math.imul(E,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,n=n+Math.imul(m,ue)|0,i=(i=i+Math.imul(m,fe)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,fe)|0,n=n+Math.imul(p,he)|0,i=(i=i+Math.imul(p,le)|0)+Math.imul(y,he)|0,o=o+Math.imul(y,le)|0;var Ae=(f+(n=n+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,ye)|0)+Math.imul(l,pe)|0))<<13)|0;f=((o=o+Math.imul(l,ye)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(D,F),i=(i=Math.imul(D,V))+Math.imul(L,F)|0,o=Math.imul(L,V),n=n+Math.imul(C,J)|0,i=(i=i+Math.imul(C,Z)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,Z)|0,n=n+Math.imul(O,X)|0,i=(i=i+Math.imul(O,Y)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,Y)|0,n=n+Math.imul(j,Q)|0,i=(i=i+Math.imul(j,ee)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,ee)|0,n=n+Math.imul(k,re)|0,i=(i=i+Math.imul(k,ne)|0)+Math.imul(B,re)|0,o=o+Math.imul(B,ne)|0,n=n+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,ae)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,ae)|0,n=n+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(_,ue)|0,o=o+Math.imul(_,fe)|0,n=n+Math.imul(m,he)|0,i=(i=i+Math.imul(m,le)|0)+Math.imul(v,he)|0,o=o+Math.imul(v,le)|0;var ke=(f+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ye)|0)+Math.imul(y,pe)|0))<<13)|0;f=((o=o+Math.imul(y,ye)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(D,J),i=(i=Math.imul(D,Z))+Math.imul(L,J)|0,o=Math.imul(L,Z),n=n+Math.imul(C,X)|0,i=(i=i+Math.imul(C,Y)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,Y)|0,n=n+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(R,Q)|0,o=o+Math.imul(R,ee)|0,n=n+Math.imul(j,re)|0,i=(i=i+Math.imul(j,ne)|0)+Math.imul(x,re)|0,o=o+Math.imul(x,ne)|0,n=n+Math.imul(k,oe)|0,i=(i=i+Math.imul(k,ae)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,ae)|0,n=n+Math.imul(S,ue)|0,i=(i=i+Math.imul(S,fe)|0)+Math.imul(E,ue)|0,o=o+Math.imul(E,fe)|0,n=n+Math.imul(w,he)|0,i=(i=i+Math.imul(w,le)|0)+Math.imul(_,he)|0,o=o+Math.imul(_,le)|0;var Be=(f+(n=n+Math.imul(m,pe)|0)|0)+((8191&(i=(i=i+Math.imul(m,ye)|0)+Math.imul(v,pe)|0))<<13)|0;f=((o=o+Math.imul(v,ye)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863,n=Math.imul(D,X),i=(i=Math.imul(D,Y))+Math.imul(L,X)|0,o=Math.imul(L,Y),n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,ee)|0,n=n+Math.imul(O,re)|0,i=(i=i+Math.imul(O,ne)|0)+Math.imul(R,re)|0,o=o+Math.imul(R,ne)|0,n=n+Math.imul(j,oe)|0,i=(i=i+Math.imul(j,ae)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,ae)|0,n=n+Math.imul(k,ue)|0,i=(i=i+Math.imul(k,fe)|0)+Math.imul(B,ue)|0,o=o+Math.imul(B,fe)|0,n=n+Math.imul(S,he)|0,i=(i=i+Math.imul(S,le)|0)+Math.imul(E,he)|0,o=o+Math.imul(E,le)|0;var Te=(f+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ye)|0)+Math.imul(_,pe)|0))<<13)|0;f=((o=o+Math.imul(_,ye)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(D,Q),i=(i=Math.imul(D,ee))+Math.imul(L,Q)|0,o=Math.imul(L,ee),n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(N,re)|0,o=o+Math.imul(N,ne)|0,n=n+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,ae)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,ae)|0,n=n+Math.imul(j,ue)|0,i=(i=i+Math.imul(j,fe)|0)+Math.imul(x,ue)|0,o=o+Math.imul(x,fe)|0,n=n+Math.imul(k,he)|0,i=(i=i+Math.imul(k,le)|0)+Math.imul(B,he)|0,o=o+Math.imul(B,le)|0;var je=(f+(n=n+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,ye)|0)+Math.imul(E,pe)|0))<<13)|0;f=((o=o+Math.imul(E,ye)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,n=Math.imul(D,re),i=(i=Math.imul(D,ne))+Math.imul(L,re)|0,o=Math.imul(L,ne),n=n+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,ae)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,ae)|0,n=n+Math.imul(O,ue)|0,i=(i=i+Math.imul(O,fe)|0)+Math.imul(R,ue)|0,o=o+Math.imul(R,fe)|0,n=n+Math.imul(j,he)|0,i=(i=i+Math.imul(j,le)|0)+Math.imul(x,he)|0,o=o+Math.imul(x,le)|0;var xe=(f+(n=n+Math.imul(k,pe)|0)|0)+((8191&(i=(i=i+Math.imul(k,ye)|0)+Math.imul(B,pe)|0))<<13)|0;f=((o=o+Math.imul(B,ye)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(D,oe),i=(i=Math.imul(D,ae))+Math.imul(L,oe)|0,o=Math.imul(L,ae),n=n+Math.imul(C,ue)|0,i=(i=i+Math.imul(C,fe)|0)+Math.imul(N,ue)|0,o=o+Math.imul(N,fe)|0,n=n+Math.imul(O,he)|0,i=(i=i+Math.imul(O,le)|0)+Math.imul(R,he)|0,o=o+Math.imul(R,le)|0;var Pe=(f+(n=n+Math.imul(j,pe)|0)|0)+((8191&(i=(i=i+Math.imul(j,ye)|0)+Math.imul(x,pe)|0))<<13)|0;f=((o=o+Math.imul(x,ye)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(D,ue),i=(i=Math.imul(D,fe))+Math.imul(L,ue)|0,o=Math.imul(L,fe),n=n+Math.imul(C,he)|0,i=(i=i+Math.imul(C,le)|0)+Math.imul(N,he)|0,o=o+Math.imul(N,le)|0;var Oe=(f+(n=n+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,ye)|0)+Math.imul(R,pe)|0))<<13)|0;f=((o=o+Math.imul(R,ye)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(D,he),i=(i=Math.imul(D,le))+Math.imul(L,he)|0,o=Math.imul(L,le);var Re=(f+(n=n+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,ye)|0)+Math.imul(N,pe)|0))<<13)|0;f=((o=o+Math.imul(N,ye)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ie=(f+(n=Math.imul(D,pe))|0)+((8191&(i=(i=Math.imul(D,ye))+Math.imul(L,pe)|0))<<13)|0;return f=((o=Math.imul(L,ye))+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,u[0]=be,u[1]=me,u[2]=ve,u[3]=ge,u[4]=we,u[5]=_e,u[6]=Me,u[7]=Se,u[8]=Ee,u[9]=Ae,u[10]=ke,u[11]=Be,u[12]=Te,u[13]=je,u[14]=xe,u[15]=Pe,u[16]=Oe,u[17]=Re,u[18]=Ie,0!==f&&(u[19]=f,r.length++),r};function m(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function v(e,t,r){return m(e,t,r)}function g(e,t){this.x=e,this.y=t}Math.imul||(b=y),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?b(this,e,t):r<63?y(this,e,t):r<1024?m(this,e,t):v(this,e,t)},g.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n>=1;return n},g.prototype.permute=function(e,t,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*t;a>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i&1}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,f=0;f=0&&(0!==c||f>=i);f--){var h=0|this.words[f];this.words[f]=c<<26-o|h>>>o,c=h&s}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,u=n.length-i.length;if("mod"!==t){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var f=0;f=0;h--){var l=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(l=Math.min(l/a|0,67108863),n._ishlnsubmul(i,l,h);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);s&&(s.words[h]=l)}return s&&s._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),f=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++f;for(var c=r.clone(),h=t.clone();!t.isZero();){for(var l=0,d=1;0==(t.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(t.iushrn(l);l-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(c),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(c),u.isub(h)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(s),a.isub(u)):(r.isub(t),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:r.iushln(f)}},o.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new o(1),s=new o(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var f=0,c=1;0==(t.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(t.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,l=1;0==(r.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new k(e)},o.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var w={k256:null,p224:null,p192:null,p25519:null};function _(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function S(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function B(e){k.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}_.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},_.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},_.prototype.split=function(e,t){e.iushrn(this.n,0,t)},_.prototype.imulK=function(e){return e.imul(this.k)},i(M,_),M.prototype.split=function(e,t){for(var r=Math.min(e.length,9),n=0;n>>22,i=o}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},M.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(w[e])return w[e];var t;if("k256"===e)t=new M;else if("p224"===e)t=new S;else if("p192"===e)t=new E;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new A}return w[e]=t,t},k.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},k.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},k.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(c(e,e.umod(this.m)._forceRed(this)),e)},k.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},k.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},k.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},k.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},k.prototype.isqr=function(e){return this.imul(e,e.clone())},k.prototype.sqr=function(e){return this.mul(e,e)},k.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),f=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new o(2*c*c).toRed(this);0!==this.pow(c,f).cmp(u);)c.redIAdd(u);for(var h=this.pow(c,i),l=this.pow(e,i.addn(1).iushrn(1)),d=this.pow(e,i),p=a;0!==d.cmp(s);){for(var y=d,b=0;0!==y.cmp(s);b++)y=y.redSqr();n(b=0;n--){for(var f=t.words[n],c=u-1;c>=0;c--){var h=f>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4===++s||0===n&&0===c)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}u=26}return i},k.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},k.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new B(e)},i(B,k),B.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},B.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},B.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},B.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},B.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this)},{buffer:222}],221:[function(e,t,r){arguments[4][46][0].apply(r,arguments)},{crypto:222,dup:46}],222:[function(e,t,r){arguments[4][199][0].apply(r,arguments)},{dup:199}],223:[function(e,t,r){var n=e("safe-buffer").Buffer;function i(e){n.isBuffer(e)||(e=n.from(e));for(var t=e.length/4|0,r=new Array(t),i=0;i>>24]^c[p>>>16&255]^h[y>>>8&255]^l[255&b]^t[m++],a=f[p>>>24]^c[y>>>16&255]^h[b>>>8&255]^l[255&d]^t[m++],s=f[y>>>24]^c[b>>>16&255]^h[d>>>8&255]^l[255&p]^t[m++],u=f[b>>>24]^c[d>>>16&255]^h[p>>>8&255]^l[255&y]^t[m++],d=o,p=a,y=s,b=u;return o=(n[d>>>24]<<24|n[p>>>16&255]<<16|n[y>>>8&255]<<8|n[255&b])^t[m++],a=(n[p>>>24]<<24|n[y>>>16&255]<<16|n[b>>>8&255]<<8|n[255&d])^t[m++],s=(n[y>>>24]<<24|n[b>>>16&255]<<16|n[d>>>8&255]<<8|n[255&p])^t[m++],u=(n[b>>>24]<<24|n[d>>>16&255]<<16|n[p>>>8&255]<<8|n[255&y])^t[m++],[o>>>=0,a>>>=0,s>>>=0,u>>>=0]}var s=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,u=0;u<256;++u){var f=s^s<<1^s<<2^s<<3^s<<4;f=f>>>8^255&f^99,r[a]=f,n[f]=a;var c=e[a],h=e[c],l=e[h],d=257*e[f]^16843008*f;i[0][a]=d<<24|d>>>8,i[1][a]=d<<16|d>>>16,i[2][a]=d<<8|d>>>24,i[3][a]=d,d=16843009*l^65537*h^257*c^16843008*a,o[0][f]=d<<24|d>>>8,o[1][f]=d<<16|d>>>16,o[2][f]=d<<8|d>>>24,o[3][f]=d,0===a?a=s=1:(a=c^e[e[e[l^c]]],s^=e[e[s]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function f(e){this._key=i(e),this._reset()}f.blockSize=16,f.keySize=32,f.prototype.blockSize=f.blockSize,f.prototype.keySize=f.keySize,f.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,n=4*(r+1),i=[],o=0;o>>24,a=u.SBOX[a>>>24]<<24|u.SBOX[a>>>16&255]<<16|u.SBOX[a>>>8&255]<<8|u.SBOX[255&a],a^=s[o/t|0]<<24):t>6&&o%t==4&&(a=u.SBOX[a>>>24]<<24|u.SBOX[a>>>16&255]<<16|u.SBOX[a>>>8&255]<<8|u.SBOX[255&a]),i[o]=i[o-t]^a}for(var f=[],c=0;c>>24]]^u.INV_SUB_MIX[1][u.SBOX[l>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[l>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&l]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=f},f.prototype.encryptBlockRaw=function(e){return a(e=i(e),this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},f.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=n.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},f.prototype.decryptBlock=function(e){var t=(e=i(e))[1];e[1]=e[3],e[3]=t;var r=a(e,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),o=n.allocUnsafe(16);return o.writeUInt32BE(r[0],0),o.writeUInt32BE(r[3],4),o.writeUInt32BE(r[2],8),o.writeUInt32BE(r[1],12),o},f.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},t.exports.AES=f},{"safe-buffer":364}],224:[function(e,t,r){var n=e("./aes"),i=e("safe-buffer").Buffer,o=e("cipher-base"),a=e("inherits"),s=e("./ghash"),u=e("buffer-xor"),f=e("./incr32");function c(e,t,r,a){o.call(this);var u=i.alloc(4,0);this._cipher=new n.AES(t);var c=this._cipher.encryptBlock(u);this._ghash=new s(c),r=function(e,t,r){if(12===t.length)return e._finID=i.concat([t,i.from([0,0,0,1])]),i.concat([t,i.from([0,0,0,2])]);var n=new s(r),o=t.length,a=o%16;n.update(t),a&&(a=16-a,n.update(i.alloc(a,0))),n.update(i.alloc(8,0));var u=8*o,c=i.alloc(8);c.writeUIntBE(u,0,8),n.update(c),e._finID=n.state;var h=i.from(e._finID);return f(h),h}(this,r,c),this._prev=i.from(r),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=a,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}a(c,o),c.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=i.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r},c.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=u(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var r=0;e.length!==t.length&&r++;for(var n=Math.min(e.length,t.length),i=0;i16)throw new Error("unable to decrypt data");var r=-1;for(;++r16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},h.prototype.flush=function(){if(this.cache.length)return this.cache},r.createDecipher=function(e,t){var r=o[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=f(t,!1,r.key,r.iv);return l(e,n.key,n.iv)},r.createDecipheriv=l},{"./aes":223,"./authCipher":224,"./modes":236,"./streamCipher":239,"cipher-base":267,evp_bytestokey:304,inherits:335,"safe-buffer":364}],227:[function(e,t,r){var n=e("./modes"),i=e("./authCipher"),o=e("safe-buffer").Buffer,a=e("./streamCipher"),s=e("cipher-base"),u=e("./aes"),f=e("evp_bytestokey");function c(e,t,r){s.call(this),this._cache=new l,this._cipher=new u.AES(t),this._prev=o.from(r),this._mode=e,this._autopadding=!0}e("inherits")(c,s),c.prototype._update=function(e){var t,r;this._cache.add(e);for(var n=[];t=this._cache.get();)r=this._mode.encrypt(this,t),n.push(r);return o.concat(n)};var h=o.alloc(16,16);function l(){this.cache=o.allocUnsafe(0)}function d(e,t,r){var s=n[e.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=o.from(t)),t.length!==s.key/8)throw new TypeError("invalid key length "+t.length);if("string"==typeof r&&(r=o.from(r)),"GCM"!==s.mode&&r.length!==s.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===s.type?new a(s.module,t,r):"auth"===s.type?new i(s.module,t,r):new c(s.module,t,r)}c.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(h))throw this._cipher.scrub(),new Error("data not multiple of block length")},c.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},l.prototype.add=function(e){this.cache=o.concat([this.cache,e])},l.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},l.prototype.flush=function(){for(var e=16-this.cache.length,t=o.allocUnsafe(e),r=-1;++r>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function a(e){this.h=e,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}a.prototype.ghash=function(e){for(var t=-1;++t0;t--)n[t]=n[t]>>>1|(1&n[t-1])<<31;n[0]=n[0]>>>1,r&&(n[0]=n[0]^225<<24)}this.state=o(i)},a.prototype.update=function(e){var t;for(this.cache=n.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},a.prototype.final=function(e,t){return this.cache.length&&this.ghash(n.concat([this.cache,i],16)),this.ghash(o([0,e,0,t])),this.state},t.exports=a},{"safe-buffer":364}],229:[function(e,t,r){t.exports=function(e){for(var t,r=e.length;r--;){if(255!==(t=e.readUInt8(r))){t++,e.writeUInt8(t,r);break}e.writeUInt8(0,r)}}},{}],230:[function(e,t,r){var n=e("buffer-xor");r.encrypt=function(e,t){var r=n(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev},r.decrypt=function(e,t){var r=e._prev;e._prev=t;var i=e._cipher.decryptBlock(t);return n(i,r)}},{"buffer-xor":265}],231:[function(e,t,r){var n=e("safe-buffer").Buffer,i=e("buffer-xor");function o(e,t,r){var o=t.length,a=i(t,e._cache);return e._cache=e._cache.slice(o),e._prev=n.concat([e._prev,r?t:a]),a}r.encrypt=function(e,t,r){for(var i,a=n.allocUnsafe(0);t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=n.allocUnsafe(0)),!(e._cache.length<=t.length)){a=n.concat([a,o(e,t,r)]);break}i=e._cache.length,a=n.concat([a,o(e,t.slice(0,i),r)]),t=t.slice(i)}return a}},{"buffer-xor":265,"safe-buffer":364}],232:[function(e,t,r){var n=e("safe-buffer").Buffer;function i(e,t,r){for(var n,i,a=-1,s=0;++a<8;)n=t&1<<7-a?128:0,s+=(128&(i=e._cipher.encryptBlock(e._prev)[0]^n))>>a%8,e._prev=o(e._prev,r?n:i);return s}function o(e,t){var r=e.length,i=-1,o=n.allocUnsafe(e.length);for(e=n.concat([e,n.from([t])]);++i>7;return o}r.encrypt=function(e,t,r){for(var o=t.length,a=n.allocUnsafe(o),s=-1;++s=0||!t.umod(e.prime1)||!t.umod(e.prime2));return t}function a(e,t){var i=function(e){var t=o(e);return{blinder:t.toRed(n.mont(e.modulus)).redPow(new n(e.publicExponent)).fromRed(),unblinder:t.invm(e.modulus)}}(t),a=t.modulus.byteLength(),s=new n(e).mul(i.blinder).umod(t.modulus),u=s.toRed(n.mont(t.prime1)),f=s.toRed(n.mont(t.prime2)),c=t.coefficient,h=t.prime1,l=t.prime2,d=u.redPow(t.exponent1).fromRed(),p=f.redPow(t.exponent2).fromRed(),y=d.isub(p).imul(c).umod(h).imul(l);return p.iadd(y).imul(i.unblinder).umod(t.modulus).toArrayLike(r,"be",a)}a.getr=o,t.exports=a}).call(this)}).call(this,e("buffer").Buffer)},{"bn.js":220,buffer:266,randombytes:361}],244:[function(e,t,r){t.exports=e("./browser/algorithms.json")},{"./browser/algorithms.json":245}],245:[function(e,t,r){t.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}},{}],246:[function(e,t,r){t.exports={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}},{}],247:[function(e,t,r){var n=e("safe-buffer").Buffer,i=e("create-hash"),o=e("readable-stream"),a=e("inherits"),s=e("./sign"),u=e("./verify"),f=e("./algorithms.json");function c(e){o.Writable.call(this);var t=f[e];if(!t)throw new Error("Unknown message digest");this._hashType=t.hash,this._hash=i(t.hash),this._tag=t.id,this._signType=t.sign}function h(e){o.Writable.call(this);var t=f[e];if(!t)throw new Error("Unknown message digest");this._hash=i(t.hash),this._tag=t.id,this._signType=t.sign}function l(e){return new c(e)}function d(e){return new h(e)}Object.keys(f).forEach(function(e){f[e].id=n.from(f[e].id,"hex"),f[e.toLowerCase()]=f[e]}),a(c,o.Writable),c.prototype._write=function(e,t,r){this._hash.update(e),r()},c.prototype.update=function(e,t){return"string"==typeof e&&(e=n.from(e,t)),this._hash.update(e),this},c.prototype.sign=function(e,t){this.end();var r=this._hash.digest(),n=s(r,e,this._hashType,this._signType,this._tag);return t?n.toString(t):n},a(h,o.Writable),h.prototype._write=function(e,t,r){this._hash.update(e),r()},h.prototype.update=function(e,t){return"string"==typeof e&&(e=n.from(e,t)),this._hash.update(e),this},h.prototype.verify=function(e,t,r){"string"==typeof t&&(t=n.from(t,r)),this.end();var i=this._hash.digest();return u(t,i,e,this._signType,this._tag)},t.exports={Sign:l,Verify:d,createSign:l,createVerify:d}},{"./algorithms.json":245,"./sign":248,"./verify":249,"create-hash":270,inherits:335,"readable-stream":264,"safe-buffer":364}],248:[function(e,t,r){var n=e("safe-buffer").Buffer,i=e("create-hmac"),o=e("browserify-rsa"),a=e("elliptic").ec,s=e("bn.js"),u=e("parse-asn1"),f=e("./curves.json");function c(e,t,r,o){if((e=n.from(e.toArray())).length0&&r.ishrn(n),r}function l(e,t,r){var o,a;do{for(o=n.alloc(0);8*o.length=t)throw new Error("invalid sig")}t.exports=function(e,t,r,f,c){var h=a(r);if("ec"===h.type){if("ecdsa"!==f&&"ecdsa/rsa"!==f)throw new Error("wrong public key type");return function(e,t,r){var n=s[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var i=new o(n),a=r.data.subjectPrivateKey.data;return i.verify(t,e,a)}(e,t,h)}if("dsa"===h.type){if("dsa"!==f)throw new Error("wrong public key type");return function(e,t,r){var n=r.data.p,o=r.data.q,s=r.data.g,f=r.data.pub_key,c=a.signature.decode(e,"der"),h=c.s,l=c.r;u(h,o),u(l,o);var d=i.mont(n),p=h.invm(o);return 0===s.toRed(d).redPow(new i(t).mul(p).mod(o)).fromRed().mul(f.toRed(d).redPow(l.mul(p).mod(o)).fromRed()).mod(n).mod(o).cmp(l)}(e,t,h)}if("rsa"!==f&&"ecdsa/rsa"!==f)throw new Error("wrong public key type");t=n.concat([c,t]);for(var l=h.modulus.byteLength(),d=[1],p=0;t.length+d.length+2i)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=a.prototype,t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return f(e)}return s(e,t,r)}function s(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|l(e,t),n=o(r),i=n.write(e,t);i!==r&&(n=n.slice(0,i));return n}(e,t);if(ArrayBuffer.isView(e))return c(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(L(e,ArrayBuffer)||e&&L(e.buffer,ArrayBuffer))return function(e,t,r){if(t<0||e.byteLength=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function l(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||L(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return N(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return U(e).length;default:if(i)return n?-1:N(e).length;t=(""+t).toLowerCase(),i=!0}}function d(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function p(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),K(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){var o,a=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,r/=2}function f(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=r;os&&(r=s-u),o=r;o>=0;o--){for(var h=!0,l=0;li&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function M(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function S(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:f>223?3:f>191?2:1;if(i+h<=r)switch(h){case 1:f<128&&(c=f);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&f)<<6|63&o)>127&&(c=u);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(u=(15&f)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&f)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=h}return function(e){var t=e.length;if(t<=E)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return B(this,t,r);case"utf8":case"utf-8":return S(this,t,r);case"ascii":return A(this,t,r);case"latin1":case"binary":return k(this,t,r);case"base64":return M(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),""},a.prototype.compare=function(e,t,r,n,i){if(L(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),u=Math.min(o,s),f=this.slice(n,i),c=e.slice(t,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return m(this,e,t,r);case"ascii":return v(this,e,t,r);case"latin1":case"binary":return g(this,e,t,r);case"base64":return w(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var E=4096;function A(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function x(e,t,r,n,i,o){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function P(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function O(e,t,r,i,o){return t=+t,r>>>=0,o||P(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function R(e,t,r,i,o){return t=+t,r>>>=0,o||P(e,0,r,8),n.write(e,t,r,i,52,8),r+8}a.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||j(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||j(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},a.prototype.readUInt8=function(e,t){return e>>>=0,t||j(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||j(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||j(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||j(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||j(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||j(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||j(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},a.prototype.readInt8=function(e,t){return e>>>=0,t||j(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||j(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||j(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||j(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||j(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||j(e,4,this.length),n.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||j(e,4,this.length),n.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||j(e,8,this.length),n.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||j(e,8,this.length),n.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||x(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n)||x(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},a.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);x(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);x(this,e,t,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,r){return O(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return O(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return R(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return R(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},a.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(e=i)}}else"number"==typeof e&&(e&=255);if(t<0||this.length>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function U(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(I,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function D(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function L(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function K(e){return e!=e}}).call(this)}).call(this,e("buffer").Buffer)},{"base64-js":219,buffer:266,ieee754:334}],267:[function(e,t,r){arguments[4][50][0].apply(r,arguments)},{dup:50,inherits:335,"safe-buffer":364,stream:374,string_decoder:389}],268:[function(e,t,r){(function(r){(function(){var n=e("elliptic"),i=e("bn.js");t.exports=function(e){return new a(e)};var o={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function a(e){this.curveType=o[e],this.curveType||(this.curveType={name:e}),this.curve=new n.ec(this.curveType.name),this.keys=void 0}function s(e,t,n){Array.isArray(e)||(e=e.toArray());var i=new r(e);if(n&&i.length0;n--)t+=this._buffer(e,t),r+=this._flushBuffer(i,r);return t+=this._buffer(e,t),i},i.prototype.final=function(e){var t,r;return e&&(t=this.update(e)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),t?t.concat(r):r},i.prototype._pad=function(e,t){if(0===t)return!1;for(;t>>1];r=o.r28shl(r,s),i=o.r28shl(i,s),o.pc2(r,i,e.keys,a)}},u.prototype._update=function(e,t,r,n){var i=this._desState,a=o.readUInt32BE(e,t),s=o.readUInt32BE(e,t+4);o.ip(a,s,i.tmp,0),a=i.tmp[0],s=i.tmp[1],"encrypt"===this.type?this._encrypt(i,a,s,i.tmp,0):this._decrypt(i,a,s,i.tmp,0),a=i.tmp[0],s=i.tmp[1],o.writeUInt32BE(r,a,n),o.writeUInt32BE(r,s,n+4)},u.prototype._pad=function(e,t){for(var r=e.length-t,n=t;n>>0,a=l}o.rip(s,a,n,i)},u.prototype._decrypt=function(e,t,r,n,i){for(var a=r,s=t,u=e.keys.length-2;u>=0;u-=2){var f=e.keys[u],c=e.keys[u+1];o.expand(a,e.tmp,0),f^=e.tmp[0],c^=e.tmp[1];var h=o.substitute(f,c),l=a;a=(s^o.permute(h))>>>0,s=l}o.rip(a,s,n,i)}},{"./cipher":277,"./utils":280,inherits:335,"minimalistic-assert":339}],279:[function(e,t,r){"use strict";var n=e("minimalistic-assert"),i=e("inherits"),o=e("./cipher"),a=e("./des");function s(e,t){n.equal(t.length,24,"Invalid key length");var r=t.slice(0,8),i=t.slice(8,16),o=t.slice(16,24);this.ciphers="encrypt"===e?[a.create({type:"encrypt",key:r}),a.create({type:"decrypt",key:i}),a.create({type:"encrypt",key:o})]:[a.create({type:"decrypt",key:o}),a.create({type:"encrypt",key:i}),a.create({type:"decrypt",key:r})]}function u(e){o.call(this,e);var t=new s(this.type,this.options.key);this._edeState=t}i(u,o),t.exports=u,u.create=function(e){return new u(e)},u.prototype._update=function(e,t,r,n){var i=this._edeState;i.ciphers[0]._update(e,t,r,n),i.ciphers[1]._update(r,n,r,n),i.ciphers[2]._update(r,n,r,n)},u.prototype._pad=a.prototype._pad,u.prototype._unpad=a.prototype._unpad},{"./cipher":277,"./des":278,inherits:335,"minimalistic-assert":339}],280:[function(e,t,r){"use strict";r.readUInt32BE=function(e,t){return(e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])>>>0},r.writeUInt32BE=function(e,t,r){e[0+r]=t>>>24,e[1+r]=t>>>16&255,e[2+r]=t>>>8&255,e[3+r]=255&t},r.ip=function(e,t,r,n){for(var i=0,o=0,a=6;a>=0;a-=2){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=e>>>s+a&1}for(a=6;a>=0;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1}r[n+0]=i>>>0,r[n+1]=o>>>0},r.rip=function(e,t,r,n){for(var i=0,o=0,a=0;a<4;a++)for(var s=24;s>=0;s-=8)i<<=1,i|=t>>>s+a&1,i<<=1,i|=e>>>s+a&1;for(a=4;a<8;a++)for(s=24;s>=0;s-=8)o<<=1,o|=t>>>s+a&1,o<<=1,o|=e>>>s+a&1;r[n+0]=i>>>0,r[n+1]=o>>>0},r.pc1=function(e,t,r,n){for(var i=0,o=0,a=7;a>=5;a--){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1}for(s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;r[n+0]=i>>>0,r[n+1]=o>>>0},r.r28shl=function(e,t){return e<>>28-t};var n=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];r.pc2=function(e,t,r,i){for(var o=0,a=0,s=n.length>>>1,u=0;u>>n[u]&1;for(u=s;u>>n[u]&1;r[i+0]=o>>>0,r[i+1]=a>>>0},r.expand=function(e,t,r){var n=0,i=0;n=(1&e)<<5|e>>>27;for(var o=23;o>=15;o-=4)n<<=6,n|=e>>>o&63;for(o=11;o>=3;o-=4)i|=e>>>o&63,i<<=6;i|=(31&e)<<1|e>>>31,t[r+0]=n>>>0,t[r+1]=i>>>0};var i=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];r.substitute=function(e,t){for(var r=0,n=0;n<4;n++){r<<=4,r|=i[64*n+(e>>>18-6*n&63)]}for(n=0;n<4;n++){r<<=4,r|=i[256+64*n+(t>>>18-6*n&63)]}return r>>>0};var o=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];r.permute=function(e){for(var t=0,r=0;r>>o[r]&1;return t>>>0},r.padSplit=function(e,t,r){for(var n=e.toString(2);n.lengthe;)r.ishrn(1);if(r.isEven()&&r.iadd(s),r.testn(1)||r.iadd(u),t.cmp(u)){if(!t.cmp(f))for(;r.mod(c).cmp(h);)r.iadd(d)}else for(;r.mod(o).cmp(l);)r.iadd(d);if(b(p=r.shrn(1))&&b(r)&&m(p)&&m(r)&&a.test(p)&&a.test(r))return r}}},{"bn.js":285,"miller-rabin":337,randombytes:361}],284:[function(e,t,r){t.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}},{}],285:[function(e,t,r){arguments[4][45][0].apply(r,arguments)},{buffer:222,dup:45}],286:[function(e,t,r){arguments[4][56][0].apply(r,arguments)},{"../package.json":302,"./elliptic/curve":289,"./elliptic/curves":292,"./elliptic/ec":293,"./elliptic/eddsa":296,"./elliptic/utils":300,brorand:221,dup:56}],287:[function(e,t,r){arguments[4][57][0].apply(r,arguments)},{"../utils":300,"bn.js":301,dup:57}],288:[function(e,t,r){arguments[4][58][0].apply(r,arguments)},{"../utils":300,"./base":287,"bn.js":301,dup:58,inherits:335}],289:[function(e,t,r){arguments[4][59][0].apply(r,arguments)},{"./base":287,"./edwards":288,"./mont":290,"./short":291,dup:59}],290:[function(e,t,r){arguments[4][60][0].apply(r,arguments)},{"../utils":300,"./base":287,"bn.js":301,dup:60,inherits:335}],291:[function(e,t,r){arguments[4][61][0].apply(r,arguments)},{"../utils":300,"./base":287,"bn.js":301,dup:61,inherits:335}],292:[function(e,t,r){arguments[4][62][0].apply(r,arguments)},{"./curve":289,"./precomputed/secp256k1":299,"./utils":300,dup:62,"hash.js":321}],293:[function(e,t,r){arguments[4][63][0].apply(r,arguments)},{"../curves":292,"../utils":300,"./key":294,"./signature":295,"bn.js":301,brorand:221,dup:63,"hmac-drbg":333}],294:[function(e,t,r){arguments[4][64][0].apply(r,arguments)},{"../utils":300,"bn.js":301,dup:64}],295:[function(e,t,r){arguments[4][65][0].apply(r,arguments)},{"../utils":300,"bn.js":301,dup:65}],296:[function(e,t,r){arguments[4][66][0].apply(r,arguments)},{"../curves":292,"../utils":300,"./key":297,"./signature":298,dup:66,"hash.js":321}],297:[function(e,t,r){arguments[4][67][0].apply(r,arguments)},{"../utils":300,dup:67}],298:[function(e,t,r){arguments[4][68][0].apply(r,arguments)},{"../utils":300,"bn.js":301,dup:68}],299:[function(e,t,r){arguments[4][69][0].apply(r,arguments)},{dup:69}],300:[function(e,t,r){arguments[4][70][0].apply(r,arguments)},{"bn.js":301,dup:70,"minimalistic-assert":339,"minimalistic-crypto-utils":340}],301:[function(e,t,r){arguments[4][45][0].apply(r,arguments)},{buffer:222,dup:45}],302:[function(e,t,r){t.exports={_from:"elliptic@^6.5.3",_id:"elliptic@6.5.4",_inBundle:!1,_integrity:"sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==",_location:"/browserify/elliptic",_phantomChildren:{},_requested:{type:"range",registry:!0,raw:"elliptic@^6.5.3",name:"elliptic",escapedName:"elliptic",rawSpec:"^6.5.3",saveSpec:null,fetchSpec:"^6.5.3"},_requiredBy:["/browserify/browserify-sign","/browserify/create-ecdh"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz",_shasum:"da37cebd31e79a1367e941b592ed1fbebd58abbb",_spec:"elliptic@^6.5.3",_where:"/usr/local/lib/node_modules/browserify/node_modules/browserify-sign",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},bundleDependencies:!1,dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},deprecated:!1,description:"EC cryptography",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},files:["lib"],homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",test:"npm run lint && npm run unit",unit:"istanbul test _mocha --reporter=spec test/index.js",version:"grunt dist && git add dist/"},version:"6.5.4"}},{}],303:[function(e,t,r){"use strict";var n,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(e,t){return new Promise(function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}b(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&b(e,"error",t,r)}(e,i,{once:!0})})},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var u=10;function f(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function h(e,t,r,n){var i,o,a,s;if(f(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]),void 0===a)a=o[t]=r,++e._eventsCount;else if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=c(e))>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,s=u,console&&console.warn&&console.warn(s)}return e}function l(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(n);return i.listener=r,n.wrapFn=i,i}function d(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)o(u,this,t);else{var f=u.length,c=y(u,f);for(r=0;r=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},s.prototype.listeners=function(e){return d(this,e,!0)},s.prototype.rawListeners=function(e){return d(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},s.prototype.listenerCount=p,s.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},{}],304:[function(e,t,r){var n=e("safe-buffer").Buffer,i=e("md5.js");t.exports=function(e,t,r,o){if(n.isBuffer(e)||(e=n.from(e,"binary")),t&&(n.isBuffer(t)||(t=n.from(t,"binary")),8!==t.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var a=r/8,s=n.alloc(a),u=n.alloc(o||0),f=n.alloc(0);a>0||o>0;){var c=new i;c.update(f),c.update(e),t&&c.update(t),f=c.digest();var h=0;if(a>0){var l=s.length-a;h=Math.min(a,f.length),f.copy(s,l,0,h),a-=h}if(h0){var d=u.length-o,p=Math.min(o,f.length-h);f.copy(u,d,h,h+p),o-=p}}return f.fill(0),{key:s,iv:u}}},{"md5.js":336,"safe-buffer":364}],305:[function(e,t,r){arguments[4][82][0].apply(r,arguments)},{dup:82,inherits:335,"readable-stream":320,"safe-buffer":364}],306:[function(e,t,r){arguments[4][106][0].apply(r,arguments)},{dup:106}],307:[function(e,t,r){arguments[4][107][0].apply(r,arguments)},{"./_stream_readable":309,"./_stream_writable":311,_process:353,dup:107,inherits:335}],308:[function(e,t,r){arguments[4][108][0].apply(r,arguments)},{"./_stream_transform":310,dup:108,inherits:335}],309:[function(e,t,r){arguments[4][109][0].apply(r,arguments)},{"../errors":306,"./_stream_duplex":307,"./internal/streams/async_iterator":312,"./internal/streams/buffer_list":313,"./internal/streams/destroy":314,"./internal/streams/from":316,"./internal/streams/state":318,"./internal/streams/stream":319,_process:353,buffer:266,dup:109,events:303,inherits:335,"string_decoder/":389,util:222}],310:[function(e,t,r){arguments[4][110][0].apply(r,arguments)},{"../errors":306,"./_stream_duplex":307,dup:110,inherits:335}],311:[function(e,t,r){arguments[4][111][0].apply(r,arguments)},{"../errors":306,"./_stream_duplex":307,"./internal/streams/destroy":314,"./internal/streams/state":318,"./internal/streams/stream":319,_process:353,buffer:266,dup:111,inherits:335,"util-deprecate":390}],312:[function(e,t,r){arguments[4][112][0].apply(r,arguments)},{"./end-of-stream":315,_process:353,dup:112}],313:[function(e,t,r){arguments[4][113][0].apply(r,arguments)},{buffer:266,dup:113,util:222}],314:[function(e,t,r){arguments[4][114][0].apply(r,arguments)},{_process:353,dup:114}],315:[function(e,t,r){arguments[4][115][0].apply(r,arguments)},{"../../../errors":306,dup:115}],316:[function(e,t,r){arguments[4][116][0].apply(r,arguments)},{dup:116}],317:[function(e,t,r){arguments[4][117][0].apply(r,arguments)},{"../../../errors":306,"./end-of-stream":315,dup:117}],318:[function(e,t,r){arguments[4][118][0].apply(r,arguments)},{"../../../errors":306,dup:118}],319:[function(e,t,r){arguments[4][119][0].apply(r,arguments)},{dup:119,events:303}],320:[function(e,t,r){arguments[4][120][0].apply(r,arguments)},{"./lib/_stream_duplex.js":307,"./lib/_stream_passthrough.js":308,"./lib/_stream_readable.js":309,"./lib/_stream_transform.js":310,"./lib/_stream_writable.js":311,"./lib/internal/streams/end-of-stream.js":315,"./lib/internal/streams/pipeline.js":317,dup:120}],321:[function(e,t,r){arguments[4][83][0].apply(r,arguments)},{"./hash/common":322,"./hash/hmac":323,"./hash/ripemd":324,"./hash/sha":325,"./hash/utils":332,dup:83}],322:[function(e,t,r){arguments[4][84][0].apply(r,arguments)},{"./utils":332,dup:84,"minimalistic-assert":339}],323:[function(e,t,r){arguments[4][85][0].apply(r,arguments)},{"./utils":332,dup:85,"minimalistic-assert":339}],324:[function(e,t,r){arguments[4][86][0].apply(r,arguments)},{"./common":322,"./utils":332,dup:86}],325:[function(e,t,r){arguments[4][87][0].apply(r,arguments)},{"./sha/1":326,"./sha/224":327,"./sha/256":328,"./sha/384":329,"./sha/512":330,dup:87}],326:[function(e,t,r){arguments[4][88][0].apply(r,arguments)},{"../common":322,"../utils":332,"./common":331,dup:88}],327:[function(e,t,r){arguments[4][89][0].apply(r,arguments)},{"../utils":332,"./256":328,dup:89}],328:[function(e,t,r){arguments[4][90][0].apply(r,arguments)},{"../common":322,"../utils":332,"./common":331,dup:90,"minimalistic-assert":339}],329:[function(e,t,r){arguments[4][91][0].apply(r,arguments)},{"../utils":332,"./512":330,dup:91}],330:[function(e,t,r){arguments[4][92][0].apply(r,arguments)},{"../common":322,"../utils":332,dup:92,"minimalistic-assert":339}],331:[function(e,t,r){arguments[4][93][0].apply(r,arguments)},{"../utils":332,dup:93}],332:[function(e,t,r){arguments[4][94][0].apply(r,arguments)},{dup:94,inherits:335,"minimalistic-assert":339}],333:[function(e,t,r){arguments[4][95][0].apply(r,arguments)},{dup:95,"hash.js":321,"minimalistic-assert":339,"minimalistic-crypto-utils":340}],334:[function(e,t,r){r.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,u=(1<>1,c=-7,h=r?i-1:0,l=r?-1:1,d=e[t+h];for(h+=l,o=d&(1<<-c)-1,d>>=-c,c+=s;c>0;o=256*o+e[t+h],h+=l,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+e[t+h],h+=l,c-=8);if(0===o)o=1-f;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=f}return(d?-1:1)*a*Math.pow(2,o-n)},r.write=function(e,t,r,n,i,o){var a,s,u,f=8*o-i-1,c=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+h>=1?l/u:l*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(t*u-1)*Math.pow(2,i),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<0;e[r+d]=255&a,d+=p,a/=256,f-=8);e[r+d-p]|=128*y}},{}],335:[function(e,t,r){arguments[4][97][0].apply(r,arguments)},{dup:97}],336:[function(e,t,r){arguments[4][102][0].apply(r,arguments)},{dup:102,"hash-base":305,inherits:335,"safe-buffer":364}],337:[function(e,t,r){var n=e("bn.js"),i=e("brorand");function o(e){this.rand=e||new i.Rand}t.exports=o,o.create=function(e){return new o(e)},o.prototype._randbelow=function(e){var t=e.bitLength(),r=Math.ceil(t/8);do{var i=new n(this.rand.generate(r))}while(i.cmp(e)>=0);return i},o.prototype._randrange=function(e,t){var r=t.sub(e);return e.add(this._randbelow(r))},o.prototype.test=function(e,t,r){var i=e.bitLength(),o=n.mont(e),a=new n(1).toRed(o);t||(t=Math.max(1,i/48|0));for(var s=e.subn(1),u=0;!s.testn(u);u++);for(var f=e.shrn(u),c=s.toRed(o);t>0;t--){var h=this._randrange(new n(2),s);r&&r(h);var l=h.toRed(o).redPow(f);if(0!==l.cmp(a)&&0!==l.cmp(c)){for(var d=1;d0;t--){var c=this._randrange(new n(2),a),h=e.gcd(c);if(0!==h.cmpn(1))return h;var l=c.toRed(i).redPow(u);if(0!==l.cmp(o)&&0!==l.cmp(f)){for(var d=1;d=6?"utf-8":"binary"}else n="utf-8";t.exports=n}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:353}],350:[function(e,t,r){var n=Math.pow(2,30)-1;t.exports=function(e,t){if("number"!=typeof e)throw new TypeError("Iterations not a number");if(e<0)throw new TypeError("Bad iterations");if("number"!=typeof t)throw new TypeError("Key length not a number");if(t<0||t>n||t!=t)throw new TypeError("Bad key length")}},{}],351:[function(e,t,r){var n=e("create-hash/md5"),i=e("ripemd160"),o=e("sha.js"),a=e("safe-buffer").Buffer,s=e("./precondition"),u=e("./default-encoding"),f=e("./to-buffer"),c=a.alloc(128),h={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function l(e,t,r){var s=function(e){return"rmd160"===e||"ripemd160"===e?function(e){return(new i).update(e).digest()}:"md5"===e?n:function(t){return o(e).update(t).digest()}}(e),u="sha512"===e||"sha384"===e?128:64;t.length>u?t=s(t):t.length1)for(var r=1;rp||new a(t).cmp(d.modulus)>=0)throw new Error("decryption error");l=r?f(new a(t),d):s(t,d);var y=c.alloc(p-l.length);if(l=c.concat([y,l],p),4===h)return function(e,t){var r=e.modulus.byteLength(),n=u("sha1").update(c.alloc(0)).digest(),a=n.length;if(0!==t[0])throw new Error("decryption error");var s=t.slice(1,a+1),f=t.slice(a+1),h=o(s,i(f,a)),l=o(f,i(h,r-a-1));if(function(e,t){e=c.from(e),t=c.from(t);var r=0,n=e.length;e.length!==t.length&&(r++,n=Math.min(e.length,t.length));var i=-1;for(;++i=t.length){o++;break}var a=t.slice(2,i-1);("0002"!==n.toString("hex")&&!r||"0001"!==n.toString("hex")&&r)&&o++;a.length<8&&o++;if(o)throw new Error("decryption error");return t.slice(i)}(0,l,r);if(3===h)return l;throw new Error("unknown padding")}},{"./mgf":355,"./withPublic":359,"./xor":360,"bn.js":356,"browserify-rsa":243,"create-hash":270,"parse-asn1":346,"safe-buffer":364}],358:[function(e,t,r){var n=e("parse-asn1"),i=e("randombytes"),o=e("create-hash"),a=e("./mgf"),s=e("./xor"),u=e("bn.js"),f=e("./withPublic"),c=e("browserify-rsa"),h=e("safe-buffer").Buffer;t.exports=function(e,t,r){var l;l=e.padding?e.padding:r?1:4;var d,p=n(e);if(4===l)d=function(e,t){var r=e.modulus.byteLength(),n=t.length,f=o("sha1").update(h.alloc(0)).digest(),c=f.length,l=2*c;if(n>r-l-2)throw new Error("message too long");var d=h.alloc(r-n-l-2),p=r-c-1,y=i(c),b=s(h.concat([f,d,h.alloc(1,1),t],p),a(y,p)),m=s(y,a(b,c));return new u(h.concat([h.alloc(1),m,b],r))}(p,t);else if(1===l)d=function(e,t,r){var n,o=t.length,a=e.modulus.byteLength();if(o>a-11)throw new Error("message too long");n=r?h.alloc(a-o-3,255):function(e){var t,r=h.allocUnsafe(e),n=0,o=i(2*e),a=0;for(;n=0)throw new Error("data too long for modulus")}return r?c(d,p):f(d,p)}},{"./mgf":355,"./withPublic":359,"./xor":360,"bn.js":356,"browserify-rsa":243,"create-hash":270,"parse-asn1":346,randombytes:361,"safe-buffer":364}],359:[function(e,t,r){var n=e("bn.js"),i=e("safe-buffer").Buffer;t.exports=function(e,t){return i.from(e.toRed(n.mont(t.modulus)).redPow(new n(t.publicExponent)).fromRed().toArray())}},{"bn.js":356,"safe-buffer":364}],360:[function(e,t,r){t.exports=function(e,t){for(var r=e.length,n=-1;++nc||e<0)throw new TypeError("offset must be a uint32");if(e>u||e>t)throw new RangeError("offset out of range")}function l(e,t,r){if("number"!=typeof e||e!=e)throw new TypeError("size must be a number");if(e>c||e<0)throw new TypeError("size must be a uint32");if(e+t>r||e>u)throw new RangeError("buffer too small")}function d(e,r,n,i){if(t.browser){var o=e.buffer,s=new Uint8Array(o,r,n);return f.getRandomValues(s),i?void t.nextTick(function(){i(null,e)}):e}if(!i)return a(n).copy(e,r),e;a(n,function(t,n){if(t)return i(t);n.copy(e,r),i(null,e)})}f&&f.getRandomValues||!t.browser?(r.randomFill=function(e,t,r,i){if(!(s.isBuffer(e)||e instanceof n.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof t)i=t,t=0,r=e.length;else if("function"==typeof r)i=r,r=e.length-t;else if("function"!=typeof i)throw new TypeError('"cb" argument must be a function');return h(t,e.length),l(r,t,e.length),d(e,t,r,i)},r.randomFillSync=function(e,t,r){void 0===t&&(t=0);if(!(s.isBuffer(e)||e instanceof n.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');h(t,e.length),void 0===r&&(r=e.length-t);return l(r,t,e.length),d(e,t,r)}):(r.randomFill=i,r.randomFillSync=i)}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:353,randombytes:361,"safe-buffer":364}],363:[function(e,t,r){arguments[4][121][0].apply(r,arguments)},{buffer:266,dup:121,"hash-base":305,inherits:335}],364:[function(e,t,r){arguments[4][122][0].apply(r,arguments)},{buffer:266,dup:122}],365:[function(e,t,r){arguments[4][123][0].apply(r,arguments)},{_process:353,buffer:266,dup:123}],366:[function(e,t,r){arguments[4][127][0].apply(r,arguments)},{dup:127,"safe-buffer":364}],367:[function(e,t,r){arguments[4][128][0].apply(r,arguments)},{"./sha":368,"./sha1":369,"./sha224":370,"./sha256":371,"./sha384":372,"./sha512":373,dup:128}],368:[function(e,t,r){arguments[4][129][0].apply(r,arguments)},{"./hash":366,dup:129,inherits:335,"safe-buffer":364}],369:[function(e,t,r){arguments[4][130][0].apply(r,arguments)},{"./hash":366,dup:130,inherits:335,"safe-buffer":364}],370:[function(e,t,r){arguments[4][131][0].apply(r,arguments)},{"./hash":366,"./sha256":371,dup:131,inherits:335,"safe-buffer":364}],371:[function(e,t,r){arguments[4][132][0].apply(r,arguments)},{"./hash":366,dup:132,inherits:335,"safe-buffer":364}],372:[function(e,t,r){arguments[4][133][0].apply(r,arguments)},{"./hash":366,"./sha512":373,dup:133,inherits:335,"safe-buffer":364}],373:[function(e,t,r){arguments[4][134][0].apply(r,arguments)},{"./hash":366,dup:134,inherits:335,"safe-buffer":364}],374:[function(e,t,r){t.exports=i;var n=e("events").EventEmitter;function i(){n.call(this)}e("inherits")(i,n),i.Readable=e("readable-stream/lib/_stream_readable.js"),i.Writable=e("readable-stream/lib/_stream_writable.js"),i.Duplex=e("readable-stream/lib/_stream_duplex.js"),i.Transform=e("readable-stream/lib/_stream_transform.js"),i.PassThrough=e("readable-stream/lib/_stream_passthrough.js"),i.finished=e("readable-stream/lib/internal/streams/end-of-stream.js"),i.pipeline=e("readable-stream/lib/internal/streams/pipeline.js"),i.Stream=i,i.prototype.pipe=function(e,t){var r=this;function i(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),e.on("drain",o),e._isStdio||t&&!1===t.end||(r.on("end",s),r.on("close",u));var a=!1;function s(){a||(a=!0,e.end())}function u(){a||(a=!0,"function"==typeof e.destroy&&e.destroy())}function f(e){if(c(),0===n.listenerCount(this,"error"))throw e}function c(){r.removeListener("data",i),e.removeListener("drain",o),r.removeListener("end",s),r.removeListener("close",u),r.removeListener("error",f),e.removeListener("error",f),r.removeListener("end",c),r.removeListener("close",c),e.removeListener("close",c)}return r.on("error",f),e.on("error",f),r.on("end",c),r.on("close",c),e.on("close",c),e.emit("pipe",r),e}},{events:303,inherits:335,"readable-stream/lib/_stream_duplex.js":376,"readable-stream/lib/_stream_passthrough.js":377,"readable-stream/lib/_stream_readable.js":378,"readable-stream/lib/_stream_transform.js":379,"readable-stream/lib/_stream_writable.js":380,"readable-stream/lib/internal/streams/end-of-stream.js":384,"readable-stream/lib/internal/streams/pipeline.js":386}],375:[function(e,t,r){arguments[4][106][0].apply(r,arguments)},{dup:106}],376:[function(e,t,r){arguments[4][107][0].apply(r,arguments)},{"./_stream_readable":378,"./_stream_writable":380,_process:353,dup:107,inherits:335}],377:[function(e,t,r){arguments[4][108][0].apply(r,arguments)},{"./_stream_transform":379,dup:108,inherits:335}],378:[function(e,t,r){arguments[4][109][0].apply(r,arguments)},{"../errors":375,"./_stream_duplex":376,"./internal/streams/async_iterator":381,"./internal/streams/buffer_list":382,"./internal/streams/destroy":383,"./internal/streams/from":385,"./internal/streams/state":387,"./internal/streams/stream":388,_process:353,buffer:266,dup:109,events:303,inherits:335,"string_decoder/":389,util:222}],379:[function(e,t,r){arguments[4][110][0].apply(r,arguments)},{"../errors":375,"./_stream_duplex":376,dup:110,inherits:335}],380:[function(e,t,r){arguments[4][111][0].apply(r,arguments)},{"../errors":375,"./_stream_duplex":376,"./internal/streams/destroy":383,"./internal/streams/state":387,"./internal/streams/stream":388,_process:353,buffer:266,dup:111,inherits:335,"util-deprecate":390}],381:[function(e,t,r){arguments[4][112][0].apply(r,arguments)},{"./end-of-stream":384,_process:353,dup:112}],382:[function(e,t,r){arguments[4][113][0].apply(r,arguments)},{buffer:266,dup:113,util:222}],383:[function(e,t,r){arguments[4][114][0].apply(r,arguments)},{_process:353,dup:114}],384:[function(e,t,r){arguments[4][115][0].apply(r,arguments)},{"../../../errors":375,dup:115}],385:[function(e,t,r){arguments[4][116][0].apply(r,arguments)},{dup:116}],386:[function(e,t,r){arguments[4][117][0].apply(r,arguments)},{"../../../errors":375,"./end-of-stream":384,dup:117}],387:[function(e,t,r){arguments[4][118][0].apply(r,arguments)},{"../../../errors":375,dup:118}],388:[function(e,t,r){arguments[4][119][0].apply(r,arguments)},{dup:119,events:303}],389:[function(e,t,r){arguments[4][135][0].apply(r,arguments)},{dup:135,"safe-buffer":364}],390:[function(e,t,r){arguments[4][179][0].apply(r,arguments)},{dup:179}]},{},[181])(181)}); \ No newline at end of file diff --git a/app/assets/v2/js/pages/bounty_detail/casper_extension.js b/app/assets/v2/js/pages/bounty_detail/casper_extension.js new file mode 100644 index 00000000000..9996b44da31 --- /dev/null +++ b/app/assets/v2/js/pages/bounty_detail/casper_extension.js @@ -0,0 +1,93 @@ +const payWithCasperExtension = async(fulfillment_id, to_address, vm, modal) => { + + const amount = vm.fulfillment_context.amount; + const token_name = vm.bounty.token_name; + const tenant = vm.getTenant(token_name, vm.bounty.web3_type); + + const { CasperClient, DeployUtil, PublicKey, Signer } = casper; + const casperClient = new CasperClient(`/api/v1/reverse-proxy/${tenant}`); + + const isConnected = await Signer.isConnected(); + + if (!isConnected) { + try { + Signer.sendConnectionRequest(); + } catch (e) { + _alert({ message: gettext('Please download or enable CasperLabs Signer extension.') }, 'danger'); + return; + } + } + + const selectedAddress = await Signer.getActivePublicKey(); + + const paymentAmount = 10000; // for native-transfers the payment price is fixed + const id = fulfillment_id; + const gasPrice = 1; // gasPrice for native transfers can be set to 1 + + // time that the deploy will remain valid for, in milliseconds + // the default value is 1800000 ms (30 minutes) + const ttl = 1800000; + + const fromPublicKey = PublicKey.fromHex(selectedAddress); + const toPublicKey = PublicKey.fromHex(to_address); + + let deployParams = new DeployUtil.DeployParams(fromPublicKey, 'casper', gasPrice, ttl); + + const session = DeployUtil.ExecutableDeployItem.newTransfer( + amount * 10 ** vm.decimals, + toPublicKey, + null, + id + ); + + const payment = DeployUtil.standardPayment(paymentAmount); + const deploy = DeployUtil.makeDeploy(deployParams, session, payment); + const deployJson = DeployUtil.deployToJson(deploy); + + const signedDeployJson = await Signer.sign(deployJson, selectedAddress, to_address); + const signedDeploy = DeployUtil.deployFromJson(signedDeployJson); + + try { + const deployHash = await casperClient.putDeploy(signedDeploy); + + callback(null, selectedAddress, deployHash); + } catch (e) { + modal.closeModal(); + callback(e); + } + + function callback(error, from_address, txn) { + if (error) { + _alert({ message: gettext('Unable to payout bounty due to: ' + error) }, 'danger'); + console.log(error); + } else { + + const payload = { + payout_type: 'casper_ext', + tenant: 'CASPER', + amount: amount, + token_name: token_name, + funder_address: from_address, + payout_tx_id: txn + }; + + modal.closeModal(); + const apiUrlBounty = `/api/v1/bounty/payout/${fulfillment_id}`; + + fetchData(apiUrlBounty, 'POST', payload).then(response => { + if (200 <= response.status && response.status <= 204) { + vm.fetchBounty(); + _alert('Payment Successful', 'success'); + + } else { + _alert('Unable to make payout bounty. Please try again later', 'danger'); + console.error(`error: bounty payment failed with status: ${response.status} and message: ${response.message}`); + } + }).catch(function(error) { + _alert('Unable to make payout bounty. Please try again later', 'danger'); + console.log(error); + }); + } + } +}; + \ No newline at end of file diff --git a/app/assets/v2/js/pages/bounty_details2.js b/app/assets/v2/js/pages/bounty_details2.js index 20ce375b631..b924dc68ef7 100644 --- a/app/assets/v2/js/pages/bounty_details2.js +++ b/app/assets/v2/js/pages/bounty_details2.js @@ -166,6 +166,10 @@ Vue.mixin({ url = `https://tzkt.io/${txn}`; break; + case 'CSPR': + url = `https://casperstats.io/tx/${txn}`; + break; + default: url = `https://etherscan.io/tx/${txn}`; @@ -244,6 +248,10 @@ Vue.mixin({ url = `https://tzkt.io/${address}/operations/`; break; + case 'CSPR': + url = `https://casperstats.io/address/${address}`; + break; + default: url = `https://etherscan.io/address/${address}`; } @@ -492,6 +500,10 @@ Vue.mixin({ tenant = 'TEZOS'; break; + case 'CSPR': + tenant = 'CASPER'; + break; + default: tenant = 'ETH'; } @@ -589,6 +601,10 @@ Vue.mixin({ case 'tezos_ext': payWithTezosExtension(fulfillment_id, fulfiller_address, vm, modal); break; + + case 'casper_ext': + payWithCasperExtension(fulfillment_id, fulfiller_address, vm, modal); + break; } }, closeBounty: function() { @@ -809,6 +825,7 @@ Vue.mixin({ case 'xinfin_ext': case 'algorand_ext': case 'tezos_ext': + case 'casper_ext': vm.fulfillment_context.active_step = 'payout_amount'; break; } diff --git a/app/assets/v2/js/pages/hackathon_new_bounty.js b/app/assets/v2/js/pages/hackathon_new_bounty.js index 86d24f86170..110f19a6aa0 100644 --- a/app/assets/v2/js/pages/hackathon_new_bounty.js +++ b/app/assets/v2/js/pages/hackathon_new_bounty.js @@ -186,6 +186,10 @@ Vue.mixin({ // tezos type = 'tezos_ext'; break; + case '270895': + // casper + type = 'casper_ext'; + break; case '666': // paypal type = 'fiat'; diff --git a/app/assets/v2/js/pages/new_bounty.js b/app/assets/v2/js/pages/new_bounty.js index bb53be644f6..576307aceeb 100644 --- a/app/assets/v2/js/pages/new_bounty.js +++ b/app/assets/v2/js/pages/new_bounty.js @@ -161,6 +161,16 @@ Vue.mixin({ break; } + case '270895': { + // casper + let addr = vm.form.funderAddress; + + if (!addr.toLowerCase().startsWith('01') && !addr.toLowerCase().startsWith('02')) { + isValid = false; + } + break; + } + // include validation for other chains here } @@ -255,6 +265,10 @@ Vue.mixin({ // tezos type = 'tezos_ext'; break; + case '270895': + // casper + type = 'casper_ext'; + break; case '666': // paypal type = 'fiat'; diff --git a/app/dashboard/management/commands/sync_pending_fulfillments.py b/app/dashboard/management/commands/sync_pending_fulfillments.py index 167256632cc..c50979df7da 100644 --- a/app/dashboard/management/commands/sync_pending_fulfillments.py +++ b/app/dashboard/management/commands/sync_pending_fulfillments.py @@ -36,7 +36,7 @@ def handle(self, *args, **options): ) # Extensions - ext_payout_types= ['web3_modal', 'polkadot_ext', 'harmony_ext', 'binance_ext', 'rsk_ext', 'xinfin_ext', 'nervos_ext', 'algorand_ext', 'sia_ext', 'tezos_ext'] + ext_payout_types= ['web3_modal', 'polkadot_ext', 'harmony_ext', 'binance_ext', 'rsk_ext', 'xinfin_ext', 'nervos_ext', 'algorand_ext', 'sia_ext', 'tezos_ext', 'casper_ext'] for ext_payout_type in ext_payout_types: ext_pending_fulfillments = pending_fulfillments.filter(payout_type=ext_payout_type) for fulfillment in ext_pending_fulfillments.all(): diff --git a/app/dashboard/models.py b/app/dashboard/models.py index 43db3d50e71..0755d545004 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -296,6 +296,7 @@ class Bounty(SuperModel): ('algorand_ext', 'Algorand Ext'), ('sia_ext', 'Sia Ext'), ('tezos_ext', 'Tezos Ext'), + ('casper_ext', 'Casper Ext'), ('fiat', 'Fiat'), ('manual', 'Manual') ) @@ -1410,6 +1411,7 @@ class BountyFulfillment(SuperModel): ('algorand_ext', 'algorand_ext'), ('sia_ext', 'sia_ext'), ('tezos_ext', 'tezos_ext'), + ('casper_ext', 'casper_ext'), ('manual', 'manual') ] @@ -1430,6 +1432,7 @@ class BountyFulfillment(SuperModel): ('ALGORAND', 'ALGORAND'), ('SIA', 'SIA'), ('TEZOS', 'TEZOS'), + ('CASPER', 'CASPER'), ('OTHERS', 'OTHERS') ] diff --git a/app/dashboard/sync/binance.py b/app/dashboard/sync/binance.py index 2a533470be2..a769b9d11e9 100644 --- a/app/dashboard/sync/binance.py +++ b/app/dashboard/sync/binance.py @@ -30,10 +30,6 @@ def get_binance_txn_status(fulfillment): 'params': [ txnid ] } - headers = { - 'Host': 'gitcoin.co' - } - binance_response = requests.post(binance_url, json=data).json() result = binance_response['result'] diff --git a/app/dashboard/sync/casper.py b/app/dashboard/sync/casper.py new file mode 100644 index 00000000000..0323f607d3b --- /dev/null +++ b/app/dashboard/sync/casper.py @@ -0,0 +1,63 @@ +import logging + +from django.utils import timezone + +import requests +from dashboard.sync.helpers import record_payout_activity + +logger = logging.getLogger(__name__) + + +def get_casper_txn_status(fulfillment): + txnid = fulfillment.payout_tx_id + token_name = fulfillment.token_name + funderAddress = fulfillment.funder_address + amount = fulfillment.payout_amount + + if token_name != 'CSPR' or not txnid: + return None + + try: + data = { + 'id': 0, + 'jsonrpc': '2.0', + 'method': 'info_get_deploy', + 'params': [ txnid ] + } + casper_rpc_url = 'http://3.142.224.108:7777/rpc' + casper_response = requests.post(casper_rpc_url, json=data).json() + + result = casper_response['result'] + + if result: + transfer_args = result["deploy"]["session"]["Transfer"]["args"] + if ( + result["deploy"]["hash"] == txnid + and result["deploy"]["header"]["account"] == funderAddress + and float([ + arg for arg in transfer_args if arg[0] == 'amount' + ][0][1]['parsed']) == float(amount) * 10 ** 9 + ): + if result["execution_results"][0]["result"].get("Success", False) != False: + return 'success' + return 'expired' + + except Exception as e: + logger.error(f'error: get_casper_txn_status - {e}') + + return None + + +def sync_casper_payout(fulfillment): + if fulfillment.payout_tx_id: + txn_status = get_casper_txn_status(fulfillment) + + if txn_status == 'success': + fulfillment.payout_status = 'done' + fulfillment.accepted_on = timezone.now() + fulfillment.accepted = True + record_payout_activity(fulfillment) + elif txn_status == 'expired': + fulfillment.payout_status = 'expired' + + fulfillment.save() diff --git a/app/dashboard/sync/tezos.py b/app/dashboard/sync/tezos.py index 8eda1421be8..258c7a9bc93 100644 --- a/app/dashboard/sync/tezos.py +++ b/app/dashboard/sync/tezos.py @@ -56,10 +56,8 @@ def get_tezos_txn_status(fulfillment): and tx_response['sender']['address'] == funderAddress and tx_response['target']['address'] == payeeAddress and tx_response['amount'] == float(amount) * 10 ** 6 - and tx_response['status'] == 'applied' - and confirmations > 0 ): - if tx_response['status'] == 'applied': + if tx_response['status'] == 'applied' and confirmations > 0: return 'success' return 'expired' diff --git a/app/dashboard/templates/bounty/details2.html b/app/dashboard/templates/bounty/details2.html index bab4f7eb686..25f29030823 100644 --- a/app/dashboard/templates/bounty/details2.html +++ b/app/dashboard/templates/bounty/details2.html @@ -438,7 +438,7 @@
{% trans "SUBMISSIONS" %}
-
+

Payout

@@ -1163,6 +1163,11 @@

{{ noscript.keywords }}

+ {% elif web3_type == 'casper_ext' %} + + + + {% elif web3_type == 'fiat' %} {% if PYPL_CLIENT_ID %} diff --git a/app/dashboard/templates/bounty/new_bounty.html b/app/dashboard/templates/bounty/new_bounty.html index 3b7b89b040a..266149bcbb8 100644 --- a/app/dashboard/templates/bounty/new_bounty.html +++ b/app/dashboard/templates/bounty/new_bounty.html @@ -139,6 +139,10 @@

Fund Issue

Tezos + + diff --git a/app/dashboard/templates/dashboard/hackathon/new_bounty.html b/app/dashboard/templates/dashboard/hackathon/new_bounty.html index 0e09f894531..cff7fa94834 100644 --- a/app/dashboard/templates/dashboard/hackathon/new_bounty.html +++ b/app/dashboard/templates/dashboard/hackathon/new_bounty.html @@ -203,6 +203,10 @@

Fund Prize

Tezos + + diff --git a/app/dashboard/utils.py b/app/dashboard/utils.py index 03555265db3..ef740839344 100644 --- a/app/dashboard/utils.py +++ b/app/dashboard/utils.py @@ -39,6 +39,7 @@ from dashboard.sync.algorand import sync_algorand_payout from dashboard.sync.binance import sync_binance_payout from dashboard.sync.btc import sync_btc_payout +from dashboard.sync.casper import sync_casper_payout from dashboard.sync.celo import sync_celo_payout from dashboard.sync.etc import sync_etc_payout from dashboard.sync.eth import sync_eth_payout @@ -671,6 +672,9 @@ def sync_payout(fulfillment): elif fulfillment.payout_type == 'tezos_ext': sync_tezos_payout(fulfillment) + elif fulfillment.payout_type == 'casper_ext': + sync_casper_payout(fulfillment) + def get_bounty_id(issue_url, network): issue_url = normalize_url(issue_url) diff --git a/app/dashboard/views.py b/app/dashboard/views.py index deec8404d41..6afb69acabf 100644 --- a/app/dashboard/views.py +++ b/app/dashboard/views.py @@ -6295,7 +6295,7 @@ def fulfill_bounty_v1(request): if payout_type == 'fiat' and not fulfiller_identifier: response['message'] = 'error: missing fulfiller_identifier' return JsonResponse(response) - elif payout_type in ['qr', 'polkadot_ext', 'harmony_ext', 'binance_ext', 'rsk_ext', 'xinfin_ext', 'nervos_ext', 'algorand_ext', 'sia_ext', 'tezos_ext'] and not fulfiller_address: + elif payout_type in ['qr', 'polkadot_ext', 'harmony_ext', 'binance_ext', 'rsk_ext', 'xinfin_ext', 'nervos_ext', 'algorand_ext', 'sia_ext', 'tezos_ext', 'casper_ext'] and not fulfiller_address: response['message'] = 'error: missing fulfiller_address' return JsonResponse(response) @@ -6412,8 +6412,8 @@ def payout_bounty_v1(request, fulfillment_id): if not payout_type: response['message'] = 'error: missing parameter payout_type' return JsonResponse(response) - if payout_type not in ['fiat', 'qr', 'web3_modal', 'polkadot_ext', 'harmony_ext' , 'binance_ext', 'rsk_ext', 'xinfin_ext', 'nervos_ext', 'algorand_ext', 'sia_ext', 'tezos_ext', 'manual']: - response['message'] = 'error: parameter payout_type must be fiat / qr / web_modal / polkadot_ext / harmony_ext / binance_ext / rsk_ext / xinfin_ext / nervos_ext / algorand_ext / sia_ext / tezos_ext / manual' + if payout_type not in ['fiat', 'qr', 'web3_modal', 'polkadot_ext', 'harmony_ext' , 'binance_ext', 'rsk_ext', 'xinfin_ext', 'nervos_ext', 'algorand_ext', 'sia_ext', 'tezos_ext', 'casper_ext', 'manual']: + response['message'] = 'error: parameter payout_type must be fiat / qr / web_modal / polkadot_ext / harmony_ext / binance_ext / rsk_ext / xinfin_ext / nervos_ext / algorand_ext / sia_ext / tezos_ext / casper_ext / manual' return JsonResponse(response) if payout_type == 'manual' and not bounty.event: response['message'] = 'error: payout_type manual is eligible only for hackathons' @@ -6479,7 +6479,7 @@ def payout_bounty_v1(request, fulfillment_id): fulfillment.save() record_bounty_activity(bounty, user, 'worker_paid', None, fulfillment) - elif payout_type in ['qr', 'web3_modal', 'polkadot_ext', 'harmony_ext', 'binance_ext', 'rsk_ext', 'xinfin_ext', 'nervos_ext', 'algorand_ext', 'sia_ext', 'tezos_ext']: + elif payout_type in ['qr', 'web3_modal', 'polkadot_ext', 'harmony_ext', 'binance_ext', 'rsk_ext', 'xinfin_ext', 'nervos_ext', 'algorand_ext', 'sia_ext', 'tezos_ext', 'casper_ext']: fulfillment.payout_status = 'pending' fulfillment.save() sync_payout(fulfillment) @@ -6493,6 +6493,32 @@ def payout_bounty_v1(request, fulfillment_id): return JsonResponse(response) +@csrf_exempt +@require_POST +def reverse_proxy_rpc_v1(request, tenant): + ''' + Proxy payout transaction to external node to bypass CORS restriction on browser. + ''' + + if tenant.upper() == 'CASPER': + # casper + url = 'http://3.142.224.108:7777/rpc' + else: + return JsonResponse({'error': 'invalid tenant'}, status=400) + + data = json.loads(request.body) + + try: + response = requests.post(url, json=data).json() + + if response.get("error", False): + return JsonResponse({'error': response["error"]}, status=422) + except Exception: + return JsonResponse({'error': 'something went wrong!'}, status=422) + + return JsonResponse(response) + + @csrf_exempt @require_POST def close_bounty_v1(request, bounty_id):