@waves/node-api-js 1.2.5-beta.18 → 1.2.5-beta.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@
5
5
  * @author Feross Aboukhadijeh <http://feross.org>
6
6
  * @license MIT
7
7
  */
8
- var n=r(59),i=r(60),a=r(61);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return f(this,e)}return c(this,e,t,r)}function c(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=h(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(t,r),i=(e=o(e,n)).write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(u.isBuffer(t)){var r=0|p(t.length);return 0===(e=o(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?o(e,0):h(e,t);if("Buffer"===t.type&&a(t.data))return h(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function f(e,t){if(l(t),e=o(e,t<0?0:0|p(t)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function h(e,t){var r=t.length<0?0:0|p(t.length);e=o(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function p(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function d(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(e).length;default:if(n)return K(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.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 N(this,t,r);case"utf8":case"utf-8":return w(this,t,r);case"ascii":return B(this,t,r);case"latin1":case"binary":return _(this,t,r);case"base64":return I(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(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),r=+r,isNaN(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=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){var a,s=1,o=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;s=2,o/=2,u/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(a=r;a<o;a++)if(c(e,a)===c(t,-1===l?0:a-l)){if(-1===l&&(l=a),a-l+1===u)return l*s}else-1!==l&&(a-=a-l),l=-1}else for(r+u>o&&(r=o-u),a=r;a>=0;a--){for(var f=!0,h=0;h<u;h++)if(c(e,a+h)!==c(t,h)){f=!1;break}if(f)return a}return-1}function b(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var s=0;s<n;++s){var o=parseInt(t.substr(2*s,2),16);if(isNaN(o))return s;e[r+s]=o}return s}function E(e,t,r,n){return F(K(t,e.length-r),e,r,n)}function C(e,t,r,n){return F(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function S(e,t,r,n){return C(e,t,r,n)}function T(e,t,r,n){return F(j(t),e,r,n)}function A(e,t,r,n){return F(function(e,t){for(var r,n,i,a=[],s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,a.push(i),a.push(n);return a}(t,e.length-r),e,r,n)}function I(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function w(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var a,s,o,u,c=e[i],l=null,f=c>239?4:c>223?3:c>191?2:1;if(i+f<=r)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(a=e[i+1]))&&(u=(31&c)<<6|63&a)>127&&(l=u);break;case 3:a=e[i+1],s=e[i+2],128==(192&a)&&128==(192&s)&&(u=(15&c)<<12|(63&a)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:a=e[i+1],s=e[i+2],o=e[i+3],128==(192&a)&&128==(192&s)&&128==(192&o)&&(u=(15&c)<<18|(63&a)<<12|(63&s)<<6|63&o)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=4096));return r}(n)}t.Buffer=u,t.SlowBuffer=function(e){+e!=e&&(e=0);return u.alloc(+e)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=s(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,r){return c(null,e,t,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,r){return function(e,t,r,n){return l(t),t<=0?o(e,t):void 0!==r?"string"==typeof n?o(e,t).fill(r,n):o(e,t).fill(r):o(e,t)}(null,e,t,r)},u.allocUnsafe=function(e){return f(null,e)},u.allocUnsafeSlow=function(e){return f(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!a(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=u.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var s=e[r];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},u.byteLength=d,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?w(this,0,e):y.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},u.prototype.compare=function(e,t,r,n,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");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 a=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),o=Math.min(a,s),c=this.slice(n,i),l=e.slice(t,r),f=0;f<o;++f)if(c[f]!==l[f]){a=c[f],s=l[f];break}return a<s?-1:s<a?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)},u.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=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 a=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":return C(this,e,t,r);case"latin1":case"binary":return S(this,e,t,r);case"base64":return T(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function B(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function _(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function N(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",a=t;a<r;++a)i+=V(e[a]);return i}function R(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}function k(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function U(e,t,r,n,i,a){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function P(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-r,2);i<a;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function O(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-r,4);i<a;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function L(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,r,n,a){return a||L(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function M(e,t,r,n,a){return a||L(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=u.prototype;else{var i=t-e;r=new u(i,void 0);for(var a=0;a<i;++a)r[a]=this[a+e]}return r},u.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||k(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},u.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||k(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUInt8=function(e,t){return t||k(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||k(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||k(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||k(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||k(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||k(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||k(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},u.prototype.readInt8=function(e,t){return t||k(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||k(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||k(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return t||k(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||k(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||k(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||k(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||k(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||k(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||U(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,a=0;for(this[t]=255&e;++a<r&&(i*=256);)this[t+a]=e/i&255;return t+r},u.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||U(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):O(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):O(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);U(this,e,t,r,i-1,-i)}var a=0,s=1,o=0;for(this[t]=255&e;++a<r&&(s*=256);)e<0&&0===o&&0!==this[t+a-1]&&(o=1),this[t+a]=(e/s>>0)-o&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);U(this,e,t,r,i-1,-i)}var a=r-1,s=1,o=0;for(this[t+a]=255&e;--a>=0&&(s*=256);)e<0&&0===o&&0!==this[t+a+1]&&(o=1),this[t+a]=(e/s>>0)-o&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):O(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):O(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return M(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return M(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,a=n-r;if(this===e&&r<t&&t<n)for(i=a-1;i>=0;--i)e[i+t]=this[i+r];else if(a<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+a),t);return a},u.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),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var a;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a<r;++a)this[a]=e;else{var s=u.isBuffer(e)?e:K(new u(e,n).toString()),o=s.length;for(a=0;a<r-t;++a)this[a+t]=s[a%o]}return this};var x=/[^+\/0-9A-Za-z-_]/g;function V(e){return e<16?"0"+e.toString(16):e.toString(16)}function K(e,t){var r;t=t||1/0;for(var n=e.length,i=null,a=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.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;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function j(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(x,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}}).call(this,r(12))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return s},i=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(n(arguments[t]));return e};Object.defineProperty(t,"__esModule",{value:!0});var a=r(6);t.concat=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reduce((function(e,t){return Uint8Array.from(i(e,a._fromIn(t)))}),new Uint8Array(0))},t.split=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n=t.reduce((function(e,t){return{arr:e.arr.slice(t),r:i(e.r,[e.arr.slice(0,t)])}}),{arr:a._fromIn(e),r:[]}),s=n.r,o=n.arr;return i(s,[o])}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PUBLIC_KEY_LENGTH=32,t.PRIVATE_KEY_LENGTH=32,t.SIGNATURE_LENGTH=64,t.ADDRESS_LENGTH=26,t.MAIN_NET_CHAIN_ID=87,t.TEST_NET_CHAIN_ID=84},function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return s};t.__esModule=!0;var i=r(3);t.default=function(e,t){void 0===t&&(t=Object.create(null));var r=Object.keys(e).map((function(t){return[t,e[t]]})).map((function(e){var r=n(e,2),i=r[0],a=r[1];return[i,Object.prototype.hasOwnProperty.call(t,i)?t[i](a):a]})).filter((function(e){var t=n(e,2);t[0];return null!=t[1]})).map((function(e){var t=n(e,2),r=t[0],a=t[1];return i.toArray(a).map((function(e){return r+"="+e})).join("&")})).join("&");return r.length?"?"+r:""}},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<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return s},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0,t.broadcast=t.fetchStatus=t.fetchInfo=t.fetchUnconfirmedInfo=t.fetchTransactions=t.fetchUnconfirmed=t.fetchCalculateFee=t.fetchUnconfirmedSize=void 0;var s=r(31),o=r(30),u=a(r(2)),c=a(r(15)),l=r(3),f=a(r(50)),h=r(91);function p(e,t,r){return void 0===r&&(r=Object.create(null)),u.default({base:e,url:"/transactions/unconfirmed/info/"+t,options:r})}function d(e,t,r){return void 0===r&&(r=Object.create(null)),u.default({base:e,url:"/transactions/info/"+t,options:r}).then((function(e){return h.addStateUpdateField(e)}))}t.fetchUnconfirmedSize=function(e){return u.default({base:e,url:"/transactions/unconfirmed/size"})},t.fetchCalculateFee=function(e,t,r){return void 0===r&&(r=Object.create(null)),u.default({base:e,url:"/transactions/calculateFee",options:l.deepAssign(n({},r),{method:"POST",body:f.default(t),headers:{"Content-Type":"application/json"}})})},t.fetchUnconfirmed=function(e,t){return void 0===t&&(t=Object.create(null)),u.default({base:e,url:"/transactions/unconfirmed",options:t})},t.fetchTransactions=function(e,t,r,n,a,s){return void 0===s&&(s=Object.create(null)),u.default({base:e,url:"/transactions/address/"+t+"/limit/"+r+c.default({after:n}),options:s}).then((function(e){var t=i(e,1)[0];return t.forEach((function(e){return h.addStateUpdateField(e)})),t}))},t.fetchUnconfirmedInfo=p,t.fetchInfo=d,t.fetchStatus=function(e,t){var r={id:"",confirmations:-1,height:-1,inUTX:!1,status:s.TRANSACTION_STATUSES.NOT_FOUND},a=t.map((function(t){return p(e,t).then((function(){return n(n({},r),{id:t,status:s.TRANSACTION_STATUSES.UNCONFIRMED,inUTX:!0})})).catch((function(){return d(e,t).then((function(e){return n(n({},r),{id:t,status:s.TRANSACTION_STATUSES.IN_BLOCKCHAIN,height:e.height,applicationStatus:e.applicationStatus})}))})).catch((function(){return n(n({},r),{id:t})}))}));return Promise.all([o.fetchHeight(e),Promise.all(a)]).then((function(e){var t=i(e,2),r=t[0].height,a=t[1];return{height:r,statuses:a.map((function(e){return n(n({},e),{confirmations:e.status===s.TRANSACTION_STATUSES.IN_BLOCKCHAIN?r-e.height:e.confirmations})}))}}))},t.broadcast=function(e,t,r){return void 0===r&&(r=Object.create(null)),u.default({base:e,url:"/transactions/broadcast",options:l.deepAssign(n({},r),{method:"POST",body:f.default(t),headers:{"Content-Type":"application/json"}})})}},function(e,t,r){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0});var i=r(33),a=r(36);t.seedWordsList=a.seedWordsList;var s=r(39);t.ChaidId=s.ChaidId;var o=r(38);t.Seed=o.Seed;var u=r(28);t.isPrivateKey=u.isPrivateKey,t.isPublicKey=u.isPublicKey;var c=r(33);t.crypto=c.crypto,function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(14)),t.signBytes=(n=i.crypto({output:"Base58"})).signBytes,t.keyPair=n.keyPair,t.publicKey=n.publicKey,t.privateKey=n.privateKey,t.address=n.address,t.buildAddress=n.buildAddress,t.blake2b=n.blake2b,t.keccak=n.keccak,t.sha256=n.sha256,t.sharedKey=n.sharedKey,t.seedWithNonce=n.seedWithNonce,t.base64Encode=n.base64Encode,t.base64Decode=n.base64Decode,t.base58Encode=n.base58Encode,t.base58Decode=n.base58Decode,t.base16Encode=n.base16Encode,t.base16Decode=n.base16Decode,t.stringToBytes=n.stringToBytes,t.bytesToString=n.bytesToString,t.random=n.random,t.randomSeed=n.randomSeed,t.randomBytes=n.randomBytes,t.verifySignature=n.verifySignature,t.verifyPublicKey=n.verifyPublicKey,t.verifyAddress=n.verifyAddress,t.messageDecrypt=n.messageDecrypt,t.messageEncrypt=n.messageEncrypt,t.aesDecrypt=n.aesDecrypt,t.aesEncrypt=n.aesEncrypt,t.encryptSeed=n.encryptSeed,t.decryptSeed=n.decryptSeed,t.rsaKeyPair=n.rsaKeyPair,t.rsaKeyPairSync=n.rsaKeyPairSync,t.rsaSign=n.rsaSign,t.rsaVerify=n.rsaVerify,t.merkleVerify=n.merkleVerify,t.split=n.split,t.concat=n.concat},function(e,t,r){"use strict";(function(e){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=n(r(7)),a=r(36),s=r(5),o=function(e){return s.stringToBytes(i.default.getBytesSync(e),"raw")};t.random=function(r,n){switch(n){case"Array8":return Array.from(o(r));case"Array16":return Array.from(t.random(r,"Uint16Array"));case"Array32":return Array.from(t.random(r,"Uint32Array"));case"Buffer":return function(){try{new e(1)}catch(e){throw new Error("Buffer not supported in this environment. Use Node.js or Browserify for browser support.")}}(),e.from(o(r));case"Uint8Array":return o(r);case"Uint16Array":return new Uint16Array(r).map((function(e){return o(2).reduce((function(e,t,r){return e|t<<8*(1-r)}),0)}));case"Uint32Array":return new Uint32Array(r).map((function(e){return o(4).reduce((function(e,t,r){return e|t<<8*(1-r)}),0)}));default:throw new Error(n+" is unsupported.")}},t.randomBytes=function(e){return t.random(e,"Uint8Array")},t.randomSeed=function(e){return void 0===e&&(e=15),t.random(e,"Array32").map((function(e){return a.seedWordsList[e%a.seedWordsList.length]})).join(" ")}}).call(this,r(11).Buffer)},function(e,t){var r,n,i=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(e){if(r===setTimeout)return setTimeout(e,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:a}catch(e){r=a}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var u,c=[],l=!1,f=-1;function h(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&p())}function p(){if(!l){var e=o(h);l=!0;for(var t=c.length;t;){for(u=c,c=[];++f<t;)u&&u[f].run();f=-1,t=c.length}u=null,l=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function y(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new d(e,t)),1!==c.length||l||o(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=y,i.addListener=y,i.once=y,i.off=y,i.removeListener=y,i.removeAllListeners=y,i.emit=y,i.prependListener=y,i.prependOnceListener=y,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(1),a=n(r(66)),s=r(6),o=r(5);t.base64Decode=function(e){return o.stringToBytes(i.decode64(e),"raw")},t.base64Encode=function(e){return i.encode64(o.bytesToString(s._fromIn(e),"raw"))},t.base58Decode=function(e){return a.default.decode(e)},t.base58Encode=function(e){return a.default.encode(s._fromIn(e))},t.base16Decode=function(e){return o.stringToBytes(i.hexToBytes(e),"raw")},t.base16Encode=function(e){return i.bytesToHex(o.bytesToString(s._fromIn(e),"raw"))}},function(e,t,r){"use strict";t.__esModule=!0;var n=Object.create(null),i=function(e){var t,r=new Float64Array(16);if(e)for(t=0;t<e.length;t++)r[t]=e[t];return r},a=(new Uint8Array(16),new Uint8Array(32));a[0]=9;var s=i(),o=i([1]),u=i([56129,1]),c=i([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),l=i([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),f=i([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),h=i([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),p=i([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function d(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}function y(e,t,r,n){return function(e,t,r,n,i){var a,s=0;for(a=0;a<i;a++)s|=e[t+a]^r[n+a];return(1&s-1>>>8)-1}(e,t,r,n,32)}function g(e,t){for(var r=0;r<16;r++)e[r]=0|t[r]}function m(e){var t,r,n=1;for(t=0;t<16;t++)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function v(e,t,r){for(var n,i=~(r-1),a=0;a<16;a++)n=i&(e[a]^t[a]),e[a]^=n,t[a]^=n}function b(e,t){var r,n,a,s=i(),o=i();for(r=0;r<16;r++)o[r]=t[r];for(m(o),m(o),m(o),n=0;n<2;n++){for(s[0]=o[0]-65517,r=1;r<15;r++)s[r]=o[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=o[15]-32767-(s[14]>>16&1),a=s[15]>>16&1,s[14]&=65535,v(o,s,1-a)}for(r=0;r<16;r++)e[2*r]=255&o[r],e[2*r+1]=o[r]>>8}function E(e,t){var r=new Uint8Array(32),n=new Uint8Array(32);return b(r,e),b(n,t),y(r,0,n,0)}function C(e){var t=new Uint8Array(32);return b(t,e),1&t[0]}function S(e,t){for(var r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function T(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]+r[n]}function A(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]-r[n]}function I(e,t,r){var n,i,a=0,s=0,o=0,u=0,c=0,l=0,f=0,h=0,p=0,d=0,y=0,g=0,m=0,v=0,b=0,E=0,C=0,S=0,T=0,A=0,I=0,w=0,B=0,_=0,N=0,R=0,k=0,U=0,P=0,O=0,L=0,D=r[0],M=r[1],x=r[2],V=r[3],K=r[4],j=r[5],F=r[6],q=r[7],z=r[8],G=r[9],H=r[10],Y=r[11],Q=r[12],W=r[13],X=r[14],J=r[15];a+=(n=t[0])*D,s+=n*M,o+=n*x,u+=n*V,c+=n*K,l+=n*j,f+=n*F,h+=n*q,p+=n*z,d+=n*G,y+=n*H,g+=n*Y,m+=n*Q,v+=n*W,b+=n*X,E+=n*J,s+=(n=t[1])*D,o+=n*M,u+=n*x,c+=n*V,l+=n*K,f+=n*j,h+=n*F,p+=n*q,d+=n*z,y+=n*G,g+=n*H,m+=n*Y,v+=n*Q,b+=n*W,E+=n*X,C+=n*J,o+=(n=t[2])*D,u+=n*M,c+=n*x,l+=n*V,f+=n*K,h+=n*j,p+=n*F,d+=n*q,y+=n*z,g+=n*G,m+=n*H,v+=n*Y,b+=n*Q,E+=n*W,C+=n*X,S+=n*J,u+=(n=t[3])*D,c+=n*M,l+=n*x,f+=n*V,h+=n*K,p+=n*j,d+=n*F,y+=n*q,g+=n*z,m+=n*G,v+=n*H,b+=n*Y,E+=n*Q,C+=n*W,S+=n*X,T+=n*J,c+=(n=t[4])*D,l+=n*M,f+=n*x,h+=n*V,p+=n*K,d+=n*j,y+=n*F,g+=n*q,m+=n*z,v+=n*G,b+=n*H,E+=n*Y,C+=n*Q,S+=n*W,T+=n*X,A+=n*J,l+=(n=t[5])*D,f+=n*M,h+=n*x,p+=n*V,d+=n*K,y+=n*j,g+=n*F,m+=n*q,v+=n*z,b+=n*G,E+=n*H,C+=n*Y,S+=n*Q,T+=n*W,A+=n*X,I+=n*J,f+=(n=t[6])*D,h+=n*M,p+=n*x,d+=n*V,y+=n*K,g+=n*j,m+=n*F,v+=n*q,b+=n*z,E+=n*G,C+=n*H,S+=n*Y,T+=n*Q,A+=n*W,I+=n*X,w+=n*J,h+=(n=t[7])*D,p+=n*M,d+=n*x,y+=n*V,g+=n*K,m+=n*j,v+=n*F,b+=n*q,E+=n*z,C+=n*G,S+=n*H,T+=n*Y,A+=n*Q,I+=n*W,w+=n*X,B+=n*J,p+=(n=t[8])*D,d+=n*M,y+=n*x,g+=n*V,m+=n*K,v+=n*j,b+=n*F,E+=n*q,C+=n*z,S+=n*G,T+=n*H,A+=n*Y,I+=n*Q,w+=n*W,B+=n*X,_+=n*J,d+=(n=t[9])*D,y+=n*M,g+=n*x,m+=n*V,v+=n*K,b+=n*j,E+=n*F,C+=n*q,S+=n*z,T+=n*G,A+=n*H,I+=n*Y,w+=n*Q,B+=n*W,_+=n*X,N+=n*J,y+=(n=t[10])*D,g+=n*M,m+=n*x,v+=n*V,b+=n*K,E+=n*j,C+=n*F,S+=n*q,T+=n*z,A+=n*G,I+=n*H,w+=n*Y,B+=n*Q,_+=n*W,N+=n*X,R+=n*J,g+=(n=t[11])*D,m+=n*M,v+=n*x,b+=n*V,E+=n*K,C+=n*j,S+=n*F,T+=n*q,A+=n*z,I+=n*G,w+=n*H,B+=n*Y,_+=n*Q,N+=n*W,R+=n*X,k+=n*J,m+=(n=t[12])*D,v+=n*M,b+=n*x,E+=n*V,C+=n*K,S+=n*j,T+=n*F,A+=n*q,I+=n*z,w+=n*G,B+=n*H,_+=n*Y,N+=n*Q,R+=n*W,k+=n*X,U+=n*J,v+=(n=t[13])*D,b+=n*M,E+=n*x,C+=n*V,S+=n*K,T+=n*j,A+=n*F,I+=n*q,w+=n*z,B+=n*G,_+=n*H,N+=n*Y,R+=n*Q,k+=n*W,U+=n*X,P+=n*J,b+=(n=t[14])*D,E+=n*M,C+=n*x,S+=n*V,T+=n*K,A+=n*j,I+=n*F,w+=n*q,B+=n*z,_+=n*G,N+=n*H,R+=n*Y,k+=n*Q,U+=n*W,P+=n*X,O+=n*J,E+=(n=t[15])*D,s+=38*(S+=n*x),o+=38*(T+=n*V),u+=38*(A+=n*K),c+=38*(I+=n*j),l+=38*(w+=n*F),f+=38*(B+=n*q),h+=38*(_+=n*z),p+=38*(N+=n*G),d+=38*(R+=n*H),y+=38*(k+=n*Y),g+=38*(U+=n*Q),m+=38*(P+=n*W),v+=38*(O+=n*X),b+=38*(L+=n*J),a=(n=(a+=38*(C+=n*M))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=o+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),E=(n=E+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=(a+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=o+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),E=(n=E+i+65535)-65536*(i=Math.floor(n/65536)),a+=i-1+37*(i-1),e[0]=a,e[1]=s,e[2]=o,e[3]=u,e[4]=c,e[5]=l,e[6]=f,e[7]=h,e[8]=p,e[9]=d,e[10]=y,e[11]=g,e[12]=m,e[13]=v,e[14]=b,e[15]=E}function w(e,t){I(e,t,t)}function B(e,t){var r,n=i();for(r=0;r<16;r++)n[r]=t[r];for(r=253;r>=0;r--)w(n,n),2!==r&&4!==r&&I(n,n,t);for(r=0;r<16;r++)e[r]=n[r]}function _(e,t,r){var n,a,s=new Uint8Array(32),o=new Float64Array(80),c=i(),l=i(),f=i(),h=i(),p=i(),d=i();for(a=0;a<31;a++)s[a]=t[a];for(s[31]=127&t[31]|64,s[0]&=248,S(o,r),a=0;a<16;a++)l[a]=o[a],h[a]=c[a]=f[a]=0;for(c[0]=h[0]=1,a=254;a>=0;--a)v(c,l,n=s[a>>>3]>>>(7&a)&1),v(f,h,n),T(p,c,f),A(c,c,f),T(f,l,h),A(l,l,h),w(h,p),w(d,c),I(c,f,c),I(f,l,p),T(p,c,f),A(c,c,f),w(l,c),A(f,h,d),I(c,f,u),T(c,c,h),I(f,f,c),I(c,h,d),I(h,l,o),w(l,p),v(c,l,n),v(f,h,n);for(a=0;a<16;a++)o[a+16]=c[a],o[a+32]=f[a],o[a+48]=l[a],o[a+64]=h[a];var y=o.subarray(32),g=o.subarray(16);return B(y,y),I(g,g,y),b(e,g),0}var N=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function R(e,t,r,n){for(var i,a,s,o,u,c,l,f,h,p,d,y,g,m,v,b,E,C,S,T,A,I,w,B,_,R,k=new Int32Array(16),U=new Int32Array(16),P=e[0],O=e[1],L=e[2],D=e[3],M=e[4],x=e[5],V=e[6],K=e[7],j=t[0],F=t[1],q=t[2],z=t[3],G=t[4],H=t[5],Y=t[6],Q=t[7],W=0;n>=128;){for(S=0;S<16;S++)T=8*S+W,k[S]=r[T+0]<<24|r[T+1]<<16|r[T+2]<<8|r[T+3],U[S]=r[T+4]<<24|r[T+5]<<16|r[T+6]<<8|r[T+7];for(S=0;S<80;S++)if(i=P,a=O,s=L,o=D,u=M,c=x,l=V,K,h=j,p=F,d=q,y=z,g=G,m=H,v=Y,Q,w=65535&(I=Q),B=I>>>16,_=65535&(A=K),R=A>>>16,w+=65535&(I=(G>>>14|M<<18)^(G>>>18|M<<14)^(M>>>9|G<<23)),B+=I>>>16,_+=65535&(A=(M>>>14|G<<18)^(M>>>18|G<<14)^(G>>>9|M<<23)),R+=A>>>16,w+=65535&(I=G&H^~G&Y),B+=I>>>16,_+=65535&(A=M&x^~M&V),R+=A>>>16,w+=65535&(I=N[2*S+1]),B+=I>>>16,_+=65535&(A=N[2*S]),R+=A>>>16,A=k[S%16],B+=(I=U[S%16])>>>16,_+=65535&A,R+=A>>>16,_+=(B+=(w+=65535&I)>>>16)>>>16,w=65535&(I=C=65535&w|B<<16),B=I>>>16,_=65535&(A=E=65535&_|(R+=_>>>16)<<16),R=A>>>16,w+=65535&(I=(j>>>28|P<<4)^(P>>>2|j<<30)^(P>>>7|j<<25)),B+=I>>>16,_+=65535&(A=(P>>>28|j<<4)^(j>>>2|P<<30)^(j>>>7|P<<25)),R+=A>>>16,B+=(I=j&F^j&q^F&q)>>>16,_+=65535&(A=P&O^P&L^O&L),R+=A>>>16,f=65535&(_+=(B+=(w+=65535&I)>>>16)>>>16)|(R+=_>>>16)<<16,b=65535&w|B<<16,w=65535&(I=y),B=I>>>16,_=65535&(A=o),R=A>>>16,B+=(I=C)>>>16,_+=65535&(A=E),R+=A>>>16,O=i,L=a,D=s,M=o=65535&(_+=(B+=(w+=65535&I)>>>16)>>>16)|(R+=_>>>16)<<16,x=u,V=c,K=l,P=f,F=h,q=p,z=d,G=y=65535&w|B<<16,H=g,Y=m,Q=v,j=b,S%16==15)for(T=0;T<16;T++)A=k[T],w=65535&(I=U[T]),B=I>>>16,_=65535&A,R=A>>>16,A=k[(T+9)%16],w+=65535&(I=U[(T+9)%16]),B+=I>>>16,_+=65535&A,R+=A>>>16,E=k[(T+1)%16],w+=65535&(I=((C=U[(T+1)%16])>>>1|E<<31)^(C>>>8|E<<24)^(C>>>7|E<<25)),B+=I>>>16,_+=65535&(A=(E>>>1|C<<31)^(E>>>8|C<<24)^E>>>7),R+=A>>>16,E=k[(T+14)%16],B+=(I=((C=U[(T+14)%16])>>>19|E<<13)^(E>>>29|C<<3)^(C>>>6|E<<26))>>>16,_+=65535&(A=(E>>>19|C<<13)^(C>>>29|E<<3)^E>>>6),R+=A>>>16,R+=(_+=(B+=(w+=65535&I)>>>16)>>>16)>>>16,k[T]=65535&_|R<<16,U[T]=65535&w|B<<16;w=65535&(I=j),B=I>>>16,_=65535&(A=P),R=A>>>16,A=e[0],B+=(I=t[0])>>>16,_+=65535&A,R+=A>>>16,R+=(_+=(B+=(w+=65535&I)>>>16)>>>16)>>>16,e[0]=P=65535&_|R<<16,t[0]=j=65535&w|B<<16,w=65535&(I=F),B=I>>>16,_=65535&(A=O),R=A>>>16,A=e[1],B+=(I=t[1])>>>16,_+=65535&A,R+=A>>>16,R+=(_+=(B+=(w+=65535&I)>>>16)>>>16)>>>16,e[1]=O=65535&_|R<<16,t[1]=F=65535&w|B<<16,w=65535&(I=q),B=I>>>16,_=65535&(A=L),R=A>>>16,A=e[2],B+=(I=t[2])>>>16,_+=65535&A,R+=A>>>16,R+=(_+=(B+=(w+=65535&I)>>>16)>>>16)>>>16,e[2]=L=65535&_|R<<16,t[2]=q=65535&w|B<<16,w=65535&(I=z),B=I>>>16,_=65535&(A=D),R=A>>>16,A=e[3],B+=(I=t[3])>>>16,_+=65535&A,R+=A>>>16,R+=(_+=(B+=(w+=65535&I)>>>16)>>>16)>>>16,e[3]=D=65535&_|R<<16,t[3]=z=65535&w|B<<16,w=65535&(I=G),B=I>>>16,_=65535&(A=M),R=A>>>16,A=e[4],B+=(I=t[4])>>>16,_+=65535&A,R+=A>>>16,R+=(_+=(B+=(w+=65535&I)>>>16)>>>16)>>>16,e[4]=M=65535&_|R<<16,t[4]=G=65535&w|B<<16,w=65535&(I=H),B=I>>>16,_=65535&(A=x),R=A>>>16,A=e[5],B+=(I=t[5])>>>16,_+=65535&A,R+=A>>>16,R+=(_+=(B+=(w+=65535&I)>>>16)>>>16)>>>16,e[5]=x=65535&_|R<<16,t[5]=H=65535&w|B<<16,w=65535&(I=Y),B=I>>>16,_=65535&(A=V),R=A>>>16,A=e[6],B+=(I=t[6])>>>16,_+=65535&A,R+=A>>>16,R+=(_+=(B+=(w+=65535&I)>>>16)>>>16)>>>16,e[6]=V=65535&_|R<<16,t[6]=Y=65535&w|B<<16,w=65535&(I=Q),B=I>>>16,_=65535&(A=K),R=A>>>16,A=e[7],B+=(I=t[7])>>>16,_+=65535&A,R+=A>>>16,R+=(_+=(B+=(w+=65535&I)>>>16)>>>16)>>>16,e[7]=K=65535&_|R<<16,t[7]=Q=65535&w|B<<16,W+=128,n-=128}return n}function k(e,t,r){var n,i=new Int32Array(8),a=new Int32Array(8),s=new Uint8Array(256),o=r;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[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,R(i,a,t,r),r%=128,n=0;n<r;n++)s[n]=t[o-r+n];for(s[r]=128,s[(r=256-128*(r<112?1:0))-9]=0,d(s,r-8,o/536870912|0,o<<3),R(i,a,s,r),n=0;n<8;n++)d(e,8*n,i[n],a[n]);return 0}function U(e,t){var r=i(),n=i(),a=i(),s=i(),o=i(),u=i(),c=i(),f=i(),h=i();A(r,e[1],e[0]),A(h,t[1],t[0]),I(r,r,h),T(n,e[0],e[1]),T(h,t[0],t[1]),I(n,n,h),I(a,e[3],t[3]),I(a,a,l),I(s,e[2],t[2]),T(s,s,s),A(o,n,r),A(u,s,a),T(c,s,a),T(f,n,r),I(e[0],o,u),I(e[1],f,c),I(e[2],c,u),I(e[3],o,f)}function P(e,t,r){for(var n=0;n<4;n++)v(e[n],t[n],r)}function O(e,t){var r=i(),n=i(),a=i();B(a,t[2]),I(r,t[0],a),I(n,t[1],a),b(e,n),e[31]^=C(r)<<7}function L(e,t,r){var n,i;for(g(e[0],s),g(e[1],o),g(e[2],o),g(e[3],s),i=255;i>=0;--i)P(e,t,n=r[i/8|0]>>(7&i)&1),U(t,e),U(e,e),P(e,t,n)}function D(e,t){var r=[i(),i(),i(),i()];g(r[0],f),g(r[1],h),g(r[2],o),I(r[3],f,h),L(e,r,t)}var M=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function x(e,t){var r,n,i,a;for(n=63;n>=32;--n){for(r=0,i=n-32,a=n-12;i<a;++i)t[i]+=r-16*t[n]*M[i-(n-32)],r=t[i]+128>>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 V(e){var t,r=new Float64Array(64);for(t=0;t<64;t++)r[t]=e[t];for(t=0;t<64;t++)e[t]=0;x(e,r)}function K(e,t,r,n,a){for(var s=new Uint8Array(64),o=[i(),i(),i(),i()],u=0;u<32;u++)s[u]=n[u];s[0]&=248,s[31]&=127,s[31]|=64,D(o,s),O(s.subarray(32),o);var c,l=128&s[63];return c=a?function(e,t,r,n,a){new Uint8Array(64);var s,o,u=new Uint8Array(64),c=new Uint8Array(64),l=new Float64Array(64),f=[i(),i(),i(),i()];for(e[0]=254,s=1;s<32;s++)e[s]=255;for(s=0;s<32;s++)e[32+s]=n[s];for(s=0;s<r;s++)e[64+s]=t[s];for(s=0;s<64;s++)e[r+64+s]=a[s];for(k(c,e,r+128),V(c),D(f,c),O(e,f),s=0;s<32;s++)e[s+32]=n[32+s];for(k(u,e,r+64),V(u),s=0;s<64;s++)e[r+64+s]=0;for(s=0;s<64;s++)l[s]=0;for(s=0;s<32;s++)l[s]=c[s];for(s=0;s<32;s++)for(o=0;o<32;o++)l[s+o]+=u[s]*n[o];return x(e.subarray(32,r+64),l),r+64}(e,t,r,s,a):function(e,t,r,n){new Uint8Array(64);var a,s,o=new Uint8Array(64),u=new Uint8Array(64),c=new Float64Array(64),l=[i(),i(),i(),i()];for(a=0;a<r;a++)e[64+a]=t[a];for(a=0;a<32;a++)e[32+a]=n[a];for(k(u,e.subarray(32),r+32),V(u),D(l,u),O(e,l),a=0;a<32;a++)e[a+32]=n[32+a];for(k(o,e,r+64),V(o),a=0;a<64;a++)c[a]=0;for(a=0;a<32;a++)c[a]=u[a];for(a=0;a<32;a++)for(s=0;s<32;s++)c[a+s]+=o[a]*n[s];return x(e.subarray(32),c),r+64}(e,t,r,s),e[63]|=l,c}function j(e,t){var r=i(),n=i(),a=i(),u=i(),l=i(),f=i(),h=i();return g(e[2],o),S(e[1],t),w(a,e[1]),I(u,a,c),A(a,a,e[2]),T(u,e[2],u),w(l,u),w(f,l),I(h,f,l),I(r,h,a),I(r,r,u),function(e,t){var r,n=i();for(r=0;r<16;r++)n[r]=t[r];for(r=250;r>=0;r--)w(n,n),1!==r&&I(n,n,t);for(r=0;r<16;r++)e[r]=n[r]}(r,r),I(r,r,a),I(r,r,u),I(r,r,u),I(e[0],r,u),w(n,e[0]),I(n,n,u),E(n,a)&&I(e[0],e[0],p),w(n,e[0]),I(n,n,u),E(n,a)?-1:(C(e[0])===t[31]>>7&&A(e[0],s,e[0]),I(e[3],e[0],e[1]),0)}function F(e,t,r,n){var a=function(e){var t=new Uint8Array(32),r=i(),n=i(),a=i();return S(r,e),T(n,r,o),A(a,r,o),B(n,n),I(n,n,a),b(t,n),t}(n);return a[31]|=128&t[63],t[63]&=127,function(e,t,r,n){var a,s=new Uint8Array(32),o=new Uint8Array(64),u=[i(),i(),i(),i()],c=[i(),i(),i(),i()];if(-1,r<64)return-1;if(j(c,n))return-1;for(a=0;a<r;a++)e[a]=t[a];for(a=0;a<32;a++)e[a+32]=n[a];if(k(o,e,r),V(o),L(u,c,o),D(c,t.subarray(32)),U(u,c),O(s,u),r-=64,y(t,0,s,0)){for(a=0;a<r;a++)e[a]=0;return-1}for(a=0;a<r;a++)e[a]=t[a+64];return r}(e,t,r,a)}function q(){for(var e,t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];for(t=0;t<arguments.length;t++)if("[object Uint8Array]"!==(e=Object.prototype.toString.call(arguments[t])))throw new TypeError("unexpected type "+e+", use Uint8Array")}n.sharedKey=function(e,t){if(q(t,e),32!==t.length)throw new Error("wrong public key length");if(32!==e.length)throw new Error("wrong secret key length");var r=new Uint8Array(32);return _(r,e,t),r},n.signMessage=function(e,t,r){if(q(t,e),32!==e.length)throw new Error("wrong secret key length");if(r){if(q(r),64!==r.length)throw new Error("wrong random data length");var n=new Uint8Array(128+t.length);return K(n,t,t.length,e,r),new Uint8Array(n.subarray(0,64+t.length))}var i=new Uint8Array(64+t.length);return K(i,t,t.length,e),i},n.openMessage=function(e,t){if(q(t,e),32!==e.length)throw new Error("wrong public key length");var r=new Uint8Array(t.length),n=F(r,t,t.length,e);if(n<0)return null;for(var i=new Uint8Array(n),a=0;a<i.length;a++)i[a]=r[a];return i},n.sign=function(e,t,r){if(q(e,t),32!==e.length)throw new Error("wrong secret key length");if(r&&(q(r),64!==r.length))throw new Error("wrong random data length");var n=new Uint8Array((r?128:64)+t.length);K(n,t,t.length,e,r);for(var i=new Uint8Array(64),a=0;a<i.length;a++)i[a]=n[a];return i},n.verify=function(e,t,r){if(q(t,r,e),64!==r.length)throw new Error("wrong signature length");if(32!==e.length)throw new Error("wrong public key length");var n,i=new Uint8Array(64+t.length),a=new Uint8Array(64+t.length);for(n=0;n<64;n++)i[n]=r[n];for(n=0;n<t.length;n++)i[n+64]=t[n];return F(a,i,i.length,e)>=0},n.generateKeyPair=function(e){if(q(e),32!==e.length)throw new Error("wrong seed length");for(var t=new Uint8Array(32),r=new Uint8Array(32),n=0;n<32;n++)t[n]=e[n];return _(r,t,a),t[0]&=248,t[31]&=127,t[31]|=64,r[31]&=127,{public:r,private:t}},t.default=n},function(e,t,r){var n=r(0);if(r(9),r(43),r(10),r(75),r(76),r(7),r(1),void 0===i)var i=n.jsbn.BigInteger;var a=n.util.isNodejs?r(25):null,s=n.asn1,o=n.util;n.pki=n.pki||{},e.exports=n.pki.rsa=n.rsa=n.rsa||{};var u=n.pki,c=[6,4,2,4,2,4,6,2],l={name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},f={name:"RSAPrivateKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},h={name:"RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},p=n.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},d=function(e){var t;if(!(e.algorithm in u.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=u.oids[e.algorithm];var n=s.oidToDer(t).getBytes(),i=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]),a=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]);a.value.push(s.create(s.Class.UNIVERSAL,s.Type.OID,!1,n)),a.value.push(s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,""));var o=s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(a),i.value.push(o),s.toDer(i).getBytes()},y=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var a;t.dP||(t.dP=t.d.mod(t.p.subtract(i.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(i.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{a=new i(n.util.bytesToHex(n.random.getBytes(t.n.bitLength()/8)),16)}while(a.compareTo(t.n)>=0||!a.gcd(t.n).equals(i.ONE));for(var s=(e=e.multiply(a.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),o=e.mod(t.q).modPow(t.dQ,t.q);s.compareTo(o)<0;)s=s.add(t.p);var u=s.subtract(o).multiply(t.qInv).mod(t.p).multiply(t.q).add(o);return u=u.multiply(a.modInverse(t.n)).mod(t.n)};function g(e,t,r){var i=n.util.createBuffer(),a=Math.ceil(t.n.bitLength()/8);if(e.length>a-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=a-11,s}i.putByte(0),i.putByte(r);var o,u=a-3-e.length;if(0===r||1===r){o=0===r?0:255;for(var c=0;c<u;++c)i.putByte(o)}else for(;u>0;){var l=0,f=n.random.getBytes(u);for(c=0;c<u;++c)0===(o=f.charCodeAt(c))?++l:i.putByte(o);u=l}return i.putByte(0),i.putBytes(e),i}function m(e,t,r,i){var a=Math.ceil(t.n.bitLength()/8),s=n.util.createBuffer(e),o=s.getByte(),u=s.getByte();if(0!==o||r&&0!==u&&1!==u||!r&&2!=u||r&&0===u&&void 0===i)throw new Error("Encryption block is invalid.");var c=0;if(0===u){c=a-3-i;for(var l=0;l<c;++l)if(0!==s.getByte())throw new Error("Encryption block is invalid.")}else if(1===u)for(c=0;s.length()>1;){if(255!==s.getByte()){--s.read;break}++c}else if(2===u)for(c=0;s.length()>1;){if(0===s.getByte()){--s.read;break}++c}if(0!==s.getByte()||c!==a-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function v(e,t,r){"function"==typeof t&&(r=t,t={});var a={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function s(){o(e.pBits,(function(t,n){return t?r(t):(e.p=n,null!==e.q?c(t,e.q):void o(e.qBits,c))}))}function o(e,t){n.prime.generateProbablePrime(e,a,t)}function c(t,n){if(t)return r(t);if(e.q=n,e.p.compareTo(e.q)<0){var a=e.p;e.p=e.q,e.q=a}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.p=null,void s();if(0!==e.q.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.q=null,void o(e.qBits,c);if(e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(i.ONE))return e.p=e.q=null,void s();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void o(e.qBits,c);var l=e.e.modInverse(e.phi);e.keys={privateKey:u.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:u.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"prng"in t&&(a.prng=t.prng),s()}function b(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=n.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function E(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function C(e){return n.util.isNodejs&&"function"==typeof a[e]}function S(e){return void 0!==o.globalScope&&"object"==typeof o.globalScope.crypto&&"object"==typeof o.globalScope.crypto.subtle&&"function"==typeof o.globalScope.crypto.subtle[e]}function T(e){return void 0!==o.globalScope&&"object"==typeof o.globalScope.msCrypto&&"object"==typeof o.globalScope.msCrypto.subtle&&"function"==typeof o.globalScope.msCrypto.subtle[e]}function A(e){for(var t=n.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),i=0;i<t.length;++i)r[i]=t.charCodeAt(i);return r}u.rsa.encrypt=function(e,t,r){var a,s=r,o=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(s=2===r,a=g(e,t,r)):(a=n.util.createBuffer()).putBytes(e);for(var u=new i(a.toHex(),16),c=y(u,t,s).toString(16),l=n.util.createBuffer(),f=o-Math.ceil(c.length/2);f>0;)l.putByte(0),--f;return l.putBytes(n.util.hexToBytes(c)),l.getBytes()},u.rsa.decrypt=function(e,t,r,a){var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var o=new Error("Encrypted message length is invalid.");throw o.length=e.length,o.expected=s,o}var u=new i(n.util.createBuffer(e).toHex(),16);if(u.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var c=y(u,t,r).toString(16),l=n.util.createBuffer(),f=s-Math.ceil(c.length/2);f>0;)l.putByte(0),--f;return l.putBytes(n.util.hexToBytes(c)),!1!==a?m(l.getBytes(),t,r):l.getBytes()},u.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048;var a,s=(r=r||{}).prng||n.random,o={nextBytes:function(e){for(var t=s.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},u=r.algorithm||"PRIMEINC";if("PRIMEINC"!==u)throw new Error("Invalid key generation algorithm: "+u);return(a={algorithm:u,state:0,bits:e,rng:o,eInt:t||65537,e:new i(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(a.eInt),a},u.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new i(null);r.fromInt(30);for(var n,a=0,s=function(e,t){return e|t},o=+new Date,l=0;null===e.keys&&(t<=0||l<t);){if(0===e.state){var f=null===e.p?e.pBits:e.qBits,h=f-1;0===e.pqState?(e.num=new i(f,e.rng),e.num.testBit(h)||e.num.bitwiseTo(i.ONE.shiftLeft(h),s,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),a=0,++e.pqState):1===e.pqState?e.num.bitLength()>f?e.pqState=0:e.num.isProbablePrime(E(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(c[a++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(i.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var p=e.e.modInverse(e.phi);e.keys={privateKey:u.rsa.setPrivateKey(e.n,e.e,p,e.p,e.q,p.mod(e.p1),p.mod(e.q1),e.q.modInverse(e.p)),publicKey:u.rsa.setPublicKey(e.n,e.e)}}l+=(n=+new Date)-o,o=n}return null!==e.keys},u.rsa.generateKeyPair=function(e,t,r,i){if(1===arguments.length?"object"==typeof e?(r=e,e=void 0):"function"==typeof e&&(i=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(i=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,i=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(i=r,r=void 0):(i=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!n.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(i){if(C("generateKeyPair"))return a.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,r){if(e)return i(e);i(null,{privateKey:u.privateKeyFromPem(r),publicKey:u.publicKeyFromPem(t)})}));if(S("generateKey")&&S("exportKey"))return o.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:A(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return o.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)})).then(void 0,(function(e){i(e)})).then((function(e){if(e){var t=u.privateKeyFromAsn1(s.fromDer(n.util.createBuffer(e)));i(null,{privateKey:t,publicKey:u.setRsaPublicKey(t.n,t.e)})}}));if(T("generateKey")&&T("exportKey")){var c=o.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:A(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return c.oncomplete=function(e){var t=e.target.result,r=o.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=u.privateKeyFromAsn1(s.fromDer(n.util.createBuffer(t)));i(null,{privateKey:r,publicKey:u.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){i(e)}},void(c.onerror=function(e){i(e)})}}else if(C("generateKeyPairSync")){var l=a.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:u.privateKeyFromPem(l.privateKey),publicKey:u.publicKeyFromPem(l.publicKey)}}var f=u.rsa.createKeyPairGenerationState(e,t,r);if(!i)return u.rsa.stepKeyPairGenerationState(f,0),f.keys;v(f,r,i)},u.setRsaPublicKey=u.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,i){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return g(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return n.pkcs1.encode_rsa_oaep(t,e,i)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var a=t.encode(e,r,!0);return u.rsa.encrypt(a,r,!0)},verify:function(e,t,n){"string"==typeof n?n=n.toUpperCase():void 0===n&&(n="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===n?n={verify:function(e,t){return t=m(t,r,!0),e===s.fromDer(t).value[1].value}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(e,t){return e===(t=m(t,r,!0))}});var i=u.rsa.decrypt(t,r,!0,!1);return n.verify(e,i,r.n.bitLength())}};return r},u.setRsaPrivateKey=u.rsa.setPrivateKey=function(e,t,r,i,a,s,o,c){var l={n:e,e:t,d:r,p:i,q:a,dP:s,dQ:o,qInv:c,decrypt:function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var i=u.rsa.decrypt(e,l,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:m};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return n.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(i,l,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:d},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,l.n.bitLength());return u.rsa.encrypt(n,l,r)}};return l},u.wrapRsaPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(u.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,s.toDer(e).getBytes())])},u.privateKeyFromAsn1=function(e){var t,r,a,o,c,h,p,d,y={},g=[];if(s.validate(e,l,y,g)&&(e=s.fromDer(n.util.createBuffer(y.privateKey))),y={},g=[],!s.validate(e,f,y,g)){var m=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw m.errors=g,m}return t=n.util.createBuffer(y.privateKeyModulus).toHex(),r=n.util.createBuffer(y.privateKeyPublicExponent).toHex(),a=n.util.createBuffer(y.privateKeyPrivateExponent).toHex(),o=n.util.createBuffer(y.privateKeyPrime1).toHex(),c=n.util.createBuffer(y.privateKeyPrime2).toHex(),h=n.util.createBuffer(y.privateKeyExponent1).toHex(),p=n.util.createBuffer(y.privateKeyExponent2).toHex(),d=n.util.createBuffer(y.privateKeyCoefficient).toHex(),u.setRsaPrivateKey(new i(t,16),new i(r,16),new i(a,16),new i(o,16),new i(c,16),new i(h,16),new i(p,16),new i(d,16))},u.privateKeyToAsn1=u.privateKeyToRSAPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.e)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.d)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.p)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.q)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.dP)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.dQ)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.qInv))])},u.publicKeyFromAsn1=function(e){var t={},r=[];if(s.validate(e,p,t,r)){var a,o=s.derToOid(t.publicKeyOid);if(o!==u.oids.rsaEncryption)throw(a=new Error("Cannot read public key. Unknown OID.")).oid=o,a;e=t.rsaPublicKey}if(r=[],!s.validate(e,h,t,r))throw(a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,a;var c=n.util.createBuffer(t.publicKeyModulus).toHex(),l=n.util.createBuffer(t.publicKeyExponent).toHex();return u.setRsaPublicKey(new i(c,16),new i(l,16))},u.publicKeyToAsn1=u.publicKeyToSubjectPublicKeyInfo=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(u.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.BITSTRING,!1,[u.publicKeyToRSAPublicKey(e)])])},u.publicKeyToRSAPublicKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.e))])}},function(e,t,r){var n=r(0);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.aes.Algorithm(e,t)}))}r(24),r(34),r(1),e.exports=n.aes=n.aes||{},n.aes.startEncrypting=function(e,t,r,n){var i=d({key:e,output:r,decrypt:!1,mode:n});return i.start(t),i},n.aes.createEncryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!1,mode:t})},n.aes.startDecrypting=function(e,t,r,n){var i=d({key:e,output:r,decrypt:!0,mode:n});return i.start(t),i},n.aes.createDecryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!0,mode:t})},n.aes.Algorithm=function(e,t){l||f();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return p(r._w,e,t,!1)},decrypt:function(e,t){return p(r._w,e,t,!0)}}}),r._init=!1},n.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(n.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=n.util.createBuffer();for(var i=0;i<t.length;++i)r.putByte(t[i])}}else r=n.util.createBuffer(r);if(!n.util.isArray(r)){t=r,r=[];var a=t.length();if(16===a||24===a||32===a){a>>>=2;for(i=0;i<a;++i)r.push(t.getInt32())}}if(!n.util.isArray(r)||4!==r.length&&6!==r.length&&8!==r.length)throw new Error("Invalid key parameter.");var s=this.mode.name,o=-1!==["CFB","OFB","CTR","GCM"].indexOf(s);this._w=h(r,e.decrypt&&!o),this._init=!0}},n.aes._expandKey=function(e,t){return l||f(),h(e,t)},n.aes._updateBlock=p,i("AES-ECB",n.cipher.modes.ecb),i("AES-CBC",n.cipher.modes.cbc),i("AES-CFB",n.cipher.modes.cfb),i("AES-OFB",n.cipher.modes.ofb),i("AES-CTR",n.cipher.modes.ctr),i("AES-GCM",n.cipher.modes.gcm);var a,s,o,u,c,l=!1;function f(){l=!0,o=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;a=new Array(256),s=new Array(256),u=new Array(4),c=new Array(4);for(t=0;t<4;++t)u[t]=new Array(256),c[t]=new Array(256);var r,n,i,f,h,p,d,y=0,g=0;for(t=0;t<256;++t){f=(f=g^g<<1^g<<2^g<<3^g<<4)>>8^255&f^99,a[y]=f,s[f]=y,p=(h=e[f])<<24^f<<16^f<<8^f^h,d=((r=e[y])^(n=e[r])^(i=e[n]))<<24^(y^i)<<16^(y^n^i)<<8^y^r^i;for(var m=0;m<4;++m)u[m][y]=p,c[m][f]=d,p=p<<24|p>>>8,d=d<<24|d>>>8;0===y?y=g=1:(y=r^e[e[e[r^i]]],g^=e[e[g]])}}function h(e,t){for(var r,n=e.slice(0),i=1,s=n.length,u=4*(s+6+1),l=s;l<u;++l)r=n[l-1],l%s==0?(r=a[r>>>16&255]<<24^a[r>>>8&255]<<16^a[255&r]<<8^a[r>>>24]^o[i]<<24,i++):s>6&&l%s==4&&(r=a[r>>>24]<<24^a[r>>>16&255]<<16^a[r>>>8&255]<<8^a[255&r]),n[l]=n[l-s]^r;if(t){for(var f,h=c[0],p=c[1],d=c[2],y=c[3],g=n.slice(0),m=(l=0,(u=n.length)-4);l<u;l+=4,m-=4)if(0===l||l===u-4)g[l]=n[m],g[l+1]=n[m+3],g[l+2]=n[m+2],g[l+3]=n[m+1];else for(var v=0;v<4;++v)f=n[m+v],g[l+(3&-v)]=h[a[f>>>24]]^p[a[f>>>16&255]]^d[a[f>>>8&255]]^y[a[255&f]];n=g}return n}function p(e,t,r,n){var i,o,l,f,h,p,d,y,g,m,v,b,E=e.length/4-1;n?(i=c[0],o=c[1],l=c[2],f=c[3],h=s):(i=u[0],o=u[1],l=u[2],f=u[3],h=a),p=t[0]^e[0],d=t[n?3:1]^e[1],y=t[2]^e[2],g=t[n?1:3]^e[3];for(var C=3,S=1;S<E;++S)m=i[p>>>24]^o[d>>>16&255]^l[y>>>8&255]^f[255&g]^e[++C],v=i[d>>>24]^o[y>>>16&255]^l[g>>>8&255]^f[255&p]^e[++C],b=i[y>>>24]^o[g>>>16&255]^l[p>>>8&255]^f[255&d]^e[++C],g=i[g>>>24]^o[p>>>16&255]^l[d>>>8&255]^f[255&y]^e[++C],p=m,d=v,y=b;r[0]=h[p>>>24]<<24^h[d>>>16&255]<<16^h[y>>>8&255]<<8^h[255&g]^e[++C],r[n?3:1]=h[d>>>24]<<24^h[y>>>16&255]<<16^h[g>>>8&255]<<8^h[255&p]^e[++C],r[2]=h[y>>>24]<<24^h[g>>>16&255]<<16^h[p>>>8&255]<<8^h[255&d]^e[++C],r[n?1:3]=h[g>>>24]<<24^h[p>>>16&255]<<16^h[d>>>8&255]<<8^h[255&y]^e[++C]}function d(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var a=null;r instanceof n.util.ByteBuffer&&(a=r,r={}),(r=r||{}).output=a,r.iv=e,i.call(t,r)},t}},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return(e=e.toUpperCase())in n.cipher.algorithms?n.cipher.algorithms[e]:null};var i=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};i.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},i.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},i.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t){},function(e,t,r){var n=r(0);r(4),r(1),(e.exports=n.hmac=n.hmac||{}).create=function(){var e=null,t=null,r=null,i=null,a={start:function(a,s){if(null!==a)if("string"==typeof a){if(!((a=a.toLowerCase())in n.md.algorithms))throw new Error('Unknown hash algorithm "'+a+'"');t=n.md.algorithms[a].create()}else t=a;if(null===s)s=e;else{if("string"==typeof s)s=n.util.createBuffer(s);else if(n.util.isArray(s)){var o=s;s=n.util.createBuffer();for(var u=0;u<o.length;++u)s.putByte(o[u])}var c=s.length();c>t.blockLength&&(t.start(),t.update(s.bytes()),s=t.digest()),r=n.util.createBuffer(),i=n.util.createBuffer(),c=s.length();for(u=0;u<c;++u){o=s.at(u);r.putByte(54^o),i.putByte(92^o)}if(c<t.blockLength)for(o=t.blockLength-c,u=0;u<o;++u)r.putByte(54),i.putByte(92);e=s,r=r.bytes(),i=i.bytes()}t.start(),t.update(r)},update:function(e){t.update(e)},getMac:function(){var e=t.digest().bytes();return t.start(),t.update(i),t.update(e),t.digest()}};return a.digest=a.getMac,a}},function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(14),a=r(38),s=r(8),o=r(6),u=r(13),c=r(28),l=n(r(21));t.seedWithNonce=function(e,t){return{seed:a.Seed.toBinary(e).seed,nonce:t}},t.buildAddress=function(e,t){void 0===t&&(t=i.MAIN_NET_CHAIN_ID);var r=[1,"string"==typeof t?t.charCodeAt(0):t],n=s._hashChain(e).slice(0,20),a=u.concat(r,n),o=s._hashChain(a).slice(0,4);return u.concat(a,o)};t.keyPair=function(e){var t=a.Seed.toBinary(e),r=function(e,t){var r=[0,0,0,0];if(t&&t>0)for(var n=t,i=3;i>=0;i--)r[3-i]=Math.floor(n/Math.pow(2,8*i)),n%=Math.pow(2,8*i);var a=u.concat(r,e),o=s._hashChain(a);return s.sha256(o)}(t.seed,t.nonce),n=l.default.generateKeyPair(r);return{privateKey:n.private,publicKey:n.public}},t.address=function(e,r){return void 0===r&&(r=i.MAIN_NET_CHAIN_ID),c.isPublicKey(e)?t.buildAddress(o._fromIn(e.publicKey),r):t.address(t.keyPair(e),r)},t.publicKey=function(e){return c.isPrivateKey(e)?l.default.generateKeyPair(o._fromIn(e.privateKey)).public:t.keyPair(e).publicKey},t.privateKey=function(e){return t.keyPair(e).privateKey}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isPublicKey=function(e){return void 0!==e.publicKey},t.isPrivateKey=function(e){return void 0!==e.privateKey}},function(e,t,r){var n=r(0);r(1);var i=e.exports=n.pem=n.pem||{};function a(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},i=0;i<e.values.length;++i)r.push(e.values[i].replace(/^(\S+\r\n)/,n));t+=r.join(",")+"\r\n";var a=0,s=-1;for(i=0;i<t.length;++i,++a)if(a>65&&-1!==s){var o=t[s];","===o?(++s,t=t.substr(0,s)+"\r\n "+t.substr(s)):t=t.substr(0,s)+"\r\n"+o+t.substr(s+1),a=i-s-1,s=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(s=i);return t}function s(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var r,i="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(i+=a(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(i+=a(r={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),i+=a(r)),e.headers)for(var s=0;s<e.headers.length;++s)i+=a(e.headers[s]);return e.procType&&(i+="\r\n"),i+=n.util.encode64(e.body,t.maxline||64)+"\r\n",i+="-----END "+e.type+"-----\r\n"},i.decode=function(e){for(var t,r=[],i=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,a=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,o=/\r?\n/;t=i.exec(e);){var u={type:t[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:n.util.decode64(t[3])};if(r.push(u),t[2]){for(var c=t[2].split(o),l=0;t&&l<c.length;){for(var f=c[l].replace(/\s+$/,""),h=l+1;h<c.length;++h){var p=c[h];if(!/\s/.test(p[0]))break;f+=p,l=h}if(t=f.match(a)){for(var d={name:t[1],values:[]},y=t[2].split(","),g=0;g<y.length;++g)d.values.push(s(y[g]));if(u.procType)if(u.contentDomain||"Content-Domain"!==d.name)if(u.dekInfo||"DEK-Info"!==d.name)u.headers.push(d);else{if(0===d.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');u.dekInfo={algorithm:y[0],parameters:y[1]||null}}else u.contentDomain=y[0]||"";else{if("Proc-Type"!==d.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==d.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');u.procType={version:y[0],type:y[1]}}}++l}if("ENCRYPTED"===u.procType&&!u.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===r.length)throw new Error("Invalid PEM formatted message.");return r}},function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0,t.fetchHeightByTimestamp=t.fetchHeight=t.fetchDelay=t.fetchLast=t.fetchBlocksByAddress=t.fetchFirst=t.fetchBlockById=t.fetchSeq=t.fetchBlockAt=t.fetchHeadersById=t.fetchHeadersAt=t.fetchHeightById=t.fetchHeadersLast=t.fetchHeadersSeq=void 0;var i=n(r(2));t.fetchHeadersSeq=function(e,t,r,n){return void 0===n&&(n=Object.create(null)),i.default({base:e,url:"/blocks/headers/seq/"+t+"/"+r,options:n})},t.fetchHeadersLast=function(e,t){return void 0===t&&(t=Object.create(null)),i.default({base:e,url:"/blocks/headers/last",options:t})},t.fetchHeightById=function(e,t){return i.default({base:e,url:"/blocks/height/"+t})},t.fetchHeadersAt=function(e,t,r){return void 0===r&&(r=Object.create(null)),i.default({base:e,url:"/blocks/headers/at/"+t,options:r})},t.fetchHeadersById=function(e,t,r){return void 0===r&&(r=Object.create(null)),i.default({base:e,url:"/blocks/headers/"+t,options:r})},t.fetchBlockAt=function(e,t,r){return void 0===r&&(r=Object.create(null)),i.default({base:e,url:"/blocks/at/"+t,options:r})},t.fetchSeq=function(e,t,r,n){return void 0===n&&(n=Object.create(null)),i.default({base:e,url:"/blocks/seq/"+t+"/"+r,options:n})},t.fetchBlockById=function(e,t,r){return void 0===r&&(r=Object.create(null)),i.default({base:e,url:"/blocks/"+t,options:r})},t.fetchFirst=function(e,t){return void 0===t&&(t=Object.create(null)),i.default({base:e,url:"/blocks/first",options:t})},t.fetchBlocksByAddress=function(e,t,r,n,a){return void 0===a&&(a=Object.create(null)),i.default({base:e,url:"/blocks/address/"+t+"/"+r+"/"+n,options:a})},t.fetchLast=function(e,t){return void 0===t&&(t=Object.create(null)),i.default({base:e,url:"/blocks/last",options:t})},t.fetchDelay=function(e,t,r){return i.default({base:e,url:"/blocks/delay/"+t+"/"+r})},t.fetchHeight=function(e){return i.default({base:e,url:"/blocks/height"})},t.fetchHeightByTimestamp=function(e,t,r){return void 0===r&&(r=Object.create(null)),i.default({base:e,url:"/blocks/heightByTimestamp/"+t,options:r})}},function(e,t,r){"use strict";t.__esModule=!0,t.TRANSACTION_STATUSES=t.NAME_MAP=t.TYPE_MAP=void 0,t.TYPE_MAP={3:"issue",4:"transfer",5:"reissue",6:"burn",7:"exchange",8:"lease",9:"cancelLease",10:"alias",11:"massTransfer",12:"data",13:"setScript",14:"sponsorship",15:"setAssetScript",16:"invoke",17:"updateAsset"},t.NAME_MAP={issue:3,transfer:4,reissue:5,burn:6,exchange:7,lease:8,cancelLease:9,alias:10,massTransfer:11,data:12,setScript:13,sponsorship:14,setAssetScript:15,invoke:16,updateAsset:17},t.TRANSACTION_STATUSES={IN_BLOCKCHAIN:"in_blockchain",UNCONFIRMED:"unconfirmed",NOT_FOUND:"not_found"}},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function s(e){try{u(n.next(e))}catch(e){a(e)}}function o(e){try{u(n.throw(e))}catch(e){a(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(s,o)}u((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,i,a,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(a){return function(o){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,o])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0,t.fetchBalanceAddressAssetId=t.fetchAssetsBalance=t.fetchAssetsNft=t.fetchAssetsAddressLimit=t.fetchAssetDistribution=t.fetchAssetsDetails=t.fetchDetails=void 0;var s=r(52),o=a(r(2)),u=r(3);function c(e,t,r){void 0===r&&(r=Object.create(null));var n=t.map((function(e){return"id="+e})).join("&"),i=t.length?"?"+n:"";return o.default({base:e,url:"/assets/details"+i,options:r})}t.fetchDetails=function(e,t,r){void 0===r&&(r=Object.create(null));var n=!Array.isArray(t);return Promise.all(u.toArray(t).map((function(t){return o.default({base:e,url:"/assets/details/"+t,options:r})}))).then((function(e){return n?e[0]:e}))},t.fetchAssetsDetails=c,t.fetchAssetDistribution=function(e,t,r,n,i){return void 0===i&&(i=Object.create(null)),o.default({base:e,url:"/assets/"+t+"/distribution/"+r+"/limit/"+n,options:i})},t.fetchAssetsAddressLimit=function(e,t,r,n){return void 0===n&&(n=Object.create(null)),o.default({base:e,url:"assets/nft/"+t+"/limit/"+r,options:n})},t.fetchAssetsNft=function(e,t,r){var n=t.address,i=t.limit,a=t.after;void 0===r&&(r=Object.create(null));var s=new URL("assets/nft/"+n+"/limit/"+i,e);return a&&s.searchParams.append("after",a),o.default({base:e,url:""+s.pathname+s.search,options:r})},t.fetchAssetsBalance=function(e,t,r){return void 0===r&&(r=Object.create(null)),n(this,void 0,void 0,(function(){var n,a;return i(this,(function(i){switch(i.label){case 0:return[4,o.default({base:e,url:"/assets/balance/"+t,options:r})];case 1:return n=i.sent(),a=n.balances.reduce((function(e,t,r){return t.issueTransaction||(e[t.assetId]=r),e}),{}),[4,c(e,Object.keys(a),r)];case 2:return i.sent().forEach((function(e){if(!("error"in e)){var t=a[e.assetId],r=n.balances[t];r&&(r.issueTransaction={id:e.originTransactionId,name:e.name,decimals:e.decimals,description:e.description,quantity:e.quantity,reissuable:e.reissuable,sender:e.issuer,senderPublicKey:e.issuerPublicKey,timestamp:e.issueTimestamp,height:e.issueHeight,script:e.scripted?"-":null,proofs:[],fee:Math.pow(10,8),feeAssetId:null,version:3,type:s.TRANSACTION_TYPE.ISSUE,chainId:0})}})),[2,n]}}))}))},t.fetchBalanceAddressAssetId=function(e,t,r,n){return void 0===n&&(n=Object.create(null)),o.default({base:e,url:"/assets/balance/"+t+"/"+r,options:n})}},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<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return s},a=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(i(arguments[t]));return e};Object.defineProperty(t,"__esModule",{value:!0});var s=r(18),o=r(37),u=r(20),c=r(5),l=r(13),f=r(8),h=r(27),p=r(70),d=r(71),y=r(72),g=r(83),m=r(84);t.crypto=function(e){if(e&&""==e.seed)throw new Error("Empty seed is not allowed.");var t,r=function(e,t){return function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return e.apply(void 0,a([t],r))}},i=function(t){return function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=t.apply(void 0,a(r));return!e||e&&"Base58"===e.output?u.base58Encode(i):i}},v=e&&e.seed?e.seed:void 0,b={seedWithNonce:v?r(h.seedWithNonce,v):h.seedWithNonce,signBytes:i(v?r(p.signBytes,v):p.signBytes),keyPair:(t=v?r(h.keyPair,v):h.keyPair,function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=t.apply(void 0,a(r));return!e||e&&"Base58"===e.output?{privateKey:u.base58Encode(i.privateKey),publicKey:u.base58Encode(i.publicKey)}:i}),publicKey:i(v?r(h.publicKey,v):h.publicKey),privateKey:i(v?r(h.privateKey,v):h.privateKey),address:i(v?r(h.address,v):h.address)};return n({},b,{sharedKey:i(o.sharedKey),buildAddress:h.buildAddress,blake2b:f.blake2b,keccak:f.keccak,sha256:f.sha256,base64Encode:u.base64Encode,base64Decode:u.base64Decode,base58Encode:u.base58Encode,base58Decode:u.base58Decode,base16Encode:u.base16Encode,base16Decode:u.base16Decode,stringToBytes:c.stringToBytes,bytesToString:c.bytesToString,random:s.random,randomSeed:s.randomSeed,randomBytes:s.randomBytes,verifySignature:d.verifySignature,verifyPublicKey:d.verifyPublicKey,verifyAddress:d.verifyAddress,messageDecrypt:o.messageDecrypt,messageEncrypt:o.messageEncrypt,aesDecrypt:o.aesDecrypt,aesEncrypt:o.aesEncrypt,encryptSeed:g.encryptSeed,decryptSeed:g.decryptSeed,rsaKeyPair:y.rsaKeyPair,rsaKeyPairSync:y.rsaKeyPairSync,rsaSign:y.rsaSign,rsaVerify:y.rsaVerify,merkleVerify:m.merkleVerify,split:l.split,concat:l.concat})}},function(e,t,r){var n=r(0);r(1),n.cipher=n.cipher||{};var i=e.exports=n.cipher.modes=n.cipher.modes||{};function a(e){if("string"==typeof e&&(e=n.util.createBuffer(e)),n.util.isArray(e)&&e.length>4){var t=e;e=n.util.createBuffer();for(var r=0;r<t.length;++r)e.putByte(t[r])}return n.util.isArray(e)||(e=[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()]),e}function s(e){e[e.length-1]=e[e.length-1]+1&4294967295}function o(e){return[e/4294967296|0,4294967295&e]}i.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.ecb.prototype.start=function(e){},i.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},i.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},i.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},i.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=a(e.iv),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]);this._prev=this._outBlock},i.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)},i.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},i.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=a(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32()^this._outBlock[i],t.putInt32(this._inBlock[i]);else{var a=(this.blockSize-n)%this.blockSize;a>0&&(a=this.blockSize-a),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32()^this._outBlock[i],this._partialOutput.putInt32(this._partialBlock[i]);if(a>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32(),t.putInt32(this._inBlock[i]^this._outBlock[i]);else{var a=(this.blockSize-n)%this.blockSize;a>0&&(a=this.blockSize-a),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[i]^this._outBlock[i]);if(a>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=a(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]),this._inBlock[i]=this._outBlock[i];else{var a=(this.blockSize-n)%this.blockSize;a>0&&(a=this.blockSize-a),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(a>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._outBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=a(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]);else{var a=(this.blockSize-n)%this.blockSize;a>0&&(a=this.blockSize-a),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(a>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}s(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=n.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?n.util.createBuffer(e.additionalData):n.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=n.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=r.length();if(12===i)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(o(8*i)))}this._inBlock=this._j0.slice(0),s(this._inBlock),this._partialBytes=0,t=n.util.createBuffer(t),this._aDataLength=o(8*t.length());var a=t.length()%this.blockSize;for(a&&t.fillWithByte(0,this.blockSize-a),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},i.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^=e.getInt32());this._cipherLength+=this.blockSize}else{var a=(this.blockSize-n)%this.blockSize;a>0&&(a=this.blockSize-a),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(a<=0||r){if(r){var o=n%this.blockSize;this._cipherLength+=o,this._partialOutput.truncate(this.blockSize-o)}else this._cipherLength+=this.blockSize;for(i=0;i<this._ints;++i)this._outBlock[i]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),s(this._inBlock)},i.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n<this.blockSize&&!(r&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),s(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^this._hashBlock[i]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize},i.gcm.prototype.afterFinish=function(e,t){var r=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=n.util.createBuffer();var i=this._aDataLength.concat(o(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,i);var a=[];this.cipher.encrypt(this._j0,a);for(var s=0;s<this._ints;++s)this.tag.putInt32(this._s[s]^a[s]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r},i.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],n=t.slice(0),i=0;i<128;++i){e[i/32|0]&1<<31-i%32&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n)}return r},i.gcm.prototype.pow=function(e,t){for(var r=1&e[3],n=3;n>0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},i.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=e[r/8|0]>>>4*(7-r%8)&15,i=this._m[r][n];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},i.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},i.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,i=16*r,a=new Array(i),s=0;s<i;++s){var o=[0,0,0,0],u=(n-1-s%n)*t;o[s/n|0]=1<<t-1<<u,a[s]=this.generateSubHashTable(this.multiply(o,e),t)}return a},i.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,n=r>>>1,i=new Array(r);i[n]=e.slice(0);for(var a=n>>>1;a>0;)this.pow(i[2*a],i[a]=[]),a>>=1;for(a=2;a<n;){for(var s=1;s<a;++s){var o=i[a],u=i[s];i[a+s]=[o[0]^u[0],o[1]^u[1],o[2]^u[2],o[3]^u[3]]}a*=2}for(i[0]=[0,0,0,0],a=n+1;a<r;++a){var c=i[a^n];i[a]=[e[0]^c[0],e[1]^c[1],e[2]^c[2],e[3]^c[3]]}return i}},function(e,t,r){var n=r(0);r(4),r(1);var i=e.exports=n.sha256=n.sha256||{};n.md.sha256=n.md.algorithms.sha256=i,i.create=function(){s||(a=String.fromCharCode(128),a+=n.util.fillString(String.fromCharCode(0),64),o=[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=!0);var e=null,t=n.util.createBuffer(),r=new Array(64),i={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,a=0;a<r;++a)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},i}};return i.start(),i.update=function(a,s){"utf8"===s&&(a=n.util.encodeUtf8(a));var o=a.length;i.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var c=i.fullMessageLength.length-1;c>=0;--c)i.fullMessageLength[c]+=o[1],o[1]=o[0]+(i.fullMessageLength[c]/4294967296>>>0),i.fullMessageLength[c]=i.fullMessageLength[c]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(a),u(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var o,c=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;s.putBytes(a.substr(0,i.blockLength-c));for(var l=8*i.fullMessageLength[0],f=0;f<i.fullMessageLength.length-1;++f)l+=(o=8*i.fullMessageLength[f+1])/4294967296>>>0,s.putInt32(l>>>0),l=o>>>0;s.putInt32(l);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};u(h,r,s);var p=n.util.createBuffer();return p.putInt32(h.h0),p.putInt32(h.h1),p.putInt32(h.h2),p.putInt32(h.h3),p.putInt32(h.h4),p.putInt32(h.h5),p.putInt32(h.h6),p.putInt32(h.h7),p},i};var a=null,s=!1,o=null;function u(e,t,r){for(var n,i,a,s,u,c,l,f,h,p,d,y,g,m=r.length();m>=64;){for(u=0;u<16;++u)t[u]=r.getInt32();for(;u<64;++u)n=((n=t[u-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=((i=t[u-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[u]=n+t[u-7]+i+t[u-16]|0;for(c=e.h0,l=e.h1,f=e.h2,h=e.h3,p=e.h4,d=e.h5,y=e.h6,g=e.h7,u=0;u<64;++u)a=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),s=c&l|f&(c^l),n=g+((p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(y^p&(d^y))+o[u]+t[u],g=y,y=d,d=p,p=h+n>>>0,h=f,f=l,l=c,c=n+(i=a+s)>>>0;e.h0=e.h0+c|0,e.h1=e.h1+l|0,e.h2=e.h2+f|0,e.h3=e.h3+h|0,e.h4=e.h4+p|0,e.h5=e.h5+d|0,e.h6=e.h6+y|0,e.h7=e.h7+g|0,m-=64}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.seedWordsList=["abandon","ability","able","about","above","absent","absorb","abstract","absurd","abuse","access","accident","account","accuse","achieve","acid","acoustic","acquire","across","act","action","actor","actress","actual","adapt","add","addict","address","adjust","admit","adult","advance","advice","aerobic","affair","afford","afraid","again","age","agent","agree","ahead","aim","air","airport","aisle","alarm","album","alcohol","alert","alien","all","alley","allow","almost","alone","alpha","already","also","alter","always","amateur","amazing","among","amount","amused","analyst","anchor","ancient","anger","angle","angry","animal","ankle","announce","annual","another","answer","antenna","antique","anxiety","any","apart","apology","appear","apple","approve","april","arch","arctic","area","arena","argue","arm","armed","armor","army","around","arrange","arrest","arrive","arrow","art","artefact","artist","artwork","ask","aspect","assault","asset","assist","assume","asthma","athlete","atom","attack","attend","attitude","attract","auction","audit","august","aunt","author","auto","autumn","average","avocado","avoid","awake","aware","away","awesome","awful","awkward","axis","baby","bachelor","bacon","badge","bag","balance","balcony","ball","bamboo","banana","banner","bar","barely","bargain","barrel","base","basic","basket","battle","beach","bean","beauty","because","become","beef","before","begin","behave","behind","believe","below","belt","bench","benefit","best","betray","better","between","beyond","bicycle","bid","bike","bind","biology","bird","birth","bitter","black","blade","blame","blanket","blast","bleak","bless","blind","blood","blossom","blouse","blue","blur","blush","board","boat","body","boil","bomb","bone","bonus","book","boost","border","boring","borrow","boss","bottom","bounce","box","boy","bracket","brain","brand","brass","brave","bread","breeze","brick","bridge","brief","bright","bring","brisk","broccoli","broken","bronze","broom","brother","brown","brush","bubble","buddy","budget","buffalo","build","bulb","bulk","bullet","bundle","bunker","burden","burger","burst","bus","business","busy","butter","buyer","buzz","cabbage","cabin","cable","cactus","cage","cake","call","calm","camera","camp","can","canal","cancel","candy","cannon","canoe","canvas","canyon","capable","capital","captain","car","carbon","card","cargo","carpet","carry","cart","case","cash","casino","castle","casual","cat","catalog","catch","category","cattle","caught","cause","caution","cave","ceiling","celery","cement","census","century","cereal","certain","chair","chalk","champion","change","chaos","chapter","charge","chase","chat","cheap","check","cheese","chef","cherry","chest","chicken","chief","child","chimney","choice","choose","chronic","chuckle","chunk","churn","cigar","cinnamon","circle","citizen","city","civil","claim","clap","clarify","claw","clay","clean","clerk","clever","click","client","cliff","climb","clinic","clip","clock","clog","close","cloth","cloud","clown","club","clump","cluster","clutch","coach","coast","coconut","code","coffee","coil","coin","collect","color","column","combine","come","comfort","comic","common","company","concert","conduct","confirm","congress","connect","consider","control","convince","cook","cool","copper","copy","coral","core","corn","correct","cost","cotton","couch","country","couple","course","cousin","cover","coyote","crack","cradle","craft","cram","crane","crash","crater","crawl","crazy","cream","credit","creek","crew","cricket","crime","crisp","critic","crop","cross","crouch","crowd","crucial","cruel","cruise","crumble","crunch","crush","cry","crystal","cube","culture","cup","cupboard","curious","current","curtain","curve","cushion","custom","cute","cycle","dad","damage","damp","dance","danger","daring","dash","daughter","dawn","day","deal","debate","debris","decade","december","decide","decline","decorate","decrease","deer","defense","define","defy","degree","delay","deliver","demand","demise","denial","dentist","deny","depart","depend","deposit","depth","deputy","derive","describe","desert","design","desk","despair","destroy","detail","detect","develop","device","devote","diagram","dial","diamond","diary","dice","diesel","diet","differ","digital","dignity","dilemma","dinner","dinosaur","direct","dirt","disagree","discover","disease","dish","dismiss","disorder","display","distance","divert","divide","divorce","dizzy","doctor","document","dog","doll","dolphin","domain","donate","donkey","donor","door","dose","double","dove","draft","dragon","drama","drastic","draw","dream","dress","drift","drill","drink","drip","drive","drop","drum","dry","duck","dumb","dune","during","dust","dutch","duty","dwarf","dynamic","eager","eagle","early","earn","earth","easily","east","easy","echo","ecology","economy","edge","edit","educate","effort","egg","eight","either","elbow","elder","electric","elegant","element","elephant","elevator","elite","else","embark","embody","embrace","emerge","emotion","employ","empower","empty","enable","enact","end","endless","endorse","enemy","energy","enforce","engage","engine","enhance","enjoy","enlist","enough","enrich","enroll","ensure","enter","entire","entry","envelope","episode","equal","equip","era","erase","erode","erosion","error","erupt","escape","essay","essence","estate","eternal","ethics","evidence","evil","evoke","evolve","exact","example","excess","exchange","excite","exclude","excuse","execute","exercise","exhaust","exhibit","exile","exist","exit","exotic","expand","expect","expire","explain","expose","express","extend","extra","eye","eyebrow","fabric","face","faculty","fade","faint","faith","fall","false","fame","family","famous","fan","fancy","fantasy","farm","fashion","fat","fatal","father","fatigue","fault","favorite","feature","february","federal","fee","feed","feel","female","fence","festival","fetch","fever","few","fiber","fiction","field","figure","file","film","filter","final","find","fine","finger","finish","fire","firm","first","fiscal","fish","fit","fitness","fix","flag","flame","flash","flat","flavor","flee","flight","flip","float","flock","floor","flower","fluid","flush","fly","foam","focus","fog","foil","fold","follow","food","foot","force","forest","forget","fork","fortune","forum","forward","fossil","foster","found","fox","fragile","frame","frequent","fresh","friend","fringe","frog","front","frost","frown","frozen","fruit","fuel","fun","funny","furnace","fury","future","gadget","gain","galaxy","gallery","game","gap","garage","garbage","garden","garlic","garment","gas","gasp","gate","gather","gauge","gaze","general","genius","genre","gentle","genuine","gesture","ghost","giant","gift","giggle","ginger","giraffe","girl","give","glad","glance","glare","glass","glide","glimpse","globe","gloom","glory","glove","glow","glue","goat","goddess","gold","good","goose","gorilla","gospel","gossip","govern","gown","grab","grace","grain","grant","grape","grass","gravity","great","green","grid","grief","grit","grocery","group","grow","grunt","guard","guess","guide","guilt","guitar","gun","gym","habit","hair","half","hammer","hamster","hand","happy","harbor","hard","harsh","harvest","hat","have","hawk","hazard","head","health","heart","heavy","hedgehog","height","hello","helmet","help","hen","hero","hidden","high","hill","hint","hip","hire","history","hobby","hockey","hold","hole","holiday","hollow","home","honey","hood","hope","horn","horror","horse","hospital","host","hotel","hour","hover","hub","huge","human","humble","humor","hundred","hungry","hunt","hurdle","hurry","hurt","husband","hybrid","ice","icon","idea","identify","idle","ignore","ill","illegal","illness","image","imitate","immense","immune","impact","impose","improve","impulse","inch","include","income","increase","index","indicate","indoor","industry","infant","inflict","inform","inhale","inherit","initial","inject","injury","inmate","inner","innocent","input","inquiry","insane","insect","inside","inspire","install","intact","interest","into","invest","invite","involve","iron","island","isolate","issue","item","ivory","jacket","jaguar","jar","jazz","jealous","jeans","jelly","jewel","job","join","joke","journey","joy","judge","juice","jump","jungle","junior","junk","just","kangaroo","keen","keep","ketchup","key","kick","kid","kidney","kind","kingdom","kiss","kit","kitchen","kite","kitten","kiwi","knee","knife","knock","know","lab","label","labor","ladder","lady","lake","lamp","language","laptop","large","later","latin","laugh","laundry","lava","law","lawn","lawsuit","layer","lazy","leader","leaf","learn","leave","lecture","left","leg","legal","legend","leisure","lemon","lend","length","lens","leopard","lesson","letter","level","liar","liberty","library","license","life","lift","light","like","limb","limit","link","lion","liquid","list","little","live","lizard","load","loan","lobster","local","lock","logic","lonely","long","loop","lottery","loud","lounge","love","loyal","lucky","luggage","lumber","lunar","lunch","luxury","lyrics","machine","mad","magic","magnet","maid","mail","main","major","make","mammal","man","manage","mandate","mango","mansion","manual","maple","marble","march","margin","marine","market","marriage","mask","mass","master","match","material","math","matrix","matter","maximum","maze","meadow","mean","measure","meat","mechanic","medal","media","melody","melt","member","memory","mention","menu","mercy","merge","merit","merry","mesh","message","metal","method","middle","midnight","milk","million","mimic","mind","minimum","minor","minute","miracle","mirror","misery","miss","mistake","mix","mixed","mixture","mobile","model","modify","mom","moment","monitor","monkey","monster","month","moon","moral","more","morning","mosquito","mother","motion","motor","mountain","mouse","move","movie","much","muffin","mule","multiply","muscle","museum","mushroom","music","must","mutual","myself","mystery","myth","naive","name","napkin","narrow","nasty","nation","nature","near","neck","need","negative","neglect","neither","nephew","nerve","nest","net","network","neutral","never","news","next","nice","night","noble","noise","nominee","noodle","normal","north","nose","notable","note","nothing","notice","novel","now","nuclear","number","nurse","nut","oak","obey","object","oblige","obscure","observe","obtain","obvious","occur","ocean","october","odor","off","offer","office","often","oil","okay","old","olive","olympic","omit","once","one","onion","online","only","open","opera","opinion","oppose","option","orange","orbit","orchard","order","ordinary","organ","orient","original","orphan","ostrich","other","outdoor","outer","output","outside","oval","oven","over","own","owner","oxygen","oyster","ozone","pact","paddle","page","pair","palace","palm","panda","panel","panic","panther","paper","parade","parent","park","parrot","party","pass","patch","path","patient","patrol","pattern","pause","pave","payment","peace","peanut","pear","peasant","pelican","pen","penalty","pencil","people","pepper","perfect","permit","person","pet","phone","photo","phrase","physical","piano","picnic","picture","piece","pig","pigeon","pill","pilot","pink","pioneer","pipe","pistol","pitch","pizza","place","planet","plastic","plate","play","please","pledge","pluck","plug","plunge","poem","poet","point","polar","pole","police","pond","pony","pool","popular","portion","position","possible","post","potato","pottery","poverty","powder","power","practice","praise","predict","prefer","prepare","present","pretty","prevent","price","pride","primary","print","priority","prison","private","prize","problem","process","produce","profit","program","project","promote","proof","property","prosper","protect","proud","provide","public","pudding","pull","pulp","pulse","pumpkin","punch","pupil","puppy","purchase","purity","purpose","purse","push","put","puzzle","pyramid","quality","quantum","quarter","question","quick","quit","quiz","quote","rabbit","raccoon","race","rack","radar","radio","rail","rain","raise","rally","ramp","ranch","random","range","rapid","rare","rate","rather","raven","raw","razor","ready","real","reason","rebel","rebuild","recall","receive","recipe","record","recycle","reduce","reflect","reform","refuse","region","regret","regular","reject","relax","release","relief","rely","remain","remember","remind","remove","render","renew","rent","reopen","repair","repeat","replace","report","require","rescue","resemble","resist","resource","response","result","retire","retreat","return","reunion","reveal","review","reward","rhythm","rib","ribbon","rice","rich","ride","ridge","rifle","right","rigid","ring","riot","ripple","risk","ritual","rival","river","road","roast","robot","robust","rocket","romance","roof","rookie","room","rose","rotate","rough","round","route","royal","rubber","rude","rug","rule","run","runway","rural","sad","saddle","sadness","safe","sail","salad","salmon","salon","salt","salute","same","sample","sand","satisfy","satoshi","sauce","sausage","save","say","scale","scan","scare","scatter","scene","scheme","school","science","scissors","scorpion","scout","scrap","screen","script","scrub","sea","search","season","seat","second","secret","section","security","seed","seek","segment","select","sell","seminar","senior","sense","sentence","series","service","session","settle","setup","seven","shadow","shaft","shallow","share","shed","shell","sheriff","shield","shift","shine","ship","shiver","shock","shoe","shoot","shop","short","shoulder","shove","shrimp","shrug","shuffle","shy","sibling","sick","side","siege","sight","sign","silent","silk","silly","silver","similar","simple","since","sing","siren","sister","situate","six","size","skate","sketch","ski","skill","skin","skirt","skull","slab","slam","sleep","slender","slice","slide","slight","slim","slogan","slot","slow","slush","small","smart","smile","smoke","smooth","snack","snake","snap","sniff","snow","soap","soccer","social","sock","soda","soft","solar","soldier","solid","solution","solve","someone","song","soon","sorry","sort","soul","sound","soup","source","south","space","spare","spatial","spawn","speak","special","speed","spell","spend","sphere","spice","spider","spike","spin","spirit","split","spoil","sponsor","spoon","sport","spot","spray","spread","spring","spy","square","squeeze","squirrel","stable","stadium","staff","stage","stairs","stamp","stand","start","state","stay","steak","steel","stem","step","stereo","stick","still","sting","stock","stomach","stone","stool","story","stove","strategy","street","strike","strong","struggle","student","stuff","stumble","style","subject","submit","subway","success","such","sudden","suffer","sugar","suggest","suit","summer","sun","sunny","sunset","super","supply","supreme","sure","surface","surge","surprise","surround","survey","suspect","sustain","swallow","swamp","swap","swarm","swear","sweet","swift","swim","swing","switch","sword","symbol","symptom","syrup","system","table","tackle","tag","tail","talent","talk","tank","tape","target","task","taste","tattoo","taxi","teach","team","tell","ten","tenant","tennis","tent","term","test","text","thank","that","theme","then","theory","there","they","thing","this","thought","three","thrive","throw","thumb","thunder","ticket","tide","tiger","tilt","timber","time","tiny","tip","tired","tissue","title","toast","tobacco","today","toddler","toe","together","toilet","token","tomato","tomorrow","tone","tongue","tonight","tool","tooth","top","topic","topple","torch","tornado","tortoise","toss","total","tourist","toward","tower","town","toy","track","trade","traffic","tragic","train","transfer","trap","trash","travel","tray","treat","tree","trend","trial","tribe","trick","trigger","trim","trip","trophy","trouble","truck","true","truly","trumpet","trust","truth","try","tube","tuition","tumble","tuna","tunnel","turkey","turn","turtle","twelve","twenty","twice","twin","twist","two","type","typical","ugly","umbrella","unable","unaware","uncle","uncover","under","undo","unfair","unfold","unhappy","uniform","unique","unit","universe","unknown","unlock","until","unusual","unveil","update","upgrade","uphold","upon","upper","upset","urban","urge","usage","use","used","useful","useless","usual","utility","vacant","vacuum","vague","valid","valley","valve","van","vanish","vapor","various","vast","vault","vehicle","velvet","vendor","venture","venue","verb","verify","version","very","vessel","veteran","viable","vibrant","vicious","victory","video","view","village","vintage","violin","virtual","virus","visa","visit","visual","vital","vivid","vocal","voice","void","volcano","volume","vote","voyage","wage","wagon","wait","walk","wall","walnut","want","warfare","warm","warrior","wash","wasp","waste","water","wave","way","wealth","weapon","wear","weasel","weather","web","wedding","weekend","weird","welcome","west","wet","whale","what","wheat","wheel","when","where","whip","whisper","wide","width","wife","wild","will","win","window","wine","wing","wink","winner","winter","wire","wisdom","wise","wish","witness","wolf","woman","wonder","wood","wool","word","work","world","worry","worth","wrap","wreck","wrestle","wrist","write","wrong","yard","year","yellow","you","young","youth","zebra","zero","zone","zoo"]},function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return s},i=this&&this.__importStar||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},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(r(24)),o=i(r(1)),u=r(18),c=r(6),l=r(8),f=r(13),h=a(r(21)),p=r(5);t.aesEncrypt=function(e,t,r,n){void 0===r&&(r="CBC");var i=s.createCipher("AES-"+r,p.bytesToString(c._fromIn(t),"raw"));return i.start({iv:n&&o.createBuffer(p.bytesToString(c._fromIn(n),"raw"))}),i.update(o.createBuffer(p.bytesToString(e,"raw"))),i.finish(),p.stringToBytes(i.output.getBytes(),"raw")},t.aesDecrypt=function(e,t,r,n){void 0===r&&(r="CBC");var i=s.createDecipher("AES-"+r,p.bytesToString(c._fromIn(t),"raw"));i.start({iv:n&&o.createBuffer(p.bytesToString(c._fromIn(n),"raw"))});var a=o.createBuffer(p.bytesToString(c._fromIn(e),"raw"));if(i.update(a),!i.finish())throw new Error("Failed to decrypt data with provided key");return p.stringToBytes(i.output.getBytes(),"raw")},t.messageEncrypt=function(e,r){var n=Uint8Array.from([1]),i=u.randomBytes(32),a=u.randomBytes(16),s=p.stringToBytes(r),o=t.aesEncrypt(s,i,"CTR",a),c=t.aesEncrypt(i,e,"ECB"),h=l.hmacSHA256(s,i),d=l.hmacSHA256(f.concat(i,a),e);return f.concat(n,c,d,h,a,o)},t.messageDecrypt=function(e,r){var i=n(f.split(r,1,48,32,32,16),6),a=(i[0],i[1]),s=i[2],o=i[3],u=i[4],h=i[5],d=t.aesDecrypt(a,e,"ECB");if(!c._fromIn(l.hmacSHA256(f.concat(d,u),c._fromIn(e))).every((function(e,t){return e===s[t]})))throw new Error("Invalid key");var y=t.aesDecrypt(h,d,"CTR",u);if(!c._fromIn(l.hmacSHA256(y,d)).every((function(e,t){return e===o[t]})))throw new Error("Invalid message");return p.bytesToString(y)},t.sharedKey=function(e,t,r){var n=h.default.sharedKey(c._fromIn(e),c._fromIn(t)),i=l.sha256(c._fromRawIn(r));return l.hmacSHA256(n,i)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(6),i=r(5);t.Seed={isSeedWithNonce:function(e){return void 0!==e.nonce},toBinary:function(e){return t.Seed.isSeedWithNonce(e)?{seed:t.Seed.toBinary(e.seed).seed,nonce:e.nonce}:{seed:n._fromRawIn(e),nonce:void 0}},toString:function(e){return i.bytesToString(t.Seed.toBinary(e).seed)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(14),i=r(14);t.ChaidId={toNumber:function(e){return"string"==typeof e?e.charCodeAt(0):e},isMainnet:function(e){return t.ChaidId.toNumber(e)===n.MAIN_NET_CHAIN_ID},isTestnet:function(e){return t.ChaidId.toNumber(e)===i.TEST_NET_CHAIN_ID}}},function(e,t,r){var n=r(0);if(r(23),r(9),r(41),r(4),r(10),r(42),r(29),r(7),r(74),r(22),r(1),void 0===i)var i=n.jsbn.BigInteger;var a=n.asn1,s=n.pki=n.pki||{};e.exports=s.pbe=n.pbe=n.pbe||{};var o=s.oids,u={name:"EncryptedPrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},c={name:"PBES2Algorithms",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},l={name:"pkcs-12PbeParams",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"iterations"}]};function f(e,t){return e.start().update(t).digest().getBytes()}function h(e){var t;if(e){if(!(t=s.oids[a.derToOid(e)])){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}}else t="hmacWithSHA1";return p(t)}function p(e){var t=n.md;switch(e){case"hmacWithSHA224":t=n.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}s.encryptPrivateKeyInfo=function(e,t,r){(r=r||{}).saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var i,u,c,l=n.random.getBytesSync(r.saltSize),f=r.count,h=a.integerToDer(f);if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var d,y,g;switch(r.algorithm){case"aes128":i=16,d=16,y=o["aes128-CBC"],g=n.aes.createEncryptionCipher;break;case"aes192":i=24,d=16,y=o["aes192-CBC"],g=n.aes.createEncryptionCipher;break;case"aes256":i=32,d=16,y=o["aes256-CBC"],g=n.aes.createEncryptionCipher;break;case"des":i=8,d=8,y=o.desCBC,g=n.des.createEncryptionCipher;break;default:throw(S=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,S}var m="hmacWith"+r.prfAlgorithm.toUpperCase(),v=p(m),b=n.pkcs5.pbkdf2(t,l,f,i,v),E=n.random.getBytesSync(d);(T=g(b)).start(E),T.update(a.toDer(e)),T.finish(),c=T.output.getBytes();var C=function(e,t,r,i){var o=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,e),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,t.getBytes())]);"hmacWithSHA1"!==i&&o.value.push(a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,n.util.hexToBytes(r.toString(16))),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(s.oids[i]).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]));return o}(l,h,i,m);u=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(o.pkcs5PBES2).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(o.pkcs5PBKDF2).getBytes()),C]),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(y).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,E)])])])}else{var S;if("3des"!==r.algorithm)throw(S=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,S;i=24;var T,A=new n.util.ByteBuffer(l);b=s.pbe.generatePkcs12Key(t,A,1,f,i),E=s.pbe.generatePkcs12Key(t,A,2,f,i);(T=n.des.createEncryptionCipher(b)).start(E),T.update(a.toDer(e)),T.finish(),c=T.output.getBytes(),u=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(o["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,l),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,h.getBytes())])])}return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[u,a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,c)])},s.decryptPrivateKeyInfo=function(e,t){var r=null,i={},o=[];if(!a.validate(e,u,i,o)){var c=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw c.errors=o,c}var l=a.derToOid(i.encryptionOid),f=s.pbe.getCipher(l,i.encryptionParams,t),h=n.util.createBuffer(i.encryptedData);return f.update(h),f.finish()&&(r=a.fromDer(f.output)),r},s.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:a.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})},s.encryptedPrivateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return a.fromDer(t.body)},s.encryptRsaPrivateKey=function(e,t,r){if(!(r=r||{}).legacy){var i=s.wrapRsaPrivateKey(s.privateKeyToAsn1(e));return i=s.encryptPrivateKeyInfo(i,t,r),s.encryptedPrivateKeyToPem(i)}var o,u,c,l;switch(r.algorithm){case"aes128":o="AES-128-CBC",c=16,u=n.random.getBytesSync(16),l=n.aes.createEncryptionCipher;break;case"aes192":o="AES-192-CBC",c=24,u=n.random.getBytesSync(16),l=n.aes.createEncryptionCipher;break;case"aes256":o="AES-256-CBC",c=32,u=n.random.getBytesSync(16),l=n.aes.createEncryptionCipher;break;case"3des":o="DES-EDE3-CBC",c=24,u=n.random.getBytesSync(8),l=n.des.createEncryptionCipher;break;case"des":o="DES-CBC",c=8,u=n.random.getBytesSync(8),l=n.des.createEncryptionCipher;break;default:var f=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw f.algorithm=r.algorithm,f}var h=l(n.pbe.opensslDeriveBytes(t,u.substr(0,8),c));h.start(u),h.update(a.toDer(s.privateKeyToAsn1(e))),h.finish();var p={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:o,parameters:n.util.bytesToHex(u).toUpperCase()},body:h.output.getBytes()};return n.pem.encode(p)},s.decryptRsaPrivateKey=function(e,t){var r=null,i=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type)throw(c=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=c,c;if(i.procType&&"ENCRYPTED"===i.procType.type){var o,u;switch(i.dekInfo.algorithm){case"DES-CBC":o=8,u=n.des.createDecryptionCipher;break;case"DES-EDE3-CBC":o=24,u=n.des.createDecryptionCipher;break;case"AES-128-CBC":o=16,u=n.aes.createDecryptionCipher;break;case"AES-192-CBC":o=24,u=n.aes.createDecryptionCipher;break;case"AES-256-CBC":o=32,u=n.aes.createDecryptionCipher;break;case"RC2-40-CBC":o=5,u=function(e){return n.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":o=8,u=function(e){return n.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":o=16,u=function(e){return n.rc2.createDecryptionCipher(e,128)};break;default:var c;throw(c=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".')).algorithm=i.dekInfo.algorithm,c}var l=n.util.hexToBytes(i.dekInfo.parameters),f=u(n.pbe.opensslDeriveBytes(t,l.substr(0,8),o));if(f.start(l),f.update(n.util.createBuffer(i.body)),!f.finish())return r;r=f.output.getBytes()}else r=i.body;return null!==(r="ENCRYPTED PRIVATE KEY"===i.type?s.decryptPrivateKeyInfo(a.fromDer(r),t):a.fromDer(r))&&(r=s.privateKeyFromAsn1(r)),r},s.pbe.generatePkcs12Key=function(e,t,r,i,a,s){var o,u;if(null==s){if(!("sha1"in n.md))throw new Error('"sha1" hash algorithm unavailable.');s=n.md.sha1.create()}var c=s.digestLength,l=s.blockLength,f=new n.util.ByteBuffer,h=new n.util.ByteBuffer;if(null!=e){for(u=0;u<e.length;u++)h.putInt16(e.charCodeAt(u));h.putInt16(0)}var p=h.length(),d=t.length(),y=new n.util.ByteBuffer;y.fillWithByte(r,l);var g=l*Math.ceil(d/l),m=new n.util.ByteBuffer;for(u=0;u<g;u++)m.putByte(t.at(u%d));var v=l*Math.ceil(p/l),b=new n.util.ByteBuffer;for(u=0;u<v;u++)b.putByte(h.at(u%p));var E=m;E.putBuffer(b);for(var C=Math.ceil(a/c),S=1;S<=C;S++){var T=new n.util.ByteBuffer;T.putBytes(y.bytes()),T.putBytes(E.bytes());for(var A=0;A<i;A++)s.start(),s.update(T.getBytes()),T=s.digest();var I=new n.util.ByteBuffer;for(u=0;u<l;u++)I.putByte(T.at(u%c));var w=Math.ceil(d/l)+Math.ceil(p/l),B=new n.util.ByteBuffer;for(o=0;o<w;o++){var _=new n.util.ByteBuffer(E.getBytes(l)),N=511;for(u=I.length()-1;u>=0;u--)N>>=8,N+=I.at(u)+_.at(u),_.setAt(u,255&N);B.putBuffer(_)}E=B,f.putBuffer(T)}return f.truncate(f.length()-a),f},s.pbe.getCipher=function(e,t,r){switch(e){case s.oids.pkcs5PBES2:return s.pbe.getCipherForPBES2(e,t,r);case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case s.oids["pbewithSHAAnd40BitRC2-CBC"]:return s.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},s.pbe.getCipherForPBES2=function(e,t,r){var i,o={},u=[];if(!a.validate(t,c,o,u))throw(i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=u,i;if((e=a.derToOid(o.kdfOid))!==s.oids.pkcs5PBKDF2)throw(i=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,i.supportedOids=["pkcs5PBKDF2"],i;if((e=a.derToOid(o.encOid))!==s.oids["aes128-CBC"]&&e!==s.oids["aes192-CBC"]&&e!==s.oids["aes256-CBC"]&&e!==s.oids["des-EDE3-CBC"]&&e!==s.oids.desCBC)throw(i=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,i.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],i;var l,f,p=o.kdfSalt,d=n.util.createBuffer(o.kdfIterationCount);switch(d=d.getInt(d.length()<<3),s.oids[e]){case"aes128-CBC":l=16,f=n.aes.createDecryptionCipher;break;case"aes192-CBC":l=24,f=n.aes.createDecryptionCipher;break;case"aes256-CBC":l=32,f=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":l=24,f=n.des.createDecryptionCipher;break;case"desCBC":l=8,f=n.des.createDecryptionCipher}var y=h(o.prfOid),g=n.pkcs5.pbkdf2(r,p,d,l,y),m=o.encIv,v=f(g);return v.start(m),v},s.pbe.getCipherForPKCS12PBE=function(e,t,r){var i={},o=[];if(!a.validate(t,l,i,o))throw(y=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=o,y;var u,c,f,p=n.util.createBuffer(i.salt),d=n.util.createBuffer(i.iterations);switch(d=d.getInt(d.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:u=24,c=8,f=n.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:u=5,c=8,f=function(e,t){var r=n.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var y;throw(y=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,y}var g=h(i.prfOid),m=s.pbe.generatePkcs12Key(r,p,1,d,u,g);return g.start(),f(m,s.pbe.generatePkcs12Key(r,p,2,d,c,g))},s.pbe.opensslDeriveBytes=function(e,t,r,i){if(null==i){if(!("md5"in n.md))throw new Error('"md5" hash algorithm unavailable.');i=n.md.md5.create()}null===t&&(t="");for(var a=[f(i,e+t)],s=16,o=1;s<r;++o,s+=16)a.push(f(i,a[o-1]+e+t));return a.join("").substr(0,r)}},function(e,t,r){var n=r(0);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.des.Algorithm(e,t)}))}r(24),r(34),r(1),e.exports=n.des=n.des||{},n.des.startEncrypting=function(e,t,r,n){var i=d({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createEncryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!1,mode:t})},n.des.startDecrypting=function(e,t,r,n){var i=d({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createDecryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!0,mode:t})},n.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return p(r._keys,e,t,!1)},decrypt:function(e,t){return p(r._keys,e,t,!0)}}}),r._init=!1},n.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=n.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=function(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],n=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],i=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],a=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],o=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],u=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],c=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],f=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],h=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],p=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],d=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],g=e.length()>8?3:1,m=[],v=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,E=0;E<g;E++){var C=e.getInt32(),S=e.getInt32();C^=(t=252645135&(C>>>4^S))<<4,C^=t=65535&((S^=t)>>>-16^C),C^=(t=858993459&(C>>>2^(S^=t<<-16)))<<2,C^=t=65535&((S^=t)>>>-16^C),C^=(t=1431655765&(C>>>1^(S^=t<<-16)))<<1,C^=t=16711935&((S^=t)>>>8^C),t=(C^=(t=1431655765&(C>>>1^(S^=t<<8)))<<1)<<8|(S^=t)>>>20&240,C=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T<v.length;++T){v[T]?(C=C<<2|C>>>26,S=S<<2|S>>>26):(C=C<<1|C>>>27,S=S<<1|S>>>27);var A=r[(C&=-15)>>>28]|n[C>>>24&15]|i[C>>>20&15]|a[C>>>16&15]|s[C>>>12&15]|o[C>>>8&15]|u[C>>>4&15],I=c[(S&=-15)>>>28]|l[S>>>24&15]|f[S>>>20&15]|h[S>>>16&15]|p[S>>>12&15]|d[S>>>8&15]|y[S>>>4&15];t=65535&(I>>>16^A),m[b++]=A^t,m[b++]=I^t<<16}}return m}(t),this._init=!0}},i("DES-ECB",n.cipher.modes.ecb),i("DES-CBC",n.cipher.modes.cbc),i("DES-CFB",n.cipher.modes.cfb),i("DES-OFB",n.cipher.modes.ofb),i("DES-CTR",n.cipher.modes.ctr),i("3DES-ECB",n.cipher.modes.ecb),i("3DES-CBC",n.cipher.modes.cbc),i("3DES-CFB",n.cipher.modes.cfb),i("3DES-OFB",n.cipher.modes.ofb),i("3DES-CTR",n.cipher.modes.ctr);var a=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],s=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],o=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],u=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],c=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],l=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],f=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],h=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function p(e,t,r,n){var i,p,d=32===e.length?3:9;i=3===d?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var y=t[0],g=t[1];y^=(p=252645135&(y>>>4^g))<<4,y^=(p=65535&(y>>>16^(g^=p)))<<16,y^=p=858993459&((g^=p)>>>2^y),y^=p=16711935&((g^=p<<2)>>>8^y),y=(y^=(p=1431655765&(y>>>1^(g^=p<<8)))<<1)<<1|y>>>31,g=(g^=p)<<1|g>>>31;for(var m=0;m<d;m+=3){for(var v=i[m+1],b=i[m+2],E=i[m];E!=v;E+=b){var C=g^e[E],S=(g>>>4|g<<28)^e[E+1];p=y,y=g,g=p^(s[C>>>24&63]|u[C>>>16&63]|l[C>>>8&63]|h[63&C]|a[S>>>24&63]|o[S>>>16&63]|c[S>>>8&63]|f[63&S])}p=y,y=g,g=p}g=g>>>1|g<<31,g^=p=1431655765&((y=y>>>1|y<<31)>>>1^g),g^=(p=16711935&(g>>>8^(y^=p<<1)))<<8,g^=(p=858993459&(g>>>2^(y^=p)))<<2,g^=p=65535&((y^=p)>>>16^g),g^=p=252645135&((y^=p<<16)>>>4^g),y^=p<<4,r[0]=y,r[1]=g}function d(e){var t,r="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var a=null;r instanceof n.util.ByteBuffer&&(a=r,r={}),(r=r||{}).output=a,r.iv=e,i.call(t,r)},t}},function(e,t,r){(function(t){var n=r(0);r(26),r(4),r(1);var i,a=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(i=r(25)),e.exports=n.pbkdf2=a.pbkdf2=function(e,r,a,s,o,u){if("function"==typeof o&&(u=o,o=null),n.util.isNodejs&&!n.options.usePureJavaScript&&i.pbkdf2&&(null===o||"object"!=typeof o)&&(i.pbkdf2Sync.length>4||!o||"sha1"===o))return"string"!=typeof o&&(o="sha1"),e=t.from(e,"binary"),r=t.from(r,"binary"),u?4===i.pbkdf2Sync.length?i.pbkdf2(e,r,a,s,(function(e,t){if(e)return u(e);u(null,t.toString("binary"))})):i.pbkdf2(e,r,a,s,o,(function(e,t){if(e)return u(e);u(null,t.toString("binary"))})):4===i.pbkdf2Sync.length?i.pbkdf2Sync(e,r,a,s).toString("binary"):i.pbkdf2Sync(e,r,a,s,o).toString("binary");if(null==o&&(o="sha1"),"string"==typeof o){if(!(o in n.md.algorithms))throw new Error("Unknown hash algorithm: "+o);o=n.md[o].create()}var c=o.digestLength;if(s>4294967295*c){var l=new Error("Derived key is too long.");if(u)return u(l);throw l}var f=Math.ceil(s/c),h=s-(f-1)*c,p=n.hmac.create();p.start(o,e);var d,y,g,m="";if(!u){for(var v=1;v<=f;++v){p.start(null,null),p.update(r),p.update(n.util.int32ToBytes(v)),d=g=p.digest().getBytes();for(var b=2;b<=a;++b)p.start(null,null),p.update(g),y=p.digest().getBytes(),d=n.util.xorBytes(d,y,c),g=y;m+=v<f?d:d.substr(0,h)}return m}v=1;function E(){if(v>f)return u(null,m);p.start(null,null),p.update(r),p.update(n.util.int32ToBytes(v)),d=g=p.digest().getBytes(),b=2,C()}function C(){if(b<=a)return p.start(null,null),p.update(g),y=p.digest().getBytes(),d=n.util.xorBytes(d,y,c),g=y,++b,n.util.setImmediate(C);m+=v<f?d:d.substr(0,h),++v,E()}E()}}).call(this,r(11).Buffer)},function(e,t,r){var n,i=r(0);e.exports=i.jsbn=i.jsbn||{};function a(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function s(){return new a(null)}function o(e,t,r,n,i,a){for(var s=16383&t,o=t>>14;--a>=0;){var u=16383&this.data[e],c=this.data[e++]>>14,l=o*u+c*s;i=((u=s*u+((16383&l)<<14)+r.data[n]+i)>>28)+(l>>14)+o*c,r.data[n++]=268435455&u}return i}i.jsbn.BigInteger=a,"undefined"==typeof navigator?(a.prototype.am=o,n=28):"Microsoft Internet Explorer"==navigator.appName?(a.prototype.am=function(e,t,r,n,i,a){for(var s=32767&t,o=t>>15;--a>=0;){var u=32767&this.data[e],c=this.data[e++]>>15,l=o*u+c*s;i=((u=s*u+((32767&l)<<15)+r.data[n]+(1073741823&i))>>>30)+(l>>>15)+o*c+(i>>>30),r.data[n++]=1073741823&u}return i},n=30):"Netscape"!=navigator.appName?(a.prototype.am=function(e,t,r,n,i,a){for(;--a>=0;){var s=t*this.data[e++]+r.data[n]+i;i=Math.floor(s/67108864),r.data[n++]=67108863&s}return i},n=26):(a.prototype.am=o,n=28),a.prototype.DB=n,a.prototype.DM=(1<<n)-1,a.prototype.DV=1<<n;a.prototype.FV=Math.pow(2,52),a.prototype.F1=52-n,a.prototype.F2=2*n-52;var u,c,l=new Array;for(u="0".charCodeAt(0),c=0;c<=9;++c)l[u++]=c;for(u="a".charCodeAt(0),c=10;c<36;++c)l[u++]=c;for(u="A".charCodeAt(0),c=10;c<36;++c)l[u++]=c;function f(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function h(e,t){var r=l[e.charCodeAt(t)];return null==r?-1:r}function p(e){var t=s();return t.fromInt(e),t}function d(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function y(e){this.m=e}function g(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function m(e,t){return e&t}function v(e,t){return e|t}function b(e,t){return e^t}function E(e,t){return e&~t}function C(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function S(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function T(){}function A(e){return e}function I(e){this.r2=s(),this.q3=s(),a.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}y.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},y.prototype.revert=function(e){return e},y.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},y.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},y.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},g.prototype.convert=function(e){var t=s();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(a.ZERO)>0&&this.m.subTo(t,t),t},g.prototype.revert=function(e){var t=s();return e.copyTo(t),this.reduce(t),t},g.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e.data[t],n=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},g.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},g.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},a.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},a.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},a.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,i=!1,s=0;--n>=0;){var o=8==r?255&e[n]:h(e,n);o<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==s?this.data[this.t++]=o:s+r>this.DB?(this.data[this.t-1]|=(o&(1<<this.DB-s)-1)<<s,this.data[this.t++]=o>>this.DB-s):this.data[this.t-1]|=o<<s,(s+=r)>=this.DB&&(s-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),i&&a.ZERO.subTo(this,this)},a.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t},a.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},a.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s},a.prototype.lShiftTo=function(e,t){var r,n=e%this.DB,i=this.DB-n,a=(1<<i)-1,s=Math.floor(e/this.DB),o=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t.data[r+s+1]=this.data[r]>>i|o,o=(this.data[r]&a)<<n;for(r=s-1;r>=0;--r)t.data[r]=0;t.data[s]=o,t.t=this.t+s+1,t.s=this.s,t.clamp()},a.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,a=(1<<n)-1;t.data[0]=this.data[r]>>n;for(var s=r+1;s<this.t;++s)t.data[s-r-1]|=(this.data[s]&a)<<i,t.data[s-r]=this.data[s]>>n;n>0&&(t.data[this.t-r-1]|=(this.s&a)<<i),t.t=this.t-r,t.clamp()}},a.prototype.subTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]-e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()},a.prototype.multiplyTo=function(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t.data[i]=0;for(i=0;i<n.t;++i)t.data[i+r.t]=r.am(0,n.data[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&a.ZERO.subTo(t,t)},a.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},a.prototype.divRemTo=function(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=s());var o=s(),u=this.s,c=e.s,l=this.DB-d(n.data[n.t-1]);l>0?(n.lShiftTo(l,o),i.lShiftTo(l,r)):(n.copyTo(o),i.copyTo(r));var f=o.t,h=o.data[f-1];if(0!=h){var p=h*(1<<this.F1)+(f>1?o.data[f-2]>>this.F2:0),y=this.FV/p,g=(1<<this.F1)/p,m=1<<this.F2,v=r.t,b=v-f,E=null==t?s():t;for(o.dlShiftTo(b,E),r.compareTo(E)>=0&&(r.data[r.t++]=1,r.subTo(E,r)),a.ONE.dlShiftTo(f,E),E.subTo(o,o);o.t<f;)o.data[o.t++]=0;for(;--b>=0;){var C=r.data[--v]==h?this.DM:Math.floor(r.data[v]*y+(r.data[v-1]+m)*g);if((r.data[v]+=o.am(0,C,r,b,0,f))<C)for(o.dlShiftTo(b,E),r.subTo(E,r);r.data[v]<--C;)r.subTo(E,r)}null!=t&&(r.drShiftTo(f,t),u!=c&&a.ZERO.subTo(t,t)),r.t=f,r.clamp(),l>0&&r.rShiftTo(l,r),u<0&&a.ZERO.subTo(r,r)}}},a.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},a.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},a.prototype.exp=function(e,t){if(e>4294967295||e<1)return a.ONE;var r=s(),n=s(),i=t.convert(this),o=d(e)-1;for(i.copyTo(r);--o>=0;)if(t.sqrTo(r,n),(e&1<<o)>0)t.mulTo(n,i,r);else{var u=r;r=n,n=u}return t.revert(r)},a.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,i=!1,a="",s=this.t,o=this.DB-s*this.DB%t;if(s-- >0)for(o<this.DB&&(r=this.data[s]>>o)>0&&(i=!0,a=f(r));s>=0;)o<t?(r=(this.data[s]&(1<<o)-1)<<t-o,r|=this.data[--s]>>(o+=this.DB-t)):(r=this.data[s]>>(o-=t)&n,o<=0&&(o+=this.DB,--s)),r>0&&(i=!0),i&&(a+=f(r));return i?a:"0"},a.prototype.negate=function(){var e=s();return a.ZERO.subTo(this,e),e},a.prototype.abs=function(){return this.s<0?this.negate():this},a.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},a.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+d(this.data[this.t-1]^this.s&this.DM)},a.prototype.mod=function(e){var t=s();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(a.ZERO)>0&&e.subTo(t,t),t},a.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new y(t):new g(t),this.exp(e,r)},a.ZERO=p(0),a.ONE=p(1),T.prototype.convert=A,T.prototype.revert=A,T.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},T.prototype.sqrTo=function(e,t){e.squareTo(t)},I.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=s();return e.copyTo(t),this.reduce(t),t},I.prototype.revert=function(e){return e},I.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},I.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},I.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var w=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],B=(1<<26)/w[w.length-1];a.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},a.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=p(r),i=s(),a=s(),o="";for(this.divRemTo(n,i,a);i.signum()>0;)o=(r+a.intValue()).toString(e).substr(1)+o,i.divRemTo(n,i,a);return a.intValue().toString(e)+o},a.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,s=0,o=0,u=0;u<e.length;++u){var c=h(e,u);c<0?"-"==e.charAt(u)&&0==this.signum()&&(i=!0):(o=t*o+c,++s>=r&&(this.dMultiply(n),this.dAddOffset(o,0),s=0,o=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(o,0)),i&&a.ZERO.subTo(this,this)},a.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(a.ONE.shiftLeft(e-1),v,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(a.ONE.shiftLeft(e-1),this);else{var n=new Array,i=7&e;n.length=1+(e>>3),t.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}},a.prototype.bitwiseTo=function(e,t,r){var n,i,a=Math.min(e.t,this.t);for(n=0;n<a;++n)r.data[n]=t(this.data[n],e.data[n]);if(e.t<this.t){for(i=e.s&this.DM,n=a;n<this.t;++n)r.data[n]=t(this.data[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=a;n<e.t;++n)r.data[n]=t(i,e.data[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()},a.prototype.changeBit=function(e,t){var r=a.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r},a.prototype.addTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]+e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()},a.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},a.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},a.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r.data[--i]=0;for(n=r.t-this.t;i<n;++i)r.data[i+this.t]=this.am(0,e.data[i],r,i,0,this.t);for(n=Math.min(e.t,t);i<n;++i)this.am(0,e.data[i],r,i,0,t-i);r.clamp()},a.prototype.multiplyUpperTo=function(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r.data[this.t+n-t]=this.am(t-n,e.data[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)},a.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r},a.prototype.millerRabin=function(e){var t=this.subtract(a.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n,i=t.shiftRight(r),s={nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}},o=0;o<e;++o){do{n=new a(this.bitLength(),s)}while(n.compareTo(a.ONE)<=0||n.compareTo(t)>=0);var u=n.modPow(i,this);if(0!=u.compareTo(a.ONE)&&0!=u.compareTo(t)){for(var c=1;c++<r&&0!=u.compareTo(t);)if(0==(u=u.modPowInt(2,this)).compareTo(a.ONE))return!1;if(0!=u.compareTo(t))return!1}}return!0},a.prototype.clone=function(){var e=s();return this.copyTo(e),e},a.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]},a.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24},a.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},a.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},a.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n<this.DB&&(r=this.data[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this.data[e]&(1<<n)-1)<<8-n,r|=this.data[--e]>>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},a.prototype.equals=function(e){return 0==this.compareTo(e)},a.prototype.min=function(e){return this.compareTo(e)<0?this:e},a.prototype.max=function(e){return this.compareTo(e)>0?this:e},a.prototype.and=function(e){var t=s();return this.bitwiseTo(e,m,t),t},a.prototype.or=function(e){var t=s();return this.bitwiseTo(e,v,t),t},a.prototype.xor=function(e){var t=s();return this.bitwiseTo(e,b,t),t},a.prototype.andNot=function(e){var t=s();return this.bitwiseTo(e,E,t),t},a.prototype.not=function(){for(var e=s(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e},a.prototype.shiftLeft=function(e){var t=s();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},a.prototype.shiftRight=function(e){var t=s();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},a.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this.data[e])return e*this.DB+C(this.data[e]);return this.s<0?this.t*this.DB:-1},a.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=S(this.data[r]^t);return e},a.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this.data[t]&1<<e%this.DB)},a.prototype.setBit=function(e){return this.changeBit(e,v)},a.prototype.clearBit=function(e){return this.changeBit(e,E)},a.prototype.flipBit=function(e){return this.changeBit(e,b)},a.prototype.add=function(e){var t=s();return this.addTo(e,t),t},a.prototype.subtract=function(e){var t=s();return this.subTo(e,t),t},a.prototype.multiply=function(e){var t=s();return this.multiplyTo(e,t),t},a.prototype.divide=function(e){var t=s();return this.divRemTo(e,t,null),t},a.prototype.remainder=function(e){var t=s();return this.divRemTo(e,null,t),t},a.prototype.divideAndRemainder=function(e){var t=s(),r=s();return this.divRemTo(e,t,r),new Array(t,r)},a.prototype.modPow=function(e,t){var r,n,i=e.bitLength(),a=p(1);if(i<=0)return a;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new y(t):t.isEven()?new I(t):new g(t);var o=new Array,u=3,c=r-1,l=(1<<r)-1;if(o[1]=n.convert(this),r>1){var f=s();for(n.sqrTo(o[1],f);u<=l;)o[u]=s(),n.mulTo(f,o[u-2],o[u]),u+=2}var h,m,v=e.t-1,b=!0,E=s();for(i=d(e.data[v])-1;v>=0;){for(i>=c?h=e.data[v]>>i-c&l:(h=(e.data[v]&(1<<i+1)-1)<<c-i,v>0&&(h|=e.data[v-1]>>this.DB+i-c)),u=r;0==(1&h);)h>>=1,--u;if((i-=u)<0&&(i+=this.DB,--v),b)o[h].copyTo(a),b=!1;else{for(;u>1;)n.sqrTo(a,E),n.sqrTo(E,a),u-=2;u>0?n.sqrTo(a,E):(m=a,a=E,E=m),n.mulTo(E,o[h],a)}for(;v>=0&&0==(e.data[v]&1<<i);)n.sqrTo(a,E),m=a,a=E,E=m,--i<0&&(i=this.DB-1,--v)}return n.revert(a)},a.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return a.ZERO;for(var r=e.clone(),n=this.clone(),i=p(1),s=p(0),o=p(0),u=p(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(i.isEven()&&s.isEven()||(i.addTo(this,i),s.subTo(e,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),t?(o.isEven()&&u.isEven()||(o.addTo(this,o),u.subTo(e,u)),o.rShiftTo(1,o)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(o,i),s.subTo(u,s)):(n.subTo(r,n),t&&o.subTo(i,o),u.subTo(s,u))}return 0!=n.compareTo(a.ONE)?a.ZERO:u.compareTo(e)>=0?u.subtract(e):u.signum()<0?(u.addTo(e,u),u.signum()<0?u.add(e):u):u},a.prototype.pow=function(e){return this.exp(e,new T)},a.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),a=r.getLowestSetBit();if(a<0)return t;for(i<a&&(a=i),a>0&&(t.rShiftTo(a,t),r.rShiftTo(a,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return a>0&&r.lShiftTo(a,r),r},a.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=w[w.length-1]){for(t=0;t<w.length;++t)if(r.data[0]==w[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<w.length;){for(var n=w[t],i=t+1;i<w.length&&n<B;)n*=w[i++];for(n=r.modInt(n);t<i;)if(n%w[t++]==0)return!1}return r.millerRabin(e)}},function(e,t,r){var n=r(0);r(4),r(1);var i=e.exports=n.sha1=n.sha1||{};n.md.sha1=n.md.algorithms.sha1=i,i.create=function(){s||(a=String.fromCharCode(128),a+=n.util.fillString(String.fromCharCode(0),64),s=!0);var e=null,t=n.util.createBuffer(),r=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,a=0;a<r;++a)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},i}};return i.start(),i.update=function(a,s){"utf8"===s&&(a=n.util.encodeUtf8(a));var u=a.length;i.messageLength+=u,u=[u/4294967296>>>0,u>>>0];for(var c=i.fullMessageLength.length-1;c>=0;--c)i.fullMessageLength[c]+=u[1],u[1]=u[0]+(i.fullMessageLength[c]/4294967296>>>0),i.fullMessageLength[c]=i.fullMessageLength[c]>>>0,u[0]=u[1]/4294967296>>>0;return t.putBytes(a),o(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var u,c=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;s.putBytes(a.substr(0,i.blockLength-c));for(var l=8*i.fullMessageLength[0],f=0;f<i.fullMessageLength.length-1;++f)l+=(u=8*i.fullMessageLength[f+1])/4294967296>>>0,s.putInt32(l>>>0),l=u>>>0;s.putInt32(l);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};o(h,r,s);var p=n.util.createBuffer();return p.putInt32(h.h0),p.putInt32(h.h1),p.putInt32(h.h2),p.putInt32(h.h3),p.putInt32(h.h4),p},i};var a=null,s=!1;function o(e,t,r){for(var n,i,a,s,o,u,c,l=r.length();l>=64;){for(i=e.h0,a=e.h1,s=e.h2,o=e.h3,u=e.h4,c=0;c<16;++c)n=r.getInt32(),t[c]=n,n=(i<<5|i>>>27)+(o^a&(s^o))+u+1518500249+n,u=o,o=s,s=(a<<30|a>>>2)>>>0,a=i,i=n;for(;c<20;++c)n=(n=t[c-3]^t[c-8]^t[c-14]^t[c-16])<<1|n>>>31,t[c]=n,n=(i<<5|i>>>27)+(o^a&(s^o))+u+1518500249+n,u=o,o=s,s=(a<<30|a>>>2)>>>0,a=i,i=n;for(;c<32;++c)n=(n=t[c-3]^t[c-8]^t[c-14]^t[c-16])<<1|n>>>31,t[c]=n,n=(i<<5|i>>>27)+(a^s^o)+u+1859775393+n,u=o,o=s,s=(a<<30|a>>>2)>>>0,a=i,i=n;for(;c<40;++c)n=(n=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|n>>>30,t[c]=n,n=(i<<5|i>>>27)+(a^s^o)+u+1859775393+n,u=o,o=s,s=(a<<30|a>>>2)>>>0,a=i,i=n;for(;c<60;++c)n=(n=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|n>>>30,t[c]=n,n=(i<<5|i>>>27)+(a&s|o&(a^s))+u+2400959708+n,u=o,o=s,s=(a<<30|a>>>2)>>>0,a=i,i=n;for(;c<80;++c)n=(n=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|n>>>30,t[c]=n,n=(i<<5|i>>>27)+(a^s^o)+u+3395469782+n,u=o,o=s,s=(a<<30|a>>>2)>>>0,a=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+a|0,e.h2=e.h2+s|0,e.h3=e.h3+o|0,e.h4=e.h4+u|0,l-=64}}},function(e,t,r){var n=r(0);r(23),r(9),r(41),r(4),r(79),r(10),r(29),r(46),r(22),r(1);var i=n.asn1,a=e.exports=n.pki=n.pki||{},s=a.oids,o={};o.CN=s.commonName,o.commonName="CN",o.C=s.countryName,o.countryName="C",o.L=s.localityName,o.localityName="L",o.ST=s.stateOrProvinceName,o.stateOrProvinceName="ST",o.O=s.organizationName,o.organizationName="O",o.OU=s.organizationalUnitName,o.organizationalUnitName="OU",o.E=s.emailAddress,o.emailAddress="E";var u=n.pki.rsa.publicKeyValidator,c={name:"Certificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},u,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},l={name:"rsapss",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},f={name:"CertificationRequestInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},u,{name:"CertificationRequestInfo.attributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0}]}]}]},h={name:"CertificationRequest",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[f,{name:"CertificationRequest.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function p(e,t){"string"==typeof t&&(t={shortName:t});for(var r,n=null,i=0;null===n&&i<e.attributes.length;++i)r=e.attributes[i],(t.type&&t.type===r.type||t.name&&t.name===r.name||t.shortName&&t.shortName===r.shortName)&&(n=r);return n}a.RDNAttributesAsArray=function(e,t){for(var r,n,a,u=[],c=0;c<e.value.length;++c){r=e.value[c];for(var l=0;l<r.value.length;++l)a={},n=r.value[l],a.type=i.derToOid(n.value[0].value),a.value=n.value[1].value,a.valueTagClass=n.value[1].type,a.type in s&&(a.name=s[a.type],a.name in o&&(a.shortName=o[a.name])),t&&(t.update(a.type),t.update(a.value)),u.push(a)}return u},a.CRIAttributesAsArray=function(e){for(var t=[],r=0;r<e.length;++r)for(var n=e[r],u=i.derToOid(n.value[0].value),c=n.value[1].value,l=0;l<c.length;++l){var f={};if(f.type=u,f.value=c[l].value,f.valueTagClass=c[l].type,f.type in s&&(f.name=s[f.type],f.name in o&&(f.shortName=o[f.name])),f.type===s.extensionRequest){f.extensions=[];for(var h=0;h<f.value.length;++h)f.extensions.push(a.certificateExtensionFromAsn1(f.value[h]))}t.push(f)}return t};var d=function(e,t,r){var n={};if(e!==s["RSASSA-PSS"])return n;r&&(n={hash:{algorithmOid:s.sha1},mgf:{algorithmOid:s.mgf1,hash:{algorithmOid:s.sha1}},saltLength:20});var a={},o=[];if(!i.validate(t,l,a,o)){var u=new Error("Cannot read RSASSA-PSS parameter block.");throw u.errors=o,u}return void 0!==a.hashOid&&(n.hash=n.hash||{},n.hash.algorithmOid=i.derToOid(a.hashOid)),void 0!==a.maskGenOid&&(n.mgf=n.mgf||{},n.mgf.algorithmOid=i.derToOid(a.maskGenOid),n.mgf.hash=n.mgf.hash||{},n.mgf.hash.algorithmOid=i.derToOid(a.maskGenHashOid)),void 0!==a.saltLength&&(n.saltLength=a.saltLength.charCodeAt(0)),n};function y(e){for(var t,r,a=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),s=e.attributes,o=0;o<s.length;++o){var u=(t=s[o]).value,c=i.Type.PRINTABLESTRING;"valueTagClass"in t&&(c=t.valueTagClass)===i.Type.UTF8&&(u=n.util.encodeUtf8(u)),r=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.type).getBytes()),i.create(i.Class.UNIVERSAL,c,!1,u)])]),a.value.push(r)}return a}function g(e){for(var t,r=0;r<e.length;++r){if(void 0===(t=e[r]).name&&(t.type&&t.type in a.oids?t.name=a.oids[t.type]:t.shortName&&t.shortName in o&&(t.name=a.oids[o[t.shortName]])),void 0===t.type){if(!t.name||!(t.name in a.oids))throw(u=new Error("Attribute type not specified.")).attribute=t,u;t.type=a.oids[t.name]}if(void 0===t.shortName&&t.name&&t.name in o&&(t.shortName=o[t.name]),t.type===s.extensionRequest&&(t.valueConstructed=!0,t.valueTagClass=i.Type.SEQUENCE,!t.value&&t.extensions)){t.value=[];for(var n=0;n<t.extensions.length;++n)t.value.push(a.certificateExtensionToAsn1(m(t.extensions[n])))}var u;if(void 0===t.value)throw(u=new Error("Attribute value not specified.")).attribute=t,u}}function m(e,t){if(t=t||{},void 0===e.name&&e.id&&e.id in a.oids&&(e.name=a.oids[e.id]),void 0===e.id){if(!e.name||!(e.name in a.oids))throw(C=new Error("Extension ID not specified.")).extension=e,C;e.id=a.oids[e.name]}if(void 0!==e.value)return e;if("keyUsage"===e.name){var r=0,o=0,u=0;e.digitalSignature&&(o|=128,r=7),e.nonRepudiation&&(o|=64,r=6),e.keyEncipherment&&(o|=32,r=5),e.dataEncipherment&&(o|=16,r=4),e.keyAgreement&&(o|=8,r=3),e.keyCertSign&&(o|=4,r=2),e.cRLSign&&(o|=2,r=1),e.encipherOnly&&(o|=1,r=0),e.decipherOnly&&(u|=128,r=7);var c=String.fromCharCode(r);0!==u?c+=String.fromCharCode(o)+String.fromCharCode(u):0!==o&&(c+=String.fromCharCode(o)),e.value=i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,c)}else if("basicConstraints"===e.name)e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(i.create(i.Class.UNIVERSAL,i.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in e&&e.value.value.push(i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.pathLenConstraint).getBytes()));else if("extKeyUsage"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);var l=e.value.value;for(var f in e)!0===e[f]&&(f in s?l.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s[f]).getBytes())):-1!==f.indexOf(".")&&l.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(f).getBytes())))}else if("nsCertType"===e.name){r=0,o=0;e.client&&(o|=128,r=7),e.server&&(o|=64,r=6),e.email&&(o|=32,r=5),e.objsign&&(o|=16,r=4),e.reserved&&(o|=8,r=3),e.sslCA&&(o|=4,r=2),e.emailCA&&(o|=2,r=1),e.objCA&&(o|=1,r=0);c=String.fromCharCode(r);0!==o&&(c+=String.fromCharCode(o)),e.value=i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,c)}else if("subjectAltName"===e.name||"issuerAltName"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);for(var h=0;h<e.altNames.length;++h){c=(v=e.altNames[h]).value;if(7===v.type&&v.ip){if(null===(c=n.util.bytesFromIP(v.ip)))throw(C=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,C}else 8===v.type&&(c=v.oid?i.oidToDer(i.oidToDer(v.oid)):i.oidToDer(c));e.value.value.push(i.create(i.Class.CONTEXT_SPECIFIC,v.type,!1,c))}}else if("nsComment"===e.name&&t.cert){if(!/^[\x00-\x7F]*$/.test(e.comment)||e.comment.length<1||e.comment.length>128)throw new Error('Invalid "nsComment" content.');e.value=i.create(i.Class.UNIVERSAL,i.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var p=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=p.toHex(),e.value=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,p.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);l=e.value.value;if(e.keyIdentifier){var d=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;l.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!1,d))}if(e.authorityCertIssuer){var g=[i.create(i.Class.CONTEXT_SPECIFIC,4,!0,[y(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];l.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,g))}if(e.serialNumber){var m=n.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);l.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!1,m))}}else if("cRLDistributionPoints"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);l=e.value.value;var v,b=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),E=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(h=0;h<e.altNames.length;++h){c=(v=e.altNames[h]).value;if(7===v.type&&v.ip){if(null===(c=n.util.bytesFromIP(v.ip)))throw(C=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,C}else 8===v.type&&(c=v.oid?i.oidToDer(i.oidToDer(v.oid)):i.oidToDer(c));E.value.push(i.create(i.Class.CONTEXT_SPECIFIC,v.type,!1,c))}b.value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[E])),l.push(b)}var C;if(void 0===e.value)throw(C=new Error("Extension value not specified.")).extension=e,C;return e}function v(e,t){switch(e){case s["RSASSA-PSS"]:var r=[];return void 0!==t.hash.algorithmOid&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.hash.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])])),void 0!==t.mgf.algorithmOid&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.mgf.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.mgf.hash.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])])])),void 0!==t.saltLength&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(t.saltLength).getBytes())])),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,r);default:return i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")}}function b(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===e.attributes.length)return t;for(var r=e.attributes,a=0;a<r.length;++a){var s=r[a],o=s.value,u=i.Type.UTF8;"valueTagClass"in s&&(u=s.valueTagClass),u===i.Type.UTF8&&(o=n.util.encodeUtf8(o));var c=!1;"valueConstructed"in s&&(c=s.valueConstructed);var l=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s.type).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,u,c,o)])]);t.value.push(l)}return t}a.certificateFromPem=function(e,t,r){var s=n.pem.decode(e)[0];if("CERTIFICATE"!==s.type&&"X509 CERTIFICATE"!==s.type&&"TRUSTED CERTIFICATE"!==s.type){var o=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw o.headerType=s.type,o}if(s.procType&&"ENCRYPTED"===s.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var u=i.fromDer(s.body,r);return a.certificateFromAsn1(u,t)},a.certificateToPem=function(e,t){var r={type:"CERTIFICATE",body:i.toDer(a.certificateToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},a.publicKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("PUBLIC KEY"!==t.type&&"RSA PUBLIC KEY"!==t.type){var r=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert public key from PEM; PEM is encrypted.");var s=i.fromDer(t.body);return a.publicKeyFromAsn1(s)},a.publicKeyToPem=function(e,t){var r={type:"PUBLIC KEY",body:i.toDer(a.publicKeyToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},a.publicKeyToRSAPublicKeyPem=function(e,t){var r={type:"RSA PUBLIC KEY",body:i.toDer(a.publicKeyToRSAPublicKey(e)).getBytes()};return n.pem.encode(r,{maxline:t})},a.getPublicKeyFingerprint=function(e,t){var r,s=(t=t||{}).md||n.md.sha1.create();switch(t.type||"RSAPublicKey"){case"RSAPublicKey":r=i.toDer(a.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":r=i.toDer(a.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+t.type+'".')}s.start(),s.update(r);var o=s.digest();if("hex"===t.encoding){var u=o.toHex();return t.delimiter?u.match(/.{2}/g).join(t.delimiter):u}if("binary"===t.encoding)return o.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".');return o},a.certificationRequestFromPem=function(e,t,r){var s=n.pem.decode(e)[0];if("CERTIFICATE REQUEST"!==s.type){var o=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw o.headerType=s.type,o}if(s.procType&&"ENCRYPTED"===s.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var u=i.fromDer(s.body,r);return a.certificationRequestFromAsn1(u,t)},a.certificationRequestToPem=function(e,t){var r={type:"CERTIFICATE REQUEST",body:i.toDer(a.certificationRequestToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},a.createCertificate=function(){var e={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return p(e.issuer,t)},e.issuer.addField=function(t){g([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return p(e.subject,t)},e.subject.addField=function(t){g([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,r){g(t),e.subject.attributes=t,delete e.subject.uniqueId,r&&(e.subject.uniqueId=r),e.subject.hash=null},e.setIssuer=function(t,r){g(t),e.issuer.attributes=t,delete e.issuer.uniqueId,r&&(e.issuer.uniqueId=r),e.issuer.hash=null},e.setExtensions=function(t){for(var r=0;r<t.length;++r)m(t[r],{cert:e});e.extensions=t},e.getExtension=function(t){"string"==typeof t&&(t={name:t});for(var r,n=null,i=0;null===n&&i<e.extensions.length;++i)r=e.extensions[i],(t.id&&r.id===t.id||t.name&&r.name===t.name)&&(n=r);return n},e.sign=function(t,r){e.md=r||n.md.sha1.create();var o=s[e.md.algorithm+"WithRSAEncryption"];if(!o){var u=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw u.algorithm=e.md.algorithm,u}e.signatureOid=e.siginfo.algorithmOid=o,e.tbsCertificate=a.getTBSCertificate(e);var c=i.toDer(e.tbsCertificate);e.md.update(c.getBytes()),e.signature=t.sign(e.md)},e.verify=function(t){var r=!1;if(!e.issued(t)){var o=t.issuer,u=e.subject;throw(y=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.")).expectedIssuer=o.attributes,y.actualIssuer=u.attributes,y}var c=t.md;if(null===c){if(t.signatureOid in s)switch(s[t.signatureOid]){case"sha1WithRSAEncryption":c=n.md.sha1.create();break;case"md5WithRSAEncryption":c=n.md.md5.create();break;case"sha256WithRSAEncryption":c=n.md.sha256.create();break;case"sha384WithRSAEncryption":c=n.md.sha384.create();break;case"sha512WithRSAEncryption":c=n.md.sha512.create();break;case"RSASSA-PSS":c=n.md.sha256.create()}if(null===c)throw(y=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=t.signatureOid,y;var l=t.tbsCertificate||a.getTBSCertificate(t),f=i.toDer(l);c.update(f.getBytes())}if(null!==c){var h;switch(t.signatureOid){case s.sha1WithRSAEncryption:h=void 0;break;case s["RSASSA-PSS"]:var p,d,y;if(void 0===(p=s[t.signatureParameters.mgf.hash.algorithmOid])||void 0===n.md[p])throw(y=new Error("Unsupported MGF hash function.")).oid=t.signatureParameters.mgf.hash.algorithmOid,y.name=p,y;if(void 0===(d=s[t.signatureParameters.mgf.algorithmOid])||void 0===n.mgf[d])throw(y=new Error("Unsupported MGF function.")).oid=t.signatureParameters.mgf.algorithmOid,y.name=d,y;if(d=n.mgf[d].create(n.md[p].create()),void 0===(p=s[t.signatureParameters.hash.algorithmOid])||void 0===n.md[p])throw{message:"Unsupported RSASSA-PSS hash function.",oid:t.signatureParameters.hash.algorithmOid,name:p};h=n.pss.create(n.md[p].create(),d,t.signatureParameters.saltLength)}r=e.publicKey.verify(c.digest().getBytes(),t.signature,h)}return r},e.isIssuer=function(t){var r=!1,n=e.issuer,i=t.subject;if(n.hash&&i.hash)r=n.hash===i.hash;else if(n.attributes.length===i.attributes.length){var a,s;r=!0;for(var o=0;r&&o<n.attributes.length;++o)a=n.attributes[o],s=i.attributes[o],a.type===s.type&&a.value===s.value||(r=!1)}return r},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return a.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=s.subjectKeyIdentifier,r=0;r<e.extensions.length;++r){var i=e.extensions[r];if(i.id===t){var a=e.generateSubjectKeyIdentifier().getBytes();return n.util.hexToBytes(i.subjectKeyIdentifier)===a}}return!1},e},a.certificateFromAsn1=function(e,t){var r={},o=[];if(!i.validate(e,c,r,o))throw(h=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.")).errors=o,h;if(i.derToOid(r.publicKeyOid)!==a.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var u=a.createCertificate();u.version=r.certVersion?r.certVersion.charCodeAt(0):0;var l=n.util.createBuffer(r.certSerialNumber);u.serialNumber=l.toHex(),u.signatureOid=n.asn1.derToOid(r.certSignatureOid),u.signatureParameters=d(u.signatureOid,r.certSignatureParams,!0),u.siginfo.algorithmOid=n.asn1.derToOid(r.certinfoSignatureOid),u.siginfo.parameters=d(u.siginfo.algorithmOid,r.certinfoSignatureParams,!1),u.signature=r.certSignature;var f=[];if(void 0!==r.certValidity1UTCTime&&f.push(i.utcTimeToDate(r.certValidity1UTCTime)),void 0!==r.certValidity2GeneralizedTime&&f.push(i.generalizedTimeToDate(r.certValidity2GeneralizedTime)),void 0!==r.certValidity3UTCTime&&f.push(i.utcTimeToDate(r.certValidity3UTCTime)),void 0!==r.certValidity4GeneralizedTime&&f.push(i.generalizedTimeToDate(r.certValidity4GeneralizedTime)),f.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(f.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(u.validity.notBefore=f[0],u.validity.notAfter=f[1],u.tbsCertificate=r.tbsCertificate,t){var h;if(u.md=null,u.signatureOid in s)switch(s[u.signatureOid]){case"sha1WithRSAEncryption":u.md=n.md.sha1.create();break;case"md5WithRSAEncryption":u.md=n.md.md5.create();break;case"sha256WithRSAEncryption":u.md=n.md.sha256.create();break;case"sha384WithRSAEncryption":u.md=n.md.sha384.create();break;case"sha512WithRSAEncryption":u.md=n.md.sha512.create();break;case"RSASSA-PSS":u.md=n.md.sha256.create()}if(null===u.md)throw(h=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=u.signatureOid,h;var y=i.toDer(u.tbsCertificate);u.md.update(y.getBytes())}var m=n.md.sha1.create();u.issuer.getField=function(e){return p(u.issuer,e)},u.issuer.addField=function(e){g([e]),u.issuer.attributes.push(e)},u.issuer.attributes=a.RDNAttributesAsArray(r.certIssuer,m),r.certIssuerUniqueId&&(u.issuer.uniqueId=r.certIssuerUniqueId),u.issuer.hash=m.digest().toHex();var v=n.md.sha1.create();return u.subject.getField=function(e){return p(u.subject,e)},u.subject.addField=function(e){g([e]),u.subject.attributes.push(e)},u.subject.attributes=a.RDNAttributesAsArray(r.certSubject,v),r.certSubjectUniqueId&&(u.subject.uniqueId=r.certSubjectUniqueId),u.subject.hash=v.digest().toHex(),r.certExtensions?u.extensions=a.certificateExtensionsFromAsn1(r.certExtensions):u.extensions=[],u.publicKey=a.publicKeyFromAsn1(r.subjectPublicKeyInfo),u},a.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r<e.value.length;++r)for(var n=e.value[r],i=0;i<n.value.length;++i)t.push(a.certificateExtensionFromAsn1(n.value[i]));return t},a.certificateExtensionFromAsn1=function(e){var t={};if(t.id=i.derToOid(e.value[0].value),t.critical=!1,e.value[1].type===i.Type.BOOLEAN?(t.critical=0!==e.value[1].value.charCodeAt(0),t.value=e.value[2].value):t.value=e.value[1].value,t.id in s)if(t.name=s[t.id],"keyUsage"===t.name){var r=0,a=0;(u=i.fromDer(t.value)).value.length>1&&(r=u.value.charCodeAt(1),a=u.value.length>2?u.value.charCodeAt(2):0),t.digitalSignature=128==(128&r),t.nonRepudiation=64==(64&r),t.keyEncipherment=32==(32&r),t.dataEncipherment=16==(16&r),t.keyAgreement=8==(8&r),t.keyCertSign=4==(4&r),t.cRLSign=2==(2&r),t.encipherOnly=1==(1&r),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){(u=i.fromDer(t.value)).value.length>0&&u.value[0].type===i.Type.BOOLEAN?t.cA=0!==u.value[0].value.charCodeAt(0):t.cA=!1;var o=null;u.value.length>0&&u.value[0].type===i.Type.INTEGER?o=u.value[0].value:u.value.length>1&&(o=u.value[1].value),null!==o&&(t.pathLenConstraint=i.derToInteger(o))}else if("extKeyUsage"===t.name)for(var u=i.fromDer(t.value),c=0;c<u.value.length;++c){var l=i.derToOid(u.value[c].value);l in s?t[s[l]]=!0:t[l]=!0}else if("nsCertType"===t.name){r=0;(u=i.fromDer(t.value)).value.length>1&&(r=u.value.charCodeAt(1)),t.client=128==(128&r),t.server=64==(64&r),t.email=32==(32&r),t.objsign=16==(16&r),t.reserved=8==(8&r),t.sslCA=4==(4&r),t.emailCA=2==(2&r),t.objCA=1==(1&r)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){var f;t.altNames=[];u=i.fromDer(t.value);for(var h=0;h<u.value.length;++h){var p={type:(f=u.value[h]).type,value:f.value};switch(t.altNames.push(p),f.type){case 1:case 2:case 6:break;case 7:p.ip=n.util.bytesToIP(f.value);break;case 8:p.oid=i.derToOid(f.value)}}}else if("subjectKeyIdentifier"===t.name){u=i.fromDer(t.value);t.subjectKeyIdentifier=n.util.bytesToHex(u.value)}return t},a.certificationRequestFromAsn1=function(e,t){var r={},o=[];if(!i.validate(e,h,r,o))throw(c=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.")).errors=o,c;if(i.derToOid(r.publicKeyOid)!==a.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var u=a.createCertificationRequest();if(u.version=r.csrVersion?r.csrVersion.charCodeAt(0):0,u.signatureOid=n.asn1.derToOid(r.csrSignatureOid),u.signatureParameters=d(u.signatureOid,r.csrSignatureParams,!0),u.siginfo.algorithmOid=n.asn1.derToOid(r.csrSignatureOid),u.siginfo.parameters=d(u.siginfo.algorithmOid,r.csrSignatureParams,!1),u.signature=r.csrSignature,u.certificationRequestInfo=r.certificationRequestInfo,t){var c;if(u.md=null,u.signatureOid in s)switch(s[u.signatureOid]){case"sha1WithRSAEncryption":u.md=n.md.sha1.create();break;case"md5WithRSAEncryption":u.md=n.md.md5.create();break;case"sha256WithRSAEncryption":u.md=n.md.sha256.create();break;case"sha384WithRSAEncryption":u.md=n.md.sha384.create();break;case"sha512WithRSAEncryption":u.md=n.md.sha512.create();break;case"RSASSA-PSS":u.md=n.md.sha256.create()}if(null===u.md)throw(c=new Error("Could not compute certification request digest. Unknown signature OID.")).signatureOid=u.signatureOid,c;var l=i.toDer(u.certificationRequestInfo);u.md.update(l.getBytes())}var f=n.md.sha1.create();return u.subject.getField=function(e){return p(u.subject,e)},u.subject.addField=function(e){g([e]),u.subject.attributes.push(e)},u.subject.attributes=a.RDNAttributesAsArray(r.certificationRequestInfoSubject,f),u.subject.hash=f.digest().toHex(),u.publicKey=a.publicKeyFromAsn1(r.subjectPublicKeyInfo),u.getAttribute=function(e){return p(u,e)},u.addAttribute=function(e){g([e]),u.attributes.push(e)},u.attributes=a.CRIAttributesAsArray(r.certificationRequestInfoAttributes||[]),u},a.createCertificationRequest=function(){var e={version:0,signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return p(e.subject,t)},e.subject.addField=function(t){g([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return p(e,t)},e.addAttribute=function(t){g([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){g(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){g(t),e.attributes=t},e.sign=function(t,r){e.md=r||n.md.sha1.create();var o=s[e.md.algorithm+"WithRSAEncryption"];if(!o){var u=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw u.algorithm=e.md.algorithm,u}e.signatureOid=e.siginfo.algorithmOid=o,e.certificationRequestInfo=a.getCertificationRequestInfo(e);var c=i.toDer(e.certificationRequestInfo);e.md.update(c.getBytes()),e.signature=t.sign(e.md)},e.verify=function(){var t=!1,r=e.md;if(null===r){if(e.signatureOid in s)switch(s[e.signatureOid]){case"sha1WithRSAEncryption":r=n.md.sha1.create();break;case"md5WithRSAEncryption":r=n.md.md5.create();break;case"sha256WithRSAEncryption":r=n.md.sha256.create();break;case"sha384WithRSAEncryption":r=n.md.sha384.create();break;case"sha512WithRSAEncryption":r=n.md.sha512.create();break;case"RSASSA-PSS":r=n.md.sha256.create()}if(null===r)throw(h=new Error("Could not compute certification request digest. Unknown signature OID.")).signatureOid=e.signatureOid,h;var o=e.certificationRequestInfo||a.getCertificationRequestInfo(e),u=i.toDer(o);r.update(u.getBytes())}if(null!==r){var c;switch(e.signatureOid){case s.sha1WithRSAEncryption:break;case s["RSASSA-PSS"]:var l,f,h;if(void 0===(l=s[e.signatureParameters.mgf.hash.algorithmOid])||void 0===n.md[l])throw(h=new Error("Unsupported MGF hash function.")).oid=e.signatureParameters.mgf.hash.algorithmOid,h.name=l,h;if(void 0===(f=s[e.signatureParameters.mgf.algorithmOid])||void 0===n.mgf[f])throw(h=new Error("Unsupported MGF function.")).oid=e.signatureParameters.mgf.algorithmOid,h.name=f,h;if(f=n.mgf[f].create(n.md[l].create()),void 0===(l=s[e.signatureParameters.hash.algorithmOid])||void 0===n.md[l])throw(h=new Error("Unsupported RSASSA-PSS hash function.")).oid=e.signatureParameters.hash.algorithmOid,h.name=l,h;c=n.pss.create(n.md[l].create(),f,e.signatureParameters.saltLength)}t=e.publicKey.verify(r.digest().getBytes(),e.signature,c)}return t},e};var E=new Date("1950-01-01T00:00:00Z"),C=new Date("2050-01-01T00:00:00Z");function S(e){return e>=E&&e<C?i.create(i.Class.UNIVERSAL,i.Type.UTCTIME,!1,i.dateToUtcTime(e)):i.create(i.Class.UNIVERSAL,i.Type.GENERALIZEDTIME,!1,i.dateToGeneralizedTime(e))}a.getTBSCertificate=function(e){var t=S(e.validity.notBefore),r=S(e.validity.notAfter),s=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes())]),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(e.serialNumber)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.siginfo.algorithmOid).getBytes()),v(e.siginfo.algorithmOid,e.siginfo.parameters)]),y(e.issuer),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,r]),y(e.subject),a.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&s.value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.issuer.uniqueId)])),e.subject.uniqueId&&s.value.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!0,[i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.subject.uniqueId)])),e.extensions.length>0&&s.value.push(a.certificateExtensionsToAsn1(e.extensions)),s},a.getCertificationRequestInfo=function(e){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),y(e.subject),a.publicKeyToAsn1(e.publicKey),b(e)])},a.distinguishedNameToAsn1=function(e){return y(e)},a.certificateToAsn1=function(e){var t=e.tbsCertificate||a.getTBSCertificate(e);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureOid).getBytes()),v(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},a.certificateExtensionsToAsn1=function(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,3,!0,[]),r=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;n<e.length;++n)r.value.push(a.certificateExtensionToAsn1(e[n]));return t},a.certificateExtensionToAsn1=function(e){var t=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.id).getBytes())),e.critical&&t.value.push(i.create(i.Class.UNIVERSAL,i.Type.BOOLEAN,!1,String.fromCharCode(255)));var r=e.value;return"string"!=typeof e.value&&(r=i.toDer(r).getBytes()),t.value.push(i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,r)),t},a.certificationRequestToAsn1=function(e){var t=e.certificationRequestInfo||a.getCertificationRequestInfo(e);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureOid).getBytes()),v(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},a.createCaStore=function(e){var t={certs:{}};function r(e){return s(e),t.certs[e.hash]||null}function s(e){if(!e.hash){var t=n.md.sha1.create();e.attributes=a.RDNAttributesAsArray(y(e),t),e.hash=t.digest().toHex()}}if(t.getIssuer=function(e){return r(e.issuer)},t.addCertificate=function(e){if("string"==typeof e&&(e=n.pki.certificateFromPem(e)),s(e.subject),!t.hasCertificate(e))if(e.subject.hash in t.certs){var r=t.certs[e.subject.hash];n.util.isArray(r)||(r=[r]),r.push(e),t.certs[e.subject.hash]=r}else t.certs[e.subject.hash]=e},t.hasCertificate=function(e){"string"==typeof e&&(e=n.pki.certificateFromPem(e));var t=r(e.subject);if(!t)return!1;n.util.isArray(t)||(t=[t]);for(var s=i.toDer(a.certificateToAsn1(e)).getBytes(),o=0;o<t.length;++o){if(s===i.toDer(a.certificateToAsn1(t[o])).getBytes())return!0}return!1},t.listAllCertificates=function(){var e=[];for(var r in t.certs)if(t.certs.hasOwnProperty(r)){var i=t.certs[r];if(n.util.isArray(i))for(var a=0;a<i.length;++a)e.push(i[a]);else e.push(i)}return e},t.removeCertificate=function(e){var o;if("string"==typeof e&&(e=n.pki.certificateFromPem(e)),s(e.subject),!t.hasCertificate(e))return null;var u=r(e.subject);if(!n.util.isArray(u))return o=t.certs[e.subject.hash],delete t.certs[e.subject.hash],o;for(var c=i.toDer(a.certificateToAsn1(e)).getBytes(),l=0;l<u.length;++l){c===i.toDer(a.certificateToAsn1(u[l])).getBytes()&&(o=u[l],u.splice(l,1))}return 0===u.length&&delete t.certs[e.subject.hash],o},e)for(var o=0;o<e.length;++o){var u=e[o];t.addCertificate(u)}return t},a.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},a.verifyCertificateChain=function(e,t,r){"function"==typeof r&&(r={verify:r}),r=r||{};var i=(t=t.slice(0)).slice(0),s=r.validityCheckDate;void 0===s&&(s=new Date);var o=!0,u=null,c=0;do{var l=t.shift(),f=null,h=!1;if(s&&(s<l.validity.notBefore||s>l.validity.notAfter)&&(u={message:"Certificate is not valid yet or has expired.",error:a.certificateError.certificate_expired,notBefore:l.validity.notBefore,notAfter:l.validity.notAfter,now:s}),null===u){if(null===(f=t[0]||e.getIssuer(l))&&l.isIssuer(l)&&(h=!0,f=l),f){var p=f;n.util.isArray(p)||(p=[p]);for(var d=!1;!d&&p.length>0;){f=p.shift();try{d=f.verify(l)}catch(e){}}d||(u={message:"Certificate signature is invalid.",error:a.certificateError.bad_certificate})}null!==u||f&&!h||e.hasCertificate(l)||(u={message:"Certificate is not trusted.",error:a.certificateError.unknown_ca})}if(null===u&&f&&!l.isIssuer(f)&&(u={message:"Certificate issuer is invalid.",error:a.certificateError.bad_certificate}),null===u)for(var y={keyUsage:!0,basicConstraints:!0},g=0;null===u&&g<l.extensions.length;++g){var m=l.extensions[g];m.critical&&!(m.name in y)&&(u={message:"Certificate has an unsupported critical extension.",error:a.certificateError.unsupported_certificate})}if(null===u&&(!o||0===t.length&&(!f||h))){var v=l.getExtension("basicConstraints"),b=l.getExtension("keyUsage");if(null!==b&&(b.keyCertSign&&null!==v||(u={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:a.certificateError.bad_certificate})),null!==u||null===v||v.cA||(u={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:a.certificateError.bad_certificate}),null===u&&null!==b&&"pathLenConstraint"in v)c-1>v.pathLenConstraint&&(u={message:"Certificate basicConstraints pathLenConstraint violated.",error:a.certificateError.bad_certificate})}var E=null===u||u.error,C=r.verify?r.verify(E,c,i):E;if(!0!==C)throw!0===E&&(u={message:"The application rejected the certificate.",error:a.certificateError.bad_certificate}),(C||0===C)&&("object"!=typeof C||n.util.isArray(C)?"string"==typeof C&&(u.error=C):(C.message&&(u.message=C.message),C.error&&(u.error=C.error))),u;u=null,o=!1,++c}while(t.length>0);return!0}},function(e,t,r){var n=r(0);r(7),r(1),(e.exports=n.pss=n.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,i=e.mgf,a=r.digestLength,s=e.salt||null;if("string"==typeof s&&(s=n.util.createBuffer(s)),"saltLength"in e)t=e.saltLength;else{if(null===s)throw new Error("Salt length not specified or specific salt not given.");t=s.length()}if(null!==s&&s.length()!==t)throw new Error("Given salt length does not match length of given salt.");var o=e.prng||n.random,u={encode:function(e,u){var c,l,f=u-1,h=Math.ceil(f/8),p=e.digest().getBytes();if(h<a+t+2)throw new Error("Message is too long to encrypt.");l=null===s?o.getBytesSync(t):s.bytes();var d=new n.util.ByteBuffer;d.fillWithByte(0,8),d.putBytes(p),d.putBytes(l),r.start(),r.update(d.getBytes());var y=r.digest().getBytes(),g=new n.util.ByteBuffer;g.fillWithByte(0,h-t-a-2),g.putByte(1),g.putBytes(l);var m=g.getBytes(),v=h-a-1,b=i.generate(y,v),E="";for(c=0;c<v;c++)E+=String.fromCharCode(m.charCodeAt(c)^b.charCodeAt(c));var C=65280>>8*h-f&255;return(E=String.fromCharCode(E.charCodeAt(0)&~C)+E.substr(1))+y+String.fromCharCode(188)},verify:function(e,s,o){var u,c=o-1,l=Math.ceil(c/8);if(s=s.substr(-l),l<a+t+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==s.charCodeAt(l-1))throw new Error("Encoded message does not end in 0xBC.");var f=l-a-1,h=s.substr(0,f),p=s.substr(f,a),d=65280>>8*l-c&255;if(0!=(h.charCodeAt(0)&d))throw new Error("Bits beyond keysize not zero as expected.");var y=i.generate(p,f),g="";for(u=0;u<f;u++)g+=String.fromCharCode(h.charCodeAt(u)^y.charCodeAt(u));g=String.fromCharCode(g.charCodeAt(0)&~d)+g.substr(1);var m=l-a-t-2;for(u=0;u<m;u++)if(0!==g.charCodeAt(u))throw new Error("Leftmost octets not zero as expected");if(1!==g.charCodeAt(m))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var v=g.substr(-t),b=new n.util.ByteBuffer;return b.fillWithByte(0,8),b.putBytes(e),b.putBytes(v),r.start(),r.update(b.getBytes()),p===r.digest().getBytes()}};return u}},function(e,t,r){var n=r(0);r(4),r(1);var i=e.exports=n.md5=n.md5||{};n.md.md5=n.md.algorithms.md5=i,i.create=function(){c||function(){a=String.fromCharCode(128),a+=n.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],o=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],u=new Array(64);for(var e=0;e<64;++e)u[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));c=!0}();var e=null,t=n.util.createBuffer(),r=new Array(16),i={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,a=0;a<r;++a)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},i}};return i.start(),i.update=function(a,s){"utf8"===s&&(a=n.util.encodeUtf8(a));var o=a.length;i.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var u=i.fullMessageLength.length-1;u>=0;--u)i.fullMessageLength[u]+=o[1],o[1]=o[0]+(i.fullMessageLength[u]/4294967296>>>0),i.fullMessageLength[u]=i.fullMessageLength[u]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(a),l(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var o=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;s.putBytes(a.substr(0,i.blockLength-o));for(var u,c=0,f=i.fullMessageLength.length-1;f>=0;--f)c=(u=8*i.fullMessageLength[f]+c)/4294967296>>>0,s.putInt32Le(u>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};l(h,r,s);var p=n.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},i};var a=null,s=null,o=null,u=null,c=!1;function l(e,t,r){for(var n,i,a,c,l,f,h,p=r.length();p>=64;){for(i=e.h0,a=e.h1,c=e.h2,l=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),n=i+(l^a&(c^l))+u[h]+t[h],i=l,l=c,c=a,a+=n<<(f=o[h])|n>>>32-f;for(;h<32;++h)n=i+(c^l&(a^c))+u[h]+t[s[h]],i=l,l=c,c=a,a+=n<<(f=o[h])|n>>>32-f;for(;h<48;++h)n=i+(a^c^l)+u[h]+t[s[h]],i=l,l=c,c=a,a+=n<<(f=o[h])|n>>>32-f;for(;h<64;++h)n=i+(c^(a|~l))+u[h]+t[s[h]],i=l,l=c,c=a,a+=n<<(f=o[h])|n>>>32-f;e.h0=e.h0+i|0,e.h1=e.h1+a|0,e.h2=e.h2+c|0,e.h3=e.h3+l|0,p-=64}}},function(e,t,r){"use strict";t.__esModule=!0,t.default=function(e,t){return new URL(e,t).toString()}},function(e,t,r){"use strict";t.__esModule=!0;var n=new RegExp('((?!\\\\)"\\w+"):\\s*(-?[\\d|\\.]{14,})',"g");t.default=function(e){return JSON.parse(e.replace(n,'$1:"$2"'))}},function(e,t,r){"use strict";t.__esModule=!0;var n=["amount","matcherFee","price","fee","minSponsoredAssetFee","quantity","sellMatcherFee","buyMatcherFee"];t.default=function(e){return JSON.stringify(e,(function(e,t){return n.includes(e)||"value"===e&&"integer"===this.type?"!"+t+"!":t}),0).replace(/"\!(-?\d+)\!"/g,"$1")}},function(e,t,r){!function(e){"use strict";var t=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,r=Math.ceil,n=Math.floor,i="[BigNumber Error] ",a=i+"Number primitive has more than 15 significant digits: ",s=1e14,o=14,u=9007199254740991,c=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],l=1e7,f=1e9;function h(e){var t=0|e;return e>0||e===t?t:t-1}function p(e){for(var t,r,n=1,i=e.length,a=e[0]+"";n<i;){for(t=e[n++]+"",r=o-t.length;r--;t="0"+t);a+=t}for(i=a.length;48===a.charCodeAt(--i););return a.slice(0,i+1||1)}function d(e,t){var r,n,i=e.c,a=t.c,s=e.s,o=t.s,u=e.e,c=t.e;if(!s||!o)return null;if(r=i&&!i[0],n=a&&!a[0],r||n)return r?n?0:-o:s;if(s!=o)return s;if(r=s<0,n=u==c,!i||!a)return n?0:!i^r?1:-1;if(!n)return u>c^r?1:-1;for(o=(u=i.length)<(c=a.length)?u:c,s=0;s<o;s++)if(i[s]!=a[s])return i[s]>a[s]^r?1:-1;return u==c?0:u>c^r?1:-1}function y(e,t,r,a){if(e<t||e>r||e!==n(e))throw Error(i+(a||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function g(e){var t=e.c.length-1;return h(e.e/o)==t&&e.c[t]%2!=0}function m(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function v(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var b=function e(b){var E,C,S,T,A,I,w,B,_,N=F.prototype={constructor:F,toString:null,valueOf:null},R=new F(1),k=20,U=4,P=-7,O=21,L=-1e7,D=1e7,M=!1,x=1,V=0,K={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},j="0123456789abcdefghijklmnopqrstuvwxyz";function F(e,r){var i,s,c,l,f,h,p,d,g=this;if(!(g instanceof F))return new F(e,r);if(null==r){if(e&&!0===e._isBigNumber)return g.s=e.s,void(!e.c||e.e>D?g.c=g.e=null:e.e<L?g.c=[g.e=0]:(g.e=e.e,g.c=e.c.slice()));if((h="number"==typeof e)&&0*e==0){if(g.s=1/e<0?(e=-e,-1):1,e===~~e){for(l=0,f=e;f>=10;f/=10,l++);return void(l>D?g.c=g.e=null:(g.e=l,g.c=[e]))}d=String(e)}else{if(!t.test(d=String(e)))return S(g,d,h);g.s=45==d.charCodeAt(0)?(d=d.slice(1),-1):1}(l=d.indexOf("."))>-1&&(d=d.replace(".","")),(f=d.search(/e/i))>0?(l<0&&(l=f),l+=+d.slice(f+1),d=d.substring(0,f)):l<0&&(l=d.length)}else{if(y(r,2,j.length,"Base"),10==r)return H(g=new F(e),k+g.e+1,U);if(d=String(e),h="number"==typeof e){if(0*e!=0)return S(g,d,h,r);if(g.s=1/e<0?(d=d.slice(1),-1):1,F.DEBUG&&d.replace(/^0\.0*|\./,"").length>15)throw Error(a+e)}else g.s=45===d.charCodeAt(0)?(d=d.slice(1),-1):1;for(i=j.slice(0,r),l=f=0,p=d.length;f<p;f++)if(i.indexOf(s=d.charAt(f))<0){if("."==s){if(f>l){l=p;continue}}else if(!c&&(d==d.toUpperCase()&&(d=d.toLowerCase())||d==d.toLowerCase()&&(d=d.toUpperCase()))){c=!0,f=-1,l=0;continue}return S(g,String(e),h,r)}h=!1,(l=(d=C(d,r,10,g.s)).indexOf("."))>-1?d=d.replace(".",""):l=d.length}for(f=0;48===d.charCodeAt(f);f++);for(p=d.length;48===d.charCodeAt(--p););if(d=d.slice(f,++p)){if(p-=f,h&&F.DEBUG&&p>15&&(e>u||e!==n(e)))throw Error(a+g.s*e);if((l=l-f-1)>D)g.c=g.e=null;else if(l<L)g.c=[g.e=0];else{if(g.e=l,g.c=[],f=(l+1)%o,l<0&&(f+=o),f<p){for(f&&g.c.push(+d.slice(0,f)),p-=o;f<p;)g.c.push(+d.slice(f,f+=o));f=o-(d=d.slice(f)).length}else f-=p;for(;f--;d+="0");g.c.push(+d)}}else g.c=[g.e=0]}function q(e,t,r,n){var i,a,s,o,u;if(null==r?r=U:y(r,0,8),!e.c)return e.toString();if(i=e.c[0],s=e.e,null==t)u=p(e.c),u=1==n||2==n&&(s<=P||s>=O)?m(u,s):v(u,s,"0");else if(a=(e=H(new F(e),t,r)).e,o=(u=p(e.c)).length,1==n||2==n&&(t<=a||a<=P)){for(;o<t;u+="0",o++);u=m(u,a)}else if(t-=s,u=v(u,a,"0"),a+1>o){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=a-o)>0)for(a+1==o&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function z(e,t){for(var r,n=1,i=new F(e[0]);n<e.length;n++){if(!(r=new F(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function G(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+r*o-1)>D?e.c=e.e=null:r<L?e.c=[e.e=0]:(e.e=r,e.c=t),e}function H(e,t,i,a){var u,l,f,h,p,d,y,g=e.c,m=c;if(g){e:{for(u=1,h=g[0];h>=10;h/=10,u++);if((l=t-u)<0)l+=o,f=t,y=(p=g[d=0])/m[u-f-1]%10|0;else if((d=r((l+1)/o))>=g.length){if(!a)break e;for(;g.length<=d;g.push(0));p=y=0,u=1,f=(l%=o)-o+1}else{for(p=h=g[d],u=1;h>=10;h/=10,u++);y=(f=(l%=o)-o+u)<0?0:p/m[u-f-1]%10|0}if(a=a||t<0||null!=g[d+1]||(f<0?p:p%m[u-f-1]),a=i<4?(y||a)&&(0==i||i==(e.s<0?3:2)):y>5||5==y&&(4==i||a||6==i&&(l>0?f>0?p/m[u-f]:0:g[d-1])%10&1||i==(e.s<0?8:7)),t<1||!g[0])return g.length=0,a?(t-=e.e+1,g[0]=m[(o-t%o)%o],e.e=-t||0):g[0]=e.e=0,e;if(0==l?(g.length=d,h=1,d--):(g.length=d+1,h=m[o-l],g[d]=f>0?n(p/m[u-f]%m[f])*h:0),a)for(;;){if(0==d){for(l=1,f=g[0];f>=10;f/=10,l++);for(f=g[0]+=h,h=1;f>=10;f/=10,h++);l!=h&&(e.e++,g[0]==s&&(g[0]=1));break}if(g[d]+=h,g[d]!=s)break;g[d--]=0,h=1}for(l=g.length;0===g[--l];g.pop());}e.e>D?e.c=e.e=null:e.e<L&&(e.c=[e.e=0])}return e}function Y(e){var t,r=e.e;return null===r?e.toString():(t=p(e.c),t=r<=P||r>=O?m(t,r):v(t,r,"0"),e.s<0?"-"+t:t)}return F.clone=e,F.ROUND_UP=0,F.ROUND_DOWN=1,F.ROUND_CEIL=2,F.ROUND_FLOOR=3,F.ROUND_HALF_UP=4,F.ROUND_HALF_DOWN=5,F.ROUND_HALF_EVEN=6,F.ROUND_HALF_CEIL=7,F.ROUND_HALF_FLOOR=8,F.EUCLID=9,F.config=F.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(i+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(y(r=e[t],0,f,t),k=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(y(r=e[t],0,8,t),U=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(y(r[0],-f,0,t),y(r[1],0,f,t),P=r[0],O=r[1]):(y(r,-f,f,t),P=-(O=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)y(r[0],-f,-1,t),y(r[1],1,f,t),L=r[0],D=r[1];else{if(y(r,-f,f,t),!r)throw Error(i+t+" cannot be zero: "+r);L=-(D=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(i+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw M=!r,Error(i+"crypto unavailable");M=r}else M=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(y(r=e[t],0,9,t),x=r),e.hasOwnProperty(t="POW_PRECISION")&&(y(r=e[t],0,f,t),V=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(i+t+" not an object: "+r);K=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(i+t+" invalid: "+r);j=r}}return{DECIMAL_PLACES:k,ROUNDING_MODE:U,EXPONENTIAL_AT:[P,O],RANGE:[L,D],CRYPTO:M,MODULO_MODE:x,POW_PRECISION:V,FORMAT:K,ALPHABET:j}},F.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!F.DEBUG)return!0;var t,r,a=e.c,u=e.e,c=e.s;e:if("[object Array]"=={}.toString.call(a)){if((1===c||-1===c)&&u>=-f&&u<=f&&u===n(u)){if(0===a[0]){if(0===u&&1===a.length)return!0;break e}if((t=(u+1)%o)<1&&(t+=o),String(a[0]).length==t){for(t=0;t<a.length;t++)if((r=a[t])<0||r>=s||r!==n(r))break e;if(0!==r)return!0}}}else if(null===a&&null===u&&(null===c||1===c||-1===c))return!0;throw Error(i+"Invalid BigNumber: "+e)},F.maximum=F.max=function(){return z(arguments,N.lt)},F.minimum=F.min=function(){return z(arguments,N.gt)},F.random=(T=9007199254740992*Math.random()&2097151?function(){return n(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,a,s,u,l,h=0,p=[],d=new F(R);if(null==e?e=k:y(e,0,f),u=r(e/o),M)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(u*=2));h<u;)(l=131072*t[h]+(t[h+1]>>>11))>=9e15?(a=crypto.getRandomValues(new Uint32Array(2)),t[h]=a[0],t[h+1]=a[1]):(p.push(l%1e14),h+=2);h=u/2}else{if(!crypto.randomBytes)throw M=!1,Error(i+"crypto unavailable");for(t=crypto.randomBytes(u*=7);h<u;)(l=281474976710656*(31&t[h])+1099511627776*t[h+1]+4294967296*t[h+2]+16777216*t[h+3]+(t[h+4]<<16)+(t[h+5]<<8)+t[h+6])>=9e15?crypto.randomBytes(7).copy(t,h):(p.push(l%1e14),h+=7);h=u/7}if(!M)for(;h<u;)(l=T())<9e15&&(p[h++]=l%1e14);for(u=p[--h],e%=o,u&&e&&(l=c[o-e],p[h]=n(u/l)*l);0===p[h];p.pop(),h--);if(h<0)p=[s=0];else{for(s=-1;0===p[0];p.splice(0,1),s-=o);for(h=1,l=p[0];l>=10;l/=10,h++);h<o&&(s-=o-h)}return d.e=s,d.c=p,d}),F.sum=function(){for(var e=1,t=arguments,r=new F(t[0]);e<t.length;)r=r.plus(t[e++]);return r},C=function(){function e(e,t,r,n){for(var i,a,s=[0],o=0,u=e.length;o<u;){for(a=s.length;a--;s[a]*=t);for(s[0]+=n.indexOf(e.charAt(o++)),i=0;i<s.length;i++)s[i]>r-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(t,r,n,i,a){var s,o,u,c,l,f,h,d,y=t.indexOf("."),g=k,m=U;for(y>=0&&(c=V,V=0,t=t.replace(".",""),f=(d=new F(r)).pow(t.length-y),V=c,d.c=e(v(p(f.c),f.e,"0"),10,n,"0123456789"),d.e=d.c.length),u=c=(h=e(t,r,n,a?(s=j,"0123456789"):(s="0123456789",j))).length;0==h[--c];h.pop());if(!h[0])return s.charAt(0);if(y<0?--u:(f.c=h,f.e=u,f.s=i,h=(f=E(f,d,g,m,n)).c,l=f.r,u=f.e),y=h[o=u+g+1],c=n/2,l=l||o<0||null!=h[o+1],l=m<4?(null!=y||l)&&(0==m||m==(f.s<0?3:2)):y>c||y==c&&(4==m||l||6==m&&1&h[o-1]||m==(f.s<0?8:7)),o<1||!h[0])t=l?v(s.charAt(1),-g,s.charAt(0)):s.charAt(0);else{if(h.length=o,l)for(--n;++h[--o]>n;)h[o]=0,o||(++u,h=[1].concat(h));for(c=h.length;!h[--c];);for(y=0,t="";y<=c;t+=s.charAt(h[y++]));t=v(t,u,s.charAt(0))}return t}}(),E=function(){function e(e,t,r){var n,i,a,s,o=0,u=e.length,c=t%l,f=t/l|0;for(e=e.slice();u--;)o=((i=c*(a=e[u]%l)+(n=f*a+(s=e[u]/l|0)*c)%l*l+o)/r|0)+(n/l|0)+f*s,e[u]=i%r;return o&&(e=[o].concat(e)),e}function t(e,t,r,n){var i,a;if(r!=n)a=r>n?1:-1;else for(i=a=0;i<r;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(i,a,u,c,l){var f,p,d,y,g,m,v,b,E,C,S,T,A,I,w,B,_,N=i.s==a.s?1:-1,R=i.c,k=a.c;if(!(R&&R[0]&&k&&k[0]))return new F(i.s&&a.s&&(R?!k||R[0]!=k[0]:k)?R&&0==R[0]||!k?0*N:N/0:NaN);for(E=(b=new F(N)).c=[],N=u+(p=i.e-a.e)+1,l||(l=s,p=h(i.e/o)-h(a.e/o),N=N/o|0),d=0;k[d]==(R[d]||0);d++);if(k[d]>(R[d]||0)&&p--,N<0)E.push(1),y=!0;else{for(I=R.length,B=k.length,d=0,N+=2,(g=n(l/(k[0]+1)))>1&&(k=e(k,g,l),R=e(R,g,l),B=k.length,I=R.length),A=B,S=(C=R.slice(0,B)).length;S<B;C[S++]=0);_=k.slice(),_=[0].concat(_),w=k[0],k[1]>=l/2&&w++;do{if(g=0,(f=t(k,C,B,S))<0){if(T=C[0],B!=S&&(T=T*l+(C[1]||0)),(g=n(T/w))>1)for(g>=l&&(g=l-1),v=(m=e(k,g,l)).length,S=C.length;1==t(m,C,v,S);)g--,r(m,B<v?_:k,v,l),v=m.length,f=1;else 0==g&&(f=g=1),v=(m=k.slice()).length;if(v<S&&(m=[0].concat(m)),r(C,m,S,l),S=C.length,-1==f)for(;t(k,C,B,S)<1;)g++,r(C,B<S?_:k,S,l),S=C.length}else 0===f&&(g++,C=[0]);E[d++]=g,C[0]?C[S++]=R[A]||0:(C=[R[A]],S=1)}while((A++<I||null!=C[0])&&N--);y=null!=C[0],E[0]||E.splice(0,1)}if(l==s){for(d=1,N=E[0];N>=10;N/=10,d++);H(b,u+(b.e=d+p*o-1)+1,c,y)}else b.e=p,b.r=+y;return b}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,I=/^([^.]+)\.$/,w=/^\.([^.]+)$/,B=/^-?(Infinity|NaN)$/,_=/^\s*\+(?=[\w.])|^\s+|\s+$/g,S=function(e,t,r,n){var a,s=r?t:t.replace(_,"");if(B.test(s))e.s=isNaN(s)?null:s<0?-1:1;else{if(!r&&(s=s.replace(A,(function(e,t,r){return a="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=a?e:t})),n&&(a=n,s=s.replace(I,"$1").replace(w,"0.$1")),t!=s))return new F(s,a);if(F.DEBUG)throw Error(i+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},N.absoluteValue=N.abs=function(){var e=new F(this);return e.s<0&&(e.s=1),e},N.comparedTo=function(e,t){return d(this,new F(e,t))},N.decimalPlaces=N.dp=function(e,t){var r,n,i,a=this;if(null!=e)return y(e,0,f),null==t?t=U:y(t,0,8),H(new F(a),e+a.e+1,t);if(!(r=a.c))return null;if(n=((i=r.length-1)-h(this.e/o))*o,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},N.dividedBy=N.div=function(e,t){return E(this,new F(e,t),k,U)},N.dividedToIntegerBy=N.idiv=function(e,t){return E(this,new F(e,t),0,1)},N.exponentiatedBy=N.pow=function(e,t){var a,s,u,c,l,f,h,p,d=this;if((e=new F(e)).c&&!e.isInteger())throw Error(i+"Exponent not an integer: "+Y(e));if(null!=t&&(t=new F(t)),l=e.e>14,!d.c||!d.c[0]||1==d.c[0]&&!d.e&&1==d.c.length||!e.c||!e.c[0])return p=new F(Math.pow(+Y(d),l?2-g(e):+Y(e))),t?p.mod(t):p;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new F(NaN);(s=!f&&d.isInteger()&&t.isInteger())&&(d=d.mod(t))}else{if(e.e>9&&(d.e>0||d.e<-1||(0==d.e?d.c[0]>1||l&&d.c[1]>=24e7:d.c[0]<8e13||l&&d.c[0]<=9999975e7)))return c=d.s<0&&g(e)?-0:0,d.e>-1&&(c=1/c),new F(f?1/c:c);V&&(c=r(V/o+2))}for(l?(a=new F(.5),f&&(e.s=1),h=g(e)):h=(u=Math.abs(+Y(e)))%2,p=new F(R);;){if(h){if(!(p=p.times(d)).c)break;c?p.c.length>c&&(p.c.length=c):s&&(p=p.mod(t))}if(u){if(0===(u=n(u/2)))break;h=u%2}else if(H(e=e.times(a),e.e+1,1),e.e>14)h=g(e);else{if(0==(u=+Y(e)))break;h=u%2}d=d.times(d),c?d.c&&d.c.length>c&&(d.c.length=c):s&&(d=d.mod(t))}return s?p:(f&&(p=R.div(p)),t?p.mod(t):c?H(p,V,U,void 0):p)},N.integerValue=function(e){var t=new F(this);return null==e?e=U:y(e,0,8),H(t,t.e+1,e)},N.isEqualTo=N.eq=function(e,t){return 0===d(this,new F(e,t))},N.isFinite=function(){return!!this.c},N.isGreaterThan=N.gt=function(e,t){return d(this,new F(e,t))>0},N.isGreaterThanOrEqualTo=N.gte=function(e,t){return 1===(t=d(this,new F(e,t)))||0===t},N.isInteger=function(){return!!this.c&&h(this.e/o)>this.c.length-2},N.isLessThan=N.lt=function(e,t){return d(this,new F(e,t))<0},N.isLessThanOrEqualTo=N.lte=function(e,t){return-1===(t=d(this,new F(e,t)))||0===t},N.isNaN=function(){return!this.s},N.isNegative=function(){return this.s<0},N.isPositive=function(){return this.s>0},N.isZero=function(){return!!this.c&&0==this.c[0]},N.minus=function(e,t){var r,n,i,a,u=this,c=u.s;if(t=(e=new F(e,t)).s,!c||!t)return new F(NaN);if(c!=t)return e.s=-t,u.plus(e);var l=u.e/o,f=e.e/o,p=u.c,d=e.c;if(!l||!f){if(!p||!d)return p?(e.s=-t,e):new F(d?u:NaN);if(!p[0]||!d[0])return d[0]?(e.s=-t,e):new F(p[0]?u:3==U?-0:0)}if(l=h(l),f=h(f),p=p.slice(),c=l-f){for((a=c<0)?(c=-c,i=p):(f=l,i=d),i.reverse(),t=c;t--;i.push(0));i.reverse()}else for(n=(a=(c=p.length)<(t=d.length))?c:t,c=t=0;t<n;t++)if(p[t]!=d[t]){a=p[t]<d[t];break}if(a&&(i=p,p=d,d=i,e.s=-e.s),(t=(n=d.length)-(r=p.length))>0)for(;t--;p[r++]=0);for(t=s-1;n>c;){if(p[--n]<d[n]){for(r=n;r&&!p[--r];p[r]=t);--p[r],p[n]+=s}p[n]-=d[n]}for(;0==p[0];p.splice(0,1),--f);return p[0]?G(e,p,f):(e.s=3==U?-1:1,e.c=[e.e=0],e)},N.modulo=N.mod=function(e,t){var r,n,i=this;return e=new F(e,t),!i.c||!e.s||e.c&&!e.c[0]?new F(NaN):!e.c||i.c&&!i.c[0]?new F(i):(9==x?(n=e.s,e.s=1,r=E(i,e,0,3),e.s=n,r.s*=n):r=E(i,e,0,x),(e=i.minus(r.times(e))).c[0]||1!=x||(e.s=i.s),e)},N.multipliedBy=N.times=function(e,t){var r,n,i,a,u,c,f,p,d,y,g,m,v,b,E,C=this,S=C.c,T=(e=new F(e,t)).c;if(!(S&&T&&S[0]&&T[0]))return!C.s||!e.s||S&&!S[0]&&!T||T&&!T[0]&&!S?e.c=e.e=e.s=null:(e.s*=C.s,S&&T?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=h(C.e/o)+h(e.e/o),e.s*=C.s,(f=S.length)<(y=T.length)&&(v=S,S=T,T=v,i=f,f=y,y=i),i=f+y,v=[];i--;v.push(0));for(b=s,E=l,i=y;--i>=0;){for(r=0,g=T[i]%E,m=T[i]/E|0,a=i+(u=f);a>i;)r=((p=g*(p=S[--u]%E)+(c=m*p+(d=S[u]/E|0)*g)%E*E+v[a]+r)/b|0)+(c/E|0)+m*d,v[a--]=p%b;v[a]=r}return r?++n:v.splice(0,1),G(e,v,n)},N.negated=function(){var e=new F(this);return e.s=-e.s||null,e},N.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new F(e,t)).s,!i||!t)return new F(NaN);if(i!=t)return e.s=-t,n.minus(e);var a=n.e/o,u=e.e/o,c=n.c,l=e.c;if(!a||!u){if(!c||!l)return new F(i/0);if(!c[0]||!l[0])return l[0]?e:new F(c[0]?n:0*i)}if(a=h(a),u=h(u),c=c.slice(),i=a-u){for(i>0?(u=a,r=l):(i=-i,r=c),r.reverse();i--;r.push(0));r.reverse()}for((i=c.length)-(t=l.length)<0&&(r=l,l=c,c=r,t=i),i=0;t;)i=(c[--t]=c[t]+l[t]+i)/s|0,c[t]=s===c[t]?0:c[t]%s;return i&&(c=[i].concat(c),++u),G(e,c,u)},N.precision=N.sd=function(e,t){var r,n,i,a=this;if(null!=e&&e!==!!e)return y(e,1,f),null==t?t=U:y(t,0,8),H(new F(a),e,t);if(!(r=a.c))return null;if(n=(i=r.length-1)*o+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&a.e+1>n&&(n=a.e+1),n},N.shiftedBy=function(e){return y(e,-u,u),this.times("1e"+e)},N.squareRoot=N.sqrt=function(){var e,t,r,n,i,a=this,s=a.c,o=a.s,u=a.e,c=k+4,l=new F("0.5");if(1!==o||!s||!s[0])return new F(!o||o<0&&(!s||s[0])?NaN:s?a:1/0);if(0==(o=Math.sqrt(+Y(a)))||o==1/0?(((t=p(s)).length+u)%2==0&&(t+="0"),o=Math.sqrt(+t),u=h((u+1)/2)-(u<0||u%2),r=new F(t=o==1/0?"5e"+u:(t=o.toExponential()).slice(0,t.indexOf("e")+1)+u)):r=new F(o+""),r.c[0])for((o=(u=r.e)+c)<3&&(o=0);;)if(i=r,r=l.times(i.plus(E(a,i,c,1))),p(i.c).slice(0,o)===(t=p(r.c)).slice(0,o)){if(r.e<u&&--o,"9999"!=(t=t.slice(o-3,o+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(H(r,r.e+k+2,1),e=!r.times(r).eq(a));break}if(!n&&(H(i,i.e+k+2,0),i.times(i).eq(a))){r=i;break}c+=4,o+=4,n=1}return H(r,r.e+k+1,U,e)},N.toExponential=function(e,t){return null!=e&&(y(e,0,f),e++),q(this,e,t,1)},N.toFixed=function(e,t){return null!=e&&(y(e,0,f),e=e+this.e+1),q(this,e,t)},N.toFormat=function(e,t,r){var n,a=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=K;else if("object"!=typeof r)throw Error(i+"Argument not an object: "+r);if(n=a.toFixed(e,t),a.c){var s,o=n.split("."),u=+r.groupSize,c=+r.secondaryGroupSize,l=r.groupSeparator||"",f=o[0],h=o[1],p=a.s<0,d=p?f.slice(1):f,y=d.length;if(c&&(s=u,u=c,c=s,y-=s),u>0&&y>0){for(s=y%u||u,f=d.substr(0,s);s<y;s+=u)f+=l+d.substr(s,u);c>0&&(f+=l+d.slice(s)),p&&(f="-"+f)}n=h?f+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?h.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):h):f}return(r.prefix||"")+n+(r.suffix||"")},N.toFraction=function(e){var t,r,n,a,s,u,l,f,h,d,y,g,m=this,v=m.c;if(null!=e&&(!(l=new F(e)).isInteger()&&(l.c||1!==l.s)||l.lt(R)))throw Error(i+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+Y(l));if(!v)return new F(m);for(t=new F(R),h=r=new F(R),n=f=new F(R),g=p(v),s=t.e=g.length-m.e-1,t.c[0]=c[(u=s%o)<0?o+u:u],e=!e||l.comparedTo(t)>0?s>0?t:h:l,u=D,D=1/0,l=new F(g),f.c[0]=0;d=E(l,t,0,1),1!=(a=r.plus(d.times(n))).comparedTo(e);)r=n,n=a,h=f.plus(d.times(a=h)),f=a,t=l.minus(d.times(a=t)),l=a;return a=E(e.minus(r),n,0,1),f=f.plus(a.times(h)),r=r.plus(a.times(n)),f.s=h.s=m.s,y=E(h,n,s*=2,U).minus(m).abs().comparedTo(E(f,r,s,U).minus(m).abs())<1?[h,n]:[f,r],D=u,y},N.toNumber=function(){return+Y(this)},N.toPrecision=function(e,t){return null!=e&&y(e,1,f),q(this,e,t,2)},N.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=i<=P||i>=O?m(p(r.c),i):v(p(r.c),i,"0"):10===e?t=v(p((r=H(new F(r),k+i+1,U)).c),r.e,"0"):(y(e,2,j.length,"Base"),t=C(v(p(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},N.valueOf=N.toJSON=function(){return Y(this)},N._isBigNumber=!0,N[Symbol.toStringTag]="BigNumber",N[Symbol.for("nodejs.util.inspect.custom")]=N.valueOf,null!=b&&F.set(b),F}(),E=function(){return(E=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},C=function(){function e(){this.format=e.DEFAULT_FORMAT,b.config({FORMAT:this.format})}return e.prototype.set=function(e){"FORMAT"in e&&(this.format=E({},this.format,e.FORMAT),e.FORMAT=this.format),b.config(e)},e.DEFAULT_FORMAT={prefix:"",decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0,suffix:""},e}();e.BigNumber=function(){function e(t){"object"==typeof t&&e.isBigNumber(t)?this.bn=t.bn.plus(0):this.bn=e.toBigNumberJs(t)}return e.prototype.clone=function(){return new e(this)},e.prototype.add=function(t){return new e(this.bn.plus(e.toBigNumberJs(t)))},e.prototype.sub=function(t){return new e(this.bn.minus(e.toBigNumberJs(t)))},e.prototype.mul=function(t){return new e(this.bn.times(e.toBigNumberJs(t)))},e.prototype.div=function(t){return new e(this.bn.div(e.toBigNumberJs(t)))},e.prototype.pow=function(t){return new e(this.bn.pow(e.toBigNumberJs(t)))},e.prototype.sqrt=function(){return new e(this.bn.sqrt())},e.prototype.abs=function(){return new e(this.bn.abs())},e.prototype.mod=function(t){return new e(this.bn.mod(e.toBigNumberJs(t)))},e.prototype.roundTo=function(t,r){return void 0===t&&(t=0),void 0===r&&(r=4),new e(this.bn.dp(t||0,r))},e.prototype.eq=function(t){return this.bn.eq(e.toBigNumberJs(t))},e.prototype.lt=function(t){return this.bn.lt(e.toBigNumberJs(t))},e.prototype.gt=function(t){return this.bn.gt(e.toBigNumberJs(t))},e.prototype.lte=function(t){return this.bn.lte(e.toBigNumberJs(t))},e.prototype.gte=function(t){return this.bn.gte(e.toBigNumberJs(t))},e.prototype.isNaN=function(){return this.bn.isNaN()},e.prototype.isFinite=function(){return this.bn.isFinite()},e.prototype.isZero=function(){return this.eq(0)},e.prototype.isPositive=function(){return this.gt(0)},e.prototype.isNegative=function(){return this.lt(0)},e.prototype.isInt=function(){return this.bn.isInteger()},e.prototype.getDecimalsCount=function(){return this.bn.dp()},e.prototype.isEven=function(){return this.mod(2).eq(0)},e.prototype.isOdd=function(){return!this.isEven()},e.prototype.isInSignedRange=function(){return this.gte(e.MIN_VALUE)&&this.lte(e.MAX_VALUE)},e.prototype.isInUnsignedRange=function(){return this.gte(e.MIN_UNSIGNED_VALUE)&&this.lte(e.MAX_UNSIGNED_VALUE)},e.prototype.toFormat=function(e,t,r){return this.bn.toFormat(e,t,r)},e.prototype.toFixed=function(e,t){return null==e?this.bn.toFixed():this.bn.toFixed(e,t)},e.prototype.toString=function(){return this.toFixed()},e.prototype.toNumber=function(){return this.bn.toNumber()},e.prototype.toJSON=function(){return this.bn.toFixed()},e.prototype.valueOf=function(){return this.bn.valueOf()},e.prototype.toBytes=function(t){var r=void 0===t?{}:t,n=r.isSigned,i=void 0===n||n,a=r.isLong,s=void 0===a||a;if(!this.isInt())throw new Error("Cant create bytes from number with decimals!");if(!i&&this.isNegative())throw new Error("Cant create bytes from negative number in signed mode!");if(s&&i&&!this.isInSignedRange())throw new Error("Number is not from signed numbers range");if(s&&!i&&!this.isInUnsignedRange())throw new Error("Number is not from unsigned numbers range");var o=i&&this.isNegative(),u=o?"1":"0",c=this.bn.plus(u).toString(2).replace("-",""),l=s?64:8*Math.ceil(c.length/8),f=e._toLength(l,c).split(""),h=[];do{h.push(parseInt(f.splice(0,8).join(""),2))}while(f.length);return o?Uint8Array.from(h.map((function(e){return 255-e}))):Uint8Array.from(h)},e.fromBytes=function(t,r){var n=void 0===r?{}:r,i=n.isSigned,a=void 0===i||i,s=n.isLong,o=void 0===s||s;if(o&&8!==t.length)throw new Error("Wrong bytes length! Minimal length is 8 byte!");t=!o&&t.length>0||o?t:[0];var u=!!a&&t[0]>127,c=Array.from(t).map((function(e){return u?255-e:e})).map((function(t){return e._toLength(8,t.toString(2))})).join(""),l=new e(new b(c,2));return u?l.mul(-1).sub(1):l},e.max=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.toBigNumber(t).reduce((function(e,t){return e.gte(t)?e:t}))},e.min=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.toBigNumber(t).reduce((function(e,t){return e.lte(t)?e:t}))},e.sum=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.toBigNumber(t).reduce((function(e,t){return e.add(t)}))},e.isBigNumber=function(t){return t&&"object"==typeof t&&(t instanceof e||Object.entries(e.prototype).filter((function(e){return"_"!==e[0].charAt(0)})).every((function(e){var r=e[0],n=e[1];return r in t&&typeof n==typeof t[r]})))},e.toBigNumber=function(t){return Array.isArray(t)?t.map((function(t){return new e(t)})):new e(t)},e.toBigNumberJs=function(t){return b.isBigNumber(t)?t:t instanceof e?t.bn:new b(t)},e._toLength=function(e,t){return new Array(e).fill("0",0,e).concat(t.split("")).slice(-e).join("")},e.MIN_VALUE=new e("-9223372036854775808"),e.MAX_VALUE=new e("9223372036854775807"),e.MIN_UNSIGNED_VALUE=new e("0"),e.MAX_UNSIGNED_VALUE=new e("18446744073709551615"),e.config=new C,e}(),function(e){!function(e){e[e.ROUND_UP=0]="ROUND_UP",e[e.ROUND_DOWN=1]="ROUND_DOWN",e[e.ROUND_CEIL=2]="ROUND_CEIL",e[e.ROUND_FLOOR=3]="ROUND_FLOOR",e[e.ROUND_HALF_UP=4]="ROUND_HALF_UP",e[e.ROUND_HALF_DOWN=5]="ROUND_HALF_DOWN",e[e.ROUND_HALF_EVEN=6]="ROUND_HALF_EVEN",e[e.ROUND_HALF_CEIL=7]="ROUND_HALF_CEIL",e[e.ROUND_HALF_FLOOR=8]="ROUND_HALF_FLOOR"}(e.ROUND_MODE||(e.ROUND_MODE={}))}(e.BigNumber||(e.BigNumber={}));var S=e.BigNumber;e.default=S,Object.defineProperty(e,"__esModule",{value:!0})}(t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GENESIS_TYPE=1,t.PAYMENT_TYPE=2,t.ISSUE_TYPE=3,t.TRANSFER_TYPE=4,t.REISSUE_TYPE=5,t.BURN_TYPE=6,t.EXCHANGE_TYPE=7,t.LEASE_TYPE=8,t.CANCEL_LEASE_TYPE=9,t.ALIAS_TYPE=10,t.MASS_TRANSFER_TYPE=11,t.DATA_TYPE=12,t.SET_SCRIPT_TYPE=13,t.SPONSORSHIP_TYPE=14,t.SET_ASSET_SCRIPT_TYPE=15,t.INVOKE_SCRIPT_TYPE=16,t.UPDATE_ASSET_INFO_TYPE=17,t.ETHEREUM=18,t.INTEGER_DATA_TYPE="integer",t.BOOLEAN_DATA_TYPE="boolean",t.STRING_DATA_TYPE="string",t.BINARY_DATA_TYPE="binary",t.TRANSACTION_TYPE={GENESIS:t.GENESIS_TYPE,PAYMENT:t.PAYMENT_TYPE,ISSUE:t.ISSUE_TYPE,TRANSFER:t.TRANSFER_TYPE,REISSUE:t.REISSUE_TYPE,BURN:t.BURN_TYPE,EXCHANGE:t.EXCHANGE_TYPE,LEASE:t.LEASE_TYPE,CANCEL_LEASE:t.CANCEL_LEASE_TYPE,ALIAS:t.ALIAS_TYPE,MASS_TRANSFER:t.MASS_TRANSFER_TYPE,DATA:t.DATA_TYPE,SET_SCRIPT:t.SET_SCRIPT_TYPE,SPONSORSHIP:t.SPONSORSHIP_TYPE,SET_ASSET_SCRIPT:t.SET_ASSET_SCRIPT_TYPE,INVOKE_SCRIPT:t.INVOKE_SCRIPT_TYPE,UPDATE_ASSET_INFO:t.UPDATE_ASSET_INFO_TYPE,ETHEREUM:t.ETHEREUM},t.DATA_FIELD_TYPE={INTEGER:t.INTEGER_DATA_TYPE,BOOLEAN:t.BOOLEAN_DATA_TYPE,STRING:t.STRING_DATA_TYPE,BINARY:t.BINARY_DATA_TYPE}},function(e,t,r){"use strict";t.__esModule=!0;var n=r(3),i=r(16),a=r(31);t.default=function(e,t,r){var s=!Array.isArray(t),o=Date.now(),u=[],c=r&&r.confirmations||0,l=r&&r.maxWaitTime||0,f=r&&r.requestInterval||250,h=function(t){return i.fetchStatus(e,t.map(n.prop("id"))).then((function(e){var r=n.indexBy(n.prop("id"),e.statuses);if(t.some((function(e){return r[e.id].status===a.TRANSACTION_STATUSES.NOT_FOUND})))throw new Error("One transaction is not in blockchain!");var i=t.filter((function(e){return!(r[e.id].confirmations>=c)||(u.push(e),!1)}));if(i.length)return l&&Date.now()-o>l?Promise.reject("Timeout error!"):n.wait(f).then((function(){return h(i)}))}))};return h(n.toArray(t)).then((function(){return s?n.head(u):u}))}},function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var i=r(32),a=n(r(55)),s=r(3);t.default=function(e,t){return i.fetchDetails(e,a.default(t)).then((function(e){return s.indexBy(s.prop("assetId"),e)}))}},function(e,t,r){"use strict";var n,i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return s},a=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(i(arguments[t]));return e};t.__esModule=!0;var s=r(3),o=r(31),u=s.switchTransactionByType(((n={})[o.NAME_MAP.transfer]=function(e){return[e.assetId,e.feeAssetId]},n[o.NAME_MAP.burn]=function(e){return[e.assetId]},n[o.NAME_MAP.reissue]=function(e){return[e.assetId]},n[o.NAME_MAP.exchange]=function(e){return Array.from(new Set([e.order1.assetPair.amountAsset,e.order1.assetPair.priceAsset,3===e.order1.version?e.order1.matcherFeeAssetId:null,3===e.order2.version?e.order2.matcherFeeAssetId:null]))},n[o.NAME_MAP.massTransfer]=function(e){return[e.assetId]},n[o.NAME_MAP.setAssetScript]=function(e){return[e.assetId]},n[o.NAME_MAP.sponsorship]=function(e){return[e.assetId]},n[o.NAME_MAP.invoke]=function(e){return a((e.payment||[]).map(s.prop("assetId")),[e.feeAssetId])},n[o.NAME_MAP.updateAsset]=function(e){return[e.assetId]},n));t.default=function(e){return s.toArray(e).reduce((function(e,t){return e.concat(u(t)||[])}),[]).filter((function(e){return null!=e}))}},function(e,t,r){"use strict";t.__esModule=!0;var n=r(30);t.default=function(e){return n.fetchHeadersLast(e).then((function(e){return function(e){var t,r,n,i,s;if(0===e.length)return new Uint8Array(0);s=void 0,i=void 0,t=[0],s=0;for(;s<e.length;){if(!((r=e[s])in a))throw"Base58.decode received unacceptable input. Character '"+r+"' is not in the Base58 alphabet.";for(i=0;i<t.length;)t[i]*=58,i++;for(t[0]+=a[r],n=0,i=0;i<t.length;)t[i]+=n,n=t[i]>>8,t[i]&=255,++i;for(;n;)t.push(255&n),n>>=8;s++}s=0;for(;"1"===e[s]&&s<e.length-1;)t.push(0),s++;return new Uint8Array(t.reverse())}(e.generator)[1]}))};for(var i="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",a={},s=0;s<i.length;s++)a[i.charAt(s)]=s},function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0,t.create=t.ethTxId2waves=t.wavesAsset2Eth=t.ethAddress2waves=t.wavesAddress2eth=void 0;var i=n(r(58));t.wavesAddress2eth=i.default;var a=n(r(85));t.ethAddress2waves=a.default;var s=n(r(86));t.wavesAsset2Eth=s.default;var o=n(r(87));t.ethTxId2waves=o.default;var u=r(88);t.create=u.create,t.default=u.create},function(e,t,r){"use strict";t.__esModule=!0;var n=r(17);t.default=function(e){var t=n.base58Decode(e),r=t.slice(2,t.byteLength-4);return"0x"+n.base16Encode(r)}},function(e,t,r){"use strict";t.byteLength=function(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,n=c(e),s=n[0],o=n[1],u=new a(function(e,t,r){return 3*(t+r)/4-r}(0,s,o)),l=0,f=o>0?s-4:s;for(r=0;r<f;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===o&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===o&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,a=[],s=0,o=r-i;s<o;s+=16383)a.push(l(e,s,s+16383>o?o:s+16383));1===i?(t=e[r-1],a.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],a.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return a.join("")};for(var n=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,u=s.length;o<u;++o)n[o]=s[o],i[s.charCodeAt(o)]=o;function c(e){var t=e.length;if(t%4>0)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 l(e,t,r){for(var i,a,s=[],o=t;o<r;o+=3)i=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),s.push(n[(a=i)>>18&63]+n[a>>12&63]+n[a>>6&63]+n[63&a]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){
8
+ var n=r(59),i=r(60),a=r(61);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return f(this,e)}return c(this,e,t,r)}function c(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=h(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(t,r),i=(e=o(e,n)).write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(u.isBuffer(t)){var r=0|p(t.length);return 0===(e=o(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?o(e,0):h(e,t);if("Buffer"===t.type&&a(t.data))return h(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function f(e,t){if(l(t),e=o(e,t<0?0:0|p(t)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function h(e,t){var r=t.length<0?0:0|p(t.length);e=o(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function p(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function d(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(e).length;default:if(n)return K(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.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 N(this,t,r);case"utf8":case"utf-8":return w(this,t,r);case"ascii":return B(this,t,r);case"latin1":case"binary":return _(this,t,r);case"base64":return I(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(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),r=+r,isNaN(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=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){var a,s=1,o=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;s=2,o/=2,u/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(a=r;a<o;a++)if(c(e,a)===c(t,-1===l?0:a-l)){if(-1===l&&(l=a),a-l+1===u)return l*s}else-1!==l&&(a-=a-l),l=-1}else for(r+u>o&&(r=o-u),a=r;a>=0;a--){for(var f=!0,h=0;h<u;h++)if(c(e,a+h)!==c(t,h)){f=!1;break}if(f)return a}return-1}function b(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var s=0;s<n;++s){var o=parseInt(t.substr(2*s,2),16);if(isNaN(o))return s;e[r+s]=o}return s}function E(e,t,r,n){return F(K(t,e.length-r),e,r,n)}function C(e,t,r,n){return F(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function S(e,t,r,n){return C(e,t,r,n)}function T(e,t,r,n){return F(j(t),e,r,n)}function A(e,t,r,n){return F(function(e,t){for(var r,n,i,a=[],s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,a.push(i),a.push(n);return a}(t,e.length-r),e,r,n)}function I(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function w(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var a,s,o,u,c=e[i],l=null,f=c>239?4:c>223?3:c>191?2:1;if(i+f<=r)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(a=e[i+1]))&&(u=(31&c)<<6|63&a)>127&&(l=u);break;case 3:a=e[i+1],s=e[i+2],128==(192&a)&&128==(192&s)&&(u=(15&c)<<12|(63&a)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:a=e[i+1],s=e[i+2],o=e[i+3],128==(192&a)&&128==(192&s)&&128==(192&o)&&(u=(15&c)<<18|(63&a)<<12|(63&s)<<6|63&o)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=4096));return r}(n)}t.Buffer=u,t.SlowBuffer=function(e){+e!=e&&(e=0);return u.alloc(+e)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=s(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,r){return c(null,e,t,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,r){return function(e,t,r,n){return l(t),t<=0?o(e,t):void 0!==r?"string"==typeof n?o(e,t).fill(r,n):o(e,t).fill(r):o(e,t)}(null,e,t,r)},u.allocUnsafe=function(e){return f(null,e)},u.allocUnsafeSlow=function(e){return f(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!a(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=u.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var s=e[r];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},u.byteLength=d,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?w(this,0,e):y.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},u.prototype.compare=function(e,t,r,n,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");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 a=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),o=Math.min(a,s),c=this.slice(n,i),l=e.slice(t,r),f=0;f<o;++f)if(c[f]!==l[f]){a=c[f],s=l[f];break}return a<s?-1:s<a?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)},u.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=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 a=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":return C(this,e,t,r);case"latin1":case"binary":return S(this,e,t,r);case"base64":return T(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function B(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function _(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function N(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",a=t;a<r;++a)i+=V(e[a]);return i}function R(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}function k(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function U(e,t,r,n,i,a){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function P(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-r,2);i<a;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function O(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-r,4);i<a;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function L(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,r,n,a){return a||L(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function M(e,t,r,n,a){return a||L(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=u.prototype;else{var i=t-e;r=new u(i,void 0);for(var a=0;a<i;++a)r[a]=this[a+e]}return r},u.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||k(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},u.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||k(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUInt8=function(e,t){return t||k(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||k(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||k(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||k(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||k(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||k(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||k(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},u.prototype.readInt8=function(e,t){return t||k(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||k(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||k(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return t||k(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||k(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||k(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||k(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||k(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||k(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||U(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,a=0;for(this[t]=255&e;++a<r&&(i*=256);)this[t+a]=e/i&255;return t+r},u.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||U(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):O(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):O(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);U(this,e,t,r,i-1,-i)}var a=0,s=1,o=0;for(this[t]=255&e;++a<r&&(s*=256);)e<0&&0===o&&0!==this[t+a-1]&&(o=1),this[t+a]=(e/s>>0)-o&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);U(this,e,t,r,i-1,-i)}var a=r-1,s=1,o=0;for(this[t+a]=255&e;--a>=0&&(s*=256);)e<0&&0===o&&0!==this[t+a+1]&&(o=1),this[t+a]=(e/s>>0)-o&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):O(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||U(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):O(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return M(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return M(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,a=n-r;if(this===e&&r<t&&t<n)for(i=a-1;i>=0;--i)e[i+t]=this[i+r];else if(a<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+a),t);return a},u.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),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var a;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a<r;++a)this[a]=e;else{var s=u.isBuffer(e)?e:K(new u(e,n).toString()),o=s.length;for(a=0;a<r-t;++a)this[a+t]=s[a%o]}return this};var x=/[^+\/0-9A-Za-z-_]/g;function V(e){return e<16?"0"+e.toString(16):e.toString(16)}function K(e,t){var r;t=t||1/0;for(var n=e.length,i=null,a=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.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;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function j(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(x,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}}).call(this,r(12))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return s},i=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(n(arguments[t]));return e};Object.defineProperty(t,"__esModule",{value:!0});var a=r(6);t.concat=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reduce((function(e,t){return Uint8Array.from(i(e,a._fromIn(t)))}),new Uint8Array(0))},t.split=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n=t.reduce((function(e,t){return{arr:e.arr.slice(t),r:i(e.r,[e.arr.slice(0,t)])}}),{arr:a._fromIn(e),r:[]}),s=n.r,o=n.arr;return i(s,[o])}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PUBLIC_KEY_LENGTH=32,t.PRIVATE_KEY_LENGTH=32,t.SIGNATURE_LENGTH=64,t.ADDRESS_LENGTH=26,t.MAIN_NET_CHAIN_ID=87,t.TEST_NET_CHAIN_ID=84},function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return s};t.__esModule=!0;var i=r(3);t.default=function(e,t){void 0===t&&(t=Object.create(null));var r=Object.keys(e).map((function(t){return[t,e[t]]})).map((function(e){var r=n(e,2),i=r[0],a=r[1];return[i,Object.prototype.hasOwnProperty.call(t,i)?t[i](a):a]})).filter((function(e){var t=n(e,2);t[0];return null!=t[1]})).map((function(e){var t=n(e,2),r=t[0],a=t[1];return i.toArray(a).map((function(e){return r+"="+e})).join("&")})).join("&");return r.length?"?"+r:""}},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<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return s},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0,t.broadcast=t.fetchStatus=t.fetchInfo=t.fetchUnconfirmedInfo=t.fetchTransactions=t.fetchUnconfirmed=t.fetchCalculateFee=t.fetchUnconfirmedSize=void 0;var s=r(31),o=r(30),u=a(r(2)),c=a(r(15)),l=r(3),f=a(r(50)),h=r(91);function p(e,t,r){return void 0===r&&(r=Object.create(null)),u.default({base:e,url:"/transactions/unconfirmed/info/"+t,options:r})}function d(e,t,r){return void 0===r&&(r=Object.create(null)),u.default({base:e,url:"/transactions/info/"+t,options:r}).then((function(e){return h.addStateUpdateField(e)}))}t.fetchUnconfirmedSize=function(e){return u.default({base:e,url:"/transactions/unconfirmed/size"})},t.fetchCalculateFee=function(e,t,r){return void 0===r&&(r=Object.create(null)),u.default({base:e,url:"/transactions/calculateFee",options:l.deepAssign(n({},r),{method:"POST",body:f.default(t),headers:{"Content-Type":"application/json"}})})},t.fetchUnconfirmed=function(e,t){return void 0===t&&(t=Object.create(null)),u.default({base:e,url:"/transactions/unconfirmed",options:t})},t.fetchTransactions=function(e,t,r,n,a,s){return void 0===s&&(s=Object.create(null)),u.default({base:e,url:"/transactions/address/"+t+"/limit/"+r+c.default({after:n}),options:s}).then((function(e){var t=i(e,1)[0];return t.forEach((function(e){return h.addStateUpdateField(e)})),t}))},t.fetchUnconfirmedInfo=p,t.fetchInfo=d,t.fetchStatus=function(e,t){var r={id:"",confirmations:-1,height:-1,inUTX:!1,status:s.TRANSACTION_STATUSES.NOT_FOUND},a=t.map((function(t){return p(e,t).then((function(){return n(n({},r),{id:t,status:s.TRANSACTION_STATUSES.UNCONFIRMED,inUTX:!0})})).catch((function(){return d(e,t).then((function(e){return n(n({},r),{id:t,status:s.TRANSACTION_STATUSES.IN_BLOCKCHAIN,height:e.height,applicationStatus:e.applicationStatus})}))})).catch((function(){return n(n({},r),{id:t})}))}));return Promise.all([o.fetchHeight(e),Promise.all(a)]).then((function(e){var t=i(e,2),r=t[0].height,a=t[1];return{height:r,statuses:a.map((function(e){return n(n({},e),{confirmations:e.status===s.TRANSACTION_STATUSES.IN_BLOCKCHAIN?r-e.height:e.confirmations})}))}}))},t.broadcast=function(e,t,r){return void 0===r&&(r=Object.create(null)),u.default({base:e,url:"/transactions/broadcast",options:l.deepAssign(n({},r),{method:"POST",body:f.default(t),headers:{"Content-Type":"application/json"}})})}},function(e,t,r){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0});var i=r(33),a=r(36);t.seedWordsList=a.seedWordsList;var s=r(39);t.ChaidId=s.ChaidId;var o=r(38);t.Seed=o.Seed;var u=r(28);t.isPrivateKey=u.isPrivateKey,t.isPublicKey=u.isPublicKey;var c=r(33);t.crypto=c.crypto,function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(14)),t.signBytes=(n=i.crypto({output:"Base58"})).signBytes,t.keyPair=n.keyPair,t.publicKey=n.publicKey,t.privateKey=n.privateKey,t.address=n.address,t.buildAddress=n.buildAddress,t.blake2b=n.blake2b,t.keccak=n.keccak,t.sha256=n.sha256,t.sharedKey=n.sharedKey,t.seedWithNonce=n.seedWithNonce,t.base64Encode=n.base64Encode,t.base64Decode=n.base64Decode,t.base58Encode=n.base58Encode,t.base58Decode=n.base58Decode,t.base16Encode=n.base16Encode,t.base16Decode=n.base16Decode,t.stringToBytes=n.stringToBytes,t.bytesToString=n.bytesToString,t.random=n.random,t.randomSeed=n.randomSeed,t.randomBytes=n.randomBytes,t.verifySignature=n.verifySignature,t.verifyPublicKey=n.verifyPublicKey,t.verifyAddress=n.verifyAddress,t.messageDecrypt=n.messageDecrypt,t.messageEncrypt=n.messageEncrypt,t.aesDecrypt=n.aesDecrypt,t.aesEncrypt=n.aesEncrypt,t.encryptSeed=n.encryptSeed,t.decryptSeed=n.decryptSeed,t.rsaKeyPair=n.rsaKeyPair,t.rsaKeyPairSync=n.rsaKeyPairSync,t.rsaSign=n.rsaSign,t.rsaVerify=n.rsaVerify,t.merkleVerify=n.merkleVerify,t.split=n.split,t.concat=n.concat},function(e,t,r){"use strict";(function(e){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=n(r(7)),a=r(36),s=r(5),o=function(e){return s.stringToBytes(i.default.getBytesSync(e),"raw")};t.random=function(r,n){switch(n){case"Array8":return Array.from(o(r));case"Array16":return Array.from(t.random(r,"Uint16Array"));case"Array32":return Array.from(t.random(r,"Uint32Array"));case"Buffer":return function(){try{new e(1)}catch(e){throw new Error("Buffer not supported in this environment. Use Node.js or Browserify for browser support.")}}(),e.from(o(r));case"Uint8Array":return o(r);case"Uint16Array":return new Uint16Array(r).map((function(e){return o(2).reduce((function(e,t,r){return e|t<<8*(1-r)}),0)}));case"Uint32Array":return new Uint32Array(r).map((function(e){return o(4).reduce((function(e,t,r){return e|t<<8*(1-r)}),0)}));default:throw new Error(n+" is unsupported.")}},t.randomBytes=function(e){return t.random(e,"Uint8Array")},t.randomSeed=function(e){return void 0===e&&(e=15),t.random(e,"Array32").map((function(e){return a.seedWordsList[e%a.seedWordsList.length]})).join(" ")}}).call(this,r(11).Buffer)},function(e,t){var r,n,i=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(e){if(r===setTimeout)return setTimeout(e,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:a}catch(e){r=a}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var u,c=[],l=!1,f=-1;function h(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&p())}function p(){if(!l){var e=o(h);l=!0;for(var t=c.length;t;){for(u=c,c=[];++f<t;)u&&u[f].run();f=-1,t=c.length}u=null,l=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function y(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new d(e,t)),1!==c.length||l||o(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=y,i.addListener=y,i.once=y,i.off=y,i.removeListener=y,i.removeAllListeners=y,i.emit=y,i.prependListener=y,i.prependOnceListener=y,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(1),a=n(r(66)),s=r(6),o=r(5);t.base64Decode=function(e){return o.stringToBytes(i.decode64(e),"raw")},t.base64Encode=function(e){return i.encode64(o.bytesToString(s._fromIn(e),"raw"))},t.base58Decode=function(e){return a.default.decode(e)},t.base58Encode=function(e){return a.default.encode(s._fromIn(e))},t.base16Decode=function(e){return o.stringToBytes(i.hexToBytes(e),"raw")},t.base16Encode=function(e){return i.bytesToHex(o.bytesToString(s._fromIn(e),"raw"))}},function(e,t,r){"use strict";t.__esModule=!0;var n=Object.create(null),i=function(e){var t,r=new Float64Array(16);if(e)for(t=0;t<e.length;t++)r[t]=e[t];return r},a=(new Uint8Array(16),new Uint8Array(32));a[0]=9;var s=i(),o=i([1]),u=i([56129,1]),c=i([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),l=i([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),f=i([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),h=i([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),p=i([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function d(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}function y(e,t,r,n){return function(e,t,r,n,i){var a,s=0;for(a=0;a<i;a++)s|=e[t+a]^r[n+a];return(1&s-1>>>8)-1}(e,t,r,n,32)}function g(e,t){for(var r=0;r<16;r++)e[r]=0|t[r]}function m(e){var t,r,n=1;for(t=0;t<16;t++)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function v(e,t,r){for(var n,i=~(r-1),a=0;a<16;a++)n=i&(e[a]^t[a]),e[a]^=n,t[a]^=n}function b(e,t){var r,n,a,s=i(),o=i();for(r=0;r<16;r++)o[r]=t[r];for(m(o),m(o),m(o),n=0;n<2;n++){for(s[0]=o[0]-65517,r=1;r<15;r++)s[r]=o[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=o[15]-32767-(s[14]>>16&1),a=s[15]>>16&1,s[14]&=65535,v(o,s,1-a)}for(r=0;r<16;r++)e[2*r]=255&o[r],e[2*r+1]=o[r]>>8}function E(e,t){var r=new Uint8Array(32),n=new Uint8Array(32);return b(r,e),b(n,t),y(r,0,n,0)}function C(e){var t=new Uint8Array(32);return b(t,e),1&t[0]}function S(e,t){for(var r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function T(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]+r[n]}function A(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]-r[n]}function I(e,t,r){var n,i,a=0,s=0,o=0,u=0,c=0,l=0,f=0,h=0,p=0,d=0,y=0,g=0,m=0,v=0,b=0,E=0,C=0,S=0,T=0,A=0,I=0,w=0,B=0,_=0,N=0,R=0,k=0,U=0,P=0,O=0,L=0,D=r[0],M=r[1],x=r[2],V=r[3],K=r[4],j=r[5],F=r[6],q=r[7],z=r[8],G=r[9],H=r[10],Y=r[11],Q=r[12],W=r[13],X=r[14],J=r[15];a+=(n=t[0])*D,s+=n*M,o+=n*x,u+=n*V,c+=n*K,l+=n*j,f+=n*F,h+=n*q,p+=n*z,d+=n*G,y+=n*H,g+=n*Y,m+=n*Q,v+=n*W,b+=n*X,E+=n*J,s+=(n=t[1])*D,o+=n*M,u+=n*x,c+=n*V,l+=n*K,f+=n*j,h+=n*F,p+=n*q,d+=n*z,y+=n*G,g+=n*H,m+=n*Y,v+=n*Q,b+=n*W,E+=n*X,C+=n*J,o+=(n=t[2])*D,u+=n*M,c+=n*x,l+=n*V,f+=n*K,h+=n*j,p+=n*F,d+=n*q,y+=n*z,g+=n*G,m+=n*H,v+=n*Y,b+=n*Q,E+=n*W,C+=n*X,S+=n*J,u+=(n=t[3])*D,c+=n*M,l+=n*x,f+=n*V,h+=n*K,p+=n*j,d+=n*F,y+=n*q,g+=n*z,m+=n*G,v+=n*H,b+=n*Y,E+=n*Q,C+=n*W,S+=n*X,T+=n*J,c+=(n=t[4])*D,l+=n*M,f+=n*x,h+=n*V,p+=n*K,d+=n*j,y+=n*F,g+=n*q,m+=n*z,v+=n*G,b+=n*H,E+=n*Y,C+=n*Q,S+=n*W,T+=n*X,A+=n*J,l+=(n=t[5])*D,f+=n*M,h+=n*x,p+=n*V,d+=n*K,y+=n*j,g+=n*F,m+=n*q,v+=n*z,b+=n*G,E+=n*H,C+=n*Y,S+=n*Q,T+=n*W,A+=n*X,I+=n*J,f+=(n=t[6])*D,h+=n*M,p+=n*x,d+=n*V,y+=n*K,g+=n*j,m+=n*F,v+=n*q,b+=n*z,E+=n*G,C+=n*H,S+=n*Y,T+=n*Q,A+=n*W,I+=n*X,w+=n*J,h+=(n=t[7])*D,p+=n*M,d+=n*x,y+=n*V,g+=n*K,m+=n*j,v+=n*F,b+=n*q,E+=n*z,C+=n*G,S+=n*H,T+=n*Y,A+=n*Q,I+=n*W,w+=n*X,B+=n*J,p+=(n=t[8])*D,d+=n*M,y+=n*x,g+=n*V,m+=n*K,v+=n*j,b+=n*F,E+=n*q,C+=n*z,S+=n*G,T+=n*H,A+=n*Y,I+=n*Q,w+=n*W,B+=n*X,_+=n*J,d+=(n=t[9])*D,y+=n*M,g+=n*x,m+=n*V,v+=n*K,b+=n*j,E+=n*F,C+=n*q,S+=n*z,T+=n*G,A+=n*H,I+=n*Y,w+=n*Q,B+=n*W,_+=n*X,N+=n*J,y+=(n=t[10])*D,g+=n*M,m+=n*x,v+=n*V,b+=n*K,E+=n*j,C+=n*F,S+=n*q,T+=n*z,A+=n*G,I+=n*H,w+=n*Y,B+=n*Q,_+=n*W,N+=n*X,R+=n*J,g+=(n=t[11])*D,m+=n*M,v+=n*x,b+=n*V,E+=n*K,C+=n*j,S+=n*F,T+=n*q,A+=n*z,I+=n*G,w+=n*H,B+=n*Y,_+=n*Q,N+=n*W,R+=n*X,k+=n*J,m+=(n=t[12])*D,v+=n*M,b+=n*x,E+=n*V,C+=n*K,S+=n*j,T+=n*F,A+=n*q,I+=n*z,w+=n*G,B+=n*H,_+=n*Y,N+=n*Q,R+=n*W,k+=n*X,U+=n*J,v+=(n=t[13])*D,b+=n*M,E+=n*x,C+=n*V,S+=n*K,T+=n*j,A+=n*F,I+=n*q,w+=n*z,B+=n*G,_+=n*H,N+=n*Y,R+=n*Q,k+=n*W,U+=n*X,P+=n*J,b+=(n=t[14])*D,E+=n*M,C+=n*x,S+=n*V,T+=n*K,A+=n*j,I+=n*F,w+=n*q,B+=n*z,_+=n*G,N+=n*H,R+=n*Y,k+=n*Q,U+=n*W,P+=n*X,O+=n*J,E+=(n=t[15])*D,s+=38*(S+=n*x),o+=38*(T+=n*V),u+=38*(A+=n*K),c+=38*(I+=n*j),l+=38*(w+=n*F),f+=38*(B+=n*q),h+=38*(_+=n*z),p+=38*(N+=n*G),d+=38*(R+=n*H),y+=38*(k+=n*Y),g+=38*(U+=n*Q),m+=38*(P+=n*W),v+=38*(O+=n*X),b+=38*(L+=n*J),a=(n=(a+=38*(C+=n*M))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=o+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),E=(n=E+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=(a+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=o+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),E=(n=E+i+65535)-65536*(i=Math.floor(n/65536)),a+=i-1+37*(i-1),e[0]=a,e[1]=s,e[2]=o,e[3]=u,e[4]=c,e[5]=l,e[6]=f,e[7]=h,e[8]=p,e[9]=d,e[10]=y,e[11]=g,e[12]=m,e[13]=v,e[14]=b,e[15]=E}function w(e,t){I(e,t,t)}function B(e,t){var r,n=i();for(r=0;r<16;r++)n[r]=t[r];for(r=253;r>=0;r--)w(n,n),2!==r&&4!==r&&I(n,n,t);for(r=0;r<16;r++)e[r]=n[r]}function _(e,t,r){var n,a,s=new Uint8Array(32),o=new Float64Array(80),c=i(),l=i(),f=i(),h=i(),p=i(),d=i();for(a=0;a<31;a++)s[a]=t[a];for(s[31]=127&t[31]|64,s[0]&=248,S(o,r),a=0;a<16;a++)l[a]=o[a],h[a]=c[a]=f[a]=0;for(c[0]=h[0]=1,a=254;a>=0;--a)v(c,l,n=s[a>>>3]>>>(7&a)&1),v(f,h,n),T(p,c,f),A(c,c,f),T(f,l,h),A(l,l,h),w(h,p),w(d,c),I(c,f,c),I(f,l,p),T(p,c,f),A(c,c,f),w(l,c),A(f,h,d),I(c,f,u),T(c,c,h),I(f,f,c),I(c,h,d),I(h,l,o),w(l,p),v(c,l,n),v(f,h,n);for(a=0;a<16;a++)o[a+16]=c[a],o[a+32]=f[a],o[a+48]=l[a],o[a+64]=h[a];var y=o.subarray(32),g=o.subarray(16);return B(y,y),I(g,g,y),b(e,g),0}var N=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function R(e,t,r,n){for(var i,a,s,o,u,c,l,f,h,p,d,y,g,m,v,b,E,C,S,T,A,I,w,B,_,R,k=new Int32Array(16),U=new Int32Array(16),P=e[0],O=e[1],L=e[2],D=e[3],M=e[4],x=e[5],V=e[6],K=e[7],j=t[0],F=t[1],q=t[2],z=t[3],G=t[4],H=t[5],Y=t[6],Q=t[7],W=0;n>=128;){for(S=0;S<16;S++)T=8*S+W,k[S]=r[T+0]<<24|r[T+1]<<16|r[T+2]<<8|r[T+3],U[S]=r[T+4]<<24|r[T+5]<<16|r[T+6]<<8|r[T+7];for(S=0;S<80;S++)if(i=P,a=O,s=L,o=D,u=M,c=x,l=V,K,h=j,p=F,d=q,y=z,g=G,m=H,v=Y,Q,w=65535&(I=Q),B=I>>>16,_=65535&(A=K),R=A>>>16,w+=65535&(I=(G>>>14|M<<18)^(G>>>18|M<<14)^(M>>>9|G<<23)),B+=I>>>16,_+=65535&(A=(M>>>14|G<<18)^(M>>>18|G<<14)^(G>>>9|M<<23)),R+=A>>>16,w+=65535&(I=G&H^~G&Y),B+=I>>>16,_+=65535&(A=M&x^~M&V),R+=A>>>16,w+=65535&(I=N[2*S+1]),B+=I>>>16,_+=65535&(A=N[2*S]),R+=A>>>16,A=k[S%16],B+=(I=U[S%16])>>>16,_+=65535&A,R+=A>>>16,_+=(B+=(w+=65535&I)>>>16)>>>16,w=65535&(I=C=65535&w|B<<16),B=I>>>16,_=65535&(A=E=65535&_|(R+=_>>>16)<<16),R=A>>>16,w+=65535&(I=(j>>>28|P<<4)^(P>>>2|j<<30)^(P>>>7|j<<25)),B+=I>>>16,_+=65535&(A=(P>>>28|j<<4)^(j>>>2|P<<30)^(j>>>7|P<<25)),R+=A>>>16,B+=(I=j&F^j&q^F&q)>>>16,_+=65535&(A=P&O^P&L^O&L),R+=A>>>16,f=65535&(_+=(B+=(w+=65535&I)>>>16)>>>16)|(R+=_>>>16)<<16,b=65535&w|B<<16,w=65535&(I=y),B=I>>>16,_=65535&(A=o),R=A>>>16,B+=(I=C)>>>16,_+=65535&(A=E),R+=A>>>16,O=i,L=a,D=s,M=o=65535&(_+=(B+=(w+=65535&I)>>>16)>>>16)|(R+=_>>>16)<<16,x=u,V=c,K=l,P=f,F=h,q=p,z=d,G=y=65535&w|B<<16,H=g,Y=m,Q=v,j=b,S%16==15)for(T=0;T<16;T++)A=k[T],w=65535&(I=U[T]),B=I>>>16,_=65535&A,R=A>>>16,A=k[(T+9)%16],w+=65535&(I=U[(T+9)%16]),B+=I>>>16,_+=65535&A,R+=A>>>16,E=k[(T+1)%16],w+=65535&(I=((C=U[(T+1)%16])>>>1|E<<31)^(C>>>8|E<<24)^(C>>>7|E<<25)),B+=I>>>16,_+=65535&(A=(E>>>1|C<<31)^(E>>>8|C<<24)^E>>>7),R+=A>>>16,E=k[(T+14)%16],B+=(I=((C=U[(T+14)%16])>>>19|E<<13)^(E>>>29|C<<3)^(C>>>6|E<<26))>>>16,_+=65535&(A=(E>>>19|C<<13)^(C>>>29|E<<3)^E>>>6),R+=A>>>16,R+=(_+=(B+=(w+=65535&I)>>>16)>>>16)>>>16,k[T]=65535&_|R<<16,U[T]=65535&w|B<<16;w=65535&(I=j),B=I>>>16,_=65535&(A=P),R=A>>>16,A=e[0],B+=(I=t[0])>>>16,_+=65535&A,R+=A>>>16,R+=(_+=(B+=(w+=65535&I)>>>16)>>>16)>>>16,e[0]=P=65535&_|R<<16,t[0]=j=65535&w|B<<16,w=65535&(I=F),B=I>>>16,_=65535&(A=O),R=A>>>16,A=e[1],B+=(I=t[1])>>>16,_+=65535&A,R+=A>>>16,R+=(_+=(B+=(w+=65535&I)>>>16)>>>16)>>>16,e[1]=O=65535&_|R<<16,t[1]=F=65535&w|B<<16,w=65535&(I=q),B=I>>>16,_=65535&(A=L),R=A>>>16,A=e[2],B+=(I=t[2])>>>16,_+=65535&A,R+=A>>>16,R+=(_+=(B+=(w+=65535&I)>>>16)>>>16)>>>16,e[2]=L=65535&_|R<<16,t[2]=q=65535&w|B<<16,w=65535&(I=z),B=I>>>16,_=65535&(A=D),R=A>>>16,A=e[3],B+=(I=t[3])>>>16,_+=65535&A,R+=A>>>16,R+=(_+=(B+=(w+=65535&I)>>>16)>>>16)>>>16,e[3]=D=65535&_|R<<16,t[3]=z=65535&w|B<<16,w=65535&(I=G),B=I>>>16,_=65535&(A=M),R=A>>>16,A=e[4],B+=(I=t[4])>>>16,_+=65535&A,R+=A>>>16,R+=(_+=(B+=(w+=65535&I)>>>16)>>>16)>>>16,e[4]=M=65535&_|R<<16,t[4]=G=65535&w|B<<16,w=65535&(I=H),B=I>>>16,_=65535&(A=x),R=A>>>16,A=e[5],B+=(I=t[5])>>>16,_+=65535&A,R+=A>>>16,R+=(_+=(B+=(w+=65535&I)>>>16)>>>16)>>>16,e[5]=x=65535&_|R<<16,t[5]=H=65535&w|B<<16,w=65535&(I=Y),B=I>>>16,_=65535&(A=V),R=A>>>16,A=e[6],B+=(I=t[6])>>>16,_+=65535&A,R+=A>>>16,R+=(_+=(B+=(w+=65535&I)>>>16)>>>16)>>>16,e[6]=V=65535&_|R<<16,t[6]=Y=65535&w|B<<16,w=65535&(I=Q),B=I>>>16,_=65535&(A=K),R=A>>>16,A=e[7],B+=(I=t[7])>>>16,_+=65535&A,R+=A>>>16,R+=(_+=(B+=(w+=65535&I)>>>16)>>>16)>>>16,e[7]=K=65535&_|R<<16,t[7]=Q=65535&w|B<<16,W+=128,n-=128}return n}function k(e,t,r){var n,i=new Int32Array(8),a=new Int32Array(8),s=new Uint8Array(256),o=r;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[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,R(i,a,t,r),r%=128,n=0;n<r;n++)s[n]=t[o-r+n];for(s[r]=128,s[(r=256-128*(r<112?1:0))-9]=0,d(s,r-8,o/536870912|0,o<<3),R(i,a,s,r),n=0;n<8;n++)d(e,8*n,i[n],a[n]);return 0}function U(e,t){var r=i(),n=i(),a=i(),s=i(),o=i(),u=i(),c=i(),f=i(),h=i();A(r,e[1],e[0]),A(h,t[1],t[0]),I(r,r,h),T(n,e[0],e[1]),T(h,t[0],t[1]),I(n,n,h),I(a,e[3],t[3]),I(a,a,l),I(s,e[2],t[2]),T(s,s,s),A(o,n,r),A(u,s,a),T(c,s,a),T(f,n,r),I(e[0],o,u),I(e[1],f,c),I(e[2],c,u),I(e[3],o,f)}function P(e,t,r){for(var n=0;n<4;n++)v(e[n],t[n],r)}function O(e,t){var r=i(),n=i(),a=i();B(a,t[2]),I(r,t[0],a),I(n,t[1],a),b(e,n),e[31]^=C(r)<<7}function L(e,t,r){var n,i;for(g(e[0],s),g(e[1],o),g(e[2],o),g(e[3],s),i=255;i>=0;--i)P(e,t,n=r[i/8|0]>>(7&i)&1),U(t,e),U(e,e),P(e,t,n)}function D(e,t){var r=[i(),i(),i(),i()];g(r[0],f),g(r[1],h),g(r[2],o),I(r[3],f,h),L(e,r,t)}var M=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function x(e,t){var r,n,i,a;for(n=63;n>=32;--n){for(r=0,i=n-32,a=n-12;i<a;++i)t[i]+=r-16*t[n]*M[i-(n-32)],r=t[i]+128>>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 V(e){var t,r=new Float64Array(64);for(t=0;t<64;t++)r[t]=e[t];for(t=0;t<64;t++)e[t]=0;x(e,r)}function K(e,t,r,n,a){for(var s=new Uint8Array(64),o=[i(),i(),i(),i()],u=0;u<32;u++)s[u]=n[u];s[0]&=248,s[31]&=127,s[31]|=64,D(o,s),O(s.subarray(32),o);var c,l=128&s[63];return c=a?function(e,t,r,n,a){new Uint8Array(64);var s,o,u=new Uint8Array(64),c=new Uint8Array(64),l=new Float64Array(64),f=[i(),i(),i(),i()];for(e[0]=254,s=1;s<32;s++)e[s]=255;for(s=0;s<32;s++)e[32+s]=n[s];for(s=0;s<r;s++)e[64+s]=t[s];for(s=0;s<64;s++)e[r+64+s]=a[s];for(k(c,e,r+128),V(c),D(f,c),O(e,f),s=0;s<32;s++)e[s+32]=n[32+s];for(k(u,e,r+64),V(u),s=0;s<64;s++)e[r+64+s]=0;for(s=0;s<64;s++)l[s]=0;for(s=0;s<32;s++)l[s]=c[s];for(s=0;s<32;s++)for(o=0;o<32;o++)l[s+o]+=u[s]*n[o];return x(e.subarray(32,r+64),l),r+64}(e,t,r,s,a):function(e,t,r,n){new Uint8Array(64);var a,s,o=new Uint8Array(64),u=new Uint8Array(64),c=new Float64Array(64),l=[i(),i(),i(),i()];for(a=0;a<r;a++)e[64+a]=t[a];for(a=0;a<32;a++)e[32+a]=n[a];for(k(u,e.subarray(32),r+32),V(u),D(l,u),O(e,l),a=0;a<32;a++)e[a+32]=n[32+a];for(k(o,e,r+64),V(o),a=0;a<64;a++)c[a]=0;for(a=0;a<32;a++)c[a]=u[a];for(a=0;a<32;a++)for(s=0;s<32;s++)c[a+s]+=o[a]*n[s];return x(e.subarray(32),c),r+64}(e,t,r,s),e[63]|=l,c}function j(e,t){var r=i(),n=i(),a=i(),u=i(),l=i(),f=i(),h=i();return g(e[2],o),S(e[1],t),w(a,e[1]),I(u,a,c),A(a,a,e[2]),T(u,e[2],u),w(l,u),w(f,l),I(h,f,l),I(r,h,a),I(r,r,u),function(e,t){var r,n=i();for(r=0;r<16;r++)n[r]=t[r];for(r=250;r>=0;r--)w(n,n),1!==r&&I(n,n,t);for(r=0;r<16;r++)e[r]=n[r]}(r,r),I(r,r,a),I(r,r,u),I(r,r,u),I(e[0],r,u),w(n,e[0]),I(n,n,u),E(n,a)&&I(e[0],e[0],p),w(n,e[0]),I(n,n,u),E(n,a)?-1:(C(e[0])===t[31]>>7&&A(e[0],s,e[0]),I(e[3],e[0],e[1]),0)}function F(e,t,r,n){var a=function(e){var t=new Uint8Array(32),r=i(),n=i(),a=i();return S(r,e),T(n,r,o),A(a,r,o),B(n,n),I(n,n,a),b(t,n),t}(n);return a[31]|=128&t[63],t[63]&=127,function(e,t,r,n){var a,s=new Uint8Array(32),o=new Uint8Array(64),u=[i(),i(),i(),i()],c=[i(),i(),i(),i()];if(-1,r<64)return-1;if(j(c,n))return-1;for(a=0;a<r;a++)e[a]=t[a];for(a=0;a<32;a++)e[a+32]=n[a];if(k(o,e,r),V(o),L(u,c,o),D(c,t.subarray(32)),U(u,c),O(s,u),r-=64,y(t,0,s,0)){for(a=0;a<r;a++)e[a]=0;return-1}for(a=0;a<r;a++)e[a]=t[a+64];return r}(e,t,r,a)}function q(){for(var e,t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];for(t=0;t<arguments.length;t++)if("[object Uint8Array]"!==(e=Object.prototype.toString.call(arguments[t])))throw new TypeError("unexpected type "+e+", use Uint8Array")}n.sharedKey=function(e,t){if(q(t,e),32!==t.length)throw new Error("wrong public key length");if(32!==e.length)throw new Error("wrong secret key length");var r=new Uint8Array(32);return _(r,e,t),r},n.signMessage=function(e,t,r){if(q(t,e),32!==e.length)throw new Error("wrong secret key length");if(r){if(q(r),64!==r.length)throw new Error("wrong random data length");var n=new Uint8Array(128+t.length);return K(n,t,t.length,e,r),new Uint8Array(n.subarray(0,64+t.length))}var i=new Uint8Array(64+t.length);return K(i,t,t.length,e),i},n.openMessage=function(e,t){if(q(t,e),32!==e.length)throw new Error("wrong public key length");var r=new Uint8Array(t.length),n=F(r,t,t.length,e);if(n<0)return null;for(var i=new Uint8Array(n),a=0;a<i.length;a++)i[a]=r[a];return i},n.sign=function(e,t,r){if(q(e,t),32!==e.length)throw new Error("wrong secret key length");if(r&&(q(r),64!==r.length))throw new Error("wrong random data length");var n=new Uint8Array((r?128:64)+t.length);K(n,t,t.length,e,r);for(var i=new Uint8Array(64),a=0;a<i.length;a++)i[a]=n[a];return i},n.verify=function(e,t,r){if(q(t,r,e),64!==r.length)throw new Error("wrong signature length");if(32!==e.length)throw new Error("wrong public key length");var n,i=new Uint8Array(64+t.length),a=new Uint8Array(64+t.length);for(n=0;n<64;n++)i[n]=r[n];for(n=0;n<t.length;n++)i[n+64]=t[n];return F(a,i,i.length,e)>=0},n.generateKeyPair=function(e){if(q(e),32!==e.length)throw new Error("wrong seed length");for(var t=new Uint8Array(32),r=new Uint8Array(32),n=0;n<32;n++)t[n]=e[n];return _(r,t,a),t[0]&=248,t[31]&=127,t[31]|=64,r[31]&=127,{public:r,private:t}},t.default=n},function(e,t,r){var n=r(0);if(r(9),r(43),r(10),r(75),r(76),r(7),r(1),void 0===i)var i=n.jsbn.BigInteger;var a=n.util.isNodejs?r(25):null,s=n.asn1,o=n.util;n.pki=n.pki||{},e.exports=n.pki.rsa=n.rsa=n.rsa||{};var u=n.pki,c=[6,4,2,4,2,4,6,2],l={name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},f={name:"RSAPrivateKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},h={name:"RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},p=n.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},d=function(e){var t;if(!(e.algorithm in u.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=u.oids[e.algorithm];var n=s.oidToDer(t).getBytes(),i=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]),a=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]);a.value.push(s.create(s.Class.UNIVERSAL,s.Type.OID,!1,n)),a.value.push(s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,""));var o=s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(a),i.value.push(o),s.toDer(i).getBytes()},y=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var a;t.dP||(t.dP=t.d.mod(t.p.subtract(i.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(i.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{a=new i(n.util.bytesToHex(n.random.getBytes(t.n.bitLength()/8)),16)}while(a.compareTo(t.n)>=0||!a.gcd(t.n).equals(i.ONE));for(var s=(e=e.multiply(a.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),o=e.mod(t.q).modPow(t.dQ,t.q);s.compareTo(o)<0;)s=s.add(t.p);var u=s.subtract(o).multiply(t.qInv).mod(t.p).multiply(t.q).add(o);return u=u.multiply(a.modInverse(t.n)).mod(t.n)};function g(e,t,r){var i=n.util.createBuffer(),a=Math.ceil(t.n.bitLength()/8);if(e.length>a-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=a-11,s}i.putByte(0),i.putByte(r);var o,u=a-3-e.length;if(0===r||1===r){o=0===r?0:255;for(var c=0;c<u;++c)i.putByte(o)}else for(;u>0;){var l=0,f=n.random.getBytes(u);for(c=0;c<u;++c)0===(o=f.charCodeAt(c))?++l:i.putByte(o);u=l}return i.putByte(0),i.putBytes(e),i}function m(e,t,r,i){var a=Math.ceil(t.n.bitLength()/8),s=n.util.createBuffer(e),o=s.getByte(),u=s.getByte();if(0!==o||r&&0!==u&&1!==u||!r&&2!=u||r&&0===u&&void 0===i)throw new Error("Encryption block is invalid.");var c=0;if(0===u){c=a-3-i;for(var l=0;l<c;++l)if(0!==s.getByte())throw new Error("Encryption block is invalid.")}else if(1===u)for(c=0;s.length()>1;){if(255!==s.getByte()){--s.read;break}++c}else if(2===u)for(c=0;s.length()>1;){if(0===s.getByte()){--s.read;break}++c}if(0!==s.getByte()||c!==a-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function v(e,t,r){"function"==typeof t&&(r=t,t={});var a={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function s(){o(e.pBits,(function(t,n){return t?r(t):(e.p=n,null!==e.q?c(t,e.q):void o(e.qBits,c))}))}function o(e,t){n.prime.generateProbablePrime(e,a,t)}function c(t,n){if(t)return r(t);if(e.q=n,e.p.compareTo(e.q)<0){var a=e.p;e.p=e.q,e.q=a}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.p=null,void s();if(0!==e.q.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.q=null,void o(e.qBits,c);if(e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(i.ONE))return e.p=e.q=null,void s();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void o(e.qBits,c);var l=e.e.modInverse(e.phi);e.keys={privateKey:u.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:u.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"prng"in t&&(a.prng=t.prng),s()}function b(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=n.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function E(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function C(e){return n.util.isNodejs&&"function"==typeof a[e]}function S(e){return void 0!==o.globalScope&&"object"==typeof o.globalScope.crypto&&"object"==typeof o.globalScope.crypto.subtle&&"function"==typeof o.globalScope.crypto.subtle[e]}function T(e){return void 0!==o.globalScope&&"object"==typeof o.globalScope.msCrypto&&"object"==typeof o.globalScope.msCrypto.subtle&&"function"==typeof o.globalScope.msCrypto.subtle[e]}function A(e){for(var t=n.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),i=0;i<t.length;++i)r[i]=t.charCodeAt(i);return r}u.rsa.encrypt=function(e,t,r){var a,s=r,o=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(s=2===r,a=g(e,t,r)):(a=n.util.createBuffer()).putBytes(e);for(var u=new i(a.toHex(),16),c=y(u,t,s).toString(16),l=n.util.createBuffer(),f=o-Math.ceil(c.length/2);f>0;)l.putByte(0),--f;return l.putBytes(n.util.hexToBytes(c)),l.getBytes()},u.rsa.decrypt=function(e,t,r,a){var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var o=new Error("Encrypted message length is invalid.");throw o.length=e.length,o.expected=s,o}var u=new i(n.util.createBuffer(e).toHex(),16);if(u.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var c=y(u,t,r).toString(16),l=n.util.createBuffer(),f=s-Math.ceil(c.length/2);f>0;)l.putByte(0),--f;return l.putBytes(n.util.hexToBytes(c)),!1!==a?m(l.getBytes(),t,r):l.getBytes()},u.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048;var a,s=(r=r||{}).prng||n.random,o={nextBytes:function(e){for(var t=s.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},u=r.algorithm||"PRIMEINC";if("PRIMEINC"!==u)throw new Error("Invalid key generation algorithm: "+u);return(a={algorithm:u,state:0,bits:e,rng:o,eInt:t||65537,e:new i(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(a.eInt),a},u.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new i(null);r.fromInt(30);for(var n,a=0,s=function(e,t){return e|t},o=+new Date,l=0;null===e.keys&&(t<=0||l<t);){if(0===e.state){var f=null===e.p?e.pBits:e.qBits,h=f-1;0===e.pqState?(e.num=new i(f,e.rng),e.num.testBit(h)||e.num.bitwiseTo(i.ONE.shiftLeft(h),s,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),a=0,++e.pqState):1===e.pqState?e.num.bitLength()>f?e.pqState=0:e.num.isProbablePrime(E(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(c[a++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(i.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var p=e.e.modInverse(e.phi);e.keys={privateKey:u.rsa.setPrivateKey(e.n,e.e,p,e.p,e.q,p.mod(e.p1),p.mod(e.q1),e.q.modInverse(e.p)),publicKey:u.rsa.setPublicKey(e.n,e.e)}}l+=(n=+new Date)-o,o=n}return null!==e.keys},u.rsa.generateKeyPair=function(e,t,r,i){if(1===arguments.length?"object"==typeof e?(r=e,e=void 0):"function"==typeof e&&(i=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(i=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,i=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(i=r,r=void 0):(i=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!n.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(i){if(C("generateKeyPair"))return a.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,r){if(e)return i(e);i(null,{privateKey:u.privateKeyFromPem(r),publicKey:u.publicKeyFromPem(t)})}));if(S("generateKey")&&S("exportKey"))return o.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:A(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return o.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)})).then(void 0,(function(e){i(e)})).then((function(e){if(e){var t=u.privateKeyFromAsn1(s.fromDer(n.util.createBuffer(e)));i(null,{privateKey:t,publicKey:u.setRsaPublicKey(t.n,t.e)})}}));if(T("generateKey")&&T("exportKey")){var c=o.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:A(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return c.oncomplete=function(e){var t=e.target.result,r=o.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=u.privateKeyFromAsn1(s.fromDer(n.util.createBuffer(t)));i(null,{privateKey:r,publicKey:u.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){i(e)}},void(c.onerror=function(e){i(e)})}}else if(C("generateKeyPairSync")){var l=a.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:u.privateKeyFromPem(l.privateKey),publicKey:u.publicKeyFromPem(l.publicKey)}}var f=u.rsa.createKeyPairGenerationState(e,t,r);if(!i)return u.rsa.stepKeyPairGenerationState(f,0),f.keys;v(f,r,i)},u.setRsaPublicKey=u.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,i){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return g(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return n.pkcs1.encode_rsa_oaep(t,e,i)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var a=t.encode(e,r,!0);return u.rsa.encrypt(a,r,!0)},verify:function(e,t,n){"string"==typeof n?n=n.toUpperCase():void 0===n&&(n="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===n?n={verify:function(e,t){return t=m(t,r,!0),e===s.fromDer(t).value[1].value}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(e,t){return e===(t=m(t,r,!0))}});var i=u.rsa.decrypt(t,r,!0,!1);return n.verify(e,i,r.n.bitLength())}};return r},u.setRsaPrivateKey=u.rsa.setPrivateKey=function(e,t,r,i,a,s,o,c){var l={n:e,e:t,d:r,p:i,q:a,dP:s,dQ:o,qInv:c,decrypt:function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var i=u.rsa.decrypt(e,l,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:m};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return n.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(i,l,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:d},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,l.n.bitLength());return u.rsa.encrypt(n,l,r)}};return l},u.wrapRsaPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(u.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,s.toDer(e).getBytes())])},u.privateKeyFromAsn1=function(e){var t,r,a,o,c,h,p,d,y={},g=[];if(s.validate(e,l,y,g)&&(e=s.fromDer(n.util.createBuffer(y.privateKey))),y={},g=[],!s.validate(e,f,y,g)){var m=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw m.errors=g,m}return t=n.util.createBuffer(y.privateKeyModulus).toHex(),r=n.util.createBuffer(y.privateKeyPublicExponent).toHex(),a=n.util.createBuffer(y.privateKeyPrivateExponent).toHex(),o=n.util.createBuffer(y.privateKeyPrime1).toHex(),c=n.util.createBuffer(y.privateKeyPrime2).toHex(),h=n.util.createBuffer(y.privateKeyExponent1).toHex(),p=n.util.createBuffer(y.privateKeyExponent2).toHex(),d=n.util.createBuffer(y.privateKeyCoefficient).toHex(),u.setRsaPrivateKey(new i(t,16),new i(r,16),new i(a,16),new i(o,16),new i(c,16),new i(h,16),new i(p,16),new i(d,16))},u.privateKeyToAsn1=u.privateKeyToRSAPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.e)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.d)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.p)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.q)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.dP)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.dQ)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.qInv))])},u.publicKeyFromAsn1=function(e){var t={},r=[];if(s.validate(e,p,t,r)){var a,o=s.derToOid(t.publicKeyOid);if(o!==u.oids.rsaEncryption)throw(a=new Error("Cannot read public key. Unknown OID.")).oid=o,a;e=t.rsaPublicKey}if(r=[],!s.validate(e,h,t,r))throw(a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,a;var c=n.util.createBuffer(t.publicKeyModulus).toHex(),l=n.util.createBuffer(t.publicKeyExponent).toHex();return u.setRsaPublicKey(new i(c,16),new i(l,16))},u.publicKeyToAsn1=u.publicKeyToSubjectPublicKeyInfo=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(u.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.BITSTRING,!1,[u.publicKeyToRSAPublicKey(e)])])},u.publicKeyToRSAPublicKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.e))])}},function(e,t,r){var n=r(0);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.aes.Algorithm(e,t)}))}r(24),r(34),r(1),e.exports=n.aes=n.aes||{},n.aes.startEncrypting=function(e,t,r,n){var i=d({key:e,output:r,decrypt:!1,mode:n});return i.start(t),i},n.aes.createEncryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!1,mode:t})},n.aes.startDecrypting=function(e,t,r,n){var i=d({key:e,output:r,decrypt:!0,mode:n});return i.start(t),i},n.aes.createDecryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!0,mode:t})},n.aes.Algorithm=function(e,t){l||f();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return p(r._w,e,t,!1)},decrypt:function(e,t){return p(r._w,e,t,!0)}}}),r._init=!1},n.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(n.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=n.util.createBuffer();for(var i=0;i<t.length;++i)r.putByte(t[i])}}else r=n.util.createBuffer(r);if(!n.util.isArray(r)){t=r,r=[];var a=t.length();if(16===a||24===a||32===a){a>>>=2;for(i=0;i<a;++i)r.push(t.getInt32())}}if(!n.util.isArray(r)||4!==r.length&&6!==r.length&&8!==r.length)throw new Error("Invalid key parameter.");var s=this.mode.name,o=-1!==["CFB","OFB","CTR","GCM"].indexOf(s);this._w=h(r,e.decrypt&&!o),this._init=!0}},n.aes._expandKey=function(e,t){return l||f(),h(e,t)},n.aes._updateBlock=p,i("AES-ECB",n.cipher.modes.ecb),i("AES-CBC",n.cipher.modes.cbc),i("AES-CFB",n.cipher.modes.cfb),i("AES-OFB",n.cipher.modes.ofb),i("AES-CTR",n.cipher.modes.ctr),i("AES-GCM",n.cipher.modes.gcm);var a,s,o,u,c,l=!1;function f(){l=!0,o=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;a=new Array(256),s=new Array(256),u=new Array(4),c=new Array(4);for(t=0;t<4;++t)u[t]=new Array(256),c[t]=new Array(256);var r,n,i,f,h,p,d,y=0,g=0;for(t=0;t<256;++t){f=(f=g^g<<1^g<<2^g<<3^g<<4)>>8^255&f^99,a[y]=f,s[f]=y,p=(h=e[f])<<24^f<<16^f<<8^f^h,d=((r=e[y])^(n=e[r])^(i=e[n]))<<24^(y^i)<<16^(y^n^i)<<8^y^r^i;for(var m=0;m<4;++m)u[m][y]=p,c[m][f]=d,p=p<<24|p>>>8,d=d<<24|d>>>8;0===y?y=g=1:(y=r^e[e[e[r^i]]],g^=e[e[g]])}}function h(e,t){for(var r,n=e.slice(0),i=1,s=n.length,u=4*(s+6+1),l=s;l<u;++l)r=n[l-1],l%s==0?(r=a[r>>>16&255]<<24^a[r>>>8&255]<<16^a[255&r]<<8^a[r>>>24]^o[i]<<24,i++):s>6&&l%s==4&&(r=a[r>>>24]<<24^a[r>>>16&255]<<16^a[r>>>8&255]<<8^a[255&r]),n[l]=n[l-s]^r;if(t){for(var f,h=c[0],p=c[1],d=c[2],y=c[3],g=n.slice(0),m=(l=0,(u=n.length)-4);l<u;l+=4,m-=4)if(0===l||l===u-4)g[l]=n[m],g[l+1]=n[m+3],g[l+2]=n[m+2],g[l+3]=n[m+1];else for(var v=0;v<4;++v)f=n[m+v],g[l+(3&-v)]=h[a[f>>>24]]^p[a[f>>>16&255]]^d[a[f>>>8&255]]^y[a[255&f]];n=g}return n}function p(e,t,r,n){var i,o,l,f,h,p,d,y,g,m,v,b,E=e.length/4-1;n?(i=c[0],o=c[1],l=c[2],f=c[3],h=s):(i=u[0],o=u[1],l=u[2],f=u[3],h=a),p=t[0]^e[0],d=t[n?3:1]^e[1],y=t[2]^e[2],g=t[n?1:3]^e[3];for(var C=3,S=1;S<E;++S)m=i[p>>>24]^o[d>>>16&255]^l[y>>>8&255]^f[255&g]^e[++C],v=i[d>>>24]^o[y>>>16&255]^l[g>>>8&255]^f[255&p]^e[++C],b=i[y>>>24]^o[g>>>16&255]^l[p>>>8&255]^f[255&d]^e[++C],g=i[g>>>24]^o[p>>>16&255]^l[d>>>8&255]^f[255&y]^e[++C],p=m,d=v,y=b;r[0]=h[p>>>24]<<24^h[d>>>16&255]<<16^h[y>>>8&255]<<8^h[255&g]^e[++C],r[n?3:1]=h[d>>>24]<<24^h[y>>>16&255]<<16^h[g>>>8&255]<<8^h[255&p]^e[++C],r[2]=h[y>>>24]<<24^h[g>>>16&255]<<16^h[p>>>8&255]<<8^h[255&d]^e[++C],r[n?1:3]=h[g>>>24]<<24^h[p>>>16&255]<<16^h[d>>>8&255]<<8^h[255&y]^e[++C]}function d(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var a=null;r instanceof n.util.ByteBuffer&&(a=r,r={}),(r=r||{}).output=a,r.iv=e,i.call(t,r)},t}},function(e,t,r){var n=r(0);r(1),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return(e=e.toUpperCase())in n.cipher.algorithms?n.cipher.algorithms[e]:null};var i=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};i.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},i.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},i.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t){},function(e,t,r){var n=r(0);r(4),r(1),(e.exports=n.hmac=n.hmac||{}).create=function(){var e=null,t=null,r=null,i=null,a={start:function(a,s){if(null!==a)if("string"==typeof a){if(!((a=a.toLowerCase())in n.md.algorithms))throw new Error('Unknown hash algorithm "'+a+'"');t=n.md.algorithms[a].create()}else t=a;if(null===s)s=e;else{if("string"==typeof s)s=n.util.createBuffer(s);else if(n.util.isArray(s)){var o=s;s=n.util.createBuffer();for(var u=0;u<o.length;++u)s.putByte(o[u])}var c=s.length();c>t.blockLength&&(t.start(),t.update(s.bytes()),s=t.digest()),r=n.util.createBuffer(),i=n.util.createBuffer(),c=s.length();for(u=0;u<c;++u){o=s.at(u);r.putByte(54^o),i.putByte(92^o)}if(c<t.blockLength)for(o=t.blockLength-c,u=0;u<o;++u)r.putByte(54),i.putByte(92);e=s,r=r.bytes(),i=i.bytes()}t.start(),t.update(r)},update:function(e){t.update(e)},getMac:function(){var e=t.digest().bytes();return t.start(),t.update(i),t.update(e),t.digest()}};return a.digest=a.getMac,a}},function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(14),a=r(38),s=r(8),o=r(6),u=r(13),c=r(28),l=n(r(21));t.seedWithNonce=function(e,t){return{seed:a.Seed.toBinary(e).seed,nonce:t}},t.buildAddress=function(e,t){void 0===t&&(t=i.MAIN_NET_CHAIN_ID);var r=[1,"string"==typeof t?t.charCodeAt(0):t],n=s._hashChain(e).slice(0,20),a=u.concat(r,n),o=s._hashChain(a).slice(0,4);return u.concat(a,o)};t.keyPair=function(e){var t=a.Seed.toBinary(e),r=function(e,t){var r=[0,0,0,0];if(t&&t>0)for(var n=t,i=3;i>=0;i--)r[3-i]=Math.floor(n/Math.pow(2,8*i)),n%=Math.pow(2,8*i);var a=u.concat(r,e),o=s._hashChain(a);return s.sha256(o)}(t.seed,t.nonce),n=l.default.generateKeyPair(r);return{privateKey:n.private,publicKey:n.public}},t.address=function(e,r){return void 0===r&&(r=i.MAIN_NET_CHAIN_ID),c.isPublicKey(e)?t.buildAddress(o._fromIn(e.publicKey),r):t.address(t.keyPair(e),r)},t.publicKey=function(e){return c.isPrivateKey(e)?l.default.generateKeyPair(o._fromIn(e.privateKey)).public:t.keyPair(e).publicKey},t.privateKey=function(e){return t.keyPair(e).privateKey}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isPublicKey=function(e){return void 0!==e.publicKey},t.isPrivateKey=function(e){return void 0!==e.privateKey}},function(e,t,r){var n=r(0);r(1);var i=e.exports=n.pem=n.pem||{};function a(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},i=0;i<e.values.length;++i)r.push(e.values[i].replace(/^(\S+\r\n)/,n));t+=r.join(",")+"\r\n";var a=0,s=-1;for(i=0;i<t.length;++i,++a)if(a>65&&-1!==s){var o=t[s];","===o?(++s,t=t.substr(0,s)+"\r\n "+t.substr(s)):t=t.substr(0,s)+"\r\n"+o+t.substr(s+1),a=i-s-1,s=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(s=i);return t}function s(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var r,i="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(i+=a(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(i+=a(r={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),i+=a(r)),e.headers)for(var s=0;s<e.headers.length;++s)i+=a(e.headers[s]);return e.procType&&(i+="\r\n"),i+=n.util.encode64(e.body,t.maxline||64)+"\r\n",i+="-----END "+e.type+"-----\r\n"},i.decode=function(e){for(var t,r=[],i=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,a=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,o=/\r?\n/;t=i.exec(e);){var u={type:t[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:n.util.decode64(t[3])};if(r.push(u),t[2]){for(var c=t[2].split(o),l=0;t&&l<c.length;){for(var f=c[l].replace(/\s+$/,""),h=l+1;h<c.length;++h){var p=c[h];if(!/\s/.test(p[0]))break;f+=p,l=h}if(t=f.match(a)){for(var d={name:t[1],values:[]},y=t[2].split(","),g=0;g<y.length;++g)d.values.push(s(y[g]));if(u.procType)if(u.contentDomain||"Content-Domain"!==d.name)if(u.dekInfo||"DEK-Info"!==d.name)u.headers.push(d);else{if(0===d.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');u.dekInfo={algorithm:y[0],parameters:y[1]||null}}else u.contentDomain=y[0]||"";else{if("Proc-Type"!==d.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==d.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');u.procType={version:y[0],type:y[1]}}}++l}if("ENCRYPTED"===u.procType&&!u.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===r.length)throw new Error("Invalid PEM formatted message.");return r}},function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0,t.fetchHeightByTimestamp=t.fetchHeight=t.fetchDelay=t.fetchLast=t.fetchBlocksByAddress=t.fetchFirst=t.fetchBlockById=t.fetchSeq=t.fetchBlockAt=t.fetchHeadersById=t.fetchHeadersAt=t.fetchHeightById=t.fetchHeadersLast=t.fetchHeadersSeq=void 0;var i=n(r(2));t.fetchHeadersSeq=function(e,t,r,n){return void 0===n&&(n=Object.create(null)),i.default({base:e,url:"/blocks/headers/seq/"+t+"/"+r,options:n})},t.fetchHeadersLast=function(e,t){return void 0===t&&(t=Object.create(null)),i.default({base:e,url:"/blocks/headers/last",options:t})},t.fetchHeightById=function(e,t){return i.default({base:e,url:"/blocks/height/"+t})},t.fetchHeadersAt=function(e,t,r){return void 0===r&&(r=Object.create(null)),i.default({base:e,url:"/blocks/headers/at/"+t,options:r})},t.fetchHeadersById=function(e,t,r){return void 0===r&&(r=Object.create(null)),i.default({base:e,url:"/blocks/headers/"+t,options:r})},t.fetchBlockAt=function(e,t,r){return void 0===r&&(r=Object.create(null)),i.default({base:e,url:"/blocks/at/"+t,options:r})},t.fetchSeq=function(e,t,r,n){return void 0===n&&(n=Object.create(null)),i.default({base:e,url:"/blocks/seq/"+t+"/"+r,options:n})},t.fetchBlockById=function(e,t,r){return void 0===r&&(r=Object.create(null)),i.default({base:e,url:"/blocks/"+t,options:r})},t.fetchFirst=function(e,t){return void 0===t&&(t=Object.create(null)),i.default({base:e,url:"/blocks/first",options:t})},t.fetchBlocksByAddress=function(e,t,r,n,a){return void 0===a&&(a=Object.create(null)),i.default({base:e,url:"/blocks/address/"+t+"/"+r+"/"+n,options:a})},t.fetchLast=function(e,t){return void 0===t&&(t=Object.create(null)),i.default({base:e,url:"/blocks/last",options:t})},t.fetchDelay=function(e,t,r){return i.default({base:e,url:"/blocks/delay/"+t+"/"+r})},t.fetchHeight=function(e){return i.default({base:e,url:"/blocks/height"})},t.fetchHeightByTimestamp=function(e,t,r){return void 0===r&&(r=Object.create(null)),i.default({base:e,url:"/blocks/heightByTimestamp/"+t,options:r})}},function(e,t,r){"use strict";t.__esModule=!0,t.TRANSACTION_STATUSES=t.NAME_MAP=t.TYPE_MAP=void 0,t.TYPE_MAP={3:"issue",4:"transfer",5:"reissue",6:"burn",7:"exchange",8:"lease",9:"cancelLease",10:"alias",11:"massTransfer",12:"data",13:"setScript",14:"sponsorship",15:"setAssetScript",16:"invoke",17:"updateAsset"},t.NAME_MAP={issue:3,transfer:4,reissue:5,burn:6,exchange:7,lease:8,cancelLease:9,alias:10,massTransfer:11,data:12,setScript:13,sponsorship:14,setAssetScript:15,invoke:16,updateAsset:17},t.TRANSACTION_STATUSES={IN_BLOCKCHAIN:"in_blockchain",UNCONFIRMED:"unconfirmed",NOT_FOUND:"not_found"}},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function s(e){try{u(n.next(e))}catch(e){a(e)}}function o(e){try{u(n.throw(e))}catch(e){a(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(s,o)}u((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,i,a,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(a){return function(o){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,o])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0,t.fetchBalanceAddressAssetId=t.fetchAssetsBalance=t.fetchAssetsNft=t.fetchAssetsAddressLimit=t.fetchAssetDistribution=t.fetchAssetsDetails=t.fetchDetails=void 0;var s=r(52),o=a(r(2)),u=r(3);function c(e,t,r){void 0===r&&(r=Object.create(null));var n=t.map((function(e){return"id="+e})).join("&"),i=t.length?"?"+n:"";return o.default({base:e,url:"/assets/details"+i,options:r})}t.fetchDetails=function(e,t,r){void 0===r&&(r=Object.create(null));var n=!Array.isArray(t);return Promise.all(u.toArray(t).map((function(t){return o.default({base:e,url:"/assets/details/"+t,options:r})}))).then((function(e){return n?e[0]:e}))},t.fetchAssetsDetails=c,t.fetchAssetDistribution=function(e,t,r,n,i){return void 0===i&&(i=Object.create(null)),o.default({base:e,url:"/assets/"+t+"/distribution/"+r+"/limit/"+n,options:i})},t.fetchAssetsAddressLimit=function(e,t,r,n){return void 0===n&&(n=Object.create(null)),o.default({base:e,url:"assets/nft/"+t+"/limit/"+r,options:n})},t.fetchAssetsNft=function(e,t,r){var n=t.address,i=t.limit,a=t.after;void 0===r&&(r=Object.create(null));var s=new URL("assets/nft/"+n+"/limit/"+i,e);return a&&s.searchParams.append("after",a),o.default({base:e,url:""+s.pathname+s.search,options:r})},t.fetchAssetsBalance=function(e,t,r){return void 0===r&&(r=Object.create(null)),n(this,void 0,void 0,(function(){var n,a;return i(this,(function(i){switch(i.label){case 0:return[4,o.default({base:e,url:"/assets/balance/"+t,options:r})];case 1:return n=i.sent(),a=n.balances.reduce((function(e,t,r){return t.issueTransaction||(e[t.assetId]=r),e}),{}),[4,c(e,Object.keys(a),r)];case 2:return i.sent().forEach((function(e){if(!("error"in e)){var t=a[e.assetId],r=n.balances[t];r&&(r.issueTransaction={id:e.originTransactionId,name:e.name,decimals:e.decimals,description:e.description,quantity:e.quantity,reissuable:e.reissuable,sender:e.issuer,senderPublicKey:e.issuerPublicKey,timestamp:e.issueTimestamp,height:e.issueHeight,script:e.scripted?"-":null,proofs:[],fee:Math.pow(10,8),feeAssetId:null,version:3,type:s.TRANSACTION_TYPE.ISSUE,chainId:0})}})),[2,n]}}))}))},t.fetchBalanceAddressAssetId=function(e,t,r,n){return void 0===n&&(n=Object.create(null)),o.default({base:e,url:"/assets/balance/"+t+"/"+r,options:n})}},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<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return s},a=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(i(arguments[t]));return e};Object.defineProperty(t,"__esModule",{value:!0});var s=r(18),o=r(37),u=r(20),c=r(5),l=r(13),f=r(8),h=r(27),p=r(70),d=r(71),y=r(72),g=r(83),m=r(84);t.crypto=function(e){if(e&&""==e.seed)throw new Error("Empty seed is not allowed.");var t,r=function(e,t){return function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return e.apply(void 0,a([t],r))}},i=function(t){return function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=t.apply(void 0,a(r));return!e||e&&"Base58"===e.output?u.base58Encode(i):i}},v=e&&e.seed?e.seed:void 0,b={seedWithNonce:v?r(h.seedWithNonce,v):h.seedWithNonce,signBytes:i(v?r(p.signBytes,v):p.signBytes),keyPair:(t=v?r(h.keyPair,v):h.keyPair,function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=t.apply(void 0,a(r));return!e||e&&"Base58"===e.output?{privateKey:u.base58Encode(i.privateKey),publicKey:u.base58Encode(i.publicKey)}:i}),publicKey:i(v?r(h.publicKey,v):h.publicKey),privateKey:i(v?r(h.privateKey,v):h.privateKey),address:i(v?r(h.address,v):h.address)};return n({},b,{sharedKey:i(o.sharedKey),buildAddress:h.buildAddress,blake2b:f.blake2b,keccak:f.keccak,sha256:f.sha256,base64Encode:u.base64Encode,base64Decode:u.base64Decode,base58Encode:u.base58Encode,base58Decode:u.base58Decode,base16Encode:u.base16Encode,base16Decode:u.base16Decode,stringToBytes:c.stringToBytes,bytesToString:c.bytesToString,random:s.random,randomSeed:s.randomSeed,randomBytes:s.randomBytes,verifySignature:d.verifySignature,verifyPublicKey:d.verifyPublicKey,verifyAddress:d.verifyAddress,messageDecrypt:o.messageDecrypt,messageEncrypt:o.messageEncrypt,aesDecrypt:o.aesDecrypt,aesEncrypt:o.aesEncrypt,encryptSeed:g.encryptSeed,decryptSeed:g.decryptSeed,rsaKeyPair:y.rsaKeyPair,rsaKeyPairSync:y.rsaKeyPairSync,rsaSign:y.rsaSign,rsaVerify:y.rsaVerify,merkleVerify:m.merkleVerify,split:l.split,concat:l.concat})}},function(e,t,r){var n=r(0);r(1),n.cipher=n.cipher||{};var i=e.exports=n.cipher.modes=n.cipher.modes||{};function a(e){if("string"==typeof e&&(e=n.util.createBuffer(e)),n.util.isArray(e)&&e.length>4){var t=e;e=n.util.createBuffer();for(var r=0;r<t.length;++r)e.putByte(t[r])}return n.util.isArray(e)||(e=[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()]),e}function s(e){e[e.length-1]=e[e.length-1]+1&4294967295}function o(e){return[e/4294967296|0,4294967295&e]}i.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.ecb.prototype.start=function(e){},i.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},i.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},i.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},i.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=a(e.iv),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]);this._prev=this._outBlock},i.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)},i.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},i.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=a(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32()^this._outBlock[i],t.putInt32(this._inBlock[i]);else{var a=(this.blockSize-n)%this.blockSize;a>0&&(a=this.blockSize-a),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32()^this._outBlock[i],this._partialOutput.putInt32(this._partialBlock[i]);if(a>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32(),t.putInt32(this._inBlock[i]^this._outBlock[i]);else{var a=(this.blockSize-n)%this.blockSize;a>0&&(a=this.blockSize-a),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[i]^this._outBlock[i]);if(a>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=a(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]),this._inBlock[i]=this._outBlock[i];else{var a=(this.blockSize-n)%this.blockSize;a>0&&(a=this.blockSize-a),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(a>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._outBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=a(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]);else{var a=(this.blockSize-n)%this.blockSize;a>0&&(a=this.blockSize-a),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(a>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}s(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=n.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?n.util.createBuffer(e.additionalData):n.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=n.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=r.length();if(12===i)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(o(8*i)))}this._inBlock=this._j0.slice(0),s(this._inBlock),this._partialBytes=0,t=n.util.createBuffer(t),this._aDataLength=o(8*t.length());var a=t.length()%this.blockSize;for(a&&t.fillWithByte(0,this.blockSize-a),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},i.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^=e.getInt32());this._cipherLength+=this.blockSize}else{var a=(this.blockSize-n)%this.blockSize;a>0&&(a=this.blockSize-a),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(a<=0||r){if(r){var o=n%this.blockSize;this._cipherLength+=o,this._partialOutput.truncate(this.blockSize-o)}else this._cipherLength+=this.blockSize;for(i=0;i<this._ints;++i)this._outBlock[i]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),s(this._inBlock)},i.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n<this.blockSize&&!(r&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),s(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^this._hashBlock[i]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize},i.gcm.prototype.afterFinish=function(e,t){var r=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=n.util.createBuffer();var i=this._aDataLength.concat(o(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,i);var a=[];this.cipher.encrypt(this._j0,a);for(var s=0;s<this._ints;++s)this.tag.putInt32(this._s[s]^a[s]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r},i.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],n=t.slice(0),i=0;i<128;++i){e[i/32|0]&1<<31-i%32&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n)}return r},i.gcm.prototype.pow=function(e,t){for(var r=1&e[3],n=3;n>0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},i.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=e[r/8|0]>>>4*(7-r%8)&15,i=this._m[r][n];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},i.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},i.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,i=16*r,a=new Array(i),s=0;s<i;++s){var o=[0,0,0,0],u=(n-1-s%n)*t;o[s/n|0]=1<<t-1<<u,a[s]=this.generateSubHashTable(this.multiply(o,e),t)}return a},i.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,n=r>>>1,i=new Array(r);i[n]=e.slice(0);for(var a=n>>>1;a>0;)this.pow(i[2*a],i[a]=[]),a>>=1;for(a=2;a<n;){for(var s=1;s<a;++s){var o=i[a],u=i[s];i[a+s]=[o[0]^u[0],o[1]^u[1],o[2]^u[2],o[3]^u[3]]}a*=2}for(i[0]=[0,0,0,0],a=n+1;a<r;++a){var c=i[a^n];i[a]=[e[0]^c[0],e[1]^c[1],e[2]^c[2],e[3]^c[3]]}return i}},function(e,t,r){var n=r(0);r(4),r(1);var i=e.exports=n.sha256=n.sha256||{};n.md.sha256=n.md.algorithms.sha256=i,i.create=function(){s||(a=String.fromCharCode(128),a+=n.util.fillString(String.fromCharCode(0),64),o=[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=!0);var e=null,t=n.util.createBuffer(),r=new Array(64),i={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,a=0;a<r;++a)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},i}};return i.start(),i.update=function(a,s){"utf8"===s&&(a=n.util.encodeUtf8(a));var o=a.length;i.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var c=i.fullMessageLength.length-1;c>=0;--c)i.fullMessageLength[c]+=o[1],o[1]=o[0]+(i.fullMessageLength[c]/4294967296>>>0),i.fullMessageLength[c]=i.fullMessageLength[c]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(a),u(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var o,c=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;s.putBytes(a.substr(0,i.blockLength-c));for(var l=8*i.fullMessageLength[0],f=0;f<i.fullMessageLength.length-1;++f)l+=(o=8*i.fullMessageLength[f+1])/4294967296>>>0,s.putInt32(l>>>0),l=o>>>0;s.putInt32(l);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};u(h,r,s);var p=n.util.createBuffer();return p.putInt32(h.h0),p.putInt32(h.h1),p.putInt32(h.h2),p.putInt32(h.h3),p.putInt32(h.h4),p.putInt32(h.h5),p.putInt32(h.h6),p.putInt32(h.h7),p},i};var a=null,s=!1,o=null;function u(e,t,r){for(var n,i,a,s,u,c,l,f,h,p,d,y,g,m=r.length();m>=64;){for(u=0;u<16;++u)t[u]=r.getInt32();for(;u<64;++u)n=((n=t[u-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=((i=t[u-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[u]=n+t[u-7]+i+t[u-16]|0;for(c=e.h0,l=e.h1,f=e.h2,h=e.h3,p=e.h4,d=e.h5,y=e.h6,g=e.h7,u=0;u<64;++u)a=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),s=c&l|f&(c^l),n=g+((p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(y^p&(d^y))+o[u]+t[u],g=y,y=d,d=p,p=h+n>>>0,h=f,f=l,l=c,c=n+(i=a+s)>>>0;e.h0=e.h0+c|0,e.h1=e.h1+l|0,e.h2=e.h2+f|0,e.h3=e.h3+h|0,e.h4=e.h4+p|0,e.h5=e.h5+d|0,e.h6=e.h6+y|0,e.h7=e.h7+g|0,m-=64}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.seedWordsList=["abandon","ability","able","about","above","absent","absorb","abstract","absurd","abuse","access","accident","account","accuse","achieve","acid","acoustic","acquire","across","act","action","actor","actress","actual","adapt","add","addict","address","adjust","admit","adult","advance","advice","aerobic","affair","afford","afraid","again","age","agent","agree","ahead","aim","air","airport","aisle","alarm","album","alcohol","alert","alien","all","alley","allow","almost","alone","alpha","already","also","alter","always","amateur","amazing","among","amount","amused","analyst","anchor","ancient","anger","angle","angry","animal","ankle","announce","annual","another","answer","antenna","antique","anxiety","any","apart","apology","appear","apple","approve","april","arch","arctic","area","arena","argue","arm","armed","armor","army","around","arrange","arrest","arrive","arrow","art","artefact","artist","artwork","ask","aspect","assault","asset","assist","assume","asthma","athlete","atom","attack","attend","attitude","attract","auction","audit","august","aunt","author","auto","autumn","average","avocado","avoid","awake","aware","away","awesome","awful","awkward","axis","baby","bachelor","bacon","badge","bag","balance","balcony","ball","bamboo","banana","banner","bar","barely","bargain","barrel","base","basic","basket","battle","beach","bean","beauty","because","become","beef","before","begin","behave","behind","believe","below","belt","bench","benefit","best","betray","better","between","beyond","bicycle","bid","bike","bind","biology","bird","birth","bitter","black","blade","blame","blanket","blast","bleak","bless","blind","blood","blossom","blouse","blue","blur","blush","board","boat","body","boil","bomb","bone","bonus","book","boost","border","boring","borrow","boss","bottom","bounce","box","boy","bracket","brain","brand","brass","brave","bread","breeze","brick","bridge","brief","bright","bring","brisk","broccoli","broken","bronze","broom","brother","brown","brush","bubble","buddy","budget","buffalo","build","bulb","bulk","bullet","bundle","bunker","burden","burger","burst","bus","business","busy","butter","buyer","buzz","cabbage","cabin","cable","cactus","cage","cake","call","calm","camera","camp","can","canal","cancel","candy","cannon","canoe","canvas","canyon","capable","capital","captain","car","carbon","card","cargo","carpet","carry","cart","case","cash","casino","castle","casual","cat","catalog","catch","category","cattle","caught","cause","caution","cave","ceiling","celery","cement","census","century","cereal","certain","chair","chalk","champion","change","chaos","chapter","charge","chase","chat","cheap","check","cheese","chef","cherry","chest","chicken","chief","child","chimney","choice","choose","chronic","chuckle","chunk","churn","cigar","cinnamon","circle","citizen","city","civil","claim","clap","clarify","claw","clay","clean","clerk","clever","click","client","cliff","climb","clinic","clip","clock","clog","close","cloth","cloud","clown","club","clump","cluster","clutch","coach","coast","coconut","code","coffee","coil","coin","collect","color","column","combine","come","comfort","comic","common","company","concert","conduct","confirm","congress","connect","consider","control","convince","cook","cool","copper","copy","coral","core","corn","correct","cost","cotton","couch","country","couple","course","cousin","cover","coyote","crack","cradle","craft","cram","crane","crash","crater","crawl","crazy","cream","credit","creek","crew","cricket","crime","crisp","critic","crop","cross","crouch","crowd","crucial","cruel","cruise","crumble","crunch","crush","cry","crystal","cube","culture","cup","cupboard","curious","current","curtain","curve","cushion","custom","cute","cycle","dad","damage","damp","dance","danger","daring","dash","daughter","dawn","day","deal","debate","debris","decade","december","decide","decline","decorate","decrease","deer","defense","define","defy","degree","delay","deliver","demand","demise","denial","dentist","deny","depart","depend","deposit","depth","deputy","derive","describe","desert","design","desk","despair","destroy","detail","detect","develop","device","devote","diagram","dial","diamond","diary","dice","diesel","diet","differ","digital","dignity","dilemma","dinner","dinosaur","direct","dirt","disagree","discover","disease","dish","dismiss","disorder","display","distance","divert","divide","divorce","dizzy","doctor","document","dog","doll","dolphin","domain","donate","donkey","donor","door","dose","double","dove","draft","dragon","drama","drastic","draw","dream","dress","drift","drill","drink","drip","drive","drop","drum","dry","duck","dumb","dune","during","dust","dutch","duty","dwarf","dynamic","eager","eagle","early","earn","earth","easily","east","easy","echo","ecology","economy","edge","edit","educate","effort","egg","eight","either","elbow","elder","electric","elegant","element","elephant","elevator","elite","else","embark","embody","embrace","emerge","emotion","employ","empower","empty","enable","enact","end","endless","endorse","enemy","energy","enforce","engage","engine","enhance","enjoy","enlist","enough","enrich","enroll","ensure","enter","entire","entry","envelope","episode","equal","equip","era","erase","erode","erosion","error","erupt","escape","essay","essence","estate","eternal","ethics","evidence","evil","evoke","evolve","exact","example","excess","exchange","excite","exclude","excuse","execute","exercise","exhaust","exhibit","exile","exist","exit","exotic","expand","expect","expire","explain","expose","express","extend","extra","eye","eyebrow","fabric","face","faculty","fade","faint","faith","fall","false","fame","family","famous","fan","fancy","fantasy","farm","fashion","fat","fatal","father","fatigue","fault","favorite","feature","february","federal","fee","feed","feel","female","fence","festival","fetch","fever","few","fiber","fiction","field","figure","file","film","filter","final","find","fine","finger","finish","fire","firm","first","fiscal","fish","fit","fitness","fix","flag","flame","flash","flat","flavor","flee","flight","flip","float","flock","floor","flower","fluid","flush","fly","foam","focus","fog","foil","fold","follow","food","foot","force","forest","forget","fork","fortune","forum","forward","fossil","foster","found","fox","fragile","frame","frequent","fresh","friend","fringe","frog","front","frost","frown","frozen","fruit","fuel","fun","funny","furnace","fury","future","gadget","gain","galaxy","gallery","game","gap","garage","garbage","garden","garlic","garment","gas","gasp","gate","gather","gauge","gaze","general","genius","genre","gentle","genuine","gesture","ghost","giant","gift","giggle","ginger","giraffe","girl","give","glad","glance","glare","glass","glide","glimpse","globe","gloom","glory","glove","glow","glue","goat","goddess","gold","good","goose","gorilla","gospel","gossip","govern","gown","grab","grace","grain","grant","grape","grass","gravity","great","green","grid","grief","grit","grocery","group","grow","grunt","guard","guess","guide","guilt","guitar","gun","gym","habit","hair","half","hammer","hamster","hand","happy","harbor","hard","harsh","harvest","hat","have","hawk","hazard","head","health","heart","heavy","hedgehog","height","hello","helmet","help","hen","hero","hidden","high","hill","hint","hip","hire","history","hobby","hockey","hold","hole","holiday","hollow","home","honey","hood","hope","horn","horror","horse","hospital","host","hotel","hour","hover","hub","huge","human","humble","humor","hundred","hungry","hunt","hurdle","hurry","hurt","husband","hybrid","ice","icon","idea","identify","idle","ignore","ill","illegal","illness","image","imitate","immense","immune","impact","impose","improve","impulse","inch","include","income","increase","index","indicate","indoor","industry","infant","inflict","inform","inhale","inherit","initial","inject","injury","inmate","inner","innocent","input","inquiry","insane","insect","inside","inspire","install","intact","interest","into","invest","invite","involve","iron","island","isolate","issue","item","ivory","jacket","jaguar","jar","jazz","jealous","jeans","jelly","jewel","job","join","joke","journey","joy","judge","juice","jump","jungle","junior","junk","just","kangaroo","keen","keep","ketchup","key","kick","kid","kidney","kind","kingdom","kiss","kit","kitchen","kite","kitten","kiwi","knee","knife","knock","know","lab","label","labor","ladder","lady","lake","lamp","language","laptop","large","later","latin","laugh","laundry","lava","law","lawn","lawsuit","layer","lazy","leader","leaf","learn","leave","lecture","left","leg","legal","legend","leisure","lemon","lend","length","lens","leopard","lesson","letter","level","liar","liberty","library","license","life","lift","light","like","limb","limit","link","lion","liquid","list","little","live","lizard","load","loan","lobster","local","lock","logic","lonely","long","loop","lottery","loud","lounge","love","loyal","lucky","luggage","lumber","lunar","lunch","luxury","lyrics","machine","mad","magic","magnet","maid","mail","main","major","make","mammal","man","manage","mandate","mango","mansion","manual","maple","marble","march","margin","marine","market","marriage","mask","mass","master","match","material","math","matrix","matter","maximum","maze","meadow","mean","measure","meat","mechanic","medal","media","melody","melt","member","memory","mention","menu","mercy","merge","merit","merry","mesh","message","metal","method","middle","midnight","milk","million","mimic","mind","minimum","minor","minute","miracle","mirror","misery","miss","mistake","mix","mixed","mixture","mobile","model","modify","mom","moment","monitor","monkey","monster","month","moon","moral","more","morning","mosquito","mother","motion","motor","mountain","mouse","move","movie","much","muffin","mule","multiply","muscle","museum","mushroom","music","must","mutual","myself","mystery","myth","naive","name","napkin","narrow","nasty","nation","nature","near","neck","need","negative","neglect","neither","nephew","nerve","nest","net","network","neutral","never","news","next","nice","night","noble","noise","nominee","noodle","normal","north","nose","notable","note","nothing","notice","novel","now","nuclear","number","nurse","nut","oak","obey","object","oblige","obscure","observe","obtain","obvious","occur","ocean","october","odor","off","offer","office","often","oil","okay","old","olive","olympic","omit","once","one","onion","online","only","open","opera","opinion","oppose","option","orange","orbit","orchard","order","ordinary","organ","orient","original","orphan","ostrich","other","outdoor","outer","output","outside","oval","oven","over","own","owner","oxygen","oyster","ozone","pact","paddle","page","pair","palace","palm","panda","panel","panic","panther","paper","parade","parent","park","parrot","party","pass","patch","path","patient","patrol","pattern","pause","pave","payment","peace","peanut","pear","peasant","pelican","pen","penalty","pencil","people","pepper","perfect","permit","person","pet","phone","photo","phrase","physical","piano","picnic","picture","piece","pig","pigeon","pill","pilot","pink","pioneer","pipe","pistol","pitch","pizza","place","planet","plastic","plate","play","please","pledge","pluck","plug","plunge","poem","poet","point","polar","pole","police","pond","pony","pool","popular","portion","position","possible","post","potato","pottery","poverty","powder","power","practice","praise","predict","prefer","prepare","present","pretty","prevent","price","pride","primary","print","priority","prison","private","prize","problem","process","produce","profit","program","project","promote","proof","property","prosper","protect","proud","provide","public","pudding","pull","pulp","pulse","pumpkin","punch","pupil","puppy","purchase","purity","purpose","purse","push","put","puzzle","pyramid","quality","quantum","quarter","question","quick","quit","quiz","quote","rabbit","raccoon","race","rack","radar","radio","rail","rain","raise","rally","ramp","ranch","random","range","rapid","rare","rate","rather","raven","raw","razor","ready","real","reason","rebel","rebuild","recall","receive","recipe","record","recycle","reduce","reflect","reform","refuse","region","regret","regular","reject","relax","release","relief","rely","remain","remember","remind","remove","render","renew","rent","reopen","repair","repeat","replace","report","require","rescue","resemble","resist","resource","response","result","retire","retreat","return","reunion","reveal","review","reward","rhythm","rib","ribbon","rice","rich","ride","ridge","rifle","right","rigid","ring","riot","ripple","risk","ritual","rival","river","road","roast","robot","robust","rocket","romance","roof","rookie","room","rose","rotate","rough","round","route","royal","rubber","rude","rug","rule","run","runway","rural","sad","saddle","sadness","safe","sail","salad","salmon","salon","salt","salute","same","sample","sand","satisfy","satoshi","sauce","sausage","save","say","scale","scan","scare","scatter","scene","scheme","school","science","scissors","scorpion","scout","scrap","screen","script","scrub","sea","search","season","seat","second","secret","section","security","seed","seek","segment","select","sell","seminar","senior","sense","sentence","series","service","session","settle","setup","seven","shadow","shaft","shallow","share","shed","shell","sheriff","shield","shift","shine","ship","shiver","shock","shoe","shoot","shop","short","shoulder","shove","shrimp","shrug","shuffle","shy","sibling","sick","side","siege","sight","sign","silent","silk","silly","silver","similar","simple","since","sing","siren","sister","situate","six","size","skate","sketch","ski","skill","skin","skirt","skull","slab","slam","sleep","slender","slice","slide","slight","slim","slogan","slot","slow","slush","small","smart","smile","smoke","smooth","snack","snake","snap","sniff","snow","soap","soccer","social","sock","soda","soft","solar","soldier","solid","solution","solve","someone","song","soon","sorry","sort","soul","sound","soup","source","south","space","spare","spatial","spawn","speak","special","speed","spell","spend","sphere","spice","spider","spike","spin","spirit","split","spoil","sponsor","spoon","sport","spot","spray","spread","spring","spy","square","squeeze","squirrel","stable","stadium","staff","stage","stairs","stamp","stand","start","state","stay","steak","steel","stem","step","stereo","stick","still","sting","stock","stomach","stone","stool","story","stove","strategy","street","strike","strong","struggle","student","stuff","stumble","style","subject","submit","subway","success","such","sudden","suffer","sugar","suggest","suit","summer","sun","sunny","sunset","super","supply","supreme","sure","surface","surge","surprise","surround","survey","suspect","sustain","swallow","swamp","swap","swarm","swear","sweet","swift","swim","swing","switch","sword","symbol","symptom","syrup","system","table","tackle","tag","tail","talent","talk","tank","tape","target","task","taste","tattoo","taxi","teach","team","tell","ten","tenant","tennis","tent","term","test","text","thank","that","theme","then","theory","there","they","thing","this","thought","three","thrive","throw","thumb","thunder","ticket","tide","tiger","tilt","timber","time","tiny","tip","tired","tissue","title","toast","tobacco","today","toddler","toe","together","toilet","token","tomato","tomorrow","tone","tongue","tonight","tool","tooth","top","topic","topple","torch","tornado","tortoise","toss","total","tourist","toward","tower","town","toy","track","trade","traffic","tragic","train","transfer","trap","trash","travel","tray","treat","tree","trend","trial","tribe","trick","trigger","trim","trip","trophy","trouble","truck","true","truly","trumpet","trust","truth","try","tube","tuition","tumble","tuna","tunnel","turkey","turn","turtle","twelve","twenty","twice","twin","twist","two","type","typical","ugly","umbrella","unable","unaware","uncle","uncover","under","undo","unfair","unfold","unhappy","uniform","unique","unit","universe","unknown","unlock","until","unusual","unveil","update","upgrade","uphold","upon","upper","upset","urban","urge","usage","use","used","useful","useless","usual","utility","vacant","vacuum","vague","valid","valley","valve","van","vanish","vapor","various","vast","vault","vehicle","velvet","vendor","venture","venue","verb","verify","version","very","vessel","veteran","viable","vibrant","vicious","victory","video","view","village","vintage","violin","virtual","virus","visa","visit","visual","vital","vivid","vocal","voice","void","volcano","volume","vote","voyage","wage","wagon","wait","walk","wall","walnut","want","warfare","warm","warrior","wash","wasp","waste","water","wave","way","wealth","weapon","wear","weasel","weather","web","wedding","weekend","weird","welcome","west","wet","whale","what","wheat","wheel","when","where","whip","whisper","wide","width","wife","wild","will","win","window","wine","wing","wink","winner","winter","wire","wisdom","wise","wish","witness","wolf","woman","wonder","wood","wool","word","work","world","worry","worth","wrap","wreck","wrestle","wrist","write","wrong","yard","year","yellow","you","young","youth","zebra","zero","zone","zoo"]},function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return s},i=this&&this.__importStar||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},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(r(24)),o=i(r(1)),u=r(18),c=r(6),l=r(8),f=r(13),h=a(r(21)),p=r(5);t.aesEncrypt=function(e,t,r,n){void 0===r&&(r="CBC");var i=s.createCipher("AES-"+r,p.bytesToString(c._fromIn(t),"raw"));return i.start({iv:n&&o.createBuffer(p.bytesToString(c._fromIn(n),"raw"))}),i.update(o.createBuffer(p.bytesToString(e,"raw"))),i.finish(),p.stringToBytes(i.output.getBytes(),"raw")},t.aesDecrypt=function(e,t,r,n){void 0===r&&(r="CBC");var i=s.createDecipher("AES-"+r,p.bytesToString(c._fromIn(t),"raw"));i.start({iv:n&&o.createBuffer(p.bytesToString(c._fromIn(n),"raw"))});var a=o.createBuffer(p.bytesToString(c._fromIn(e),"raw"));if(i.update(a),!i.finish())throw new Error("Failed to decrypt data with provided key");return p.stringToBytes(i.output.getBytes(),"raw")},t.messageEncrypt=function(e,r){var n=Uint8Array.from([1]),i=u.randomBytes(32),a=u.randomBytes(16),s=p.stringToBytes(r),o=t.aesEncrypt(s,i,"CTR",a),c=t.aesEncrypt(i,e,"ECB"),h=l.hmacSHA256(s,i),d=l.hmacSHA256(f.concat(i,a),e);return f.concat(n,c,d,h,a,o)},t.messageDecrypt=function(e,r){var i=n(f.split(r,1,48,32,32,16),6),a=(i[0],i[1]),s=i[2],o=i[3],u=i[4],h=i[5],d=t.aesDecrypt(a,e,"ECB");if(!c._fromIn(l.hmacSHA256(f.concat(d,u),c._fromIn(e))).every((function(e,t){return e===s[t]})))throw new Error("Invalid key");var y=t.aesDecrypt(h,d,"CTR",u);if(!c._fromIn(l.hmacSHA256(y,d)).every((function(e,t){return e===o[t]})))throw new Error("Invalid message");return p.bytesToString(y)},t.sharedKey=function(e,t,r){var n=h.default.sharedKey(c._fromIn(e),c._fromIn(t)),i=l.sha256(c._fromRawIn(r));return l.hmacSHA256(n,i)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(6),i=r(5);t.Seed={isSeedWithNonce:function(e){return void 0!==e.nonce},toBinary:function(e){return t.Seed.isSeedWithNonce(e)?{seed:t.Seed.toBinary(e.seed).seed,nonce:e.nonce}:{seed:n._fromRawIn(e),nonce:void 0}},toString:function(e){return i.bytesToString(t.Seed.toBinary(e).seed)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(14),i=r(14);t.ChaidId={toNumber:function(e){return"string"==typeof e?e.charCodeAt(0):e},isMainnet:function(e){return t.ChaidId.toNumber(e)===n.MAIN_NET_CHAIN_ID},isTestnet:function(e){return t.ChaidId.toNumber(e)===i.TEST_NET_CHAIN_ID}}},function(e,t,r){var n=r(0);if(r(23),r(9),r(41),r(4),r(10),r(42),r(29),r(7),r(74),r(22),r(1),void 0===i)var i=n.jsbn.BigInteger;var a=n.asn1,s=n.pki=n.pki||{};e.exports=s.pbe=n.pbe=n.pbe||{};var o=s.oids,u={name:"EncryptedPrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},c={name:"PBES2Algorithms",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},l={name:"pkcs-12PbeParams",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"iterations"}]};function f(e,t){return e.start().update(t).digest().getBytes()}function h(e){var t;if(e){if(!(t=s.oids[a.derToOid(e)])){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}}else t="hmacWithSHA1";return p(t)}function p(e){var t=n.md;switch(e){case"hmacWithSHA224":t=n.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}s.encryptPrivateKeyInfo=function(e,t,r){(r=r||{}).saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var i,u,c,l=n.random.getBytesSync(r.saltSize),f=r.count,h=a.integerToDer(f);if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var d,y,g;switch(r.algorithm){case"aes128":i=16,d=16,y=o["aes128-CBC"],g=n.aes.createEncryptionCipher;break;case"aes192":i=24,d=16,y=o["aes192-CBC"],g=n.aes.createEncryptionCipher;break;case"aes256":i=32,d=16,y=o["aes256-CBC"],g=n.aes.createEncryptionCipher;break;case"des":i=8,d=8,y=o.desCBC,g=n.des.createEncryptionCipher;break;default:throw(S=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,S}var m="hmacWith"+r.prfAlgorithm.toUpperCase(),v=p(m),b=n.pkcs5.pbkdf2(t,l,f,i,v),E=n.random.getBytesSync(d);(T=g(b)).start(E),T.update(a.toDer(e)),T.finish(),c=T.output.getBytes();var C=function(e,t,r,i){var o=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,e),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,t.getBytes())]);"hmacWithSHA1"!==i&&o.value.push(a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,n.util.hexToBytes(r.toString(16))),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(s.oids[i]).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]));return o}(l,h,i,m);u=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(o.pkcs5PBES2).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(o.pkcs5PBKDF2).getBytes()),C]),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(y).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,E)])])])}else{var S;if("3des"!==r.algorithm)throw(S=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,S;i=24;var T,A=new n.util.ByteBuffer(l);b=s.pbe.generatePkcs12Key(t,A,1,f,i),E=s.pbe.generatePkcs12Key(t,A,2,f,i);(T=n.des.createEncryptionCipher(b)).start(E),T.update(a.toDer(e)),T.finish(),c=T.output.getBytes(),u=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(o["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,l),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,h.getBytes())])])}return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[u,a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,c)])},s.decryptPrivateKeyInfo=function(e,t){var r=null,i={},o=[];if(!a.validate(e,u,i,o)){var c=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw c.errors=o,c}var l=a.derToOid(i.encryptionOid),f=s.pbe.getCipher(l,i.encryptionParams,t),h=n.util.createBuffer(i.encryptedData);return f.update(h),f.finish()&&(r=a.fromDer(f.output)),r},s.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:a.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})},s.encryptedPrivateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return a.fromDer(t.body)},s.encryptRsaPrivateKey=function(e,t,r){if(!(r=r||{}).legacy){var i=s.wrapRsaPrivateKey(s.privateKeyToAsn1(e));return i=s.encryptPrivateKeyInfo(i,t,r),s.encryptedPrivateKeyToPem(i)}var o,u,c,l;switch(r.algorithm){case"aes128":o="AES-128-CBC",c=16,u=n.random.getBytesSync(16),l=n.aes.createEncryptionCipher;break;case"aes192":o="AES-192-CBC",c=24,u=n.random.getBytesSync(16),l=n.aes.createEncryptionCipher;break;case"aes256":o="AES-256-CBC",c=32,u=n.random.getBytesSync(16),l=n.aes.createEncryptionCipher;break;case"3des":o="DES-EDE3-CBC",c=24,u=n.random.getBytesSync(8),l=n.des.createEncryptionCipher;break;case"des":o="DES-CBC",c=8,u=n.random.getBytesSync(8),l=n.des.createEncryptionCipher;break;default:var f=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw f.algorithm=r.algorithm,f}var h=l(n.pbe.opensslDeriveBytes(t,u.substr(0,8),c));h.start(u),h.update(a.toDer(s.privateKeyToAsn1(e))),h.finish();var p={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:o,parameters:n.util.bytesToHex(u).toUpperCase()},body:h.output.getBytes()};return n.pem.encode(p)},s.decryptRsaPrivateKey=function(e,t){var r=null,i=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type)throw(c=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=c,c;if(i.procType&&"ENCRYPTED"===i.procType.type){var o,u;switch(i.dekInfo.algorithm){case"DES-CBC":o=8,u=n.des.createDecryptionCipher;break;case"DES-EDE3-CBC":o=24,u=n.des.createDecryptionCipher;break;case"AES-128-CBC":o=16,u=n.aes.createDecryptionCipher;break;case"AES-192-CBC":o=24,u=n.aes.createDecryptionCipher;break;case"AES-256-CBC":o=32,u=n.aes.createDecryptionCipher;break;case"RC2-40-CBC":o=5,u=function(e){return n.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":o=8,u=function(e){return n.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":o=16,u=function(e){return n.rc2.createDecryptionCipher(e,128)};break;default:var c;throw(c=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".')).algorithm=i.dekInfo.algorithm,c}var l=n.util.hexToBytes(i.dekInfo.parameters),f=u(n.pbe.opensslDeriveBytes(t,l.substr(0,8),o));if(f.start(l),f.update(n.util.createBuffer(i.body)),!f.finish())return r;r=f.output.getBytes()}else r=i.body;return null!==(r="ENCRYPTED PRIVATE KEY"===i.type?s.decryptPrivateKeyInfo(a.fromDer(r),t):a.fromDer(r))&&(r=s.privateKeyFromAsn1(r)),r},s.pbe.generatePkcs12Key=function(e,t,r,i,a,s){var o,u;if(null==s){if(!("sha1"in n.md))throw new Error('"sha1" hash algorithm unavailable.');s=n.md.sha1.create()}var c=s.digestLength,l=s.blockLength,f=new n.util.ByteBuffer,h=new n.util.ByteBuffer;if(null!=e){for(u=0;u<e.length;u++)h.putInt16(e.charCodeAt(u));h.putInt16(0)}var p=h.length(),d=t.length(),y=new n.util.ByteBuffer;y.fillWithByte(r,l);var g=l*Math.ceil(d/l),m=new n.util.ByteBuffer;for(u=0;u<g;u++)m.putByte(t.at(u%d));var v=l*Math.ceil(p/l),b=new n.util.ByteBuffer;for(u=0;u<v;u++)b.putByte(h.at(u%p));var E=m;E.putBuffer(b);for(var C=Math.ceil(a/c),S=1;S<=C;S++){var T=new n.util.ByteBuffer;T.putBytes(y.bytes()),T.putBytes(E.bytes());for(var A=0;A<i;A++)s.start(),s.update(T.getBytes()),T=s.digest();var I=new n.util.ByteBuffer;for(u=0;u<l;u++)I.putByte(T.at(u%c));var w=Math.ceil(d/l)+Math.ceil(p/l),B=new n.util.ByteBuffer;for(o=0;o<w;o++){var _=new n.util.ByteBuffer(E.getBytes(l)),N=511;for(u=I.length()-1;u>=0;u--)N>>=8,N+=I.at(u)+_.at(u),_.setAt(u,255&N);B.putBuffer(_)}E=B,f.putBuffer(T)}return f.truncate(f.length()-a),f},s.pbe.getCipher=function(e,t,r){switch(e){case s.oids.pkcs5PBES2:return s.pbe.getCipherForPBES2(e,t,r);case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case s.oids["pbewithSHAAnd40BitRC2-CBC"]:return s.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},s.pbe.getCipherForPBES2=function(e,t,r){var i,o={},u=[];if(!a.validate(t,c,o,u))throw(i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=u,i;if((e=a.derToOid(o.kdfOid))!==s.oids.pkcs5PBKDF2)throw(i=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,i.supportedOids=["pkcs5PBKDF2"],i;if((e=a.derToOid(o.encOid))!==s.oids["aes128-CBC"]&&e!==s.oids["aes192-CBC"]&&e!==s.oids["aes256-CBC"]&&e!==s.oids["des-EDE3-CBC"]&&e!==s.oids.desCBC)throw(i=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,i.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],i;var l,f,p=o.kdfSalt,d=n.util.createBuffer(o.kdfIterationCount);switch(d=d.getInt(d.length()<<3),s.oids[e]){case"aes128-CBC":l=16,f=n.aes.createDecryptionCipher;break;case"aes192-CBC":l=24,f=n.aes.createDecryptionCipher;break;case"aes256-CBC":l=32,f=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":l=24,f=n.des.createDecryptionCipher;break;case"desCBC":l=8,f=n.des.createDecryptionCipher}var y=h(o.prfOid),g=n.pkcs5.pbkdf2(r,p,d,l,y),m=o.encIv,v=f(g);return v.start(m),v},s.pbe.getCipherForPKCS12PBE=function(e,t,r){var i={},o=[];if(!a.validate(t,l,i,o))throw(y=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=o,y;var u,c,f,p=n.util.createBuffer(i.salt),d=n.util.createBuffer(i.iterations);switch(d=d.getInt(d.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:u=24,c=8,f=n.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:u=5,c=8,f=function(e,t){var r=n.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var y;throw(y=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,y}var g=h(i.prfOid),m=s.pbe.generatePkcs12Key(r,p,1,d,u,g);return g.start(),f(m,s.pbe.generatePkcs12Key(r,p,2,d,c,g))},s.pbe.opensslDeriveBytes=function(e,t,r,i){if(null==i){if(!("md5"in n.md))throw new Error('"md5" hash algorithm unavailable.');i=n.md.md5.create()}null===t&&(t="");for(var a=[f(i,e+t)],s=16,o=1;s<r;++o,s+=16)a.push(f(i,a[o-1]+e+t));return a.join("").substr(0,r)}},function(e,t,r){var n=r(0);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.des.Algorithm(e,t)}))}r(24),r(34),r(1),e.exports=n.des=n.des||{},n.des.startEncrypting=function(e,t,r,n){var i=d({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createEncryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!1,mode:t})},n.des.startDecrypting=function(e,t,r,n){var i=d({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createDecryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!0,mode:t})},n.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return p(r._keys,e,t,!1)},decrypt:function(e,t){return p(r._keys,e,t,!0)}}}),r._init=!1},n.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=n.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=function(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],n=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],i=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],a=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],o=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],u=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],c=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],f=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],h=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],p=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],d=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],g=e.length()>8?3:1,m=[],v=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,E=0;E<g;E++){var C=e.getInt32(),S=e.getInt32();C^=(t=252645135&(C>>>4^S))<<4,C^=t=65535&((S^=t)>>>-16^C),C^=(t=858993459&(C>>>2^(S^=t<<-16)))<<2,C^=t=65535&((S^=t)>>>-16^C),C^=(t=1431655765&(C>>>1^(S^=t<<-16)))<<1,C^=t=16711935&((S^=t)>>>8^C),t=(C^=(t=1431655765&(C>>>1^(S^=t<<8)))<<1)<<8|(S^=t)>>>20&240,C=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var T=0;T<v.length;++T){v[T]?(C=C<<2|C>>>26,S=S<<2|S>>>26):(C=C<<1|C>>>27,S=S<<1|S>>>27);var A=r[(C&=-15)>>>28]|n[C>>>24&15]|i[C>>>20&15]|a[C>>>16&15]|s[C>>>12&15]|o[C>>>8&15]|u[C>>>4&15],I=c[(S&=-15)>>>28]|l[S>>>24&15]|f[S>>>20&15]|h[S>>>16&15]|p[S>>>12&15]|d[S>>>8&15]|y[S>>>4&15];t=65535&(I>>>16^A),m[b++]=A^t,m[b++]=I^t<<16}}return m}(t),this._init=!0}},i("DES-ECB",n.cipher.modes.ecb),i("DES-CBC",n.cipher.modes.cbc),i("DES-CFB",n.cipher.modes.cfb),i("DES-OFB",n.cipher.modes.ofb),i("DES-CTR",n.cipher.modes.ctr),i("3DES-ECB",n.cipher.modes.ecb),i("3DES-CBC",n.cipher.modes.cbc),i("3DES-CFB",n.cipher.modes.cfb),i("3DES-OFB",n.cipher.modes.ofb),i("3DES-CTR",n.cipher.modes.ctr);var a=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],s=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],o=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],u=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],c=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],l=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],f=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],h=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function p(e,t,r,n){var i,p,d=32===e.length?3:9;i=3===d?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var y=t[0],g=t[1];y^=(p=252645135&(y>>>4^g))<<4,y^=(p=65535&(y>>>16^(g^=p)))<<16,y^=p=858993459&((g^=p)>>>2^y),y^=p=16711935&((g^=p<<2)>>>8^y),y=(y^=(p=1431655765&(y>>>1^(g^=p<<8)))<<1)<<1|y>>>31,g=(g^=p)<<1|g>>>31;for(var m=0;m<d;m+=3){for(var v=i[m+1],b=i[m+2],E=i[m];E!=v;E+=b){var C=g^e[E],S=(g>>>4|g<<28)^e[E+1];p=y,y=g,g=p^(s[C>>>24&63]|u[C>>>16&63]|l[C>>>8&63]|h[63&C]|a[S>>>24&63]|o[S>>>16&63]|c[S>>>8&63]|f[63&S])}p=y,y=g,g=p}g=g>>>1|g<<31,g^=p=1431655765&((y=y>>>1|y<<31)>>>1^g),g^=(p=16711935&(g>>>8^(y^=p<<1)))<<8,g^=(p=858993459&(g>>>2^(y^=p)))<<2,g^=p=65535&((y^=p)>>>16^g),g^=p=252645135&((y^=p<<16)>>>4^g),y^=p<<4,r[0]=y,r[1]=g}function d(e){var t,r="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var a=null;r instanceof n.util.ByteBuffer&&(a=r,r={}),(r=r||{}).output=a,r.iv=e,i.call(t,r)},t}},function(e,t,r){(function(t){var n=r(0);r(26),r(4),r(1);var i,a=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(i=r(25)),e.exports=n.pbkdf2=a.pbkdf2=function(e,r,a,s,o,u){if("function"==typeof o&&(u=o,o=null),n.util.isNodejs&&!n.options.usePureJavaScript&&i.pbkdf2&&(null===o||"object"!=typeof o)&&(i.pbkdf2Sync.length>4||!o||"sha1"===o))return"string"!=typeof o&&(o="sha1"),e=t.from(e,"binary"),r=t.from(r,"binary"),u?4===i.pbkdf2Sync.length?i.pbkdf2(e,r,a,s,(function(e,t){if(e)return u(e);u(null,t.toString("binary"))})):i.pbkdf2(e,r,a,s,o,(function(e,t){if(e)return u(e);u(null,t.toString("binary"))})):4===i.pbkdf2Sync.length?i.pbkdf2Sync(e,r,a,s).toString("binary"):i.pbkdf2Sync(e,r,a,s,o).toString("binary");if(null==o&&(o="sha1"),"string"==typeof o){if(!(o in n.md.algorithms))throw new Error("Unknown hash algorithm: "+o);o=n.md[o].create()}var c=o.digestLength;if(s>4294967295*c){var l=new Error("Derived key is too long.");if(u)return u(l);throw l}var f=Math.ceil(s/c),h=s-(f-1)*c,p=n.hmac.create();p.start(o,e);var d,y,g,m="";if(!u){for(var v=1;v<=f;++v){p.start(null,null),p.update(r),p.update(n.util.int32ToBytes(v)),d=g=p.digest().getBytes();for(var b=2;b<=a;++b)p.start(null,null),p.update(g),y=p.digest().getBytes(),d=n.util.xorBytes(d,y,c),g=y;m+=v<f?d:d.substr(0,h)}return m}v=1;function E(){if(v>f)return u(null,m);p.start(null,null),p.update(r),p.update(n.util.int32ToBytes(v)),d=g=p.digest().getBytes(),b=2,C()}function C(){if(b<=a)return p.start(null,null),p.update(g),y=p.digest().getBytes(),d=n.util.xorBytes(d,y,c),g=y,++b,n.util.setImmediate(C);m+=v<f?d:d.substr(0,h),++v,E()}E()}}).call(this,r(11).Buffer)},function(e,t,r){var n,i=r(0);e.exports=i.jsbn=i.jsbn||{};function a(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function s(){return new a(null)}function o(e,t,r,n,i,a){for(var s=16383&t,o=t>>14;--a>=0;){var u=16383&this.data[e],c=this.data[e++]>>14,l=o*u+c*s;i=((u=s*u+((16383&l)<<14)+r.data[n]+i)>>28)+(l>>14)+o*c,r.data[n++]=268435455&u}return i}i.jsbn.BigInteger=a,"undefined"==typeof navigator?(a.prototype.am=o,n=28):"Microsoft Internet Explorer"==navigator.appName?(a.prototype.am=function(e,t,r,n,i,a){for(var s=32767&t,o=t>>15;--a>=0;){var u=32767&this.data[e],c=this.data[e++]>>15,l=o*u+c*s;i=((u=s*u+((32767&l)<<15)+r.data[n]+(1073741823&i))>>>30)+(l>>>15)+o*c+(i>>>30),r.data[n++]=1073741823&u}return i},n=30):"Netscape"!=navigator.appName?(a.prototype.am=function(e,t,r,n,i,a){for(;--a>=0;){var s=t*this.data[e++]+r.data[n]+i;i=Math.floor(s/67108864),r.data[n++]=67108863&s}return i},n=26):(a.prototype.am=o,n=28),a.prototype.DB=n,a.prototype.DM=(1<<n)-1,a.prototype.DV=1<<n;a.prototype.FV=Math.pow(2,52),a.prototype.F1=52-n,a.prototype.F2=2*n-52;var u,c,l=new Array;for(u="0".charCodeAt(0),c=0;c<=9;++c)l[u++]=c;for(u="a".charCodeAt(0),c=10;c<36;++c)l[u++]=c;for(u="A".charCodeAt(0),c=10;c<36;++c)l[u++]=c;function f(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function h(e,t){var r=l[e.charCodeAt(t)];return null==r?-1:r}function p(e){var t=s();return t.fromInt(e),t}function d(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function y(e){this.m=e}function g(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function m(e,t){return e&t}function v(e,t){return e|t}function b(e,t){return e^t}function E(e,t){return e&~t}function C(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function S(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function T(){}function A(e){return e}function I(e){this.r2=s(),this.q3=s(),a.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}y.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},y.prototype.revert=function(e){return e},y.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},y.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},y.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},g.prototype.convert=function(e){var t=s();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(a.ZERO)>0&&this.m.subTo(t,t),t},g.prototype.revert=function(e){var t=s();return e.copyTo(t),this.reduce(t),t},g.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e.data[t],n=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},g.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},g.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},a.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},a.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},a.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,i=!1,s=0;--n>=0;){var o=8==r?255&e[n]:h(e,n);o<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==s?this.data[this.t++]=o:s+r>this.DB?(this.data[this.t-1]|=(o&(1<<this.DB-s)-1)<<s,this.data[this.t++]=o>>this.DB-s):this.data[this.t-1]|=o<<s,(s+=r)>=this.DB&&(s-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),i&&a.ZERO.subTo(this,this)},a.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t},a.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},a.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s},a.prototype.lShiftTo=function(e,t){var r,n=e%this.DB,i=this.DB-n,a=(1<<i)-1,s=Math.floor(e/this.DB),o=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t.data[r+s+1]=this.data[r]>>i|o,o=(this.data[r]&a)<<n;for(r=s-1;r>=0;--r)t.data[r]=0;t.data[s]=o,t.t=this.t+s+1,t.s=this.s,t.clamp()},a.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,a=(1<<n)-1;t.data[0]=this.data[r]>>n;for(var s=r+1;s<this.t;++s)t.data[s-r-1]|=(this.data[s]&a)<<i,t.data[s-r]=this.data[s]>>n;n>0&&(t.data[this.t-r-1]|=(this.s&a)<<i),t.t=this.t-r,t.clamp()}},a.prototype.subTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]-e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()},a.prototype.multiplyTo=function(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t.data[i]=0;for(i=0;i<n.t;++i)t.data[i+r.t]=r.am(0,n.data[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&a.ZERO.subTo(t,t)},a.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},a.prototype.divRemTo=function(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=s());var o=s(),u=this.s,c=e.s,l=this.DB-d(n.data[n.t-1]);l>0?(n.lShiftTo(l,o),i.lShiftTo(l,r)):(n.copyTo(o),i.copyTo(r));var f=o.t,h=o.data[f-1];if(0!=h){var p=h*(1<<this.F1)+(f>1?o.data[f-2]>>this.F2:0),y=this.FV/p,g=(1<<this.F1)/p,m=1<<this.F2,v=r.t,b=v-f,E=null==t?s():t;for(o.dlShiftTo(b,E),r.compareTo(E)>=0&&(r.data[r.t++]=1,r.subTo(E,r)),a.ONE.dlShiftTo(f,E),E.subTo(o,o);o.t<f;)o.data[o.t++]=0;for(;--b>=0;){var C=r.data[--v]==h?this.DM:Math.floor(r.data[v]*y+(r.data[v-1]+m)*g);if((r.data[v]+=o.am(0,C,r,b,0,f))<C)for(o.dlShiftTo(b,E),r.subTo(E,r);r.data[v]<--C;)r.subTo(E,r)}null!=t&&(r.drShiftTo(f,t),u!=c&&a.ZERO.subTo(t,t)),r.t=f,r.clamp(),l>0&&r.rShiftTo(l,r),u<0&&a.ZERO.subTo(r,r)}}},a.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},a.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},a.prototype.exp=function(e,t){if(e>4294967295||e<1)return a.ONE;var r=s(),n=s(),i=t.convert(this),o=d(e)-1;for(i.copyTo(r);--o>=0;)if(t.sqrTo(r,n),(e&1<<o)>0)t.mulTo(n,i,r);else{var u=r;r=n,n=u}return t.revert(r)},a.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,i=!1,a="",s=this.t,o=this.DB-s*this.DB%t;if(s-- >0)for(o<this.DB&&(r=this.data[s]>>o)>0&&(i=!0,a=f(r));s>=0;)o<t?(r=(this.data[s]&(1<<o)-1)<<t-o,r|=this.data[--s]>>(o+=this.DB-t)):(r=this.data[s]>>(o-=t)&n,o<=0&&(o+=this.DB,--s)),r>0&&(i=!0),i&&(a+=f(r));return i?a:"0"},a.prototype.negate=function(){var e=s();return a.ZERO.subTo(this,e),e},a.prototype.abs=function(){return this.s<0?this.negate():this},a.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},a.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+d(this.data[this.t-1]^this.s&this.DM)},a.prototype.mod=function(e){var t=s();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(a.ZERO)>0&&e.subTo(t,t),t},a.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new y(t):new g(t),this.exp(e,r)},a.ZERO=p(0),a.ONE=p(1),T.prototype.convert=A,T.prototype.revert=A,T.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},T.prototype.sqrTo=function(e,t){e.squareTo(t)},I.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=s();return e.copyTo(t),this.reduce(t),t},I.prototype.revert=function(e){return e},I.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},I.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},I.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var w=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],B=(1<<26)/w[w.length-1];a.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},a.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=p(r),i=s(),a=s(),o="";for(this.divRemTo(n,i,a);i.signum()>0;)o=(r+a.intValue()).toString(e).substr(1)+o,i.divRemTo(n,i,a);return a.intValue().toString(e)+o},a.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,s=0,o=0,u=0;u<e.length;++u){var c=h(e,u);c<0?"-"==e.charAt(u)&&0==this.signum()&&(i=!0):(o=t*o+c,++s>=r&&(this.dMultiply(n),this.dAddOffset(o,0),s=0,o=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(o,0)),i&&a.ZERO.subTo(this,this)},a.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(a.ONE.shiftLeft(e-1),v,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(a.ONE.shiftLeft(e-1),this);else{var n=new Array,i=7&e;n.length=1+(e>>3),t.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}},a.prototype.bitwiseTo=function(e,t,r){var n,i,a=Math.min(e.t,this.t);for(n=0;n<a;++n)r.data[n]=t(this.data[n],e.data[n]);if(e.t<this.t){for(i=e.s&this.DM,n=a;n<this.t;++n)r.data[n]=t(this.data[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=a;n<e.t;++n)r.data[n]=t(i,e.data[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()},a.prototype.changeBit=function(e,t){var r=a.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r},a.prototype.addTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]+e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()},a.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},a.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},a.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r.data[--i]=0;for(n=r.t-this.t;i<n;++i)r.data[i+this.t]=this.am(0,e.data[i],r,i,0,this.t);for(n=Math.min(e.t,t);i<n;++i)this.am(0,e.data[i],r,i,0,t-i);r.clamp()},a.prototype.multiplyUpperTo=function(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r.data[this.t+n-t]=this.am(t-n,e.data[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)},a.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r},a.prototype.millerRabin=function(e){var t=this.subtract(a.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n,i=t.shiftRight(r),s={nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}},o=0;o<e;++o){do{n=new a(this.bitLength(),s)}while(n.compareTo(a.ONE)<=0||n.compareTo(t)>=0);var u=n.modPow(i,this);if(0!=u.compareTo(a.ONE)&&0!=u.compareTo(t)){for(var c=1;c++<r&&0!=u.compareTo(t);)if(0==(u=u.modPowInt(2,this)).compareTo(a.ONE))return!1;if(0!=u.compareTo(t))return!1}}return!0},a.prototype.clone=function(){var e=s();return this.copyTo(e),e},a.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]},a.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24},a.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},a.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},a.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n<this.DB&&(r=this.data[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this.data[e]&(1<<n)-1)<<8-n,r|=this.data[--e]>>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},a.prototype.equals=function(e){return 0==this.compareTo(e)},a.prototype.min=function(e){return this.compareTo(e)<0?this:e},a.prototype.max=function(e){return this.compareTo(e)>0?this:e},a.prototype.and=function(e){var t=s();return this.bitwiseTo(e,m,t),t},a.prototype.or=function(e){var t=s();return this.bitwiseTo(e,v,t),t},a.prototype.xor=function(e){var t=s();return this.bitwiseTo(e,b,t),t},a.prototype.andNot=function(e){var t=s();return this.bitwiseTo(e,E,t),t},a.prototype.not=function(){for(var e=s(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e},a.prototype.shiftLeft=function(e){var t=s();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},a.prototype.shiftRight=function(e){var t=s();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},a.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this.data[e])return e*this.DB+C(this.data[e]);return this.s<0?this.t*this.DB:-1},a.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=S(this.data[r]^t);return e},a.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this.data[t]&1<<e%this.DB)},a.prototype.setBit=function(e){return this.changeBit(e,v)},a.prototype.clearBit=function(e){return this.changeBit(e,E)},a.prototype.flipBit=function(e){return this.changeBit(e,b)},a.prototype.add=function(e){var t=s();return this.addTo(e,t),t},a.prototype.subtract=function(e){var t=s();return this.subTo(e,t),t},a.prototype.multiply=function(e){var t=s();return this.multiplyTo(e,t),t},a.prototype.divide=function(e){var t=s();return this.divRemTo(e,t,null),t},a.prototype.remainder=function(e){var t=s();return this.divRemTo(e,null,t),t},a.prototype.divideAndRemainder=function(e){var t=s(),r=s();return this.divRemTo(e,t,r),new Array(t,r)},a.prototype.modPow=function(e,t){var r,n,i=e.bitLength(),a=p(1);if(i<=0)return a;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new y(t):t.isEven()?new I(t):new g(t);var o=new Array,u=3,c=r-1,l=(1<<r)-1;if(o[1]=n.convert(this),r>1){var f=s();for(n.sqrTo(o[1],f);u<=l;)o[u]=s(),n.mulTo(f,o[u-2],o[u]),u+=2}var h,m,v=e.t-1,b=!0,E=s();for(i=d(e.data[v])-1;v>=0;){for(i>=c?h=e.data[v]>>i-c&l:(h=(e.data[v]&(1<<i+1)-1)<<c-i,v>0&&(h|=e.data[v-1]>>this.DB+i-c)),u=r;0==(1&h);)h>>=1,--u;if((i-=u)<0&&(i+=this.DB,--v),b)o[h].copyTo(a),b=!1;else{for(;u>1;)n.sqrTo(a,E),n.sqrTo(E,a),u-=2;u>0?n.sqrTo(a,E):(m=a,a=E,E=m),n.mulTo(E,o[h],a)}for(;v>=0&&0==(e.data[v]&1<<i);)n.sqrTo(a,E),m=a,a=E,E=m,--i<0&&(i=this.DB-1,--v)}return n.revert(a)},a.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return a.ZERO;for(var r=e.clone(),n=this.clone(),i=p(1),s=p(0),o=p(0),u=p(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(i.isEven()&&s.isEven()||(i.addTo(this,i),s.subTo(e,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),t?(o.isEven()&&u.isEven()||(o.addTo(this,o),u.subTo(e,u)),o.rShiftTo(1,o)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(o,i),s.subTo(u,s)):(n.subTo(r,n),t&&o.subTo(i,o),u.subTo(s,u))}return 0!=n.compareTo(a.ONE)?a.ZERO:u.compareTo(e)>=0?u.subtract(e):u.signum()<0?(u.addTo(e,u),u.signum()<0?u.add(e):u):u},a.prototype.pow=function(e){return this.exp(e,new T)},a.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),a=r.getLowestSetBit();if(a<0)return t;for(i<a&&(a=i),a>0&&(t.rShiftTo(a,t),r.rShiftTo(a,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return a>0&&r.lShiftTo(a,r),r},a.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=w[w.length-1]){for(t=0;t<w.length;++t)if(r.data[0]==w[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<w.length;){for(var n=w[t],i=t+1;i<w.length&&n<B;)n*=w[i++];for(n=r.modInt(n);t<i;)if(n%w[t++]==0)return!1}return r.millerRabin(e)}},function(e,t,r){var n=r(0);r(4),r(1);var i=e.exports=n.sha1=n.sha1||{};n.md.sha1=n.md.algorithms.sha1=i,i.create=function(){s||(a=String.fromCharCode(128),a+=n.util.fillString(String.fromCharCode(0),64),s=!0);var e=null,t=n.util.createBuffer(),r=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,a=0;a<r;++a)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},i}};return i.start(),i.update=function(a,s){"utf8"===s&&(a=n.util.encodeUtf8(a));var u=a.length;i.messageLength+=u,u=[u/4294967296>>>0,u>>>0];for(var c=i.fullMessageLength.length-1;c>=0;--c)i.fullMessageLength[c]+=u[1],u[1]=u[0]+(i.fullMessageLength[c]/4294967296>>>0),i.fullMessageLength[c]=i.fullMessageLength[c]>>>0,u[0]=u[1]/4294967296>>>0;return t.putBytes(a),o(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var u,c=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;s.putBytes(a.substr(0,i.blockLength-c));for(var l=8*i.fullMessageLength[0],f=0;f<i.fullMessageLength.length-1;++f)l+=(u=8*i.fullMessageLength[f+1])/4294967296>>>0,s.putInt32(l>>>0),l=u>>>0;s.putInt32(l);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};o(h,r,s);var p=n.util.createBuffer();return p.putInt32(h.h0),p.putInt32(h.h1),p.putInt32(h.h2),p.putInt32(h.h3),p.putInt32(h.h4),p},i};var a=null,s=!1;function o(e,t,r){for(var n,i,a,s,o,u,c,l=r.length();l>=64;){for(i=e.h0,a=e.h1,s=e.h2,o=e.h3,u=e.h4,c=0;c<16;++c)n=r.getInt32(),t[c]=n,n=(i<<5|i>>>27)+(o^a&(s^o))+u+1518500249+n,u=o,o=s,s=(a<<30|a>>>2)>>>0,a=i,i=n;for(;c<20;++c)n=(n=t[c-3]^t[c-8]^t[c-14]^t[c-16])<<1|n>>>31,t[c]=n,n=(i<<5|i>>>27)+(o^a&(s^o))+u+1518500249+n,u=o,o=s,s=(a<<30|a>>>2)>>>0,a=i,i=n;for(;c<32;++c)n=(n=t[c-3]^t[c-8]^t[c-14]^t[c-16])<<1|n>>>31,t[c]=n,n=(i<<5|i>>>27)+(a^s^o)+u+1859775393+n,u=o,o=s,s=(a<<30|a>>>2)>>>0,a=i,i=n;for(;c<40;++c)n=(n=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|n>>>30,t[c]=n,n=(i<<5|i>>>27)+(a^s^o)+u+1859775393+n,u=o,o=s,s=(a<<30|a>>>2)>>>0,a=i,i=n;for(;c<60;++c)n=(n=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|n>>>30,t[c]=n,n=(i<<5|i>>>27)+(a&s|o&(a^s))+u+2400959708+n,u=o,o=s,s=(a<<30|a>>>2)>>>0,a=i,i=n;for(;c<80;++c)n=(n=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|n>>>30,t[c]=n,n=(i<<5|i>>>27)+(a^s^o)+u+3395469782+n,u=o,o=s,s=(a<<30|a>>>2)>>>0,a=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+a|0,e.h2=e.h2+s|0,e.h3=e.h3+o|0,e.h4=e.h4+u|0,l-=64}}},function(e,t,r){var n=r(0);r(23),r(9),r(41),r(4),r(79),r(10),r(29),r(46),r(22),r(1);var i=n.asn1,a=e.exports=n.pki=n.pki||{},s=a.oids,o={};o.CN=s.commonName,o.commonName="CN",o.C=s.countryName,o.countryName="C",o.L=s.localityName,o.localityName="L",o.ST=s.stateOrProvinceName,o.stateOrProvinceName="ST",o.O=s.organizationName,o.organizationName="O",o.OU=s.organizationalUnitName,o.organizationalUnitName="OU",o.E=s.emailAddress,o.emailAddress="E";var u=n.pki.rsa.publicKeyValidator,c={name:"Certificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},u,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},l={name:"rsapss",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},f={name:"CertificationRequestInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},u,{name:"CertificationRequestInfo.attributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0}]}]}]},h={name:"CertificationRequest",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[f,{name:"CertificationRequest.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function p(e,t){"string"==typeof t&&(t={shortName:t});for(var r,n=null,i=0;null===n&&i<e.attributes.length;++i)r=e.attributes[i],(t.type&&t.type===r.type||t.name&&t.name===r.name||t.shortName&&t.shortName===r.shortName)&&(n=r);return n}a.RDNAttributesAsArray=function(e,t){for(var r,n,a,u=[],c=0;c<e.value.length;++c){r=e.value[c];for(var l=0;l<r.value.length;++l)a={},n=r.value[l],a.type=i.derToOid(n.value[0].value),a.value=n.value[1].value,a.valueTagClass=n.value[1].type,a.type in s&&(a.name=s[a.type],a.name in o&&(a.shortName=o[a.name])),t&&(t.update(a.type),t.update(a.value)),u.push(a)}return u},a.CRIAttributesAsArray=function(e){for(var t=[],r=0;r<e.length;++r)for(var n=e[r],u=i.derToOid(n.value[0].value),c=n.value[1].value,l=0;l<c.length;++l){var f={};if(f.type=u,f.value=c[l].value,f.valueTagClass=c[l].type,f.type in s&&(f.name=s[f.type],f.name in o&&(f.shortName=o[f.name])),f.type===s.extensionRequest){f.extensions=[];for(var h=0;h<f.value.length;++h)f.extensions.push(a.certificateExtensionFromAsn1(f.value[h]))}t.push(f)}return t};var d=function(e,t,r){var n={};if(e!==s["RSASSA-PSS"])return n;r&&(n={hash:{algorithmOid:s.sha1},mgf:{algorithmOid:s.mgf1,hash:{algorithmOid:s.sha1}},saltLength:20});var a={},o=[];if(!i.validate(t,l,a,o)){var u=new Error("Cannot read RSASSA-PSS parameter block.");throw u.errors=o,u}return void 0!==a.hashOid&&(n.hash=n.hash||{},n.hash.algorithmOid=i.derToOid(a.hashOid)),void 0!==a.maskGenOid&&(n.mgf=n.mgf||{},n.mgf.algorithmOid=i.derToOid(a.maskGenOid),n.mgf.hash=n.mgf.hash||{},n.mgf.hash.algorithmOid=i.derToOid(a.maskGenHashOid)),void 0!==a.saltLength&&(n.saltLength=a.saltLength.charCodeAt(0)),n};function y(e){for(var t,r,a=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),s=e.attributes,o=0;o<s.length;++o){var u=(t=s[o]).value,c=i.Type.PRINTABLESTRING;"valueTagClass"in t&&(c=t.valueTagClass)===i.Type.UTF8&&(u=n.util.encodeUtf8(u)),r=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.type).getBytes()),i.create(i.Class.UNIVERSAL,c,!1,u)])]),a.value.push(r)}return a}function g(e){for(var t,r=0;r<e.length;++r){if(void 0===(t=e[r]).name&&(t.type&&t.type in a.oids?t.name=a.oids[t.type]:t.shortName&&t.shortName in o&&(t.name=a.oids[o[t.shortName]])),void 0===t.type){if(!t.name||!(t.name in a.oids))throw(u=new Error("Attribute type not specified.")).attribute=t,u;t.type=a.oids[t.name]}if(void 0===t.shortName&&t.name&&t.name in o&&(t.shortName=o[t.name]),t.type===s.extensionRequest&&(t.valueConstructed=!0,t.valueTagClass=i.Type.SEQUENCE,!t.value&&t.extensions)){t.value=[];for(var n=0;n<t.extensions.length;++n)t.value.push(a.certificateExtensionToAsn1(m(t.extensions[n])))}var u;if(void 0===t.value)throw(u=new Error("Attribute value not specified.")).attribute=t,u}}function m(e,t){if(t=t||{},void 0===e.name&&e.id&&e.id in a.oids&&(e.name=a.oids[e.id]),void 0===e.id){if(!e.name||!(e.name in a.oids))throw(C=new Error("Extension ID not specified.")).extension=e,C;e.id=a.oids[e.name]}if(void 0!==e.value)return e;if("keyUsage"===e.name){var r=0,o=0,u=0;e.digitalSignature&&(o|=128,r=7),e.nonRepudiation&&(o|=64,r=6),e.keyEncipherment&&(o|=32,r=5),e.dataEncipherment&&(o|=16,r=4),e.keyAgreement&&(o|=8,r=3),e.keyCertSign&&(o|=4,r=2),e.cRLSign&&(o|=2,r=1),e.encipherOnly&&(o|=1,r=0),e.decipherOnly&&(u|=128,r=7);var c=String.fromCharCode(r);0!==u?c+=String.fromCharCode(o)+String.fromCharCode(u):0!==o&&(c+=String.fromCharCode(o)),e.value=i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,c)}else if("basicConstraints"===e.name)e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(i.create(i.Class.UNIVERSAL,i.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in e&&e.value.value.push(i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.pathLenConstraint).getBytes()));else if("extKeyUsage"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);var l=e.value.value;for(var f in e)!0===e[f]&&(f in s?l.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s[f]).getBytes())):-1!==f.indexOf(".")&&l.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(f).getBytes())))}else if("nsCertType"===e.name){r=0,o=0;e.client&&(o|=128,r=7),e.server&&(o|=64,r=6),e.email&&(o|=32,r=5),e.objsign&&(o|=16,r=4),e.reserved&&(o|=8,r=3),e.sslCA&&(o|=4,r=2),e.emailCA&&(o|=2,r=1),e.objCA&&(o|=1,r=0);c=String.fromCharCode(r);0!==o&&(c+=String.fromCharCode(o)),e.value=i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,c)}else if("subjectAltName"===e.name||"issuerAltName"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);for(var h=0;h<e.altNames.length;++h){c=(v=e.altNames[h]).value;if(7===v.type&&v.ip){if(null===(c=n.util.bytesFromIP(v.ip)))throw(C=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,C}else 8===v.type&&(c=v.oid?i.oidToDer(i.oidToDer(v.oid)):i.oidToDer(c));e.value.value.push(i.create(i.Class.CONTEXT_SPECIFIC,v.type,!1,c))}}else if("nsComment"===e.name&&t.cert){if(!/^[\x00-\x7F]*$/.test(e.comment)||e.comment.length<1||e.comment.length>128)throw new Error('Invalid "nsComment" content.');e.value=i.create(i.Class.UNIVERSAL,i.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var p=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=p.toHex(),e.value=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,p.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);l=e.value.value;if(e.keyIdentifier){var d=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;l.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!1,d))}if(e.authorityCertIssuer){var g=[i.create(i.Class.CONTEXT_SPECIFIC,4,!0,[y(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];l.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,g))}if(e.serialNumber){var m=n.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);l.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!1,m))}}else if("cRLDistributionPoints"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);l=e.value.value;var v,b=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),E=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(h=0;h<e.altNames.length;++h){c=(v=e.altNames[h]).value;if(7===v.type&&v.ip){if(null===(c=n.util.bytesFromIP(v.ip)))throw(C=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,C}else 8===v.type&&(c=v.oid?i.oidToDer(i.oidToDer(v.oid)):i.oidToDer(c));E.value.push(i.create(i.Class.CONTEXT_SPECIFIC,v.type,!1,c))}b.value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[E])),l.push(b)}var C;if(void 0===e.value)throw(C=new Error("Extension value not specified.")).extension=e,C;return e}function v(e,t){switch(e){case s["RSASSA-PSS"]:var r=[];return void 0!==t.hash.algorithmOid&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.hash.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])])),void 0!==t.mgf.algorithmOid&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.mgf.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.mgf.hash.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])])])),void 0!==t.saltLength&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(t.saltLength).getBytes())])),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,r);default:return i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")}}function b(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===e.attributes.length)return t;for(var r=e.attributes,a=0;a<r.length;++a){var s=r[a],o=s.value,u=i.Type.UTF8;"valueTagClass"in s&&(u=s.valueTagClass),u===i.Type.UTF8&&(o=n.util.encodeUtf8(o));var c=!1;"valueConstructed"in s&&(c=s.valueConstructed);var l=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s.type).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,u,c,o)])]);t.value.push(l)}return t}a.certificateFromPem=function(e,t,r){var s=n.pem.decode(e)[0];if("CERTIFICATE"!==s.type&&"X509 CERTIFICATE"!==s.type&&"TRUSTED CERTIFICATE"!==s.type){var o=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw o.headerType=s.type,o}if(s.procType&&"ENCRYPTED"===s.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var u=i.fromDer(s.body,r);return a.certificateFromAsn1(u,t)},a.certificateToPem=function(e,t){var r={type:"CERTIFICATE",body:i.toDer(a.certificateToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},a.publicKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("PUBLIC KEY"!==t.type&&"RSA PUBLIC KEY"!==t.type){var r=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert public key from PEM; PEM is encrypted.");var s=i.fromDer(t.body);return a.publicKeyFromAsn1(s)},a.publicKeyToPem=function(e,t){var r={type:"PUBLIC KEY",body:i.toDer(a.publicKeyToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},a.publicKeyToRSAPublicKeyPem=function(e,t){var r={type:"RSA PUBLIC KEY",body:i.toDer(a.publicKeyToRSAPublicKey(e)).getBytes()};return n.pem.encode(r,{maxline:t})},a.getPublicKeyFingerprint=function(e,t){var r,s=(t=t||{}).md||n.md.sha1.create();switch(t.type||"RSAPublicKey"){case"RSAPublicKey":r=i.toDer(a.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":r=i.toDer(a.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+t.type+'".')}s.start(),s.update(r);var o=s.digest();if("hex"===t.encoding){var u=o.toHex();return t.delimiter?u.match(/.{2}/g).join(t.delimiter):u}if("binary"===t.encoding)return o.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".');return o},a.certificationRequestFromPem=function(e,t,r){var s=n.pem.decode(e)[0];if("CERTIFICATE REQUEST"!==s.type){var o=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw o.headerType=s.type,o}if(s.procType&&"ENCRYPTED"===s.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var u=i.fromDer(s.body,r);return a.certificationRequestFromAsn1(u,t)},a.certificationRequestToPem=function(e,t){var r={type:"CERTIFICATE REQUEST",body:i.toDer(a.certificationRequestToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},a.createCertificate=function(){var e={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return p(e.issuer,t)},e.issuer.addField=function(t){g([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return p(e.subject,t)},e.subject.addField=function(t){g([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,r){g(t),e.subject.attributes=t,delete e.subject.uniqueId,r&&(e.subject.uniqueId=r),e.subject.hash=null},e.setIssuer=function(t,r){g(t),e.issuer.attributes=t,delete e.issuer.uniqueId,r&&(e.issuer.uniqueId=r),e.issuer.hash=null},e.setExtensions=function(t){for(var r=0;r<t.length;++r)m(t[r],{cert:e});e.extensions=t},e.getExtension=function(t){"string"==typeof t&&(t={name:t});for(var r,n=null,i=0;null===n&&i<e.extensions.length;++i)r=e.extensions[i],(t.id&&r.id===t.id||t.name&&r.name===t.name)&&(n=r);return n},e.sign=function(t,r){e.md=r||n.md.sha1.create();var o=s[e.md.algorithm+"WithRSAEncryption"];if(!o){var u=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw u.algorithm=e.md.algorithm,u}e.signatureOid=e.siginfo.algorithmOid=o,e.tbsCertificate=a.getTBSCertificate(e);var c=i.toDer(e.tbsCertificate);e.md.update(c.getBytes()),e.signature=t.sign(e.md)},e.verify=function(t){var r=!1;if(!e.issued(t)){var o=t.issuer,u=e.subject;throw(y=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.")).expectedIssuer=o.attributes,y.actualIssuer=u.attributes,y}var c=t.md;if(null===c){if(t.signatureOid in s)switch(s[t.signatureOid]){case"sha1WithRSAEncryption":c=n.md.sha1.create();break;case"md5WithRSAEncryption":c=n.md.md5.create();break;case"sha256WithRSAEncryption":c=n.md.sha256.create();break;case"sha384WithRSAEncryption":c=n.md.sha384.create();break;case"sha512WithRSAEncryption":c=n.md.sha512.create();break;case"RSASSA-PSS":c=n.md.sha256.create()}if(null===c)throw(y=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=t.signatureOid,y;var l=t.tbsCertificate||a.getTBSCertificate(t),f=i.toDer(l);c.update(f.getBytes())}if(null!==c){var h;switch(t.signatureOid){case s.sha1WithRSAEncryption:h=void 0;break;case s["RSASSA-PSS"]:var p,d,y;if(void 0===(p=s[t.signatureParameters.mgf.hash.algorithmOid])||void 0===n.md[p])throw(y=new Error("Unsupported MGF hash function.")).oid=t.signatureParameters.mgf.hash.algorithmOid,y.name=p,y;if(void 0===(d=s[t.signatureParameters.mgf.algorithmOid])||void 0===n.mgf[d])throw(y=new Error("Unsupported MGF function.")).oid=t.signatureParameters.mgf.algorithmOid,y.name=d,y;if(d=n.mgf[d].create(n.md[p].create()),void 0===(p=s[t.signatureParameters.hash.algorithmOid])||void 0===n.md[p])throw{message:"Unsupported RSASSA-PSS hash function.",oid:t.signatureParameters.hash.algorithmOid,name:p};h=n.pss.create(n.md[p].create(),d,t.signatureParameters.saltLength)}r=e.publicKey.verify(c.digest().getBytes(),t.signature,h)}return r},e.isIssuer=function(t){var r=!1,n=e.issuer,i=t.subject;if(n.hash&&i.hash)r=n.hash===i.hash;else if(n.attributes.length===i.attributes.length){var a,s;r=!0;for(var o=0;r&&o<n.attributes.length;++o)a=n.attributes[o],s=i.attributes[o],a.type===s.type&&a.value===s.value||(r=!1)}return r},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return a.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=s.subjectKeyIdentifier,r=0;r<e.extensions.length;++r){var i=e.extensions[r];if(i.id===t){var a=e.generateSubjectKeyIdentifier().getBytes();return n.util.hexToBytes(i.subjectKeyIdentifier)===a}}return!1},e},a.certificateFromAsn1=function(e,t){var r={},o=[];if(!i.validate(e,c,r,o))throw(h=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.")).errors=o,h;if(i.derToOid(r.publicKeyOid)!==a.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var u=a.createCertificate();u.version=r.certVersion?r.certVersion.charCodeAt(0):0;var l=n.util.createBuffer(r.certSerialNumber);u.serialNumber=l.toHex(),u.signatureOid=n.asn1.derToOid(r.certSignatureOid),u.signatureParameters=d(u.signatureOid,r.certSignatureParams,!0),u.siginfo.algorithmOid=n.asn1.derToOid(r.certinfoSignatureOid),u.siginfo.parameters=d(u.siginfo.algorithmOid,r.certinfoSignatureParams,!1),u.signature=r.certSignature;var f=[];if(void 0!==r.certValidity1UTCTime&&f.push(i.utcTimeToDate(r.certValidity1UTCTime)),void 0!==r.certValidity2GeneralizedTime&&f.push(i.generalizedTimeToDate(r.certValidity2GeneralizedTime)),void 0!==r.certValidity3UTCTime&&f.push(i.utcTimeToDate(r.certValidity3UTCTime)),void 0!==r.certValidity4GeneralizedTime&&f.push(i.generalizedTimeToDate(r.certValidity4GeneralizedTime)),f.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(f.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(u.validity.notBefore=f[0],u.validity.notAfter=f[1],u.tbsCertificate=r.tbsCertificate,t){var h;if(u.md=null,u.signatureOid in s)switch(s[u.signatureOid]){case"sha1WithRSAEncryption":u.md=n.md.sha1.create();break;case"md5WithRSAEncryption":u.md=n.md.md5.create();break;case"sha256WithRSAEncryption":u.md=n.md.sha256.create();break;case"sha384WithRSAEncryption":u.md=n.md.sha384.create();break;case"sha512WithRSAEncryption":u.md=n.md.sha512.create();break;case"RSASSA-PSS":u.md=n.md.sha256.create()}if(null===u.md)throw(h=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=u.signatureOid,h;var y=i.toDer(u.tbsCertificate);u.md.update(y.getBytes())}var m=n.md.sha1.create();u.issuer.getField=function(e){return p(u.issuer,e)},u.issuer.addField=function(e){g([e]),u.issuer.attributes.push(e)},u.issuer.attributes=a.RDNAttributesAsArray(r.certIssuer,m),r.certIssuerUniqueId&&(u.issuer.uniqueId=r.certIssuerUniqueId),u.issuer.hash=m.digest().toHex();var v=n.md.sha1.create();return u.subject.getField=function(e){return p(u.subject,e)},u.subject.addField=function(e){g([e]),u.subject.attributes.push(e)},u.subject.attributes=a.RDNAttributesAsArray(r.certSubject,v),r.certSubjectUniqueId&&(u.subject.uniqueId=r.certSubjectUniqueId),u.subject.hash=v.digest().toHex(),r.certExtensions?u.extensions=a.certificateExtensionsFromAsn1(r.certExtensions):u.extensions=[],u.publicKey=a.publicKeyFromAsn1(r.subjectPublicKeyInfo),u},a.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r<e.value.length;++r)for(var n=e.value[r],i=0;i<n.value.length;++i)t.push(a.certificateExtensionFromAsn1(n.value[i]));return t},a.certificateExtensionFromAsn1=function(e){var t={};if(t.id=i.derToOid(e.value[0].value),t.critical=!1,e.value[1].type===i.Type.BOOLEAN?(t.critical=0!==e.value[1].value.charCodeAt(0),t.value=e.value[2].value):t.value=e.value[1].value,t.id in s)if(t.name=s[t.id],"keyUsage"===t.name){var r=0,a=0;(u=i.fromDer(t.value)).value.length>1&&(r=u.value.charCodeAt(1),a=u.value.length>2?u.value.charCodeAt(2):0),t.digitalSignature=128==(128&r),t.nonRepudiation=64==(64&r),t.keyEncipherment=32==(32&r),t.dataEncipherment=16==(16&r),t.keyAgreement=8==(8&r),t.keyCertSign=4==(4&r),t.cRLSign=2==(2&r),t.encipherOnly=1==(1&r),t.decipherOnly=128==(128&a)}else if("basicConstraints"===t.name){(u=i.fromDer(t.value)).value.length>0&&u.value[0].type===i.Type.BOOLEAN?t.cA=0!==u.value[0].value.charCodeAt(0):t.cA=!1;var o=null;u.value.length>0&&u.value[0].type===i.Type.INTEGER?o=u.value[0].value:u.value.length>1&&(o=u.value[1].value),null!==o&&(t.pathLenConstraint=i.derToInteger(o))}else if("extKeyUsage"===t.name)for(var u=i.fromDer(t.value),c=0;c<u.value.length;++c){var l=i.derToOid(u.value[c].value);l in s?t[s[l]]=!0:t[l]=!0}else if("nsCertType"===t.name){r=0;(u=i.fromDer(t.value)).value.length>1&&(r=u.value.charCodeAt(1)),t.client=128==(128&r),t.server=64==(64&r),t.email=32==(32&r),t.objsign=16==(16&r),t.reserved=8==(8&r),t.sslCA=4==(4&r),t.emailCA=2==(2&r),t.objCA=1==(1&r)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){var f;t.altNames=[];u=i.fromDer(t.value);for(var h=0;h<u.value.length;++h){var p={type:(f=u.value[h]).type,value:f.value};switch(t.altNames.push(p),f.type){case 1:case 2:case 6:break;case 7:p.ip=n.util.bytesToIP(f.value);break;case 8:p.oid=i.derToOid(f.value)}}}else if("subjectKeyIdentifier"===t.name){u=i.fromDer(t.value);t.subjectKeyIdentifier=n.util.bytesToHex(u.value)}return t},a.certificationRequestFromAsn1=function(e,t){var r={},o=[];if(!i.validate(e,h,r,o))throw(c=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.")).errors=o,c;if(i.derToOid(r.publicKeyOid)!==a.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var u=a.createCertificationRequest();if(u.version=r.csrVersion?r.csrVersion.charCodeAt(0):0,u.signatureOid=n.asn1.derToOid(r.csrSignatureOid),u.signatureParameters=d(u.signatureOid,r.csrSignatureParams,!0),u.siginfo.algorithmOid=n.asn1.derToOid(r.csrSignatureOid),u.siginfo.parameters=d(u.siginfo.algorithmOid,r.csrSignatureParams,!1),u.signature=r.csrSignature,u.certificationRequestInfo=r.certificationRequestInfo,t){var c;if(u.md=null,u.signatureOid in s)switch(s[u.signatureOid]){case"sha1WithRSAEncryption":u.md=n.md.sha1.create();break;case"md5WithRSAEncryption":u.md=n.md.md5.create();break;case"sha256WithRSAEncryption":u.md=n.md.sha256.create();break;case"sha384WithRSAEncryption":u.md=n.md.sha384.create();break;case"sha512WithRSAEncryption":u.md=n.md.sha512.create();break;case"RSASSA-PSS":u.md=n.md.sha256.create()}if(null===u.md)throw(c=new Error("Could not compute certification request digest. Unknown signature OID.")).signatureOid=u.signatureOid,c;var l=i.toDer(u.certificationRequestInfo);u.md.update(l.getBytes())}var f=n.md.sha1.create();return u.subject.getField=function(e){return p(u.subject,e)},u.subject.addField=function(e){g([e]),u.subject.attributes.push(e)},u.subject.attributes=a.RDNAttributesAsArray(r.certificationRequestInfoSubject,f),u.subject.hash=f.digest().toHex(),u.publicKey=a.publicKeyFromAsn1(r.subjectPublicKeyInfo),u.getAttribute=function(e){return p(u,e)},u.addAttribute=function(e){g([e]),u.attributes.push(e)},u.attributes=a.CRIAttributesAsArray(r.certificationRequestInfoAttributes||[]),u},a.createCertificationRequest=function(){var e={version:0,signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return p(e.subject,t)},e.subject.addField=function(t){g([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return p(e,t)},e.addAttribute=function(t){g([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){g(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){g(t),e.attributes=t},e.sign=function(t,r){e.md=r||n.md.sha1.create();var o=s[e.md.algorithm+"WithRSAEncryption"];if(!o){var u=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw u.algorithm=e.md.algorithm,u}e.signatureOid=e.siginfo.algorithmOid=o,e.certificationRequestInfo=a.getCertificationRequestInfo(e);var c=i.toDer(e.certificationRequestInfo);e.md.update(c.getBytes()),e.signature=t.sign(e.md)},e.verify=function(){var t=!1,r=e.md;if(null===r){if(e.signatureOid in s)switch(s[e.signatureOid]){case"sha1WithRSAEncryption":r=n.md.sha1.create();break;case"md5WithRSAEncryption":r=n.md.md5.create();break;case"sha256WithRSAEncryption":r=n.md.sha256.create();break;case"sha384WithRSAEncryption":r=n.md.sha384.create();break;case"sha512WithRSAEncryption":r=n.md.sha512.create();break;case"RSASSA-PSS":r=n.md.sha256.create()}if(null===r)throw(h=new Error("Could not compute certification request digest. Unknown signature OID.")).signatureOid=e.signatureOid,h;var o=e.certificationRequestInfo||a.getCertificationRequestInfo(e),u=i.toDer(o);r.update(u.getBytes())}if(null!==r){var c;switch(e.signatureOid){case s.sha1WithRSAEncryption:break;case s["RSASSA-PSS"]:var l,f,h;if(void 0===(l=s[e.signatureParameters.mgf.hash.algorithmOid])||void 0===n.md[l])throw(h=new Error("Unsupported MGF hash function.")).oid=e.signatureParameters.mgf.hash.algorithmOid,h.name=l,h;if(void 0===(f=s[e.signatureParameters.mgf.algorithmOid])||void 0===n.mgf[f])throw(h=new Error("Unsupported MGF function.")).oid=e.signatureParameters.mgf.algorithmOid,h.name=f,h;if(f=n.mgf[f].create(n.md[l].create()),void 0===(l=s[e.signatureParameters.hash.algorithmOid])||void 0===n.md[l])throw(h=new Error("Unsupported RSASSA-PSS hash function.")).oid=e.signatureParameters.hash.algorithmOid,h.name=l,h;c=n.pss.create(n.md[l].create(),f,e.signatureParameters.saltLength)}t=e.publicKey.verify(r.digest().getBytes(),e.signature,c)}return t},e};var E=new Date("1950-01-01T00:00:00Z"),C=new Date("2050-01-01T00:00:00Z");function S(e){return e>=E&&e<C?i.create(i.Class.UNIVERSAL,i.Type.UTCTIME,!1,i.dateToUtcTime(e)):i.create(i.Class.UNIVERSAL,i.Type.GENERALIZEDTIME,!1,i.dateToGeneralizedTime(e))}a.getTBSCertificate=function(e){var t=S(e.validity.notBefore),r=S(e.validity.notAfter),s=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes())]),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(e.serialNumber)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.siginfo.algorithmOid).getBytes()),v(e.siginfo.algorithmOid,e.siginfo.parameters)]),y(e.issuer),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,r]),y(e.subject),a.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&s.value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.issuer.uniqueId)])),e.subject.uniqueId&&s.value.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!0,[i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.subject.uniqueId)])),e.extensions.length>0&&s.value.push(a.certificateExtensionsToAsn1(e.extensions)),s},a.getCertificationRequestInfo=function(e){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),y(e.subject),a.publicKeyToAsn1(e.publicKey),b(e)])},a.distinguishedNameToAsn1=function(e){return y(e)},a.certificateToAsn1=function(e){var t=e.tbsCertificate||a.getTBSCertificate(e);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureOid).getBytes()),v(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},a.certificateExtensionsToAsn1=function(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,3,!0,[]),r=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;n<e.length;++n)r.value.push(a.certificateExtensionToAsn1(e[n]));return t},a.certificateExtensionToAsn1=function(e){var t=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.id).getBytes())),e.critical&&t.value.push(i.create(i.Class.UNIVERSAL,i.Type.BOOLEAN,!1,String.fromCharCode(255)));var r=e.value;return"string"!=typeof e.value&&(r=i.toDer(r).getBytes()),t.value.push(i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,r)),t},a.certificationRequestToAsn1=function(e){var t=e.certificationRequestInfo||a.getCertificationRequestInfo(e);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureOid).getBytes()),v(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},a.createCaStore=function(e){var t={certs:{}};function r(e){return s(e),t.certs[e.hash]||null}function s(e){if(!e.hash){var t=n.md.sha1.create();e.attributes=a.RDNAttributesAsArray(y(e),t),e.hash=t.digest().toHex()}}if(t.getIssuer=function(e){return r(e.issuer)},t.addCertificate=function(e){if("string"==typeof e&&(e=n.pki.certificateFromPem(e)),s(e.subject),!t.hasCertificate(e))if(e.subject.hash in t.certs){var r=t.certs[e.subject.hash];n.util.isArray(r)||(r=[r]),r.push(e),t.certs[e.subject.hash]=r}else t.certs[e.subject.hash]=e},t.hasCertificate=function(e){"string"==typeof e&&(e=n.pki.certificateFromPem(e));var t=r(e.subject);if(!t)return!1;n.util.isArray(t)||(t=[t]);for(var s=i.toDer(a.certificateToAsn1(e)).getBytes(),o=0;o<t.length;++o){if(s===i.toDer(a.certificateToAsn1(t[o])).getBytes())return!0}return!1},t.listAllCertificates=function(){var e=[];for(var r in t.certs)if(t.certs.hasOwnProperty(r)){var i=t.certs[r];if(n.util.isArray(i))for(var a=0;a<i.length;++a)e.push(i[a]);else e.push(i)}return e},t.removeCertificate=function(e){var o;if("string"==typeof e&&(e=n.pki.certificateFromPem(e)),s(e.subject),!t.hasCertificate(e))return null;var u=r(e.subject);if(!n.util.isArray(u))return o=t.certs[e.subject.hash],delete t.certs[e.subject.hash],o;for(var c=i.toDer(a.certificateToAsn1(e)).getBytes(),l=0;l<u.length;++l){c===i.toDer(a.certificateToAsn1(u[l])).getBytes()&&(o=u[l],u.splice(l,1))}return 0===u.length&&delete t.certs[e.subject.hash],o},e)for(var o=0;o<e.length;++o){var u=e[o];t.addCertificate(u)}return t},a.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},a.verifyCertificateChain=function(e,t,r){"function"==typeof r&&(r={verify:r}),r=r||{};var i=(t=t.slice(0)).slice(0),s=r.validityCheckDate;void 0===s&&(s=new Date);var o=!0,u=null,c=0;do{var l=t.shift(),f=null,h=!1;if(s&&(s<l.validity.notBefore||s>l.validity.notAfter)&&(u={message:"Certificate is not valid yet or has expired.",error:a.certificateError.certificate_expired,notBefore:l.validity.notBefore,notAfter:l.validity.notAfter,now:s}),null===u){if(null===(f=t[0]||e.getIssuer(l))&&l.isIssuer(l)&&(h=!0,f=l),f){var p=f;n.util.isArray(p)||(p=[p]);for(var d=!1;!d&&p.length>0;){f=p.shift();try{d=f.verify(l)}catch(e){}}d||(u={message:"Certificate signature is invalid.",error:a.certificateError.bad_certificate})}null!==u||f&&!h||e.hasCertificate(l)||(u={message:"Certificate is not trusted.",error:a.certificateError.unknown_ca})}if(null===u&&f&&!l.isIssuer(f)&&(u={message:"Certificate issuer is invalid.",error:a.certificateError.bad_certificate}),null===u)for(var y={keyUsage:!0,basicConstraints:!0},g=0;null===u&&g<l.extensions.length;++g){var m=l.extensions[g];m.critical&&!(m.name in y)&&(u={message:"Certificate has an unsupported critical extension.",error:a.certificateError.unsupported_certificate})}if(null===u&&(!o||0===t.length&&(!f||h))){var v=l.getExtension("basicConstraints"),b=l.getExtension("keyUsage");if(null!==b&&(b.keyCertSign&&null!==v||(u={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:a.certificateError.bad_certificate})),null!==u||null===v||v.cA||(u={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:a.certificateError.bad_certificate}),null===u&&null!==b&&"pathLenConstraint"in v)c-1>v.pathLenConstraint&&(u={message:"Certificate basicConstraints pathLenConstraint violated.",error:a.certificateError.bad_certificate})}var E=null===u||u.error,C=r.verify?r.verify(E,c,i):E;if(!0!==C)throw!0===E&&(u={message:"The application rejected the certificate.",error:a.certificateError.bad_certificate}),(C||0===C)&&("object"!=typeof C||n.util.isArray(C)?"string"==typeof C&&(u.error=C):(C.message&&(u.message=C.message),C.error&&(u.error=C.error))),u;u=null,o=!1,++c}while(t.length>0);return!0}},function(e,t,r){var n=r(0);r(7),r(1),(e.exports=n.pss=n.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,i=e.mgf,a=r.digestLength,s=e.salt||null;if("string"==typeof s&&(s=n.util.createBuffer(s)),"saltLength"in e)t=e.saltLength;else{if(null===s)throw new Error("Salt length not specified or specific salt not given.");t=s.length()}if(null!==s&&s.length()!==t)throw new Error("Given salt length does not match length of given salt.");var o=e.prng||n.random,u={encode:function(e,u){var c,l,f=u-1,h=Math.ceil(f/8),p=e.digest().getBytes();if(h<a+t+2)throw new Error("Message is too long to encrypt.");l=null===s?o.getBytesSync(t):s.bytes();var d=new n.util.ByteBuffer;d.fillWithByte(0,8),d.putBytes(p),d.putBytes(l),r.start(),r.update(d.getBytes());var y=r.digest().getBytes(),g=new n.util.ByteBuffer;g.fillWithByte(0,h-t-a-2),g.putByte(1),g.putBytes(l);var m=g.getBytes(),v=h-a-1,b=i.generate(y,v),E="";for(c=0;c<v;c++)E+=String.fromCharCode(m.charCodeAt(c)^b.charCodeAt(c));var C=65280>>8*h-f&255;return(E=String.fromCharCode(E.charCodeAt(0)&~C)+E.substr(1))+y+String.fromCharCode(188)},verify:function(e,s,o){var u,c=o-1,l=Math.ceil(c/8);if(s=s.substr(-l),l<a+t+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==s.charCodeAt(l-1))throw new Error("Encoded message does not end in 0xBC.");var f=l-a-1,h=s.substr(0,f),p=s.substr(f,a),d=65280>>8*l-c&255;if(0!=(h.charCodeAt(0)&d))throw new Error("Bits beyond keysize not zero as expected.");var y=i.generate(p,f),g="";for(u=0;u<f;u++)g+=String.fromCharCode(h.charCodeAt(u)^y.charCodeAt(u));g=String.fromCharCode(g.charCodeAt(0)&~d)+g.substr(1);var m=l-a-t-2;for(u=0;u<m;u++)if(0!==g.charCodeAt(u))throw new Error("Leftmost octets not zero as expected");if(1!==g.charCodeAt(m))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var v=g.substr(-t),b=new n.util.ByteBuffer;return b.fillWithByte(0,8),b.putBytes(e),b.putBytes(v),r.start(),r.update(b.getBytes()),p===r.digest().getBytes()}};return u}},function(e,t,r){var n=r(0);r(4),r(1);var i=e.exports=n.md5=n.md5||{};n.md.md5=n.md.algorithms.md5=i,i.create=function(){c||function(){a=String.fromCharCode(128),a+=n.util.fillString(String.fromCharCode(0),64),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],o=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],u=new Array(64);for(var e=0;e<64;++e)u[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));c=!0}();var e=null,t=n.util.createBuffer(),r=new Array(16),i={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,a=0;a<r;++a)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},i}};return i.start(),i.update=function(a,s){"utf8"===s&&(a=n.util.encodeUtf8(a));var o=a.length;i.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var u=i.fullMessageLength.length-1;u>=0;--u)i.fullMessageLength[u]+=o[1],o[1]=o[0]+(i.fullMessageLength[u]/4294967296>>>0),i.fullMessageLength[u]=i.fullMessageLength[u]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(a),l(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var o=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;s.putBytes(a.substr(0,i.blockLength-o));for(var u,c=0,f=i.fullMessageLength.length-1;f>=0;--f)c=(u=8*i.fullMessageLength[f]+c)/4294967296>>>0,s.putInt32Le(u>>>0);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};l(h,r,s);var p=n.util.createBuffer();return p.putInt32Le(h.h0),p.putInt32Le(h.h1),p.putInt32Le(h.h2),p.putInt32Le(h.h3),p},i};var a=null,s=null,o=null,u=null,c=!1;function l(e,t,r){for(var n,i,a,c,l,f,h,p=r.length();p>=64;){for(i=e.h0,a=e.h1,c=e.h2,l=e.h3,h=0;h<16;++h)t[h]=r.getInt32Le(),n=i+(l^a&(c^l))+u[h]+t[h],i=l,l=c,c=a,a+=n<<(f=o[h])|n>>>32-f;for(;h<32;++h)n=i+(c^l&(a^c))+u[h]+t[s[h]],i=l,l=c,c=a,a+=n<<(f=o[h])|n>>>32-f;for(;h<48;++h)n=i+(a^c^l)+u[h]+t[s[h]],i=l,l=c,c=a,a+=n<<(f=o[h])|n>>>32-f;for(;h<64;++h)n=i+(c^(a|~l))+u[h]+t[s[h]],i=l,l=c,c=a,a+=n<<(f=o[h])|n>>>32-f;e.h0=e.h0+i|0,e.h1=e.h1+a|0,e.h2=e.h2+c|0,e.h3=e.h3+l|0,p-=64}}},function(e,t,r){"use strict";t.__esModule=!0,t.default=function(e,t){return new URL(e,t).toString()}},function(e,t,r){"use strict";t.__esModule=!0;var n=new RegExp('((?!\\\\)"\\w+"):\\s*(-?[\\d|\\.]{14,})',"g");t.default=function(e){return JSON.parse(e.replace(n,'$1:"$2"'))}},function(e,t,r){"use strict";t.__esModule=!0;var n=["amount","matcherFee","price","minSponsoredAssetFee","fee","quantity","sellMatcherFee","buyMatcherFee"];t.default=function(e){return JSON.stringify(e,(function(e,t){return n.includes(e)&&t||"value"===e&&"integer"===this.type?"!"+t+"!":"minSponsoredAssetFee"===e&&null==t?null:t}),0).replace(/"\!(-?\d+)\!"/g,"$1")}},function(e,t,r){!function(e){"use strict";var t=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,r=Math.ceil,n=Math.floor,i="[BigNumber Error] ",a=i+"Number primitive has more than 15 significant digits: ",s=1e14,o=14,u=9007199254740991,c=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],l=1e7,f=1e9;function h(e){var t=0|e;return e>0||e===t?t:t-1}function p(e){for(var t,r,n=1,i=e.length,a=e[0]+"";n<i;){for(t=e[n++]+"",r=o-t.length;r--;t="0"+t);a+=t}for(i=a.length;48===a.charCodeAt(--i););return a.slice(0,i+1||1)}function d(e,t){var r,n,i=e.c,a=t.c,s=e.s,o=t.s,u=e.e,c=t.e;if(!s||!o)return null;if(r=i&&!i[0],n=a&&!a[0],r||n)return r?n?0:-o:s;if(s!=o)return s;if(r=s<0,n=u==c,!i||!a)return n?0:!i^r?1:-1;if(!n)return u>c^r?1:-1;for(o=(u=i.length)<(c=a.length)?u:c,s=0;s<o;s++)if(i[s]!=a[s])return i[s]>a[s]^r?1:-1;return u==c?0:u>c^r?1:-1}function y(e,t,r,a){if(e<t||e>r||e!==n(e))throw Error(i+(a||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function g(e){var t=e.c.length-1;return h(e.e/o)==t&&e.c[t]%2!=0}function m(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function v(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var b=function e(b){var E,C,S,T,A,I,w,B,_,N=F.prototype={constructor:F,toString:null,valueOf:null},R=new F(1),k=20,U=4,P=-7,O=21,L=-1e7,D=1e7,M=!1,x=1,V=0,K={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},j="0123456789abcdefghijklmnopqrstuvwxyz";function F(e,r){var i,s,c,l,f,h,p,d,g=this;if(!(g instanceof F))return new F(e,r);if(null==r){if(e&&!0===e._isBigNumber)return g.s=e.s,void(!e.c||e.e>D?g.c=g.e=null:e.e<L?g.c=[g.e=0]:(g.e=e.e,g.c=e.c.slice()));if((h="number"==typeof e)&&0*e==0){if(g.s=1/e<0?(e=-e,-1):1,e===~~e){for(l=0,f=e;f>=10;f/=10,l++);return void(l>D?g.c=g.e=null:(g.e=l,g.c=[e]))}d=String(e)}else{if(!t.test(d=String(e)))return S(g,d,h);g.s=45==d.charCodeAt(0)?(d=d.slice(1),-1):1}(l=d.indexOf("."))>-1&&(d=d.replace(".","")),(f=d.search(/e/i))>0?(l<0&&(l=f),l+=+d.slice(f+1),d=d.substring(0,f)):l<0&&(l=d.length)}else{if(y(r,2,j.length,"Base"),10==r)return H(g=new F(e),k+g.e+1,U);if(d=String(e),h="number"==typeof e){if(0*e!=0)return S(g,d,h,r);if(g.s=1/e<0?(d=d.slice(1),-1):1,F.DEBUG&&d.replace(/^0\.0*|\./,"").length>15)throw Error(a+e)}else g.s=45===d.charCodeAt(0)?(d=d.slice(1),-1):1;for(i=j.slice(0,r),l=f=0,p=d.length;f<p;f++)if(i.indexOf(s=d.charAt(f))<0){if("."==s){if(f>l){l=p;continue}}else if(!c&&(d==d.toUpperCase()&&(d=d.toLowerCase())||d==d.toLowerCase()&&(d=d.toUpperCase()))){c=!0,f=-1,l=0;continue}return S(g,String(e),h,r)}h=!1,(l=(d=C(d,r,10,g.s)).indexOf("."))>-1?d=d.replace(".",""):l=d.length}for(f=0;48===d.charCodeAt(f);f++);for(p=d.length;48===d.charCodeAt(--p););if(d=d.slice(f,++p)){if(p-=f,h&&F.DEBUG&&p>15&&(e>u||e!==n(e)))throw Error(a+g.s*e);if((l=l-f-1)>D)g.c=g.e=null;else if(l<L)g.c=[g.e=0];else{if(g.e=l,g.c=[],f=(l+1)%o,l<0&&(f+=o),f<p){for(f&&g.c.push(+d.slice(0,f)),p-=o;f<p;)g.c.push(+d.slice(f,f+=o));f=o-(d=d.slice(f)).length}else f-=p;for(;f--;d+="0");g.c.push(+d)}}else g.c=[g.e=0]}function q(e,t,r,n){var i,a,s,o,u;if(null==r?r=U:y(r,0,8),!e.c)return e.toString();if(i=e.c[0],s=e.e,null==t)u=p(e.c),u=1==n||2==n&&(s<=P||s>=O)?m(u,s):v(u,s,"0");else if(a=(e=H(new F(e),t,r)).e,o=(u=p(e.c)).length,1==n||2==n&&(t<=a||a<=P)){for(;o<t;u+="0",o++);u=m(u,a)}else if(t-=s,u=v(u,a,"0"),a+1>o){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=a-o)>0)for(a+1==o&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function z(e,t){for(var r,n=1,i=new F(e[0]);n<e.length;n++){if(!(r=new F(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function G(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+r*o-1)>D?e.c=e.e=null:r<L?e.c=[e.e=0]:(e.e=r,e.c=t),e}function H(e,t,i,a){var u,l,f,h,p,d,y,g=e.c,m=c;if(g){e:{for(u=1,h=g[0];h>=10;h/=10,u++);if((l=t-u)<0)l+=o,f=t,y=(p=g[d=0])/m[u-f-1]%10|0;else if((d=r((l+1)/o))>=g.length){if(!a)break e;for(;g.length<=d;g.push(0));p=y=0,u=1,f=(l%=o)-o+1}else{for(p=h=g[d],u=1;h>=10;h/=10,u++);y=(f=(l%=o)-o+u)<0?0:p/m[u-f-1]%10|0}if(a=a||t<0||null!=g[d+1]||(f<0?p:p%m[u-f-1]),a=i<4?(y||a)&&(0==i||i==(e.s<0?3:2)):y>5||5==y&&(4==i||a||6==i&&(l>0?f>0?p/m[u-f]:0:g[d-1])%10&1||i==(e.s<0?8:7)),t<1||!g[0])return g.length=0,a?(t-=e.e+1,g[0]=m[(o-t%o)%o],e.e=-t||0):g[0]=e.e=0,e;if(0==l?(g.length=d,h=1,d--):(g.length=d+1,h=m[o-l],g[d]=f>0?n(p/m[u-f]%m[f])*h:0),a)for(;;){if(0==d){for(l=1,f=g[0];f>=10;f/=10,l++);for(f=g[0]+=h,h=1;f>=10;f/=10,h++);l!=h&&(e.e++,g[0]==s&&(g[0]=1));break}if(g[d]+=h,g[d]!=s)break;g[d--]=0,h=1}for(l=g.length;0===g[--l];g.pop());}e.e>D?e.c=e.e=null:e.e<L&&(e.c=[e.e=0])}return e}function Y(e){var t,r=e.e;return null===r?e.toString():(t=p(e.c),t=r<=P||r>=O?m(t,r):v(t,r,"0"),e.s<0?"-"+t:t)}return F.clone=e,F.ROUND_UP=0,F.ROUND_DOWN=1,F.ROUND_CEIL=2,F.ROUND_FLOOR=3,F.ROUND_HALF_UP=4,F.ROUND_HALF_DOWN=5,F.ROUND_HALF_EVEN=6,F.ROUND_HALF_CEIL=7,F.ROUND_HALF_FLOOR=8,F.EUCLID=9,F.config=F.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(i+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(y(r=e[t],0,f,t),k=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(y(r=e[t],0,8,t),U=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(y(r[0],-f,0,t),y(r[1],0,f,t),P=r[0],O=r[1]):(y(r,-f,f,t),P=-(O=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)y(r[0],-f,-1,t),y(r[1],1,f,t),L=r[0],D=r[1];else{if(y(r,-f,f,t),!r)throw Error(i+t+" cannot be zero: "+r);L=-(D=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(i+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw M=!r,Error(i+"crypto unavailable");M=r}else M=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(y(r=e[t],0,9,t),x=r),e.hasOwnProperty(t="POW_PRECISION")&&(y(r=e[t],0,f,t),V=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(i+t+" not an object: "+r);K=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(i+t+" invalid: "+r);j=r}}return{DECIMAL_PLACES:k,ROUNDING_MODE:U,EXPONENTIAL_AT:[P,O],RANGE:[L,D],CRYPTO:M,MODULO_MODE:x,POW_PRECISION:V,FORMAT:K,ALPHABET:j}},F.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!F.DEBUG)return!0;var t,r,a=e.c,u=e.e,c=e.s;e:if("[object Array]"=={}.toString.call(a)){if((1===c||-1===c)&&u>=-f&&u<=f&&u===n(u)){if(0===a[0]){if(0===u&&1===a.length)return!0;break e}if((t=(u+1)%o)<1&&(t+=o),String(a[0]).length==t){for(t=0;t<a.length;t++)if((r=a[t])<0||r>=s||r!==n(r))break e;if(0!==r)return!0}}}else if(null===a&&null===u&&(null===c||1===c||-1===c))return!0;throw Error(i+"Invalid BigNumber: "+e)},F.maximum=F.max=function(){return z(arguments,N.lt)},F.minimum=F.min=function(){return z(arguments,N.gt)},F.random=(T=9007199254740992*Math.random()&2097151?function(){return n(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,a,s,u,l,h=0,p=[],d=new F(R);if(null==e?e=k:y(e,0,f),u=r(e/o),M)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(u*=2));h<u;)(l=131072*t[h]+(t[h+1]>>>11))>=9e15?(a=crypto.getRandomValues(new Uint32Array(2)),t[h]=a[0],t[h+1]=a[1]):(p.push(l%1e14),h+=2);h=u/2}else{if(!crypto.randomBytes)throw M=!1,Error(i+"crypto unavailable");for(t=crypto.randomBytes(u*=7);h<u;)(l=281474976710656*(31&t[h])+1099511627776*t[h+1]+4294967296*t[h+2]+16777216*t[h+3]+(t[h+4]<<16)+(t[h+5]<<8)+t[h+6])>=9e15?crypto.randomBytes(7).copy(t,h):(p.push(l%1e14),h+=7);h=u/7}if(!M)for(;h<u;)(l=T())<9e15&&(p[h++]=l%1e14);for(u=p[--h],e%=o,u&&e&&(l=c[o-e],p[h]=n(u/l)*l);0===p[h];p.pop(),h--);if(h<0)p=[s=0];else{for(s=-1;0===p[0];p.splice(0,1),s-=o);for(h=1,l=p[0];l>=10;l/=10,h++);h<o&&(s-=o-h)}return d.e=s,d.c=p,d}),F.sum=function(){for(var e=1,t=arguments,r=new F(t[0]);e<t.length;)r=r.plus(t[e++]);return r},C=function(){function e(e,t,r,n){for(var i,a,s=[0],o=0,u=e.length;o<u;){for(a=s.length;a--;s[a]*=t);for(s[0]+=n.indexOf(e.charAt(o++)),i=0;i<s.length;i++)s[i]>r-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(t,r,n,i,a){var s,o,u,c,l,f,h,d,y=t.indexOf("."),g=k,m=U;for(y>=0&&(c=V,V=0,t=t.replace(".",""),f=(d=new F(r)).pow(t.length-y),V=c,d.c=e(v(p(f.c),f.e,"0"),10,n,"0123456789"),d.e=d.c.length),u=c=(h=e(t,r,n,a?(s=j,"0123456789"):(s="0123456789",j))).length;0==h[--c];h.pop());if(!h[0])return s.charAt(0);if(y<0?--u:(f.c=h,f.e=u,f.s=i,h=(f=E(f,d,g,m,n)).c,l=f.r,u=f.e),y=h[o=u+g+1],c=n/2,l=l||o<0||null!=h[o+1],l=m<4?(null!=y||l)&&(0==m||m==(f.s<0?3:2)):y>c||y==c&&(4==m||l||6==m&&1&h[o-1]||m==(f.s<0?8:7)),o<1||!h[0])t=l?v(s.charAt(1),-g,s.charAt(0)):s.charAt(0);else{if(h.length=o,l)for(--n;++h[--o]>n;)h[o]=0,o||(++u,h=[1].concat(h));for(c=h.length;!h[--c];);for(y=0,t="";y<=c;t+=s.charAt(h[y++]));t=v(t,u,s.charAt(0))}return t}}(),E=function(){function e(e,t,r){var n,i,a,s,o=0,u=e.length,c=t%l,f=t/l|0;for(e=e.slice();u--;)o=((i=c*(a=e[u]%l)+(n=f*a+(s=e[u]/l|0)*c)%l*l+o)/r|0)+(n/l|0)+f*s,e[u]=i%r;return o&&(e=[o].concat(e)),e}function t(e,t,r,n){var i,a;if(r!=n)a=r>n?1:-1;else for(i=a=0;i<r;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(i,a,u,c,l){var f,p,d,y,g,m,v,b,E,C,S,T,A,I,w,B,_,N=i.s==a.s?1:-1,R=i.c,k=a.c;if(!(R&&R[0]&&k&&k[0]))return new F(i.s&&a.s&&(R?!k||R[0]!=k[0]:k)?R&&0==R[0]||!k?0*N:N/0:NaN);for(E=(b=new F(N)).c=[],N=u+(p=i.e-a.e)+1,l||(l=s,p=h(i.e/o)-h(a.e/o),N=N/o|0),d=0;k[d]==(R[d]||0);d++);if(k[d]>(R[d]||0)&&p--,N<0)E.push(1),y=!0;else{for(I=R.length,B=k.length,d=0,N+=2,(g=n(l/(k[0]+1)))>1&&(k=e(k,g,l),R=e(R,g,l),B=k.length,I=R.length),A=B,S=(C=R.slice(0,B)).length;S<B;C[S++]=0);_=k.slice(),_=[0].concat(_),w=k[0],k[1]>=l/2&&w++;do{if(g=0,(f=t(k,C,B,S))<0){if(T=C[0],B!=S&&(T=T*l+(C[1]||0)),(g=n(T/w))>1)for(g>=l&&(g=l-1),v=(m=e(k,g,l)).length,S=C.length;1==t(m,C,v,S);)g--,r(m,B<v?_:k,v,l),v=m.length,f=1;else 0==g&&(f=g=1),v=(m=k.slice()).length;if(v<S&&(m=[0].concat(m)),r(C,m,S,l),S=C.length,-1==f)for(;t(k,C,B,S)<1;)g++,r(C,B<S?_:k,S,l),S=C.length}else 0===f&&(g++,C=[0]);E[d++]=g,C[0]?C[S++]=R[A]||0:(C=[R[A]],S=1)}while((A++<I||null!=C[0])&&N--);y=null!=C[0],E[0]||E.splice(0,1)}if(l==s){for(d=1,N=E[0];N>=10;N/=10,d++);H(b,u+(b.e=d+p*o-1)+1,c,y)}else b.e=p,b.r=+y;return b}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,I=/^([^.]+)\.$/,w=/^\.([^.]+)$/,B=/^-?(Infinity|NaN)$/,_=/^\s*\+(?=[\w.])|^\s+|\s+$/g,S=function(e,t,r,n){var a,s=r?t:t.replace(_,"");if(B.test(s))e.s=isNaN(s)?null:s<0?-1:1;else{if(!r&&(s=s.replace(A,(function(e,t,r){return a="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=a?e:t})),n&&(a=n,s=s.replace(I,"$1").replace(w,"0.$1")),t!=s))return new F(s,a);if(F.DEBUG)throw Error(i+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},N.absoluteValue=N.abs=function(){var e=new F(this);return e.s<0&&(e.s=1),e},N.comparedTo=function(e,t){return d(this,new F(e,t))},N.decimalPlaces=N.dp=function(e,t){var r,n,i,a=this;if(null!=e)return y(e,0,f),null==t?t=U:y(t,0,8),H(new F(a),e+a.e+1,t);if(!(r=a.c))return null;if(n=((i=r.length-1)-h(this.e/o))*o,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},N.dividedBy=N.div=function(e,t){return E(this,new F(e,t),k,U)},N.dividedToIntegerBy=N.idiv=function(e,t){return E(this,new F(e,t),0,1)},N.exponentiatedBy=N.pow=function(e,t){var a,s,u,c,l,f,h,p,d=this;if((e=new F(e)).c&&!e.isInteger())throw Error(i+"Exponent not an integer: "+Y(e));if(null!=t&&(t=new F(t)),l=e.e>14,!d.c||!d.c[0]||1==d.c[0]&&!d.e&&1==d.c.length||!e.c||!e.c[0])return p=new F(Math.pow(+Y(d),l?2-g(e):+Y(e))),t?p.mod(t):p;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new F(NaN);(s=!f&&d.isInteger()&&t.isInteger())&&(d=d.mod(t))}else{if(e.e>9&&(d.e>0||d.e<-1||(0==d.e?d.c[0]>1||l&&d.c[1]>=24e7:d.c[0]<8e13||l&&d.c[0]<=9999975e7)))return c=d.s<0&&g(e)?-0:0,d.e>-1&&(c=1/c),new F(f?1/c:c);V&&(c=r(V/o+2))}for(l?(a=new F(.5),f&&(e.s=1),h=g(e)):h=(u=Math.abs(+Y(e)))%2,p=new F(R);;){if(h){if(!(p=p.times(d)).c)break;c?p.c.length>c&&(p.c.length=c):s&&(p=p.mod(t))}if(u){if(0===(u=n(u/2)))break;h=u%2}else if(H(e=e.times(a),e.e+1,1),e.e>14)h=g(e);else{if(0==(u=+Y(e)))break;h=u%2}d=d.times(d),c?d.c&&d.c.length>c&&(d.c.length=c):s&&(d=d.mod(t))}return s?p:(f&&(p=R.div(p)),t?p.mod(t):c?H(p,V,U,void 0):p)},N.integerValue=function(e){var t=new F(this);return null==e?e=U:y(e,0,8),H(t,t.e+1,e)},N.isEqualTo=N.eq=function(e,t){return 0===d(this,new F(e,t))},N.isFinite=function(){return!!this.c},N.isGreaterThan=N.gt=function(e,t){return d(this,new F(e,t))>0},N.isGreaterThanOrEqualTo=N.gte=function(e,t){return 1===(t=d(this,new F(e,t)))||0===t},N.isInteger=function(){return!!this.c&&h(this.e/o)>this.c.length-2},N.isLessThan=N.lt=function(e,t){return d(this,new F(e,t))<0},N.isLessThanOrEqualTo=N.lte=function(e,t){return-1===(t=d(this,new F(e,t)))||0===t},N.isNaN=function(){return!this.s},N.isNegative=function(){return this.s<0},N.isPositive=function(){return this.s>0},N.isZero=function(){return!!this.c&&0==this.c[0]},N.minus=function(e,t){var r,n,i,a,u=this,c=u.s;if(t=(e=new F(e,t)).s,!c||!t)return new F(NaN);if(c!=t)return e.s=-t,u.plus(e);var l=u.e/o,f=e.e/o,p=u.c,d=e.c;if(!l||!f){if(!p||!d)return p?(e.s=-t,e):new F(d?u:NaN);if(!p[0]||!d[0])return d[0]?(e.s=-t,e):new F(p[0]?u:3==U?-0:0)}if(l=h(l),f=h(f),p=p.slice(),c=l-f){for((a=c<0)?(c=-c,i=p):(f=l,i=d),i.reverse(),t=c;t--;i.push(0));i.reverse()}else for(n=(a=(c=p.length)<(t=d.length))?c:t,c=t=0;t<n;t++)if(p[t]!=d[t]){a=p[t]<d[t];break}if(a&&(i=p,p=d,d=i,e.s=-e.s),(t=(n=d.length)-(r=p.length))>0)for(;t--;p[r++]=0);for(t=s-1;n>c;){if(p[--n]<d[n]){for(r=n;r&&!p[--r];p[r]=t);--p[r],p[n]+=s}p[n]-=d[n]}for(;0==p[0];p.splice(0,1),--f);return p[0]?G(e,p,f):(e.s=3==U?-1:1,e.c=[e.e=0],e)},N.modulo=N.mod=function(e,t){var r,n,i=this;return e=new F(e,t),!i.c||!e.s||e.c&&!e.c[0]?new F(NaN):!e.c||i.c&&!i.c[0]?new F(i):(9==x?(n=e.s,e.s=1,r=E(i,e,0,3),e.s=n,r.s*=n):r=E(i,e,0,x),(e=i.minus(r.times(e))).c[0]||1!=x||(e.s=i.s),e)},N.multipliedBy=N.times=function(e,t){var r,n,i,a,u,c,f,p,d,y,g,m,v,b,E,C=this,S=C.c,T=(e=new F(e,t)).c;if(!(S&&T&&S[0]&&T[0]))return!C.s||!e.s||S&&!S[0]&&!T||T&&!T[0]&&!S?e.c=e.e=e.s=null:(e.s*=C.s,S&&T?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=h(C.e/o)+h(e.e/o),e.s*=C.s,(f=S.length)<(y=T.length)&&(v=S,S=T,T=v,i=f,f=y,y=i),i=f+y,v=[];i--;v.push(0));for(b=s,E=l,i=y;--i>=0;){for(r=0,g=T[i]%E,m=T[i]/E|0,a=i+(u=f);a>i;)r=((p=g*(p=S[--u]%E)+(c=m*p+(d=S[u]/E|0)*g)%E*E+v[a]+r)/b|0)+(c/E|0)+m*d,v[a--]=p%b;v[a]=r}return r?++n:v.splice(0,1),G(e,v,n)},N.negated=function(){var e=new F(this);return e.s=-e.s||null,e},N.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new F(e,t)).s,!i||!t)return new F(NaN);if(i!=t)return e.s=-t,n.minus(e);var a=n.e/o,u=e.e/o,c=n.c,l=e.c;if(!a||!u){if(!c||!l)return new F(i/0);if(!c[0]||!l[0])return l[0]?e:new F(c[0]?n:0*i)}if(a=h(a),u=h(u),c=c.slice(),i=a-u){for(i>0?(u=a,r=l):(i=-i,r=c),r.reverse();i--;r.push(0));r.reverse()}for((i=c.length)-(t=l.length)<0&&(r=l,l=c,c=r,t=i),i=0;t;)i=(c[--t]=c[t]+l[t]+i)/s|0,c[t]=s===c[t]?0:c[t]%s;return i&&(c=[i].concat(c),++u),G(e,c,u)},N.precision=N.sd=function(e,t){var r,n,i,a=this;if(null!=e&&e!==!!e)return y(e,1,f),null==t?t=U:y(t,0,8),H(new F(a),e,t);if(!(r=a.c))return null;if(n=(i=r.length-1)*o+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&a.e+1>n&&(n=a.e+1),n},N.shiftedBy=function(e){return y(e,-u,u),this.times("1e"+e)},N.squareRoot=N.sqrt=function(){var e,t,r,n,i,a=this,s=a.c,o=a.s,u=a.e,c=k+4,l=new F("0.5");if(1!==o||!s||!s[0])return new F(!o||o<0&&(!s||s[0])?NaN:s?a:1/0);if(0==(o=Math.sqrt(+Y(a)))||o==1/0?(((t=p(s)).length+u)%2==0&&(t+="0"),o=Math.sqrt(+t),u=h((u+1)/2)-(u<0||u%2),r=new F(t=o==1/0?"5e"+u:(t=o.toExponential()).slice(0,t.indexOf("e")+1)+u)):r=new F(o+""),r.c[0])for((o=(u=r.e)+c)<3&&(o=0);;)if(i=r,r=l.times(i.plus(E(a,i,c,1))),p(i.c).slice(0,o)===(t=p(r.c)).slice(0,o)){if(r.e<u&&--o,"9999"!=(t=t.slice(o-3,o+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(H(r,r.e+k+2,1),e=!r.times(r).eq(a));break}if(!n&&(H(i,i.e+k+2,0),i.times(i).eq(a))){r=i;break}c+=4,o+=4,n=1}return H(r,r.e+k+1,U,e)},N.toExponential=function(e,t){return null!=e&&(y(e,0,f),e++),q(this,e,t,1)},N.toFixed=function(e,t){return null!=e&&(y(e,0,f),e=e+this.e+1),q(this,e,t)},N.toFormat=function(e,t,r){var n,a=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=K;else if("object"!=typeof r)throw Error(i+"Argument not an object: "+r);if(n=a.toFixed(e,t),a.c){var s,o=n.split("."),u=+r.groupSize,c=+r.secondaryGroupSize,l=r.groupSeparator||"",f=o[0],h=o[1],p=a.s<0,d=p?f.slice(1):f,y=d.length;if(c&&(s=u,u=c,c=s,y-=s),u>0&&y>0){for(s=y%u||u,f=d.substr(0,s);s<y;s+=u)f+=l+d.substr(s,u);c>0&&(f+=l+d.slice(s)),p&&(f="-"+f)}n=h?f+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?h.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):h):f}return(r.prefix||"")+n+(r.suffix||"")},N.toFraction=function(e){var t,r,n,a,s,u,l,f,h,d,y,g,m=this,v=m.c;if(null!=e&&(!(l=new F(e)).isInteger()&&(l.c||1!==l.s)||l.lt(R)))throw Error(i+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+Y(l));if(!v)return new F(m);for(t=new F(R),h=r=new F(R),n=f=new F(R),g=p(v),s=t.e=g.length-m.e-1,t.c[0]=c[(u=s%o)<0?o+u:u],e=!e||l.comparedTo(t)>0?s>0?t:h:l,u=D,D=1/0,l=new F(g),f.c[0]=0;d=E(l,t,0,1),1!=(a=r.plus(d.times(n))).comparedTo(e);)r=n,n=a,h=f.plus(d.times(a=h)),f=a,t=l.minus(d.times(a=t)),l=a;return a=E(e.minus(r),n,0,1),f=f.plus(a.times(h)),r=r.plus(a.times(n)),f.s=h.s=m.s,y=E(h,n,s*=2,U).minus(m).abs().comparedTo(E(f,r,s,U).minus(m).abs())<1?[h,n]:[f,r],D=u,y},N.toNumber=function(){return+Y(this)},N.toPrecision=function(e,t){return null!=e&&y(e,1,f),q(this,e,t,2)},N.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=i<=P||i>=O?m(p(r.c),i):v(p(r.c),i,"0"):10===e?t=v(p((r=H(new F(r),k+i+1,U)).c),r.e,"0"):(y(e,2,j.length,"Base"),t=C(v(p(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},N.valueOf=N.toJSON=function(){return Y(this)},N._isBigNumber=!0,N[Symbol.toStringTag]="BigNumber",N[Symbol.for("nodejs.util.inspect.custom")]=N.valueOf,null!=b&&F.set(b),F}(),E=function(){return(E=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},C=function(){function e(){this.format=e.DEFAULT_FORMAT,b.config({FORMAT:this.format})}return e.prototype.set=function(e){"FORMAT"in e&&(this.format=E({},this.format,e.FORMAT),e.FORMAT=this.format),b.config(e)},e.DEFAULT_FORMAT={prefix:"",decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0,suffix:""},e}();e.BigNumber=function(){function e(t){"object"==typeof t&&e.isBigNumber(t)?this.bn=t.bn.plus(0):this.bn=e.toBigNumberJs(t)}return e.prototype.clone=function(){return new e(this)},e.prototype.add=function(t){return new e(this.bn.plus(e.toBigNumberJs(t)))},e.prototype.sub=function(t){return new e(this.bn.minus(e.toBigNumberJs(t)))},e.prototype.mul=function(t){return new e(this.bn.times(e.toBigNumberJs(t)))},e.prototype.div=function(t){return new e(this.bn.div(e.toBigNumberJs(t)))},e.prototype.pow=function(t){return new e(this.bn.pow(e.toBigNumberJs(t)))},e.prototype.sqrt=function(){return new e(this.bn.sqrt())},e.prototype.abs=function(){return new e(this.bn.abs())},e.prototype.mod=function(t){return new e(this.bn.mod(e.toBigNumberJs(t)))},e.prototype.roundTo=function(t,r){return void 0===t&&(t=0),void 0===r&&(r=4),new e(this.bn.dp(t||0,r))},e.prototype.eq=function(t){return this.bn.eq(e.toBigNumberJs(t))},e.prototype.lt=function(t){return this.bn.lt(e.toBigNumberJs(t))},e.prototype.gt=function(t){return this.bn.gt(e.toBigNumberJs(t))},e.prototype.lte=function(t){return this.bn.lte(e.toBigNumberJs(t))},e.prototype.gte=function(t){return this.bn.gte(e.toBigNumberJs(t))},e.prototype.isNaN=function(){return this.bn.isNaN()},e.prototype.isFinite=function(){return this.bn.isFinite()},e.prototype.isZero=function(){return this.eq(0)},e.prototype.isPositive=function(){return this.gt(0)},e.prototype.isNegative=function(){return this.lt(0)},e.prototype.isInt=function(){return this.bn.isInteger()},e.prototype.getDecimalsCount=function(){return this.bn.dp()},e.prototype.isEven=function(){return this.mod(2).eq(0)},e.prototype.isOdd=function(){return!this.isEven()},e.prototype.isInSignedRange=function(){return this.gte(e.MIN_VALUE)&&this.lte(e.MAX_VALUE)},e.prototype.isInUnsignedRange=function(){return this.gte(e.MIN_UNSIGNED_VALUE)&&this.lte(e.MAX_UNSIGNED_VALUE)},e.prototype.toFormat=function(e,t,r){return this.bn.toFormat(e,t,r)},e.prototype.toFixed=function(e,t){return null==e?this.bn.toFixed():this.bn.toFixed(e,t)},e.prototype.toString=function(){return this.toFixed()},e.prototype.toNumber=function(){return this.bn.toNumber()},e.prototype.toJSON=function(){return this.bn.toFixed()},e.prototype.valueOf=function(){return this.bn.valueOf()},e.prototype.toBytes=function(t){var r=void 0===t?{}:t,n=r.isSigned,i=void 0===n||n,a=r.isLong,s=void 0===a||a;if(!this.isInt())throw new Error("Cant create bytes from number with decimals!");if(!i&&this.isNegative())throw new Error("Cant create bytes from negative number in signed mode!");if(s&&i&&!this.isInSignedRange())throw new Error("Number is not from signed numbers range");if(s&&!i&&!this.isInUnsignedRange())throw new Error("Number is not from unsigned numbers range");var o=i&&this.isNegative(),u=o?"1":"0",c=this.bn.plus(u).toString(2).replace("-",""),l=s?64:8*Math.ceil(c.length/8),f=e._toLength(l,c).split(""),h=[];do{h.push(parseInt(f.splice(0,8).join(""),2))}while(f.length);return o?Uint8Array.from(h.map((function(e){return 255-e}))):Uint8Array.from(h)},e.fromBytes=function(t,r){var n=void 0===r?{}:r,i=n.isSigned,a=void 0===i||i,s=n.isLong,o=void 0===s||s;if(o&&8!==t.length)throw new Error("Wrong bytes length! Minimal length is 8 byte!");t=!o&&t.length>0||o?t:[0];var u=!!a&&t[0]>127,c=Array.from(t).map((function(e){return u?255-e:e})).map((function(t){return e._toLength(8,t.toString(2))})).join(""),l=new e(new b(c,2));return u?l.mul(-1).sub(1):l},e.max=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.toBigNumber(t).reduce((function(e,t){return e.gte(t)?e:t}))},e.min=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.toBigNumber(t).reduce((function(e,t){return e.lte(t)?e:t}))},e.sum=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.toBigNumber(t).reduce((function(e,t){return e.add(t)}))},e.isBigNumber=function(t){return t&&"object"==typeof t&&(t instanceof e||Object.entries(e.prototype).filter((function(e){return"_"!==e[0].charAt(0)})).every((function(e){var r=e[0],n=e[1];return r in t&&typeof n==typeof t[r]})))},e.toBigNumber=function(t){return Array.isArray(t)?t.map((function(t){return new e(t)})):new e(t)},e.toBigNumberJs=function(t){return b.isBigNumber(t)?t:t instanceof e?t.bn:new b(t)},e._toLength=function(e,t){return new Array(e).fill("0",0,e).concat(t.split("")).slice(-e).join("")},e.MIN_VALUE=new e("-9223372036854775808"),e.MAX_VALUE=new e("9223372036854775807"),e.MIN_UNSIGNED_VALUE=new e("0"),e.MAX_UNSIGNED_VALUE=new e("18446744073709551615"),e.config=new C,e}(),function(e){!function(e){e[e.ROUND_UP=0]="ROUND_UP",e[e.ROUND_DOWN=1]="ROUND_DOWN",e[e.ROUND_CEIL=2]="ROUND_CEIL",e[e.ROUND_FLOOR=3]="ROUND_FLOOR",e[e.ROUND_HALF_UP=4]="ROUND_HALF_UP",e[e.ROUND_HALF_DOWN=5]="ROUND_HALF_DOWN",e[e.ROUND_HALF_EVEN=6]="ROUND_HALF_EVEN",e[e.ROUND_HALF_CEIL=7]="ROUND_HALF_CEIL",e[e.ROUND_HALF_FLOOR=8]="ROUND_HALF_FLOOR"}(e.ROUND_MODE||(e.ROUND_MODE={}))}(e.BigNumber||(e.BigNumber={}));var S=e.BigNumber;e.default=S,Object.defineProperty(e,"__esModule",{value:!0})}(t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GENESIS_TYPE=1,t.PAYMENT_TYPE=2,t.ISSUE_TYPE=3,t.TRANSFER_TYPE=4,t.REISSUE_TYPE=5,t.BURN_TYPE=6,t.EXCHANGE_TYPE=7,t.LEASE_TYPE=8,t.CANCEL_LEASE_TYPE=9,t.ALIAS_TYPE=10,t.MASS_TRANSFER_TYPE=11,t.DATA_TYPE=12,t.SET_SCRIPT_TYPE=13,t.SPONSORSHIP_TYPE=14,t.SET_ASSET_SCRIPT_TYPE=15,t.INVOKE_SCRIPT_TYPE=16,t.UPDATE_ASSET_INFO_TYPE=17,t.ETHEREUM=18,t.INTEGER_DATA_TYPE="integer",t.BOOLEAN_DATA_TYPE="boolean",t.STRING_DATA_TYPE="string",t.BINARY_DATA_TYPE="binary",t.TRANSACTION_TYPE={GENESIS:t.GENESIS_TYPE,PAYMENT:t.PAYMENT_TYPE,ISSUE:t.ISSUE_TYPE,TRANSFER:t.TRANSFER_TYPE,REISSUE:t.REISSUE_TYPE,BURN:t.BURN_TYPE,EXCHANGE:t.EXCHANGE_TYPE,LEASE:t.LEASE_TYPE,CANCEL_LEASE:t.CANCEL_LEASE_TYPE,ALIAS:t.ALIAS_TYPE,MASS_TRANSFER:t.MASS_TRANSFER_TYPE,DATA:t.DATA_TYPE,SET_SCRIPT:t.SET_SCRIPT_TYPE,SPONSORSHIP:t.SPONSORSHIP_TYPE,SET_ASSET_SCRIPT:t.SET_ASSET_SCRIPT_TYPE,INVOKE_SCRIPT:t.INVOKE_SCRIPT_TYPE,UPDATE_ASSET_INFO:t.UPDATE_ASSET_INFO_TYPE,ETHEREUM:t.ETHEREUM},t.DATA_FIELD_TYPE={INTEGER:t.INTEGER_DATA_TYPE,BOOLEAN:t.BOOLEAN_DATA_TYPE,STRING:t.STRING_DATA_TYPE,BINARY:t.BINARY_DATA_TYPE}},function(e,t,r){"use strict";t.__esModule=!0;var n=r(3),i=r(16),a=r(31);t.default=function(e,t,r){var s=!Array.isArray(t),o=Date.now(),u=[],c=r&&r.confirmations||0,l=r&&r.maxWaitTime||0,f=r&&r.requestInterval||250,h=function(t){return i.fetchStatus(e,t.map(n.prop("id"))).then((function(e){var r=n.indexBy(n.prop("id"),e.statuses);if(t.some((function(e){return r[e.id].status===a.TRANSACTION_STATUSES.NOT_FOUND})))throw new Error("One transaction is not in blockchain!");var i=t.filter((function(e){return!(r[e.id].confirmations>=c)||(u.push(e),!1)}));if(i.length)return l&&Date.now()-o>l?Promise.reject("Timeout error!"):n.wait(f).then((function(){return h(i)}))}))};return h(n.toArray(t)).then((function(){return s?n.head(u):u}))}},function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var i=r(32),a=n(r(55)),s=r(3);t.default=function(e,t){return i.fetchDetails(e,a.default(t)).then((function(e){return s.indexBy(s.prop("assetId"),e)}))}},function(e,t,r){"use strict";var n,i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return s},a=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(i(arguments[t]));return e};t.__esModule=!0;var s=r(3),o=r(31),u=s.switchTransactionByType(((n={})[o.NAME_MAP.transfer]=function(e){return[e.assetId,e.feeAssetId]},n[o.NAME_MAP.burn]=function(e){return[e.assetId]},n[o.NAME_MAP.reissue]=function(e){return[e.assetId]},n[o.NAME_MAP.exchange]=function(e){return Array.from(new Set([e.order1.assetPair.amountAsset,e.order1.assetPair.priceAsset,3===e.order1.version?e.order1.matcherFeeAssetId:null,3===e.order2.version?e.order2.matcherFeeAssetId:null]))},n[o.NAME_MAP.massTransfer]=function(e){return[e.assetId]},n[o.NAME_MAP.setAssetScript]=function(e){return[e.assetId]},n[o.NAME_MAP.sponsorship]=function(e){return[e.assetId]},n[o.NAME_MAP.invoke]=function(e){return a((e.payment||[]).map(s.prop("assetId")),[e.feeAssetId])},n[o.NAME_MAP.updateAsset]=function(e){return[e.assetId]},n));t.default=function(e){return s.toArray(e).reduce((function(e,t){return e.concat(u(t)||[])}),[]).filter((function(e){return null!=e}))}},function(e,t,r){"use strict";t.__esModule=!0;var n=r(30);t.default=function(e){return n.fetchHeadersLast(e).then((function(e){return function(e){var t,r,n,i,s;if(0===e.length)return new Uint8Array(0);s=void 0,i=void 0,t=[0],s=0;for(;s<e.length;){if(!((r=e[s])in a))throw"Base58.decode received unacceptable input. Character '"+r+"' is not in the Base58 alphabet.";for(i=0;i<t.length;)t[i]*=58,i++;for(t[0]+=a[r],n=0,i=0;i<t.length;)t[i]+=n,n=t[i]>>8,t[i]&=255,++i;for(;n;)t.push(255&n),n>>=8;s++}s=0;for(;"1"===e[s]&&s<e.length-1;)t.push(0),s++;return new Uint8Array(t.reverse())}(e.generator)[1]}))};for(var i="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",a={},s=0;s<i.length;s++)a[i.charAt(s)]=s},function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0,t.create=t.ethTxId2waves=t.wavesAsset2Eth=t.ethAddress2waves=t.wavesAddress2eth=void 0;var i=n(r(58));t.wavesAddress2eth=i.default;var a=n(r(85));t.ethAddress2waves=a.default;var s=n(r(86));t.wavesAsset2Eth=s.default;var o=n(r(87));t.ethTxId2waves=o.default;var u=r(88);t.create=u.create,t.default=u.create},function(e,t,r){"use strict";t.__esModule=!0;var n=r(17);t.default=function(e){var t=n.base58Decode(e),r=t.slice(2,t.byteLength-4);return"0x"+n.base16Encode(r)}},function(e,t,r){"use strict";t.byteLength=function(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,n=c(e),s=n[0],o=n[1],u=new a(function(e,t,r){return 3*(t+r)/4-r}(0,s,o)),l=0,f=o>0?s-4:s;for(r=0;r<f;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===o&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===o&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,a=[],s=0,o=r-i;s<o;s+=16383)a.push(l(e,s,s+16383>o?o:s+16383));1===i?(t=e[r-1],a.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],a.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return a.join("")};for(var n=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,u=s.length;o<u;++o)n[o]=s[o],i[s.charCodeAt(o)]=o;function c(e){var t=e.length;if(t%4>0)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 l(e,t,r){for(var i,a,s=[],o=t;o<r;o+=3)i=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),s.push(n[(a=i)>>18&63]+n[a>>12&63]+n[a>>6&63]+n[63&a]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){
9
9
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
10
10
  t.read=function(e,t,r,n,i){var a,s,o=8*i-n-1,u=(1<<o)-1,c=u>>1,l=-7,f=r?i-1:0,h=r?-1:1,p=e[t+f];for(f+=h,a=p&(1<<-l)-1,p>>=-l,l+=o;l>0;a=256*a+e[t+f],f+=h,l-=8);for(s=a&(1<<-l)-1,a>>=-l,l+=n;l>0;s=256*s+e[t+f],f+=h,l-=8);if(0===a)a=1-c;else{if(a===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),a-=c}return(p?-1:1)*s*Math.pow(2,a-n)},t.write=function(e,t,r,n,i,a){var s,o,u,c=8*a-i-1,l=(1<<c)-1,f=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:a-1,d=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=l?(o=0,s=l):s+f>=1?(o=(t*u-1)*Math.pow(2,i),s+=f):(o=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[r+p]=255&o,p+=d,o/=256,i-=8);for(s=s<<i|o,c+=i;c>0;e[r+p]=255&s,p+=d,s/=256,c-=8);e[r+p-d]|=128*y}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){(function(e){var n=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function a(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new a(i.call(setTimeout,n,arguments),clearTimeout)},t.setInterval=function(){return new a(i.call(setInterval,n,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(n,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},r(63),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,r(12))},function(e,t,r){(function(e,t){!function(e,r){"use strict";if(!e.setImmediate){var n,i,a,s,o,u=1,c={},l=!1,f=e.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(e);h=h&&h.setTimeout?h:e,"[object process]"==={}.toString.call(e.process)?n=function(e){t.nextTick((function(){d(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?e.MessageChannel?((a=new MessageChannel).port1.onmessage=function(e){d(e.data)},n=function(e){a.port2.postMessage(e)}):f&&"onreadystatechange"in f.createElement("script")?(i=f.documentElement,n=function(e){var t=f.createElement("script");t.onreadystatechange=function(){d(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):n=function(e){setTimeout(d,0,e)}:(s="setImmediate$"+Math.random()+"$",o=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(s)&&d(+t.data.slice(s.length))},e.addEventListener?e.addEventListener("message",o,!1):e.attachEvent("onmessage",o),n=function(t){e.postMessage(s+t,"*")}),h.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r<t.length;r++)t[r]=arguments[r+1];var i={callback:e,args:t};return c[u]=i,n(u),u++},h.clearImmediate=p}function p(e){delete c[e]}function d(e){if(l)setTimeout(d,0,e);else{var t=c[e];if(t){l=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(void 0,r)}}(t)}finally{p(e),l=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,r(12),r(19))},function(e,t,r){(function(t){var r={};e.exports=r;var n={};r.encode=function(e,t,r){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!=typeof r)throw new TypeError('"maxline" must be a number.');var n="";if(e instanceof Uint8Array){var i=0,a=t.length,s=t.charAt(0),o=[0];for(i=0;i<e.length;++i){for(var u=0,c=e[i];u<o.length;++u)c+=o[u]<<8,o[u]=c%a,c=c/a|0;for(;c>0;)o.push(c%a),c=c/a|0}for(i=0;0===e[i]&&i<e.length-1;++i)n+=s;for(i=o.length-1;i>=0;--i)n+=t[o[i]]}else n=function(e,t){var r=0,n=t.length,i=t.charAt(0),a=[0];for(r=0;r<e.length();++r){for(var s=0,o=e.at(r);s<a.length;++s)o+=a[s]<<8,a[s]=o%n,o=o/n|0;for(;o>0;)a.push(o%n),o=o/n|0}var u="";for(r=0;0===e.at(r)&&r<e.length()-1;++r)u+=i;for(r=a.length-1;r>=0;--r)u+=t[a[r]];return u}(e,t);if(r){var l=new RegExp(".{1,"+r+"}","g");n=n.match(l).join("\r\n")}return n},r.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var i=n[r];if(!i){i=n[r]=[];for(var a=0;a<r.length;++a)i[r.charCodeAt(a)]=a}e=e.replace(/\s/g,"");var s=r.length,o=r.charAt(0),u=[0];for(a=0;a<e.length;a++){var c=i[e.charCodeAt(a)];if(void 0===c)return;for(var l=0,f=c;l<u.length;++l)f+=u[l]*s,u[l]=255&f,f>>=8;for(;f>0;)u.push(255&f),f>>=8}for(var h=0;e[h]===o&&h<e.length-1;++h)u.push(0);return void 0!==t?t.from(u.reverse()):new Uint8Array(u.reverse())}}).call(this,r(11).Buffer)},function(e,t,r){(function(t){var n=r(0);r(1);var i=null;!n.util.isNodejs||n.options.usePureJavaScript||t.versions["node-webkit"]||(i=r(25)),(e.exports=n.prng=n.prng||{}).create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,a=new Array(32),s=0;s<32;++s)a[s]=r.create();function o(){if(t.pools[0].messageLength>=32)return u();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),u()}function u(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,n=0;n<32;++n)t.reseeds%r==0&&(e.update(t.pools[n].digest().getBytes()),t.pools[n].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var i=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(i),t.generated=0}function c(e){var t=null,r=n.util.globalScope,i=r.crypto||r.msCrypto;i&&i.getRandomValues&&(t=function(e){return i.getRandomValues(e)});var a=n.util.createBuffer();if(t)for(;a.length()<e;){var s=Math.max(1,Math.min(e-a.length(),65536)/4),o=new Uint32Array(Math.floor(s));try{t(o);for(var u=0;u<o.length;++u)a.putInt32(o[u])}catch(e){if(!("undefined"!=typeof QuotaExceededError&&e instanceof QuotaExceededError))throw e}}if(a.length()<e)for(var c,l,f,h=Math.floor(65536*Math.random());a.length()<e;){l=16807*(65535&h),l+=(32767&(c=16807*(h>>16)))<<16,h=4294967295&(l=(2147483647&(l+=c>>15))+(l>>31));for(u=0;u<3;++u)f=h>>>(u<<3),f^=Math.floor(256*Math.random()),a.putByte(String.fromCharCode(255&f))}return a.getBytes(e)}return t.pools=a,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var i=t.plugin.cipher,a=t.plugin.increment,s=t.plugin.formatKey,o=t.plugin.formatSeed,c=n.util.createBuffer();t.key=null,function l(f){if(f)return r(f);if(c.length()>=e)return r(null,c.getBytes(e));t.generated>1048575&&(t.key=null);if(null===t.key)return n.util.nextTick((function(){!function(e){if(t.pools[0].messageLength>=32)return u(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,(function(r,n){if(r)return e(r);t.collect(n),u(),e()}))}(l)}));var h=i(t.key,t.seed);t.generated+=h.length,c.putBytes(h),t.key=s(i(t.key,a(t.seed))),t.seed=o(i(t.key,t.seed)),n.util.setImmediate(l)}()},t.generateSync=function(e){var r=t.plugin.cipher,i=t.plugin.increment,a=t.plugin.formatKey,s=t.plugin.formatSeed;t.key=null;for(var u=n.util.createBuffer();u.length()<e;){t.generated>1048575&&(t.key=null),null===t.key&&o();var c=r(t.key,t.seed);t.generated+=c.length,u.putBytes(c),t.key=a(r(t.key,i(t.seed))),t.seed=s(r(t.key,t.seed))}return u.getBytes(e)},i?(t.seedFile=function(e,t){i.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString())}))},t.seedFileSync=function(e){return i.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,c(e))}catch(e){t(e)}},t.seedFileSync=c),t.collect=function(e){for(var r=e.length,n=0;n<r;++n)t.pools[t.pool].update(e.substr(n,1)),t.pool=31===t.pool?0:t.pool+1},t.collectInt=function(e,r){for(var n="",i=0;i<r;i+=8)n+=String.fromCharCode(e>>i&255);t.collect(n)},t.registerWorker=function(e){if(e===self)t.seedFile=function(e,t){self.addEventListener("message",(function e(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",e),t(n.forge.prng.err,n.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:e}}})};else{e.addEventListener("message",(function(r){var n=r.data;n.forge&&n.forge.prng&&t.seedFile(n.forge.prng.needed,(function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})}))}))}},t}}).call(this,r(19))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",i=n.split("").reduce((function(e,t,r){return e[t]=r,e}),{});t.default={encode:function(e){if(!e.length)return"";for(var t=[0],r=0;r<e.length;r++){for(var i=0;i<t.length;i++)t[i]<<=8;t[0]+=e[r];for(var a=0,s=0;s<t.length;s++)t[s]+=a,a=t[s]/58|0,t[s]%=58;for(;a;)t.push(a%58),a=a/58|0}for(r=0;0===e[r]&&r<e.length-1;r++)t.push(0);return t.reverse().map((function(e){return n[e]})).join("")},decode:function(e){if(!e.length)return new Uint8Array(0);for(var t=[0],r=0;r<e.length;r++){var n=e[r];if(!(n in i))throw'There is no character "'+n+'" in the Base58 sequence!';for(var a=0;a<t.length;a++)t[a]*=58;t[0]+=i[n];var s=0;for(a=0;a<t.length;a++)t[a]+=s,s=t[a]>>8,t[a]&=255;for(;s;)t.push(255&s),s>>=8}for(r=0;"1"===e[r]&&r<e.length-1;r++)t.push(0);return new Uint8Array(t.reverse())}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,i,a;t.utf8ArrayToStr=(n=new Array(128),i=String.fromCodePoint||String.fromCharCode,a=[],function(e){var t,r,s=e.length;a.length=0;for(var o=0;o<s;)(r=e[o++])<=127?t=r:r<=223?t=(31&r)<<6|63&e[o++]:r<=239?t=(15&r)<<12|(63&e[o++])<<6|63&e[o++]:String.fromCodePoint?t=(7&r)<<18|(63&e[o++])<<12|(63&e[o++])<<6|63&e[o++]:(t=63,o+=3),a.push(n[t]||(n[t]=i(t)));return a.join("")}),t.strToUtf8Array=function(e){for(var t=[],r=0;r<e.length;r++){var n=e.charCodeAt(r);n<128?t.push(n):n<2048?t.push(192|n>>6,128|63&n):n<55296||n>=57344?t.push(224|n>>12,128|n>>6&63,128|63&n):(r++,n=65536+((1023&n)<<10|1023&e.charCodeAt(r)),t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n))}return Uint8Array.from(t)}},function(e,t,r){"use strict";
11
11
  /**