diff --git a/dist/cjs/lamden.js b/dist/cjs/lamden.js index dad10ab..36a9b04 100644 --- a/dist/cjs/lamden.js +++ b/dist/cjs/lamden.js @@ -2902,28 +2902,28 @@ function new_wallet(seed = null) { /** * - * @param mnemonic 24 word seed phrase + * @param seed Bip39 seed phrase (128 characters in hex) * @param derivationIndex bip32 derivation key index * @returns {{derivationIndex: number, vk: string, sk: string, mnemonic: string}} * derivationIndex: bip32 derivation key index * vk: Verify Key (VK) represented as a 64 character hex string * sk: Signing Key (SK) represented as a 64 character hex string - * mnemonic: 24 word seed phrase - + * seed: Bip39 seed phrase (128 characters in hex) + * mnemonic: Bip39 24 words mnemonic */ -function generate_keys_bip39(mnemonic = undefined, derivationIndex = 0) { - let finalMnemonic; - - if (mnemonic !== undefined) { - finalMnemonic = mnemonic; - } else { - finalMnemonic = bip39__namespace.generateMnemonic(256); - } - - const seed = bip39__namespace.mnemonicToSeedSync(finalMnemonic).toString("hex"); +function generate_keys_bip39(seed = undefined, derivationIndex = 0) { + let finalSeed; + let finalMnemonic; + + if (seed !== undefined){ + finalSeed = seed; + }else { + finalMnemonic = bip39__namespace.generateMnemonic(256); + finalSeed = bip39__namespace.mnemonicToSeedSync(finalMnemonic).toString('hex'); + } - const derivationPath = "m/44'/789'/" + derivationIndex + "'/0'/0'"; - const { key, chainCode } = bip32__default["default"].derivePath(derivationPath, seed, 0x80000000); + const derivationPath = "m/44'/789'/" + derivationIndex + "'/0'/0'"; + const { key, chainCode } = bip32__default["default"].derivePath(derivationPath, finalSeed, 0x80000000); const privateKey = key.toString("hex"); const publicKey = bip32__default["default"].getPublicKey(key, false).toString("hex"); @@ -2932,26 +2932,28 @@ function generate_keys_bip39(mnemonic = undefined, derivationIndex = 0) { throw Error("Bip32 public key does not match with Lamden public key!"); } - return { - sk: privateKey, - vk: publicKey, - derivationIndex: derivationIndex, - mnemonic: finalMnemonic, - }; + return { + sk: privateKey, + vk: publicKey, + derivationIndex: derivationIndex, + seed: seed !== undefined ? null : finalSeed, + mnemonic: seed !== undefined ? null : finalMnemonic, + } } /** - * @param mnemonic 24 word seed phrase + * @param seed Bip39 seed phrase (128 characters in hex) * @param derivationIndex bip32 derivation key index * * @return {{derivationIndex: number, vk: string, sk: string, mnemonic: (string|undefined)}} { sk, vk, derivationIndex, mnemonic } * sk: Signing Key (SK) represented as a 64 character hex string * vk: Verify Key (VK) represented as a 64 character hex string * derivationIndex: Bip32 derivation index - * mnemonic: 24 word seed phrase + * seed: Bip39 seed phrase (128 characters in hex) + * mnemonic: Bip39 24 words mnemonic */ -function new_wallet_bip39(mnemonic = undefined, derivationIndex = 0) { - return generate_keys_bip39(mnemonic, derivationIndex); +function new_wallet_bip39(seed = undefined, derivationIndex = 0) { + return generate_keys_bip39(seed, derivationIndex); } /** diff --git a/dist/esm/lamden.js b/dist/esm/lamden.js index 266fc16..7569dcd 100644 --- a/dist/esm/lamden.js +++ b/dist/esm/lamden.js @@ -19,4 +19,4 @@ var n=e("buffer"),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a */ function(e){const t=Pe,r=$e,n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=a,e.SlowBuffer=function(e){+e!=e&&(e=0);return a.alloc(+e)},e.INSPECT_MAX_BYTES=50;const i=2147483647;function o(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return h(e)}return s(e,t,r)}function s(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|d(e,t);let n=o(r);const i=n.write(e,t);i!==r&&(n=n.slice(0,i));return n}(e,t);if(ArrayBuffer.isView(e))return function(e){if($(e,Uint8Array)){const t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return l(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if($(e,ArrayBuffer)||e&&$(e.buffer,ArrayBuffer))return f(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&($(e,SharedArrayBuffer)||e&&$(e.buffer,SharedArrayBuffer)))return f(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return a.from(n,t,r);const i=function(e){if(a.isBuffer(e)){const t=0|c(e.length),r=o(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||V(e.length)?o(0):l(e);if("Buffer"===e.type&&Array.isArray(e.data))return l(e.data)}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function h(e){return u(e),o(e<0?0:0|c(e))}function l(e){const t=e.length<0?0:0|c(e.length),r=o(t);for(let n=0;n=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function d(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||$(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":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 Y(e).length;default:if(i)return n?-1:K(e).length;t=(""+t).toLowerCase(),i=!0}}function p(e,t,r){let 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 T(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return A(this,t,r);case"base64":return S(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function y(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),V(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){let o,a=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,r/=2}function h(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){let n=-1;for(o=r;os&&(r=s-u),o=r;o>=0;o--){let r=!0;for(let n=0;ni&&(n=i):n=i;const o=t.length;let a;for(n>o/2&&(n=o/2),a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function S(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function k(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+a<=r){let r,n,s,u;switch(a){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128==(192&r)&&(u=(31&t)<<6|63&r,u>127&&(o=u));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(u=(15&t)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=e[i+1],n=e[i+2],s=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&s)&&(u=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&s,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=a}return function(e){const t=e.length;if(t<=x)return String.fromCharCode.apply(String,e);let r="",n=0;for(;nn.length?(a.isBuffer(t)||(t=a.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!a.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},a.byteLength=d,a.prototype._isBuffer=!0,a.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tr&&(t+=" ... "),""},n&&(a.prototype[n]=a.prototype.inspect),a.prototype.compare=function(e,t,r,n,i){if($(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0);const u=Math.min(o,s),h=this.slice(n,i),l=e.slice(t,r);for(let e=0;e>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const 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");let o=!1;for(;;)switch(n){case"hex":return m(this,e,t,r);case"utf8":case"utf-8":return v(this,e,t,r);case"ascii":case"latin1":case"binary":return w(this,e,t,r);case"base64":return _(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const x=4096;function R(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;in)&&(r=n);let i="";for(let n=t;nr)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,r,n,i,o){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function L(e,t,r,n,i){z(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,r}function j(e,t,r,n,i){z(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=a,a>>=8,e[r+2]=a,a>>=8,e[r+1]=a,a>>=8,e[r]=a,r+8}function U(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function I(e,t,n,i,o){return t=+t,n>>>=0,o||U(e,0,n,4),r.write(e,t,n,i,23,4),n+4}function C(e,t,n,i,o){return t=+t,n>>>=0,o||U(e,0,n,8),r.write(e,t,n,i,52,8),n+8}a.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||O(e,t,this.length);let n=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,r||O(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readBigUInt64LE=J((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<>>=0,t>>>=0,r||O(e,t,this.length);let n=this[e],i=1,o=0;for(;++o=i&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||O(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},a.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readBigInt64LE=J((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<>>=0,t||O(e,4,this.length),r.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),r.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),r.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),r.read(this,e,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){M(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,!n){M(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeBigUInt64LE=J((function(e,t=0){return L(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeBigUInt64BE=J((function(e,t=0){return j(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),a.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);M(this,e,t,r,n-1,-n)}let i=0,o=1,a=0;for(this[t]=255&e;++i>0)-a&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);M(this,e,t,r,n-1,-n)}let i=r-1,o=1,a=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/o>>0)-a&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeBigInt64LE=J((function(e,t=0){return L(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeBigInt64BE=J((function(e,t=0){return j(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),a.prototype.writeFloatLE=function(e,t,r){return I(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return I(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return C(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return C(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function z(e,t,r,n,i,o){if(e>r||e3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new N.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){q(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||W(t,e.length-(r+1))}(n,i,o)}function q(e,t){if("number"!=typeof e)throw new N.ERR_INVALID_ARG_TYPE(t,"number",e)}function W(e,t,r){if(Math.floor(e)!==e)throw q(e,r),new N.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new N.ERR_BUFFER_OUT_OF_BOUNDS;throw new N.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}P("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),P("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),P("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=D(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=D(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);const F=/[^+/0-9A-Za-z-_]/g;function K(e,t){let r;t=t||1/0;const n=e.length;let i=null;const o=[];for(let a=0;a55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Y(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(F,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function H(e,t,r,n){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function $(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function V(e){return e!=e}const G=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function J(e){return"undefined"==typeof BigInt?X:e}function X(){throw new Error("BigInt not supported")}}(Ne),function(e,t){var r=Ne,n=r.Buffer;function i(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=o),i(n,o),o.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}}(Ce,Ce.exports),Ve.prototype=Object.create(null),Ge.EventEmitter=Ge,Ge.usingDomains=!1,Ge.prototype.domain=void 0,Ge.prototype._events=void 0,Ge.prototype._maxListeners=void 0,Ge.defaultMaxListeners=10,Ge.init=function(){this.domain=null,Ge.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new Ve,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Ge.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},Ge.prototype.getMaxListeners=function(){return Je(this)},Ge.prototype.emit=function(e){var t,r,n,i,o,a,s,u="error"===e;if(a=this._events)u=u&&null==a.error;else if(!u)return!1;if(s=this.domain,u){if(t=arguments[1],!s){if(t instanceof Error)throw t;var h=new Error('Uncaught, unspecified "error" event. ('+t+")");throw h.context=t,h}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(r=a[e]))return!1;var l="function"==typeof r;switch(n=arguments.length){case 1:Xe(r,l,this);break;case 2:Ze(r,l,this,arguments[1]);break;case 3:Qe(r,l,this,arguments[1],arguments[2]);break;case 4:et(r,l,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(n-1),o=1;o0;)if(r[o]===t||r[o].listener&&r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new Ve,this;delete n[e]}else!function(e,t){for(var r=t,n=r+1,i=e.length;n0?Reflect.ownKeys(this._events):[]};var at=Object.freeze({__proto__:null,default:Ge,EventEmitter:Ge});function st(){throw new Error("setTimeout has not been defined")}function ut(){throw new Error("clearTimeout has not been defined")}var ht=st,lt=ut;function ft(e){if(ht===setTimeout)return setTimeout(e,0);if((ht===st||!ht)&&setTimeout)return ht=setTimeout,setTimeout(e,0);try{return ht(e,0)}catch(t){try{return ht.call(null,e,0)}catch(t){return ht.call(this,e,0)}}}"function"==typeof N.setTimeout&&(ht=setTimeout),"function"==typeof N.clearTimeout&&(lt=clearTimeout);var ct,dt=[],pt=!1,gt=-1;function yt(){pt&&ct&&(pt=!1,ct.length?dt=ct.concat(dt):gt=-1,dt.length&&bt())}function bt(){if(!pt){var e=ft(yt);pt=!0;for(var t=dt.length;t;){for(ct=dt,dt=[];++gt1)for(var r=1;r=a)return e;switch(e){case"%s":return String(i[n++]);case"%d":return Number(i[n++]);case"%j":try{return JSON.stringify(i[n++])}catch(e){return"[Circular]"}default:return e}})),u=i[n];n=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),c(r)?n.showHidden=r:r&&t._extend(n,r),y(n.showHidden)&&(n.showHidden=!1),y(n.depth)&&(n.depth=2),y(n.colors)&&(n.colors=!1),y(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=a),u(n,e,n.depth)}function a(e,t){var r=o.styles[t];return r?"["+o.colors[r][0]+"m"+e+"["+o.colors[r][1]+"m":e}function s(e,t){return e}function u(e,r,n){if(e.customInspect&&r&&_(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return g(i)||(i=u(e,i,n)),i}var o=function(e,t){if(y(t))return e.stylize("undefined","undefined");if(g(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(p(t))return e.stylize(""+t,"number");if(c(t))return e.stylize(""+t,"boolean");if(d(t))return e.stylize("null","null")}(e,r);if(o)return o;var a=Object.keys(r),s=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(r)),w(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return h(r);if(0===a.length){if(_(r)){var m=r.name?": "+r.name:"";return e.stylize("[Function"+m+"]","special")}if(b(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(v(r))return e.stylize(Date.prototype.toString.call(r),"date");if(w(r))return h(r)}var E,S="",k=!1,x=["{","}"];(f(r)&&(k=!0,x=["[","]"]),_(r))&&(S=" [Function"+(r.name?": "+r.name:"")+"]");return b(r)&&(S=" "+RegExp.prototype.toString.call(r)),v(r)&&(S=" "+Date.prototype.toUTCString.call(r)),w(r)&&(S=" "+h(r)),0!==a.length||k&&0!=r.length?n<0?b(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),E=k?function(e,t,r,n,i){for(var o=[],a=0,s=t.length;a60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(E,S,x)):x[0]+S+x[1]}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,r,n,i,o){var a,s,h;if((h=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=h.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):h.set&&(s=e.stylize("[Setter]","special")),R(n,i)||(a="["+i+"]"),s||(e.seen.indexOf(h.value)<0?(s=d(r)?u(e,h.value,null):u(e,h.value,r-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),y(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function f(e){return Array.isArray(e)}function c(e){return"boolean"==typeof e}function d(e){return null===e}function p(e){return"number"==typeof e}function g(e){return"string"==typeof e}function y(e){return void 0===e}function b(e){return m(e)&&"[object RegExp]"===E(e)}function m(e){return"object"==typeof e&&null!==e}function v(e){return m(e)&&"[object Date]"===E(e)}function w(e){return m(e)&&("[object Error]"===E(e)||e instanceof Error)}function _(e){return"function"==typeof e}function E(e){return Object.prototype.toString.call(e)}function S(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(y(n)&&(n=Mt.env.NODE_DEBUG||""),e=e.toUpperCase(),!i[e])if(new RegExp("\\b"+e+"\\b","i").test(n)){var r=Mt.pid;i[e]=function(){var n=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,n)}}else i[e]=function(){};return i[e]},t.inspect=o,o.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=f,t.isBoolean=c,t.isNull=d,t.isNullOrUndefined=function(e){return null==e},t.isNumber=p,t.isString=g,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=y,t.isRegExp=b,t.isObject=m,t.isDate=v,t.isError=w,t.isFunction=_,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=jt;var k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function x(){var e=new Date,t=[S(e.getHours()),S(e.getMinutes()),S(e.getSeconds())].join(":");return[e.getDate(),k[e.getMonth()],t].join(" ")}function R(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",x(),t.format.apply(t,arguments))},t.inherits=Ie.exports,t._extend=function(e,t){if(!t||!m(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}}(Lt),Ut.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},Ut.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},Ut.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},Ut.prototype.clear=function(){this.head=this.tail=null,this.length=0},Ut.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},Ut.prototype.concat=function(e){if(0===this.length)return Ne.Buffer.alloc(0);if(1===this.length)return this.head.data;for(var t=Ne.Buffer.allocUnsafe(e>>>0),r=this.head,n=0;r;)r.data.copy(t,n),n+=r.data.length,r=r.next;return t};var It={},Ct=Ce.exports.Buffer,Nt=Ct.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};var Pt=It.StringDecoder=Dt;function Dt(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(Ct.isEncoding===Nt||!Nt(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=Wt,this.end=Ft,t=4;break;case"utf8":this.fillLast=qt,t=4;break;case"base64":this.text=Kt,this.end=Yt,t=3;break;default:return this.write=Ht,void(this.end=$t)}this.lastNeed=0,this.lastTotal=0,this.lastChar=Ct.allocUnsafe(t)}function zt(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function qt(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function Wt(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function Ft(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function Kt(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function Yt(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function Ht(e){return e.toString(this.encoding)}function $t(e){return e&&e.length?this.write(e):""}Dt.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return i>0&&(e.lastNeed=i-1),i;if(--n=0)return i>0&&(e.lastNeed=i-2),i;if(--n=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},Dt.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},Jt.ReadableState=Gt;var Vt=Lt.debuglog("stream");function Gt(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof Sr&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var r=e.highWaterMark,n=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:n,this.highWaterMark=~~this.highWaterMark,this.buffer=new Ut,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new Pt(e.encoding),this.encoding=e.encoding)}function Jt(e){if(!(this instanceof Jt))return new Jt(e);this._readableState=new Gt(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),Ge.call(this)}function Xt(e,t,r,n,i){var o=function(e,t){var r=null;X.isBuffer(t)||"string"==typeof t||null==t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));return r}(t,r);if(o)e.emit("error",o);else if(null===r)t.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,Qt(e)}(e,t);else if(t.objectMode||r&&r.length>0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var u;!t.decoder||i||n||(r=t.decoder.write(r),u=!t.objectMode&&0===r.length),i||(t.reading=!1),u||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&Qt(e))),function(e,t){t.readingMore||(t.readingMore=!0,mt(tr,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function Qt(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(Vt("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?mt(er,e):er(e))}function er(e){Vt("emit readable"),e.emit("readable"),ir(e)}function tr(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;eo.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0===(e-=a)){a===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++n}return t.length-=n,i}(e,t):function(e,t){var r=X.allocUnsafe(e),n=t.head,i=1;n.data.copy(r),e-=n.data.length;for(;n=n.next;){var o=n.data,a=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,a),0===(e-=a)){a===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function ar(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,mt(sr,t,e))}function sr(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function ur(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return Vt("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?ar(this):Qt(this),null;if(0===(e=Zt(e,t))&&t.ended)return 0===t.length&&ar(this),null;var n,i=t.needReadable;return Vt("need readable",i),(0===t.length||t.length-e0?or(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&ar(this)),null!==n&&this.emit("data",n),n},Jt.prototype._read=function(e){this.emit("error",new Error("not implemented"))},Jt.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,Vt("pipe count=%d opts=%j",n.pipesCount,t);var i=!t||!1!==t.end?a:h;function o(e){Vt("onunpipe"),e===r&&h()}function a(){Vt("onend"),e.end()}n.endEmitted?mt(i):r.once("end",i),e.on("unpipe",o);var s=function(e){return function(){var t=e._readableState;Vt("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,ir(e))}}(r);e.on("drain",s);var u=!1;function h(){Vt("cleanup"),e.removeListener("close",d),e.removeListener("finish",p),e.removeListener("drain",s),e.removeListener("error",c),e.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",h),r.removeListener("data",f),u=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}var l=!1;function f(t){Vt("ondata"),l=!1,!1!==e.write(t)||l||((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==ur(n.pipes,e))&&!u&&(Vt("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,l=!0),r.pause())}function c(t){var r;Vt("onerror",t),g(),e.removeListener("error",c),0===(r="error",e.listeners(r).length)&&e.emit("error",t)}function d(){e.removeListener("finish",p),g()}function p(){Vt("onfinish"),e.removeListener("close",d),g()}function g(){Vt("unpipe"),r.unpipe(e)}return r.on("data",f),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",c),e.once("close",d),e.once("finish",p),e.emit("pipe",r),n.flowing||(Vt("pipe resume"),r.resume()),e},Jt.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var r=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},cr.prototype._write=function(e,t,r){r(new Error("not implemented"))},cr.prototype._writev=null,cr.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(e,t,r){t.ending=!0,mr(e,t),r&&(t.finished?mt(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r)},Lt.inherits(Sr,Jt);for(var wr=Object.keys(cr.prototype),_r=0;_r64?t=e(t):t.length<64&&(t=Pr.concat([t,zr],64));for(var r=this._ipad=Pr.allocUnsafe(64),n=this._opad=Pr.allocUnsafe(64),i=0;i<64;i++)r[i]=54^t[i],n[i]=92^t[i];this._hash=[r]}Nr(qr,Dr),qr.prototype._update=function(e){this._hash.push(e)},qr.prototype._final=function(){var e=this._alg(Pr.concat(this._hash));return this._alg(Pr.concat([this._opad,e]))};var Wr=qr,Fr={exports:{}}; /*! safe-buffer. MIT License. Feross Aboukhadijeh */ -!function(e,t){var r=Ne,n=r.Buffer;function i(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=o),o.prototype=Object.create(n.prototype),i(n,o),o.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}}(Fr,Fr.exports);var Kr={exports:{}},Yr=r(at),Hr=Yr.EventEmitter;function $r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Vr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Gr(e,t){for(var r=0;r0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return Jr.alloc(0);for(var t,r,n,i=Jr.allocUnsafe(e>>>0),o=this.head,a=0;o;)t=o.data,r=i,n=a,Jr.prototype.copy.call(t,r,n),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=Jr.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:Zr,value:function(e,t){return Xr(this,function(e){for(var t=1;t2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}sn("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),sn("ERR_INVALID_ARG_TYPE",(function(e,t,r){var n,i,o,a;if("string"==typeof t&&(i="not ",t.substr(!o||o<0?0:+o,i.length)===i)?(n="must not be",t=t.replace(/^not /,"")):n="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))a="The ".concat(e," ").concat(n," ").concat(un(t,"type"));else{var s=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";a='The "'.concat(e,'" ').concat(s," ").concat(n," ").concat(un(t,"type"))}return a+=". Received type ".concat(typeof r)}),TypeError),sn("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),sn("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),sn("ERR_STREAM_PREMATURE_CLOSE","Premature close"),sn("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),sn("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),sn("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),sn("ERR_STREAM_WRITE_AFTER_END","write after end"),sn("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),sn("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),sn("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),on.codes=an;var hn=on.codes.ERR_INVALID_OPT_VALUE;var ln={getHighWaterMark:function(e,t,r,n){var i=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new hn(n?r:"highWaterMark",i);return Math.floor(i)}return e.objectMode?16:16384}},fn={exports:{}};"function"==typeof Object.create?fn.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:fn.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}};var cn=function(e,t){if(dn("noDeprecation"))return e;var r=!1;return function(){if(!r){if(dn("throwDeprecation"))throw new Error(t);dn("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}};function dn(t){try{if(!e.localStorage)return!1}catch(e){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}var pn,gn=Cn;function yn(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;e.entry=null;for(;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}Cn.WritableState=In;var bn={deprecate:cn},mn=Hr,vn=Ne.Buffer,wn=e.Uint8Array||function(){};var _n,En=nn,Sn=ln.getHighWaterMark,kn=on.codes,xn=kn.ERR_INVALID_ARG_TYPE,Rn=kn.ERR_METHOD_NOT_IMPLEMENTED,An=kn.ERR_MULTIPLE_CALLBACK,Tn=kn.ERR_STREAM_CANNOT_PIPE,Bn=kn.ERR_STREAM_DESTROYED,On=kn.ERR_STREAM_NULL_VALUES,Mn=kn.ERR_STREAM_WRITE_AFTER_END,Ln=kn.ERR_UNKNOWN_ENCODING,jn=En.errorOrDestroy;function Un(){}function In(e,t,r){pn=pn||Kn,e=e||{},"boolean"!=typeof r&&(r=t instanceof pn),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=Sn(this,e,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=!1===e.decodeStrings;this.decodeStrings=!n,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if("function"!=typeof i)throw new An;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,i){--t.pendingcb,r?(Mt.nextTick(i,n),Mt.nextTick(Wn,e,t),e._writableState.errorEmitted=!0,jn(e,n)):(i(n),e._writableState.errorEmitted=!0,jn(e,n),Wn(e,t))}(e,r,n,t,i);else{var o=zn(r)||e.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||Dn(e,r),n?Mt.nextTick(Pn,e,r,o,i):Pn(e,r,o,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new yn(this)}function Cn(e){var t=this instanceof(pn=pn||Kn);if(!t&&!_n.call(Cn,this))return new Cn(e);this._writableState=new In(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),mn.call(this)}function Nn(e,t,r,n,i,o,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new Bn("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function Pn(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),Wn(e,t)}function Dn(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),o=t.corkedRequestsFree;o.entry=r;for(var a=0,s=!0;r;)i[a]=r,r.isBuf||(s=!1),r=r.next,a+=1;i.allBuffers=s,Nn(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new yn(t),t.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,h=r.encoding,l=r.callback;if(Nn(e,t,!1,t.objectMode?1:u.length,u,h,l),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function zn(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function qn(e,t){e._final((function(r){t.pendingcb--,r&&jn(e,r),t.prefinished=!0,e.emit("prefinish"),Wn(e,t)}))}function Wn(e,t){var r=zn(t);if(r&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,Mt.nextTick(qn,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}fn.exports(Cn,mn),In.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(In.prototype,"buffer",{get:bn.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(_n=Function.prototype[Symbol.hasInstance],Object.defineProperty(Cn,Symbol.hasInstance,{value:function(e){return!!_n.call(this,e)||this===Cn&&(e&&e._writableState instanceof In)}})):_n=function(e){return e instanceof this},Cn.prototype.pipe=function(){jn(this,new Tn)},Cn.prototype.write=function(e,t,r){var n,i=this._writableState,o=!1,a=!i.objectMode&&(n=e,vn.isBuffer(n)||n instanceof wn);return a&&!vn.isBuffer(e)&&(e=function(e){return vn.from(e)}(e)),"function"==typeof t&&(r=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof r&&(r=Un),i.ending?function(e,t){var r=new Mn;jn(e,r),Mt.nextTick(t,r)}(this,r):(a||function(e,t,r,n){var i;return null===r?i=new On:"string"==typeof r||t.objectMode||(i=new xn("chunk",["string","Buffer"],r)),!i||(jn(e,i),Mt.nextTick(n,i),!1)}(this,i,e,r))&&(i.pendingcb++,o=function(e,t,r,n,i,o){if(!r){var a=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=vn.from(t,r));return t}(t,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=t.objectMode?1:n.length;t.length+=s;var u=t.length-1))throw new Ln(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(Cn.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Cn.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Cn.prototype._write=function(e,t,r){r(new Rn("_write()"))},Cn.prototype._writev=null,Cn.prototype.end=function(e,t,r){var n=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,t,r){t.ending=!0,Wn(e,t),r&&(t.finished?Mt.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r),this},Object.defineProperty(Cn.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(Cn.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),Cn.prototype.destroy=En.destroy,Cn.prototype._undestroy=En.undestroy,Cn.prototype._destroy=function(e,t){t(e)};var Fn=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t},Kn=Jn,Yn=wi,Hn=gn;fn.exports(Jn,Yn);for(var $n=Fn(Hn.prototype),Vn=0;Vn<$n.length;Vn++){var Gn=$n[Vn];Jn.prototype[Gn]||(Jn.prototype[Gn]=Hn.prototype[Gn])}function Jn(e){if(!(this instanceof Jn))return new Jn(e);Yn.call(this,e),Hn.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",Xn)))}function Xn(){this._writableState.ended||Mt.nextTick(Zn,this)}function Zn(e){e.end()}Object.defineProperty(Jn.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(Jn.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Jn.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(Jn.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}});var Qn=on.codes.ERR_STREAM_PREMATURE_CLOSE;function ei(){}var ti,ri=function e(t,r,n){if("function"==typeof r)return e(t,null,r);r||(r={}),n=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i0)if("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===Si.prototype||(t=function(e){return Si.from(e)}(t)),n)a.endEmitted?Pi(e,new Ni):Fi(e,a,t,!0);else if(a.ended)Pi(e,new Ii);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(t=a.decoder.write(t),a.objectMode||0!==t.length?Fi(e,a,t,!1):$i(e,a)):Fi(e,a,t,!1)}else n||(a.reading=!1,$i(e,a));return!a.ended&&(a.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=1073741824?e=1073741824:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function Yi(e){var t=e._readableState;xi("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(xi("emitReadable",t.flowing),t.emittedReadable=!0,Mt.nextTick(Hi,e))}function Hi(e){var t=e._readableState;xi("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,Zi(e)}function $i(e,t){t.readingMore||(t.readingMore=!0,Mt.nextTick(Vi,e,t))}function Vi(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function Ji(e){xi("readable nexttick read 0"),e.read(0)}function Xi(e,t){xi("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),Zi(e),t.flowing&&!t.reading&&e.read(0)}function Zi(e){var t=e._readableState;for(xi("flow",t.flowing);t.flowing&&null!==e.read(););}function Qi(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function eo(e){var t=e._readableState;xi("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,Mt.nextTick(to,t,e))}function to(e,t){if(xi("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function ro(e,t){for(var r=0,n=e.length;r=t.highWaterMark:t.length>0)||t.ended))return xi("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?eo(this):Yi(this),null;if(0===(e=Ki(e,t))&&t.ended)return 0===t.length&&eo(this),null;var n,i=t.needReadable;return xi("need readable",i),(0===t.length||t.length-e0?Qi(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&eo(this)),null!==n&&this.emit("data",n),n},qi.prototype._read=function(e){Pi(this,new Ci("_read()"))},qi.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,xi("pipe count=%d opts=%j",n.pipesCount,t);var i=(!t||!1!==t.end)&&e!==Mt.stdout&&e!==Mt.stderr?a:d;function o(t,i){xi("onunpipe"),t===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,xi("cleanup"),e.removeListener("close",f),e.removeListener("finish",c),e.removeListener("drain",s),e.removeListener("error",l),e.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",d),r.removeListener("data",h),u=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||s())}function a(){xi("onend"),e.end()}n.endEmitted?Mt.nextTick(i):r.once("end",i),e.on("unpipe",o);var s=function(e){return function(){var t=e._readableState;xi("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&_i(e,"data")&&(t.flowing=!0,Zi(e))}}(r);e.on("drain",s);var u=!1;function h(t){xi("ondata");var i=e.write(t);xi("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==ro(n.pipes,e))&&!u&&(xi("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function l(t){xi("onerror",t),d(),e.removeListener("error",l),0===_i(e,"error")&&Pi(e,t)}function f(){e.removeListener("finish",c),d()}function c(){xi("onfinish"),e.removeListener("close",f),d()}function d(){xi("unpipe"),r.unpipe(e)}return r.on("data",h),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",l),e.once("close",f),e.once("finish",c),e.emit("pipe",r),n.flowing||(xi("pipe resume"),r.resume()),e},qi.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,xi("on readable",n.length,n.reading),n.length?Yi(this):n.reading||Mt.nextTick(Ji,this))),r},qi.prototype.addListener=qi.prototype.on,qi.prototype.removeListener=function(e,t){var r=Ei.prototype.removeListener.call(this,e,t);return"readable"===e&&Mt.nextTick(Gi,this),r},qi.prototype.removeAllListeners=function(e){var t=Ei.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||Mt.nextTick(Gi,this),t},qi.prototype.resume=function(){var e=this._readableState;return e.flowing||(xi("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,Mt.nextTick(Xi,e,t))}(this,e)),e.paused=!1,this},qi.prototype.pause=function(){return xi("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(xi("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},qi.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(xi("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(xi("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o0,(function(e){n||(n=e),e&&o.forEach(ko),a||(o.forEach(ko),i(n))}))}));return t.reduce(xo)};!function(e,t){(t=Kr.exports=wi).Stream=t,t.Readable=t,t.Writable=gn,t.Duplex=Kn,t.Transform=no,t.PassThrough=yo,t.finished=ri,t.pipeline=Ao}(0,Kr.exports);var To=Fr.exports.Buffer,Bo=Kr.exports.Transform;function Oo(e){Bo.call(this),this._block=To.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}(0,fn.exports)(Oo,Bo),Oo.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(e){n=e}r(n)},Oo.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},Oo.prototype.update=function(e,t){if(function(e,t){if(!To.isBuffer(e)&&"string"!=typeof e)throw new TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");To.isBuffer(e)||(e=To.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var i=this._blockOffset;i0;++o)this._length[o]+=a,(a=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*a);return this},Oo.prototype._update=function(){throw new Error("_update is not implemented")},Oo.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},Oo.prototype._digest=function(){throw new Error("_digest is not implemented")};var Mo=Oo,Lo=Ie.exports,jo=Mo,Uo=Ce.exports.Buffer,Io=new Array(16);function Co(){jo.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function No(e,t){return e<>>32-t}function Po(e,t,r,n,i,o,a){return No(e+(t&r|~t&n)+i+o|0,a)+t|0}function Do(e,t,r,n,i,o,a){return No(e+(t&n|r&~n)+i+o|0,a)+t|0}function zo(e,t,r,n,i,o,a){return No(e+(t^r^n)+i+o|0,a)+t|0}function qo(e,t,r,n,i,o,a){return No(e+(r^(t|~n))+i+o|0,a)+t|0}Lo(Co,jo),Co.prototype._update=function(){for(var e=Io,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,o=this._d;r=Po(r,n,i,o,e[0],3614090360,7),o=Po(o,r,n,i,e[1],3905402710,12),i=Po(i,o,r,n,e[2],606105819,17),n=Po(n,i,o,r,e[3],3250441966,22),r=Po(r,n,i,o,e[4],4118548399,7),o=Po(o,r,n,i,e[5],1200080426,12),i=Po(i,o,r,n,e[6],2821735955,17),n=Po(n,i,o,r,e[7],4249261313,22),r=Po(r,n,i,o,e[8],1770035416,7),o=Po(o,r,n,i,e[9],2336552879,12),i=Po(i,o,r,n,e[10],4294925233,17),n=Po(n,i,o,r,e[11],2304563134,22),r=Po(r,n,i,o,e[12],1804603682,7),o=Po(o,r,n,i,e[13],4254626195,12),i=Po(i,o,r,n,e[14],2792965006,17),r=Do(r,n=Po(n,i,o,r,e[15],1236535329,22),i,o,e[1],4129170786,5),o=Do(o,r,n,i,e[6],3225465664,9),i=Do(i,o,r,n,e[11],643717713,14),n=Do(n,i,o,r,e[0],3921069994,20),r=Do(r,n,i,o,e[5],3593408605,5),o=Do(o,r,n,i,e[10],38016083,9),i=Do(i,o,r,n,e[15],3634488961,14),n=Do(n,i,o,r,e[4],3889429448,20),r=Do(r,n,i,o,e[9],568446438,5),o=Do(o,r,n,i,e[14],3275163606,9),i=Do(i,o,r,n,e[3],4107603335,14),n=Do(n,i,o,r,e[8],1163531501,20),r=Do(r,n,i,o,e[13],2850285829,5),o=Do(o,r,n,i,e[2],4243563512,9),i=Do(i,o,r,n,e[7],1735328473,14),r=zo(r,n=Do(n,i,o,r,e[12],2368359562,20),i,o,e[5],4294588738,4),o=zo(o,r,n,i,e[8],2272392833,11),i=zo(i,o,r,n,e[11],1839030562,16),n=zo(n,i,o,r,e[14],4259657740,23),r=zo(r,n,i,o,e[1],2763975236,4),o=zo(o,r,n,i,e[4],1272893353,11),i=zo(i,o,r,n,e[7],4139469664,16),n=zo(n,i,o,r,e[10],3200236656,23),r=zo(r,n,i,o,e[13],681279174,4),o=zo(o,r,n,i,e[0],3936430074,11),i=zo(i,o,r,n,e[3],3572445317,16),n=zo(n,i,o,r,e[6],76029189,23),r=zo(r,n,i,o,e[9],3654602809,4),o=zo(o,r,n,i,e[12],3873151461,11),i=zo(i,o,r,n,e[15],530742520,16),r=qo(r,n=zo(n,i,o,r,e[2],3299628645,23),i,o,e[0],4096336452,6),o=qo(o,r,n,i,e[7],1126891415,10),i=qo(i,o,r,n,e[14],2878612391,15),n=qo(n,i,o,r,e[5],4237533241,21),r=qo(r,n,i,o,e[12],1700485571,6),o=qo(o,r,n,i,e[3],2399980690,10),i=qo(i,o,r,n,e[10],4293915773,15),n=qo(n,i,o,r,e[1],2240044497,21),r=qo(r,n,i,o,e[8],1873313359,6),o=qo(o,r,n,i,e[15],4264355552,10),i=qo(i,o,r,n,e[6],2734768916,15),n=qo(n,i,o,r,e[13],1309151649,21),r=qo(r,n,i,o,e[4],4149444226,6),o=qo(o,r,n,i,e[11],3174756917,10),i=qo(i,o,r,n,e[2],718787259,15),n=qo(n,i,o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},Co.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=Uo.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};var Wo=Co,Fo=Ne.Buffer,Ko=Ie.exports,Yo=Mo,Ho=new Array(16),$o=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],Vo=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Go=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Jo=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Xo=[0,1518500249,1859775393,2400959708,2840853838],Zo=[1352829926,1548603684,1836072691,2053994217,0];function Qo(){Yo.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function ea(e,t){return e<>>32-t}function ta(e,t,r,n,i,o,a,s){return ea(e+(t^r^n)+o+a|0,s)+i|0}function ra(e,t,r,n,i,o,a,s){return ea(e+(t&r|~t&n)+o+a|0,s)+i|0}function na(e,t,r,n,i,o,a,s){return ea(e+((t|~r)^n)+o+a|0,s)+i|0}function ia(e,t,r,n,i,o,a,s){return ea(e+(t&n|r&~n)+o+a|0,s)+i|0}function oa(e,t,r,n,i,o,a,s){return ea(e+(t^(r|~n))+o+a|0,s)+i|0}Ko(Qo,Yo),Qo.prototype._update=function(){for(var e=Ho,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,s=0|this._a,u=0|this._b,h=0|this._c,l=0|this._d,f=0|this._e,c=0;c<80;c+=1){var d,p;c<16?(d=ta(r,n,i,o,a,e[$o[c]],Xo[0],Go[c]),p=oa(s,u,h,l,f,e[Vo[c]],Zo[0],Jo[c])):c<32?(d=ra(r,n,i,o,a,e[$o[c]],Xo[1],Go[c]),p=ia(s,u,h,l,f,e[Vo[c]],Zo[1],Jo[c])):c<48?(d=na(r,n,i,o,a,e[$o[c]],Xo[2],Go[c]),p=na(s,u,h,l,f,e[Vo[c]],Zo[2],Jo[c])):c<64?(d=ia(r,n,i,o,a,e[$o[c]],Xo[3],Go[c]),p=ra(s,u,h,l,f,e[Vo[c]],Zo[3],Jo[c])):(d=oa(r,n,i,o,a,e[$o[c]],Xo[4],Go[c]),p=ta(s,u,h,l,f,e[Vo[c]],Zo[4],Jo[c])),r=a,a=o,o=ea(i,10),i=n,n=d,s=f,f=l,l=ea(h,10),h=u,u=p}var g=this._b+i+l|0;this._b=this._c+o+f|0,this._c=this._d+a+s|0,this._d=this._e+r+u|0,this._e=this._a+n+h|0,this._a=g},Qo.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=Fo.alloc?Fo.alloc(20):new Fo(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e};var aa=Qo,sa={exports:{}},ua=Ce.exports.Buffer;function ha(e,t){this._block=ua.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}ha.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=ua.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,o=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},ha.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var la=ha,fa=Ie.exports,ca=la,da=Ce.exports.Buffer,pa=[1518500249,1859775393,-1894007588,-899497514],ga=new Array(80);function ya(){this.init(),this._w=ga,ca.call(this,64,56)}function ba(e){return e<<30|e>>>2}function ma(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}fa(ya,ca),ya.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},ya.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0;u<16;++u)r[u]=e.readInt32BE(4*u);for(;u<80;++u)r[u]=r[u-3]^r[u-8]^r[u-14]^r[u-16];for(var h=0;h<80;++h){var l=~~(h/20),f=0|((t=n)<<5|t>>>27)+ma(l,i,o,a)+s+r[h]+pa[l];s=a,a=o,o=ba(i),i=n,n=f}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},ya.prototype._hash=function(){var e=da.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var va=ya,wa=Ie.exports,_a=la,Ea=Ce.exports.Buffer,Sa=[1518500249,1859775393,-1894007588,-899497514],ka=new Array(80);function xa(){this.init(),this._w=ka,_a.call(this,64,56)}function Ra(e){return e<<5|e>>>27}function Aa(e){return e<<30|e>>>2}function Ta(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}wa(xa,_a),xa.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},xa.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0;u<16;++u)r[u]=e.readInt32BE(4*u);for(;u<80;++u)r[u]=(t=r[u-3]^r[u-8]^r[u-14]^r[u-16])<<1|t>>>31;for(var h=0;h<80;++h){var l=~~(h/20),f=Ra(n)+Ta(l,i,o,a)+s+r[h]+Sa[l]|0;s=a,a=o,o=Aa(i),i=n,n=f}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},xa.prototype._hash=function(){var e=Ea.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var Ba=xa,Oa=Ie.exports,Ma=la,La=Ce.exports.Buffer,ja=[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],Ua=new Array(64);function Ia(){this.init(),this._w=Ua,Ma.call(this,64,56)}function Ca(e,t,r){return r^e&(t^r)}function Na(e,t,r){return e&t|r&(e|t)}function Pa(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function Da(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function za(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}Oa(Ia,Ma),Ia.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},Ia.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0|this._f,h=0|this._g,l=0|this._h,f=0;f<16;++f)r[f]=e.readInt32BE(4*f);for(;f<64;++f)r[f]=0|(((t=r[f-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[f-7]+za(r[f-15])+r[f-16];for(var c=0;c<64;++c){var d=l+Da(s)+Ca(s,u,h)+ja[c]+r[c]|0,p=Pa(n)+Na(n,i,o)|0;l=h,h=u,u=s,s=a+d|0,a=o,o=i,i=n,n=d+p|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0,this._f=u+this._f|0,this._g=h+this._g|0,this._h=l+this._h|0},Ia.prototype._hash=function(){var e=La.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var qa=Ia,Wa=Ie.exports,Fa=qa,Ka=la,Ya=Ce.exports.Buffer,Ha=new Array(64);function $a(){this.init(),this._w=Ha,Ka.call(this,64,56)}Wa($a,Fa),$a.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},$a.prototype._hash=function(){var e=Ya.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var Va=$a,Ga=Ie.exports,Ja=la,Xa=Ce.exports.Buffer,Za=[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],Qa=new Array(160);function es(){this.init(),this._w=Qa,Ja.call(this,128,112)}function ts(e,t,r){return r^e&(t^r)}function rs(e,t,r){return e&t|r&(e|t)}function ns(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function is(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function os(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function as(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function ss(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function us(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function hs(e,t){return e>>>0>>0?1:0}Ga(es,Ja),es.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},es.prototype._update=function(e){for(var t=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,s=0|this._fh,u=0|this._gh,h=0|this._hh,l=0|this._al,f=0|this._bl,c=0|this._cl,d=0|this._dl,p=0|this._el,g=0|this._fl,y=0|this._gl,b=0|this._hl,m=0;m<32;m+=2)t[m]=e.readInt32BE(4*m),t[m+1]=e.readInt32BE(4*m+4);for(;m<160;m+=2){var v=t[m-30],w=t[m-30+1],_=os(v,w),E=as(w,v),S=ss(v=t[m-4],w=t[m-4+1]),k=us(w,v),x=t[m-14],R=t[m-14+1],A=t[m-32],T=t[m-32+1],B=E+R|0,O=_+x+hs(B,E)|0;O=(O=O+S+hs(B=B+k|0,k)|0)+A+hs(B=B+T|0,T)|0,t[m]=O,t[m+1]=B}for(var M=0;M<160;M+=2){O=t[M],B=t[M+1];var L=rs(r,n,i),j=rs(l,f,c),U=ns(r,l),I=ns(l,r),C=is(a,p),N=is(p,a),P=Za[M],D=Za[M+1],z=ts(a,s,u),q=ts(p,g,y),W=b+N|0,F=h+C+hs(W,b)|0;F=(F=(F=F+z+hs(W=W+q|0,q)|0)+P+hs(W=W+D|0,D)|0)+O+hs(W=W+B|0,B)|0;var K=I+j|0,Y=U+L+hs(K,I)|0;h=u,b=y,u=s,y=g,s=a,g=p,a=o+F+hs(p=d+W|0,d)|0,o=i,d=c,i=n,c=f,n=r,f=l,r=F+Y+hs(l=W+K|0,W)|0}this._al=this._al+l|0,this._bl=this._bl+f|0,this._cl=this._cl+c|0,this._dl=this._dl+d|0,this._el=this._el+p|0,this._fl=this._fl+g|0,this._gl=this._gl+y|0,this._hl=this._hl+b|0,this._ah=this._ah+r+hs(this._al,l)|0,this._bh=this._bh+n+hs(this._bl,f)|0,this._ch=this._ch+i+hs(this._cl,c)|0,this._dh=this._dh+o+hs(this._dl,d)|0,this._eh=this._eh+a+hs(this._el,p)|0,this._fh=this._fh+s+hs(this._fl,g)|0,this._gh=this._gh+u+hs(this._gl,y)|0,this._hh=this._hh+h+hs(this._hl,b)|0},es.prototype._hash=function(){var e=Xa.allocUnsafe(64);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var ls=es,fs=Ie.exports,cs=ls,ds=la,ps=Ce.exports.Buffer,gs=new Array(160);function ys(){this.init(),this._w=gs,ds.call(this,128,112)}fs(ys,cs),ys.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},ys.prototype._hash=function(){var e=ps.allocUnsafe(48);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var bs=ys,ms=sa.exports=function(e){e=e.toLowerCase();var t=ms[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};ms.sha=va,ms.sha1=Ba,ms.sha224=Va,ms.sha256=qa,ms.sha384=bs,ms.sha512=ls;var vs=Ie.exports,ws=Wr,_s=Cr,Es=Ce.exports.Buffer,Ss=function(e){return(new Wo).update(e).digest()},ks=aa,xs=sa.exports,Rs=Es.alloc(128);function As(e,t){_s.call(this,"digest"),"string"==typeof t&&(t=Es.from(t));var r="sha512"===e||"sha384"===e?128:64;(this._alg=e,this._key=t,t.length>r)?t=("rmd160"===e?new ks:xs(e)).update(t).digest():t.length>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 p(e,t,r,n,i){var o,a=0;for(o=0;o>>8)-1}function g(e,t,r,n){return p(e,t,r,n,16)}function y(e,t,r,n){return p(e,t,r,n,32)}function b(e,t,r,n){!function(e,t,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,u=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,h=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,c=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,d=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,g=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,y=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,b=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,m=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=o,E=a,S=s,k=u,x=h,R=l,A=f,T=c,B=d,O=p,M=g,L=y,j=b,U=m,I=v,C=w,N=0;N<20;N+=2)_^=(i=(j^=(i=(B^=(i=(x^=(i=_+j|0)<<7|i>>>25)+_|0)<<9|i>>>23)+x|0)<<13|i>>>19)+B|0)<<18|i>>>14,R^=(i=(E^=(i=(U^=(i=(O^=(i=R+E|0)<<7|i>>>25)+R|0)<<9|i>>>23)+O|0)<<13|i>>>19)+U|0)<<18|i>>>14,M^=(i=(A^=(i=(S^=(i=(I^=(i=M+A|0)<<7|i>>>25)+M|0)<<9|i>>>23)+I|0)<<13|i>>>19)+S|0)<<18|i>>>14,C^=(i=(L^=(i=(T^=(i=(k^=(i=C+L|0)<<7|i>>>25)+C|0)<<9|i>>>23)+k|0)<<13|i>>>19)+T|0)<<18|i>>>14,_^=(i=(k^=(i=(S^=(i=(E^=(i=_+k|0)<<7|i>>>25)+_|0)<<9|i>>>23)+E|0)<<13|i>>>19)+S|0)<<18|i>>>14,R^=(i=(x^=(i=(T^=(i=(A^=(i=R+x|0)<<7|i>>>25)+R|0)<<9|i>>>23)+A|0)<<13|i>>>19)+T|0)<<18|i>>>14,M^=(i=(O^=(i=(B^=(i=(L^=(i=M+O|0)<<7|i>>>25)+M|0)<<9|i>>>23)+L|0)<<13|i>>>19)+B|0)<<18|i>>>14,C^=(i=(I^=(i=(U^=(i=(j^=(i=C+I|0)<<7|i>>>25)+C|0)<<9|i>>>23)+j|0)<<13|i>>>19)+U|0)<<18|i>>>14;_=_+o|0,E=E+a|0,S=S+s|0,k=k+u|0,x=x+h|0,R=R+l|0,A=A+f|0,T=T+c|0,B=B+d|0,O=O+p|0,M=M+g|0,L=L+y|0,j=j+b|0,U=U+m|0,I=I+v|0,C=C+w|0,e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=E>>>0&255,e[5]=E>>>8&255,e[6]=E>>>16&255,e[7]=E>>>24&255,e[8]=S>>>0&255,e[9]=S>>>8&255,e[10]=S>>>16&255,e[11]=S>>>24&255,e[12]=k>>>0&255,e[13]=k>>>8&255,e[14]=k>>>16&255,e[15]=k>>>24&255,e[16]=x>>>0&255,e[17]=x>>>8&255,e[18]=x>>>16&255,e[19]=x>>>24&255,e[20]=R>>>0&255,e[21]=R>>>8&255,e[22]=R>>>16&255,e[23]=R>>>24&255,e[24]=A>>>0&255,e[25]=A>>>8&255,e[26]=A>>>16&255,e[27]=A>>>24&255,e[28]=T>>>0&255,e[29]=T>>>8&255,e[30]=T>>>16&255,e[31]=T>>>24&255,e[32]=B>>>0&255,e[33]=B>>>8&255,e[34]=B>>>16&255,e[35]=B>>>24&255,e[36]=O>>>0&255,e[37]=O>>>8&255,e[38]=O>>>16&255,e[39]=O>>>24&255,e[40]=M>>>0&255,e[41]=M>>>8&255,e[42]=M>>>16&255,e[43]=M>>>24&255,e[44]=L>>>0&255,e[45]=L>>>8&255,e[46]=L>>>16&255,e[47]=L>>>24&255,e[48]=j>>>0&255,e[49]=j>>>8&255,e[50]=j>>>16&255,e[51]=j>>>24&255,e[52]=U>>>0&255,e[53]=U>>>8&255,e[54]=U>>>16&255,e[55]=U>>>24&255,e[56]=I>>>0&255,e[57]=I>>>8&255,e[58]=I>>>16&255,e[59]=I>>>24&255,e[60]=C>>>0&255,e[61]=C>>>8&255,e[62]=C>>>16&255,e[63]=C>>>24&255}(e,t,r,n)}function m(e,t,r,n){!function(e,t,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,u=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,h=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,c=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,d=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,g=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,y=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,b=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,m=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=0;_<20;_+=2)o^=(i=(b^=(i=(d^=(i=(h^=(i=o+b|0)<<7|i>>>25)+o|0)<<9|i>>>23)+h|0)<<13|i>>>19)+d|0)<<18|i>>>14,l^=(i=(a^=(i=(m^=(i=(p^=(i=l+a|0)<<7|i>>>25)+l|0)<<9|i>>>23)+p|0)<<13|i>>>19)+m|0)<<18|i>>>14,g^=(i=(f^=(i=(s^=(i=(v^=(i=g+f|0)<<7|i>>>25)+g|0)<<9|i>>>23)+v|0)<<13|i>>>19)+s|0)<<18|i>>>14,w^=(i=(y^=(i=(c^=(i=(u^=(i=w+y|0)<<7|i>>>25)+w|0)<<9|i>>>23)+u|0)<<13|i>>>19)+c|0)<<18|i>>>14,o^=(i=(u^=(i=(s^=(i=(a^=(i=o+u|0)<<7|i>>>25)+o|0)<<9|i>>>23)+a|0)<<13|i>>>19)+s|0)<<18|i>>>14,l^=(i=(h^=(i=(c^=(i=(f^=(i=l+h|0)<<7|i>>>25)+l|0)<<9|i>>>23)+f|0)<<13|i>>>19)+c|0)<<18|i>>>14,g^=(i=(p^=(i=(d^=(i=(y^=(i=g+p|0)<<7|i>>>25)+g|0)<<9|i>>>23)+y|0)<<13|i>>>19)+d|0)<<18|i>>>14,w^=(i=(v^=(i=(m^=(i=(b^=(i=w+v|0)<<7|i>>>25)+w|0)<<9|i>>>23)+b|0)<<13|i>>>19)+m|0)<<18|i>>>14;e[0]=o>>>0&255,e[1]=o>>>8&255,e[2]=o>>>16&255,e[3]=o>>>24&255,e[4]=l>>>0&255,e[5]=l>>>8&255,e[6]=l>>>16&255,e[7]=l>>>24&255,e[8]=g>>>0&255,e[9]=g>>>8&255,e[10]=g>>>16&255,e[11]=g>>>24&255,e[12]=w>>>0&255,e[13]=w>>>8&255,e[14]=w>>>16&255,e[15]=w>>>24&255,e[16]=f>>>0&255,e[17]=f>>>8&255,e[18]=f>>>16&255,e[19]=f>>>24&255,e[20]=c>>>0&255,e[21]=c>>>8&255,e[22]=c>>>16&255,e[23]=c>>>24&255,e[24]=d>>>0&255,e[25]=d>>>8&255,e[26]=d>>>16&255,e[27]=d>>>24&255,e[28]=p>>>0&255,e[29]=p>>>8&255,e[30]=p>>>16&255,e[31]=p>>>24&255}(e,t,r,n)}var v=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function w(e,t,r,n,i,o,a){var s,u,h=new Uint8Array(16),l=new Uint8Array(64);for(u=0;u<16;u++)h[u]=0;for(u=0;u<8;u++)h[u]=o[u];for(;i>=64;){for(b(l,h,a,v),u=0;u<64;u++)e[t+u]=r[n+u]^l[u];for(s=1,u=8;u<16;u++)s=s+(255&h[u])|0,h[u]=255&s,s>>>=8;i-=64,t+=64,n+=64}if(i>0)for(b(l,h,a,v),u=0;u=64;){for(b(u,s,i,v),a=0;a<64;a++)e[t+a]=u[a];for(o=1,a=8;a<16;a++)o=o+(255&s[a])|0,s[a]=255&o,o>>>=8;r-=64,t+=64}if(r>0)for(b(u,s,i,v),a=0;a>>13|r<<3),n=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(r>>>10|n<<6),i=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(n>>>7|i<<9),o=255&e[8]|(255&e[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,a=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(o>>>14|a<<2),s=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(a>>>11|s<<5),u=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(s>>>8|u<<8),this.r[9]=u>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function x(e,t,r,n,i,o){var a=new k(o);return a.update(r,n,i),a.finish(e,t),0}function R(e,t,r,n,i,o){var a=new Uint8Array(16);return x(a,0,r,n,i,o),g(e,t,a,0)}function A(e,t,r,n,i){var o;if(r<32)return-1;for(S(e,0,t,0,r,n,i),x(e,16,e,32,r-32,e),o=0;o<16;o++)e[o]=0;return 0}function T(e,t,r,n,i){var o,a=new Uint8Array(32);if(r<32)return-1;if(E(a,0,32,n,i),0!==R(t,16,t,32,r-32,a))return-1;for(S(e,0,t,0,r,n,i),o=0;o<32;o++)e[o]=0;return 0}function B(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function O(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 M(e,t,r){for(var n,i=~(r-1),o=0;o<16;o++)n=i&(e[o]^t[o]),e[o]^=n,t[o]^=n}function L(e,r){var n,i,o,a=t(),s=t();for(n=0;n<16;n++)s[n]=r[n];for(O(s),O(s),O(s),i=0;i<2;i++){for(a[0]=s[0]-65517,n=1;n<15;n++)a[n]=s[n]-65535-(a[n-1]>>16&1),a[n-1]&=65535;a[15]=s[15]-32767-(a[14]>>16&1),o=a[15]>>16&1,a[14]&=65535,M(s,a,1-o)}for(n=0;n<16;n++)e[2*n]=255&s[n],e[2*n+1]=s[n]>>8}function j(e,t){var r=new Uint8Array(32),n=new Uint8Array(32);return L(r,e),L(n,t),y(r,0,n,0)}function I(e){var t=new Uint8Array(32);return L(t,e),1&t[0]}function C(e,t){var r;for(r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function N(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]+r[n]}function P(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]-r[n]}function D(e,t,r){var n,i,o=0,a=0,s=0,u=0,h=0,l=0,f=0,c=0,d=0,p=0,g=0,y=0,b=0,m=0,v=0,w=0,_=0,E=0,S=0,k=0,x=0,R=0,A=0,T=0,B=0,O=0,M=0,L=0,j=0,U=0,I=0,C=r[0],N=r[1],P=r[2],D=r[3],z=r[4],q=r[5],W=r[6],F=r[7],K=r[8],Y=r[9],H=r[10],$=r[11],V=r[12],G=r[13],J=r[14],X=r[15];o+=(n=t[0])*C,a+=n*N,s+=n*P,u+=n*D,h+=n*z,l+=n*q,f+=n*W,c+=n*F,d+=n*K,p+=n*Y,g+=n*H,y+=n*$,b+=n*V,m+=n*G,v+=n*J,w+=n*X,a+=(n=t[1])*C,s+=n*N,u+=n*P,h+=n*D,l+=n*z,f+=n*q,c+=n*W,d+=n*F,p+=n*K,g+=n*Y,y+=n*H,b+=n*$,m+=n*V,v+=n*G,w+=n*J,_+=n*X,s+=(n=t[2])*C,u+=n*N,h+=n*P,l+=n*D,f+=n*z,c+=n*q,d+=n*W,p+=n*F,g+=n*K,y+=n*Y,b+=n*H,m+=n*$,v+=n*V,w+=n*G,_+=n*J,E+=n*X,u+=(n=t[3])*C,h+=n*N,l+=n*P,f+=n*D,c+=n*z,d+=n*q,p+=n*W,g+=n*F,y+=n*K,b+=n*Y,m+=n*H,v+=n*$,w+=n*V,_+=n*G,E+=n*J,S+=n*X,h+=(n=t[4])*C,l+=n*N,f+=n*P,c+=n*D,d+=n*z,p+=n*q,g+=n*W,y+=n*F,b+=n*K,m+=n*Y,v+=n*H,w+=n*$,_+=n*V,E+=n*G,S+=n*J,k+=n*X,l+=(n=t[5])*C,f+=n*N,c+=n*P,d+=n*D,p+=n*z,g+=n*q,y+=n*W,b+=n*F,m+=n*K,v+=n*Y,w+=n*H,_+=n*$,E+=n*V,S+=n*G,k+=n*J,x+=n*X,f+=(n=t[6])*C,c+=n*N,d+=n*P,p+=n*D,g+=n*z,y+=n*q,b+=n*W,m+=n*F,v+=n*K,w+=n*Y,_+=n*H,E+=n*$,S+=n*V,k+=n*G,x+=n*J,R+=n*X,c+=(n=t[7])*C,d+=n*N,p+=n*P,g+=n*D,y+=n*z,b+=n*q,m+=n*W,v+=n*F,w+=n*K,_+=n*Y,E+=n*H,S+=n*$,k+=n*V,x+=n*G,R+=n*J,A+=n*X,d+=(n=t[8])*C,p+=n*N,g+=n*P,y+=n*D,b+=n*z,m+=n*q,v+=n*W,w+=n*F,_+=n*K,E+=n*Y,S+=n*H,k+=n*$,x+=n*V,R+=n*G,A+=n*J,T+=n*X,p+=(n=t[9])*C,g+=n*N,y+=n*P,b+=n*D,m+=n*z,v+=n*q,w+=n*W,_+=n*F,E+=n*K,S+=n*Y,k+=n*H,x+=n*$,R+=n*V,A+=n*G,T+=n*J,B+=n*X,g+=(n=t[10])*C,y+=n*N,b+=n*P,m+=n*D,v+=n*z,w+=n*q,_+=n*W,E+=n*F,S+=n*K,k+=n*Y,x+=n*H,R+=n*$,A+=n*V,T+=n*G,B+=n*J,O+=n*X,y+=(n=t[11])*C,b+=n*N,m+=n*P,v+=n*D,w+=n*z,_+=n*q,E+=n*W,S+=n*F,k+=n*K,x+=n*Y,R+=n*H,A+=n*$,T+=n*V,B+=n*G,O+=n*J,M+=n*X,b+=(n=t[12])*C,m+=n*N,v+=n*P,w+=n*D,_+=n*z,E+=n*q,S+=n*W,k+=n*F,x+=n*K,R+=n*Y,A+=n*H,T+=n*$,B+=n*V,O+=n*G,M+=n*J,L+=n*X,m+=(n=t[13])*C,v+=n*N,w+=n*P,_+=n*D,E+=n*z,S+=n*q,k+=n*W,x+=n*F,R+=n*K,A+=n*Y,T+=n*H,B+=n*$,O+=n*V,M+=n*G,L+=n*J,j+=n*X,v+=(n=t[14])*C,w+=n*N,_+=n*P,E+=n*D,S+=n*z,k+=n*q,x+=n*W,R+=n*F,A+=n*K,T+=n*Y,B+=n*H,O+=n*$,M+=n*V,L+=n*G,j+=n*J,U+=n*X,w+=(n=t[15])*C,a+=38*(E+=n*P),s+=38*(S+=n*D),u+=38*(k+=n*z),h+=38*(x+=n*q),l+=38*(R+=n*W),f+=38*(A+=n*F),c+=38*(T+=n*K),d+=38*(B+=n*Y),p+=38*(O+=n*H),g+=38*(M+=n*$),y+=38*(L+=n*V),b+=38*(j+=n*G),m+=38*(U+=n*J),v+=38*(I+=n*X),o=(n=(o+=38*(_+=n*N))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+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)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+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)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=(o+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+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)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+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)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),o+=i-1+37*(i-1),e[0]=o,e[1]=a,e[2]=s,e[3]=u,e[4]=h,e[5]=l,e[6]=f,e[7]=c,e[8]=d,e[9]=p,e[10]=g,e[11]=y,e[12]=b,e[13]=m,e[14]=v,e[15]=w}function z(e,t){D(e,t,t)}function q(e,r){var n,i=t();for(n=0;n<16;n++)i[n]=r[n];for(n=253;n>=0;n--)z(i,i),2!==n&&4!==n&&D(i,i,r);for(n=0;n<16;n++)e[n]=i[n]}function W(e,r){var n,i=t();for(n=0;n<16;n++)i[n]=r[n];for(n=250;n>=0;n--)z(i,i),1!==n&&D(i,i,r);for(n=0;n<16;n++)e[n]=i[n]}function F(e,r,n){var i,o,a=new Uint8Array(32),u=new Float64Array(80),h=t(),l=t(),f=t(),c=t(),d=t(),p=t();for(o=0;o<31;o++)a[o]=r[o];for(a[31]=127&r[31]|64,a[0]&=248,C(u,n),o=0;o<16;o++)l[o]=u[o],c[o]=h[o]=f[o]=0;for(h[0]=c[0]=1,o=254;o>=0;--o)M(h,l,i=a[o>>>3]>>>(7&o)&1),M(f,c,i),N(d,h,f),P(h,h,f),N(f,l,c),P(l,l,c),z(c,d),z(p,h),D(h,f,h),D(f,l,d),N(d,h,f),P(h,h,f),z(l,h),P(f,c,p),D(h,f,s),N(h,h,c),D(f,f,h),D(h,c,p),D(c,l,u),z(l,d),M(h,l,i),M(f,c,i);for(o=0;o<16;o++)u[o+16]=h[o],u[o+32]=f[o],u[o+48]=l[o],u[o+64]=c[o];var g=u.subarray(32),y=u.subarray(16);return q(g,g),D(y,y,g),L(e,y),0}function K(e,t){return F(e,t,i)}function Y(e,t){return r(t,32),K(e,t)}function H(e,t,r){var i=new Uint8Array(32);return F(i,r,t),m(e,n,i,v)}k.prototype.blocks=function(e,t,r){for(var n,i,o,a,s,u,h,l,f,c,d,p,g,y,b,m,v,w,_,E=this.fin?0:2048,S=this.h[0],k=this.h[1],x=this.h[2],R=this.h[3],A=this.h[4],T=this.h[5],B=this.h[6],O=this.h[7],M=this.h[8],L=this.h[9],j=this.r[0],U=this.r[1],I=this.r[2],C=this.r[3],N=this.r[4],P=this.r[5],D=this.r[6],z=this.r[7],q=this.r[8],W=this.r[9];r>=16;)c=f=0,c+=(S+=8191&(n=255&e[t+0]|(255&e[t+1])<<8))*j,c+=(k+=8191&(n>>>13|(i=255&e[t+2]|(255&e[t+3])<<8)<<3))*(5*W),c+=(x+=8191&(i>>>10|(o=255&e[t+4]|(255&e[t+5])<<8)<<6))*(5*q),c+=(R+=8191&(o>>>7|(a=255&e[t+6]|(255&e[t+7])<<8)<<9))*(5*z),f=(c+=(A+=8191&(a>>>4|(s=255&e[t+8]|(255&e[t+9])<<8)<<12))*(5*D))>>>13,c&=8191,c+=(T+=s>>>1&8191)*(5*P),c+=(B+=8191&(s>>>14|(u=255&e[t+10]|(255&e[t+11])<<8)<<2))*(5*N),c+=(O+=8191&(u>>>11|(h=255&e[t+12]|(255&e[t+13])<<8)<<5))*(5*C),c+=(M+=8191&(h>>>8|(l=255&e[t+14]|(255&e[t+15])<<8)<<8))*(5*I),d=f+=(c+=(L+=l>>>5|E)*(5*U))>>>13,d+=S*U,d+=k*j,d+=x*(5*W),d+=R*(5*q),f=(d+=A*(5*z))>>>13,d&=8191,d+=T*(5*D),d+=B*(5*P),d+=O*(5*N),d+=M*(5*C),f+=(d+=L*(5*I))>>>13,d&=8191,p=f,p+=S*I,p+=k*U,p+=x*j,p+=R*(5*W),f=(p+=A*(5*q))>>>13,p&=8191,p+=T*(5*z),p+=B*(5*D),p+=O*(5*P),p+=M*(5*N),g=f+=(p+=L*(5*C))>>>13,g+=S*C,g+=k*I,g+=x*U,g+=R*j,f=(g+=A*(5*W))>>>13,g&=8191,g+=T*(5*q),g+=B*(5*z),g+=O*(5*D),g+=M*(5*P),y=f+=(g+=L*(5*N))>>>13,y+=S*N,y+=k*C,y+=x*I,y+=R*U,f=(y+=A*j)>>>13,y&=8191,y+=T*(5*W),y+=B*(5*q),y+=O*(5*z),y+=M*(5*D),b=f+=(y+=L*(5*P))>>>13,b+=S*P,b+=k*N,b+=x*C,b+=R*I,f=(b+=A*U)>>>13,b&=8191,b+=T*j,b+=B*(5*W),b+=O*(5*q),b+=M*(5*z),m=f+=(b+=L*(5*D))>>>13,m+=S*D,m+=k*P,m+=x*N,m+=R*C,f=(m+=A*I)>>>13,m&=8191,m+=T*U,m+=B*j,m+=O*(5*W),m+=M*(5*q),v=f+=(m+=L*(5*z))>>>13,v+=S*z,v+=k*D,v+=x*P,v+=R*N,f=(v+=A*C)>>>13,v&=8191,v+=T*I,v+=B*U,v+=O*j,v+=M*(5*W),w=f+=(v+=L*(5*q))>>>13,w+=S*q,w+=k*z,w+=x*D,w+=R*P,f=(w+=A*N)>>>13,w&=8191,w+=T*C,w+=B*I,w+=O*U,w+=M*j,_=f+=(w+=L*(5*W))>>>13,_+=S*W,_+=k*q,_+=x*z,_+=R*D,f=(_+=A*P)>>>13,_&=8191,_+=T*N,_+=B*C,_+=O*I,_+=M*U,S=c=8191&(f=(f=((f+=(_+=L*j)>>>13)<<2)+f|0)+(c&=8191)|0),k=d+=f>>>=13,x=p&=8191,R=g&=8191,A=y&=8191,T=b&=8191,B=m&=8191,O=v&=8191,M=w&=8191,L=_&=8191,t+=16,r-=16;this.h[0]=S,this.h[1]=k,this.h[2]=x,this.h[3]=R,this.h[4]=A,this.h[5]=T,this.h[6]=B,this.h[7]=O,this.h[8]=M,this.h[9]=L},k.prototype.finish=function(e,t){var r,n,i,o,a=new Uint16Array(10);if(this.leftover){for(o=this.leftover,this.buffer[o++]=1;o<16;o++)this.buffer[o]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,o=2;o<10;o++)this.h[o]+=r,r=this.h[o]>>>13,this.h[o]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,a[0]=this.h[0]+5,r=a[0]>>>13,a[0]&=8191,o=1;o<10;o++)a[o]=this.h[o]+r,r=a[o]>>>13,a[o]&=8191;for(a[9]-=8192,n=(1^r)-1,o=0;o<10;o++)a[o]&=n;for(n=~n,o=0;o<10;o++)this.h[o]=this.h[o]&n|a[o];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),i=this.h[0]+this.pad[0],this.h[0]=65535&i,o=1;o<8;o++)i=(this.h[o]+this.pad[o]|0)+(i>>>16)|0,this.h[o]=65535&i;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},k.prototype.update=function(e,t,r){var n,i;if(this.leftover){for((i=16-this.leftover)>r&&(i=r),n=0;n=16&&(i=r-r%16,this.blocks(e,t,i),t+=i,r-=i),r){for(n=0;n=128;){for(E=0;E<16;E++)S=8*E+V,O[E]=r[S+0]<<24|r[S+1]<<16|r[S+2]<<8|r[S+3],M[E]=r[S+4]<<24|r[S+5]<<16|r[S+6]<<8|r[S+7];for(E=0;E<80;E++)if(i=L,o=j,a=U,s=I,u=C,h=N,l=P,c=z,d=q,p=W,g=F,y=K,b=Y,m=H,R=65535&(x=$),A=x>>>16,T=65535&(k=D),B=k>>>16,R+=65535&(x=(K>>>14|C<<18)^(K>>>18|C<<14)^(C>>>9|K<<23)),A+=x>>>16,T+=65535&(k=(C>>>14|K<<18)^(C>>>18|K<<14)^(K>>>9|C<<23)),B+=k>>>16,R+=65535&(x=K&Y^~K&H),A+=x>>>16,T+=65535&(k=C&N^~C&P),B+=k>>>16,R+=65535&(x=G[2*E+1]),A+=x>>>16,T+=65535&(k=G[2*E]),B+=k>>>16,k=O[E%16],A+=(x=M[E%16])>>>16,T+=65535&k,B+=k>>>16,T+=(A+=(R+=65535&x)>>>16)>>>16,R=65535&(x=_=65535&R|A<<16),A=x>>>16,T=65535&(k=w=65535&T|(B+=T>>>16)<<16),B=k>>>16,R+=65535&(x=(z>>>28|L<<4)^(L>>>2|z<<30)^(L>>>7|z<<25)),A+=x>>>16,T+=65535&(k=(L>>>28|z<<4)^(z>>>2|L<<30)^(z>>>7|L<<25)),B+=k>>>16,A+=(x=z&q^z&W^q&W)>>>16,T+=65535&(k=L&j^L&U^j&U),B+=k>>>16,f=65535&(T+=(A+=(R+=65535&x)>>>16)>>>16)|(B+=T>>>16)<<16,v=65535&R|A<<16,R=65535&(x=g),A=x>>>16,T=65535&(k=s),B=k>>>16,A+=(x=_)>>>16,T+=65535&(k=w),B+=k>>>16,j=i,U=o,I=a,C=s=65535&(T+=(A+=(R+=65535&x)>>>16)>>>16)|(B+=T>>>16)<<16,N=u,P=h,D=l,L=f,q=c,W=d,F=p,K=g=65535&R|A<<16,Y=y,H=b,$=m,z=v,E%16==15)for(S=0;S<16;S++)k=O[S],R=65535&(x=M[S]),A=x>>>16,T=65535&k,B=k>>>16,k=O[(S+9)%16],R+=65535&(x=M[(S+9)%16]),A+=x>>>16,T+=65535&k,B+=k>>>16,w=O[(S+1)%16],R+=65535&(x=((_=M[(S+1)%16])>>>1|w<<31)^(_>>>8|w<<24)^(_>>>7|w<<25)),A+=x>>>16,T+=65535&(k=(w>>>1|_<<31)^(w>>>8|_<<24)^w>>>7),B+=k>>>16,w=O[(S+14)%16],A+=(x=((_=M[(S+14)%16])>>>19|w<<13)^(w>>>29|_<<3)^(_>>>6|w<<26))>>>16,T+=65535&(k=(w>>>19|_<<13)^(_>>>29|w<<3)^w>>>6),B+=k>>>16,B+=(T+=(A+=(R+=65535&x)>>>16)>>>16)>>>16,O[S]=65535&T|B<<16,M[S]=65535&R|A<<16;R=65535&(x=z),A=x>>>16,T=65535&(k=L),B=k>>>16,k=e[0],A+=(x=t[0])>>>16,T+=65535&k,B+=k>>>16,B+=(T+=(A+=(R+=65535&x)>>>16)>>>16)>>>16,e[0]=L=65535&T|B<<16,t[0]=z=65535&R|A<<16,R=65535&(x=q),A=x>>>16,T=65535&(k=j),B=k>>>16,k=e[1],A+=(x=t[1])>>>16,T+=65535&k,B+=k>>>16,B+=(T+=(A+=(R+=65535&x)>>>16)>>>16)>>>16,e[1]=j=65535&T|B<<16,t[1]=q=65535&R|A<<16,R=65535&(x=W),A=x>>>16,T=65535&(k=U),B=k>>>16,k=e[2],A+=(x=t[2])>>>16,T+=65535&k,B+=k>>>16,B+=(T+=(A+=(R+=65535&x)>>>16)>>>16)>>>16,e[2]=U=65535&T|B<<16,t[2]=W=65535&R|A<<16,R=65535&(x=F),A=x>>>16,T=65535&(k=I),B=k>>>16,k=e[3],A+=(x=t[3])>>>16,T+=65535&k,B+=k>>>16,B+=(T+=(A+=(R+=65535&x)>>>16)>>>16)>>>16,e[3]=I=65535&T|B<<16,t[3]=F=65535&R|A<<16,R=65535&(x=K),A=x>>>16,T=65535&(k=C),B=k>>>16,k=e[4],A+=(x=t[4])>>>16,T+=65535&k,B+=k>>>16,B+=(T+=(A+=(R+=65535&x)>>>16)>>>16)>>>16,e[4]=C=65535&T|B<<16,t[4]=K=65535&R|A<<16,R=65535&(x=Y),A=x>>>16,T=65535&(k=N),B=k>>>16,k=e[5],A+=(x=t[5])>>>16,T+=65535&k,B+=k>>>16,B+=(T+=(A+=(R+=65535&x)>>>16)>>>16)>>>16,e[5]=N=65535&T|B<<16,t[5]=Y=65535&R|A<<16,R=65535&(x=H),A=x>>>16,T=65535&(k=P),B=k>>>16,k=e[6],A+=(x=t[6])>>>16,T+=65535&k,B+=k>>>16,B+=(T+=(A+=(R+=65535&x)>>>16)>>>16)>>>16,e[6]=P=65535&T|B<<16,t[6]=H=65535&R|A<<16,R=65535&(x=$),A=x>>>16,T=65535&(k=D),B=k>>>16,k=e[7],A+=(x=t[7])>>>16,T+=65535&k,B+=k>>>16,B+=(T+=(A+=(R+=65535&x)>>>16)>>>16)>>>16,e[7]=D=65535&T|B<<16,t[7]=$=65535&R|A<<16,V+=128,n-=128}return n}function X(e,t,r){var n,i=new Int32Array(8),o=new Int32Array(8),a=new Uint8Array(256),s=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,o[0]=4089235720,o[1]=2227873595,o[2]=4271175723,o[3]=1595750129,o[4]=2917565137,o[5]=725511199,o[6]=4215389547,o[7]=327033209,J(i,o,t,r),r%=128,n=0;n=0;--i)Q(e,t,n=r[i/8|0]>>(7&i)&1),Z(t,e),Z(e,e),Q(e,t,n)}function re(e,r){var n=[t(),t(),t(),t()];B(n[0],l),B(n[1],f),B(n[2],a),D(n[3],l,f),te(e,n,r)}function ne(e,n,i){var o,a=new Uint8Array(64),s=[t(),t(),t(),t()];for(i||r(n,32),X(a,n,32),a[0]&=248,a[31]&=127,a[31]|=64,re(s,a),ee(e,s),o=0;o<32;o++)n[o+32]=e[o];return 0}var ie=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 oe(e,t){var r,n,i,o;for(n=63;n>=32;--n){for(r=0,i=n-32,o=n-12;i>4)*ie[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=r*ie[i];for(n=0;n<32;n++)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function ae(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;oe(e,r)}function se(e,r,n,i){var o,a,s=new Uint8Array(64),u=new Uint8Array(64),h=new Uint8Array(64),l=new Float64Array(64),f=[t(),t(),t(),t()];X(s,i,32),s[0]&=248,s[31]&=127,s[31]|=64;var c=n+64;for(o=0;o>7&&P(e[0],o,e[0]),D(e[3],e[0],e[1]),0)}(d,i))return-1;for(s=0;s=0},e.sign.keyPair=function(){var e=new Uint8Array(fe),t=new Uint8Array(ce);return ne(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(pe(e),e.length!==ce)throw new Error("bad secret key size");for(var t=new Uint8Array(fe),r=0;re.replace("'",""),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.derivePath=e.isValidPath=e.getPublicKey=e.getMasterKeyFromSeed=void 0;const t=Ts,r=Bs.exports,n=Os;e.getMasterKeyFromSeed=e=>{const r=t("sha512","ed25519 seed").update(X.from(e,"hex")).digest();return{key:r.slice(0,32),chainCode:r.slice(32)}};e.getPublicKey=(e,t=!0)=>{const n=r.sign.keyPair.fromSeed(e).secretKey.subarray(32),i=X.alloc(1,0);return t?X.concat([i,X.from(n)]):X.from(n)},e.isValidPath=e=>!!n.pathRegex.test(e)&&!e.split("/").slice(1).map(n.replaceDerive).some(isNaN),e.derivePath=(r,i,o=2147483648)=>{if(!e.isValidPath(r))throw new Error("Invalid derivation path");const{key:a,chainCode:s}=e.getMasterKeyFromSeed(i);return r.split("/").slice(1).map(n.replaceDerive).map((e=>parseInt(e,10))).reduce(((e,r)=>(({key:e,chainCode:r},n)=>{const i=X.allocUnsafe(4);i.writeUInt32BE(n,0);const o=X.concat([X.alloc(1,0),e,i]),a=t("sha512",r).update(o).digest();return{key:a.slice(0,32),chainCode:a.slice(32)}})(e,r+o)),{key:a,chainCode:s})}}(Ue);var Ms=t(Ue);let Ls=(e={})=>{let t,{sk:r,keepPrivate:n=!1,seed:i=null}=e;if(r)t=Us(r);else{let e=Ns(i);t=e.vk,r=e.sk}return{sign:e=>Ps(r,e),verify:(e,r)=>Ds(t,e,r),vk:t,sk:n?void 0:r}};function js(e=null){var t=null;return t=null==e?I.sign.keyPair():I.sign.keyPair.fromSeed(e),{sk:new Uint8Array(t.secretKey.slice(0,32)),vk:new Uint8Array(t.secretKey.slice(32,64))}}function Us(e){return Cs(Is(e)).vk}function Is(e){return js(O(e))}function Cs(e){return{vk:B(e.vk),sk:B(e.sk)}}function Ns(e=null){return Cs(js(e))}function Ps(e,t){var r=Is(e),n=M(r.sk,r.vk);return B(I.sign.detached(t,n))}function Ds(e,t,r){var n=O(e),i=O(r);try{return I.sign.detached.verify(t,i,n)}catch(e){return!1}}var zs=Object.freeze({__proto__:null,create_wallet:Ls,generate_keys:js,get_vk:Us,format_to_keys:Is,keys_to_format:Cs,new_wallet:Ns,new_wallet_bip39:function(e,t=0){return function(e,t=0){let r;r=void 0!==e?e:C.exports.generateMnemonic(256);const n=C.exports.mnemonicToSeedSync(r).toString("hex"),i="m/44'/789'/"+t+"'/0'/0'",{key:o,chainCode:a}=Ms.derivePath(i,n,2147483648),s=o.toString("hex"),u=Ms.getPublicKey(o,!1).toString("hex");if(u!==Us(s))throw Error("Bip32 public key does not match with Lamden public key!");return{sk:s,vk:u,derivationIndex:t,mnemonic:r}}(e,t)},sign:Ps,verify:Ds});class qs{constructor(){this._events={}}on(e,t){this._events[e]||(this._events[e]=[]),this._events[e].push(t)}removeListener(e,t){if(!this._events[e])throw new Error(`Can't remove a listener. Event "${e}" doesn't exits.`);this._events[e]=this._events[e].filter((e=>e!==t))}emit(e,t){if(!this._events[e])return;this._events[e].forEach((e=>{e(t)}))}}var Ws={exports:{}};!function(e,t){var r=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r)return r;throw new Error("unable to locate global object")}();e.exports=t=r.fetch,r.fetch&&(t.default=r.fetch.bind(r)),t.Headers=r.Headers,t.Request=r.Request,t.Response=r.Response}(Ws,Ws.exports);var Fs,Ks=Ws.exports,Ys={exports:{}};Fs=Ys,function(e){var t,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,o="[BigNumber Error] ",a=o+"Number primitive has more than 15 significant digits: ",s=1e14,u=14,h=9007199254740991,l=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],f=1e7,c=1e9;function d(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,o=e[0]+"";nh^r?1:-1;for(s=(u=i.length)<(h=o.length)?u:h,a=0;ao[a]^r?1:-1;return u==h?0:u>h^r?1:-1}function y(e,t,r,n){if(er||e!==i(e))throw Error(o+(n||"Argument")+("number"==typeof e?er?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function b(e){var t=e.c.length-1;return d(e.e/u)==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 tN?g.c=g.e=null:e.e=10;f/=10,l++);return void(l>N?g.c=g.e=null:(g.e=l,g.c=[e]))}p=String(e)}else{if(!r.test(p=String(e)))return E(g,p,c);g.s=45==p.charCodeAt(0)?(p=p.slice(1),-1):1}(l=p.indexOf("."))>-1&&(p=p.replace(".","")),(f=p.search(/e/i))>0?(l<0&&(l=f),l+=+p.slice(f+1),p=p.substring(0,f)):l<0&&(l=p.length)}else{if(y(t,2,W.length,"Base"),10==t)return $(g=new F(e),L+g.e+1,j);if(p=String(e),c="number"==typeof e){if(0*e!=0)return E(g,p,c,t);if(g.s=1/e<0?(p=p.slice(1),-1):1,F.DEBUG&&p.replace(/^0\.0*|\./,"").length>15)throw Error(a+e)}else g.s=45===p.charCodeAt(0)?(p=p.slice(1),-1):1;for(n=W.slice(0,t),l=f=0,d=p.length;fl){l=d;continue}}else if(!s&&(p==p.toUpperCase()&&(p=p.toLowerCase())||p==p.toLowerCase()&&(p=p.toUpperCase()))){s=!0,f=-1,l=0;continue}return E(g,String(e),c,t)}c=!1,(l=(p=_(p,t,10,g.s)).indexOf("."))>-1?p=p.replace(".",""):l=p.length}for(f=0;48===p.charCodeAt(f);f++);for(d=p.length;48===p.charCodeAt(--d););if(p=p.slice(f,++d)){if(d-=f,c&&F.DEBUG&&d>15&&(e>h||e!==i(e)))throw Error(a+g.s*e);if((l=l-f-1)>N)g.c=g.e=null;else if(l=I)?m(u,a):v(u,a,"0");else if(o=(e=$(new F(e),t,r)).e,s=(u=p(e.c)).length,1==n||2==n&&(t<=o||o<=U)){for(;ss){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=o-s)>0)for(o+1==s&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function Y(e,t){for(var r,n=1,i=new F(e[0]);n=10;i/=10,n++);return(r=n+r*u-1)>N?e.c=e.e=null:r=10;c/=10,a++);if((h=t-a)<0)h+=u,f=t,g=(d=y[p=0])/b[a-f-1]%10|0;else if((p=n((h+1)/u))>=y.length){if(!o)break e;for(;y.length<=p;y.push(0));d=g=0,a=1,f=(h%=u)-u+1}else{for(d=c=y[p],a=1;c>=10;c/=10,a++);g=(f=(h%=u)-u+a)<0?0:d/b[a-f-1]%10|0}if(o=o||t<0||null!=y[p+1]||(f<0?d:d%b[a-f-1]),o=r<4?(g||o)&&(0==r||r==(e.s<0?3:2)):g>5||5==g&&(4==r||o||6==r&&(h>0?f>0?d/b[a-f]:0:y[p-1])%10&1||r==(e.s<0?8:7)),t<1||!y[0])return y.length=0,o?(t-=e.e+1,y[0]=b[(u-t%u)%u],e.e=-t||0):y[0]=e.e=0,e;if(0==h?(y.length=p,c=1,p--):(y.length=p+1,c=b[u-h],y[p]=f>0?i(d/b[a-f]%b[f])*c:0),o)for(;;){if(0==p){for(h=1,f=y[0];f>=10;f/=10,h++);for(f=y[0]+=c,c=1;f>=10;f/=10,c++);h!=c&&(e.e++,y[0]==s&&(y[0]=1));break}if(y[p]+=c,y[p]!=s)break;y[p--]=0,c=1}for(h=y.length;0===y[--h];y.pop());}e.e>N?e.c=e.e=null:e.e=I?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(o+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(y(r=e[t],0,c,t),L=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(y(r=e[t],0,8,t),j=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(y(r[0],-c,0,t),y(r[1],0,c,t),U=r[0],I=r[1]):(y(r,-c,c,t),U=-(I=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)y(r[0],-c,-1,t),y(r[1],1,c,t),C=r[0],N=r[1];else{if(y(r,-c,c,t),!r)throw Error(o+t+" cannot be zero: "+r);C=-(N=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(o+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw P=!r,Error(o+"crypto unavailable");P=r}else P=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(y(r=e[t],0,9,t),D=r),e.hasOwnProperty(t="POW_PRECISION")&&(y(r=e[t],0,c,t),z=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(o+t+" not an object: "+r);q=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(o+t+" invalid: "+r);W=r}}return{DECIMAL_PLACES:L,ROUNDING_MODE:j,EXPONENTIAL_AT:[U,I],RANGE:[C,N],CRYPTO:P,MODULO_MODE:D,POW_PRECISION:z,FORMAT:q,ALPHABET:W}},F.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!F.DEBUG)return!0;var t,r,n=e.c,a=e.e,h=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===h||-1===h)&&a>=-c&&a<=c&&a===i(a)){if(0===n[0]){if(0===a&&1===n.length)return!0;break e}if((t=(a+1)%u)<1&&(t+=u),String(n[0]).length==t){for(t=0;t=s||r!==i(r))break e;if(0!==r)return!0}}}else if(null===n&&null===a&&(null===h||1===h||-1===h))return!0;throw Error(o+"Invalid BigNumber: "+e)},F.maximum=F.max=function(){return Y(arguments,O.lt)},F.minimum=F.min=function(){return Y(arguments,O.gt)},F.random=(S=9007199254740992,k=Math.random()*S&2097151?function(){return i(Math.random()*S)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,a,s,h,f=0,d=[],p=new F(M);if(null==e?e=L:y(e,0,c),s=n(e/u),P)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(s*=2));f>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[f]=r[0],t[f+1]=r[1]):(d.push(h%1e14),f+=2);f=s/2}else{if(!crypto.randomBytes)throw P=!1,Error(o+"crypto unavailable");for(t=crypto.randomBytes(s*=7);f=9e15?crypto.randomBytes(7).copy(t,f):(d.push(h%1e14),f+=7);f=s/7}if(!P)for(;f=10;h/=10,f++);fr-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/r|0,a[i]%=r)}return a.reverse()}return function(r,n,i,o,a){var s,u,h,l,f,c,d,g,y=r.indexOf("."),b=L,m=j;for(y>=0&&(l=z,z=0,r=r.replace(".",""),c=(g=new F(n)).pow(r.length-y),z=l,g.c=t(v(p(c.c),c.e,"0"),10,i,e),g.e=g.c.length),h=l=(d=t(r,n,i,a?(s=W,e):(s=e,W))).length;0==d[--l];d.pop());if(!d[0])return s.charAt(0);if(y<0?--h:(c.c=d,c.e=h,c.s=o,d=(c=w(c,g,b,m,i)).c,f=c.r,h=c.e),y=d[u=h+b+1],l=i/2,f=f||u<0||null!=d[u+1],f=m<4?(null!=y||f)&&(0==m||m==(c.s<0?3:2)):y>l||y==l&&(4==m||f||6==m&&1&d[u-1]||m==(c.s<0?8:7)),u<1||!d[0])r=f?v(s.charAt(1),-b,s.charAt(0)):s.charAt(0);else{if(d.length=u,f)for(--i;++d[--u]>i;)d[u]=0,u||(++h,d=[1].concat(d));for(l=d.length;!d[--l];);for(y=0,r="";y<=l;r+=s.charAt(d[y++]));r=v(r,h,s.charAt(0))}return r}}(),w=function(){function e(e,t,r){var n,i,o,a,s=0,u=e.length,h=t%f,l=t/f|0;for(e=e.slice();u--;)s=((i=h*(o=e[u]%f)+(n=l*o+(a=e[u]/f|0)*h)%f*f+s)/r|0)+(n/f|0)+l*a,e[u]=i%r;return s&&(e=[s].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;it[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]1;e.splice(0,1));}return function(n,o,a,h,l){var f,c,p,g,y,b,m,v,w,_,E,S,k,x,R,A,T,B=n.s==o.s?1:-1,O=n.c,M=o.c;if(!(O&&O[0]&&M&&M[0]))return new F(n.s&&o.s&&(O?!M||O[0]!=M[0]:M)?O&&0==O[0]||!M?0*B:B/0:NaN);for(w=(v=new F(B)).c=[],B=a+(c=n.e-o.e)+1,l||(l=s,c=d(n.e/u)-d(o.e/u),B=B/u|0),p=0;M[p]==(O[p]||0);p++);if(M[p]>(O[p]||0)&&c--,B<0)w.push(1),g=!0;else{for(x=O.length,A=M.length,p=0,B+=2,(y=i(l/(M[0]+1)))>1&&(M=e(M,y,l),O=e(O,y,l),A=M.length,x=O.length),k=A,E=(_=O.slice(0,A)).length;E=l/2&&R++;do{if(y=0,(f=t(M,_,A,E))<0){if(S=_[0],A!=E&&(S=S*l+(_[1]||0)),(y=i(S/R))>1)for(y>=l&&(y=l-1),m=(b=e(M,y,l)).length,E=_.length;1==t(b,_,m,E);)y--,r(b,A=10;B/=10,p++);$(v,a+(v.e=p+c*u-1)+1,h,g)}else v.e=c,v.r=+g;return v}}(),x=/^(-?)0([xbo])(?=\w[\w.]*$)/i,R=/^([^.]+)\.$/,A=/^\.([^.]+)$/,T=/^-?(Infinity|NaN)$/,B=/^\s*\+(?=[\w.])|^\s+|\s+$/g,E=function(e,t,r,n){var i,a=r?t:t.replace(B,"");if(T.test(a))e.s=isNaN(a)?null:a<0?-1:1;else{if(!r&&(a=a.replace(x,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,a=a.replace(R,"$1").replace(A,"0.$1")),t!=a))return new F(a,i);if(F.DEBUG)throw Error(o+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},O.absoluteValue=O.abs=function(){var e=new F(this);return e.s<0&&(e.s=1),e},O.comparedTo=function(e,t){return g(this,new F(e,t))},O.decimalPlaces=O.dp=function(e,t){var r,n,i,o=this;if(null!=e)return y(e,0,c),null==t?t=j:y(t,0,8),$(new F(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-d(this.e/u))*u,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},O.dividedBy=O.div=function(e,t){return w(this,new F(e,t),L,j)},O.dividedToIntegerBy=O.idiv=function(e,t){return w(this,new F(e,t),0,1)},O.exponentiatedBy=O.pow=function(e,t){var r,a,s,h,l,f,c,d,p=this;if((e=new F(e)).c&&!e.isInteger())throw Error(o+"Exponent not an integer: "+V(e));if(null!=t&&(t=new F(t)),l=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return d=new F(Math.pow(+V(p),l?2-b(e):+V(e))),t?d.mod(t):d;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new F(NaN);(a=!f&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||l&&p.c[1]>=24e7:p.c[0]<8e13||l&&p.c[0]<=9999975e7)))return h=p.s<0&&b(e)?-0:0,p.e>-1&&(h=1/h),new F(f?1/h:h);z&&(h=n(z/u+2))}for(l?(r=new F(.5),f&&(e.s=1),c=b(e)):c=(s=Math.abs(+V(e)))%2,d=new F(M);;){if(c){if(!(d=d.times(p)).c)break;h?d.c.length>h&&(d.c.length=h):a&&(d=d.mod(t))}if(s){if(0===(s=i(s/2)))break;c=s%2}else if($(e=e.times(r),e.e+1,1),e.e>14)c=b(e);else{if(0==(s=+V(e)))break;c=s%2}p=p.times(p),h?p.c&&p.c.length>h&&(p.c.length=h):a&&(p=p.mod(t))}return a?d:(f&&(d=M.div(d)),t?d.mod(t):h?$(d,z,j,void 0):d)},O.integerValue=function(e){var t=new F(this);return null==e?e=j:y(e,0,8),$(t,t.e+1,e)},O.isEqualTo=O.eq=function(e,t){return 0===g(this,new F(e,t))},O.isFinite=function(){return!!this.c},O.isGreaterThan=O.gt=function(e,t){return g(this,new F(e,t))>0},O.isGreaterThanOrEqualTo=O.gte=function(e,t){return 1===(t=g(this,new F(e,t)))||0===t},O.isInteger=function(){return!!this.c&&d(this.e/u)>this.c.length-2},O.isLessThan=O.lt=function(e,t){return g(this,new F(e,t))<0},O.isLessThanOrEqualTo=O.lte=function(e,t){return-1===(t=g(this,new F(e,t)))||0===t},O.isNaN=function(){return!this.s},O.isNegative=function(){return this.s<0},O.isPositive=function(){return this.s>0},O.isZero=function(){return!!this.c&&0==this.c[0]},O.minus=function(e,t){var r,n,i,o,a=this,h=a.s;if(t=(e=new F(e,t)).s,!h||!t)return new F(NaN);if(h!=t)return e.s=-t,a.plus(e);var l=a.e/u,f=e.e/u,c=a.c,p=e.c;if(!l||!f){if(!c||!p)return c?(e.s=-t,e):new F(p?a:NaN);if(!c[0]||!p[0])return p[0]?(e.s=-t,e):new F(c[0]?a:3==j?-0:0)}if(l=d(l),f=d(f),c=c.slice(),h=l-f){for((o=h<0)?(h=-h,i=c):(f=l,i=p),i.reverse(),t=h;t--;i.push(0));i.reverse()}else for(n=(o=(h=c.length)<(t=p.length))?h:t,h=t=0;t0)for(;t--;c[r++]=0);for(t=s-1;n>h;){if(c[--n]=0;){for(r=0,y=S[i]%w,b=S[i]/w|0,o=i+(a=l);o>i;)r=((c=y*(c=E[--a]%w)+(h=b*c+(p=E[a]/w|0)*y)%w*w+m[o]+r)/v|0)+(h/w|0)+b*p,m[o--]=c%v;m[o]=r}return r?++n:m.splice(0,1),H(e,m,n)},O.negated=function(){var e=new F(this);return e.s=-e.s||null,e},O.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 o=n.e/u,a=e.e/u,h=n.c,l=e.c;if(!o||!a){if(!h||!l)return new F(i/0);if(!h[0]||!l[0])return l[0]?e:new F(h[0]?n:0*i)}if(o=d(o),a=d(a),h=h.slice(),i=o-a){for(i>0?(a=o,r=l):(i=-i,r=h),r.reverse();i--;r.push(0));r.reverse()}for((i=h.length)-(t=l.length)<0&&(r=l,l=h,h=r,t=i),i=0;t;)i=(h[--t]=h[t]+l[t]+i)/s|0,h[t]=s===h[t]?0:h[t]%s;return i&&(h=[i].concat(h),++a),H(e,h,a)},O.precision=O.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return y(e,1,c),null==t?t=j:y(t,0,8),$(new F(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*u+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},O.shiftedBy=function(e){return y(e,-9007199254740991,h),this.times("1e"+e)},O.squareRoot=O.sqrt=function(){var e,t,r,n,i,o=this,a=o.c,s=o.s,u=o.e,h=L+4,l=new F("0.5");if(1!==s||!a||!a[0])return new F(!s||s<0&&(!a||a[0])?NaN:a?o:1/0);if(0==(s=Math.sqrt(+V(o)))||s==1/0?(((t=p(a)).length+u)%2==0&&(t+="0"),s=Math.sqrt(+t),u=d((u+1)/2)-(u<0||u%2),r=new F(t=s==1/0?"1e"+u:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+u)):r=new F(s+""),r.c[0])for((s=(u=r.e)+h)<3&&(s=0);;)if(i=r,r=l.times(i.plus(w(o,i,h,1))),p(i.c).slice(0,s)===(t=p(r.c)).slice(0,s)){if(r.e0&&g>0){for(a=g%u||u,f=p.substr(0,a);a0&&(f+=l+p.slice(a)),d&&(f="-"+f)}n=c?f+(r.decimalSeparator||"")+((h=+r.fractionGroupSize)?c.replace(new RegExp("\\d{"+h+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):c):f}return(r.prefix||"")+n+(r.suffix||"")},O.toFraction=function(e){var t,r,n,i,a,s,h,f,c,d,g,y,b=this,m=b.c;if(null!=e&&(!(h=new F(e)).isInteger()&&(h.c||1!==h.s)||h.lt(M)))throw Error(o+"Argument "+(h.isInteger()?"out of range: ":"not an integer: ")+V(h));if(!m)return new F(b);for(t=new F(M),c=r=new F(M),n=f=new F(M),y=p(m),a=t.e=y.length-b.e-1,t.c[0]=l[(s=a%u)<0?u+s:s],e=!e||h.comparedTo(t)>0?a>0?t:c:h,s=N,N=1/0,h=new F(y),f.c[0]=0;d=w(h,t,0,1),1!=(i=r.plus(d.times(n))).comparedTo(e);)r=n,n=i,c=f.plus(d.times(i=c)),f=i,t=h.minus(d.times(i=t)),h=i;return i=w(e.minus(r),n,0,1),f=f.plus(i.times(c)),r=r.plus(i.times(n)),f.s=c.s=b.s,g=w(c,n,a*=2,j).minus(b).abs().comparedTo(w(f,r,a,j).minus(b).abs())<1?[c,n]:[f,r],N=s,g},O.toNumber=function(){return+V(this)},O.toPrecision=function(e,t){return null!=e&&y(e,1,c),K(this,e,t,2)},O.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<=U||i>=I?m(p(r.c),i):v(p(r.c),i,"0"):10===e?t=v(p((r=$(new F(r),L+i+1,j)).c),r.e,"0"):(y(e,2,W.length,"Base"),t=_(v(p(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},O.valueOf=O.toJSON=function(){return V(this)},O._isBigNumber=!0,null!=t&&F.set(t),F}(),t.default=t.BigNumber=t,Fs.exports?Fs.exports=t:(e||(e="undefined"!=typeof self&&self?self:window),e.BigNumber=t)}(e);var Hs=Ys.exports;function $s(e,t){const r=t=>{throw new Error(`Error encoding ${t} to ${e}`)},n=e=>{if(Math.floor(e)===e)return 0;try{return e.toString().split(".")[1].length}catch(e){return 0}},i=e=>e&&"object"==typeof e&&e.constructor===Array,o=e=>e&&"object"==typeof e&&e.constructor===Object,a=e=>e instanceof Date,s=e=>!i(e)&&!isNaN(l(e).toNumber()),u=e=>!!s(e)&&0!==n(e),h=e=>(s(e)||r(e),Hs.isBigNumber(e)||(e=new Hs(e)),{__fixed__:e.toFixed(30).replace(/^0+(\d)|(\d)0+$/gm,"$1$2")}),l=e=>(Hs.isBigNumber(e)||(e=new Hs(e)),e),f=e=>(e=>"boolean"==typeof e)(e)?e:"true"===e||1===e||"false"!==e&&0!==e&&void r(e),c=e=>(e=>"string"==typeof e||e instanceof String)(e)?e:a(e)?e.toISOString():JSON.stringify(e),d=e=>(e=a(e)?e:new Date(e),a(e)||r(e),{__time__:[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()]}),p=e=>{const t=a(e)?e.getTime():new Date(e).getTime(),r=parseInt(t/1e3/60/60/24);return{__delta__:[r,(t-24*r*60*60*1e3)/1e3]}},g=e=>{if(i(e))return b(e);try{e=JSON.parse(e)}catch(t){r(e)}if(i(e))return b(e);r(e)},y=e=>{if(o(e))return b(e);try{e=JSON.parse(e)}catch(t){r(e)}if(o(e))return b(e);r(e)};function b(e){let t=JSON.stringify(e,((e,t)=>"datetime"===e||"datetime.datetime"===e?$s("datetime.datetime",t):"timedelta"===e||"datetime.timedelta"===e?$s("datetime.timedelta",t):"__fixed__"!==e&&u(t)?h(t):t));return JSON.parse(t,((e,t)=>{const r=e=>1===Object.keys(e).length&&["datetime.datetime","datetime","datetime.timedelta","timedelta"].filter((t=>t===Object.keys(e)[0])).length>0;return t.constructor===Array&&t.map((e=>1===Object.keys(e).length&&r(t)?e[Object.keys(e)[0]]:e)),t.constructor===Object&&1===Object.keys(t).length&&r(t)?t[Object.keys(t)[0]]:t}))}const m={str:c,string:c,float:h,int:e=>{if(s(e))return parseInt(e);r(e)},bool:f,boolean:f,dict:y,list:g,Any:()=>t,"datetime.timedelta":p,"datetime.datetime":d,timedelta:p,datetime:d,number:e=>(s(e)||r(e),u(e)?(Hs.isBigNumber(e)||(e=new Hs(e)),{__fixed__:e.toFixed(30).replace(/^0+(\d)|(\d)0+$/gm,"$1$2")}):(e=>!!s(e)&&0===n(e))(e)?parseInt(e):void 0),object:e=>{try{return g(e)}catch(t){return y(e)}},bigNumber:l};if(Object.keys(m).includes(e))return m[e](t);throw new Error(`Error: ${e} is not a valid encoder type.`)}Hs.config({RANGE:[-30,30],EXPONENTIAL_AT:1e9}),Hs.set({DECIMAL_PLACES:30,ROUNDING_MODE:Hs.ROUND_DOWN}),$s.BigNumber=Hs;const{validateTypes:Vs}=o;class Gs{constructor(e){if(!Vs.isObjectWithKeys(e))throw new Error("Expected Object and got Type: "+typeof e);if(!Vs.isArrayWithValues(e.hosts))throw new Error("HOSTS Required (Type: Array)");this.hosts=this.validateHosts(e.hosts)}vaidateProtocol(e){if(["https://","http://"].map((t=>e.includes(t))).includes(!0))return e;throw new Error("Host String must include http:// or https://")}validateHosts(e){return e.map((e=>this.vaidateProtocol(e.toLowerCase())))}get host(){return this.hosts[Math.floor(Math.random()*this.hosts.length)]}get url(){return this.host}send(e,t,r,n,i){let o="";Object.keys(r).includes("parms")&&(o=this.createParms(r.parms));let a={};if("POST"===e){let t={"Content-Type":"application/json"};a.method=e,a.headers=t,a.body=r}return Ks(`${n||this.url}${t}${o}`,a).then((async e=>{if(200===e.status){let t=await e.json();return i(t,void 0),t}{let t=!!Vs.isStringWithValue(e.statusText)&&e.statusText;return i(void 0,t),t}})).catch((e=>i(void 0,e.toString())))}createParms(e){if(0===Object.keys(e).length)return"";let t="?";return Object.keys(e).forEach((r=>{t=`${t}${r}=${e[r]}&`})),t.slice(0,-1)}async getContractInfo(e){const t=e=>{try{if(e.name)return e}catch(e){}return null};let r=`/contracts/${e}`;return this.send("GET",r,{},void 0,((e,r)=>t(e))).then((e=>t(e)))}async getVariable(e,t,r=""){let n={};Vs.isStringWithValue(r)&&(n.key=r);let i=`/contracts/${e}/${t}/`;const o=e=>{try{if(e.value)return e.value}catch(e){}return null};return this.send("GET",i,{parms:n},void 0,((e,t)=>o(e))).then((e=>o(e)))}async getContractMethods(e){const t=e=>{try{if(e.methods)return e.methods}catch(e){}return[]};let r=`/contracts/${e}/methods`;return this.send("GET",r,{},void 0,((e,r)=>t(e))).then((e=>t(e)))}async getContractVariables(e){const t=e=>{try{if(e.variables)return e}catch(e){}return{}};let r=`/contracts/${e}/variables`;return this.send("GET",r,{},void 0,((e,r)=>t(e))).then((e=>t(e)))}async pingServer(){const e=e=>{try{if(e.status)return!0}catch(e){}return!1};let t=await this.send("GET","/ping",{},void 0,((t,r)=>e(t)));return e(t)}async getCurrencyBalance(e){let t=await this.getVariable("currency","balances",e);return t?t.__fixed__?$s("bigNumber",t.__fixed__):$s("bigNumber",t.toString()):$s("bigNumber",0)}async contractExists(e){const t=e=>{try{if(e.name)return!0}catch(e){}return!1};let r=`/contracts/${e}`;return this.send("GET",r,{},void 0,((e,r)=>t(e))).then((e=>t(e)))}async sendTransaction(e,t,r){return this.send("POST","/",JSON.stringify(e),t,((e,t)=>t?r?void r(void 0,t):t:r?void r(e,void 0):e))}async getNonce(e,t){if(!Vs.isStringHex(e))return`${e} is not a hex string.`;let r=`/nonce/${e}`,n=this.host;return this.send("GET",r,{},n,((r,i)=>i?t?void t(void 0,`Unable to get nonce for ${e} on network ${n}`):`Unable to get nonce for ${e} on network ${n}`:(r.masternode=n,t?void t(r,void 0):r)))}checkTransaction(e,t){const r={hash:e};return this.send("GET","/tx",{parms:r},void 0,((e,r)=>r?t?void t(void 0,r):r:t?void t(e,void 0):e))}}const{validateTypes:Js}=o;class Xs{constructor(e){if(!Js.isObjectWithKeys(e))throw new Error("Expected Network Info Object and got Type: "+typeof e);if(!Js.isArrayWithValues(e.hosts))throw new Error("HOSTS Required (Type: Array)");this.type=Js.isStringWithValue(e.type)?e.type.toLowerCase():"custom",this.events=new qs,this.hosts=this.validateHosts(e.hosts),this.currencySymbol=Js.isStringWithValue(e.currencySymbol)?e.currencySymbol:"TAU",this.name=Js.isStringWithValue(e.name)?e.name:"lamden network",this.lamden=!!Js.isBoolean(e.lamden)&&e.lamden,this.blockExplorer=Js.isStringWithValue(e.blockExplorer)?e.blockExplorer:void 0,this.online=!1;try{this.API=new Gs(e)}catch(e){throw new Error(e)}}vaidateProtocol(e){if(["https://","http://"].map((t=>e.includes(t))).includes(!0))return e;throw new Error("Host String must include http:// or https://")}validateHosts(e){return e.map((e=>this.vaidateProtocol(e.toLowerCase())))}async ping(e){return this.online=await this.API.pingServer(),this.events.emit("online",this.online),Js.isFunction(e)&&e(this.online),this.online}get host(){return this.hosts[Math.floor(Math.random()*this.hosts.length)]}get url(){return this.host}getNetworkInfo(){return{name:this.name,lamden:this.lamden,type:this.type,hosts:this.hosts,url:this.url,online:this.online}}}const{validateTypes:Zs}=o;class Qs extends Xs{constructor(e,t,r){if(Zs.isSpecificClass(e,"Network")?super(e.getNetworkInfo()):super(e),!Zs.isObjectWithKeys(t))throw new Error("txInfo object not found");if(!Zs.isStringHex(t.senderVk))throw new Error("Sender Public Key Required (Type: Hex String)");if(!Zs.isStringWithValue(t.contractName))throw new Error("Contract Name Required (Type: String)");if(!Zs.isStringWithValue(t.methodName))throw new Error("Method Required (Type: String)");if(!Zs.isInteger(t.stampLimit))throw new Error("Stamps Limit Required (Type: Integer)");if(this.uid=Zs.isStringWithValue(t.uid)?t.uid:void 0,this.sender=t.senderVk,this.contract=t.contractName,this.method=t.methodName,this.kwargs={},Zs.isObject(t.kwargs)&&(this.kwargs=t.kwargs),this.stampLimit=t.stampLimit,void 0!==t.nonce){if(!Zs.isInteger(t.nonce))throw new Error(`arg[6] Nonce is required to be an Integer, type ${typeof t.none} was given`);this.nonce=t.nonce}if(void 0!==t.processor){if(!Zs.isStringWithValue(t.processor))throw new Error(`arg[7] Processor is required to be a String, type ${typeof t.processor} was given`);this.processor=t.processor}this.signature,this.transactionSigned=!1,this.nonceResult={},this.txSendResult={errors:[]},this.txBlockResult={},this.txHash,this.txCheckResult={},this.txCheckAttempts=0,this.txCheckLimit=10,r&&(r.uid&&(this.uid=r.uid),Zs.isObjectWithKeys(r.txSendResult)&&(this.txSendResult=r.txSendResult),Zs.isObjectWithKeys(r.nonceResult)&&(this.nonceResult=r.nonceResult,Zs.isInteger(this.nonceResult.nonce)&&(this.nonce=this.nonceResult.nonce),Zs.isStringWithValue(this.nonceResult.processor)&&(this.processor=this.nonceResult.processor)),Zs.isObjectWithKeys(r.txSendResult)&&(this.txSendResult=r.txSendResult,this.txSendResult.hash&&(this.txHash=this.txSendResult.hash)),Zs.isObjectWithKeys(r.txBlockResult)&&(this.txBlockResult=r.txBlockResult),Zs.isObjectWithKeys(r.resultInfo)&&(this.resultInfo=r.resultInfo)),this.makePayload()}makePayload(){this.payload={contract:this.contract,function:this.method,kwargs:this.kwargs,nonce:this.nonce,processor:this.processor,sender:this.sender,stamps_supplied:this.stampLimit},this.sortedPayload=this.sortObject(this.payload)}makeTransaction(){this.tx={metadata:{signature:this.signature,timestamp:parseInt(+new Date/1e3)},payload:this.sortedPayload.orderedObj}}verifySignature(){if(!this.transactionSigned)throw new Error("Transaction has not be been signed. Use the sign() method first.");const e=Buffer.from(this.sortedPayload.json),t=new Uint8Array(e);return Ds(this.sender,t,this.signature)}sign(e,t){const r=Buffer.from(this.sortedPayload.json),n=new Uint8Array(r);this.signature=t?t.sign(n):Ps(e,n),this.transactionSigned=!0}sortObject(e){const t=(e=>{const t=e=>Object.prototype.toString.call(e),r=e=>"[object Object]"===t(e),n=e=>(Object.keys(e).forEach((i=>{var o;o=e[i],"[object Array]"===t(o)&&(e[i]=e[i].map((e=>r(e)?n(e):e))),r(e[i])&&(e[i]=n(e[i]))})),(e=>{const t={};return Object.keys(e).sort().forEach((r=>t[r]=e[r])),t})(e));if(!r(e))throw new TypeError("Not a valid Object");try{e=JSON.parse(JSON.stringify(e))}catch(e){throw new TypeError("Not a valid JSON Object")}return n(e)})(e);return{orderedObj:t,json:JSON.stringify(t)}}async getNonce(e){let t=(new Date).toUTCString();if(this.nonceResult=await this.API.getNonce(this.sender),void 0===this.nonceResult.nonce)throw new Error(this.nonceResult);return this.nonceResult.timestamp=t,this.nonce=this.nonceResult.nonce,this.processor=this.nonceResult.processor,this.nonceMasternode=this.nonceResult.masternode,this.makePayload(),e?e(this.nonceResult):this.nonceResult}async send(e,t,r){if(!Zs.isStringWithValue(e)&&!this.transactionSigned)throw new Error("Transation Not Signed: Private key needed or call sign() first");let n=(new Date).toUTCString();try{!isNaN(this.nonce)&&Zs.isStringWithValue(this.processor)||await this.getNonce(),Zs.isStringWithValue(e)&&this.sign(e),this.makeTransaction();let t=r;!t&&this.nonceMasternode&&(t=this.nonceMasternode);let n=await this.API.sendTransaction(this.tx,t);!n||Zs.isStringWithValue(n)?this.txSendResult.errors=[n||"Unknown Transaction Error"]:n.error?this.txSendResult.errors=[n.error]:this.txSendResult=n}catch(e){this.txSendResult.errors=[e.message]}return this.txSendResult.timestamp=n,this.handleMasterNodeResponse(this.txSendResult,t)}checkForTransactionResult(e){return new Promise((t=>{let r=setTimeout(async function n(){this.txCheckAttempts=this.txCheckAttempts+1;let i=await this.API.checkTransaction(this.txHash),o=!1,a=(new Date).toUTCString();"string"!=typeof i&&i?i.error?"Transaction not found."===i.error?this.txCheckAttempts0&&(Zs.isArray(this.txCheckResult.errors)||(this.txCheckResult.errors=[]),this.txCheckResult.errors.push("This transaction returned a non-zero status code")),this.txCheckResult.timestamp=a,clearTimeout(r),t(this.handleMasterNodeResponse(this.txCheckResult,e)))}.bind(this),1e3)}))}handleMasterNodeResponse(e,t){return Zs.isStringWithValue(e.hash)&&Zs.isStringWithValue(e.success)?(this.txHash=e.hash,this.setPendingBlockInfo()):(this.setBlockResultInfo(e),this.txBlockResult=e),this.events.emit("response",e,this.resultInfo.subtitle),Zs.isFunction(t)&&t(e),e}setPendingBlockInfo(){return this.resultInfo={title:"Transaction Pending",subtitle:"Your transaction was submitted and is being processed",message:`Tx Hash: ${this.txHash}`,type:"success"},this.resultInfo}setBlockResultInfo(e){let t=!1,r="returned an error and ",n=Zs.isNumber(e.status)?e.status:void 0,i=e.stampsUsed||e.stamps_used||0,o="";return Zs.isArrayWithValues(e.errors)&&(t=!0,o=`This transaction returned ${e.errors.length} errors.`,e.result&&e.result.includes("AssertionError")&&e.errors.push(e.result)),n&&t&&(r=`returned status code ${n} and `),this.resultInfo={title:"Transaction "+(t?"Failed":"Successful"),subtitle:`Your transaction ${t?`${r} `:""}used ${i} stamps`,message:o,type:""+(t?"error":"success"),errorInfo:t?e.errors:void 0,returnResult:e.result||"",stampsUsed:i,statusCode:n},this.resultInfo}getResultInfo(){return this.resultInfo}getTxInfo(){return{senderVk:this.sender,contractName:this.contract,methodName:this.method,kwargs:this.kwargs,stampLimit:this.stampLimit}}getAllInfo(){return{uid:this.uid,txHash:this.txHash,signed:this.transactionSigned,tx:this.tx,signature:this.signature,networkInfo:this.getNetworkInfo(),txInfo:this.getTxInfo(),txSendResult:this.txSendResult,txBlockResult:this.txBlockResult,resultInfo:this.getResultInfo(),nonceResult:this.nonceResult}}}const{validateTypes:eu}=o;const{validateTypes:tu,assertTypes:ru}=o;globalThis.Buffer=Ne.Buffer;var nu={TransactionBuilder:Qs,TransactionBatcher:class extends Xs{constructor(e){eu.isSpecificClass(e,"Network")?super(e.getNetworkInfo()):super(e),this.txBatches={},this.overflow=[],this.nonceResults={},this.running=!1}addTransaction(e){this.running?this.overflow.push(e):(this.validateTransactionInfo(e),this.txBatches[e.senderVk]||(this.txBatches[e.senderVk]=[]),this.txBatches[e.senderVk].push(e))}addTransactionList(e){e.forEach((e=>this.addTransaction(e)))}processOverflow(){const e=this.overflow;this.overflow=[],e.forEach((e=>this.addTransaction(e)))}hasTransactions(){let e=Object.keys(this.txBatches).map((e=>this.txBatches[e].length));return e.filter((e=>0===e)),e.length>0}validateTransactionInfo(e){try{new Qs(e)}catch(e){return!1}return!0}async getStartingNonce(e,t){let r=(new Date).toUTCString(),n=await this.API.getNonce(e);if(void 0===n.nonce)throw new Error(n);return n.timestamp=r,this.nonceResults[e]=n,t&&t(n),n}async sendAllBatches(e){if(this.running)return;let t=[];this.running=!0,await Promise.all(Object.keys(this.txBatches).map((r=>{const n=this.txBatches[r].splice(0,15);return n.length<=15&&delete this.txBatches[r],new Promise((async i=>{if(0===n.length&&i(),!e[r])throw new Error(`Cannot sign batch for ${r}. No signing key provided.`);let o=await this.getStartingNonce(r),a=this.setBatchNonces(o,n);this.signBatch(a,e[r]),this.sendBatch(a).then((e=>{t=[...t,...e],i()}))}))})));try{return Promise.all(t)}catch(e){}finally{this.running=!1,this.processOverflow()}}setBatchNonces(e,t){return t.map(((t,r)=>(t.nonce=e.nonce+r,t.processor=e.processor,new Qs({hosts:[e.masternode]},t)))).sort(((e,t)=>e.nonce-t.nonce))}signBatch(e,t){e.forEach((e=>e.sign(t)))}sendBatch(e){let t=[];return new Promise((r=>{e.forEach(((n,i)=>{setTimeout((()=>{t[i]=n.send().then((()=>n)),(n=>{n+1===e.length&&r(t)})(i)}),1200*i)}))}))}},Masternode_API:Gs,Network:Xs,wallet:zs,Keystore:class{constructor(e){this.KEYSTORE_VERSION="1.0",this.password=null,this.encryptedData=null,this.keyList=(()=>{let e=[],t=this,r=[];const n=t=>{e.push(t),i()},i=()=>{r=[],e.forEach((e=>{let t=Ls({sk:e.sk,keepPrivate:!0});t={...t,...e},delete t.sk,r.push(t)}))};return{getWallets:()=>r,getWallet:e=>r.find((t=>t.vk===e)),addKey:n,clearKeys:()=>{e=[],i()},numOfKeys:()=>e.length,deleteKey:t=>{e.splice(t,1),i()},createKeystore:(r,n)=>JSON.stringify({data:x(r,{version:t.KEYSTORE_VERSION,keyList:e}),w:n?A("n1ahcKc0lb",n):""}),decryptKeystore:(e,r)=>{let i=R(e,r);if(!i)throw new Error("Incorrect Keystore Password.");ru.isArray(i.keyList),i.keyList.forEach((e=>ru.isStringWithValue(e.sk))),i.keyList.forEach((e=>n(e))),t.version=i.version}}})(),e&&(e.key&&this.addKey(e.key),e.keyList&&this.addKeys(e.keyList),e.keystoreData&&this.addKeystoreData(e.keystoreData))}addKeys(e){ru.isArray(e),e.forEach((e=>this.addKey(e)))}addKey(e){ru.isObjectWithKeys(e),ru.isStringWithValue(e.sk),tu.isStringWithValue(e.vk)&&delete e.vk,this.keyList.addKey(e)}addKeystoreData(e){tu.isString(e)&&(e=JSON.parse(e)),this.validateKeyStore(e)&&(this.encryptedData=e)}getPasswordHint(e){if(!this.encryptedData&&!e)throw new Error("No keystore data found.");return e?tu.isString(e)&&(e=JSON.parse(e)):e=this.encryptedData,e.w?T("n1ahcKc0lb",e.w):""}deleteKey(e){if(ru.isInteger(e),0!==this.keyList.numOfKeys()){if(e<0||e>=this.keyList.numOfKeys())throw new Error("Key index out of range.");this.keyList.deleteKey(e)}}clearKeys(){this.keyList.clearKeys()}get wallets(){return this.keyList.getWallets()}getWallet(e){return this.keyList.getWallet(e)}validateKeyStore(e){ru.isObjectWithKeys(e);try{let t=JSON.parse(e.data);if(!t.ct||!t.iv||!t.s)throw new Error("This is not a valid keystore file.")}catch(e){throw new Error("This is not a valid keystore file.")}return!0}createKeystore(e,t){return ru.isStringWithValue(e),t&&ru.isStringWithValue(t),this.keyList.createKeystore(e,t)}decryptKeystore(e,t){if(t&&this.addKeystoreData(t),!this.encryptedData)throw new Error("No keystoreData to decrypt.");try{this.keyList.decryptKeystore(e,this.encryptedData.data)}catch(e){throw new Error("Incorrect Keystore Password.")}}},Encoder:$s,utils:L};export{nu as default}; +!function(e,t){var r=Ne,n=r.Buffer;function i(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=o),o.prototype=Object.create(n.prototype),i(n,o),o.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}}(Fr,Fr.exports);var Kr={exports:{}},Yr=r(at),Hr=Yr.EventEmitter;function $r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Vr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Gr(e,t){for(var r=0;r0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return Jr.alloc(0);for(var t,r,n,i=Jr.allocUnsafe(e>>>0),o=this.head,a=0;o;)t=o.data,r=i,n=a,Jr.prototype.copy.call(t,r,n),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=Jr.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:Zr,value:function(e,t){return Xr(this,function(e){for(var t=1;t2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}sn("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),sn("ERR_INVALID_ARG_TYPE",(function(e,t,r){var n,i,o,a;if("string"==typeof t&&(i="not ",t.substr(!o||o<0?0:+o,i.length)===i)?(n="must not be",t=t.replace(/^not /,"")):n="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))a="The ".concat(e," ").concat(n," ").concat(un(t,"type"));else{var s=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";a='The "'.concat(e,'" ').concat(s," ").concat(n," ").concat(un(t,"type"))}return a+=". Received type ".concat(typeof r)}),TypeError),sn("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),sn("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),sn("ERR_STREAM_PREMATURE_CLOSE","Premature close"),sn("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),sn("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),sn("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),sn("ERR_STREAM_WRITE_AFTER_END","write after end"),sn("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),sn("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),sn("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),on.codes=an;var hn=on.codes.ERR_INVALID_OPT_VALUE;var ln={getHighWaterMark:function(e,t,r,n){var i=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new hn(n?r:"highWaterMark",i);return Math.floor(i)}return e.objectMode?16:16384}},fn={exports:{}};"function"==typeof Object.create?fn.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:fn.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}};var cn=function(e,t){if(dn("noDeprecation"))return e;var r=!1;return function(){if(!r){if(dn("throwDeprecation"))throw new Error(t);dn("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}};function dn(t){try{if(!e.localStorage)return!1}catch(e){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}var pn,gn=Cn;function yn(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;e.entry=null;for(;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}Cn.WritableState=In;var bn={deprecate:cn},mn=Hr,vn=Ne.Buffer,wn=e.Uint8Array||function(){};var _n,En=nn,Sn=ln.getHighWaterMark,kn=on.codes,xn=kn.ERR_INVALID_ARG_TYPE,Rn=kn.ERR_METHOD_NOT_IMPLEMENTED,An=kn.ERR_MULTIPLE_CALLBACK,Tn=kn.ERR_STREAM_CANNOT_PIPE,Bn=kn.ERR_STREAM_DESTROYED,On=kn.ERR_STREAM_NULL_VALUES,Mn=kn.ERR_STREAM_WRITE_AFTER_END,Ln=kn.ERR_UNKNOWN_ENCODING,jn=En.errorOrDestroy;function Un(){}function In(e,t,r){pn=pn||Kn,e=e||{},"boolean"!=typeof r&&(r=t instanceof pn),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=Sn(this,e,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=!1===e.decodeStrings;this.decodeStrings=!n,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if("function"!=typeof i)throw new An;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,i){--t.pendingcb,r?(Mt.nextTick(i,n),Mt.nextTick(Wn,e,t),e._writableState.errorEmitted=!0,jn(e,n)):(i(n),e._writableState.errorEmitted=!0,jn(e,n),Wn(e,t))}(e,r,n,t,i);else{var o=zn(r)||e.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||Dn(e,r),n?Mt.nextTick(Pn,e,r,o,i):Pn(e,r,o,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new yn(this)}function Cn(e){var t=this instanceof(pn=pn||Kn);if(!t&&!_n.call(Cn,this))return new Cn(e);this._writableState=new In(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),mn.call(this)}function Nn(e,t,r,n,i,o,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new Bn("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function Pn(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),Wn(e,t)}function Dn(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),o=t.corkedRequestsFree;o.entry=r;for(var a=0,s=!0;r;)i[a]=r,r.isBuf||(s=!1),r=r.next,a+=1;i.allBuffers=s,Nn(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new yn(t),t.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,h=r.encoding,l=r.callback;if(Nn(e,t,!1,t.objectMode?1:u.length,u,h,l),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function zn(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function qn(e,t){e._final((function(r){t.pendingcb--,r&&jn(e,r),t.prefinished=!0,e.emit("prefinish"),Wn(e,t)}))}function Wn(e,t){var r=zn(t);if(r&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,Mt.nextTick(qn,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}fn.exports(Cn,mn),In.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(In.prototype,"buffer",{get:bn.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(_n=Function.prototype[Symbol.hasInstance],Object.defineProperty(Cn,Symbol.hasInstance,{value:function(e){return!!_n.call(this,e)||this===Cn&&(e&&e._writableState instanceof In)}})):_n=function(e){return e instanceof this},Cn.prototype.pipe=function(){jn(this,new Tn)},Cn.prototype.write=function(e,t,r){var n,i=this._writableState,o=!1,a=!i.objectMode&&(n=e,vn.isBuffer(n)||n instanceof wn);return a&&!vn.isBuffer(e)&&(e=function(e){return vn.from(e)}(e)),"function"==typeof t&&(r=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof r&&(r=Un),i.ending?function(e,t){var r=new Mn;jn(e,r),Mt.nextTick(t,r)}(this,r):(a||function(e,t,r,n){var i;return null===r?i=new On:"string"==typeof r||t.objectMode||(i=new xn("chunk",["string","Buffer"],r)),!i||(jn(e,i),Mt.nextTick(n,i),!1)}(this,i,e,r))&&(i.pendingcb++,o=function(e,t,r,n,i,o){if(!r){var a=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=vn.from(t,r));return t}(t,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=t.objectMode?1:n.length;t.length+=s;var u=t.length-1))throw new Ln(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(Cn.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Cn.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Cn.prototype._write=function(e,t,r){r(new Rn("_write()"))},Cn.prototype._writev=null,Cn.prototype.end=function(e,t,r){var n=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,t,r){t.ending=!0,Wn(e,t),r&&(t.finished?Mt.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r),this},Object.defineProperty(Cn.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(Cn.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),Cn.prototype.destroy=En.destroy,Cn.prototype._undestroy=En.undestroy,Cn.prototype._destroy=function(e,t){t(e)};var Fn=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t},Kn=Jn,Yn=wi,Hn=gn;fn.exports(Jn,Yn);for(var $n=Fn(Hn.prototype),Vn=0;Vn<$n.length;Vn++){var Gn=$n[Vn];Jn.prototype[Gn]||(Jn.prototype[Gn]=Hn.prototype[Gn])}function Jn(e){if(!(this instanceof Jn))return new Jn(e);Yn.call(this,e),Hn.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",Xn)))}function Xn(){this._writableState.ended||Mt.nextTick(Zn,this)}function Zn(e){e.end()}Object.defineProperty(Jn.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(Jn.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Jn.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(Jn.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}});var Qn=on.codes.ERR_STREAM_PREMATURE_CLOSE;function ei(){}var ti,ri=function e(t,r,n){if("function"==typeof r)return e(t,null,r);r||(r={}),n=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i0)if("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===Si.prototype||(t=function(e){return Si.from(e)}(t)),n)a.endEmitted?Pi(e,new Ni):Fi(e,a,t,!0);else if(a.ended)Pi(e,new Ii);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(t=a.decoder.write(t),a.objectMode||0!==t.length?Fi(e,a,t,!1):$i(e,a)):Fi(e,a,t,!1)}else n||(a.reading=!1,$i(e,a));return!a.ended&&(a.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=1073741824?e=1073741824:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function Yi(e){var t=e._readableState;xi("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(xi("emitReadable",t.flowing),t.emittedReadable=!0,Mt.nextTick(Hi,e))}function Hi(e){var t=e._readableState;xi("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,Zi(e)}function $i(e,t){t.readingMore||(t.readingMore=!0,Mt.nextTick(Vi,e,t))}function Vi(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function Ji(e){xi("readable nexttick read 0"),e.read(0)}function Xi(e,t){xi("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),Zi(e),t.flowing&&!t.reading&&e.read(0)}function Zi(e){var t=e._readableState;for(xi("flow",t.flowing);t.flowing&&null!==e.read(););}function Qi(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function eo(e){var t=e._readableState;xi("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,Mt.nextTick(to,t,e))}function to(e,t){if(xi("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function ro(e,t){for(var r=0,n=e.length;r=t.highWaterMark:t.length>0)||t.ended))return xi("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?eo(this):Yi(this),null;if(0===(e=Ki(e,t))&&t.ended)return 0===t.length&&eo(this),null;var n,i=t.needReadable;return xi("need readable",i),(0===t.length||t.length-e0?Qi(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&eo(this)),null!==n&&this.emit("data",n),n},qi.prototype._read=function(e){Pi(this,new Ci("_read()"))},qi.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,xi("pipe count=%d opts=%j",n.pipesCount,t);var i=(!t||!1!==t.end)&&e!==Mt.stdout&&e!==Mt.stderr?a:d;function o(t,i){xi("onunpipe"),t===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,xi("cleanup"),e.removeListener("close",f),e.removeListener("finish",c),e.removeListener("drain",s),e.removeListener("error",l),e.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",d),r.removeListener("data",h),u=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||s())}function a(){xi("onend"),e.end()}n.endEmitted?Mt.nextTick(i):r.once("end",i),e.on("unpipe",o);var s=function(e){return function(){var t=e._readableState;xi("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&_i(e,"data")&&(t.flowing=!0,Zi(e))}}(r);e.on("drain",s);var u=!1;function h(t){xi("ondata");var i=e.write(t);xi("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==ro(n.pipes,e))&&!u&&(xi("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function l(t){xi("onerror",t),d(),e.removeListener("error",l),0===_i(e,"error")&&Pi(e,t)}function f(){e.removeListener("finish",c),d()}function c(){xi("onfinish"),e.removeListener("close",f),d()}function d(){xi("unpipe"),r.unpipe(e)}return r.on("data",h),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",l),e.once("close",f),e.once("finish",c),e.emit("pipe",r),n.flowing||(xi("pipe resume"),r.resume()),e},qi.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,xi("on readable",n.length,n.reading),n.length?Yi(this):n.reading||Mt.nextTick(Ji,this))),r},qi.prototype.addListener=qi.prototype.on,qi.prototype.removeListener=function(e,t){var r=Ei.prototype.removeListener.call(this,e,t);return"readable"===e&&Mt.nextTick(Gi,this),r},qi.prototype.removeAllListeners=function(e){var t=Ei.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||Mt.nextTick(Gi,this),t},qi.prototype.resume=function(){var e=this._readableState;return e.flowing||(xi("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,Mt.nextTick(Xi,e,t))}(this,e)),e.paused=!1,this},qi.prototype.pause=function(){return xi("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(xi("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},qi.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(xi("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(xi("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o0,(function(e){n||(n=e),e&&o.forEach(ko),a||(o.forEach(ko),i(n))}))}));return t.reduce(xo)};!function(e,t){(t=Kr.exports=wi).Stream=t,t.Readable=t,t.Writable=gn,t.Duplex=Kn,t.Transform=no,t.PassThrough=yo,t.finished=ri,t.pipeline=Ao}(0,Kr.exports);var To=Fr.exports.Buffer,Bo=Kr.exports.Transform;function Oo(e){Bo.call(this),this._block=To.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}(0,fn.exports)(Oo,Bo),Oo.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(e){n=e}r(n)},Oo.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},Oo.prototype.update=function(e,t){if(function(e,t){if(!To.isBuffer(e)&&"string"!=typeof e)throw new TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");To.isBuffer(e)||(e=To.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var i=this._blockOffset;i0;++o)this._length[o]+=a,(a=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*a);return this},Oo.prototype._update=function(){throw new Error("_update is not implemented")},Oo.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},Oo.prototype._digest=function(){throw new Error("_digest is not implemented")};var Mo=Oo,Lo=Ie.exports,jo=Mo,Uo=Ce.exports.Buffer,Io=new Array(16);function Co(){jo.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function No(e,t){return e<>>32-t}function Po(e,t,r,n,i,o,a){return No(e+(t&r|~t&n)+i+o|0,a)+t|0}function Do(e,t,r,n,i,o,a){return No(e+(t&n|r&~n)+i+o|0,a)+t|0}function zo(e,t,r,n,i,o,a){return No(e+(t^r^n)+i+o|0,a)+t|0}function qo(e,t,r,n,i,o,a){return No(e+(r^(t|~n))+i+o|0,a)+t|0}Lo(Co,jo),Co.prototype._update=function(){for(var e=Io,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,o=this._d;r=Po(r,n,i,o,e[0],3614090360,7),o=Po(o,r,n,i,e[1],3905402710,12),i=Po(i,o,r,n,e[2],606105819,17),n=Po(n,i,o,r,e[3],3250441966,22),r=Po(r,n,i,o,e[4],4118548399,7),o=Po(o,r,n,i,e[5],1200080426,12),i=Po(i,o,r,n,e[6],2821735955,17),n=Po(n,i,o,r,e[7],4249261313,22),r=Po(r,n,i,o,e[8],1770035416,7),o=Po(o,r,n,i,e[9],2336552879,12),i=Po(i,o,r,n,e[10],4294925233,17),n=Po(n,i,o,r,e[11],2304563134,22),r=Po(r,n,i,o,e[12],1804603682,7),o=Po(o,r,n,i,e[13],4254626195,12),i=Po(i,o,r,n,e[14],2792965006,17),r=Do(r,n=Po(n,i,o,r,e[15],1236535329,22),i,o,e[1],4129170786,5),o=Do(o,r,n,i,e[6],3225465664,9),i=Do(i,o,r,n,e[11],643717713,14),n=Do(n,i,o,r,e[0],3921069994,20),r=Do(r,n,i,o,e[5],3593408605,5),o=Do(o,r,n,i,e[10],38016083,9),i=Do(i,o,r,n,e[15],3634488961,14),n=Do(n,i,o,r,e[4],3889429448,20),r=Do(r,n,i,o,e[9],568446438,5),o=Do(o,r,n,i,e[14],3275163606,9),i=Do(i,o,r,n,e[3],4107603335,14),n=Do(n,i,o,r,e[8],1163531501,20),r=Do(r,n,i,o,e[13],2850285829,5),o=Do(o,r,n,i,e[2],4243563512,9),i=Do(i,o,r,n,e[7],1735328473,14),r=zo(r,n=Do(n,i,o,r,e[12],2368359562,20),i,o,e[5],4294588738,4),o=zo(o,r,n,i,e[8],2272392833,11),i=zo(i,o,r,n,e[11],1839030562,16),n=zo(n,i,o,r,e[14],4259657740,23),r=zo(r,n,i,o,e[1],2763975236,4),o=zo(o,r,n,i,e[4],1272893353,11),i=zo(i,o,r,n,e[7],4139469664,16),n=zo(n,i,o,r,e[10],3200236656,23),r=zo(r,n,i,o,e[13],681279174,4),o=zo(o,r,n,i,e[0],3936430074,11),i=zo(i,o,r,n,e[3],3572445317,16),n=zo(n,i,o,r,e[6],76029189,23),r=zo(r,n,i,o,e[9],3654602809,4),o=zo(o,r,n,i,e[12],3873151461,11),i=zo(i,o,r,n,e[15],530742520,16),r=qo(r,n=zo(n,i,o,r,e[2],3299628645,23),i,o,e[0],4096336452,6),o=qo(o,r,n,i,e[7],1126891415,10),i=qo(i,o,r,n,e[14],2878612391,15),n=qo(n,i,o,r,e[5],4237533241,21),r=qo(r,n,i,o,e[12],1700485571,6),o=qo(o,r,n,i,e[3],2399980690,10),i=qo(i,o,r,n,e[10],4293915773,15),n=qo(n,i,o,r,e[1],2240044497,21),r=qo(r,n,i,o,e[8],1873313359,6),o=qo(o,r,n,i,e[15],4264355552,10),i=qo(i,o,r,n,e[6],2734768916,15),n=qo(n,i,o,r,e[13],1309151649,21),r=qo(r,n,i,o,e[4],4149444226,6),o=qo(o,r,n,i,e[11],3174756917,10),i=qo(i,o,r,n,e[2],718787259,15),n=qo(n,i,o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},Co.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=Uo.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};var Wo=Co,Fo=Ne.Buffer,Ko=Ie.exports,Yo=Mo,Ho=new Array(16),$o=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],Vo=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Go=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Jo=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Xo=[0,1518500249,1859775393,2400959708,2840853838],Zo=[1352829926,1548603684,1836072691,2053994217,0];function Qo(){Yo.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function ea(e,t){return e<>>32-t}function ta(e,t,r,n,i,o,a,s){return ea(e+(t^r^n)+o+a|0,s)+i|0}function ra(e,t,r,n,i,o,a,s){return ea(e+(t&r|~t&n)+o+a|0,s)+i|0}function na(e,t,r,n,i,o,a,s){return ea(e+((t|~r)^n)+o+a|0,s)+i|0}function ia(e,t,r,n,i,o,a,s){return ea(e+(t&n|r&~n)+o+a|0,s)+i|0}function oa(e,t,r,n,i,o,a,s){return ea(e+(t^(r|~n))+o+a|0,s)+i|0}Ko(Qo,Yo),Qo.prototype._update=function(){for(var e=Ho,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,s=0|this._a,u=0|this._b,h=0|this._c,l=0|this._d,f=0|this._e,c=0;c<80;c+=1){var d,p;c<16?(d=ta(r,n,i,o,a,e[$o[c]],Xo[0],Go[c]),p=oa(s,u,h,l,f,e[Vo[c]],Zo[0],Jo[c])):c<32?(d=ra(r,n,i,o,a,e[$o[c]],Xo[1],Go[c]),p=ia(s,u,h,l,f,e[Vo[c]],Zo[1],Jo[c])):c<48?(d=na(r,n,i,o,a,e[$o[c]],Xo[2],Go[c]),p=na(s,u,h,l,f,e[Vo[c]],Zo[2],Jo[c])):c<64?(d=ia(r,n,i,o,a,e[$o[c]],Xo[3],Go[c]),p=ra(s,u,h,l,f,e[Vo[c]],Zo[3],Jo[c])):(d=oa(r,n,i,o,a,e[$o[c]],Xo[4],Go[c]),p=ta(s,u,h,l,f,e[Vo[c]],Zo[4],Jo[c])),r=a,a=o,o=ea(i,10),i=n,n=d,s=f,f=l,l=ea(h,10),h=u,u=p}var g=this._b+i+l|0;this._b=this._c+o+f|0,this._c=this._d+a+s|0,this._d=this._e+r+u|0,this._e=this._a+n+h|0,this._a=g},Qo.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=Fo.alloc?Fo.alloc(20):new Fo(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e};var aa=Qo,sa={exports:{}},ua=Ce.exports.Buffer;function ha(e,t){this._block=ua.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}ha.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=ua.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,o=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},ha.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var la=ha,fa=Ie.exports,ca=la,da=Ce.exports.Buffer,pa=[1518500249,1859775393,-1894007588,-899497514],ga=new Array(80);function ya(){this.init(),this._w=ga,ca.call(this,64,56)}function ba(e){return e<<30|e>>>2}function ma(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}fa(ya,ca),ya.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},ya.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0;u<16;++u)r[u]=e.readInt32BE(4*u);for(;u<80;++u)r[u]=r[u-3]^r[u-8]^r[u-14]^r[u-16];for(var h=0;h<80;++h){var l=~~(h/20),f=0|((t=n)<<5|t>>>27)+ma(l,i,o,a)+s+r[h]+pa[l];s=a,a=o,o=ba(i),i=n,n=f}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},ya.prototype._hash=function(){var e=da.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var va=ya,wa=Ie.exports,_a=la,Ea=Ce.exports.Buffer,Sa=[1518500249,1859775393,-1894007588,-899497514],ka=new Array(80);function xa(){this.init(),this._w=ka,_a.call(this,64,56)}function Ra(e){return e<<5|e>>>27}function Aa(e){return e<<30|e>>>2}function Ta(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}wa(xa,_a),xa.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},xa.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0;u<16;++u)r[u]=e.readInt32BE(4*u);for(;u<80;++u)r[u]=(t=r[u-3]^r[u-8]^r[u-14]^r[u-16])<<1|t>>>31;for(var h=0;h<80;++h){var l=~~(h/20),f=Ra(n)+Ta(l,i,o,a)+s+r[h]+Sa[l]|0;s=a,a=o,o=Aa(i),i=n,n=f}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},xa.prototype._hash=function(){var e=Ea.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var Ba=xa,Oa=Ie.exports,Ma=la,La=Ce.exports.Buffer,ja=[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],Ua=new Array(64);function Ia(){this.init(),this._w=Ua,Ma.call(this,64,56)}function Ca(e,t,r){return r^e&(t^r)}function Na(e,t,r){return e&t|r&(e|t)}function Pa(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function Da(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function za(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}Oa(Ia,Ma),Ia.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},Ia.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0|this._f,h=0|this._g,l=0|this._h,f=0;f<16;++f)r[f]=e.readInt32BE(4*f);for(;f<64;++f)r[f]=0|(((t=r[f-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[f-7]+za(r[f-15])+r[f-16];for(var c=0;c<64;++c){var d=l+Da(s)+Ca(s,u,h)+ja[c]+r[c]|0,p=Pa(n)+Na(n,i,o)|0;l=h,h=u,u=s,s=a+d|0,a=o,o=i,i=n,n=d+p|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0,this._f=u+this._f|0,this._g=h+this._g|0,this._h=l+this._h|0},Ia.prototype._hash=function(){var e=La.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var qa=Ia,Wa=Ie.exports,Fa=qa,Ka=la,Ya=Ce.exports.Buffer,Ha=new Array(64);function $a(){this.init(),this._w=Ha,Ka.call(this,64,56)}Wa($a,Fa),$a.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},$a.prototype._hash=function(){var e=Ya.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var Va=$a,Ga=Ie.exports,Ja=la,Xa=Ce.exports.Buffer,Za=[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],Qa=new Array(160);function es(){this.init(),this._w=Qa,Ja.call(this,128,112)}function ts(e,t,r){return r^e&(t^r)}function rs(e,t,r){return e&t|r&(e|t)}function ns(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function is(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function os(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function as(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function ss(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function us(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function hs(e,t){return e>>>0>>0?1:0}Ga(es,Ja),es.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},es.prototype._update=function(e){for(var t=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,s=0|this._fh,u=0|this._gh,h=0|this._hh,l=0|this._al,f=0|this._bl,c=0|this._cl,d=0|this._dl,p=0|this._el,g=0|this._fl,y=0|this._gl,b=0|this._hl,m=0;m<32;m+=2)t[m]=e.readInt32BE(4*m),t[m+1]=e.readInt32BE(4*m+4);for(;m<160;m+=2){var v=t[m-30],w=t[m-30+1],_=os(v,w),E=as(w,v),S=ss(v=t[m-4],w=t[m-4+1]),k=us(w,v),x=t[m-14],R=t[m-14+1],A=t[m-32],T=t[m-32+1],B=E+R|0,O=_+x+hs(B,E)|0;O=(O=O+S+hs(B=B+k|0,k)|0)+A+hs(B=B+T|0,T)|0,t[m]=O,t[m+1]=B}for(var M=0;M<160;M+=2){O=t[M],B=t[M+1];var L=rs(r,n,i),j=rs(l,f,c),U=ns(r,l),I=ns(l,r),C=is(a,p),N=is(p,a),P=Za[M],D=Za[M+1],z=ts(a,s,u),q=ts(p,g,y),W=b+N|0,F=h+C+hs(W,b)|0;F=(F=(F=F+z+hs(W=W+q|0,q)|0)+P+hs(W=W+D|0,D)|0)+O+hs(W=W+B|0,B)|0;var K=I+j|0,Y=U+L+hs(K,I)|0;h=u,b=y,u=s,y=g,s=a,g=p,a=o+F+hs(p=d+W|0,d)|0,o=i,d=c,i=n,c=f,n=r,f=l,r=F+Y+hs(l=W+K|0,W)|0}this._al=this._al+l|0,this._bl=this._bl+f|0,this._cl=this._cl+c|0,this._dl=this._dl+d|0,this._el=this._el+p|0,this._fl=this._fl+g|0,this._gl=this._gl+y|0,this._hl=this._hl+b|0,this._ah=this._ah+r+hs(this._al,l)|0,this._bh=this._bh+n+hs(this._bl,f)|0,this._ch=this._ch+i+hs(this._cl,c)|0,this._dh=this._dh+o+hs(this._dl,d)|0,this._eh=this._eh+a+hs(this._el,p)|0,this._fh=this._fh+s+hs(this._fl,g)|0,this._gh=this._gh+u+hs(this._gl,y)|0,this._hh=this._hh+h+hs(this._hl,b)|0},es.prototype._hash=function(){var e=Xa.allocUnsafe(64);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var ls=es,fs=Ie.exports,cs=ls,ds=la,ps=Ce.exports.Buffer,gs=new Array(160);function ys(){this.init(),this._w=gs,ds.call(this,128,112)}fs(ys,cs),ys.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},ys.prototype._hash=function(){var e=ps.allocUnsafe(48);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var bs=ys,ms=sa.exports=function(e){e=e.toLowerCase();var t=ms[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};ms.sha=va,ms.sha1=Ba,ms.sha224=Va,ms.sha256=qa,ms.sha384=bs,ms.sha512=ls;var vs=Ie.exports,ws=Wr,_s=Cr,Es=Ce.exports.Buffer,Ss=function(e){return(new Wo).update(e).digest()},ks=aa,xs=sa.exports,Rs=Es.alloc(128);function As(e,t){_s.call(this,"digest"),"string"==typeof t&&(t=Es.from(t));var r="sha512"===e||"sha384"===e?128:64;(this._alg=e,this._key=t,t.length>r)?t=("rmd160"===e?new ks:xs(e)).update(t).digest():t.length>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 p(e,t,r,n,i){var o,a=0;for(o=0;o>>8)-1}function g(e,t,r,n){return p(e,t,r,n,16)}function y(e,t,r,n){return p(e,t,r,n,32)}function b(e,t,r,n){!function(e,t,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,u=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,h=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,c=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,d=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,g=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,y=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,b=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,m=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=o,E=a,S=s,k=u,x=h,R=l,A=f,T=c,B=d,O=p,M=g,L=y,j=b,U=m,I=v,C=w,N=0;N<20;N+=2)_^=(i=(j^=(i=(B^=(i=(x^=(i=_+j|0)<<7|i>>>25)+_|0)<<9|i>>>23)+x|0)<<13|i>>>19)+B|0)<<18|i>>>14,R^=(i=(E^=(i=(U^=(i=(O^=(i=R+E|0)<<7|i>>>25)+R|0)<<9|i>>>23)+O|0)<<13|i>>>19)+U|0)<<18|i>>>14,M^=(i=(A^=(i=(S^=(i=(I^=(i=M+A|0)<<7|i>>>25)+M|0)<<9|i>>>23)+I|0)<<13|i>>>19)+S|0)<<18|i>>>14,C^=(i=(L^=(i=(T^=(i=(k^=(i=C+L|0)<<7|i>>>25)+C|0)<<9|i>>>23)+k|0)<<13|i>>>19)+T|0)<<18|i>>>14,_^=(i=(k^=(i=(S^=(i=(E^=(i=_+k|0)<<7|i>>>25)+_|0)<<9|i>>>23)+E|0)<<13|i>>>19)+S|0)<<18|i>>>14,R^=(i=(x^=(i=(T^=(i=(A^=(i=R+x|0)<<7|i>>>25)+R|0)<<9|i>>>23)+A|0)<<13|i>>>19)+T|0)<<18|i>>>14,M^=(i=(O^=(i=(B^=(i=(L^=(i=M+O|0)<<7|i>>>25)+M|0)<<9|i>>>23)+L|0)<<13|i>>>19)+B|0)<<18|i>>>14,C^=(i=(I^=(i=(U^=(i=(j^=(i=C+I|0)<<7|i>>>25)+C|0)<<9|i>>>23)+j|0)<<13|i>>>19)+U|0)<<18|i>>>14;_=_+o|0,E=E+a|0,S=S+s|0,k=k+u|0,x=x+h|0,R=R+l|0,A=A+f|0,T=T+c|0,B=B+d|0,O=O+p|0,M=M+g|0,L=L+y|0,j=j+b|0,U=U+m|0,I=I+v|0,C=C+w|0,e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=E>>>0&255,e[5]=E>>>8&255,e[6]=E>>>16&255,e[7]=E>>>24&255,e[8]=S>>>0&255,e[9]=S>>>8&255,e[10]=S>>>16&255,e[11]=S>>>24&255,e[12]=k>>>0&255,e[13]=k>>>8&255,e[14]=k>>>16&255,e[15]=k>>>24&255,e[16]=x>>>0&255,e[17]=x>>>8&255,e[18]=x>>>16&255,e[19]=x>>>24&255,e[20]=R>>>0&255,e[21]=R>>>8&255,e[22]=R>>>16&255,e[23]=R>>>24&255,e[24]=A>>>0&255,e[25]=A>>>8&255,e[26]=A>>>16&255,e[27]=A>>>24&255,e[28]=T>>>0&255,e[29]=T>>>8&255,e[30]=T>>>16&255,e[31]=T>>>24&255,e[32]=B>>>0&255,e[33]=B>>>8&255,e[34]=B>>>16&255,e[35]=B>>>24&255,e[36]=O>>>0&255,e[37]=O>>>8&255,e[38]=O>>>16&255,e[39]=O>>>24&255,e[40]=M>>>0&255,e[41]=M>>>8&255,e[42]=M>>>16&255,e[43]=M>>>24&255,e[44]=L>>>0&255,e[45]=L>>>8&255,e[46]=L>>>16&255,e[47]=L>>>24&255,e[48]=j>>>0&255,e[49]=j>>>8&255,e[50]=j>>>16&255,e[51]=j>>>24&255,e[52]=U>>>0&255,e[53]=U>>>8&255,e[54]=U>>>16&255,e[55]=U>>>24&255,e[56]=I>>>0&255,e[57]=I>>>8&255,e[58]=I>>>16&255,e[59]=I>>>24&255,e[60]=C>>>0&255,e[61]=C>>>8&255,e[62]=C>>>16&255,e[63]=C>>>24&255}(e,t,r,n)}function m(e,t,r,n){!function(e,t,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,u=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,h=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,c=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,d=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,g=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,y=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,b=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,m=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=0;_<20;_+=2)o^=(i=(b^=(i=(d^=(i=(h^=(i=o+b|0)<<7|i>>>25)+o|0)<<9|i>>>23)+h|0)<<13|i>>>19)+d|0)<<18|i>>>14,l^=(i=(a^=(i=(m^=(i=(p^=(i=l+a|0)<<7|i>>>25)+l|0)<<9|i>>>23)+p|0)<<13|i>>>19)+m|0)<<18|i>>>14,g^=(i=(f^=(i=(s^=(i=(v^=(i=g+f|0)<<7|i>>>25)+g|0)<<9|i>>>23)+v|0)<<13|i>>>19)+s|0)<<18|i>>>14,w^=(i=(y^=(i=(c^=(i=(u^=(i=w+y|0)<<7|i>>>25)+w|0)<<9|i>>>23)+u|0)<<13|i>>>19)+c|0)<<18|i>>>14,o^=(i=(u^=(i=(s^=(i=(a^=(i=o+u|0)<<7|i>>>25)+o|0)<<9|i>>>23)+a|0)<<13|i>>>19)+s|0)<<18|i>>>14,l^=(i=(h^=(i=(c^=(i=(f^=(i=l+h|0)<<7|i>>>25)+l|0)<<9|i>>>23)+f|0)<<13|i>>>19)+c|0)<<18|i>>>14,g^=(i=(p^=(i=(d^=(i=(y^=(i=g+p|0)<<7|i>>>25)+g|0)<<9|i>>>23)+y|0)<<13|i>>>19)+d|0)<<18|i>>>14,w^=(i=(v^=(i=(m^=(i=(b^=(i=w+v|0)<<7|i>>>25)+w|0)<<9|i>>>23)+b|0)<<13|i>>>19)+m|0)<<18|i>>>14;e[0]=o>>>0&255,e[1]=o>>>8&255,e[2]=o>>>16&255,e[3]=o>>>24&255,e[4]=l>>>0&255,e[5]=l>>>8&255,e[6]=l>>>16&255,e[7]=l>>>24&255,e[8]=g>>>0&255,e[9]=g>>>8&255,e[10]=g>>>16&255,e[11]=g>>>24&255,e[12]=w>>>0&255,e[13]=w>>>8&255,e[14]=w>>>16&255,e[15]=w>>>24&255,e[16]=f>>>0&255,e[17]=f>>>8&255,e[18]=f>>>16&255,e[19]=f>>>24&255,e[20]=c>>>0&255,e[21]=c>>>8&255,e[22]=c>>>16&255,e[23]=c>>>24&255,e[24]=d>>>0&255,e[25]=d>>>8&255,e[26]=d>>>16&255,e[27]=d>>>24&255,e[28]=p>>>0&255,e[29]=p>>>8&255,e[30]=p>>>16&255,e[31]=p>>>24&255}(e,t,r,n)}var v=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function w(e,t,r,n,i,o,a){var s,u,h=new Uint8Array(16),l=new Uint8Array(64);for(u=0;u<16;u++)h[u]=0;for(u=0;u<8;u++)h[u]=o[u];for(;i>=64;){for(b(l,h,a,v),u=0;u<64;u++)e[t+u]=r[n+u]^l[u];for(s=1,u=8;u<16;u++)s=s+(255&h[u])|0,h[u]=255&s,s>>>=8;i-=64,t+=64,n+=64}if(i>0)for(b(l,h,a,v),u=0;u=64;){for(b(u,s,i,v),a=0;a<64;a++)e[t+a]=u[a];for(o=1,a=8;a<16;a++)o=o+(255&s[a])|0,s[a]=255&o,o>>>=8;r-=64,t+=64}if(r>0)for(b(u,s,i,v),a=0;a>>13|r<<3),n=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(r>>>10|n<<6),i=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(n>>>7|i<<9),o=255&e[8]|(255&e[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,a=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(o>>>14|a<<2),s=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(a>>>11|s<<5),u=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(s>>>8|u<<8),this.r[9]=u>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function x(e,t,r,n,i,o){var a=new k(o);return a.update(r,n,i),a.finish(e,t),0}function R(e,t,r,n,i,o){var a=new Uint8Array(16);return x(a,0,r,n,i,o),g(e,t,a,0)}function A(e,t,r,n,i){var o;if(r<32)return-1;for(S(e,0,t,0,r,n,i),x(e,16,e,32,r-32,e),o=0;o<16;o++)e[o]=0;return 0}function T(e,t,r,n,i){var o,a=new Uint8Array(32);if(r<32)return-1;if(E(a,0,32,n,i),0!==R(t,16,t,32,r-32,a))return-1;for(S(e,0,t,0,r,n,i),o=0;o<32;o++)e[o]=0;return 0}function B(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function O(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 M(e,t,r){for(var n,i=~(r-1),o=0;o<16;o++)n=i&(e[o]^t[o]),e[o]^=n,t[o]^=n}function L(e,r){var n,i,o,a=t(),s=t();for(n=0;n<16;n++)s[n]=r[n];for(O(s),O(s),O(s),i=0;i<2;i++){for(a[0]=s[0]-65517,n=1;n<15;n++)a[n]=s[n]-65535-(a[n-1]>>16&1),a[n-1]&=65535;a[15]=s[15]-32767-(a[14]>>16&1),o=a[15]>>16&1,a[14]&=65535,M(s,a,1-o)}for(n=0;n<16;n++)e[2*n]=255&s[n],e[2*n+1]=s[n]>>8}function j(e,t){var r=new Uint8Array(32),n=new Uint8Array(32);return L(r,e),L(n,t),y(r,0,n,0)}function I(e){var t=new Uint8Array(32);return L(t,e),1&t[0]}function C(e,t){var r;for(r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function N(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]+r[n]}function P(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]-r[n]}function D(e,t,r){var n,i,o=0,a=0,s=0,u=0,h=0,l=0,f=0,c=0,d=0,p=0,g=0,y=0,b=0,m=0,v=0,w=0,_=0,E=0,S=0,k=0,x=0,R=0,A=0,T=0,B=0,O=0,M=0,L=0,j=0,U=0,I=0,C=r[0],N=r[1],P=r[2],D=r[3],z=r[4],q=r[5],W=r[6],F=r[7],K=r[8],Y=r[9],H=r[10],$=r[11],V=r[12],G=r[13],J=r[14],X=r[15];o+=(n=t[0])*C,a+=n*N,s+=n*P,u+=n*D,h+=n*z,l+=n*q,f+=n*W,c+=n*F,d+=n*K,p+=n*Y,g+=n*H,y+=n*$,b+=n*V,m+=n*G,v+=n*J,w+=n*X,a+=(n=t[1])*C,s+=n*N,u+=n*P,h+=n*D,l+=n*z,f+=n*q,c+=n*W,d+=n*F,p+=n*K,g+=n*Y,y+=n*H,b+=n*$,m+=n*V,v+=n*G,w+=n*J,_+=n*X,s+=(n=t[2])*C,u+=n*N,h+=n*P,l+=n*D,f+=n*z,c+=n*q,d+=n*W,p+=n*F,g+=n*K,y+=n*Y,b+=n*H,m+=n*$,v+=n*V,w+=n*G,_+=n*J,E+=n*X,u+=(n=t[3])*C,h+=n*N,l+=n*P,f+=n*D,c+=n*z,d+=n*q,p+=n*W,g+=n*F,y+=n*K,b+=n*Y,m+=n*H,v+=n*$,w+=n*V,_+=n*G,E+=n*J,S+=n*X,h+=(n=t[4])*C,l+=n*N,f+=n*P,c+=n*D,d+=n*z,p+=n*q,g+=n*W,y+=n*F,b+=n*K,m+=n*Y,v+=n*H,w+=n*$,_+=n*V,E+=n*G,S+=n*J,k+=n*X,l+=(n=t[5])*C,f+=n*N,c+=n*P,d+=n*D,p+=n*z,g+=n*q,y+=n*W,b+=n*F,m+=n*K,v+=n*Y,w+=n*H,_+=n*$,E+=n*V,S+=n*G,k+=n*J,x+=n*X,f+=(n=t[6])*C,c+=n*N,d+=n*P,p+=n*D,g+=n*z,y+=n*q,b+=n*W,m+=n*F,v+=n*K,w+=n*Y,_+=n*H,E+=n*$,S+=n*V,k+=n*G,x+=n*J,R+=n*X,c+=(n=t[7])*C,d+=n*N,p+=n*P,g+=n*D,y+=n*z,b+=n*q,m+=n*W,v+=n*F,w+=n*K,_+=n*Y,E+=n*H,S+=n*$,k+=n*V,x+=n*G,R+=n*J,A+=n*X,d+=(n=t[8])*C,p+=n*N,g+=n*P,y+=n*D,b+=n*z,m+=n*q,v+=n*W,w+=n*F,_+=n*K,E+=n*Y,S+=n*H,k+=n*$,x+=n*V,R+=n*G,A+=n*J,T+=n*X,p+=(n=t[9])*C,g+=n*N,y+=n*P,b+=n*D,m+=n*z,v+=n*q,w+=n*W,_+=n*F,E+=n*K,S+=n*Y,k+=n*H,x+=n*$,R+=n*V,A+=n*G,T+=n*J,B+=n*X,g+=(n=t[10])*C,y+=n*N,b+=n*P,m+=n*D,v+=n*z,w+=n*q,_+=n*W,E+=n*F,S+=n*K,k+=n*Y,x+=n*H,R+=n*$,A+=n*V,T+=n*G,B+=n*J,O+=n*X,y+=(n=t[11])*C,b+=n*N,m+=n*P,v+=n*D,w+=n*z,_+=n*q,E+=n*W,S+=n*F,k+=n*K,x+=n*Y,R+=n*H,A+=n*$,T+=n*V,B+=n*G,O+=n*J,M+=n*X,b+=(n=t[12])*C,m+=n*N,v+=n*P,w+=n*D,_+=n*z,E+=n*q,S+=n*W,k+=n*F,x+=n*K,R+=n*Y,A+=n*H,T+=n*$,B+=n*V,O+=n*G,M+=n*J,L+=n*X,m+=(n=t[13])*C,v+=n*N,w+=n*P,_+=n*D,E+=n*z,S+=n*q,k+=n*W,x+=n*F,R+=n*K,A+=n*Y,T+=n*H,B+=n*$,O+=n*V,M+=n*G,L+=n*J,j+=n*X,v+=(n=t[14])*C,w+=n*N,_+=n*P,E+=n*D,S+=n*z,k+=n*q,x+=n*W,R+=n*F,A+=n*K,T+=n*Y,B+=n*H,O+=n*$,M+=n*V,L+=n*G,j+=n*J,U+=n*X,w+=(n=t[15])*C,a+=38*(E+=n*P),s+=38*(S+=n*D),u+=38*(k+=n*z),h+=38*(x+=n*q),l+=38*(R+=n*W),f+=38*(A+=n*F),c+=38*(T+=n*K),d+=38*(B+=n*Y),p+=38*(O+=n*H),g+=38*(M+=n*$),y+=38*(L+=n*V),b+=38*(j+=n*G),m+=38*(U+=n*J),v+=38*(I+=n*X),o=(n=(o+=38*(_+=n*N))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+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)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+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)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=(o+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+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)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+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)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),o+=i-1+37*(i-1),e[0]=o,e[1]=a,e[2]=s,e[3]=u,e[4]=h,e[5]=l,e[6]=f,e[7]=c,e[8]=d,e[9]=p,e[10]=g,e[11]=y,e[12]=b,e[13]=m,e[14]=v,e[15]=w}function z(e,t){D(e,t,t)}function q(e,r){var n,i=t();for(n=0;n<16;n++)i[n]=r[n];for(n=253;n>=0;n--)z(i,i),2!==n&&4!==n&&D(i,i,r);for(n=0;n<16;n++)e[n]=i[n]}function W(e,r){var n,i=t();for(n=0;n<16;n++)i[n]=r[n];for(n=250;n>=0;n--)z(i,i),1!==n&&D(i,i,r);for(n=0;n<16;n++)e[n]=i[n]}function F(e,r,n){var i,o,a=new Uint8Array(32),u=new Float64Array(80),h=t(),l=t(),f=t(),c=t(),d=t(),p=t();for(o=0;o<31;o++)a[o]=r[o];for(a[31]=127&r[31]|64,a[0]&=248,C(u,n),o=0;o<16;o++)l[o]=u[o],c[o]=h[o]=f[o]=0;for(h[0]=c[0]=1,o=254;o>=0;--o)M(h,l,i=a[o>>>3]>>>(7&o)&1),M(f,c,i),N(d,h,f),P(h,h,f),N(f,l,c),P(l,l,c),z(c,d),z(p,h),D(h,f,h),D(f,l,d),N(d,h,f),P(h,h,f),z(l,h),P(f,c,p),D(h,f,s),N(h,h,c),D(f,f,h),D(h,c,p),D(c,l,u),z(l,d),M(h,l,i),M(f,c,i);for(o=0;o<16;o++)u[o+16]=h[o],u[o+32]=f[o],u[o+48]=l[o],u[o+64]=c[o];var g=u.subarray(32),y=u.subarray(16);return q(g,g),D(y,y,g),L(e,y),0}function K(e,t){return F(e,t,i)}function Y(e,t){return r(t,32),K(e,t)}function H(e,t,r){var i=new Uint8Array(32);return F(i,r,t),m(e,n,i,v)}k.prototype.blocks=function(e,t,r){for(var n,i,o,a,s,u,h,l,f,c,d,p,g,y,b,m,v,w,_,E=this.fin?0:2048,S=this.h[0],k=this.h[1],x=this.h[2],R=this.h[3],A=this.h[4],T=this.h[5],B=this.h[6],O=this.h[7],M=this.h[8],L=this.h[9],j=this.r[0],U=this.r[1],I=this.r[2],C=this.r[3],N=this.r[4],P=this.r[5],D=this.r[6],z=this.r[7],q=this.r[8],W=this.r[9];r>=16;)c=f=0,c+=(S+=8191&(n=255&e[t+0]|(255&e[t+1])<<8))*j,c+=(k+=8191&(n>>>13|(i=255&e[t+2]|(255&e[t+3])<<8)<<3))*(5*W),c+=(x+=8191&(i>>>10|(o=255&e[t+4]|(255&e[t+5])<<8)<<6))*(5*q),c+=(R+=8191&(o>>>7|(a=255&e[t+6]|(255&e[t+7])<<8)<<9))*(5*z),f=(c+=(A+=8191&(a>>>4|(s=255&e[t+8]|(255&e[t+9])<<8)<<12))*(5*D))>>>13,c&=8191,c+=(T+=s>>>1&8191)*(5*P),c+=(B+=8191&(s>>>14|(u=255&e[t+10]|(255&e[t+11])<<8)<<2))*(5*N),c+=(O+=8191&(u>>>11|(h=255&e[t+12]|(255&e[t+13])<<8)<<5))*(5*C),c+=(M+=8191&(h>>>8|(l=255&e[t+14]|(255&e[t+15])<<8)<<8))*(5*I),d=f+=(c+=(L+=l>>>5|E)*(5*U))>>>13,d+=S*U,d+=k*j,d+=x*(5*W),d+=R*(5*q),f=(d+=A*(5*z))>>>13,d&=8191,d+=T*(5*D),d+=B*(5*P),d+=O*(5*N),d+=M*(5*C),f+=(d+=L*(5*I))>>>13,d&=8191,p=f,p+=S*I,p+=k*U,p+=x*j,p+=R*(5*W),f=(p+=A*(5*q))>>>13,p&=8191,p+=T*(5*z),p+=B*(5*D),p+=O*(5*P),p+=M*(5*N),g=f+=(p+=L*(5*C))>>>13,g+=S*C,g+=k*I,g+=x*U,g+=R*j,f=(g+=A*(5*W))>>>13,g&=8191,g+=T*(5*q),g+=B*(5*z),g+=O*(5*D),g+=M*(5*P),y=f+=(g+=L*(5*N))>>>13,y+=S*N,y+=k*C,y+=x*I,y+=R*U,f=(y+=A*j)>>>13,y&=8191,y+=T*(5*W),y+=B*(5*q),y+=O*(5*z),y+=M*(5*D),b=f+=(y+=L*(5*P))>>>13,b+=S*P,b+=k*N,b+=x*C,b+=R*I,f=(b+=A*U)>>>13,b&=8191,b+=T*j,b+=B*(5*W),b+=O*(5*q),b+=M*(5*z),m=f+=(b+=L*(5*D))>>>13,m+=S*D,m+=k*P,m+=x*N,m+=R*C,f=(m+=A*I)>>>13,m&=8191,m+=T*U,m+=B*j,m+=O*(5*W),m+=M*(5*q),v=f+=(m+=L*(5*z))>>>13,v+=S*z,v+=k*D,v+=x*P,v+=R*N,f=(v+=A*C)>>>13,v&=8191,v+=T*I,v+=B*U,v+=O*j,v+=M*(5*W),w=f+=(v+=L*(5*q))>>>13,w+=S*q,w+=k*z,w+=x*D,w+=R*P,f=(w+=A*N)>>>13,w&=8191,w+=T*C,w+=B*I,w+=O*U,w+=M*j,_=f+=(w+=L*(5*W))>>>13,_+=S*W,_+=k*q,_+=x*z,_+=R*D,f=(_+=A*P)>>>13,_&=8191,_+=T*N,_+=B*C,_+=O*I,_+=M*U,S=c=8191&(f=(f=((f+=(_+=L*j)>>>13)<<2)+f|0)+(c&=8191)|0),k=d+=f>>>=13,x=p&=8191,R=g&=8191,A=y&=8191,T=b&=8191,B=m&=8191,O=v&=8191,M=w&=8191,L=_&=8191,t+=16,r-=16;this.h[0]=S,this.h[1]=k,this.h[2]=x,this.h[3]=R,this.h[4]=A,this.h[5]=T,this.h[6]=B,this.h[7]=O,this.h[8]=M,this.h[9]=L},k.prototype.finish=function(e,t){var r,n,i,o,a=new Uint16Array(10);if(this.leftover){for(o=this.leftover,this.buffer[o++]=1;o<16;o++)this.buffer[o]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,o=2;o<10;o++)this.h[o]+=r,r=this.h[o]>>>13,this.h[o]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,a[0]=this.h[0]+5,r=a[0]>>>13,a[0]&=8191,o=1;o<10;o++)a[o]=this.h[o]+r,r=a[o]>>>13,a[o]&=8191;for(a[9]-=8192,n=(1^r)-1,o=0;o<10;o++)a[o]&=n;for(n=~n,o=0;o<10;o++)this.h[o]=this.h[o]&n|a[o];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),i=this.h[0]+this.pad[0],this.h[0]=65535&i,o=1;o<8;o++)i=(this.h[o]+this.pad[o]|0)+(i>>>16)|0,this.h[o]=65535&i;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},k.prototype.update=function(e,t,r){var n,i;if(this.leftover){for((i=16-this.leftover)>r&&(i=r),n=0;n=16&&(i=r-r%16,this.blocks(e,t,i),t+=i,r-=i),r){for(n=0;n=128;){for(E=0;E<16;E++)S=8*E+V,O[E]=r[S+0]<<24|r[S+1]<<16|r[S+2]<<8|r[S+3],M[E]=r[S+4]<<24|r[S+5]<<16|r[S+6]<<8|r[S+7];for(E=0;E<80;E++)if(i=L,o=j,a=U,s=I,u=C,h=N,l=P,c=z,d=q,p=W,g=F,y=K,b=Y,m=H,R=65535&(x=$),A=x>>>16,T=65535&(k=D),B=k>>>16,R+=65535&(x=(K>>>14|C<<18)^(K>>>18|C<<14)^(C>>>9|K<<23)),A+=x>>>16,T+=65535&(k=(C>>>14|K<<18)^(C>>>18|K<<14)^(K>>>9|C<<23)),B+=k>>>16,R+=65535&(x=K&Y^~K&H),A+=x>>>16,T+=65535&(k=C&N^~C&P),B+=k>>>16,R+=65535&(x=G[2*E+1]),A+=x>>>16,T+=65535&(k=G[2*E]),B+=k>>>16,k=O[E%16],A+=(x=M[E%16])>>>16,T+=65535&k,B+=k>>>16,T+=(A+=(R+=65535&x)>>>16)>>>16,R=65535&(x=_=65535&R|A<<16),A=x>>>16,T=65535&(k=w=65535&T|(B+=T>>>16)<<16),B=k>>>16,R+=65535&(x=(z>>>28|L<<4)^(L>>>2|z<<30)^(L>>>7|z<<25)),A+=x>>>16,T+=65535&(k=(L>>>28|z<<4)^(z>>>2|L<<30)^(z>>>7|L<<25)),B+=k>>>16,A+=(x=z&q^z&W^q&W)>>>16,T+=65535&(k=L&j^L&U^j&U),B+=k>>>16,f=65535&(T+=(A+=(R+=65535&x)>>>16)>>>16)|(B+=T>>>16)<<16,v=65535&R|A<<16,R=65535&(x=g),A=x>>>16,T=65535&(k=s),B=k>>>16,A+=(x=_)>>>16,T+=65535&(k=w),B+=k>>>16,j=i,U=o,I=a,C=s=65535&(T+=(A+=(R+=65535&x)>>>16)>>>16)|(B+=T>>>16)<<16,N=u,P=h,D=l,L=f,q=c,W=d,F=p,K=g=65535&R|A<<16,Y=y,H=b,$=m,z=v,E%16==15)for(S=0;S<16;S++)k=O[S],R=65535&(x=M[S]),A=x>>>16,T=65535&k,B=k>>>16,k=O[(S+9)%16],R+=65535&(x=M[(S+9)%16]),A+=x>>>16,T+=65535&k,B+=k>>>16,w=O[(S+1)%16],R+=65535&(x=((_=M[(S+1)%16])>>>1|w<<31)^(_>>>8|w<<24)^(_>>>7|w<<25)),A+=x>>>16,T+=65535&(k=(w>>>1|_<<31)^(w>>>8|_<<24)^w>>>7),B+=k>>>16,w=O[(S+14)%16],A+=(x=((_=M[(S+14)%16])>>>19|w<<13)^(w>>>29|_<<3)^(_>>>6|w<<26))>>>16,T+=65535&(k=(w>>>19|_<<13)^(_>>>29|w<<3)^w>>>6),B+=k>>>16,B+=(T+=(A+=(R+=65535&x)>>>16)>>>16)>>>16,O[S]=65535&T|B<<16,M[S]=65535&R|A<<16;R=65535&(x=z),A=x>>>16,T=65535&(k=L),B=k>>>16,k=e[0],A+=(x=t[0])>>>16,T+=65535&k,B+=k>>>16,B+=(T+=(A+=(R+=65535&x)>>>16)>>>16)>>>16,e[0]=L=65535&T|B<<16,t[0]=z=65535&R|A<<16,R=65535&(x=q),A=x>>>16,T=65535&(k=j),B=k>>>16,k=e[1],A+=(x=t[1])>>>16,T+=65535&k,B+=k>>>16,B+=(T+=(A+=(R+=65535&x)>>>16)>>>16)>>>16,e[1]=j=65535&T|B<<16,t[1]=q=65535&R|A<<16,R=65535&(x=W),A=x>>>16,T=65535&(k=U),B=k>>>16,k=e[2],A+=(x=t[2])>>>16,T+=65535&k,B+=k>>>16,B+=(T+=(A+=(R+=65535&x)>>>16)>>>16)>>>16,e[2]=U=65535&T|B<<16,t[2]=W=65535&R|A<<16,R=65535&(x=F),A=x>>>16,T=65535&(k=I),B=k>>>16,k=e[3],A+=(x=t[3])>>>16,T+=65535&k,B+=k>>>16,B+=(T+=(A+=(R+=65535&x)>>>16)>>>16)>>>16,e[3]=I=65535&T|B<<16,t[3]=F=65535&R|A<<16,R=65535&(x=K),A=x>>>16,T=65535&(k=C),B=k>>>16,k=e[4],A+=(x=t[4])>>>16,T+=65535&k,B+=k>>>16,B+=(T+=(A+=(R+=65535&x)>>>16)>>>16)>>>16,e[4]=C=65535&T|B<<16,t[4]=K=65535&R|A<<16,R=65535&(x=Y),A=x>>>16,T=65535&(k=N),B=k>>>16,k=e[5],A+=(x=t[5])>>>16,T+=65535&k,B+=k>>>16,B+=(T+=(A+=(R+=65535&x)>>>16)>>>16)>>>16,e[5]=N=65535&T|B<<16,t[5]=Y=65535&R|A<<16,R=65535&(x=H),A=x>>>16,T=65535&(k=P),B=k>>>16,k=e[6],A+=(x=t[6])>>>16,T+=65535&k,B+=k>>>16,B+=(T+=(A+=(R+=65535&x)>>>16)>>>16)>>>16,e[6]=P=65535&T|B<<16,t[6]=H=65535&R|A<<16,R=65535&(x=$),A=x>>>16,T=65535&(k=D),B=k>>>16,k=e[7],A+=(x=t[7])>>>16,T+=65535&k,B+=k>>>16,B+=(T+=(A+=(R+=65535&x)>>>16)>>>16)>>>16,e[7]=D=65535&T|B<<16,t[7]=$=65535&R|A<<16,V+=128,n-=128}return n}function X(e,t,r){var n,i=new Int32Array(8),o=new Int32Array(8),a=new Uint8Array(256),s=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,o[0]=4089235720,o[1]=2227873595,o[2]=4271175723,o[3]=1595750129,o[4]=2917565137,o[5]=725511199,o[6]=4215389547,o[7]=327033209,J(i,o,t,r),r%=128,n=0;n=0;--i)Q(e,t,n=r[i/8|0]>>(7&i)&1),Z(t,e),Z(e,e),Q(e,t,n)}function re(e,r){var n=[t(),t(),t(),t()];B(n[0],l),B(n[1],f),B(n[2],a),D(n[3],l,f),te(e,n,r)}function ne(e,n,i){var o,a=new Uint8Array(64),s=[t(),t(),t(),t()];for(i||r(n,32),X(a,n,32),a[0]&=248,a[31]&=127,a[31]|=64,re(s,a),ee(e,s),o=0;o<32;o++)n[o+32]=e[o];return 0}var ie=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 oe(e,t){var r,n,i,o;for(n=63;n>=32;--n){for(r=0,i=n-32,o=n-12;i>4)*ie[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=r*ie[i];for(n=0;n<32;n++)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function ae(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;oe(e,r)}function se(e,r,n,i){var o,a,s=new Uint8Array(64),u=new Uint8Array(64),h=new Uint8Array(64),l=new Float64Array(64),f=[t(),t(),t(),t()];X(s,i,32),s[0]&=248,s[31]&=127,s[31]|=64;var c=n+64;for(o=0;o>7&&P(e[0],o,e[0]),D(e[3],e[0],e[1]),0)}(d,i))return-1;for(s=0;s=0},e.sign.keyPair=function(){var e=new Uint8Array(fe),t=new Uint8Array(ce);return ne(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(pe(e),e.length!==ce)throw new Error("bad secret key size");for(var t=new Uint8Array(fe),r=0;re.replace("'",""),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.derivePath=e.isValidPath=e.getPublicKey=e.getMasterKeyFromSeed=void 0;const t=Ts,r=Bs.exports,n=Os;e.getMasterKeyFromSeed=e=>{const r=t("sha512","ed25519 seed").update(X.from(e,"hex")).digest();return{key:r.slice(0,32),chainCode:r.slice(32)}};e.getPublicKey=(e,t=!0)=>{const n=r.sign.keyPair.fromSeed(e).secretKey.subarray(32),i=X.alloc(1,0);return t?X.concat([i,X.from(n)]):X.from(n)},e.isValidPath=e=>!!n.pathRegex.test(e)&&!e.split("/").slice(1).map(n.replaceDerive).some(isNaN),e.derivePath=(r,i,o=2147483648)=>{if(!e.isValidPath(r))throw new Error("Invalid derivation path");const{key:a,chainCode:s}=e.getMasterKeyFromSeed(i);return r.split("/").slice(1).map(n.replaceDerive).map((e=>parseInt(e,10))).reduce(((e,r)=>(({key:e,chainCode:r},n)=>{const i=X.allocUnsafe(4);i.writeUInt32BE(n,0);const o=X.concat([X.alloc(1,0),e,i]),a=t("sha512",r).update(o).digest();return{key:a.slice(0,32),chainCode:a.slice(32)}})(e,r+o)),{key:a,chainCode:s})}}(Ue);var Ms=t(Ue);let Ls=(e={})=>{let t,{sk:r,keepPrivate:n=!1,seed:i=null}=e;if(r)t=Us(r);else{let e=Ns(i);t=e.vk,r=e.sk}return{sign:e=>Ps(r,e),verify:(e,r)=>Ds(t,e,r),vk:t,sk:n?void 0:r}};function js(e=null){var t=null;return t=null==e?I.sign.keyPair():I.sign.keyPair.fromSeed(e),{sk:new Uint8Array(t.secretKey.slice(0,32)),vk:new Uint8Array(t.secretKey.slice(32,64))}}function Us(e){return Cs(Is(e)).vk}function Is(e){return js(O(e))}function Cs(e){return{vk:B(e.vk),sk:B(e.sk)}}function Ns(e=null){return Cs(js(e))}function Ps(e,t){var r=Is(e),n=M(r.sk,r.vk);return B(I.sign.detached(t,n))}function Ds(e,t,r){var n=O(e),i=O(r);try{return I.sign.detached.verify(t,i,n)}catch(e){return!1}}var zs=Object.freeze({__proto__:null,create_wallet:Ls,generate_keys:js,get_vk:Us,format_to_keys:Is,keys_to_format:Cs,new_wallet:Ns,new_wallet_bip39:function(e,t=0){return function(e,t=0){let r,n;void 0!==e?r=e:(n=C.exports.generateMnemonic(256),r=C.exports.mnemonicToSeedSync(n).toString("hex"));const i="m/44'/789'/"+t+"'/0'/0'",{key:o,chainCode:a}=Ms.derivePath(i,r,2147483648),s=o.toString("hex"),u=Ms.getPublicKey(o,!1).toString("hex");if(u!==Us(s))throw Error("Bip32 public key does not match with Lamden public key!");return{sk:s,vk:u,derivationIndex:t,seed:void 0!==e?null:r,mnemonic:void 0!==e?null:n}}(e,t)},sign:Ps,verify:Ds});class qs{constructor(){this._events={}}on(e,t){this._events[e]||(this._events[e]=[]),this._events[e].push(t)}removeListener(e,t){if(!this._events[e])throw new Error(`Can't remove a listener. Event "${e}" doesn't exits.`);this._events[e]=this._events[e].filter((e=>e!==t))}emit(e,t){if(!this._events[e])return;this._events[e].forEach((e=>{e(t)}))}}var Ws={exports:{}};!function(e,t){var r=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r)return r;throw new Error("unable to locate global object")}();e.exports=t=r.fetch,r.fetch&&(t.default=r.fetch.bind(r)),t.Headers=r.Headers,t.Request=r.Request,t.Response=r.Response}(Ws,Ws.exports);var Fs,Ks=Ws.exports,Ys={exports:{}};Fs=Ys,function(e){var t,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,o="[BigNumber Error] ",a=o+"Number primitive has more than 15 significant digits: ",s=1e14,u=14,h=9007199254740991,l=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],f=1e7,c=1e9;function d(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,o=e[0]+"";nh^r?1:-1;for(s=(u=i.length)<(h=o.length)?u:h,a=0;ao[a]^r?1:-1;return u==h?0:u>h^r?1:-1}function y(e,t,r,n){if(er||e!==i(e))throw Error(o+(n||"Argument")+("number"==typeof e?er?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function b(e){var t=e.c.length-1;return d(e.e/u)==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 tN?g.c=g.e=null:e.e=10;f/=10,l++);return void(l>N?g.c=g.e=null:(g.e=l,g.c=[e]))}p=String(e)}else{if(!r.test(p=String(e)))return E(g,p,c);g.s=45==p.charCodeAt(0)?(p=p.slice(1),-1):1}(l=p.indexOf("."))>-1&&(p=p.replace(".","")),(f=p.search(/e/i))>0?(l<0&&(l=f),l+=+p.slice(f+1),p=p.substring(0,f)):l<0&&(l=p.length)}else{if(y(t,2,W.length,"Base"),10==t)return $(g=new F(e),L+g.e+1,j);if(p=String(e),c="number"==typeof e){if(0*e!=0)return E(g,p,c,t);if(g.s=1/e<0?(p=p.slice(1),-1):1,F.DEBUG&&p.replace(/^0\.0*|\./,"").length>15)throw Error(a+e)}else g.s=45===p.charCodeAt(0)?(p=p.slice(1),-1):1;for(n=W.slice(0,t),l=f=0,d=p.length;fl){l=d;continue}}else if(!s&&(p==p.toUpperCase()&&(p=p.toLowerCase())||p==p.toLowerCase()&&(p=p.toUpperCase()))){s=!0,f=-1,l=0;continue}return E(g,String(e),c,t)}c=!1,(l=(p=_(p,t,10,g.s)).indexOf("."))>-1?p=p.replace(".",""):l=p.length}for(f=0;48===p.charCodeAt(f);f++);for(d=p.length;48===p.charCodeAt(--d););if(p=p.slice(f,++d)){if(d-=f,c&&F.DEBUG&&d>15&&(e>h||e!==i(e)))throw Error(a+g.s*e);if((l=l-f-1)>N)g.c=g.e=null;else if(l=I)?m(u,a):v(u,a,"0");else if(o=(e=$(new F(e),t,r)).e,s=(u=p(e.c)).length,1==n||2==n&&(t<=o||o<=U)){for(;ss){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=o-s)>0)for(o+1==s&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function Y(e,t){for(var r,n=1,i=new F(e[0]);n=10;i/=10,n++);return(r=n+r*u-1)>N?e.c=e.e=null:r=10;c/=10,a++);if((h=t-a)<0)h+=u,f=t,g=(d=y[p=0])/b[a-f-1]%10|0;else if((p=n((h+1)/u))>=y.length){if(!o)break e;for(;y.length<=p;y.push(0));d=g=0,a=1,f=(h%=u)-u+1}else{for(d=c=y[p],a=1;c>=10;c/=10,a++);g=(f=(h%=u)-u+a)<0?0:d/b[a-f-1]%10|0}if(o=o||t<0||null!=y[p+1]||(f<0?d:d%b[a-f-1]),o=r<4?(g||o)&&(0==r||r==(e.s<0?3:2)):g>5||5==g&&(4==r||o||6==r&&(h>0?f>0?d/b[a-f]:0:y[p-1])%10&1||r==(e.s<0?8:7)),t<1||!y[0])return y.length=0,o?(t-=e.e+1,y[0]=b[(u-t%u)%u],e.e=-t||0):y[0]=e.e=0,e;if(0==h?(y.length=p,c=1,p--):(y.length=p+1,c=b[u-h],y[p]=f>0?i(d/b[a-f]%b[f])*c:0),o)for(;;){if(0==p){for(h=1,f=y[0];f>=10;f/=10,h++);for(f=y[0]+=c,c=1;f>=10;f/=10,c++);h!=c&&(e.e++,y[0]==s&&(y[0]=1));break}if(y[p]+=c,y[p]!=s)break;y[p--]=0,c=1}for(h=y.length;0===y[--h];y.pop());}e.e>N?e.c=e.e=null:e.e=I?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(o+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(y(r=e[t],0,c,t),L=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(y(r=e[t],0,8,t),j=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(y(r[0],-c,0,t),y(r[1],0,c,t),U=r[0],I=r[1]):(y(r,-c,c,t),U=-(I=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)y(r[0],-c,-1,t),y(r[1],1,c,t),C=r[0],N=r[1];else{if(y(r,-c,c,t),!r)throw Error(o+t+" cannot be zero: "+r);C=-(N=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(o+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw P=!r,Error(o+"crypto unavailable");P=r}else P=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(y(r=e[t],0,9,t),D=r),e.hasOwnProperty(t="POW_PRECISION")&&(y(r=e[t],0,c,t),z=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(o+t+" not an object: "+r);q=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(o+t+" invalid: "+r);W=r}}return{DECIMAL_PLACES:L,ROUNDING_MODE:j,EXPONENTIAL_AT:[U,I],RANGE:[C,N],CRYPTO:P,MODULO_MODE:D,POW_PRECISION:z,FORMAT:q,ALPHABET:W}},F.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!F.DEBUG)return!0;var t,r,n=e.c,a=e.e,h=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===h||-1===h)&&a>=-c&&a<=c&&a===i(a)){if(0===n[0]){if(0===a&&1===n.length)return!0;break e}if((t=(a+1)%u)<1&&(t+=u),String(n[0]).length==t){for(t=0;t=s||r!==i(r))break e;if(0!==r)return!0}}}else if(null===n&&null===a&&(null===h||1===h||-1===h))return!0;throw Error(o+"Invalid BigNumber: "+e)},F.maximum=F.max=function(){return Y(arguments,O.lt)},F.minimum=F.min=function(){return Y(arguments,O.gt)},F.random=(S=9007199254740992,k=Math.random()*S&2097151?function(){return i(Math.random()*S)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,a,s,h,f=0,d=[],p=new F(M);if(null==e?e=L:y(e,0,c),s=n(e/u),P)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(s*=2));f>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[f]=r[0],t[f+1]=r[1]):(d.push(h%1e14),f+=2);f=s/2}else{if(!crypto.randomBytes)throw P=!1,Error(o+"crypto unavailable");for(t=crypto.randomBytes(s*=7);f=9e15?crypto.randomBytes(7).copy(t,f):(d.push(h%1e14),f+=7);f=s/7}if(!P)for(;f=10;h/=10,f++);fr-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/r|0,a[i]%=r)}return a.reverse()}return function(r,n,i,o,a){var s,u,h,l,f,c,d,g,y=r.indexOf("."),b=L,m=j;for(y>=0&&(l=z,z=0,r=r.replace(".",""),c=(g=new F(n)).pow(r.length-y),z=l,g.c=t(v(p(c.c),c.e,"0"),10,i,e),g.e=g.c.length),h=l=(d=t(r,n,i,a?(s=W,e):(s=e,W))).length;0==d[--l];d.pop());if(!d[0])return s.charAt(0);if(y<0?--h:(c.c=d,c.e=h,c.s=o,d=(c=w(c,g,b,m,i)).c,f=c.r,h=c.e),y=d[u=h+b+1],l=i/2,f=f||u<0||null!=d[u+1],f=m<4?(null!=y||f)&&(0==m||m==(c.s<0?3:2)):y>l||y==l&&(4==m||f||6==m&&1&d[u-1]||m==(c.s<0?8:7)),u<1||!d[0])r=f?v(s.charAt(1),-b,s.charAt(0)):s.charAt(0);else{if(d.length=u,f)for(--i;++d[--u]>i;)d[u]=0,u||(++h,d=[1].concat(d));for(l=d.length;!d[--l];);for(y=0,r="";y<=l;r+=s.charAt(d[y++]));r=v(r,h,s.charAt(0))}return r}}(),w=function(){function e(e,t,r){var n,i,o,a,s=0,u=e.length,h=t%f,l=t/f|0;for(e=e.slice();u--;)s=((i=h*(o=e[u]%f)+(n=l*o+(a=e[u]/f|0)*h)%f*f+s)/r|0)+(n/f|0)+l*a,e[u]=i%r;return s&&(e=[s].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;it[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]1;e.splice(0,1));}return function(n,o,a,h,l){var f,c,p,g,y,b,m,v,w,_,E,S,k,x,R,A,T,B=n.s==o.s?1:-1,O=n.c,M=o.c;if(!(O&&O[0]&&M&&M[0]))return new F(n.s&&o.s&&(O?!M||O[0]!=M[0]:M)?O&&0==O[0]||!M?0*B:B/0:NaN);for(w=(v=new F(B)).c=[],B=a+(c=n.e-o.e)+1,l||(l=s,c=d(n.e/u)-d(o.e/u),B=B/u|0),p=0;M[p]==(O[p]||0);p++);if(M[p]>(O[p]||0)&&c--,B<0)w.push(1),g=!0;else{for(x=O.length,A=M.length,p=0,B+=2,(y=i(l/(M[0]+1)))>1&&(M=e(M,y,l),O=e(O,y,l),A=M.length,x=O.length),k=A,E=(_=O.slice(0,A)).length;E=l/2&&R++;do{if(y=0,(f=t(M,_,A,E))<0){if(S=_[0],A!=E&&(S=S*l+(_[1]||0)),(y=i(S/R))>1)for(y>=l&&(y=l-1),m=(b=e(M,y,l)).length,E=_.length;1==t(b,_,m,E);)y--,r(b,A=10;B/=10,p++);$(v,a+(v.e=p+c*u-1)+1,h,g)}else v.e=c,v.r=+g;return v}}(),x=/^(-?)0([xbo])(?=\w[\w.]*$)/i,R=/^([^.]+)\.$/,A=/^\.([^.]+)$/,T=/^-?(Infinity|NaN)$/,B=/^\s*\+(?=[\w.])|^\s+|\s+$/g,E=function(e,t,r,n){var i,a=r?t:t.replace(B,"");if(T.test(a))e.s=isNaN(a)?null:a<0?-1:1;else{if(!r&&(a=a.replace(x,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,a=a.replace(R,"$1").replace(A,"0.$1")),t!=a))return new F(a,i);if(F.DEBUG)throw Error(o+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},O.absoluteValue=O.abs=function(){var e=new F(this);return e.s<0&&(e.s=1),e},O.comparedTo=function(e,t){return g(this,new F(e,t))},O.decimalPlaces=O.dp=function(e,t){var r,n,i,o=this;if(null!=e)return y(e,0,c),null==t?t=j:y(t,0,8),$(new F(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-d(this.e/u))*u,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},O.dividedBy=O.div=function(e,t){return w(this,new F(e,t),L,j)},O.dividedToIntegerBy=O.idiv=function(e,t){return w(this,new F(e,t),0,1)},O.exponentiatedBy=O.pow=function(e,t){var r,a,s,h,l,f,c,d,p=this;if((e=new F(e)).c&&!e.isInteger())throw Error(o+"Exponent not an integer: "+V(e));if(null!=t&&(t=new F(t)),l=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return d=new F(Math.pow(+V(p),l?2-b(e):+V(e))),t?d.mod(t):d;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new F(NaN);(a=!f&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||l&&p.c[1]>=24e7:p.c[0]<8e13||l&&p.c[0]<=9999975e7)))return h=p.s<0&&b(e)?-0:0,p.e>-1&&(h=1/h),new F(f?1/h:h);z&&(h=n(z/u+2))}for(l?(r=new F(.5),f&&(e.s=1),c=b(e)):c=(s=Math.abs(+V(e)))%2,d=new F(M);;){if(c){if(!(d=d.times(p)).c)break;h?d.c.length>h&&(d.c.length=h):a&&(d=d.mod(t))}if(s){if(0===(s=i(s/2)))break;c=s%2}else if($(e=e.times(r),e.e+1,1),e.e>14)c=b(e);else{if(0==(s=+V(e)))break;c=s%2}p=p.times(p),h?p.c&&p.c.length>h&&(p.c.length=h):a&&(p=p.mod(t))}return a?d:(f&&(d=M.div(d)),t?d.mod(t):h?$(d,z,j,void 0):d)},O.integerValue=function(e){var t=new F(this);return null==e?e=j:y(e,0,8),$(t,t.e+1,e)},O.isEqualTo=O.eq=function(e,t){return 0===g(this,new F(e,t))},O.isFinite=function(){return!!this.c},O.isGreaterThan=O.gt=function(e,t){return g(this,new F(e,t))>0},O.isGreaterThanOrEqualTo=O.gte=function(e,t){return 1===(t=g(this,new F(e,t)))||0===t},O.isInteger=function(){return!!this.c&&d(this.e/u)>this.c.length-2},O.isLessThan=O.lt=function(e,t){return g(this,new F(e,t))<0},O.isLessThanOrEqualTo=O.lte=function(e,t){return-1===(t=g(this,new F(e,t)))||0===t},O.isNaN=function(){return!this.s},O.isNegative=function(){return this.s<0},O.isPositive=function(){return this.s>0},O.isZero=function(){return!!this.c&&0==this.c[0]},O.minus=function(e,t){var r,n,i,o,a=this,h=a.s;if(t=(e=new F(e,t)).s,!h||!t)return new F(NaN);if(h!=t)return e.s=-t,a.plus(e);var l=a.e/u,f=e.e/u,c=a.c,p=e.c;if(!l||!f){if(!c||!p)return c?(e.s=-t,e):new F(p?a:NaN);if(!c[0]||!p[0])return p[0]?(e.s=-t,e):new F(c[0]?a:3==j?-0:0)}if(l=d(l),f=d(f),c=c.slice(),h=l-f){for((o=h<0)?(h=-h,i=c):(f=l,i=p),i.reverse(),t=h;t--;i.push(0));i.reverse()}else for(n=(o=(h=c.length)<(t=p.length))?h:t,h=t=0;t0)for(;t--;c[r++]=0);for(t=s-1;n>h;){if(c[--n]=0;){for(r=0,y=S[i]%w,b=S[i]/w|0,o=i+(a=l);o>i;)r=((c=y*(c=E[--a]%w)+(h=b*c+(p=E[a]/w|0)*y)%w*w+m[o]+r)/v|0)+(h/w|0)+b*p,m[o--]=c%v;m[o]=r}return r?++n:m.splice(0,1),H(e,m,n)},O.negated=function(){var e=new F(this);return e.s=-e.s||null,e},O.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 o=n.e/u,a=e.e/u,h=n.c,l=e.c;if(!o||!a){if(!h||!l)return new F(i/0);if(!h[0]||!l[0])return l[0]?e:new F(h[0]?n:0*i)}if(o=d(o),a=d(a),h=h.slice(),i=o-a){for(i>0?(a=o,r=l):(i=-i,r=h),r.reverse();i--;r.push(0));r.reverse()}for((i=h.length)-(t=l.length)<0&&(r=l,l=h,h=r,t=i),i=0;t;)i=(h[--t]=h[t]+l[t]+i)/s|0,h[t]=s===h[t]?0:h[t]%s;return i&&(h=[i].concat(h),++a),H(e,h,a)},O.precision=O.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return y(e,1,c),null==t?t=j:y(t,0,8),$(new F(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*u+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},O.shiftedBy=function(e){return y(e,-9007199254740991,h),this.times("1e"+e)},O.squareRoot=O.sqrt=function(){var e,t,r,n,i,o=this,a=o.c,s=o.s,u=o.e,h=L+4,l=new F("0.5");if(1!==s||!a||!a[0])return new F(!s||s<0&&(!a||a[0])?NaN:a?o:1/0);if(0==(s=Math.sqrt(+V(o)))||s==1/0?(((t=p(a)).length+u)%2==0&&(t+="0"),s=Math.sqrt(+t),u=d((u+1)/2)-(u<0||u%2),r=new F(t=s==1/0?"1e"+u:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+u)):r=new F(s+""),r.c[0])for((s=(u=r.e)+h)<3&&(s=0);;)if(i=r,r=l.times(i.plus(w(o,i,h,1))),p(i.c).slice(0,s)===(t=p(r.c)).slice(0,s)){if(r.e0&&g>0){for(a=g%u||u,f=p.substr(0,a);a0&&(f+=l+p.slice(a)),d&&(f="-"+f)}n=c?f+(r.decimalSeparator||"")+((h=+r.fractionGroupSize)?c.replace(new RegExp("\\d{"+h+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):c):f}return(r.prefix||"")+n+(r.suffix||"")},O.toFraction=function(e){var t,r,n,i,a,s,h,f,c,d,g,y,b=this,m=b.c;if(null!=e&&(!(h=new F(e)).isInteger()&&(h.c||1!==h.s)||h.lt(M)))throw Error(o+"Argument "+(h.isInteger()?"out of range: ":"not an integer: ")+V(h));if(!m)return new F(b);for(t=new F(M),c=r=new F(M),n=f=new F(M),y=p(m),a=t.e=y.length-b.e-1,t.c[0]=l[(s=a%u)<0?u+s:s],e=!e||h.comparedTo(t)>0?a>0?t:c:h,s=N,N=1/0,h=new F(y),f.c[0]=0;d=w(h,t,0,1),1!=(i=r.plus(d.times(n))).comparedTo(e);)r=n,n=i,c=f.plus(d.times(i=c)),f=i,t=h.minus(d.times(i=t)),h=i;return i=w(e.minus(r),n,0,1),f=f.plus(i.times(c)),r=r.plus(i.times(n)),f.s=c.s=b.s,g=w(c,n,a*=2,j).minus(b).abs().comparedTo(w(f,r,a,j).minus(b).abs())<1?[c,n]:[f,r],N=s,g},O.toNumber=function(){return+V(this)},O.toPrecision=function(e,t){return null!=e&&y(e,1,c),K(this,e,t,2)},O.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<=U||i>=I?m(p(r.c),i):v(p(r.c),i,"0"):10===e?t=v(p((r=$(new F(r),L+i+1,j)).c),r.e,"0"):(y(e,2,W.length,"Base"),t=_(v(p(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},O.valueOf=O.toJSON=function(){return V(this)},O._isBigNumber=!0,null!=t&&F.set(t),F}(),t.default=t.BigNumber=t,Fs.exports?Fs.exports=t:(e||(e="undefined"!=typeof self&&self?self:window),e.BigNumber=t)}(e);var Hs=Ys.exports;function $s(e,t){const r=t=>{throw new Error(`Error encoding ${t} to ${e}`)},n=e=>{if(Math.floor(e)===e)return 0;try{return e.toString().split(".")[1].length}catch(e){return 0}},i=e=>e&&"object"==typeof e&&e.constructor===Array,o=e=>e&&"object"==typeof e&&e.constructor===Object,a=e=>e instanceof Date,s=e=>!i(e)&&!isNaN(l(e).toNumber()),u=e=>!!s(e)&&0!==n(e),h=e=>(s(e)||r(e),Hs.isBigNumber(e)||(e=new Hs(e)),{__fixed__:e.toFixed(30).replace(/^0+(\d)|(\d)0+$/gm,"$1$2")}),l=e=>(Hs.isBigNumber(e)||(e=new Hs(e)),e),f=e=>(e=>"boolean"==typeof e)(e)?e:"true"===e||1===e||"false"!==e&&0!==e&&void r(e),c=e=>(e=>"string"==typeof e||e instanceof String)(e)?e:a(e)?e.toISOString():JSON.stringify(e),d=e=>(e=a(e)?e:new Date(e),a(e)||r(e),{__time__:[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()]}),p=e=>{const t=a(e)?e.getTime():new Date(e).getTime(),r=parseInt(t/1e3/60/60/24);return{__delta__:[r,(t-24*r*60*60*1e3)/1e3]}},g=e=>{if(i(e))return b(e);try{e=JSON.parse(e)}catch(t){r(e)}if(i(e))return b(e);r(e)},y=e=>{if(o(e))return b(e);try{e=JSON.parse(e)}catch(t){r(e)}if(o(e))return b(e);r(e)};function b(e){let t=JSON.stringify(e,((e,t)=>"datetime"===e||"datetime.datetime"===e?$s("datetime.datetime",t):"timedelta"===e||"datetime.timedelta"===e?$s("datetime.timedelta",t):"__fixed__"!==e&&u(t)?h(t):t));return JSON.parse(t,((e,t)=>{const r=e=>1===Object.keys(e).length&&["datetime.datetime","datetime","datetime.timedelta","timedelta"].filter((t=>t===Object.keys(e)[0])).length>0;return t.constructor===Array&&t.map((e=>1===Object.keys(e).length&&r(t)?e[Object.keys(e)[0]]:e)),t.constructor===Object&&1===Object.keys(t).length&&r(t)?t[Object.keys(t)[0]]:t}))}const m={str:c,string:c,float:h,int:e=>{if(s(e))return parseInt(e);r(e)},bool:f,boolean:f,dict:y,list:g,Any:()=>t,"datetime.timedelta":p,"datetime.datetime":d,timedelta:p,datetime:d,number:e=>(s(e)||r(e),u(e)?(Hs.isBigNumber(e)||(e=new Hs(e)),{__fixed__:e.toFixed(30).replace(/^0+(\d)|(\d)0+$/gm,"$1$2")}):(e=>!!s(e)&&0===n(e))(e)?parseInt(e):void 0),object:e=>{try{return g(e)}catch(t){return y(e)}},bigNumber:l};if(Object.keys(m).includes(e))return m[e](t);throw new Error(`Error: ${e} is not a valid encoder type.`)}Hs.config({RANGE:[-30,30],EXPONENTIAL_AT:1e9}),Hs.set({DECIMAL_PLACES:30,ROUNDING_MODE:Hs.ROUND_DOWN}),$s.BigNumber=Hs;const{validateTypes:Vs}=o;class Gs{constructor(e){if(!Vs.isObjectWithKeys(e))throw new Error("Expected Object and got Type: "+typeof e);if(!Vs.isArrayWithValues(e.hosts))throw new Error("HOSTS Required (Type: Array)");this.hosts=this.validateHosts(e.hosts)}vaidateProtocol(e){if(["https://","http://"].map((t=>e.includes(t))).includes(!0))return e;throw new Error("Host String must include http:// or https://")}validateHosts(e){return e.map((e=>this.vaidateProtocol(e.toLowerCase())))}get host(){return this.hosts[Math.floor(Math.random()*this.hosts.length)]}get url(){return this.host}send(e,t,r,n,i){let o="";Object.keys(r).includes("parms")&&(o=this.createParms(r.parms));let a={};if("POST"===e){let t={"Content-Type":"application/json"};a.method=e,a.headers=t,a.body=r}return Ks(`${n||this.url}${t}${o}`,a).then((async e=>{if(200===e.status){let t=await e.json();return i(t,void 0),t}{let t=!!Vs.isStringWithValue(e.statusText)&&e.statusText;return i(void 0,t),t}})).catch((e=>i(void 0,e.toString())))}createParms(e){if(0===Object.keys(e).length)return"";let t="?";return Object.keys(e).forEach((r=>{t=`${t}${r}=${e[r]}&`})),t.slice(0,-1)}async getContractInfo(e){const t=e=>{try{if(e.name)return e}catch(e){}return null};let r=`/contracts/${e}`;return this.send("GET",r,{},void 0,((e,r)=>t(e))).then((e=>t(e)))}async getVariable(e,t,r=""){let n={};Vs.isStringWithValue(r)&&(n.key=r);let i=`/contracts/${e}/${t}/`;const o=e=>{try{if(e.value)return e.value}catch(e){}return null};return this.send("GET",i,{parms:n},void 0,((e,t)=>o(e))).then((e=>o(e)))}async getContractMethods(e){const t=e=>{try{if(e.methods)return e.methods}catch(e){}return[]};let r=`/contracts/${e}/methods`;return this.send("GET",r,{},void 0,((e,r)=>t(e))).then((e=>t(e)))}async getContractVariables(e){const t=e=>{try{if(e.variables)return e}catch(e){}return{}};let r=`/contracts/${e}/variables`;return this.send("GET",r,{},void 0,((e,r)=>t(e))).then((e=>t(e)))}async pingServer(){const e=e=>{try{if(e.status)return!0}catch(e){}return!1};let t=await this.send("GET","/ping",{},void 0,((t,r)=>e(t)));return e(t)}async getCurrencyBalance(e){let t=await this.getVariable("currency","balances",e);return t?t.__fixed__?$s("bigNumber",t.__fixed__):$s("bigNumber",t.toString()):$s("bigNumber",0)}async contractExists(e){const t=e=>{try{if(e.name)return!0}catch(e){}return!1};let r=`/contracts/${e}`;return this.send("GET",r,{},void 0,((e,r)=>t(e))).then((e=>t(e)))}async sendTransaction(e,t,r){return this.send("POST","/",JSON.stringify(e),t,((e,t)=>t?r?void r(void 0,t):t:r?void r(e,void 0):e))}async getNonce(e,t){if(!Vs.isStringHex(e))return`${e} is not a hex string.`;let r=`/nonce/${e}`,n=this.host;return this.send("GET",r,{},n,((r,i)=>i?t?void t(void 0,`Unable to get nonce for ${e} on network ${n}`):`Unable to get nonce for ${e} on network ${n}`:(r.masternode=n,t?void t(r,void 0):r)))}checkTransaction(e,t){const r={hash:e};return this.send("GET","/tx",{parms:r},void 0,((e,r)=>r?t?void t(void 0,r):r:t?void t(e,void 0):e))}}const{validateTypes:Js}=o;class Xs{constructor(e){if(!Js.isObjectWithKeys(e))throw new Error("Expected Network Info Object and got Type: "+typeof e);if(!Js.isArrayWithValues(e.hosts))throw new Error("HOSTS Required (Type: Array)");this.type=Js.isStringWithValue(e.type)?e.type.toLowerCase():"custom",this.events=new qs,this.hosts=this.validateHosts(e.hosts),this.currencySymbol=Js.isStringWithValue(e.currencySymbol)?e.currencySymbol:"TAU",this.name=Js.isStringWithValue(e.name)?e.name:"lamden network",this.lamden=!!Js.isBoolean(e.lamden)&&e.lamden,this.blockExplorer=Js.isStringWithValue(e.blockExplorer)?e.blockExplorer:void 0,this.online=!1;try{this.API=new Gs(e)}catch(e){throw new Error(e)}}vaidateProtocol(e){if(["https://","http://"].map((t=>e.includes(t))).includes(!0))return e;throw new Error("Host String must include http:// or https://")}validateHosts(e){return e.map((e=>this.vaidateProtocol(e.toLowerCase())))}async ping(e){return this.online=await this.API.pingServer(),this.events.emit("online",this.online),Js.isFunction(e)&&e(this.online),this.online}get host(){return this.hosts[Math.floor(Math.random()*this.hosts.length)]}get url(){return this.host}getNetworkInfo(){return{name:this.name,lamden:this.lamden,type:this.type,hosts:this.hosts,url:this.url,online:this.online}}}const{validateTypes:Zs}=o;class Qs extends Xs{constructor(e,t,r){if(Zs.isSpecificClass(e,"Network")?super(e.getNetworkInfo()):super(e),!Zs.isObjectWithKeys(t))throw new Error("txInfo object not found");if(!Zs.isStringHex(t.senderVk))throw new Error("Sender Public Key Required (Type: Hex String)");if(!Zs.isStringWithValue(t.contractName))throw new Error("Contract Name Required (Type: String)");if(!Zs.isStringWithValue(t.methodName))throw new Error("Method Required (Type: String)");if(!Zs.isInteger(t.stampLimit))throw new Error("Stamps Limit Required (Type: Integer)");if(this.uid=Zs.isStringWithValue(t.uid)?t.uid:void 0,this.sender=t.senderVk,this.contract=t.contractName,this.method=t.methodName,this.kwargs={},Zs.isObject(t.kwargs)&&(this.kwargs=t.kwargs),this.stampLimit=t.stampLimit,void 0!==t.nonce){if(!Zs.isInteger(t.nonce))throw new Error(`arg[6] Nonce is required to be an Integer, type ${typeof t.none} was given`);this.nonce=t.nonce}if(void 0!==t.processor){if(!Zs.isStringWithValue(t.processor))throw new Error(`arg[7] Processor is required to be a String, type ${typeof t.processor} was given`);this.processor=t.processor}this.signature,this.transactionSigned=!1,this.nonceResult={},this.txSendResult={errors:[]},this.txBlockResult={},this.txHash,this.txCheckResult={},this.txCheckAttempts=0,this.txCheckLimit=10,r&&(r.uid&&(this.uid=r.uid),Zs.isObjectWithKeys(r.txSendResult)&&(this.txSendResult=r.txSendResult),Zs.isObjectWithKeys(r.nonceResult)&&(this.nonceResult=r.nonceResult,Zs.isInteger(this.nonceResult.nonce)&&(this.nonce=this.nonceResult.nonce),Zs.isStringWithValue(this.nonceResult.processor)&&(this.processor=this.nonceResult.processor)),Zs.isObjectWithKeys(r.txSendResult)&&(this.txSendResult=r.txSendResult,this.txSendResult.hash&&(this.txHash=this.txSendResult.hash)),Zs.isObjectWithKeys(r.txBlockResult)&&(this.txBlockResult=r.txBlockResult),Zs.isObjectWithKeys(r.resultInfo)&&(this.resultInfo=r.resultInfo)),this.makePayload()}makePayload(){this.payload={contract:this.contract,function:this.method,kwargs:this.kwargs,nonce:this.nonce,processor:this.processor,sender:this.sender,stamps_supplied:this.stampLimit},this.sortedPayload=this.sortObject(this.payload)}makeTransaction(){this.tx={metadata:{signature:this.signature,timestamp:parseInt(+new Date/1e3)},payload:this.sortedPayload.orderedObj}}verifySignature(){if(!this.transactionSigned)throw new Error("Transaction has not be been signed. Use the sign() method first.");const e=Buffer.from(this.sortedPayload.json),t=new Uint8Array(e);return Ds(this.sender,t,this.signature)}sign(e,t){const r=Buffer.from(this.sortedPayload.json),n=new Uint8Array(r);this.signature=t?t.sign(n):Ps(e,n),this.transactionSigned=!0}sortObject(e){const t=(e=>{const t=e=>Object.prototype.toString.call(e),r=e=>"[object Object]"===t(e),n=e=>(Object.keys(e).forEach((i=>{var o;o=e[i],"[object Array]"===t(o)&&(e[i]=e[i].map((e=>r(e)?n(e):e))),r(e[i])&&(e[i]=n(e[i]))})),(e=>{const t={};return Object.keys(e).sort().forEach((r=>t[r]=e[r])),t})(e));if(!r(e))throw new TypeError("Not a valid Object");try{e=JSON.parse(JSON.stringify(e))}catch(e){throw new TypeError("Not a valid JSON Object")}return n(e)})(e);return{orderedObj:t,json:JSON.stringify(t)}}async getNonce(e){let t=(new Date).toUTCString();if(this.nonceResult=await this.API.getNonce(this.sender),void 0===this.nonceResult.nonce)throw new Error(this.nonceResult);return this.nonceResult.timestamp=t,this.nonce=this.nonceResult.nonce,this.processor=this.nonceResult.processor,this.nonceMasternode=this.nonceResult.masternode,this.makePayload(),e?e(this.nonceResult):this.nonceResult}async send(e,t,r){if(!Zs.isStringWithValue(e)&&!this.transactionSigned)throw new Error("Transation Not Signed: Private key needed or call sign() first");let n=(new Date).toUTCString();try{!isNaN(this.nonce)&&Zs.isStringWithValue(this.processor)||await this.getNonce(),Zs.isStringWithValue(e)&&this.sign(e),this.makeTransaction();let t=r;!t&&this.nonceMasternode&&(t=this.nonceMasternode);let n=await this.API.sendTransaction(this.tx,t);!n||Zs.isStringWithValue(n)?this.txSendResult.errors=[n||"Unknown Transaction Error"]:n.error?this.txSendResult.errors=[n.error]:this.txSendResult=n}catch(e){this.txSendResult.errors=[e.message]}return this.txSendResult.timestamp=n,this.handleMasterNodeResponse(this.txSendResult,t)}checkForTransactionResult(e){return new Promise((t=>{let r=setTimeout(async function n(){this.txCheckAttempts=this.txCheckAttempts+1;let i=await this.API.checkTransaction(this.txHash),o=!1,a=(new Date).toUTCString();"string"!=typeof i&&i?i.error?"Transaction not found."===i.error?this.txCheckAttempts0&&(Zs.isArray(this.txCheckResult.errors)||(this.txCheckResult.errors=[]),this.txCheckResult.errors.push("This transaction returned a non-zero status code")),this.txCheckResult.timestamp=a,clearTimeout(r),t(this.handleMasterNodeResponse(this.txCheckResult,e)))}.bind(this),1e3)}))}handleMasterNodeResponse(e,t){return Zs.isStringWithValue(e.hash)&&Zs.isStringWithValue(e.success)?(this.txHash=e.hash,this.setPendingBlockInfo()):(this.setBlockResultInfo(e),this.txBlockResult=e),this.events.emit("response",e,this.resultInfo.subtitle),Zs.isFunction(t)&&t(e),e}setPendingBlockInfo(){return this.resultInfo={title:"Transaction Pending",subtitle:"Your transaction was submitted and is being processed",message:`Tx Hash: ${this.txHash}`,type:"success"},this.resultInfo}setBlockResultInfo(e){let t=!1,r="returned an error and ",n=Zs.isNumber(e.status)?e.status:void 0,i=e.stampsUsed||e.stamps_used||0,o="";return Zs.isArrayWithValues(e.errors)&&(t=!0,o=`This transaction returned ${e.errors.length} errors.`,e.result&&e.result.includes("AssertionError")&&e.errors.push(e.result)),n&&t&&(r=`returned status code ${n} and `),this.resultInfo={title:"Transaction "+(t?"Failed":"Successful"),subtitle:`Your transaction ${t?`${r} `:""}used ${i} stamps`,message:o,type:""+(t?"error":"success"),errorInfo:t?e.errors:void 0,returnResult:e.result||"",stampsUsed:i,statusCode:n},this.resultInfo}getResultInfo(){return this.resultInfo}getTxInfo(){return{senderVk:this.sender,contractName:this.contract,methodName:this.method,kwargs:this.kwargs,stampLimit:this.stampLimit}}getAllInfo(){return{uid:this.uid,txHash:this.txHash,signed:this.transactionSigned,tx:this.tx,signature:this.signature,networkInfo:this.getNetworkInfo(),txInfo:this.getTxInfo(),txSendResult:this.txSendResult,txBlockResult:this.txBlockResult,resultInfo:this.getResultInfo(),nonceResult:this.nonceResult}}}const{validateTypes:eu}=o;const{validateTypes:tu,assertTypes:ru}=o;globalThis.Buffer=Ne.Buffer;var nu={TransactionBuilder:Qs,TransactionBatcher:class extends Xs{constructor(e){eu.isSpecificClass(e,"Network")?super(e.getNetworkInfo()):super(e),this.txBatches={},this.overflow=[],this.nonceResults={},this.running=!1}addTransaction(e){this.running?this.overflow.push(e):(this.validateTransactionInfo(e),this.txBatches[e.senderVk]||(this.txBatches[e.senderVk]=[]),this.txBatches[e.senderVk].push(e))}addTransactionList(e){e.forEach((e=>this.addTransaction(e)))}processOverflow(){const e=this.overflow;this.overflow=[],e.forEach((e=>this.addTransaction(e)))}hasTransactions(){let e=Object.keys(this.txBatches).map((e=>this.txBatches[e].length));return e.filter((e=>0===e)),e.length>0}validateTransactionInfo(e){try{new Qs(e)}catch(e){return!1}return!0}async getStartingNonce(e,t){let r=(new Date).toUTCString(),n=await this.API.getNonce(e);if(void 0===n.nonce)throw new Error(n);return n.timestamp=r,this.nonceResults[e]=n,t&&t(n),n}async sendAllBatches(e){if(this.running)return;let t=[];this.running=!0,await Promise.all(Object.keys(this.txBatches).map((r=>{const n=this.txBatches[r].splice(0,15);return n.length<=15&&delete this.txBatches[r],new Promise((async i=>{if(0===n.length&&i(),!e[r])throw new Error(`Cannot sign batch for ${r}. No signing key provided.`);let o=await this.getStartingNonce(r),a=this.setBatchNonces(o,n);this.signBatch(a,e[r]),this.sendBatch(a).then((e=>{t=[...t,...e],i()}))}))})));try{return Promise.all(t)}catch(e){}finally{this.running=!1,this.processOverflow()}}setBatchNonces(e,t){return t.map(((t,r)=>(t.nonce=e.nonce+r,t.processor=e.processor,new Qs({hosts:[e.masternode]},t)))).sort(((e,t)=>e.nonce-t.nonce))}signBatch(e,t){e.forEach((e=>e.sign(t)))}sendBatch(e){let t=[];return new Promise((r=>{e.forEach(((n,i)=>{setTimeout((()=>{t[i]=n.send().then((()=>n)),(n=>{n+1===e.length&&r(t)})(i)}),1200*i)}))}))}},Masternode_API:Gs,Network:Xs,wallet:zs,Keystore:class{constructor(e){this.KEYSTORE_VERSION="1.0",this.password=null,this.encryptedData=null,this.keyList=(()=>{let e=[],t=this,r=[];const n=t=>{e.push(t),i()},i=()=>{r=[],e.forEach((e=>{let t=Ls({sk:e.sk,keepPrivate:!0});t={...t,...e},delete t.sk,r.push(t)}))};return{getWallets:()=>r,getWallet:e=>r.find((t=>t.vk===e)),addKey:n,clearKeys:()=>{e=[],i()},numOfKeys:()=>e.length,deleteKey:t=>{e.splice(t,1),i()},createKeystore:(r,n)=>JSON.stringify({data:x(r,{version:t.KEYSTORE_VERSION,keyList:e}),w:n?A("n1ahcKc0lb",n):""}),decryptKeystore:(e,r)=>{let i=R(e,r);if(!i)throw new Error("Incorrect Keystore Password.");ru.isArray(i.keyList),i.keyList.forEach((e=>ru.isStringWithValue(e.sk))),i.keyList.forEach((e=>n(e))),t.version=i.version}}})(),e&&(e.key&&this.addKey(e.key),e.keyList&&this.addKeys(e.keyList),e.keystoreData&&this.addKeystoreData(e.keystoreData))}addKeys(e){ru.isArray(e),e.forEach((e=>this.addKey(e)))}addKey(e){ru.isObjectWithKeys(e),ru.isStringWithValue(e.sk),tu.isStringWithValue(e.vk)&&delete e.vk,this.keyList.addKey(e)}addKeystoreData(e){tu.isString(e)&&(e=JSON.parse(e)),this.validateKeyStore(e)&&(this.encryptedData=e)}getPasswordHint(e){if(!this.encryptedData&&!e)throw new Error("No keystore data found.");return e?tu.isString(e)&&(e=JSON.parse(e)):e=this.encryptedData,e.w?T("n1ahcKc0lb",e.w):""}deleteKey(e){if(ru.isInteger(e),0!==this.keyList.numOfKeys()){if(e<0||e>=this.keyList.numOfKeys())throw new Error("Key index out of range.");this.keyList.deleteKey(e)}}clearKeys(){this.keyList.clearKeys()}get wallets(){return this.keyList.getWallets()}getWallet(e){return this.keyList.getWallet(e)}validateKeyStore(e){ru.isObjectWithKeys(e);try{let t=JSON.parse(e.data);if(!t.ct||!t.iv||!t.s)throw new Error("This is not a valid keystore file.")}catch(e){throw new Error("This is not a valid keystore file.")}return!0}createKeystore(e,t){return ru.isStringWithValue(e),t&&ru.isStringWithValue(t),this.keyList.createKeystore(e,t)}decryptKeystore(e,t){if(t&&this.addKeystoreData(t),!this.encryptedData)throw new Error("No keystoreData to decrypt.");try{this.keyList.decryptKeystore(e,this.encryptedData.data)}catch(e){throw new Error("Incorrect Keystore Password.")}}},Encoder:$s,utils:L};export{nu as default}; diff --git a/package.json b/package.json index e1301e2..8ea492c 100644 --- a/package.json +++ b/package.json @@ -5,10 +5,10 @@ "main": "dist/cjs/lamden.js", "module": "dist/esm/lamden.js", "scripts": { - "test": "npm run build && mocha --recursive --timeout 10000", + "test": "npm run build && mocha --recursive --timeout 30000", "tests": "npm run test", - "test-network": "npm run build && mocha test/network-test.js", - "test-masternode-api": "npm run build && mocha test/masternode_api-test.js", + "test-network": "npm run build && mocha test/network-test.js --timeout 10000", + "test-masternode-api": "npm run build && mocha test/masternode_api-test.js --timeout 10000", "test-transaction-builder": "npm run build && mocha test/transactionBuilder-test.js --timeout 10000", "test-transaction-batcher": "npm run build && mocha test/transactionBatcher-test.js --timeout 60000", "test-wallet": "npm run build && mocha test/wallet-test.js", diff --git a/src/js/wallet.js b/src/js/wallet.js index f737c07..7dbe6ab 100644 --- a/src/js/wallet.js +++ b/src/js/wallet.js @@ -121,7 +121,7 @@ export function new_wallet(seed = null) { /** * - * @param mnemonic 24 word seed phrase + * @param seed Bip39 seed phrase (128 characters in hex) * @param derivationIndex bip32 derivation key index * @returns {{derivationIndex: number, vk: string, sk: string, mnemonic: string}} * derivationIndex: bip32 derivation key index @@ -165,7 +165,7 @@ function generate_keys_bip39(seed = undefined, derivationIndex = 0) { } /** - * @param mnemonic 24 word seed phrase + * @param seed Bip39 seed phrase (128 characters in hex) * @param derivationIndex bip32 derivation key index * * @return {{derivationIndex: number, vk: string, sk: string, mnemonic: (string|undefined)}} { sk, vk, derivationIndex, mnemonic } diff --git a/test/browsers/wallet-test.js b/test/browsers/wallet-test.js index d6d724f..50c216a 100644 --- a/test/browsers/wallet-test.js +++ b/test/browsers/wallet-test.js @@ -49,22 +49,18 @@ describe("Browsers Tests: Test Lamden Wallet methods", async () => { expect(validateTypes.isNumber(newWallet.derivationIndex)).to.be(true); expect(newWallet.derivationIndex).to.be(0); }), - it("creates a bip39 / bip32 compatible lamden keypair from mnemonic", async () => { - const mnemonic = - "ripple junk access broom element fitness side example ramp flush model creek nest face rent jacket ahead come short find over family wise comfort"; + it("creates a bip39 / bip32 compatible lamden keypair from seed", async () => { + const seed = 'd3ad26bd89d54d0c22bb32d34ea9f06c567ba060d8e1518974d807180b886c643bfb7f455bd3db2c767a17c089aab20db97cf0f0184d730b9d20be0c7b6cc6cc' const derivationIndex = 127; - let newWallet = await driver.executeScript(`return Lamden.wallet.new_wallet_bip39('${mnemonic}', ${derivationIndex})`); + let newWallet = await driver.executeScript(`return Lamden.wallet.new_wallet_bip39('${seed}', ${derivationIndex})`); expect(validateTypes.isStringHex(newWallet.vk)).to.be(true); - expect(newWallet.vk).to.be( - "d0d2de909bf7c2be3bafbcb3af0b1c50487b80ba48b5700bff35bb927921c607" - ); + expect(newWallet.vk).to.be("d0d2de909bf7c2be3bafbcb3af0b1c50487b80ba48b5700bff35bb927921c607"); expect(validateTypes.isStringHex(newWallet.sk)).to.be(true); - expect(newWallet.sk).to.be( - "86c77748edc039c672cf761d2db1e52d6255b16cd4d626d4b66c67eb224287a8" - ); - expect(newWallet.mnemonic).to.be(mnemonic); + expect(newWallet.sk).to.be("86c77748edc039c672cf761d2db1e52d6255b16cd4d626d4b66c67eb224287a8"); + expect(newWallet.mnemonic).to.be(null); + expect(newWallet.seed).to.be( null ) expect(validateTypes.isNumber(newWallet.derivationIndex)).to.be(true); expect(newWallet.derivationIndex).to.be(127); }); diff --git a/test/transactionBuilder-test.js b/test/transactionBuilder-test.js index 9182ac7..3f02053 100644 --- a/test/transactionBuilder-test.js +++ b/test/transactionBuilder-test.js @@ -265,7 +265,7 @@ describe("Test TransactionBuilder class", () => { expect(resultInfo.type).to.equal("success"); }); it("Sends transactions and can get hash result from masternode", async function () { - this.timeout(20000); + this.timeout(30000); await newTx1.checkForTransactionResult(); let txBlockResult = newTx1.txBlockResult; expect(txBlockResult.hash).to.equal(newTx1.txSendResult.hash); diff --git a/test/wallet-test.js b/test/wallet-test.js index 985d631..bf43194 100644 --- a/test/wallet-test.js +++ b/test/wallet-test.js @@ -17,23 +17,6 @@ describe("Test Lamden Wallet methods", () => { expect(validateTypes.isNumber(newWallet.derivationIndex)).to.be(true); expect(newWallet.derivationIndex).to.be(0); }), - it("creates a bip39 / bip32 compatible lamden keypair from mnemonic", () => { - const mnemonic = - "ripple junk access broom element fitness side example ramp flush model creek nest face rent jacket ahead come short find over family wise comfort"; - const derivationIndex = 127; - let newWallet = wallet.new_wallet_bip39(mnemonic, derivationIndex); - - expect( validateTypes.isStringHex(newWallet.vk) ).to.be( true ) - expect( newWallet.vk.length ).to.be( 64 ) - expect( validateTypes.isStringHex(newWallet.sk) ).to.be( true ) - expect( newWallet.sk.length ).to.be( 64 ) - expect( validateTypes.isStringWithValue(newWallet.mnemonic) ).to.be( true ) - expect( validateTypes.isNumber(newWallet.derivationIndex) ).to.be( true ) - expect( newWallet.derivationIndex ).to.be( 0 ) - expect( validateTypes.isStringHex(newWallet.seed) ).to.be( true ) - expect( newWallet.seed.length ).to.be( 128 ) - }), - it('creates a bip39 / bip32 compatible lamden keypair from seed', () => { const seed = 'd3ad26bd89d54d0c22bb32d34ea9f06c567ba060d8e1518974d807180b886c643bfb7f455bd3db2c767a17c089aab20db97cf0f0184d730b9d20be0c7b6cc6cc' const derivationIndex = 127