diff --git a/docs/assets/js/ganache/ganache.min.js b/docs/assets/js/ganache/ganache.min.js index 9bce9ff6a9..67bf92b137 100644 --- a/docs/assets/js/ganache/ganache.min.js +++ b/docs/assets/js/ganache/ganache.min.js @@ -1,3 +1,3 @@ /*! For license information please see ganache.min.js.LICENSE.txt */ -!function webpackUniversalModuleDefinition(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Ganache=t():e.Ganache=t()}(self,(function(){return(()=>{var __webpack_modules__=[(e,t,r)=>{"use strict";var a=r(1285),n=r(1286),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=Buffer,t.SlowBuffer=function SlowBuffer(e){+e!=e&&(e=0);return Buffer.alloc(+e)},t.INSPECT_MAX_BYTES=50;var c=2147483647;function createBuffer(e){if(e>c)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,Buffer.prototype),t}function Buffer(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 allocUnsafe(e)}return from(e,t,r)}function from(e,t,r){if("string"==typeof e)return function fromString(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!Buffer.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|byteLength(e,t),a=createBuffer(r),n=a.write(e,t);n!==r&&(a=a.slice(0,n));return a}(e,t);if(ArrayBuffer.isView(e))return function fromArrayView(e){if(isInstance(e,Uint8Array)){var t=new Uint8Array(e);return fromArrayBuffer(t.buffer,t.byteOffset,t.byteLength)}return fromArrayLike(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(isInstance(e,ArrayBuffer)||e&&isInstance(e.buffer,ArrayBuffer))return fromArrayBuffer(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(isInstance(e,SharedArrayBuffer)||e&&isInstance(e.buffer,SharedArrayBuffer)))return fromArrayBuffer(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var a=e.valueOf&&e.valueOf();if(null!=a&&a!==e)return Buffer.from(a,t,r);var n=function fromObject(e){if(Buffer.isBuffer(e)){var t=0|checked(e.length),r=createBuffer(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||numberIsNaN(e.length)?createBuffer(0):fromArrayLike(e);if("Buffer"===e.type&&Array.isArray(e.data))return fromArrayLike(e.data)}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return Buffer.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 assertSize(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 allocUnsafe(e){return assertSize(e),createBuffer(e<0?0:0|checked(e))}function fromArrayLike(e){for(var t=e.length<0?0:0|checked(e.length),r=createBuffer(t),a=0;a=c)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+c.toString(16)+" bytes");return 0|e}function byteLength(e,t){if(Buffer.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||isInstance(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,a=arguments.length>2&&!0===arguments[2];if(!a&&0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return utf8ToBytes(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return base64ToBytes(e).length;default:if(n)return a?-1:utf8ToBytes(e).length;t=(""+t).toLowerCase(),n=!0}}function slowToString(e,t,r){var a=!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 hexSlice(this,t,r);case"utf8":case"utf-8":return utf8Slice(this,t,r);case"ascii":return asciiSlice(this,t,r);case"latin1":case"binary":return latin1Slice(this,t,r);case"base64":return base64Slice(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,t,r);default:if(a)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function swap(e,t,r){var a=e[t];e[t]=e[r],e[r]=a}function bidirectionalIndexOf(e,t,r,a,n){if(0===e.length)return-1;if("string"==typeof r?(a=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),numberIsNaN(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=Buffer.from(t,a)),Buffer.isBuffer(t))return 0===t.length?-1:arrayIndexOf(e,t,r,a,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):arrayIndexOf(e,[t],r,a,n);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(e,t,r,a,n){var o,c=1,s=e.length,d=t.length;if(void 0!==a&&("ucs2"===(a=String(a).toLowerCase())||"ucs-2"===a||"utf16le"===a||"utf-16le"===a)){if(e.length<2||t.length<2)return-1;c=2,s/=2,d/=2,r/=2}function read(e,t){return 1===c?e[t]:e.readUInt16BE(t*c)}if(n){var u=-1;for(o=r;os&&(r=s-d),o=r;o>=0;o--){for(var h=!0,l=0;ln&&(a=n):a=n;var o=t.length;a>o/2&&(a=o/2);for(var c=0;c>8,n=r%256,o.push(n),o.push(a);return o}(t,e.length-r),e,r,a)}function base64Slice(e,t,r){return 0===t&&r===e.length?a.fromByteArray(e):a.fromByteArray(e.slice(t,r))}function utf8Slice(e,t,r){r=Math.min(e.length,r);for(var a=[],n=t;n239?4:h>223?3:h>191?2:1;if(n+b<=r)switch(b){case 1:h<128&&(l=h);break;case 2:128==(192&(o=e[n+1]))&&(u=(31&h)<<6|63&o)>127&&(l=u);break;case 3:o=e[n+1],c=e[n+2],128==(192&o)&&128==(192&c)&&(u=(15&h)<<12|(63&o)<<6|63&c)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[n+1],c=e[n+2],d=e[n+3],128==(192&o)&&128==(192&c)&&128==(192&d)&&(u=(15&h)<<18|(63&o)<<12|(63&c)<<6|63&d)>65535&&u<1114112&&(l=u)}null===l?(l=65533,b=1):l>65535&&(l-=65536,a.push(l>>>10&1023|55296),l=56320|1023&l),a.push(l),n+=b}return function decodeCodePointsArray(e){var t=e.length;if(t<=s)return String.fromCharCode.apply(String,e);var r="",a=0;for(;aa.length?Buffer.from(o).copy(a,n):Uint8Array.prototype.set.call(a,o,n);else{if(!Buffer.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(a,n)}n+=o.length}return a},Buffer.byteLength=byteLength,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function swap16(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tr&&(e+=" ... "),""},o&&(Buffer.prototype[o]=Buffer.prototype.inspect),Buffer.prototype.compare=function compare(e,t,r,a,n){if(isInstance(e,Uint8Array)&&(e=Buffer.from(e,e.offset,e.byteLength)),!Buffer.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===a&&(a=0),void 0===n&&(n=this.length),t<0||r>e.length||a<0||n>this.length)throw new RangeError("out of range index");if(a>=n&&t>=r)return 0;if(a>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(n>>>=0)-(a>>>=0),c=(r>>>=0)-(t>>>=0),s=Math.min(o,c),d=this.slice(a,n),u=e.slice(t,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===a&&(a="utf8")):(a=r,r=void 0)}var n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var o=!1;;)switch(a){case"hex":return hexWrite(this,e,t,r);case"utf8":case"utf-8":return utf8Write(this,e,t,r);case"ascii":case"latin1":case"binary":return asciiWrite(this,e,t,r);case"base64":return base64Write(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),o=!0}},Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var s=4096;function asciiSlice(e,t,r){var a="";r=Math.min(e.length,r);for(var n=t;na)&&(r=a);for(var n="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function checkInt(e,t,r,a,n,o){if(!Buffer.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw new RangeError("Index out of range")}function checkIEEE754(e,t,r,a,n,o){if(r+a>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function writeFloat(e,t,r,a,o){return t=+t,r>>>=0,o||checkIEEE754(e,0,r,4),n.write(e,t,r,a,23,4),r+4}function writeDouble(e,t,r,a,o){return t=+t,r>>>=0,o||checkIEEE754(e,0,r,8),n.write(e,t,r,a,52,8),r+8}Buffer.prototype.slice=function slice(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e],n=1,o=0;++o>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e+--t],n=1;t>0&&(n*=256);)a+=this[e+--t]*n;return a},Buffer.prototype.readUint8=Buffer.prototype.readUInt8=function readUInt8(e,t){return e>>>=0,t||checkOffset(e,1,this.length),this[e]},Buffer.prototype.readUint16LE=Buffer.prototype.readUInt16LE=function readUInt16LE(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]|this[e+1]<<8},Buffer.prototype.readUint16BE=Buffer.prototype.readUInt16BE=function readUInt16BE(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]<<8|this[e+1]},Buffer.prototype.readUint32LE=Buffer.prototype.readUInt32LE=function readUInt32LE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Buffer.prototype.readUint32BE=Buffer.prototype.readUInt32BE=function readUInt32BE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Buffer.prototype.readIntLE=function readIntLE(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e],n=1,o=0;++o=(n*=128)&&(a-=Math.pow(2,8*t)),a},Buffer.prototype.readIntBE=function readIntBE(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=t,n=1,o=this[e+--a];a>0&&(n*=256);)o+=this[e+--a]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*t)),o},Buffer.prototype.readInt8=function readInt8(e,t){return e>>>=0,t||checkOffset(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Buffer.prototype.readInt16LE=function readInt16LE(e,t){e>>>=0,t||checkOffset(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt16BE=function readInt16BE(e,t){e>>>=0,t||checkOffset(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt32LE=function readInt32LE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Buffer.prototype.readInt32BE=function readInt32BE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Buffer.prototype.readFloatLE=function readFloatLE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),n.read(this,e,!0,23,4)},Buffer.prototype.readFloatBE=function readFloatBE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),n.read(this,e,!1,23,4)},Buffer.prototype.readDoubleLE=function readDoubleLE(e,t){return e>>>=0,t||checkOffset(e,8,this.length),n.read(this,e,!0,52,8)},Buffer.prototype.readDoubleBE=function readDoubleBE(e,t){return e>>>=0,t||checkOffset(e,8,this.length),n.read(this,e,!1,52,8)},Buffer.prototype.writeUintLE=Buffer.prototype.writeUIntLE=function writeUIntLE(e,t,r,a){(e=+e,t>>>=0,r>>>=0,a)||checkInt(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,a)||checkInt(this,e,t,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[t+n]=255&e;--n>=0&&(o*=256);)this[t+n]=e/o&255;return t+r},Buffer.prototype.writeUint8=Buffer.prototype.writeUInt8=function writeUInt8(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,255,0),this[t]=255&e,t+1},Buffer.prototype.writeUint16LE=Buffer.prototype.writeUInt16LE=function writeUInt16LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeUint16BE=Buffer.prototype.writeUInt16BE=function writeUInt16BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeUint32LE=Buffer.prototype.writeUInt32LE=function writeUInt32LE(e,t,r){return e=+e,t>>>=0,r||checkInt(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},Buffer.prototype.writeUint32BE=Buffer.prototype.writeUInt32BE=function writeUInt32BE(e,t,r){return e=+e,t>>>=0,r||checkInt(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},Buffer.prototype.writeIntLE=function writeIntLE(e,t,r,a){if(e=+e,t>>>=0,!a){var n=Math.pow(2,8*r-1);checkInt(this,e,t,r,n-1,-n)}var o=0,c=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+r},Buffer.prototype.writeIntBE=function writeIntBE(e,t,r,a){if(e=+e,t>>>=0,!a){var n=Math.pow(2,8*r-1);checkInt(this,e,t,r,n-1,-n)}var o=r-1,c=1,s=0;for(this[t+o]=255&e;--o>=0&&(c*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/c>>0)-s&255;return t+r},Buffer.prototype.writeInt8=function writeInt8(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},Buffer.prototype.writeInt16LE=function writeInt16LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeInt16BE=function writeInt16BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeInt32LE=function writeInt32LE(e,t,r){return e=+e,t>>>=0,r||checkInt(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},Buffer.prototype.writeInt32BE=function writeInt32BE(e,t,r){return e=+e,t>>>=0,r||checkInt(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},Buffer.prototype.writeFloatLE=function writeFloatLE(e,t,r){return writeFloat(this,e,t,!0,r)},Buffer.prototype.writeFloatBE=function writeFloatBE(e,t,r){return writeFloat(this,e,t,!1,r)},Buffer.prototype.writeDoubleLE=function writeDoubleLE(e,t,r){return writeDouble(this,e,t,!0,r)},Buffer.prototype.writeDoubleBE=function writeDoubleBE(e,t,r){return writeDouble(this,e,t,!1,r)},Buffer.prototype.copy=function copy(e,t,r,a){if(!Buffer.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),a||0===a||(a=this.length),t>=e.length&&(t=e.length),t||(t=0),a>0&&a=this.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(c+1===a){(t-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&o.push(239,191,189);if(n=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 base64ToBytes(e){return a.toByteArray(function base64clean(e){if((e=(e=e.split("=")[0]).trim().replace(d,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function blitBuffer(e,t,r,a){for(var n=0;n=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function isInstance(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function numberIsNaN(e){return e!=e}var u=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var a=16*r,n=0;n<16;++n)t[a+n]=e[r]+e[n];return t}()},e=>{var t,r,a=e.exports={};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(e){if(t===setTimeout)return setTimeout(e,0);if((t===defaultSetTimout||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){t=defaultSetTimout}try{r="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){r=defaultClearTimeout}}();var n,o=[],c=!1,s=-1;function cleanUpNextTick(){c&&n&&(c=!1,n.length?o=n.concat(o):s=-1,o.length&&drainQueue())}function drainQueue(){if(!c){var e=runTimeout(cleanUpNextTick);c=!0;for(var t=o.length;t;){for(n=o,o=[];++s1)for(var r=1;r{"use strict";const a=r(423),n=r(424),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=Buffer,t.SlowBuffer=function SlowBuffer(e){+e!=e&&(e=0);return Buffer.alloc(+e)},t.INSPECT_MAX_BYTES=50;const c=2147483647;function createBuffer(e){if(e>c)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,Buffer.prototype),t}function Buffer(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 allocUnsafe(e)}return from(e,t,r)}function from(e,t,r){if("string"==typeof e)return function fromString(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!Buffer.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|byteLength(e,t);let a=createBuffer(r);const n=a.write(e,t);n!==r&&(a=a.slice(0,n));return a}(e,t);if(ArrayBuffer.isView(e))return function fromArrayView(e){if(isInstance(e,Uint8Array)){const t=new Uint8Array(e);return fromArrayBuffer(t.buffer,t.byteOffset,t.byteLength)}return fromArrayLike(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(isInstance(e,ArrayBuffer)||e&&isInstance(e.buffer,ArrayBuffer))return fromArrayBuffer(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(isInstance(e,SharedArrayBuffer)||e&&isInstance(e.buffer,SharedArrayBuffer)))return fromArrayBuffer(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const a=e.valueOf&&e.valueOf();if(null!=a&&a!==e)return Buffer.from(a,t,r);const n=function fromObject(e){if(Buffer.isBuffer(e)){const t=0|checked(e.length),r=createBuffer(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||numberIsNaN(e.length)?createBuffer(0):fromArrayLike(e);if("Buffer"===e.type&&Array.isArray(e.data))return fromArrayLike(e.data)}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return Buffer.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 assertSize(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 allocUnsafe(e){return assertSize(e),createBuffer(e<0?0:0|checked(e))}function fromArrayLike(e){const t=e.length<0?0:0|checked(e.length),r=createBuffer(t);for(let a=0;a=c)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+c.toString(16)+" bytes");return 0|e}function byteLength(e,t){if(Buffer.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||isInstance(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,a=arguments.length>2&&!0===arguments[2];if(!a&&0===r)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return utf8ToBytes(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return base64ToBytes(e).length;default:if(n)return a?-1:utf8ToBytes(e).length;t=(""+t).toLowerCase(),n=!0}}function slowToString(e,t,r){let a=!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 hexSlice(this,t,r);case"utf8":case"utf-8":return utf8Slice(this,t,r);case"ascii":return asciiSlice(this,t,r);case"latin1":case"binary":return latin1Slice(this,t,r);case"base64":return base64Slice(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,t,r);default:if(a)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function swap(e,t,r){const a=e[t];e[t]=e[r],e[r]=a}function bidirectionalIndexOf(e,t,r,a,n){if(0===e.length)return-1;if("string"==typeof r?(a=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),numberIsNaN(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=Buffer.from(t,a)),Buffer.isBuffer(t))return 0===t.length?-1:arrayIndexOf(e,t,r,a,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):arrayIndexOf(e,[t],r,a,n);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(e,t,r,a,n){let o,c=1,s=e.length,d=t.length;if(void 0!==a&&("ucs2"===(a=String(a).toLowerCase())||"ucs-2"===a||"utf16le"===a||"utf-16le"===a)){if(e.length<2||t.length<2)return-1;c=2,s/=2,d/=2,r/=2}function read(e,t){return 1===c?e[t]:e.readUInt16BE(t*c)}if(n){let a=-1;for(o=r;os&&(r=s-d),o=r;o>=0;o--){let r=!0;for(let a=0;an&&(a=n):a=n;const o=t.length;let c;for(a>o/2&&(a=o/2),c=0;c>8,n=r%256,o.push(n),o.push(a);return o}(t,e.length-r),e,r,a)}function base64Slice(e,t,r){return 0===t&&r===e.length?a.fromByteArray(e):a.fromByteArray(e.slice(t,r))}function utf8Slice(e,t,r){r=Math.min(e.length,r);const a=[];let n=t;for(;n239?4:t>223?3:t>191?2:1;if(n+c<=r){let r,a,s,d;switch(c){case 1:t<128&&(o=t);break;case 2:r=e[n+1],128==(192&r)&&(d=(31&t)<<6|63&r,d>127&&(o=d));break;case 3:r=e[n+1],a=e[n+2],128==(192&r)&&128==(192&a)&&(d=(15&t)<<12|(63&r)<<6|63&a,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:r=e[n+1],a=e[n+2],s=e[n+3],128==(192&r)&&128==(192&a)&&128==(192&s)&&(d=(15&t)<<18|(63&r)<<12|(63&a)<<6|63&s,d>65535&&d<1114112&&(o=d))}}null===o?(o=65533,c=1):o>65535&&(o-=65536,a.push(o>>>10&1023|55296),o=56320|1023&o),a.push(o),n+=c}return function decodeCodePointsArray(e){const t=e.length;if(t<=s)return String.fromCharCode.apply(String,e);let r="",a=0;for(;aa.length?(Buffer.isBuffer(t)||(t=Buffer.from(t)),t.copy(a,n)):Uint8Array.prototype.set.call(a,t,n);else{if(!Buffer.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(a,n)}n+=t.length}return a},Buffer.byteLength=byteLength,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function swap16(){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&&(e+=" ... "),""},o&&(Buffer.prototype[o]=Buffer.prototype.inspect),Buffer.prototype.compare=function compare(e,t,r,a,n){if(isInstance(e,Uint8Array)&&(e=Buffer.from(e,e.offset,e.byteLength)),!Buffer.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===a&&(a=0),void 0===n&&(n=this.length),t<0||r>e.length||a<0||n>this.length)throw new RangeError("out of range index");if(a>=n&&t>=r)return 0;if(a>=n)return-1;if(t>=r)return 1;if(this===e)return 0;let o=(n>>>=0)-(a>>>=0),c=(r>>>=0)-(t>>>=0);const s=Math.min(o,c),d=this.slice(a,n),u=e.slice(t,r);for(let e=0;e>>=0,isFinite(r)?(r>>>=0,void 0===a&&(a="utf8")):(a=r,r=void 0)}const n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");let o=!1;for(;;)switch(a){case"hex":return hexWrite(this,e,t,r);case"utf8":case"utf-8":return utf8Write(this,e,t,r);case"ascii":case"latin1":case"binary":return asciiWrite(this,e,t,r);case"base64":return base64Write(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),o=!0}},Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const s=4096;function asciiSlice(e,t,r){let a="";r=Math.min(e.length,r);for(let n=t;na)&&(r=a);let n="";for(let a=t;ar)throw new RangeError("Trying to access beyond buffer length")}function checkInt(e,t,r,a,n,o){if(!Buffer.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw new RangeError("Index out of range")}function wrtBigUInt64LE(e,t,r,a,n){checkIntBI(t,a,n,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 c=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=c,c>>=8,e[r++]=c,c>>=8,e[r++]=c,c>>=8,e[r++]=c,r}function wrtBigUInt64BE(e,t,r,a,n){checkIntBI(t,a,n,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 c=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=c,c>>=8,e[r+2]=c,c>>=8,e[r+1]=c,c>>=8,e[r]=c,r+8}function checkIEEE754(e,t,r,a,n,o){if(r+a>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function writeFloat(e,t,r,a,o){return t=+t,r>>>=0,o||checkIEEE754(e,0,r,4),n.write(e,t,r,a,23,4),r+4}function writeDouble(e,t,r,a,o){return t=+t,r>>>=0,o||checkIEEE754(e,0,r,8),n.write(e,t,r,a,52,8),r+8}Buffer.prototype.slice=function slice(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||checkOffset(e,t,this.length);let a=this[e],n=1,o=0;for(;++o>>=0,t>>>=0,r||checkOffset(e,t,this.length);let a=this[e+--t],n=1;for(;t>0&&(n*=256);)a+=this[e+--t]*n;return a},Buffer.prototype.readUint8=Buffer.prototype.readUInt8=function readUInt8(e,t){return e>>>=0,t||checkOffset(e,1,this.length),this[e]},Buffer.prototype.readUint16LE=Buffer.prototype.readUInt16LE=function readUInt16LE(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]|this[e+1]<<8},Buffer.prototype.readUint16BE=Buffer.prototype.readUInt16BE=function readUInt16BE(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]<<8|this[e+1]},Buffer.prototype.readUint32LE=Buffer.prototype.readUInt32LE=function readUInt32LE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Buffer.prototype.readUint32BE=Buffer.prototype.readUInt32BE=function readUInt32BE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Buffer.prototype.readBigUInt64LE=defineBigIntMethod((function readBigUInt64LE(e){validateNumber(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||boundsError(e,this.length-8);const a=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,n=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(a)+(BigInt(n)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||boundsError(e,this.length-8);const a=t*2**24+65536*this[++e]+256*this[++e]+this[++e],n=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(a)<>>=0,t>>>=0,r||checkOffset(e,t,this.length);let a=this[e],n=1,o=0;for(;++o=n&&(a-=Math.pow(2,8*t)),a},Buffer.prototype.readIntBE=function readIntBE(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);let a=t,n=1,o=this[e+--a];for(;a>0&&(n*=256);)o+=this[e+--a]*n;return n*=128,o>=n&&(o-=Math.pow(2,8*t)),o},Buffer.prototype.readInt8=function readInt8(e,t){return e>>>=0,t||checkOffset(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Buffer.prototype.readInt16LE=function readInt16LE(e,t){e>>>=0,t||checkOffset(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt16BE=function readInt16BE(e,t){e>>>=0,t||checkOffset(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt32LE=function readInt32LE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Buffer.prototype.readInt32BE=function readInt32BE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Buffer.prototype.readBigInt64LE=defineBigIntMethod((function readBigInt64LE(e){validateNumber(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||boundsError(e,this.length-8);const a=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(a)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||boundsError(e,this.length-8);const a=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(a)<>>=0,t||checkOffset(e,4,this.length),n.read(this,e,!0,23,4)},Buffer.prototype.readFloatBE=function readFloatBE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),n.read(this,e,!1,23,4)},Buffer.prototype.readDoubleLE=function readDoubleLE(e,t){return e>>>=0,t||checkOffset(e,8,this.length),n.read(this,e,!0,52,8)},Buffer.prototype.readDoubleBE=function readDoubleBE(e,t){return e>>>=0,t||checkOffset(e,8,this.length),n.read(this,e,!1,52,8)},Buffer.prototype.writeUintLE=Buffer.prototype.writeUIntLE=function writeUIntLE(e,t,r,a){if(e=+e,t>>>=0,r>>>=0,!a){checkInt(this,e,t,r,Math.pow(2,8*r)-1,0)}let n=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,!a){checkInt(this,e,t,r,Math.pow(2,8*r)-1,0)}let n=r-1,o=1;for(this[t+n]=255&e;--n>=0&&(o*=256);)this[t+n]=e/o&255;return t+r},Buffer.prototype.writeUint8=Buffer.prototype.writeUInt8=function writeUInt8(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,255,0),this[t]=255&e,t+1},Buffer.prototype.writeUint16LE=Buffer.prototype.writeUInt16LE=function writeUInt16LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeUint16BE=Buffer.prototype.writeUInt16BE=function writeUInt16BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeUint32LE=Buffer.prototype.writeUInt32LE=function writeUInt32LE(e,t,r){return e=+e,t>>>=0,r||checkInt(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},Buffer.prototype.writeUint32BE=Buffer.prototype.writeUInt32BE=function writeUInt32BE(e,t,r){return e=+e,t>>>=0,r||checkInt(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},Buffer.prototype.writeBigUInt64LE=defineBigIntMethod((function writeBigUInt64LE(e,t=0){return wrtBigUInt64LE(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),Buffer.prototype.writeBigUInt64BE=defineBigIntMethod((function writeBigUInt64BE(e,t=0){return wrtBigUInt64BE(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),Buffer.prototype.writeIntLE=function writeIntLE(e,t,r,a){if(e=+e,t>>>=0,!a){const a=Math.pow(2,8*r-1);checkInt(this,e,t,r,a-1,-a)}let n=0,o=1,c=0;for(this[t]=255&e;++n>0)-c&255;return t+r},Buffer.prototype.writeIntBE=function writeIntBE(e,t,r,a){if(e=+e,t>>>=0,!a){const a=Math.pow(2,8*r-1);checkInt(this,e,t,r,a-1,-a)}let n=r-1,o=1,c=0;for(this[t+n]=255&e;--n>=0&&(o*=256);)e<0&&0===c&&0!==this[t+n+1]&&(c=1),this[t+n]=(e/o>>0)-c&255;return t+r},Buffer.prototype.writeInt8=function writeInt8(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},Buffer.prototype.writeInt16LE=function writeInt16LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeInt16BE=function writeInt16BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeInt32LE=function writeInt32LE(e,t,r){return e=+e,t>>>=0,r||checkInt(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},Buffer.prototype.writeInt32BE=function writeInt32BE(e,t,r){return e=+e,t>>>=0,r||checkInt(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},Buffer.prototype.writeBigInt64LE=defineBigIntMethod((function writeBigInt64LE(e,t=0){return wrtBigUInt64LE(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),Buffer.prototype.writeBigInt64BE=defineBigIntMethod((function writeBigInt64BE(e,t=0){return wrtBigUInt64BE(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),Buffer.prototype.writeFloatLE=function writeFloatLE(e,t,r){return writeFloat(this,e,t,!0,r)},Buffer.prototype.writeFloatBE=function writeFloatBE(e,t,r){return writeFloat(this,e,t,!1,r)},Buffer.prototype.writeDoubleLE=function writeDoubleLE(e,t,r){return writeDouble(this,e,t,!0,r)},Buffer.prototype.writeDoubleBE=function writeDoubleBE(e,t,r){return writeDouble(this,e,t,!1,r)},Buffer.prototype.copy=function copy(e,t,r,a){if(!Buffer.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),a||0===a||(a=this.length),t>=e.length&&(t=e.length),t||(t=0),a>0&&a=this.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(n=t;n=a+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function checkIntBI(e,t,r,a,n,o){if(e>r||e3?0===t||t===BigInt(0)?`>= 0${a} and < 2${a} ** ${8*(o+1)}${a}`:`>= -(2${a} ** ${8*(o+1)-1}${a}) and < 2 ** ${8*(o+1)-1}${a}`:`>= ${t}${a} and <= ${r}${a}`,new d.ERR_OUT_OF_RANGE("value",n,e)}!function checkBounds(e,t,r){validateNumber(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||boundsError(t,e.length-(r+1))}(a,n,o)}function validateNumber(e,t){if("number"!=typeof e)throw new d.ERR_INVALID_ARG_TYPE(t,"number",e)}function boundsError(e,t,r){if(Math.floor(e)!==e)throw validateNumber(e,r),new d.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new d.ERR_BUFFER_OUT_OF_BOUNDS;throw new d.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}E("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),E("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),E("ERR_OUT_OF_RANGE",(function(e,t,r){let a=`The value of "${e}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=addNumericalSeparator(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=addNumericalSeparator(n)),n+="n"),a+=` It must be ${t}. Received ${n}`,a}),RangeError);const u=/[^+/0-9A-Za-z-_]/g;function utf8ToBytes(e,t){let r;t=t||1/0;const a=e.length;let n=null;const o=[];for(let c=0;c55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(c+1===a){(t-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&o.push(239,191,189);if(n=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 base64ToBytes(e){return a.toByteArray(function base64clean(e){if((e=(e=e.split("=")[0]).trim().replace(u,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function blitBuffer(e,t,r,a){let n;for(n=0;n=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function isInstance(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function numberIsNaN(e){return e!=e}const h=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const a=16*r;for(let n=0;n<16;++n)t[a+n]=e[r]+e[n]}return t}();function defineBigIntMethod(e){return"undefined"==typeof BigInt?BufferBigIntNotDefined:e}function BufferBigIntNotDefined(){throw new Error("BigInt not supported")}},(e,t,r)=>{"use strict";var a=r(1234),n=r(1235),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=Buffer,t.SlowBuffer=function SlowBuffer(e){+e!=e&&(e=0);return Buffer.alloc(+e)},t.INSPECT_MAX_BYTES=50;var c=2147483647;function createBuffer(e){if(e>c)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,Buffer.prototype),t}function Buffer(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 allocUnsafe(e)}return from(e,t,r)}function from(e,t,r){if("string"==typeof e)return function fromString(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!Buffer.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|byteLength(e,t),a=createBuffer(r),n=a.write(e,t);n!==r&&(a=a.slice(0,n));return a}(e,t);if(ArrayBuffer.isView(e))return function fromArrayView(e){if(isInstance(e,Uint8Array)){var t=new Uint8Array(e);return fromArrayBuffer(t.buffer,t.byteOffset,t.byteLength)}return fromArrayLike(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(isInstance(e,ArrayBuffer)||e&&isInstance(e.buffer,ArrayBuffer))return fromArrayBuffer(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(isInstance(e,SharedArrayBuffer)||e&&isInstance(e.buffer,SharedArrayBuffer)))return fromArrayBuffer(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var a=e.valueOf&&e.valueOf();if(null!=a&&a!==e)return Buffer.from(a,t,r);var n=function fromObject(e){if(Buffer.isBuffer(e)){var t=0|checked(e.length),r=createBuffer(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||numberIsNaN(e.length)?createBuffer(0):fromArrayLike(e);if("Buffer"===e.type&&Array.isArray(e.data))return fromArrayLike(e.data)}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return Buffer.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 assertSize(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 allocUnsafe(e){return assertSize(e),createBuffer(e<0?0:0|checked(e))}function fromArrayLike(e){for(var t=e.length<0?0:0|checked(e.length),r=createBuffer(t),a=0;a=c)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+c.toString(16)+" bytes");return 0|e}function byteLength(e,t){if(Buffer.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||isInstance(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,a=arguments.length>2&&!0===arguments[2];if(!a&&0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return utf8ToBytes(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return base64ToBytes(e).length;default:if(n)return a?-1:utf8ToBytes(e).length;t=(""+t).toLowerCase(),n=!0}}function slowToString(e,t,r){var a=!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 hexSlice(this,t,r);case"utf8":case"utf-8":return utf8Slice(this,t,r);case"ascii":return asciiSlice(this,t,r);case"latin1":case"binary":return latin1Slice(this,t,r);case"base64":return base64Slice(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,t,r);default:if(a)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function swap(e,t,r){var a=e[t];e[t]=e[r],e[r]=a}function bidirectionalIndexOf(e,t,r,a,n){if(0===e.length)return-1;if("string"==typeof r?(a=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),numberIsNaN(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=Buffer.from(t,a)),Buffer.isBuffer(t))return 0===t.length?-1:arrayIndexOf(e,t,r,a,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):arrayIndexOf(e,[t],r,a,n);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(e,t,r,a,n){var o,c=1,s=e.length,d=t.length;if(void 0!==a&&("ucs2"===(a=String(a).toLowerCase())||"ucs-2"===a||"utf16le"===a||"utf-16le"===a)){if(e.length<2||t.length<2)return-1;c=2,s/=2,d/=2,r/=2}function read(e,t){return 1===c?e[t]:e.readUInt16BE(t*c)}if(n){var u=-1;for(o=r;os&&(r=s-d),o=r;o>=0;o--){for(var h=!0,l=0;ln&&(a=n):a=n;var o=t.length;a>o/2&&(a=o/2);for(var c=0;c>8,n=r%256,o.push(n),o.push(a);return o}(t,e.length-r),e,r,a)}function base64Slice(e,t,r){return 0===t&&r===e.length?a.fromByteArray(e):a.fromByteArray(e.slice(t,r))}function utf8Slice(e,t,r){r=Math.min(e.length,r);for(var a=[],n=t;n239?4:h>223?3:h>191?2:1;if(n+b<=r)switch(b){case 1:h<128&&(l=h);break;case 2:128==(192&(o=e[n+1]))&&(u=(31&h)<<6|63&o)>127&&(l=u);break;case 3:o=e[n+1],c=e[n+2],128==(192&o)&&128==(192&c)&&(u=(15&h)<<12|(63&o)<<6|63&c)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[n+1],c=e[n+2],d=e[n+3],128==(192&o)&&128==(192&c)&&128==(192&d)&&(u=(15&h)<<18|(63&o)<<12|(63&c)<<6|63&d)>65535&&u<1114112&&(l=u)}null===l?(l=65533,b=1):l>65535&&(l-=65536,a.push(l>>>10&1023|55296),l=56320|1023&l),a.push(l),n+=b}return function decodeCodePointsArray(e){var t=e.length;if(t<=s)return String.fromCharCode.apply(String,e);var r="",a=0;for(;aa.length?Buffer.from(o).copy(a,n):Uint8Array.prototype.set.call(a,o,n);else{if(!Buffer.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(a,n)}n+=o.length}return a},Buffer.byteLength=byteLength,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function swap16(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tr&&(e+=" ... "),""},o&&(Buffer.prototype[o]=Buffer.prototype.inspect),Buffer.prototype.compare=function compare(e,t,r,a,n){if(isInstance(e,Uint8Array)&&(e=Buffer.from(e,e.offset,e.byteLength)),!Buffer.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===a&&(a=0),void 0===n&&(n=this.length),t<0||r>e.length||a<0||n>this.length)throw new RangeError("out of range index");if(a>=n&&t>=r)return 0;if(a>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(n>>>=0)-(a>>>=0),c=(r>>>=0)-(t>>>=0),s=Math.min(o,c),d=this.slice(a,n),u=e.slice(t,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===a&&(a="utf8")):(a=r,r=void 0)}var n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var o=!1;;)switch(a){case"hex":return hexWrite(this,e,t,r);case"utf8":case"utf-8":return utf8Write(this,e,t,r);case"ascii":case"latin1":case"binary":return asciiWrite(this,e,t,r);case"base64":return base64Write(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),o=!0}},Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var s=4096;function asciiSlice(e,t,r){var a="";r=Math.min(e.length,r);for(var n=t;na)&&(r=a);for(var n="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function checkInt(e,t,r,a,n,o){if(!Buffer.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw new RangeError("Index out of range")}function checkIEEE754(e,t,r,a,n,o){if(r+a>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function writeFloat(e,t,r,a,o){return t=+t,r>>>=0,o||checkIEEE754(e,0,r,4),n.write(e,t,r,a,23,4),r+4}function writeDouble(e,t,r,a,o){return t=+t,r>>>=0,o||checkIEEE754(e,0,r,8),n.write(e,t,r,a,52,8),r+8}Buffer.prototype.slice=function slice(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e],n=1,o=0;++o>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e+--t],n=1;t>0&&(n*=256);)a+=this[e+--t]*n;return a},Buffer.prototype.readUint8=Buffer.prototype.readUInt8=function readUInt8(e,t){return e>>>=0,t||checkOffset(e,1,this.length),this[e]},Buffer.prototype.readUint16LE=Buffer.prototype.readUInt16LE=function readUInt16LE(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]|this[e+1]<<8},Buffer.prototype.readUint16BE=Buffer.prototype.readUInt16BE=function readUInt16BE(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]<<8|this[e+1]},Buffer.prototype.readUint32LE=Buffer.prototype.readUInt32LE=function readUInt32LE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Buffer.prototype.readUint32BE=Buffer.prototype.readUInt32BE=function readUInt32BE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Buffer.prototype.readIntLE=function readIntLE(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e],n=1,o=0;++o=(n*=128)&&(a-=Math.pow(2,8*t)),a},Buffer.prototype.readIntBE=function readIntBE(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=t,n=1,o=this[e+--a];a>0&&(n*=256);)o+=this[e+--a]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*t)),o},Buffer.prototype.readInt8=function readInt8(e,t){return e>>>=0,t||checkOffset(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Buffer.prototype.readInt16LE=function readInt16LE(e,t){e>>>=0,t||checkOffset(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt16BE=function readInt16BE(e,t){e>>>=0,t||checkOffset(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt32LE=function readInt32LE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Buffer.prototype.readInt32BE=function readInt32BE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Buffer.prototype.readFloatLE=function readFloatLE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),n.read(this,e,!0,23,4)},Buffer.prototype.readFloatBE=function readFloatBE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),n.read(this,e,!1,23,4)},Buffer.prototype.readDoubleLE=function readDoubleLE(e,t){return e>>>=0,t||checkOffset(e,8,this.length),n.read(this,e,!0,52,8)},Buffer.prototype.readDoubleBE=function readDoubleBE(e,t){return e>>>=0,t||checkOffset(e,8,this.length),n.read(this,e,!1,52,8)},Buffer.prototype.writeUintLE=Buffer.prototype.writeUIntLE=function writeUIntLE(e,t,r,a){(e=+e,t>>>=0,r>>>=0,a)||checkInt(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,a)||checkInt(this,e,t,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[t+n]=255&e;--n>=0&&(o*=256);)this[t+n]=e/o&255;return t+r},Buffer.prototype.writeUint8=Buffer.prototype.writeUInt8=function writeUInt8(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,255,0),this[t]=255&e,t+1},Buffer.prototype.writeUint16LE=Buffer.prototype.writeUInt16LE=function writeUInt16LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeUint16BE=Buffer.prototype.writeUInt16BE=function writeUInt16BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeUint32LE=Buffer.prototype.writeUInt32LE=function writeUInt32LE(e,t,r){return e=+e,t>>>=0,r||checkInt(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},Buffer.prototype.writeUint32BE=Buffer.prototype.writeUInt32BE=function writeUInt32BE(e,t,r){return e=+e,t>>>=0,r||checkInt(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},Buffer.prototype.writeIntLE=function writeIntLE(e,t,r,a){if(e=+e,t>>>=0,!a){var n=Math.pow(2,8*r-1);checkInt(this,e,t,r,n-1,-n)}var o=0,c=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+r},Buffer.prototype.writeIntBE=function writeIntBE(e,t,r,a){if(e=+e,t>>>=0,!a){var n=Math.pow(2,8*r-1);checkInt(this,e,t,r,n-1,-n)}var o=r-1,c=1,s=0;for(this[t+o]=255&e;--o>=0&&(c*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/c>>0)-s&255;return t+r},Buffer.prototype.writeInt8=function writeInt8(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},Buffer.prototype.writeInt16LE=function writeInt16LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeInt16BE=function writeInt16BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeInt32LE=function writeInt32LE(e,t,r){return e=+e,t>>>=0,r||checkInt(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},Buffer.prototype.writeInt32BE=function writeInt32BE(e,t,r){return e=+e,t>>>=0,r||checkInt(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},Buffer.prototype.writeFloatLE=function writeFloatLE(e,t,r){return writeFloat(this,e,t,!0,r)},Buffer.prototype.writeFloatBE=function writeFloatBE(e,t,r){return writeFloat(this,e,t,!1,r)},Buffer.prototype.writeDoubleLE=function writeDoubleLE(e,t,r){return writeDouble(this,e,t,!0,r)},Buffer.prototype.writeDoubleBE=function writeDoubleBE(e,t,r){return writeDouble(this,e,t,!1,r)},Buffer.prototype.copy=function copy(e,t,r,a){if(!Buffer.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),a||0===a||(a=this.length),t>=e.length&&(t=e.length),t||(t=0),a>0&&a=this.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(c+1===a){(t-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&o.push(239,191,189);if(n=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 base64ToBytes(e){return a.toByteArray(function base64clean(e){if((e=(e=e.split("=")[0]).trim().replace(d,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function blitBuffer(e,t,r,a){for(var n=0;n=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function isInstance(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function numberIsNaN(e){return e!=e}var u=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var a=16*r,n=0;n<16;++n)t[a+n]=e[r]+e[n];return t}()},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(194),t),n(r(49),t),n(r(1293),t),n(r(64),t),n(r(561),t),n(r(81),t),n(r(136),t),n(r(1294),t),n(r(247),t),n(r(17),t)},(e,t,r)=>{"use strict";var a=r(1258),n=r(1259),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=Buffer,t.SlowBuffer=function SlowBuffer(e){+e!=e&&(e=0);return Buffer.alloc(+e)},t.INSPECT_MAX_BYTES=50;var c=2147483647;function createBuffer(e){if(e>c)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,Buffer.prototype),t}function Buffer(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 allocUnsafe(e)}return from(e,t,r)}function from(e,t,r){if("string"==typeof e)return function fromString(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!Buffer.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|byteLength(e,t),a=createBuffer(r),n=a.write(e,t);n!==r&&(a=a.slice(0,n));return a}(e,t);if(ArrayBuffer.isView(e))return function fromArrayView(e){if(isInstance(e,Uint8Array)){var t=new Uint8Array(e);return fromArrayBuffer(t.buffer,t.byteOffset,t.byteLength)}return fromArrayLike(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(isInstance(e,ArrayBuffer)||e&&isInstance(e.buffer,ArrayBuffer))return fromArrayBuffer(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(isInstance(e,SharedArrayBuffer)||e&&isInstance(e.buffer,SharedArrayBuffer)))return fromArrayBuffer(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var a=e.valueOf&&e.valueOf();if(null!=a&&a!==e)return Buffer.from(a,t,r);var n=function fromObject(e){if(Buffer.isBuffer(e)){var t=0|checked(e.length),r=createBuffer(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||numberIsNaN(e.length)?createBuffer(0):fromArrayLike(e);if("Buffer"===e.type&&Array.isArray(e.data))return fromArrayLike(e.data)}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return Buffer.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 assertSize(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 allocUnsafe(e){return assertSize(e),createBuffer(e<0?0:0|checked(e))}function fromArrayLike(e){for(var t=e.length<0?0:0|checked(e.length),r=createBuffer(t),a=0;a=c)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+c.toString(16)+" bytes");return 0|e}function byteLength(e,t){if(Buffer.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||isInstance(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,a=arguments.length>2&&!0===arguments[2];if(!a&&0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return utf8ToBytes(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return base64ToBytes(e).length;default:if(n)return a?-1:utf8ToBytes(e).length;t=(""+t).toLowerCase(),n=!0}}function slowToString(e,t,r){var a=!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 hexSlice(this,t,r);case"utf8":case"utf-8":return utf8Slice(this,t,r);case"ascii":return asciiSlice(this,t,r);case"latin1":case"binary":return latin1Slice(this,t,r);case"base64":return base64Slice(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,t,r);default:if(a)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function swap(e,t,r){var a=e[t];e[t]=e[r],e[r]=a}function bidirectionalIndexOf(e,t,r,a,n){if(0===e.length)return-1;if("string"==typeof r?(a=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),numberIsNaN(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=Buffer.from(t,a)),Buffer.isBuffer(t))return 0===t.length?-1:arrayIndexOf(e,t,r,a,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):arrayIndexOf(e,[t],r,a,n);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(e,t,r,a,n){var o,c=1,s=e.length,d=t.length;if(void 0!==a&&("ucs2"===(a=String(a).toLowerCase())||"ucs-2"===a||"utf16le"===a||"utf-16le"===a)){if(e.length<2||t.length<2)return-1;c=2,s/=2,d/=2,r/=2}function read(e,t){return 1===c?e[t]:e.readUInt16BE(t*c)}if(n){var u=-1;for(o=r;os&&(r=s-d),o=r;o>=0;o--){for(var h=!0,l=0;ln&&(a=n):a=n;var o=t.length;a>o/2&&(a=o/2);for(var c=0;c>8,n=r%256,o.push(n),o.push(a);return o}(t,e.length-r),e,r,a)}function base64Slice(e,t,r){return 0===t&&r===e.length?a.fromByteArray(e):a.fromByteArray(e.slice(t,r))}function utf8Slice(e,t,r){r=Math.min(e.length,r);for(var a=[],n=t;n239?4:h>223?3:h>191?2:1;if(n+b<=r)switch(b){case 1:h<128&&(l=h);break;case 2:128==(192&(o=e[n+1]))&&(u=(31&h)<<6|63&o)>127&&(l=u);break;case 3:o=e[n+1],c=e[n+2],128==(192&o)&&128==(192&c)&&(u=(15&h)<<12|(63&o)<<6|63&c)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[n+1],c=e[n+2],d=e[n+3],128==(192&o)&&128==(192&c)&&128==(192&d)&&(u=(15&h)<<18|(63&o)<<12|(63&c)<<6|63&d)>65535&&u<1114112&&(l=u)}null===l?(l=65533,b=1):l>65535&&(l-=65536,a.push(l>>>10&1023|55296),l=56320|1023&l),a.push(l),n+=b}return function decodeCodePointsArray(e){var t=e.length;if(t<=s)return String.fromCharCode.apply(String,e);var r="",a=0;for(;aa.length?Buffer.from(o).copy(a,n):Uint8Array.prototype.set.call(a,o,n);else{if(!Buffer.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(a,n)}n+=o.length}return a},Buffer.byteLength=byteLength,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function swap16(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tr&&(e+=" ... "),""},o&&(Buffer.prototype[o]=Buffer.prototype.inspect),Buffer.prototype.compare=function compare(e,t,r,a,n){if(isInstance(e,Uint8Array)&&(e=Buffer.from(e,e.offset,e.byteLength)),!Buffer.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===a&&(a=0),void 0===n&&(n=this.length),t<0||r>e.length||a<0||n>this.length)throw new RangeError("out of range index");if(a>=n&&t>=r)return 0;if(a>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(n>>>=0)-(a>>>=0),c=(r>>>=0)-(t>>>=0),s=Math.min(o,c),d=this.slice(a,n),u=e.slice(t,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===a&&(a="utf8")):(a=r,r=void 0)}var n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var o=!1;;)switch(a){case"hex":return hexWrite(this,e,t,r);case"utf8":case"utf-8":return utf8Write(this,e,t,r);case"ascii":case"latin1":case"binary":return asciiWrite(this,e,t,r);case"base64":return base64Write(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),o=!0}},Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var s=4096;function asciiSlice(e,t,r){var a="";r=Math.min(e.length,r);for(var n=t;na)&&(r=a);for(var n="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function checkInt(e,t,r,a,n,o){if(!Buffer.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw new RangeError("Index out of range")}function checkIEEE754(e,t,r,a,n,o){if(r+a>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function writeFloat(e,t,r,a,o){return t=+t,r>>>=0,o||checkIEEE754(e,0,r,4),n.write(e,t,r,a,23,4),r+4}function writeDouble(e,t,r,a,o){return t=+t,r>>>=0,o||checkIEEE754(e,0,r,8),n.write(e,t,r,a,52,8),r+8}Buffer.prototype.slice=function slice(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e],n=1,o=0;++o>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e+--t],n=1;t>0&&(n*=256);)a+=this[e+--t]*n;return a},Buffer.prototype.readUint8=Buffer.prototype.readUInt8=function readUInt8(e,t){return e>>>=0,t||checkOffset(e,1,this.length),this[e]},Buffer.prototype.readUint16LE=Buffer.prototype.readUInt16LE=function readUInt16LE(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]|this[e+1]<<8},Buffer.prototype.readUint16BE=Buffer.prototype.readUInt16BE=function readUInt16BE(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]<<8|this[e+1]},Buffer.prototype.readUint32LE=Buffer.prototype.readUInt32LE=function readUInt32LE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Buffer.prototype.readUint32BE=Buffer.prototype.readUInt32BE=function readUInt32BE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Buffer.prototype.readIntLE=function readIntLE(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e],n=1,o=0;++o=(n*=128)&&(a-=Math.pow(2,8*t)),a},Buffer.prototype.readIntBE=function readIntBE(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=t,n=1,o=this[e+--a];a>0&&(n*=256);)o+=this[e+--a]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*t)),o},Buffer.prototype.readInt8=function readInt8(e,t){return e>>>=0,t||checkOffset(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Buffer.prototype.readInt16LE=function readInt16LE(e,t){e>>>=0,t||checkOffset(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt16BE=function readInt16BE(e,t){e>>>=0,t||checkOffset(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt32LE=function readInt32LE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Buffer.prototype.readInt32BE=function readInt32BE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Buffer.prototype.readFloatLE=function readFloatLE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),n.read(this,e,!0,23,4)},Buffer.prototype.readFloatBE=function readFloatBE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),n.read(this,e,!1,23,4)},Buffer.prototype.readDoubleLE=function readDoubleLE(e,t){return e>>>=0,t||checkOffset(e,8,this.length),n.read(this,e,!0,52,8)},Buffer.prototype.readDoubleBE=function readDoubleBE(e,t){return e>>>=0,t||checkOffset(e,8,this.length),n.read(this,e,!1,52,8)},Buffer.prototype.writeUintLE=Buffer.prototype.writeUIntLE=function writeUIntLE(e,t,r,a){(e=+e,t>>>=0,r>>>=0,a)||checkInt(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,a)||checkInt(this,e,t,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[t+n]=255&e;--n>=0&&(o*=256);)this[t+n]=e/o&255;return t+r},Buffer.prototype.writeUint8=Buffer.prototype.writeUInt8=function writeUInt8(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,255,0),this[t]=255&e,t+1},Buffer.prototype.writeUint16LE=Buffer.prototype.writeUInt16LE=function writeUInt16LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeUint16BE=Buffer.prototype.writeUInt16BE=function writeUInt16BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeUint32LE=Buffer.prototype.writeUInt32LE=function writeUInt32LE(e,t,r){return e=+e,t>>>=0,r||checkInt(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},Buffer.prototype.writeUint32BE=Buffer.prototype.writeUInt32BE=function writeUInt32BE(e,t,r){return e=+e,t>>>=0,r||checkInt(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},Buffer.prototype.writeIntLE=function writeIntLE(e,t,r,a){if(e=+e,t>>>=0,!a){var n=Math.pow(2,8*r-1);checkInt(this,e,t,r,n-1,-n)}var o=0,c=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+r},Buffer.prototype.writeIntBE=function writeIntBE(e,t,r,a){if(e=+e,t>>>=0,!a){var n=Math.pow(2,8*r-1);checkInt(this,e,t,r,n-1,-n)}var o=r-1,c=1,s=0;for(this[t+o]=255&e;--o>=0&&(c*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/c>>0)-s&255;return t+r},Buffer.prototype.writeInt8=function writeInt8(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},Buffer.prototype.writeInt16LE=function writeInt16LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeInt16BE=function writeInt16BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeInt32LE=function writeInt32LE(e,t,r){return e=+e,t>>>=0,r||checkInt(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},Buffer.prototype.writeInt32BE=function writeInt32BE(e,t,r){return e=+e,t>>>=0,r||checkInt(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},Buffer.prototype.writeFloatLE=function writeFloatLE(e,t,r){return writeFloat(this,e,t,!0,r)},Buffer.prototype.writeFloatBE=function writeFloatBE(e,t,r){return writeFloat(this,e,t,!1,r)},Buffer.prototype.writeDoubleLE=function writeDoubleLE(e,t,r){return writeDouble(this,e,t,!0,r)},Buffer.prototype.writeDoubleBE=function writeDoubleBE(e,t,r){return writeDouble(this,e,t,!1,r)},Buffer.prototype.copy=function copy(e,t,r,a){if(!Buffer.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),a||0===a||(a=this.length),t>=e.length&&(t=e.length),t||(t=0),a>0&&a=this.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(c+1===a){(t-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&o.push(239,191,189);if(n=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 base64ToBytes(e){return a.toByteArray(function base64clean(e){if((e=(e=e.split("=")[0]).trim().replace(d,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function blitBuffer(e,t,r,a){for(var n=0;n=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function isInstance(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function numberIsNaN(e){return e!=e}var u=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var a=16*r,n=0;n<16;++n)t[a+n]=e[r]+e[n];return t}()},(e,t,r)=>{"use strict";var a=r(1);function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var n,o,c=r(805).codes,s=c.ERR_AMBIGUOUS_ARGUMENT,d=c.ERR_INVALID_ARG_TYPE,u=c.ERR_INVALID_ARG_VALUE,h=c.ERR_INVALID_RETURN_VALUE,l=c.ERR_MISSING_ARGS,b=r(814),g=r(40).inspect,p=r(40).types,B=p.isPromise,m=p.isRegExp,I=Object.assign?Object.assign:r(815).assign,y=Object.is?Object.is:r(484);new Map;function lazyLoadComparison(){var e=r(819);n=e.isDeepEqual,o=e.isDeepStrictEqual}var x=!1,C=e.exports=ok,v={};function innerFail(e){if(e.message instanceof Error)throw e.message;throw new b(e)}function innerOk(e,t,r,a){if(!r){var n=!1;if(0===t)n=!0,a="No value argument passed to `assert.ok()`";else if(a instanceof Error)throw a;var o=new b({actual:r,expected:!0,message:a,operator:"==",stackStartFn:e});throw o.generatedMessage=n,o}}function ok(){for(var e=arguments.length,t=new Array(e),r=0;r1?t-1:0),a=1;a1?t-1:0),a=1;a1?t-1:0),a=1;a1?t-1:0),a=1;a{"use strict";var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=r(244),o=n.keccak224,c=n.keccak384,s=n.keccak256,d=n.keccak512,u=r(967),h=r(6),l=r(20),b=r(197),g=r(135),p=r(22).Buffer;Object.assign(t,r(17)),t.MAX_INTEGER=new b("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new b("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.SHA3_NULL_S=t.KECCAK256_NULL_S,t.KECCAK256_NULL=p.from(t.KECCAK256_NULL_S,"hex"),t.SHA3_NULL=t.KECCAK256_NULL,t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.SHA3_RLP_ARRAY_S=t.KECCAK256_RLP_ARRAY_S,t.KECCAK256_RLP_ARRAY=p.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.SHA3_RLP_ARRAY=t.KECCAK256_RLP_ARRAY,t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.SHA3_RLP_S=t.KECCAK256_RLP_S,t.KECCAK256_RLP=p.from(t.KECCAK256_RLP_S,"hex"),t.SHA3_RLP=t.KECCAK256_RLP,t.BN=b,t.rlp=l,t.secp256k1=u,t.zeros=function(e){return p.allocUnsafe(e).fill(0)},t.zeroAddress=function(){var e=t.zeros(20);return t.bufferToHex(e)},t.setLengthLeft=t.setLength=function(e,r,a){var n=t.zeros(r);return e=t.toBuffer(e),a?e.length0&&"0"===r.toString();)r=(e=e.slice(1))[0];return e},t.toBuffer=function(e){if(!p.isBuffer(e))if(Array.isArray(e))e=p.from(e);else if("string"==typeof e)e=t.isHexString(e)?p.from(t.padToEven(t.stripHexPrefix(e)),"hex"):p.from(e);else if("number"==typeof e)e=t.intToBuffer(e);else if(null==e)e=p.allocUnsafe(0);else if(b.isBN(e))e=e.toArrayLike(p);else{if(!e.toArray)throw new Error("invalid type");e=p.from(e.toArray())}return e},t.bufferToInt=function(e){return new b(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return"0x"+(e=t.toBuffer(e)).toString("hex")},t.fromSigned=function(e){return new b(e).fromTwos(256)},t.toUnsigned=function(e){return p.from(e.toTwos(256).toArray())},t.keccak=function(e,r){switch(e=t.toBuffer(e),r||(r=256),r){case 224:return o(e);case 256:return s(e);case 384:return c(e);case 512:return d(e);default:throw new Error("Invald algorithm: keccak"+r)}},t.keccak256=function(e){return t.keccak(e)},t.sha3=t.keccak,t.sha256=function(e){return e=t.toBuffer(e),g("sha256").update(e).digest()},t.ripemd160=function(e,r){e=t.toBuffer(e);var a=g("rmd160").update(e).digest();return!0===r?t.setLength(a,32):a},t.rlphash=function(e){return t.keccak(l.encode(e))},t.isValidPrivate=function(e){return u.privateKeyVerify(e)},t.isValidPublic=function(e,t){return 64===e.length?u.publicKeyVerify(p.concat([p.from([4]),e])):!!t&&u.publicKeyVerify(e)},t.pubToAddress=t.publicToAddress=function(e,r){return e=t.toBuffer(e),r&&64!==e.length&&(e=u.publicKeyConvert(e,!1).slice(1)),h(64===e.length),t.keccak(e).slice(-20)};var B=t.privateToPublic=function(e){return e=t.toBuffer(e),u.publicKeyCreate(e,!1).slice(1)};t.importPublic=function(e){return 64!==(e=t.toBuffer(e)).length&&(e=u.publicKeyConvert(e,!1).slice(1)),e},t.ecsign=function(e,t){var r=u.sign(e,t),a={};return a.r=r.signature.slice(0,32),a.s=r.signature.slice(32,64),a.v=r.recovery+27,a},t.hashPersonalMessage=function(e){var r=t.toBuffer("Ethereum Signed Message:\n"+e.length.toString());return t.keccak(p.concat([r,e]))},t.ecrecover=function(e,r,a,n){var o=p.concat([t.setLength(a,32),t.setLength(n,32)],64),c=r-27;if(0!==c&&1!==c)throw new Error("Invalid signature v value");var s=u.recover(e,o,c);return u.publicKeyConvert(s,!1).slice(1)},t.toRpcSig=function(e,r,a){if(27!==e&&28!==e)throw new Error("Invalid recovery id");return t.bufferToHex(p.concat([t.setLengthLeft(r,32),t.setLengthLeft(a,32),t.toBuffer(e-27)]))},t.fromRpcSig=function(e){if(65!==(e=t.toBuffer(e)).length)throw new Error("Invalid signature length");var r=e[64];return r<27&&(r+=27),{v:r,r:e.slice(0,32),s:e.slice(32,64)}},t.privateToAddress=function(e){return t.publicToAddress(B(e))},t.isValidAddress=function(e){return/^0x[0-9a-fA-F]{40}$/.test(e)},t.isZeroAddress=function(e){return t.zeroAddress()===t.addHexPrefix(e)},t.toChecksumAddress=function(e){e=t.stripHexPrefix(e).toLowerCase();for(var r=t.keccak(e).toString("hex"),a="0x",n=0;n=8?a+=e[n].toUpperCase():a+=e[n];return a},t.isValidChecksumAddress=function(e){return t.isValidAddress(e)&&t.toChecksumAddress(e)===e},t.generateAddress=function(e,r){return e=t.toBuffer(e),r=(r=new b(r)).isZero()?null:p.from(r.toArray()),t.rlphash([e,r]).slice(-20)},t.isPrecompiled=function(e){var r=t.unpad(e);return 1===r.length&&r[0]>=1&&r[0]<=8},t.addHexPrefix=function(e){return"string"!=typeof e||t.isHexPrefixed(e)?e:"0x"+e},t.isValidSignature=function(e,t,r,a){var n=new b("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),o=new b("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);return 32===t.length&&32===r.length&&((27===e||28===e)&&(t=new b(t),r=new b(r),!(t.isZero()||t.gt(o)||r.isZero()||r.gt(o))&&(!1!==a||1!==new b(r).cmp(n))))},t.baToJSON=function(e){if(p.isBuffer(e))return"0x"+e.toString("hex");if(e instanceof Array){for(var r=[],a=0;a=n.length,"The field "+r.name+" must not have more "+r.length+" bytes")):r.allowZero&&0===n.length||!r.length||h(r.length===n.length,"The field "+r.name+" must have byte length of "+r.length),e.raw[a]=n}e._fields.push(r.name),Object.defineProperty(e,r.name,{enumerable:!0,configurable:!0,get:getter,set:setter}),r.default&&(e[r.name]=r.default),r.alias&&Object.defineProperty(e,r.alias,{enumerable:!1,configurable:!0,set:setter,get:getter})})),n)if("string"==typeof n&&(n=p.from(t.stripHexPrefix(n),"hex")),p.isBuffer(n)&&(n=l.decode(n)),Array.isArray(n)){if(n.length>e._fields.length)throw new Error("wrong number of fields in data");n.forEach((function(r,a){e[e._fields[a]]=t.toBuffer(r)}))}else{if("object"!==(void 0===n?"undefined":a(n)))throw new Error("invalid data");var o=Object.keys(n);r.forEach((function(t){-1!==o.indexOf(t.name)&&(e[t.name]=n[t.name]),-1!==o.indexOf(t.alias)&&(e[t.alias]=n[t.alias])}))}}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PromiEvent=t.JsonRpcErrorCode=t.makeResponse=t.makeRequest=t.makeError=void 0,n(r(155),t),n(r(26),t),n(r(1227),t),n(r(723),t),n(r(1228),t);var c=r(780);Object.defineProperty(t,"makeError",{enumerable:!0,get:function(){return c.makeError}}),Object.defineProperty(t,"makeRequest",{enumerable:!0,get:function(){return c.makeRequest}}),Object.defineProperty(t,"makeResponse",{enumerable:!0,get:function(){return c.makeResponse}}),Object.defineProperty(t,"JsonRpcErrorCode",{enumerable:!0,get:function(){return c.JsonRpcErrorCode}});var s=r(272);Object.defineProperty(t,"PromiEvent",{enumerable:!0,get:function(){return o(s).default}})},(e,t,r)=>{"use strict";var a=r(0).Buffer,n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=r(244),c=o.keccak224,s=o.keccak384,d=o.keccak256,u=o.keccak512,h=r(969),l=r(6),b=r(20),g=r(197),p=r(135);t.MAX_INTEGER=new g("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new g("10000000000000000000000000000000000000000000000000000000000000000",16),t.SHA3_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.SHA3_NULL=new a(t.SHA3_NULL_S,"hex"),t.SHA3_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.SHA3_RLP_ARRAY=new a(t.SHA3_RLP_ARRAY_S,"hex"),t.SHA3_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.SHA3_RLP=new a(t.SHA3_RLP_S,"hex"),t.BN=g,t.rlp=b,t.secp256k1=h,t.zeros=function(e){var t=new a(e);return t.fill(0),t},t.setLengthLeft=t.setLength=function(e,r,a){var n=t.zeros(r);return e=t.toBuffer(e),a?e.length0&&"0"===r.toString();)r=(e=e.slice(1))[0];return e},t.toBuffer=function(e){if(!a.isBuffer(e))if(Array.isArray(e))e=new a(e);else if("string"==typeof e)e=t.isHexPrefixed(e)?new a(t.padToEven(t.stripHexPrefix(e)),"hex"):new a(e);else if("number"==typeof e)e=t.intToBuffer(e);else if(null==e)e=new a([]);else{if(!e.toArray)throw new Error("invalid type");e=new a(e.toArray())}return e},t.intToHex=function(e){l(e%1==0,"number is not a integer"),l(e>=0,"number must be positive");var t=e.toString(16);return t.length%2&&(t="0"+t),"0x"+t},t.intToBuffer=function(e){var r=t.intToHex(e);return new a(r.slice(2),"hex")},t.bufferToInt=function(e){return parseInt(t.bufferToHex(e),16)},t.bufferToHex=function(e){return 0===(e=t.toBuffer(e)).length?0:"0x"+e.toString("hex")},t.fromSigned=function(e){return new g(e).fromTwos(256)},t.toUnsigned=function(e){return new a(e.toTwos(256).toArray())},t.sha3=function(e,r){switch(e=t.toBuffer(e),r||(r=256),r){case 224:return c(e);case 256:return d(e);case 384:return s(e);case 512:return u(e);default:throw new Error("Invalid algorithm: keccak"+r)}},t.sha256=function(e){return e=t.toBuffer(e),p("sha256").update(e).digest()},t.ripemd160=function(e,r){e=t.toBuffer(e);var a=p("rmd160").update(e).digest();return!0===r?t.setLength(a,32):a},t.rlphash=function(e){return t.sha3(b.encode(e))},t.isValidPrivate=function(e){return h.privateKeyVerify(e)},t.isValidPublic=function(e,t){return 64===e.length?h.publicKeyVerify(a.concat([new a([4]),e])):!!t&&h.publicKeyVerify(e)},t.pubToAddress=t.publicToAddress=function(e,r){return e=t.toBuffer(e),r&&64!==e.length&&(e=h.publicKeyConvert(e,!1).slice(1)),l(64===e.length),t.sha3(e).slice(-20)};var B=t.privateToPublic=function(e){return e=t.toBuffer(e),h.publicKeyCreate(e,!1).slice(1)};t.importPublic=function(e){return 64!==(e=t.toBuffer(e)).length&&(e=h.publicKeyConvert(e,!1).slice(1)),e},t.ecsign=function(e,t){var r=h.sign(e,t),a={};return a.r=r.signature.slice(0,32),a.s=r.signature.slice(32,64),a.v=r.recovery+27,a},t.ecrecover=function(e,r,n,o){var c=a.concat([t.setLength(n,32),t.setLength(o,32)],64),s=t.bufferToInt(r)-27;if(0!==s&&1!==s)throw new Error("Invalid signature v value");var d=h.recover(e,c,s);return h.publicKeyConvert(d,!1).slice(1)},t.toRpcSig=function(e,r,n){return t.bufferToHex(a.concat([r,n,t.toBuffer(e-27)]))},t.fromRpcSig=function(e){var r=(e=t.toBuffer(e))[64];return r<27&&(r+=27),{v:r,r:e.slice(0,32),s:e.slice(32,64)}},t.privateToAddress=function(e){return t.publicToAddress(B(e))},t.isValidAddress=function(e){return/^0x[0-9a-fA-F]{40}$/i.test(e)},t.toChecksumAddress=function(e){e=t.stripHexPrefix(e).toLowerCase();for(var r=t.sha3(e).toString("hex"),a="0x",n=0;n=8?a+=e[n].toUpperCase():a+=e[n];return a},t.isValidChecksumAddress=function(e){return t.isValidAddress(e)&&t.toChecksumAddress(e)===e},t.generateAddress=function(e,r){return e=t.toBuffer(e),r=(r=new g(r)).isZero()?null:new a(r.toArray()),t.rlphash([e,r]).slice(-20)},t.isPrecompiled=function(e){var r=t.unpad(e);return 1===r.length&&r[0]>0&&r[0]<5},t.isHexPrefixed=function(e){return"0x"===e.slice(0,2)},t.stripHexPrefix=function(e){return"string"!=typeof e?e:t.isHexPrefixed(e)?e.slice(2):e},t.addHexPrefix=function(e){return"string"!=typeof e||t.isHexPrefixed(e)?e:"0x"+e},t.padToEven=function(e){return e.length%2&&(e="0"+e),e},t.baToJSON=function(e){if(a.isBuffer(e))return"0x"+e.toString("hex");if(e instanceof Array){for(var r=[],n=0;n=o.length,"The field "+r.name+" must not have more "+r.length+" bytes")):r.allowZero&&0===o.length||!r.length||l(r.length===o.length,"The field "+r.name+" must have byte length of "+r.length),e.raw[n]=o}e._fields.push(r.name),Object.defineProperty(e,r.name,{enumerable:!0,configurable:!0,get:getter,set:setter}),r.default&&(e[r.name]=r.default),r.alias&&Object.defineProperty(e,r.alias,{enumerable:!1,configurable:!0,set:setter,get:getter})})),o)if("string"==typeof o&&(o=new a(t.stripHexPrefix(o),"hex")),a.isBuffer(o)&&(o=b.decode(o)),Array.isArray(o)){if(o.length>e._fields.length)throw new Error("wrong number of fields in data");o.forEach((function(r,a){e[e._fields[a]]=t.toBuffer(r)}))}else{if("object"!==(void 0===o?"undefined":n(o)))throw new Error("invalid data");for(var c in o)-1!==e._fields.indexOf(c)&&(e[c]=o[c])}}},e=>{"function"==typeof Object.create?e.exports=function inherits(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function inherits(e,t){if(t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}}},(e,t,r)=>{var a=r(2),n=a.Buffer;function copyProps(e,t){for(var r in e)t[r]=e[r]}function SafeBuffer(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=a:(copyProps(a,t),t.Buffer=SafeBuffer),SafeBuffer.prototype=Object.create(n.prototype),copyProps(n,SafeBuffer),SafeBuffer.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},SafeBuffer.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var a=n(e);return void 0!==t?"string"==typeof r?a.fill(t,r):a.fill(t):a.fill(0),a},SafeBuffer.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},SafeBuffer.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a.SlowBuffer(e)}},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(18).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void assert(!1,"Invalid character in "+e)}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=0,c=Math.min(e.length,r),s=t;s=49?d-49+10:d>=17?d-17+10:d,assert(d>=0&&o0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);return this._strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;this._strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,c=o%a,s=Math.min(o,o-c)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{BN.prototype[Symbol.for("nodejs.util.inspect.custom")]=inspect}catch(e){BN.prototype.inspect=inspect}else BN.prototype.inspect=inspect;function inspect(){return(this.red?""}var n=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],o=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,s=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=c[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modrn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16,2)},a&&(BN.prototype.toBuffer=function toBuffer(e,t){return this.toArrayLike(a,e,t)}),BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)};function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],c=n*o,s=67108863&c,d=c/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(c=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&c}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r._strip()}BN.prototype.toArrayLike=function toArrayLike(e,t,r){this._strip();var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0");var o=function allocate(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,n);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,a),o},BN.prototype._toArrayLikeLE=function _toArrayLikeLE(e,t){for(var r=0,a=0,n=0,o=0;n>8&255),r>16&255),6===o?(r>24&255),a=0,o=0):(a=c>>>24,o+=2)}if(r=0&&(e[r--]=c>>8&255),r>=0&&(e[r--]=c>>16&255),6===o?(r>=0&&(e[r--]=c>>24&255),a=0,o=0):(a=c>>>24,o+=2)}if(r>=0)for(e[r--]=a;r>=0;)e[r--]=0},Math.clz32?BN.prototype._countBits=function _countBits(e){return 32-Math.clz32(e)}:BN.prototype._countBits=function _countBits(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this._strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,c=0;c>26,this.words[c]=67108863&t;for(;0!==o&&c>26,this.words[c]=67108863&t;if(0===o&&c>>13,g=0|c[1],p=8191&g,B=g>>>13,m=0|c[2],I=8191&m,y=m>>>13,x=0|c[3],C=8191&x,v=x>>>13,Q=0|c[4],w=8191&Q,_=Q>>>13,k=0|c[5],N=8191&k,D=k>>>13,U=0|c[6],G=8191&U,T=U>>>13,L=0|c[7],q=8191&L,P=L>>>13,O=0|c[8],H=8191&O,Y=O>>>13,J=0|c[9],j=8191&J,z=J>>>13,W=0|s[0],V=8191&W,X=W>>>13,$=0|s[1],et=8191&$,tt=$>>>13,rt=0|s[2],at=8191&rt,it=rt>>>13,nt=0|s[3],ot=8191&nt,At=nt>>>13,ct=0|s[4],st=8191&ct,dt=ct>>>13,ut=0|s[5],ht=8191&ut,bt=ut>>>13,pt=0|s[6],Bt=8191&pt,mt=pt>>>13,It=0|s[7],Et=8191&It,yt=It>>>13,xt=0|s[8],Ct=8191&xt,vt=xt>>>13,Qt=0|s[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(C,V),n=(n=Math.imul(C,X))+Math.imul(v,V)|0,o=Math.imul(v,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(C,et)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(v,et)|0,o=o+Math.imul(v,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,st)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(C,at)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(v,at)|0,o=o+Math.imul(v,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,st)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,st)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,At)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,At)|0,a=a+Math.imul(I,st)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,st)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(q,V),n=(n=Math.imul(q,X))+Math.imul(P,V)|0,o=Math.imul(P,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(C,st)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(v,st)|0,o=o+Math.imul(v,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(q,et)|0,n=(n=n+Math.imul(q,tt)|0)+Math.imul(P,et)|0,o=o+Math.imul(P,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,st)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,st)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,bt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,Ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,vt)|0)+Math.imul(b,Ct)|0))<<13)|0;u=((o=o+Math.imul(b,vt)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(j,V),n=(n=Math.imul(j,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(q,at)|0,n=(n=n+Math.imul(q,it)|0)+Math.imul(P,at)|0,o=o+Math.imul(P,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,st)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,st)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(C,Bt)|0,n=(n=n+Math.imul(C,mt)|0)+Math.imul(v,Bt)|0,o=o+Math.imul(v,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,Ct)|0,n=(n=n+Math.imul(p,vt)|0)+Math.imul(B,Ct)|0,o=o+Math.imul(B,vt)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(j,et),n=(n=Math.imul(j,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(q,ot)|0,n=(n=n+Math.imul(q,At)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,At)|0,a=a+Math.imul(G,st)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,st)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(C,Et)|0,n=(n=n+Math.imul(C,yt)|0)+Math.imul(v,Et)|0,o=o+Math.imul(v,yt)|0,a=a+Math.imul(I,Ct)|0,n=(n=n+Math.imul(I,vt)|0)+Math.imul(y,Ct)|0,o=o+Math.imul(y,vt)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(j,at),n=(n=Math.imul(j,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(q,st)|0,n=(n=n+Math.imul(q,dt)|0)+Math.imul(P,st)|0,o=o+Math.imul(P,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(C,Ct)|0,n=(n=n+Math.imul(C,vt)|0)+Math.imul(v,Ct)|0,o=o+Math.imul(v,vt)|0;var qt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(j,ot),n=(n=Math.imul(j,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,st)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,st)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(q,ht)|0,n=(n=n+Math.imul(q,bt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,Ct)|0,n=(n=n+Math.imul(w,vt)|0)+Math.imul(_,Ct)|0,o=o+Math.imul(_,vt)|0;var Pt=(u+(a=a+Math.imul(C,wt)|0)|0)+((8191&(n=(n=n+Math.imul(C,Mt)|0)+Math.imul(v,wt)|0))<<13)|0;u=((o=o+Math.imul(v,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(j,st),n=(n=Math.imul(j,dt))+Math.imul(z,st)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(q,Bt)|0,n=(n=n+Math.imul(q,mt)|0)+Math.imul(P,Bt)|0,o=o+Math.imul(P,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,Ct)|0,n=(n=n+Math.imul(N,vt)|0)+Math.imul(D,Ct)|0,o=o+Math.imul(D,vt)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(j,ht),n=(n=Math.imul(j,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(q,Et)|0,n=(n=n+Math.imul(q,yt)|0)+Math.imul(P,Et)|0,o=o+Math.imul(P,yt)|0,a=a+Math.imul(G,Ct)|0,n=(n=n+Math.imul(G,vt)|0)+Math.imul(T,Ct)|0,o=o+Math.imul(T,vt)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(j,Bt),n=(n=Math.imul(j,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(q,Ct)|0,n=(n=n+Math.imul(q,vt)|0)+Math.imul(P,Ct)|0,o=o+Math.imul(P,vt)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(j,Et),n=(n=Math.imul(j,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,Ct)|0,n=(n=n+Math.imul(H,vt)|0)+Math.imul(Y,Ct)|0,o=o+Math.imul(Y,vt)|0;var Jt=(u+(a=a+Math.imul(q,wt)|0)|0)+((8191&(n=(n=n+Math.imul(q,Mt)|0)+Math.imul(P,wt)|0))<<13)|0;u=((o=o+Math.imul(P,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(j,Ct),n=(n=Math.imul(j,vt))+Math.imul(z,Ct)|0,o=Math.imul(z,vt);var Kt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863;var jt=(u+(a=Math.imul(j,wt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=qt,d[12]=Pt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=Jt,d[17]=Kt,d[18]=jt,0!==u&&(d[19]=u,r.length++),r};function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,c&=67108863}r.words[o]=s,a=c,c=n}return 0!==a?r.words[o]=a:r.length--,r._strip()}function jumboMulTo(e,t,r){return bigMulTo(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(s=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?s(this,e,t):r<63?smallMulTo(this,e,t):r<1024?bigMulTo(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var c=0;c>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,r+=n/67108864|0,r+=o>>>26,this.words[a]=67108863&o}return 0!==r&&(this.words[a]=r,this.length++),t?this.ineg():this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n&1}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),c=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&c}return s&&0!==u&&(s.words[s.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(s/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===c)return this._strip();for(assert(-1===c),c=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this._strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var c,s=a.length-n.length;if("mod"!==t){(c=new BN(null)).length=s+1,c.words=new Array(c.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);c&&(c.words[h]=l)}return c&&c._strip(),a._strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:c||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modrn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modrn=function modrn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=(1<<26)%e,a=0,n=this.length-1;n>=0;n--)a=(r*a+(0|this.words[n]))%e;return t?-a:a},BN.prototype.modn=function modn(e){return this.modrn(e)},BN.prototype.idivn=function idivn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=0,a=this.length-1;a>=0;a--){var n=(0|this.words[a])+67108864*r;this.words[a]=n/e|0,r=n%e}return this._strip(),t?this.ineg():this},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),c=new BN(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(d),c.isub(u)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(c)):(r.isub(t),o.isub(a),c.isub(n))}return{a:o,b:c,gcd:r.iushln(s)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var s=0,d=1;0==(t.words[0]&d)&&s<26;++s,d<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(c),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,c&=67108863,this.words[o]=c}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=c}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(move(e,e.umod(this.m)._forceRed(this)),e)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),c=o.redNeg(),s=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,s).cmp(c);)d.redIAdd(c);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=s-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++c||0===a&&0===u)&&(n=this.mul(n,r[o]),c=0,o=0)):c=0}s=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,a=arguments.length;r0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1] "+p.toString()+"))")),y=!0,this._vm._common.gteHardfork("spuriousDragon")&&g.returnValue.length>this._vm._common.param("vm","maxCodeSize")&&(y=!1),x=!1,p.lte(e.gasLimit)&&(this._vm._allowUnlimitedContractSize||y)?g.gasUsed=p:this._vm._common.gteHardfork("homestead")?(m("Not enough gas or code size not allowed (>= Homestead)"),g=n(n({},g),OOGResult(e.gasLimit))):(m("Not enough gas or code size not allowed (Frontier)"),p.sub(B).lte(e.gasLimit)?(g=n(n({},g),COOGResult(p.sub(B))),x=!0):g=n(n({},g),OOGResult(e.gasLimit))),g.exceptionError||!g.returnValue||""===g.returnValue.toString()?[3,14]:[4,this._state.putContractCode(e.to,g.returnValue)];case 13:return c.sent(),m("Code saved on new contract creation"),[3,17];case 14:return x?this._vm._common.gteHardfork("homestead")?[3,17]:[4,this._state.getAccount(e.to)]:[3,17];case 15:return C=c.sent(),[4,this._state.putAccount(e.to,C)];case 16:c.sent(),c.label=17;case 17:return[2,{gasUsed:g.gasUsed,createdAddress:e.to,execResult:g}]}}))}))},EVM.prototype.runInterpreter=function(e,t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var r,o,s,d,b,p,m;return c(this,(function(c){switch(c.label){case 0:return o={blockchain:this._vm.blockchain,address:e.to||u.Address.zero(),caller:e.caller||u.Address.zero(),callData:e.data||a.from([0]),callValue:e.value||new u.BN(0),code:e.code,isStatic:e.isStatic||!1,depth:e.depth||0,gasPrice:this._tx.gasPrice,origin:this._tx.origin||e.caller||u.Address.zero(),block:this._block||new h.Block},[4,this._state.getAccount(e.to||u.Address.zero())];case 1:return o.contract=c.sent(),o.codeAddress=e.codeAddress,r=o,s=new g.default(r,this._state,this,this._vm._common,e.gasLimit.clone()),e.selfdestruct&&(s._result.selfdestruct=e.selfdestruct),d=this._refund.clone(),[4,new B.default(this._vm,s).run(e.code,t)];case 2:return b=c.sent(),p=s._result,m=e.gasLimit.sub(s._gasLeft),b.exceptionError&&(b.exceptionError.error!==l.ERROR.REVERT&&(m=e.gasLimit),p=n(n({},p),{logs:[],selfdestruct:{}}),this._refund=d),[2,n(n({},p),{runState:n(n(n({},b.runState),p),s._env),exceptionError:b.exceptionError,gas:s._gasLeft,gasUsed:m,returnValue:p.returnValue?p.returnValue:a.alloc(0)})]}}))}))},EVM.prototype.getPrecompile=function(e){return b.getPrecompile(e,this._vm._common)},EVM.prototype.runPrecompile=function(e,t,r){if("function"!=typeof e)throw new Error("Invalid precompile");return e({data:t,gasLimit:r,_common:this._vm._common,_VM:this._vm})},EVM.prototype._loadCode=function(e){return o(this,void 0,void 0,(function(){var t,r;return c(this,(function(a){switch(a.label){case 0:return e.code?[3,3]:(t=this.getPrecompile(e.codeAddress))?(e.code=t,e.isCompiled=!0,[3,3]):[3,1];case 1:return r=e,[4,this._state.getContractCode(e.codeAddress)];case 2:r.code=a.sent(),e.isCompiled=!1,a.label=3;case 3:return[2]}}))}))},EVM.prototype._generateAddress=function(e){return o(this,void 0,void 0,(function(){var t,r,n;return c(this,(function(o){switch(o.label){case 0:return e.salt?(t=u.generateAddress2(e.caller.buf,e.salt,e.code),[3,3]):[3,1];case 1:return[4,this._state.getAccount(e.caller)];case 2:r=o.sent(),n=r.nonce.subn(1),t=u.generateAddress(e.caller.buf,n.toArrayLike(a)),o.label=3;case 3:return[2,new u.Address(t)]}}))}))},EVM.prototype._reduceSenderBalance=function(e,t){return o(this,void 0,void 0,(function(){var r;return c(this,(function(a){return e.balance.isub(t.value),r=this._state.putAccount(t.caller,e),m("Reduced sender ("+t.caller.toString()+") balance (-> "+e.balance.toString()+")"),[2,r]}))}))},EVM.prototype._addToBalance=function(e,t){return o(this,void 0,void 0,(function(){var r,a;return c(this,(function(n){if((r=e.balance.add(t.value)).gt(u.MAX_INTEGER))throw new l.VmError(l.ERROR.VALUE_OVERFLOW);return e.balance=r,a=this._state.putAccount(t.to,e),m("Added toAccount ("+t.to.toString()+") balance (-> "+e.balance.toString()+")"),[2,a]}))}))},EVM.prototype._touchAccount=function(e){return o(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return[4,this._state.getAccount(e)];case 1:return t=r.sent(),[2,this._state.putAccount(e,t)]}}))}))},EVM}();t.default=y},(e,t,r)=>{"use strict";var a,n=SyntaxError,o=Function,c=TypeError,getEvalledConstructor=function(e){try{return o('"use strict"; return ('+e+").constructor;")()}catch(e){}},s=Object.getOwnPropertyDescriptor;if(s)try{s({},"")}catch(e){s=null}var throwTypeError=function(){throw new c},d=s?function(){try{return throwTypeError}catch(e){try{return s(arguments,"callee").get}catch(e){return throwTypeError}}}():throwTypeError,u=r(417)(),h=Object.getPrototypeOf||function(e){return e.__proto__},l={},b="undefined"==typeof Uint8Array?a:h(Uint8Array),g={"%AggregateError%":"undefined"==typeof AggregateError?a:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?a:ArrayBuffer,"%ArrayIteratorPrototype%":u?h([][Symbol.iterator]()):a,"%AsyncFromSyncIteratorPrototype%":a,"%AsyncFunction%":l,"%AsyncGenerator%":l,"%AsyncGeneratorFunction%":l,"%AsyncIteratorPrototype%":l,"%Atomics%":"undefined"==typeof Atomics?a:Atomics,"%BigInt%":"undefined"==typeof BigInt?a:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?a:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?a:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?a:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?a:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":l,"%Int8Array%":"undefined"==typeof Int8Array?a:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?a:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?a:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":u?h(h([][Symbol.iterator]())):a,"%JSON%":"object"==typeof JSON?JSON:a,"%Map%":"undefined"==typeof Map?a:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&u?h((new Map)[Symbol.iterator]()):a,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?a:Promise,"%Proxy%":"undefined"==typeof Proxy?a:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?a:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?a:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&u?h((new Set)[Symbol.iterator]()):a,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?a:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":u?h(""[Symbol.iterator]()):a,"%Symbol%":u?Symbol:a,"%SyntaxError%":n,"%ThrowTypeError%":d,"%TypedArray%":b,"%TypeError%":c,"%Uint8Array%":"undefined"==typeof Uint8Array?a:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?a:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?a:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?a:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?a:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?a:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?a:WeakSet},p=function doEval(e){var t;if("%AsyncFunction%"===e)t=getEvalledConstructor("async function () {}");else if("%GeneratorFunction%"===e)t=getEvalledConstructor("function* () {}");else if("%AsyncGeneratorFunction%"===e)t=getEvalledConstructor("async function* () {}");else if("%AsyncGenerator%"===e){var r=doEval("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if("%AsyncIteratorPrototype%"===e){var a=doEval("%AsyncGenerator%");a&&(t=h(a.prototype))}return g[e]=t,t},B={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},m=r(416),I=r(176),y=m.call(Function.call,Array.prototype.concat),x=m.call(Function.apply,Array.prototype.splice),C=m.call(Function.call,String.prototype.replace),v=m.call(Function.call,String.prototype.slice),Q=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,w=/\\(\\)?/g,_=function stringToPath(e){var t=v(e,0,1),r=v(e,-1);if("%"===t&&"%"!==r)throw new n("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new n("invalid intrinsic syntax, expected opening `%`");var a=[];return C(e,Q,(function(e,t,r,n){a[a.length]=r?C(n,w,"$1"):t||e})),a},k=function getBaseIntrinsic(e,t){var r,a=e;if(I(B,a)&&(a="%"+(r=B[a])[0]+"%"),I(g,a)){var o=g[a];if(o===l&&(o=p(a)),void 0===o&&!t)throw new c("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:a,value:o}}throw new n("intrinsic "+e+" does not exist!")};e.exports=function GetIntrinsic(e,t){if("string"!=typeof e||0===e.length)throw new c("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new c('"allowMissing" argument must be a boolean');var r=_(e),a=r.length>0?r[0]:"",o=k("%"+a+"%",t),d=o.name,u=o.value,h=!1,l=o.alias;l&&(a=l[0],x(r,y([0,1],l)));for(var b=1,p=!0;b=r.length){var Q=s(u,B);u=(p=!!Q)&&"get"in Q&&!("originalValue"in Q.get)?Q.get:u[B]}else p=I(u,B),u=u[B];p&&!h&&(g[d]=u)}}return u}},e=>{"function"==typeof Object.create?e.exports=function inherits(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function inherits(e,t){if(t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(208),t),n(r(38),t),n(r(623),t),n(r(68),t),n(r(624),t),n(r(87),t),n(r(142),t),n(r(143),t),n(r(252),t),n(r(17),t)},(e,t,r)=>{"use strict";var a=r(0).Buffer,n=r(543),o=r(932);function padToEven(e){var t=e;if("string"!=typeof t)throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof t+", while padToEven.");return t.length%2&&(t="0"+t),t}function intToHex(e){return"0x"+e.toString(16)}e.exports={arrayContainsArray:function arrayContainsArray(e,t,r){if(!0!==Array.isArray(e))throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof e+"'");if(!0!==Array.isArray(t))throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof t+"'");return t[Boolean(r)?"some":"every"]((function(t){return e.indexOf(t)>=0}))},intToBuffer:function intToBuffer(e){var t=intToHex(e);return new a(padToEven(t.slice(2)),"hex")},getBinarySize:function getBinarySize(e){if("string"!=typeof e)throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof e+"'.");return a.byteLength(e,"utf8")},isHexPrefixed:n,stripHexPrefix:o,padToEven,intToHex,fromAscii:function fromAscii(e){for(var t="",r=0;r{},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(21),t)},(e,t,r)=>{"use strict";var a=r(0).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.getLength=t.decode=t.encode=void 0;var n=r(542);function safeParseInt(e,t){if("00"===e.slice(0,2))throw new Error("invalid RLP: extra zeros");return parseInt(e,t)}function encodeLength(e,t){if(e<56)return a.from([e+t]);var r=intToHex(e),n=intToHex(t+55+r.length/2);return a.from(n+r,"hex")}function _decode(e){var t,r,n,o,c,s=[],d=e[0];if(d<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(d<=183){if(t=d-127,n=128===d?a.from([]):e.slice(1,t),2===t&&n[0]<128)throw new Error("invalid rlp encoding: byte must be less 0x80");return{data:n,remainder:e.slice(t)}}if(d<=191){if(r=d-182,e.length-1e.length)throw new Error("invalid rlp: total length is larger than the data");if(0===(o=e.slice(r,u)).length)throw new Error("invalid rlp, List has a invalid length");for(;o.length;)c=_decode(o),s.push(c.data),o=c.remainder;return{data:s,remainder:e.slice(u)}}function isHexPrefixed(e){return"0x"===e.slice(0,2)}function intToHex(e){if(e<0)throw new Error("Invalid integer as argument, must be unsigned!");var t=e.toString(16);return t.length%2?"0"+t:t}function toBuffer(e){if(!a.isBuffer(e)){if("string"==typeof e)return isHexPrefixed(e)?a.from(function padToEven(e){return e.length%2?"0"+e:e}(function stripHexPrefix(e){return"string"!=typeof e?e:isHexPrefixed(e)?e.slice(2):e}(e)),"hex"):a.from(e);if("number"==typeof e||"bigint"==typeof e)return e?function intToBuffer(e){var t=intToHex(e);return a.from(t,"hex")}(e):a.from([]);if(null==e)return a.from([]);if(e instanceof Uint8Array)return a.from(e);if(n.isBN(e))return a.from(e.toArray());throw new Error("invalid type")}return e}t.encode=function encode(e){if(Array.isArray(e)){for(var t=[],r=0;r{var a=r(0),n=a.Buffer;function copyProps(e,t){for(var r in e)t[r]=e[r]}function SafeBuffer(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=a:(copyProps(a,t),t.Buffer=SafeBuffer),SafeBuffer.prototype=Object.create(n.prototype),copyProps(n,SafeBuffer),SafeBuffer.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},SafeBuffer.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var a=n(e);return void 0!==t?"string"==typeof r?a.fill(t,r):a.fill(t):a.fill(0),a},SafeBuffer.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},SafeBuffer.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a.SlowBuffer(e)}},e=>{"function"==typeof Object.create?e.exports=function inherits(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function inherits(e,t){if(t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}}},e=>{"function"==typeof Object.create?e.exports=function inherits(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function inherits(e,t){if(t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}}},e=>{"function"==typeof Object.create?e.exports=function inherits(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function inherits(e,t){if(t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(1197),t),n(r(1199),t),n(r(262),t),n(r(1200),t),n(r(263),t),n(r(1201),t),n(r(722),t),n(r(721),t),n(r(156),t),n(r(1202),t),n(r(425),t),n(r(1204),t),n(r(431),t)},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(345),t),n(r(1269),t),n(r(1270),t),n(r(886),t),n(r(1271),t),n(r(885),t),n(r(1272),t),n(r(1273),t),n(r(240),t),n(r(241),t),n(r(1274),t)},(e,t,r)=>{var a;function createDebug(e){function debug(){if(debug.enabled){var e=debug,r=+new Date,n=r-(a||r);e.diff=n,e.prev=a,e.curr=r,a=r;for(var o=new Array(arguments.length),c=0;c=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),c=t;c=49?s-49+10:s>=17?s-17+10:s}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,c=o%a,s=Math.min(o,o-c)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],o=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],c=n*o,s=67108863&c,d=c/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(c=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&c}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,s=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=c[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,c,s="le"===t,d=new e(n),u=this.clone();if(s){for(c=0;!u.isZero();c++)o=u.andln(255),u.iushrn(8),d[c]=o;for(;c=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,c=0;c>26,this.words[c]=67108863&t;for(;0!==o&&c>26,this.words[c]=67108863&t;if(0===o&&c>>13,g=0|c[1],p=8191&g,B=g>>>13,m=0|c[2],I=8191&m,y=m>>>13,x=0|c[3],C=8191&x,v=x>>>13,Q=0|c[4],w=8191&Q,_=Q>>>13,k=0|c[5],N=8191&k,D=k>>>13,U=0|c[6],G=8191&U,T=U>>>13,L=0|c[7],q=8191&L,P=L>>>13,O=0|c[8],H=8191&O,Y=O>>>13,J=0|c[9],j=8191&J,z=J>>>13,W=0|s[0],V=8191&W,X=W>>>13,$=0|s[1],et=8191&$,tt=$>>>13,rt=0|s[2],at=8191&rt,it=rt>>>13,nt=0|s[3],ot=8191&nt,At=nt>>>13,ct=0|s[4],st=8191&ct,dt=ct>>>13,ut=0|s[5],ht=8191&ut,bt=ut>>>13,pt=0|s[6],Bt=8191&pt,mt=pt>>>13,It=0|s[7],Et=8191&It,yt=It>>>13,xt=0|s[8],Ct=8191&xt,vt=xt>>>13,Qt=0|s[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(C,V),n=(n=Math.imul(C,X))+Math.imul(v,V)|0,o=Math.imul(v,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(C,et)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(v,et)|0,o=o+Math.imul(v,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,st)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(C,at)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(v,at)|0,o=o+Math.imul(v,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,st)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,st)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,At)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,At)|0,a=a+Math.imul(I,st)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,st)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(q,V),n=(n=Math.imul(q,X))+Math.imul(P,V)|0,o=Math.imul(P,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(C,st)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(v,st)|0,o=o+Math.imul(v,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(q,et)|0,n=(n=n+Math.imul(q,tt)|0)+Math.imul(P,et)|0,o=o+Math.imul(P,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,st)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,st)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,bt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,Ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,vt)|0)+Math.imul(b,Ct)|0))<<13)|0;u=((o=o+Math.imul(b,vt)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(j,V),n=(n=Math.imul(j,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(q,at)|0,n=(n=n+Math.imul(q,it)|0)+Math.imul(P,at)|0,o=o+Math.imul(P,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,st)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,st)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(C,Bt)|0,n=(n=n+Math.imul(C,mt)|0)+Math.imul(v,Bt)|0,o=o+Math.imul(v,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,Ct)|0,n=(n=n+Math.imul(p,vt)|0)+Math.imul(B,Ct)|0,o=o+Math.imul(B,vt)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(j,et),n=(n=Math.imul(j,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(q,ot)|0,n=(n=n+Math.imul(q,At)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,At)|0,a=a+Math.imul(G,st)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,st)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(C,Et)|0,n=(n=n+Math.imul(C,yt)|0)+Math.imul(v,Et)|0,o=o+Math.imul(v,yt)|0,a=a+Math.imul(I,Ct)|0,n=(n=n+Math.imul(I,vt)|0)+Math.imul(y,Ct)|0,o=o+Math.imul(y,vt)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(j,at),n=(n=Math.imul(j,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(q,st)|0,n=(n=n+Math.imul(q,dt)|0)+Math.imul(P,st)|0,o=o+Math.imul(P,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(C,Ct)|0,n=(n=n+Math.imul(C,vt)|0)+Math.imul(v,Ct)|0,o=o+Math.imul(v,vt)|0;var qt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(j,ot),n=(n=Math.imul(j,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,st)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,st)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(q,ht)|0,n=(n=n+Math.imul(q,bt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,Ct)|0,n=(n=n+Math.imul(w,vt)|0)+Math.imul(_,Ct)|0,o=o+Math.imul(_,vt)|0;var Pt=(u+(a=a+Math.imul(C,wt)|0)|0)+((8191&(n=(n=n+Math.imul(C,Mt)|0)+Math.imul(v,wt)|0))<<13)|0;u=((o=o+Math.imul(v,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(j,st),n=(n=Math.imul(j,dt))+Math.imul(z,st)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(q,Bt)|0,n=(n=n+Math.imul(q,mt)|0)+Math.imul(P,Bt)|0,o=o+Math.imul(P,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,Ct)|0,n=(n=n+Math.imul(N,vt)|0)+Math.imul(D,Ct)|0,o=o+Math.imul(D,vt)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(j,ht),n=(n=Math.imul(j,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(q,Et)|0,n=(n=n+Math.imul(q,yt)|0)+Math.imul(P,Et)|0,o=o+Math.imul(P,yt)|0,a=a+Math.imul(G,Ct)|0,n=(n=n+Math.imul(G,vt)|0)+Math.imul(T,Ct)|0,o=o+Math.imul(T,vt)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(j,Bt),n=(n=Math.imul(j,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(q,Ct)|0,n=(n=n+Math.imul(q,vt)|0)+Math.imul(P,Ct)|0,o=o+Math.imul(P,vt)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(j,Et),n=(n=Math.imul(j,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,Ct)|0,n=(n=n+Math.imul(H,vt)|0)+Math.imul(Y,Ct)|0,o=o+Math.imul(Y,vt)|0;var Jt=(u+(a=a+Math.imul(q,wt)|0)|0)+((8191&(n=(n=n+Math.imul(q,Mt)|0)+Math.imul(P,wt)|0))<<13)|0;u=((o=o+Math.imul(P,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(j,Ct),n=(n=Math.imul(j,vt))+Math.imul(z,Ct)|0,o=Math.imul(z,vt);var Kt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863;var jt=(u+(a=Math.imul(j,wt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=qt,d[12]=Pt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=Jt,d[17]=Kt,d[18]=jt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(s=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?s(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,c&=67108863}r.words[o]=s,a=c,c=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var c=0;c>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),c=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&c}return s&&0!==u&&(s.words[s.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(s/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===c)return this.strip();for(assert(-1===c),c=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var c,s=a.length-n.length;if("mod"!==t){(c=new BN(null)).length=s+1,c.words=new Array(c.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);c&&(c.words[h]=l)}return c&&c.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:c||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),c=new BN(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(d),c.isub(u)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(c)):(r.isub(t),o.isub(a),c.isub(n))}return{a:o,b:c,gcd:r.iushln(s)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var s=0,d=1;0==(t.words[0]&d)&&s<26;++s,d<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(c),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,c&=67108863,this.words[o]=c}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=c}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),c=o.redNeg(),s=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,s).cmp(c);)d.redIAdd(c);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=s-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++c||0===a&&0===u)&&(n=this.mul(n,r[o]),c=0,o=0)):c=0}s=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VmError=t.ERROR=void 0,function(e){e.OUT_OF_GAS="out of gas",e.CODESTORE_OUT_OF_GAS="code store out of gas",e.STACK_UNDERFLOW="stack underflow",e.STACK_OVERFLOW="stack overflow",e.INVALID_JUMP="invalid JUMP",e.INVALID_OPCODE="invalid opcode",e.OUT_OF_RANGE="value out of range",e.REVERT="revert",e.STATIC_STATE_CHANGE="static state change",e.INTERNAL_ERROR="internal error",e.CREATE_COLLISION="create collision",e.STOP="stop",e.REFUND_EXHAUSTED="refund exhausted",e.VALUE_OVERFLOW="value overflow",e.INVALID_BEGINSUB="invalid BEGINSUB",e.INVALID_RETURNSUB="invalid RETURNSUB",e.INVALID_JUMPSUB="invalid JUMPSUB",e.BLS_12_381_INVALID_INPUT_LENGTH="invalid input length",e.BLS_12_381_POINT_NOT_ON_CURVE="point not on curve",e.BLS_12_381_INPUT_EMPTY="input is empty",e.BLS_12_381_FP_NOT_IN_FIELD="fp point not in field"}(t.ERROR||(t.ERROR={}));t.VmError=class VmError{constructor(e){this.error=e,this.errorType="VmError"}}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.VmErrorResult=t.COOGResult=t.OOGResult=void 0;const o=r(51),c=r(4),s=r(109),d=r(30),u=r(413),h=n(r(684)),l=r(310),b=n(r(686)),g=o.debug("vm:evm"),p=o.debug("vm:evm:gas");function OOGResult(e){return{returnValue:a.alloc(0),gasUsed:e,exceptionError:new d.VmError(d.ERROR.OUT_OF_GAS)}}function COOGResult(e){return{returnValue:a.alloc(0),gasUsed:e,exceptionError:new d.VmError(d.ERROR.CODESTORE_OUT_OF_GAS)}}t.OOGResult=OOGResult,t.COOGResult=COOGResult,t.VmErrorResult=function VmErrorResult(e,t){return{returnValue:a.alloc(0),gasUsed:t,exceptionError:e}};t.default=class EVM{constructor(e,t,r){this._vm=e,this._state=this._vm.stateManager,this._tx=t,this._block=r,this._refund=new c.BN(0)}async executeMessage(e){var t;let r;await this._vm._emit("beforeMessage",e),!e.to&&this._vm._common.isActivatedEIP(2929)&&(e.code=e.data,this._state.addWarmedAddress((await this._generateAddress(e)).buf)),await this._state.checkpoint(),g("-".repeat(100)),g("message checkpoint"),g(`New message caller=${e.caller.toString()} gasLimit=${e.gasLimit.toString()} to=${e.to?e.to.toString():""} value=${e.value.toString()} delegatecall=${e.delegatecall?"yes":"no"}`),e.to?(g(`Message CALL execution (to: ${e.to.toString()})`),r=await this._executeCall(e)):(g("Message CREATE execution (to undefined)"),r=await this._executeCreate(e)),g(`Received message results gasUsed=${r.gasUsed} execResult: [ gasUsed=${r.gasUsed} exceptionError=${r.execResult.exceptionError?r.execResult.exceptionError.toString():""} returnValue=${l.short(r.execResult.returnValue)} gasRefund=${null===(t=r.execResult.gasRefund)||void 0===t?void 0:t.toString()} ]`),r.execResult.gasRefund=this._refund.clone();const a=r.execResult.exceptionError;return a&&(this._vm._common.gteHardfork("homestead")||a.error!=d.ERROR.CODESTORE_OUT_OF_GAS)?(r.execResult.logs=[],await this._state.revert(),g("message checkpoint reverted")):(await this._state.commit(),g("message checkpoint committed")),await this._vm._emit("afterMessage",r),r}async _executeCall(e){const t=await this._state.getAccount(e.caller);e.delegatecall||await this._reduceSenderBalance(t,e);const r=await this._state.getAccount(e.to);let n;if(!e.delegatecall)try{await this._addToBalance(r,e)}catch(e){n=e}await this._loadCode(e);let o,s=!1;return e.code&&0!==e.code.length||(s=!0,g("Exit early on no code")),n&&(s=!0,g("Exit early on value tranfer overflowed")),s?{gasUsed:new c.BN(0),execResult:{gasUsed:new c.BN(0),exceptionError:n,returnValue:a.alloc(0)}}:(e.isCompiled?(g("Run precompile"),o=await this.runPrecompile(e.code,e.data,e.gasLimit)):(g("Start bytecode processing..."),o=await this.runInterpreter(e)),{gasUsed:o.gasUsed,execResult:o})}async _executeCreate(e){const t=await this._state.getAccount(e.caller);await this._reduceSenderBalance(t,e),e.code=e.data,e.data=a.alloc(0),e.to=await this._generateAddress(e),g(`Generated CREATE contract address ${e.to.toString()}`);let r=await this._state.getAccount(e.to);if(r.nonce&&r.nonce.gtn(0)||!r.codeHash.equals(c.KECCAK256_NULL))return g("Returning on address collision"),{gasUsed:e.gasLimit,createdAddress:e.to,execResult:{returnValue:a.alloc(0),exceptionError:new d.VmError(d.ERROR.CREATE_COLLISION),gasUsed:e.gasLimit}};await this._state.clearContractStorage(e.to);const n={address:e.to,code:e.code};let o;await this._vm._emit("newContract",n),r=await this._state.getAccount(e.to),this._vm._common.gteHardfork("spuriousDragon")&&r.nonce.iaddn(1);try{await this._addToBalance(r,e)}catch(e){o=e}let s=!1;if(e.code&&0!==e.code.length||(s=!0,g("Exit early on no code")),o&&(s=!0,g("Exit early on value tranfer overflowed")),s)return{gasUsed:new c.BN(0),createdAddress:e.to,execResult:{gasUsed:new c.BN(0),exceptionError:o,returnValue:a.alloc(0)}};g("Start bytecode processing...");let u=await this.runInterpreter(e),h=u.gasUsed,l=new c.BN(0);u.exceptionError||(l=new c.BN(u.returnValue.length).imuln(this._vm._common.param("gasPrices","createData")),h=h.add(l),p(`Add return value size fee (${l.toString()} to gas used (-> ${h.toString()}))`));let b=!0;this._vm._common.gteHardfork("spuriousDragon")&&u.returnValue.length>this._vm._common.param("vm","maxCodeSize")&&(b=!1);let B=!1;if(h.lte(e.gasLimit)&&(this._vm._allowUnlimitedContractSize||b)?u.gasUsed=h:this._vm._common.gteHardfork("homestead")?(g("Not enough gas or code size not allowed (>= Homestead)"),u=Object.assign(Object.assign({},u),OOGResult(e.gasLimit))):(g("Not enough gas or code size not allowed (Frontier)"),h.sub(l).lte(e.gasLimit)?(u=Object.assign(Object.assign({},u),COOGResult(h.sub(l))),B=!0):u=Object.assign(Object.assign({},u),OOGResult(e.gasLimit))),!u.exceptionError&&u.returnValue&&""!==u.returnValue.toString())await this._state.putContractCode(e.to,u.returnValue),g("Code saved on new contract creation");else if(B&&!this._vm._common.gteHardfork("homestead")){const t=await this._state.getAccount(e.to);await this._state.putAccount(e.to,t)}return{gasUsed:u.gasUsed,createdAddress:e.to,execResult:u}}async runInterpreter(e,t={}){const r={blockchain:this._vm.blockchain,address:e.to||c.Address.zero(),caller:e.caller||c.Address.zero(),callData:e.data||a.from([0]),callValue:e.value||new c.BN(0),code:e.code,isStatic:e.isStatic||!1,depth:e.depth||0,gasPrice:this._tx.gasPrice,origin:this._tx.origin||e.caller||c.Address.zero(),block:this._block||new s.Block,contract:await this._state.getAccount(e.to||c.Address.zero()),codeAddress:e.codeAddress},n=new h.default(r,this._state,this,this._vm._common,e.gasLimit.clone());e.selfdestruct&&(n._result.selfdestruct=e.selfdestruct);const o=this._refund.clone(),u=new b.default(this._vm,n),l=await u.run(e.code,t);let g=n._result,p=e.gasLimit.sub(n._gasLeft);return l.exceptionError&&(l.exceptionError.error!==d.ERROR.REVERT&&(p=e.gasLimit),g=Object.assign(Object.assign({},g),{logs:[],selfdestruct:{}}),this._refund=o),Object.assign(Object.assign({},g),{runState:Object.assign(Object.assign(Object.assign({},l.runState),g),n._env),exceptionError:l.exceptionError,gas:n._gasLeft,gasUsed:p,returnValue:g.returnValue?g.returnValue:a.alloc(0)})}getPrecompile(e){return u.getPrecompile(e,this._vm._common)}runPrecompile(e,t,r){if("function"!=typeof e)throw new Error("Invalid precompile");return e({data:t,gasLimit:r,_common:this._vm._common,_VM:this._vm})}async _loadCode(e){if(!e.code){const t=this.getPrecompile(e.codeAddress);t?(e.code=t,e.isCompiled=!0):(e.code=await this._state.getContractCode(e.codeAddress),e.isCompiled=!1)}}async _generateAddress(e){let t;if(e.salt)t=c.generateAddress2(e.caller.buf,e.salt,e.code);else{const r=(await this._state.getAccount(e.caller)).nonce.subn(1);t=c.generateAddress(e.caller.buf,r.toArrayLike(a))}return new c.Address(t)}async _reduceSenderBalance(e,t){e.balance.isub(t.value);const r=this._state.putAccount(t.caller,e);return g(`Reduced sender (${t.caller.toString()}) balance (-> ${e.balance.toString()})`),r}async _addToBalance(e,t){const r=e.balance.add(t.value);if(r.gt(c.MAX_INTEGER))throw new d.VmError(d.ERROR.VALUE_OVERFLOW);e.balance=r;const a=this._state.putAccount(t.to,e);return g(`Added toAccount (${t.to.toString()}) balance (-> ${e.balance.toString()})`),a}async _touchAccount(e){const t=await this._state.getAccount(e);return this._state.putAccount(e,t)}}},(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VmError=t.ERROR=void 0,function(e){e.OUT_OF_GAS="out of gas",e.CODESTORE_OUT_OF_GAS="code store out of gas",e.STACK_UNDERFLOW="stack underflow",e.STACK_OVERFLOW="stack overflow",e.INVALID_JUMP="invalid JUMP",e.INVALID_OPCODE="invalid opcode",e.OUT_OF_RANGE="value out of range",e.REVERT="revert",e.STATIC_STATE_CHANGE="static state change",e.INTERNAL_ERROR="internal error",e.CREATE_COLLISION="create collision",e.STOP="stop",e.REFUND_EXHAUSTED="refund exhausted",e.VALUE_OVERFLOW="value overflow",e.INVALID_BEGINSUB="invalid BEGINSUB",e.INVALID_RETURNSUB="invalid RETURNSUB",e.INVALID_JUMPSUB="invalid JUMPSUB",e.BLS_12_381_INVALID_INPUT_LENGTH="invalid input length",e.BLS_12_381_POINT_NOT_ON_CURVE="point not on curve",e.BLS_12_381_INPUT_EMPTY="input is empty",e.BLS_12_381_FP_NOT_IN_FIELD="fp point not in field"}(t.ERROR||(t.ERROR={}));var r=function r(e){this.error=e,this.errorType="VmError"};t.VmError=r},(e,t,r)=>{"use strict";var a=r(2).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.BaseJsonRpcType=t.toBuffers=t.toStrings=t.bufCache=t.strCache=void 0;const n=r(26),o=r(26),c=r(156);t.strCache=new WeakMap,t.bufCache=new WeakMap,t.toStrings=new WeakMap,t.toBuffers=new WeakMap;const s=Symbol.for("nodejs.util.inspect.custom");t.BaseJsonRpcType=class BaseJsonRpcType{constructor(e){const r=this;if(a.isBuffer(e))t.toStrings.set(this,(()=>e.toString("hex"))),t.bufCache.set(this,e),r[Symbol.toStringTag]="Buffer";else{const s=typeof e;switch(s){case"number":if(e%1!=0)throw new Error("`Cannot wrap a decimal value as a json-rpc type`");t.toStrings.set(this,(()=>e.toString(16))),t.toBuffers.set(this,(()=>0===e?c.BUFFER_EMPTY:o.uintToBuffer(e)));break;case"bigint":t.toStrings.set(this,(()=>e.toString(16))),t.toBuffers.set(this,(()=>0n===e?c.BUFFER_EMPTY:n.bigIntToBuffer(e)));break;case"string":if(0!==e.indexOf("0x"))throw new Error(`cannot convert string value "${e}" into type \`${this.constructor.name}\`; strings must be hex-encoded and prefixed with "0x".`);t.strCache.set(this,e.toLowerCase()),t.toBuffers.set(this,(()=>{let t=e.slice(2);return t.length%2==1&&(t="0"+t),a.from(t,"hex")}));break;default:if(null==e){this.toString=()=>e,t.bufCache.set(this,c.BUFFER_EMPTY);break}throw new Error(`Cannot wrap a "${s}" as a json-rpc type`)}r[Symbol.toStringTag]=s}this.value=e}[s](e,t){return this.value}toString(){let e=t.strCache.get(this);return void 0===e&&(e="0x"+t.toStrings.get(this)(),t.strCache.set(this,e)),e}toBuffer(){let e=t.bufCache.get(this);return void 0===e&&(e=t.toBuffers.get(this)(),t.bufCache.set(this,e)),e}valueOf(){return this.value}toJSON(){return this.toString()}isNull(){return null==this.value}}},e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,a=r&&"function"==typeof r.apply?r.apply:function ReflectApply(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function ReflectOwnKeys(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function ReflectOwnKeys(e){return Object.getOwnPropertyNames(e)};var n=Number.isNaN||function NumberIsNaN(e){return e!=e};function EventEmitter(){EventEmitter.init.call(this)}e.exports=EventEmitter,e.exports.once=function once(e,t){return new Promise((function(r,a){function eventListener(){void 0!==n&&e.removeListener("error",n),r([].slice.call(arguments))}var n;"error"!==t&&(n=function errorListener(r){e.removeListener(t,eventListener),a(r)},e.once("error",n)),e.once(t,eventListener)}))},EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._eventsCount=0,EventEmitter.prototype._maxListeners=void 0;var o=10;function checkListener(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function _getMaxListeners(e){return void 0===e._maxListeners?EventEmitter.defaultMaxListeners:e._maxListeners}function _addListener(e,t,r,a){var n,o,c;if(checkListener(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),c=o[t]),void 0===c)c=o[t]=r,++e._eventsCount;else if("function"==typeof c?c=o[t]=a?[r,c]:[c,r]:a?c.unshift(r):c.push(r),(n=_getMaxListeners(e))>0&&c.length>n&&!c.warned){c.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=c.length,function ProcessEmitWarning(e){console&&console.warn&&console.warn(e)}(s)}return e}function onceWrapper(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _onceWrap(e,t,r){var a={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=onceWrapper.bind(a);return n.listener=r,a.wrapFn=n,n}function _listeners(e,t,r){var a=e._events;if(void 0===a)return[];var n=a[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function unwrapListeners(e){for(var t=new Array(e.length),r=0;r0&&(c=t[0]),c instanceof Error)throw c;var s=new Error("Unhandled error."+(c?" ("+c.message+")":""));throw s.context=c,s}var d=o[e];if(void 0===d)return!1;if("function"==typeof d)a(d,this,t);else{var u=d.length,h=arrayClone(d,u);for(r=0;r=0;o--)if(r[o]===t||r[o].listener===t){c=r[o].listener,n=o;break}if(n<0)return this;0===n?r.shift():function spliceOne(e,t){for(;t+1=0;a--)this.removeListener(e,t[a]);return this},EventEmitter.prototype.listeners=function listeners(e){return _listeners(this,e,!0)},EventEmitter.prototype.rawListeners=function rawListeners(e){return _listeners(this,e,!1)},EventEmitter.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):listenerCount.call(e,t)},EventEmitter.prototype.listenerCount=listenerCount,EventEmitter.prototype.eventNames=function eventNames(){return this._eventsCount>0?t(this._events):[]}},e=>{"function"==typeof Object.create?e.exports=function inherits(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function inherits(e,t){if(t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},s=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),c=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)c.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return c},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isZeroAddress=t.zeroAddress=t.importPublic=t.privateToAddress=t.privateToPublic=t.publicToAddress=t.pubToAddress=t.isValidPublic=t.isValidPrivate=t.generateAddress2=t.generateAddress=t.isValidChecksumAddress=t.toChecksumAddress=t.isValidAddress=t.Account=void 0;var u=d(r(6)),h=d(r(12)),l=c(r(20)),b=r(50),g=r(17),p=r(203),B=r(84),m=r(65),I=r(373),y=r(250),x=function(){function Account(e,t,r,a){void 0===e&&(e=new h.default(0)),void 0===t&&(t=new h.default(0)),void 0===r&&(r=p.KECCAK256_RLP),void 0===a&&(a=p.KECCAK256_NULL),this.nonce=e,this.balance=t,this.stateRoot=r,this.codeHash=a,this._validate()}return Account.fromAccountData=function(e){var t=e.nonce,r=e.balance,a=e.stateRoot,n=e.codeHash;return new Account(t?new h.default(B.toBuffer(t)):void 0,r?new h.default(B.toBuffer(r)):void 0,a?B.toBuffer(a):void 0,n?B.toBuffer(n):void 0)},Account.fromRlpSerializedAccount=function(e){var t=l.decode(e);if(!Array.isArray(t))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(t)},Account.fromValuesArray=function(e){var t=s(e,4),r=t[0],a=t[1],n=t[2],o=t[3];return new Account(new h.default(r),new h.default(a),n,o)},Account.prototype._validate=function(){if(this.nonce.lt(new h.default(0)))throw new Error("nonce must be greater than zero");if(this.balance.lt(new h.default(0)))throw new Error("balance must be greater than zero");if(32!==this.stateRoot.length)throw new Error("stateRoot must have a length of 32");if(32!==this.codeHash.length)throw new Error("codeHash must have a length of 32")},Account.prototype.raw=function(){return[y.bnToUnpaddedBuffer(this.nonce),y.bnToUnpaddedBuffer(this.balance),this.stateRoot,this.codeHash]},Account.prototype.serialize=function(){return l.encode(this.raw())},Account.prototype.isContract=function(){return!this.codeHash.equals(p.KECCAK256_NULL)},Account.prototype.isEmpty=function(){return this.balance.isZero()&&this.nonce.isZero()&&this.codeHash.equals(p.KECCAK256_NULL)},Account}();t.Account=x,t.isValidAddress=function(e){try{I.assertIsString(e)}catch(e){return!1}return/^0x[0-9a-fA-F]{40}$/.test(e)},t.toChecksumAddress=function(e,t){I.assertIsHexString(e);var r=g.stripHexPrefix(e).toLowerCase(),a="";t&&(a=y.toType(t,y.TypeOutput.BN).toString()+"0x");for(var n=m.keccakFromString(a+r).toString("hex"),o="0x",c=0;c=8?o+=r[c].toUpperCase():o+=r[c];return o},t.isValidChecksumAddress=function(e,r){return t.isValidAddress(e)&&t.toChecksumAddress(e,r)===e},t.generateAddress=function(e,t){I.assertIsBuffer(e),I.assertIsBuffer(t);var r=new h.default(t);return r.isZero()?m.rlphash([e,null]).slice(-20):m.rlphash([e,a.from(r.toArray())]).slice(-20)},t.generateAddress2=function(e,t,r){return I.assertIsBuffer(e),I.assertIsBuffer(t),I.assertIsBuffer(r),u.default(20===e.length),u.default(32===t.length),m.keccak256(a.concat([a.from("ff","hex"),e,t,m.keccak256(r)])).slice(-20)},t.isValidPrivate=function(e){return b.privateKeyVerify(e)},t.isValidPublic=function(e,t){return void 0===t&&(t=!1),I.assertIsBuffer(e),64===e.length?b.publicKeyVerify(a.concat([a.from([4]),e])):!!t&&b.publicKeyVerify(e)},t.pubToAddress=function(e,t){return void 0===t&&(t=!1),I.assertIsBuffer(e),t&&64!==e.length&&(e=a.from(b.publicKeyConvert(e,!1).slice(1))),u.default(64===e.length),m.keccak(e).slice(-20)},t.publicToAddress=t.pubToAddress,t.privateToPublic=function(e){return I.assertIsBuffer(e),a.from(b.publicKeyCreate(e,!1)).slice(1)},t.privateToAddress=function(e){return t.publicToAddress(t.privateToPublic(e))},t.importPublic=function(e){return I.assertIsBuffer(e),64!==e.length&&(e=a.from(b.publicKeyConvert(e,!1).slice(1))),e},t.zeroAddress=function(){var e=B.zeros(20);return B.bufferToHex(e)},t.isZeroAddress=function(e){try{I.assertIsString(e)}catch(e){return!1}return t.zeroAddress()===e}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},s=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),c=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)c.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return c},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isZeroAddress=t.zeroAddress=t.importPublic=t.privateToAddress=t.privateToPublic=t.publicToAddress=t.pubToAddress=t.isValidPublic=t.isValidPrivate=t.generateAddress2=t.generateAddress=t.isValidChecksumAddress=t.toChecksumAddress=t.isValidAddress=t.Account=void 0;var u=d(r(6)),h=d(r(12)),l=c(r(20)),b=r(50),g=r(17),p=r(207),B=r(85),m=r(67),I=r(384),y=r(251),x=function(){function Account(e,t,r,a){void 0===e&&(e=new h.default(0)),void 0===t&&(t=new h.default(0)),void 0===r&&(r=p.KECCAK256_RLP),void 0===a&&(a=p.KECCAK256_NULL),this.nonce=e,this.balance=t,this.stateRoot=r,this.codeHash=a,this._validate()}return Account.fromAccountData=function(e){var t=e.nonce,r=e.balance,a=e.stateRoot,n=e.codeHash;return new Account(t?new h.default(B.toBuffer(t)):void 0,r?new h.default(B.toBuffer(r)):void 0,a?B.toBuffer(a):void 0,n?B.toBuffer(n):void 0)},Account.fromRlpSerializedAccount=function(e){var t=l.decode(e);if(!Array.isArray(t))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(t)},Account.fromValuesArray=function(e){var t=s(e,4),r=t[0],a=t[1],n=t[2],o=t[3];return new Account(new h.default(r),new h.default(a),n,o)},Account.prototype._validate=function(){if(this.nonce.lt(new h.default(0)))throw new Error("nonce must be greater than zero");if(this.balance.lt(new h.default(0)))throw new Error("balance must be greater than zero");if(32!==this.stateRoot.length)throw new Error("stateRoot must have a length of 32");if(32!==this.codeHash.length)throw new Error("codeHash must have a length of 32")},Account.prototype.raw=function(){return[y.bnToUnpaddedBuffer(this.nonce),y.bnToUnpaddedBuffer(this.balance),this.stateRoot,this.codeHash]},Account.prototype.serialize=function(){return l.encode(this.raw())},Account.prototype.isContract=function(){return!this.codeHash.equals(p.KECCAK256_NULL)},Account.prototype.isEmpty=function(){return this.balance.isZero()&&this.nonce.isZero()&&this.codeHash.equals(p.KECCAK256_NULL)},Account}();t.Account=x,t.isValidAddress=function(e){try{I.assertIsString(e)}catch(e){return!1}return/^0x[0-9a-fA-F]{40}$/.test(e)},t.toChecksumAddress=function(e,t){I.assertIsHexString(e);var r=g.stripHexPrefix(e).toLowerCase(),a="";t&&(a=y.toType(t,y.TypeOutput.BN).toString()+"0x");for(var n=m.keccakFromString(a+r).toString("hex"),o="0x",c=0;c=8?o+=r[c].toUpperCase():o+=r[c];return o},t.isValidChecksumAddress=function(e,r){return t.isValidAddress(e)&&t.toChecksumAddress(e,r)===e},t.generateAddress=function(e,t){I.assertIsBuffer(e),I.assertIsBuffer(t);var r=new h.default(t);return r.isZero()?m.rlphash([e,null]).slice(-20):m.rlphash([e,a.from(r.toArray())]).slice(-20)},t.generateAddress2=function(e,t,r){return I.assertIsBuffer(e),I.assertIsBuffer(t),I.assertIsBuffer(r),u.default(20===e.length),u.default(32===t.length),m.keccak256(a.concat([a.from("ff","hex"),e,t,m.keccak256(r)])).slice(-20)},t.isValidPrivate=function(e){return b.privateKeyVerify(e)},t.isValidPublic=function(e,t){return void 0===t&&(t=!1),I.assertIsBuffer(e),64===e.length?b.publicKeyVerify(a.concat([a.from([4]),e])):!!t&&b.publicKeyVerify(e)},t.pubToAddress=function(e,t){return void 0===t&&(t=!1),I.assertIsBuffer(e),t&&64!==e.length&&(e=a.from(b.publicKeyConvert(e,!1).slice(1))),u.default(64===e.length),m.keccak(e).slice(-20)},t.publicToAddress=t.pubToAddress,t.privateToPublic=function(e){return I.assertIsBuffer(e),a.from(b.publicKeyCreate(e,!1)).slice(1)},t.privateToAddress=function(e){return t.publicToAddress(t.privateToPublic(e))},t.importPublic=function(e){return I.assertIsBuffer(e),64!==e.length&&(e=a.from(b.publicKeyConvert(e,!1).slice(1))),e},t.zeroAddress=function(){var e=B.zeros(20);return B.bufferToHex(e)},t.isZeroAddress=function(e){try{I.assertIsString(e)}catch(e){return!1}return t.zeroAddress()===e}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},s=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),c=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)c.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return c},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isZeroAddress=t.zeroAddress=t.importPublic=t.privateToAddress=t.privateToPublic=t.publicToAddress=t.pubToAddress=t.isValidPublic=t.isValidPrivate=t.generateAddress2=t.generateAddress=t.isValidChecksumAddress=t.toChecksumAddress=t.isValidAddress=t.Account=void 0;var u=d(r(6)),h=d(r(12)),l=c(r(20)),b=r(50),g=r(17),p=r(208),B=r(87),m=r(68),I=r(385),y=r(252),x=function(){function Account(e,t,r,a){void 0===e&&(e=new h.default(0)),void 0===t&&(t=new h.default(0)),void 0===r&&(r=p.KECCAK256_RLP),void 0===a&&(a=p.KECCAK256_NULL),this.nonce=e,this.balance=t,this.stateRoot=r,this.codeHash=a,this._validate()}return Account.fromAccountData=function(e){var t=e.nonce,r=e.balance,a=e.stateRoot,n=e.codeHash;return new Account(t?new h.default(B.toBuffer(t)):void 0,r?new h.default(B.toBuffer(r)):void 0,a?B.toBuffer(a):void 0,n?B.toBuffer(n):void 0)},Account.fromRlpSerializedAccount=function(e){var t=l.decode(e);if(!Array.isArray(t))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(t)},Account.fromValuesArray=function(e){var t=s(e,4),r=t[0],a=t[1],n=t[2],o=t[3];return new Account(new h.default(r),new h.default(a),n,o)},Account.prototype._validate=function(){if(this.nonce.lt(new h.default(0)))throw new Error("nonce must be greater than zero");if(this.balance.lt(new h.default(0)))throw new Error("balance must be greater than zero");if(32!==this.stateRoot.length)throw new Error("stateRoot must have a length of 32");if(32!==this.codeHash.length)throw new Error("codeHash must have a length of 32")},Account.prototype.raw=function(){return[y.bnToUnpaddedBuffer(this.nonce),y.bnToUnpaddedBuffer(this.balance),this.stateRoot,this.codeHash]},Account.prototype.serialize=function(){return l.encode(this.raw())},Account.prototype.isContract=function(){return!this.codeHash.equals(p.KECCAK256_NULL)},Account.prototype.isEmpty=function(){return this.balance.isZero()&&this.nonce.isZero()&&this.codeHash.equals(p.KECCAK256_NULL)},Account}();t.Account=x,t.isValidAddress=function(e){try{I.assertIsString(e)}catch(e){return!1}return/^0x[0-9a-fA-F]{40}$/.test(e)},t.toChecksumAddress=function(e,t){I.assertIsHexString(e);var r=g.stripHexPrefix(e).toLowerCase(),a="";t&&(a=y.toType(t,y.TypeOutput.BN).toString()+"0x");for(var n=m.keccakFromString(a+r).toString("hex"),o="0x",c=0;c=8?o+=r[c].toUpperCase():o+=r[c];return o},t.isValidChecksumAddress=function(e,r){return t.isValidAddress(e)&&t.toChecksumAddress(e,r)===e},t.generateAddress=function(e,t){I.assertIsBuffer(e),I.assertIsBuffer(t);var r=new h.default(t);return r.isZero()?m.rlphash([e,null]).slice(-20):m.rlphash([e,a.from(r.toArray())]).slice(-20)},t.generateAddress2=function(e,t,r){return I.assertIsBuffer(e),I.assertIsBuffer(t),I.assertIsBuffer(r),u.default(20===e.length),u.default(32===t.length),m.keccak256(a.concat([a.from("ff","hex"),e,t,m.keccak256(r)])).slice(-20)},t.isValidPrivate=function(e){return b.privateKeyVerify(e)},t.isValidPublic=function(e,t){return void 0===t&&(t=!1),I.assertIsBuffer(e),64===e.length?b.publicKeyVerify(a.concat([a.from([4]),e])):!!t&&b.publicKeyVerify(e)},t.pubToAddress=function(e,t){return void 0===t&&(t=!1),I.assertIsBuffer(e),t&&64!==e.length&&(e=a.from(b.publicKeyConvert(e,!1).slice(1))),u.default(64===e.length),m.keccak(e).slice(-20)},t.publicToAddress=t.pubToAddress,t.privateToPublic=function(e){return I.assertIsBuffer(e),a.from(b.publicKeyCreate(e,!1)).slice(1)},t.privateToAddress=function(e){return t.publicToAddress(t.privateToPublic(e))},t.importPublic=function(e){return I.assertIsBuffer(e),64!==e.length&&(e=a.from(b.publicKeyConvert(e,!1).slice(1))),e},t.zeroAddress=function(){var e=B.zeros(20);return B.bufferToHex(e)},t.isZeroAddress=function(e){try{I.assertIsString(e)}catch(e){return!1}return t.zeroAddress()===e}},(e,t,r)=>{e.exports=Stream;var a=r(34).EventEmitter;function Stream(){a.call(this)}r(10)(Stream,a),Stream.Readable=r(316),Stream.Writable=r(317),Stream.Duplex=r(157),Stream.Transform=r(318),Stream.PassThrough=r(429),Stream.finished=r(264),Stream.pipeline=r(430),Stream.Stream=Stream,Stream.prototype.pipe=function(e,t){var r=this;function ondata(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function ondrain(){r.readable&&r.resume&&r.resume()}r.on("data",ondata),e.on("drain",ondrain),e._isStdio||t&&!1===t.end||(r.on("end",onend),r.on("close",onclose));var n=!1;function onend(){n||(n=!0,e.end())}function onclose(){n||(n=!0,"function"==typeof e.destroy&&e.destroy())}function onerror(e){if(cleanup(),0===a.listenerCount(this,"error"))throw e}function cleanup(){r.removeListener("data",ondata),e.removeListener("drain",ondrain),r.removeListener("end",onend),r.removeListener("close",onclose),r.removeListener("error",onerror),e.removeListener("error",onerror),r.removeListener("end",cleanup),r.removeListener("close",cleanup),e.removeListener("close",cleanup)}return r.on("error",onerror),e.on("error",onerror),r.on("end",cleanup),r.on("close",cleanup),e.on("close",cleanup),e.emit("pipe",r),e}},(e,t,r)=>{var a=r(1),n=Object.getOwnPropertyDescriptors||function getOwnPropertyDescriptors(e){for(var t=Object.keys(e),r={},a=0;a=n)return e;switch(e){case"%s":return String(a[r++]);case"%d":return Number(a[r++]);case"%j":try{return JSON.stringify(a[r++])}catch(e){return"[Circular]"}default:return e}})),s=a[r];r=3&&(a.depth=arguments[2]),arguments.length>=4&&(a.colors=arguments[3]),isBoolean(r)?a.showHidden=r:r&&t._extend(a,r),isUndefined(a.showHidden)&&(a.showHidden=!1),isUndefined(a.depth)&&(a.depth=2),isUndefined(a.colors)&&(a.colors=!1),isUndefined(a.customInspect)&&(a.customInspect=!0),a.colors&&(a.stylize=stylizeWithColor),formatValue(a,e,a.depth)}function stylizeWithColor(e,t){var r=inspect.styles[t];return r?"["+inspect.colors[r][0]+"m"+e+"["+inspect.colors[r][1]+"m":e}function stylizeNoColor(e,t){return e}function formatValue(e,r,a){if(e.customInspect&&r&&isFunction(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(a,e);return isString(n)||(n=formatValue(e,n,a)),n}var o=function formatPrimitive(e,t){if(isUndefined(t))return e.stylize("undefined","undefined");if(isString(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(isNumber(t))return e.stylize(""+t,"number");if(isBoolean(t))return e.stylize(""+t,"boolean");if(isNull(t))return e.stylize("null","null")}(e,r);if(o)return o;var c=Object.keys(r),s=function arrayToHash(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(c);if(e.showHidden&&(c=Object.getOwnPropertyNames(r)),isError(r)&&(c.indexOf("message")>=0||c.indexOf("description")>=0))return formatError(r);if(0===c.length){if(isFunction(r)){var d=r.name?": "+r.name:"";return e.stylize("[Function"+d+"]","special")}if(isRegExp(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(isDate(r))return e.stylize(Date.prototype.toString.call(r),"date");if(isError(r))return formatError(r)}var u,h="",l=!1,b=["{","}"];(isArray(r)&&(l=!0,b=["[","]"]),isFunction(r))&&(h=" [Function"+(r.name?": "+r.name:"")+"]");return isRegExp(r)&&(h=" "+RegExp.prototype.toString.call(r)),isDate(r)&&(h=" "+Date.prototype.toUTCString.call(r)),isError(r)&&(h=" "+formatError(r)),0!==c.length||l&&0!=r.length?a<0?isRegExp(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),u=l?function formatArray(e,t,r,a,n){for(var o=[],c=0,s=t.length;c=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(u,h,b)):b[0]+h+b[1]}function formatError(e){return"["+Error.prototype.toString.call(e)+"]"}function formatProperty(e,t,r,a,n,o){var c,s,d;if((d=Object.getOwnPropertyDescriptor(t,n)||{value:t[n]}).get?s=d.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):d.set&&(s=e.stylize("[Setter]","special")),hasOwnProperty(a,n)||(c="["+n+"]"),s||(e.seen.indexOf(d.value)<0?(s=isNull(r)?formatValue(e,d.value,null):formatValue(e,d.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")),isUndefined(c)){if(o&&n.match(/^\d+$/))return s;(c=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(c=c.substr(1,c.length-2),c=e.stylize(c,"name")):(c=c.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),c=e.stylize(c,"string"))}return c+": "+s}function isArray(e){return Array.isArray(e)}function isBoolean(e){return"boolean"==typeof e}function isNull(e){return null===e}function isNumber(e){return"number"==typeof e}function isString(e){return"string"==typeof e}function isUndefined(e){return void 0===e}function isRegExp(e){return isObject(e)&&"[object RegExp]"===objectToString(e)}function isObject(e){return"object"==typeof e&&null!==e}function isDate(e){return isObject(e)&&"[object Date]"===objectToString(e)}function isError(e){return isObject(e)&&("[object Error]"===objectToString(e)||e instanceof Error)}function isFunction(e){return"function"==typeof e}function objectToString(e){return Object.prototype.toString.call(e)}function pad(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(e=e.toUpperCase(),!c[e])if(s.test(e)){var r=a.pid;c[e]=function(){var a=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,a)}}else c[e]=function(){};return c[e]},t.inspect=inspect,inspect.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]},inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.types=r(806),t.isArray=isArray,t.isBoolean=isBoolean,t.isNull=isNull,t.isNullOrUndefined=function isNullOrUndefined(e){return null==e},t.isNumber=isNumber,t.isString=isString,t.isSymbol=function isSymbol(e){return"symbol"==typeof e},t.isUndefined=isUndefined,t.isRegExp=isRegExp,t.types.isRegExp=isRegExp,t.isObject=isObject,t.isDate=isDate,t.types.isDate=isDate,t.isError=isError,t.types.isNativeError=isError,t.isFunction=isFunction,t.isPrimitive=function isPrimitive(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(813);var u=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp(){var e=new Date,t=[pad(e.getHours()),pad(e.getMinutes()),pad(e.getSeconds())].join(":");return[e.getDate(),u[e.getMonth()],t].join(" ")}function hasOwnProperty(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",timestamp(),t.format.apply(t,arguments))},t.inherits=r(10),t._extend=function(e,t){if(!t||!isObject(t))return e;for(var r=Object.keys(t),a=r.length;a--;)e[r[a]]=t[r[a]];return e};var h="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function callbackifyOnRejected(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}t.promisify=function promisify(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(h&&e[h]){var t;if("function"!=typeof(t=e[h]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,h,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,a=new Promise((function(e,a){t=e,r=a})),n=[],o=0;o{var a=r(2),n=a.Buffer;function copyProps(e,t){for(var r in e)t[r]=e[r]}function SafeBuffer(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=a:(copyProps(a,t),t.Buffer=SafeBuffer),SafeBuffer.prototype=Object.create(n.prototype),copyProps(n,SafeBuffer),SafeBuffer.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},SafeBuffer.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var a=n(e);return void 0!==t?"string"==typeof r?a.fill(t,r):a.fill(t):a.fill(0),a},SafeBuffer.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},SafeBuffer.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a.SlowBuffer(e)}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(203),t),n(r(36),t),n(r(598),t),n(r(65),t),n(r(599),t),n(r(84),t),n(r(137),t),n(r(138),t),n(r(250),t),n(r(17),t)},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},s=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},d=this&&this.__generator||function(e,t){var r,a,n,o,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(s){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,a=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(n=c.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0)&&!(a=o.next()).done;)c.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return c},h=this&&this.__spread||function(){for(var e=[],t=0;t0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},l=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var b=r(51),g=r(20),p=r(168),B=r(4),m=r(109),I=l(r(405)),y=s(r(1445)),x=r(111),C=b.debug("vm:block"),v=y.DAOAccounts,Q=y.DAORefundContract;function applyBlock(e,t){return d(this,void 0,void 0,(function(){var r;return u(this,(function(a){switch(a.label){case 0:if(t.skipBlockValidation)return[3,3];if(!e.header.gasLimit.gte(new B.BN("8000000000000000",16)))return[3,1];throw new Error("Invalid block with gas limit greater than (2^63 - 1)");case 1:return C("Validate block"),[4,e.validate(this.blockchain)];case 2:a.sent(),a.label=3;case 3:return C("Apply transactions"),[4,applyTransactions.bind(this)(e,t)];case 4:return r=a.sent(),"pow"!==this._common.consensusType()?[3,6]:[4,assignBlockRewards.bind(this)(e)];case 5:a.sent(),a.label=6;case 6:return[2,r]}}))}))}function applyTransactions(e,t){return d(this,void 0,void 0,(function(){var r,o,c,s,d,h,l,b,m,y,v,Q,w,_,k,N;return u(this,(function(u){switch(u.label){case 0:r=new I.default,o=new B.BN(0),c=new p.BaseTrie,s=[],d=[],h=0,u.label=1;case 1:if(!(h "+o+")"),r.or(y.bloom),v={gasUsed:o.toArrayLike(a),bitvector:y.bloom.bitvector,logs:y.execResult.logs||[]},Q=void 0,w=void 0,_="Generate tx receipt transactionType="+("transactionType"in l?l.transactionType:"NaN")+" gasUsed="+o+" bitvector="+x.short(v.bitvector)+" ("+v.bitvector.length+" bytes) logs="+v.logs.length,"transactionType"in l&&0!==l.transactionType?[3,6]:this._common.gteHardfork("byzantium")?(Q=n({status:y.execResult.exceptionError?0:1},v),k=y.execResult.exceptionError?"error":"ok",_+=" status="+Q.status+" ("+k+") (>= Byzantium)",[3,5]):[3,3];case 3:return[4,this.stateManager.getStateRoot(!0)];case 4:N=u.sent(),Q=n({stateRoot:N},v),_+=" stateRoot="+Q.stateRoot.toString("hex")+" (< Byzantium)",u.label=5;case 5:return w=g.encode(Object.values(Q)),[3,7];case 6:if(!("transactionType"in l)||1!==l.transactionType)throw new Error("Unsupported transaction type "+("transactionType"in l?l.transactionType:"NaN"));Q=n({status:y.execResult.exceptionError?0:1},v),w=a.concat([a.from("01","hex"),g.encode(Object.values(Q))]),u.label=7;case 7:return C(_),s.push(Q),[4,c.put(g.encode(h),w)];case 8:u.sent(),u.label=9;case 9:return h++,[3,1];case 10:return[2,{bloom:r,gasUsed:o,receiptRoot:c.root,receipts:s,results:d}]}}))}))}function assignBlockRewards(e){return d(this,void 0,void 0,(function(){var t,r,a,n,o,c,s,d,l,b,g,p,m;return u(this,(function(u){switch(u.label){case 0:C("Assign block rewards"),t=this.stateManager,r=new B.BN(this._common.param("pow","minerReward")),a=e.uncleHeaders,u.label=1;case 1:u.trys.push([1,6,7,8]),n=h(a),o=n.next(),u.label=2;case 2:return o.done?[3,5]:(c=o.value,s=function calculateOmmerReward(e,t,r){var a=t.sub(e),n=new B.BN(8).sub(a).mul(r.divn(8));n.ltn(0)&&(n=new B.BN(0));return n}(c.number,e.header.number,r),[4,rewardAccount(t,c.coinbase,s)]);case 3:d=u.sent(),C("Add uncle reward "+s+" to account "+c.coinbase+" (-> "+d.balance+")"),u.label=4;case 4:return o=n.next(),[3,2];case 5:return[3,8];case 6:return l=u.sent(),p={error:l},[3,8];case 7:try{o&&!o.done&&(m=n.return)&&m.call(n)}finally{if(p)throw p.error}return[7];case 8:return b=function calculateMinerReward(e,t){var r=e.divn(32).muln(t);return e.add(r)}(r,a.length),[4,rewardAccount(t,e.header.coinbase,b)];case 9:return g=u.sent(),C("Add miner reward "+b+" to account "+e.header.coinbase+" (-> "+g.balance+")"),[2]}}))}))}function rewardAccount(e,t,r){return d(this,void 0,void 0,(function(){var a;return u(this,(function(n){switch(n.label){case 0:return[4,e.getAccount(t)];case 1:return(a=n.sent()).balance.iadd(r),[4,e.putAccount(t,a)];case 2:return n.sent(),[2,a]}}))}))}function _applyDAOHardfork(e){return d(this,void 0,void 0,(function(){var t,r,n,o,c,s,d,l,b,g;return u(this,(function(u){switch(u.label){case 0:return t=new B.Address(a.from(Q,"hex")),e.accountExists(t)?[3,2]:[4,e.putAccount(t,new B.Account)];case 1:u.sent(),u.label=2;case 2:return[4,e.getAccount(t)];case 3:r=u.sent(),u.label=4;case 4:u.trys.push([4,10,11,12]),n=h(v),o=n.next(),u.label=5;case 5:return o.done?[3,9]:(c=o.value,s=new B.Address(a.from(c,"hex")),[4,e.getAccount(s)]);case 6:return d=u.sent(),r.balance.iadd(d.balance),d.balance=new B.BN(0),[4,e.putAccount(s,d)];case 7:u.sent(),u.label=8;case 8:return o=n.next(),[3,5];case 9:return[3,12];case 10:return l=u.sent(),b={error:l},[3,12];case 11:try{o&&!o.done&&(g=n.return)&&g.call(n)}finally{if(b)throw b.error}return[7];case 12:return[4,e.putAccount(t,r)];case 13:return u.sent(),[2]}}))}))}t.default=function runBlock(e){return d(this,void 0,void 0,(function(){var t,r,a,o,c,s,d,h,l,b;return u(this,(function(u){switch(u.label){case 0:return t=this.stateManager,r=e.root,a=e.block,o=!!e.generate,[4,this._emit("beforeBlock",a)];case 1:return u.sent(),this._hardforkByBlockNumber&&this._common.setHardforkByBlockNumber(a.header.number.toNumber()),C("-".repeat(100)),C("Running blog hash="+a.hash().toString("hex")+" number="+a.header.number.toNumber()+" hardfork="+this._common.hardfork()),r?(C("Set provided state root "+r.toString("hex")),[4,t.setStateRoot(r)]):[3,3];case 2:u.sent(),u.label=3;case 3:return this._common.hardforkIsActiveOnChain("dao")&&a.header.number.eq(this._common.hardforkBlockBN("dao"))?(C("Apply DAO hardfork"),[4,_applyDAOHardfork(t)]):[3,5];case 4:u.sent(),u.label=5;case 5:return[4,t.checkpoint()];case 6:u.sent(),C("block checkpoint"),u.label=7;case 7:return u.trys.push([7,9,,11]),[4,applyBlock.bind(this)(a,e)];case 8:return c=u.sent(),C("Received block results gasUsed="+c.gasUsed+" bloom="+x.short(c.bloom.bitvector)+" ("+c.bloom.bitvector.length+" bytes) receiptRoot="+c.receiptRoot.toString("hex")+" receipts="+c.receipts.length+" txResults="+c.results.length),[3,11];case 9:return s=u.sent(),[4,t.revert()];case 10:throw u.sent(),C("block checkpoint reverted"),s;case 11:return[4,t.commit()];case 12:return u.sent(),C("block checkpoint committed"),[4,t.getStateRoot(!1)];case 13:if(d=u.sent(),o)h=c.bloom.bitvector,a=m.Block.fromBlockData(n(n({},a),{header:n(n({},a.header),{stateRoot:d,bloom:h})}));else{if(c.receiptRoot&&!c.receiptRoot.equals(a.header.receiptTrie))throw C("Invalid receiptTrie received="+c.receiptRoot.toString("hex")+" expected="+a.header.receiptTrie.toString("hex")),new Error("invalid receiptTrie");if(!c.bloom.bitvector.equals(a.header.bloom))throw C("Invalid bloom received="+c.bloom.bitvector.toString("hex")+" expected="+a.header.bloom.toString("hex")),new Error("invalid bloom");if(!c.gasUsed.eq(a.header.gasUsed))throw C("Invalid gasUsed received="+c.gasUsed+" expected="+a.header.gasUsed),new Error("invalid gasUsed");if(!d.equals(a.header.stateRoot))throw C("Invalid stateRoot received="+d.toString("hex")+" expected="+a.header.stateRoot.toString("hex")),new Error("invalid block stateRoot")}return l={receipts:c.receipts,results:c.results,stateRoot:d,gasUsed:c.gasUsed,logsBloom:c.bloom.bitvector,receiptRoot:c.receiptRoot},b=n(n({},l),{block:a}),[4,this._emit("afterBlock",b)];case 14:return u.sent(),C("Running blog finished hash="+a.hash().toString("hex")+" number="+a.header.number.toNumber()+" hardfork="+this._common.hardfork()),[2,l]}}))}))}},function(e,t,r){"use strict";var a=r(3).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isZeroAddress=t.zeroAddress=t.importPublic=t.privateToAddress=t.privateToPublic=t.publicToAddress=t.pubToAddress=t.isValidPublic=t.isValidPrivate=t.generateAddress2=t.generateAddress=t.isValidChecksumAddress=t.toChecksumAddress=t.isValidAddress=t.Account=void 0;const d=s(r(6)),u=s(r(129)),h=c(r(181)),l=r(91),b=r(185),g=r(74),p=r(59),B=r(344),m=r(237),{privateKeyVerify:I,publicKeyCreate:y,publicKeyVerify:x,publicKeyConvert:C}=r(127);class Account{constructor(e=new u.default(0),t=new u.default(0),r=b.KECCAK256_RLP,a=b.KECCAK256_NULL){this.nonce=e,this.balance=t,this.stateRoot=r,this.codeHash=a,this._validate()}static fromAccountData(e){const{nonce:t,balance:r,stateRoot:a,codeHash:n}=e;return new Account(t?new u.default(g.toBuffer(t)):void 0,r?new u.default(g.toBuffer(r)):void 0,a?g.toBuffer(a):void 0,n?g.toBuffer(n):void 0)}static fromRlpSerializedAccount(e){const t=h.decode(e);if(!Array.isArray(t))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(t)}static fromValuesArray(e){const[t,r,a,n]=e;return new Account(new u.default(t),new u.default(r),a,n)}_validate(){if(this.nonce.lt(new u.default(0)))throw new Error("nonce must be greater than zero");if(this.balance.lt(new u.default(0)))throw new Error("balance must be greater than zero");if(32!==this.stateRoot.length)throw new Error("stateRoot must have a length of 32");if(32!==this.codeHash.length)throw new Error("codeHash must have a length of 32")}raw(){return[m.bnToRlp(this.nonce),m.bnToRlp(this.balance),this.stateRoot,this.codeHash]}serialize(){return h.encode(this.raw())}isContract(){return!this.codeHash.equals(b.KECCAK256_NULL)}isEmpty(){return this.balance.isZero()&&this.nonce.isZero()&&this.codeHash.equals(b.KECCAK256_NULL)}}t.Account=Account,t.isValidAddress=function(e){return B.assertIsHexString(e),/^0x[0-9a-fA-F]{40}$/.test(e)},t.toChecksumAddress=function(e,t){B.assertIsHexString(e);const r=l.stripHexPrefix(e).toLowerCase();let a="";if(t){a=m.toType(t,m.TypeOutput.BN).toString()+"0x"}const n=p.keccakFromString(a+r).toString("hex");let o="0x";for(let e=0;e=8?o+=r[e].toUpperCase():o+=r[e];return o},t.isValidChecksumAddress=function(e,r){return t.isValidAddress(e)&&t.toChecksumAddress(e,r)===e},t.generateAddress=function(e,t){B.assertIsBuffer(e),B.assertIsBuffer(t);const r=new u.default(t);return r.isZero()?p.rlphash([e,null]).slice(-20):p.rlphash([e,a.from(r.toArray())]).slice(-20)},t.generateAddress2=function(e,t,r){B.assertIsBuffer(e),B.assertIsBuffer(t),B.assertIsBuffer(r),d.default(20===e.length),d.default(32===t.length);return p.keccak256(a.concat([a.from("ff","hex"),e,t,p.keccak256(r)])).slice(-20)},t.isValidPrivate=function(e){return I(e)},t.isValidPublic=function(e,t=!1){return B.assertIsBuffer(e),64===e.length?x(a.concat([a.from([4]),e])):!!t&&x(e)},t.pubToAddress=function(e,t=!1){return B.assertIsBuffer(e),t&&64!==e.length&&(e=a.from(C(e,!1).slice(1))),d.default(64===e.length),p.keccak(e).slice(-20)},t.publicToAddress=t.pubToAddress,t.privateToPublic=function(e){return B.assertIsBuffer(e),a.from(y(e,!1)).slice(1)},t.privateToAddress=function(e){return t.publicToAddress(t.privateToPublic(e))},t.importPublic=function(e){return B.assertIsBuffer(e),64!==e.length&&(e=a.from(C(e,!1).slice(1))),e},t.zeroAddress=function(){const e=g.zeros(20);return g.bufferToHex(e)},t.isZeroAddress=function(e){B.assertIsHexString(e);return t.zeroAddress()===e}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(186),t),n(r(47),t),n(r(1267),t),n(r(60),t),n(r(522),t),n(r(77),t),n(r(132),t),n(r(1268),t),n(r(239),t),n(r(187),t)},function(e,t,r){"use strict";var a=r(5).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isZeroAddress=t.zeroAddress=t.importPublic=t.privateToAddress=t.privateToPublic=t.publicToAddress=t.pubToAddress=t.isValidPublic=t.isValidPrivate=t.generateAddress2=t.generateAddress=t.isValidChecksumAddress=t.toChecksumAddress=t.isValidAddress=t.Account=void 0;const d=s(r(6)),u=s(r(131)),h=c(r(346)),l=r(187),b=r(186),g=r(77),p=r(60),B=r(347),m=r(239),{privateKeyVerify:I,publicKeyCreate:y,publicKeyVerify:x,publicKeyConvert:C}=r(160);class Account{constructor(e=new u.default(0),t=new u.default(0),r=b.KECCAK256_RLP,a=b.KECCAK256_NULL){this.nonce=e,this.balance=t,this.stateRoot=r,this.codeHash=a,this._validate()}static fromAccountData(e){const{nonce:t,balance:r,stateRoot:a,codeHash:n}=e;return new Account(t?new u.default(g.toBuffer(t)):void 0,r?new u.default(g.toBuffer(r)):void 0,a?g.toBuffer(a):void 0,n?g.toBuffer(n):void 0)}static fromRlpSerializedAccount(e){const t=h.decode(e);if(!Array.isArray(t))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(t)}static fromValuesArray(e){const[t,r,a,n]=e;return new Account(new u.default(t),new u.default(r),a,n)}_validate(){if(this.nonce.lt(new u.default(0)))throw new Error("nonce must be greater than zero");if(this.balance.lt(new u.default(0)))throw new Error("balance must be greater than zero");if(32!==this.stateRoot.length)throw new Error("stateRoot must have a length of 32");if(32!==this.codeHash.length)throw new Error("codeHash must have a length of 32")}raw(){return[m.bnToRlp(this.nonce),m.bnToRlp(this.balance),this.stateRoot,this.codeHash]}serialize(){return h.encode(this.raw())}isContract(){return!this.codeHash.equals(b.KECCAK256_NULL)}isEmpty(){return this.balance.isZero()&&this.nonce.isZero()&&this.codeHash.equals(b.KECCAK256_NULL)}}t.Account=Account,t.isValidAddress=function(e){return B.assertIsHexString(e),/^0x[0-9a-fA-F]{40}$/.test(e)},t.toChecksumAddress=function(e,t){B.assertIsHexString(e);const r=l.stripHexPrefix(e).toLowerCase();let a="";if(t){a=m.toType(t,m.TypeOutput.BN).toString()+"0x"}const n=p.keccakFromString(a+r).toString("hex");let o="0x";for(let e=0;e=8?o+=r[e].toUpperCase():o+=r[e];return o},t.isValidChecksumAddress=function(e,r){return t.isValidAddress(e)&&t.toChecksumAddress(e,r)===e},t.generateAddress=function(e,t){B.assertIsBuffer(e),B.assertIsBuffer(t);const r=new u.default(t);return r.isZero()?p.rlphash([e,null]).slice(-20):p.rlphash([e,a.from(r.toArray())]).slice(-20)},t.generateAddress2=function(e,t,r){B.assertIsBuffer(e),B.assertIsBuffer(t),B.assertIsBuffer(r),d.default(20===e.length),d.default(32===t.length);return p.keccak256(a.concat([a.from("ff","hex"),e,t,p.keccak256(r)])).slice(-20)},t.isValidPrivate=function(e){return I(e)},t.isValidPublic=function(e,t=!1){return B.assertIsBuffer(e),64===e.length?x(a.concat([a.from([4]),e])):!!t&&x(e)},t.pubToAddress=function(e,t=!1){return B.assertIsBuffer(e),t&&64!==e.length&&(e=a.from(C(e,!1).slice(1))),d.default(64===e.length),p.keccak(e).slice(-20)},t.publicToAddress=t.pubToAddress,t.privateToPublic=function(e){return B.assertIsBuffer(e),a.from(y(e,!1)).slice(1)},t.privateToAddress=function(e){return t.publicToAddress(t.privateToPublic(e))},t.importPublic=function(e){return B.assertIsBuffer(e),64!==e.length&&(e=a.from(C(e,!1).slice(1))),e},t.zeroAddress=function(){const e=g.zeros(20);return g.bufferToHex(e)},t.isZeroAddress=function(e){B.assertIsHexString(e);return t.zeroAddress()===e}},function(e,t,r){"use strict";var a=r(2).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isZeroAddress=t.zeroAddress=t.importPublic=t.privateToAddress=t.privateToPublic=t.publicToAddress=t.pubToAddress=t.isValidPublic=t.isValidPrivate=t.generateAddress2=t.generateAddress=t.isValidChecksumAddress=t.toChecksumAddress=t.isValidAddress=t.Account=void 0;const d=s(r(6)),u=s(r(133)),h=c(r(353)),l=r(191),b=r(190),g=r(79),p=r(62),B=r(354),m=r(243),{privateKeyVerify:I,publicKeyCreate:y,publicKeyVerify:x,publicKeyConvert:C}=r(162);class Account{constructor(e=new u.default(0),t=new u.default(0),r=b.KECCAK256_RLP,a=b.KECCAK256_NULL){this.nonce=e,this.balance=t,this.stateRoot=r,this.codeHash=a,this._validate()}static fromAccountData(e){const{nonce:t,balance:r,stateRoot:a,codeHash:n}=e;return new Account(t?new u.default(g.toBuffer(t)):void 0,r?new u.default(g.toBuffer(r)):void 0,a?g.toBuffer(a):void 0,n?g.toBuffer(n):void 0)}static fromRlpSerializedAccount(e){const t=h.decode(e);if(!Array.isArray(t))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(t)}static fromValuesArray(e){const[t,r,a,n]=e;return new Account(new u.default(t),new u.default(r),a,n)}_validate(){if(this.nonce.lt(new u.default(0)))throw new Error("nonce must be greater than zero");if(this.balance.lt(new u.default(0)))throw new Error("balance must be greater than zero");if(32!==this.stateRoot.length)throw new Error("stateRoot must have a length of 32");if(32!==this.codeHash.length)throw new Error("codeHash must have a length of 32")}raw(){return[m.bnToRlp(this.nonce),m.bnToRlp(this.balance),this.stateRoot,this.codeHash]}serialize(){return h.encode(this.raw())}isContract(){return!this.codeHash.equals(b.KECCAK256_NULL)}isEmpty(){return this.balance.isZero()&&this.nonce.isZero()&&this.codeHash.equals(b.KECCAK256_NULL)}}t.Account=Account,t.isValidAddress=function(e){return B.assertIsHexString(e),/^0x[0-9a-fA-F]{40}$/.test(e)},t.toChecksumAddress=function(e,t){B.assertIsHexString(e);const r=l.stripHexPrefix(e).toLowerCase();let a="";if(t){a=m.toType(t,m.TypeOutput.BN).toString()+"0x"}const n=p.keccakFromString(a+r).toString("hex");let o="0x";for(let e=0;e=8?o+=r[e].toUpperCase():o+=r[e];return o},t.isValidChecksumAddress=function(e,r){return t.isValidAddress(e)&&t.toChecksumAddress(e,r)===e},t.generateAddress=function(e,t){B.assertIsBuffer(e),B.assertIsBuffer(t);const r=new u.default(t);return r.isZero()?p.rlphash([e,null]).slice(-20):p.rlphash([e,a.from(r.toArray())]).slice(-20)},t.generateAddress2=function(e,t,r){B.assertIsBuffer(e),B.assertIsBuffer(t),B.assertIsBuffer(r),d.default(20===e.length),d.default(32===t.length);return p.keccak256(a.concat([a.from("ff","hex"),e,t,p.keccak256(r)])).slice(-20)},t.isValidPrivate=function(e){return I(e)},t.isValidPublic=function(e,t=!1){return B.assertIsBuffer(e),64===e.length?x(a.concat([a.from([4]),e])):!!t&&x(e)},t.pubToAddress=function(e,t=!1){return B.assertIsBuffer(e),t&&64!==e.length&&(e=a.from(C(e,!1).slice(1))),d.default(64===e.length),p.keccak(e).slice(-20)},t.publicToAddress=t.pubToAddress,t.privateToPublic=function(e){return B.assertIsBuffer(e),a.from(y(e,!1)).slice(1)},t.privateToAddress=function(e){return t.publicToAddress(t.privateToPublic(e))},t.importPublic=function(e){return B.assertIsBuffer(e),64!==e.length&&(e=a.from(C(e,!1).slice(1))),e},t.zeroAddress=function(){const e=g.zeros(20);return g.bufferToHex(e)},t.isZeroAddress=function(e){B.assertIsHexString(e);return t.zeroAddress()===e}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isZeroAddress=t.zeroAddress=t.importPublic=t.privateToAddress=t.privateToPublic=t.publicToAddress=t.pubToAddress=t.isValidPublic=t.isValidPrivate=t.generateAddress2=t.generateAddress=t.isValidChecksumAddress=t.toChecksumAddress=t.isValidAddress=t.Account=void 0;const d=s(r(6)),u=s(r(12)),h=c(r(20)),l=r(17),b=r(194),g=r(81),p=r(64),B=r(359),m=r(247),{privateKeyVerify:I,publicKeyCreate:y,publicKeyVerify:x,publicKeyConvert:C}=r(50);class Account{constructor(e=new u.default(0),t=new u.default(0),r=b.KECCAK256_RLP,a=b.KECCAK256_NULL){this.nonce=e,this.balance=t,this.stateRoot=r,this.codeHash=a,this._validate()}static fromAccountData(e){const{nonce:t,balance:r,stateRoot:a,codeHash:n}=e;return new Account(t?new u.default(g.toBuffer(t)):void 0,r?new u.default(g.toBuffer(r)):void 0,a?g.toBuffer(a):void 0,n?g.toBuffer(n):void 0)}static fromRlpSerializedAccount(e){const t=h.decode(e);if(!Array.isArray(t))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(t)}static fromValuesArray(e){const[t,r,a,n]=e;return new Account(new u.default(t),new u.default(r),a,n)}_validate(){if(this.nonce.lt(new u.default(0)))throw new Error("nonce must be greater than zero");if(this.balance.lt(new u.default(0)))throw new Error("balance must be greater than zero");if(32!==this.stateRoot.length)throw new Error("stateRoot must have a length of 32");if(32!==this.codeHash.length)throw new Error("codeHash must have a length of 32")}raw(){return[m.bnToRlp(this.nonce),m.bnToRlp(this.balance),this.stateRoot,this.codeHash]}serialize(){return h.encode(this.raw())}isContract(){return!this.codeHash.equals(b.KECCAK256_NULL)}isEmpty(){return this.balance.isZero()&&this.nonce.isZero()&&this.codeHash.equals(b.KECCAK256_NULL)}}t.Account=Account,t.isValidAddress=function(e){return B.assertIsHexString(e),/^0x[0-9a-fA-F]{40}$/.test(e)},t.toChecksumAddress=function(e,t){B.assertIsHexString(e);const r=l.stripHexPrefix(e).toLowerCase();let a="";if(t){a=m.toType(t,m.TypeOutput.BN).toString()+"0x"}const n=p.keccakFromString(a+r).toString("hex");let o="0x";for(let e=0;e=8?o+=r[e].toUpperCase():o+=r[e];return o},t.isValidChecksumAddress=function(e,r){return t.isValidAddress(e)&&t.toChecksumAddress(e,r)===e},t.generateAddress=function(e,t){B.assertIsBuffer(e),B.assertIsBuffer(t);const r=new u.default(t);return r.isZero()?p.rlphash([e,null]).slice(-20):p.rlphash([e,a.from(r.toArray())]).slice(-20)},t.generateAddress2=function(e,t,r){B.assertIsBuffer(e),B.assertIsBuffer(t),B.assertIsBuffer(r),d.default(20===e.length),d.default(32===t.length);return p.keccak256(a.concat([a.from("ff","hex"),e,t,p.keccak256(r)])).slice(-20)},t.isValidPrivate=function(e){return I(e)},t.isValidPublic=function(e,t=!1){return B.assertIsBuffer(e),64===e.length?x(a.concat([a.from([4]),e])):!!t&&x(e)},t.pubToAddress=function(e,t=!1){return B.assertIsBuffer(e),t&&64!==e.length&&(e=a.from(C(e,!1).slice(1))),d.default(64===e.length),p.keccak(e).slice(-20)},t.publicToAddress=t.pubToAddress,t.privateToPublic=function(e){return B.assertIsBuffer(e),a.from(y(e,!1)).slice(1)},t.privateToAddress=function(e){return t.publicToAddress(t.privateToPublic(e))},t.importPublic=function(e){return B.assertIsBuffer(e),64!==e.length&&(e=a.from(C(e,!1).slice(1))),e},t.zeroAddress=function(){const e=g.zeros(20);return g.bufferToHex(e)},t.isZeroAddress=function(e){B.assertIsHexString(e);return t.zeroAddress()===e}},function(e,t,r){"use strict";var a=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},n=this&&this.__generator||function(e,t){var r,a,n,o,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(s){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,a=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(n=c.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]{var a=r(1);function load(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==a&&"env"in a&&(e=a.env.DEBUG),e}(t=e.exports=r(28)).log=function log(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function formatArgs(e){var r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),!r)return;var a="color: "+this.color;e.splice(1,0,a,"color: inherit");var n=0,o=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(n++,"%c"===e&&(o=n))})),e.splice(o,0,a)},t.save=function save(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=load,t.useColors=function useColors(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function localstorage(){try{return window.localStorage}catch(e){}}(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(load())},(e,t,r)=>{"use strict";var a=r(2).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.createDecipheriv=t.createCipheriv=t.randomBytes=t.pseudoRandomBytes=t.createHash=t.createHmac=t.scrypt=void 0;const n=r(320);Object.defineProperty(t,"createCipheriv",{enumerable:!0,get:function(){return n.createCipheriv}}),Object.defineProperty(t,"createDecipheriv",{enumerable:!0,get:function(){return n.createDecipheriv}});const o=r(442),scrypt=(e,t,r,n,c)=>{o.scrypt(a.from(e,"utf8"),a.from(t,"utf8"),n.N,n.r,n.p,r).then((e=>{c(null,a.from(e))})).catch((e=>c(e,void 0)))};t.scrypt=scrypt;const c=r(1213);Object.defineProperty(t,"createHmac",{enumerable:!0,get:function(){return c.createHmac}}),Object.defineProperty(t,"createHash",{enumerable:!0,get:function(){return c.createHash}}),Object.defineProperty(t,"pseudoRandomBytes",{enumerable:!0,get:function(){return c.pseudoRandomBytes}}),Object.defineProperty(t,"randomBytes",{enumerable:!0,get:function(){return c.randomBytes}}),t.default={scrypt,createHmac:c.createHmac,createHash:c.createHash,pseudoRandomBytes:c.pseudoRandomBytes,randomBytes:c.randomBytes,createCipheriv:n.createCipheriv,createDecipheriv:n.createDecipheriv}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(185),t),n(r(45),t),n(r(1244),t),n(r(59),t),n(r(500),t),n(r(74),t),n(r(130),t),n(r(1245),t),n(r(237),t),n(r(91),t)},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(190),t),n(r(48),t),n(r(1282),t),n(r(62),t),n(r(541),t),n(r(79),t),n(r(134),t),n(r(1283),t),n(r(243),t),n(r(191),t)},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(1323),t),n(r(1324),t),n(r(1325),t),n(r(288),t),n(r(1326),t)},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(207),t),n(r(37),t),n(r(621),t),n(r(67),t),n(r(622),t),n(r(85),t),n(r(140),t),n(r(141),t),n(r(251),t),n(r(17),t)},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,a,n,o,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(s){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,a=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(n=c.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0)&&!(a=o.next()).done;)c.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return c};Object.defineProperty(t,"__esModule",{value:!0}),t.handlers=void 0;var s=r(4),d=r(124),u=r(1435),h=r(1436),l=r(647),b=r(32);t.handlers=new Map([[0,function(){d.trap(b.ERROR.STOP)}],[1,function(e){var t=c(e.stack.popN(2),2),r=t[0],a=t[1],n=r.add(a).mod(s.TWO_POW256);e.stack.push(n)}],[2,function(e){var t=c(e.stack.popN(2),2),r=t[0],a=t[1],n=r.mul(a).mod(s.TWO_POW256);e.stack.push(n)}],[3,function(e){var t=c(e.stack.popN(2),2),r=t[0],a=t[1],n=r.sub(a).toTwos(256);e.stack.push(n)}],[4,function(e){var t,r=c(e.stack.popN(2),2),a=r[0],n=r[1];t=n.isZero()?new s.BN(n):a.div(n),e.stack.push(t)}],[5,function(e){var t,r=c(e.stack.popN(2),2),a=r[0],n=r[1];n.isZero()?t=new s.BN(n):(a=a.fromTwos(256),n=n.fromTwos(256),t=a.div(n).toTwos(256)),e.stack.push(t)}],[6,function(e){var t,r=c(e.stack.popN(2),2),a=r[0],n=r[1];t=n.isZero()?new s.BN(n):a.mod(n),e.stack.push(t)}],[7,function(e){var t,r=c(e.stack.popN(2),2),a=r[0],n=r[1];n.isZero()?t=new s.BN(n):(a=a.fromTwos(256),n=n.fromTwos(256),t=a.abs().mod(n.abs()),a.isNeg()&&(t=t.ineg()),t=t.toTwos(256)),e.stack.push(t)}],[8,function(e){var t,r=c(e.stack.popN(3),3),a=r[0],n=r[1],o=r[2];t=o.isZero()?new s.BN(o):a.add(n).mod(o),e.stack.push(t)}],[9,function(e){var t,r=c(e.stack.popN(3),3),a=r[0],n=r[1],o=r[2];t=o.isZero()?new s.BN(o):a.mul(n).mod(o),e.stack.push(t)}],[10,function(e){var t=c(e.stack.popN(2),2),r=t[0],a=t[1];if(a.isZero())e.stack.push(new s.BN(1));else{var n=a.byteLength();(n<1||n>32)&&d.trap(b.ERROR.OUT_OF_RANGE);var o=e._common.param("gasPrices","expByte"),u=new s.BN(n).muln(o);if(e.eei.useGas(u,"EXP opcode"),r.isZero())e.stack.push(new s.BN(0));else{var h=s.BN.red(s.TWO_POW256),l=r.toRed(h).redPow(a);e.stack.push(l.fromRed())}}}],[11,function(e){var t=c(e.stack.popN(2),2),r=t[0],a=t[1];if(r.ltn(31)){var n=r.muln(8).iaddn(7).toNumber(),o=new s.BN(1).ishln(n).isubn(1);a=a.testn(n)?a.or(o.notn(256)):a.and(o)}else a=new s.BN(a);e.stack.push(a)}],[16,function(e){var t=c(e.stack.popN(2),2),r=t[0],a=t[1],n=new s.BN(r.lt(a)?1:0);e.stack.push(n)}],[17,function(e){var t=c(e.stack.popN(2),2),r=t[0],a=t[1],n=new s.BN(r.gt(a)?1:0);e.stack.push(n)}],[18,function(e){var t=c(e.stack.popN(2),2),r=t[0],a=t[1],n=new s.BN(r.fromTwos(256).lt(a.fromTwos(256))?1:0);e.stack.push(n)}],[19,function(e){var t=c(e.stack.popN(2),2),r=t[0],a=t[1],n=new s.BN(r.fromTwos(256).gt(a.fromTwos(256))?1:0);e.stack.push(n)}],[20,function(e){var t=c(e.stack.popN(2),2),r=t[0],a=t[1],n=new s.BN(r.eq(a)?1:0);e.stack.push(n)}],[21,function(e){var t=e.stack.pop(),r=new s.BN(t.isZero()?1:0);e.stack.push(r)}],[22,function(e){var t=c(e.stack.popN(2),2),r=t[0],a=t[1],n=r.and(a);e.stack.push(n)}],[23,function(e){var t=c(e.stack.popN(2),2),r=t[0],a=t[1],n=r.or(a);e.stack.push(n)}],[24,function(e){var t=c(e.stack.popN(2),2),r=t[0],a=t[1],n=r.xor(a);e.stack.push(n)}],[25,function(e){var t=e.stack.pop().notn(256);e.stack.push(t)}],[26,function(e){var t=c(e.stack.popN(2),2),r=t[0],a=t[1];if(r.gten(32))e.stack.push(new s.BN(0));else{var n=new s.BN(a.shrn(8*(31-r.toNumber())).andln(255));e.stack.push(n)}}],[27,function(e){var t=c(e.stack.popN(2),2),r=t[0],a=t[1];if(r.gten(256))e.stack.push(new s.BN(0));else{var n=a.shln(r.toNumber()).iand(s.MAX_INTEGER);e.stack.push(n)}}],[28,function(e){var t=c(e.stack.popN(2),2),r=t[0],a=t[1];if(r.gten(256))e.stack.push(new s.BN(0));else{var n=a.shrn(r.toNumber());e.stack.push(n)}}],[29,function(e){var t,r=c(e.stack.popN(2),2),a=r[0],n=r[1],o=n.testn(255);if(a.gten(256))return t=o?new s.BN(s.MAX_INTEGER):new s.BN(0),void e.stack.push(t);var d=n.shrn(a.toNumber());if(o){var u=255-a.toNumber(),h=s.MAX_INTEGER.shrn(u).shln(u);t=d.ior(h)}else t=d;e.stack.push(t)}],[32,function(e){var t=c(e.stack.popN(2),2),r=t[0],n=t[1];d.subMemUsage(e,r,n);var o=a.alloc(0);n.isZero()||(o=e.memory.read(r.toNumber(),n.toNumber())),e.eei.useGas(new s.BN(e._common.param("gasPrices","sha3Word")).imul(d.divCeil(n,new s.BN(32))),"SHA3 opcode");var u=new s.BN(s.keccak256(o));e.stack.push(u)}],[48,function(e){var t=new s.BN(e.eei.getAddress().buf);e.stack.push(t)}],[49,function(e){return n(this,void 0,void 0,(function(){var t,r,a;return o(this,(function(n){switch(n.label){case 0:return t=e.stack.pop(),r=new s.Address(d.addressToBuffer(t)),l.accessAddressEIP2929(e,r),[4,e.eei.getExternalBalance(r)];case 1:return a=n.sent(),e.stack.push(a),[2]}}))}))}],[50,function(e){e.stack.push(e.eei.getTxOrigin())}],[51,function(e){e.stack.push(e.eei.getCaller())}],[52,function(e){e.stack.push(e.eei.getCallValue())}],[53,function(e){var t=e.stack.pop();if(t.gt(e.eei.getCallDataSize()))e.stack.push(new s.BN(0));else{var r=t.toNumber(),n=e.eei.getCallData().slice(r,r+32);n=n.length?n:a.from([0]);var o=new s.BN(s.setLengthRight(n,32));e.stack.push(o)}}],[54,function(e){var t=e.eei.getCallDataSize();e.stack.push(t)}],[55,function(e){var t=c(e.stack.popN(3),3),r=t[0],a=t[1],n=t[2];d.subMemUsage(e,r,n),e.eei.useGas(new s.BN(e._common.param("gasPrices","copy")).imul(d.divCeil(n,new s.BN(32))),"CALLDATACOPY opcode");var o=d.getDataSlice(e.eei.getCallData(),a,n),u=r.toNumber(),h=n.toNumber();e.memory.extend(u,h),e.memory.write(u,h,o)}],[56,function(e){e.stack.push(e.eei.getCodeSize())}],[57,function(e){var t=c(e.stack.popN(3),3),r=t[0],a=t[1],n=t[2];d.subMemUsage(e,r,n),e.eei.useGas(new s.BN(e._common.param("gasPrices","copy")).imul(d.divCeil(n,new s.BN(32))),"CODECOPY opcode");var o=d.getDataSlice(e.eei.getCode(),a,n),u=r.toNumber(),h=n.toNumber();e.memory.extend(u,h),e.memory.write(u,h,o)}],[59,function(e){return n(this,void 0,void 0,(function(){var t,r,a;return o(this,(function(n){switch(n.label){case 0:return t=e.stack.pop(),r=new s.Address(d.addressToBuffer(t)),l.accessAddressEIP2929(e,r),[4,e.eei.getExternalCodeSize(t)];case 1:return a=n.sent(),e.stack.push(a),[2]}}))}))}],[60,function(e){return n(this,void 0,void 0,(function(){var t,r,a,n,u,h,b,g,p,B;return o(this,(function(o){switch(o.label){case 0:return t=c(e.stack.popN(4),4),r=t[0],a=t[1],n=t[2],u=t[3],d.subMemUsage(e,a,u),h=new s.Address(d.addressToBuffer(r)),l.accessAddressEIP2929(e,h),e.eei.useGas(new s.BN(e._common.param("gasPrices","copy")).imul(d.divCeil(u,new s.BN(32))),"EXTCODECOPY opcode"),[4,e.eei.getExternalCode(r)];case 1:return b=o.sent(),g=d.getDataSlice(b,n,u),p=a.toNumber(),B=u.toNumber(),e.memory.extend(p,B),e.memory.write(p,B,g),[2]}}))}))}],[63,function(e){return n(this,void 0,void 0,(function(){var t,r,a;return o(this,(function(n){switch(n.label){case 0:return t=e.stack.pop(),r=new s.Address(d.addressToBuffer(t)),l.accessAddressEIP2929(e,r),[4,e.eei.isAccountEmpty(r)];case 1:return n.sent()?(e.stack.push(new s.BN(0)),[2]):[4,e.eei.getExternalCode(t)];case 2:return 0===(a=n.sent()).length?(e.stack.push(new s.BN(s.KECCAK256_NULL)),[2]):(e.stack.push(new s.BN(s.keccak256(a))),[2])}}))}))}],[61,function(e){e.stack.push(e.eei.getReturnDataSize())}],[62,function(e){var t=c(e.stack.popN(3),3),r=t[0],a=t[1],n=t[2];a.add(n).gt(e.eei.getReturnDataSize())&&d.trap(b.ERROR.OUT_OF_GAS),d.subMemUsage(e,r,n),e.eei.useGas(new s.BN(e._common.param("gasPrices","copy")).mul(d.divCeil(n,new s.BN(32))),"RETURNDATACOPY opcode");var o=d.getDataSlice(e.eei.getReturnData(),a,n),u=r.toNumber(),h=n.toNumber();e.memory.extend(u,h),e.memory.write(u,h,o)}],[58,function(e){e.stack.push(e.eei.getTxGasPrice())}],[64,function(e){return n(this,void 0,void 0,(function(){var t,r,a;return o(this,(function(n){switch(n.label){case 0:return t=e.stack.pop(),(r=e.eei.getBlockNumber().sub(t)).gtn(256)||r.lten(0)?(e.stack.push(new s.BN(0)),[2]):[4,e.eei.getBlockHash(t)];case 1:return a=n.sent(),e.stack.push(a),[2]}}))}))}],[65,function(e){e.stack.push(e.eei.getBlockCoinbase())}],[66,function(e){e.stack.push(e.eei.getBlockTimestamp())}],[67,function(e){e.stack.push(e.eei.getBlockNumber())}],[68,function(e){e.stack.push(e.eei.getBlockDifficulty())}],[69,function(e){e.stack.push(e.eei.getBlockGasLimit())}],[70,function(e){e.stack.push(e.eei.getChainId())}],[71,function(e){e.stack.push(e.eei.getSelfBalance())}],[80,function(e){e.stack.pop()}],[81,function(e){var t=e.stack.pop();d.subMemUsage(e,t,new s.BN(32));var r=e.memory.read(t.toNumber(),32);e.stack.push(new s.BN(r))}],[82,function(e){var t=c(e.stack.popN(2),2),r=t[0],n=t[1].toArrayLike(a,"be",32);d.subMemUsage(e,r,new s.BN(32));var o=r.toNumber();e.memory.extend(o,32),e.memory.write(o,32,n)}],[83,function(e){var t=c(e.stack.popN(2),2),r=t[0],n=t[1],o=a.from([n.andln(255)]);d.subMemUsage(e,r,new s.BN(1));var u=r.toNumber();e.memory.extend(u,1),e.memory.write(u,1,o)}],[84,function(e){return n(this,void 0,void 0,(function(){var t,r,n,c;return o(this,(function(o){switch(o.label){case 0:return t=e.stack.pop(),r=t.toArrayLike(a,"be",32),l.accessStorageEIP2929(e,r,!1),[4,e.eei.storageLoad(r)];case 1:return n=o.sent(),c=n.length?new s.BN(n):new s.BN(0),e.stack.push(c),[2]}}))}))}],[85,function(e){return n(this,void 0,void 0,(function(){var t,r,n,s,g,p;return o(this,(function(o){switch(o.label){case 0:return e.eei.isStatic()&&d.trap(b.ERROR.STATIC_STATE_CHANGE),t=c(e.stack.popN(2),2),r=t[0],n=t[1],s=r.toArrayLike(a,"be",32),g=n.isZero()?a.from([]):n.toArrayLike(a,"be"),[4,d.getContractStorage(e,e.eei.getAddress(),s)];case 1:return p=o.sent(),"constantinople"===e._common.hardfork()?u.updateSstoreGasEIP1283(e,p,d.setLengthLeftStorage(g)):e._common.gteHardfork("istanbul")?h.updateSstoreGasEIP2200(e,p,d.setLengthLeftStorage(g),s):d.updateSstoreGas(e,p,d.setLengthLeftStorage(g),s),l.accessStorageEIP2929(e,s,!0),[4,e.eei.storageStore(s,g)];case 2:return o.sent(),[2]}}))}))}],[86,function(e){var t=e.stack.pop();t.gt(e.eei.getCodeSize())&&d.trap(b.ERROR.INVALID_JUMP+" at "+d.describeLocation(e));var r=t.toNumber();d.jumpIsValid(e,r)||d.trap(b.ERROR.INVALID_JUMP+" at "+d.describeLocation(e)),e.programCounter=r}],[87,function(e){var t=c(e.stack.popN(2),2),r=t[0];if(!t[1].isZero()){r.gt(e.eei.getCodeSize())&&d.trap(b.ERROR.INVALID_JUMP+" at "+d.describeLocation(e));var a=r.toNumber();d.jumpIsValid(e,a)||d.trap(b.ERROR.INVALID_JUMP+" at "+d.describeLocation(e)),e.programCounter=a}}],[88,function(e){e.stack.push(new s.BN(e.programCounter-1))}],[89,function(e){e.stack.push(e.memoryWordCount.muln(32))}],[90,function(e){e.stack.push(new s.BN(e.eei.getGasLeft()))}],[91,function(){}],[92,function(e){d.trap(b.ERROR.INVALID_BEGINSUB+" at "+d.describeLocation(e))}],[93,function(e){e.returnStack.length<1&&d.trap(b.ERROR.INVALID_RETURNSUB);var t=e.returnStack.pop();e.programCounter=t.toNumber()}],[94,function(e){var t=e.stack.pop();t.gt(e.eei.getCodeSize())&&d.trap(b.ERROR.INVALID_JUMPSUB+" at "+d.describeLocation(e));var r=t.toNumber();d.jumpSubIsValid(e,r)||d.trap(b.ERROR.INVALID_JUMPSUB+" at "+d.describeLocation(e)),e.returnStack.push(new s.BN(e.programCounter)),e.programCounter=r+1}],[96,function(e){var t=e.opCode-95,r=new s.BN(e.eei.getCode().slice(e.programCounter,e.programCounter+t));e.programCounter+=t,e.stack.push(r)}],[128,function(e){var t=e.opCode-127;e.stack.dup(t)}],[144,function(e){var t=e.opCode-143;e.stack.swap(t)}],[160,function(e){e.eei.isStatic()&&d.trap(b.ERROR.STATIC_STATE_CHANGE);var t=c(e.stack.popN(2),2),r=t[0],n=t[1],o=e.opCode-160;(o<0||o>4)&&d.trap(b.ERROR.OUT_OF_RANGE);var u=e.stack.popN(o).map((function(e){return e.toArrayLike(a,"be",32)}));d.subMemUsage(e,r,n);var h=a.alloc(0);n.isZero()||(h=e.memory.read(r.toNumber(),n.toNumber())),e.eei.useGas(new s.BN(e._common.param("gasPrices","logTopic")).imuln(o).iadd(n.muln(e._common.param("gasPrices","logData"))),"LOG opcode"),e.eei.log(h,o,u)}],[240,function(e){return n(this,void 0,void 0,(function(){var t,r,n,u,h,g,p;return o(this,(function(o){switch(o.label){case 0:return e.eei.isStatic()&&d.trap(b.ERROR.STATIC_STATE_CHANGE),t=c(e.stack.popN(3),3),r=t[0],n=t[1],u=t[2],l.accessAddressEIP2929(e,e.eei.getAddress(),!1),d.subMemUsage(e,n,u),h=new s.BN(e.eei.getGasLeft()),h=d.maxCallGas(h,e.eei.getGasLeft(),e),g=a.alloc(0),u.isZero()||(g=e.memory.read(n.toNumber(),u.toNumber())),[4,e.eei.create(h,r,g)];case 1:return p=o.sent(),e.stack.push(p),[2]}}))}))}],[245,function(e){return n(this,void 0,void 0,(function(){var t,r,n,u,h,g,p,B;return o(this,(function(o){switch(o.label){case 0:return e.eei.isStatic()&&d.trap(b.ERROR.STATIC_STATE_CHANGE),t=c(e.stack.popN(4),4),r=t[0],n=t[1],u=t[2],h=t[3],d.subMemUsage(e,n,u),l.accessAddressEIP2929(e,e.eei.getAddress(),!1),e.eei.useGas(new s.BN(e._common.param("gasPrices","sha3Word")).imul(d.divCeil(u,new s.BN(32))),"CREATE2 opcode"),g=new s.BN(e.eei.getGasLeft()),g=d.maxCallGas(g,e.eei.getGasLeft(),e),p=a.alloc(0),u.isZero()||(p=e.memory.read(n.toNumber(),u.toNumber())),[4,e.eei.create2(g,r,p,h.toArrayLike(a,"be",32))];case 1:return B=o.sent(),e.stack.push(B),[2]}}))}))}],[241,function(e){return n(this,void 0,void 0,(function(){var t,r,n,u,h,g,p,B,m,I,y,x;return o(this,(function(o){switch(o.label){case 0:return t=c(e.stack.popN(7),7),r=t[0],n=t[1],u=t[2],h=t[3],g=t[4],p=t[5],B=t[6],m=new s.Address(d.addressToBuffer(n)),e.eei.isStatic()&&!u.isZero()&&d.trap(b.ERROR.STATIC_STATE_CHANGE),d.subMemUsage(e,h,g),d.subMemUsage(e,p,B),l.accessAddressEIP2929(e,m),u.isZero()||e.eei.useGas(new s.BN(e._common.param("gasPrices","callValueTransfer")),"CALL opcode -> callValueTransfer"),I=a.alloc(0),g.isZero()||(I=e.memory.read(h.toNumber(),g.toNumber())),e._common.gteHardfork("spuriousDragon")?[4,e.eei.isAccountEmpty(m)]:[3,2];case 1:return o.sent()&&!u.isZero()&&e.eei.useGas(new s.BN(e._common.param("gasPrices","callNewAccount")),"CALL opcode -> callNewAccount (>= SpuriousDragon)"),[3,4];case 2:return[4,e.eei.accountExists(m)];case 3:o.sent()||e.eei.useGas(new s.BN(e._common.param("gasPrices","callNewAccount")),"CALL opcode -> callNewAccount (< SpuriousDragon)"),o.label=4;case 4:return(y=d.maxCallGas(r,e.eei.getGasLeft(),e)).gt(e.eei.getGasLeft())&&d.trap(b.ERROR.OUT_OF_GAS),u.isZero()||(e.eei._gasLeft.iaddn(e._common.param("gasPrices","callStipend")),y.iaddn(e._common.param("gasPrices","callStipend"))),[4,e.eei.call(y,m,u,I)];case 5:return x=o.sent(),d.writeCallOutput(e,p,B),e.stack.push(x),[2]}}))}))}],[242,function(e){return n(this,void 0,void 0,(function(){var t,r,n,u,h,g,p,B,m,I,y,x;return o(this,(function(o){switch(o.label){case 0:return t=c(e.stack.popN(7),7),r=t[0],n=t[1],u=t[2],h=t[3],g=t[4],p=t[5],B=t[6],m=new s.Address(d.addressToBuffer(n)),d.subMemUsage(e,h,g),d.subMemUsage(e,p,B),l.accessAddressEIP2929(e,m),u.isZero()||e.eei.useGas(new s.BN(e._common.param("gasPrices","callValueTransfer")),"CALLCODE opcode -> callValueTransfer"),(I=d.maxCallGas(r,e.eei.getGasLeft(),e)).gt(e.eei.getGasLeft())&&d.trap(b.ERROR.OUT_OF_GAS),u.isZero()||(e.eei._gasLeft.iaddn(e._common.param("gasPrices","callStipend")),I.iaddn(e._common.param("gasPrices","callStipend"))),y=a.alloc(0),g.isZero()||(y=e.memory.read(h.toNumber(),g.toNumber())),[4,e.eei.callCode(I,m,u,y)];case 1:return x=o.sent(),d.writeCallOutput(e,p,B),e.stack.push(x),[2]}}))}))}],[244,function(e){return n(this,void 0,void 0,(function(){var t,r,n,u,h,g,p,B,m,I,y,x;return o(this,(function(o){switch(o.label){case 0:return t=e.eei.getCallValue(),r=c(e.stack.popN(6),6),n=r[0],u=r[1],h=r[2],g=r[3],p=r[4],B=r[5],m=new s.Address(d.addressToBuffer(u)),d.subMemUsage(e,h,g),d.subMemUsage(e,p,B),l.accessAddressEIP2929(e,m),(I=d.maxCallGas(n,e.eei.getGasLeft(),e)).gt(e.eei.getGasLeft())&&d.trap(b.ERROR.OUT_OF_GAS),y=a.alloc(0),g.isZero()||(y=e.memory.read(h.toNumber(),g.toNumber())),[4,e.eei.callDelegate(I,m,t,y)];case 1:return x=o.sent(),d.writeCallOutput(e,p,B),e.stack.push(x),[2]}}))}))}],[250,function(e){return n(this,void 0,void 0,(function(){var t,r,n,u,h,b,g,p,B,m,I,y;return o(this,(function(o){switch(o.label){case 0:return t=new s.BN(0),r=c(e.stack.popN(6),6),n=r[0],u=r[1],h=r[2],b=r[3],g=r[4],p=r[5],B=new s.Address(d.addressToBuffer(u)),d.subMemUsage(e,h,b),d.subMemUsage(e,g,p),l.accessAddressEIP2929(e,B),m=d.maxCallGas(n,e.eei.getGasLeft(),e),I=a.alloc(0),b.isZero()||(I=e.memory.read(h.toNumber(),b.toNumber())),[4,e.eei.callStatic(m,B,t,I)];case 1:return y=o.sent(),d.writeCallOutput(e,g,p),e.stack.push(y),[2]}}))}))}],[243,function(e){var t=c(e.stack.popN(2),2),r=t[0],n=t[1];d.subMemUsage(e,r,n);var o=a.alloc(0);n.isZero()||(o=e.memory.read(r.toNumber(),n.toNumber())),e.eei.finish(o)}],[253,function(e){var t=c(e.stack.popN(2),2),r=t[0],n=t[1];d.subMemUsage(e,r,n);var o=a.alloc(0);n.isZero()||(o=e.memory.read(r.toNumber(),n.toNumber())),e.eei.revert(o)}],[255,function(e){return n(this,void 0,void 0,(function(){var t,r,a;return o(this,(function(n){switch(n.label){case 0:return t=e.stack.pop(),e.eei.isStatic()&&d.trap(b.ERROR.STATIC_STATE_CHANGE),r=new s.Address(d.addressToBuffer(t)),a=!1,e._common.gteHardfork("spuriousDragon")?[4,e.eei.getExternalBalance(e.eei.getAddress())]:[3,4];case 1:return n.sent().gtn(0)?[4,e.eei.isAccountEmpty(r)]:[3,3];case 2:n.sent()&&(a=!0),n.label=3;case 3:return[3,6];case 4:return e._common.gteHardfork("tangerineWhistle")?[4,e.stateManager.accountExists(r)]:[3,6];case 5:n.sent()||(a=!0),n.label=6;case 6:return a&&e.eei.useGas(new s.BN(e._common.param("gasPrices","callNewAccount"))," opcode"),l.accessAddressEIP2929(e,r,!0,!0),[2,e.eei.selfDestruct(r)]}}))}))}]]);for(var g=t.handlers.get(96),p=97;p<=127;p++)t.handlers.set(p,g);var B=t.handlers.get(128);for(p=129;p<=143;p++)t.handlers.set(p,B);var m=t.handlers.get(144);for(p=145;p<=159;p++)t.handlers.set(p,m);var I=t.handlers.get(160);for(p=161;p<=164;p++)t.handlers.set(p,I)},(e,t,r)=>{var a=r(3),n=a.Buffer;function copyProps(e,t){for(var r in e)t[r]=e[r]}function SafeBuffer(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=a:(copyProps(a,t),t.Buffer=SafeBuffer),SafeBuffer.prototype=Object.create(n.prototype),copyProps(n,SafeBuffer),SafeBuffer.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},SafeBuffer.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var a=n(e);return void 0!==t?"string"==typeof r?a.fill(t,r):a.fill(t):a.fill(0),a},SafeBuffer.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},SafeBuffer.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a.SlowBuffer(e)}},function(e,t,r){"use strict";var a=r(3).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.rlphash=t.ripemd160FromArray=t.ripemd160FromString=t.ripemd160=t.sha256FromArray=t.sha256FromString=t.sha256=t.keccakFromArray=t.keccakFromHexString=t.keccakFromString=t.keccak256=t.keccak=void 0;const{keccak224:s,keccak384:d,keccak256:u,keccak512:h}=r(822),l=r(490),b=c(r(181)),g=r(74),p=r(344);t.keccak=function(e,t=256){switch(p.assertIsBuffer(e),t){case 224:return s(e);case 256:return u(e);case 384:return d(e);case 512:return h(e);default:throw new Error(`Invald algorithm: keccak${t}`)}},t.keccak256=function(e){return t.keccak(e)},t.keccakFromString=function(e,r=256){p.assertIsString(e);const n=a.from(e,"utf8");return t.keccak(n,r)},t.keccakFromHexString=function(e,r=256){return p.assertIsHexString(e),t.keccak(g.toBuffer(e),r)},t.keccakFromArray=function(e,r=256){return p.assertIsArray(e),t.keccak(g.toBuffer(e),r)};const _sha256=function(e){return e=g.toBuffer(e),l("sha256").update(e).digest()};t.sha256=function(e){return p.assertIsBuffer(e),_sha256(e)},t.sha256FromString=function(e){return p.assertIsString(e),_sha256(e)},t.sha256FromArray=function(e){return p.assertIsArray(e),_sha256(e)};const _ripemd160=function(e,t){e=g.toBuffer(e);const r=l("rmd160").update(e).digest();return!0===t?g.setLengthLeft(r,32):r};t.ripemd160=function(e,t){return p.assertIsBuffer(e),_ripemd160(e,t)},t.ripemd160FromString=function(e,t){return p.assertIsString(e),_ripemd160(e,t)},t.ripemd160FromArray=function(e,t){return p.assertIsArray(e),_ripemd160(e,t)},t.rlphash=function(e){return t.keccak(b.encode(e))}},function(e,t,r){"use strict";var a=r(5).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.rlphash=t.ripemd160FromArray=t.ripemd160FromString=t.ripemd160=t.sha256FromArray=t.sha256FromString=t.sha256=t.keccakFromArray=t.keccakFromHexString=t.keccakFromString=t.keccak256=t.keccak=void 0;const{keccak224:s,keccak384:d,keccak256:u,keccak512:h}=r(1260),l=r(851),b=c(r(346)),g=r(77),p=r(347);t.keccak=function(e,t=256){switch(p.assertIsBuffer(e),t){case 224:return s(e);case 256:return u(e);case 384:return d(e);case 512:return h(e);default:throw new Error(`Invald algorithm: keccak${t}`)}},t.keccak256=function(e){return t.keccak(e)},t.keccakFromString=function(e,r=256){p.assertIsString(e);const n=a.from(e,"utf8");return t.keccak(n,r)},t.keccakFromHexString=function(e,r=256){return p.assertIsHexString(e),t.keccak(g.toBuffer(e),r)},t.keccakFromArray=function(e,r=256){return p.assertIsArray(e),t.keccak(g.toBuffer(e),r)};const _sha256=function(e){return e=g.toBuffer(e),l("sha256").update(e).digest()};t.sha256=function(e){return p.assertIsBuffer(e),_sha256(e)},t.sha256FromString=function(e){return p.assertIsString(e),_sha256(e)},t.sha256FromArray=function(e){return p.assertIsArray(e),_sha256(e)};const _ripemd160=function(e,t){e=g.toBuffer(e);const r=l("rmd160").update(e).digest();return!0===t?g.setLengthLeft(r,32):r};t.ripemd160=function(e,t){return p.assertIsBuffer(e),_ripemd160(e,t)},t.ripemd160FromString=function(e,t){return p.assertIsString(e),_ripemd160(e,t)},t.ripemd160FromArray=function(e,t){return p.assertIsArray(e),_ripemd160(e,t)},t.rlphash=function(e){return t.keccak(b.encode(e))}},(e,t,r)=>{var a=r(5),n=a.Buffer;function copyProps(e,t){for(var r in e)t[r]=e[r]}function SafeBuffer(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=a:(copyProps(a,t),t.Buffer=SafeBuffer),SafeBuffer.prototype=Object.create(n.prototype),copyProps(n,SafeBuffer),SafeBuffer.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},SafeBuffer.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var a=n(e);return void 0!==t?"string"==typeof r?a.fill(t,r):a.fill(t):a.fill(0),a},SafeBuffer.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},SafeBuffer.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a.SlowBuffer(e)}},function(e,t,r){"use strict";var a=r(2).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.rlphash=t.ripemd160FromArray=t.ripemd160FromString=t.ripemd160=t.sha256FromArray=t.sha256FromString=t.sha256=t.keccakFromArray=t.keccakFromHexString=t.keccakFromString=t.keccak256=t.keccak=void 0;const{keccak224:s,keccak384:d,keccak256:u,keccak512:h}=r(1275),l=r(896),b=c(r(353)),g=r(79),p=r(354);t.keccak=function(e,t=256){switch(p.assertIsBuffer(e),t){case 224:return s(e);case 256:return u(e);case 384:return d(e);case 512:return h(e);default:throw new Error(`Invald algorithm: keccak${t}`)}},t.keccak256=function(e){return t.keccak(e)},t.keccakFromString=function(e,r=256){p.assertIsString(e);const n=a.from(e,"utf8");return t.keccak(n,r)},t.keccakFromHexString=function(e,r=256){return p.assertIsHexString(e),t.keccak(g.toBuffer(e),r)},t.keccakFromArray=function(e,r=256){return p.assertIsArray(e),t.keccak(g.toBuffer(e),r)};const _sha256=function(e){return e=g.toBuffer(e),l("sha256").update(e).digest()};t.sha256=function(e){return p.assertIsBuffer(e),_sha256(e)},t.sha256FromString=function(e){return p.assertIsString(e),_sha256(e)},t.sha256FromArray=function(e){return p.assertIsArray(e),_sha256(e)};const _ripemd160=function(e,t){e=g.toBuffer(e);const r=l("rmd160").update(e).digest();return!0===t?g.setLengthLeft(r,32):r};t.ripemd160=function(e,t){return p.assertIsBuffer(e),_ripemd160(e,t)},t.ripemd160FromString=function(e,t){return p.assertIsString(e),_ripemd160(e,t)},t.ripemd160FromArray=function(e,t){return p.assertIsArray(e),_ripemd160(e,t)},t.rlphash=function(e){return t.keccak(b.encode(e))}},(e,t,r)=>{var a=r(2),n=a.Buffer;function copyProps(e,t){for(var r in e)t[r]=e[r]}function SafeBuffer(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=a:(copyProps(a,t),t.Buffer=SafeBuffer),SafeBuffer.prototype=Object.create(n.prototype),copyProps(n,SafeBuffer),SafeBuffer.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},SafeBuffer.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var a=n(e);return void 0!==t?"string"==typeof r?a.fill(t,r):a.fill(t):a.fill(0),a},SafeBuffer.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},SafeBuffer.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a.SlowBuffer(e)}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.rlphash=t.ripemd160FromArray=t.ripemd160FromString=t.ripemd160=t.sha256FromArray=t.sha256FromString=t.sha256=t.keccakFromArray=t.keccakFromHexString=t.keccakFromString=t.keccak256=t.keccak=void 0;const{keccak224:s,keccak384:d,keccak256:u,keccak512:h}=r(244),l=r(135),b=c(r(20)),g=r(81),p=r(359);t.keccak=function(e,t=256){switch(p.assertIsBuffer(e),t){case 224:return s(e);case 256:return u(e);case 384:return d(e);case 512:return h(e);default:throw new Error(`Invald algorithm: keccak${t}`)}},t.keccak256=function(e){return t.keccak(e)},t.keccakFromString=function(e,r=256){p.assertIsString(e);const n=a.from(e,"utf8");return t.keccak(n,r)},t.keccakFromHexString=function(e,r=256){return p.assertIsHexString(e),t.keccak(g.toBuffer(e),r)},t.keccakFromArray=function(e,r=256){return p.assertIsArray(e),t.keccak(g.toBuffer(e),r)};const _sha256=function(e){return e=g.toBuffer(e),l("sha256").update(e).digest()};t.sha256=function(e){return p.assertIsBuffer(e),_sha256(e)},t.sha256FromString=function(e){return p.assertIsString(e),_sha256(e)},t.sha256FromArray=function(e){return p.assertIsArray(e),_sha256(e)};const _ripemd160=function(e,t){e=g.toBuffer(e);const r=l("rmd160").update(e).digest();return!0===t?g.setLengthLeft(r,32):r};t.ripemd160=function(e,t){return p.assertIsBuffer(e),_ripemd160(e,t)},t.ripemd160FromString=function(e,t){return p.assertIsString(e),_ripemd160(e,t)},t.ripemd160FromArray=function(e,t){return p.assertIsArray(e),_ripemd160(e,t)},t.rlphash=function(e){return t.keccak(b.encode(e))}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.rlphash=t.ripemd160FromArray=t.ripemd160FromString=t.ripemd160=t.sha256FromArray=t.sha256FromString=t.sha256=t.keccakFromArray=t.keccakFromHexString=t.keccakFromString=t.keccak256=t.keccak=void 0;var s=r(244),d=r(135),u=c(r(20)),h=r(84),l=r(373);t.keccak=function(e,t){switch(void 0===t&&(t=256),l.assertIsBuffer(e),t){case 224:return s.keccak224(e);case 256:return s.keccak256(e);case 384:return s.keccak384(e);case 512:return s.keccak512(e);default:throw new Error("Invald algorithm: keccak"+t)}},t.keccak256=function(e){return t.keccak(e)},t.keccakFromString=function(e,r){void 0===r&&(r=256),l.assertIsString(e);var n=a.from(e,"utf8");return t.keccak(n,r)},t.keccakFromHexString=function(e,r){return void 0===r&&(r=256),l.assertIsHexString(e),t.keccak(h.toBuffer(e),r)},t.keccakFromArray=function(e,r){return void 0===r&&(r=256),l.assertIsArray(e),t.keccak(h.toBuffer(e),r)};var _sha256=function(e){return e=h.toBuffer(e),d("sha256").update(e).digest()};t.sha256=function(e){return l.assertIsBuffer(e),_sha256(e)},t.sha256FromString=function(e){return l.assertIsString(e),_sha256(e)},t.sha256FromArray=function(e){return l.assertIsArray(e),_sha256(e)};var _ripemd160=function(e,t){e=h.toBuffer(e);var r=d("rmd160").update(e).digest();return!0===t?h.setLengthLeft(r,32):r};t.ripemd160=function(e,t){return l.assertIsBuffer(e),_ripemd160(e,t)},t.ripemd160FromString=function(e,t){return l.assertIsString(e),_ripemd160(e,t)},t.ripemd160FromArray=function(e,t){return l.assertIsArray(e),_ripemd160(e,t)},t.rlphash=function(e){return t.keccak(u.encode(e))}},function(e,t,r){"use strict";var a,n=r(0).Buffer,o=this&&this.__extends||(a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function __(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),c=this&&this.__assign||function(){return(c=Object.assign||function(e){for(var t,r=1,a=arguments.length;r=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var d=r(34),u=r(620),h=r(56),l=r(293),b=r(1356),g=r(1369),p=function(e){function Common(t){var r,a,n=e.call(this)||this;return n._supportedHardforks=[],n._eips=[],n._customChains=null!==(r=t.customChains)&&void 0!==r?r:[],n._chainParams=n.setChain(t.chain),n.DEFAULT_HARDFORK=null!==(a=n._chainParams.defaultHardfork)&&void 0!==a?a:"istanbul",n._hardfork=n.DEFAULT_HARDFORK,t.supportedHardforks&&(n._supportedHardforks=t.supportedHardforks),t.hardfork&&n.setHardfork(t.hardfork),t.eips&&n.setEIPs(t.eips),n}return o(Common,e),Common.forCustomChain=function(e,t,r,a){var n=Common._getChainParams(e);return new Common({chain:c(c({},n),t),hardfork:r,supportedHardforks:a})},Common._getChainParams=function(e,t){var r=l._getInitializedChains(t);if("number"==typeof e||h.BN.isBN(e)){if(e=e.toString(),r.names[e])return r[r.names[e]];throw new Error("Chain with ID "+e+" not supported")}if(r[e])return r[e];throw new Error("Chain with name "+e+" not supported")},Common.prototype.setChain=function(e){var t,r;if("number"==typeof e||"string"==typeof e||h.BN.isBN(e))this._chainParams=Common._getChainParams(e,this._customChains);else{if("object"!=typeof e)throw new Error("Wrong input format");if(this._customChains.length>0)throw new Error("Chain must be a string, number, or BN when initialized with customChains passed in");try{for(var a=s(["networkId","genesis","hardforks","bootstrapNodes"]),n=a.next();!n.done;n=a.next()){var o=n.value;if(void 0===e[o])throw new Error("Missing required chain parameter: "+o)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}this._chainParams=e}return this._chainParams},Common.prototype.setHardfork=function(e){var t,r;if(!this._isSupportedHardfork(e))throw new Error("Hardfork "+e+" not set as supported in supportedHardforks");var a=!1;try{for(var n=s(b.hardforks),o=n.next();!o.done;o=n.next()){o.value[0]===e&&(this._hardfork!==e&&(this._hardfork=e,this.emit("hardforkChanged",e)),a=!0)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}if(!a)throw new Error("Hardfork with name "+e+" not supported")},Common.prototype.getHardforkByBlockNumber=function(e){var t,r;e=h.toType(e,h.TypeOutput.BN);var a="chainstart";try{for(var n=s(this.hardforks()),o=n.next();!o.done;o=n.next()){var c=o.value;null!==c.block&&(e.gte(new h.BN(c.block))&&(a=c.name))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return a},Common.prototype.setHardforkByBlockNumber=function(e){e=h.toType(e,h.TypeOutput.BN);var t=this.getHardforkByBlockNumber(e);return this.setHardfork(t),t},Common.prototype._chooseHardfork=function(e,t){if(void 0===t&&(t=!0),e){if(t&&!this._isSupportedHardfork(e))throw new Error("Hardfork "+e+" not set as supported in supportedHardforks")}else e=this._hardfork;return e},Common.prototype._getHardfork=function(e){var t,r,a=this.hardforks();try{for(var n=s(a),o=n.next();!o.done;o=n.next()){var c=o.value;if(c.name===e)return c}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}throw new Error("Hardfork "+e+" not defined for chain "+this.chainName())},Common.prototype._isSupportedHardfork=function(e){var t,r;if(!(this._supportedHardforks.length>0))return!0;try{for(var a=s(this._supportedHardforks),n=a.next();!n.done;n=a.next()){if(e===n.value)return!0}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return!1},Common.prototype.setEIPs=function(e){var t,r,a=this;void 0===e&&(e=[]);var _loop_1=function(t){if(!(t in g.EIPs))throw new Error(t+" not supported");var r=n.gteHardfork(g.EIPs[t].minimumHardfork);if(!r)throw new Error(t+" cannot be activated on hardfork "+n.hardfork()+", minimumHardfork: "+r);g.EIPs[t].requiredEIPs&&g.EIPs[t].requiredEIPs.forEach((function(r){if(!e.includes(r)&&!a.isActivatedEIP(r))throw new Error(t+" requires EIP "+r+", but is not included in the EIP list")}))},n=this;try{for(var o=s(e),c=o.next();!c.done;c=o.next()){_loop_1(c.value)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}this._eips=e},Common.prototype.param=function(e,t){var r,a,n=null;try{for(var o=s(this._eips),c=o.next();!c.done;c=o.next()){var d=c.value;if(null!==(n=this.paramByEIP(e,t,d)))return n}}catch(e){r={error:e}}finally{try{c&&!c.done&&(a=o.return)&&a.call(o)}finally{if(r)throw r.error}}return this.paramByHardfork(e,t,this._hardfork)},Common.prototype.paramByHardfork=function(e,t,r){var a,n,o,c;r=this._chooseHardfork(r);var d=null;try{for(var u=s(b.hardforks),h=u.next();!h.done;h=u.next()){var l=h.value;if(l[1].hasOwnProperty("eips")){var g=l[1].eips;try{for(var p=(o=void 0,s(g)),B=p.next();!B.done;B=p.next()){var m=B.value,I=this.paramByEIP(e,t,m);d=null!==I?I:d}}catch(e){o={error:e}}finally{try{B&&!B.done&&(c=p.return)&&c.call(p)}finally{if(o)throw o.error}}}else{if(!l[1][e])throw new Error("Topic "+e+" not defined");void 0!==l[1][e][t]&&(d=l[1][e][t].v)}if(l[0]===r)break}}catch(e){a={error:e}}finally{try{h&&!h.done&&(n=u.return)&&n.call(u)}finally{if(a)throw a.error}}return d},Common.prototype.paramByEIP=function(e,t,r){if(!(r in g.EIPs))throw new Error(r+" not supported");var a=g.EIPs[r];if(!(e in a))throw new Error("Topic "+e+" not defined");return void 0===a[e][t]?null:a[e][t].v},Common.prototype.paramByBlock=function(e,t,r){var a=this.activeHardforks(r),n=a[a.length-1].name;return this.paramByHardfork(e,t,n)},Common.prototype.isActivatedEIP=function(e){var t,r;if(this.eips().includes(e))return!0;try{for(var a=s(b.hardforks),n=a.next();!n.done;n=a.next()){var o=n.value[1];if(this.gteHardfork(o.name)&&"eips"in o&&o.eips.includes(e))return!0}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return!1},Common.prototype.hardforkIsActiveOnBlock=function(e,t,r){var a;void 0===r&&(r={}),t=h.toType(t,h.TypeOutput.BN);var n=null!==(a=r.onlySupported)&&void 0!==a&&a;e=this._chooseHardfork(e,n);var o=this.hardforkBlockBN(e);return!(!o||!t.gte(o))},Common.prototype.activeOnBlock=function(e,t){return this.hardforkIsActiveOnBlock(null,e,t)},Common.prototype.hardforkGteHardfork=function(e,t,r){var a,n;void 0===r&&(r={});var o,c=void 0!==r.onlyActive&&r.onlyActive;e=this._chooseHardfork(e,r.onlySupported),o=c?this.activeHardforks(null,r):this.hardforks();var d=-1,u=-1,h=0;try{for(var l=s(o),b=l.next();!b.done;b=l.next()){var g=b.value;g.name===e&&(d=h),g.name===t&&(u=h),h+=1}}catch(e){a={error:e}}finally{try{b&&!b.done&&(n=l.return)&&n.call(l)}finally{if(a)throw a.error}}return d>=u&&-1!==u},Common.prototype.gteHardfork=function(e,t){return this.hardforkGteHardfork(null,e,t)},Common.prototype.hardforkIsActiveOnChain=function(e,t){var r,a,n;void 0===t&&(t={});var o=null!==(n=t.onlySupported)&&void 0!==n&&n;e=this._chooseHardfork(e,o);try{for(var c=s(this.hardforks()),d=c.next();!d.done;d=c.next()){var u=d.value;if(u.name===e&&null!==u.block)return!0}}catch(e){r={error:e}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(r)throw r.error}}return!1},Common.prototype.activeHardforks=function(e,t){var r,a;void 0===t&&(t={});var n=[],o=this.hardforks();try{for(var c=s(o),d=c.next();!d.done;d=c.next()){var u=d.value;if(null!==u.block){if(null!=e&&e0)return r[r.length-1].name;throw new Error("No (supported) active hardfork found")},Common.prototype.hardforkBlock=function(e){return h.toType(this.hardforkBlockBN(e),h.TypeOutput.Number)},Common.prototype.hardforkBlockBN=function(e){return e=this._chooseHardfork(e,!1),new h.BN(this._getHardfork(e).block)},Common.prototype.isHardforkBlock=function(e,t){return e=h.toType(e,h.TypeOutput.BN),t=this._chooseHardfork(t,!1),this.hardforkBlockBN(t).eq(e)},Common.prototype.nextHardforkBlock=function(e){var t=this.nextHardforkBlockBN(e);return null===t?null:h.toType(t,h.TypeOutput.Number)},Common.prototype.nextHardforkBlockBN=function(e){e=this._chooseHardfork(e,!1);var t=this.hardforkBlockBN(e);return this.hardforks().reduce((function(e,r){var a=new h.BN(r.block);return a.gt(t)&&null===e?a:e}),null)},Common.prototype.isNextHardforkBlock=function(e,t){e=h.toType(e,h.TypeOutput.BN),t=this._chooseHardfork(t,!1);var r=this.nextHardforkBlockBN(t);return null!==r&&r.eq(e)},Common.prototype._calcForkHash=function(e){var t,r,a=n.from(this.genesis().hash.substr(2),"hex"),o=n.alloc(0),c=0;try{for(var d=s(this.hardforks()),l=d.next();!l.done;l=d.next()){var b=l.value,g=b.block;if(0!==g&&null!==g&&g!==c){var p=n.from(g.toString(16).padStart(16,"0"),"hex");o=n.concat([o,p])}if(b.name===e)break;c=g}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=d.return)&&r.call(d)}finally{if(t)throw t.error}}var B=n.concat([a,o]);return"0x"+h.intToBuffer(u.buf(B)>>>0).toString("hex")},Common.prototype.forkHash=function(e){e=this._chooseHardfork(e,!1);var t=this._getHardfork(e);if(null===t.block){throw new Error("No fork hash calculation possible for non-applied or future hardfork")}return void 0!==t.forkHash?t.forkHash:this._calcForkHash(e)},Common.prototype.hardforkForForkHash=function(e){var t=this.hardforks().filter((function(t){return t.forkHash===e}));return t.length>=1?t[t.length-1]:null},Common.prototype.genesis=function(){return this._chainParams.genesis},Common.prototype.hardforks=function(){return this._chainParams.hardforks},Common.prototype.bootstrapNodes=function(){return this._chainParams.bootstrapNodes},Common.prototype.dnsNetworks=function(){return this._chainParams.dnsNetworks},Common.prototype.hardfork=function(){return this._hardfork},Common.prototype.chainId=function(){return h.toType(this.chainIdBN(),h.TypeOutput.Number)},Common.prototype.chainIdBN=function(){return new h.BN(this._chainParams.chainId)},Common.prototype.chainName=function(){return this._chainParams.name},Common.prototype.networkId=function(){return h.toType(this.networkIdBN(),h.TypeOutput.Number)},Common.prototype.networkIdBN=function(){return new h.BN(this._chainParams.networkId)},Common.prototype.eips=function(){return this._eips},Common.prototype.consensusType=function(){return this._chainParams.consensus.type},Common.prototype.consensusAlgorithm=function(){return this._chainParams.consensus.algorithm},Common.prototype.consensusConfig=function(){return this._chainParams.consensus[this.consensusAlgorithm()]},Common.prototype.copy=function(){return Object.assign(Object.create(Object.getPrototypeOf(this)),this)},Common}(d.EventEmitter);t.default=p},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.rlphash=t.ripemd160FromArray=t.ripemd160FromString=t.ripemd160=t.sha256FromArray=t.sha256FromString=t.sha256=t.keccakFromArray=t.keccakFromHexString=t.keccakFromString=t.keccak256=t.keccak=void 0;var s=r(244),d=r(135),u=c(r(20)),h=r(85),l=r(384);t.keccak=function(e,t){switch(void 0===t&&(t=256),l.assertIsBuffer(e),t){case 224:return s.keccak224(e);case 256:return s.keccak256(e);case 384:return s.keccak384(e);case 512:return s.keccak512(e);default:throw new Error("Invald algorithm: keccak"+t)}},t.keccak256=function(e){return t.keccak(e)},t.keccakFromString=function(e,r){void 0===r&&(r=256),l.assertIsString(e);var n=a.from(e,"utf8");return t.keccak(n,r)},t.keccakFromHexString=function(e,r){return void 0===r&&(r=256),l.assertIsHexString(e),t.keccak(h.toBuffer(e),r)},t.keccakFromArray=function(e,r){return void 0===r&&(r=256),l.assertIsArray(e),t.keccak(h.toBuffer(e),r)};var _sha256=function(e){return e=h.toBuffer(e),d("sha256").update(e).digest()};t.sha256=function(e){return l.assertIsBuffer(e),_sha256(e)},t.sha256FromString=function(e){return l.assertIsString(e),_sha256(e)},t.sha256FromArray=function(e){return l.assertIsArray(e),_sha256(e)};var _ripemd160=function(e,t){e=h.toBuffer(e);var r=d("rmd160").update(e).digest();return!0===t?h.setLengthLeft(r,32):r};t.ripemd160=function(e,t){return l.assertIsBuffer(e),_ripemd160(e,t)},t.ripemd160FromString=function(e,t){return l.assertIsString(e),_ripemd160(e,t)},t.ripemd160FromArray=function(e,t){return l.assertIsArray(e),_ripemd160(e,t)},t.rlphash=function(e){return t.keccak(u.encode(e))}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.rlphash=t.ripemd160FromArray=t.ripemd160FromString=t.ripemd160=t.sha256FromArray=t.sha256FromString=t.sha256=t.keccakFromArray=t.keccakFromHexString=t.keccakFromString=t.keccak256=t.keccak=void 0;var s=r(244),d=r(135),u=c(r(20)),h=r(87),l=r(385);t.keccak=function(e,t){switch(void 0===t&&(t=256),l.assertIsBuffer(e),t){case 224:return s.keccak224(e);case 256:return s.keccak256(e);case 384:return s.keccak384(e);case 512:return s.keccak512(e);default:throw new Error("Invald algorithm: keccak"+t)}},t.keccak256=function(e){return t.keccak(e)},t.keccakFromString=function(e,r){void 0===r&&(r=256),l.assertIsString(e);var n=a.from(e,"utf8");return t.keccak(n,r)},t.keccakFromHexString=function(e,r){return void 0===r&&(r=256),l.assertIsHexString(e),t.keccak(h.toBuffer(e),r)},t.keccakFromArray=function(e,r){return void 0===r&&(r=256),l.assertIsArray(e),t.keccak(h.toBuffer(e),r)};var _sha256=function(e){return e=h.toBuffer(e),d("sha256").update(e).digest()};t.sha256=function(e){return l.assertIsBuffer(e),_sha256(e)},t.sha256FromString=function(e){return l.assertIsString(e),_sha256(e)},t.sha256FromArray=function(e){return l.assertIsArray(e),_sha256(e)};var _ripemd160=function(e,t){e=h.toBuffer(e);var r=d("rmd160").update(e).digest();return!0===t?h.setLengthLeft(r,32):r};t.ripemd160=function(e,t){return l.assertIsBuffer(e),_ripemd160(e,t)},t.ripemd160FromString=function(e,t){return l.assertIsString(e),_ripemd160(e,t)},t.ripemd160FromArray=function(e,t){return l.assertIsArray(e),_ripemd160(e,t)},t.rlphash=function(e){return t.keccak(u.encode(e))}},(e,t,r)=>{"use strict";var a,n=SyntaxError,o=Function,c=TypeError,getEvalledConstructor=function(e){try{return o('"use strict"; return ('+e+").constructor;")()}catch(e){}},s=Object.getOwnPropertyDescriptor;if(s)try{s({},"")}catch(e){s=null}var throwTypeError=function(){throw new c},d=s?function(){try{return throwTypeError}catch(e){try{return s(arguments,"callee").get}catch(e){return throwTypeError}}}():throwTypeError,u=r(675)(),h=Object.getPrototypeOf||function(e){return e.__proto__},l={},b="undefined"==typeof Uint8Array?a:h(Uint8Array),g={"%AggregateError%":"undefined"==typeof AggregateError?a:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?a:ArrayBuffer,"%ArrayIteratorPrototype%":u?h([][Symbol.iterator]()):a,"%AsyncFromSyncIteratorPrototype%":a,"%AsyncFunction%":l,"%AsyncGenerator%":l,"%AsyncGeneratorFunction%":l,"%AsyncIteratorPrototype%":l,"%Atomics%":"undefined"==typeof Atomics?a:Atomics,"%BigInt%":"undefined"==typeof BigInt?a:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?a:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?a:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?a:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?a:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":l,"%Int8Array%":"undefined"==typeof Int8Array?a:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?a:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?a:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":u?h(h([][Symbol.iterator]())):a,"%JSON%":"object"==typeof JSON?JSON:a,"%Map%":"undefined"==typeof Map?a:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&u?h((new Map)[Symbol.iterator]()):a,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?a:Promise,"%Proxy%":"undefined"==typeof Proxy?a:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?a:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?a:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&u?h((new Set)[Symbol.iterator]()):a,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?a:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":u?h(""[Symbol.iterator]()):a,"%Symbol%":u?Symbol:a,"%SyntaxError%":n,"%ThrowTypeError%":d,"%TypedArray%":b,"%TypeError%":c,"%Uint8Array%":"undefined"==typeof Uint8Array?a:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?a:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?a:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?a:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?a:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?a:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?a:WeakSet},p=function doEval(e){var t;if("%AsyncFunction%"===e)t=getEvalledConstructor("async function () {}");else if("%GeneratorFunction%"===e)t=getEvalledConstructor("function* () {}");else if("%AsyncGeneratorFunction%"===e)t=getEvalledConstructor("async function* () {}");else if("%AsyncGenerator%"===e){var r=doEval("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if("%AsyncIteratorPrototype%"===e){var a=doEval("%AsyncGenerator%");a&&(t=h(a.prototype))}return g[e]=t,t},B={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},m=r(411),I=r(259),y=m.call(Function.call,Array.prototype.concat),x=m.call(Function.apply,Array.prototype.splice),C=m.call(Function.call,String.prototype.replace),v=m.call(Function.call,String.prototype.slice),Q=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,w=/\\(\\)?/g,_=function stringToPath(e){var t=v(e,0,1),r=v(e,-1);if("%"===t&&"%"!==r)throw new n("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new n("invalid intrinsic syntax, expected opening `%`");var a=[];return C(e,Q,(function(e,t,r,n){a[a.length]=r?C(n,w,"$1"):t||e})),a},k=function getBaseIntrinsic(e,t){var r,a=e;if(I(B,a)&&(a="%"+(r=B[a])[0]+"%"),I(g,a)){var o=g[a];if(o===l&&(o=p(a)),void 0===o&&!t)throw new c("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:a,value:o}}throw new n("intrinsic "+e+" does not exist!")};e.exports=function GetIntrinsic(e,t){if("string"!=typeof e||0===e.length)throw new c("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new c('"allowMissing" argument must be a boolean');var r=_(e),a=r.length>0?r[0]:"",o=k("%"+a+"%",t),d=o.name,u=o.value,h=!1,l=o.alias;l&&(a=l[0],x(r,y([0,1],l)));for(var b=1,p=!0;b=r.length){var Q=s(u,B);u=(p=!!Q)&&"get"in Q&&!("originalValue"in Q.get)?Q.get:u[B]}else p=I(u,B),u=u[B];p&&!h&&(g[d]=u)}}return u}},e=>{function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=assert,assert.equal=function assertEqual(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},(e,t,r)=>{"use strict";var a=t,n=r(29),o=r(70),c=r(455);a.assert=o,a.toArray=c.toArray,a.zero2=c.zero2,a.toHex=c.toHex,a.encode=c.encode,a.getNAF=function getNAF(e,t,r){var a=new Array(Math.max(e.bitLength(),r)+1);a.fill(0);for(var n=1<(n>>1)-1?(n>>1)-d:d,o.isubn(s)):s=0,a[c]=s,o.iushrn(1)}return a},a.getJSF=function getJSF(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var a,n=0,o=0;e.cmpn(-n)>0||t.cmpn(-o)>0;){var c,s,d=e.andln(3)+n&3,u=t.andln(3)+o&3;3===d&&(d=-1),3===u&&(u=-1),c=0==(1&d)?0:3!==(a=e.andln(7)+n&7)&&5!==a||2!==u?d:-d,r[0].push(c),s=0==(1&u)?0:3!==(a=t.andln(7)+o&7)&&5!==a||2!==d?u:-u,r[1].push(s),2*n===c+1&&(n=1-n),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},a.cachedProperty=function cachedProperty(e,t,r){var a="_"+t;e.prototype[t]=function cachedProperty(){return void 0!==this[a]?this[a]:this[a]=r.call(this)}},a.parseBytes=function parseBytes(e){return"string"==typeof e?a.toArray(e,"hex"):e},a.intFromLE=function intFromLE(e){return new n(e,"hex","le")}},(e,t,r)=>{"use strict";var a=t,n=r(99),o=r(159),c=r(471);a.assert=o,a.toArray=c.toArray,a.zero2=c.zero2,a.toHex=c.toHex,a.encode=c.encode,a.getNAF=function getNAF(e,t,r){var a=new Array(Math.max(e.bitLength(),r)+1);a.fill(0);for(var n=1<(n>>1)-1?(n>>1)-d:d,o.isubn(s)):s=0,a[c]=s,o.iushrn(1)}return a},a.getJSF=function getJSF(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var a,n=0,o=0;e.cmpn(-n)>0||t.cmpn(-o)>0;){var c,s,d=e.andln(3)+n&3,u=t.andln(3)+o&3;3===d&&(d=-1),3===u&&(u=-1),c=0==(1&d)?0:3!==(a=e.andln(7)+n&7)&&5!==a||2!==u?d:-d,r[0].push(c),s=0==(1&u)?0:3!==(a=t.andln(7)+o&7)&&5!==a||2!==d?u:-u,r[1].push(s),2*n===c+1&&(n=1-n),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},a.cachedProperty=function cachedProperty(e,t,r){var a="_"+t;e.prototype[t]=function cachedProperty(){return void 0!==this[a]?this[a]:this[a]=r.call(this)}},a.parseBytes=function parseBytes(e){return"string"==typeof e?a.toArray(e,"hex"):e},a.intFromLE=function intFromLE(e){return new n(e,"hex","le")}},(e,t,r)=>{"use strict";var a=r(3).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.baToJSON=t.addHexPrefix=t.toUnsigned=t.fromSigned=t.bufferToHex=t.bufferToInt=t.toBuffer=t.stripZeros=t.unpad=t.setLengthRight=t.setLength=t.setLengthLeft=t.zeros=void 0;var n=r(91),o=r(128);t.zeros=function(e){return a.allocUnsafe(e).fill(0)},t.setLengthLeft=function(e,r,a){void 0===a&&(a=!1);var n=t.zeros(r);return e=t.toBuffer(e),a?e.length0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e},t.stripZeros=t.unpad,t.toBuffer=function(e){if(!a.isBuffer(e))if(Array.isArray(e))e=a.from(e);else if("string"==typeof e){if(!n.isHexString(e))throw new Error("Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: "+e);e=a.from(n.padToEven(n.stripHexPrefix(e)),"hex")}else if("number"==typeof e)e=n.intToBuffer(e);else if(null==e)e=a.allocUnsafe(0);else if(o.isBN(e))e=e.toArrayLike(a);else{if(!e.toArray)throw new Error("invalid type");e=a.from(e.toArray())}return e},t.bufferToInt=function(e){return new o(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return"0x"+(e=t.toBuffer(e)).toString("hex")},t.fromSigned=function(e){return new o(e).fromTwos(256)},t.toUnsigned=function(e){return a.from(e.toTwos(256).toArray())},t.addHexPrefix=function(e){return"string"!=typeof e||n.isHexPrefixed(e)?e:"0x"+e},t.baToJSON=function(e){if(a.isBuffer(e))return"0x"+e.toString("hex");if(e instanceof Array){for(var r=[],n=0;n0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e};t.unpadBuffer=function(e){return s.assertIsBuffer(e),stripZeros(e)},t.unpadArray=function(e){return s.assertIsArray(e),stripZeros(e)},t.unpadHexString=function(e){return s.assertIsHexString(e),e=c.stripHexPrefix(e),stripZeros(e)},t.toBuffer=function(e){if(null==e)return a.allocUnsafe(0);if(a.isBuffer(e))return a.from(e);if(Array.isArray(e)||e instanceof Uint8Array)return a.from(e);if("string"==typeof e){if(!c.isHexString(e))throw new Error(`Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ${e}`);return a.from(c.padToEven(c.stripHexPrefix(e)),"hex")}if("number"==typeof e)return c.intToBuffer(e);if(o.default.isBN(e))return e.toArrayLike(a);if(e.toArray)return a.from(e.toArray());if(e.toBuffer)return a.from(e.toBuffer());throw new Error("invalid type")},t.bufferToInt=function(e){return new o.default(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return"0x"+(e=t.toBuffer(e)).toString("hex")},t.fromSigned=function(e){return new o.default(e).fromTwos(256)},t.toUnsigned=function(e){return a.from(e.toTwos(256).toArray())},t.addHexPrefix=function(e){return"string"!=typeof e||c.isHexPrefixed(e)?e:"0x"+e},t.baToJSON=function(e){if(a.isBuffer(e))return`0x${e.toString("hex")}`;if(e instanceof Array){const r=[];for(let a=0;a{"use strict";var a=r(2).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.decode=t.encodeLength=t.encode=t.digest=t.encodeRange=t.getLength=void 0;const n=r(1246);Object.defineProperty(t,"getLength",{enumerable:!0,get:function(){return n.getLength}});const o=r(8);function encode(e){if(Array.isArray(e)){let t=0;const r=[];for(let a=0,n=e.length;a{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Address=void 0;const a=r(8);class Address extends a.Data{constructor(e){super(e,Address.ByteLength)}static from(e){return new Address(e)}}t.Address=Address,Address.ByteLength=20},function(e,t,r){"use strict";var a=r(5).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.baToJSON=t.addHexPrefix=t.toUnsigned=t.fromSigned=t.bufferToHex=t.bufferToInt=t.toBuffer=t.unpadHexString=t.unpadArray=t.unpadBuffer=t.setLengthRight=t.setLengthLeft=t.zeros=void 0;const o=n(r(131)),c=r(187),s=r(347);t.zeros=function(e){return a.allocUnsafe(e).fill(0)};const setLength=function(e,r,a){const n=t.zeros(r);return a?e.length0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e};t.unpadBuffer=function(e){return s.assertIsBuffer(e),stripZeros(e)},t.unpadArray=function(e){return s.assertIsArray(e),stripZeros(e)},t.unpadHexString=function(e){return s.assertIsHexString(e),e=c.stripHexPrefix(e),stripZeros(e)},t.toBuffer=function(e){if(null==e)return a.allocUnsafe(0);if(a.isBuffer(e))return a.from(e);if(Array.isArray(e)||e instanceof Uint8Array)return a.from(e);if("string"==typeof e){if(!c.isHexString(e))throw new Error(`Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ${e}`);return a.from(c.padToEven(c.stripHexPrefix(e)),"hex")}if("number"==typeof e)return c.intToBuffer(e);if(o.default.isBN(e))return e.toArrayLike(a);if(e.toArray)return a.from(e.toArray());if(e.toBuffer)return a.from(e.toBuffer());throw new Error("invalid type")},t.bufferToInt=function(e){return new o.default(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return"0x"+(e=t.toBuffer(e)).toString("hex")},t.fromSigned=function(e){return new o.default(e).fromTwos(256)},t.toUnsigned=function(e){return a.from(e.toTwos(256).toArray())},t.addHexPrefix=function(e){return"string"!=typeof e||c.isHexPrefixed(e)?e:"0x"+e},t.baToJSON=function(e){if(a.isBuffer(e))return`0x${e.toString("hex")}`;if(e instanceof Array){const r=[];for(let a=0;a{"use strict";var a=t,n=r(101),o=r(161),c=r(516);a.assert=o,a.toArray=c.toArray,a.zero2=c.zero2,a.toHex=c.toHex,a.encode=c.encode,a.getNAF=function getNAF(e,t,r){var a=new Array(Math.max(e.bitLength(),r)+1);a.fill(0);for(var n=1<(n>>1)-1?(n>>1)-d:d,o.isubn(s)):s=0,a[c]=s,o.iushrn(1)}return a},a.getJSF=function getJSF(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var a,n=0,o=0;e.cmpn(-n)>0||t.cmpn(-o)>0;){var c,s,d=e.andln(3)+n&3,u=t.andln(3)+o&3;3===d&&(d=-1),3===u&&(u=-1),c=0==(1&d)?0:3!==(a=e.andln(7)+n&7)&&5!==a||2!==u?d:-d,r[0].push(c),s=0==(1&u)?0:3!==(a=t.andln(7)+o&7)&&5!==a||2!==d?u:-u,r[1].push(s),2*n===c+1&&(n=1-n),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},a.cachedProperty=function cachedProperty(e,t,r){var a="_"+t;e.prototype[t]=function cachedProperty(){return void 0!==this[a]?this[a]:this[a]=r.call(this)}},a.parseBytes=function parseBytes(e){return"string"==typeof e?a.toArray(e,"hex"):e},a.intFromLE=function intFromLE(e){return new n(e,"hex","le")}},function(e,t,r){"use strict";var a=r(2).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.baToJSON=t.addHexPrefix=t.toUnsigned=t.fromSigned=t.bufferToHex=t.bufferToInt=t.toBuffer=t.unpadHexString=t.unpadArray=t.unpadBuffer=t.setLengthRight=t.setLengthLeft=t.zeros=void 0;const o=n(r(133)),c=r(191),s=r(354);t.zeros=function(e){return a.allocUnsafe(e).fill(0)};const setLength=function(e,r,a){const n=t.zeros(r);return a?e.length0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e};t.unpadBuffer=function(e){return s.assertIsBuffer(e),stripZeros(e)},t.unpadArray=function(e){return s.assertIsArray(e),stripZeros(e)},t.unpadHexString=function(e){return s.assertIsHexString(e),e=c.stripHexPrefix(e),stripZeros(e)},t.toBuffer=function(e){if(null==e)return a.allocUnsafe(0);if(a.isBuffer(e))return a.from(e);if(Array.isArray(e)||e instanceof Uint8Array)return a.from(e);if("string"==typeof e){if(!c.isHexString(e))throw new Error(`Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ${e}`);return a.from(c.padToEven(c.stripHexPrefix(e)),"hex")}if("number"==typeof e)return c.intToBuffer(e);if(o.default.isBN(e))return e.toArrayLike(a);if(e.toArray)return a.from(e.toArray());if(e.toBuffer)return a.from(e.toBuffer());throw new Error("invalid type")},t.bufferToInt=function(e){return new o.default(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return"0x"+(e=t.toBuffer(e)).toString("hex")},t.fromSigned=function(e){return new o.default(e).fromTwos(256)},t.toUnsigned=function(e){return a.from(e.toTwos(256).toArray())},t.addHexPrefix=function(e){return"string"!=typeof e||c.isHexPrefixed(e)?e:"0x"+e},t.baToJSON=function(e){if(a.isBuffer(e))return`0x${e.toString("hex")}`;if(e instanceof Array){const r=[];for(let a=0;a{"use strict";var a=t,n=r(102),o=r(163),c=r(535);a.assert=o,a.toArray=c.toArray,a.zero2=c.zero2,a.toHex=c.toHex,a.encode=c.encode,a.getNAF=function getNAF(e,t,r){var a=new Array(Math.max(e.bitLength(),r)+1);a.fill(0);for(var n=1<(n>>1)-1?(n>>1)-d:d,o.isubn(s)):s=0,a[c]=s,o.iushrn(1)}return a},a.getJSF=function getJSF(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var a,n=0,o=0;e.cmpn(-n)>0||t.cmpn(-o)>0;){var c,s,d=e.andln(3)+n&3,u=t.andln(3)+o&3;3===d&&(d=-1),3===u&&(u=-1),c=0==(1&d)?0:3!==(a=e.andln(7)+n&7)&&5!==a||2!==u?d:-d,r[0].push(c),s=0==(1&u)?0:3!==(a=t.andln(7)+o&7)&&5!==a||2!==d?u:-u,r[1].push(s),2*n===c+1&&(n=1-n),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},a.cachedProperty=function cachedProperty(e,t,r){var a="_"+t;e.prototype[t]=function cachedProperty(){return void 0!==this[a]?this[a]:this[a]=r.call(this)}},a.parseBytes=function parseBytes(e){return"string"==typeof e?a.toArray(e,"hex"):e},a.intFromLE=function intFromLE(e){return new n(e,"hex","le")}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.baToJSON=t.addHexPrefix=t.toUnsigned=t.fromSigned=t.bufferToHex=t.bufferToInt=t.toBuffer=t.unpadHexString=t.unpadArray=t.unpadBuffer=t.setLengthRight=t.setLengthLeft=t.zeros=void 0;const o=n(r(12)),c=r(17),s=r(359);t.zeros=function(e){return a.allocUnsafe(e).fill(0)};const setLength=function(e,r,a){const n=t.zeros(r);return a?e.length0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e};t.unpadBuffer=function(e){return s.assertIsBuffer(e),stripZeros(e)},t.unpadArray=function(e){return s.assertIsArray(e),stripZeros(e)},t.unpadHexString=function(e){return s.assertIsHexString(e),e=c.stripHexPrefix(e),stripZeros(e)},t.toBuffer=function(e){if(null==e)return a.allocUnsafe(0);if(a.isBuffer(e))return a.from(e);if(Array.isArray(e)||e instanceof Uint8Array)return a.from(e);if("string"==typeof e){if(!c.isHexString(e))throw new Error(`Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ${e}`);return a.from(c.padToEven(c.stripHexPrefix(e)),"hex")}if("number"==typeof e)return c.intToBuffer(e);if(o.default.isBN(e))return e.toArrayLike(a);if(e.toArray)return a.from(e.toArray());if(e.toBuffer)return a.from(e.toBuffer());throw new Error("invalid type")},t.bufferToInt=function(e){return new o.default(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return"0x"+(e=t.toBuffer(e)).toString("hex")},t.fromSigned=function(e){return new o.default(e).fromTwos(256)},t.toUnsigned=function(e){return a.from(e.toTwos(256).toArray())},t.addHexPrefix=function(e){return"string"!=typeof e||c.isHexPrefixed(e)?e:"0x"+e},t.baToJSON=function(e){if(a.isBuffer(e))return`0x${e.toString("hex")}`;if(e instanceof Array){const r=[];for(let a=0;a{"use strict";var a=t,n=r(103),o=r(164),c=r(557);a.assert=o,a.toArray=c.toArray,a.zero2=c.zero2,a.toHex=c.toHex,a.encode=c.encode,a.getNAF=function getNAF(e,t,r){var a=new Array(Math.max(e.bitLength(),r)+1);a.fill(0);for(var n=1<(n>>1)-1?(n>>1)-d:d,o.isubn(s)):s=0,a[c]=s,o.iushrn(1)}return a},a.getJSF=function getJSF(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var a,n=0,o=0;e.cmpn(-n)>0||t.cmpn(-o)>0;){var c,s,d=e.andln(3)+n&3,u=t.andln(3)+o&3;3===d&&(d=-1),3===u&&(u=-1),c=0==(1&d)?0:3!==(a=e.andln(7)+n&7)&&5!==a||2!==u?d:-d,r[0].push(c),s=0==(1&u)?0:3!==(a=t.andln(7)+o&7)&&5!==a||2!==d?u:-u,r[1].push(s),2*n===c+1&&(n=1-n),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},a.cachedProperty=function cachedProperty(e,t,r){var a="_"+t;e.prototype[t]=function cachedProperty(){return void 0!==this[a]?this[a]:this[a]=r.call(this)}},a.parseBytes=function parseBytes(e){return"string"==typeof e?a.toArray(e,"hex"):e},a.intFromLE=function intFromLE(e){return new n(e,"hex","le")}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.EthereumOptionsConfig=t.EthereumDefaults=void 0;const o=r(980),c=r(981),s=r(982),d=r(983),u=r(368),h=r(1001),l=r(55);t.EthereumDefaults={chain:o.ChainOptions,database:c.DatabaseOptions,logging:s.LoggingOptions,miner:d.MinerOptions,wallet:u.WalletOptions,fork:h.ForkOptions},t.EthereumOptionsConfig=new l.OptionsConfig(t.EthereumDefaults),n(r(980),t),n(r(981),t),n(r(199),t),n(r(982),t),n(r(983),t),n(r(368),t),n(r(1001),t)},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.baToJSON=t.addHexPrefix=t.toUnsigned=t.fromSigned=t.bufferToHex=t.bufferToInt=t.toBuffer=t.unpadHexString=t.unpadArray=t.unpadBuffer=t.setLengthRight=t.setLengthLeft=t.zeros=void 0;var o=n(r(12)),c=r(17),s=r(373);t.zeros=function(e){return a.allocUnsafe(e).fill(0)};var setLength=function(e,r,a){var n=t.zeros(r);return a?e.length0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e};t.unpadBuffer=function(e){return s.assertIsBuffer(e),stripZeros(e)},t.unpadArray=function(e){return s.assertIsArray(e),stripZeros(e)},t.unpadHexString=function(e){return s.assertIsHexString(e),e=c.stripHexPrefix(e),stripZeros(e)},t.toBuffer=function(e){if(null==e)return a.allocUnsafe(0);if(a.isBuffer(e))return a.from(e);if(Array.isArray(e)||e instanceof Uint8Array)return a.from(e);if("string"==typeof e){if(!c.isHexString(e))throw new Error("Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: "+e);return a.from(c.padToEven(c.stripHexPrefix(e)),"hex")}if("number"==typeof e)return c.intToBuffer(e);if(o.default.isBN(e))return e.toArrayLike(a);if(e.toArray)return a.from(e.toArray());if(e.toBuffer)return a.from(e.toBuffer());throw new Error("invalid type")},t.bufferToInt=function(e){return new o.default(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return"0x"+(e=t.toBuffer(e)).toString("hex")},t.fromSigned=function(e){return new o.default(e).fromTwos(256)},t.toUnsigned=function(e){return a.from(e.toTwos(256).toArray())},t.addHexPrefix=function(e){return"string"!=typeof e||c.isHexPrefixed(e)?e:"0x"+e},t.baToJSON=function(e){if(a.isBuffer(e))return"0x"+e.toString("hex");if(e instanceof Array){for(var r=[],n=0;n0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e};t.unpadBuffer=function(e){return s.assertIsBuffer(e),stripZeros(e)},t.unpadArray=function(e){return s.assertIsArray(e),stripZeros(e)},t.unpadHexString=function(e){return s.assertIsHexString(e),e=c.stripHexPrefix(e),stripZeros(e)},t.toBuffer=function(e){if(null==e)return a.allocUnsafe(0);if(a.isBuffer(e))return a.from(e);if(Array.isArray(e)||e instanceof Uint8Array)return a.from(e);if("string"==typeof e){if(!c.isHexString(e))throw new Error("Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: "+e);return a.from(c.padToEven(c.stripHexPrefix(e)),"hex")}if("number"==typeof e)return c.intToBuffer(e);if(o.default.isBN(e))return e.toArrayLike(a);if(e.toArray)return a.from(e.toArray());if(e.toBuffer)return a.from(e.toBuffer());throw new Error("invalid type")},t.bufferToInt=function(e){return new o.default(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return"0x"+(e=t.toBuffer(e)).toString("hex")},t.fromSigned=function(e){return new o.default(e).fromTwos(256)},t.toUnsigned=function(e){return a.from(e.toTwos(256).toArray())},t.addHexPrefix=function(e){return"string"!=typeof e||c.isHexPrefixed(e)?e:"0x"+e},t.baToJSON=function(e){if(a.isBuffer(e))return"0x"+e.toString("hex");if(e instanceof Array){for(var r=[],n=0;n0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},c=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),c=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)c.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return c},s=this&&this.__spread||function(){for(var e=[],t=0;t1},Blockchain.prototype.cliqueSaveGenesisSigners=function(e){return a(this,void 0,void 0,(function(){var t;return n(this,(function(r){switch(r.label){case 0:return t=[new l.BN(0),e.header.cliqueEpochTransitionSigners()],[4,this.cliqueUpdateSignerStates(t)];case 1:return r.sent(),x("[Block 0] Genesis block -> update signer states"),[4,this.cliqueUpdateVotes()];case 2:return r.sent(),[2]}}))}))},Blockchain.prototype.cliqueUpdateSignerStates=function(e){var t;return a(this,void 0,void 0,(function(){var r,a,c,s,d,u,h,b,g,p,B,y,C,v;return n(this,(function(n){switch(n.label){case 0:return r=[],e&&this._cliqueLatestSignerStates.push(e),a=this.CLIQUE_SIGNER_HISTORY_BLOCK_LIMIT,c=this._cliqueLatestBlockSigners,(s=null===(t=c[c.length-1])||void 0===t?void 0:t[0])&&(d=s.subn(a),u=this._cliqueLatestSignerStates,h=u[u.length-1],this._cliqueLatestSignerStates=u.filter((function(e){return e[0].gte(d)})),0===this._cliqueLatestSignerStates.length&&this._cliqueLatestSignerStates.push(h)),b=this._cliqueLatestSignerStates.map((function(e){return[e[0].toBuffer(),e[1].map((function(e){return e.toBuffer()}))]})),r.push(m.DBOp.set(I.DBTarget.CliqueSignerStates,l.rlp.encode(b))),[4,this.dbManager.batch(r)];case 1:n.sent(),g=0;try{for(p=o(this.cliqueActiveSigners()),B=p.next();!B.done;B=p.next())y=B.value,x("Clique signer ["+g+"]: "+y),g++}catch(e){C={error:e}}finally{try{B&&!B.done&&(v=p.return)&&v.call(p)}finally{if(C)throw C.error}}return[2]}}))}))},Blockchain.prototype.cliqueUpdateVotes=function(e){var t;return a(this,void 0,void 0,(function(){var r,a,c,s,d,u,h,b,g,p,B,C,v,Q,w;return n(this,(function(_){switch(_.label){case 0:if(!e||e.coinbase.isZero())return[3,4];r=e.cliqueSigner(),a=e.coinbase,c=e.nonce,s=[e.number,[r,a,c]],d=function(t){var d,h,b,g,p,B,m,I,C,v,Q,w,_,k,N,D,U,G,T,L,q;return n(this,(function(n){switch(n.label){case 0:d=e.number.sub(e.number.mod(new l.BN(u._common.consensusConfig().epoch))),h=u.cliqueSignerLimit(),b=u.cliqueActiveSigners(),g=!1,p=u._cliqueLatestVotes.filter((function(e){return e[0].gte(d)&&!e[1][0].equals(r)&&e[1][1].equals(a)&&e[1][2].equals(y.CLIQUE_NONCE_AUTH)})),B=[],m=function(e){0===B.filter((function(t){return t.equals(e[1][0])})).length&&B.push(e[1][0])};try{for(G=void 0,I=o(p),C=I.next();!C.done;C=I.next())N=C.value,m(N)}catch(e){G={error:e}}finally{try{C&&!C.done&&(T=I.return)&&T.call(I)}finally{if(G)throw G.error}}v=B.length,2===t&&c.equals(y.CLIQUE_NONCE_AUTH)&&(v+=1),v>=h&&(g=!0,b.push(a),b.sort((function(e,t){return e.toBuffer().compare(t.toBuffer())})),u._cliqueLatestVotes=u._cliqueLatestVotes.filter((function(e){return!e[1][1].equals(a)})),x("[Block "+e.number.toNumber()+"] Clique majority consensus (AUTH "+a+")")),p=u._cliqueLatestVotes.filter((function(e){return e[0].gte(d)&&!e[1][0].equals(r)&&e[1][1].equals(a)&&e[1][2].equals(y.CLIQUE_NONCE_DROP)})),Q=[],w=function(e){0===Q.filter((function(t){return t.equals(e[1][0])})).length&&Q.push(e[1][0])};try{for(L=void 0,_=o(p),k=_.next();!k.done;k=_.next())N=k.value,w(N)}catch(e){L={error:e}}finally{try{k&&!k.done&&(q=_.return)&&q.call(_)}finally{if(L)throw L.error}}return D=Q.length,2===t&&c.equals(y.CLIQUE_NONCE_DROP)&&(D+=1),D>=h&&(g=!0,b=b.filter((function(e){return!e.equals(a)})),u._cliqueLatestVotes=u._cliqueLatestVotes.filter((function(e){return!e[1][0].equals(a)&&!e[1][1].equals(a)})),x("[Block "+e.number.toNumber()+"] Clique majority consensus (DROP "+a+")")),1===t&&(u._cliqueLatestVotes.push(s),x("[Block "+e.number.toNumber()+"] New clique vote: "+r+" -> "+a+" "+(c.equals(y.CLIQUE_NONCE_AUTH)?"AUTH":"DROP"))),g?(x(1===t?"[Block "+e.number.toNumber()+"] Clique majority consensus on existing votes -> update signer states":"[Block "+e.number.toNumber()+"] Clique majority consensus on new vote -> update signer states"),U=[e.number,b],[4,u.cliqueUpdateSignerStates(U)]):[3,2];case 1:return n.sent(),[2,{value:void 0}];case 2:return[2]}}))},u=this,h=1,_.label=1;case 1:return h<=2?[5,d(h)]:[3,4];case 2:if("object"==typeof(b=_.sent()))return[2,b.value];_.label=3;case 3:return h++,[3,1];case 4:return g=this.CLIQUE_SIGNER_HISTORY_BLOCK_LIMIT,p=this._cliqueLatestBlockSigners,(B=null===(t=p[p.length-1])||void 0===t?void 0:t[0])&&(C=B.sub(B.mod(new l.BN(this._common.consensusConfig().epoch))),v=C.subn(g),this._cliqueLatestVotes=this._cliqueLatestVotes.filter((function(e){return e[0].gte(v)}))),Q=[],w=this._cliqueLatestVotes.map((function(e){return[e[0].toBuffer(),[e[1][0].toBuffer(),e[1][1].toBuffer(),e[1][2]]]})),Q.push(m.DBOp.set(I.DBTarget.CliqueVotes,l.rlp.encode(w))),[4,this.dbManager.batch(Q)];case 5:return _.sent(),[2]}}))}))},Blockchain.prototype.cliqueUpdateLatestBlockSigners=function(e){return a(this,void 0,void 0,(function(){var t,r,a,o,c;return n(this,(function(n){switch(n.label){case 0:if(t=[],e){if(e.isGenesis())return[2];r=[e.number,e.cliqueSigner()],this._cliqueLatestBlockSigners.push(r),a=this._cliqueLatestBlockSigners.length,o=this.cliqueSignerLimit(),a>o&&(this._cliqueLatestBlockSigners=this._cliqueLatestBlockSigners.slice(a-o,a))}return c=this._cliqueLatestBlockSigners.map((function(e){return[e[0].toBuffer(),e[1].toBuffer()]})),t.push(m.DBOp.set(I.DBTarget.CliqueBlockSigners,l.rlp.encode(c))),[4,this.dbManager.batch(t)];case 1:return n.sent(),[2]}}))}))},Blockchain.prototype.cliqueActiveSigners=function(){this._requireClique();var e=this._cliqueLatestSignerStates;return s(e[e.length-1][1])},Blockchain.prototype.cliqueSignerLimit=function(){return Math.floor(this.cliqueActiveSigners().length/2)+1},Blockchain.prototype.getIteratorHead=function(e){return void 0===e&&(e="vm"),a(this,void 0,void 0,(function(){var t=this;return n(this,(function(r){switch(r.label){case 0:return[4,this.initAndLock((function(){return a(t,void 0,void 0,(function(){var t;return n(this,(function(r){switch(r.label){case 0:if(!(t=this._heads[e]||this._genesis))throw new Error("No head found.");return[4,this._getBlock(t)];case 1:return[2,r.sent()]}}))}))}))];case 1:return[2,r.sent()]}}))}))},Blockchain.prototype.getHead=function(e){return void 0===e&&(e="vm"),a(this,void 0,void 0,(function(){var t=this;return n(this,(function(r){switch(r.label){case 0:return[4,this.initAndLock((function(){return a(t,void 0,void 0,(function(){var t;return n(this,(function(r){switch(r.label){case 0:if(!(t=this._heads[e]||this._headBlockHash))throw new Error("No head found.");return[4,this._getBlock(t)];case 1:return[2,r.sent()]}}))}))}))];case 1:return[2,r.sent()]}}))}))},Blockchain.prototype.getLatestHeader=function(){return a(this,void 0,void 0,(function(){var e=this;return n(this,(function(t){switch(t.label){case 0:return[4,this.initAndLock((function(){return a(e,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:if(!this._headHeaderHash)throw new Error("No head header set");return[4,this._getBlock(this._headHeaderHash)];case 1:return[2,e.sent().header]}}))}))}))];case 1:return[2,t.sent()]}}))}))},Blockchain.prototype.getLatestBlock=function(){return a(this,void 0,void 0,(function(){var e=this;return n(this,(function(t){return[2,this.initAndLock((function(){return a(e,void 0,void 0,(function(){return n(this,(function(e){if(!this._headBlockHash)throw new Error("No head block set");return[2,this._getBlock(this._headBlockHash)]}))}))}))]}))}))},Blockchain.prototype.putBlocks=function(e){return a(this,void 0,void 0,(function(){var t;return n(this,(function(r){switch(r.label){case 0:return[4,this.initPromise];case 1:r.sent(),t=0,r.label=2;case 2:return t=a))return[3,6];o=void 0,n.label=2;case 2:return n.trys.push([2,4,,5]),[4,this.dbManager.hashToNumber(e[r])];case 3:return o=n.sent(),[3,5];case 4:if("NotFoundError"!==(c=n.sent()).type)throw c;return[3,5];case 5:return o?a=r+1:t=r-1,r=Math.floor((a+t)/2),[3,1];case 6:return[2,e.slice(a)]}}))}))}))];case 1:return[2,r.sent()]}}))}))},Blockchain.prototype.delBlock=function(e){return a(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,this.initPromise];case 1:return t.sent(),[4,this._delBlock(e)];case 2:return t.sent(),[2]}}))}))},Blockchain.prototype._delBlock=function(e){return a(this,void 0,void 0,(function(){var t,r,a,o,c,s,d;return n(this,(function(n){switch(n.label){case 0:return t=[],[4,this._getHeader(e)];case 1:return r=n.sent(),o=(a=r).number,c=a.parentHash,[4,this.safeNumberToHash(o)];case 2:return s=n.sent(),d=!!s&&s.equals(e),[4,this._delChild(e,o,d?c:null,t)];case 3:return n.sent(),d?[4,this._deleteCanonicalChainReferences(o,c,t)]:[3,5];case 4:n.sent(),n.label=5;case 5:return[4,this.dbManager.batch(t)];case 6:return n.sent(),[2]}}))}))},Blockchain.prototype._delChild=function(e,t,r,o){var c,s;return a(this,void 0,void 0,(function(){var a,d;return n(this,(function(n){switch(n.label){case 0:if(o.push(m.DBOp.del(I.DBTarget.Header,{blockHash:e,blockNumber:t})),o.push(m.DBOp.del(I.DBTarget.Body,{blockHash:e,blockNumber:t})),o.push(m.DBOp.del(I.DBTarget.HashToNumber,{blockHash:e})),o.push(m.DBOp.del(I.DBTarget.TotalDifficulty,{blockHash:e,blockNumber:t})),!r)return[2];(null===(c=this._headHeaderHash)||void 0===c?void 0:c.equals(e))&&(this._headHeaderHash=r),(null===(s=this._headBlockHash)||void 0===s?void 0:s.equals(e))&&(this._headBlockHash=r),n.label=1;case 1:return n.trys.push([1,4,,5]),[4,this._getCanonicalHeader(t.addn(1))];case 2:return a=n.sent(),[4,this._delChild(a.hash(),a.number,r,o)];case 3:return n.sent(),[3,5];case 4:if("NotFoundError"!==(d=n.sent()).type)throw d;return[3,5];case 5:return[2]}}))}))},Blockchain.prototype.iterator=function(e,t,r){return a(this,void 0,void 0,(function(){return n(this,(function(a){return[2,this._iterator(e,t,r)]}))}))},Blockchain.prototype._iterator=function(e,t,r){return a(this,void 0,void 0,(function(){var o=this;return n(this,(function(c){switch(c.label){case 0:return[4,this.initAndLock((function(){return a(o,void 0,void 0,(function(){var a,o,c,s,d,u,h,l;return n(this,(function(n){switch(n.label){case 0:if(!(a=this._heads[e]||this._genesis))return[2,0];if(r&&r<0)throw"If maxBlocks is provided, it has to be a non-negative number";return[4,this.dbManager.hashToNumber(a)];case 1:c=n.sent(),s=c.addn(1),d=0,n.label=2;case 2:if(r===d)return[3,8];n.label=3;case 3:return n.trys.push([3,6,,7]),[4,this._getBlock(s)];case 4:return u=n.sent(),this._heads[e]=u.hash(),h=!!o&&o.hash().equals(u.header.parentHash),o=u,[4,t(u,h)];case 5:return n.sent(),s.iaddn(1),d++,[3,7];case 6:if("NotFoundError"===(l=n.sent()).type)return[3,8];throw l;case 7:return[3,2];case 8:return[4,this._saveHeads()];case 9:return n.sent(),[2,d]}}))}))}))];case 1:return[2,c.sent()]}}))}))},Blockchain.prototype.setIteratorHead=function(e,t){return a(this,void 0,void 0,(function(){return n(this,(function(r){switch(r.label){case 0:return[4,this.setHead(e,t)];case 1:return[2,r.sent()]}}))}))},Blockchain.prototype.setHead=function(e,t){return a(this,void 0,void 0,(function(){var r=this;return n(this,(function(o){switch(o.label){case 0:return[4,this.initAndLock((function(){return a(r,void 0,void 0,(function(){return n(this,(function(r){switch(r.label){case 0:return this._heads[e]=t,[4,this._saveHeads()];case 1:return r.sent(),[2]}}))}))}))];case 1:return o.sent(),[2]}}))}))},Blockchain.prototype._findAncient=function(e){return a(this,void 0,void 0,(function(){var t;return n(this,(function(r){switch(r.label){case 0:if(!this._headHeaderHash)throw new Error("No head header set");return[4,this._getBlock(this._headHeaderHash)];case 1:return(t=r.sent().header).number.gt(e.number)?[4,this._getCanonicalHeader(e.number)]:[3,3];case 2:return t=r.sent(),[3,5];case 3:return t.number.eq(e.number)||!e.number.gtn(0)?[3,5]:[4,this._getHeader(e.parentHash,e.number.subn(1))];case 4:return e=r.sent(),[3,3];case 5:if(!t.number.eq(e.number))throw new Error("Failed to find ancient header");r.label=6;case 6:return t.hash().equals(e.hash())||!t.number.gtn(0)?[3,9]:[4,this._getCanonicalHeader(t.number.subn(1))];case 7:return t=r.sent(),[4,this._getHeader(e.parentHash,e.number.subn(1))];case 8:return e=r.sent(),[3,6];case 9:if(!t.hash().equals(e.hash()))throw new Error("Failed to find ancient header");return[2,t]}}))}))},Blockchain.prototype._cliqueBuildSnapshots=function(e){return a(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return e.cliqueIsEpochTransition()?[3,2]:[4,this.cliqueUpdateVotes(e)];case 1:t.sent(),t.label=2;case 2:return[4,this.cliqueUpdateLatestBlockSigners(e)];case 3:return t.sent(),[2]}}))}))},Blockchain.prototype._cliqueDeleteSnapshots=function(e){return a(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return this._cliqueLatestSignerStates=this._cliqueLatestSignerStates.filter((function(t){return t[0].lte(e)})),[4,this.cliqueUpdateSignerStates()];case 1:return t.sent(),this._cliqueLatestVotes=this._cliqueLatestVotes.filter((function(t){return t[0].lte(e)})),[4,this.cliqueUpdateVotes()];case 2:return t.sent(),this._cliqueLatestBlockSigners=this._cliqueLatestBlockSigners.filter((function(t){return t[0].lte(e)})),[4,this.cliqueUpdateLatestBlockSigners()];case 3:return t.sent(),[2]}}))}))},Blockchain.prototype._deleteCanonicalChainReferences=function(e,t,r){var o;return a(this,void 0,void 0,(function(){var a,c=this;return n(this,(function(n){switch(n.label){case 0:return e=e.clone(),[4,this.safeNumberToHash(e)];case 1:a=n.sent(),n.label=2;case 2:return a?(r.push(m.DBOp.del(I.DBTarget.NumberToHash,{blockNumber:e})),Object.keys(this._heads).forEach((function(e){c._heads[e].equals(a)&&(c._heads[e]=t)})),(null===(o=this._headBlockHash)||void 0===o?void 0:o.equals(a))&&(this._headBlockHash=t),e.iaddn(1),[4,this.safeNumberToHash(e)]):[3,4];case 3:return a=n.sent(),[3,2];case 4:return[2]}}))}))},Blockchain.prototype._rebuildCanonical=function(e,t){var r;return a(this,void 0,void 0,(function(){var o,c,s,d,u,h,l,b,g,p=this;return n(this,(function(B){switch(B.label){case 0:o=e.number.clone(),c=e.hash(),s=!1,d=[],u=!1,h=function(){return a(p,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,this.safeNumberToHash(o)];case 1:return s=t.sent(),c=e.hash(),[2,!s||!c.equals(s)]}}))}))},B.label=1;case 1:return[4,h()];case 2:if(!B.sent())return[3,7];if(l=e.hash(),b=e.number,m.DBSaveLookups(l,b).map((function(e){t.push(e)})),b.isZero())return[3,7];Object.keys(this._heads).forEach((function(e){s&&p._heads[e].equals(s)&&d.push(e)})),s&&(null===(r=this._headBlockHash)||void 0===r?void 0:r.equals(s))&&(u=!0),o.isubn(1),B.label=3;case 3:return B.trys.push([3,5,,6]),[4,this._getHeader(e.parentHash,o)];case 4:return e=B.sent(),[3,6];case 5:if(g=B.sent(),d=[],"NotFoundError"!==g.type)throw g;return[3,7];case 6:return[3,1];case 7:return d.forEach((function(e){p._heads[e]=c})),u&&(this._headBlockHash=c),[2]}}))}))},Blockchain.prototype._saveHeadOps=function(){return[m.DBOp.set(I.DBTarget.Heads,this._heads),m.DBOp.set(I.DBTarget.HeadHeader,this._headHeaderHash),m.DBOp.set(I.DBTarget.HeadBlock,this._headBlockHash)]},Blockchain.prototype._saveHeads=function(){return a(this,void 0,void 0,(function(){return n(this,(function(e){return[2,this.dbManager.batch(this._saveHeadOps())]}))}))},Blockchain.prototype._getHeader=function(e,t){return a(this,void 0,void 0,(function(){return n(this,(function(r){switch(r.label){case 0:return t?[3,2]:[4,this.dbManager.hashToNumber(e)];case 1:t=r.sent(),r.label=2;case 2:return[2,this.dbManager.getHeader(e,t)]}}))}))},Blockchain.prototype._getCanonicalHeader=function(e){return a(this,void 0,void 0,(function(){var t;return n(this,(function(r){switch(r.label){case 0:return[4,this.dbManager.numberToHash(e)];case 1:return t=r.sent(),[2,this._getHeader(t,e)]}}))}))},Blockchain.prototype.safeNumberToHash=function(e){return a(this,void 0,void 0,(function(){var t;return n(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.dbManager.numberToHash(e)];case 1:return[2,r.sent()];case 2:if("NotFoundError"!==(t=r.sent()).type)throw t;return[2,!1];case 3:return[2]}}))}))},Blockchain}();t.default=v},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.baToJSON=t.addHexPrefix=t.toUnsigned=t.fromSigned=t.bufferToHex=t.bufferToInt=t.toBuffer=t.unpadHexString=t.unpadArray=t.unpadBuffer=t.setLengthRight=t.setLengthLeft=t.zeros=void 0;var o=n(r(12)),c=r(17),s=r(385);t.zeros=function(e){return a.allocUnsafe(e).fill(0)};var setLength=function(e,r,a){var n=t.zeros(r);return a?e.length0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e};t.unpadBuffer=function(e){return s.assertIsBuffer(e),stripZeros(e)},t.unpadArray=function(e){return s.assertIsArray(e),stripZeros(e)},t.unpadHexString=function(e){return s.assertIsHexString(e),e=c.stripHexPrefix(e),stripZeros(e)},t.toBuffer=function(e){if(null==e)return a.allocUnsafe(0);if(a.isBuffer(e))return a.from(e);if(Array.isArray(e)||e instanceof Uint8Array)return a.from(e);if("string"==typeof e){if(!c.isHexString(e))throw new Error("Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: "+e);return a.from(c.padToEven(c.stripHexPrefix(e)),"hex")}if("number"==typeof e)return c.intToBuffer(e);if(o.default.isBN(e))return e.toArrayLike(a);if(e.toArray)return a.from(e.toArray());if(e.toBuffer)return a.from(e.toBuffer());throw new Error("invalid type")},t.bufferToInt=function(e){return new o.default(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return"0x"+(e=t.toBuffer(e)).toString("hex")},t.fromSigned=function(e){return new o.default(e).fromTwos(256)},t.toUnsigned=function(e){return a.from(e.toTwos(256).toArray())},t.addHexPrefix=function(e){return"string"!=typeof e||c.isHexPrefixed(e)?e:"0x"+e},t.baToJSON=function(e){if(a.isBuffer(e))return"0x"+e.toString("hex");if(e instanceof Array){for(var r=[],n=0;n{"use strict";var a=r(1149);e.exports=function Type(e){return"symbol"==typeof e?"Symbol":"bigint"==typeof e?"BigInt":a(e)}},()=>{},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.secp256k1=t.rlp=t.BN=void 0;var o=r(335);t.secp256k1=o;var c=r(91),s=r(128);t.BN=s;var d=r(181);t.rlp=d,Object.assign(t,c),n(r(338),t),n(r(182),t),n(r(278),t),n(r(1240),t),n(r(73),t),n(r(1241),t)},(e,t,r)=>{"use strict";var a=r(3).Buffer,n=r(477),o=r(804);function padToEven(e){var t=e;if("string"!=typeof t)throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof t+", while padToEven.");return t.length%2&&(t="0"+t),t}function intToHex(e){return"0x"+e.toString(16)}e.exports={arrayContainsArray:function arrayContainsArray(e,t,r){if(!0!==Array.isArray(e))throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof e+"'");if(!0!==Array.isArray(t))throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof t+"'");return t[Boolean(r)?"some":"every"]((function(t){return e.indexOf(t)>=0}))},intToBuffer:function intToBuffer(e){var t=intToHex(e);return new a(padToEven(t.slice(2)),"hex")},getBinarySize:function getBinarySize(e){if("string"!=typeof e)throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof e+"'.");return a.byteLength(e,"utf8")},isHexPrefixed:n,stripHexPrefix:o,padToEven,intToHex,fromAscii:function fromAscii(e){for(var t="",r=0;r0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0)&&!(a=o.next()).done;)c.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return c},d=this&&this.__spread||function(){for(var e=[],t=0;t0)&&!(a=o.next()).done;)c.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return c},d=this&&this.__spread||function(){for(var e=[],t=0;t0?this._value:null},set:function(e){this._value=e},enumerable:!1,configurable:!0}),BranchNode.prototype.setBranch=function(e,t){this._branches[e]=t},BranchNode.prototype.raw=function(){return d(this._branches,[this._value])},BranchNode.prototype.serialize=function(){return u.encode(this.raw())},BranchNode.prototype.hash=function(){return h.keccak256(this.serialize())},BranchNode.prototype.getBranch=function(e){var t=this._branches[e];return null!==t&&t.length>0?t:null},BranchNode.prototype.getChildren=function(){for(var e=[],t=0;t<16;t++){var r=this._branches[t];null!==r&&r.length>0&&e.push([t,r])}return e},BranchNode}();t.BranchNode=g;var p=function(){function ExtensionNode(e,t){this._nibbles=e,this._value=t}return ExtensionNode.encodeKey=function(e){return b.addHexPrefix(e,!1)},ExtensionNode.decodeKey=function(e){return b.removeHexPrefix(e)},Object.defineProperty(ExtensionNode.prototype,"key",{get:function(){return this._nibbles.slice(0)},set:function(e){this._nibbles=e},enumerable:!1,configurable:!0}),Object.defineProperty(ExtensionNode.prototype,"value",{get:function(){return this._value},set:function(e){this._value=e},enumerable:!1,configurable:!0}),ExtensionNode.prototype.encodedKey=function(){return ExtensionNode.encodeKey(this._nibbles.slice(0))},ExtensionNode.prototype.raw=function(){return[l.nibblesToBuffer(this.encodedKey()),this._value]},ExtensionNode.prototype.serialize=function(){return u.encode(this.raw())},ExtensionNode.prototype.hash=function(){return h.keccak256(this.serialize())},ExtensionNode}();t.ExtensionNode=p;var B=function(){function LeafNode(e,t){this._nibbles=e,this._value=t}return LeafNode.encodeKey=function(e){return b.addHexPrefix(e,!0)},LeafNode.decodeKey=function(e){return b.removeHexPrefix(e)},Object.defineProperty(LeafNode.prototype,"key",{get:function(){return this._nibbles.slice(0)},set:function(e){this._nibbles=e},enumerable:!1,configurable:!0}),Object.defineProperty(LeafNode.prototype,"value",{get:function(){return this._value},set:function(e){this._value=e},enumerable:!1,configurable:!0}),LeafNode.prototype.encodedKey=function(){return LeafNode.encodeKey(this._nibbles.slice(0))},LeafNode.prototype.raw=function(){return[l.nibblesToBuffer(this.encodedKey()),this._value]},LeafNode.prototype.serialize=function(){return u.encode(this.raw())},LeafNode.prototype.hash=function(){return h.keccak256(this.serialize())},LeafNode}();function decodeRawNode(e){if(17===e.length)return g.fromArray(e);if(2===e.length){var t=l.bufferToNibbles(e[0]);return b.isTerminator(t)?new B(B.decodeKey(t),e[1]):new p(p.decodeKey(t),e[1])}throw new Error("Invalid node")}t.LeafNode=B,t.decodeRawNode=decodeRawNode,t.decodeNode=function decodeNode(e){var t=u.decode(e);if(!Array.isArray(t))throw new Error("Invalid node");return decodeRawNode(t)},t.isRawNode=function isRawNode(e){return Array.isArray(e)&&!a.isBuffer(e)}},function(e,t,r){"use strict";var a,n=r(0).Buffer,o=this&&this.__extends||(a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function __(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),c=this&&this.__assign||function(){return(c=Object.assign||function(e){for(var t,r=1,a=arguments.length;r=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.Hardfork=t.Chain=t.CustomChain=void 0;var d,u,h=r(34),l=r(620),b=r(16),g=r(294),p=r(1387),B=r(1400);!function(e){e.PolygonMainnet="polygon-mainnet",e.PolygonMumbai="polygon-mumbai",e.ArbitrumRinkebyTestnet="arbitrum-rinkeby-testnet",e.xDaiChain="x-dai-chain"}(d=t.CustomChain||(t.CustomChain={})),function(e){e[e.Mainnet=1]="Mainnet",e[e.Ropsten=3]="Ropsten",e[e.Rinkeby=4]="Rinkeby",e[e.Kovan=42]="Kovan",e[e.Goerli=5]="Goerli",e[e.Calaveras=123]="Calaveras"}(t.Chain||(t.Chain={})),function(e){e.Chainstart="chainstart",e.Homestead="homestead",e.Dao="dao",e.TangerineWhistle="tangerineWhistle",e.SpuriousDragon="spuriousDragon",e.Byzantium="byzantium",e.Constantinople="constantinople",e.Petersburg="petersburg",e.Istanbul="istanbul",e.MuirGlacier="muirGlacier",e.Berlin="berlin",e.London="london"}(u=t.Hardfork||(t.Hardfork={}));var m=function(e){function Common(t){var r,a,n=e.call(this)||this;return n._supportedHardforks=[],n._eips=[],n._customChains=null!==(r=t.customChains)&&void 0!==r?r:[],n._chainParams=n.setChain(t.chain),n.DEFAULT_HARDFORK=null!==(a=n._chainParams.defaultHardfork)&&void 0!==a?a:u.Istanbul,n._hardfork=n.DEFAULT_HARDFORK,t.supportedHardforks&&(n._supportedHardforks=t.supportedHardforks),t.hardfork&&n.setHardfork(t.hardfork),t.eips&&n.setEIPs(t.eips),n}return o(Common,e),Common.custom=function(e,t){var r;void 0===t&&(t={});var a=null!==(r=t.baseChain)&&void 0!==r?r:"mainnet",n=c({},Common._getChainParams(a));if(n.name="custom-chain","string"!=typeof e)return new Common(c({chain:c(c({},n),e)},t));if(e===d.PolygonMainnet)return Common.custom({name:d.PolygonMainnet,chainId:137,networkId:137});if(e===d.PolygonMumbai)return Common.custom({name:d.PolygonMumbai,chainId:80001,networkId:80001});if(e===d.ArbitrumRinkebyTestnet)return Common.custom({name:d.ArbitrumRinkebyTestnet,chainId:421611,networkId:421611});if(e===d.xDaiChain)return Common.custom({name:d.xDaiChain,chainId:100,networkId:100});throw new Error("Custom chain "+e+" not supported")},Common.forCustomChain=function(e,t,r,a){var n=Common._getChainParams(e);return new Common({chain:c(c({},n),t),hardfork:r,supportedHardforks:a})},Common.isSupportedChainId=function(e){var t=g._getInitializedChains();return Boolean(t.names[e.toString()])},Common._getChainParams=function(e,t){var r=g._getInitializedChains(t);if("number"==typeof e||b.BN.isBN(e)){if(e=e.toString(),r.names[e])return r[r.names[e]];throw new Error("Chain with ID "+e+" not supported")}if(r[e])return r[e];throw new Error("Chain with name "+e+" not supported")},Common.prototype.setChain=function(e){var t,r;if("number"==typeof e||"string"==typeof e||b.BN.isBN(e))this._chainParams=Common._getChainParams(e,this._customChains);else{if("object"!=typeof e)throw new Error("Wrong input format");if(this._customChains.length>0)throw new Error("Chain must be a string, number, or BN when initialized with customChains passed in");try{for(var a=s(["networkId","genesis","hardforks","bootstrapNodes"]),n=a.next();!n.done;n=a.next()){var o=n.value;if(void 0===e[o])throw new Error("Missing required chain parameter: "+o)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}this._chainParams=e}return this._chainParams},Common.prototype.setHardfork=function(e){var t,r;if(!this._isSupportedHardfork(e))throw new Error("Hardfork "+e+" not set as supported in supportedHardforks");var a=!1;try{for(var n=s(p.hardforks),o=n.next();!o.done;o=n.next()){o.value[0]===e&&(this._hardfork!==e&&(this._hardfork=e,this.emit("hardforkChanged",e)),a=!0)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}if(!a)throw new Error("Hardfork with name "+e+" not supported")},Common.prototype.getHardforkByBlockNumber=function(e){var t,r;e=b.toType(e,b.TypeOutput.BN);var a=u.Chainstart;try{for(var n=s(this.hardforks()),o=n.next();!o.done;o=n.next()){var c=o.value;null!==c.block&&(e.gte(new b.BN(c.block))&&(a=c.name))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return a},Common.prototype.setHardforkByBlockNumber=function(e){e=b.toType(e,b.TypeOutput.BN);var t=this.getHardforkByBlockNumber(e);return this.setHardfork(t),t},Common.prototype._chooseHardfork=function(e,t){if(void 0===t&&(t=!0),e){if(t&&!this._isSupportedHardfork(e))throw new Error("Hardfork "+e+" not set as supported in supportedHardforks")}else e=this._hardfork;return e},Common.prototype._getHardfork=function(e){var t,r,a=this.hardforks();try{for(var n=s(a),o=n.next();!o.done;o=n.next()){var c=o.value;if(c.name===e)return c}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}throw new Error("Hardfork "+e+" not defined for chain "+this.chainName())},Common.prototype._isSupportedHardfork=function(e){var t,r;if(!(this._supportedHardforks.length>0))return!0;try{for(var a=s(this._supportedHardforks),n=a.next();!n.done;n=a.next()){if(e===n.value)return!0}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return!1},Common.prototype.setEIPs=function(e){var t,r,a=this;void 0===e&&(e=[]);var _loop_1=function(t){if(!(t in B.EIPs))throw new Error(t+" not supported");var r=n.gteHardfork(B.EIPs[t].minimumHardfork);if(!r)throw new Error(t+" cannot be activated on hardfork "+n.hardfork()+", minimumHardfork: "+r);B.EIPs[t].requiredEIPs&&B.EIPs[t].requiredEIPs.forEach((function(r){if(!e.includes(r)&&!a.isActivatedEIP(r))throw new Error(t+" requires EIP "+r+", but is not included in the EIP list")}))},n=this;try{for(var o=s(e),c=o.next();!c.done;c=o.next()){_loop_1(c.value)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}this._eips=e},Common.prototype.param=function(e,t){var r,a,n=null;try{for(var o=s(this._eips),c=o.next();!c.done;c=o.next()){var d=c.value;if(null!==(n=this.paramByEIP(e,t,d)))return n}}catch(e){r={error:e}}finally{try{c&&!c.done&&(a=o.return)&&a.call(o)}finally{if(r)throw r.error}}return this.paramByHardfork(e,t,this._hardfork)},Common.prototype.paramByHardfork=function(e,t,r){var a,n,o,c;r=this._chooseHardfork(r);var d=null;try{for(var u=s(p.hardforks),h=u.next();!h.done;h=u.next()){var l=h.value;if(l[1].hasOwnProperty("eips")){var b=l[1].eips;try{for(var g=(o=void 0,s(b)),B=g.next();!B.done;B=g.next()){var m=B.value,I=this.paramByEIP(e,t,m);d=null!==I?I:d}}catch(e){o={error:e}}finally{try{B&&!B.done&&(c=g.return)&&c.call(g)}finally{if(o)throw o.error}}}else{if(!l[1][e])throw new Error("Topic "+e+" not defined");void 0!==l[1][e][t]&&(d=l[1][e][t].v)}if(l[0]===r)break}}catch(e){a={error:e}}finally{try{h&&!h.done&&(n=u.return)&&n.call(u)}finally{if(a)throw a.error}}return d},Common.prototype.paramByEIP=function(e,t,r){if(!(r in B.EIPs))throw new Error(r+" not supported");var a=B.EIPs[r];if(!(e in a))throw new Error("Topic "+e+" not defined");return void 0===a[e][t]?null:a[e][t].v},Common.prototype.paramByBlock=function(e,t,r){var a=this.activeHardforks(r),n=a[a.length-1].name;return this.paramByHardfork(e,t,n)},Common.prototype.isActivatedEIP=function(e){var t,r;if(this.eips().includes(e))return!0;try{for(var a=s(p.hardforks),n=a.next();!n.done;n=a.next()){var o=n.value[1];if(this.gteHardfork(o.name)&&"eips"in o&&o.eips.includes(e))return!0}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return!1},Common.prototype.hardforkIsActiveOnBlock=function(e,t,r){var a;void 0===r&&(r={}),t=b.toType(t,b.TypeOutput.BN);var n=null!==(a=r.onlySupported)&&void 0!==a&&a;e=this._chooseHardfork(e,n);var o=this.hardforkBlockBN(e);return!(!o||!t.gte(o))},Common.prototype.activeOnBlock=function(e,t){return this.hardforkIsActiveOnBlock(null,e,t)},Common.prototype.hardforkGteHardfork=function(e,t,r){var a,n;void 0===r&&(r={});var o,c=void 0!==r.onlyActive&&r.onlyActive;e=this._chooseHardfork(e,r.onlySupported),o=c?this.activeHardforks(null,r):this.hardforks();var d=-1,u=-1,h=0;try{for(var l=s(o),b=l.next();!b.done;b=l.next()){var g=b.value;g.name===e&&(d=h),g.name===t&&(u=h),h+=1}}catch(e){a={error:e}}finally{try{b&&!b.done&&(n=l.return)&&n.call(l)}finally{if(a)throw a.error}}return d>=u&&-1!==u},Common.prototype.gteHardfork=function(e,t){return this.hardforkGteHardfork(null,e,t)},Common.prototype.hardforkIsActiveOnChain=function(e,t){var r,a,n;void 0===t&&(t={});var o=null!==(n=t.onlySupported)&&void 0!==n&&n;e=this._chooseHardfork(e,o);try{for(var c=s(this.hardforks()),d=c.next();!d.done;d=c.next()){var u=d.value;if(u.name===e&&null!==u.block)return!0}}catch(e){r={error:e}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(r)throw r.error}}return!1},Common.prototype.activeHardforks=function(e,t){var r,a;void 0===t&&(t={});var n=[],o=this.hardforks();try{for(var c=s(o),d=c.next();!d.done;d=c.next()){var u=d.value;if(null!==u.block){if(null!=e&&e0)return r[r.length-1].name;throw new Error("No (supported) active hardfork found")},Common.prototype.hardforkBlock=function(e){return b.toType(this.hardforkBlockBN(e),b.TypeOutput.Number)},Common.prototype.hardforkBlockBN=function(e){return e=this._chooseHardfork(e,!1),new b.BN(this._getHardfork(e).block)},Common.prototype.isHardforkBlock=function(e,t){return e=b.toType(e,b.TypeOutput.BN),t=this._chooseHardfork(t,!1),this.hardforkBlockBN(t).eq(e)},Common.prototype.nextHardforkBlock=function(e){var t=this.nextHardforkBlockBN(e);return null===t?null:b.toType(t,b.TypeOutput.Number)},Common.prototype.nextHardforkBlockBN=function(e){e=this._chooseHardfork(e,!1);var t=this.hardforkBlockBN(e);return this.hardforks().reduce((function(e,r){var a=new b.BN(r.block);return a.gt(t)&&null===e?a:e}),null)},Common.prototype.isNextHardforkBlock=function(e,t){e=b.toType(e,b.TypeOutput.BN),t=this._chooseHardfork(t,!1);var r=this.nextHardforkBlockBN(t);return null!==r&&r.eq(e)},Common.prototype._calcForkHash=function(e){var t,r,a=n.from(this.genesis().hash.substr(2),"hex"),o=n.alloc(0),c=0;try{for(var d=s(this.hardforks()),u=d.next();!u.done;u=d.next()){var h=u.value,g=h.block;if(0!==g&&null!==g&&g!==c){var p=n.from(g.toString(16).padStart(16,"0"),"hex");o=n.concat([o,p])}if(h.name===e)break;c=g}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=d.return)&&r.call(d)}finally{if(t)throw t.error}}var B=n.concat([a,o]);return"0x"+b.intToBuffer(l.buf(B)>>>0).toString("hex")},Common.prototype.forkHash=function(e){e=this._chooseHardfork(e,!1);var t=this._getHardfork(e);if(null===t.block){throw new Error("No fork hash calculation possible for non-applied or future hardfork")}return void 0!==t.forkHash?t.forkHash:this._calcForkHash(e)},Common.prototype.hardforkForForkHash=function(e){var t=this.hardforks().filter((function(t){return t.forkHash===e}));return t.length>=1?t[t.length-1]:null},Common.prototype.genesis=function(){return this._chainParams.genesis},Common.prototype.hardforks=function(){return this._chainParams.hardforks},Common.prototype.bootstrapNodes=function(){return this._chainParams.bootstrapNodes},Common.prototype.dnsNetworks=function(){return this._chainParams.dnsNetworks},Common.prototype.hardfork=function(){return this._hardfork},Common.prototype.chainId=function(){return b.toType(this.chainIdBN(),b.TypeOutput.Number)},Common.prototype.chainIdBN=function(){return new b.BN(this._chainParams.chainId)},Common.prototype.chainName=function(){return this._chainParams.name},Common.prototype.networkId=function(){return b.toType(this.networkIdBN(),b.TypeOutput.Number)},Common.prototype.networkIdBN=function(){return new b.BN(this._chainParams.networkId)},Common.prototype.eips=function(){return this._eips},Common.prototype.consensusType=function(){return this._chainParams.consensus.type},Common.prototype.consensusAlgorithm=function(){return this._chainParams.consensus.algorithm},Common.prototype.consensusConfig=function(){return this._chainParams.consensus[this.consensusAlgorithm()]},Common.prototype.copy=function(){return Object.assign(Object.create(Object.getPrototypeOf(this)),this)},Common}(h.EventEmitter);t.default=m},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,a=arguments.length;r0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0)&&!(a=o.next()).done;)c.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return c},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BlockHeader=void 0;var u=d(r(94)),h=r(16),l=r(1413),b=new h.BN(a.from("ffffffffffffff","hex")),g=function(){function BlockHeader(e,t,r,n,o,c,s,d,g,p,B,m,I,y,x,C,v){var Q;if(void 0===C&&(C={}),this._errorPostfix="",C.common)this._common=C.common.copy();else{var w="mainnet";C.initWithGenesisHeader?this._common=new u.default({chain:w,hardfork:"chainstart"}):this._common=new u.default({chain:w})}if(C.hardforkByBlockNumber&&this._common.setHardforkByBlockNumber(g.toNumber()),this._common.isActivatedEIP(1559))void 0===v&&(v=new h.BN(7));else if(v)throw new Error("A base fee for a block can only be set with EIP1559 being activated");if(C.initWithGenesisHeader&&(g=new h.BN(0),p.eq(b)&&(p=new h.BN(h.toBuffer(this._common.genesis().gasLimit))),m.isZero()&&(m=new h.BN(h.toBuffer(this._common.genesis().timestamp))),d.isZero()&&(d=new h.BN(h.toBuffer(this._common.genesis().difficulty))),0===I.length&&(I=h.toBuffer(this._common.genesis().extraData)),x.equals(h.zeros(8))&&(x=h.toBuffer(this._common.genesis().nonce)),n.equals(h.zeros(32))&&(n=h.toBuffer(this._common.genesis().stateRoot))),this.parentHash=e,this.uncleHash=t,this.coinbase=r,this.stateRoot=n,this.transactionsTrie=o,this.receiptTrie=c,this.bloom=s,this.difficulty=d,this.number=g,this.gasLimit=p,this.gasUsed=B,this.timestamp=m,this.extraData=I,this.mixHash=y,this.nonce=x,this.baseFeePerGas=v,this._validateHeaderFields(),this._checkDAOExtraData(),C.calcDifficultyFromHeader&&(this.difficulty=this.canonicalDifficulty(C.calcDifficultyFromHeader)),C.cliqueSigner){var _=l.CLIQUE_EXTRA_VANITY+l.CLIQUE_EXTRA_SEAL;if(this.extraData.length<_){var k=_-this.extraData.length;this.extraData=a.concat([this.extraData,a.alloc(k)])}this.extraData=this.cliqueSealBlock(C.cliqueSigner)}this._errorPostfix="block number="+this.number.toNumber()+" hash="+this.hash().toString("hex"),(null===(Q=null==C?void 0:C.freeze)||void 0===Q||Q)&&Object.freeze(this)}return BlockHeader.fromHeaderData=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var r=e.parentHash,n=e.uncleHash,o=e.coinbase,c=e.stateRoot,s=e.transactionsTrie,d=e.receiptTrie,u=e.bloom,l=e.difficulty,g=e.number,p=e.gasLimit,B=e.gasUsed,m=e.timestamp,I=e.extraData,y=e.mixHash,x=e.nonce,C=e.baseFeePerGas;return new BlockHeader(r?h.toBuffer(r):h.zeros(32),n?h.toBuffer(n):h.KECCAK256_RLP_ARRAY,o?new h.Address(h.toBuffer(o)):h.Address.zero(),c?h.toBuffer(c):h.zeros(32),s?h.toBuffer(s):h.KECCAK256_RLP,d?h.toBuffer(d):h.KECCAK256_RLP,u?h.toBuffer(u):h.zeros(256),l?new h.BN(h.toBuffer(l)):new h.BN(0),g?new h.BN(h.toBuffer(g)):new h.BN(0),p?new h.BN(h.toBuffer(p)):b,B?new h.BN(h.toBuffer(B)):new h.BN(0),m?new h.BN(h.toBuffer(m)):new h.BN(0),I?h.toBuffer(I):a.from([]),y?h.toBuffer(y):h.zeros(32),x?h.toBuffer(x):h.zeros(8),t,void 0!==C?new h.BN(h.toBuffer(C)):void 0)},BlockHeader.fromRLPSerializedHeader=function(e,t){void 0===t&&(t={});var r=h.rlp.decode(e);if(!Array.isArray(r))throw new Error("Invalid serialized header input. Must be array");return BlockHeader.fromValuesArray(r,t)},BlockHeader.fromValuesArray=function(e,t){void 0===t&&(t={});var r=s(e,16),a=r[0],n=r[1],o=r[2],c=r[3],d=r[4],u=r[5],l=r[6],b=r[7],g=r[8],p=r[9],B=r[10],m=r[11],I=r[12],y=r[13],x=r[14],C=r[15];if(e.length>16)throw new Error("invalid header. More values than expected were received");if(e.length<15)throw new Error("invalid header. Less values than expected were received");return new BlockHeader(h.toBuffer(a),h.toBuffer(n),new h.Address(h.toBuffer(o)),h.toBuffer(c),h.toBuffer(d),h.toBuffer(u),h.toBuffer(l),new h.BN(h.toBuffer(b)),new h.BN(h.toBuffer(g)),new h.BN(h.toBuffer(p)),new h.BN(h.toBuffer(B)),new h.BN(h.toBuffer(m)),h.toBuffer(I),h.toBuffer(y),h.toBuffer(x),t,void 0!==C?new h.BN(h.toBuffer(C)):void 0)},BlockHeader.genesis=function(e,t){return void 0===e&&(e={}),t=n(n({},t),{initWithGenesisHeader:!0}),BlockHeader.fromHeaderData(e,t)},BlockHeader.prototype._validateHeaderFields=function(){var e=this,t=e.parentHash,r=e.stateRoot,a=e.transactionsTrie,n=e.receiptTrie,o=e.mixHash,c=e.nonce;if(32!==t.length)throw new Error("parentHash must be 32 bytes, received "+t.length+" bytes");if(32!==r.length)throw new Error("stateRoot must be 32 bytes, received "+r.length+" bytes");if(32!==a.length)throw new Error("transactionsTrie must be 32 bytes, received "+a.length+" bytes");if(32!==n.length)throw new Error("receiptTrie must be 32 bytes, received "+n.length+" bytes");if(32!==o.length)throw new Error("mixHash must be 32 bytes, received "+o.length+" bytes");if(8!==c.length){if(!this._common.networkIdBN().eqn(42))throw new Error("nonce must be 8 bytes, received "+c.length+" bytes");if(65!==c.length)throw new Error("nonce must be 65 bytes on kovan, received "+c.length+" bytes")}},BlockHeader.prototype.canonicalDifficulty=function(e){if("pow"!==this._common.consensusType())throw new Error("difficulty calculation is only supported on PoW chains");if("ethash"!==this._common.consensusAlgorithm())throw new Error("difficulty calculation currently only supports the ethash algorithm");var t,r=this._getHardfork(),a=this.timestamp,n=e.timestamp,o=e.difficulty,c=new h.BN(this._common.paramByHardfork("pow","minimumDifficulty",r)),s=o.div(new h.BN(this._common.paramByHardfork("pow","difficultyBoundDivisor",r))),d=this.number.clone();if(this._common.hardforkGteHardfork(r,"byzantium")){var u=e.uncleHash.equals(h.KECCAK256_RLP_ARRAY)?1:2,l=a.sub(n).idivn(9).ineg().iaddn(u);(b=new h.BN(-99)).gt(l)&&(l=b),t=o.add(s.mul(l))}if(this._common.hardforkGteHardfork(r,"byzantium"))d.isubn(this._common.param("pow","difficultyBombDelay")),d.ltn(0)&&(d=new h.BN(0));else if(this._common.hardforkGteHardfork(r,"homestead")){var b;l=a.sub(n).idivn(10).ineg().iaddn(1);(b=new h.BN(-99)).gt(l)&&(l=b),t=o.add(s.mul(l))}else t=n.addn(this._common.paramByHardfork("pow","durationLimit",r)).gt(a)?s.add(o):o.sub(s);var g=d.divn(1e5).isubn(2);return g.isNeg()||t.iadd(new h.BN(2).pow(g)),t.lt(c)&&(t=c),t},BlockHeader.prototype.validateDifficulty=function(e){return this.canonicalDifficulty(e).eq(this.difficulty)},BlockHeader.prototype.validateCliqueDifficulty=function(e){var t=this;if(this._requireClique("validateCliqueDifficulty"),!this.difficulty.eq(l.CLIQUE_DIFF_INTURN)&&!this.difficulty.eq(l.CLIQUE_DIFF_NOTURN))throw new Error("difficulty for clique block must be INTURN (2) or NOTURN (1), received: "+this.difficulty.toString());if("cliqueActiveSigners"in e==!1)throw new Error("PoA blockchain requires method blockchain.cliqueActiveSigners() to validate clique difficulty");var r=e.cliqueActiveSigners();if(0===r.length)return!0;var a=r.findIndex((function(e){return e.equals(t.cliqueSigner())})),n=this.number.modn(r.length)===a;return!!(n&&this.difficulty.eq(l.CLIQUE_DIFF_INTURN)||!n&&this.difficulty.eq(l.CLIQUE_DIFF_NOTURN))},BlockHeader.prototype.validateGasLimit=function(e){var t=e.gasLimit;if(this.number.eq(this._common.hardforkBlockBN("london"))){var r=new h.BN(this._common.param("gasConfig","elasticityMultiplier"));t=t.mul(r)}var a=this.gasLimit,n=this._getHardfork(),o=t.div(new h.BN(this._common.paramByHardfork("gasConfig","gasLimitBoundDivisor",n))),c=t.add(o),s=t.sub(o);return a.lt(c)&&a.gt(s)&&a.gte(this._common.paramByHardfork("gasConfig","minGasLimit",n))},BlockHeader.prototype.validate=function(e,t){return o(this,void 0,void 0,(function(){var r,n,o,s,d,u,b,g,p;return c(this,(function(c){switch(c.label){case 0:if(this.isGenesis())return[2];if(r=this._getHardfork(),"clique"!==this._common.consensusAlgorithm()){if(this.extraData.length>this._common.paramByHardfork("vm","maxExtraDataSize",r))throw s="invalid amount of extra data",this._error(s)}else{if(n=l.CLIQUE_EXTRA_VANITY+l.CLIQUE_EXTRA_SEAL,this.cliqueIsEpochTransition()){if((o=this.extraData.length-n)%20!=0)throw s="invalid signer list length in extraData, received signer length of "+o+" (not divisible by 20)",this._error(s);if(!this.coinbase.isZero())throw s="coinbase must be filled with zeros on epoch transition blocks, received "+this.coinbase.toString(),this._error(s)}else if(this.extraData.length!==n)throw s="extraData must be "+n+" bytes on non-epoch transition blocks, received "+this.extraData.length+" bytes",this._error(s);if(!this.mixHash.equals(a.alloc(32)))throw s="mixHash must be filled with zeros, received "+this.mixHash,this._error(s);if(!this.validateCliqueDifficulty(e))throw s="invalid clique difficulty",this._error(s)}return[4,this._getHeaderByHash(e,this.parentHash)];case 1:if(!(d=c.sent()))throw new Error("could not find parent header");if(!this.number.eq(d.number.addn(1)))throw new Error("invalid number");if(this.timestamp.lte(d.timestamp))throw new Error("invalid timestamp");if("clique"===this._common.consensusAlgorithm()&&(u=this._common.consensusConfig().period,d.timestamp.addn(u).gt(this.timestamp)))throw new Error("invalid timestamp diff (lower than period)");if("pow"===this._common.consensusType()&&!this.validateDifficulty(d))throw new Error("invalid difficulty");if(!this.validateGasLimit(d))throw new Error("invalid gas limit");if(t&&(!(b=t.sub(d.number)).ltn(8)||!b.gtn(1)))throw new Error("uncle block has a parent that is too old or too young");if(this.gasUsed.gt(this.gasLimit))throw new Error("Invalid block: too much gas used");if(this._common.isActivatedEIP(1559)){if(!this.baseFeePerGas)throw new Error("EIP1559 block has no base fee field");if(this.number.eq(this._common.hardforkBlockBN("london"))){if(g=new h.BN(this._common.param("gasConfig","initialBaseFee")),!this.baseFeePerGas.eq(g))throw new Error("Initial EIP1559 block does not have initial base fee")}else if(p=d.calcNextBaseFee(),!this.baseFeePerGas.eq(p))throw new Error("Invalid block: base fee not correct")}return[2]}}))}))},BlockHeader.prototype.calcNextBaseFee=function(){if(!this._common.isActivatedEIP(1559))throw new Error("calcNextBaseFee() can only be called with EIP1559 being activated");var e,t=new h.BN(this._common.param("gasConfig","elasticityMultiplier")),r=this.gasLimit.div(t);if(r.eq(this.gasUsed))e=this.baseFeePerGas;else if(this.gasUsed.gt(r)){var a=this.gasUsed.sub(r),n=new h.BN(this._common.param("gasConfig","baseFeeMaxChangeDenominator")),o=this.baseFeePerGas.mul(a).div(r).div(n);e=h.BN.max(o,new h.BN(1)).add(this.baseFeePerGas)}else{a=r.sub(this.gasUsed),n=new h.BN(this._common.param("gasConfig","baseFeeMaxChangeDenominator")),o=this.baseFeePerGas.mul(a).div(r).div(n);e=h.BN.max(this.baseFeePerGas.sub(o),new h.BN(0))}return e},BlockHeader.prototype.raw=function(){var e=[this.parentHash,this.uncleHash,this.coinbase.buf,this.stateRoot,this.transactionsTrie,this.receiptTrie,this.bloom,h.bnToUnpaddedBuffer(this.difficulty),h.bnToUnpaddedBuffer(this.number),h.bnToUnpaddedBuffer(this.gasLimit),h.bnToUnpaddedBuffer(this.gasUsed),h.bnToUnpaddedBuffer(this.timestamp),this.extraData,this.mixHash,this.nonce];return this._common.isActivatedEIP(1559)&&e.push(h.bnToUnpaddedBuffer(this.baseFeePerGas)),e},BlockHeader.prototype.hash=function(){return h.rlphash(this.raw())},BlockHeader.prototype.isGenesis=function(){return this.number.isZero()},BlockHeader.prototype._requireClique=function(e){if("clique"!==this._common.consensusAlgorithm())throw new Error("BlockHeader."+e+"() call only supported for clique PoA networks")},BlockHeader.prototype.cliqueSigHash=function(){this._requireClique("cliqueSigHash");var e=this.raw();return e[12]=this.extraData.slice(0,this.extraData.length-l.CLIQUE_EXTRA_SEAL),h.rlphash(e)},BlockHeader.prototype.cliqueIsEpochTransition=function(){this._requireClique("cliqueIsEpochTransition");var e=new h.BN(this._common.consensusConfig().epoch);return this.number.mod(e).isZero()},BlockHeader.prototype.cliqueExtraVanity=function(){return this._requireClique("cliqueExtraVanity"),this.extraData.slice(0,l.CLIQUE_EXTRA_VANITY)},BlockHeader.prototype.cliqueExtraSeal=function(){return this._requireClique("cliqueExtraSeal"),this.extraData.slice(-l.CLIQUE_EXTRA_SEAL)},BlockHeader.prototype.cliqueSealBlock=function(e){this._requireClique("cliqueSealBlock");var t=h.ecsign(this.cliqueSigHash(),e),r=a.concat([t.r,t.s,h.intToBuffer(t.v-27)]),n=this.extraData.slice(0,this.extraData.length-l.CLIQUE_EXTRA_SEAL);return a.concat([n,r])},BlockHeader.prototype.cliqueEpochTransitionSigners=function(){if(this._requireClique("cliqueEpochTransitionSigners"),!this.cliqueIsEpochTransition())throw new Error("Signers are only included in epoch transition blocks (clique)");for(var e=l.CLIQUE_EXTRA_VANITY,t=this.extraData.length-l.CLIQUE_EXTRA_SEAL,r=this.extraData.slice(e,t),a=[],n=0;n<=r.length-20;n+=20)a.push(r.slice(n,n+20));return a.map((function(e){return new h.Address(e)}))},BlockHeader.prototype.cliqueVerifySignature=function(e){this._requireClique("cliqueVerifySignature");var t=this.cliqueSigner();return!!e.find((function(e){return e.equals(t)}))},BlockHeader.prototype.cliqueSigner=function(){this._requireClique("cliqueSigner");var e=this.cliqueExtraSeal();if(0===e.length)return h.Address.zero();var t=e.slice(0,32),r=e.slice(32,64),a=new h.BN(e.slice(64,65)).addn(27),n=h.ecrecover(this.cliqueSigHash(),a,t,r);return h.Address.fromPublicKey(n)},BlockHeader.prototype.serialize=function(){return h.rlp.encode(this.raw())},BlockHeader.prototype.toJSON=function(){var e={parentHash:"0x"+this.parentHash.toString("hex"),uncleHash:"0x"+this.uncleHash.toString("hex"),coinbase:this.coinbase.toString(),stateRoot:"0x"+this.stateRoot.toString("hex"),transactionsTrie:"0x"+this.transactionsTrie.toString("hex"),receiptTrie:"0x"+this.receiptTrie.toString("hex"),bloom:"0x"+this.bloom.toString("hex"),difficulty:h.bnToHex(this.difficulty),number:h.bnToHex(this.number),gasLimit:h.bnToHex(this.gasLimit),gasUsed:h.bnToHex(this.gasUsed),timestamp:h.bnToHex(this.timestamp),extraData:"0x"+this.extraData.toString("hex"),mixHash:"0x"+this.mixHash.toString("hex"),nonce:"0x"+this.nonce.toString("hex")};return this._common.isActivatedEIP(1559)&&(e.baseFee="0x"+this.baseFeePerGas.toString("hex")),e},BlockHeader.prototype._error=function(e){return e+=" ("+this._errorPostfix+")",new Error(e)},BlockHeader.prototype._getHardfork=function(){return this._common.hardfork()||this._common.activeHardfork(this.number.toNumber())},BlockHeader.prototype._getHeaderByHash=function(e,t){return o(this,void 0,void 0,(function(){var r;return c(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,e.getBlock(t)];case 1:return[2,a.sent().header];case 2:if("NotFoundError"===(r=a.sent()).type)return[2,void 0];throw r;case 3:return[2]}}))}))},BlockHeader.prototype._checkDAOExtraData=function(){var e=a.from("64616f2d686172642d666f726b","hex"),t=new h.BN(9);if(this._common.hardforkIsActiveOnChain("dao")){var r=this.number,n=this._common.hardforkBlockBN("dao");if(r.gte(n))if(r.sub(n).lte(t)&&!this.extraData.equals(e))throw new Error("extraData should be 'dao-hard-fork'")}},BlockHeader}();t.BlockHeader=g},(e,t,r)=>{"use strict";var a=r(0).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.bufReverse=t.fnvBuffer=t.fnv=t.getSeed=t.getEpoc=t.getFullSize=t.getCacheSize=t.params=void 0;var n=r(4),o=r(1035);function fnv(e,t){return((16777216*e|0)+(403*e|0)^t)>>>0}t.params={DATASET_BYTES_INIT:1073741824,DATASET_BYTES_GROWTH:8388608,CACHE_BYTES_INIT:16777216,CACHE_BYTES_GROWTH:131072,CACHE_MULTIPLIER:1024,EPOCH_LENGTH:3e4,MIX_BYTES:128,HASH_BYTES:64,DATASET_PARENTS:256,CACHE_ROUNDS:3,ACCESSES:64,WORD_BYTES:4},t.getCacheSize=function getCacheSize(e){var r=new o,a=t.params.CACHE_BYTES_INIT+t.params.CACHE_BYTES_GROWTH*e;for(a-=t.params.HASH_BYTES;!r.test(new n.BN(a/t.params.HASH_BYTES));)a-=2*t.params.HASH_BYTES;return a},t.getFullSize=function getFullSize(e){var r=new o,a=t.params.DATASET_BYTES_INIT+t.params.DATASET_BYTES_GROWTH*e;for(a-=t.params.MIX_BYTES;!r.test(new n.BN(a/t.params.MIX_BYTES));)a-=2*t.params.MIX_BYTES;return a},t.getEpoc=function getEpoc(e){return Math.floor(e/t.params.EPOCH_LENGTH)},t.getSeed=function getSeed(e,t,r){for(var a=t;a0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0)&&!(a=o.next()).done;)c.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return c},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BlockHeader=void 0;var u=d(r(66)),h=r(4),l=r(1432),b=new h.BN(a.from("ffffffffffffff","hex")),g=function(){function BlockHeader(e,t,r,a,n,o,c,s,d,l,g,p,B,m,I,y){var x;if(void 0===y&&(y={}),this._errorPostfix="",y.common)this._common=Object.assign(Object.create(Object.getPrototypeOf(y.common)),y.common);else{var C="mainnet";y.initWithGenesisHeader?this._common=new u.default({chain:C,hardfork:"chainstart"}):this._common=new u.default({chain:C})}y.hardforkByBlockNumber&&this._common.setHardforkByBlockNumber(d.toNumber()),y.initWithGenesisHeader&&(d=new h.BN(0),l.eq(b)&&(l=new h.BN(h.toBuffer(this._common.genesis().gasLimit))),p.isZero()&&(p=new h.BN(h.toBuffer(this._common.genesis().timestamp))),s.isZero()&&(s=new h.BN(h.toBuffer(this._common.genesis().difficulty))),0===B.length&&(B=h.toBuffer(this._common.genesis().extraData)),I.equals(h.zeros(8))&&(I=h.toBuffer(this._common.genesis().nonce)),a.equals(h.zeros(32))&&(a=h.toBuffer(this._common.genesis().stateRoot))),this.parentHash=e,this.uncleHash=t,this.coinbase=r,this.stateRoot=a,this.transactionsTrie=n,this.receiptTrie=o,this.bloom=c,this.difficulty=s,this.number=d,this.gasLimit=l,this.gasUsed=g,this.timestamp=p,this.extraData=B,this.mixHash=m,this.nonce=I,this._validateHeaderFields(),this._checkDAOExtraData(),y.calcDifficultyFromHeader&&(this.difficulty=this.canonicalDifficulty(y.calcDifficultyFromHeader)),y.cliqueSigner&&(this.extraData=this.cliqueSealBlock(y.cliqueSigner)),this._errorPostfix="block number="+this.number.toNumber()+" hash="+this.hash().toString("hex"),(null===(x=null==y?void 0:y.freeze)||void 0===x||x)&&Object.freeze(this)}return BlockHeader.fromHeaderData=function(e,t){void 0===e&&(e={});var r=e.parentHash,n=e.uncleHash,o=e.coinbase,c=e.stateRoot,s=e.transactionsTrie,d=e.receiptTrie,u=e.bloom,l=e.difficulty,g=e.number,p=e.gasLimit,B=e.gasUsed,m=e.timestamp,I=e.extraData,y=e.mixHash,x=e.nonce;return new BlockHeader(r?h.toBuffer(r):h.zeros(32),n?h.toBuffer(n):h.KECCAK256_RLP_ARRAY,o?new h.Address(h.toBuffer(o)):h.Address.zero(),c?h.toBuffer(c):h.zeros(32),s?h.toBuffer(s):h.KECCAK256_RLP,d?h.toBuffer(d):h.KECCAK256_RLP,u?h.toBuffer(u):h.zeros(256),l?new h.BN(h.toBuffer(l)):new h.BN(0),g?new h.BN(h.toBuffer(g)):new h.BN(0),p?new h.BN(h.toBuffer(p)):b,B?new h.BN(h.toBuffer(B)):new h.BN(0),m?new h.BN(h.toBuffer(m)):new h.BN(0),I?h.toBuffer(I):a.from([]),y?h.toBuffer(y):h.zeros(32),x?h.toBuffer(x):h.zeros(8),t)},BlockHeader.fromRLPSerializedHeader=function(e,t){var r=h.rlp.decode(e);if(!Array.isArray(r))throw new Error("Invalid serialized header input. Must be array");return BlockHeader.fromValuesArray(r,t)},BlockHeader.fromValuesArray=function(e,t){if(e.length>15)throw new Error("invalid header. More values than expected were received");var r=s(e,15),a=r[0],n=r[1],o=r[2],c=r[3],d=r[4],u=r[5],l=r[6],b=r[7],g=r[8],p=r[9],B=r[10],m=r[11],I=r[12],y=r[13],x=r[14];return new BlockHeader(h.toBuffer(a),h.toBuffer(n),new h.Address(h.toBuffer(o)),h.toBuffer(c),h.toBuffer(d),h.toBuffer(u),h.toBuffer(l),new h.BN(h.toBuffer(b)),new h.BN(h.toBuffer(g)),new h.BN(h.toBuffer(p)),new h.BN(h.toBuffer(B)),new h.BN(h.toBuffer(m)),h.toBuffer(I),h.toBuffer(y),h.toBuffer(x),t)},BlockHeader.genesis=function(e,t){return void 0===e&&(e={}),t=n(n({},t),{initWithGenesisHeader:!0}),BlockHeader.fromHeaderData(e,t)},BlockHeader.prototype._validateHeaderFields=function(){var e=this,t=e.parentHash,r=e.stateRoot,a=e.transactionsTrie,n=e.receiptTrie,o=e.mixHash,c=e.nonce;if(32!==t.length)throw new Error("parentHash must be 32 bytes, received "+t.length+" bytes");if(32!==r.length)throw new Error("stateRoot must be 32 bytes, received "+r.length+" bytes");if(32!==a.length)throw new Error("transactionsTrie must be 32 bytes, received "+a.length+" bytes");if(32!==n.length)throw new Error("receiptTrie must be 32 bytes, received "+n.length+" bytes");if(32!==o.length)throw new Error("mixHash must be 32 bytes, received "+o.length+" bytes");if(8!==c.length)throw new Error("nonce must be 8 bytes, received "+c.length+" bytes")},BlockHeader.prototype.canonicalDifficulty=function(e){if("pow"!==this._common.consensusType())throw new Error("difficulty calculation is only supported on PoW chains");if("ethash"!==this._common.consensusAlgorithm())throw new Error("difficulty calculation currently only supports the ethash algorithm");var t,r=this._getHardfork(),a=this.timestamp,n=e.timestamp,o=e.difficulty,c=new h.BN(this._common.paramByHardfork("pow","minimumDifficulty",r)),s=o.div(new h.BN(this._common.paramByHardfork("pow","difficultyBoundDivisor",r))),d=this.number.clone();if(this._common.hardforkGteHardfork(r,"byzantium")){var u=e.uncleHash.equals(h.KECCAK256_RLP_ARRAY)?1:2,l=a.sub(n).idivn(9).ineg().iaddn(u);(b=new h.BN(-99)).gt(l)&&(l=b),t=o.add(s.mul(l))}if(this._common.hardforkGteHardfork(r,"muirGlacier"))d.isubn(9e6),d.ltn(0)&&(d=new h.BN(0));else if(this._common.hardforkGteHardfork(r,"constantinople"))d.isubn(5e6),d.ltn(0)&&(d=new h.BN(0));else if(this._common.hardforkGteHardfork(r,"byzantium"))d.isubn(3e6),d.ltn(0)&&(d=new h.BN(0));else if(this._common.hardforkGteHardfork(r,"homestead")){var b;l=a.sub(n).idivn(10).ineg().iaddn(1);(b=new h.BN(-99)).gt(l)&&(l=b),t=o.add(s.mul(l))}else t=n.addn(this._common.paramByHardfork("pow","durationLimit",r)).gt(a)?s.add(o):o.sub(s);var g=d.divn(1e5).isubn(2);return g.isNeg()||t.iadd(new h.BN(2).pow(g)),t.lt(c)&&(t=c),t},BlockHeader.prototype.validateDifficulty=function(e){return this.canonicalDifficulty(e).eq(this.difficulty)},BlockHeader.prototype.validateCliqueDifficulty=function(e){var t=this;if(this._requireClique("validateCliqueDifficulty"),!this.difficulty.eq(l.CLIQUE_DIFF_INTURN)&&!this.difficulty.eq(l.CLIQUE_DIFF_NOTURN))throw new Error("difficulty for clique block must be INTURN (2) or NOTURN (1), received: "+this.difficulty.toString());if("cliqueActiveSigners"in e==!1)throw new Error("PoA blockchain requires method blockchain.cliqueActiveSigners() to validate clique difficulty");var r=e.cliqueActiveSigners();if(0===r.length)return!0;var a=r.findIndex((function(e){return e.equals(t.cliqueSigner())})),n=this.number.modn(r.length)===a;return!!(n&&this.difficulty.eq(l.CLIQUE_DIFF_INTURN)||!n&&this.difficulty.eq(l.CLIQUE_DIFF_NOTURN))},BlockHeader.prototype.validateGasLimit=function(e){var t=e.gasLimit,r=this.gasLimit,a=this._getHardfork(),n=t.div(new h.BN(this._common.paramByHardfork("gasConfig","gasLimitBoundDivisor",a))),o=t.add(n),c=t.sub(n);return r.lt(o)&&r.gt(c)&&r.gte(this._common.paramByHardfork("gasConfig","minGasLimit",a))},BlockHeader.prototype.validate=function(e,t){return o(this,void 0,void 0,(function(){var r,n,o,s,d,u,h;return c(this,(function(c){switch(c.label){case 0:if(this.isGenesis())return[2];if(r=this._getHardfork(),"clique"!==this._common.consensusAlgorithm()){if(this.extraData.length>this._common.paramByHardfork("vm","maxExtraDataSize",r))throw s="invalid amount of extra data",this._error(s)}else{if(n=l.CLIQUE_EXTRA_VANITY+l.CLIQUE_EXTRA_SEAL,this.cliqueIsEpochTransition()){if((o=this.extraData.length-n)%20!=0)throw s="invalid signer list length in extraData, received signer length of "+o+" (not divisible by 20)",this._error(s);if(!this.coinbase.isZero())throw s="coinbase must be filled with zeros on epoch transition blocks, received "+this.coinbase.toString(),this._error(s)}else if(this.extraData.length!==n)throw s="extraData must be "+n+" bytes on non-epoch transition blocks, received "+this.extraData.length+" bytes",this._error(s);if(!this.mixHash.equals(a.alloc(32)))throw s="mixHash must be filled with zeros, received "+this.mixHash,this._error(s);if(!this.validateCliqueDifficulty(e))throw s="invalid clique difficulty",this._error(s)}return[4,this._getHeaderByHash(e,this.parentHash)];case 1:if(!(d=c.sent()))throw new Error("could not find parent header");if(!this.number.eq(d.number.addn(1)))throw new Error("invalid number");if(this.timestamp.lte(d.timestamp))throw new Error("invalid timestamp");if("clique"===this._common.consensusAlgorithm()&&(u=this._common.consensusConfig().period,d.timestamp.addn(u).gt(this.timestamp)))throw new Error("invalid timestamp diff (lower than period)");if("pow"===this._common.consensusType()&&!this.validateDifficulty(d))throw new Error("invalid difficulty");if(!this.validateGasLimit(d))throw new Error("invalid gas limit");if(t&&(!(h=t.sub(d.number)).ltn(8)||!h.gtn(1)))throw new Error("uncle block has a parent that is too old or too young");return[2]}}))}))},BlockHeader.prototype.raw=function(){return[this.parentHash,this.uncleHash,this.coinbase.buf,this.stateRoot,this.transactionsTrie,this.receiptTrie,this.bloom,h.unpadBuffer(h.toBuffer(this.difficulty)),h.unpadBuffer(h.toBuffer(this.number)),h.unpadBuffer(h.toBuffer(this.gasLimit)),h.unpadBuffer(h.toBuffer(this.gasUsed)),h.unpadBuffer(h.toBuffer(this.timestamp)),this.extraData,this.mixHash,this.nonce]},BlockHeader.prototype.hash=function(){return h.rlphash(this.raw())},BlockHeader.prototype.isGenesis=function(){return this.number.isZero()},BlockHeader.prototype._requireClique=function(e){if("clique"!==this._common.consensusAlgorithm())throw new Error("BlockHeader."+e+"() call only supported for clique PoA networks")},BlockHeader.prototype.cliqueSigHash=function(){this._requireClique("cliqueSigHash");var e=this.raw();return e[12]=this.extraData.slice(0,this.extraData.length-l.CLIQUE_EXTRA_SEAL),h.rlphash(e)},BlockHeader.prototype.cliqueIsEpochTransition=function(){this._requireClique("cliqueIsEpochTransition");var e=new h.BN(this._common.consensusConfig().epoch);return this.number.mod(e).isZero()},BlockHeader.prototype.cliqueExtraVanity=function(){return this._requireClique("cliqueExtraVanity"),this.extraData.slice(0,l.CLIQUE_EXTRA_VANITY)},BlockHeader.prototype.cliqueExtraSeal=function(){return this._requireClique("cliqueExtraSeal"),this.extraData.slice(-l.CLIQUE_EXTRA_SEAL)},BlockHeader.prototype.cliqueSealBlock=function(e){this._requireClique("cliqueSealBlock");var t=h.ecsign(this.cliqueSigHash(),e),r=a.concat([t.r,t.s,h.intToBuffer(t.v-27)]),n=this.extraData.slice(0,this.extraData.length-l.CLIQUE_EXTRA_SEAL);if(n.length=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),c=t;c=49?s-49+10:s>=17?s-17+10:s}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,c=o%a,s=Math.min(o,o-c)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],o=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],c=n*o,s=67108863&c,d=c/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(c=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&c}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,s=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=c[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,c,s="le"===t,d=new e(n),u=this.clone();if(s){for(c=0;!u.isZero();c++)o=u.andln(255),u.iushrn(8),d[c]=o;for(;c=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,c=0;c>26,this.words[c]=67108863&t;for(;0!==o&&c>26,this.words[c]=67108863&t;if(0===o&&c>>13,g=0|c[1],p=8191&g,B=g>>>13,m=0|c[2],I=8191&m,y=m>>>13,x=0|c[3],C=8191&x,v=x>>>13,Q=0|c[4],w=8191&Q,_=Q>>>13,k=0|c[5],N=8191&k,D=k>>>13,U=0|c[6],G=8191&U,T=U>>>13,L=0|c[7],q=8191&L,P=L>>>13,O=0|c[8],H=8191&O,Y=O>>>13,J=0|c[9],j=8191&J,z=J>>>13,W=0|s[0],V=8191&W,X=W>>>13,$=0|s[1],et=8191&$,tt=$>>>13,rt=0|s[2],at=8191&rt,it=rt>>>13,nt=0|s[3],ot=8191&nt,At=nt>>>13,ct=0|s[4],st=8191&ct,dt=ct>>>13,ut=0|s[5],ht=8191&ut,bt=ut>>>13,pt=0|s[6],Bt=8191&pt,mt=pt>>>13,It=0|s[7],Et=8191&It,yt=It>>>13,xt=0|s[8],Ct=8191&xt,vt=xt>>>13,Qt=0|s[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(C,V),n=(n=Math.imul(C,X))+Math.imul(v,V)|0,o=Math.imul(v,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(C,et)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(v,et)|0,o=o+Math.imul(v,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,st)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(C,at)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(v,at)|0,o=o+Math.imul(v,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,st)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,st)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,At)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,At)|0,a=a+Math.imul(I,st)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,st)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(q,V),n=(n=Math.imul(q,X))+Math.imul(P,V)|0,o=Math.imul(P,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(C,st)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(v,st)|0,o=o+Math.imul(v,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(q,et)|0,n=(n=n+Math.imul(q,tt)|0)+Math.imul(P,et)|0,o=o+Math.imul(P,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,st)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,st)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,bt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,Ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,vt)|0)+Math.imul(b,Ct)|0))<<13)|0;u=((o=o+Math.imul(b,vt)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(j,V),n=(n=Math.imul(j,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(q,at)|0,n=(n=n+Math.imul(q,it)|0)+Math.imul(P,at)|0,o=o+Math.imul(P,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,st)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,st)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(C,Bt)|0,n=(n=n+Math.imul(C,mt)|0)+Math.imul(v,Bt)|0,o=o+Math.imul(v,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,Ct)|0,n=(n=n+Math.imul(p,vt)|0)+Math.imul(B,Ct)|0,o=o+Math.imul(B,vt)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(j,et),n=(n=Math.imul(j,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(q,ot)|0,n=(n=n+Math.imul(q,At)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,At)|0,a=a+Math.imul(G,st)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,st)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(C,Et)|0,n=(n=n+Math.imul(C,yt)|0)+Math.imul(v,Et)|0,o=o+Math.imul(v,yt)|0,a=a+Math.imul(I,Ct)|0,n=(n=n+Math.imul(I,vt)|0)+Math.imul(y,Ct)|0,o=o+Math.imul(y,vt)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(j,at),n=(n=Math.imul(j,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(q,st)|0,n=(n=n+Math.imul(q,dt)|0)+Math.imul(P,st)|0,o=o+Math.imul(P,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(C,Ct)|0,n=(n=n+Math.imul(C,vt)|0)+Math.imul(v,Ct)|0,o=o+Math.imul(v,vt)|0;var qt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(j,ot),n=(n=Math.imul(j,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,st)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,st)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(q,ht)|0,n=(n=n+Math.imul(q,bt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,Ct)|0,n=(n=n+Math.imul(w,vt)|0)+Math.imul(_,Ct)|0,o=o+Math.imul(_,vt)|0;var Pt=(u+(a=a+Math.imul(C,wt)|0)|0)+((8191&(n=(n=n+Math.imul(C,Mt)|0)+Math.imul(v,wt)|0))<<13)|0;u=((o=o+Math.imul(v,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(j,st),n=(n=Math.imul(j,dt))+Math.imul(z,st)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(q,Bt)|0,n=(n=n+Math.imul(q,mt)|0)+Math.imul(P,Bt)|0,o=o+Math.imul(P,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,Ct)|0,n=(n=n+Math.imul(N,vt)|0)+Math.imul(D,Ct)|0,o=o+Math.imul(D,vt)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(j,ht),n=(n=Math.imul(j,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(q,Et)|0,n=(n=n+Math.imul(q,yt)|0)+Math.imul(P,Et)|0,o=o+Math.imul(P,yt)|0,a=a+Math.imul(G,Ct)|0,n=(n=n+Math.imul(G,vt)|0)+Math.imul(T,Ct)|0,o=o+Math.imul(T,vt)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(j,Bt),n=(n=Math.imul(j,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(q,Ct)|0,n=(n=n+Math.imul(q,vt)|0)+Math.imul(P,Ct)|0,o=o+Math.imul(P,vt)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(j,Et),n=(n=Math.imul(j,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,Ct)|0,n=(n=n+Math.imul(H,vt)|0)+Math.imul(Y,Ct)|0,o=o+Math.imul(Y,vt)|0;var Jt=(u+(a=a+Math.imul(q,wt)|0)|0)+((8191&(n=(n=n+Math.imul(q,Mt)|0)+Math.imul(P,wt)|0))<<13)|0;u=((o=o+Math.imul(P,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(j,Ct),n=(n=Math.imul(j,vt))+Math.imul(z,Ct)|0,o=Math.imul(z,vt);var Kt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863;var jt=(u+(a=Math.imul(j,wt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=qt,d[12]=Pt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=Jt,d[17]=Kt,d[18]=jt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(s=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?s(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,c&=67108863}r.words[o]=s,a=c,c=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var c=0;c>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),c=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&c}return s&&0!==u&&(s.words[s.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(s/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===c)return this.strip();for(assert(-1===c),c=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var c,s=a.length-n.length;if("mod"!==t){(c=new BN(null)).length=s+1,c.words=new Array(c.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);c&&(c.words[h]=l)}return c&&c.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:c||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),c=new BN(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(d),c.isub(u)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(c)):(r.isub(t),o.isub(a),c.isub(n))}return{a:o,b:c,gcd:r.iushln(s)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var s=0,d=1;0==(t.words[0]&d)&&s<26;++s,d<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(c),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,c&=67108863,this.words[o]=c}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=c}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),c=o.redNeg(),s=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,s).cmp(c);)d.redIAdd(c);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=s-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++c||0===a&&0===u)&&(n=this.mul(n,r[o]),c=0,o=0)):c=0}s=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(844),t),n(r(889),t),n(r(1284),t)},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(18).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),c=t;c=49?s-49+10:s>=17?s-17+10:s}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,c=o%a,s=Math.min(o,o-c)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],o=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],c=n*o,s=67108863&c,d=c/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(c=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&c}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,s=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=c[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,c,s="le"===t,d=new e(n),u=this.clone();if(s){for(c=0;!u.isZero();c++)o=u.andln(255),u.iushrn(8),d[c]=o;for(;c=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,c=0;c>26,this.words[c]=67108863&t;for(;0!==o&&c>26,this.words[c]=67108863&t;if(0===o&&c>>13,g=0|c[1],p=8191&g,B=g>>>13,m=0|c[2],I=8191&m,y=m>>>13,x=0|c[3],C=8191&x,v=x>>>13,Q=0|c[4],w=8191&Q,_=Q>>>13,k=0|c[5],N=8191&k,D=k>>>13,U=0|c[6],G=8191&U,T=U>>>13,L=0|c[7],q=8191&L,P=L>>>13,O=0|c[8],H=8191&O,Y=O>>>13,J=0|c[9],j=8191&J,z=J>>>13,W=0|s[0],V=8191&W,X=W>>>13,$=0|s[1],et=8191&$,tt=$>>>13,rt=0|s[2],at=8191&rt,it=rt>>>13,nt=0|s[3],ot=8191&nt,At=nt>>>13,ct=0|s[4],st=8191&ct,dt=ct>>>13,ut=0|s[5],ht=8191&ut,bt=ut>>>13,pt=0|s[6],Bt=8191&pt,mt=pt>>>13,It=0|s[7],Et=8191&It,yt=It>>>13,xt=0|s[8],Ct=8191&xt,vt=xt>>>13,Qt=0|s[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(C,V),n=(n=Math.imul(C,X))+Math.imul(v,V)|0,o=Math.imul(v,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(C,et)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(v,et)|0,o=o+Math.imul(v,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,st)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(C,at)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(v,at)|0,o=o+Math.imul(v,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,st)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,st)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,At)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,At)|0,a=a+Math.imul(I,st)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,st)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(q,V),n=(n=Math.imul(q,X))+Math.imul(P,V)|0,o=Math.imul(P,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(C,st)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(v,st)|0,o=o+Math.imul(v,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(q,et)|0,n=(n=n+Math.imul(q,tt)|0)+Math.imul(P,et)|0,o=o+Math.imul(P,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,st)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,st)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,bt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,Ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,vt)|0)+Math.imul(b,Ct)|0))<<13)|0;u=((o=o+Math.imul(b,vt)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(j,V),n=(n=Math.imul(j,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(q,at)|0,n=(n=n+Math.imul(q,it)|0)+Math.imul(P,at)|0,o=o+Math.imul(P,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,st)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,st)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(C,Bt)|0,n=(n=n+Math.imul(C,mt)|0)+Math.imul(v,Bt)|0,o=o+Math.imul(v,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,Ct)|0,n=(n=n+Math.imul(p,vt)|0)+Math.imul(B,Ct)|0,o=o+Math.imul(B,vt)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(j,et),n=(n=Math.imul(j,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(q,ot)|0,n=(n=n+Math.imul(q,At)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,At)|0,a=a+Math.imul(G,st)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,st)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(C,Et)|0,n=(n=n+Math.imul(C,yt)|0)+Math.imul(v,Et)|0,o=o+Math.imul(v,yt)|0,a=a+Math.imul(I,Ct)|0,n=(n=n+Math.imul(I,vt)|0)+Math.imul(y,Ct)|0,o=o+Math.imul(y,vt)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(j,at),n=(n=Math.imul(j,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(q,st)|0,n=(n=n+Math.imul(q,dt)|0)+Math.imul(P,st)|0,o=o+Math.imul(P,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(C,Ct)|0,n=(n=n+Math.imul(C,vt)|0)+Math.imul(v,Ct)|0,o=o+Math.imul(v,vt)|0;var qt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(j,ot),n=(n=Math.imul(j,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,st)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,st)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(q,ht)|0,n=(n=n+Math.imul(q,bt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,Ct)|0,n=(n=n+Math.imul(w,vt)|0)+Math.imul(_,Ct)|0,o=o+Math.imul(_,vt)|0;var Pt=(u+(a=a+Math.imul(C,wt)|0)|0)+((8191&(n=(n=n+Math.imul(C,Mt)|0)+Math.imul(v,wt)|0))<<13)|0;u=((o=o+Math.imul(v,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(j,st),n=(n=Math.imul(j,dt))+Math.imul(z,st)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(q,Bt)|0,n=(n=n+Math.imul(q,mt)|0)+Math.imul(P,Bt)|0,o=o+Math.imul(P,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,Ct)|0,n=(n=n+Math.imul(N,vt)|0)+Math.imul(D,Ct)|0,o=o+Math.imul(D,vt)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(j,ht),n=(n=Math.imul(j,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(q,Et)|0,n=(n=n+Math.imul(q,yt)|0)+Math.imul(P,Et)|0,o=o+Math.imul(P,yt)|0,a=a+Math.imul(G,Ct)|0,n=(n=n+Math.imul(G,vt)|0)+Math.imul(T,Ct)|0,o=o+Math.imul(T,vt)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(j,Bt),n=(n=Math.imul(j,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(q,Ct)|0,n=(n=n+Math.imul(q,vt)|0)+Math.imul(P,Ct)|0,o=o+Math.imul(P,vt)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(j,Et),n=(n=Math.imul(j,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,Ct)|0,n=(n=n+Math.imul(H,vt)|0)+Math.imul(Y,Ct)|0,o=o+Math.imul(Y,vt)|0;var Jt=(u+(a=a+Math.imul(q,wt)|0)|0)+((8191&(n=(n=n+Math.imul(q,Mt)|0)+Math.imul(P,wt)|0))<<13)|0;u=((o=o+Math.imul(P,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(j,Ct),n=(n=Math.imul(j,vt))+Math.imul(z,Ct)|0,o=Math.imul(z,vt);var Kt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863;var jt=(u+(a=Math.imul(j,wt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=qt,d[12]=Pt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=Jt,d[17]=Kt,d[18]=jt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(s=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?s(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,c&=67108863}r.words[o]=s,a=c,c=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var c=0;c>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),c=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&c}return s&&0!==u&&(s.words[s.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(s/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===c)return this.strip();for(assert(-1===c),c=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var c,s=a.length-n.length;if("mod"!==t){(c=new BN(null)).length=s+1,c.words=new Array(c.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);c&&(c.words[h]=l)}return c&&c.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:c||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),c=new BN(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(d),c.isub(u)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(c)):(r.isub(t),o.isub(a),c.isub(n))}return{a:o,b:c,gcd:r.iushln(s)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var s=0,d=1;0==(t.words[0]&d)&&s<26;++s,d<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(c),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,c&=67108863,this.words[o]=c}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=c}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),c=o.redNeg(),s=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,s).cmp(c);)d.redIAdd(c);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=s-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++c||0===a&&0===u)&&(n=this.mul(n,r[o]),c=0,o=0)):c=0}s=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(18).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),c=t;c=49?s-49+10:s>=17?s-17+10:s}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,c=o%a,s=Math.min(o,o-c)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],o=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],c=n*o,s=67108863&c,d=c/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(c=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&c}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,s=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=c[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,c,s="le"===t,d=new e(n),u=this.clone();if(s){for(c=0;!u.isZero();c++)o=u.andln(255),u.iushrn(8),d[c]=o;for(;c=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,c=0;c>26,this.words[c]=67108863&t;for(;0!==o&&c>26,this.words[c]=67108863&t;if(0===o&&c>>13,g=0|c[1],p=8191&g,B=g>>>13,m=0|c[2],I=8191&m,y=m>>>13,x=0|c[3],C=8191&x,v=x>>>13,Q=0|c[4],w=8191&Q,_=Q>>>13,k=0|c[5],N=8191&k,D=k>>>13,U=0|c[6],G=8191&U,T=U>>>13,L=0|c[7],q=8191&L,P=L>>>13,O=0|c[8],H=8191&O,Y=O>>>13,J=0|c[9],j=8191&J,z=J>>>13,W=0|s[0],V=8191&W,X=W>>>13,$=0|s[1],et=8191&$,tt=$>>>13,rt=0|s[2],at=8191&rt,it=rt>>>13,nt=0|s[3],ot=8191&nt,At=nt>>>13,ct=0|s[4],st=8191&ct,dt=ct>>>13,ut=0|s[5],ht=8191&ut,bt=ut>>>13,pt=0|s[6],Bt=8191&pt,mt=pt>>>13,It=0|s[7],Et=8191&It,yt=It>>>13,xt=0|s[8],Ct=8191&xt,vt=xt>>>13,Qt=0|s[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(C,V),n=(n=Math.imul(C,X))+Math.imul(v,V)|0,o=Math.imul(v,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(C,et)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(v,et)|0,o=o+Math.imul(v,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,st)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(C,at)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(v,at)|0,o=o+Math.imul(v,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,st)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,st)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,At)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,At)|0,a=a+Math.imul(I,st)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,st)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(q,V),n=(n=Math.imul(q,X))+Math.imul(P,V)|0,o=Math.imul(P,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(C,st)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(v,st)|0,o=o+Math.imul(v,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(q,et)|0,n=(n=n+Math.imul(q,tt)|0)+Math.imul(P,et)|0,o=o+Math.imul(P,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,st)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,st)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,bt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,Ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,vt)|0)+Math.imul(b,Ct)|0))<<13)|0;u=((o=o+Math.imul(b,vt)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(j,V),n=(n=Math.imul(j,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(q,at)|0,n=(n=n+Math.imul(q,it)|0)+Math.imul(P,at)|0,o=o+Math.imul(P,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,st)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,st)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(C,Bt)|0,n=(n=n+Math.imul(C,mt)|0)+Math.imul(v,Bt)|0,o=o+Math.imul(v,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,Ct)|0,n=(n=n+Math.imul(p,vt)|0)+Math.imul(B,Ct)|0,o=o+Math.imul(B,vt)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(j,et),n=(n=Math.imul(j,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(q,ot)|0,n=(n=n+Math.imul(q,At)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,At)|0,a=a+Math.imul(G,st)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,st)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(C,Et)|0,n=(n=n+Math.imul(C,yt)|0)+Math.imul(v,Et)|0,o=o+Math.imul(v,yt)|0,a=a+Math.imul(I,Ct)|0,n=(n=n+Math.imul(I,vt)|0)+Math.imul(y,Ct)|0,o=o+Math.imul(y,vt)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(j,at),n=(n=Math.imul(j,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(q,st)|0,n=(n=n+Math.imul(q,dt)|0)+Math.imul(P,st)|0,o=o+Math.imul(P,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(C,Ct)|0,n=(n=n+Math.imul(C,vt)|0)+Math.imul(v,Ct)|0,o=o+Math.imul(v,vt)|0;var qt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(j,ot),n=(n=Math.imul(j,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,st)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,st)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(q,ht)|0,n=(n=n+Math.imul(q,bt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,Ct)|0,n=(n=n+Math.imul(w,vt)|0)+Math.imul(_,Ct)|0,o=o+Math.imul(_,vt)|0;var Pt=(u+(a=a+Math.imul(C,wt)|0)|0)+((8191&(n=(n=n+Math.imul(C,Mt)|0)+Math.imul(v,wt)|0))<<13)|0;u=((o=o+Math.imul(v,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(j,st),n=(n=Math.imul(j,dt))+Math.imul(z,st)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(q,Bt)|0,n=(n=n+Math.imul(q,mt)|0)+Math.imul(P,Bt)|0,o=o+Math.imul(P,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,Ct)|0,n=(n=n+Math.imul(N,vt)|0)+Math.imul(D,Ct)|0,o=o+Math.imul(D,vt)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(j,ht),n=(n=Math.imul(j,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(q,Et)|0,n=(n=n+Math.imul(q,yt)|0)+Math.imul(P,Et)|0,o=o+Math.imul(P,yt)|0,a=a+Math.imul(G,Ct)|0,n=(n=n+Math.imul(G,vt)|0)+Math.imul(T,Ct)|0,o=o+Math.imul(T,vt)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(j,Bt),n=(n=Math.imul(j,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(q,Ct)|0,n=(n=n+Math.imul(q,vt)|0)+Math.imul(P,Ct)|0,o=o+Math.imul(P,vt)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(j,Et),n=(n=Math.imul(j,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,Ct)|0,n=(n=n+Math.imul(H,vt)|0)+Math.imul(Y,Ct)|0,o=o+Math.imul(Y,vt)|0;var Jt=(u+(a=a+Math.imul(q,wt)|0)|0)+((8191&(n=(n=n+Math.imul(q,Mt)|0)+Math.imul(P,wt)|0))<<13)|0;u=((o=o+Math.imul(P,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(j,Ct),n=(n=Math.imul(j,vt))+Math.imul(z,Ct)|0,o=Math.imul(z,vt);var Kt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863;var jt=(u+(a=Math.imul(j,wt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=qt,d[12]=Pt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=Jt,d[17]=Kt,d[18]=jt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(s=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?s(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,c&=67108863}r.words[o]=s,a=c,c=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var c=0;c>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),c=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&c}return s&&0!==u&&(s.words[s.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(s/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===c)return this.strip();for(assert(-1===c),c=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var c,s=a.length-n.length;if("mod"!==t){(c=new BN(null)).length=s+1,c.words=new Array(c.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);c&&(c.words[h]=l)}return c&&c.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:c||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),c=new BN(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(d),c.isub(u)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(c)):(r.isub(t),o.isub(a),c.isub(n))}return{a:o,b:c,gcd:r.iushln(s)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var s=0,d=1;0==(t.words[0]&d)&&s<26;++s,d<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(c),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,c&=67108863,this.words[o]=c}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=c}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),c=o.redNeg(),s=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,s).cmp(c);)d.redIAdd(c);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=s-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++c||0===a&&0===u)&&(n=this.mul(n,r[o]),c=0,o=0)):c=0}s=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(18).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),c=t;c=49?s-49+10:s>=17?s-17+10:s}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,c=o%a,s=Math.min(o,o-c)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],o=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],c=n*o,s=67108863&c,d=c/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(c=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&c}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,s=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=c[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,c,s="le"===t,d=new e(n),u=this.clone();if(s){for(c=0;!u.isZero();c++)o=u.andln(255),u.iushrn(8),d[c]=o;for(;c=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,c=0;c>26,this.words[c]=67108863&t;for(;0!==o&&c>26,this.words[c]=67108863&t;if(0===o&&c>>13,g=0|c[1],p=8191&g,B=g>>>13,m=0|c[2],I=8191&m,y=m>>>13,x=0|c[3],C=8191&x,v=x>>>13,Q=0|c[4],w=8191&Q,_=Q>>>13,k=0|c[5],N=8191&k,D=k>>>13,U=0|c[6],G=8191&U,T=U>>>13,L=0|c[7],q=8191&L,P=L>>>13,O=0|c[8],H=8191&O,Y=O>>>13,J=0|c[9],j=8191&J,z=J>>>13,W=0|s[0],V=8191&W,X=W>>>13,$=0|s[1],et=8191&$,tt=$>>>13,rt=0|s[2],at=8191&rt,it=rt>>>13,nt=0|s[3],ot=8191&nt,At=nt>>>13,ct=0|s[4],st=8191&ct,dt=ct>>>13,ut=0|s[5],ht=8191&ut,bt=ut>>>13,pt=0|s[6],Bt=8191&pt,mt=pt>>>13,It=0|s[7],Et=8191&It,yt=It>>>13,xt=0|s[8],Ct=8191&xt,vt=xt>>>13,Qt=0|s[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(C,V),n=(n=Math.imul(C,X))+Math.imul(v,V)|0,o=Math.imul(v,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(C,et)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(v,et)|0,o=o+Math.imul(v,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,st)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(C,at)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(v,at)|0,o=o+Math.imul(v,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,st)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,st)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,At)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,At)|0,a=a+Math.imul(I,st)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,st)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(q,V),n=(n=Math.imul(q,X))+Math.imul(P,V)|0,o=Math.imul(P,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(C,st)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(v,st)|0,o=o+Math.imul(v,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(q,et)|0,n=(n=n+Math.imul(q,tt)|0)+Math.imul(P,et)|0,o=o+Math.imul(P,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,st)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,st)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,bt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,Ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,vt)|0)+Math.imul(b,Ct)|0))<<13)|0;u=((o=o+Math.imul(b,vt)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(j,V),n=(n=Math.imul(j,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(q,at)|0,n=(n=n+Math.imul(q,it)|0)+Math.imul(P,at)|0,o=o+Math.imul(P,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,st)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,st)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(C,Bt)|0,n=(n=n+Math.imul(C,mt)|0)+Math.imul(v,Bt)|0,o=o+Math.imul(v,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,Ct)|0,n=(n=n+Math.imul(p,vt)|0)+Math.imul(B,Ct)|0,o=o+Math.imul(B,vt)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(j,et),n=(n=Math.imul(j,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(q,ot)|0,n=(n=n+Math.imul(q,At)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,At)|0,a=a+Math.imul(G,st)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,st)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(C,Et)|0,n=(n=n+Math.imul(C,yt)|0)+Math.imul(v,Et)|0,o=o+Math.imul(v,yt)|0,a=a+Math.imul(I,Ct)|0,n=(n=n+Math.imul(I,vt)|0)+Math.imul(y,Ct)|0,o=o+Math.imul(y,vt)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(j,at),n=(n=Math.imul(j,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(q,st)|0,n=(n=n+Math.imul(q,dt)|0)+Math.imul(P,st)|0,o=o+Math.imul(P,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(C,Ct)|0,n=(n=n+Math.imul(C,vt)|0)+Math.imul(v,Ct)|0,o=o+Math.imul(v,vt)|0;var qt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(j,ot),n=(n=Math.imul(j,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,st)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,st)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(q,ht)|0,n=(n=n+Math.imul(q,bt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,Ct)|0,n=(n=n+Math.imul(w,vt)|0)+Math.imul(_,Ct)|0,o=o+Math.imul(_,vt)|0;var Pt=(u+(a=a+Math.imul(C,wt)|0)|0)+((8191&(n=(n=n+Math.imul(C,Mt)|0)+Math.imul(v,wt)|0))<<13)|0;u=((o=o+Math.imul(v,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(j,st),n=(n=Math.imul(j,dt))+Math.imul(z,st)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(q,Bt)|0,n=(n=n+Math.imul(q,mt)|0)+Math.imul(P,Bt)|0,o=o+Math.imul(P,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,Ct)|0,n=(n=n+Math.imul(N,vt)|0)+Math.imul(D,Ct)|0,o=o+Math.imul(D,vt)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(j,ht),n=(n=Math.imul(j,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(q,Et)|0,n=(n=n+Math.imul(q,yt)|0)+Math.imul(P,Et)|0,o=o+Math.imul(P,yt)|0,a=a+Math.imul(G,Ct)|0,n=(n=n+Math.imul(G,vt)|0)+Math.imul(T,Ct)|0,o=o+Math.imul(T,vt)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(j,Bt),n=(n=Math.imul(j,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(q,Ct)|0,n=(n=n+Math.imul(q,vt)|0)+Math.imul(P,Ct)|0,o=o+Math.imul(P,vt)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(j,Et),n=(n=Math.imul(j,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,Ct)|0,n=(n=n+Math.imul(H,vt)|0)+Math.imul(Y,Ct)|0,o=o+Math.imul(Y,vt)|0;var Jt=(u+(a=a+Math.imul(q,wt)|0)|0)+((8191&(n=(n=n+Math.imul(q,Mt)|0)+Math.imul(P,wt)|0))<<13)|0;u=((o=o+Math.imul(P,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(j,Ct),n=(n=Math.imul(j,vt))+Math.imul(z,Ct)|0,o=Math.imul(z,vt);var Kt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863;var jt=(u+(a=Math.imul(j,wt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=qt,d[12]=Pt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=Jt,d[17]=Kt,d[18]=jt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(s=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?s(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,c&=67108863}r.words[o]=s,a=c,c=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var c=0;c>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),c=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&c}return s&&0!==u&&(s.words[s.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(s/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===c)return this.strip();for(assert(-1===c),c=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var c,s=a.length-n.length;if("mod"!==t){(c=new BN(null)).length=s+1,c.words=new Array(c.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);c&&(c.words[h]=l)}return c&&c.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:c||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),c=new BN(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(d),c.isub(u)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(c)):(r.isub(t),o.isub(a),c.isub(n))}return{a:o,b:c,gcd:r.iushln(s)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var s=0,d=1;0==(t.words[0]&d)&&s<26;++s,d<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(c),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,c&=67108863,this.words[o]=c}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=c}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),c=o.redNeg(),s=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,s).cmp(c);)d.redIAdd(c);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=s-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++c||0===a&&0===u)&&(n=this.mul(n,r[o]),c=0,o=0)):c=0}s=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},function(e,t,r){"use strict";var a,n=this&&this.__extends||(a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function __(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),o=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},c=this&&this.__generator||function(e,t){var r,a,n,o,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(s){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,a=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(n=c.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0)&&!(a=o.next()).done;)c.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return c},d=this&&this.__spread||function(){for(var e=[],t=0;t0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var h,l,b=r(168),g=r(4),p=u(r(86)),B=u(r(66)),m=r(1417),I=u(r(650)),y=u(r(652)),x=u(r(112)),C=u(r(44)),v=r(111),Q=r(255),w=u(r(308)),_=r(1446),k=r(1097),N=new Function("try {return this===window;}catch(e){ return false;}");N()||(h=r(1125),l=h.init(h.BLS12_381));var D=function(e){function VM(t){var r,a,n;void 0===t&&(t={});var o=e.call(this)||this;if(o._isInitialized=!1,o._opts=t,"chain"in t||"hardfork"in t)throw new Error("Chain/hardfork options are not allowed any more on initialization");if(t.common){var c=[2315,2537,2565,2718,2929,2930];try{for(var s=d(t.common.eips()),u=s.next();!u.done;u=s.next()){var l=u.value;if(!c.includes(l))throw new Error(l+" is not supported by the VM")}}catch(e){r={error:e}}finally{try{u&&!u.done&&(a=s.return)&&a.call(s)}finally{if(r)throw r.error}}o._common=t.common}else{o._common=new B.default({chain:"mainnet",supportedHardforks:["chainstart","homestead","dao","tangerineWhistle","spuriousDragon","byzantium","constantinople","petersburg","istanbul","muirGlacier","berlin"]})}if(o._common.on("hardforkChanged",(function(){o._opcodes=v.getOpcodesForHF(o._common)})),o._opcodes=v.getOpcodesForHF(o._common),t.stateManager)o.stateManager=t.stateManager;else{var g=t.state||new b.SecureTrie;o.stateManager=new m.DefaultStateManager({trie:g,common:o._common})}if(o.blockchain=t.blockchain||new p.default({common:o._common}),o._allowUnlimitedContractSize=t.allowUnlimitedContractSize||!1,o._hardforkByBlockNumber=null!==(n=t.hardforkByBlockNumber)&&void 0!==n&&n,o._common.isActivatedEIP(2537)){if(N())throw new Error("EIP-2537 is currently not supported in browsers");o._mcl=h}return o._emit=k(o.emit.bind(o)),o}return o(VM,e),VM.create=function(e){return void 0===e&&(e={}),c(this,void 0,void 0,(function(){var t;return s(this,(function(r){switch(r.label){case 0:return[4,(t=new this(e)).init()];case 1:return r.sent(),[2,t]}}))}))},VM.prototype.init=function(){return c(this,void 0,void 0,(function(){var e,t=this;return s(this,(function(r){switch(r.label){case 0:return this._isInitialized?[2]:[4,this.blockchain.initPromise];case 1:return r.sent(),!this._opts.activatePrecompiles||this._opts.stateManager?[3,5]:[4,this.stateManager.checkpoint()];case 2:return r.sent(),[4,Promise.all(Object.keys(Q.precompiles).map((function(e){return new g.Address(n.from(e,"hex"))})).map((function(e){return c(t,void 0,void 0,(function(){var t;return s(this,(function(r){switch(r.label){case 0:return t=g.Account.fromAccountData({balance:1}),[4,this.stateManager.putAccount(e,t)];case 1:return r.sent(),[2]}}))}))})))];case 3:return r.sent(),[4,this.stateManager.commit()];case 4:r.sent(),r.label=5;case 5:if(!this._common.isActivatedEIP(2537))return[3,8];if(!N())return[3,6];throw new Error("EIP-2537 is currently not supported in browsers");case 6:return e=this._mcl,[4,l];case 7:r.sent(),e.setMapToMode(e.IRTF),e.verifyOrderG1(1),e.verifyOrderG2(1),r.label=8;case 8:return this._isInitialized=!0,[2]}}))}))},VM.prototype.runBlockchain=function(e,t){return c(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return[4,this.init()];case 1:return r.sent(),[2,w.default.bind(this)(e,t)]}}))}))},VM.prototype.runBlock=function(e){return c(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.init()];case 1:return t.sent(),[2,C.default.bind(this)(e)]}}))}))},VM.prototype.runTx=function(e){return c(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.init()];case 1:return t.sent(),[2,x.default.bind(this)(e)]}}))}))},VM.prototype.runCall=function(e){return c(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.init()];case 1:return t.sent(),[2,y.default.bind(this)(e)]}}))}))},VM.prototype.runCode=function(e){return c(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.init()];case 1:return t.sent(),[2,I.default.bind(this)(e)]}}))}))},VM.prototype.getActiveOpcodes=function(){return v.getOpcodesForHF(this._common)},VM.prototype.copy=function(){return new VM({stateManager:this.stateManager.copy(),blockchain:this.blockchain,common:this._common})},VM}(_);t.default=D},function(e,t,r){"use strict";var a=this&&this.__assign||function(){return(a=Object.assign||function(e){for(var t,r=1,a=arguments.length;r0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},s=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),c=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)c.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return c};Object.defineProperty(t,"__esModule",{value:!0}),t.Block=void 0;var d=r(168),u=r(16),h=r(209),l=r(95),b=function(){function Block(e,t,r,a){var n;if(void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===a&&(a={}),this.transactions=[],this.uncleHeaders=[],this.txTrie=new d.BaseTrie,this.header=null!=e?e:l.BlockHeader.fromHeaderData({},a),this.transactions=t,this.uncleHeaders=r,this._common=this.header._common,"poa"===this._common.consensusType()&&r.length>0)throw new Error("Block initialization with uncleHeaders on a PoA network is not allowed");(null===(n=null==a?void 0:a.freeze)||void 0===n||n)&&Object.freeze(this)}return Block.fromBlockData=function(e,t){var r,n,o,s;void 0===e&&(e={});var d=e.header,u=e.transactions,b=e.uncleHeaders,g=l.BlockHeader.fromHeaderData(d,t),p=[];try{for(var B=c(null!=u?u:[]),m=B.next();!m.done;m=B.next()){var I=m.value,y=h.TransactionFactory.fromTxData(I,a(a({},t),{common:g._common}));p.push(y)}}catch(e){r={error:e}}finally{try{m&&!m.done&&(n=B.return)&&n.call(B)}finally{if(r)throw r.error}}var x=[];try{for(var C=c(null!=b?b:[]),v=C.next();!v.done;v=C.next()){var Q=v.value,w=l.BlockHeader.fromHeaderData(Q,a(a({},t),{common:g._common,calcDifficultyFromHeader:void 0}));x.push(w)}}catch(e){o={error:e}}finally{try{v&&!v.done&&(s=C.return)&&s.call(C)}finally{if(o)throw o.error}}return new Block(g,p,x,t)},Block.fromRLPSerializedBlock=function(e,t){var r=u.rlp.decode(e);if(!Array.isArray(r))throw new Error("Invalid serialized block input. Must be array");return Block.fromValuesArray(r,t)},Block.fromValuesArray=function(e,t){var r,n,o,d;if(e.length>3)throw new Error("invalid block. More values than expected were received");var u=s(e,3),b=u[0],g=u[1],p=u[2],B=l.BlockHeader.fromValuesArray(b,t),m=[];try{for(var I=c(g||[]),y=I.next();!y.done;y=I.next()){var x=y.value;m.push(h.TransactionFactory.fromBlockBodyData(x,a(a({},t),{common:B._common})))}}catch(e){r={error:e}}finally{try{y&&!y.done&&(n=I.return)&&n.call(I)}finally{if(r)throw r.error}}var C=[];try{for(var v=c(p||[]),Q=v.next();!Q.done;Q=v.next()){var w=Q.value;C.push(l.BlockHeader.fromValuesArray(w,a(a({},t),{common:B._common,calcDifficultyFromHeader:void 0})))}}catch(e){o={error:e}}finally{try{Q&&!Q.done&&(d=v.return)&&d.call(v)}finally{if(o)throw o.error}}return new Block(B,m,C,t)},Block.genesis=function(e,t){return void 0===e&&(e={}),t=a(a({},t),{initWithGenesisHeader:!0}),Block.fromBlockData(e,t)},Block.prototype.raw=function(){return[this.header.raw(),this.transactions.map((function(e){return e.supports(h.Capability.EIP2718TypedTransaction)?e.serialize():e.raw()})),this.uncleHeaders.map((function(e){return e.raw()}))]},Block.prototype.hash=function(){return this.header.hash()},Block.prototype.isGenesis=function(){return this.header.isGenesis()},Block.prototype.serialize=function(){return u.rlp.encode(this.raw())},Block.prototype.genTxTrie=function(){return n(this,void 0,void 0,(function(){var e,t,r,a,n,c,s;return o(this,(function(o){switch(o.label){case 0:t=(e=this).transactions,r=e.txTrie,a=0,o.label=1;case 1:return a0&&r.push("errors at tx "+a+": "+n.join(", "))})),e?r:0===r.length},Block.prototype.validate=function(e,t){return void 0===t&&(t=!1),n(this,void 0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:return[4,this.header.validate(e)];case 1:return r.sent(),[4,this.validateUncles(e)];case 2:return r.sent(),[4,this.validateData(t)];case 3:return r.sent(),[2]}}))}))},Block.prototype.validateData=function(e){return void 0===e&&(e=!1),n(this,void 0,void 0,(function(){var t,r;return o(this,(function(a){switch(a.label){case 0:if((t=this.validateTransactions(!0)).length>0)throw r="invalid transactions: "+t.join(" "),this.header._error(r);return e?[3,2]:[4,this.validateTransactionsTrie()];case 1:if(!a.sent())throw new Error("invalid transaction trie");if(!this.validateUnclesHash())throw new Error("invalid uncle hash");a.label=2;case 2:return[2]}}))}))},Block.prototype.validateUnclesHash=function(){var e=u.rlp.encode(this.uncleHeaders.map((function(e){return e.raw()})));return u.keccak256(e).equals(this.header.uncleHash)},Block.prototype.validateUncles=function(e){return n(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:if(this.isGenesis())return[2];if(this.uncleHeaders.length>2)throw new Error("too many uncle headers");if(t=this.uncleHeaders.map((function(e){return e.hash().toString("hex")})),new Set(t).size!==t.length)throw new Error("duplicate uncles");return[4,this._validateUncleHeaders(this.uncleHeaders,e)];case 1:return r.sent(),[2]}}))}))},Block.prototype.canonicalDifficulty=function(e){return this.header.canonicalDifficulty(e.header)},Block.prototype.validateDifficulty=function(e){return this.header.validateDifficulty(e.header)},Block.prototype.validateGasLimit=function(e){return this.header.validateGasLimit(e.header)},Block.prototype.toJSON=function(){return{header:this.header.toJSON(),transactions:this.transactions.map((function(e){return e.toJSON()})),uncleHeaders:this.uncleHeaders.map((function(e){return e.toJSON()}))}},Block.prototype._error=function(e){return this.header._error(e)},Block.prototype._validateUncleHeaders=function(e,t){return n(this,void 0,void 0,(function(){var r,a,n,c,s,d,u,h,l=this;return o(this,(function(o){switch(o.label){case 0:return 0==e.length?[2]:[4,Promise.all(e.map((function(e){return e.validate(t,l.header.number)})))];case 1:o.sent(),r=[],a=this.header.number.clone(),e.map((function(e){e.number.lt(a)&&(a=e.number.clone())})),n={},c={},s=this.header.number.clone().sub(a).addn(1).toNumber(),d=this.header.parentHash,u=0,o.label=2;case 2:return u{var check=function(e){return e&&e.Math==Math&&e};e.exports=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof r.g&&r.g)||function(){return this}()||Function("return this")()},(e,t,r)=>{var a=r(107),n=r(634),o=r(123),c=r(394),s=r(633),d=r(632),u=n("wks"),h=a.Symbol,l=d?h:h&&h.withoutSetter||c;e.exports=function(e){return o(u,e)&&(s||"string"==typeof u[e])||(s&&o(h,e)?u[e]=h[e]:u[e]=l("Symbol."+e)),u[e]}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0});var o=r(110);Object.defineProperty(t,"Block",{enumerable:!0,get:function(){return o.Block}});var c=r(97);Object.defineProperty(t,"BlockHeader",{enumerable:!0,get:function(){return c.BlockHeader}}),n(r(1433),t)},function(e,t,r){"use strict";var a=this&&this.__assign||function(){return(a=Object.assign||function(e){for(var t,r=1,a=arguments.length;r0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},s=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),c=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)c.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return c};Object.defineProperty(t,"__esModule",{value:!0}),t.Block=void 0;var d=r(168),u=r(4),h=r(256),l=r(97),b=function(){function Block(e,t,r,a){var n;if(void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===a&&(a={}),this.transactions=[],this.uncleHeaders=[],this.txTrie=new d.BaseTrie,this.header=e||l.BlockHeader.fromHeaderData({},a),this.transactions=t,this.uncleHeaders=r,this._common=this.header._common,"poa"===this._common.consensusType()&&r.length>0)throw new Error("Block initialization with uncleHeaders on a PoA network is not allowed");(null===(n=null==a?void 0:a.freeze)||void 0===n||n)&&Object.freeze(this)}return Block.fromBlockData=function(e,t){var r,n,o,s;void 0===e&&(e={});var d=e.header,u=e.transactions,b=e.uncleHeaders,g=l.BlockHeader.fromHeaderData(d,t),p=[];try{for(var B=c(u||[]),m=B.next();!m.done;m=B.next()){var I=m.value,y=h.TransactionFactory.fromTxData(I,a(a({},t),{common:g._common}));p.push(y)}}catch(e){r={error:e}}finally{try{m&&!m.done&&(n=B.return)&&n.call(B)}finally{if(r)throw r.error}}var x=[];try{for(var C=c(b||[]),v=C.next();!v.done;v=C.next()){var Q=v.value,w=l.BlockHeader.fromHeaderData(Q,a(a({},t),{common:g._common,calcDifficultyFromHeader:void 0}));x.push(w)}}catch(e){o={error:e}}finally{try{v&&!v.done&&(s=C.return)&&s.call(C)}finally{if(o)throw o.error}}return new Block(g,p,x,t)},Block.fromRLPSerializedBlock=function(e,t){var r=u.rlp.decode(e);if(!Array.isArray(r))throw new Error("Invalid serialized block input. Must be array");return Block.fromValuesArray(r,t)},Block.fromValuesArray=function(e,t){var r,n,o,d;if(e.length>3)throw new Error("invalid block. More values than expected were received");var u=s(e,3),b=u[0],g=u[1],p=u[2],B=l.BlockHeader.fromValuesArray(b,t),m=[];try{for(var I=c(g||[]),y=I.next();!y.done;y=I.next()){var x=y.value;m.push(h.TransactionFactory.fromBlockBodyData(x,a(a({},t),{common:B._common})))}}catch(e){r={error:e}}finally{try{y&&!y.done&&(n=I.return)&&n.call(I)}finally{if(r)throw r.error}}var C=[];try{for(var v=c(p||[]),Q=v.next();!Q.done;Q=v.next()){var w=Q.value;C.push(l.BlockHeader.fromValuesArray(w,a(a({},t),{common:B._common,calcDifficultyFromHeader:void 0})))}}catch(e){o={error:e}}finally{try{Q&&!Q.done&&(d=v.return)&&d.call(v)}finally{if(o)throw o.error}}return new Block(B,m,C,t)},Block.genesis=function(e,t){return void 0===e&&(e={}),t=a(a({},t),{initWithGenesisHeader:!0}),Block.fromBlockData(e,t)},Block.prototype.raw=function(){return[this.header.raw(),this.transactions.map((function(e){return"transactionType"in e&&e.transactionType>0?e.serialize():e.raw()})),this.uncleHeaders.map((function(e){return e.raw()}))]},Block.prototype.hash=function(){return this.header.hash()},Block.prototype.isGenesis=function(){return this.header.isGenesis()},Block.prototype.serialize=function(){return u.rlp.encode(this.raw())},Block.prototype.genTxTrie=function(){return n(this,void 0,void 0,(function(){var e,t,r,a,n,c,s;return o(this,(function(o){switch(o.label){case 0:t=(e=this).transactions,r=e.txTrie,a=0,o.label=1;case 1:return a0&&t.push("errors at tx "+r+": "+a.join(", "))})),e?t:0===t.length},Block.prototype.validate=function(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.header.validate(e)];case 1:return t.sent(),[4,this.validateUncles(e)];case 2:return t.sent(),[4,this.validateData()];case 3:return t.sent(),[2]}}))}))},Block.prototype.validateData=function(){return n(this,void 0,void 0,(function(){var e,t;return o(this,(function(r){switch(r.label){case 0:if((e=this.validateTransactions(!0)).length>0)throw t="invalid transactions: "+e.join(" "),this.header._error(t);return[4,this.validateTransactionsTrie()];case 1:if(!r.sent())throw new Error("invalid transaction trie");if(!this.validateUnclesHash())throw new Error("invalid uncle hash");return[2]}}))}))},Block.prototype.validateUnclesHash=function(){var e=u.rlp.encode(this.uncleHeaders.map((function(e){return e.raw()})));return u.keccak256(e).equals(this.header.uncleHash)},Block.prototype.validateUncles=function(e){return n(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:if(this.isGenesis())return[2];if(this.uncleHeaders.length>2)throw new Error("too many uncle headers");if(t=this.uncleHeaders.map((function(e){return e.hash().toString("hex")})),new Set(t).size!==t.length)throw new Error("duplicate uncles");return[4,this._validateUncleHeaders(this.uncleHeaders,e)];case 1:return r.sent(),[2]}}))}))},Block.prototype.canonicalDifficulty=function(e){return this.header.canonicalDifficulty(e.header)},Block.prototype.validateDifficulty=function(e){return this.header.validateDifficulty(e.header)},Block.prototype.validateGasLimit=function(e){return this.header.validateGasLimit(e.header)},Block.prototype.toJSON=function(){return{header:this.header.toJSON(),transactions:this.transactions.map((function(e){return e.toJSON()})),uncleHeaders:this.uncleHeaders.map((function(e){return e.toJSON()}))}},Block.prototype._error=function(e){return this.header._error(e)},Block.prototype._validateUncleHeaders=function(e,t){return n(this,void 0,void 0,(function(){var r,a,n,c,s,d,u,h,l=this;return o(this,(function(o){switch(o.label){case 0:return 0==e.length?[2]:[4,Promise.all(e.map((function(e){return e.validate(t,l.header.number)})))];case 1:o.sent(),r=[],a=this.header.number.clone(),e.map((function(e){e.number.lt(a)&&(a=e.number.clone())})),n={},c={},s=this.header.number.clone().sub(a).addn(1).toNumber(),d=this.header.parentHash,u=0,o.label=2;case 2:return u0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var u=r(51),h=r(4),l=r(109),b=d(r(405)),g=d(r(13)),p=r(124),B=d(r(404)),m=d(r(651)),I=r(255),y=u.debug("vm:tx"),x=u.debug("vm:tx:gas");function _runTx(e){var t;return o(this,void 0,void 0,(function(){var r,o,d,u,l,C,v,Q,w,_,k,N,D,U,G,T,L,q,P,O,H,Y,J,j,z,W,V,X,$,et,tt,rt;return c(this,(function(c){switch(c.label){case 0:if(r=this.stateManager,o=e.tx,!(d=e.block))throw new Error("block required");return[4,this._emit("beforeTx",o)];case 1:if(c.sent(),u=o.getSenderAddress(),y("New tx run hash="+e.tx.hash().toString("hex")+" sender="+u.toString()),this._common.isActivatedEIP(2929)&&(I.getActivePrecompiles(this._common).forEach((function(e){return r.addWarmedAddress(e.buf)})),r.addWarmedAddress(u.buf),o.to&&r.addWarmedAddress(o.to.buf)),l=o.getBaseFee(),(C=o.gasLimit.clone()).lt(l))throw new Error("base fee exceeds gas limit");return C.isub(l),x("Subtracting base fee ("+l+") from gasLimit (-> "+C+")"),[4,r.getAccount(u)];case 2:if(v=c.sent(),Q=v.nonce,w=v.balance,e.skipBalance){if(!e.skipNonce&&!Q.eq(o.nonce))throw new Error("the tx doesn't have the correct nonce. account has nonce of: "+Q+" tx has nonce of: "+o.nonce)}else if(_=o.getUpfrontCost(),w.lt(_))throw new Error("sender doesn't have enough funds to send tx. The upfront cost is: "+_+" and the sender's account only has: "+w);return v.nonce.iaddn(1),k=o.gasLimit.mul(o.gasPrice),v.balance.isub(k),[4,r.putAccount(u,v)];case 3:return c.sent(),y("Update fromAccount (caller) nonce (-> "+v.nonce+") and balance(-> "+v.balance+")"),N=new m.default(o.gasPrice,u),D=o.value,U=o.data,G=o.to,T=new B.default({caller:u,gasLimit:C,to:G,value:D,data:U}),L=new g.default(this,N,d),y("Running tx=0x"+o.hash().toString("hex")+" with caller="+u.toString()+" gasLimit="+C+" to="+(G?G.toString():"")+" value="+D+" data=0x"+p.short(U)),[4,L.executeMessage(T)];case 4:return q=c.sent(),y("-".repeat(100)),y("Received tx results gasUsed="+q.gasUsed+" execResult: [ gasUsed="+q.gasUsed+" exceptionError="+(q.execResult.exceptionError?q.execResult.exceptionError.error:"")+" returnValue="+p.short(q.execResult.returnValue)+" gasRefund="+q.execResult.gasRefund+" ]"),q.bloom=function txLogsBloom(e){var t=new b.default;if(e)for(var r=0;r "+q.gasUsed+")"),(P=L._refund).gtn(0)?(P.lt(q.gasUsed.divn(2))||(P=q.gasUsed.divn(2)),q.gasUsed.isub(P),y("Subtract tx gasRefund ("+P+") from gasUsed (-> "+q.gasUsed+")")):y("No tx gasRefund"),q.amountSpent=q.gasUsed.mul(o.gasPrice),[4,r.getAccount(u)];case 5:return v=c.sent(),O=q.gasUsed.mul(o.gasPrice),H=k.sub(O),v.balance.iadd(H),[4,r.putAccount(u,v)];case 6:return c.sent(),y("Refunded txCostDiff ("+H+") to fromAccount (caller) balance (-> "+v.balance+")"),Y="pow"===this._common.consensusType()?d.header.coinbase:"cliqueSigner"in d.header?d.header.cliqueSigner():h.Address.zero(),[4,r.getAccount(Y)];case 7:return(J=c.sent()).balance.iadd(q.amountSpent),[4,r.putAccount(Y,J)];case 8:if(c.sent(),y("tx update miner account ("+Y.toString()+") balance (-> "+J.balance+")"),!q.execResult.selfdestruct)return[3,16];j=Object.keys(q.execResult.selfdestruct),c.label=9;case 9:c.trys.push([9,14,15,16]),z=s(j),W=z.next(),c.label=10;case 10:return W.done?[3,13]:(V=W.value,X=new h.Address(a.from(V,"hex")),[4,r.deleteAccount(X)]);case 11:c.sent(),y("tx selfdestruct on address="+X.toString()),c.label=12;case 12:return W=z.next(),[3,10];case 13:return[3,16];case 14:return $=c.sent(),tt={error:$},[3,16];case 15:try{W&&!W.done&&(rt=z.return)&&rt.call(z)}finally{if(tt)throw tt.error}return[7];case 16:return[4,r.cleanupTouchedAccounts()];case 17:return c.sent(),r.clearOriginalStorageCache(),et=n({transaction:o},q),[4,this._emit("afterTx",et)];case 18:return c.sent(),y("tx run finished hash="+e.tx.hash().toString("hex")+" sender="+u.toString()),[2,q]}}))}))}t.default=function runTx(e){var t;return o(this,void 0,void 0,(function(){var r,n,o;return c(this,(function(c){switch(c.label){case 0:if(!e.tx)throw new Error("invalid input, tx is required");if(e.block=null!==(t=e.block)&&void 0!==t?t:l.Block.fromBlockData({},{common:e.tx.common}),!0!==e.skipBlockGasLimitValidation&&e.block.header.gasLimit.lt(e.tx.gasLimit))throw new Error("tx has a higher gas limit than the block");return r=this.stateManager,this._common.isActivatedEIP(2929)&&r.clearWarmedAccounts(),[4,r.checkpoint()];case 1:if(c.sent(),y("-".repeat(100)),y("tx checkpoint"),"transactionType"in e.tx&&1===e.tx.transactionType&&this._common.isActivatedEIP(2929)){if(!this._common.isActivatedEIP(2930))throw new Error("Cannot run transaction: EIP 2930 is not activated.");e.tx.AccessListJSON.forEach((function(e){var t=a.from(e.address.slice(2),"hex");r.addWarmedAddress(t),e.storageKeys.forEach((function(e){r.addWarmedStorage(t,a.from(e.slice(2),"hex"))}))}))}c.label=2;case 2:return c.trys.push([2,5,7,8]),[4,_runTx.bind(this)(e)];case 3:return n=c.sent(),[4,r.commit()];case 4:return c.sent(),y("tx checkpoint committed"),[2,n];case 5:return o=c.sent(),[4,r.revert()];case 6:throw c.sent(),y("tx checkpoint reverted"),o;case 7:return this._common.isActivatedEIP(2929)&&r.clearWarmedAccounts(),[7];case 8:return[2]}}))}))}},(e,t,r)=>{"use strict";var a=r(14),n=r(229),o=n(a("String.prototype.indexOf"));e.exports=function callBoundIntrinsic(e,t){var r=a(e,!!t);return"function"==typeof r&&o(e,".prototype.")>-1?n(r):r}},(e,t,r)=>{"use strict";var a=r(70),n=r(10);function isSurrogatePair(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function htonl(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function zero2(e){return 1===e.length?"0"+e:e}function zero8(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=n,t.toArray=function toArray(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n>6|192,r[a++]=63&o|128):isSurrogatePair(e,n)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++n)),r[a++]=o>>18|240,r[a++]=o>>12&63|128,r[a++]=o>>6&63|128,r[a++]=63&o|128):(r[a++]=o>>12|224,r[a++]=o>>6&63|128,r[a++]=63&o|128)}else for(n=0;n>>0}return c},t.split32=function split32(e,t){for(var r=new Array(4*e.length),a=0,n=0;a>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=255&o):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=255&o)}return r},t.rotr32=function rotr32(e,t){return e>>>t|e<<32-t},t.rotl32=function rotl32(e,t){return e<>>32-t},t.sum32=function sum32(e,t){return e+t>>>0},t.sum32_3=function sum32_3(e,t,r){return e+t+r>>>0},t.sum32_4=function sum32_4(e,t,r,a){return e+t+r+a>>>0},t.sum32_5=function sum32_5(e,t,r,a,n){return e+t+r+a+n>>>0},t.sum64=function sum64(e,t,r,a){var n=e[t],o=a+e[t+1]>>>0,c=(o>>0,e[t+1]=o},t.sum64_hi=function sum64_hi(e,t,r,a){return(t+a>>>0>>0},t.sum64_lo=function sum64_lo(e,t,r,a){return t+a>>>0},t.sum64_4_hi=function sum64_4_hi(e,t,r,a,n,o,c,s){var d=0,u=t;return d+=(u=u+a>>>0)>>0)>>0)>>0},t.sum64_4_lo=function sum64_4_lo(e,t,r,a,n,o,c,s){return t+a+o+s>>>0},t.sum64_5_hi=function sum64_5_hi(e,t,r,a,n,o,c,s,d,u){var h=0,l=t;return h+=(l=l+a>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function sum64_5_lo(e,t,r,a,n,o,c,s,d,u){return t+a+o+s+u>>>0},t.rotr64_hi=function rotr64_hi(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function rotr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function shr64_hi(e,t,r){return e>>>r},t.shr64_lo=function shr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0}},(e,t,r)=>{"use strict";var a=r(159),n=r(23);function isSurrogatePair(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function htonl(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function zero2(e){return 1===e.length?"0"+e:e}function zero8(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=n,t.toArray=function toArray(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n>6|192,r[a++]=63&o|128):isSurrogatePair(e,n)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++n)),r[a++]=o>>18|240,r[a++]=o>>12&63|128,r[a++]=o>>6&63|128,r[a++]=63&o|128):(r[a++]=o>>12|224,r[a++]=o>>6&63|128,r[a++]=63&o|128)}else for(n=0;n>>0}return c},t.split32=function split32(e,t){for(var r=new Array(4*e.length),a=0,n=0;a>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=255&o):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=255&o)}return r},t.rotr32=function rotr32(e,t){return e>>>t|e<<32-t},t.rotl32=function rotl32(e,t){return e<>>32-t},t.sum32=function sum32(e,t){return e+t>>>0},t.sum32_3=function sum32_3(e,t,r){return e+t+r>>>0},t.sum32_4=function sum32_4(e,t,r,a){return e+t+r+a>>>0},t.sum32_5=function sum32_5(e,t,r,a,n){return e+t+r+a+n>>>0},t.sum64=function sum64(e,t,r,a){var n=e[t],o=a+e[t+1]>>>0,c=(o>>0,e[t+1]=o},t.sum64_hi=function sum64_hi(e,t,r,a){return(t+a>>>0>>0},t.sum64_lo=function sum64_lo(e,t,r,a){return t+a>>>0},t.sum64_4_hi=function sum64_4_hi(e,t,r,a,n,o,c,s){var d=0,u=t;return d+=(u=u+a>>>0)>>0)>>0)>>0},t.sum64_4_lo=function sum64_4_lo(e,t,r,a,n,o,c,s){return t+a+o+s>>>0},t.sum64_5_hi=function sum64_5_hi(e,t,r,a,n,o,c,s,d,u){var h=0,l=t;return h+=(l=l+a>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function sum64_5_lo(e,t,r,a,n,o,c,s,d,u){return t+a+o+s+u>>>0},t.rotr64_hi=function rotr64_hi(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function rotr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function shr64_hi(e,t,r){return e>>>r},t.shr64_lo=function shr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0}},(e,t,r)=>{"use strict";var a=r(161),n=r(24);function isSurrogatePair(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function htonl(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function zero2(e){return 1===e.length?"0"+e:e}function zero8(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=n,t.toArray=function toArray(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n>6|192,r[a++]=63&o|128):isSurrogatePair(e,n)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++n)),r[a++]=o>>18|240,r[a++]=o>>12&63|128,r[a++]=o>>6&63|128,r[a++]=63&o|128):(r[a++]=o>>12|224,r[a++]=o>>6&63|128,r[a++]=63&o|128)}else for(n=0;n>>0}return c},t.split32=function split32(e,t){for(var r=new Array(4*e.length),a=0,n=0;a>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=255&o):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=255&o)}return r},t.rotr32=function rotr32(e,t){return e>>>t|e<<32-t},t.rotl32=function rotl32(e,t){return e<>>32-t},t.sum32=function sum32(e,t){return e+t>>>0},t.sum32_3=function sum32_3(e,t,r){return e+t+r>>>0},t.sum32_4=function sum32_4(e,t,r,a){return e+t+r+a>>>0},t.sum32_5=function sum32_5(e,t,r,a,n){return e+t+r+a+n>>>0},t.sum64=function sum64(e,t,r,a){var n=e[t],o=a+e[t+1]>>>0,c=(o>>0,e[t+1]=o},t.sum64_hi=function sum64_hi(e,t,r,a){return(t+a>>>0>>0},t.sum64_lo=function sum64_lo(e,t,r,a){return t+a>>>0},t.sum64_4_hi=function sum64_4_hi(e,t,r,a,n,o,c,s){var d=0,u=t;return d+=(u=u+a>>>0)>>0)>>0)>>0},t.sum64_4_lo=function sum64_4_lo(e,t,r,a,n,o,c,s){return t+a+o+s>>>0},t.sum64_5_hi=function sum64_5_hi(e,t,r,a,n,o,c,s,d,u){var h=0,l=t;return h+=(l=l+a>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function sum64_5_lo(e,t,r,a,n,o,c,s,d,u){return t+a+o+s+u>>>0},t.rotr64_hi=function rotr64_hi(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function rotr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function shr64_hi(e,t,r){return e>>>r},t.shr64_lo=function shr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0}},(e,t,r)=>{"use strict";var a=r(163),n=r(25);function isSurrogatePair(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function htonl(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function zero2(e){return 1===e.length?"0"+e:e}function zero8(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=n,t.toArray=function toArray(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n>6|192,r[a++]=63&o|128):isSurrogatePair(e,n)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++n)),r[a++]=o>>18|240,r[a++]=o>>12&63|128,r[a++]=o>>6&63|128,r[a++]=63&o|128):(r[a++]=o>>12|224,r[a++]=o>>6&63|128,r[a++]=63&o|128)}else for(n=0;n>>0}return c},t.split32=function split32(e,t){for(var r=new Array(4*e.length),a=0,n=0;a>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=255&o):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=255&o)}return r},t.rotr32=function rotr32(e,t){return e>>>t|e<<32-t},t.rotl32=function rotl32(e,t){return e<>>32-t},t.sum32=function sum32(e,t){return e+t>>>0},t.sum32_3=function sum32_3(e,t,r){return e+t+r>>>0},t.sum32_4=function sum32_4(e,t,r,a){return e+t+r+a>>>0},t.sum32_5=function sum32_5(e,t,r,a,n){return e+t+r+a+n>>>0},t.sum64=function sum64(e,t,r,a){var n=e[t],o=a+e[t+1]>>>0,c=(o>>0,e[t+1]=o},t.sum64_hi=function sum64_hi(e,t,r,a){return(t+a>>>0>>0},t.sum64_lo=function sum64_lo(e,t,r,a){return t+a>>>0},t.sum64_4_hi=function sum64_4_hi(e,t,r,a,n,o,c,s){var d=0,u=t;return d+=(u=u+a>>>0)>>0)>>0)>>0},t.sum64_4_lo=function sum64_4_lo(e,t,r,a,n,o,c,s){return t+a+o+s>>>0},t.sum64_5_hi=function sum64_5_hi(e,t,r,a,n,o,c,s,d,u){var h=0,l=t;return h+=(l=l+a>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function sum64_5_lo(e,t,r,a,n,o,c,s,d,u){return t+a+o+s+u>>>0},t.rotr64_hi=function rotr64_hi(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function rotr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function shr64_hi(e,t,r){return e>>>r},t.shr64_lo=function shr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0}},(e,t,r)=>{"use strict";var a=r(164),n=r(15);function isSurrogatePair(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function htonl(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function zero2(e){return 1===e.length?"0"+e:e}function zero8(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=n,t.toArray=function toArray(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n>6|192,r[a++]=63&o|128):isSurrogatePair(e,n)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++n)),r[a++]=o>>18|240,r[a++]=o>>12&63|128,r[a++]=o>>6&63|128,r[a++]=63&o|128):(r[a++]=o>>12|224,r[a++]=o>>6&63|128,r[a++]=63&o|128)}else for(n=0;n>>0}return c},t.split32=function split32(e,t){for(var r=new Array(4*e.length),a=0,n=0;a>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=255&o):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=255&o)}return r},t.rotr32=function rotr32(e,t){return e>>>t|e<<32-t},t.rotl32=function rotl32(e,t){return e<>>32-t},t.sum32=function sum32(e,t){return e+t>>>0},t.sum32_3=function sum32_3(e,t,r){return e+t+r>>>0},t.sum32_4=function sum32_4(e,t,r,a){return e+t+r+a>>>0},t.sum32_5=function sum32_5(e,t,r,a,n){return e+t+r+a+n>>>0},t.sum64=function sum64(e,t,r,a){var n=e[t],o=a+e[t+1]>>>0,c=(o>>0,e[t+1]=o},t.sum64_hi=function sum64_hi(e,t,r,a){return(t+a>>>0>>0},t.sum64_lo=function sum64_lo(e,t,r,a){return t+a>>>0},t.sum64_4_hi=function sum64_4_hi(e,t,r,a,n,o,c,s){var d=0,u=t;return d+=(u=u+a>>>0)>>0)>>0)>>0},t.sum64_4_lo=function sum64_4_lo(e,t,r,a,n,o,c,s){return t+a+o+s>>>0},t.sum64_5_hi=function sum64_5_hi(e,t,r,a,n,o,c,s,d,u){var h=0,l=t;return h+=(l=l+a>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function sum64_5_lo(e,t,r,a,n,o,c,s,d,u){return t+a+o+s+u>>>0},t.rotr64_hi=function rotr64_hi(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function rotr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function shr64_hi(e,t,r){return e>>>r},t.shr64_lo=function shr64_lo(e,t,r){return(e<<32-r|t>>>r)>>>0}},function(e,t,r){"use strict";var a=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},n=this&&this.__generator||function(e,t){var r,a,n,o,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(s){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,a=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(n=c.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Trie=void 0;var s=c(r(372)),d=r(42),u=r(120),h=r(205),l=r(613),b=r(169),g=r(93),p=r(6),B=function(){function Trie(e,t,r){void 0===r&&(r=!1),this.EMPTY_TRIE_ROOT=d.KECCAK256_RLP,this.lock=new s.default(1),this.db=e?new u.DB(e):new u.DB,this._root=this.EMPTY_TRIE_ROOT,this._deleteFromDB=r,t&&this.setRoot(t)}return Object.defineProperty(Trie.prototype,"root",{get:function(){return this._root},set:function(e){this.setRoot(e)},enumerable:!1,configurable:!0}),Trie.prototype.setRoot=function(e){e||(e=this.EMPTY_TRIE_ROOT),p(32===e.length,"Invalid root length. Roots are 32 bytes"),this._root=e},Trie.prototype.checkRoot=function(e){return a(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,this._lookupNode(e)];case 1:return[2,!!t.sent()]}}))}))},Object.defineProperty(Trie.prototype,"isCheckpoint",{get:function(){return!1},enumerable:!1,configurable:!0}),Trie.prototype.get=function(e){return a(this,void 0,void 0,(function(){var t,r,a,o;return n(this,(function(n){switch(n.label){case 0:return[4,this.findPath(e)];case 1:return t=n.sent(),r=t.node,a=t.remaining,o=null,r&&0===a.length&&(o=r.value),[2,o]}}))}))},Trie.prototype.put=function(e,t){return a(this,void 0,void 0,(function(){var r,a,o;return n(this,(function(n){switch(n.label){case 0:return t&&""!==t.toString()?[3,2]:[4,this.del(e)];case 1:return[2,n.sent()];case 2:return[4,this.lock.wait()];case 3:return n.sent(),this.root.equals(d.KECCAK256_RLP)?[4,this._createInitialNode(e,t)]:[3,5];case 4:return n.sent(),[3,8];case 5:return[4,this.findPath(e)];case 6:return r=n.sent(),a=r.remaining,o=r.stack,[4,this._updateNode(e,t,a,o)];case 7:n.sent(),n.label=8;case 8:return this.lock.signal(),[2]}}))}))},Trie.prototype.del=function(e){return a(this,void 0,void 0,(function(){var t,r,a;return n(this,(function(n){switch(n.label){case 0:return[4,this.lock.wait()];case 1:return n.sent(),[4,this.findPath(e)];case 2:return t=n.sent(),r=t.node,a=t.stack,r?[4,this._deleteNode(e,a)]:[3,4];case 3:n.sent(),n.label=4;case 4:return this.lock.signal(),[2]}}))}))},Trie.prototype.findPath=function(e){return a(this,void 0,void 0,(function(){var t=this;return n(this,(function(r){return[2,new Promise((function(r){return a(t,void 0,void 0,(function(){var t,o,c,s=this;return n(this,(function(d){switch(d.label){case 0:return t=[],o=l.bufferToNibbles(e),c=function(e,c,d,u){return a(s,void 0,void 0,(function(){var e,a;return n(this,(function(n){return null===c||(e=o.slice(l.matchingNibbleLength(d,o)),t.push(c),c instanceof g.BranchNode?0===e.length?r({node:c,remaining:[],stack:t}):(a=e[0],c.getBranch(a)?u.onlyBranchIndex(c,d,a):r({node:null,remaining:e,stack:t})):c instanceof g.LeafNode?l.doKeysMatch(e,c.key)?r({node:c,remaining:[],stack:t}):r({node:null,remaining:e,stack:t}):c instanceof g.ExtensionNode&&(l.matchingNibbleLength(e,c.key)!==c.key.length?r({node:null,remaining:e,stack:t}):u.allChildren(c,d))),[2]}))}))},[4,this.walkTrie(this.root,c)];case 1:return d.sent(),r({node:null,remaining:[],stack:t}),[2]}}))}))}))]}))}))},Trie.prototype.walkTrie=function(e,t){return a(this,void 0,void 0,(function(){return n(this,(function(r){switch(r.label){case 0:return[4,b.WalkController.newWalk(t,this,e)];case 1:return r.sent(),[2]}}))}))},Trie.prototype._walkTrie=function(e,t){return a(this,void 0,void 0,(function(){return n(this,(function(r){switch(r.label){case 0:return[4,this.walkTrie(e,t)];case 1:return r.sent(),[2]}}))}))},Trie.prototype._createInitialNode=function(e,t){return a(this,void 0,void 0,(function(){var r;return n(this,(function(a){switch(a.label){case 0:return r=new g.LeafNode(l.bufferToNibbles(e),t),this.root=r.hash(),[4,this.db.put(this.root,r.serialize())];case 1:return a.sent(),[2]}}))}))},Trie.prototype.lookupNode=function(e){return a(this,void 0,void 0,(function(){var t,r;return n(this,(function(a){switch(a.label){case 0:return g.isRawNode(e)?[2,g.decodeRawNode(e)]:(t=null,r=null,[4,this.db.get(e)]);case 1:return(t=a.sent())&&(r=g.decodeNode(t)),[2,r]}}))}))},Trie.prototype._lookupNode=function(e){return a(this,void 0,void 0,(function(){return n(this,(function(t){return[2,this.lookupNode(e)]}))}))},Trie.prototype._updateNode=function(e,t,r,o){return a(this,void 0,void 0,(function(){var a,c,s,d,u,h,b,p,B,m,I,y,x,C,v,Q;return n(this,(function(n){switch(n.label){case 0:if(a=[],!(c=o.pop()))throw new Error("Stack underflow");if(s=l.bufferToNibbles(e),d=!1,c instanceof g.LeafNode){for(u=0,h=0;h=32||t){var o=d.keccak(n);return a?this._deleteFromDB&&r.push({type:"del",key:o}):r.push({type:"put",key:o,value:n}),o}return e.raw()},Trie.prototype.batch=function(e){return a(this,void 0,void 0,(function(){var t,r,a,c,s,d;return n(this,(function(n){switch(n.label){case 0:n.trys.push([0,7,8,9]),t=o(e),r=t.next(),n.label=1;case 1:if(r.done)return[3,6];if("put"!==(a=r.value).type)return[3,3];if(!a.value)throw new Error("Invalid batch db operation");return[4,this.put(a.key,a.value)];case 2:return n.sent(),[3,5];case 3:return"del"!==a.type?[3,5]:[4,this.del(a.key)];case 4:n.sent(),n.label=5;case 5:return r=t.next(),[3,1];case 6:return[3,9];case 7:return c=n.sent(),s={error:c},[3,9];case 8:try{r&&!r.done&&(d=t.return)&&d.call(t)}finally{if(s)throw s.error}return[7];case 9:return[2]}}))}))},Trie.fromProof=function(e,t){return a(this,void 0,void 0,(function(){var r;return n(this,(function(a){switch(a.label){case 0:return r=e.map((function(e){return{type:"put",key:d.keccak(e),value:e}})),t||(t=new Trie,r[0]&&(t.root=r[0].key)),[4,t.db.batch(r)];case 1:return a.sent(),[2,t]}}))}))},Trie.prove=function(e,t){return a(this,void 0,void 0,(function(){return n(this,(function(r){return[2,this.createProof(e,t)]}))}))},Trie.createProof=function(e,t){return a(this,void 0,void 0,(function(){var r;return n(this,(function(a){switch(a.label){case 0:return[4,e.findPath(t)];case 1:return r=a.sent().stack,[2,r.map((function(e){return e.serialize()}))]}}))}))},Trie.verifyProof=function(e,t,r){return a(this,void 0,void 0,(function(){var a;return n(this,(function(n){switch(n.label){case 0:a=new Trie(null,e),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,Trie.fromProof(r,a)];case 2:return a=n.sent(),[3,4];case 3:throw n.sent(),new Error("Invalid proof nodes given");case 4:return[2,a.get(t)]}}))}))},Trie.prototype.createReadStream=function(){return new h.TrieReadStream(this)},Trie.prototype.copy=function(){return new Trie(this.db.copy()._leveldb,this.root)},Trie.prototype._findDbNodes=function(e){return a(this,void 0,void 0,(function(){var t,r=this;return n(this,(function(o){switch(o.label){case 0:return t=function(t,o,c,s){return a(r,void 0,void 0,(function(){return n(this,(function(r){return g.isRawNode(t)?null!==o&&s.allChildren(o,c):e(t,o,c,s),[2]}))}))},[4,this.walkTrie(this.root,t)];case 1:return o.sent(),[2]}}))}))},Trie.prototype._findValueNodes=function(e){return a(this,void 0,void 0,(function(){var t,r=this;return n(this,(function(o){switch(o.label){case 0:return t=function(t,o,c,s){return a(r,void 0,void 0,(function(){var r;return n(this,(function(a){return r=c,o instanceof g.LeafNode?(r=c.concat(o.key),e(t,o,r,s)):o instanceof g.BranchNode&&o.value?e(t,o,r,s):null!==o&&s.allChildren(o,c),[2]}))}))},[4,this.walkTrie(this.root,t)];case 1:return o.sent(),[2]}}))}))},Trie}();t.Trie=B},function(e,t,r){"use strict";var a=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},n=this&&this.__generator||function(e,t){var r,a,n,o,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(s){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,a=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(n=c.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]{e.exports=function(e){try{return!!e()}catch(e){return!0}}},e=>{e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},(e,t,r)=>{var a=r(393),n={}.hasOwnProperty;e.exports=Object.hasOwn||function hasOwn(e,t){return n.call(a(e),t)}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,a,n,o,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(s){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,a=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(n=c.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0){var n=t.toNumber(),o=r.toNumber();a.length{var a=r(11).Buffer,n=r(39).Transform,o=r(428).a;function CipherBase(e){n.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}r(10)(CipherBase,n),CipherBase.prototype.update=function(e,t,r){"string"==typeof e&&(e=a.from(e,t));var n=this._update(e);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)},CipherBase.prototype.setAutoPadding=function(){},CipherBase.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},CipherBase.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},CipherBase.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},CipherBase.prototype._transform=function(e,t,r){var a;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){a=e}finally{r(a)}},CipherBase.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},CipherBase.prototype._finalOrDigest=function(e){var t=this.__final()||a.alloc(0);return e&&(t=this._toString(t,e,!0)),t},CipherBase.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new o(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var a=this._decoder.write(e);return r&&(a+=this._decoder.end()),a},e.exports=CipherBase},function(e,t,r){"use strict";var a,n,o,c,s,d,u=r(0).Buffer,h=this&&this.__decorate||function(e,t,r,a){var n,o=arguments.length,c=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,a);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(c=(o<3?n(c):o>3?n(t,r,c):n(t,r))||c);return o>3&&c&&Object.defineProperty(t,r,c),c},l=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},b=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},g=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const p=r(19),B=r(100),m=r(27),I=r(4),y=r(562),x=r(8),C=g(r(165)),v=g(r(1310)),Q=r(1311),w=r(979),_=r(75),k=r(76),{version:N}={version:"7.0.0-canary.1342"},D=`Ganache/v${N}/EthereumJS TestRPC/v${N}/ethereum-js`,U=x.Data.from("0x3f"),G={eth:"1.0",net:"1.0",rpc:"1.0",web3:"1.0",evm:"1.0",personal:"1.0"};function assertExceptionalTransactions(e){let t,r=null;const a={};if(e.forEach((e=>{e.execException&&(r?(r=p.VM_EXCEPTIONS,t.push(`${e.hash.toString()}: ${e.execException}\n`),a[e.execException.data.hash]=e.execException.data):(r=p.VM_EXCEPTION,t=[e.execException.message],a[e.execException.data.hash]=e.execException.data))})),r){const e=new Error(r+t.join("\n"));throw e.data=a,e}}class EthereumApi{constructor(e,t,r){var u;a.set(this,(u=0,()=>x.Quantity.from(++u))),n.set(this,new Map),o.set(this,new Map),c.set(this,void 0),s.set(this,void 0),d.set(this,void 0),l(this,c,e),l(this,d,t),l(this,s,r)}async db_putString(e,t,r){return!1}async db_getString(e,t){return""}async db_putHex(e,t,r){return!1}async db_getHex(e,t){return"0x00"}async bzz_hive(){return[]}async bzz_info(){return[]}async evm_mine(e){const t=b(this,s),r=b(this,c).chain.vmErrorsOnRPCResponse;if(null!==e&&"object"==typeof e){let{blocks:a,timestamp:n}=e;null==a&&(a=1);for(let e=0;ex.Quantity.from(t).toBuffer()},await n.putAccount({buf:r},o),await a.mine(0),!0}async evm_increaseTime(e){const t=1e3*("number"==typeof e?e:x.Quantity.from(e).toNumber());return Math.floor(b(this,s).increaseTime(t)/1e3)}async evm_setTime(e){let t;switch(typeof e){case"object":t=e.getTime();break;case"number":t=e;break;default:t=x.Quantity.from(e).toNumber()}return Math.floor(b(this,s).setTime(t)/1e3)}async evm_revert(e){return b(this,s).revert(x.Quantity.from(e))}async evm_snapshot(){return x.Quantity.from(b(this,s).snapshot())}async evm_unlockUnknownAccount(e,t=0){return b(this,d).unlockUnknownAccount(e.toLowerCase(),t)}async evm_lockUnknownAccount(e){const t=e.toLowerCase();if(b(this,d).knownAccounts.has(t))throw new Error("cannot lock known/personal account");return b(this,d).lockAccount(t)}async miner_start(e=1){if(!0===b(this,c).miner.legacyInstamine){const t=await b(this,s).resume(e);null!=t&&b(this,c).chain.vmErrorsOnRPCResponse&&assertExceptionalTransactions(t)}else b(this,s).resume(e);return!0}async miner_stop(){return b(this,s).pause(),!0}async miner_setGasPrice(e){return b(this,c).miner.defaultGasPrice=x.Quantity.from(e),!0}async miner_setEtherbase(e){return b(this,s).coinbase=k.Address.from(e),!0}async miner_setExtra(e){const t=x.Data.from(e),r=t.toBuffer().length;if(r>32)throw new Error(`extra exceeds max length. ${r} > 32`);return b(this,c).miner.extraData=t,!0}async web3_clientVersion(){return D}async web3_sha3(e){return x.Data.from(x.keccak(u.from(e)))}async net_version(){return b(this,c).chain.networkId.toString()}async net_listening(){return!0}async net_peerCount(){return x.RPCQUANTITY_ZERO}async eth_estimateGas(e,t=p.Tag.LATEST){const r=b(this,s),a=r.blocks,n=(await a.get(t)).header,o=b(this,c),generateVM=()=>r.vm.copy();return new Promise(((t,a)=>{const{coinbase:c}=r,d=new m.RuntimeTransaction(e,b(this,s).common);null==d.from&&(d.from=c),d.gas.isNull()&&(d.gas=o.miner.callGasLimit);const h=new B.RuntimeBlock(x.Quantity.from((n.number.toBigInt()||0n)+1n),n.parentHash,n.miner,d.gas.toBuffer(),n.timestamp,o.miner.difficulty,n.totalDifficulty),l={tx:d.toVmTransaction(),block:h,skipBalance:!0,skipNonce:!0};v.default(generateVM,l,((e,r)=>{if(e)return a(e);t(x.Quantity.from(r.gasEstimate.toArrayLike(u)))}))}))}async eth_protocolVersion(){return U}async eth_syncing(){return!1}async eth_coinbase(){return b(this,s).coinbase}async eth_getBlockByNumber(e,t=!1){const r=await b(this,s).blocks.get(e).catch((e=>null));return r?r.toJSON(t):null}async eth_getBlockByHash(e,t=!1){const r=await b(this,s).blocks.getByHash(e).catch((e=>null));return r?r.toJSON(t):null}async eth_getBlockTransactionCountByNumber(e){const{blocks:t}=b(this,s),r=t.getEffectiveNumber(e),a=await t.getRawByBlockNumber(r);if(!a)return null;const[,n]=_.decode(a);return x.Quantity.from(n.length)}async eth_getBlockTransactionCountByHash(e){const{blocks:t}=b(this,s),r=await t.getNumberFromHash(e);if(!r)return null;const a=await t.getRawByBlockNumber(x.Quantity.from(r));if(!a)return null;const[,n]=_.decode(a);return x.Quantity.from(n.length)}async eth_getCompilers(){return[]}async eth_getTransactionByBlockHashAndIndex(e,t){const r=await this.eth_getBlockByHash(e,!0);if(r){const e=r.transactions[x.Quantity.from(t).toNumber()];if(e)return e}return null}async eth_getTransactionByBlockNumberAndIndex(e,t){return(await this.eth_getBlockByNumber(e,!0)).transactions[parseInt(x.Quantity.from(t).toString(),10)]}async eth_getUncleCountByBlockHash(e){return x.RPCQUANTITY_ZERO}async eth_getUncleCountByBlockNumber(e){return x.RPCQUANTITY_ZERO}async eth_getUncleByBlockHashAndIndex(e,t){return null}async eth_getUncleByBlockNumberAndIndex(e,t){return null}async eth_getWork(e){return[]}async eth_submitWork(e,t,r){return!1}async eth_submitHashrate(e,t){return!1}async eth_mining(){return b(this,s).isStarted()}async eth_hashrate(){return x.RPCQUANTITY_ZERO}async eth_gasPrice(){return b(this,c).miner.defaultGasPrice}async eth_accounts(){return b(this,d).addresses}async eth_blockNumber(){return b(this,s).blocks.latest.header.number}async eth_chainId(){return x.Quantity.from(b(this,c).chain.chainId)}async eth_getBalance(e,t=p.Tag.LATEST){return b(this,s).accounts.getBalance(k.Address.from(e),t)}async eth_getCode(e,t=p.Tag.LATEST){const{accounts:r}=b(this,s);return r.getCode(k.Address.from(e),t)}async eth_getStorageAt(e,t,r=p.Tag.LATEST){const a=b(this,s),n=a.blocks.getEffectiveNumber(r),o=await a.blocks.getRawByBlockNumber(n);if(!o)throw new Error("header not found");const[[,,,c]]=_.decode(o),d=a.trie.copy(!1);d.setContext(c,null,n);const h=x.Quantity.from(t).toBuffer(),l=h.length;let g;l<32?(g=u.allocUnsafe(32).fill(0),h.copy(g,32-l)):g=32===l?h:h.slice(-32);const B=k.Address.from(e).toBuffer(),m=await d.get(B),I=_.decode(m)[2];d.setContext(I,B,n);const y=await d.get(g);return x.Data.from(_.decode(y))}async eth_getTransactionByHash(e){const{transactions:t}=b(this,s),r=x.Data.from(e).toBuffer(),a=await t.get(r);if(null===a){const e=t.transactionPool.find(r);return e?e.toJSON():null}return a.toJSON()}async eth_getTransactionReceipt(e){const{transactions:t,transactionReceipts:r,blocks:a}=b(this,s),n=x.Data.from(e),o=n.toBuffer(),d=t.get(o),u=r.get(o),h=d.then((e=>e?a.get(e.blockNumber.toBuffer()):null)),[l,g,p]=await Promise.all([d,u,h]);if(l)return g.toJSON(p,l);const B=b(this,c);if(B.miner.blockTime<=0&&!0!==B.miner.legacyInstamine&&b(this,s).isStarted()){null!=b(this,s).transactions.transactionPool.find(o)&&B.logging.logger.log(` > Ganache \`eth_getTransactionReceipt\` notice: the transaction with hash\n > \`${n.toString()}\` has not\n > yet been mined.`)}return null}async eth_sendTransaction(e){const t=b(this,s),r=new m.RuntimeTransaction(e,t.common);if(null==r.from)throw new Error("from not found; is required");const a=r.from.toString(),n=b(this,d),o=n.knownAccounts.has(a),u=n.unlockedAccounts.has(a);if(!u){throw new Error(o?"authentication needed: password or unlock":"sender account not recognized")}if(r.gas.isNull()){const t=b(this,c).miner.defaultTransactionGasLimit;t===x.RPCQUANTITY_EMPTY?r.gas=await this.eth_estimateGas(e,p.Tag.LATEST):r.gas=t}if(r.gasPrice.isNull()&&(r.gasPrice=b(this,c).miner.defaultGasPrice),u){const e=n.unlockedAccounts.get(a);return t.queueTransaction(r,e)}return t.queueTransaction(r)}async eth_signTransaction(e){const t=b(this,s),r=new m.RuntimeTransaction(e,t.common);if(null==r.from)throw new Error("from not found; is required");const a=r.from.toString(),n=b(this,d),o=n.knownAccounts.has(a);if(!n.unlockedAccounts.has(a)){throw new Error(o?"authentication needed: password or unlock":"sender account not recognized")}const c=n.unlockedAccounts.get(a).toBuffer();return r.signAndHash(c),x.Data.from(r.serialized).toString()}async eth_sendRawTransaction(e){const t=x.Data.from(e).toBuffer(),r=_.decode(t),a=b(this,s),n=new m.RuntimeTransaction(r,a.common);return a.queueTransaction(n)}async eth_sign(e,t){const r=k.Address.from(e).toString().toLowerCase(),a=b(this,d).unlockedAccounts.get(r);if(null==a)throw new Error("cannot sign data; no private key");const n=b(this,c).chain.chainId,o=I.hashPersonalMessage(x.Data.from(t).toBuffer()),{v:s,r:u,s:h}=I.ecsign(o,a.toBuffer(),n);return I.toRpcSig(s,u,h,n)}async eth_signTypedData(e,t){const r=k.Address.from(e).toString().toLowerCase(),a=b(this,d).unlockedAccounts.get(r);if(null==a)throw new Error("cannot sign data; no private key");if(!t.types)throw new Error("cannot sign data; types missing");if(!t.types.EIP712Domain)throw new Error("cannot sign data; EIP712Domain definition missing");if(!t.domain)throw new Error("cannot sign data; domain missing");if(!t.primaryType)throw new Error("cannot sign data; primaryType missing");if(!t.message)throw new Error("cannot sign data; message missing");return y.signTypedData_v4(a.toBuffer(),{data:t})}eth_subscribe(e,t){const r=b(this,o);switch(e){case"newHeads":{const e=b(this,a).call(this),t=x.PromiEvent.resolve(e),n=b(this,s).on("block",(r=>{const a=r.header,n={logsBloom:a.logsBloom,miner:a.miner,difficulty:a.difficulty,totalDifficulty:a.totalDifficulty,extraData:a.extraData,gasLimit:a.gasLimit,gasUsed:a.gasUsed,hash:r.hash(),mixHash:r.header.mixHash,nonce:a.nonce,number:a.number,parentHash:a.parentHash,receiptsRoot:a.receiptsRoot,stateRoot:a.stateRoot,timestamp:a.timestamp,transactionsRoot:a.transactionsRoot,sha3Uncles:a.sha3Uncles};t.emit("message",{type:"eth_subscription",data:{result:JSON.parse(JSON.stringify(n)),subscription:e.toString()}})}));return r.set(e.toString(),n),t}case"logs":{const e=b(this,a).call(this),n=x.PromiEvent.resolve(e),{addresses:o,topics:c}=t?w.parseFilterDetails(t):{addresses:[],topics:[]},d=b(this,s).on("blockLogs",(t=>{const r=JSON.parse(JSON.stringify([...t.filter(o,c)]));n.emit("message",{type:"eth_subscription",data:{result:r,subscription:e.toString()}})}));return r.set(e.toString(),d),n}case"newPendingTransactions":{const e=b(this,a).call(this),t=x.PromiEvent.resolve(e),n=b(this,s).on("pendingTransaction",(r=>{const a=r.hash.toString();t.emit("message",{type:"eth_subscription",data:{result:a,subscription:e.toString()}})}));return r.set(e.toString(),n),t}case"syncing":{const e=b(this,a).call(this),t=x.PromiEvent.resolve(e);return b(this,o).set(e.toString(),(()=>{})),t}default:throw new p.CodedError(`no "${e}" subscription in eth namespace`,x.JsonRpcErrorCode.METHOD_NOT_FOUND)}}async eth_unsubscribe(e){const t=b(this,o),r=t.get(e);return!!r&&(t.delete(e),r(),!0)}async eth_newBlockFilter(){const e={updates:[],unsubscribe:b(this,s).on("block",(t=>{e.updates.push(t.hash())})),filter:null,type:p.FilterTypes.block},t=b(this,a).call(this);return b(this,n).set(t.toString(),e),t}async eth_newPendingTransactionFilter(){const e={updates:[],unsubscribe:b(this,s).on("pendingTransaction",(t=>{e.updates.push(t.hash)})),filter:null,type:p.FilterTypes.pendingTransaction},t=b(this,a).call(this);return b(this,n).set(t.toString(),e),t}async eth_newFilter(e){const t=b(this,s);null==e&&(e={});const{addresses:r,topics:o}=w.parseFilterDetails(e||{}),c={updates:[],unsubscribe:t.on("blockLogs",(a=>{const n=a.blockNumber,{fromBlock:s,toBlock:d}=w.parseFilterRange(e,t);s<=n&&d>=n&&c.updates.push(...a.filter(r,o))})),filter:e,type:p.FilterTypes.log},d=b(this,a).call(this);return b(this,n).set(d.toString(),c),d}async eth_getFilterChanges(e){const t=b(this,n).get(x.Quantity.from(e).toString());if(t){const e=t.updates;return t.updates=[],e}throw new Error("filter not found")}async eth_uninstallFilter(e){const t=x.Quantity.from(e).toString(),r=b(this,n).get(t);return!!r&&(r.unsubscribe(),b(this,n).delete(t))}async eth_getFilterLogs(e){const t=b(this,n).get(x.Quantity.from(e).toString());if(t&&t.type===p.FilterTypes.log)return this.eth_getLogs(t.filter);throw new Error("filter not found")}async eth_getLogs(e){return b(this,s).blockLogs.getLogs(e)}async eth_getTransactionCount(e,t=p.Tag.LATEST){return b(this,s).accounts.getNonce(k.Address.from(e),t)}async eth_call(e,t=p.Tag.LATEST){const r=b(this,s),a=r.blocks,n=await a.get(t),o=n.header,d=b(this,c);let u,h;u=void 0===e.gasLimit?void 0!==e.gas?x.Quantity.from(e.gas):d.miner.callGasLimit:x.Quantity.from(e.gasLimit),void 0===e.data?void 0!==e.input&&(h=x.Data.from(e.input)):h=x.Data.from(e.data);const l=new B.RuntimeBlock(o.number,o.parentHash,r.coinbase,u.toBuffer(),o.timestamp,d.miner.difficulty,o.totalDifficulty),g={gas:u,from:null==e.from?r.coinbase:k.Address.from(e.from),to:null==e.to?null:k.Address.from(e.to),gasPrice:x.Quantity.from(null==e.gasPrice?0:e.gasPrice),value:null==e.value?null:x.Quantity.from(e.value),data:h,block:l};return r.simulateTransaction(g,n)}async debug_traceTransaction(e,t){return b(this,s).traceTransaction(e,t||{})}async debug_storageRangeAt(e,t,r,a,n){return b(this,s).storageRangeAt(e,x.Quantity.from(t).toNumber(),r,a,x.Quantity.from(n).toNumber())}async personal_listAccounts(){return b(this,d).addresses}async personal_newAccount(e){if("string"!=typeof e)throw new Error("missing value for required argument `passphrase`");const t=b(this,d),r=t.createRandomAccount(),a=r.address.toString(),n=await t.encrypt(r.privateKey,e);return t.encryptedKeyFiles.set(a,n),t.addresses.push(a),t.knownAccounts.add(a),r.address}async personal_importRawKey(e,t){if("string"!=typeof t)throw new Error("missing value for required argument `passphrase`");const r=b(this,d),a=C.default.createAccountFromPrivateKey(x.Data.from(e)),n=a.address.toString(),o=await r.encrypt(a.privateKey,t);return r.encryptedKeyFiles.set(n,o),r.addresses.push(n),r.knownAccounts.add(n),a.address}async personal_lockAccount(e){return b(this,d).lockAccount(e.toLowerCase())}async personal_unlockAccount(e,t,r=300){return b(this,d).unlockAccount(e.toLowerCase(),t,r)}async personal_sendTransaction(e,t){const r=b(this,s),a=new m.RuntimeTransaction(e,r.common);if(null==a.from)throw new Error("from not found; is required");const n=a.from.toString(),o=b(this,d),c=o.encryptedKeyFiles.get(n);if(void 0===c)throw new Error("no key for given address or file");if(null!==c){const e=await o.decrypt(c,t);a.signAndHash(e)}return r.queueTransaction(a)}async personal_signTransaction(e,t){const r=b(this,s),a=new m.RuntimeTransaction(e,r.common);if(null==a.from)throw new Error("from not found; is required");const n=a.from.toString(),o=b(this,d),c=o.encryptedKeyFiles.get(n);if(null==c)throw new Error("no key for given address or file");const u=await o.decrypt(c,t);return a.signAndHash(u),x.Data.from(a.serialized).toString()}async rpc_modules(){return G}async shh_newIdentity(){return"0x00"}async shh_hasIdentity(e){return!1}async shh_newGroup(){return"0x00"}async shh_addToGroup(e){return!1}async shh_newFilter(e,t){return!1}async shh_uninstallFilter(e){return!1}async shh_getFilterChanges(e){return[]}async shh_getMessages(e){return!1}async shh_post(e){return!1}async shh_version(){return"2"}}a=new WeakMap,n=new WeakMap,o=new WeakMap,c=new WeakMap,s=new WeakMap,d=new WeakMap,h([Q.assertArgLength(3)],EthereumApi.prototype,"db_putString",null),h([Q.assertArgLength(2)],EthereumApi.prototype,"db_getString",null),h([Q.assertArgLength(3)],EthereumApi.prototype,"db_putHex",null),h([Q.assertArgLength(2)],EthereumApi.prototype,"db_getHex",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"bzz_hive",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"bzz_info",null),h([Q.assertArgLength(0,1)],EthereumApi.prototype,"evm_mine",null),h([Q.assertArgLength(2)],EthereumApi.prototype,"evm_setAccountNonce",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"evm_increaseTime",null),h([Q.assertArgLength(0,1)],EthereumApi.prototype,"evm_setTime",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"evm_revert",null),h([Q.assertArgLength(0,1)],EthereumApi.prototype,"miner_start",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"miner_stop",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"miner_setGasPrice",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"miner_setEtherbase",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"miner_setExtra",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"web3_clientVersion",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"web3_sha3",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"net_version",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"net_listening",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"net_peerCount",null),h([Q.assertArgLength(1,2)],EthereumApi.prototype,"eth_estimateGas",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"eth_protocolVersion",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"eth_syncing",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"eth_coinbase",null),h([Q.assertArgLength(1,2)],EthereumApi.prototype,"eth_getBlockByNumber",null),h([Q.assertArgLength(1,2)],EthereumApi.prototype,"eth_getBlockByHash",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"eth_getBlockTransactionCountByNumber",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"eth_getBlockTransactionCountByHash",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"eth_getCompilers",null),h([Q.assertArgLength(2)],EthereumApi.prototype,"eth_getTransactionByBlockHashAndIndex",null),h([Q.assertArgLength(2)],EthereumApi.prototype,"eth_getTransactionByBlockNumberAndIndex",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"eth_getUncleCountByBlockHash",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"eth_getUncleCountByBlockNumber",null),h([Q.assertArgLength(2)],EthereumApi.prototype,"eth_getUncleByBlockHashAndIndex",null),h([Q.assertArgLength(2)],EthereumApi.prototype,"eth_getUncleByBlockNumberAndIndex",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"eth_getWork",null),h([Q.assertArgLength(3)],EthereumApi.prototype,"eth_submitWork",null),h([Q.assertArgLength(2)],EthereumApi.prototype,"eth_submitHashrate",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"eth_mining",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"eth_hashrate",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"eth_gasPrice",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"eth_accounts",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"eth_blockNumber",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"eth_chainId",null),h([Q.assertArgLength(1,2)],EthereumApi.prototype,"eth_getBalance",null),h([Q.assertArgLength(1,2)],EthereumApi.prototype,"eth_getCode",null),h([Q.assertArgLength(2,3)],EthereumApi.prototype,"eth_getStorageAt",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"eth_getTransactionByHash",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"eth_getTransactionReceipt",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"eth_sendTransaction",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"eth_signTransaction",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"eth_sendRawTransaction",null),h([Q.assertArgLength(2)],EthereumApi.prototype,"eth_sign",null),h([Q.assertArgLength(2)],EthereumApi.prototype,"eth_signTypedData",null),h([Q.assertArgLength(1,2)],EthereumApi.prototype,"eth_subscribe",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"eth_unsubscribe",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"eth_newBlockFilter",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"eth_newPendingTransactionFilter",null),h([Q.assertArgLength(0,1)],EthereumApi.prototype,"eth_newFilter",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"eth_getFilterChanges",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"eth_uninstallFilter",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"eth_getFilterLogs",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"eth_getLogs",null),h([Q.assertArgLength(1,2)],EthereumApi.prototype,"eth_getTransactionCount",null),h([Q.assertArgLength(1,2)],EthereumApi.prototype,"eth_call",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"personal_listAccounts",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"personal_newAccount",null),h([Q.assertArgLength(2)],EthereumApi.prototype,"personal_importRawKey",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"personal_lockAccount",null),h([Q.assertArgLength(2,3)],EthereumApi.prototype,"personal_unlockAccount",null),h([Q.assertArgLength(2)],EthereumApi.prototype,"personal_sendTransaction",null),h([Q.assertArgLength(2)],EthereumApi.prototype,"personal_signTransaction",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"rpc_modules",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"shh_newIdentity",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"shh_hasIdentity",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"shh_newGroup",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"shh_addToGroup",null),h([Q.assertArgLength(2)],EthereumApi.prototype,"shh_newFilter",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"shh_uninstallFilter",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"shh_getFilterChanges",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"shh_getMessages",null),h([Q.assertArgLength(1)],EthereumApi.prototype,"shh_post",null),h([Q.assertArgLength(0)],EthereumApi.prototype,"shh_version",null),t.default=EthereumApi},function(e,t,r){"use strict";var a=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},n=this&&this.__generator||function(e,t){var r,a,n,o,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(s){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,a=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(n=c.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),c=t;c=49?s-49+10:s>=17?s-17+10:s}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,c=o%a,s=Math.min(o,o-c)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],o=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],c=n*o,s=67108863&c,d=c/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(c=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&c}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,s=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=c[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,c,s="le"===t,d=new e(n),u=this.clone();if(s){for(c=0;!u.isZero();c++)o=u.andln(255),u.iushrn(8),d[c]=o;for(;c=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,c=0;c>26,this.words[c]=67108863&t;for(;0!==o&&c>26,this.words[c]=67108863&t;if(0===o&&c>>13,g=0|c[1],p=8191&g,B=g>>>13,m=0|c[2],I=8191&m,y=m>>>13,x=0|c[3],C=8191&x,v=x>>>13,Q=0|c[4],w=8191&Q,_=Q>>>13,k=0|c[5],N=8191&k,D=k>>>13,U=0|c[6],G=8191&U,T=U>>>13,L=0|c[7],q=8191&L,P=L>>>13,O=0|c[8],H=8191&O,Y=O>>>13,J=0|c[9],j=8191&J,z=J>>>13,W=0|s[0],V=8191&W,X=W>>>13,$=0|s[1],et=8191&$,tt=$>>>13,rt=0|s[2],at=8191&rt,it=rt>>>13,nt=0|s[3],ot=8191&nt,At=nt>>>13,ct=0|s[4],st=8191&ct,dt=ct>>>13,ut=0|s[5],ht=8191&ut,bt=ut>>>13,pt=0|s[6],Bt=8191&pt,mt=pt>>>13,It=0|s[7],Et=8191&It,yt=It>>>13,xt=0|s[8],Ct=8191&xt,vt=xt>>>13,Qt=0|s[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(C,V),n=(n=Math.imul(C,X))+Math.imul(v,V)|0,o=Math.imul(v,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(C,et)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(v,et)|0,o=o+Math.imul(v,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,st)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(C,at)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(v,at)|0,o=o+Math.imul(v,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,st)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,st)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,At)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,At)|0,a=a+Math.imul(I,st)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,st)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(q,V),n=(n=Math.imul(q,X))+Math.imul(P,V)|0,o=Math.imul(P,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(C,st)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(v,st)|0,o=o+Math.imul(v,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(q,et)|0,n=(n=n+Math.imul(q,tt)|0)+Math.imul(P,et)|0,o=o+Math.imul(P,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,st)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,st)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,bt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,Ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,vt)|0)+Math.imul(b,Ct)|0))<<13)|0;u=((o=o+Math.imul(b,vt)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(j,V),n=(n=Math.imul(j,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(q,at)|0,n=(n=n+Math.imul(q,it)|0)+Math.imul(P,at)|0,o=o+Math.imul(P,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,st)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,st)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(C,Bt)|0,n=(n=n+Math.imul(C,mt)|0)+Math.imul(v,Bt)|0,o=o+Math.imul(v,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,Ct)|0,n=(n=n+Math.imul(p,vt)|0)+Math.imul(B,Ct)|0,o=o+Math.imul(B,vt)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(j,et),n=(n=Math.imul(j,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(q,ot)|0,n=(n=n+Math.imul(q,At)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,At)|0,a=a+Math.imul(G,st)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,st)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(C,Et)|0,n=(n=n+Math.imul(C,yt)|0)+Math.imul(v,Et)|0,o=o+Math.imul(v,yt)|0,a=a+Math.imul(I,Ct)|0,n=(n=n+Math.imul(I,vt)|0)+Math.imul(y,Ct)|0,o=o+Math.imul(y,vt)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(j,at),n=(n=Math.imul(j,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(q,st)|0,n=(n=n+Math.imul(q,dt)|0)+Math.imul(P,st)|0,o=o+Math.imul(P,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(C,Ct)|0,n=(n=n+Math.imul(C,vt)|0)+Math.imul(v,Ct)|0,o=o+Math.imul(v,vt)|0;var qt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(j,ot),n=(n=Math.imul(j,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,st)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,st)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(q,ht)|0,n=(n=n+Math.imul(q,bt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,Ct)|0,n=(n=n+Math.imul(w,vt)|0)+Math.imul(_,Ct)|0,o=o+Math.imul(_,vt)|0;var Pt=(u+(a=a+Math.imul(C,wt)|0)|0)+((8191&(n=(n=n+Math.imul(C,Mt)|0)+Math.imul(v,wt)|0))<<13)|0;u=((o=o+Math.imul(v,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(j,st),n=(n=Math.imul(j,dt))+Math.imul(z,st)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(q,Bt)|0,n=(n=n+Math.imul(q,mt)|0)+Math.imul(P,Bt)|0,o=o+Math.imul(P,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,Ct)|0,n=(n=n+Math.imul(N,vt)|0)+Math.imul(D,Ct)|0,o=o+Math.imul(D,vt)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(j,ht),n=(n=Math.imul(j,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(q,Et)|0,n=(n=n+Math.imul(q,yt)|0)+Math.imul(P,Et)|0,o=o+Math.imul(P,yt)|0,a=a+Math.imul(G,Ct)|0,n=(n=n+Math.imul(G,vt)|0)+Math.imul(T,Ct)|0,o=o+Math.imul(T,vt)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(j,Bt),n=(n=Math.imul(j,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(q,Ct)|0,n=(n=n+Math.imul(q,vt)|0)+Math.imul(P,Ct)|0,o=o+Math.imul(P,vt)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(j,Et),n=(n=Math.imul(j,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,Ct)|0,n=(n=n+Math.imul(H,vt)|0)+Math.imul(Y,Ct)|0,o=o+Math.imul(Y,vt)|0;var Jt=(u+(a=a+Math.imul(q,wt)|0)|0)+((8191&(n=(n=n+Math.imul(q,Mt)|0)+Math.imul(P,wt)|0))<<13)|0;u=((o=o+Math.imul(P,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(j,Ct),n=(n=Math.imul(j,vt))+Math.imul(z,Ct)|0,o=Math.imul(z,vt);var Kt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863;var jt=(u+(a=Math.imul(j,wt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=qt,d[12]=Pt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=Jt,d[17]=Kt,d[18]=jt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(s=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?s(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,c&=67108863}r.words[o]=s,a=c,c=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var c=0;c>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),c=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&c}return s&&0!==u&&(s.words[s.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(s/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===c)return this.strip();for(assert(-1===c),c=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var c,s=a.length-n.length;if("mod"!==t){(c=new BN(null)).length=s+1,c.words=new Array(c.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);c&&(c.words[h]=l)}return c&&c.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:c||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),c=new BN(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(d),c.isub(u)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(c)):(r.isub(t),o.isub(a),c.isub(n))}return{a:o,b:c,gcd:r.iushln(s)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var s=0,d=1;0==(t.words[0]&d)&&s<26;++s,d<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(c),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,c&=67108863,this.words[o]=c}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=c}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),c=o.redNeg(),s=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,s).cmp(c);)d.redIAdd(c);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=s-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++c||0===a&&0===u)&&(n=this.mul(n,r[o]),c=0,o=0)):c=0}s=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(18).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void assert(!1,"Invalid character in "+e)}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=0,c=Math.min(e.length,r),s=t;s=49?d-49+10:d>=17?d-17+10:d,assert(d>=0&&o0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);return this._strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;this._strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,c=o%a,s=Math.min(o,o-c)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{BN.prototype[Symbol.for("nodejs.util.inspect.custom")]=inspect}catch(e){BN.prototype.inspect=inspect}else BN.prototype.inspect=inspect;function inspect(){return(this.red?""}var n=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],o=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,s=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=c[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modrn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16,2)},a&&(BN.prototype.toBuffer=function toBuffer(e,t){return this.toArrayLike(a,e,t)}),BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)};function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],c=n*o,s=67108863&c,d=c/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(c=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&c}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r._strip()}BN.prototype.toArrayLike=function toArrayLike(e,t,r){this._strip();var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0");var o=function allocate(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,n);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,a),o},BN.prototype._toArrayLikeLE=function _toArrayLikeLE(e,t){for(var r=0,a=0,n=0,o=0;n>8&255),r>16&255),6===o?(r>24&255),a=0,o=0):(a=c>>>24,o+=2)}if(r=0&&(e[r--]=c>>8&255),r>=0&&(e[r--]=c>>16&255),6===o?(r>=0&&(e[r--]=c>>24&255),a=0,o=0):(a=c>>>24,o+=2)}if(r>=0)for(e[r--]=a;r>=0;)e[r--]=0},Math.clz32?BN.prototype._countBits=function _countBits(e){return 32-Math.clz32(e)}:BN.prototype._countBits=function _countBits(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this._strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,c=0;c>26,this.words[c]=67108863&t;for(;0!==o&&c>26,this.words[c]=67108863&t;if(0===o&&c>>13,g=0|c[1],p=8191&g,B=g>>>13,m=0|c[2],I=8191&m,y=m>>>13,x=0|c[3],C=8191&x,v=x>>>13,Q=0|c[4],w=8191&Q,_=Q>>>13,k=0|c[5],N=8191&k,D=k>>>13,U=0|c[6],G=8191&U,T=U>>>13,L=0|c[7],q=8191&L,P=L>>>13,O=0|c[8],H=8191&O,Y=O>>>13,J=0|c[9],j=8191&J,z=J>>>13,W=0|s[0],V=8191&W,X=W>>>13,$=0|s[1],et=8191&$,tt=$>>>13,rt=0|s[2],at=8191&rt,it=rt>>>13,nt=0|s[3],ot=8191&nt,At=nt>>>13,ct=0|s[4],st=8191&ct,dt=ct>>>13,ut=0|s[5],ht=8191&ut,bt=ut>>>13,pt=0|s[6],Bt=8191&pt,mt=pt>>>13,It=0|s[7],Et=8191&It,yt=It>>>13,xt=0|s[8],Ct=8191&xt,vt=xt>>>13,Qt=0|s[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(C,V),n=(n=Math.imul(C,X))+Math.imul(v,V)|0,o=Math.imul(v,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(C,et)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(v,et)|0,o=o+Math.imul(v,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,st)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(C,at)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(v,at)|0,o=o+Math.imul(v,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,st)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,st)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,At)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,At)|0,a=a+Math.imul(I,st)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,st)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(q,V),n=(n=Math.imul(q,X))+Math.imul(P,V)|0,o=Math.imul(P,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(C,st)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(v,st)|0,o=o+Math.imul(v,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(q,et)|0,n=(n=n+Math.imul(q,tt)|0)+Math.imul(P,et)|0,o=o+Math.imul(P,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,st)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,st)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,bt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,Ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,vt)|0)+Math.imul(b,Ct)|0))<<13)|0;u=((o=o+Math.imul(b,vt)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(j,V),n=(n=Math.imul(j,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(q,at)|0,n=(n=n+Math.imul(q,it)|0)+Math.imul(P,at)|0,o=o+Math.imul(P,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,st)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,st)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(C,Bt)|0,n=(n=n+Math.imul(C,mt)|0)+Math.imul(v,Bt)|0,o=o+Math.imul(v,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,Ct)|0,n=(n=n+Math.imul(p,vt)|0)+Math.imul(B,Ct)|0,o=o+Math.imul(B,vt)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(j,et),n=(n=Math.imul(j,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(q,ot)|0,n=(n=n+Math.imul(q,At)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,At)|0,a=a+Math.imul(G,st)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,st)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(C,Et)|0,n=(n=n+Math.imul(C,yt)|0)+Math.imul(v,Et)|0,o=o+Math.imul(v,yt)|0,a=a+Math.imul(I,Ct)|0,n=(n=n+Math.imul(I,vt)|0)+Math.imul(y,Ct)|0,o=o+Math.imul(y,vt)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(j,at),n=(n=Math.imul(j,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(q,st)|0,n=(n=n+Math.imul(q,dt)|0)+Math.imul(P,st)|0,o=o+Math.imul(P,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(C,Ct)|0,n=(n=n+Math.imul(C,vt)|0)+Math.imul(v,Ct)|0,o=o+Math.imul(v,vt)|0;var qt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(j,ot),n=(n=Math.imul(j,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,st)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,st)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(q,ht)|0,n=(n=n+Math.imul(q,bt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,Ct)|0,n=(n=n+Math.imul(w,vt)|0)+Math.imul(_,Ct)|0,o=o+Math.imul(_,vt)|0;var Pt=(u+(a=a+Math.imul(C,wt)|0)|0)+((8191&(n=(n=n+Math.imul(C,Mt)|0)+Math.imul(v,wt)|0))<<13)|0;u=((o=o+Math.imul(v,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(j,st),n=(n=Math.imul(j,dt))+Math.imul(z,st)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(q,Bt)|0,n=(n=n+Math.imul(q,mt)|0)+Math.imul(P,Bt)|0,o=o+Math.imul(P,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,Ct)|0,n=(n=n+Math.imul(N,vt)|0)+Math.imul(D,Ct)|0,o=o+Math.imul(D,vt)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(j,ht),n=(n=Math.imul(j,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(q,Et)|0,n=(n=n+Math.imul(q,yt)|0)+Math.imul(P,Et)|0,o=o+Math.imul(P,yt)|0,a=a+Math.imul(G,Ct)|0,n=(n=n+Math.imul(G,vt)|0)+Math.imul(T,Ct)|0,o=o+Math.imul(T,vt)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(j,Bt),n=(n=Math.imul(j,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(q,Ct)|0,n=(n=n+Math.imul(q,vt)|0)+Math.imul(P,Ct)|0,o=o+Math.imul(P,vt)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(j,Et),n=(n=Math.imul(j,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,Ct)|0,n=(n=n+Math.imul(H,vt)|0)+Math.imul(Y,Ct)|0,o=o+Math.imul(Y,vt)|0;var Jt=(u+(a=a+Math.imul(q,wt)|0)|0)+((8191&(n=(n=n+Math.imul(q,Mt)|0)+Math.imul(P,wt)|0))<<13)|0;u=((o=o+Math.imul(P,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(j,Ct),n=(n=Math.imul(j,vt))+Math.imul(z,Ct)|0,o=Math.imul(z,vt);var Kt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863;var jt=(u+(a=Math.imul(j,wt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=qt,d[12]=Pt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=Jt,d[17]=Kt,d[18]=jt,0!==u&&(d[19]=u,r.length++),r};function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,c&=67108863}r.words[o]=s,a=c,c=n}return 0!==a?r.words[o]=a:r.length--,r._strip()}function jumboMulTo(e,t,r){return bigMulTo(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(s=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?s(this,e,t):r<63?smallMulTo(this,e,t):r<1024?bigMulTo(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var c=0;c>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,r+=n/67108864|0,r+=o>>>26,this.words[a]=67108863&o}return 0!==r&&(this.words[a]=r,this.length++),t?this.ineg():this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n&1}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),c=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&c}return s&&0!==u&&(s.words[s.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(s/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===c)return this._strip();for(assert(-1===c),c=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this._strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var c,s=a.length-n.length;if("mod"!==t){(c=new BN(null)).length=s+1,c.words=new Array(c.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);c&&(c.words[h]=l)}return c&&c._strip(),a._strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:c||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modrn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modrn=function modrn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=(1<<26)%e,a=0,n=this.length-1;n>=0;n--)a=(r*a+(0|this.words[n]))%e;return t?-a:a},BN.prototype.modn=function modn(e){return this.modrn(e)},BN.prototype.idivn=function idivn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=0,a=this.length-1;a>=0;a--){var n=(0|this.words[a])+67108864*r;this.words[a]=n/e|0,r=n%e}return this._strip(),t?this.ineg():this},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),c=new BN(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(d),c.isub(u)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(c)):(r.isub(t),o.isub(a),c.isub(n))}return{a:o,b:c,gcd:r.iushln(s)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var s=0,d=1;0==(t.words[0]&d)&&s<26;++s,d<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(c),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,c&=67108863,this.words[o]=c}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=c}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(move(e,e.umod(this.m)._forceRed(this)),e)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),c=o.redNeg(),s=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,s).cmp(c);)d.redIAdd(c);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=s-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++c||0===a&&0===u)&&(n=this.mul(n,r[o]),c=0,o=0)):c=0}s=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},function(e,t,r){"use strict";var a=r(3).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.defineProperties=void 0;const d=s(r(6)),u=c(r(91)),h=c(r(181)),l=r(74);t.defineProperties=function(e,t,r){if(e.raw=[],e._fields=[],e.toJSON=function(t=!1){if(t){const t={};return e._fields.forEach((r=>{t[r]=`0x${e[r].toString("hex")}`})),t}return l.baToJSON(e.raw)},e.serialize=function serialize(){return h.encode(e.raw)},t.forEach(((t,r)=>{function getter(){return e.raw[r]}function setter(n){"00"!==(n=l.toBuffer(n)).toString("hex")||t.allowZero||(n=a.allocUnsafe(0)),t.allowLess&&t.length?(n=l.unpadBuffer(n),d.default(t.length>=n.length,`The field ${t.name} must not have more ${t.length} bytes`)):t.allowZero&&0===n.length||!t.length||d.default(t.length===n.length,`The field ${t.name} must have byte length of ${t.length}`),e.raw[r]=n}e._fields.push(t.name),Object.defineProperty(e,t.name,{enumerable:!0,configurable:!0,get:getter,set:setter}),t.default&&(e[t.name]=t.default),t.alias&&Object.defineProperty(e,t.alias,{enumerable:!1,configurable:!0,set:setter,get:getter})})),r)if("string"==typeof r&&(r=a.from(u.stripHexPrefix(r),"hex")),a.isBuffer(r)&&(r=h.decode(r)),Array.isArray(r)){if(r.length>e._fields.length)throw new Error("wrong number of fields in data");r.forEach(((t,r)=>{e[e._fields[r]]=l.toBuffer(t)}))}else{if("object"!=typeof r)throw new Error("invalid data");{const a=Object.keys(r);t.forEach((t=>{-1!==a.indexOf(t.name)&&(e[t.name]=r[t.name]),-1!==a.indexOf(t.alias)&&(e[t.alias]=r[t.alias])}))}}}},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(18).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void assert(!1,"Invalid character in "+e)}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=0,c=Math.min(e.length,r),s=t;s=49?d-49+10:d>=17?d-17+10:d,assert(d>=0&&o0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);return this._strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;this._strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,c=o%a,s=Math.min(o,o-c)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{BN.prototype[Symbol.for("nodejs.util.inspect.custom")]=inspect}catch(e){BN.prototype.inspect=inspect}else BN.prototype.inspect=inspect;function inspect(){return(this.red?""}var n=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],o=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,s=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=c[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modrn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16,2)},a&&(BN.prototype.toBuffer=function toBuffer(e,t){return this.toArrayLike(a,e,t)}),BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)};function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],c=n*o,s=67108863&c,d=c/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(c=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&c}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r._strip()}BN.prototype.toArrayLike=function toArrayLike(e,t,r){this._strip();var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0");var o=function allocate(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,n);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,a),o},BN.prototype._toArrayLikeLE=function _toArrayLikeLE(e,t){for(var r=0,a=0,n=0,o=0;n>8&255),r>16&255),6===o?(r>24&255),a=0,o=0):(a=c>>>24,o+=2)}if(r=0&&(e[r--]=c>>8&255),r>=0&&(e[r--]=c>>16&255),6===o?(r>=0&&(e[r--]=c>>24&255),a=0,o=0):(a=c>>>24,o+=2)}if(r>=0)for(e[r--]=a;r>=0;)e[r--]=0},Math.clz32?BN.prototype._countBits=function _countBits(e){return 32-Math.clz32(e)}:BN.prototype._countBits=function _countBits(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this._strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,c=0;c>26,this.words[c]=67108863&t;for(;0!==o&&c>26,this.words[c]=67108863&t;if(0===o&&c>>13,g=0|c[1],p=8191&g,B=g>>>13,m=0|c[2],I=8191&m,y=m>>>13,x=0|c[3],C=8191&x,v=x>>>13,Q=0|c[4],w=8191&Q,_=Q>>>13,k=0|c[5],N=8191&k,D=k>>>13,U=0|c[6],G=8191&U,T=U>>>13,L=0|c[7],q=8191&L,P=L>>>13,O=0|c[8],H=8191&O,Y=O>>>13,J=0|c[9],j=8191&J,z=J>>>13,W=0|s[0],V=8191&W,X=W>>>13,$=0|s[1],et=8191&$,tt=$>>>13,rt=0|s[2],at=8191&rt,it=rt>>>13,nt=0|s[3],ot=8191&nt,At=nt>>>13,ct=0|s[4],st=8191&ct,dt=ct>>>13,ut=0|s[5],ht=8191&ut,bt=ut>>>13,pt=0|s[6],Bt=8191&pt,mt=pt>>>13,It=0|s[7],Et=8191&It,yt=It>>>13,xt=0|s[8],Ct=8191&xt,vt=xt>>>13,Qt=0|s[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(C,V),n=(n=Math.imul(C,X))+Math.imul(v,V)|0,o=Math.imul(v,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(C,et)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(v,et)|0,o=o+Math.imul(v,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,st)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(C,at)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(v,at)|0,o=o+Math.imul(v,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,st)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,st)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,At)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,At)|0,a=a+Math.imul(I,st)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,st)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(q,V),n=(n=Math.imul(q,X))+Math.imul(P,V)|0,o=Math.imul(P,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(C,st)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(v,st)|0,o=o+Math.imul(v,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(q,et)|0,n=(n=n+Math.imul(q,tt)|0)+Math.imul(P,et)|0,o=o+Math.imul(P,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,st)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,st)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,bt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,Ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,vt)|0)+Math.imul(b,Ct)|0))<<13)|0;u=((o=o+Math.imul(b,vt)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(j,V),n=(n=Math.imul(j,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(q,at)|0,n=(n=n+Math.imul(q,it)|0)+Math.imul(P,at)|0,o=o+Math.imul(P,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,st)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,st)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(C,Bt)|0,n=(n=n+Math.imul(C,mt)|0)+Math.imul(v,Bt)|0,o=o+Math.imul(v,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,Ct)|0,n=(n=n+Math.imul(p,vt)|0)+Math.imul(B,Ct)|0,o=o+Math.imul(B,vt)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(j,et),n=(n=Math.imul(j,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(q,ot)|0,n=(n=n+Math.imul(q,At)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,At)|0,a=a+Math.imul(G,st)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,st)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(C,Et)|0,n=(n=n+Math.imul(C,yt)|0)+Math.imul(v,Et)|0,o=o+Math.imul(v,yt)|0,a=a+Math.imul(I,Ct)|0,n=(n=n+Math.imul(I,vt)|0)+Math.imul(y,Ct)|0,o=o+Math.imul(y,vt)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(j,at),n=(n=Math.imul(j,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(q,st)|0,n=(n=n+Math.imul(q,dt)|0)+Math.imul(P,st)|0,o=o+Math.imul(P,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(C,Ct)|0,n=(n=n+Math.imul(C,vt)|0)+Math.imul(v,Ct)|0,o=o+Math.imul(v,vt)|0;var qt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(j,ot),n=(n=Math.imul(j,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,st)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,st)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(q,ht)|0,n=(n=n+Math.imul(q,bt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,Ct)|0,n=(n=n+Math.imul(w,vt)|0)+Math.imul(_,Ct)|0,o=o+Math.imul(_,vt)|0;var Pt=(u+(a=a+Math.imul(C,wt)|0)|0)+((8191&(n=(n=n+Math.imul(C,Mt)|0)+Math.imul(v,wt)|0))<<13)|0;u=((o=o+Math.imul(v,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(j,st),n=(n=Math.imul(j,dt))+Math.imul(z,st)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(q,Bt)|0,n=(n=n+Math.imul(q,mt)|0)+Math.imul(P,Bt)|0,o=o+Math.imul(P,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,Ct)|0,n=(n=n+Math.imul(N,vt)|0)+Math.imul(D,Ct)|0,o=o+Math.imul(D,vt)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(j,ht),n=(n=Math.imul(j,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(q,Et)|0,n=(n=n+Math.imul(q,yt)|0)+Math.imul(P,Et)|0,o=o+Math.imul(P,yt)|0,a=a+Math.imul(G,Ct)|0,n=(n=n+Math.imul(G,vt)|0)+Math.imul(T,Ct)|0,o=o+Math.imul(T,vt)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(j,Bt),n=(n=Math.imul(j,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(q,Ct)|0,n=(n=n+Math.imul(q,vt)|0)+Math.imul(P,Ct)|0,o=o+Math.imul(P,vt)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(j,Et),n=(n=Math.imul(j,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,Ct)|0,n=(n=n+Math.imul(H,vt)|0)+Math.imul(Y,Ct)|0,o=o+Math.imul(Y,vt)|0;var Jt=(u+(a=a+Math.imul(q,wt)|0)|0)+((8191&(n=(n=n+Math.imul(q,Mt)|0)+Math.imul(P,wt)|0))<<13)|0;u=((o=o+Math.imul(P,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(j,Ct),n=(n=Math.imul(j,vt))+Math.imul(z,Ct)|0,o=Math.imul(z,vt);var Kt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863;var jt=(u+(a=Math.imul(j,wt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=qt,d[12]=Pt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=Jt,d[17]=Kt,d[18]=jt,0!==u&&(d[19]=u,r.length++),r};function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,c&=67108863}r.words[o]=s,a=c,c=n}return 0!==a?r.words[o]=a:r.length--,r._strip()}function jumboMulTo(e,t,r){return bigMulTo(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(s=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?s(this,e,t):r<63?smallMulTo(this,e,t):r<1024?bigMulTo(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var c=0;c>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,r+=n/67108864|0,r+=o>>>26,this.words[a]=67108863&o}return 0!==r&&(this.words[a]=r,this.length++),t?this.ineg():this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n&1}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),c=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&c}return s&&0!==u&&(s.words[s.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(s/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===c)return this._strip();for(assert(-1===c),c=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this._strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var c,s=a.length-n.length;if("mod"!==t){(c=new BN(null)).length=s+1,c.words=new Array(c.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);c&&(c.words[h]=l)}return c&&c._strip(),a._strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:c||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modrn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modrn=function modrn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=(1<<26)%e,a=0,n=this.length-1;n>=0;n--)a=(r*a+(0|this.words[n]))%e;return t?-a:a},BN.prototype.modn=function modn(e){return this.modrn(e)},BN.prototype.idivn=function idivn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=0,a=this.length-1;a>=0;a--){var n=(0|this.words[a])+67108864*r;this.words[a]=n/e|0,r=n%e}return this._strip(),t?this.ineg():this},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),c=new BN(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(d),c.isub(u)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(c)):(r.isub(t),o.isub(a),c.isub(n))}return{a:o,b:c,gcd:r.iushln(s)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var s=0,d=1;0==(t.words[0]&d)&&s<26;++s,d<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(c),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,c&=67108863,this.words[o]=c}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=c}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(move(e,e.umod(this.m)._forceRed(this)),e)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),c=o.redNeg(),s=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,s).cmp(c);)d.redIAdd(c);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=s-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++c||0===a&&0===u)&&(n=this.mul(n,r[o]),c=0,o=0)):c=0}s=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},function(e,t,r){"use strict";var a=r(5).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.defineProperties=void 0;const d=s(r(6)),u=c(r(187)),h=c(r(346)),l=r(77);t.defineProperties=function(e,t,r){if(e.raw=[],e._fields=[],e.toJSON=function(t=!1){if(t){const t={};return e._fields.forEach((r=>{t[r]=`0x${e[r].toString("hex")}`})),t}return l.baToJSON(e.raw)},e.serialize=function serialize(){return h.encode(e.raw)},t.forEach(((t,r)=>{function getter(){return e.raw[r]}function setter(n){"00"!==(n=l.toBuffer(n)).toString("hex")||t.allowZero||(n=a.allocUnsafe(0)),t.allowLess&&t.length?(n=l.unpadBuffer(n),d.default(t.length>=n.length,`The field ${t.name} must not have more ${t.length} bytes`)):t.allowZero&&0===n.length||!t.length||d.default(t.length===n.length,`The field ${t.name} must have byte length of ${t.length}`),e.raw[r]=n}e._fields.push(t.name),Object.defineProperty(e,t.name,{enumerable:!0,configurable:!0,get:getter,set:setter}),t.default&&(e[t.name]=t.default),t.alias&&Object.defineProperty(e,t.alias,{enumerable:!1,configurable:!0,set:setter,get:getter})})),r)if("string"==typeof r&&(r=a.from(u.stripHexPrefix(r),"hex")),a.isBuffer(r)&&(r=h.decode(r)),Array.isArray(r)){if(r.length>e._fields.length)throw new Error("wrong number of fields in data");r.forEach(((t,r)=>{e[e._fields[r]]=l.toBuffer(t)}))}else{if("object"!=typeof r)throw new Error("invalid data");{const a=Object.keys(r);t.forEach((t=>{-1!==a.indexOf(t.name)&&(e[t.name]=r[t.name]),-1!==a.indexOf(t.alias)&&(e[t.alias]=r[t.alias])}))}}}},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(18).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void assert(!1,"Invalid character in "+e)}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=0,c=Math.min(e.length,r),s=t;s=49?d-49+10:d>=17?d-17+10:d,assert(d>=0&&o0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);return this._strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;this._strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,c=o%a,s=Math.min(o,o-c)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{BN.prototype[Symbol.for("nodejs.util.inspect.custom")]=inspect}catch(e){BN.prototype.inspect=inspect}else BN.prototype.inspect=inspect;function inspect(){return(this.red?""}var n=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],o=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,s=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=c[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modrn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16,2)},a&&(BN.prototype.toBuffer=function toBuffer(e,t){return this.toArrayLike(a,e,t)}),BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)};function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],c=n*o,s=67108863&c,d=c/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(c=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&c}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r._strip()}BN.prototype.toArrayLike=function toArrayLike(e,t,r){this._strip();var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0");var o=function allocate(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,n);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,a),o},BN.prototype._toArrayLikeLE=function _toArrayLikeLE(e,t){for(var r=0,a=0,n=0,o=0;n>8&255),r>16&255),6===o?(r>24&255),a=0,o=0):(a=c>>>24,o+=2)}if(r=0&&(e[r--]=c>>8&255),r>=0&&(e[r--]=c>>16&255),6===o?(r>=0&&(e[r--]=c>>24&255),a=0,o=0):(a=c>>>24,o+=2)}if(r>=0)for(e[r--]=a;r>=0;)e[r--]=0},Math.clz32?BN.prototype._countBits=function _countBits(e){return 32-Math.clz32(e)}:BN.prototype._countBits=function _countBits(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this._strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,c=0;c>26,this.words[c]=67108863&t;for(;0!==o&&c>26,this.words[c]=67108863&t;if(0===o&&c>>13,g=0|c[1],p=8191&g,B=g>>>13,m=0|c[2],I=8191&m,y=m>>>13,x=0|c[3],C=8191&x,v=x>>>13,Q=0|c[4],w=8191&Q,_=Q>>>13,k=0|c[5],N=8191&k,D=k>>>13,U=0|c[6],G=8191&U,T=U>>>13,L=0|c[7],q=8191&L,P=L>>>13,O=0|c[8],H=8191&O,Y=O>>>13,J=0|c[9],j=8191&J,z=J>>>13,W=0|s[0],V=8191&W,X=W>>>13,$=0|s[1],et=8191&$,tt=$>>>13,rt=0|s[2],at=8191&rt,it=rt>>>13,nt=0|s[3],ot=8191&nt,At=nt>>>13,ct=0|s[4],st=8191&ct,dt=ct>>>13,ut=0|s[5],ht=8191&ut,bt=ut>>>13,pt=0|s[6],Bt=8191&pt,mt=pt>>>13,It=0|s[7],Et=8191&It,yt=It>>>13,xt=0|s[8],Ct=8191&xt,vt=xt>>>13,Qt=0|s[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(C,V),n=(n=Math.imul(C,X))+Math.imul(v,V)|0,o=Math.imul(v,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(C,et)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(v,et)|0,o=o+Math.imul(v,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,st)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(C,at)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(v,at)|0,o=o+Math.imul(v,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,st)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,st)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,At)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,At)|0,a=a+Math.imul(I,st)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,st)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(q,V),n=(n=Math.imul(q,X))+Math.imul(P,V)|0,o=Math.imul(P,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(C,st)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(v,st)|0,o=o+Math.imul(v,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(q,et)|0,n=(n=n+Math.imul(q,tt)|0)+Math.imul(P,et)|0,o=o+Math.imul(P,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,st)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,st)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,bt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,Ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,vt)|0)+Math.imul(b,Ct)|0))<<13)|0;u=((o=o+Math.imul(b,vt)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(j,V),n=(n=Math.imul(j,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(q,at)|0,n=(n=n+Math.imul(q,it)|0)+Math.imul(P,at)|0,o=o+Math.imul(P,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,st)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,st)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(C,Bt)|0,n=(n=n+Math.imul(C,mt)|0)+Math.imul(v,Bt)|0,o=o+Math.imul(v,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,Ct)|0,n=(n=n+Math.imul(p,vt)|0)+Math.imul(B,Ct)|0,o=o+Math.imul(B,vt)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(j,et),n=(n=Math.imul(j,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(q,ot)|0,n=(n=n+Math.imul(q,At)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,At)|0,a=a+Math.imul(G,st)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,st)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(C,Et)|0,n=(n=n+Math.imul(C,yt)|0)+Math.imul(v,Et)|0,o=o+Math.imul(v,yt)|0,a=a+Math.imul(I,Ct)|0,n=(n=n+Math.imul(I,vt)|0)+Math.imul(y,Ct)|0,o=o+Math.imul(y,vt)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(j,at),n=(n=Math.imul(j,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(q,st)|0,n=(n=n+Math.imul(q,dt)|0)+Math.imul(P,st)|0,o=o+Math.imul(P,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(C,Ct)|0,n=(n=n+Math.imul(C,vt)|0)+Math.imul(v,Ct)|0,o=o+Math.imul(v,vt)|0;var qt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(j,ot),n=(n=Math.imul(j,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,st)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,st)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(q,ht)|0,n=(n=n+Math.imul(q,bt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,Ct)|0,n=(n=n+Math.imul(w,vt)|0)+Math.imul(_,Ct)|0,o=o+Math.imul(_,vt)|0;var Pt=(u+(a=a+Math.imul(C,wt)|0)|0)+((8191&(n=(n=n+Math.imul(C,Mt)|0)+Math.imul(v,wt)|0))<<13)|0;u=((o=o+Math.imul(v,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(j,st),n=(n=Math.imul(j,dt))+Math.imul(z,st)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(q,Bt)|0,n=(n=n+Math.imul(q,mt)|0)+Math.imul(P,Bt)|0,o=o+Math.imul(P,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,Ct)|0,n=(n=n+Math.imul(N,vt)|0)+Math.imul(D,Ct)|0,o=o+Math.imul(D,vt)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(j,ht),n=(n=Math.imul(j,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(q,Et)|0,n=(n=n+Math.imul(q,yt)|0)+Math.imul(P,Et)|0,o=o+Math.imul(P,yt)|0,a=a+Math.imul(G,Ct)|0,n=(n=n+Math.imul(G,vt)|0)+Math.imul(T,Ct)|0,o=o+Math.imul(T,vt)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(j,Bt),n=(n=Math.imul(j,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(q,Ct)|0,n=(n=n+Math.imul(q,vt)|0)+Math.imul(P,Ct)|0,o=o+Math.imul(P,vt)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(j,Et),n=(n=Math.imul(j,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,Ct)|0,n=(n=n+Math.imul(H,vt)|0)+Math.imul(Y,Ct)|0,o=o+Math.imul(Y,vt)|0;var Jt=(u+(a=a+Math.imul(q,wt)|0)|0)+((8191&(n=(n=n+Math.imul(q,Mt)|0)+Math.imul(P,wt)|0))<<13)|0;u=((o=o+Math.imul(P,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(j,Ct),n=(n=Math.imul(j,vt))+Math.imul(z,Ct)|0,o=Math.imul(z,vt);var Kt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863;var jt=(u+(a=Math.imul(j,wt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=qt,d[12]=Pt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=Jt,d[17]=Kt,d[18]=jt,0!==u&&(d[19]=u,r.length++),r};function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,c&=67108863}r.words[o]=s,a=c,c=n}return 0!==a?r.words[o]=a:r.length--,r._strip()}function jumboMulTo(e,t,r){return bigMulTo(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(s=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?s(this,e,t):r<63?smallMulTo(this,e,t):r<1024?bigMulTo(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var c=0;c>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,r+=n/67108864|0,r+=o>>>26,this.words[a]=67108863&o}return 0!==r&&(this.words[a]=r,this.length++),t?this.ineg():this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n&1}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),c=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&c}return s&&0!==u&&(s.words[s.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(s/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===c)return this._strip();for(assert(-1===c),c=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this._strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var c,s=a.length-n.length;if("mod"!==t){(c=new BN(null)).length=s+1,c.words=new Array(c.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);c&&(c.words[h]=l)}return c&&c._strip(),a._strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:c||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modrn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modrn=function modrn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=(1<<26)%e,a=0,n=this.length-1;n>=0;n--)a=(r*a+(0|this.words[n]))%e;return t?-a:a},BN.prototype.modn=function modn(e){return this.modrn(e)},BN.prototype.idivn=function idivn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=0,a=this.length-1;a>=0;a--){var n=(0|this.words[a])+67108864*r;this.words[a]=n/e|0,r=n%e}return this._strip(),t?this.ineg():this},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),c=new BN(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(d),c.isub(u)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(c)):(r.isub(t),o.isub(a),c.isub(n))}return{a:o,b:c,gcd:r.iushln(s)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var s=0,d=1;0==(t.words[0]&d)&&s<26;++s,d<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(c),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,c&=67108863,this.words[o]=c}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=c}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(move(e,e.umod(this.m)._forceRed(this)),e)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),c=o.redNeg(),s=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,s).cmp(c);)d.redIAdd(c);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=s-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++c||0===a&&0===u)&&(n=this.mul(n,r[o]),c=0,o=0)):c=0}s=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},function(e,t,r){"use strict";var a=r(2).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.defineProperties=void 0;const d=s(r(6)),u=c(r(191)),h=c(r(353)),l=r(79);t.defineProperties=function(e,t,r){if(e.raw=[],e._fields=[],e.toJSON=function(t=!1){if(t){const t={};return e._fields.forEach((r=>{t[r]=`0x${e[r].toString("hex")}`})),t}return l.baToJSON(e.raw)},e.serialize=function serialize(){return h.encode(e.raw)},t.forEach(((t,r)=>{function getter(){return e.raw[r]}function setter(n){"00"!==(n=l.toBuffer(n)).toString("hex")||t.allowZero||(n=a.allocUnsafe(0)),t.allowLess&&t.length?(n=l.unpadBuffer(n),d.default(t.length>=n.length,`The field ${t.name} must not have more ${t.length} bytes`)):t.allowZero&&0===n.length||!t.length||d.default(t.length===n.length,`The field ${t.name} must have byte length of ${t.length}`),e.raw[r]=n}e._fields.push(t.name),Object.defineProperty(e,t.name,{enumerable:!0,configurable:!0,get:getter,set:setter}),t.default&&(e[t.name]=t.default),t.alias&&Object.defineProperty(e,t.alias,{enumerable:!1,configurable:!0,set:setter,get:getter})})),r)if("string"==typeof r&&(r=a.from(u.stripHexPrefix(r),"hex")),a.isBuffer(r)&&(r=h.decode(r)),Array.isArray(r)){if(r.length>e._fields.length)throw new Error("wrong number of fields in data");r.forEach(((t,r)=>{e[e._fields[r]]=l.toBuffer(t)}))}else{if("object"!=typeof r)throw new Error("invalid data");{const a=Object.keys(r);t.forEach((t=>{-1!==a.indexOf(t.name)&&(e[t.name]=r[t.name]),-1!==a.indexOf(t.alias)&&(e[t.alias]=r[t.alias])}))}}}},(e,t,r)=>{"use strict";var a=r(15),n=r(545),o=r(553),c=r(554),s=r(948);function Hash(e){s.call(this,"digest"),this._hash=e}a(Hash,s),Hash.prototype._update=function(e){this._hash.update(e)},Hash.prototype._final=function(){return this._hash.digest()},e.exports=function createHash(e){return"md5"===(e=e.toLowerCase())?new n:"rmd160"===e||"ripemd160"===e?new o:new Hash(c(e))}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.defineProperties=void 0;const d=s(r(6)),u=c(r(17)),h=c(r(20)),l=r(81);t.defineProperties=function(e,t,r){if(e.raw=[],e._fields=[],e.toJSON=function(t=!1){if(t){const t={};return e._fields.forEach((r=>{t[r]=`0x${e[r].toString("hex")}`})),t}return l.baToJSON(e.raw)},e.serialize=function serialize(){return h.encode(e.raw)},t.forEach(((t,r)=>{function getter(){return e.raw[r]}function setter(n){"00"!==(n=l.toBuffer(n)).toString("hex")||t.allowZero||(n=a.allocUnsafe(0)),t.allowLess&&t.length?(n=l.unpadBuffer(n),d.default(t.length>=n.length,`The field ${t.name} must not have more ${t.length} bytes`)):t.allowZero&&0===n.length||!t.length||d.default(t.length===n.length,`The field ${t.name} must have byte length of ${t.length}`),e.raw[r]=n}e._fields.push(t.name),Object.defineProperty(e,t.name,{enumerable:!0,configurable:!0,get:getter,set:setter}),t.default&&(e[t.name]=t.default),t.alias&&Object.defineProperty(e,t.alias,{enumerable:!1,configurable:!0,set:setter,get:getter})})),r)if("string"==typeof r&&(r=a.from(u.stripHexPrefix(r),"hex")),a.isBuffer(r)&&(r=h.decode(r)),Array.isArray(r)){if(r.length>e._fields.length)throw new Error("wrong number of fields in data");r.forEach(((t,r)=>{e[e._fields[r]]=l.toBuffer(t)}))}else{if("object"!=typeof r)throw new Error("invalid data");{const a=Object.keys(r);t.forEach((t=>{-1!==a.indexOf(t.name)&&(e[t.name]=r[t.name]),-1!==a.indexOf(t.alias)&&(e[t.alias]=r[t.alias])}))}}}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.defineProperties=void 0;var d=s(r(6)),u=c(r(17)),h=c(r(20)),l=r(84);t.defineProperties=function(e,t,r){if(e.raw=[],e._fields=[],e.toJSON=function(t){if(void 0===t&&(t=!1),t){var r={};return e._fields.forEach((function(t){r[t]="0x"+e[t].toString("hex")})),r}return l.baToJSON(e.raw)},e.serialize=function serialize(){return h.encode(e.raw)},t.forEach((function(t,r){function getter(){return e.raw[r]}function setter(n){"00"!==(n=l.toBuffer(n)).toString("hex")||t.allowZero||(n=a.allocUnsafe(0)),t.allowLess&&t.length?(n=l.unpadBuffer(n),d.default(t.length>=n.length,"The field "+t.name+" must not have more "+t.length+" bytes")):t.allowZero&&0===n.length||!t.length||d.default(t.length===n.length,"The field "+t.name+" must have byte length of "+t.length),e.raw[r]=n}e._fields.push(t.name),Object.defineProperty(e,t.name,{enumerable:!0,configurable:!0,get:getter,set:setter}),t.default&&(e[t.name]=t.default),t.alias&&Object.defineProperty(e,t.alias,{enumerable:!1,configurable:!0,set:setter,get:getter})})),r)if("string"==typeof r&&(r=a.from(u.stripHexPrefix(r),"hex")),a.isBuffer(r)&&(r=h.decode(r)),Array.isArray(r)){if(r.length>e._fields.length)throw new Error("wrong number of fields in data");r.forEach((function(t,r){e[e._fields[r]]=l.toBuffer(t)}))}else{if("object"!=typeof r)throw new Error("invalid data");var n=Object.keys(r);t.forEach((function(t){-1!==n.indexOf(t.name)&&(e[t.name]=r[t.name]),-1!==n.indexOf(t.alias)&&(e[t.alias]=r[t.alias])}))}}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&a(t,e,r);return n(t,e),t},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.rlp=t.BN=void 0;var s=c(r(12));t.BN=s.default;var d=o(r(20));t.rlp=d},function(e,t,r){"use strict";var a,n=r(0).Buffer,o=this&&this.__extends||(a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function __(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),c=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var r,a,n,o,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(s){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,a=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(n=c.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.CheckpointDB=void 0;var u=r(120),h=function(e){function CheckpointDB(t){var r=e.call(this,t)||this;return r.checkpoints=[],r}return o(CheckpointDB,e),Object.defineProperty(CheckpointDB.prototype,"isCheckpoint",{get:function(){return this.checkpoints.length>0},enumerable:!1,configurable:!0}),CheckpointDB.prototype.checkpoint=function(e){this.checkpoints.push({keyValueMap:new Map,root:e})},CheckpointDB.prototype.commit=function(){return c(this,void 0,void 0,(function(){var e,t,r;return s(this,(function(a){switch(a.label){case 0:return e=this.checkpoints.pop().keyValueMap,this.isCheckpoint?[3,2]:(t=[],e.forEach((function(e,r){null===e?t.push({type:"del",key:n.from(r,"binary")}):t.push({type:"put",key:n.from(r,"binary"),value:e})})),[4,this.batch(t)]);case 1:return a.sent(),[3,3];case 2:r=this.checkpoints[this.checkpoints.length-1].keyValueMap,e.forEach((function(e,t){return r.set(t,e)})),a.label=3;case 3:return[2]}}))}))},CheckpointDB.prototype.revert=function(){return c(this,void 0,void 0,(function(){return s(this,(function(e){return[2,this.checkpoints.pop().root]}))}))},CheckpointDB.prototype.get=function(t){return c(this,void 0,void 0,(function(){var r,a,n;return s(this,(function(o){switch(o.label){case 0:for(r=this.checkpoints.length-1;r>=0;r--)if(void 0!==(a=this.checkpoints[r].keyValueMap.get(t.toString("binary"))))return[2,a];return[4,e.prototype.get.call(this,t)];case 1:return n=o.sent(),this.isCheckpoint&&this.checkpoints[this.checkpoints.length-1].keyValueMap.set(t.toString("binary"),n),[2,n]}}))}))},CheckpointDB.prototype.put=function(t,r){return c(this,void 0,void 0,(function(){return s(this,(function(a){switch(a.label){case 0:return this.isCheckpoint?(this.checkpoints[this.checkpoints.length-1].keyValueMap.set(t.toString("binary"),r),[3,3]):[3,1];case 1:return[4,e.prototype.put.call(this,t,r)];case 2:a.sent(),a.label=3;case 3:return[2]}}))}))},CheckpointDB.prototype.del=function(e){return c(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return this.isCheckpoint?(this.checkpoints[this.checkpoints.length-1].keyValueMap.set(e.toString("binary"),null),[3,3]):[3,1];case 1:return[4,this._leveldb.del(e,u.ENCODING_OPTS)];case 2:t.sent(),t.label=3;case 3:return[2]}}))}))},CheckpointDB.prototype.batch=function(t){return c(this,void 0,void 0,(function(){var r,a,n,o,c,u;return s(this,(function(s){switch(s.label){case 0:if(!this.isCheckpoint)return[3,11];s.label=1;case 1:s.trys.push([1,8,9,10]),r=d(t),a=r.next(),s.label=2;case 2:return a.done?[3,7]:"put"!==(n=a.value).type?[3,4]:[4,this.put(n.key,n.value)];case 3:return s.sent(),[3,6];case 4:return"del"!==n.type?[3,6]:[4,this.del(n.key)];case 5:s.sent(),s.label=6;case 6:return a=r.next(),[3,2];case 7:return[3,10];case 8:return o=s.sent(),c={error:o},[3,10];case 9:try{a&&!a.done&&(u=r.return)&&u.call(r)}finally{if(c)throw c.error}return[7];case 10:return[3,13];case 11:return[4,e.prototype.batch.call(this,t)];case 12:s.sent(),s.label=13;case 13:return[2]}}))}))},CheckpointDB}(u.DB);t.CheckpointDB=h},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.defineProperties=void 0;var d=s(r(6)),u=c(r(17)),h=c(r(20)),l=r(85);t.defineProperties=function(e,t,r){if(e.raw=[],e._fields=[],e.toJSON=function(t){if(void 0===t&&(t=!1),t){var r={};return e._fields.forEach((function(t){r[t]="0x"+e[t].toString("hex")})),r}return l.baToJSON(e.raw)},e.serialize=function serialize(){return h.encode(e.raw)},t.forEach((function(t,r){function getter(){return e.raw[r]}function setter(n){"00"!==(n=l.toBuffer(n)).toString("hex")||t.allowZero||(n=a.allocUnsafe(0)),t.allowLess&&t.length?(n=l.unpadBuffer(n),d.default(t.length>=n.length,"The field "+t.name+" must not have more "+t.length+" bytes")):t.allowZero&&0===n.length||!t.length||d.default(t.length===n.length,"The field "+t.name+" must have byte length of "+t.length),e.raw[r]=n}e._fields.push(t.name),Object.defineProperty(e,t.name,{enumerable:!0,configurable:!0,get:getter,set:setter}),t.default&&(e[t.name]=t.default),t.alias&&Object.defineProperty(e,t.alias,{enumerable:!1,configurable:!0,set:setter,get:getter})})),r)if("string"==typeof r&&(r=a.from(u.stripHexPrefix(r),"hex")),a.isBuffer(r)&&(r=h.decode(r)),Array.isArray(r)){if(r.length>e._fields.length)throw new Error("wrong number of fields in data");r.forEach((function(t,r){e[e._fields[r]]=l.toBuffer(t)}))}else{if("object"!=typeof r)throw new Error("invalid data");var n=Object.keys(r);t.forEach((function(t){-1!==n.indexOf(t.name)&&(e[t.name]=r[t.name]),-1!==n.indexOf(t.alias)&&(e[t.alias]=r[t.alias])}))}}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&a(t,e,r);return n(t,e),t},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.rlp=t.BN=void 0;var s=c(r(12));t.BN=s.default;var d=o(r(20));t.rlp=d},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.defineProperties=void 0;var d=s(r(6)),u=c(r(17)),h=c(r(20)),l=r(87);t.defineProperties=function(e,t,r){if(e.raw=[],e._fields=[],e.toJSON=function(t){if(void 0===t&&(t=!1),t){var r={};return e._fields.forEach((function(t){r[t]="0x"+e[t].toString("hex")})),r}return l.baToJSON(e.raw)},e.serialize=function serialize(){return h.encode(e.raw)},t.forEach((function(t,r){function getter(){return e.raw[r]}function setter(n){"00"!==(n=l.toBuffer(n)).toString("hex")||t.allowZero||(n=a.allocUnsafe(0)),t.allowLess&&t.length?(n=l.unpadBuffer(n),d.default(t.length>=n.length,"The field "+t.name+" must not have more "+t.length+" bytes")):t.allowZero&&0===n.length||!t.length||d.default(t.length===n.length,"The field "+t.name+" must have byte length of "+t.length),e.raw[r]=n}e._fields.push(t.name),Object.defineProperty(e,t.name,{enumerable:!0,configurable:!0,get:getter,set:setter}),t.default&&(e[t.name]=t.default),t.alias&&Object.defineProperty(e,t.alias,{enumerable:!1,configurable:!0,set:setter,get:getter})})),r)if("string"==typeof r&&(r=a.from(u.stripHexPrefix(r),"hex")),a.isBuffer(r)&&(r=h.decode(r)),Array.isArray(r)){if(r.length>e._fields.length)throw new Error("wrong number of fields in data");r.forEach((function(t,r){e[e._fields[r]]=l.toBuffer(t)}))}else{if("object"!=typeof r)throw new Error("invalid data");var n=Object.keys(r);t.forEach((function(t){-1!==n.indexOf(t.name)&&(e[t.name]=r[t.name]),-1!==n.indexOf(t.alias)&&(e[t.alias]=r[t.alias])}))}}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&a(t,e,r);return n(t,e),t},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.rlp=t.BN=void 0;var s=c(r(12));t.BN=s.default;var d=o(r(20));t.rlp=d},function(e,t,r){"use strict";var a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),c=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)c.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return c},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseTransaction=void 0;var c=o(r(94)),s=r(16),d=r(211),u=function(){function BaseTransaction(e){this.activeCapabilities=[],this.DEFAULT_CHAIN="mainnet",this.DEFAULT_HARDFORK="istanbul";var t=e.nonce,r=e.gasLimit,a=e.to,n=e.value,o=e.data,c=e.v,d=e.r,u=e.s,h=e.type;this._type=new s.BN(s.toBuffer(h)).toNumber();var l=s.toBuffer(""===a?"0x":a),b=s.toBuffer(""===c?"0x":c),g=s.toBuffer(""===d?"0x":d),p=s.toBuffer(""===u?"0x":u);this.nonce=new s.BN(s.toBuffer(""===t?"0x":t)),this.gasLimit=new s.BN(s.toBuffer(""===r?"0x":r)),this.to=l.length>0?new s.Address(l):void 0,this.value=new s.BN(s.toBuffer(""===n?"0x":n)),this.data=s.toBuffer(""===o?"0x":o),this.v=b.length>0?new s.BN(b):void 0,this.r=g.length>0?new s.BN(g):void 0,this.s=p.length>0?new s.BN(p):void 0,this._validateCannotExceedMaxInteger({nonce:this.nonce,gasLimit:this.gasLimit,value:this.value,r:this.r,s:this.s})}return Object.defineProperty(BaseTransaction.prototype,"transactionType",{get:function(){return this.type},enumerable:!1,configurable:!0}),Object.defineProperty(BaseTransaction.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),BaseTransaction.prototype.supports=function(e){return this.activeCapabilities.includes(e)},BaseTransaction.prototype.validate=function(e){void 0===e&&(e=!1);var t=[];return this.getBaseFee().gt(this.gasLimit)&&t.push("gasLimit is too low. given "+this.gasLimit+", need at least "+this.getBaseFee()),this.isSigned()&&!this.verifySignature()&&t.push("Invalid Signature"),e?t:0===t.length},BaseTransaction.prototype.getBaseFee=function(){var e=this.getDataFee().addn(this.common.param("gasPrices","tx"));return this.common.gteHardfork("homestead")&&this.toCreationAddress()&&e.iaddn(this.common.param("gasPrices","txCreation")),e},BaseTransaction.prototype.getDataFee=function(){for(var e=this.common.param("gasPrices","txDataZero"),t=this.common.param("gasPrices","txDataNonZero"),r=0,a=0;a-1&&this.activeCapabilities.splice(h,1)}return u},BaseTransaction.prototype._getCommon=function(e,t){var r;if(t){var a=new s.BN(s.toBuffer(t));if(e){if(!e.chainIdBN().eq(a))throw new Error("The chain ID does not match the chain ID of Common");return e.copy()}return c.default.isSupportedChainId(a)?new c.default({chain:a,hardfork:this.DEFAULT_HARDFORK}):c.default.forCustomChain(this.DEFAULT_CHAIN,{name:"custom-chain",networkId:a,chainId:a},this.DEFAULT_HARDFORK)}return null!==(r=null==e?void 0:e.copy())&&void 0!==r?r:new c.default({chain:this.DEFAULT_CHAIN,hardfork:this.DEFAULT_HARDFORK})},BaseTransaction.prototype._validateCannotExceedMaxInteger=function(e,t){var r,o;void 0===t&&(t=53);try{for(var c=a(Object.entries(e)),d=c.next();!d.done;d=c.next()){var u=n(d.value,2),h=u[0],l=u[1];if(53===t){if(null==l?void 0:l.gt(s.MAX_INTEGER))throw new Error(h+" cannot exceed MAX_INTEGER, given "+l)}else{if(256!==t)throw new Error("unimplemented bits value");if(null==l?void 0:l.gte(s.TWO_POW256))throw new Error(h+" must be less than 2^256, given "+l)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=c.return)&&o.call(c)}finally{if(r)throw r.error}}},BaseTransaction}();t.BaseTransaction=u},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,a,n,o,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(s){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,a=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(n=c.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var d=r(627),u=r(51),h=r(168),l=r(4),b=r(20),g=s(r(66)),p=r(1077),B=s(r(217)),m=r(255),I=r(111),y=u.debug("vm:state"),x=function(){function DefaultStateManager(e){void 0===e&&(e={});var t=e.common;t||(t=new g.default({chain:"mainnet",hardfork:"petersburg"})),this._common=t,this._trie=e.trie||new h.SecureTrie,this._storageTries={},this._cache=new B.default(this._trie),this._touched=new d,this._touchedStack=[],this._checkpointCount=0,this._originalStorageCache=new Map,this._accessedStorage=[new Map]}return DefaultStateManager.prototype.copy=function(){return new DefaultStateManager({trie:this._trie.copy(!1),common:this._common})},DefaultStateManager.prototype.getAccount=function(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this._cache.getOrLoad(e)];case 1:return[2,t.sent()]}}))}))},DefaultStateManager.prototype.putAccount=function(e,t){return n(this,void 0,void 0,(function(){return o(this,(function(r){return y("Save account address="+e+" nonce="+t.nonce+" balance="+t.balance+" contract="+(t.isContract()?"yes":"no")+" empty="+(t.isEmpty()?"yes":"no")),this._cache.put(e,t),this.touchAccount(e),[2]}))}))},DefaultStateManager.prototype.deleteAccount=function(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){return y("Delete account "+e),this._cache.del(e),this.touchAccount(e),[2]}))}))},DefaultStateManager.prototype.touchAccount=function(e){this._touched.add(e.buf.toString("hex"))},DefaultStateManager.prototype.putContractCode=function(e,t){return n(this,void 0,void 0,(function(){var r,a;return o(this,(function(n){switch(n.label){case 0:return(r=l.keccak256(t)).equals(l.KECCAK256_NULL)?[2]:[4,this._trie.db.put(r,t)];case 1:return n.sent(),[4,this.getAccount(e)];case 2:return a=n.sent(),y("Update codeHash (-> "+I.short(r)+") for account "+e),a.codeHash=r,[4,this.putAccount(e,a)];case 3:return n.sent(),[2]}}))}))},DefaultStateManager.prototype.getContractCode=function(e){return n(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return[4,this.getAccount(e)];case 1:return(t=r.sent()).isContract()?[4,this._trie.db.get(t.codeHash)]:[2,a.alloc(0)];case 2:return[2,r.sent()||a.alloc(0)]}}))}))},DefaultStateManager.prototype._lookupStorageTrie=function(e){return n(this,void 0,void 0,(function(){var t,r;return o(this,(function(a){switch(a.label){case 0:return[4,this.getAccount(e)];case 1:return t=a.sent(),(r=this._trie.copy(!1)).root=t.stateRoot,r.db.checkpoints=[],[2,r]}}))}))},DefaultStateManager.prototype._getStorageTrie=function(e){return n(this,void 0,void 0,(function(){var t,r;return o(this,(function(a){switch(a.label){case 0:return t=e.buf.toString("hex"),(r=this._storageTries[t])?[3,2]:[4,this._lookupStorageTrie(e)];case 1:r=a.sent(),a.label=2;case 2:return[2,r]}}))}))},DefaultStateManager.prototype.getContractStorage=function(e,t){return n(this,void 0,void 0,(function(){var r;return o(this,(function(a){switch(a.label){case 0:if(32!==t.length)throw new Error("Storage key must be 32 bytes long");return[4,this._getStorageTrie(e)];case 1:return[4,a.sent().get(t)];case 2:return r=a.sent(),[2,b.decode(r)]}}))}))},DefaultStateManager.prototype.getOriginalContractStorage=function(e,t){return n(this,void 0,void 0,(function(){var r,a,n,c;return o(this,(function(o){switch(o.label){case 0:if(32!==t.length)throw new Error("Storage key must be 32 bytes long");return r=e.buf.toString("hex"),a=t.toString("hex"),this._originalStorageCache.has(r)?n=this._originalStorageCache.get(r):(n=new Map,this._originalStorageCache.set(r,n)),n.has(a)?[2,n.get(a)]:[3,1];case 1:return[4,this.getContractStorage(e,t)];case 2:return c=o.sent(),n.set(a,c),[2,c]}}))}))},DefaultStateManager.prototype._clearOriginalStorageCache=function(){this._originalStorageCache=new Map},DefaultStateManager.prototype.clearOriginalStorageCache=function(){this._clearOriginalStorageCache()},DefaultStateManager.prototype._modifyContractStorage=function(e,t){return n(this,void 0,void 0,(function(){var r=this;return o(this,(function(a){return[2,new Promise((function(a){return n(r,void 0,void 0,(function(){var r,c=this;return o(this,(function(s){switch(s.label){case 0:return[4,this._getStorageTrie(e)];case 1:return r=s.sent(),t(r,(function(){return n(c,void 0,void 0,(function(){var t,n;return o(this,(function(o){switch(o.label){case 0:return t=e.buf.toString("hex"),this._storageTries[t]=r,(n=this._cache.get(e)).stateRoot=r.root,[4,this.putAccount(e,n)];case 1:return o.sent(),this.touchAccount(e),a(),[2]}}))}))})),[2]}}))}))}))]}))}))},DefaultStateManager.prototype.putContractStorage=function(e,t,r){return n(this,void 0,void 0,(function(){var a=this;return o(this,(function(c){switch(c.label){case 0:if(32!==t.length)throw new Error("Storage key must be 32 bytes long");if(r.length>32)throw new Error("Storage value cannot be longer than 32 bytes");return r=l.unpadBuffer(r),[4,this._modifyContractStorage(e,(function(c,s){return n(a,void 0,void 0,(function(){var a;return o(this,(function(n){switch(n.label){case 0:return r&&r.length?(a=b.encode(r),y("Update contract storage for account "+e+" to "+I.short(r)),[4,c.put(t,a)]):[3,2];case 1:return n.sent(),[3,4];case 2:return y("Delete contract storage for account"),[4,c.del(t)];case 3:n.sent(),n.label=4;case 4:return s(),[2]}}))}))}))];case 1:return c.sent(),[2]}}))}))},DefaultStateManager.prototype.clearContractStorage=function(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this._modifyContractStorage(e,(function(e,t){e.root=e.EMPTY_TRIE_ROOT,t()}))];case 1:return t.sent(),[2]}}))}))},DefaultStateManager.prototype.checkpoint=function(){return n(this,void 0,void 0,(function(){return o(this,(function(e){return this._trie.checkpoint(),this._cache.checkpoint(),this._touchedStack.push(new d(Array.from(this._touched))),this._accessedStorage.push(new Map),this._checkpointCount++,[2]}))}))},DefaultStateManager.prototype.commit=function(){return n(this,void 0,void 0,(function(){var e,t;return o(this,(function(r){switch(r.label){case 0:return[4,this._trie.commit()];case 1:return r.sent(),this._cache.commit(),this._touchedStack.pop(),this._checkpointCount--,e=this._accessedStorage.pop(),(t=this._accessedStorage[this._accessedStorage.length-1])&&(null==e||e.forEach((function(e,r){t.get(r)||t.set(r,new d);var a=t.get(r);e.forEach((function(e){a.add(e)}))}))),0!==this._checkpointCount?[3,3]:[4,this._cache.flush()];case 2:r.sent(),this._clearOriginalStorageCache(),r.label=3;case 3:return[2]}}))}))},DefaultStateManager.prototype.revert=function(){return n(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return[4,this._trie.revert()];case 1:if(t.sent(),this._cache.revert(),this._storageTries={},this._accessedStorage.pop(),!(e=this._touchedStack.pop()))throw new Error("Reverting to invalid state checkpoint failed");return this._touched.has(m.ripemdPrecompileAddress)&&e.add(m.ripemdPrecompileAddress),this._touched=e,this._checkpointCount--,0!==this._checkpointCount?[3,3]:[4,this._cache.flush()];case 2:t.sent(),this._clearOriginalStorageCache(),t.label=3;case 3:return[2]}}))}))},DefaultStateManager.prototype.getStateRoot=function(e){return void 0===e&&(e=!1),n(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:if(!e&&0!==this._checkpointCount)throw new Error("Cannot get state root with uncommitted checkpoints");return[4,this._cache.flush()];case 1:return t.sent(),[2,this._trie.root]}}))}))},DefaultStateManager.prototype.setStateRoot=function(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:if(0!==this._checkpointCount)throw new Error("Cannot set state root with uncommitted checkpoints");return[4,this._cache.flush()];case 1:return t.sent(),e===this._trie.EMPTY_TRIE_ROOT?(this._trie.root=e,this._cache.clear(),this._storageTries={},[2]):[4,this._trie.checkRoot(e)];case 2:if(!t.sent())throw new Error("State trie does not contain state root");return this._trie.root=e,this._cache.clear(),this._storageTries={},[2]}}))}))},DefaultStateManager.prototype.dumpStorage=function(e){return n(this,void 0,void 0,(function(){var t=this;return o(this,(function(r){return[2,new Promise((function(r,a){t._getStorageTrie(e).then((function(e){var t={},a=e.createReadStream();a.on("data",(function(e){t[e.key.toString("hex")]=e.value.toString("hex")})),a.on("end",(function(){r(t)}))})).catch((function(e){a(e)}))}))]}))}))},DefaultStateManager.prototype.hasGenesisState=function(){return n(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return e=this._common.genesis().stateRoot,[4,this._trie.checkRoot(e)];case 1:return[2,t.sent()]}}))}))},DefaultStateManager.prototype.generateCanonicalGenesis=function(){return n(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:if(0!==this._checkpointCount)throw new Error("Cannot create genesis state with uncommitted checkpoints");return[4,this.hasGenesisState()];case 1:return e.sent()?[3,3]:[4,this.generateGenesis(p.genesisStateByName(this._common.chainName()))];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))},DefaultStateManager.prototype.generateGenesis=function(e){return n(this,void 0,void 0,(function(){var t,r,a,n,s,d,u,h,b,g;return o(this,(function(o){switch(o.label){case 0:if(0!==this._checkpointCount)throw new Error("Cannot create genesis state with uncommitted checkpoints");y("Save genesis state into the state trie"),t=Object.keys(e),o.label=1;case 1:o.trys.push([1,6,7,8]),r=c(t),a=r.next(),o.label=2;case 2:return a.done?[3,5]:(n=a.value,s=new l.BN(l.toBuffer(e[n])),d=l.Account.fromAccountData({balance:s}),u=l.toBuffer(n),[4,this._trie.put(u,d.serialize())]);case 3:o.sent(),o.label=4;case 4:return a=r.next(),[3,2];case 5:return[3,8];case 6:return h=o.sent(),b={error:h},[3,8];case 7:try{a&&!a.done&&(g=r.return)&&g.call(r)}finally{if(b)throw b.error}return[7];case 8:return[2]}}))}))},DefaultStateManager.prototype.accountIsEmpty=function(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.getAccount(e)];case 1:return[2,t.sent().isEmpty()]}}))}))},DefaultStateManager.prototype.accountExists=function(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return this._cache.lookup(e)&&!this._cache.keyIsDeleted(e)?[2,!0]:[4,this._cache._trie.get(e.buf)];case 1:return t.sent()?[2,!0]:[2,!1]}}))}))},DefaultStateManager.prototype.isWarmedAddress=function(e){for(var t=this._accessedStorage.length-1;t>=0;t--){if(this._accessedStorage[t].has(e.toString("hex")))return!0}return!1},DefaultStateManager.prototype.addWarmedAddress=function(e){var t=e.toString("hex");if(!this._accessedStorage[this._accessedStorage.length-1].get(t)){var r=new d;this._accessedStorage[this._accessedStorage.length-1].set(t,r)}},DefaultStateManager.prototype.isWarmedStorage=function(e,t){for(var r=e.toString("hex"),a=t.toString("hex"),n=this._accessedStorage.length-1;n>=0;n--){var o=this._accessedStorage[n];if(o.has(r)&&o.get(r).has(a))return!0}return!1},DefaultStateManager.prototype.addWarmedStorage=function(e,t){var r=e.toString("hex"),a=this._accessedStorage[this._accessedStorage.length-1].get(r);a||(a=new d,this._accessedStorage[this._accessedStorage.length-1].set(r,a)),a.add(t.toString("hex"))},DefaultStateManager.prototype.clearWarmedAccounts=function(){this._accessedStorage=[new Map]},DefaultStateManager.prototype.cleanupTouchedAccounts=function(){return n(this,void 0,void 0,(function(){var e,t,r,n,s,d,u,h;return o(this,(function(o){switch(o.label){case 0:if(!this._common.gteHardfork("spuriousDragon"))return[3,8];e=Array.from(this._touched),o.label=1;case 1:o.trys.push([1,6,7,8]),t=c(e),r=t.next(),o.label=2;case 2:return r.done?[3,5]:(n=r.value,s=new l.Address(a.from(n,"hex")),[4,this.accountIsEmpty(s)]);case 3:o.sent()&&(this._cache.del(s),y("Cleanup touched account address="+s.toString()+" (>= SpuriousDragon)")),o.label=4;case 4:return r=t.next(),[3,2];case 5:return[3,8];case 6:return d=o.sent(),u={error:d},[3,8];case 7:try{r&&!r.done&&(h=t.return)&&h.call(t)}finally{if(u)throw u.error}return[7];case 8:return this._touched.clear(),[2]}}))}))},DefaultStateManager}();t.default=x},(e,t,r)=>{var a=r(121);e.exports=!a((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,a=arguments.length;r0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1] "+this._gasLeft+")"),this._gasLeft.ltn(0)&&(this._gasLeft=new u.BN(0),trap(h.ERROR.OUT_OF_GAS))},EEI.prototype.refundGas=function(e,t){b((t?t+": ":"")+"refund "+e+" gas (-> "+this._evm._refund+")"),this._evm._refund.iadd(e)},EEI.prototype.subRefund=function(e,t){b((t?t+": ":"")+"sub gas refund "+e+" (-> "+this._evm._refund+")"),this._evm._refund.isub(e),this._evm._refund.ltn(0)&&(this._evm._refund=new u.BN(0),trap(h.ERROR.REFUND_EXHAUSTED))},EEI.prototype.getAddress=function(){return this._env.address},EEI.prototype.getExternalBalance=function(e){return o(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return e.equals(this._env.address)?[2,this._env.contract.balance]:[4,this._state.getAccount(e)];case 1:return[2,t.sent().balance]}}))}))},EEI.prototype.getSelfBalance=function(){return this._env.contract.balance},EEI.prototype.getCaller=function(){return new u.BN(this._env.caller.buf)},EEI.prototype.getCallValue=function(){return new u.BN(this._env.callValue)},EEI.prototype.getCallData=function(){return this._env.callData},EEI.prototype.getCallDataSize=function(){return new u.BN(this._env.callData.length)},EEI.prototype.getCodeSize=function(){return new u.BN(this._env.code.length)},EEI.prototype.getCode=function(){return this._env.code},EEI.prototype.isStatic=function(){return this._env.isStatic},EEI.prototype.getExternalCodeSize=function(e){return o(this,void 0,void 0,(function(){var t,r;return c(this,(function(a){switch(a.label){case 0:return t=new u.Address(addressToBuffer(e)),[4,this._state.getContractCode(t)];case 1:return r=a.sent(),[2,new u.BN(r.length)]}}))}))},EEI.prototype.getExternalCode=function(e){return o(this,void 0,void 0,(function(){var t;return c(this,(function(r){return t=new u.Address(addressToBuffer(e)),[2,this._state.getContractCode(t)]}))}))},EEI.prototype.getReturnDataSize=function(){return new u.BN(this._lastReturned.length)},EEI.prototype.getReturnData=function(){return this._lastReturned},EEI.prototype.getTxGasPrice=function(){return this._env.gasPrice},EEI.prototype.getTxOrigin=function(){return new u.BN(this._env.origin.buf)},EEI.prototype.getBlockNumber=function(){return this._env.block.header.number},EEI.prototype.getBlockCoinbase=function(){var e;return e="clique"===this._common.consensusAlgorithm()?"cliqueSigner"in this._env.block.header?this._env.block.header.cliqueSigner():u.Address.zero():this._env.block.header.coinbase,new u.BN(e.toBuffer())},EEI.prototype.getBlockTimestamp=function(){return this._env.block.header.timestamp},EEI.prototype.getBlockDifficulty=function(){return this._env.block.header.difficulty},EEI.prototype.getBlockGasLimit=function(){return this._env.block.header.gasLimit},EEI.prototype.getChainId=function(){return this._common.chainIdBN()},EEI.prototype.getBlockHash=function(e){return o(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return[4,this._env.blockchain.getBlock(e)];case 1:return t=r.sent(),[2,new u.BN(t.hash())]}}))}))},EEI.prototype.storageStore=function(e,t){return o(this,void 0,void 0,(function(){var r;return c(this,(function(a){switch(a.label){case 0:return[4,this._state.putContractStorage(this._env.address,e,t)];case 1:return a.sent(),[4,this._state.getAccount(this._env.address)];case 2:return r=a.sent(),this._env.contract=r,[2]}}))}))},EEI.prototype.storageLoad=function(e){return o(this,void 0,void 0,(function(){return c(this,(function(t){return[2,this._state.getContractStorage(this._env.address,e)]}))}))},EEI.prototype.getGasLeft=function(){return this._gasLeft.clone()},EEI.prototype.finish=function(e){this._result.returnValue=e,trap(h.ERROR.STOP)},EEI.prototype.revert=function(e){this._result.returnValue=e,trap(h.ERROR.REVERT)},EEI.prototype.selfDestruct=function(e){return o(this,void 0,void 0,(function(){return c(this,(function(t){return[2,this._selfDestruct(e)]}))}))},EEI.prototype._selfDestruct=function(e){return o(this,void 0,void 0,(function(){var t,r;return c(this,(function(a){switch(a.label){case 0:return this._result.selfdestruct[this._env.address.buf.toString("hex")]||this.refundGas(new u.BN(this._common.param("gasPrices","selfdestructRefund"))),this._result.selfdestruct[this._env.address.buf.toString("hex")]=e.buf,[4,this._state.getAccount(e)];case 1:return(t=a.sent()).balance.iadd(this._env.contract.balance),[4,this._state.putAccount(e,t)];case 2:return a.sent(),[4,this._state.getAccount(this._env.address)];case 3:return(r=a.sent()).balance=new u.BN(0),[4,this._state.putAccount(this._env.address,r)];case 4:return a.sent(),trap(h.ERROR.STOP),[2]}}))}))},EEI.prototype.log=function(e,t,r){(t<0||t>4)&&trap(h.ERROR.OUT_OF_RANGE),r.length!==t&&trap(h.ERROR.INTERNAL_ERROR);var a=[this._env.address.buf,r,e];this._result.logs.push(a)},EEI.prototype.call=function(e,t,r,a){return o(this,void 0,void 0,(function(){var n;return c(this,(function(o){return n=new l.default({caller:this._env.address,gasLimit:e,to:t,value:r,data:a,isStatic:this._env.isStatic,depth:this._env.depth+1}),[2,this._baseCall(n)]}))}))},EEI.prototype.callCode=function(e,t,r,a){return o(this,void 0,void 0,(function(){var n;return c(this,(function(o){return n=new l.default({caller:this._env.address,gasLimit:e,to:this._env.address,codeAddress:t,value:r,data:a,isStatic:this._env.isStatic,depth:this._env.depth+1}),[2,this._baseCall(n)]}))}))},EEI.prototype.callStatic=function(e,t,r,a){return o(this,void 0,void 0,(function(){var n;return c(this,(function(o){return n=new l.default({caller:this._env.address,gasLimit:e,to:t,value:r,data:a,isStatic:!0,depth:this._env.depth+1}),[2,this._baseCall(n)]}))}))},EEI.prototype.callDelegate=function(e,t,r,a){return o(this,void 0,void 0,(function(){var n;return c(this,(function(o){return n=new l.default({caller:this._env.caller,gasLimit:e,to:this._env.address,codeAddress:t,value:r,data:a,isStatic:this._env.isStatic,delegatecall:!0,depth:this._env.depth+1}),[2,this._baseCall(n)]}))}))},EEI.prototype._baseCall=function(e){return o(this,void 0,void 0,(function(){var t,r,o;return c(this,(function(c){switch(c.label){case 0:return t=n({},this._result.selfdestruct),e.selfdestruct=t,this._lastReturned=a.alloc(0),this._env.depth>=this._common.param("vm","stackLimit")||!0!==e.delegatecall&&this._env.contract.balance.lt(e.value)?[2,new u.BN(0)]:[4,this._evm.executeMessage(e)];case 1:return(r=c.sent()).execResult.logs&&(this._result.logs=this._result.logs.concat(r.execResult.logs)),this.useGas(r.gasUsed,"CALL, STATICCALL, DELEGATECALL, CALLCODE"),!r.execResult.returnValue||r.execResult.exceptionError&&r.execResult.exceptionError.error!==h.ERROR.REVERT||(this._lastReturned=r.execResult.returnValue),r.execResult.exceptionError?[3,3]:(Object.assign(this._result.selfdestruct,t),[4,this._state.getAccount(this._env.address)]);case 2:o=c.sent(),this._env.contract=o,c.label=3;case 3:return[2,this._getReturnCode(r)]}}))}))},EEI.prototype.create=function(e,t,r,s){return void 0===s&&(s=null),o(this,void 0,void 0,(function(){var o,d,b,g;return c(this,(function(c){switch(c.label){case 0:return o=n({},this._result.selfdestruct),d=new l.default({caller:this._env.address,gasLimit:e,value:t,data:r,salt:s,depth:this._env.depth+1,selfdestruct:o}),this._lastReturned=a.alloc(0),this._env.depth>=this._common.param("vm","stackLimit")||!0!==d.delegatecall&&this._env.contract.balance.lt(d.value)?[2,new u.BN(0)]:(this._env.contract.nonce.iaddn(1),[4,this._state.putAccount(this._env.address,this._env.contract)]);case 1:return c.sent(),[4,this._evm.executeMessage(d)];case 2:return(b=c.sent()).execResult.logs&&(this._result.logs=this._result.logs.concat(b.execResult.logs)),this.useGas(b.gasUsed,"CREATE"),b.execResult.exceptionError&&b.execResult.exceptionError.error===h.ERROR.REVERT&&(this._lastReturned=b.execResult.returnValue),b.execResult.exceptionError&&b.execResult.exceptionError.error!==h.ERROR.CODESTORE_OUT_OF_GAS?[3,4]:(Object.assign(this._result.selfdestruct,o),[4,this._state.getAccount(this._env.address)]);case 3:if(g=c.sent(),this._env.contract=g,b.createdAddress)return[2,new u.BN(b.createdAddress.buf)];c.label=4;case 4:return[2,this._getReturnCode(b)]}}))}))},EEI.prototype.create2=function(e,t,r,a){return o(this,void 0,void 0,(function(){return c(this,(function(n){return[2,this.create(e,t,r,a)]}))}))},EEI.prototype.isAccountEmpty=function(e){return o(this,void 0,void 0,(function(){return c(this,(function(t){return[2,this._state.accountIsEmpty(e)]}))}))},EEI.prototype.accountExists=function(e){return o(this,void 0,void 0,(function(){return c(this,(function(t){return[2,this._state.accountExists(e)]}))}))},EEI.prototype._getReturnCode=function(e){return e.execResult.exceptionError?new u.BN(0):new u.BN(1)},EEI}();t.default=p},(e,t,r)=>{"use strict";var a=r(0).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.BLS12_381_ToFp2Point=t.BLS12_381_ToFpPoint=t.BLS12_381_ToFrPoint=t.BLS12_381_FromG2Point=t.BLS12_381_ToG2Point=t.BLS12_381_FromG1Point=t.BLS12_381_ToG1Point=void 0;var n=r(4),o=r(32),c=new n.BN("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab",16);function BLS12_381_ToFp2Point(e,t,r){if(new n.BN(e).gte(c))throw new o.VmError(o.ERROR.BLS_12_381_FP_NOT_IN_FIELD);if(new n.BN(t).gte(c))throw new o.VmError(o.ERROR.BLS_12_381_FP_NOT_IN_FIELD);var a=new r.Fp,s=new r.Fp,d=new r.Fp2;return a.setStr(e.slice(16).toString("hex"),16),s.setStr(t.slice(16).toString("hex"),16),d.set_a(a),d.set_b(s),d}t.BLS12_381_ToG1Point=function BLS12_381_ToG1Point(e,t){var r=e.slice(16,64).toString("hex"),a=e.slice(80,128).toString("hex"),n="0".repeat(96);if(r==a&&r==n)return new t.G1;var c=new t.Fp,s=new t.Fp,d=new t.Fp;c.setStr(r,16),s.setStr(a,16),d.setStr("1",16);var u=new t.G1;if(u.setX(c),u.setY(s),u.setZ(d),!u.isValidOrder())throw new o.VmError(o.ERROR.BLS_12_381_POINT_NOT_ON_CURVE);if(!u.isValid())throw new o.VmError(o.ERROR.BLS_12_381_POINT_NOT_ON_CURVE);return u},t.BLS12_381_FromG1Point=function BLS12_381_FromG1Point(e){var t=e.getStr(16),r=t.match(/"?[0-9a-f]+"?/g);if("0"==t)return a.alloc(128,0);var o=n.padToEven(r[1]),c=n.padToEven(r[2]),s=a.concat([a.alloc(64-o.length/2,0),a.from(o,"hex")]),d=a.concat([a.alloc(64-c.length/2,0),a.from(c,"hex")]);return a.concat([s,d])},t.BLS12_381_ToG2Point=function BLS12_381_ToG2Point(e,t){var r=e.slice(0,64),n=e.slice(64,128),c=e.slice(128,192),s=e.slice(192,256),d=a.alloc(64,0);if(r.equals(n)&&r.equals(c)&&r.equals(s)&&r.equals(d))return new t.G2;var u=BLS12_381_ToFp2Point(r,n,t),h=BLS12_381_ToFp2Point(c,s,t),l=new t.Fp;l.setStr("1",16);var b=new t.Fp;b.setStr("0",16);var g=new t.Fp2;g.set_a(l),g.set_b(b);var p=new t.G2;if(p.setX(u),p.setY(h),p.setZ(g),!p.isValidOrder())throw new o.VmError(o.ERROR.BLS_12_381_POINT_NOT_ON_CURVE);if(!p.isValid())throw new o.VmError(o.ERROR.BLS_12_381_POINT_NOT_ON_CURVE);return p},t.BLS12_381_FromG2Point=function BLS12_381_FromG2Point(e){var t=e.getStr(16);if("0"==t)return a.alloc(256,0);var r=t.match(/"?[0-9a-f]+"?/g),o=n.padToEven(r[1]),c=n.padToEven(r[2]),s=n.padToEven(r[3]),d=n.padToEven(r[4]),u=a.concat([a.alloc(64-o.length/2,0),a.from(o,"hex")]),h=a.concat([a.alloc(64-c.length/2,0),a.from(c,"hex")]),l=a.concat([a.alloc(64-s.length/2,0),a.from(s,"hex")]),b=a.concat([a.alloc(64-d.length/2,0),a.from(d,"hex")]);return a.concat([u,h,l,b])},t.BLS12_381_ToFrPoint=function BLS12_381_ToFrPoint(e,t){var r=t.fromHexStr(e.toString("hex")),a=new t.Fr;return a.setBigEndianMod(r),a},t.BLS12_381_ToFpPoint=function BLS12_381_ToFpPoint(e,t){if(new n.BN(e).gte(c))throw new o.VmError(o.ERROR.BLS_12_381_FP_NOT_IN_FIELD);var r=new t.Fp;return r.setBigEndianMod(t.fromHexStr(e.toString("hex"))),r},t.BLS12_381_ToFp2Point=BLS12_381_ToFp2Point},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(1454),t),n(r(150),t),n(r(310),t)},(e,t,r)=>{"use strict";var a=r(0).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.handlers=void 0;const n=r(4),o=r(310),c=r(1455),s=r(1456),d=r(685),u=r(30);t.handlers=new Map([[0,function(){o.trap(u.ERROR.STOP)}],[1,function(e){const[t,r]=e.stack.popN(2),a=t.add(r).mod(n.TWO_POW256);e.stack.push(a)}],[2,function(e){const[t,r]=e.stack.popN(2),a=t.mul(r).mod(n.TWO_POW256);e.stack.push(a)}],[3,function(e){const[t,r]=e.stack.popN(2),a=t.sub(r).toTwos(256);e.stack.push(a)}],[4,function(e){const[t,r]=e.stack.popN(2);let a;a=r.isZero()?new n.BN(r):t.div(r),e.stack.push(a)}],[5,function(e){let t,[r,a]=e.stack.popN(2);a.isZero()?t=new n.BN(a):(r=r.fromTwos(256),a=a.fromTwos(256),t=r.div(a).toTwos(256)),e.stack.push(t)}],[6,function(e){const[t,r]=e.stack.popN(2);let a;a=r.isZero()?new n.BN(r):t.mod(r),e.stack.push(a)}],[7,function(e){let t,[r,a]=e.stack.popN(2);a.isZero()?t=new n.BN(a):(r=r.fromTwos(256),a=a.fromTwos(256),t=r.abs().mod(a.abs()),r.isNeg()&&(t=t.ineg()),t=t.toTwos(256)),e.stack.push(t)}],[8,function(e){const[t,r,a]=e.stack.popN(3);let o;o=a.isZero()?new n.BN(a):t.add(r).mod(a),e.stack.push(o)}],[9,function(e){const[t,r,a]=e.stack.popN(3);let o;o=a.isZero()?new n.BN(a):t.mul(r).mod(a),e.stack.push(o)}],[10,function(e){const[t,r]=e.stack.popN(2);if(r.isZero())return void e.stack.push(new n.BN(1));const a=r.byteLength();(a<1||a>32)&&o.trap(u.ERROR.OUT_OF_RANGE);const c=e._common.param("gasPrices","expByte"),s=new n.BN(a).muln(c);if(e.eei.useGas(s,"EXP opcode"),t.isZero())return void e.stack.push(new n.BN(0));const d=n.BN.red(n.TWO_POW256),h=t.toRed(d).redPow(r);e.stack.push(h.fromRed())}],[11,function(e){let[t,r]=e.stack.popN(2);if(t.ltn(31)){const e=t.muln(8).iaddn(7).toNumber(),a=new n.BN(1).ishln(e).isubn(1);r=r.testn(e)?r.or(a.notn(256)):r.and(a)}else r=new n.BN(r);e.stack.push(r)}],[16,function(e){const[t,r]=e.stack.popN(2),a=new n.BN(t.lt(r)?1:0);e.stack.push(a)}],[17,function(e){const[t,r]=e.stack.popN(2),a=new n.BN(t.gt(r)?1:0);e.stack.push(a)}],[18,function(e){const[t,r]=e.stack.popN(2),a=new n.BN(t.fromTwos(256).lt(r.fromTwos(256))?1:0);e.stack.push(a)}],[19,function(e){const[t,r]=e.stack.popN(2),a=new n.BN(t.fromTwos(256).gt(r.fromTwos(256))?1:0);e.stack.push(a)}],[20,function(e){const[t,r]=e.stack.popN(2),a=new n.BN(t.eq(r)?1:0);e.stack.push(a)}],[21,function(e){const t=e.stack.pop(),r=new n.BN(t.isZero()?1:0);e.stack.push(r)}],[22,function(e){const[t,r]=e.stack.popN(2),a=t.and(r);e.stack.push(a)}],[23,function(e){const[t,r]=e.stack.popN(2),a=t.or(r);e.stack.push(a)}],[24,function(e){const[t,r]=e.stack.popN(2),a=t.xor(r);e.stack.push(a)}],[25,function(e){const t=e.stack.pop().notn(256);e.stack.push(t)}],[26,function(e){const[t,r]=e.stack.popN(2);if(t.gten(32))return void e.stack.push(new n.BN(0));const a=new n.BN(r.shrn(8*(31-t.toNumber())).andln(255));e.stack.push(a)}],[27,function(e){const[t,r]=e.stack.popN(2);if(t.gten(256))return void e.stack.push(new n.BN(0));const a=r.shln(t.toNumber()).iand(n.MAX_INTEGER);e.stack.push(a)}],[28,function(e){const[t,r]=e.stack.popN(2);if(t.gten(256))return void e.stack.push(new n.BN(0));const a=r.shrn(t.toNumber());e.stack.push(a)}],[29,function(e){const[t,r]=e.stack.popN(2);let a;const o=r.testn(255);if(t.gten(256))return a=o?new n.BN(n.MAX_INTEGER):new n.BN(0),void e.stack.push(a);const c=r.shrn(t.toNumber());if(o){const e=255-t.toNumber(),r=n.MAX_INTEGER.shrn(e).shln(e);a=c.ior(r)}else a=c;e.stack.push(a)}],[32,function(e){const[t,r]=e.stack.popN(2);o.subMemUsage(e,t,r);let c=a.alloc(0);r.isZero()||(c=e.memory.read(t.toNumber(),r.toNumber())),e.eei.useGas(new n.BN(e._common.param("gasPrices","sha3Word")).imul(o.divCeil(r,new n.BN(32))),"SHA3 opcode");const s=new n.BN(n.keccak256(c));e.stack.push(s)}],[48,function(e){const t=new n.BN(e.eei.getAddress().buf);e.stack.push(t)}],[49,async function(e){const t=e.stack.pop(),r=new n.Address(o.addressToBuffer(t));d.accessAddressEIP2929(e,r);const a=await e.eei.getExternalBalance(r);e.stack.push(a)}],[50,function(e){e.stack.push(e.eei.getTxOrigin())}],[51,function(e){e.stack.push(e.eei.getCaller())}],[52,function(e){e.stack.push(e.eei.getCallValue())}],[53,function(e){const t=e.stack.pop();if(t.gt(e.eei.getCallDataSize()))return void e.stack.push(new n.BN(0));const r=t.toNumber();let o=e.eei.getCallData().slice(r,r+32);o=o.length?o:a.from([0]);const c=new n.BN(n.setLengthRight(o,32));e.stack.push(c)}],[54,function(e){const t=e.eei.getCallDataSize();e.stack.push(t)}],[55,function(e){const[t,r,a]=e.stack.popN(3);o.subMemUsage(e,t,a),e.eei.useGas(new n.BN(e._common.param("gasPrices","copy")).imul(o.divCeil(a,new n.BN(32))),"CALLDATACOPY opcode");const c=o.getDataSlice(e.eei.getCallData(),r,a),s=t.toNumber(),d=a.toNumber();e.memory.extend(s,d),e.memory.write(s,d,c)}],[56,function(e){e.stack.push(e.eei.getCodeSize())}],[57,function(e){const[t,r,a]=e.stack.popN(3);o.subMemUsage(e,t,a),e.eei.useGas(new n.BN(e._common.param("gasPrices","copy")).imul(o.divCeil(a,new n.BN(32))),"CODECOPY opcode");const c=o.getDataSlice(e.eei.getCode(),r,a),s=t.toNumber(),d=a.toNumber();e.memory.extend(s,d),e.memory.write(s,d,c)}],[59,async function(e){const t=e.stack.pop(),r=new n.Address(o.addressToBuffer(t));d.accessAddressEIP2929(e,r);const a=await e.eei.getExternalCodeSize(t);e.stack.push(a)}],[60,async function(e){const[t,r,a,c]=e.stack.popN(4);o.subMemUsage(e,r,c);const s=new n.Address(o.addressToBuffer(t));d.accessAddressEIP2929(e,s),e.eei.useGas(new n.BN(e._common.param("gasPrices","copy")).imul(o.divCeil(c,new n.BN(32))),"EXTCODECOPY opcode");const u=await e.eei.getExternalCode(t),h=o.getDataSlice(u,a,c),l=r.toNumber(),b=c.toNumber();e.memory.extend(l,b),e.memory.write(l,b,h)}],[63,async function(e){const t=e.stack.pop(),r=new n.Address(o.addressToBuffer(t));d.accessAddressEIP2929(e,r);if(await e.eei.isAccountEmpty(r))return void e.stack.push(new n.BN(0));const a=await e.eei.getExternalCode(t);0!==a.length?e.stack.push(new n.BN(n.keccak256(a))):e.stack.push(new n.BN(n.KECCAK256_NULL))}],[61,function(e){e.stack.push(e.eei.getReturnDataSize())}],[62,function(e){const[t,r,a]=e.stack.popN(3);r.add(a).gt(e.eei.getReturnDataSize())&&o.trap(u.ERROR.OUT_OF_GAS),o.subMemUsage(e,t,a),e.eei.useGas(new n.BN(e._common.param("gasPrices","copy")).mul(o.divCeil(a,new n.BN(32))),"RETURNDATACOPY opcode");const c=o.getDataSlice(e.eei.getReturnData(),r,a),s=t.toNumber(),d=a.toNumber();e.memory.extend(s,d),e.memory.write(s,d,c)}],[58,function(e){e.stack.push(e.eei.getTxGasPrice())}],[64,async function(e){const t=e.stack.pop(),r=e.eei.getBlockNumber().sub(t);if(r.gtn(256)||r.lten(0))return void e.stack.push(new n.BN(0));const a=await e.eei.getBlockHash(t);e.stack.push(a)}],[65,function(e){e.stack.push(e.eei.getBlockCoinbase())}],[66,function(e){e.stack.push(e.eei.getBlockTimestamp())}],[67,function(e){e.stack.push(e.eei.getBlockNumber())}],[68,function(e){e.stack.push(e.eei.getBlockDifficulty())}],[69,function(e){e.stack.push(e.eei.getBlockGasLimit())}],[70,function(e){e.stack.push(e.eei.getChainId())}],[71,function(e){e.stack.push(e.eei.getSelfBalance())}],[80,function(e){e.stack.pop()}],[81,function(e){const t=e.stack.pop();o.subMemUsage(e,t,new n.BN(32));const r=e.memory.read(t.toNumber(),32);e.stack.push(new n.BN(r))}],[82,function(e){const[t,r]=e.stack.popN(2),c=r.toArrayLike(a,"be",32);o.subMemUsage(e,t,new n.BN(32));const s=t.toNumber();e.memory.extend(s,32),e.memory.write(s,32,c)}],[83,function(e){const[t,r]=e.stack.popN(2),c=a.from([r.andln(255)]);o.subMemUsage(e,t,new n.BN(1));const s=t.toNumber();e.memory.extend(s,1),e.memory.write(s,1,c)}],[84,async function(e){const t=e.stack.pop().toArrayLike(a,"be",32);d.accessStorageEIP2929(e,t,!1);const r=await e.eei.storageLoad(t),o=r.length?new n.BN(r):new n.BN(0);e.stack.push(o)}],[85,async function(e){e.eei.isStatic()&&o.trap(u.ERROR.STATIC_STATE_CHANGE);const[t,r]=e.stack.popN(2),n=t.toArrayLike(a,"be",32);let h;h=r.isZero()?a.from([]):r.toArrayLike(a,"be");const l=await o.getContractStorage(e,e.eei.getAddress(),n);"constantinople"===e._common.hardfork()?c.updateSstoreGasEIP1283(e,l,o.setLengthLeftStorage(h)):e._common.gteHardfork("istanbul")?s.updateSstoreGasEIP2200(e,l,o.setLengthLeftStorage(h),n):o.updateSstoreGas(e,l,o.setLengthLeftStorage(h),n),d.accessStorageEIP2929(e,n,!0),await e.eei.storageStore(n,h)}],[86,function(e){const t=e.stack.pop();t.gt(e.eei.getCodeSize())&&o.trap(u.ERROR.INVALID_JUMP+" at "+o.describeLocation(e));const r=t.toNumber();o.jumpIsValid(e,r)||o.trap(u.ERROR.INVALID_JUMP+" at "+o.describeLocation(e)),e.programCounter=r}],[87,function(e){const[t,r]=e.stack.popN(2);if(!r.isZero()){t.gt(e.eei.getCodeSize())&&o.trap(u.ERROR.INVALID_JUMP+" at "+o.describeLocation(e));const r=t.toNumber();o.jumpIsValid(e,r)||o.trap(u.ERROR.INVALID_JUMP+" at "+o.describeLocation(e)),e.programCounter=r}}],[88,function(e){e.stack.push(new n.BN(e.programCounter-1))}],[89,function(e){e.stack.push(e.memoryWordCount.muln(32))}],[90,function(e){e.stack.push(new n.BN(e.eei.getGasLeft()))}],[91,function(){}],[92,function(e){o.trap(u.ERROR.INVALID_BEGINSUB+" at "+o.describeLocation(e))}],[93,function(e){e.returnStack.length<1&&o.trap(u.ERROR.INVALID_RETURNSUB);const t=e.returnStack.pop();e.programCounter=t.toNumber()}],[94,function(e){const t=e.stack.pop();t.gt(e.eei.getCodeSize())&&o.trap(u.ERROR.INVALID_JUMPSUB+" at "+o.describeLocation(e));const r=t.toNumber();o.jumpSubIsValid(e,r)||o.trap(u.ERROR.INVALID_JUMPSUB+" at "+o.describeLocation(e)),e.returnStack.push(new n.BN(e.programCounter)),e.programCounter=r+1}],[96,function(e){const t=e.opCode-95,r=new n.BN(e.eei.getCode().slice(e.programCounter,e.programCounter+t));e.programCounter+=t,e.stack.push(r)}],[128,function(e){const t=e.opCode-127;e.stack.dup(t)}],[144,function(e){const t=e.opCode-143;e.stack.swap(t)}],[160,function(e){e.eei.isStatic()&&o.trap(u.ERROR.STATIC_STATE_CHANGE);const[t,r]=e.stack.popN(2),c=e.opCode-160;(c<0||c>4)&&o.trap(u.ERROR.OUT_OF_RANGE);const s=e.stack.popN(c).map((function(e){return e.toArrayLike(a,"be",32)}));o.subMemUsage(e,t,r);let d=a.alloc(0);r.isZero()||(d=e.memory.read(t.toNumber(),r.toNumber())),e.eei.useGas(new n.BN(e._common.param("gasPrices","logTopic")).imuln(c).iadd(r.muln(e._common.param("gasPrices","logData"))),"LOG opcode"),e.eei.log(d,c,s)}],[240,async function(e){e.eei.isStatic()&&o.trap(u.ERROR.STATIC_STATE_CHANGE);const[t,r,c]=e.stack.popN(3);d.accessAddressEIP2929(e,e.eei.getAddress(),!1),o.subMemUsage(e,r,c);let s=new n.BN(e.eei.getGasLeft());s=o.maxCallGas(s,e.eei.getGasLeft(),e);let h=a.alloc(0);c.isZero()||(h=e.memory.read(r.toNumber(),c.toNumber()));const l=await e.eei.create(s,t,h);e.stack.push(l)}],[245,async function(e){e.eei.isStatic()&&o.trap(u.ERROR.STATIC_STATE_CHANGE);const[t,r,c,s]=e.stack.popN(4);o.subMemUsage(e,r,c),d.accessAddressEIP2929(e,e.eei.getAddress(),!1),e.eei.useGas(new n.BN(e._common.param("gasPrices","sha3Word")).imul(o.divCeil(c,new n.BN(32))),"CREATE2 opcode");let h=new n.BN(e.eei.getGasLeft());h=o.maxCallGas(h,e.eei.getGasLeft(),e);let l=a.alloc(0);c.isZero()||(l=e.memory.read(r.toNumber(),c.toNumber()));const b=await e.eei.create2(h,t,l,s.toArrayLike(a,"be",32));e.stack.push(b)}],[241,async function(e){const[t,r,c,s,h,l,b]=e.stack.popN(7),g=new n.Address(o.addressToBuffer(r));e.eei.isStatic()&&!c.isZero()&&o.trap(u.ERROR.STATIC_STATE_CHANGE),o.subMemUsage(e,s,h),o.subMemUsage(e,l,b),d.accessAddressEIP2929(e,g),c.isZero()||e.eei.useGas(new n.BN(e._common.param("gasPrices","callValueTransfer")),"CALL opcode -> callValueTransfer");let p=a.alloc(0);h.isZero()||(p=e.memory.read(s.toNumber(),h.toNumber())),e._common.gteHardfork("spuriousDragon")?await e.eei.isAccountEmpty(g)&&!c.isZero()&&e.eei.useGas(new n.BN(e._common.param("gasPrices","callNewAccount")),"CALL opcode -> callNewAccount (>= SpuriousDragon)"):await e.eei.accountExists(g)||e.eei.useGas(new n.BN(e._common.param("gasPrices","callNewAccount")),"CALL opcode -> callNewAccount (< SpuriousDragon)");const B=o.maxCallGas(t,e.eei.getGasLeft(),e);B.gt(e.eei.getGasLeft())&&o.trap(u.ERROR.OUT_OF_GAS),c.isZero()||(e.eei._gasLeft.iaddn(e._common.param("gasPrices","callStipend")),B.iaddn(e._common.param("gasPrices","callStipend")));const m=await e.eei.call(B,g,c,p);o.writeCallOutput(e,l,b),e.stack.push(m)}],[242,async function(e){const[t,r,c,s,h,l,b]=e.stack.popN(7),g=new n.Address(o.addressToBuffer(r));o.subMemUsage(e,s,h),o.subMemUsage(e,l,b),d.accessAddressEIP2929(e,g),c.isZero()||e.eei.useGas(new n.BN(e._common.param("gasPrices","callValueTransfer")),"CALLCODE opcode -> callValueTransfer");const p=o.maxCallGas(t,e.eei.getGasLeft(),e);p.gt(e.eei.getGasLeft())&&o.trap(u.ERROR.OUT_OF_GAS),c.isZero()||(e.eei._gasLeft.iaddn(e._common.param("gasPrices","callStipend")),p.iaddn(e._common.param("gasPrices","callStipend")));let B=a.alloc(0);h.isZero()||(B=e.memory.read(s.toNumber(),h.toNumber()));const m=await e.eei.callCode(p,g,c,B);o.writeCallOutput(e,l,b),e.stack.push(m)}],[244,async function(e){const t=e.eei.getCallValue(),[r,c,s,h,l,b]=e.stack.popN(6),g=new n.Address(o.addressToBuffer(c));o.subMemUsage(e,s,h),o.subMemUsage(e,l,b),d.accessAddressEIP2929(e,g);const p=o.maxCallGas(r,e.eei.getGasLeft(),e);p.gt(e.eei.getGasLeft())&&o.trap(u.ERROR.OUT_OF_GAS);let B=a.alloc(0);h.isZero()||(B=e.memory.read(s.toNumber(),h.toNumber()));const m=await e.eei.callDelegate(p,g,t,B);o.writeCallOutput(e,l,b),e.stack.push(m)}],[250,async function(e){const t=new n.BN(0),[r,c,s,u,h,l]=e.stack.popN(6),b=new n.Address(o.addressToBuffer(c));o.subMemUsage(e,s,u),o.subMemUsage(e,h,l),d.accessAddressEIP2929(e,b);const g=o.maxCallGas(r,e.eei.getGasLeft(),e);let p=a.alloc(0);u.isZero()||(p=e.memory.read(s.toNumber(),u.toNumber()));const B=await e.eei.callStatic(g,b,t,p);o.writeCallOutput(e,h,l),e.stack.push(B)}],[243,function(e){const[t,r]=e.stack.popN(2);o.subMemUsage(e,t,r);let n=a.alloc(0);r.isZero()||(n=e.memory.read(t.toNumber(),r.toNumber())),e.eei.finish(n)}],[253,function(e){const[t,r]=e.stack.popN(2);o.subMemUsage(e,t,r);let n=a.alloc(0);r.isZero()||(n=e.memory.read(t.toNumber(),r.toNumber())),e.eei.revert(n)}],[255,async function(e){const t=e.stack.pop();e.eei.isStatic()&&o.trap(u.ERROR.STATIC_STATE_CHANGE);const r=new n.Address(o.addressToBuffer(t));let a=!1;if(e._common.gteHardfork("spuriousDragon")){if((await e.eei.getExternalBalance(e.eei.getAddress())).gtn(0)){await e.eei.isAccountEmpty(r)&&(a=!0)}}else if(e._common.gteHardfork("tangerineWhistle")){await e.stateManager.accountExists(r)||(a=!0)}return a&&e.eei.useGas(new n.BN(e._common.param("gasPrices","callNewAccount"))," opcode"),d.accessAddressEIP2929(e,r,!0,!0),e.eei.selfDestruct(r)}]]);const h=t.handlers.get(96);for(let e=97;e<=127;e++)t.handlers.set(e,h);const l=t.handlers.get(128);for(let e=129;e<=143;e++)t.handlers.set(e,l);const b=t.handlers.get(144);for(let e=145;e<=159;e++)t.handlers.set(e,b);const g=t.handlers.get(160);for(let e=161;e<=164;e++)t.handlers.set(e,g)},(e,t,r)=>{"use strict";var a=r(0).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.BLS12_381_ToFp2Point=t.BLS12_381_ToFpPoint=t.BLS12_381_ToFrPoint=t.BLS12_381_FromG2Point=t.BLS12_381_ToG2Point=t.BLS12_381_FromG1Point=t.BLS12_381_ToG1Point=void 0;const n=r(4),o=r(30),c=new n.BN("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab",16);function BLS12_381_ToFp2Point(e,t,r){if(new n.BN(e).gte(c))throw new o.VmError(o.ERROR.BLS_12_381_FP_NOT_IN_FIELD);if(new n.BN(t).gte(c))throw new o.VmError(o.ERROR.BLS_12_381_FP_NOT_IN_FIELD);const a=new r.Fp,s=new r.Fp,d=new r.Fp2;return a.setStr(e.slice(16).toString("hex"),16),s.setStr(t.slice(16).toString("hex"),16),d.set_a(a),d.set_b(s),d}t.BLS12_381_ToG1Point=function BLS12_381_ToG1Point(e,t){const r=e.slice(16,64).toString("hex"),a=e.slice(80,128).toString("hex"),n="0".repeat(96);if(r==a&&r==n)return new t.G1;const c=new t.Fp,s=new t.Fp,d=new t.Fp;c.setStr(r,16),s.setStr(a,16),d.setStr("1",16);const u=new t.G1;if(u.setX(c),u.setY(s),u.setZ(d),!u.isValidOrder())throw new o.VmError(o.ERROR.BLS_12_381_POINT_NOT_ON_CURVE);if(!u.isValid())throw new o.VmError(o.ERROR.BLS_12_381_POINT_NOT_ON_CURVE);return u},t.BLS12_381_FromG1Point=function BLS12_381_FromG1Point(e){const t=e.getStr(16),r=t.match(/"?[0-9a-f]+"?/g);if("0"==t)return a.alloc(128,0);const o=n.padToEven(r[1]),c=n.padToEven(r[2]),s=a.concat([a.alloc(64-o.length/2,0),a.from(o,"hex")]),d=a.concat([a.alloc(64-c.length/2,0),a.from(c,"hex")]);return a.concat([s,d])},t.BLS12_381_ToG2Point=function BLS12_381_ToG2Point(e,t){const r=e.slice(0,64),n=e.slice(64,128),c=e.slice(128,192),s=e.slice(192,256),d=a.alloc(64,0);if(r.equals(n)&&r.equals(c)&&r.equals(s)&&r.equals(d))return new t.G2;const u=BLS12_381_ToFp2Point(r,n,t),h=BLS12_381_ToFp2Point(c,s,t),l=new t.Fp;l.setStr("1",16);const b=new t.Fp;b.setStr("0",16);const g=new t.Fp2;g.set_a(l),g.set_b(b);const p=new t.G2;if(p.setX(u),p.setY(h),p.setZ(g),!p.isValidOrder())throw new o.VmError(o.ERROR.BLS_12_381_POINT_NOT_ON_CURVE);if(!p.isValid())throw new o.VmError(o.ERROR.BLS_12_381_POINT_NOT_ON_CURVE);return p},t.BLS12_381_FromG2Point=function BLS12_381_FromG2Point(e){const t=e.getStr(16);if("0"==t)return a.alloc(256,0);const r=t.match(/"?[0-9a-f]+"?/g),o=n.padToEven(r[1]),c=n.padToEven(r[2]),s=n.padToEven(r[3]),d=n.padToEven(r[4]),u=a.concat([a.alloc(64-o.length/2,0),a.from(o,"hex")]),h=a.concat([a.alloc(64-c.length/2,0),a.from(c,"hex")]),l=a.concat([a.alloc(64-s.length/2,0),a.from(s,"hex")]),b=a.concat([a.alloc(64-d.length/2,0),a.from(d,"hex")]);return a.concat([u,h,l,b])},t.BLS12_381_ToFrPoint=function BLS12_381_ToFrPoint(e,t){const r=t.fromHexStr(e.toString("hex")),a=new t.Fr;return a.setBigEndianMod(r),a},t.BLS12_381_ToFpPoint=function BLS12_381_ToFpPoint(e,t){if(new n.BN(e).gte(c))throw new o.VmError(o.ERROR.BLS_12_381_FP_NOT_IN_FIELD);const r=new t.Fp;return r.setBigEndianMod(t.fromHexStr(e.toString("hex"))),r},t.BLS12_381_ToFp2Point=BLS12_381_ToFp2Point},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ForkTrie=void 0;const d=r(76),u=r(8),h=r(1130),l=s(r(383)),b=c(r(1475)),g=r(75),p=r(19),B=r(4),m=new WeakMap,I={keyEncoding:"binary",valueEncoding:"binary"};async function commit(){const{keyValueMap:e}=this.checkpoints.pop();if(this.isCheckpoint){const t=this.checkpoints[this.checkpoints.length-1].keyValueMap;e.forEach(((e,r)=>t.set(r,e)))}else{const t=[];e.forEach((function(e,r){null===e?t.push({type:"del",key:a.from(r,"binary")}):t.push({type:"put",key:a.from(r,"binary"),value:e})})),await this.batch(t)}}class ForkTrie extends h.GanacheTrie{constructor(e,t,r){super(e,t,r),this.address=null,this.blockNumber=null,this.accountFromFallback=async(e,t)=>{const{fallback:r}=this.blockchain,a=this.blockchain.fallback.selectValidForkBlockNumber(t),n=r.request("eth_getCode",[e,a]),o=[r.request("eth_getTransactionCount",[e,a]),r.request("eth_getBalance",[e,a]),null],c=new p.Account(e),s=await n;if("0x"!==s){const e=u.Data.from(s).toBuffer();c.codeHash=u.keccak(e),c.codeHash.equals(B.KECCAK256_NULL)||(o[2]=this.db.put(c.codeHash,e))}const[d,h]=await Promise.all(o);return c.nonce="0x0"===d?u.RPCQUANTITY_EMPTY:u.Quantity.from(d,!0),c.balance="0x0"===h?u.RPCQUANTITY_EMPTY:u.Quantity.from(h),c.serialize()},this.storageFromFallback=async(e,t,r)=>{const n=await this.blockchain.fallback.request("eth_getStorageAt",[`0x${e.toString("hex")}`,`0x${t.toString("hex")}`,this.blockchain.fallback.selectValidForkBlockNumber(r)]);if(!n)return null;const o=n.replace(/^0x(00)*/,""),c=a.from(o,"hex");return g.encode(c)},this.db.commit=commit.bind(this.db),this.accounts=r.accounts,this.blockNumber=this.blockchain.fallback.blockNumber,m.has(e)?this.metadata=m.get(e):(this.metadata=l.default(e,"f",I),m.set(e,this.metadata))}set root(e){this._root=e}get root(){return this._root}setContext(e,t,r){this._root=e,this.address=t,this.blockNumber=r}async put(e,t){return super.put(e,t)}createDelKey(e){const t=this.blockNumber.toBuffer();return b.encode([t,this.address,e])}async keyWasDeleted(e){return new Promise(((t,r)=>{const a=null===this.address?u.BUFFER_EMPTY:this.address;let n=!1;const o=this.metadata.createKeyStream({lte:this.createDelKey(e),reverse:!0}).on("data",(t=>{const r=b.decode(t),c=r[1],s=r[2];c.equals(a)&&s.equals(e)&&(n=!0,o.destroy())})).on("close",(()=>t(n))).on("error",r)}))}async del(e){await this.lock.wait();const t=u.keccak(e),r=this.createDelKey(e),a=this.metadata.put(r,u.BUFFER_ZERO),{node:n,stack:o}=await this.findPath(t);n&&await this._deleteNode(t,o),await a,this.lock.signal()}async get(e){const t=await super.get(e);return null!=t?t:await this.keyWasDeleted(e)?null:null===this.address?this.accountFromFallback(d.Address.from(e),this.blockNumber):this.storageFromFallback(this.address,e,this.blockNumber)}copy(){const e=this.db.copy(),t=new ForkTrie(e._leveldb,this.root,this.blockchain);return t.accounts=this.accounts,t.address=this.address,t.blockNumber=this.blockNumber,t}}t.ForkTrie=ForkTrie},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.HttpHandler=void 0;const d=r(19),u=c(r(1477)),h=c(r(1478)),l=r(414),b=s(r(1132)),{JSONRPC_PREFIX:g}=l.BaseHandler;class HttpHandler extends l.BaseHandler{constructor(e,t){super(e,t),this.url=e.fork.url,this.headers.accept=this.headers["content-type"]="application/json","http:"===this.url.protocol?(this._request=u.default.request,this.agent=new u.Agent({keepAlive:!0,scheduling:"fifo"})):(this._request=h.default.request,this.agent=new h.Agent({keepAlive:!0,scheduling:"fifo"}))}handleLengthedResponse(e,t){let r=a.allocUnsafe(t),n=0;return new Promise(((t,a)=>{e.on("data",(function data(e){const t=e.length;e.copy(r,n,0,t),n+=t})),e.on("end",(function end(){n!==r.length?a(new Error("content-length mismatch")):t(r)}))}))}handleChunkedResponse(e){let t;return new Promise((r=>{e.on("data",(e=>{const r=e;t=t?a.concat([t,r],t.length+r.length):a.concat([r],r.length)})),e.on("end",(()=>{r(t)}))}))}async request(e,t){const r=JSON.stringify({method:e,params:t});if(this.requestCache.has(r))return this.requestCache.get(r);const{protocol:a,hostname:n,port:o,pathname:c,search:s}=this.url,u={protocol:a,host:n,port:o,path:c+s,headers:this.headers,method:"POST",agent:this.agent,signal:this.abortSignal},h=this.limiter.handle((()=>{if(this.abortSignal.aborted)return Promise.reject(new d.AbortError);const e=b.default(),t=`${g}${this.id++},${r.slice(1)}`;this.headers["content-length"]=t.length;const a=this._request(u);return a.on("response",(t=>{const{headers:r}=t;let a;if("transfer-encoding"in r)a=this.handleChunkedResponse(t);else{const e=r["content-length"]/1;a=isNaN(e)||e<=0?this.handleChunkedResponse(t):this.handleLengthedResponse(t,e)}a.then((t=>{try{e.resolve(JSON.parse(t))}catch{const r=t.toString();let a;a=r.length>340?r.slice(0,320)+"…":r;let n=`Invalid JSON response from fork provider:\n\n ${a}`;(r.startsWith("invalid project id")||r.startsWith("project id required in the url"))&&this.url.host.endsWith("infura.io")&&(n+=`\n\nThe provided fork url, ${this.url}, may be an invalid or incorrect Infura endpoint.`,n+="\nVisit https://infura.io/docs/ethereum for Infura documentation."),e.reject(new Error(n))}}))})),a.setTimeout(5e3,a.abort.bind(a,null)),a.on("error",e.reject),a.write(t),a.end(),e.promise.finally((()=>this.requestCache.delete(r)))})).then((e=>{if("result"in e)return e.result;if("error"in e)throw e.error}));return this.requestCache.set(r,h),h}close(){return Promise.resolve()}}t.HttpHandler=HttpHandler},function(e,t,r){"use strict";var a,n,o,c,s,d,u,h,l,b=r(1),g=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},p=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},B=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Server=t._DefaultServerOptions=t.ServerStatus=void 0;const m=r(1143),I=B(r(1144)),y=B(r(1190)),x=r(1490),C=r(98),v=B(r(719)),Q=B(r(261)),w=B(r(231)),_=B(r(1193));var k;!function(e){e[e.unknown=0]="unknown",e[e.ready=1]="ready",e[e.opening=2]="opening",e[e.open=4]="open",e[e.openingOrOpen=6]="openingOrOpen",e[e.closing=8]="closing",e[e.closed=16]="closed",e[e.closingOrClosed=24]="closingOrClosed"}(k=t.ServerStatus||(t.ServerStatus={})),t._DefaultServerOptions=m.serverDefaults;class Server extends _.default{constructor(e={flavor:C.DefaultFlavor}){super(),a.set(this,void 0),n.set(this,void 0),o.set(this,k.unknown),c.set(this,null),s.set(this,null),d.set(this,null),u.set(this,void 0),h.set(this,null),l.set(this,void 0),g(this,a,m.serverOptionsConfig.normalize(e)),g(this,n,e),g(this,o,k.ready);const t=g(this,u,v.default.initialize(p(this,n)));g(this,l,this.initialize(t))}get provider(){return p(this,u).provider}get status(){return p(this,o)}async initialize(e){const t=g(this,c,x.App());p(this,a).server.ws&&g(this,h,new Q.default(t,e,p(this,a).server)),g(this,s,new w.default(t,e,p(this,a).server)),await e.once("ready")}listen(e,t,r){let a=null;"function"==typeof t&&(r=t,a=null);const n="function"==typeof r,s=p(this,o);if(s===k.closing){const e=new Error("Cannot start server while it is closing.");return n?b.nextTick(r,e):Promise.reject(e)}if(0!=(s&k.openingOrOpen)){const t=new Error(`Server is already open, or is opening, on port: ${e}.`);return n?b.nextTick(r,t):Promise.reject(t)}g(this,o,k.opening);const u=p(this,l);I.default.shim();const h=Promise.allSettled([u,new Promise((t=>{a?p(this,c).listen(a,e,1,t):p(this,c).listen(e,1,t)})).then((t=>{if(!t){g(this,o,k.closed);throw new Error(`listen EADDRINUSE: address already in use ${a||"127.0.0.1"}:${e}.`)}g(this,o,k.open),g(this,d,t)}))]).then((async e=>{const t=[];if("rejected"===e[0].status&&t.push(e[0].reason),"rejected"===e[1].status&&t.push(e[1].reason),0!==t.length){g(this,o,k.unknown);try{await this.close()}catch(e){t.push(e)}throw t.length>1?new y.default(t):t[0]}this.emit("open")}));if(!n)return h;h.then((()=>r(null))).catch(r)}async close(){if(p(this,o)===k.opening)throw new Error("Cannot close server while it is opening.");if(0!=(p(this,o)&k.closingOrClosed))throw new Error("Server is already closing or closed.");g(this,o,k.closing);const e=p(this,d);g(this,d,null),null!==e&&x.us_listen_socket_close(e),null!==p(this,h)&&p(this,h).close(),null!==p(this,s)&&p(this,s).close(),null!==p(this,u)&&await p(this,u).close(),g(this,o,k.closed),g(this,c,null),await this.emit("close")}}t.Server=Server,a=new WeakMap,n=new WeakMap,o=new WeakMap,c=new WeakMap,s=new WeakMap,d=new WeakMap,u=new WeakMap,h=new WeakMap,l=new WeakMap,t.default=Server},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(1194),t),n(r(1195),t),n(r(1196),t)},(e,t,r)=>{"use strict";var a=r(2).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.KNOWN_CHAINIDS=t.WEI=t.RPCQUANTITY_ONE=t.RPCQUANTITY_ZERO=t.RPCQUANTITY_EMPTY=t.BUFFER_8_ZERO=t.BUFFER_32_ZERO=t.BUFFER_ZERO=t.BUFFER_EMPTY=t.ACCOUNT_ZERO=t.BUFFER_256_ZERO=void 0;const n=r(723);t.BUFFER_256_ZERO=a.allocUnsafe(256).fill(0),t.ACCOUNT_ZERO=t.BUFFER_256_ZERO.slice(0,20),t.BUFFER_EMPTY=a.allocUnsafe(0),t.BUFFER_ZERO=t.BUFFER_256_ZERO.slice(0,1),t.BUFFER_32_ZERO=t.BUFFER_256_ZERO.slice(0,32),t.BUFFER_8_ZERO=t.BUFFER_256_ZERO.slice(0,8),t.RPCQUANTITY_EMPTY=n.Quantity.from(t.BUFFER_EMPTY,!0),t.RPCQUANTITY_ZERO=n.Quantity.from(t.BUFFER_ZERO),t.RPCQUANTITY_ONE=n.Quantity.from(1n),t.WEI=1000000000000000000n,t.KNOWN_CHAINIDS=new Set([1,3,4,5,42])},(e,t,r)=>{"use strict";var a=r(1),n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=Duplex;var o=r(316),c=r(317);r(10)(Duplex,o);for(var s=n(c.prototype),d=0;d{"use strict";var a=r(1),n=65536,o=4294967295;var c=r(11).Buffer,s=r.g.crypto||r.g.msCrypto;s&&s.getRandomValues?e.exports=function randomBytes(e,t){if(e>o)throw new RangeError("requested too many random bytes");var r=c.allocUnsafe(e);if(e>0)if(e>n)for(var d=0;d{function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=assert,assert.equal=function assertEqual(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},function(e,t,r){"use strict";var a=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},n=this&&this.__generator||function(e,t){var r,a,n,o,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(s){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,a=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(n=c.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]{function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=assert,assert.equal=function assertEqual(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},function(e,t,r){"use strict";var a=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},n=this&&this.__generator||function(e,t){var r,a,n,o,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(s){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,a=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(n=c.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]{function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=assert,assert.equal=function assertEqual(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},e=>{function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=assert,assert.equal=function assertEqual(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},function(e,t,r){"use strict";var a,n,o,c,s,d=r(0).Buffer,u=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},h=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},l=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const b=r(19),g=r(8),p=r(4),B=l(r(285)),m=r(1300),I=l(r(973)),y=r(978),x=l(r(52)),C=l(r(544)),v=r(352),Q=r(76),w={dklen:32,n:1024,p:8,r:1},_="aes-128-ctr",scrypt=(...e)=>new Promise(((t,r)=>{x.default.scrypt.call(x.default,...e,((e,a)=>{if(!e)return t(a);r(e)}))})),uncompressedPublicKeyToAddress=e=>{const t=B.default.publicKeyConvert(e,!1).slice(1),r=C.default("keccak256");return r._state.absorb(t),Q.Address.from(r.digest().slice(-20))},asUUID=e=>`${e.toString("hex",0,4)}-${e.toString("hex",4,6)}-${e.toString("hex",6,8)}-${e.toString("hex",8,10)}-${e.toString("hex",10)}`;class Wallet{constructor(e){this.knownAccounts=new Set,this.encryptedKeyFiles=new Map,this.unlockedAccounts=new Map,this.lockTimers=new Map,a.set(this,void 0),n.set(this,void 0),o.set(this,(e=>{const t=d.allocUnsafe(e),r=h(this,n);for(let a=0;a{const t=e.defaultBalance.toString().split(".",2),r=BigInt(t[0]),n=t[1]||"0",o=BigInt(n),c=10n**BigInt(n.length),s=g.WEI*r+o*(g.WEI/c),d=g.Quantity.from(s);let u,l,b=e.accounts;if(b&&0!==(l=b.length)){const t=h(this,a),r=e.hdPath;u=Array(l);for(let e=0;e(this.lockTimers.delete(e),this.unlockedAccounts.delete(e),!0))),u(this,a,I.default.fromMasterSeed(m.mnemonicToSeedSync(e.mnemonic,null))),u(this,n,y.alea("ganache "+e.mnemonic));const t=this.initialAccounts=h(this,c).call(this,e),r=t.length,l=this.knownAccounts,b=this.unlockedAccounts,p=e.unlockedAccounts;if(p){const e=p.length;for(let a=0;a{t.addresses[r]=r,t.private_keys[r]=e})),v.writeFileSync(e.accountKeysPath,JSON.stringify(t))}}async encrypt(e,t){const r=h(this,o).call(this,64),a=r.slice(0,32),n=r.slice(32,48),c=r.slice(48),s=await scrypt(t,a,w.dklen,{...w,N:w.n}),u=x.default.createCipheriv(_,s.slice(0,16),n),l=d.concat([u.update(e.toBuffer()),u.final()]),b=C.default("keccak256").update(d.concat([s.slice(16,32),l])).digest();return{crypto:{cipher:_,ciphertext:g.Data.from(l),cipherparams:{iv:g.Data.from(n)},kdf:"scrypt",kdfParams:{...w,salt:g.Data.from(a)},mac:g.Data.from(b)},id:asUUID(c),version:3}}async decrypt(e,t){const r=e.crypto;if(r.cipher!==_)throw new Error(`keyfile cypher must be "${_}"`);if("scrypt"!==r.kdf)throw new Error('keyfile kdf must be "script"');const a=r.kdfParams,n=a.salt,o=r.mac,c=r.ciphertext.toBuffer();let s,u;if(null!=t)try{s=await scrypt(t,n.toBuffer(),a.dklen,{...a,N:a.n}),u=C.default("keccak256").update(d.concat([s.slice(16,32),c])).digest()}catch{u=null}if(!u||!o.toBuffer().equals(u))throw new Error("could not decrypt key with given password");return x.default.createDecipheriv(r.cipher,s.slice(0,16),r.cipherparams.iv.toBuffer()).update(c)}static createAccount(e,t,r){const a=new b.Account(r);return a.privateKey=t,a.balance=e,a}static createAccountFromPrivateKey(e){const t=Q.Address.from(p.privateToAddress(e.toBuffer())),r=new b.Account(t);return r.privateKey=e,r}createRandomAccount(){const e=h(this,o).call(this,128),t=I.default.fromMasterSeed(e),r=uncompressedPublicKeyToAddress(t.publicKey),a=g.Data.from(t.privateKey);return Wallet.createAccount(g.RPCQUANTITY_ZERO,a,r)}async unlockAccount(e,t,r){const a=this.encryptedKeyFiles.get(e);if(null==a)return!1;const n=await this.decrypt(a,t),o=this.lockTimers.get(e);o&&clearTimeout(o);const c=1e3*r|0;if(c>0){const t=setTimeout(h(this,s),c,e);g.unref(t),this.lockTimers.set(e,t)}return this.unlockedAccounts.set(e,g.Data.from(n)),!0}async unlockUnknownAccount(e,t){if(this.unlockedAccounts.has(e))return!1;if(this.knownAccounts.has(e))throw new Error("cannot unlock known/personal account");const r=1e3*t|0;if(r>0){const t=setTimeout(h(this,s),r,e);g.unref(t),this.lockTimers.set(e,t)}return this.unlockedAccounts.set(e,null),!0}lockAccount(e){return!!this.unlockedAccounts.has(e)&&(clearTimeout(this.lockTimers.get(e)),h(this,s).call(this,e))}}t.default=Wallet,a=new WeakMap,n=new WeakMap,o=new WeakMap,c=new WeakMap,s=new WeakMap},(e,t,r)=>{e=r.nmd(e);var a="__lodash_hash_undefined__",n=9007199254740991,o="[object Arguments]",c="[object Boolean]",s="[object Date]",d="[object Function]",u="[object GeneratorFunction]",h="[object Map]",l="[object Number]",b="[object Object]",g="[object Promise]",p="[object RegExp]",B="[object Set]",m="[object String]",I="[object Symbol]",y="[object WeakMap]",x="[object ArrayBuffer]",C="[object DataView]",v="[object Float32Array]",Q="[object Float64Array]",w="[object Int8Array]",_="[object Int16Array]",k="[object Int32Array]",N="[object Uint8Array]",D="[object Uint8ClampedArray]",U="[object Uint16Array]",G="[object Uint32Array]",T=/\w*$/,L=/^\[object .+?Constructor\]$/,q=/^(?:0|[1-9]\d*)$/,P={};P[o]=P["[object Array]"]=P[x]=P[C]=P[c]=P[s]=P[v]=P[Q]=P[w]=P[_]=P[k]=P[h]=P[l]=P[b]=P[p]=P[B]=P[m]=P[I]=P[N]=P[D]=P[U]=P[G]=!0,P["[object Error]"]=P[d]=P[y]=!1;var O="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,H="object"==typeof self&&self&&self.Object===Object&&self,Y=O||H||Function("return this")(),J=t&&!t.nodeType&&t,j=J&&e&&!e.nodeType&&e,z=j&&j.exports===J;function addMapEntry(e,t){return e.set(t[0],t[1]),e}function addSetEntry(e,t){return e.add(t),e}function arrayReduce(e,t,r,a){var n=-1,o=e?e.length:0;for(a&&o&&(r=e[++n]);++n-1},ListCache.prototype.set=function listCacheSet(e,t){var r=this.__data__,a=assocIndexOf(r,e);return a<0?r.push([e,t]):r[a][1]=t,this},MapCache.prototype.clear=function mapCacheClear(){this.__data__={hash:new Hash,map:new(It||ListCache),string:new Hash}},MapCache.prototype.delete=function mapCacheDelete(e){return getMapData(this,e).delete(e)},MapCache.prototype.get=function mapCacheGet(e){return getMapData(this,e).get(e)},MapCache.prototype.has=function mapCacheHas(e){return getMapData(this,e).has(e)},MapCache.prototype.set=function mapCacheSet(e,t){return getMapData(this,e).set(e,t),this},Stack.prototype.clear=function stackClear(){this.__data__=new ListCache},Stack.prototype.delete=function stackDelete(e){return this.__data__.delete(e)},Stack.prototype.get=function stackGet(e){return this.__data__.get(e)},Stack.prototype.has=function stackHas(e){return this.__data__.has(e)},Stack.prototype.set=function stackSet(e,t){var r=this.__data__;if(r instanceof ListCache){var a=r.__data__;if(!It||a.length<199)return a.push([e,t]),this;r=this.__data__=new MapCache(a)}return r.set(e,t),this};var Nt=bt?overArg(bt,Object):function stubArray(){return[]},Dt=function baseGetTag(e){return it.call(e)};function isIndex(e,t){return!!(t=null==t?n:t)&&("number"==typeof e||q.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=n}(e.length)&&!isFunction(e)}var Ft=pt||function stubFalse(){return!1};function isFunction(e){var t=isObject(e)?it.call(e):"";return t==d||t==u}function isObject(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function keys(e){return isArrayLike(e)?arrayLikeKeys(e):function baseKeys(e){if(!isPrototype(e))return Bt(e);var t=[];for(var r in Object(e))at.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}e.exports=function cloneDeep(e){return baseClone(e,!0,!0)}},function(e,t,r){"use strict";var a,n,o,c,s,d,u,h,l,b,g,p,B,m,I,y,x,C,v,Q,w,_=r(1),k=r(0).Buffer,N=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},D=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},U=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Status=void 0;const G=r(888),T=U(r(202)),L=U(r(206)),q=U(r(179)),P=r(19),O=r(75),H=r(4),Y=U(r(66)),J=U(r(105)),j=r(30),z=r(8),W=U(r(309)),V=U(r(222)),X=U(r(223)),$=U(r(224)),et=r(76),tt=r(27),rt=r(100),at=r(1450),it=r(683),nt=r(1474),ot=r(1130),At=r(152),ct=r(1476),st=U(r(227));var dt;function makeTrie(e,t,r){return e.fallback?new At.ForkTrie(t,r?r.toBuffer():null,e):new ot.GanacheTrie(t,r?r.toBuffer():null,e)}!function(e){e[e.started=1]="started",e[e.starting=2]="starting",e[e.stopped=4]="stopped",e[e.stopping=8]="stopping",e[e.paused=16]="paused"}(dt=t.Status||(t.Status={}));class Blockchain extends q.default.Typed{constructor(e,t,r){super(),a.set(this,dt.starting),n.set(this,void 0),o.set(this,void 0),c.set(this,null),s.set(this,void 0),d.set(this,void 0),u.set(this,void 0),h.set(this,(({block:e,serialized:t,storageKeys:r,transactions:a})=>{const{blocks:n}=this;return n.latest=e,D(this,s).batch((()=>{const o=e.hash(),c=e.header,s=c.number,u=s.toBuffer(),h=P.BlockLogs.create(o),l=c.timestamp,g=new Date(1e3*l.toNumber()).toString(),p=[];return a.forEach(((e,t)=>{const r=e.hash.toBuffer(),a=z.Quantity.from(t),n=e.serializeForDb(o,s,a);this.transactions.set(r,n);const d=e.getReceipt(),u=d.serialize(!0);this.transactionReceipts.set(r,u),e.getLogs().forEach(h.append.bind(h,a,e.hash)),p.push(D(this,b).call(this,r,d,c.number,g,e.execException))})),r.forEach((e=>{this.storageKeys.put(e.hashedKey,e.key)})),h.blockNumber=c.number,this.blockLogs.set(u,h.serialize()),n.putBlock(u,o,t),p.length>0&&D(this,d).logging.logger.log(p.join(G.EOL)),{block:e,blockLogs:h,transactions:a}}))})),l.set(this,(async e=>{const t=D(this,d),{block:r,blockLogs:a,transactions:n}=e;return n.forEach((e=>{e.finalize("confirmed",e.execException)})),D(this,u)&&t.miner.legacyInstamine?await new Promise((e=>{_.nextTick((async()=>{await Promise.all([this.emit("blockLogs",a),this.emit("block",r)]),e(void 0)}))})):await Promise.all([this.emit("blockLogs",a),this.emit("block",r)]),e})),b.set(this,((e,t,r,a,n)=>{let o=`${G.EOL} Transaction: ${z.Data.from(e)}${G.EOL}`;const c=t.contractAddress;return null!=c&&(o+=` Contract created: ${et.Address.from(c)}${G.EOL}`),o+=` Gas usage: ${z.Quantity.from(t.raw[1]).toNumber()}${G.EOL}\n Block number: ${r.toNumber()}${G.EOL}\n Block time: ${a}${G.EOL}`,n&&(o+=` Runtime error: ${n.data.message}${G.EOL}`,n.data.reason&&(o+=` Revert reason: ${n.data.reason}${G.EOL}`)),o})),g.set(this,(async e=>(N(this,o,D(this,o).then((()=>D(this,h).call(this,e))).then(D(this,l))),D(this,o)))),p.set(this,((e,t)=>{const r=e.header.number.toBigInt()||0n;return new rt.RuntimeBlock(z.Quantity.from(r+1n),e.hash(),this.coinbase,D(this,d).miner.blockGasLimit.toBuffer(),z.Quantity.from(null==t?D(this,x).call(this):t),D(this,d).miner.difficulty,e.header.totalDifficulty)})),this.isStarted=()=>D(this,a)===dt.started,this.mine=async(e,t,r=!1)=>{await D(this,o);const a=D(this,p).call(this,this.blocks.latest,t);return D(this,n).mine(a,e,r)},B.set(this,(()=>0!=(D(this,a)&dt.paused))),this.createVmFromStateTrie=async(e,t,r)=>{const a=this.blocks,n={getBlock:async e=>{const t=await a.get(e.toBuffer()).catch((e=>null));return t?{hash:()=>t.hash().toBuffer()}:null}},o=this.common,c=await J.default.create({state:e,activatePrecompiles:!1,common:o,allowUnlimitedContractSize:t,blockchain:n,stateManager:this.fallback?new it.ForkStateManager({common:o,trie:e}):new nt.DefaultStateManager({common:o,trie:e})});return r&&await ct.activatePrecompiles(c.stateManager),c},m.set(this,(e=>Promise.all(e.map((e=>this.trie.put(e.address.toBuffer(),e.serialize())))))),I.set(this,(async(e,t,r)=>{if(null!=this.fallback){const a=this.vm.stateManager;this.vm.stateManager.checkpoint(),r.forEach((e=>{const t={buf:e.address.toBuffer()};a._cache.put(t,e),a.touchAccount(t)})),await this.vm.stateManager.commit();const n=new rt.RuntimeBlock(z.Quantity.from(this.fallback.block.header.number.toBigInt()+1n),this.fallback.block.hash(),this.coinbase,t.toBuffer(),z.Quantity.from(e),D(this,d).miner.difficulty,this.fallback.block.header.totalDifficulty),{block:o,serialized:c}=n.finalize(H.KECCAK256_RLP,H.KECCAK256_RLP,z.BUFFER_256_ZERO,this.trie.root,0n,D(this,d).miner.extraData,[],new Map),s=o.hash();return this.blocks.putBlock(o.header.number.toBuffer(),s,c).then((e=>({block:o,blockLogs:P.BlockLogs.create(s)})))}await D(this,m).call(this,r);const a=z.RPCQUANTITY_EMPTY,n=new rt.RuntimeBlock(a,z.Quantity.from(z.BUFFER_32_ZERO),this.coinbase,t.toBuffer(),z.Quantity.from(e),D(this,d).miner.difficulty,z.RPCQUANTITY_ZERO),{block:o,serialized:c}=n.finalize(H.KECCAK256_RLP,H.KECCAK256_RLP,z.BUFFER_256_ZERO,this.trie.root,0n,D(this,d).miner.extraData,[],new Map);o.header.number=z.RPCQUANTITY_ZERO;const s=o.hash();return this.blocks.putBlock(o.header.number.toBuffer(),s,c).then((e=>({block:o,blockLogs:P.BlockLogs.create(s)})))})),y.set(this,0),x.set(this,(()=>Math.floor((Date.now()+D(this,y))/1e3))),C.set(this,(e=>D(this,s).batch((()=>{const{blocks:t,transactions:r,transactionReceipts:a,blockLogs:n}=this;e.forEach((e=>{e.getTransactions().forEach((e=>{const t=e.hash.toBuffer();r.del(t),a.del(t)}));const o=e.header.number.toBuffer();t.del(o),t.del(e.hash().toBuffer()),n.del(o)}))})))),v.set(this,{snaps:[],blocks:null,unsubscribeFromBlocks:null}),Q.set(this,(async(e,t,r,a,n)=>{let o=-1;const c=[],d=this.blocks,u={getBlock:async e=>{const t=await d.get(e.toBuffer()).catch((e=>null));return t?{hash:()=>t.hash().toBuffer()}:null}},h=this.common,l=await J.default.create({state:e,activatePrecompiles:!1,common:h,allowUnlimitedContractSize:this.vm.allowUnlimitedContractSize,blockchain:u,stateManager:this.fallback?new it.ForkStateManager({common:h,trie:e}):new nt.DefaultStateManager({common:h,trie:e})}),b={},g=t.transactions[t.transactions.length-1];let p=0;const B=[],m=P.TraceDataFactory(),stepListener=async(e,t)=>{const a=e.gasLeft.toNumber(),n=g.gasLimit.toNumber()-a-p;p+=n;const s=[];if(!0!==r.disableMemory){let t=0;for(;tr?c.pop():o{if(e===g){if(a&&n){const e=D(this,s);return Promise.all(a.map((async t=>{let r=await e.storageKeys.get(t);const a=await l.stateManager.getContractStorage({buf:et.Address.from(n).toBuffer()},r);b[z.Data.from(t,t.length).toString()]={key:z.Data.from(r,r.length),value:z.Data.from(a,32)}})))}l.on("step",stepListener)}};return l.on("beforeTx",beforeTxListener),l.stateManager._cache.flush=()=>{},await at.runTransactions(l,t.transactions,t),l.removeListener("step",stepListener),l.removeListener("beforeTx",beforeTxListener),{gas:p,structLogs:B,returnValue:"",storage:b}})),w.set(this,((e,t,r)=>{const a=new rt.RuntimeBlock(z.Quantity.from((t.header.number.toBigInt()||0n)+1n),t.hash(),t.header.miner,t.header.gasLimit.toBuffer(),e.header.timestamp,D(this,d).miner.difficulty,t.header.totalDifficulty);a.transactions=[],a.uncleHeaders=[];const n=e.getTransactions();for(const e of n)if(a.transactions.push(e.toVmTransaction()),e.hash.toBuffer().equals(r))break;return a})),N(this,d,e),this.fallback=r;const U=N(this,u,!e.miner.blockTime||e.miner.blockTime<=0),T=e.miner.legacyInstamine;T&&console.info("Legacy instamining, where transactions are fully mined before the hash is returned, is deprecated and will be removed in the future."),U||(T&&console.info("Setting `legacyInstamine` to `true` has no effect when blockTime is non-zero"),e.chain.vmErrorsOnRPCResponse&&console.info("Setting `vmErrorsOnRPCResponse` to `true` has no effect on transactions when blockTime is non-zero")),this.coinbase=t,N(this,s,new L.default(e.database,this))}async initialize(e){const t=D(this,s),r=D(this,d),h=D(this,u);let l;this.fallback?(await Promise.all([t.initialize(),this.fallback.initialize()]),l=this.common=this.fallback.common,r.fork.blockNumber=this.fallback.blockNumber.toNumber(),r.chain.networkId=l.networkId(),r.chain.chainId=l.chainId()):(await t.initialize(),l=this.common=function createCommon(e,t,r){const a=Y.default.forCustomChain(z.KNOWN_CHAINIDS.has(e)?e:1,{name:"ganache",networkId:t,chainId:e,comment:"Local test network"},r);return a.on=()=>{},a}(r.chain.chainId,r.chain.networkId,r.chain.hardfork));const b=this.blocks=await V.default.initialize(this,l,t.blockIndexes,t.blocks);this.blockLogs=new X.default(t.blockLogs,this),this.transactions=new $.default(r.miner,l,this,t.transactions),this.transactionReceipts=new st.default(t.transactionReceipts,this),this.accounts=new W.default(this),this.storageKeys=t.storageKeys;const{latest:y}=b;{let e;y?(N(this,o,Promise.resolve({block:y,blockLogs:null})),({stateRoot:e}=y.header)):e=null,this.trie=makeTrie(this,t.trie,e)}this.vm=await this.createVmFromStateTrie(this.trie,r.chain.allowUnlimitedContractSize,!0);{let t;if(null!=r.chain.time){const e=r.chain.time.getTime();t=Math.floor(e/1e3),this.setTime(e)}else t=D(this,x).call(this);y||(e.length>0&&await D(this,m).call(this,e),N(this,o,D(this,I).call(this,t,r.miner.blockGasLimit,e)),b.earliest=b.latest=await D(this,o).then((({block:e})=>e)))}{const e=this.transactions.transactionPool,t=r.miner,a=N(this,n,new T.default(t,e.executables,h,this.vm,D(this,p))),o=Promise.resolve(null),mineAll=e=>D(this,B).call(this)?o:this.mine(e);if(h)e.on("drain",mineAll.bind(null,1));else{const wait=()=>z.unref(N(this,c,setTimeout(next,1e3*t.blockTime))),next=()=>mineAll(-1).then(wait);wait()}a.on("block",D(this,g)),this.once("stop").then((()=>a.clearListeners()))}N(this,a,dt.started),this.emit("ready")}pause(){N(this,a,D(this,a)|dt.paused)}resume(e=1){if(D(this,B).call(this))return N(this,a,D(this,a)^dt.paused),D(this,u)?this.mine(-1):void 0;console.log("Warning: startMining called when miner was already started")}increaseTime(e){return e<0&&(e=0),N(this,y,D(this,y)+e)}setTime(e){return N(this,y,e-Date.now())}snapshot(){const e=D(this,v),t=e.snaps.push({block:this.blocks.latest,timeAdjustment:D(this,y)});return 1===t&&(e.unsubscribeFromBlocks=this.on("block",(t=>{e.blocks={current:t.hash().toBuffer(),next:e.blocks}}))),D(this,d).logging.logger.log("Saved snapshot #"+t),t}async revert(e){const t=e.valueOf();if(null==t)throw new Error("invalid snapshotId");if(D(this,d).logging.logger.log("Reverting to snapshot #"+e),t<1n)return!1;const r=D(this,v),a=r.snaps,c=Number(t-1n),s=a[c];if(!s)return!1;await this.transactions.pause(),await D(this,n).pause(),await D(this,o),this.transactions.clear();const u=this.blocks,h=u.latest.hash().toBuffer(),l=s.block,b=l.header,g=l.hash().toBuffer();if(a.splice(c),0===a.length&&r.unsubscribeFromBlocks(),!h.equals(g)){const e=[];let t=r.blocks;for(;null!==t&&!t.current.equals(g);)e.push(u.getByHash(t.current)),t=t.next;r.blocks=t,await Promise.all(e).then(D(this,C)),function setStateRootSync(e,t){e._trie.root=t,e._cache.clear(),e._storageTries={}}(this.vm.stateManager,b.stateRoot.toBuffer()),u.latest=l}return N(this,y,s.timeAdjustment),D(this,n).resume(),this.transactions.resume(),!0}async queueTransaction(e,t){!0===await this.transactions.add(e,t)&&_.nextTick(this.emit.bind(this),"pendingTransaction",e);const r=e.hash;if(D(this,B).call(this)||!D(this,u))return r;if(D(this,u)&&D(this,d).miner.legacyInstamine){const{status:t,error:r}=await e.once("finalized");if(r&&("rejected"===t||D(this,d).chain.vmErrorsOnRPCResponse))throw r}return r}async simulateTransaction(e,t){let r;const a=e.data;let n=e.gas.toBigInt();const o=null!=e.to;let c=null;if(o){const t=e.to.toBuffer();c={equals:e=>t.equals(e.buf),buf:t}}else c=null;if(n-=tt.calculateIntrinsicGas(a,o,this.common),n>=0n){const a=this.trie.copy(!1);a.setContext(t.header.stateRoot.toBuffer(),null,t.header.number);const o=await this.createVmFromStateTrie(a,D(this,d).chain.allowUnlimitedContractSize,!1);o.stateManager.checkpoint();const s=e.from.toBuffer();r=await o.runCall({caller:{buf:s,equals:e=>s.equals(e.buf)},data:e.data&&e.data.toBuffer(),gasPrice:new H.BN(e.gasPrice.toBuffer()),gasLimit:new H.BN(z.Quantity.from(n).toBuffer()),to:c,value:null==e.value?new H.BN(0):new H.BN(e.value.toBuffer()),block:e.block})}else r={execResult:{runState:{programCounter:0},exceptionError:new j.VmError(j.ERROR.OUT_OF_GAS),returnValue:z.BUFFER_EMPTY}};if(r.execResult.exceptionError){if(D(this,d).chain.vmErrorsOnRPCResponse){const e=z.RPCQUANTITY_EMPTY;throw new P.RuntimeError(e,r,P.RETURN_TYPES.RETURN_VALUE)}return z.Data.from(r.execResult.returnValue||"0x")}return z.Data.from(r.execResult.returnValue||"0x")}async traceTransaction(e,t){const r=z.Data.from(e).toBuffer(),a=await this.transactions.get(r);if(!a)throw new Error("Unknown transaction "+e);const n=await this.blocks.get(a.blockNumber.toBuffer()),o=await this.blocks.getByHash(n.header.parentHash.toBuffer()),c=D(this,w).call(this,n,o,r);c.transactions=c.transactions.slice(0,1+a.index.toNumber());const s=this.trie.copy();s.setContext(o.header.stateRoot.toBuffer(),null,o.header.number);const{gas:d,structLogs:u,returnValue:h,storage:l}=await D(this,Q).call(this,s,c,t);return{gas:d,structLogs:u,returnValue:h,storage:l}}async storageRangeAt(e,t,r,a,n){const o=await this.blocks.getByHash(e),c=o.getTransactions()[t];if(!c)throw new Error(`transaction index ${t} is out of range for block ${e}`);const d=await this.blocks.getByHash(o.header.parentHash.toBuffer()),u=makeTrie(this,D(this,s).trie,d.header.stateRoot),h=et.Address.from(r).toBuffer(),l=await u.get(h);if(!l)throw new Error(`account ${r} doesn't exist`);const{keys:b,nextKey:g}=await(()=>{const e=u.copy(!1);return e.setContext(O.decode(l)[2],h,d.header.number),new Promise(((t,r)=>{const o=z.Data.from(a).toBuffer(),compare=(e,t)=>e.compare(t)<0,c=[];e.createReadStream().on("data",(({key:e})=>{if(o.compare(e)>0)return;const t=z.findInsertPosition(c,e,compare);t>n||c.splice(t,0,e)})).on("error",r).on("end",(()=>{c.length>n?t({keys:c.slice(0,n),nextKey:z.Data.from(c[n])}):t({keys:c,nextKey:null})}))}))})(),p=c.hash.toBuffer(),B=D(this,w).call(this,o,d,p),{storage:m}=await D(this,Q).call(this,u,B,{disableMemory:!0,disableStack:!0,disableStorage:!1},b,h);return{storage:m,nextKey:g}}async stop(){D(this,a)===dt.starting&&await this.once("ready"),clearTimeout(D(this,c)),this.vm.removeAllListeners(),await this.transactions.pause(),await D(this,n).pause(),await D(this,o),this.fallback&&await this.fallback.close(),await this.emit("stop"),D(this,a)===dt.started&&(N(this,a,dt.stopping),await D(this,s).close(),N(this,a,dt.stopped))}}t.default=Blockchain,a=new WeakMap,n=new WeakMap,o=new WeakMap,c=new WeakMap,s=new WeakMap,d=new WeakMap,u=new WeakMap,h=new WeakMap,l=new WeakMap,b=new WeakMap,g=new WeakMap,p=new WeakMap,B=new WeakMap,m=new WeakMap,I=new WeakMap,y=new WeakMap,x=new WeakMap,C=new WeakMap,v=new WeakMap,Q=new WeakMap,w=new WeakMap},(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=r(92);Object.defineProperty(t,"CheckpointTrie",{enumerable:!0,get:function(){return a.CheckpointTrie}});var n=r(104);Object.defineProperty(t,"SecureTrie",{enumerable:!0,get:function(){return n.SecureTrie}});var o=r(119);Object.defineProperty(t,"BaseTrie",{enumerable:!0,get:function(){return o.Trie}});var c=r(169);Object.defineProperty(t,"WalkController",{enumerable:!0,get:function(){return c.WalkController}})},function(e,t,r){"use strict";var a=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},n=this&&this.__generator||function(e,t){var r,a,n,o,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(s){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,a=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(n=c.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.WalkController=void 0;var c=r(1339),s=r(93),d=function(){function WalkController(e,t,r){this.onNode=e,this.taskExecutor=new c.PrioritizedTaskExecutor(r),this.trie=t,this.resolve=function(){}}return WalkController.newWalk=function(e,t,r,o){return a(this,void 0,void 0,(function(){return n(this,(function(a){switch(a.label){case 0:return[4,new WalkController(e,t,null!=o?o:500).startWalk(r)];case 1:return a.sent(),[2]}}))}))},WalkController.prototype.startWalk=function(e){return a(this,void 0,void 0,(function(){var t=this;return n(this,(function(r){switch(r.label){case 0:return[4,new Promise((function(r){return a(t,void 0,void 0,(function(){var t;return n(this,(function(a){switch(a.label){case 0:return this.resolve=r,[4,this.trie._lookupNode(e)];case 1:return t=a.sent(),this.processNode(e,t,[]),[2]}}))}))}))];case 1:return[2,r.sent()]}}))}))},WalkController.prototype.allChildren=function(e,t){var r,a,n;if((void 0===t&&(t=[]),!(e instanceof s.LeafNode))&&(e instanceof s.ExtensionNode?n=[[e.key,e.value]]:e instanceof s.BranchNode&&(n=e.getChildren().map((function(e){return[[e[0]],e[1]]}))),n))try{for(var c=o(n),d=c.next();!d.done;d=c.next()){var u=d.value,h=u[0],l=u[1],b=t.concat(h),g=b.length;this.pushNodeToQueue(l,b,g)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(r)throw r.error}}},WalkController.prototype.pushNodeToQueue=function(e,t,r){var o=this;void 0===t&&(t=[]),this.taskExecutor.executeOrQueue(null!=r?r:t.length,(function(r){return a(o,void 0,void 0,(function(){var a;return n(this,(function(n){switch(n.label){case 0:return[4,this.trie._lookupNode(e)];case 1:return a=n.sent(),r(),this.processNode(e,a,t),[2]}}))}))}))},WalkController.prototype.onlyBranchIndex=function(e,t,r,a){if(void 0===t&&(t=[]),!(e instanceof s.BranchNode))throw new Error("Expected branch node");var n=e.getBranch(r);if(!n)throw new Error("Could not get branch of childIndex");var o=t.slice();o.push(r);var c=null!=a?a:o.length;this.pushNodeToQueue(n,o,c)},WalkController.prototype.processNode=function(e,t,r){void 0===r&&(r=[]),this.onNode(e,t,r,this),this.taskExecutor.finished()&&this.resolve()},WalkController}();t.WalkController=d},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0});var o=r(106);Object.defineProperty(t,"Block",{enumerable:!0,get:function(){return o.Block}});var c=r(95);Object.defineProperty(t,"BlockHeader",{enumerable:!0,get:function(){return c.BlockHeader}}),n(r(1414),t)},(e,t,r)=>{var a=r(146),n=r(215),o=r(395);e.exports=a?function(e,t,r){return n.f(e,t,o(1,r))}:function(e,t,r){return e[t]=r,e}},function(e,t,r){"use strict";var a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),c=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)c.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return c},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseTransaction=void 0;var c=o(r(66)),s=r(4),d=function(){function BaseTransaction(e,t){var r,a;void 0===t&&(t={});var n=e.nonce,o=e.gasLimit,d=e.gasPrice,u=e.to,h=e.value,l=e.data,b=e.v,g=e.r,p=e.s;this.nonce=new s.BN(s.toBuffer(n)),this.gasPrice=new s.BN(s.toBuffer(d)),this.gasLimit=new s.BN(s.toBuffer(o)),this.to=u?new s.Address(s.toBuffer(u)):void 0,this.value=new s.BN(s.toBuffer(h)),this.data=s.toBuffer(l),this.v=b?new s.BN(s.toBuffer(b)):void 0,this.r=g?new s.BN(s.toBuffer(g)):void 0,this.s=p?new s.BN(s.toBuffer(p)):void 0,this._validateCannotExceedMaxInteger({nonce:this.nonce,gasPrice:this.gasPrice,gasLimit:this.gasLimit,value:this.value}),this.common=null!==(a=null===(r=t.common)||void 0===r?void 0:r.copy())&&void 0!==a?a:new c.default({chain:"mainnet"})}return BaseTransaction.prototype.validate=function(e){void 0===e&&(e=!1);var t=[];return this.getBaseFee().gt(this.gasLimit)&&t.push("gasLimit is too low. given "+this.gasLimit+", need at least "+this.getBaseFee()),this.isSigned()&&!this.verifySignature()&&t.push("Invalid Signature"),e?t:0===t.length},BaseTransaction.prototype.getBaseFee=function(){var e=this.getDataFee().addn(this.common.param("gasPrices","tx"));return this.common.gteHardfork("homestead")&&this.toCreationAddress()&&e.iaddn(this.common.param("gasPrices","txCreation")),e},BaseTransaction.prototype.getDataFee=function(){for(var e=this.common.param("gasPrices","txDataZero"),t=this.common.param("gasPrices","txDataNonZero"),r=0,a=0;a{e=r.nmd(e);var a=r(661),n=r(1088),o=t&&!t.nodeType&&t,c=o&&e&&!e.nodeType&&e,s=c&&c.exports===o?a.Buffer:void 0,d=(s?s.isBuffer:void 0)||n;e.exports=d},(e,t,r)=>{e=r.nmd(e);var a=r(662),n=t&&!t.nodeType&&t,o=n&&e&&!e.nodeType&&e,c=o&&o.exports===n&&a.process,s=function(){try{var e=o&&o.require&&o.require("util").types;return e||c&&c.binding&&c.binding("util")}catch(e){}}();e.exports=s},function(e,t,r){"use strict";var a,n,o=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},c=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)};Object.defineProperty(t,"__esModule",{value:!0});const s=r(8);t.default=class Manager{constructor(e,t,r){a.set(this,void 0),n.set(this,void 0),o(this,a,t),o(this,n,r),this.base=e}getRaw(e){return"string"==typeof e&&(e=s.Data.from(e).toBuffer()),0===e.length&&(e=s.BUFFER_ZERO),this.base.get(e).catch((e=>{if(404===e.status)return null;throw e}))}async get(e){const t=await this.getRaw(e);return t?new(c(this,a))(t,c(this,n)):null}set(e,t){return this.base.put(e,t)}del(e){return this.base.del(e)}},a=new WeakMap,n=new WeakMap},(e,t,r)=>{"use strict";var a=r(416);e.exports=a.call(Function.call,Object.prototype.hasOwnProperty)},(e,t,r)=>{var a=r(11).Buffer;function Hash(e,t){this._block=a.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Hash.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=a.from(e,t));for(var r=this._block,n=this._blockSize,o=e.length,c=this._len,s=0;s=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var a=(4294967295&r)>>>0,n=(r-a)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(a,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},Hash.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=Hash},function(e,t,r){"use strict";var a,n,o=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},c=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Connector=t.Provider=void 0;const d=s(r(179)),u=r(8),h=s(r(180)),l=r(19);t.Provider=h.default;class Connector extends d.default.Typed{constructor(e=null,t){super(),a.set(this,void 0),n.set(this,((e,t)=>{const r=e.method;if("eth_subscribe"===r&&function isHttp(e){return"uWS.HttpRequest"===e.constructor.name||"HttpRequest"===e.constructor.name}(t))return Promise.reject(new l.CodedError("notifications not supported",u.JsonRpcErrorCode.METHOD_NOT_SUPPORTED));const n=e.params;return c(this,a)._requestRaw({method:r,params:n})})),o(this,a,new h.default(e,t))}get provider(){return c(this,a)}async connect(){await c(this,a).initialize(),await this.emit("ready")}parse(e){try{return JSON.parse(e)}catch(e){throw new l.CodedError(e.message,u.JsonRpcErrorCode.PARSE_ERROR)}}handle(e,t){if(Array.isArray(e)){const r=e.map((e=>c(this,n).call(this,e,t).then((({value:e})=>e)).catch((e=>e))));return Promise.resolve({value:Promise.all(r)})}return c(this,n).call(this,e,t)}format(e,t){if(Array.isArray(t))return JSON.stringify(t.map(((t,r)=>{const a=e[r];return a instanceof Error?u.makeError(t.id,a):u.makeResponse(t.id,a)})));{const r=u.makeResponse(t.id,e);return JSON.stringify(r)}}formatError(e,t){const r=u.makeError(t&&t.id?t.id:null,e);return JSON.stringify(r)}close(){return c(this,a).disconnect()}}t.Connector=Connector,a=new WeakMap,n=new WeakMap},e=>{"use strict";const t=new WeakMap,r=new WeakMap,a=new WeakMap,n=Symbol("anyProducer"),o=Promise.resolve(),c=Symbol("listenerAdded"),s=Symbol("listenerRemoved");function assertEventName(e){if("string"!=typeof e&&"symbol"!=typeof e)throw new TypeError("eventName must be a string or a symbol")}function assertListener(e){if("function"!=typeof e)throw new TypeError("listener must be a function")}function getListeners(e,t){const a=r.get(e);return a.has(t)||a.set(t,new Set),a.get(t)}function getEventProducers(e,t){const r="string"==typeof t||"symbol"==typeof t?t:n,o=a.get(e);return o.has(r)||o.set(r,new Set),o.get(r)}function iterator(e,t){t=Array.isArray(t)?t:[t];let r=!1,flush=()=>{},a=[];const n={enqueue(e){a.push(e),flush()},finish(){r=!0,flush()}};for(const r of t)getEventProducers(e,r).add(n);return{async next(){return a?0===a.length?r?(a=void 0,this.next()):(await new Promise((e=>{flush=e})),this.next()):{done:!1,value:await a.shift()}:{done:!0}},async return(r){a=void 0;for(const r of t)getEventProducers(e,r).delete(n);return flush(),arguments.length>0?{done:!0,value:await r}:{done:!0}},[Symbol.asyncIterator](){return this}}}function defaultMethodNamesOrAssert(e){if(void 0===e)return d;if(!Array.isArray(e))throw new TypeError("`methodNames` must be an array of strings");for(const t of e)if(!d.includes(t)){if("string"!=typeof t)throw new TypeError("`methodNames` element must be a string");throw new Error(`${t} is not Emittery method`)}return e}const isListenerSymbol=e=>e===c||e===s;class Emittery{static mixin(e,t){return t=defaultMethodNamesOrAssert(t),r=>{if("function"!=typeof r)throw new TypeError("`target` must be function");for(const e of t)if(void 0!==r.prototype[e])throw new Error(`The property \`${e}\` already exists on \`target\``);Object.defineProperty(r.prototype,e,{enumerable:!1,get:function getEmitteryProperty(){return Object.defineProperty(this,e,{enumerable:!1,value:new Emittery}),this[e]}});const emitteryMethodCaller=t=>function(...r){return this[e][t](...r)};for(const e of t)Object.defineProperty(r.prototype,e,{enumerable:!1,value:emitteryMethodCaller(e)});return r}}constructor(){t.set(this,new Set),r.set(this,new Map),a.set(this,new Map)}on(e,t){assertListener(t),e=Array.isArray(e)?e:[e];for(const r of e)assertEventName(r),getListeners(this,r).add(t),isListenerSymbol(r)||this.emit(c,{eventName:r,listener:t});return this.off.bind(this,e,t)}off(e,t){assertListener(t),e=Array.isArray(e)?e:[e];for(const r of e)assertEventName(r),getListeners(this,r).delete(t),isListenerSymbol(r)||this.emit(s,{eventName:r,listener:t})}once(e){return new Promise((t=>{const r=this.on(e,(e=>{r(),t(e)}))}))}events(e){e=Array.isArray(e)?e:[e];for(const t of e)assertEventName(t);return iterator(this,e)}async emit(e,r){assertEventName(e),function enqueueProducers(e,t,r){const o=a.get(e);if(o.has(t))for(const e of o.get(t))e.enqueue(r);if(o.has(n)){const e=Promise.all([t,r]);for(const t of o.get(n))t.enqueue(e)}}(this,e,r);const c=getListeners(this,e),s=t.get(this),d=[...c],u=isListenerSymbol(e)?[]:[...s];await o,await Promise.all([...d.map((async e=>{if(c.has(e))return e(r)})),...u.map((async t=>{if(s.has(t))return t(e,r)}))])}async emitSerial(e,r){assertEventName(e);const a=getListeners(this,e),n=t.get(this),c=[...a],s=[...n];await o;for(const e of c)a.has(e)&&await e(r);for(const t of s)n.has(t)&&await t(e,r)}onAny(e){return assertListener(e),t.get(this).add(e),this.emit(c,{listener:e}),this.offAny.bind(this,e)}anyEvent(){return iterator(this)}offAny(e){assertListener(e),this.emit(s,{listener:e}),t.get(this).delete(e)}clearListeners(e){e=Array.isArray(e)?e:[e];for(const n of e)if("string"==typeof n||"symbol"==typeof n){getListeners(this,n).clear();const e=getEventProducers(this,n);for(const t of e)t.finish();e.clear()}else{t.get(this).clear();for(const e of r.get(this).values())e.clear();for(const e of a.get(this).values()){for(const t of e)t.finish();e.clear()}}}listenerCount(e){e=Array.isArray(e)?e:[e];let n=0;for(const o of e)if("string"!=typeof o){void 0!==o&&assertEventName(o),n+=t.get(this).size;for(const e of r.get(this).values())n+=e.size;for(const e of a.get(this).values())n+=e.size}else n+=t.get(this).size+getListeners(this,o).size+getEventProducers(this,o).size+getEventProducers(this).size;return n}bindMethods(e,t){if("object"!=typeof e||null===e)throw new TypeError("`target` must be an object");t=defaultMethodNamesOrAssert(t);for(const r of t){if(void 0!==e[r])throw new Error(`The property \`${r}\` already exists on \`target\``);Object.defineProperty(e,r,{enumerable:!1,value:this[r].bind(this)})}}}const d=Object.getOwnPropertyNames(Emittery.prototype).filter((e=>"constructor"!==e));Emittery.Typed=class extends Emittery{},Object.defineProperty(Emittery.Typed,"Typed",{enumerable:!1,value:void 0}),Object.defineProperty(Emittery,"listenerAdded",{value:c,writable:!1,enumerable:!0,configurable:!1}),Object.defineProperty(Emittery,"listenerRemoved",{value:s,writable:!1,enumerable:!0,configurable:!1}),e.exports=Emittery},function(e,t,r){"use strict";var a,n,o,c,s,d,u,h,l,b=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},g=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},p=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const B=p(r(179)),m=p(r(126)),I=r(8),y=r(198),x=p(r(166)),C=p(r(165)),v=p(r(167)),Q=r(228),w=r(76);class EthereumProvider extends B.default.Typed{constructor(e={},t){super(),a.set(this,void 0),n.set(this,void 0),o.set(this,void 0),c.set(this,void 0),s.set(this,void 0),this.removeListener=this.off,d.set(this,((e,t)=>{let r,a,n;if("string"==typeof e)r=e,a=t,n=this.request({method:r,params:a});else{if("function"!=typeof t)throw new Error("No callback provided to provider's send function. As of web3 1.0, provider.send is no longer synchronous and must be passed a callback as its final argument.");if(Array.isArray(e)){const r=t;g(this,h).call(this,e).then((({error:e,result:t})=>{r(e,t)}))}else{const r=t;g(this,l).call(this,e).then((({error:e,result:t})=>{r(e,t)}))}}return n})),u.set(this,((e,t)=>{const r=g(this,a);r.logging.verbose?r.logging.logger.log(` > ${e}: ${null==t?t:JSON.stringify(t,null,2).split("\n").join("\n > ")}`):r.logging.logger.log(e)})),this.disconnect=async()=>{await g(this,s).stop(),this.emit("disconnect")},h.set(this,(e=>Promise.all(e.map(g(this,l))).then((e=>{let t=null;const r=[];return e.forEach((({error:e,result:a},n)=>{r.push(a),e&&(null==t&&(t=new Error("Batch error:")),t.errors[n]=e)})),{error:t,result:r}})))),l.set(this,(async e=>{const t=e.method,r=e.params;try{const a=await this.request({method:t,params:r});return{error:null,result:I.makeResponse(e.id,JSON.parse(JSON.stringify(a)))}}catch(t){let r;return I.hasOwn(t,"result")&&(r=t.result,delete t.result),{error:t,result:I.makeError(e.id,t,r)}}})),b(this,o,t);const r=b(this,a,y.EthereumOptionsConfig.normalize(e)),p=b(this,c,new C.default(r.wallet)),B=p.initialAccounts,x=r.fork.url||r.fork.provider?new Q.Fork(r,B):null,_=function parseCoinbase(e,t){switch(typeof e){case"object":return e;case"number":const r=t[e];if(r)return r.address;throw new Error(`invalid coinbase address index: ${e}`);case"string":return w.Address.from(e);default:throw new Error(`coinbase address must be string or number, received: ${e}`)}}(r.miner.coinbase,B),k=new v.default(r,_,x);b(this,s,k),b(this,n,new m.default(r,p,k))}async initialize(){await g(this,s).initialize(g(this,c).initialAccounts),this.emit("connect")}getOptions(){return x.default(g(this,a))}getInitialAccounts(){const e={},t=g(this,c),r=g(this,c).unlockedAccounts;return t.initialAccounts.forEach((t=>{const a=t.address.toString();e[a]={secretKey:t.privateKey.toString(),balance:t.balance.toBigInt(),unlocked:r.has(a)}})),e}send(e,t){return g(this,d).call(this,e,t)}sendAsync(e,t){g(this,d).call(this,e,t)}async request(e){const t=await this._requestRaw(e),r=await t.value;return JSON.parse(JSON.stringify(r))}async _requestRaw({method:e,params:t}){g(this,u).call(this,e,t);const r=(await g(this,o).execute(g(this,n),e,t)).value;r instanceof I.PromiEvent&&r.on("message",(e=>{this.emit("message",e),this.emit("data",{jsonrpc:"2.0",method:"eth_subscription",params:e.data})}));return{value:r.catch((e=>{throw g(this,a).chain.vmErrorsOnRPCResponse&&I.hasOwn(e,"result")&&(e.result=JSON.parse(JSON.stringify(e.result))),e}))}}}t.default=EthereumProvider,a=new WeakMap,n=new WeakMap,o=new WeakMap,c=new WeakMap,s=new WeakMap,d=new WeakMap,u=new WeakMap,h=new WeakMap,l=new WeakMap},(e,t,r)=>{"use strict";var a=r(3).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.getLength=t.decode=t.encode=void 0;var n=r(478);function safeParseInt(e,t){if("00"===e.slice(0,2))throw new Error("invalid RLP: extra zeros");return parseInt(e,t)}function encodeLength(e,t){if(e<56)return a.from([e+t]);var r=intToHex(e),n=intToHex(t+55+r.length/2);return a.from(n+r,"hex")}function _decode(e){var t,r,n,o,c,s=[],d=e[0];if(d<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(d<=183){if(t=d-127,n=128===d?a.from([]):e.slice(1,t),2===t&&n[0]<128)throw new Error("invalid rlp encoding: byte must be less 0x80");return{data:n,remainder:e.slice(t)}}if(d<=191){if(r=d-182,e.length-1e.length)throw new Error("invalid rlp: total length is larger than the data");if(0===(o=e.slice(r,u)).length)throw new Error("invalid rlp, List has a invalid length");for(;o.length;)c=_decode(o),s.push(c.data),o=c.remainder;return{data:s,remainder:e.slice(u)}}function isHexPrefixed(e){return"0x"===e.slice(0,2)}function intToHex(e){if(e<0)throw new Error("Invalid integer as argument, must be unsigned!");var t=e.toString(16);return t.length%2?"0"+t:t}function toBuffer(e){if(!a.isBuffer(e)){if("string"==typeof e)return isHexPrefixed(e)?a.from(function padToEven(e){return e.length%2?"0"+e:e}(function stripHexPrefix(e){return"string"!=typeof e?e:isHexPrefixed(e)?e.slice(2):e}(e)),"hex"):a.from(e);if("number"==typeof e||"bigint"==typeof e)return e?function intToBuffer(e){var t=intToHex(e);return a.from(t,"hex")}(e):a.from([]);if(null==e)return a.from([]);if(e instanceof Uint8Array)return a.from(e);if(n.isBN(e))return a.from(e.toArray());throw new Error("invalid type")}return e}t.encode=function encode(e){if(Array.isArray(e)){for(var t=[],r=0;r{"use strict";var a=r(3).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.importPublic=t.privateToPublic=t.privateToAddress=t.publicToAddress=t.pubToAddress=t.isValidPublic=t.isValidPrivate=t.isPrecompiled=t.generateAddress2=t.generateAddress=t.isValidChecksumAddress=t.toChecksumAddress=t.isZeroAddress=t.isValidAddress=t.zeroAddress=void 0;var n=r(6),o=r(91),c=r(335),s=r(128),d=r(73),u=r(278);t.zeroAddress=function(){var e=d.zeros(20);return d.bufferToHex(e)},t.isValidAddress=function(e){return/^0x[0-9a-fA-F]{40}$/.test(e)},t.isZeroAddress=function(e){return t.zeroAddress()===d.addHexPrefix(e)},t.toChecksumAddress=function(e,t){e=o.stripHexPrefix(e).toLowerCase();for(var r=void 0!==t?t.toString()+"0x":"",a=u.keccak(r+e).toString("hex"),n="0x",c=0;c=8?n+=e[c].toUpperCase():n+=e[c];return n},t.isValidChecksumAddress=function(e,r){return t.isValidAddress(e)&&t.toChecksumAddress(e,r)===e},t.generateAddress=function(e,t){e=d.toBuffer(e);var r=new s(t);return r.isZero()?u.rlphash([e,null]).slice(-20):u.rlphash([e,a.from(r.toArray())]).slice(-20)},t.generateAddress2=function(e,t,r){var o=d.toBuffer(e),c=d.toBuffer(t),s=d.toBuffer(r);return n(20===o.length),n(32===c.length),u.keccak256(a.concat([a.from("ff","hex"),o,c,u.keccak256(s)])).slice(-20)},t.isPrecompiled=function(e){var t=d.unpad(e);return 1===t.length&&t[0]>=1&&t[0]<=8},t.isValidPrivate=function(e){return c.privateKeyVerify(e)},t.isValidPublic=function(e,t){return void 0===t&&(t=!1),64===e.length?c.publicKeyVerify(a.concat([a.from([4]),e])):!!t&&c.publicKeyVerify(e)},t.pubToAddress=function(e,t){return void 0===t&&(t=!1),e=d.toBuffer(e),t&&64!==e.length&&(e=c.publicKeyConvert(e,!1).slice(1)),n(64===e.length),u.keccak(e).slice(-20)},t.publicToAddress=t.pubToAddress,t.privateToAddress=function(e){return t.publicToAddress(t.privateToPublic(e))},t.privateToPublic=function(e){return e=d.toBuffer(e),c.publicKeyCreate(e,!1).slice(1)},t.importPublic=function(e){return 64!==(e=d.toBuffer(e)).length&&(e=c.publicKeyConvert(e,!1).slice(1)),e}},(e,t,r)=>{"use strict";var a=r(1),n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=Duplex;var o=r(492),c=r(495);r(23)(Duplex,o);for(var s=n(c.prototype),d=0;d{var a=r(58).Buffer;function Hash(e,t){this._block=a.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Hash.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=a.from(e,t));for(var r=this._block,n=this._blockSize,o=e.length,c=this._len,s=0;s=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var a=(4294967295&r)>>>0,n=(r-a)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(a,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},Hash.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=Hash},function(e,t,r){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.KECCAK256_RLP=t.KECCAK256_RLP_S=t.KECCAK256_RLP_ARRAY=t.KECCAK256_RLP_ARRAY_S=t.KECCAK256_NULL=t.KECCAK256_NULL_S=t.TWO_POW256=t.MAX_INTEGER=void 0;const n=r(3).Buffer,o=a(r(129));t.MAX_INTEGER=new o.default("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new o.default("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.KECCAK256_NULL=n.from(t.KECCAK256_NULL_S,"hex"),t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.KECCAK256_RLP_ARRAY=n.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.KECCAK256_RLP=n.from(t.KECCAK256_RLP_S,"hex")},function(e,t,r){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.KECCAK256_RLP=t.KECCAK256_RLP_S=t.KECCAK256_RLP_ARRAY=t.KECCAK256_RLP_ARRAY_S=t.KECCAK256_NULL=t.KECCAK256_NULL_S=t.TWO_POW256=t.MAX_INTEGER=void 0;const n=r(5).Buffer,o=a(r(131));t.MAX_INTEGER=new o.default("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new o.default("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.KECCAK256_NULL=n.from(t.KECCAK256_NULL_S,"hex"),t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.KECCAK256_RLP_ARRAY=n.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.KECCAK256_RLP=n.from(t.KECCAK256_RLP_S,"hex")},(e,t,r)=>{"use strict";var a=r(5).Buffer,n=r(504),o=r(845);function padToEven(e){var t=e;if("string"!=typeof t)throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof t+", while padToEven.");return t.length%2&&(t="0"+t),t}function intToHex(e){return"0x"+e.toString(16)}e.exports={arrayContainsArray:function arrayContainsArray(e,t,r){if(!0!==Array.isArray(e))throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof e+"'");if(!0!==Array.isArray(t))throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof t+"'");return t[Boolean(r)?"some":"every"]((function(t){return e.indexOf(t)>=0}))},intToBuffer:function intToBuffer(e){var t=intToHex(e);return new a(padToEven(t.slice(2)),"hex")},getBinarySize:function getBinarySize(e){if("string"!=typeof e)throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof e+"'.");return a.byteLength(e,"utf8")},isHexPrefixed:n,stripHexPrefix:o,padToEven,intToHex,fromAscii:function fromAscii(e){for(var t="",r=0;r{"use strict";var a=r(1),n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=Duplex;var o=r(506),c=r(509);r(24)(Duplex,o);for(var s=n(c.prototype),d=0;d{var a=r(61).Buffer;function Hash(e,t){this._block=a.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Hash.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=a.from(e,t));for(var r=this._block,n=this._blockSize,o=e.length,c=this._len,s=0;s=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var a=(4294967295&r)>>>0,n=(r-a)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(a,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},Hash.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=Hash},function(e,t,r){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.KECCAK256_RLP=t.KECCAK256_RLP_S=t.KECCAK256_RLP_ARRAY=t.KECCAK256_RLP_ARRAY_S=t.KECCAK256_NULL=t.KECCAK256_NULL_S=t.TWO_POW256=t.MAX_INTEGER=void 0;const n=r(2).Buffer,o=a(r(133));t.MAX_INTEGER=new o.default("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new o.default("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.KECCAK256_NULL=n.from(t.KECCAK256_NULL_S,"hex"),t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.KECCAK256_RLP_ARRAY=n.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.KECCAK256_RLP=n.from(t.KECCAK256_RLP_S,"hex")},(e,t,r)=>{"use strict";var a=r(2).Buffer,n=r(524),o=r(890);function padToEven(e){var t=e;if("string"!=typeof t)throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof t+", while padToEven.");return t.length%2&&(t="0"+t),t}function intToHex(e){return"0x"+e.toString(16)}e.exports={arrayContainsArray:function arrayContainsArray(e,t,r){if(!0!==Array.isArray(e))throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof e+"'");if(!0!==Array.isArray(t))throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof t+"'");return t[Boolean(r)?"some":"every"]((function(t){return e.indexOf(t)>=0}))},intToBuffer:function intToBuffer(e){var t=intToHex(e);return new a(padToEven(t.slice(2)),"hex")},getBinarySize:function getBinarySize(e){if("string"!=typeof e)throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof e+"'.");return a.byteLength(e,"utf8")},isHexPrefixed:n,stripHexPrefix:o,padToEven,intToHex,fromAscii:function fromAscii(e){for(var t="",r=0;r{"use strict";var a=r(1),n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=Duplex;var o=r(526),c=r(529);r(25)(Duplex,o);for(var s=n(c.prototype),d=0;d{var a=r(63).Buffer;function Hash(e,t){this._block=a.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Hash.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=a.from(e,t));for(var r=this._block,n=this._blockSize,o=e.length,c=this._len,s=0;s=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var a=(4294967295&r)>>>0,n=(r-a)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(a,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},Hash.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=Hash},function(e,t,r){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.KECCAK256_RLP=t.KECCAK256_RLP_S=t.KECCAK256_RLP_ARRAY=t.KECCAK256_RLP_ARRAY_S=t.KECCAK256_NULL=t.KECCAK256_NULL_S=t.TWO_POW256=t.MAX_INTEGER=void 0;const n=r(0).Buffer,o=a(r(12));t.MAX_INTEGER=new o.default("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new o.default("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.KECCAK256_NULL=n.from(t.KECCAK256_NULL_S,"hex"),t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.KECCAK256_RLP_ARRAY=n.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.KECCAK256_RLP=n.from(t.KECCAK256_RLP_S,"hex")},(e,t,r)=>{"use strict";var a=r(1),n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=Duplex;var o=r(547),c=r(550);r(15)(Duplex,o);for(var s=n(c.prototype),d=0;d{var a=r(22).Buffer;function Hash(e,t){this._block=a.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Hash.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=a.from(e,t));for(var r=this._block,n=this._blockSize,o=e.length,c=this._len,s=0;s=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var a=(4294967295&r)>>>0,n=(r-a)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(a,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},Hash.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=Hash},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(18).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),c=t;c=49?s-49+10:s>=17?s-17+10:s}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,c=o%a,s=Math.min(o,o-c)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],o=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],c=n*o,s=67108863&c,d=c/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(c=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&c}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,s=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=c[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,c,s="le"===t,d=new e(n),u=this.clone();if(s){for(c=0;!u.isZero();c++)o=u.andln(255),u.iushrn(8),d[c]=o;for(;c=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,c=0;c>26,this.words[c]=67108863&t;for(;0!==o&&c>26,this.words[c]=67108863&t;if(0===o&&c>>13,g=0|c[1],p=8191&g,B=g>>>13,m=0|c[2],I=8191&m,y=m>>>13,x=0|c[3],C=8191&x,v=x>>>13,Q=0|c[4],w=8191&Q,_=Q>>>13,k=0|c[5],N=8191&k,D=k>>>13,U=0|c[6],G=8191&U,T=U>>>13,L=0|c[7],q=8191&L,P=L>>>13,O=0|c[8],H=8191&O,Y=O>>>13,J=0|c[9],j=8191&J,z=J>>>13,W=0|s[0],V=8191&W,X=W>>>13,$=0|s[1],et=8191&$,tt=$>>>13,rt=0|s[2],at=8191&rt,it=rt>>>13,nt=0|s[3],ot=8191&nt,At=nt>>>13,ct=0|s[4],st=8191&ct,dt=ct>>>13,ut=0|s[5],ht=8191&ut,bt=ut>>>13,pt=0|s[6],Bt=8191&pt,mt=pt>>>13,It=0|s[7],Et=8191&It,yt=It>>>13,xt=0|s[8],Ct=8191&xt,vt=xt>>>13,Qt=0|s[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(C,V),n=(n=Math.imul(C,X))+Math.imul(v,V)|0,o=Math.imul(v,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(C,et)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(v,et)|0,o=o+Math.imul(v,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,st)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(C,at)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(v,at)|0,o=o+Math.imul(v,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,st)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,st)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,At)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,At)|0,a=a+Math.imul(I,st)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,st)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(q,V),n=(n=Math.imul(q,X))+Math.imul(P,V)|0,o=Math.imul(P,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(C,st)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(v,st)|0,o=o+Math.imul(v,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(q,et)|0,n=(n=n+Math.imul(q,tt)|0)+Math.imul(P,et)|0,o=o+Math.imul(P,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,st)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,st)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,bt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,Ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,vt)|0)+Math.imul(b,Ct)|0))<<13)|0;u=((o=o+Math.imul(b,vt)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(j,V),n=(n=Math.imul(j,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(q,at)|0,n=(n=n+Math.imul(q,it)|0)+Math.imul(P,at)|0,o=o+Math.imul(P,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,st)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,st)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(C,Bt)|0,n=(n=n+Math.imul(C,mt)|0)+Math.imul(v,Bt)|0,o=o+Math.imul(v,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,Ct)|0,n=(n=n+Math.imul(p,vt)|0)+Math.imul(B,Ct)|0,o=o+Math.imul(B,vt)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(j,et),n=(n=Math.imul(j,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(q,ot)|0,n=(n=n+Math.imul(q,At)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,At)|0,a=a+Math.imul(G,st)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,st)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(C,Et)|0,n=(n=n+Math.imul(C,yt)|0)+Math.imul(v,Et)|0,o=o+Math.imul(v,yt)|0,a=a+Math.imul(I,Ct)|0,n=(n=n+Math.imul(I,vt)|0)+Math.imul(y,Ct)|0,o=o+Math.imul(y,vt)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(j,at),n=(n=Math.imul(j,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(q,st)|0,n=(n=n+Math.imul(q,dt)|0)+Math.imul(P,st)|0,o=o+Math.imul(P,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(C,Ct)|0,n=(n=n+Math.imul(C,vt)|0)+Math.imul(v,Ct)|0,o=o+Math.imul(v,vt)|0;var qt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(j,ot),n=(n=Math.imul(j,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,st)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,st)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(q,ht)|0,n=(n=n+Math.imul(q,bt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,Ct)|0,n=(n=n+Math.imul(w,vt)|0)+Math.imul(_,Ct)|0,o=o+Math.imul(_,vt)|0;var Pt=(u+(a=a+Math.imul(C,wt)|0)|0)+((8191&(n=(n=n+Math.imul(C,Mt)|0)+Math.imul(v,wt)|0))<<13)|0;u=((o=o+Math.imul(v,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(j,st),n=(n=Math.imul(j,dt))+Math.imul(z,st)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(q,Bt)|0,n=(n=n+Math.imul(q,mt)|0)+Math.imul(P,Bt)|0,o=o+Math.imul(P,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,Ct)|0,n=(n=n+Math.imul(N,vt)|0)+Math.imul(D,Ct)|0,o=o+Math.imul(D,vt)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(j,ht),n=(n=Math.imul(j,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(q,Et)|0,n=(n=n+Math.imul(q,yt)|0)+Math.imul(P,Et)|0,o=o+Math.imul(P,yt)|0,a=a+Math.imul(G,Ct)|0,n=(n=n+Math.imul(G,vt)|0)+Math.imul(T,Ct)|0,o=o+Math.imul(T,vt)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(j,Bt),n=(n=Math.imul(j,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(q,Ct)|0,n=(n=n+Math.imul(q,vt)|0)+Math.imul(P,Ct)|0,o=o+Math.imul(P,vt)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(j,Et),n=(n=Math.imul(j,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,Ct)|0,n=(n=n+Math.imul(H,vt)|0)+Math.imul(Y,Ct)|0,o=o+Math.imul(Y,vt)|0;var Jt=(u+(a=a+Math.imul(q,wt)|0)|0)+((8191&(n=(n=n+Math.imul(q,Mt)|0)+Math.imul(P,wt)|0))<<13)|0;u=((o=o+Math.imul(P,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(j,Ct),n=(n=Math.imul(j,vt))+Math.imul(z,Ct)|0,o=Math.imul(z,vt);var Kt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863;var jt=(u+(a=Math.imul(j,wt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=qt,d[12]=Pt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=Jt,d[17]=Kt,d[18]=jt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(s=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?s(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,c&=67108863}r.words[o]=s,a=c,c=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var c=0;c>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),c=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&c}return s&&0!==u&&(s.words[s.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(s/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===c)return this.strip();for(assert(-1===c),c=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var c,s=a.length-n.length;if("mod"!==t){(c=new BN(null)).length=s+1,c.words=new Array(c.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);c&&(c.words[h]=l)}return c&&c.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:c||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),c=new BN(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(d),c.isub(u)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(c)):(r.isub(t),o.isub(a),c.isub(n))}return{a:o,b:c,gcd:r.iushln(s)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var s=0,d=1;0==(t.words[0]&d)&&s<26;++s,d<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(c),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,c&=67108863,this.words[o]=c}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=c}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),c=o.redNeg(),s=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,s).cmp(c);)d.redIAdd(c);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=s-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++c||0===a&&0===u)&&(n=this.mul(n,r[o]),c=0,o=0)):c=0}s=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(83),t)},(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.normalize=void 0;t.normalize=e=>e},(e,t,r)=>{"use strict";var a=r(1),n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=Duplex;var o=r(582),c=r(585);r(35)(Duplex,o);for(var s=n(c.prototype),d=0;d{var a=r(41).Buffer;function Hash(e,t){this._block=a.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Hash.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=a.from(e,t));for(var r=this._block,n=this._blockSize,o=e.length,c=this._len,s=0;s=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var a=(4294967295&r)>>>0,n=(r-a)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(a,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},Hash.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=Hash},function(e,t,r){"use strict";var a,n,o,c,s,d,u,h,l,b,g,p,B,m,I,y,x,C,v,Q,w=r(0).Buffer,_=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},k=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},N=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const D=r(19),U=r(8),G=r(75),T=r(168),L=N(r(179)),q=N(r(1341)),P=r(27),updateBloom=(e,t)=>{let r=256;for(;--r;)e[r]|=t[r]},sortByPrice=(e,t,r)=>e[t].gasPrice>e[r].gasPrice;class Miner extends L.default.Typed{constructor(e,t,r,N,L){super(),a.set(this,0n),n.set(this,new Set),o.set(this,void 0),c.set(this,!1),s.set(this,!1),d.set(this,void 0),u.set(this,void 0),h.set(this,void 0),l.set(this,void 0),b.set(this,void 0),g.set(this,void 0),p.set(this,void 0),B.set(this,new U.Heap(sortByPrice)),m.set(this,(async(e,t=-1,r=!1)=>{const{block:a,transactions:n}=await k(this,I).call(this,e,t,r);if(k(this,o)&&(k(this,v).call(this),_(this,o,!1),!r&&k(this,B).length>0)){const e=k(this,p).call(this,a);await k(this,m).call(this,e,k(this,b)?1:-1)}return n})),I.set(this,(async(e,t,r)=>{let n;const o=k(this,g),{pending:s,inProgress:d}=k(this,h),u=k(this,l);let m=!0;const I=k(this,B),v=k(this,l).legacyInstamine,N=new Map;let L;do{m=!1,_(this,c,!0),L=[];const h=new T.BaseTrie(null,null),l=new T.BaseTrie(null,null);if(0===t){await o.stateManager.checkpoint(),await o.stateManager.commit();const t=e.finalize(h.root,l.root,U.BUFFER_256_ZERO,o.stateManager._trie.root,0n,u.extraData,[],N);return this.emit("block",t),k(this,C).call(this),{block:t.block,transactions:[]}}let g=0,B=u.blockGasLimit.toBigInt(),O=0n;const H=w.allocUnsafe(256).fill(0),Y=[];await o.stateManager.checkpoint();const J=D.TraceDataFactory(),stepListener=(e,t)=>{if("SSTORE"===e.opcode.name){const t=J.from(e.stack[e.stack.length-1].toArrayLike(w)).toBuffer(),r=U.keccak(t);N.set(r.toString(),{key:t,hashedKey:r})}t()};let j;for(o.on("step",stepListener);j=I.peek();){const r=j.from.toString();if(j.calculateIntrinsicGas()>B){j.locked=!1,k(this,x).call(this,r);continue}_(this,a,j.gasPrice.toBigInt()),await o.stateManager.checkpoint(),o.stateManager._trie.blockNumber=U.Quantity.from(e.header.number.toArrayLike(w));const n=await k(this,y).call(this,j,e,r,s);if(null!==n){const e=U.Quantity.from(n.gasUsed.toArrayLike(w)).toBigInt();if(B>=e){await o.stateManager.commit(),L[g]=j,B-=e,O+=e;const a=G.encode(0===g?U.BUFFER_EMPTY:U.uintToBuffer(g));Y.push(h.put(a,j.serialized));const c=j.fillFromResult(n,O);Y.push(l.put(a,c)),updateBloom(H,n.bloom.bitvector),g++;const u=s.get(r);if(m=u.removeBest(),d.add(j),j.once("finalized").then((()=>{d.delete(j)})),B<=P.Params.TRANSACTION_GAS||g===t){m=m?q.default(I,u):k(this,x).call(this,r);break}m=m?q.default(I,u):k(this,x).call(this,r)}else await o.stateManager.revert(),j.locked=!1,m=I.removeBest()}else await o.stateManager.revert()}await Promise.all(Y),await o.stateManager.commit(),o.removeListener("step",stepListener);const z=e.finalize(h.root,l.root,H,o.stateManager._trie.root,O,u.extraData,L,N);n=z.block;const W=this.emit("block",z);if(!0===v&&await W,r){_(this,a,0n),k(this,C).call(this);break}_(this,a,0n),k(this,Q).call(this),0!==I.length?(t=k(this,b)?1:-1,e=k(this,p).call(this,n)):k(this,C).call(this)}while(m);return{block:n,transactions:L}})),y.set(this,(async(e,t,r,a)=>{try{const r=k(this,g),a={tx:e.toVmTransaction(),block:t},n=r.runTx(a);return await n}catch(t){const n=t.message,o=a.get(r);o.removeBest()?q.default(k(this,B),o):k(this,x).call(this,r);const c={execResult:{runState:{programCounter:0},exceptionError:{error:n},returnValue:U.BUFFER_EMPTY}},s=new D.RuntimeError(e.hash,c,D.RETURN_TYPES.TRANSACTION_HASH);return e.finalize("rejected",s),null}})),x.set(this,(e=>(k(this,n).delete(e),k(this,B).removeBest()))),C.set(this,(()=>{k(this,n).clear(),k(this,B).clear(),_(this,c,!1)})),v.set(this,(()=>{const{pending:e}=k(this,h),t=k(this,n),r=k(this,B);for(let a of e){const e=a[1].peek();if(e&&!e.locked){const a=e.from.toString();t.add(a),r.push(e),e.locked=!0}}})),Q.set(this,(()=>{const{pending:e}=k(this,h),t=k(this,n),r=k(this,B);for(let n of e){const e=n[1].peek();if(e&&!e.locked){const n=e.gasPrice.toBigInt();if(k(this,a)>n)continue;const o=e.from.toString();if(t.has(o))continue;t.add(o),r.push(e),e.locked=!0}}})),_(this,g,N),_(this,l,e),_(this,h,t),_(this,b,r),_(this,p,L),k(this,B).init([])}async pause(){k(this,s)||(_(this,s,!0),_(this,d,new Promise((e=>{_(this,u,e)})))),k(this,c)&&await this.once("idle")}resume(){k(this,s)&&(_(this,s,!1),k(this,u).call(this))}async mine(e,t=-1,r=!1){if(k(this,s)&&await k(this,d),k(this,c))return _(this,o,!0),void k(this,Q).call(this);{k(this,v).call(this);const a=await k(this,m).call(this,e,t,r);return this.emit("idle"),a}}}t.default=Miner,a=new WeakMap,n=new WeakMap,o=new WeakMap,c=new WeakMap,s=new WeakMap,d=new WeakMap,u=new WeakMap,h=new WeakMap,l=new WeakMap,b=new WeakMap,g=new WeakMap,p=new WeakMap,B=new WeakMap,m=new WeakMap,I=new WeakMap,y=new WeakMap,x=new WeakMap,C=new WeakMap,v=new WeakMap,Q=new WeakMap},function(e,t,r){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.KECCAK256_RLP=t.KECCAK256_RLP_S=t.KECCAK256_RLP_ARRAY=t.KECCAK256_RLP_ARRAY_S=t.KECCAK256_NULL=t.KECCAK256_NULL_S=t.TWO_POW256=t.MAX_INTEGER=void 0;var n=r(0).Buffer,o=a(r(12));t.MAX_INTEGER=new o.default("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new o.default("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.KECCAK256_NULL=n.from(t.KECCAK256_NULL_S,"hex"),t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.KECCAK256_RLP_ARRAY=n.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.KECCAK256_RLP=n.from(t.KECCAK256_RLP_S,"hex")},e=>{e.exports=function extend(){for(var e={},r=0;r0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]Promise.resolve();class Database extends l.default{constructor(e,t){super(),a.set(this,void 0),n.set(this,noop),o.set(this,!1),this.directory=null,this.db=null,c.set(this,void 0),this.initialize=async()=>{const e={keyEncoding:"binary",valueEncoding:"binary"},t=u(this,a).db;let r;if(t)d(this,c,m.default(t,e)),r=g.default(u(this,c),{});else{let t=u(this,a).dbPath;if(!t){const e=await b.dir(I);if(t=e.path,d(this,n,e.cleanup),u(this,o))return u(this,s).call(this)}this.directory=t;const h={prefix:""},l=m.default(p.default(t,h),e);d(this,c,l),r=g.default(l)}if(u(this,o))return u(this,s).call(this);const h=r.open();return this.trie=B.default(r,"T",e),this.db=r,await h,u(this,o)?u(this,s).call(this):(this.blocks=B.default(r,"b",e),this.blockIndexes=B.default(r,"i",e),this.blockLogs=B.default(r,"l",e),this.transactions=B.default(r,"t",e),this.transactionReceipts=B.default(r,"r",e),this.storageKeys=B.default(r,"s",e),this.emit("ready"))},s.set(this,(async()=>{const e=this.db;return e&&(await new Promise(((t,r)=>e.close((e=>{e?r(e):t(void 0)})))),await Promise.all([this.blocks.close(),this.blockIndexes.close(),this.blockIndexes.close(),this.transactionReceipts.close(),this.transactions.close(),this.storageKeys.close(),this.trie.close()])),u(this,n).call(this)})),d(this,a,e),this.blockchain=t}batch(e){const t=u(this,c).db,r=this.db.batch(),a=t.put,n=t.del;let o;t.put=r.put.bind(r),t.del=r.del.bind(r);try{const c=e();o=r.write().then((()=>c))}finally{t.put=a,t.del=n}return o}async close(){const e=u(this,o);d(this,o,!0),await u(this,s).call(this),e||this.emit("close")}}t.default=Database,a=new WeakMap,n=new WeakMap,o=new WeakMap,c=new WeakMap,s=new WeakMap},function(e,t,r){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.KECCAK256_RLP=t.KECCAK256_RLP_S=t.KECCAK256_RLP_ARRAY=t.KECCAK256_RLP_ARRAY_S=t.KECCAK256_NULL=t.KECCAK256_NULL_S=t.TWO_POW256=t.MAX_INTEGER=void 0;var n=r(0).Buffer,o=a(r(12));t.MAX_INTEGER=new o.default("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new o.default("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.KECCAK256_NULL=n.from(t.KECCAK256_NULL_S,"hex"),t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.KECCAK256_RLP_ARRAY=n.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.KECCAK256_RLP=n.from(t.KECCAK256_RLP_S,"hex")},function(e,t,r){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.KECCAK256_RLP=t.KECCAK256_RLP_S=t.KECCAK256_RLP_ARRAY=t.KECCAK256_RLP_ARRAY_S=t.KECCAK256_NULL=t.KECCAK256_NULL_S=t.TWO_POW256=t.MAX_INTEGER=void 0;var n=r(0).Buffer,o=a(r(12));t.MAX_INTEGER=new o.default("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new o.default("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.KECCAK256_NULL=n.from(t.KECCAK256_NULL_S,"hex"),t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.KECCAK256_RLP_ARRAY=n.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.KECCAK256_RLP=n.from(t.KECCAK256_RLP_S,"hex")},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0});var o=r(210);Object.defineProperty(t,"Transaction",{enumerable:!0,get:function(){return o.default}});var c=r(212);Object.defineProperty(t,"AccessListEIP2930Transaction",{enumerable:!0,get:function(){return c.default}});var s=r(1412);Object.defineProperty(t,"TransactionFactory",{enumerable:!0,get:function(){return s.default}});var d=r(213);Object.defineProperty(t,"FeeMarketEIP1559Transaction",{enumerable:!0,get:function(){return d.default}}),n(r(211),t)},function(e,t,r){"use strict";var a,n=r(0).Buffer,o=this&&this.__extends||(a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function __(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),c=this&&this.__assign||function(){return(c=Object.assign||function(e){for(var t,r=1,a=arguments.length;r0)&&!(a=o.next()).done;)c.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return c};Object.defineProperty(t,"__esModule",{value:!0});var d=r(16),u=r(211),h=r(144),l=function(e){function Transaction(t,r){var a;void 0===r&&(r={});var n=e.call(this,c(c({},t),{type:0}))||this;if(n.common=n._validateTxV(n.v,r.common),n.gasPrice=new d.BN(d.toBuffer(""===t.gasPrice?"0x":t.gasPrice)),n._validateCannotExceedMaxInteger({gasPrice:n.gasPrice}),n.common.gteHardfork("spuriousDragon"))if(n.isSigned()){var o=n.v,s=n.common.chainIdBN().muln(2);(o.eq(s.addn(35))||o.eq(s.addn(36)))&&n.activeCapabilities.push(u.Capability.EIP155ReplayProtection)}else n.activeCapabilities.push(u.Capability.EIP155ReplayProtection);return(null===(a=null==r?void 0:r.freeze)||void 0===a||a)&&Object.freeze(n),n}return o(Transaction,e),Transaction.fromTxData=function(e,t){return void 0===t&&(t={}),new Transaction(e,t)},Transaction.fromSerializedTx=function(e,t){void 0===t&&(t={});var r=d.rlp.decode(e);if(!Array.isArray(r))throw new Error("Invalid serialized tx input. Must be array");return this.fromValuesArray(r,t)},Transaction.fromRlpSerializedTx=function(e,t){return void 0===t&&(t={}),Transaction.fromSerializedTx(e,t)},Transaction.fromValuesArray=function(e,t){if(void 0===t&&(t={}),6!==e.length&&9!==e.length)throw new Error("Invalid transaction. Only expecting 6 values (for unsigned tx) or 9 values (for signed tx).");var r=s(e,9);return new Transaction({nonce:r[0],gasPrice:r[1],gasLimit:r[2],to:r[3],value:r[4],data:r[5],v:r[6],r:r[7],s:r[8]},t)},Transaction.prototype.raw=function(){return[d.bnToUnpaddedBuffer(this.nonce),d.bnToUnpaddedBuffer(this.gasPrice),d.bnToUnpaddedBuffer(this.gasLimit),void 0!==this.to?this.to.buf:n.from([]),d.bnToUnpaddedBuffer(this.value),this.data,void 0!==this.v?d.bnToUnpaddedBuffer(this.v):n.from([]),void 0!==this.r?d.bnToUnpaddedBuffer(this.r):n.from([]),void 0!==this.s?d.bnToUnpaddedBuffer(this.s):n.from([])]},Transaction.prototype.serialize=function(){return d.rlp.encode(this.raw())},Transaction.prototype._getMessageToSign=function(){var e=[d.bnToUnpaddedBuffer(this.nonce),d.bnToUnpaddedBuffer(this.gasPrice),d.bnToUnpaddedBuffer(this.gasLimit),void 0!==this.to?this.to.buf:n.from([]),d.bnToUnpaddedBuffer(this.value),this.data];return this.supports(u.Capability.EIP155ReplayProtection)&&(e.push(d.toBuffer(this.common.chainIdBN())),e.push(d.unpadBuffer(d.toBuffer(0))),e.push(d.unpadBuffer(d.toBuffer(0)))),e},Transaction.prototype.getMessageToSign=function(e){void 0===e&&(e=!0);var t=this._getMessageToSign();return e?d.rlphash(t):t},Transaction.prototype.getUpfrontCost=function(){return this.gasLimit.mul(this.gasPrice).add(this.value)},Transaction.prototype.hash=function(){return d.rlphash(this.raw())},Transaction.prototype.getMessageToVerifySignature=function(){if(!this.isSigned())throw Error("This transaction is not signed");var e=this._getMessageToSign();return d.rlphash(e)},Transaction.prototype.getSenderPublicKey=function(){var e,t=this.getMessageToVerifySignature();if(this.common.gteHardfork("homestead")&&(null===(e=this.s)||void 0===e?void 0:e.gt(u.N_DIV_2)))throw new Error("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid");var r=this,a=r.v,n=r.r,o=r.s;try{return d.ecrecover(t,a,d.bnToUnpaddedBuffer(n),d.bnToUnpaddedBuffer(o),this.supports(u.Capability.EIP155ReplayProtection)?this.common.chainIdBN():void 0)}catch(e){throw new Error("Invalid Signature")}},Transaction.prototype._processSignature=function(e,t,r){var a=new d.BN(e);this.supports(u.Capability.EIP155ReplayProtection)&&a.iadd(this.common.chainIdBN().muln(2).addn(8));var n={common:this.common};return Transaction.fromTxData({nonce:this.nonce,gasPrice:this.gasPrice,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,v:a,r:new d.BN(t),s:new d.BN(r)},n)},Transaction.prototype.toJSON=function(){return{nonce:d.bnToHex(this.nonce),gasPrice:d.bnToHex(this.gasPrice),gasLimit:d.bnToHex(this.gasLimit),to:void 0!==this.to?this.to.toString():void 0,value:d.bnToHex(this.value),data:"0x"+this.data.toString("hex"),v:void 0!==this.v?d.bnToHex(this.v):void 0,r:void 0!==this.r?d.bnToHex(this.r):void 0,s:void 0!==this.s?d.bnToHex(this.s):void 0}},Transaction.prototype._validateTxV=function(e,t){var r;if(void 0!==e&&!e.eqn(0)&&(!t||t.gteHardfork("spuriousDragon"))&&!e.eqn(27)&&!e.eqn(28))if(t){var a=t.chainIdBN().muln(2);if(!(e.eq(a.addn(35))||e.eq(a.addn(36))))throw new Error("Incompatible EIP155-based V "+e.toString()+" and chain id "+t.chainIdBN().toString()+". See the Common parameter of the Transaction constructor to set the chain id.")}else{var n=void 0;n=e.subn(35).isEven()?35:36,r=e.subn(n).divn(2)}return this._getCommon(t,r)},Transaction.prototype._unsignedTxImplementsEIP155=function(){return this.common.gteHardfork("spuriousDragon")},Transaction.prototype._signedTxImplementsEIP155=function(){if(!this.isSigned())throw Error("This transaction is not signed");var e=this.common.gteHardfork("spuriousDragon"),t=this.v,r=this.common.chainIdBN().muln(2);return(t.eq(r.addn(35))||t.eq(r.addn(36)))&&e},Transaction}(h.BaseTransaction);t.default=l},(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.N_DIV_2=t.isAccessList=t.isAccessListBuffer=t.Capability=void 0;var a=r(16);function isAccessListBuffer(e){if(0===e.length)return!0;var t=e[0];return!!Array.isArray(t)}!function(e){e[e.EIP155ReplayProtection=155]="EIP155ReplayProtection",e[e.EIP1559FeeMarket=1559]="EIP1559FeeMarket",e[e.EIP2718TypedTransaction=2718]="EIP2718TypedTransaction",e[e.EIP2930AccessLists=2930]="EIP2930AccessLists"}(t.Capability||(t.Capability={})),t.isAccessListBuffer=isAccessListBuffer,t.isAccessList=function isAccessList(e){return!isAccessListBuffer(e)},t.N_DIV_2=new a.BN("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16)},function(e,t,r){"use strict";var a,n=r(0).Buffer,o=this&&this.__extends||(a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function __(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),c=this&&this.__assign||function(){return(c=Object.assign||function(e){for(var t,r=1,a=arguments.length;r0)&&!(a=o.next()).done;)c.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return c};Object.defineProperty(t,"__esModule",{value:!0});var d=r(16),u=r(144),h=r(211),l=r(1034),b=n.from(1..toString(16).padStart(2,"0"),"hex"),g=function(e){function AccessListEIP2930Transaction(t,r){var a,n;void 0===r&&(r={});var o=e.call(this,c(c({},t),{type:1}))||this;o.DEFAULT_HARDFORK="berlin";var s=t.chainId,u=t.accessList,b=t.gasPrice;if(o.common=o._getCommon(r.common,s),o.chainId=o.common.chainIdBN(),!o.common.isActivatedEIP(2930))throw new Error("EIP-2930 not enabled on Common");o.activeCapabilities=o.activeCapabilities.concat([2718,2930]);var g=l.AccessLists.getAccessListData(null!=u?u:[]);if(o.accessList=g.accessList,o.AccessListJSON=g.AccessListJSON,l.AccessLists.verifyAccessList(o.accessList),o.gasPrice=new d.BN(d.toBuffer(""===b?"0x":b)),o._validateCannotExceedMaxInteger({gasPrice:o.gasPrice}),o.v&&!o.v.eqn(0)&&!o.v.eqn(1))throw new Error("The y-parity of the transaction should either be 0 or 1");if(o.common.gteHardfork("homestead")&&(null===(a=o.s)||void 0===a?void 0:a.gt(h.N_DIV_2)))throw new Error("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid");return(null===(n=null==r?void 0:r.freeze)||void 0===n||n)&&Object.freeze(o),o}return o(AccessListEIP2930Transaction,e),Object.defineProperty(AccessListEIP2930Transaction.prototype,"senderR",{get:function(){return this.r},enumerable:!1,configurable:!0}),Object.defineProperty(AccessListEIP2930Transaction.prototype,"senderS",{get:function(){return this.s},enumerable:!1,configurable:!0}),Object.defineProperty(AccessListEIP2930Transaction.prototype,"yParity",{get:function(){return this.v},enumerable:!1,configurable:!0}),AccessListEIP2930Transaction.fromTxData=function(e,t){return void 0===t&&(t={}),new AccessListEIP2930Transaction(e,t)},AccessListEIP2930Transaction.fromSerializedTx=function(e,t){if(void 0===t&&(t={}),!e.slice(0,1).equals(b))throw new Error("Invalid serialized tx input: not an EIP-2930 transaction (wrong tx type, expected: 1, received: "+e.slice(0,1).toString("hex"));var r=d.rlp.decode(e.slice(1));if(!Array.isArray(r))throw new Error("Invalid serialized tx input: must be array");return AccessListEIP2930Transaction.fromValuesArray(r,t)},AccessListEIP2930Transaction.fromRlpSerializedTx=function(e,t){return void 0===t&&(t={}),AccessListEIP2930Transaction.fromSerializedTx(e,t)},AccessListEIP2930Transaction.fromValuesArray=function(e,t){if(void 0===t&&(t={}),8!==e.length&&11!==e.length)throw new Error("Invalid EIP-2930 transaction. Only expecting 8 values (for unsigned tx) or 11 values (for signed tx).");var r=s(e,11),a=r[0],n=r[1],o=r[2],c=r[3],u=r[4],h=r[5],l=r[6],b=r[7],g=r[8],p=r[9],B=r[10];return new AccessListEIP2930Transaction({chainId:new d.BN(a),nonce:n,gasPrice:o,gasLimit:c,to:u,value:h,data:l,accessList:null!=b?b:[],v:void 0!==g?new d.BN(g):void 0,r:p,s:B},t)},AccessListEIP2930Transaction.prototype.getDataFee=function(){var t=e.prototype.getDataFee.call(this);return t.iaddn(l.AccessLists.getDataFeeEIP2930(this.accessList,this.common)),t},AccessListEIP2930Transaction.prototype.getUpfrontCost=function(){return this.gasLimit.mul(this.gasPrice).add(this.value)},AccessListEIP2930Transaction.prototype.raw=function(){return[d.bnToUnpaddedBuffer(this.chainId),d.bnToUnpaddedBuffer(this.nonce),d.bnToUnpaddedBuffer(this.gasPrice),d.bnToUnpaddedBuffer(this.gasLimit),void 0!==this.to?this.to.buf:n.from([]),d.bnToUnpaddedBuffer(this.value),this.data,this.accessList,void 0!==this.v?d.bnToUnpaddedBuffer(this.v):n.from([]),void 0!==this.r?d.bnToUnpaddedBuffer(this.r):n.from([]),void 0!==this.s?d.bnToUnpaddedBuffer(this.s):n.from([])]},AccessListEIP2930Transaction.prototype.serialize=function(){var e=this.raw();return n.concat([b,d.rlp.encode(e)])},AccessListEIP2930Transaction.prototype.getMessageToSign=function(e){void 0===e&&(e=!0);var t=this.raw().slice(0,8),r=n.concat([b,d.rlp.encode(t)]);return e?d.keccak256(r):r},AccessListEIP2930Transaction.prototype.hash=function(){if(!this.isSigned())throw new Error("Cannot call hash method if transaction is not signed");return d.keccak256(this.serialize())},AccessListEIP2930Transaction.prototype.getMessageToVerifySignature=function(){return this.getMessageToSign()},AccessListEIP2930Transaction.prototype.getSenderPublicKey=function(){var e;if(!this.isSigned())throw new Error("Cannot call this method if transaction is not signed");var t=this.getMessageToVerifySignature();if(this.common.gteHardfork("homestead")&&(null===(e=this.s)||void 0===e?void 0:e.gt(h.N_DIV_2)))throw new Error("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid");var r=this,a=r.yParity,n=r.r,o=r.s;try{return d.ecrecover(t,a.addn(27),d.bnToUnpaddedBuffer(n),d.bnToUnpaddedBuffer(o))}catch(e){throw new Error("Invalid Signature")}},AccessListEIP2930Transaction.prototype._processSignature=function(e,t,r){var a={common:this.common};return AccessListEIP2930Transaction.fromTxData({chainId:this.chainId,nonce:this.nonce,gasPrice:this.gasPrice,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,accessList:this.accessList,v:new d.BN(e-27),r:new d.BN(t),s:new d.BN(r)},a)},AccessListEIP2930Transaction.prototype.toJSON=function(){var e=l.AccessLists.getAccessListJSON(this.accessList);return{chainId:d.bnToHex(this.chainId),nonce:d.bnToHex(this.nonce),gasPrice:d.bnToHex(this.gasPrice),gasLimit:d.bnToHex(this.gasLimit),to:void 0!==this.to?this.to.toString():void 0,value:d.bnToHex(this.value),data:"0x"+this.data.toString("hex"),accessList:e,v:void 0!==this.v?d.bnToHex(this.v):void 0,r:void 0!==this.r?d.bnToHex(this.r):void 0,s:void 0!==this.s?d.bnToHex(this.s):void 0}},AccessListEIP2930Transaction}(u.BaseTransaction);t.default=g},function(e,t,r){"use strict";var a,n=r(0).Buffer,o=this&&this.__extends||(a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function __(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),c=this&&this.__assign||function(){return(c=Object.assign||function(e){for(var t,r=1,a=arguments.length;r0)&&!(a=o.next()).done;)c.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return c};Object.defineProperty(t,"__esModule",{value:!0});var d=r(16),u=r(144),h=r(211),l=r(1034),b=n.from(2..toString(16).padStart(2,"0"),"hex"),g=function(e){function FeeMarketEIP1559Transaction(t,r){var a,n;void 0===r&&(r={});var o=e.call(this,c(c({},t),{type:2}))||this;o.DEFAULT_HARDFORK="london";var s=t.chainId,u=t.accessList,b=t.maxFeePerGas,g=t.maxPriorityFeePerGas;if(o.common=o._getCommon(r.common,s),o.chainId=o.common.chainIdBN(),!o.common.isActivatedEIP(1559))throw new Error("EIP-1559 not enabled on Common");o.activeCapabilities=o.activeCapabilities.concat([1559,2718,2930]);var p=l.AccessLists.getAccessListData(null!=u?u:[]);if(o.accessList=p.accessList,o.AccessListJSON=p.AccessListJSON,l.AccessLists.verifyAccessList(o.accessList),o.maxFeePerGas=new d.BN(d.toBuffer(""===b?"0x":b)),o.maxPriorityFeePerGas=new d.BN(d.toBuffer(""===g?"0x":g)),o._validateCannotExceedMaxInteger({maxFeePerGas:o.maxFeePerGas,maxPriorityFeePerGas:o.maxPriorityFeePerGas},256),o.maxFeePerGas.lt(o.maxPriorityFeePerGas))throw new Error("maxFeePerGas cannot be less than maxPriorityFeePerGas (The total must be the larger of the two)");if(o.v&&!o.v.eqn(0)&&!o.v.eqn(1))throw new Error("The y-parity of the transaction should either be 0 or 1");if(o.common.gteHardfork("homestead")&&(null===(a=o.s)||void 0===a?void 0:a.gt(h.N_DIV_2)))throw new Error("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid");return(null===(n=null==r?void 0:r.freeze)||void 0===n||n)&&Object.freeze(o),o}return o(FeeMarketEIP1559Transaction,e),Object.defineProperty(FeeMarketEIP1559Transaction.prototype,"senderR",{get:function(){return this.r},enumerable:!1,configurable:!0}),Object.defineProperty(FeeMarketEIP1559Transaction.prototype,"senderS",{get:function(){return this.s},enumerable:!1,configurable:!0}),Object.defineProperty(FeeMarketEIP1559Transaction.prototype,"yParity",{get:function(){return this.v},enumerable:!1,configurable:!0}),FeeMarketEIP1559Transaction.fromTxData=function(e,t){return void 0===t&&(t={}),new FeeMarketEIP1559Transaction(e,t)},FeeMarketEIP1559Transaction.fromSerializedTx=function(e,t){if(void 0===t&&(t={}),!e.slice(0,1).equals(b))throw new Error("Invalid serialized tx input: not an EIP-1559 transaction (wrong tx type, expected: 2, received: "+e.slice(0,1).toString("hex"));var r=d.rlp.decode(e.slice(1));if(!Array.isArray(r))throw new Error("Invalid serialized tx input: must be array");return FeeMarketEIP1559Transaction.fromValuesArray(r,t)},FeeMarketEIP1559Transaction.fromRlpSerializedTx=function(e,t){return void 0===t&&(t={}),FeeMarketEIP1559Transaction.fromSerializedTx(e,t)},FeeMarketEIP1559Transaction.fromValuesArray=function(e,t){if(void 0===t&&(t={}),9!==e.length&&12!==e.length)throw new Error("Invalid EIP-1559 transaction. Only expecting 9 values (for unsigned tx) or 12 values (for signed tx).");var r=s(e,12),a=r[0],n=r[1],o=r[2],c=r[3],u=r[4],h=r[5],l=r[6],b=r[7],g=r[8],p=r[9],B=r[10],m=r[11];return new FeeMarketEIP1559Transaction({chainId:new d.BN(a),nonce:n,maxPriorityFeePerGas:o,maxFeePerGas:c,gasLimit:u,to:h,value:l,data:b,accessList:null!=g?g:[],v:void 0!==p?new d.BN(p):void 0,r:B,s:m},t)},FeeMarketEIP1559Transaction.prototype.getDataFee=function(){var t=e.prototype.getDataFee.call(this);return t.iaddn(l.AccessLists.getDataFeeEIP2930(this.accessList,this.common)),t},FeeMarketEIP1559Transaction.prototype.getUpfrontCost=function(e){void 0===e&&(e=new d.BN(0));var t=d.BN.min(this.maxPriorityFeePerGas,this.maxFeePerGas.sub(e)).add(e);return this.gasLimit.mul(t).add(this.value)},FeeMarketEIP1559Transaction.prototype.raw=function(){return[d.bnToUnpaddedBuffer(this.chainId),d.bnToUnpaddedBuffer(this.nonce),d.bnToUnpaddedBuffer(this.maxPriorityFeePerGas),d.bnToUnpaddedBuffer(this.maxFeePerGas),d.bnToUnpaddedBuffer(this.gasLimit),void 0!==this.to?this.to.buf:n.from([]),d.bnToUnpaddedBuffer(this.value),this.data,this.accessList,void 0!==this.v?d.bnToUnpaddedBuffer(this.v):n.from([]),void 0!==this.r?d.bnToUnpaddedBuffer(this.r):n.from([]),void 0!==this.s?d.bnToUnpaddedBuffer(this.s):n.from([])]},FeeMarketEIP1559Transaction.prototype.serialize=function(){var e=this.raw();return n.concat([b,d.rlp.encode(e)])},FeeMarketEIP1559Transaction.prototype.getMessageToSign=function(e){void 0===e&&(e=!0);var t=this.raw().slice(0,9),r=n.concat([b,d.rlp.encode(t)]);return e?d.keccak256(r):r},FeeMarketEIP1559Transaction.prototype.hash=function(){if(!this.isSigned())throw new Error("Cannot call hash method if transaction is not signed");return d.keccak256(this.serialize())},FeeMarketEIP1559Transaction.prototype.getMessageToVerifySignature=function(){return this.getMessageToSign()},FeeMarketEIP1559Transaction.prototype.getSenderPublicKey=function(){var e;if(!this.isSigned())throw new Error("Cannot call this method if transaction is not signed");var t=this.getMessageToVerifySignature();if(this.common.gteHardfork("homestead")&&(null===(e=this.s)||void 0===e?void 0:e.gt(h.N_DIV_2)))throw new Error("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid");var r=this,a=r.v,n=r.r,o=r.s;try{return d.ecrecover(t,a.addn(27),d.bnToUnpaddedBuffer(n),d.bnToUnpaddedBuffer(o))}catch(e){throw new Error("Invalid Signature")}},FeeMarketEIP1559Transaction.prototype._processSignature=function(e,t,r){var a={common:this.common};return FeeMarketEIP1559Transaction.fromTxData({chainId:this.chainId,nonce:this.nonce,maxPriorityFeePerGas:this.maxPriorityFeePerGas,maxFeePerGas:this.maxFeePerGas,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,accessList:this.accessList,v:new d.BN(e-27),r:new d.BN(t),s:new d.BN(r)},a)},FeeMarketEIP1559Transaction.prototype.toJSON=function(){var e=l.AccessLists.getAccessListJSON(this.accessList);return{chainId:d.bnToHex(this.chainId),nonce:d.bnToHex(this.nonce),maxPriorityFeePerGas:d.bnToHex(this.maxPriorityFeePerGas),maxFeePerGas:d.bnToHex(this.maxFeePerGas),gasLimit:d.bnToHex(this.gasLimit),to:void 0!==this.to?this.to.toString():void 0,value:d.bnToHex(this.value),data:"0x"+this.data.toString("hex"),accessList:e,v:void 0!==this.v?d.bnToHex(this.v):void 0,r:void 0!==this.r?d.bnToHex(this.r):void 0,s:void 0!==this.s?d.bnToHex(this.s):void 0}},FeeMarketEIP1559Transaction}(u.BaseTransaction);t.default=g},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,a,n,o,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(s){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,a=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(n=c.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0)&&!(a=o.next()).done;)c.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return c};Object.defineProperty(t,"__esModule",{value:!0});var s=r(4),d=r(96),u=r(1036),h=function(){function Ethash(e){this.dbOpts={valueEncoding:"json"},this.cacheDB=e,this.cache=[]}return Ethash.prototype.mkcache=function(e,t){var r,a=Math.floor(e/d.params.HASH_BYTES),n=[s.keccak(t,512)];for(r=1;r{var a=r(146),n=r(629),o=r(216),c=r(631),s=Object.defineProperty;t.f=a?s:function defineProperty(e,t,r){if(o(e),t=c(t),o(r),n)try{return s(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},(e,t,r)=>{var a=r(122);e.exports=function(e){if(!a(e))throw TypeError(String(e)+" is not an object");return e}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,a,n,o,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(s){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,a=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(n=c.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var s=r(4),d=r(381),u=function(){function Cache(e){this._cache=d(),this._checkpoints=[],this._trie=e}return Cache.prototype.put=function(e,t,r){void 0===r&&(r=!1);var a=!r;this._update(e,t,a,!1)},Cache.prototype.get=function(e){return this.lookup(e)||new s.Account},Cache.prototype.lookup=function(e){var t=e.buf.toString("hex"),r=this._cache.find(t);if(r.node){var a=r.value.val;return s.Account.fromRlpSerializedAccount(a)}},Cache.prototype.keyIsDeleted=function(e){var t=e.buf.toString("hex"),r=this._cache.find(t);return!!r.node&&r.value.deleted},Cache.prototype._lookupAccount=function(e){return n(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return[4,this._trie.get(e.buf)];case 1:return[2,(t=r.sent())?s.Account.fromRlpSerializedAccount(t):new s.Account]}}))}))},Cache.prototype.getOrLoad=function(e){return n(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return(t=this.lookup(e))?[3,2]:[4,this._lookupAccount(e)];case 1:t=r.sent(),this._update(e,t,!1,!1),r.label=2;case 2:return[2,t]}}))}))},Cache.prototype.warm=function(e){return n(this,void 0,void 0,(function(){var t,r,n,d,u,h,l,b;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,5,6,7]),t=c(e),r=t.next(),o.label=1;case 1:return r.done?[3,4]:(n=r.value)?(d=new s.Address(a.from(n,"hex")),[4,this._lookupAccount(d)]):[3,3];case 2:u=o.sent(),this._update(d,u,!1,!1),o.label=3;case 3:return r=t.next(),[3,1];case 4:return[3,7];case 5:return h=o.sent(),l={error:h},[3,7];case 6:try{r&&!r.done&&(b=t.return)&&b.call(t)}finally{if(l)throw l.error}return[7];case 7:return[2]}}))}))},Cache.prototype.flush=function(){return n(this,void 0,void 0,(function(){var e,t,r,n;return o(this,(function(o){switch(o.label){case 0:e=this._cache.begin,t=!0,o.label=1;case 1:return t?e.value&&e.value.modified?(e.value.modified=!1,r=e.value.val,n=a.from(e.key,"hex"),[4,this._trie.put(n,r)]):[3,3]:[3,7];case 2:return o.sent(),t=e.hasNext,e.next(),[3,6];case 3:return e.value&&e.value.deleted?(e.value.modified=!1,e.value.deleted=!0,e.value.val=(new s.Account).serialize(),n=a.from(e.key,"hex"),[4,this._trie.del(n)]):[3,5];case 4:return o.sent(),t=e.hasNext,e.next(),[3,6];case 5:t=e.hasNext,e.next(),o.label=6;case 6:return[3,1];case 7:return[2]}}))}))},Cache.prototype.checkpoint=function(){this._checkpoints.push(this._cache)},Cache.prototype.revert=function(){this._cache=this._checkpoints.pop()},Cache.prototype.commit=function(){this._checkpoints.pop()},Cache.prototype.clear=function(){this._cache=d()},Cache.prototype.del=function(e){this._update(e,new s.Account,!1,!0)},Cache.prototype._update=function(e,t,r,a){var n=e.buf.toString("hex"),o=this._cache.find(n),c=t.serialize();o.node?this._cache=o.update({val:c,modified:r,deleted:a}):this._cache=this._cache.insert(n,{val:c,modified:r,deleted:a})},Cache}();t.default=u},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,a,n,o,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(s){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,a=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(n=c.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=this._runState.code.length))throw new Error("Internal error: program counter not in range");o.label=1;case 1:return this._runState.programCounter=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),c=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)c.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return c};Object.defineProperty(t,"__esModule",{value:!0}),t.getOpcodesForHF=t.Opcode=void 0;var c=r(124),s=function s(e){var t=e.code,r=e.name,a=e.fullName,n=e.fee,o=e.isAsync;this.code=t,this.name=r,this.fullName=a,this.fee=n,this.isAsync=o,Object.freeze(this)};t.Opcode=s;var d={0:{name:"STOP",isAsync:!1},1:{name:"ADD",isAsync:!1},2:{name:"MUL",isAsync:!1},3:{name:"SUB",isAsync:!1},4:{name:"DIV",isAsync:!1},5:{name:"SDIV",isAsync:!1},6:{name:"MOD",isAsync:!1},7:{name:"SMOD",isAsync:!1},8:{name:"ADDMOD",isAsync:!1},9:{name:"MULMOD",isAsync:!1},10:{name:"EXP",isAsync:!1},11:{name:"SIGNEXTEND",isAsync:!1},16:{name:"LT",isAsync:!1},17:{name:"GT",isAsync:!1},18:{name:"SLT",isAsync:!1},19:{name:"SGT",isAsync:!1},20:{name:"EQ",isAsync:!1},21:{name:"ISZERO",isAsync:!1},22:{name:"AND",isAsync:!1},23:{name:"OR",isAsync:!1},24:{name:"XOR",isAsync:!1},25:{name:"NOT",isAsync:!1},26:{name:"BYTE",isAsync:!1},32:{name:"SHA3",isAsync:!1},48:{name:"ADDRESS",isAsync:!0},49:{name:"BALANCE",isAsync:!0},50:{name:"ORIGIN",isAsync:!0},51:{name:"CALLER",isAsync:!0},52:{name:"CALLVALUE",isAsync:!0},53:{name:"CALLDATALOAD",isAsync:!0},54:{name:"CALLDATASIZE",isAsync:!0},55:{name:"CALLDATACOPY",isAsync:!0},56:{name:"CODESIZE",isAsync:!1},57:{name:"CODECOPY",isAsync:!1},58:{name:"GASPRICE",isAsync:!1},59:{name:"EXTCODESIZE",isAsync:!0},60:{name:"EXTCODECOPY",isAsync:!0},64:{name:"BLOCKHASH",isAsync:!0},65:{name:"COINBASE",isAsync:!0},66:{name:"TIMESTAMP",isAsync:!0},67:{name:"NUMBER",isAsync:!0},68:{name:"DIFFICULTY",isAsync:!0},69:{name:"GASLIMIT",isAsync:!0},80:{name:"POP",isAsync:!1},81:{name:"MLOAD",isAsync:!1},82:{name:"MSTORE",isAsync:!1},83:{name:"MSTORE8",isAsync:!1},84:{name:"SLOAD",isAsync:!0},85:{name:"SSTORE",isAsync:!0},86:{name:"JUMP",isAsync:!1},87:{name:"JUMPI",isAsync:!1},88:{name:"PC",isAsync:!1},89:{name:"MSIZE",isAsync:!1},90:{name:"GAS",isAsync:!1},91:{name:"JUMPDEST",isAsync:!1},96:{name:"PUSH",isAsync:!1},97:{name:"PUSH",isAsync:!1},98:{name:"PUSH",isAsync:!1},99:{name:"PUSH",isAsync:!1},100:{name:"PUSH",isAsync:!1},101:{name:"PUSH",isAsync:!1},102:{name:"PUSH",isAsync:!1},103:{name:"PUSH",isAsync:!1},104:{name:"PUSH",isAsync:!1},105:{name:"PUSH",isAsync:!1},106:{name:"PUSH",isAsync:!1},107:{name:"PUSH",isAsync:!1},108:{name:"PUSH",isAsync:!1},109:{name:"PUSH",isAsync:!1},110:{name:"PUSH",isAsync:!1},111:{name:"PUSH",isAsync:!1},112:{name:"PUSH",isAsync:!1},113:{name:"PUSH",isAsync:!1},114:{name:"PUSH",isAsync:!1},115:{name:"PUSH",isAsync:!1},116:{name:"PUSH",isAsync:!1},117:{name:"PUSH",isAsync:!1},118:{name:"PUSH",isAsync:!1},119:{name:"PUSH",isAsync:!1},120:{name:"PUSH",isAsync:!1},121:{name:"PUSH",isAsync:!1},122:{name:"PUSH",isAsync:!1},123:{name:"PUSH",isAsync:!1},124:{name:"PUSH",isAsync:!1},125:{name:"PUSH",isAsync:!1},126:{name:"PUSH",isAsync:!1},127:{name:"PUSH",isAsync:!1},128:{name:"DUP",isAsync:!1},129:{name:"DUP",isAsync:!1},130:{name:"DUP",isAsync:!1},131:{name:"DUP",isAsync:!1},132:{name:"DUP",isAsync:!1},133:{name:"DUP",isAsync:!1},134:{name:"DUP",isAsync:!1},135:{name:"DUP",isAsync:!1},136:{name:"DUP",isAsync:!1},137:{name:"DUP",isAsync:!1},138:{name:"DUP",isAsync:!1},139:{name:"DUP",isAsync:!1},140:{name:"DUP",isAsync:!1},141:{name:"DUP",isAsync:!1},142:{name:"DUP",isAsync:!1},143:{name:"DUP",isAsync:!1},144:{name:"SWAP",isAsync:!1},145:{name:"SWAP",isAsync:!1},146:{name:"SWAP",isAsync:!1},147:{name:"SWAP",isAsync:!1},148:{name:"SWAP",isAsync:!1},149:{name:"SWAP",isAsync:!1},150:{name:"SWAP",isAsync:!1},151:{name:"SWAP",isAsync:!1},152:{name:"SWAP",isAsync:!1},153:{name:"SWAP",isAsync:!1},154:{name:"SWAP",isAsync:!1},155:{name:"SWAP",isAsync:!1},156:{name:"SWAP",isAsync:!1},157:{name:"SWAP",isAsync:!1},158:{name:"SWAP",isAsync:!1},159:{name:"SWAP",isAsync:!1},160:{name:"LOG",isAsync:!1},161:{name:"LOG",isAsync:!1},162:{name:"LOG",isAsync:!1},163:{name:"LOG",isAsync:!1},164:{name:"LOG",isAsync:!1},240:{name:"CREATE",isAsync:!0},241:{name:"CALL",isAsync:!0},242:{name:"CALLCODE",isAsync:!0},243:{name:"RETURN",isAsync:!1},254:{name:"INVALID",isAsync:!1},255:{name:"SELFDESTRUCT",isAsync:!0}},u=[{hardforkName:"homestead",opcodes:{244:{name:"DELEGATECALL",isAsync:!0}}},{hardforkName:"tangerineWhistle",opcodes:{84:{name:"SLOAD",isAsync:!0},241:{name:"CALL",isAsync:!0},242:{name:"CALLCODE",isAsync:!0},59:{name:"EXTCODESIZE",isAsync:!0},60:{name:"EXTCODECOPY",isAsync:!0},244:{name:"DELEGATECALL",isAsync:!0},255:{name:"SELFDESTRUCT",isAsync:!0},49:{name:"BALANCE",isAsync:!0}}},{hardforkName:"byzantium",opcodes:{253:{name:"REVERT",isAsync:!1},250:{name:"STATICCALL",isAsync:!0},61:{name:"RETURNDATASIZE",isAsync:!0},62:{name:"RETURNDATACOPY",isAsync:!0}}},{hardforkName:"constantinople",opcodes:{27:{name:"SHL",isAsync:!1},28:{name:"SHR",isAsync:!1},29:{name:"SAR",isAsync:!1},63:{name:"EXTCODEHASH",isAsync:!0},245:{name:"CREATE2",isAsync:!0}}},{hardforkName:"istanbul",opcodes:{70:{name:"CHAINID",isAsync:!1},71:{name:"SELFBALANCE",isAsync:!1}}}],h=[{eip:2315,opcodes:{92:{name:"BEGINSUB",isAsync:!1},93:{name:"RETURNSUB",isAsync:!1},94:{name:"JUMPSUB",isAsync:!1}}}];t.getOpcodesForHF=function getOpcodesForHF(e){for(var t,r,l=a({},d),b=0;b{var a=r(0).Buffer;const n=r(649),o=n.cwrap("ec_add","string",["string"]),c=n.cwrap("ec_mul","string",["string"]),s=n.cwrap("ec_pairing","string",["string"]);e.exports={add:function bn128add(e){return a.from(o(e.toString("hex")),"hex")},mul:function bn128mul(e){return a.from(c(e.toString("hex")),"hex")},pairing:function bn128pairing(e){return a.from(s(e.toString("hex")),"hex")}}},(e,t,r)=>{"use strict";var a=r(69),n=r(410),o=n(a("String.prototype.indexOf"));e.exports=function callBoundIntrinsic(e,t){var r=a(e,!!t);return"function"==typeof r&&o(e,".prototype.")>-1?n(r):r}},function(e,t,r){"use strict";var a,n,o,c=r(0).Buffer,s=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},d=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const h=u(r(175)),l=r(19),b=r(8),g=r(100),p=c.from([]);class BlockManager extends h.default{constructor(e,t,r,c){super(c,g.Block,t),a.set(this,void 0),n.set(this,void 0),o.set(this,void 0),this.fromFallback=async e=>{const t=d(this,a).fallback,r=await t.request("eth_getBlockByNumber",["string"==typeof e?e:b.Quantity.from(e).toString(),!0]);return null==r?null:g.Block.rawFromJSON(r)},s(this,a,e),s(this,n,t),s(this,o,r)}static async initialize(e,t,r,a){const n=new BlockManager(e,t,r,a);return await n.updateTaggedBlocks(),n}getBlockByTag(e){switch(l.Tag.normalize(e)){case l.Tag.LATEST:return this.latest;case void 0:case null:break;case l.Tag.PENDING:return this.latest;case l.Tag.EARLIEST:return this.earliest;default:throw new Error(`Invalid block Tag: ${e}`)}}getEffectiveNumber(e=l.Tag.LATEST){if("string"==typeof e){const t=this.getBlockByTag(e);if(t)return t.header.number}return b.Quantity.from(e)}async getNumberFromHash(e){return d(this,o).get(b.Data.from(e).toBuffer()).catch((e=>{if(404===e.status)return null;throw e}))}async getByHash(e){const t=await this.getNumberFromHash(e);if(null===t){if(d(this,a).fallback){const t=d(this,a).fallback,r=await t.request("eth_getBlockByHash",[b.Data.from(e),!0]);return r&&BigInt(r.number)<=t.blockNumber.toBigInt()?new g.Block(g.Block.rawFromJSON(r),d(this,n)):null}return null}return this.get(t)}async getRawByBlockNumber(e){const t=d(this,a).fallback,r=e.toBuffer();return this.getRaw(r).then((r=>null==r&&t?this.fromFallback(t.selectValidForkBlockNumber(e).toBuffer()):r))}async get(e){if("string"==typeof e){const t=this.getBlockByTag(e);if(t)return t}const t=await this.getRawByBlockNumber(b.Quantity.from(e));if(t)return new g.Block(t,d(this,n));throw new Error("header not found")}async putBlock(e,t,r){let a=e;p.equals(a)&&(a=c.from([0]));const n=t.toBuffer();await Promise.all([d(this,o).put(n,a),super.set(a,r)])}updateTaggedBlocks(){return new Promise(((e,t)=>{this.base.createValueStream({limit:1}).on("data",(e=>{this.earliest=new g.Block(e,d(this,n))})).on("error",(e=>{t(e)})).on("end",(()=>{e(void 0)})),this.base.createValueStream({reverse:!0,limit:1}).on("data",(e=>{this.latest=new g.Block(e,d(this,n))})).on("error",(e=>{t(e)})).on("end",(()=>{e(void 0)}))}))}}t.default=BlockManager,a=new WeakMap,n=new WeakMap,o=new WeakMap},function(e,t,r){"use strict";var a,n=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},o=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=r(19),d=c(r(175)),u=r(8),h=r(979);class BlockLogManager extends d.default{constructor(e,t){super(e,s.BlockLogs),a.set(this,void 0),n(this,a,t)}async get(e){const t=await super.get(e);if(t)t.blockNumber=u.Quantity.from(e);else if(o(this,a).fallback){const t=u.Quantity.from(e),r=await o(this,a).fallback.request("eth_getLogs",[{fromBlock:t,toBlock:t}]);return s.BlockLogs.fromJSON(r)}return t}async getLogs(e){const t=o(this,a);if("blockHash"in e){const{addresses:r,topics:a}=h.parseFilterDetails(e),n=await t.blocks.getNumberFromHash(e.blockHash);if(!n)return[];const o=await this.get(n);return o?[...o.filter(r,a)]:[]}{const{addresses:r,topics:a,fromBlock:n,toBlockNumber:o}=h.parseFilter(e,t),c=[this.get(n.toBuffer())],s=n.toNumber();if(s!==o)for(let e=s+1,t=o+1;e{const t=[];return e.forEach((e=>{e&&t.push(...e.filter(r,a))})),t}))}}}t.default=BlockLogManager,a=new WeakMap},function(e,t,r){"use strict";var a,n,o,c,s,d=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},u=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},h=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const l=h(r(175)),b=h(r(225)),g=h(r(226)),p=r(8),B=r(27);class TransactionManager extends l.default{constructor(e,t,r,h){super(h,B.FrozenTransaction,t),a.set(this,new g.default),n.set(this,!1),o.set(this,void 0),c.set(this,void 0),s.set(this,void 0),this.fromFallback=async e=>{const{fallback:t}=u(this,s),r=await t.request("eth_getTransactionByHash",[p.Data.from(e).toString()]);if(null==r)return null;return new B.RuntimeTransaction(r,t.common).serializeForDb(p.Data.from(r.blockHash,32),p.Quantity.from(r.blockNumber),p.Quantity.from(r.transactionIndex))},this.resume=()=>{u(this,n)&&(d(this,n,!1),u(this,c).call(this))},d(this,s,r),this.transactionPool=new b.default(e,r)}async getRaw(e){return super.getRaw(e).then((t=>null==t&&u(this,s).fallback?this.fromFallback(e):t))}async add(e,t){u(this,n)&&await u(this,o);const r=this.transactionPool.prepareTransaction(e,t),c=await u(this,a).add(r);return c&&this.transactionPool.drain(),c}clear(){u(this,a).clear(!1),this.transactionPool.clear()}async pause(){u(this,n)||(d(this,n,!0),d(this,o,new Promise((e=>{d(this,c,e)})))),u(this,a).isBusy()&&await u(this,a).emit("idle")}}t.default=TransactionManager,a=new WeakMap,n=new WeakMap,o=new WeakMap,c=new WeakMap,s=new WeakMap},function(e,t,r){"use strict";var a,n,o,c,s,d,u=r(0).Buffer,h=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},l=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},b=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const g=b(r(179)),p=r(8),B=r(8),m=r(19);function byNonce(e,t,r){return(e[r].nonce.toBigInt()||0n)>(e[t].nonce.toBigInt()||0n)}class TransactionPool extends g.default.Typed{constructor(e,t){super(),a.set(this,void 0),n.set(this,10n),o.set(this,void 0),this.executables={inProgress:new Set,pending:new Map},c.set(this,new Map),s.set(this,new Map),this.drain=()=>{this.emit("drain")},d.set(this,(e=>{if(e.gas>l(this,a).blockGasLimit)return new m.CodedError(m.GAS_LIMIT,B.JsonRpcErrorCode.INVALID_INPUT);const t=e.calculateIntrinsicGas();return-1n===t||e.gas.toBigInt()s))throw new m.CodedError("replacement transaction underpriced",B.JsonRpcErrorCode.TRANSACTION_REJECTED);C=!0,t[n]=e,o.finalize("rejected",new m.CodedError("Transaction replaced by better transaction",B.JsonRpcErrorCode.TRANSACTION_REJECTED))}c>I&&(I=c)}void 0===h?(h=I+1n,e.nonce=B.Quantity.from(h),C=!0,I=h):h===I+1n&&(C=!0,I=h)}else{g||(g=l(this,o).accounts.getNonce(a),l(this,s).set(b,g),g.then((()=>{l(this,s).delete(b)})));const t=await g,r=t?t.toBigInt():0n;if(void 0===h)h=r||0n,I=h,C=!0,e.nonce=B.Quantity.from(h);else{if(h=0;s--)(n=e[s])&&(c=(o<3?n(c):o>3?n(t,r,c):n(t,r))||c);return o>3&&c&&Object.defineProperty(t,r,c),c},s=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const u=d(r(1128)),h=d(r(1449));let l=class PromiseQueue{constructor(){a.set(this,[]),n.set(this,((e,t)=>{t===e[0]?(e.shift(),t.resolve(t.value),s(this,o).call(this,e)):t.resolved=!0})),o.set(this,(e=>{let t=e[0];for(;t&&t.resolved;)e.shift(),t.resolve(t.value),t=e[0];0===e.length&&this.emit("idle")}))}isBusy(){return 0!==s(this,a).length}add(e){const t=s(this,a),r=new h.default(e,t,s(this,n));return t.push(r),r.promise}clear(e){const t=s(this,a).splice(0);t.forEach((r=>{r.queue=t,r.value=e}))}};a=new WeakMap,n=new WeakMap,o=new WeakMap,l=c([u.default.mixin(Symbol.for("emittery"),["emit","once"])],l),t.default=l},function(e,t,r){"use strict";var a,n=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},o=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=c(r(175)),d=r(8),u=r(27),h=r(76);class TransactionReceiptManager extends s.default{constructor(e,t){super(e,u.TransactionReceipt),a.set(this,void 0),n(this,a,t)}async get(e){const t=await super.get(e);if(t)return t;if(o(this,a).fallback){const t=await o(this,a).fallback.request("eth_getTransactionReceipt",["string"==typeof e?e:d.Data.from(e)]);if(!t)return null;const r="0x1"===t.status?d.RPCQUANTITY_ONE.toBuffer():d.BUFFER_ZERO,n=d.Quantity.from(t.cumulativeGasUsed).toBuffer(),c=d.Data.from(t.logsBloom,256).toBuffer(),s=t.logs.map((e=>[h.Address.from(e.address).toBuffer(),e.topics.map((e=>d.Data.from(e).toBuffer())),Array.isArray(e.data)?e.data.map((e=>d.Data.from(e).toBuffer())):d.Data.from(e.data).toBuffer()])),l=d.Quantity.from(t.gasUsed).toBuffer(),b=null==t.contractAddress?d.BUFFER_EMPTY:h.Address.from(t.contractAddress).toBuffer();return u.TransactionReceipt.fromValues(r,n,c,s,l,b)}}}t.default=TransactionReceiptManager,a=new WeakMap},function(e,t,r){"use strict";var a,n,o,c,s,d,u,h=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},l=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},b=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Fork=void 0;const g=r(8),p=b(r(1131)),B=b(r(66)),m=r(153),I=r(691),y=r(19),x=r(100);function fetchNetworkId(e){return e.request("net_version",[]).then((e=>parseInt(e,10)))}function fetchBlock(e,t){return e.request("eth_getBlockByNumber",[t,!0])}t.Fork=class Fork{constructor(e,t){a.set(this,new p.default),n.set(this,void 0),o.set(this,void 0),c.set(this,void 0),s.set(this,(async()=>{const[e,t]=await Promise.all([(r=this,r.request("eth_chainId",[]).then((e=>parseInt(e,16)))),fetchNetworkId(this)]);var r;this.common=B.default.forCustomChain(g.KNOWN_CHAINIDS.has(e)?e:1,{name:"ganache-fork",networkId:t,chainId:e,comment:"Local test network fork"}),this.common.on=()=>{}})),d.set(this,(async()=>{const e=l(this,o);if(e.blockNumber===y.Tag.LATEST){const t=await fetchBlock(this,y.Tag.LATEST);return e.blockNumber=parseInt(t.number,16),this.blockNumber=g.Quantity.from(e.blockNumber),this.stateRoot=g.Data.from(t.stateRoot),await l(this,u).call(this,this.blockNumber),t}if("number"==typeof e.blockNumber){const r=g.Quantity.from(e.blockNumber),[a]=await Promise.all([fetchBlock(this,r).then((async e=>(this.stateRoot=e.stateRoot,await l(this,u).call(this,r),e))),(t=this,t.request("eth_blockNumber",[])).then((t=>{const a=parseInt(t,16);if(e.blockNumber>a)throw new Error(`\`fork.blockNumber\` (${e.blockNumber}) must not be greater than the current block number (${a})`);this.blockNumber=r}))]);return a}throw new Error(`Invalid value for \`fork.blockNumber\` option: "${e.blockNumber}". Must be a positive integer or the string "latest".`);var t})),u.set(this,(e=>Promise.all(l(this,c).map((async t=>{const r=await function fetchNonce(e,t,r){return e.request("eth_getTransactionCount",[t,r]).then((e=>g.Quantity.from(e)))}(this,t.address,e);t.nonce=r})))));const r=h(this,o,e.fork);h(this,c,t);const{url:b}=r;if(b){const{protocol:t}=b;switch(t){case"ws:":case"wss:":h(this,n,new I.WsHandler(e,l(this,a).signal));break;case"http:":case"https:":h(this,n,new m.HttpHandler(e,l(this,a).signal));break;default:throw new Error(`Unsupported protocol: ${t}`)}}else if(r.provider){let e=0;h(this,n,{request:(t,a)=>{const n=JSON.parse(JSON.stringify(a));if(r.provider.request)return r.provider.request({method:t,params:n});if(r.provider.send)return console.warn("WARNING: Ganache forking only supports EIP-1193-compliant providers. Legacy support for send is currently enabled, but will be removed in a future version _without_ a breaking change. To remove this warning, switch to an EIP-1193 provider. This error is probably caused by an old version of Web3's HttpProvider (or an ganache < v7)"),new Promise(((a,o)=>{r.provider.send({id:e++,jsonrpc:"2.0",method:t,params:n},((e,t)=>{e?o(e):a(t.result)}))}));throw new Error("Forking `provider` must be EIP-1193 compatible")},close:()=>Promise.resolve()})}}async initialize(){const[e]=await Promise.all([l(this,d).call(this),l(this,s).call(this)]);this.block=new x.Block(x.Block.rawFromJSON(e),this.common)}request(e,t){return l(this,n).request(e,t)}abort(){return l(this,a).abort()}close(){return l(this,n).close()}selectValidForkBlockNumber(e){return e.toBigInt(){"use strict";var a=r(416),n=r(14),o=n("%Function.prototype.apply%"),c=n("%Function.prototype.call%"),s=n("%Reflect.apply%",!0)||a.call(c,o),d=n("%Object.getOwnPropertyDescriptor%",!0),u=n("%Object.defineProperty%",!0),h=n("%Math.max%");if(u)try{u({},"a",{value:1})}catch(e){u=null}e.exports=function callBind(e){var t=s(a,c,arguments);if(d&&u){var r=d(t,"length");r.configurable&&u(t,"length",{value:1+h(0,e.length-(arguments.length-1))})}return t};var l=function applyBind(){return s(a,o,arguments)};u?u(e.exports,"apply",{value:l}):e.exports.apply=l},e=>{"use strict";e.exports=function IsPropertyKey(e){return"string"==typeof e||"symbol"==typeof e}},function(e,t,r){"use strict";var a,n,o,c=r(2).Buffer,s=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},d=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const h=u(r(1492)),l=u(r(1493)),noop=()=>{};function prepareCORSResponseHeaders(e,t){const r=t.getHeader("origin"),a=t.getHeader("access-control-request-headers");return t=>{""!==r&&("OPTIONS"===e&&(t.writeHeader("Access-Control-Allow-Methods","POST"),""!==a&&t.writeHeader("Access-Control-Allow-Headers",a),t.writeHeader("Access-Control-Max-Age","600")),t.writeHeader("Access-Control-Allow-Credentials","true"),t.writeHeader("Access-Control-Allow-Origin",r))}}function sendResponse(e,t,r,a,n=noop){e.cork((()=>{e.writeStatus(t),n(e),r&&e.writeHeader("Content-Type",r),e.end(a)}))}t.default=class HttpServer{constructor(e,t,r){a.set(this,void 0),n.set(this,((e,t)=>{const r=prepareCORSResponseHeaders("POST",t);let n,o=!1;e.onAborted((()=>{o=!0})),e.onData(((s,u)=>{const b=c.from(s);if(u){const s=d(this,a);let u;try{const e=n?c.concat([n,b],n.length+b.length):b;u=s.parse(e)}catch(t){return void sendResponse(e,l.default.BAD_REQUEST,h.default.PLAIN,"400 Bad Request: "+t.message,r)}s.handle(u,t).then((({value:e})=>e)).then((t=>{if(o)return;const a=s.format(t,u);sendResponse(e,l.default.OK,h.default.JSON,a,r)})).catch((t=>{if(o)return;const a=s.formatError(t,u);sendResponse(e,l.default.OK,h.default.JSON,a,r)}))}else n=n?c.concat([n,b],n.length+b.length):c.concat([b],b.length)}))})),o.set(this,((e,t)=>{const r=prepareCORSResponseHeaders("OPTIONS",t);sendResponse(e,l.default.NO_CONTENT,void 0,"",r)})),s(this,a,t),e.post(r.rpcEndpoint,d(this,n)).options(r.rpcEndpoint,d(this,o)),e.get("/418",(e=>{sendResponse(e,l.default.IM_A_TEAPOT,h.default.PLAIN,"418 I'm a teapot")})),e.any("/*",((e,t)=>{const r=t.getHeader("connection");r&&"upgrade"===r.toLowerCase()?sendResponse(e,l.default.BAD_REQUEST,h.default.PLAIN,"400 Bad Request"):sendResponse(e,l.default.NOT_FOUND,h.default.PLAIN,"404 Not Found")}))}close(){}},a=new WeakMap,n=new WeakMap,o=new WeakMap},e=>{"use strict";var t={};function createErrorType(e,r,a){a||(a=Error);var n=function(e){function NodeError(t,a,n){return e.call(this,function getMessage(e,t,a){return"string"==typeof r?r:r(e,t,a)}(t,a,n))||this}return function _inheritsLoose(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}(NodeError,e),NodeError}(a);n.prototype.name=a.name,n.prototype.code=e,t[e]=n}function oneOf(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"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))}createErrorType("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),createErrorType("ERR_INVALID_ARG_TYPE",(function(e,t,r){var a,n;if("string"==typeof t&&function startsWith(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}(t,"not ")?(a="must not be",t=t.replace(/^not /,"")):a="must be",function endsWith(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))n="The ".concat(e," ").concat(a," ").concat(oneOf(t,"type"));else{var o=function includes(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";n='The "'.concat(e,'" ').concat(o," ").concat(a," ").concat(oneOf(t,"type"))}return n+=". Received type ".concat(typeof r)}),TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.a=t},(e,t,r)=>{var a=r(2).Buffer;e.exports=function xor(e,t){for(var r=Math.min(e.length,t.length),n=new a(r),o=0;o{"use strict";var a=r(10),n=r(323),o=r(324),c=r(325),s=r(125);function Hash(e){s.call(this,"digest"),this._hash=e}a(Hash,s),Hash.prototype._update=function(e){this._hash.update(e)},Hash.prototype._final=function(){return this._hash.digest()},e.exports=function createHash(e){return"md5"===(e=e.toLowerCase())?new n:"rmd160"===e||"ripemd160"===e?new o:new Hash(c(e))}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(178),t)},e=>{"use strict";var t={};function createErrorType(e,r,a){a||(a=Error);var n=function(e){function NodeError(t,a,n){return e.call(this,function getMessage(e,t,a){return"string"==typeof r?r:r(e,t,a)}(t,a,n))||this}return function _inheritsLoose(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}(NodeError,e),NodeError}(a);n.prototype.name=a.name,n.prototype.code=e,t[e]=n}function oneOf(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"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))}createErrorType("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),createErrorType("ERR_INVALID_ARG_TYPE",(function(e,t,r){var a,n;if("string"==typeof t&&function startsWith(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}(t,"not ")?(a="must not be",t=t.replace(/^not /,"")):a="must be",function endsWith(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))n="The ".concat(e," ").concat(a," ").concat(oneOf(t,"type"));else{var o=function includes(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";n='The "'.concat(e,'" ').concat(o," ").concat(a," ").concat(oneOf(t,"type"))}return n+=". Received type ".concat(typeof r)}),TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.a=t},function(e,t,r){"use strict";var a=r(3).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.toType=t.TypeOutput=t.bnToRlp=t.bnToHex=void 0;const o=n(r(129)),c=r(91),s=r(74);var d;t.bnToHex=function bnToHex(e){return`0x${e.toString(16)}`},t.bnToRlp=function bnToRlp(e){return s.unpadBuffer(e.toArrayLike(a))},function(e){e[e.Number=0]="Number",e[e.BN=1]="BN",e[e.Buffer=2]="Buffer",e[e.PrefixedHexString=3]="PrefixedHexString"}(d=t.TypeOutput||(t.TypeOutput={})),t.toType=function toType(e,t){if("string"==typeof e&&!c.isHexString(e))throw new Error(`A string must be provided with a 0x-prefix, given: ${e}`);if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");if(e=s.toBuffer(e),t===d.Buffer)return e;if(t===d.BN)return new o.default(e);if(t===d.Number){const t=new o.default(e),r=new o.default(Number.MAX_SAFE_INTEGER.toString());if(t.gt(r))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return t.toNumber()}return`0x${e.toString("hex")}`}},e=>{"use strict";var t={};function createErrorType(e,r,a){a||(a=Error);var n=function(e){function NodeError(t,a,n){return e.call(this,function getMessage(e,t,a){return"string"==typeof r?r:r(e,t,a)}(t,a,n))||this}return function _inheritsLoose(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}(NodeError,e),NodeError}(a);n.prototype.name=a.name,n.prototype.code=e,t[e]=n}function oneOf(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"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))}createErrorType("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),createErrorType("ERR_INVALID_ARG_TYPE",(function(e,t,r){var a,n;if("string"==typeof t&&function startsWith(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}(t,"not ")?(a="must not be",t=t.replace(/^not /,"")):a="must be",function endsWith(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))n="The ".concat(e," ").concat(a," ").concat(oneOf(t,"type"));else{var o=function includes(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";n='The "'.concat(e,'" ').concat(o," ").concat(a," ").concat(oneOf(t,"type"))}return n+=". Received type ".concat(typeof r)}),TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.a=t},function(e,t,r){"use strict";var a=r(5).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.toType=t.TypeOutput=t.bnToRlp=t.bnToHex=void 0;const o=n(r(131)),c=r(187),s=r(77);var d;t.bnToHex=function bnToHex(e){return`0x${e.toString(16)}`},t.bnToRlp=function bnToRlp(e){return s.unpadBuffer(e.toArrayLike(a))},function(e){e[e.Number=0]="Number",e[e.BN=1]="BN",e[e.Buffer=2]="Buffer",e[e.PrefixedHexString=3]="PrefixedHexString"}(d=t.TypeOutput||(t.TypeOutput={})),t.toType=function toType(e,t){if("string"==typeof e&&!c.isHexString(e))throw new Error(`A string must be provided with a 0x-prefix, given: ${e}`);if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");if(e=s.toBuffer(e),t===d.Buffer)return e;if(t===d.BN)return new o.default(e);if(t===d.Number){const t=new o.default(e),r=new o.default(Number.MAX_SAFE_INTEGER.toString());if(t.gt(r))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return t.toNumber()}return`0x${e.toString("hex")}`}},(e,t,r)=>{"use strict";var a=r(1),n=r(5).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.RuntimeTransaction=t.hasPartialSignature=t.toValidLengthAddress=void 0;const o=r(19),c=r(8),s=r(46),d=r(281),u=r(75),h=r(345),l=r(241),b=r(76);t.toValidLengthAddress=(e,t)=>{const r=c.Data.from(e).toBuffer();if(r.byteLength!==b.Address.ByteLength)throw new Error(`The field ${t} must have byte length of ${b.Address.ByteLength}`);return b.Address.from(r)};t.hasPartialSignature=e=>null!=e.v||null!=e.r||null!=e.s;const g=c.RPCQUANTITY_ONE.toBuffer();class RuntimeTransaction extends h.BaseTransaction{constructor(e,r){let n;if(super(r),this.locked=!1,this.toJSON=()=>({hash:this.hash,nonce:this.nonce,blockHash:null,blockNumber:null,transactionIndex:null,from:this.from,to:this.to.isNull()?null:this.to,value:this.value,gas:this.gas,gasPrice:this.gasPrice,input:this.data,v:this.v,r:this.r,s:this.s}),this.finalized=new Promise((e=>{n=(...t)=>a.nextTick(e,...t)})),this.finalizer=n,Array.isArray(e)){this.nonce=c.Quantity.from(e[0]),this.gasPrice=c.Quantity.from(e[1]),this.gas=c.Quantity.from(e[2]),this.to=0==e[3].length?c.RPCQUANTITY_EMPTY:b.Address.from(e[3]),this.value=c.Quantity.from(e[4]),this.data=c.Data.from(e[5]),this.v=c.Quantity.from(e[6]),this.r=c.Quantity.from(e[7]),this.s=c.Quantity.from(e[8]);const{from:t,serialized:r,hash:a,encodedData:n,encodedSignature:o}=d.computeIntrinsics(this.v,e,this.common.chainId());this.from=t,this.raw=e,this.serialized=r,this.hash=a,this.encodedData=n,this.encodedSignature=o}else if(this.nonce=c.Quantity.from(e.nonce,!0),this.gasPrice=c.Quantity.from(e.gasPrice),this.gas=c.Quantity.from(null==e.gas?e.gasLimit:e.gas),this.to=null==e.to?c.RPCQUANTITY_EMPTY:t.toValidLengthAddress(e.to,"to"),this.value=c.Quantity.from(e.value),this.data=c.Data.from(null==e.data?e.input:e.data),t.hasPartialSignature(e)){if(null==e.v||null==e.r||null==e.s)throw new Error("Transaction signature is incomplete; v, r, and s are required.");if(null==e.nonce)throw new Error("Signed transaction is incomplete; nonce is required.");this.v=c.Quantity.from(e.v,!0),this.r=c.Quantity.from(e.r,!0),this.s=c.Quantity.from(e.s,!0);const r=[this.nonce.toBuffer(),this.gasPrice.toBuffer(),this.gas.toBuffer(),this.to.toBuffer(),this.value.toBuffer(),this.data.toBuffer(),this.v.toBuffer(),this.r.toBuffer(),this.s.toBuffer()],{from:a,serialized:n,hash:o,encodedData:s,encodedSignature:u}=d.computeIntrinsics(this.v,r,this.common.chainId());if(null!==e.from){const r=t.toValidLengthAddress(e.from,"from");if(!a.toBuffer().equals(r.toBuffer()))throw new Error("Transaction is signed and contains a `from` field, but the signature doesn't match.")}this.from=a,this.raw=r,this.serialized=n,this.hash=o,this.encodedData=s,this.encodedSignature=u}else null!=e.from&&(this.from=t.toValidLengthAddress(e.from,"from"))}signAndHash(e){if(null!=this.v)throw new Error("Internal Error: RuntimeTransaction `sign` called but transaction has already been signed");const t=this.common.chainId(),r=[this.nonce.toBuffer(),this.gasPrice.toBuffer(),this.gas.toBuffer(),this.to.toBuffer(),this.value.toBuffer(),this.data.toBuffer(),c.Quantity.from(t).toBuffer(),c.BUFFER_EMPTY,c.BUFFER_EMPTY],a=u.encodeRange(r,0,6),n=a.length,o=u.encodeRange(r,6,3),d=c.keccak(u.digest([a.output,o.output],n+o.length)),h=s.ecsign(d,e,t);this.v=c.Quantity.from(h.v),this.r=c.Quantity.from(h.r),this.s=c.Quantity.from(h.s),r[6]=this.v.toBuffer(),r[7]=this.r.toBuffer(),r[8]=this.s.toBuffer(),this.raw=r;const l=u.encodeRange(r,6,3);this.serialized=u.digest([a.output,l.output],n+l.length),this.hash=c.Data.from(c.keccak(this.serialized)),this.encodedData=a,this.encodedSignature=l}serializeForDb(e,t,r){const a=[this.raw,[this.from.toBuffer(),this.hash.toBuffer(),e.toBuffer(),t.toBuffer(),r.toBuffer()]];return u.encode(a)}fillFromResult(e,t){const r=e.execResult;let a;r.exceptionError?(a=c.BUFFER_ZERO,this.execException=new o.RuntimeError(this.hash,e,o.RETURN_TYPES.TRANSACTION_HASH)):a=g;return(this.receipt=l.TransactionReceipt.fromValues(a,c.Quantity.from(t).toBuffer(),e.bloom.bitvector,this.logs=r.logs||[],e.gasUsed.toArrayLike(n),e.createdAddress?e.createdAddress.buf:null)).serialize(!1)}getReceipt(){return this.receipt}getLogs(){return this.logs}once(e){return this.finalized}finalize(e,t=null){this.finalizer({status:e,error:t})}}t.RuntimeTransaction=RuntimeTransaction},function(e,t,r){"use strict";var a,n,o=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},c=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r};Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionReceipt=void 0;const s=r(19),d=r(75),u=r(8),h=r(8),l=[h.RPCQUANTITY_ZERO,h.RPCQUANTITY_ONE];class TransactionReceipt{constructor(e){if(a.set(this,void 0),n.set(this,((e,t,r,n,o,s=null)=>{this.raw=[e,t,r,n],this.contractAddress=s,c(this,a,o)})),e){const t=d.decode(e);o(this,n).call(this,t[0],t[1],t[2],t[3],t[4],t[5])}}static fromValues(e,t,r,a,c,s){const d=new TransactionReceipt;return o(d,n).call(d,e,t,r,a,c,s),d}serialize(e){if(null==this.encoded&&(this.encoded=d.encodeRange(this.raw,0,4)),e){const e=[o(this,a),this.contractAddress],t=d.encodeRange(e,0,2);return d.digest([this.encoded.output,t.output],this.encoded.length+t.length)}return d.digest([this.encoded.output],this.encoded.length)}toJSON(e,t){const r=this.raw,n=0===this.contractAddress.length?null:u.Data.from(this.contractAddress),c=e.hash(),d=e.header.number,h=s.BlockLogs.create(c),b=t.hash,g=t.index;h.blockNumber=d,r[3].forEach((e=>h.append(g,b,e)));const p=[...h.toJSON()];return{transactionHash:b,transactionIndex:g,blockNumber:d,blockHash:c,from:t.from,to:n?null:t.to,cumulativeGasUsed:u.Quantity.from(r[1]),gasUsed:u.Quantity.from(o(this,a)),contractAddress:n,logs:p,logsBloom:u.Data.from(r[2],256),status:l[r[0][0]]}}}t.TransactionReceipt=TransactionReceipt,a=new WeakMap,n=new WeakMap},e=>{"use strict";var t={};function createErrorType(e,r,a){a||(a=Error);var n=function(e){function NodeError(t,a,n){return e.call(this,function getMessage(e,t,a){return"string"==typeof r?r:r(e,t,a)}(t,a,n))||this}return function _inheritsLoose(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}(NodeError,e),NodeError}(a);n.prototype.name=a.name,n.prototype.code=e,t[e]=n}function oneOf(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"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))}createErrorType("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),createErrorType("ERR_INVALID_ARG_TYPE",(function(e,t,r){var a,n;if("string"==typeof t&&function startsWith(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}(t,"not ")?(a="must not be",t=t.replace(/^not /,"")):a="must be",function endsWith(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))n="The ".concat(e," ").concat(a," ").concat(oneOf(t,"type"));else{var o=function includes(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";n='The "'.concat(e,'" ').concat(o," ").concat(a," ").concat(oneOf(t,"type"))}return n+=". Received type ".concat(typeof r)}),TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.a=t},function(e,t,r){"use strict";var a=r(2).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.toType=t.TypeOutput=t.bnToRlp=t.bnToHex=void 0;const o=n(r(133)),c=r(191),s=r(79);var d;t.bnToHex=function bnToHex(e){return`0x${e.toString(16)}`},t.bnToRlp=function bnToRlp(e){return s.unpadBuffer(e.toArrayLike(a))},function(e){e[e.Number=0]="Number",e[e.BN=1]="BN",e[e.Buffer=2]="Buffer",e[e.PrefixedHexString=3]="PrefixedHexString"}(d=t.TypeOutput||(t.TypeOutput={})),t.toType=function toType(e,t){if("string"==typeof e&&!c.isHexString(e))throw new Error(`A string must be provided with a 0x-prefix, given: ${e}`);if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");if(e=s.toBuffer(e),t===d.Buffer)return e;if(t===d.BN)return new o.default(e);if(t===d.Number){const t=new o.default(e),r=new o.default(Number.MAX_SAFE_INTEGER.toString());if(t.gt(r))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return t.toNumber()}return`0x${e.toString("hex")}`}},(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=r(1287),n=r(544);t.keccak224=a.createHashFunction((function(){return n("keccak224")})),t.keccak256=a.createHashFunction((function(){return n("keccak256")})),t.keccak384=a.createHashFunction((function(){return n("keccak384")})),t.keccak512=a.createHashFunction((function(){return n("keccak512")}))},(e,t,r)=>{(t=e.exports=r(547)).Stream=t,t.Readable=t,t.Writable=r(550),t.Duplex=r(195),t.Transform=r(552),t.PassThrough=r(942),t.finished=r(360),t.pipeline=r(943)},e=>{"use strict";var t={};function createErrorType(e,r,a){a||(a=Error);var n=function(e){function NodeError(t,a,n){return e.call(this,function getMessage(e,t,a){return"string"==typeof r?r:r(e,t,a)}(t,a,n))||this}return function _inheritsLoose(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}(NodeError,e),NodeError}(a);n.prototype.name=a.name,n.prototype.code=e,t[e]=n}function oneOf(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"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))}createErrorType("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),createErrorType("ERR_INVALID_ARG_TYPE",(function(e,t,r){var a,n;if("string"==typeof t&&function startsWith(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}(t,"not ")?(a="must not be",t=t.replace(/^not /,"")):a="must be",function endsWith(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))n="The ".concat(e," ").concat(a," ").concat(oneOf(t,"type"));else{var o=function includes(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";n='The "'.concat(e,'" ').concat(o," ").concat(a," ").concat(oneOf(t,"type"))}return n+=". Received type ".concat(typeof r)}),TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.a=t},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.toType=t.TypeOutput=t.bnToRlp=t.bnToHex=void 0;const o=n(r(12)),c=r(17),s=r(81);var d;t.bnToHex=function bnToHex(e){return`0x${e.toString(16)}`},t.bnToRlp=function bnToRlp(e){return s.unpadBuffer(e.toArrayLike(a))},function(e){e[e.Number=0]="Number",e[e.BN=1]="BN",e[e.Buffer=2]="Buffer",e[e.PrefixedHexString=3]="PrefixedHexString"}(d=t.TypeOutput||(t.TypeOutput={})),t.toType=function toType(e,t){if("string"==typeof e&&!c.isHexString(e))throw new Error(`A string must be provided with a 0x-prefix, given: ${e}`);if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");if(e=s.toBuffer(e),t===d.Buffer)return e;if(t===d.BN)return new o.default(e);if(t===d.Number){const t=new o.default(e),r=new o.default(Number.MAX_SAFE_INTEGER.toString());if(t.gt(r))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return t.toNumber()}return`0x${e.toString("hex")}`}},e=>{"use strict";var t={};function createErrorType(e,r,a){a||(a=Error);var n=function(e){function NodeError(t,a,n){return e.call(this,function getMessage(e,t,a){return"string"==typeof r?r:r(e,t,a)}(t,a,n))||this}return function _inheritsLoose(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}(NodeError,e),NodeError}(a);n.prototype.name=a.name,n.prototype.code=e,t[e]=n}function oneOf(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"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))}createErrorType("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),createErrorType("ERR_INVALID_ARG_TYPE",(function(e,t,r){var a,n;if("string"==typeof t&&function startsWith(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}(t,"not ")?(a="must not be",t=t.replace(/^not /,"")):a="must be",function endsWith(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))n="The ".concat(e," ").concat(a," ").concat(oneOf(t,"type"));else{var o=function includes(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";n='The "'.concat(e,'" ').concat(o," ").concat(a," ").concat(oneOf(t,"type"))}return n+=". Received type ".concat(typeof r)}),TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.a=t},function(e,t){"use strict";var r=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):new r((function(t){t(e.value)})).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,a,n,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return{next:verb(0),throw:verb(1),return:verb(2)};function verb(c){return function(s){return function step(c){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,a&&(n=a[2&c[0]?"return":c[0]?"throw":"next"])&&!(n=n.call(a,c[1])).done)return n;switch(a=0,n&&(c=[0,n.value]),c[0]){case 0:case 1:n=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,a=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==c[0]&&2!==c[0])){o=0;continue}if(3===c[0]&&(!n||c[1]>n[0]&&c[1]0?(this.permits-=1,[2,Promise.resolve(!0)]):[2,new Promise((function(t){return e.promiseResolverQueue.push(t)}))]}))}))},Semaphore.prototype.acquire=function(){return r(this,void 0,void 0,(function(){return a(this,(function(e){return[2,this.wait()]}))}))},Semaphore.prototype.waitFor=function(e){return r(this,void 0,void 0,(function(){var t,r,n=this;return a(this,(function(a){return this.permits>0?(this.permits-=1,[2,Promise.resolve(!0)]):(t=function(e){},r=new Promise((function(e){t=e})),this.promiseResolverQueue.push(t),setTimeout((function(){var e=n.promiseResolverQueue.indexOf(t);-1!==e&&n.promiseResolverQueue.splice(e,1),t(!1)}),e),[2,r])}))}))},Semaphore.prototype.tryAcquire=function(){return this.permits>0&&(this.permits-=1,!0)},Semaphore.prototype.drainPermits=function(){if(this.permits>0){var e=this.permits;return this.permits=0,e}return 0},Semaphore.prototype.signal=function(){if(this.permits+=1,this.permits>1&&this.promiseResolverQueue.length>0)throw new Error("this.permits should never be > 0 when there is someone waiting.");if(1===this.permits&&this.promiseResolverQueue.length>0){this.permits-=1;var e=this.promiseResolverQueue.shift();e&&e(!0)}},Semaphore.prototype.release=function(){this.signal()},Semaphore.prototype.execute=function(e){return r(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.wait()];case 1:t.sent(),t.label=2;case 2:return t.trys.push([2,,4,5]),[4,e()];case 3:return[2,t.sent()];case 4:return this.signal(),[7];case 5:return[2]}}))}))},Semaphore}();t.default=n},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.toType=t.TypeOutput=t.bnToRlp=t.bnToUnpaddedBuffer=t.bnToHex=void 0;var o,c=n(r(12)),s=r(17),d=r(84);function bnToUnpaddedBuffer(e){return d.unpadBuffer(e.toArrayLike(a))}t.bnToHex=function bnToHex(e){return"0x"+e.toString(16)},t.bnToUnpaddedBuffer=bnToUnpaddedBuffer,t.bnToRlp=function bnToRlp(e){return bnToUnpaddedBuffer(e)},function(e){e[e.Number=0]="Number",e[e.BN=1]="BN",e[e.Buffer=2]="Buffer",e[e.PrefixedHexString=3]="PrefixedHexString"}(o=t.TypeOutput||(t.TypeOutput={})),t.toType=function toType(e,t){if("string"==typeof e&&!s.isHexString(e))throw new Error("A string must be provided with a 0x-prefix, given: "+e);if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");if(e=d.toBuffer(e),t===o.Buffer)return e;if(t===o.BN)return new c.default(e);if(t===o.Number){var r=new c.default(e),a=new c.default(Number.MAX_SAFE_INTEGER.toString());if(r.gt(a))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return r.toNumber()}return"0x"+e.toString("hex")}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.toType=t.TypeOutput=t.bnToRlp=t.bnToUnpaddedBuffer=t.bnToHex=void 0;var o,c=n(r(12)),s=r(17),d=r(85);function bnToUnpaddedBuffer(e){return d.unpadBuffer(e.toArrayLike(a))}t.bnToHex=function bnToHex(e){return"0x"+e.toString(16)},t.bnToUnpaddedBuffer=bnToUnpaddedBuffer,t.bnToRlp=function bnToRlp(e){return bnToUnpaddedBuffer(e)},function(e){e[e.Number=0]="Number",e[e.BN=1]="BN",e[e.Buffer=2]="Buffer",e[e.PrefixedHexString=3]="PrefixedHexString"}(o=t.TypeOutput||(t.TypeOutput={})),t.toType=function toType(e,t){if("string"==typeof e&&!s.isHexString(e))throw new Error("A string must be provided with a 0x-prefix, given: "+e);if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");if(e=d.toBuffer(e),t===o.Buffer)return e;if(t===o.BN)return new c.default(e);if(t===o.Number){var r=new c.default(e),a=new c.default(Number.MAX_SAFE_INTEGER.toString());if(r.gt(a))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return r.toNumber()}return"0x"+e.toString("hex")}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.toType=t.TypeOutput=t.bnToRlp=t.bnToUnpaddedBuffer=t.bnToHex=void 0;var o,c=n(r(12)),s=r(17),d=r(87);function bnToUnpaddedBuffer(e){return d.unpadBuffer(e.toArrayLike(a))}t.bnToHex=function bnToHex(e){return"0x"+e.toString(16)},t.bnToUnpaddedBuffer=bnToUnpaddedBuffer,t.bnToRlp=function bnToRlp(e){return bnToUnpaddedBuffer(e)},function(e){e[e.Number=0]="Number",e[e.BN=1]="BN",e[e.Buffer=2]="Buffer",e[e.PrefixedHexString=3]="PrefixedHexString"}(o=t.TypeOutput||(t.TypeOutput={})),t.toType=function toType(e,t){if("string"==typeof e&&!s.isHexString(e))throw new Error("A string must be provided with a 0x-prefix, given: "+e);if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");if(e=d.toBuffer(e),t===o.Buffer)return e;if(t===o.BN)return new c.default(e);if(t===o.Number){var r=new c.default(e),a=new c.default(Number.MAX_SAFE_INTEGER.toString());if(r.gt(a))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return r.toNumber()}return"0x"+e.toString("hex")}},(e,t,r)=>{var a=r(628),n=r(388);e.exports=function(e){return a(n(e))}},e=>{e.exports={}},function(e,t,r){"use strict";var a,n,o=r(0).Buffer,c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getActivePrecompiles=t.ripemdPrecompileAddress=t.getPrecompile=t.precompiles=void 0;var s,d=r(4),u=c(r(1431)),h=c(r(1437)),l=c(r(1438)),b=c(r(1439)),g=c(r(1440)),p=c(r(1441)),B=c(r(1442)),m=c(r(1443)),I=c(r(1444)),y=c(r(299)),x=c(r(300)),C=c(r(301)),v=c(r(302)),Q=c(r(303)),w=c(r(304)),_=c(r(305)),k=c(r(306)),N=c(r(307));!function(e){e[e.EIP=0]="EIP",e[e.Hardfork=1]="Hardfork"}(s||(s={}));var D="0000000000000000000000000000000000000003";t.ripemdPrecompileAddress=D;var U=((a={"0000000000000000000000000000000000000001":u.default,"0000000000000000000000000000000000000002":h.default})[D]=l.default,a["0000000000000000000000000000000000000004"]=b.default,a["0000000000000000000000000000000000000005"]=g.default,a["0000000000000000000000000000000000000006"]=p.default,a["0000000000000000000000000000000000000007"]=B.default,a["0000000000000000000000000000000000000008"]=m.default,a["0000000000000000000000000000000000000009"]=I.default,a["000000000000000000000000000000000000000a"]=y.default,a["000000000000000000000000000000000000000b"]=x.default,a["000000000000000000000000000000000000000c"]=C.default,a["000000000000000000000000000000000000000d"]=v.default,a["000000000000000000000000000000000000000e"]=Q.default,a["000000000000000000000000000000000000000f"]=w.default,a["0000000000000000000000000000000000000010"]=_.default,a["0000000000000000000000000000000000000011"]=k.default,a["0000000000000000000000000000000000000012"]=N.default,a);t.precompiles=U;var G=((n={"0000000000000000000000000000000000000001":{type:s.Hardfork,param:"chainstart"},"0000000000000000000000000000000000000002":{type:s.Hardfork,param:"chainstart"}})[D]={type:s.Hardfork,param:"chainstart"},n["0000000000000000000000000000000000000004"]={type:s.Hardfork,param:"chainstart"},n["0000000000000000000000000000000000000005"]={type:s.Hardfork,param:"byzantium"},n["0000000000000000000000000000000000000006"]={type:s.Hardfork,param:"byzantium"},n["0000000000000000000000000000000000000007"]={type:s.Hardfork,param:"byzantium"},n["0000000000000000000000000000000000000008"]={type:s.Hardfork,param:"byzantium"},n["0000000000000000000000000000000000000009"]={type:s.Hardfork,param:"istanbul"},n["000000000000000000000000000000000000000a"]={type:s.EIP,param:2537},n["000000000000000000000000000000000000000b"]={type:s.EIP,param:2537},n["000000000000000000000000000000000000000c"]={type:s.EIP,param:2537},n["000000000000000000000000000000000000000d"]={type:s.EIP,param:2537},n["000000000000000000000000000000000000000f"]={type:s.EIP,param:2537},n["000000000000000000000000000000000000000e"]={type:s.EIP,param:2537},n["0000000000000000000000000000000000000010"]={type:s.EIP,param:2537},n["0000000000000000000000000000000000000011"]={type:s.EIP,param:2537},n["0000000000000000000000000000000000000012"]={type:s.EIP,param:2537},n);function getPrecompile(e,t){var r=e.buf.toString("hex");if(U[r]){var a=G[r];if(a.type==s.Hardfork&&t.gteHardfork(a.param)||a.type==s.EIP&&t.eips().includes(a.param))return U[r]}return U[""]}t.getPrecompile=getPrecompile,t.getActivePrecompiles=function getActivePrecompiles(e){var t=[];for(var r in U){var a=new d.Address(o.from(r,"hex"));getPrecompile(a,e)&&t.push(a)}return t}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0});var o=r(257);Object.defineProperty(t,"Transaction",{enumerable:!0,get:function(){return o.default}});var c=r(258);Object.defineProperty(t,"AccessListEIP2930Transaction",{enumerable:!0,get:function(){return c.default}});var s=r(646);Object.defineProperty(t,"TransactionFactory",{enumerable:!0,get:function(){return s.default}}),n(r(645),t)},function(e,t,r){"use strict";var a,n=r(0).Buffer,o=this&&this.__extends||(a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function __(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),c=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),c=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)c.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return c};Object.defineProperty(t,"__esModule",{value:!0});var s=r(4),d=r(645),u=function(e){function Transaction(t,r){var a;void 0===r&&(r={});var n=e.call(this,t,r)||this;return n._validateCannotExceedMaxInteger({r:n.r,s:n.s}),n._validateTxV(n.v),(null===(a=null==r?void 0:r.freeze)||void 0===a||a)&&Object.freeze(n),n}return o(Transaction,e),Object.defineProperty(Transaction.prototype,"transactionType",{get:function(){return 0},enumerable:!1,configurable:!0}),Transaction.fromTxData=function(e,t){return void 0===t&&(t={}),new Transaction(e,t)},Transaction.fromSerializedTx=function(e,t){void 0===t&&(t={});var r=s.rlp.decode(e);if(!Array.isArray(r))throw new Error("Invalid serialized tx input. Must be array");return this.fromValuesArray(r,t)},Transaction.fromRlpSerializedTx=function(e,t){return void 0===t&&(t={}),Transaction.fromSerializedTx(e,t)},Transaction.fromValuesArray=function(e,t){if(void 0===t&&(t={}),6!==e.length&&9!==e.length)throw new Error("Invalid transaction. Only expecting 6 values (for unsigned tx) or 9 values (for signed tx).");var r=c(e,9),a=r[0],o=r[1],d=r[2],u=r[3],h=r[4],l=r[5],b=r[6],g=r[7],p=r[8],B=n.from([]);return new Transaction({nonce:new s.BN(a),gasPrice:new s.BN(o),gasLimit:new s.BN(d),to:u&&u.length>0?new s.Address(u):void 0,value:new s.BN(h),data:null!=l?l:B,v:void 0===b||b.equals(B)?void 0:new s.BN(b),r:void 0===g||g.equals(B)?void 0:new s.BN(g),s:void 0===p||p.equals(B)?void 0:new s.BN(p)},t)},Transaction.prototype.raw=function(){return[s.bnToRlp(this.nonce),s.bnToRlp(this.gasPrice),s.bnToRlp(this.gasLimit),void 0!==this.to?this.to.buf:n.from([]),s.bnToRlp(this.value),this.data,void 0!==this.v?s.bnToRlp(this.v):n.from([]),void 0!==this.r?s.bnToRlp(this.r):n.from([]),void 0!==this.s?s.bnToRlp(this.s):n.from([])]},Transaction.prototype.serialize=function(){return s.rlp.encode(this.raw())},Transaction.prototype._unsignedTxImplementsEIP155=function(){return this.common.gteHardfork("spuriousDragon")},Transaction.prototype._getMessageToSign=function(e){var t=[s.bnToRlp(this.nonce),s.bnToRlp(this.gasPrice),s.bnToRlp(this.gasLimit),void 0!==this.to?this.to.buf:n.from([]),s.bnToRlp(this.value),this.data];return e&&(t.push(s.toBuffer(this.common.chainIdBN())),t.push(s.unpadBuffer(s.toBuffer(0))),t.push(s.unpadBuffer(s.toBuffer(0)))),s.rlphash(t)},Transaction.prototype.getMessageToSign=function(){return this._getMessageToSign(this._unsignedTxImplementsEIP155())},Transaction.prototype.hash=function(){return s.rlphash(this.raw())},Transaction.prototype.getMessageToVerifySignature=function(){var e=this._signedTxImplementsEIP155();return this._getMessageToSign(e)},Transaction.prototype.getSenderPublicKey=function(){var e,t=this.getMessageToVerifySignature();if(this.common.gteHardfork("homestead")&&(null===(e=this.s)||void 0===e?void 0:e.gt(d.N_DIV_2)))throw new Error("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid");var r=this,a=r.v,n=r.r,o=r.s;if(!a||!n||!o)throw new Error("Missing values to derive sender public key from signed tx");try{return s.ecrecover(t,a,s.bnToRlp(n),s.bnToRlp(o),this._signedTxImplementsEIP155()?this.common.chainIdBN():void 0)}catch(e){throw new Error("Invalid Signature")}},Transaction.prototype._processSignature=function(e,t,r){var a=new s.BN(e);this._unsignedTxImplementsEIP155()&&a.iadd(this.common.chainIdBN().muln(2).addn(8));var n={common:this.common};return Transaction.fromTxData({nonce:this.nonce,gasPrice:this.gasPrice,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,v:a,r:new s.BN(t),s:new s.BN(r)},n)},Transaction.prototype.toJSON=function(){return{nonce:s.bnToHex(this.nonce),gasPrice:s.bnToHex(this.gasPrice),gasLimit:s.bnToHex(this.gasLimit),to:void 0!==this.to?this.to.toString():void 0,value:s.bnToHex(this.value),data:"0x"+this.data.toString("hex"),v:void 0!==this.v?s.bnToHex(this.v):void 0,r:void 0!==this.r?s.bnToHex(this.r):void 0,s:void 0!==this.s?s.bnToHex(this.s):void 0}},Transaction.prototype._validateTxV=function(e){if(void 0!==e&&!e.eqn(0)&&this.common.gteHardfork("spuriousDragon")&&!e.eqn(27)&&!e.eqn(28)){var t=this.common.chainIdBN().muln(2);if(!(e.eq(t.addn(35))||e.eq(t.addn(36))))throw new Error("Incompatible EIP155-based V "+e.toString()+" and chain id "+this.common.chainIdBN().toString()+". See the Common parameter of the Transaction constructor to set the chain id.")}},Transaction.prototype._signedTxImplementsEIP155=function(){if(!this.isSigned())throw Error("This transaction is not signed");var e=this.common.gteHardfork("spuriousDragon"),t=this.v,r=this.common.chainIdBN().muln(2);return(t.eq(r.addn(35))||t.eq(r.addn(36)))&&e},Transaction}(r(172).BaseTransaction);t.default=u},function(e,t,r){"use strict";var a,n=r(0).Buffer,o=this&&this.__extends||(a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function __(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),c=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,o=r.call(e),c=[];try{for(;(void 0===t||t-- >0)&&!(a=o.next()).done;)c.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return c};Object.defineProperty(t,"__esModule",{value:!0});var s=r(4),d=r(172),u=r(645),h=function(e){function AccessListEIP2930Transaction(t,r){var a,n;void 0===r&&(r={});var o,c=this,d=t.chainId,h=t.accessList;if(!(c=e.call(this,t,r)||this).common.isActivatedEIP(2930))throw new Error("EIP-2930 not enabled on Common");if(h&&u.isAccessList(h)){c.AccessListJSON=h;for(var l=[],b=0;b0?new s.Address(h):void 0,value:new s.BN(l),data:null!=b?b:I,accessList:null!=g?g:I,v:void 0!==p?new s.BN(p):void 0,r:void 0===B||B.equals(I)?void 0:new s.BN(B),s:void 0===m||m.equals(I)?void 0:new s.BN(m)},t)},AccessListEIP2930Transaction.prototype.getDataFee=function(){for(var t=e.prototype.getDataFee.call(this),r=this.common.param("gasPrices","accessListStorageKeyCost"),a=this.common.param("gasPrices","accessListAddressCost"),n=0,o=0;o{"use strict";var a=r(411);e.exports=a.call(Function.call,Object.prototype.hasOwnProperty)},(e,t,r)=>{"use strict";var a=r(1106);e.exports=function Type(e){return"symbol"==typeof e?"Symbol":"bigint"==typeof e?"BigInt":a(e)}},function(e,t,r){"use strict";var a,n=r(2).Buffer,o=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MAX_PAYLOAD_SIZE=void 0;const s=c(r(1491));t.MAX_PAYLOAD_SIZE=15728640;t.default=class WebsocketServer{constructor(e,r,c){a.set(this,new Map);const s=o(this,a),d=c.wsBinary,u="auto"===d;e.ws(c.rpcEndpoint,{maxPayloadLength:t.MAX_PAYLOAD_SIZE,idleTimeout:120,open:e=>{e.closed=!1,s.set(e,new Set)},message:async(e,t,a)=>{let o;const c=u?a:d;try{o=r.parse(n.from(t))}catch(t){const a=r.formatError(t,o);return void e.send(a,c)}let h;try{const{value:t}=await r.handle(o,e);if(e.closed)return;const n=t,c=await n;if(e.closed)return;if(h=r.format(c,o),"function"==typeof n.on){const t=n;t.on("message",(t=>{const r=JSON.stringify({jsonrpc:"2.0",method:t.type,params:t.data});e.send(r,a)})),s.get(e).add(t.dispose)}}catch(t){if(e.closed)return;h=r.formatError(t,o)}e.send(h,c)},drain:e=>{},close:e=>{e.closed=!0,s.get(e).forEach((e=>e())),s.delete(e)}})}close(){o(this,a).forEach(((e,t)=>t.end(s.default.CLOSE_NORMAL,"Server closed by client")))}},a=new WeakMap},function(e,t,r){"use strict";var a,n=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},o=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)};Object.defineProperty(t,"__esModule",{value:!0}),t.Executor=void 0;const c=r(722);t.Executor=class Executor{constructor(e){a.set(this,void 0),n(this,a,e)}execute(e,t,r){if("string"==typeof t&&(c.hasOwn(e.__proto__,t)&&"constructor"!==t||c.hasOwn(e,t))){const n=e[t];if("function"==typeof n)return o(this,a).queue(n,e,r)}throw new Error(`The method ${t} does not exist/is not available`)}},a=new WeakMap},function(e,t){"use strict";var r,a,n=this&&this.__classPrivateFieldSet||function(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r},o=this&&this.__classPrivateFieldGet||function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)};Object.defineProperty(t,"__esModule",{value:!0}),t.RequestCoordinator=void 0;const noop=()=>{};t.RequestCoordinator=class RequestCoordinator{constructor(e){this.pending=[],this.runningTasks=0,r.set(this,!0),this.pause=()=>{n(this,r,!0)},this.resume=()=>{n(this,r,!1),o(this,a).call(this)},a.set(this,(()=>{for(;!this.paused&&this.pending.length>0&&(!this.limit||this.runningTasks{this.runningTasks--,o(this,a).call(this)}))}})),this.queue=(e,t,r)=>new Promise(((n,c)=>{this.pending.push((async()=>{try{const a=Reflect.apply(e,t,r||[]);return n({value:a}),a}catch(e){c(e)}})),o(this,a).call(this)})),this.limit=e}get paused(){return o(this,r)}},r=new WeakMap,a=new WeakMap},(e,t,r)=>{"use strict";var a=r(232).a.ERR_STREAM_PREMATURE_CLOSE;function noop(){}e.exports=function eos(e,t,r){if("function"==typeof t)return eos(e,null,t);t||(t={}),r=function once(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,a=new Array(r),n=0;n{var a=r(11).Buffer,n=r(323);e.exports=function EVP_BytesToKey(e,t,r,o){if(a.isBuffer(e)||(e=a.from(e,"binary")),t&&(a.isBuffer(t)||(t=a.from(t,"binary")),8!==t.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var c=r/8,s=a.alloc(c),d=a.alloc(o||0),u=a.alloc(0);c>0||o>0;){var h=new n;h.update(u),h.update(e),t&&h.update(t),u=h.digest();var l=0;if(c>0){var b=s.length-c;l=Math.min(c,u.length),u.copy(s,b,0,l),c-=l}if(l0){var g=d.length-o,p=Math.min(o,u.length-l);u.copy(d,g,l,l+p),o-=p}}return u.fill(0),{key:s,iv:d}}},(e,t,r)=>{(t=e.exports=r(316)).Stream=t,t.Readable=t,t.Writable=r(317),t.Duplex=r(157),t.Transform=r(318),t.PassThrough=r(429),t.finished=r(264),t.pipeline=r(430)},(e,t,r)=>{"use strict";var a=r(29),n=r(71),o=n.getNAF,c=n.getJSF,s=n.assert;function BaseCurve(e,t){this.type=e,this.p=new a(t.p,16),this.red=t.prime?a.red(t.prime):a.mont(this.p),this.zero=new a(0).toRed(this.red),this.one=new a(1).toRed(this.red),this.two=new a(2).toRed(this.red),this.n=t.n&&new a(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function BasePoint(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=BaseCurve,BaseCurve.prototype.point=function point(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function validate(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function _fixedNafMul(e,t){s(e.precomputed);var r=e._getDoubles(),a=o(t,1,this._bitLength),n=(1<=c;h--)d=(d<<1)+a[h];u.push(d)}for(var l=this.jpoint(null,null,null),b=this.jpoint(null,null,null),g=n;g>0;g--){for(c=0;c=0;u--){for(var h=0;u>=0&&0===c[u];u--)h++;if(u>=0&&h++,d=d.dblp(h),u<0)break;var l=c[u];s(0!==l),d="affine"===e.type?l>0?d.mixedAdd(n[l-1>>1]):d.mixedAdd(n[-l-1>>1].neg()):l>0?d.add(n[l-1>>1]):d.add(n[-l-1>>1].neg())}return"affine"===e.type?d.toP():d},BaseCurve.prototype._wnafMulAdd=function _wnafMulAdd(e,t,r,a,n){var s,d,u,h=this._wnafT1,l=this._wnafT2,b=this._wnafT3,g=0;for(s=0;s=1;s-=2){var B=s-1,m=s;if(1===h[B]&&1===h[m]){var I=[t[B],null,null,t[m]];0===t[B].y.cmp(t[m].y)?(I[1]=t[B].add(t[m]),I[2]=t[B].toJ().mixedAdd(t[m].neg())):0===t[B].y.cmp(t[m].y.redNeg())?(I[1]=t[B].toJ().mixedAdd(t[m]),I[2]=t[B].add(t[m].neg())):(I[1]=t[B].toJ().mixedAdd(t[m]),I[2]=t[B].toJ().mixedAdd(t[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],x=c(r[B],r[m]);for(g=Math.max(x[0].length,g),b[B]=new Array(g),b[m]=new Array(g),d=0;d=0;s--){for(var _=0;s>=0;){var k=!0;for(d=0;d=0&&_++,Q=Q.dblp(_),s<0)break;for(d=0;d0?u=l[d][N-1>>1]:N<0&&(u=l[d][-N-1>>1].neg()),Q="affine"===u.type?Q.mixedAdd(u):Q.add(u))}}for(s=0;s=Math.ceil((e.bitLength()+1)/t.step)},BasePoint.prototype._getDoubles=function _getDoubles(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],a=this,n=0;n{"use strict";var a=r(114),n=r(70);function BlockHash(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=BlockHash,BlockHash.prototype.update=function update(e,t){if(e=a.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=a.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,a[n++]=e>>>16&255,a[n++]=e>>>8&255,a[n++]=255&e}else for(a[n++]=255&e,a[n++]=e>>>8&255,a[n++]=e>>>16&255,a[n++]=e>>>24&255,a[n++]=0,a[n++]=0,a[n++]=0,a[n++]=0,o=8;o{var a=r(1224),n=r(1225),o=r(774),c=r(320),s=r(744),d=r(11).Buffer;function parseKeys(e){var t;"object"!=typeof e||d.isBuffer(e)||(t=e.passphrase,e=e.key),"string"==typeof e&&(e=d.from(e));var r,u,h=o(e,t),l=h.tag,b=h.data;switch(l){case"CERTIFICATE":u=a.certificate.decode(b,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(u||(u=a.PublicKey.decode(b,"der")),r=u.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return a.RSAPublicKey.decode(u.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return u.subjectPrivateKey=u.subjectPublicKey,{type:"ec",data:u};case"1.2.840.10040.4.1":return u.algorithm.params.pub_key=a.DSAparam.decode(u.subjectPublicKey.data,"der"),{type:"dsa",data:u.algorithm.params};default:throw new Error("unknown key id "+r)}case"ENCRYPTED PRIVATE KEY":b=function decrypt(e,t){var r=e.algorithm.decrypt.kde.kdeparams.salt,a=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),o=n[e.algorithm.decrypt.cipher.algo.join(".")],u=e.algorithm.decrypt.cipher.iv,h=e.subjectPrivateKey,l=parseInt(o.split("-")[1],10)/8,b=s.pbkdf2Sync(t,r,a,l,"sha1"),g=c.createDecipheriv(o,b,u),p=[];return p.push(g.update(h)),p.push(g.final()),d.concat(p)}(b=a.EncryptedPrivateKey.decode(b,"der"),t);case"PRIVATE KEY":switch(r=(u=a.PrivateKey.decode(b,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return a.RSAPrivateKey.decode(u.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:u.algorithm.curve,privateKey:a.ECPrivateKey.decode(u.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return u.algorithm.params.priv_key=a.DSAparam.decode(u.subjectPrivateKey,"der"),{type:"dsa",params:u.algorithm.params};default:throw new Error("unknown key id "+r)}case"RSA PUBLIC KEY":return a.RSAPublicKey.decode(b,"der");case"RSA PRIVATE KEY":return a.RSAPrivateKey.decode(b,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:a.DSAPrivateKey.decode(b,"der")};case"EC PRIVATE KEY":return{curve:(b=a.ECPrivateKey.decode(b,"der")).parameters.value,privateKey:b.privateKey};default:throw new Error("unknown key type "+l)}}e.exports=parseKeys,parseKeys.signature=a.signature},(e,t,r)=>{"use strict";const a=r(10),n=r(462).a,o=r(333).Buffer;function DecoderBuffer(e,t){n.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function EncoderBuffer(e,t){if(Array.isArray(e))this.length=0,this.value=e.map((function(e){return EncoderBuffer.isEncoderBuffer(e)||(e=new EncoderBuffer(e,t)),this.length+=e.length,e}),this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}a(DecoderBuffer,n),t.a=DecoderBuffer,DecoderBuffer.isDecoderBuffer=function isDecoderBuffer(e){if(e instanceof DecoderBuffer)return!0;return"object"==typeof e&&o.isBuffer(e.base)&&"DecoderBuffer"===e.constructor.name&&"number"==typeof e.offset&&"number"==typeof e.length&&"function"==typeof e.save&&"function"==typeof e.restore&&"function"==typeof e.isEmpty&&"function"==typeof e.readUInt8&&"function"==typeof e.skip&&"function"==typeof e.raw},DecoderBuffer.prototype.save=function save(){return{offset:this.offset,reporter:n.prototype.save.call(this)}},DecoderBuffer.prototype.restore=function restore(e){const t=new DecoderBuffer(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,n.prototype.restore.call(this,e.reporter),t},DecoderBuffer.prototype.isEmpty=function isEmpty(){return this.offset===this.length},DecoderBuffer.prototype.readUInt8=function readUInt8(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},DecoderBuffer.prototype.skip=function skip(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");const r=new DecoderBuffer(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},DecoderBuffer.prototype.raw=function raw(e){return this.base.slice(e?e.offset:this.offset,this.length)},t.b=EncoderBuffer,EncoderBuffer.isEncoderBuffer=function isEncoderBuffer(e){if(e instanceof EncoderBuffer)return!0;return"object"==typeof e&&"EncoderBuffer"===e.constructor.name&&"number"==typeof e.length&&"function"==typeof e.join},EncoderBuffer.prototype.join=function join(e,t){return e||(e=o.alloc(this.length)),t||(t=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(e,t),t+=r.length})):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):o.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length)),e}},(e,t)=>{"use strict";function reverse(e){const t={};return Object.keys(e).forEach((function(r){(0|r)==r&&(r|=0);const a=e[r];t[a]=r})),t}t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=reverse(t.tagClass),t.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},t.tagByName=reverse(t.tag)},function(e,t,r){"use strict";var a,n=this&&this.__decorate||function(e,t,r,a){var n,o=arguments.length,c=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,a);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(c=(o<3?n(c):o>3?n(t,r,c):n(t,r))||c);return o>3&&c&&Object.defineProperty(t,r,c),c},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const c=o(r(781)),s=["clearListeners","once","on","emit","onAny"];let d=a=class PromiEvent extends Promise{constructor(e){super(e),this.dispose=()=>{if(!this.clearListeners)throw new Error("PromiEvent already disposed");this.clearListeners();const fn=()=>{throw new Error("PromiEvent bound after dispose")};s.filter((e=>"emit"!==e)).forEach((e=>{Object.defineProperty(this,e,{enumerable:!1,value:fn})}))}}catch(e){const t=new a(((r,a)=>{this.onAny(((e,r)=>t.emit(e,r)));super.catch(e).then(r,a)}));return t}static resolve(e){return new a((t=>{t(e)}))}};d=a=n([c.default.mixin(Symbol.for("emittery"),s)],d),t.default=d},(e,t,r)=>{"use strict";var a=r(99),n=r(72),o=n.getNAF,c=n.getJSF,s=n.assert;function BaseCurve(e,t){this.type=e,this.p=new a(t.p,16),this.red=t.prime?a.red(t.prime):a.mont(this.p),this.zero=new a(0).toRed(this.red),this.one=new a(1).toRed(this.red),this.two=new a(2).toRed(this.red),this.n=t.n&&new a(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function BasePoint(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=BaseCurve,BaseCurve.prototype.point=function point(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function validate(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function _fixedNafMul(e,t){s(e.precomputed);var r=e._getDoubles(),a=o(t,1,this._bitLength),n=(1<=c;h--)d=(d<<1)+a[h];u.push(d)}for(var l=this.jpoint(null,null,null),b=this.jpoint(null,null,null),g=n;g>0;g--){for(c=0;c=0;u--){for(var h=0;u>=0&&0===c[u];u--)h++;if(u>=0&&h++,d=d.dblp(h),u<0)break;var l=c[u];s(0!==l),d="affine"===e.type?l>0?d.mixedAdd(n[l-1>>1]):d.mixedAdd(n[-l-1>>1].neg()):l>0?d.add(n[l-1>>1]):d.add(n[-l-1>>1].neg())}return"affine"===e.type?d.toP():d},BaseCurve.prototype._wnafMulAdd=function _wnafMulAdd(e,t,r,a,n){var s,d,u,h=this._wnafT1,l=this._wnafT2,b=this._wnafT3,g=0;for(s=0;s=1;s-=2){var B=s-1,m=s;if(1===h[B]&&1===h[m]){var I=[t[B],null,null,t[m]];0===t[B].y.cmp(t[m].y)?(I[1]=t[B].add(t[m]),I[2]=t[B].toJ().mixedAdd(t[m].neg())):0===t[B].y.cmp(t[m].y.redNeg())?(I[1]=t[B].toJ().mixedAdd(t[m]),I[2]=t[B].add(t[m].neg())):(I[1]=t[B].toJ().mixedAdd(t[m]),I[2]=t[B].toJ().mixedAdd(t[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],x=c(r[B],r[m]);for(g=Math.max(x[0].length,g),b[B]=new Array(g),b[m]=new Array(g),d=0;d=0;s--){for(var _=0;s>=0;){var k=!0;for(d=0;d=0&&_++,Q=Q.dblp(_),s<0)break;for(d=0;d0?u=l[d][N-1>>1]:N<0&&(u=l[d][-N-1>>1].neg()),Q="affine"===u.type?Q.mixedAdd(u):Q.add(u))}}for(s=0;s=Math.ceil((e.bitLength()+1)/t.step)},BasePoint.prototype._getDoubles=function _getDoubles(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],a=this,n=0;n{"use strict";var a=r(115),n=r(159);function BlockHash(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=BlockHash,BlockHash.prototype.update=function update(e,t){if(e=a.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=a.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,a[n++]=e>>>16&255,a[n++]=e>>>8&255,a[n++]=255&e}else for(a[n++]=255&e,a[n++]=e>>>8&255,a[n++]=e>>>16&255,a[n++]=e>>>24&255,a[n++]=0,a[n++]=0,a[n++]=0,a[n++]=0,o=8;o{"use strict";var a=r(479);e.exports=function hasToStringTagShams(){return a()&&!!Symbol.toStringTag}},(e,t,r)=>{"use strict";var a=r(341),n=r(340),o=n("%Function.prototype.apply%"),c=n("%Function.prototype.call%"),s=n("%Reflect.apply%",!0)||a.call(c,o),d=n("%Object.getOwnPropertyDescriptor%",!0),u=n("%Object.defineProperty%",!0),h=n("%Math.max%");if(u)try{u({},"a",{value:1})}catch(e){u=null}e.exports=function callBind(e){var t=s(a,c,arguments);if(d&&u){var r=d(t,"length");r.configurable&&u(t,"length",{value:1+h(0,e.length-(arguments.length-1))})}return t};var l=function applyBind(){return s(a,o,arguments)};u?u(e.exports,"apply",{value:l}):e.exports.apply=l},(e,t,r)=>{"use strict";var a=r(816),n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,c=Array.prototype.concat,s=Object.defineProperty,d=s&&function(){var e={};try{for(var t in s(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),defineProperty=function(e,t,r,a){var n;(!(t in e)||"function"==typeof(n=a)&&"[object Function]"===o.call(n)&&a())&&(d?s(e,t,{configurable:!0,enumerable:!1,value:r,writable:!0}):e[t]=r)},defineProperties=function(e,t){var r=arguments.length>2?arguments[2]:{},o=a(t);n&&(o=c.call(o,Object.getOwnPropertySymbols(t)));for(var s=0;s{"use strict";var a=r(3).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.rlphash=t.ripemd160=t.sha256=t.keccak256=t.keccak=void 0;var n=r(822),o=n.keccak224,c=n.keccak384,s=n.keccak256,d=n.keccak512,u=r(490),h=r(91),l=r(181),b=r(73);t.keccak=function(e,t){switch(void 0===t&&(t=256),e="string"!=typeof e||h.isHexString(e)?b.toBuffer(e):a.from(e,"utf8"),t||(t=256),t){case 224:return o(e);case 256:return s(e);case 384:return c(e);case 512:return d(e);default:throw new Error("Invald algorithm: keccak"+t)}},t.keccak256=function(e){return t.keccak(e)},t.sha256=function(e){return e=b.toBuffer(e),u("sha256").update(e).digest()},t.ripemd160=function(e,t){e=b.toBuffer(e);var r=u("rmd160").update(e).digest();return!0===t?b.setLength(r,32):r},t.rlphash=function(e){return t.keccak(l.encode(e))}},(e,t,r)=>{"use strict";var a=r(101),n=r(78),o=n.getNAF,c=n.getJSF,s=n.assert;function BaseCurve(e,t){this.type=e,this.p=new a(t.p,16),this.red=t.prime?a.red(t.prime):a.mont(this.p),this.zero=new a(0).toRed(this.red),this.one=new a(1).toRed(this.red),this.two=new a(2).toRed(this.red),this.n=t.n&&new a(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function BasePoint(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=BaseCurve,BaseCurve.prototype.point=function point(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function validate(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function _fixedNafMul(e,t){s(e.precomputed);var r=e._getDoubles(),a=o(t,1,this._bitLength),n=(1<=c;h--)d=(d<<1)+a[h];u.push(d)}for(var l=this.jpoint(null,null,null),b=this.jpoint(null,null,null),g=n;g>0;g--){for(c=0;c=0;u--){for(var h=0;u>=0&&0===c[u];u--)h++;if(u>=0&&h++,d=d.dblp(h),u<0)break;var l=c[u];s(0!==l),d="affine"===e.type?l>0?d.mixedAdd(n[l-1>>1]):d.mixedAdd(n[-l-1>>1].neg()):l>0?d.add(n[l-1>>1]):d.add(n[-l-1>>1].neg())}return"affine"===e.type?d.toP():d},BaseCurve.prototype._wnafMulAdd=function _wnafMulAdd(e,t,r,a,n){var s,d,u,h=this._wnafT1,l=this._wnafT2,b=this._wnafT3,g=0;for(s=0;s=1;s-=2){var B=s-1,m=s;if(1===h[B]&&1===h[m]){var I=[t[B],null,null,t[m]];0===t[B].y.cmp(t[m].y)?(I[1]=t[B].add(t[m]),I[2]=t[B].toJ().mixedAdd(t[m].neg())):0===t[B].y.cmp(t[m].y.redNeg())?(I[1]=t[B].toJ().mixedAdd(t[m]),I[2]=t[B].add(t[m].neg())):(I[1]=t[B].toJ().mixedAdd(t[m]),I[2]=t[B].toJ().mixedAdd(t[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],x=c(r[B],r[m]);for(g=Math.max(x[0].length,g),b[B]=new Array(g),b[m]=new Array(g),d=0;d=0;s--){for(var _=0;s>=0;){var k=!0;for(d=0;d=0&&_++,Q=Q.dblp(_),s<0)break;for(d=0;d0?u=l[d][N-1>>1]:N<0&&(u=l[d][-N-1>>1].neg()),Q="affine"===u.type?Q.mixedAdd(u):Q.add(u))}}for(s=0;s=Math.ceil((e.bitLength()+1)/t.step)},BasePoint.prototype._getDoubles=function _getDoubles(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],a=this,n=0;n{"use strict";var a=r(116),n=r(161);function BlockHash(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=BlockHash,BlockHash.prototype.update=function update(e,t){if(e=a.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=a.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,a[n++]=e>>>16&255,a[n++]=e>>>8&255,a[n++]=255&e}else for(a[n++]=255&e,a[n++]=e>>>8&255,a[n++]=e>>>16&255,a[n++]=e>>>24&255,a[n++]=0,a[n++]=0,a[n++]=0,a[n++]=0,o=8;o{"use strict";var a=r(5).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.computeIntrinsics=t.computeHash=t.computeFromAddress=t.publicKeyConvert=t.ecdaRecover=t.isValidSigRecovery=void 0;const n=r(8),o=r(75),c=r(76);let s;try{s=r(887)("/")}catch(e){s=r(515)}function copyOrFill(e,t,r,a){if(e.byteLength>a)throw new Error("Invalid signature");const n=a-e.byteLength,o=r+n;let c=r;for(;c1===e||0===e;t.ecdaRecover=(e,r,a,c,d)=>{let u,h;const l=2*c+35;if(a===l||a===l+1){const t=[0===(b=c)?n.BUFFER_EMPTY:n.uintToBuffer(b),n.BUFFER_EMPTY,n.BUFFER_EMPTY],r=o.encodeRange(t,0,3);u=o.digest([e.output,r.output],e.length+r.length),h=a-l}else u=o.digest([e.output],e.length),h=a-27;var b;if(!t.isValidSigRecovery(h))throw new Error("Invalid signature v value");const g=n.keccak(u),p=r.slice(0,64);copyOrFill(d[7],p,0,32),copyOrFill(d[8],p,32,32);const B=r.slice(0,33);if(0!==s.ecdsaRecover(B,p,h,g))throw new Error("Invalid Signature");return B};t.publicKeyConvert=(e,t)=>{const r=e.slice(0,65);if(0!==s.publicKeyConvert(r,t))throw new Error("Invalid Signature");return r};const d=a.allocUnsafe(65);t.computeFromAddress=(e,r,a,o)=>{const s=t.ecdaRecover(e,d,r,o,a),u=t.publicKeyConvert(d,s);return c.Address.from(n.keccak(u.slice(1)).slice(-20))};t.computeHash=e=>n.Data.from(n.keccak(o.encode(e)),32);t.computeIntrinsics=(e,r,a)=>{const c=o.encodeRange(r,0,6),s=o.encodeRange(r,6,3),d=o.digest([c.output,s.output],c.length+s.length);return{from:t.computeFromAddress(c,e.toNumber(),r,a),hash:n.Data.from(n.keccak(d),32),serialized:d,encodedData:c,encodedSignature:s}}},(e,t,r)=>{"use strict";var a=r(1);function assertPath(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function normalizeStringPosix(e,t){for(var r,a="",n=0,o=-1,c=0,s=0;s<=e.length;++s){if(s2){var d=a.lastIndexOf("/");if(d!==a.length-1){-1===d?(a="",n=0):n=(a=a.slice(0,d)).length-1-a.lastIndexOf("/"),o=s,c=0;continue}}else if(2===a.length||1===a.length){a="",n=0,o=s,c=0;continue}t&&(a.length>0?a+="/..":a="..",n=2)}else a.length>0?a+="/"+e.slice(o+1,s):a=e.slice(o+1,s),n=s-o-1;o=s,c=0}else 46===r&&-1!==c?++c:c=-1}return a}var n={resolve:function resolve(){for(var e,t="",r=!1,n=arguments.length-1;n>=-1&&!r;n--){var o;n>=0?o=arguments[n]:(void 0===e&&(e=a.cwd()),o=e),assertPath(o),0!==o.length&&(t=o+"/"+t,r=47===o.charCodeAt(0))}return t=normalizeStringPosix(t,!r),r?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function normalize(e){if(assertPath(e),0===e.length)return".";var t=47===e.charCodeAt(0),r=47===e.charCodeAt(e.length-1);return 0!==(e=normalizeStringPosix(e,!t)).length||t||(e="."),e.length>0&&r&&(e+="/"),t?"/"+e:e},isAbsolute:function isAbsolute(e){return assertPath(e),e.length>0&&47===e.charCodeAt(0)},join:function join(){if(0===arguments.length)return".";for(var e,t=0;t0&&(void 0===e?e=r:e+="/"+r)}return void 0===e?".":n.normalize(e)},relative:function relative(e,t){if(assertPath(e),assertPath(t),e===t)return"";if((e=n.resolve(e))===(t=n.resolve(t)))return"";for(var r=1;rd){if(47===t.charCodeAt(c+h))return t.slice(c+h+1);if(0===h)return t.slice(c+h)}else o>d&&(47===e.charCodeAt(r+h)?u=h:0===h&&(u=0));break}var l=e.charCodeAt(r+h);if(l!==t.charCodeAt(c+h))break;47===l&&(u=h)}var b="";for(h=r+u+1;h<=a;++h)h!==a&&47!==e.charCodeAt(h)||(0===b.length?b+="..":b+="/..");return b.length>0?b+t.slice(c+u):(c+=u,47===t.charCodeAt(c)&&++c,t.slice(c))},_makeLong:function _makeLong(e){return e},dirname:function dirname(e){if(assertPath(e),0===e.length)return".";for(var t=e.charCodeAt(0),r=47===t,a=-1,n=!0,o=e.length-1;o>=1;--o)if(47===(t=e.charCodeAt(o))){if(!n){a=o;break}}else n=!1;return-1===a?r?"/":".":r&&1===a?"//":e.slice(0,a)},basename:function basename(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');assertPath(e);var r,a=0,n=-1,o=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var c=t.length-1,s=-1;for(r=e.length-1;r>=0;--r){var d=e.charCodeAt(r);if(47===d){if(!o){a=r+1;break}}else-1===s&&(o=!1,s=r+1),c>=0&&(d===t.charCodeAt(c)?-1==--c&&(n=r):(c=-1,n=s))}return a===n?n=s:-1===n&&(n=e.length),e.slice(a,n)}for(r=e.length-1;r>=0;--r)if(47===e.charCodeAt(r)){if(!o){a=r+1;break}}else-1===n&&(o=!1,n=r+1);return-1===n?"":e.slice(a,n)},extname:function extname(e){assertPath(e);for(var t=-1,r=0,a=-1,n=!0,o=0,c=e.length-1;c>=0;--c){var s=e.charCodeAt(c);if(47!==s)-1===a&&(n=!1,a=c+1),46===s?-1===t?t=c:1!==o&&(o=1):-1!==t&&(o=-1);else if(!n){r=c+1;break}}return-1===t||-1===a||0===o||1===o&&t===a-1&&t===r+1?"":e.slice(t,a)},format:function format(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function _format(e,t){var r=t.dir||t.root,a=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+a:r+e+a:a}("/",e)},parse:function parse(e){assertPath(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var r,a=e.charCodeAt(0),n=47===a;n?(t.root="/",r=1):r=0;for(var o=-1,c=0,s=-1,d=!0,u=e.length-1,h=0;u>=r;--u)if(47!==(a=e.charCodeAt(u)))-1===s&&(d=!1,s=u+1),46===a?-1===o?o=u:1!==h&&(h=1):-1!==o&&(h=-1);else if(!d){c=u+1;break}return-1===o||-1===s||0===h||1===h&&o===s-1&&o===c+1?-1!==s&&(t.base=t.name=0===c&&n?e.slice(1,s):e.slice(c,s)):(0===c&&n?(t.name=e.slice(1,o),t.base=e.slice(1,s)):(t.name=e.slice(c,o),t.base=e.slice(c,s)),t.ext=e.slice(o,s)),c>0?t.dir=e.slice(0,c-1):n&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};n.posix=n,e.exports=n},(e,t,r)=>{"use strict";var a=r(102),n=r(80),o=n.getNAF,c=n.getJSF,s=n.assert;function BaseCurve(e,t){this.type=e,this.p=new a(t.p,16),this.red=t.prime?a.red(t.prime):a.mont(this.p),this.zero=new a(0).toRed(this.red),this.one=new a(1).toRed(this.red),this.two=new a(2).toRed(this.red),this.n=t.n&&new a(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function BasePoint(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=BaseCurve,BaseCurve.prototype.point=function point(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function validate(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function _fixedNafMul(e,t){s(e.precomputed);var r=e._getDoubles(),a=o(t,1,this._bitLength),n=(1<=c;h--)d=(d<<1)+a[h];u.push(d)}for(var l=this.jpoint(null,null,null),b=this.jpoint(null,null,null),g=n;g>0;g--){for(c=0;c=0;u--){for(var h=0;u>=0&&0===c[u];u--)h++;if(u>=0&&h++,d=d.dblp(h),u<0)break;var l=c[u];s(0!==l),d="affine"===e.type?l>0?d.mixedAdd(n[l-1>>1]):d.mixedAdd(n[-l-1>>1].neg()):l>0?d.add(n[l-1>>1]):d.add(n[-l-1>>1].neg())}return"affine"===e.type?d.toP():d},BaseCurve.prototype._wnafMulAdd=function _wnafMulAdd(e,t,r,a,n){var s,d,u,h=this._wnafT1,l=this._wnafT2,b=this._wnafT3,g=0;for(s=0;s=1;s-=2){var B=s-1,m=s;if(1===h[B]&&1===h[m]){var I=[t[B],null,null,t[m]];0===t[B].y.cmp(t[m].y)?(I[1]=t[B].add(t[m]),I[2]=t[B].toJ().mixedAdd(t[m].neg())):0===t[B].y.cmp(t[m].y.redNeg())?(I[1]=t[B].toJ().mixedAdd(t[m]),I[2]=t[B].add(t[m].neg())):(I[1]=t[B].toJ().mixedAdd(t[m]),I[2]=t[B].toJ().mixedAdd(t[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],x=c(r[B],r[m]);for(g=Math.max(x[0].length,g),b[B]=new Array(g),b[m]=new Array(g),d=0;d=0;s--){for(var _=0;s>=0;){var k=!0;for(d=0;d=0&&_++,Q=Q.dblp(_),s<0)break;for(d=0;d0?u=l[d][N-1>>1]:N<0&&(u=l[d][-N-1>>1].neg()),Q="affine"===u.type?Q.mixedAdd(u):Q.add(u))}}for(s=0;s=Math.ceil((e.bitLength()+1)/t.step)},BasePoint.prototype._getDoubles=function _getDoubles(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],a=this,n=0;n{"use strict";var a=r(117),n=r(163);function BlockHash(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=BlockHash,BlockHash.prototype.update=function update(e,t){if(e=a.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=a.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,a[n++]=e>>>16&255,a[n++]=e>>>8&255,a[n++]=255&e}else for(a[n++]=255&e,a[n++]=e>>>8&255,a[n++]=e>>>16&255,a[n++]=e>>>24&255,a[n++]=0,a[n++]=0,a[n++]=0,a[n++]=0,o=8;o{e.exports=r(949)(r(950))},(e,t,r)=>{"use strict";var a=r(103),n=r(82),o=n.getNAF,c=n.getJSF,s=n.assert;function BaseCurve(e,t){this.type=e,this.p=new a(t.p,16),this.red=t.prime?a.red(t.prime):a.mont(this.p),this.zero=new a(0).toRed(this.red),this.one=new a(1).toRed(this.red),this.two=new a(2).toRed(this.red),this.n=t.n&&new a(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function BasePoint(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=BaseCurve,BaseCurve.prototype.point=function point(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function validate(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function _fixedNafMul(e,t){s(e.precomputed);var r=e._getDoubles(),a=o(t,1,this._bitLength),n=(1<=c;h--)d=(d<<1)+a[h];u.push(d)}for(var l=this.jpoint(null,null,null),b=this.jpoint(null,null,null),g=n;g>0;g--){for(c=0;c=0;u--){for(var h=0;u>=0&&0===c[u];u--)h++;if(u>=0&&h++,d=d.dblp(h),u<0)break;var l=c[u];s(0!==l),d="affine"===e.type?l>0?d.mixedAdd(n[l-1>>1]):d.mixedAdd(n[-l-1>>1].neg()):l>0?d.add(n[l-1>>1]):d.add(n[-l-1>>1].neg())}return"affine"===e.type?d.toP():d},BaseCurve.prototype._wnafMulAdd=function _wnafMulAdd(e,t,r,a,n){var s,d,u,h=this._wnafT1,l=this._wnafT2,b=this._wnafT3,g=0;for(s=0;s=1;s-=2){var B=s-1,m=s;if(1===h[B]&&1===h[m]){var I=[t[B],null,null,t[m]];0===t[B].y.cmp(t[m].y)?(I[1]=t[B].add(t[m]),I[2]=t[B].toJ().mixedAdd(t[m].neg())):0===t[B].y.cmp(t[m].y.redNeg())?(I[1]=t[B].toJ().mixedAdd(t[m]),I[2]=t[B].add(t[m].neg())):(I[1]=t[B].toJ().mixedAdd(t[m]),I[2]=t[B].toJ().mixedAdd(t[m].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],x=c(r[B],r[m]);for(g=Math.max(x[0].length,g),b[B]=new Array(g),b[m]=new Array(g),d=0;d=0;s--){for(var _=0;s>=0;){var k=!0;for(d=0;d=0&&_++,Q=Q.dblp(_),s<0)break;for(d=0;d0?u=l[d][N-1>>1]:N<0&&(u=l[d][-N-1>>1].neg()),Q="affine"===u.type?Q.mixedAdd(u):Q.add(u))}}for(s=0;s=Math.ceil((e.bitLength()+1)/t.step)},BasePoint.prototype._getDoubles=function _getDoubles(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],a=this,n=0;n{"use strict";var a=r(118),n=r(164);function BlockHash(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=BlockHash,BlockHash.prototype.update=function update(e,t){if(e=a.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=a.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,a[n++]=e>>>16&255,a[n++]=e>>>8&255,a[n++]=255&e}else for(a[n++]=255&e,a[n++]=e>>>8&255,a[n++]=e>>>16&255,a[n++]=e>>>24&255,a[n++]=0,a[n++]=0,a[n++]=0,a[n++]=0,o=8;o{if(a)for(const n of a)if(r.has(n))throw new Error(`Values for both "${t}.${e}" and "${t}.${n}" cannot be specified; they are mutually exclusive.`)};t.OptionsConfig=class OptionsConfig{constructor(e){a.set(this,void 0),n.set(this,void 0),o(this,a,e),o(this,n,Object.keys(e))}normalize(e){const t=c(this,a),r={};return c(this,n).forEach((a=>{!function fill(e,t,r,a){const n=e[a],o=r[a]=r[a]||{},c=t.flavor,d=new Set,u=Object.keys(n);if(s.hasOwn(t,a)){const e=t[a];for(let r=0,h=u.length;r{"use strict";var a=r(204),n=r(1006);e.exports=function supports(){var e=a.apply(null,arguments);return n(e,{bufferKeys:e.bufferKeys||!1,snapshots:e.snapshots||!1,permanence:e.permanence||!1,seek:e.seek||!1,clear:e.clear||!1,status:e.status||!1,createIfMissing:e.createIfMissing||!1,errorIfExists:e.errorIfExists||!1,deferredOpen:e.deferredOpen||!1,openCallback:e.openCallback||!1,promises:e.promises||!1,streams:e.streams||!1,encodings:e.encodings||!1,additionalMethods:a(e.additionalMethods)})}},(e,t,r)=>{var a=e.exports.all=[{errno:-2,code:"ENOENT",description:"no such file or directory"},{errno:-1,code:"UNKNOWN",description:"unknown error"},{errno:0,code:"OK",description:"success"},{errno:1,code:"EOF",description:"end of file"},{errno:2,code:"EADDRINFO",description:"getaddrinfo error"},{errno:3,code:"EACCES",description:"permission denied"},{errno:4,code:"EAGAIN",description:"resource temporarily unavailable"},{errno:5,code:"EADDRINUSE",description:"address already in use"},{errno:6,code:"EADDRNOTAVAIL",description:"address not available"},{errno:7,code:"EAFNOSUPPORT",description:"address family not supported"},{errno:8,code:"EALREADY",description:"connection already in progress"},{errno:9,code:"EBADF",description:"bad file descriptor"},{errno:10,code:"EBUSY",description:"resource busy or locked"},{errno:11,code:"ECONNABORTED",description:"software caused connection abort"},{errno:12,code:"ECONNREFUSED",description:"connection refused"},{errno:13,code:"ECONNRESET",description:"connection reset by peer"},{errno:14,code:"EDESTADDRREQ",description:"destination address required"},{errno:15,code:"EFAULT",description:"bad address in system call argument"},{errno:16,code:"EHOSTUNREACH",description:"host is unreachable"},{errno:17,code:"EINTR",description:"interrupted system call"},{errno:18,code:"EINVAL",description:"invalid argument"},{errno:19,code:"EISCONN",description:"socket is already connected"},{errno:20,code:"EMFILE",description:"too many open files"},{errno:21,code:"EMSGSIZE",description:"message too long"},{errno:22,code:"ENETDOWN",description:"network is down"},{errno:23,code:"ENETUNREACH",description:"network is unreachable"},{errno:24,code:"ENFILE",description:"file table overflow"},{errno:25,code:"ENOBUFS",description:"no buffer space available"},{errno:26,code:"ENOMEM",description:"not enough memory"},{errno:27,code:"ENOTDIR",description:"not a directory"},{errno:28,code:"EISDIR",description:"illegal operation on a directory"},{errno:29,code:"ENONET",description:"machine is not on the network"},{errno:31,code:"ENOTCONN",description:"socket is not connected"},{errno:32,code:"ENOTSOCK",description:"socket operation on non-socket"},{errno:33,code:"ENOTSUP",description:"operation not supported on socket"},{errno:34,code:"ENOENT",description:"no such file or directory"},{errno:35,code:"ENOSYS",description:"function not implemented"},{errno:36,code:"EPIPE",description:"broken pipe"},{errno:37,code:"EPROTO",description:"protocol error"},{errno:38,code:"EPROTONOSUPPORT",description:"protocol not supported"},{errno:39,code:"EPROTOTYPE",description:"protocol wrong type for socket"},{errno:40,code:"ETIMEDOUT",description:"connection timed out"},{errno:41,code:"ECHARSET",description:"invalid Unicode character"},{errno:42,code:"EAIFAMNOSUPPORT",description:"address family for hostname not supported"},{errno:44,code:"EAISERVICE",description:"servname not supported for ai_socktype"},{errno:45,code:"EAISOCKTYPE",description:"ai_socktype not supported"},{errno:46,code:"ESHUTDOWN",description:"cannot send after transport endpoint shutdown"},{errno:47,code:"EEXIST",description:"file already exists"},{errno:48,code:"ESRCH",description:"no such process"},{errno:49,code:"ENAMETOOLONG",description:"name too long"},{errno:50,code:"EPERM",description:"operation not permitted"},{errno:51,code:"ELOOP",description:"too many symbolic links encountered"},{errno:52,code:"EXDEV",description:"cross-device link not permitted"},{errno:53,code:"ENOTEMPTY",description:"directory not empty"},{errno:54,code:"ENOSPC",description:"no space left on device"},{errno:55,code:"EIO",description:"i/o error"},{errno:56,code:"EROFS",description:"read-only file system"},{errno:57,code:"ENODEV",description:"no such device"},{errno:58,code:"ESPIPE",description:"invalid seek"},{errno:59,code:"ECANCELED",description:"operation canceled"}];e.exports.errno={},e.exports.code={},a.forEach((function(t){e.exports.errno[t.errno]=t,e.exports.code[t.code]=t})),e.exports.custom=r(1011)(e.exports),e.exports.create=e.exports.custom.createError},(e,t,r)=>{var a=r(0).Buffer;function isDef(e){return void 0!==e&&""!==e}function has(e,t){return Object.hasOwnProperty.call(e,t)}function hasKey(e,t){return Object.hasOwnProperty.call(e,t)&&t}t.compare=function(e,t){if(a.isBuffer(e)){for(var r=Math.min(e.length,t.length),n=0;nt?1:0};var n=t.lowerBoundKey=function(e){return hasKey(e,"gt")||hasKey(e,"gte")||hasKey(e,"min")||(e.reverse?hasKey(e,"end"):hasKey(e,"start"))||void 0},o=t.lowerBound=function(e,t){var r=n(e);return r?e[r]:t},c=t.lowerBoundInclusive=function(e){return!has(e,"gt")},s=t.upperBoundInclusive=function(e){return!has(e,"lt")},d=t.lowerBoundExclusive=function(e){return!c(e)},u=t.upperBoundExclusive=function(e){return!s(e)},h=t.upperBoundKey=function(e){return hasKey(e,"lt")||hasKey(e,"lte")||hasKey(e,"max")||(e.reverse?hasKey(e,"start"):hasKey(e,"end"))||void 0},l=t.upperBound=function(e,t){var r=h(e);return r?e[r]:t};function id(e){return e}t.start=function(e,t){return e.reverse?l(e,t):o(e,t)},t.end=function(e,t){return e.reverse?o(e,t):l(e,t)},t.startInclusive=function(e){return e.reverse?s(e):c(e)},t.endInclusive=function(e){return e.reverse?c(e):s(e)},t.toLtgt=function(e,r,a,n,o){r=r||{},a=a||id;var c=arguments.length>3,s=t.lowerBoundKey(e),d=t.upperBoundKey(e);return s?"gt"===s?r.gt=a(e.gt,!1):r.gte=a(e[s],!1):c&&(r.gte=a(n,!1)),d?"lt"===d?r.lt=a(e.lt,!0):r.lte=a(e[d],!0):c&&(r.lte=a(o,!0)),null!=e.reverse&&(r.reverse=!!e.reverse),has(r,"max")&&delete r.max,has(r,"min")&&delete r.min,has(r,"start")&&delete r.start,has(r,"end")&&delete r.end,r},t.contains=function(e,r,a){a=a||t.compare;var n=o(e);if(isDef(n)&&((c=a(r,n))<0||0===c&&d(e)))return!1;var c,s=l(e);if(isDef(s)&&((c=a(r,s))>0||0===c&&u(e)))return!1;return!0},t.filter=function(e,r){return function(a){return t.contains(e,a,r)}}},(e,t,r)=>{var a=r(2).Buffer;function isDef(e){return void 0!==e&&""!==e}function has(e,t){return Object.hasOwnProperty.call(e,t)}function hasKey(e,t){return Object.hasOwnProperty.call(e,t)&&t}t.compare=function(e,t){if(a.isBuffer(e)){for(var r=Math.min(e.length,t.length),n=0;nt?1:0};var n=t.lowerBoundKey=function(e){return hasKey(e,"gt")||hasKey(e,"gte")||hasKey(e,"min")||(e.reverse?hasKey(e,"end"):hasKey(e,"start"))||void 0},o=t.lowerBound=function(e,t){var r=n(e);return r?e[r]:t},c=t.lowerBoundInclusive=function(e){return!has(e,"gt")},s=t.upperBoundInclusive=function(e){return!has(e,"lt")},d=t.lowerBoundExclusive=function(e){return!c(e)},u=t.upperBoundExclusive=function(e){return!s(e)},h=t.upperBoundKey=function(e){return hasKey(e,"lt")||hasKey(e,"lte")||hasKey(e,"max")||(e.reverse?hasKey(e,"start"):hasKey(e,"end"))||void 0},l=t.upperBound=function(e,t){var r=h(e);return r?e[r]:t};function id(e){return e}t.start=function(e,t){return e.reverse?l(e,t):o(e,t)},t.end=function(e,t){return e.reverse?o(e,t):l(e,t)},t.startInclusive=function(e){return e.reverse?s(e):c(e)},t.endInclusive=function(e){return e.reverse?c(e):s(e)},t.toLtgt=function(e,r,a,n,o){r=r||{},a=a||id;var c=arguments.length>3,s=t.lowerBoundKey(e),d=t.upperBoundKey(e);return s?"gt"===s?r.gt=a(e.gt,!1):r.gte=a(e[s],!1):c&&(r.gte=a(n,!1)),d?"lt"===d?r.lt=a(e.lt,!0):r.lte=a(e[d],!0):c&&(r.lte=a(o,!0)),null!=e.reverse&&(r.reverse=!!e.reverse),has(r,"max")&&delete r.max,has(r,"min")&&delete r.min,has(r,"start")&&delete r.start,has(r,"end")&&delete r.end,r},t.contains=function(e,r,a){a=a||t.compare;var n=o(e);if(isDef(n)&&((c=a(r,n))<0||0===c&&d(e)))return!1;var c,s=l(e);if(isDef(s)&&((c=a(r,s))>0||0===c&&u(e)))return!1;return!0},t.filter=function(e,r){return function(a){return t.contains(e,a,r)}}},function(e,t,r){"use strict";var a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.chains=t._getInitializedChains=void 0;var o=n(r(1348)),c=n(r(1349)),s=n(r(1350)),d=n(r(1351)),u=n(r(1352)),h=n(r(1353)),l=n(r(1354)),b=n(r(1355));function _getInitializedChains(e){var t,r,n={1:"mainnet",3:"ropsten",4:"rinkeby",42:"kovan",5:"goerli",34180983699157880:"yolov3",7822:"aleut",1642:"baikal"},g={mainnet:o.default,ropsten:c.default,rinkeby:s.default,kovan:d.default,goerli:u.default,yolov3:h.default,aleut:l.default,baikal:b.default};if(e)try{for(var p=a(e),B=p.next();!B.done;B=p.next()){var m=B.value,I=m.name;n[m.chainId.toString()]=I,g[I]=m}}catch(e){t={error:e}}finally{try{B&&!B.done&&(r=p.return)&&r.call(p)}finally{if(t)throw t.error}}return g.names=n,g}t._getInitializedChains=_getInitializedChains,t.chains=_getInitializedChains()},function(e,t,r){"use strict";var a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.chains=t._getInitializedChains=void 0;var o=n(r(1381)),c=n(r(1382)),s=n(r(1383)),d=n(r(1384)),u=n(r(1385)),h=n(r(1386));function _getInitializedChains(e){var t,r,n={1:"mainnet",3:"ropsten",4:"rinkeby",42:"kovan",5:"goerli",123:"calaveras"},l={mainnet:o.default,ropsten:c.default,rinkeby:s.default,kovan:d.default,goerli:u.default,calaveras:h.default};if(e)try{for(var b=a(e),g=b.next();!g.done;g=b.next()){var p=g.value,B=p.name;n[p.chainId.toString()]=B,l[B]=p}}catch(e){t={error:e}}finally{try{g&&!g.done&&(r=b.return)&&r.call(b)}finally{if(t)throw t.error}}return l.names=n,l}t._getInitializedChains=_getInitializedChains,t.chains=_getInitializedChains()},(e,t,r)=>{var a,n,o,c=r(1043),s=r(107),d=r(122),u=r(171),h=r(123),l=r(389),b=r(396),g=r(297),p="Object already initialized",B=s.WeakMap;if(c||l.state){var m=l.state||(l.state=new B),I=m.get,y=m.has,x=m.set;a=function(e,t){if(y.call(m,e))throw new TypeError(p);return t.facade=e,x.call(m,e,t),t},n=function(e){return I.call(m,e)||{}},o=function(e){return y.call(m,e)}}else{var C=b("state");g[C]=!0,a=function(e,t){if(h(e,C))throw new TypeError(p);return t.facade=e,u(e,C,t),t},n=function(e){return h(e,C)?e[C]:{}},o=function(e){return h(e,C)}}e.exports={set:a,get:n,has:o,enforce:function(e){return o(e)?n(e):a(e,{})},getterFor:function(e){return function(t){var r;if(!d(t)||(r=n(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return r}}}},(e,t,r)=>{var a=r(391),n=r(107),aFunction=function(e){return"function"==typeof e?e:void 0};e.exports=function(e,t){return arguments.length<2?aFunction(a[e])||aFunction(n[e]):a[e]&&a[e][t]||n[e]&&n[e][t]}},e=>{e.exports={}},(e,t,r)=>{var a=r(1051);e.exports=function(e,t,r){if(a(e),void 0===t)return e;switch(r){case 0:return function(){return e.call(t)};case 1:return function(r){return e.call(t,r)};case 2:return function(r,a){return e.call(t,r,a)};case 3:return function(r,a,n){return e.call(t,r,a,n)}}return function(){return e.apply(t,arguments)}}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(n,o){function fulfilled(e){try{step(a.next(e))}catch(e){o(e)}}function rejected(e){try{step(a.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,a,n,o,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(s){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,a=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(n=c.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]{"use strict";var a=r(0).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.updateSstoreGas=t.writeCallOutput=t.subMemUsage=t.maxCallGas=t.jumpSubIsValid=t.jumpIsValid=t.getFullname=t.getDataSlice=t.getContractStorage=t.short=t.divCeil=t.describeLocation=t.addressToBuffer=t.trap=t.setLengthLeftStorage=void 0;const n=r(4),o=r(30),c=r(685),s=new n.BN(1).shln(160).subn(1);function setLengthLeftStorage(e){return e.equals(a.alloc(e.length,0))?a.alloc(0):n.setLengthLeft(e,32)}function divCeil(e,t){const r=e.div(t);return e.mod(t).isZero()?r:r.isNeg()?r.isubn(1):r.iaddn(1)}function getDataSlice(e,t,r){const a=new n.BN(e.length);t.gt(a)&&(t=a);let o=t.add(r);return o.gt(a)&&(o=a),e=e.slice(t.toNumber(),o.toNumber()),e=n.setLengthRight(e,r.toNumber())}t.setLengthLeftStorage=setLengthLeftStorage,t.trap=function trap(e){throw new o.VmError(e)},t.addressToBuffer=function addressToBuffer(e){return a.isBuffer(e)?e:e.and(s).toArrayLike(a,"be",20)},t.describeLocation=function describeLocation(e){return`${n.keccak256(e.eei.getCode()).toString("hex")}/${e.eei.getAddress().buf.toString("hex")}:${e.programCounter-1}`},t.divCeil=divCeil,t.short=function short(e){const t=e.toString("hex");return t.length<=50?t:t.slice(0,50)+"..."},t.getContractStorage=async function getContractStorage(e,t,r){const a=setLengthLeftStorage(await e.stateManager.getContractStorage(t,r));if("constantinople"===e._common.hardfork()||e._common.gteHardfork("istanbul")){return{current:a,original:setLengthLeftStorage(await e.stateManager.getOriginalContractStorage(t,r))}}return a},t.getDataSlice=getDataSlice,t.getFullname=function getFullname(e,t){switch(t){case"LOG":t+=e-160;break;case"PUSH":t+=e-95;break;case"DUP":t+=e-127;break;case"SWAP":t+=e-143}return t},t.jumpIsValid=function jumpIsValid(e,t){return-1!==e.validJumps.indexOf(t)},t.jumpSubIsValid=function jumpSubIsValid(e,t){return-1!==e.validJumpSubs.indexOf(t)},t.maxCallGas=function maxCallGas(e,t,r){if(r._common.gteHardfork("tangerineWhistle")){const r=t.sub(t.divn(64));return e.gt(r)?r:e}return e},t.subMemUsage=function subMemUsage(e,t,r){if(r.isZero())return;const a=divCeil(t.add(r),new n.BN(32));if(a.lte(e.memoryWordCount))return;const o=a,c=new n.BN(e._common.param("gasPrices","memory")),s=new n.BN(e._common.param("gasPrices","quadCoeffDiv")),d=o.mul(c).add(o.mul(o).div(s));d.gt(e.highestMemCost)&&(e.eei.useGas(d.sub(e.highestMemCost),"subMemUsage"),e.highestMemCost=d),e.memoryWordCount=a},t.writeCallOutput=function writeCallOutput(e,t,r){const a=e.eei.getReturnData();if(a.length>0){const o=t.toNumber();let c=r.toNumber();a.length{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.normalize=void 0;t.normalize=e=>e},(e,t,r)=>{"use strict";var a=r(1146),n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,c=Array.prototype.concat,s=Object.defineProperty,d=s&&function(){var e={};try{for(var t in s(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),defineProperty=function(e,t,r,a){var n;(!(t in e)||"function"==typeof(n=a)&&"[object Function]"===o.call(n)&&a())&&(d?s(e,t,{configurable:!0,enumerable:!1,value:r,writable:!0}):e[t]=r)},defineProperties=function(e,t){var r=arguments.length>2?arguments[2]:{},o=a(t);n&&(o=c.call(o,Object.getOwnPropertySymbols(t)));for(var s=0;s{"use strict";e.exports=function requirePromise(){if("function"!=typeof Promise)throw new TypeError("`Promise.allSettled` requires a global `Promise` be available.")}},(e,t,r)=>{"use strict";var a=r(418);e.exports=function hasToStringTagShams(){return a()&&!!Symbol.toStringTag}},function(e,t,r){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.provider=t.server=t._DefaultServerOptions=t.ServerStatus=t.Server=void 0;const n=a(r(719)),o=a(r(154));var c=r(154);Object.defineProperty(t,"Server",{enumerable:!0,get:function(){return c.Server}}),Object.defineProperty(t,"ServerStatus",{enumerable:!0,get:function(){return c.ServerStatus}}),Object.defineProperty(t,"_DefaultServerOptions",{enumerable:!0,get:function(){return c._DefaultServerOptions}});const s={server:e=>new o.default(e),provider:e=>n.default.initialize(e).provider};t.server=s.server,t.provider=s.provider,t.default=s},(e,t,r)=>{"use strict";var a,n=r(1);e.exports=Readable,Readable.ReadableState=ReadableState;r(34).EventEmitter;var o=function EElistenerCount(e,t){return e.listeners(t).length},c=r(727),s=r(2).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(89);u=h&&h.debuglog?h.debuglog("stream"):function debug(){};var l,b,g,p=r(728),B=r(426),m=r(427).getHighWaterMark,I=r(232).a,y=I.ERR_INVALID_ARG_TYPE,x=I.ERR_STREAM_PUSH_AFTER_EOF,C=I.ERR_METHOD_NOT_IMPLEMENTED,v=I.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(10)(Readable,c);var Q=B.errorOrDestroy,w=["error","close","destroy","pause","resume"];function ReadableState(e,t,n){a=a||r(157),e=e||{},"boolean"!=typeof n&&(n=t instanceof a),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(this,e,"readableHighWaterMark",n),this.buffer=new p,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.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(l||(l=r(428).a),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function Readable(e){if(a=a||r(157),!(this instanceof Readable))return new Readable(e);var t=this instanceof a;this._readableState=new ReadableState(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),c.call(this)}function readableAddChunk(e,t,r,a,n){u("readableAddChunk",t);var o,c=e._readableState;if(null===t)c.reading=!1,function onEofChunk(e,t){if(u("onEofChunk"),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,t.sync?emitReadable(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,emitReadable_(e)))}(e,c);else if(n||(o=function chunkInvalid(e,t){var r;(function _isUint8Array(e){return s.isBuffer(e)||e instanceof d})(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],t));return r}(c,t)),o)Q(e,o);else if(c.objectMode||t&&t.length>0)if("string"==typeof t||c.objectMode||Object.getPrototypeOf(t)===s.prototype||(t=function _uint8ArrayToBuffer(e){return s.from(e)}(t)),a)c.endEmitted?Q(e,new v):addChunk(e,c,t,!0);else if(c.ended)Q(e,new x);else{if(c.destroyed)return!1;c.reading=!1,c.decoder&&!r?(t=c.decoder.write(t),c.objectMode||0!==t.length?addChunk(e,c,t,!1):maybeReadMore(e,c)):addChunk(e,c,t,!1)}else a||(c.reading=!1,maybeReadMore(e,c));return!c.ended&&(c.lengtht.highWaterMark&&(t.highWaterMark=function computeNewHighWaterMark(e){return e>=_?e=_:(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 emitReadable(e){var t=e._readableState;u("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(u("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(emitReadable_,e))}function emitReadable_(e){var t=e._readableState;u("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,flow(e)}function maybeReadMore(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(maybeReadMore_,e,t))}function maybeReadMore_(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function nReadingNextTick(e){u("readable nexttick read 0"),e.read(0)}function resume_(e,t){u("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),flow(e),t.flowing&&!t.reading&&e.read(0)}function flow(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function fromList(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 endReadable(e){var t=e._readableState;u("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(endReadableNT,t,e))}function endReadableNT(e,t){if(u("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 indexOf(e,t){for(var r=0,a=e.length;r=t.highWaterMark:t.length>0)||t.ended))return u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?endReadable(this):emitReadable(this),null;if(0===(e=howMuchToRead(e,t))&&t.ended)return 0===t.length&&endReadable(this),null;var a,n=t.needReadable;return u("need readable",n),(0===t.length||t.length-e0?fromList(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&&endReadable(this)),null!==a&&this.emit("data",a),a},Readable.prototype._read=function(e){Q(this,new C("_read()"))},Readable.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,u("pipe count=%d opts=%j",a.pipesCount,t);var c=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?onend:unpipe;function onunpipe(t,n){u("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,function cleanup(){u("cleanup"),e.removeListener("close",onclose),e.removeListener("finish",onfinish),e.removeListener("drain",s),e.removeListener("error",onerror),e.removeListener("unpipe",onunpipe),r.removeListener("end",onend),r.removeListener("end",unpipe),r.removeListener("data",ondata),d=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}())}function onend(){u("onend"),e.end()}a.endEmitted?n.nextTick(c):r.once("end",c),e.on("unpipe",onunpipe);var s=function pipeOnDrain(e){return function pipeOnDrainFunctionResult(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,flow(e))}}(r);e.on("drain",s);var d=!1;function ondata(t){u("ondata");var n=e.write(t);u("dest.write",n),!1===n&&((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==indexOf(a.pipes,e))&&!d&&(u("false write response, pause",a.awaitDrain),a.awaitDrain++),r.pause())}function onerror(t){u("onerror",t),unpipe(),e.removeListener("error",onerror),0===o(e,"error")&&Q(e,t)}function onclose(){e.removeListener("finish",onfinish),unpipe()}function onfinish(){u("onfinish"),e.removeListener("close",onclose),unpipe()}function unpipe(){u("unpipe"),r.unpipe(e)}return r.on("data",ondata),function prependListener(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",onerror),e.once("close",onclose),e.once("finish",onfinish),e.emit("pipe",r),a.flowing||(u("pipe resume"),r.resume()),e},Readable.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 a=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==a.flowing&&this.resume()):"readable"===e&&(a.endEmitted||a.readableListening||(a.readableListening=a.needReadable=!0,a.flowing=!1,a.emittedReadable=!1,u("on readable",a.length,a.reading),a.length?emitReadable(this):a.reading||n.nextTick(nReadingNextTick,this))),r},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.removeListener=function(e,t){var r=c.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(updateReadableListening,this),r},Readable.prototype.removeAllListeners=function(e){var t=c.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(updateReadableListening,this),t},Readable.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!e.readableListening,function resume(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(resume_,e,t))}(this,e)),e.paused=!1,this},Readable.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},Readable.prototype.wrap=function(e){var t=this,r=this._readableState,a=!1;for(var n in e.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(n){(u("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(a=!0,e.pause()))})),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function methodWrap(t){return function methodWrapReturnFunction(){return e[t].apply(e,arguments)}}(n));for(var o=0;o{"use strict";var a,n=r(1);function CorkedRequest(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function onCorkedFinish(e,t,r){var a=e.entry;e.entry=null;for(;a;){var n=a.callback;t.pendingcb--,n(r),a=a.next}t.corkedRequestsFree.next=e}(t,e)}}e.exports=Writable,Writable.WritableState=WritableState;var o={deprecate:r(729)},c=r(727),s=r(2).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(426),l=r(427).getHighWaterMark,b=r(232).a,g=b.ERR_INVALID_ARG_TYPE,p=b.ERR_METHOD_NOT_IMPLEMENTED,B=b.ERR_MULTIPLE_CALLBACK,m=b.ERR_STREAM_CANNOT_PIPE,I=b.ERR_STREAM_DESTROYED,y=b.ERR_STREAM_NULL_VALUES,x=b.ERR_STREAM_WRITE_AFTER_END,C=b.ERR_UNKNOWN_ENCODING,v=h.errorOrDestroy;function nop(){}function WritableState(e,t,o){a=a||r(157),e=e||{},"boolean"!=typeof o&&(o=t instanceof a),this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=l(this,e,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,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 onwrite(e,t){var r=e._writableState,a=r.sync,o=r.writecb;if("function"!=typeof o)throw new B;if(function onwriteStateUpdate(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function onwriteError(e,t,r,a,o){--t.pendingcb,r?(n.nextTick(o,a),n.nextTick(finishMaybe,e,t),e._writableState.errorEmitted=!0,v(e,a)):(o(a),e._writableState.errorEmitted=!0,v(e,a),finishMaybe(e,t))}(e,r,a,t,o);else{var c=needFinish(r)||e.destroyed;c||r.corked||r.bufferProcessing||!r.bufferedRequest||clearBuffer(e,r),a?n.nextTick(afterWrite,e,r,c,o):afterWrite(e,r,c,o)}}(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 CorkedRequest(this)}function Writable(e){var t=this instanceof(a=a||r(157));if(!t&&!u.call(Writable,this))return new Writable(e);this._writableState=new WritableState(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)),c.call(this)}function doWrite(e,t,r,a,n,o,c){t.writelen=a,t.writecb=c,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new I("write")):r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}function afterWrite(e,t,r,a){r||function onwriteDrain(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,a(),finishMaybe(e,t)}function clearBuffer(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var a=t.bufferedRequestCount,n=new Array(a),o=t.corkedRequestsFree;o.entry=r;for(var c=0,s=!0;r;)n[c]=r,r.isBuf||(s=!1),r=r.next,c+=1;n.allBuffers=s,doWrite(e,t,!0,t.length,n,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new CorkedRequest(t),t.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,u=r.encoding,h=r.callback;if(doWrite(e,t,!1,t.objectMode?1:d.length,d,u,h),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function needFinish(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function callFinal(e,t){e._final((function(r){t.pendingcb--,r&&v(e,r),t.prefinished=!0,e.emit("prefinish"),finishMaybe(e,t)}))}function finishMaybe(e,t){var r=needFinish(t);if(r&&(function prefinish(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,n.nextTick(callFinal,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var a=e._readableState;(!a||a.autoDestroy&&a.endEmitted)&&e.destroy()}return r}r(10)(Writable,c),WritableState.prototype.getBuffer=function getBuffer(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:o.deprecate((function writableStateBufferGetter(){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]?(u=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function value(e){return!!u.call(this,e)||this===Writable&&(e&&e._writableState instanceof WritableState)}})):u=function realHasInstance(e){return e instanceof this},Writable.prototype.pipe=function(){v(this,new m)},Writable.prototype.write=function(e,t,r){var a=this._writableState,o=!1,c=!a.objectMode&&function _isUint8Array(e){return s.isBuffer(e)||e instanceof d}(e);return c&&!s.isBuffer(e)&&(e=function _uint8ArrayToBuffer(e){return s.from(e)}(e)),"function"==typeof t&&(r=t,t=null),c?t="buffer":t||(t=a.defaultEncoding),"function"!=typeof r&&(r=nop),a.ending?function writeAfterEnd(e,t){var r=new x;v(e,r),n.nextTick(t,r)}(this,r):(c||function validChunk(e,t,r,a){var o;return null===r?o=new y:"string"==typeof r||t.objectMode||(o=new g("chunk",["string","Buffer"],r)),!o||(v(e,o),n.nextTick(a,o),!1)}(this,a,e,r))&&(a.pendingcb++,o=function writeOrBuffer(e,t,r,a,n,o){if(!r){var c=function decodeChunk(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=s.from(t,r));return t}(t,a,n);a!==c&&(r=!0,n="buffer",a=c)}var d=t.objectMode?1:a.length;t.length+=d;var u=t.length-1))throw new C(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:!1,get:function get(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function get(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(e,t,r){r(new p("_write()"))},Writable.prototype._writev=null,Writable.prototype.end=function(e,t,r){var a=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),a.corked&&(a.corked=1,this.uncork()),a.ending||function endWritable(e,t,r){t.ending=!0,finishMaybe(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,a,r),this},Object.defineProperty(Writable.prototype,"writableLength",{enumerable:!1,get:function get(){return this._writableState.length}}),Object.defineProperty(Writable.prototype,"destroyed",{enumerable:!1,get:function get(){return void 0!==this._writableState&&this._writableState.destroyed},set:function set(e){this._writableState&&(this._writableState.destroyed=e)}}),Writable.prototype.destroy=h.destroy,Writable.prototype._undestroy=h.undestroy,Writable.prototype._destroy=function(e,t){t(e)}},(e,t,r)=>{"use strict";e.exports=Transform;var a=r(232).a,n=a.ERR_METHOD_NOT_IMPLEMENTED,o=a.ERR_MULTIPLE_CALLBACK,c=a.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=a.ERR_TRANSFORM_WITH_LENGTH_0,d=r(157);function afterTransform(e,t){var r=this._transformState;r.transforming=!1;var a=r.writecb;if(null===a)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),a(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length=l;)e/=2,t/=2,r>>>=1;return(e+r)/t};return prng.int32=function(){return 0|g.g(4)},prng.quick=function(){return g.g(4)/4294967296},prng.double=prng,mixkey(tostring(g.S),o),(t.pass||r||function(e,t,r,a){return a&&(a.S&©(a,g),e.state=function(){return copy(g,{})}),r?(c.random=e,t):e})(prng,b,"global"in t?t.global:this==c,t.state)}function ARC4(e){var t,r=e.length,a=this,n=0,o=a.i=a.j=0,c=a.S=[];for(r||(e=[r++]);n{var a=r(1205),n=r(1212),o=r(736);t.createCipher=t.Cipher=a.createCipher,t.createCipheriv=t.Cipheriv=a.createCipheriv,t.createDecipher=t.Decipher=n.createDecipher,t.createDecipheriv=t.Decipheriv=n.createDecipheriv,t.listCiphers=t.getCiphers=function getCiphers(){return Object.keys(o)}},(e,t,r)=>{var a={ECB:r(1206),CBC:r(1207),CFB:r(1208),CFB8:r(1209),CFB1:r(1210),OFB:r(1211),CTR:r(735),GCM:r(735)},n=r(736);for(var o in n)n[o].module=a[n[o].mode];e.exports=n},(e,t,r)=>{var a=r(11).Buffer;function asUInt32Array(e){a.isBuffer(e)||(e=a.from(e));for(var t=e.length/4|0,r=new Array(t),n=0;n>>24]^h[p>>>16&255]^l[B>>>8&255]^b[255&m]^t[I++],c=u[p>>>24]^h[B>>>16&255]^l[m>>>8&255]^b[255&g]^t[I++],s=u[B>>>24]^h[m>>>16&255]^l[g>>>8&255]^b[255&p]^t[I++],d=u[m>>>24]^h[g>>>16&255]^l[p>>>8&255]^b[255&B]^t[I++],g=o,p=c,B=s,m=d;return o=(a[g>>>24]<<24|a[p>>>16&255]<<16|a[B>>>8&255]<<8|a[255&m])^t[I++],c=(a[p>>>24]<<24|a[B>>>16&255]<<16|a[m>>>8&255]<<8|a[255&g])^t[I++],s=(a[B>>>24]<<24|a[m>>>16&255]<<16|a[g>>>8&255]<<8|a[255&p])^t[I++],d=(a[m>>>24]<<24|a[g>>>16&255]<<16|a[p>>>8&255]<<8|a[255&B])^t[I++],[o>>>=0,c>>>=0,s>>>=0,d>>>=0]}var n=[0,1,2,4,8,16,32,64,128,27,54],o=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var r=[],a=[],n=[[],[],[],[]],o=[[],[],[],[]],c=0,s=0,d=0;d<256;++d){var u=s^s<<1^s<<2^s<<3^s<<4;u=u>>>8^255&u^99,r[c]=u,a[u]=c;var h=e[c],l=e[h],b=e[l],g=257*e[u]^16843008*u;n[0][c]=g<<24|g>>>8,n[1][c]=g<<16|g>>>16,n[2][c]=g<<8|g>>>24,n[3][c]=g,g=16843009*b^65537*l^257*h^16843008*c,o[0][u]=g<<24|g>>>8,o[1][u]=g<<16|g>>>16,o[2][u]=g<<8|g>>>24,o[3][u]=g,0===c?c=s=1:(c=h^e[e[e[b^h]]],s^=e[e[s]])}return{SBOX:r,INV_SBOX:a,SUB_MIX:n,INV_SUB_MIX:o}}();function AES(e){this._key=asUInt32Array(e),this._reset()}AES.blockSize=16,AES.keySize=32,AES.prototype.blockSize=AES.blockSize,AES.prototype.keySize=AES.keySize,AES.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,a=4*(r+1),c=[],s=0;s>>24,d=o.SBOX[d>>>24]<<24|o.SBOX[d>>>16&255]<<16|o.SBOX[d>>>8&255]<<8|o.SBOX[255&d],d^=n[s/t|0]<<24):t>6&&s%t==4&&(d=o.SBOX[d>>>24]<<24|o.SBOX[d>>>16&255]<<16|o.SBOX[d>>>8&255]<<8|o.SBOX[255&d]),c[s]=c[s-t]^d}for(var u=[],h=0;h>>24]]^o.INV_SUB_MIX[1][o.SBOX[b>>>16&255]]^o.INV_SUB_MIX[2][o.SBOX[b>>>8&255]]^o.INV_SUB_MIX[3][o.SBOX[255&b]]}this._nRounds=r,this._keySchedule=c,this._invKeySchedule=u},AES.prototype.encryptBlockRaw=function(e){return cryptBlock(e=asUInt32Array(e),this._keySchedule,o.SUB_MIX,o.SBOX,this._nRounds)},AES.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=a.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},AES.prototype.decryptBlock=function(e){var t=(e=asUInt32Array(e))[1];e[1]=e[3],e[3]=t;var r=cryptBlock(e,this._invKeySchedule,o.INV_SUB_MIX,o.INV_SBOX,this._nRounds),n=a.allocUnsafe(16);return n.writeUInt32BE(r[0],0),n.writeUInt32BE(r[3],4),n.writeUInt32BE(r[2],8),n.writeUInt32BE(r[1],12),n},AES.prototype.scrub=function(){scrubVec(this._keySchedule),scrubVec(this._invKeySchedule),scrubVec(this._key)},e.exports.AES=AES},(e,t,r)=>{"use strict";var a=r(10),n=r(441),o=r(11).Buffer,c=new Array(16);function MD5(){n.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function rotl(e,t){return e<>>32-t}function fnF(e,t,r,a,n,o,c){return rotl(e+(t&r|~t&a)+n+o|0,c)+t|0}function fnG(e,t,r,a,n,o,c){return rotl(e+(t&a|r&~a)+n+o|0,c)+t|0}function fnH(e,t,r,a,n,o,c){return rotl(e+(t^r^a)+n+o|0,c)+t|0}function fnI(e,t,r,a,n,o,c){return rotl(e+(r^(t|~a))+n+o|0,c)+t|0}a(MD5,n),MD5.prototype._update=function(){for(var e=c,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,a=this._b,n=this._c,o=this._d;r=fnF(r,a,n,o,e[0],3614090360,7),o=fnF(o,r,a,n,e[1],3905402710,12),n=fnF(n,o,r,a,e[2],606105819,17),a=fnF(a,n,o,r,e[3],3250441966,22),r=fnF(r,a,n,o,e[4],4118548399,7),o=fnF(o,r,a,n,e[5],1200080426,12),n=fnF(n,o,r,a,e[6],2821735955,17),a=fnF(a,n,o,r,e[7],4249261313,22),r=fnF(r,a,n,o,e[8],1770035416,7),o=fnF(o,r,a,n,e[9],2336552879,12),n=fnF(n,o,r,a,e[10],4294925233,17),a=fnF(a,n,o,r,e[11],2304563134,22),r=fnF(r,a,n,o,e[12],1804603682,7),o=fnF(o,r,a,n,e[13],4254626195,12),n=fnF(n,o,r,a,e[14],2792965006,17),r=fnG(r,a=fnF(a,n,o,r,e[15],1236535329,22),n,o,e[1],4129170786,5),o=fnG(o,r,a,n,e[6],3225465664,9),n=fnG(n,o,r,a,e[11],643717713,14),a=fnG(a,n,o,r,e[0],3921069994,20),r=fnG(r,a,n,o,e[5],3593408605,5),o=fnG(o,r,a,n,e[10],38016083,9),n=fnG(n,o,r,a,e[15],3634488961,14),a=fnG(a,n,o,r,e[4],3889429448,20),r=fnG(r,a,n,o,e[9],568446438,5),o=fnG(o,r,a,n,e[14],3275163606,9),n=fnG(n,o,r,a,e[3],4107603335,14),a=fnG(a,n,o,r,e[8],1163531501,20),r=fnG(r,a,n,o,e[13],2850285829,5),o=fnG(o,r,a,n,e[2],4243563512,9),n=fnG(n,o,r,a,e[7],1735328473,14),r=fnH(r,a=fnG(a,n,o,r,e[12],2368359562,20),n,o,e[5],4294588738,4),o=fnH(o,r,a,n,e[8],2272392833,11),n=fnH(n,o,r,a,e[11],1839030562,16),a=fnH(a,n,o,r,e[14],4259657740,23),r=fnH(r,a,n,o,e[1],2763975236,4),o=fnH(o,r,a,n,e[4],1272893353,11),n=fnH(n,o,r,a,e[7],4139469664,16),a=fnH(a,n,o,r,e[10],3200236656,23),r=fnH(r,a,n,o,e[13],681279174,4),o=fnH(o,r,a,n,e[0],3936430074,11),n=fnH(n,o,r,a,e[3],3572445317,16),a=fnH(a,n,o,r,e[6],76029189,23),r=fnH(r,a,n,o,e[9],3654602809,4),o=fnH(o,r,a,n,e[12],3873151461,11),n=fnH(n,o,r,a,e[15],530742520,16),r=fnI(r,a=fnH(a,n,o,r,e[2],3299628645,23),n,o,e[0],4096336452,6),o=fnI(o,r,a,n,e[7],1126891415,10),n=fnI(n,o,r,a,e[14],2878612391,15),a=fnI(a,n,o,r,e[5],4237533241,21),r=fnI(r,a,n,o,e[12],1700485571,6),o=fnI(o,r,a,n,e[3],2399980690,10),n=fnI(n,o,r,a,e[10],4293915773,15),a=fnI(a,n,o,r,e[1],2240044497,21),r=fnI(r,a,n,o,e[8],1873313359,6),o=fnI(o,r,a,n,e[15],4264355552,10),n=fnI(n,o,r,a,e[6],2734768916,15),a=fnI(a,n,o,r,e[13],1309151649,21),r=fnI(r,a,n,o,e[4],4149444226,6),o=fnI(o,r,a,n,e[11],3174756917,10),n=fnI(n,o,r,a,e[2],718787259,15),a=fnI(a,n,o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+a|0,this._c=this._c+n|0,this._d=this._d+o|0},MD5.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=o.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=MD5},(e,t,r)=>{"use strict";var a=r(2).Buffer,n=r(10),o=r(441),c=new Array(16),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],d=[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],u=[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],h=[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],l=[0,1518500249,1859775393,2400959708,2840853838],b=[1352829926,1548603684,1836072691,2053994217,0];function RIPEMD160(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function rotl(e,t){return e<>>32-t}function fn1(e,t,r,a,n,o,c,s){return rotl(e+(t^r^a)+o+c|0,s)+n|0}function fn2(e,t,r,a,n,o,c,s){return rotl(e+(t&r|~t&a)+o+c|0,s)+n|0}function fn3(e,t,r,a,n,o,c,s){return rotl(e+((t|~r)^a)+o+c|0,s)+n|0}function fn4(e,t,r,a,n,o,c,s){return rotl(e+(t&a|r&~a)+o+c|0,s)+n|0}function fn5(e,t,r,a,n,o,c,s){return rotl(e+(t^(r|~a))+o+c|0,s)+n|0}n(RIPEMD160,o),RIPEMD160.prototype._update=function(){for(var e=c,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,a=0|this._b,n=0|this._c,o=0|this._d,g=0|this._e,p=0|this._a,B=0|this._b,m=0|this._c,I=0|this._d,y=0|this._e,x=0;x<80;x+=1){var C,v;x<16?(C=fn1(r,a,n,o,g,e[s[x]],l[0],u[x]),v=fn5(p,B,m,I,y,e[d[x]],b[0],h[x])):x<32?(C=fn2(r,a,n,o,g,e[s[x]],l[1],u[x]),v=fn4(p,B,m,I,y,e[d[x]],b[1],h[x])):x<48?(C=fn3(r,a,n,o,g,e[s[x]],l[2],u[x]),v=fn3(p,B,m,I,y,e[d[x]],b[2],h[x])):x<64?(C=fn4(r,a,n,o,g,e[s[x]],l[3],u[x]),v=fn2(p,B,m,I,y,e[d[x]],b[3],h[x])):(C=fn5(r,a,n,o,g,e[s[x]],l[4],u[x]),v=fn1(p,B,m,I,y,e[d[x]],b[4],h[x])),r=g,g=o,o=rotl(n,10),n=a,a=C,p=y,y=I,I=rotl(m,10),m=B,B=v}var Q=this._b+n+I|0;this._b=this._c+o+y|0,this._c=this._d+g+p|0,this._d=this._e+r+B|0,this._e=this._a+a+m|0,this._a=Q},RIPEMD160.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=a.alloc?a.alloc(20):new a(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},e.exports=RIPEMD160},(e,t,r)=>{var a=e.exports=function SHA(e){e=e.toLowerCase();var t=a[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};a.sha=r(738),a.sha1=r(739),a.sha224=r(740),a.sha256=r(443),a.sha384=r(741),a.sha512=r(444)},(e,t,r)=>{"use strict";var a=r(70);function Cipher(e){this.options=e,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0}e.exports=Cipher,Cipher.prototype._init=function _init(){},Cipher.prototype.update=function update(e){return 0===e.length?[]:"decrypt"===this.type?this._updateDecrypt(e):this._updateEncrypt(e)},Cipher.prototype._buffer=function _buffer(e,t){for(var r=Math.min(this.buffer.length-this.bufferOff,e.length-t),a=0;a0;a--)t+=this._buffer(e,t),r+=this._flushBuffer(n,r);return t+=this._buffer(e,t),n},Cipher.prototype.final=function final(e){var t,r;return e&&(t=this.update(e)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),t?t.concat(r):r},Cipher.prototype._pad=function _pad(e,t){if(0===t)return!1;for(;t{var a;function Rand(e){this.rand=e}if(e.exports=function rand(e){return a||(a=new Rand(null)),a.generate(e)},e.exports.Rand=Rand,Rand.prototype.generate=function generate(e){return this._rand(e)},Rand.prototype._rand=function _rand(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r{var a=r(2).Buffer,n=r(454),o=r(158);function getr(e){var t,r=e.modulus.byteLength();do{t=new n(o(r))}while(t.cmp(e.modulus)>=0||!t.umod(e.prime1)||!t.umod(e.prime2));return t}function crt(e,t){var r=function blind(e){var t=getr(e);return{blinder:t.toRed(n.mont(e.modulus)).redPow(new n(e.publicExponent)).fromRed(),unblinder:t.invm(e.modulus)}}(t),o=t.modulus.byteLength(),c=new n(e).mul(r.blinder).umod(t.modulus),s=c.toRed(n.mont(t.prime1)),d=c.toRed(n.mont(t.prime2)),u=t.coefficient,h=t.prime1,l=t.prime2,b=s.redPow(t.exponent1).fromRed(),g=d.redPow(t.exponent2).fromRed(),p=b.isub(g).imul(u).umod(h).imul(l);return g.iadd(p).imul(r.unblinder).umod(t.modulus).toArrayLike(a,"be",o)}crt.getr=getr,e.exports=crt},(e,t,r)=>{"use strict";var a=t;a.version=r(1221).a,a.utils=r(71),a.rand=r(327),a.curve=r(456),a.curves=r(330),a.ec=r(761),a.eddsa=r(765)},(e,t,r)=>{"use strict";var a,n=t,o=r(331),c=r(456),s=r(71).assert;function PresetCurve(e){"short"===e.type?this.curve=new c.short(e):"edwards"===e.type?this.curve=new c.edwards(e):this.curve=new c.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function defineCurve(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new PresetCurve(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=PresetCurve,defineCurve("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),defineCurve("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),defineCurve("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),defineCurve("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),defineCurve("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),defineCurve("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{a=r(760)}catch(e){a=void 0}defineCurve("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})},(e,t,r)=>{var a=t;a.utils=r(114),a.common=r(268),a.sha=r(1222),a.ripemd=r(1223),a.hmac=r(759),a.sha1=a.sha.sha1,a.sha256=a.sha.sha256,a.sha224=a.sha.sha224,a.sha384=a.sha.sha384,a.sha512=a.sha.sha512,a.ripemd160=a.ripemd.ripemd160},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(18).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void assert(!1,"Invalid character in "+e)}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=0,c=Math.min(e.length,r),s=t;s=49?d-49+10:d>=17?d-17+10:d,assert(d>=0&&o0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);return this._strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;this._strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,c=o%a,s=Math.min(o,o-c)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{BN.prototype[Symbol.for("nodejs.util.inspect.custom")]=inspect}catch(e){BN.prototype.inspect=inspect}else BN.prototype.inspect=inspect;function inspect(){return(this.red?""}var n=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],o=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,s=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=c[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modrn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16,2)},a&&(BN.prototype.toBuffer=function toBuffer(e,t){return this.toArrayLike(a,e,t)}),BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)};function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],c=n*o,s=67108863&c,d=c/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(c=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&c}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r._strip()}BN.prototype.toArrayLike=function toArrayLike(e,t,r){this._strip();var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0");var o=function allocate(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,n);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,a),o},BN.prototype._toArrayLikeLE=function _toArrayLikeLE(e,t){for(var r=0,a=0,n=0,o=0;n>8&255),r>16&255),6===o?(r>24&255),a=0,o=0):(a=c>>>24,o+=2)}if(r=0&&(e[r--]=c>>8&255),r>=0&&(e[r--]=c>>16&255),6===o?(r>=0&&(e[r--]=c>>24&255),a=0,o=0):(a=c>>>24,o+=2)}if(r>=0)for(e[r--]=a;r>=0;)e[r--]=0},Math.clz32?BN.prototype._countBits=function _countBits(e){return 32-Math.clz32(e)}:BN.prototype._countBits=function _countBits(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this._strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,c=0;c>26,this.words[c]=67108863&t;for(;0!==o&&c>26,this.words[c]=67108863&t;if(0===o&&c>>13,g=0|c[1],p=8191&g,B=g>>>13,m=0|c[2],I=8191&m,y=m>>>13,x=0|c[3],C=8191&x,v=x>>>13,Q=0|c[4],w=8191&Q,_=Q>>>13,k=0|c[5],N=8191&k,D=k>>>13,U=0|c[6],G=8191&U,T=U>>>13,L=0|c[7],q=8191&L,P=L>>>13,O=0|c[8],H=8191&O,Y=O>>>13,J=0|c[9],j=8191&J,z=J>>>13,W=0|s[0],V=8191&W,X=W>>>13,$=0|s[1],et=8191&$,tt=$>>>13,rt=0|s[2],at=8191&rt,it=rt>>>13,nt=0|s[3],ot=8191&nt,At=nt>>>13,ct=0|s[4],st=8191&ct,dt=ct>>>13,ut=0|s[5],ht=8191&ut,bt=ut>>>13,pt=0|s[6],Bt=8191&pt,mt=pt>>>13,It=0|s[7],Et=8191&It,yt=It>>>13,xt=0|s[8],Ct=8191&xt,vt=xt>>>13,Qt=0|s[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(C,V),n=(n=Math.imul(C,X))+Math.imul(v,V)|0,o=Math.imul(v,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(C,et)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(v,et)|0,o=o+Math.imul(v,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,st)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(C,at)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(v,at)|0,o=o+Math.imul(v,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,st)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,st)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,At)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,At)|0,a=a+Math.imul(I,st)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,st)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(q,V),n=(n=Math.imul(q,X))+Math.imul(P,V)|0,o=Math.imul(P,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(C,st)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(v,st)|0,o=o+Math.imul(v,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(q,et)|0,n=(n=n+Math.imul(q,tt)|0)+Math.imul(P,et)|0,o=o+Math.imul(P,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,st)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,st)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,bt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,Ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,vt)|0)+Math.imul(b,Ct)|0))<<13)|0;u=((o=o+Math.imul(b,vt)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(j,V),n=(n=Math.imul(j,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(q,at)|0,n=(n=n+Math.imul(q,it)|0)+Math.imul(P,at)|0,o=o+Math.imul(P,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,st)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,st)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(C,Bt)|0,n=(n=n+Math.imul(C,mt)|0)+Math.imul(v,Bt)|0,o=o+Math.imul(v,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,Ct)|0,n=(n=n+Math.imul(p,vt)|0)+Math.imul(B,Ct)|0,o=o+Math.imul(B,vt)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(j,et),n=(n=Math.imul(j,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(q,ot)|0,n=(n=n+Math.imul(q,At)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,At)|0,a=a+Math.imul(G,st)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,st)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(C,Et)|0,n=(n=n+Math.imul(C,yt)|0)+Math.imul(v,Et)|0,o=o+Math.imul(v,yt)|0,a=a+Math.imul(I,Ct)|0,n=(n=n+Math.imul(I,vt)|0)+Math.imul(y,Ct)|0,o=o+Math.imul(y,vt)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(j,at),n=(n=Math.imul(j,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(q,st)|0,n=(n=n+Math.imul(q,dt)|0)+Math.imul(P,st)|0,o=o+Math.imul(P,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(C,Ct)|0,n=(n=n+Math.imul(C,vt)|0)+Math.imul(v,Ct)|0,o=o+Math.imul(v,vt)|0;var qt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(j,ot),n=(n=Math.imul(j,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,st)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,st)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(q,ht)|0,n=(n=n+Math.imul(q,bt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,Ct)|0,n=(n=n+Math.imul(w,vt)|0)+Math.imul(_,Ct)|0,o=o+Math.imul(_,vt)|0;var Pt=(u+(a=a+Math.imul(C,wt)|0)|0)+((8191&(n=(n=n+Math.imul(C,Mt)|0)+Math.imul(v,wt)|0))<<13)|0;u=((o=o+Math.imul(v,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(j,st),n=(n=Math.imul(j,dt))+Math.imul(z,st)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(q,Bt)|0,n=(n=n+Math.imul(q,mt)|0)+Math.imul(P,Bt)|0,o=o+Math.imul(P,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,Ct)|0,n=(n=n+Math.imul(N,vt)|0)+Math.imul(D,Ct)|0,o=o+Math.imul(D,vt)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(j,ht),n=(n=Math.imul(j,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(q,Et)|0,n=(n=n+Math.imul(q,yt)|0)+Math.imul(P,Et)|0,o=o+Math.imul(P,yt)|0,a=a+Math.imul(G,Ct)|0,n=(n=n+Math.imul(G,vt)|0)+Math.imul(T,Ct)|0,o=o+Math.imul(T,vt)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(j,Bt),n=(n=Math.imul(j,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(q,Ct)|0,n=(n=n+Math.imul(q,vt)|0)+Math.imul(P,Ct)|0,o=o+Math.imul(P,vt)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(j,Et),n=(n=Math.imul(j,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,Ct)|0,n=(n=n+Math.imul(H,vt)|0)+Math.imul(Y,Ct)|0,o=o+Math.imul(Y,vt)|0;var Jt=(u+(a=a+Math.imul(q,wt)|0)|0)+((8191&(n=(n=n+Math.imul(q,Mt)|0)+Math.imul(P,wt)|0))<<13)|0;u=((o=o+Math.imul(P,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(j,Ct),n=(n=Math.imul(j,vt))+Math.imul(z,Ct)|0,o=Math.imul(z,vt);var Kt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863;var jt=(u+(a=Math.imul(j,wt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=qt,d[12]=Pt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=Jt,d[17]=Kt,d[18]=jt,0!==u&&(d[19]=u,r.length++),r};function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,c&=67108863}r.words[o]=s,a=c,c=n}return 0!==a?r.words[o]=a:r.length--,r._strip()}function jumboMulTo(e,t,r){return bigMulTo(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(s=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?s(this,e,t):r<63?smallMulTo(this,e,t):r<1024?bigMulTo(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var c=0;c>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,r+=n/67108864|0,r+=o>>>26,this.words[a]=67108863&o}return 0!==r&&(this.words[a]=r,this.length++),t?this.ineg():this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n&1}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),c=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&c}return s&&0!==u&&(s.words[s.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(s/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===c)return this._strip();for(assert(-1===c),c=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this._strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var c,s=a.length-n.length;if("mod"!==t){(c=new BN(null)).length=s+1,c.words=new Array(c.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);c&&(c.words[h]=l)}return c&&c._strip(),a._strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:c||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modrn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modrn=function modrn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=(1<<26)%e,a=0,n=this.length-1;n>=0;n--)a=(r*a+(0|this.words[n]))%e;return t?-a:a},BN.prototype.modn=function modn(e){return this.modrn(e)},BN.prototype.idivn=function idivn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=0,a=this.length-1;a>=0;a--){var n=(0|this.words[a])+67108864*r;this.words[a]=n/e|0,r=n%e}return this._strip(),t?this.ineg():this},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),c=new BN(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(d),c.isub(u)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(c)):(r.isub(t),o.isub(a),c.isub(n))}return{a:o,b:c,gcd:r.iushln(s)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var s=0,d=1;0==(t.words[0]&d)&&s<26;++s,d<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(c),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,c&=67108863,this.words[o]=c}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=c}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(move(e,e.umod(this.m)._forceRed(this)),e)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),c=o.redNeg(),s=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,s).cmp(c);)d.redIAdd(c);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=s-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++c||0===a&&0===u)&&(n=this.mul(n,r[o]),c=0,o=0)):c=0}s=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},(e,t,r)=>{"use strict";var a,n=r(1),o=r(2),c=o.Buffer,s={};for(a in o)o.hasOwnProperty(a)&&"SlowBuffer"!==a&&"Buffer"!==a&&(s[a]=o[a]);var d=s.Buffer={};for(a in c)c.hasOwnProperty(a)&&"allocUnsafe"!==a&&"allocUnsafeSlow"!==a&&(d[a]=c[a]);if(s.Buffer.prototype=c.prototype,d.from&&d.from!==Uint8Array.from||(d.from=function(e,t,r){if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof e);if(e&&void 0===e.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);return c(e,t,r)}),d.alloc||(d.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError('The "size" argument must be of type number. Received type '+typeof e);if(e<0||e>=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var a=c(e);return t&&0!==t.length?"string"==typeof r?a.fill(t,r):a.fill(t):a.fill(0),a}),!s.kStringMaxLength)try{s.kStringMaxLength=n.binding("buffer").kStringMaxLength}catch(e){}s.constants||(s.constants={MAX_LENGTH:s.kMaxLength},s.kStringMaxLength&&(s.constants.MAX_STRING_LENGTH=s.kStringMaxLength)),e.exports=s},(e,t,r)=>{"use strict";const a=r(462).a,n=r(270).b,o=r(270).a,c=r(70),s=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],d=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(s);function Node(e,t,r){const a={};this._baseState=a,a.name=r,a.enc=e,a.parent=t||null,a.children=null,a.tag=null,a.args=null,a.reverseArgs=null,a.choice=null,a.optional=!1,a.any=!1,a.obj=!1,a.use=null,a.useDecoder=null,a.key=null,a.default=null,a.explicit=null,a.implicit=null,a.contains=null,a.parent||(a.children=[],this._wrap())}e.exports=Node;const u=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];Node.prototype.clone=function clone(){const e=this._baseState,t={};u.forEach((function(r){t[r]=e[r]}));const r=new this.constructor(t.parent);return r._baseState=t,r},Node.prototype._wrap=function wrap(){const e=this._baseState;d.forEach((function(t){this[t]=function _wrappedMethod(){const r=new this.constructor(this);return e.children.push(r),r[t].apply(r,arguments)}}),this)},Node.prototype._init=function init(e){const t=this._baseState;c(null===t.parent),e.call(this),t.children=t.children.filter((function(e){return e._baseState.parent===this}),this),c.equal(t.children.length,1,"Root node can have only one child")},Node.prototype._useArgs=function useArgs(e){const t=this._baseState,r=e.filter((function(e){return e instanceof this.constructor}),this);e=e.filter((function(e){return!(e instanceof this.constructor)}),this),0!==r.length&&(c(null===t.children),t.children=r,r.forEach((function(e){e._baseState.parent=this}),this)),0!==e.length&&(c(null===t.args),t.args=e,t.reverseArgs=e.map((function(e){if("object"!=typeof e||e.constructor!==Object)return e;const t={};return Object.keys(e).forEach((function(r){r==(0|r)&&(r|=0);const a=e[r];t[a]=r})),t})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(e){Node.prototype[e]=function _overrided(){const t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}})),s.forEach((function(e){Node.prototype[e]=function _tagMethod(){const t=this._baseState,r=Array.prototype.slice.call(arguments);return c(null===t.tag),t.tag=e,this._useArgs(r),this}})),Node.prototype.use=function use(e){c(e);const t=this._baseState;return c(null===t.use),t.use=e,this},Node.prototype.optional=function optional(){return this._baseState.optional=!0,this},Node.prototype.def=function def(e){const t=this._baseState;return c(null===t.default),t.default=e,t.optional=!0,this},Node.prototype.explicit=function explicit(e){const t=this._baseState;return c(null===t.explicit&&null===t.implicit),t.explicit=e,this},Node.prototype.implicit=function implicit(e){const t=this._baseState;return c(null===t.explicit&&null===t.implicit),t.implicit=e,this},Node.prototype.obj=function obj(){const e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},Node.prototype.key=function key(e){const t=this._baseState;return c(null===t.key),t.key=e,this},Node.prototype.any=function any(){return this._baseState.any=!0,this},Node.prototype.choice=function choice(e){const t=this._baseState;return c(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map((function(t){return e[t]}))),this},Node.prototype.contains=function contains(e){const t=this._baseState;return c(null===t.use),t.contains=e,this},Node.prototype._decode=function decode(e,t){const r=this._baseState;if(null===r.parent)return e.wrapResult(r.children[0]._decode(e,t));let a,n=r.default,c=!0,s=null;if(null!==r.key&&(s=e.enterKey(r.key)),r.optional){let a=null;if(null!==r.explicit?a=r.explicit:null!==r.implicit?a=r.implicit:null!==r.tag&&(a=r.tag),null!==a||r.any){if(c=this._peekTag(e,a,r.any),e.isError(c))return c}else{const a=e.save();try{null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t),c=!0}catch(e){c=!1}e.restore(a)}}if(r.obj&&c&&(a=e.enterObject()),c){if(null!==r.explicit){const t=this._decodeTag(e,r.explicit);if(e.isError(t))return t;e=t}const a=e.offset;if(null===r.use&&null===r.choice){let t;r.any&&(t=e.save());const a=this._decodeTag(e,null!==r.implicit?r.implicit:r.tag,r.any);if(e.isError(a))return a;r.any?n=e.raw(t):e=a}if(t&&t.track&&null!==r.tag&&t.track(e.path(),a,e.length,"tagged"),t&&t.track&&null!==r.tag&&t.track(e.path(),e.offset,e.length,"content"),r.any||(n=null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t)),e.isError(n))return n;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function decodeChildren(r){r._decode(e,t)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){const a=new o(n);n=this._getUse(r.contains,e._reporterState.obj)._decode(a,t)}}return r.obj&&c&&(n=e.leaveObject(a)),null===r.key||null===n&&!0!==c?null!==s&&e.exitKey(s):e.leaveKey(s,r.key,n),n},Node.prototype._decodeGeneric=function decodeGeneric(e,t,r){const a=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,a.args[0],r):/str$/.test(e)?this._decodeStr(t,e,r):"objid"===e&&a.args?this._decodeObjid(t,a.args[0],a.args[1],r):"objid"===e?this._decodeObjid(t,null,null,r):"gentime"===e||"utctime"===e?this._decodeTime(t,e,r):"null_"===e?this._decodeNull(t,r):"bool"===e?this._decodeBool(t,r):"objDesc"===e?this._decodeStr(t,e,r):"int"===e||"enum"===e?this._decodeInt(t,a.args&&a.args[0],r):null!==a.use?this._getUse(a.use,t._reporterState.obj)._decode(t,r):t.error("unknown tag: "+e)},Node.prototype._getUse=function _getUse(e,t){const r=this._baseState;return r.useDecoder=this._use(e,t),c(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},Node.prototype._decodeChoice=function decodeChoice(e,t){const r=this._baseState;let a=null,n=!1;return Object.keys(r.choice).some((function(o){const c=e.save(),s=r.choice[o];try{const r=s._decode(e,t);if(e.isError(r))return!1;a={type:o,value:r},n=!0}catch(t){return e.restore(c),!1}return!0}),this),n?a:e.error("Choice not matched")},Node.prototype._createEncoderBuffer=function createEncoderBuffer(e){return new n(e,this.reporter)},Node.prototype._encode=function encode(e,t,r){const a=this._baseState;if(null!==a.default&&a.default===e)return;const n=this._encodeValue(e,t,r);return void 0===n||this._skipDefault(n,t,r)?void 0:n},Node.prototype._encodeValue=function encode(e,t,r){const n=this._baseState;if(null===n.parent)return n.children[0]._encode(e,t||new a);let o=null;if(this.reporter=t,n.optional&&void 0===e){if(null===n.default)return;e=n.default}let c=null,s=!1;if(n.any)o=this._createEncoderBuffer(e);else if(n.choice)o=this._encodeChoice(e,t);else if(n.contains)c=this._getUse(n.contains,r)._encode(e,t),s=!0;else if(n.children)c=n.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,t,e);if(null===r._baseState.key)return t.error("Child should have a key");const a=t.enterKey(r._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");const n=r._encode(e[r._baseState.key],t,e);return t.leaveKey(a),n}),this).filter((function(e){return e})),c=this._createEncoderBuffer(c);else if("seqof"===n.tag||"setof"===n.tag){if(!n.args||1!==n.args.length)return t.error("Too many args for : "+n.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");const r=this.clone();r._baseState.implicit=null,c=this._createEncoderBuffer(e.map((function(r){const a=this._baseState;return this._getUse(a.args[0],e)._encode(r,t)}),r))}else null!==n.use?o=this._getUse(n.use,r)._encode(e,t):(c=this._encodePrimitive(n.tag,e),s=!0);if(!n.any&&null===n.choice){const e=null!==n.implicit?n.implicit:n.tag,r=null===n.implicit?"universal":"context";null===e?null===n.use&&t.error("Tag could be omitted only for .use()"):null===n.use&&(o=this._encodeComposite(e,s,r,c))}return null!==n.explicit&&(o=this._encodeComposite(n.explicit,!1,"context",o)),o},Node.prototype._encodeChoice=function encodeChoice(e,t){const r=this._baseState,a=r.choice[e.type];return a||c(!1,e.type+" not found in "+JSON.stringify(Object.keys(r.choice))),a._encode(e.value,t)},Node.prototype._encodePrimitive=function encodePrimitive(e,t){const r=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&r.args)return this._encodeObjid(t,r.reverseArgs[0],r.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,r.args&&r.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},Node.prototype._isNumstr=function isNumstr(e){return/^[0-9 ]*$/.test(e)},Node.prototype._isPrintstr=function isPrintstr(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)}},(e,t,r)=>{"use strict";var a=r(3).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.ecdhUnsafe=t.ecdh=t.recover=t.verify=t.sign=t.signatureImportLax=t.signatureImport=t.signatureExport=t.signatureNormalize=t.publicKeyCombine=t.publicKeyTweakMul=t.publicKeyTweakAdd=t.publicKeyVerify=t.publicKeyConvert=t.publicKeyCreate=t.privateKeyTweakMul=t.privateKeyTweakAdd=t.privateKeyModInverse=t.privateKeyNegate=t.privateKeyImport=t.privateKeyExport=t.privateKeyVerify=void 0;var n=r(127),o=r(1236),c=r(1237);t.privateKeyVerify=function(e){return 32===e.length&&n.privateKeyVerify(Uint8Array.from(e))},t.privateKeyExport=function(e,t){if(32!==e.length)throw new RangeError("private key length is invalid");var r=o.privateKeyExport(e,t);return c.privateKeyExport(e,r,t)},t.privateKeyImport=function(e){if(null!==(e=c.privateKeyImport(e))&&32===e.length&&t.privateKeyVerify(e))return e;throw new Error("couldn't import from DER format")},t.privateKeyNegate=function(e){return a.from(n.privateKeyNegate(Uint8Array.from(e)))},t.privateKeyModInverse=function(e){if(32!==e.length)throw new Error("private key length is invalid");return a.from(o.privateKeyModInverse(Uint8Array.from(e)))},t.privateKeyTweakAdd=function(e,t){return a.from(n.privateKeyTweakAdd(Uint8Array.from(e),t))},t.privateKeyTweakMul=function(e,t){return a.from(n.privateKeyTweakMul(Uint8Array.from(e),Uint8Array.from(t)))},t.publicKeyCreate=function(e,t){return a.from(n.publicKeyCreate(Uint8Array.from(e),t))},t.publicKeyConvert=function(e,t){return a.from(n.publicKeyConvert(Uint8Array.from(e),t))},t.publicKeyVerify=function(e){return(33===e.length||65===e.length)&&n.publicKeyVerify(Uint8Array.from(e))},t.publicKeyTweakAdd=function(e,t,r){return a.from(n.publicKeyTweakAdd(Uint8Array.from(e),Uint8Array.from(t),r))},t.publicKeyTweakMul=function(e,t,r){return a.from(n.publicKeyTweakMul(Uint8Array.from(e),Uint8Array.from(t),r))},t.publicKeyCombine=function(e,t){var r=[];return e.forEach((function(e){r.push(Uint8Array.from(e))})),a.from(n.publicKeyCombine(r,t))},t.signatureNormalize=function(e){return a.from(n.signatureNormalize(Uint8Array.from(e)))},t.signatureExport=function(e){return a.from(n.signatureExport(Uint8Array.from(e)))},t.signatureImport=function(e){return a.from(n.signatureImport(Uint8Array.from(e)))},t.signatureImportLax=function(e){if(0===e.length)throw new RangeError("signature length is invalid");var t=c.signatureImportLax(e);if(null===t)throw new Error("couldn't parse DER signature");return o.signatureImport(t)},t.sign=function(e,t,r){if(null===r)throw new TypeError("options should be an Object");var o=void 0;if(r){if(o={},null===r.data)throw new TypeError("options.data should be a Buffer");if(r.data){if(32!=r.data.length)throw new RangeError("options.data length is invalid");o.data=new Uint8Array(r.data)}if(null===r.noncefn)throw new TypeError("options.noncefn should be a Function");r.noncefn&&(o.noncefn=function(e,t,n,o,c){var s=null!=n?a.from(n):null,d=null!=o?a.from(o):null,u=a.from("");return r.noncefn&&(u=r.noncefn(a.from(e),a.from(t),s,d,c)),new Uint8Array(u)})}var c=n.ecdsaSign(Uint8Array.from(e),Uint8Array.from(t),o);return{signature:a.from(c.signature),recovery:c.recid}},t.verify=function(e,t,r){return n.ecdsaVerify(Uint8Array.from(t),Uint8Array.from(e),r)},t.recover=function(e,t,r,o){return a.from(n.ecdsaRecover(Uint8Array.from(t),r,Uint8Array.from(e),o))},t.ecdh=function(e,t){return a.from(n.ecdh(Uint8Array.from(e),Uint8Array.from(t),{}))},t.ecdhUnsafe=function(e,t,r){if(33!==e.length&&65!==e.length)throw new RangeError("public key length is invalid");if(32!==t.length)throw new RangeError("private key length is invalid");return a.from(o.ecdhUnsafe(Uint8Array.from(e),Uint8Array.from(t),r))}},(e,t,r)=>{"use strict";var a,n=t,o=r(337),c=r(473),s=r(72).assert;function PresetCurve(e){"short"===e.type?this.curve=new c.short(e):"edwards"===e.type?this.curve=new c.edwards(e):this.curve=new c.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function defineCurve(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new PresetCurve(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=PresetCurve,defineCurve("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),defineCurve("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),defineCurve("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),defineCurve("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),defineCurve("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),defineCurve("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{a=r(796)}catch(e){a=void 0}defineCurve("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})},(e,t,r)=>{var a=t;a.utils=r(115),a.common=r(274),a.sha=r(1231),a.ripemd=r(1232),a.hmac=r(795),a.sha1=a.sha.sha1,a.sha256=a.sha.sha256,a.sha224=a.sha.sha224,a.sha384=a.sha.sha384,a.sha512=a.sha.sha512,a.ripemd160=a.ripemd.ripemd160},(e,t,r)=>{"use strict";var a=r(3).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.KECCAK256_RLP=t.KECCAK256_RLP_S=t.KECCAK256_RLP_ARRAY=t.KECCAK256_RLP_ARRAY_S=t.KECCAK256_NULL=t.KECCAK256_NULL_S=t.TWO_POW256=t.MAX_INTEGER=void 0;var n=r(128);t.MAX_INTEGER=new n("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new n("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.KECCAK256_NULL=a.from(t.KECCAK256_NULL_S,"hex"),t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.KECCAK256_RLP_ARRAY=a.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.KECCAK256_RLP=a.from(t.KECCAK256_RLP_S,"hex")},(e,t,r)=>{"use strict";var a=r(340),n=r(276),o=n(a("String.prototype.indexOf"));e.exports=function callBoundIntrinsic(e,t){var r=a(e,!!t);return"function"==typeof r&&o(e,".prototype.")>-1?n(r):r}},(e,t,r)=>{"use strict";var a,n=SyntaxError,o=Function,c=TypeError,getEvalledConstructor=function(e){try{return o('"use strict"; return ('+e+").constructor;")()}catch(e){}},s=Object.getOwnPropertyDescriptor;if(s)try{s({},"")}catch(e){s=null}var throwTypeError=function(){throw new c},d=s?function(){try{return throwTypeError}catch(e){try{return s(arguments,"callee").get}catch(e){return throwTypeError}}}():throwTypeError,u=r(808)(),h=Object.getPrototypeOf||function(e){return e.__proto__},l={},b="undefined"==typeof Uint8Array?a:h(Uint8Array),g={"%AggregateError%":"undefined"==typeof AggregateError?a:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?a:ArrayBuffer,"%ArrayIteratorPrototype%":u?h([][Symbol.iterator]()):a,"%AsyncFromSyncIteratorPrototype%":a,"%AsyncFunction%":l,"%AsyncGenerator%":l,"%AsyncGeneratorFunction%":l,"%AsyncIteratorPrototype%":l,"%Atomics%":"undefined"==typeof Atomics?a:Atomics,"%BigInt%":"undefined"==typeof BigInt?a:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?a:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?a:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?a:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?a:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":l,"%Int8Array%":"undefined"==typeof Int8Array?a:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?a:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?a:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":u?h(h([][Symbol.iterator]())):a,"%JSON%":"object"==typeof JSON?JSON:a,"%Map%":"undefined"==typeof Map?a:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&u?h((new Map)[Symbol.iterator]()):a,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?a:Promise,"%Proxy%":"undefined"==typeof Proxy?a:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?a:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?a:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&u?h((new Set)[Symbol.iterator]()):a,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?a:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":u?h(""[Symbol.iterator]()):a,"%Symbol%":u?Symbol:a,"%SyntaxError%":n,"%ThrowTypeError%":d,"%TypedArray%":b,"%TypeError%":c,"%Uint8Array%":"undefined"==typeof Uint8Array?a:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?a:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?a:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?a:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?a:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?a:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?a:WeakSet},p=function doEval(e){var t;if("%AsyncFunction%"===e)t=getEvalledConstructor("async function () {}");else if("%GeneratorFunction%"===e)t=getEvalledConstructor("function* () {}");else if("%AsyncGeneratorFunction%"===e)t=getEvalledConstructor("async function* () {}");else if("%AsyncGenerator%"===e){var r=doEval("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if("%AsyncIteratorPrototype%"===e){var a=doEval("%AsyncGenerator%");a&&(t=h(a.prototype))}return g[e]=t,t},B={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},m=r(341),I=r(810),y=m.call(Function.call,Array.prototype.concat),x=m.call(Function.apply,Array.prototype.splice),C=m.call(Function.call,String.prototype.replace),v=m.call(Function.call,String.prototype.slice),Q=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,w=/\\(\\)?/g,_=function stringToPath(e){var t=v(e,0,1),r=v(e,-1);if("%"===t&&"%"!==r)throw new n("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new n("invalid intrinsic syntax, expected opening `%`");var a=[];return C(e,Q,(function(e,t,r,n){a[a.length]=r?C(n,w,"$1"):t||e})),a},k=function getBaseIntrinsic(e,t){var r,a=e;if(I(B,a)&&(a="%"+(r=B[a])[0]+"%"),I(g,a)){var o=g[a];if(o===l&&(o=p(a)),void 0===o&&!t)throw new c("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:a,value:o}}throw new n("intrinsic "+e+" does not exist!")};e.exports=function GetIntrinsic(e,t){if("string"!=typeof e||0===e.length)throw new c("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new c('"allowMissing" argument must be a boolean');var r=_(e),a=r.length>0?r[0]:"",o=k("%"+a+"%",t),d=o.name,u=o.value,h=!1,l=o.alias;l&&(a=l[0],x(r,y([0,1],l)));for(var b=1,p=!0;b=r.length){var Q=s(u,B);u=(p=!!Q)&&"get"in Q&&!("originalValue"in Q.get)?Q.get:u[B]}else p=I(u,B),u=u[B];p&&!h&&(g[d]=u)}}return u}},(e,t,r)=>{"use strict";var a=r(809);e.exports=Function.prototype.bind||a},(e,t,r)=>{(t=e.exports=r(492)).Stream=t,t.Readable=t,t.Writable=r(495),t.Duplex=r(183),t.Transform=r(497),t.PassThrough=r(834),t.finished=r(343),t.pipeline=r(835)},(e,t,r)=>{"use strict";var a=r(236).a.ERR_STREAM_PREMATURE_CLOSE;function noop(){}e.exports=function eos(e,t,r){if("function"==typeof t)return eos(e,null,t);t||(t={}),r=function once(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,a=new Array(r),n=0;n{"use strict";var a=r(3).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.assertIsString=t.assertIsArray=t.assertIsBuffer=t.assertIsHexString=void 0;const n=r(91);t.assertIsHexString=function(e){if(!n.isHexString(e)){throw new Error(`This method only supports 0x-prefixed hex strings but input was: ${e}`)}},t.assertIsBuffer=function(e){if(!a.isBuffer(e)){throw new Error(`This method only supports Buffer but input was: ${e}`)}},t.assertIsArray=function(e){if(!Array.isArray(e)){throw new Error(`This method only supports number arrays but input was: ${e}`)}},t.assertIsString=function(e){if("string"!=typeof e){throw new Error(`This method only supports strings but input was: ${e}`)}}},(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseTransaction=t.calculateIntrinsicGas=void 0;const a=r(8),n=r(46),o=r(885),c=1n<<64n-1n;t.calculateIntrinsicGas=(e,t,r)=>{const a=r.hardfork();let n=o.Params.TRANSACTION_GAS;if(t||(n+=o.Params.TRANSACTION_CREATION),e){const t=e.toBuffer(),r=t.byteLength;if(r>0){const e=o.Params.TRANSACTION_DATA_NON_ZERO_GAS.get(a),s=o.Params.TRANSACTION_DATA_ZERO_GAS;let d=0n;for(const e of t)0!==e&&d++;if((c-n)/ea.BUFFER_32_ZERO,nonce:new n.BN(this.nonce.toBuffer()),gasPrice:new n.BN(this.gasPrice.toBuffer()),gasLimit:new n.BN(this.gas.toBuffer()),to:0===t.length?null:{buf:t,equals:e=>t.equals(e.buf)},value:new n.BN(this.value.toBuffer()),data:r,getSenderAddress:()=>({buf:e,equals:t=>e.equals(t.buf)}),getBaseFee:()=>{const e=this.calculateIntrinsicGas();return new n.BN(a.Quantity.from(e).toBuffer())},getUpfrontCost:()=>{const{gas:e,gasPrice:t,value:r}=this;try{const o=e.toBigInt()*t.toBigInt()+r.toBigInt();return new n.BN(a.Quantity.from(o).toBuffer())}catch(e){throw e}}}}calculateIntrinsicGas(){const e=null!=this.to&&!this.to.toBuffer().equals(a.BUFFER_EMPTY);return t.calculateIntrinsicGas(this.data,e,this.common)}}},(e,t,r)=>{"use strict";var a=r(5).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.getLength=t.decode=t.encode=void 0;var n=r(503);function safeParseInt(e,t){if("00"===e.slice(0,2))throw new Error("invalid RLP: extra zeros");return parseInt(e,t)}function encodeLength(e,t){if(e<56)return a.from([e+t]);var r=intToHex(e),n=intToHex(t+55+r.length/2);return a.from(n+r,"hex")}function _decode(e){var t,r,n,o,c,s=[],d=e[0];if(d<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(d<=183){if(t=d-127,n=128===d?a.from([]):e.slice(1,t),2===t&&n[0]<128)throw new Error("invalid rlp encoding: byte must be less 0x80");return{data:n,remainder:e.slice(t)}}if(d<=191){if(r=d-182,e.length-1e.length)throw new Error("invalid rlp: total length is larger than the data");if(0===(o=e.slice(r,u)).length)throw new Error("invalid rlp, List has a invalid length");for(;o.length;)c=_decode(o),s.push(c.data),o=c.remainder;return{data:s,remainder:e.slice(u)}}function isHexPrefixed(e){return"0x"===e.slice(0,2)}function intToHex(e){if(e<0)throw new Error("Invalid integer as argument, must be unsigned!");var t=e.toString(16);return t.length%2?"0"+t:t}function toBuffer(e){if(!a.isBuffer(e)){if("string"==typeof e)return isHexPrefixed(e)?a.from(function padToEven(e){return e.length%2?"0"+e:e}(function stripHexPrefix(e){return"string"!=typeof e?e:isHexPrefixed(e)?e.slice(2):e}(e)),"hex"):a.from(e);if("number"==typeof e||"bigint"==typeof e)return e?function intToBuffer(e){var t=intToHex(e);return a.from(t,"hex")}(e):a.from([]);if(null==e)return a.from([]);if(e instanceof Uint8Array)return a.from(e);if(n.isBN(e))return a.from(e.toArray());throw new Error("invalid type")}return e}t.encode=function encode(e){if(Array.isArray(e)){for(var t=[],r=0;r{"use strict";var a=r(5).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.assertIsString=t.assertIsArray=t.assertIsBuffer=t.assertIsHexString=void 0;const n=r(187);t.assertIsHexString=function(e){if(!n.isHexString(e)){throw new Error(`This method only supports 0x-prefixed hex strings but input was: ${e}`)}},t.assertIsBuffer=function(e){if(!a.isBuffer(e)){throw new Error(`This method only supports Buffer but input was: ${e}`)}},t.assertIsArray=function(e){if(!Array.isArray(e)){throw new Error(`This method only supports number arrays but input was: ${e}`)}},t.assertIsString=function(e){if("string"!=typeof e){throw new Error(`This method only supports strings but input was: ${e}`)}}},(e,t,r)=>{(t=e.exports=r(506)).Stream=t,t.Readable=t,t.Writable=r(509),t.Duplex=r(188),t.Transform=r(511),t.PassThrough=r(858),t.finished=r(349),t.pipeline=r(859)},(e,t,r)=>{"use strict";var a=r(238).a.ERR_STREAM_PREMATURE_CLOSE;function noop(){}e.exports=function eos(e,t,r){if("function"==typeof t)return eos(e,null,t);t||(t={}),r=function once(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,a=new Array(r),n=0;n{"use strict";var a,n=t,o=r(351),c=r(518),s=r(78).assert;function PresetCurve(e){"short"===e.type?this.curve=new c.short(e):"edwards"===e.type?this.curve=new c.edwards(e):this.curve=new c.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function defineCurve(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new PresetCurve(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=PresetCurve,defineCurve("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),defineCurve("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),defineCurve("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),defineCurve("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),defineCurve("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),defineCurve("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{a=r(877)}catch(e){a=void 0}defineCurve("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})},(e,t,r)=>{var a=t;a.utils=r(116),a.common=r(280),a.sha=r(1264),a.ripemd=r(1265),a.hmac=r(876),a.sha1=a.sha.sha1,a.sha256=a.sha.sha256,a.sha224=a.sha.sha224,a.sha384=a.sha.sha384,a.sha512=a.sha.sha512,a.ripemd160=a.ripemd.ripemd160},()=>{},(e,t,r)=>{"use strict";var a=r(2).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.getLength=t.decode=t.encode=void 0;var n=r(523);function safeParseInt(e,t){if("00"===e.slice(0,2))throw new Error("invalid RLP: extra zeros");return parseInt(e,t)}function encodeLength(e,t){if(e<56)return a.from([e+t]);var r=intToHex(e),n=intToHex(t+55+r.length/2);return a.from(n+r,"hex")}function _decode(e){var t,r,n,o,c,s=[],d=e[0];if(d<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(d<=183){if(t=d-127,n=128===d?a.from([]):e.slice(1,t),2===t&&n[0]<128)throw new Error("invalid rlp encoding: byte must be less 0x80");return{data:n,remainder:e.slice(t)}}if(d<=191){if(r=d-182,e.length-1e.length)throw new Error("invalid rlp: total length is larger than the data");if(0===(o=e.slice(r,u)).length)throw new Error("invalid rlp, List has a invalid length");for(;o.length;)c=_decode(o),s.push(c.data),o=c.remainder;return{data:s,remainder:e.slice(u)}}function isHexPrefixed(e){return"0x"===e.slice(0,2)}function intToHex(e){if(e<0)throw new Error("Invalid integer as argument, must be unsigned!");var t=e.toString(16);return t.length%2?"0"+t:t}function toBuffer(e){if(!a.isBuffer(e)){if("string"==typeof e)return isHexPrefixed(e)?a.from(function padToEven(e){return e.length%2?"0"+e:e}(function stripHexPrefix(e){return"string"!=typeof e?e:isHexPrefixed(e)?e.slice(2):e}(e)),"hex"):a.from(e);if("number"==typeof e||"bigint"==typeof e)return e?function intToBuffer(e){var t=intToHex(e);return a.from(t,"hex")}(e):a.from([]);if(null==e)return a.from([]);if(e instanceof Uint8Array)return a.from(e);if(n.isBN(e))return a.from(e.toArray());throw new Error("invalid type")}return e}t.encode=function encode(e){if(Array.isArray(e)){for(var t=[],r=0;r{"use strict";var a=r(2).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.assertIsString=t.assertIsArray=t.assertIsBuffer=t.assertIsHexString=void 0;const n=r(191);t.assertIsHexString=function(e){if(!n.isHexString(e)){throw new Error(`This method only supports 0x-prefixed hex strings but input was: ${e}`)}},t.assertIsBuffer=function(e){if(!a.isBuffer(e)){throw new Error(`This method only supports Buffer but input was: ${e}`)}},t.assertIsArray=function(e){if(!Array.isArray(e)){throw new Error(`This method only supports number arrays but input was: ${e}`)}},t.assertIsString=function(e){if("string"!=typeof e){throw new Error(`This method only supports strings but input was: ${e}`)}}},(e,t,r)=>{(t=e.exports=r(526)).Stream=t,t.Readable=t,t.Writable=r(529),t.Duplex=r(192),t.Transform=r(531),t.PassThrough=r(903),t.finished=r(356),t.pipeline=r(904)},(e,t,r)=>{"use strict";var a=r(242).a.ERR_STREAM_PREMATURE_CLOSE;function noop(){}e.exports=function eos(e,t,r){if("function"==typeof t)return eos(e,null,t);t||(t={}),r=function once(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,a=new Array(r),n=0;n{"use strict";var a,n=t,o=r(358),c=r(537),s=r(80).assert;function PresetCurve(e){"short"===e.type?this.curve=new c.short(e):"edwards"===e.type?this.curve=new c.edwards(e):this.curve=new c.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function defineCurve(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new PresetCurve(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=PresetCurve,defineCurve("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),defineCurve("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),defineCurve("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),defineCurve("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),defineCurve("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),defineCurve("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{a=r(923)}catch(e){a=void 0}defineCurve("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})},(e,t,r)=>{var a=t;a.utils=r(117),a.common=r(284),a.sha=r(1279),a.ripemd=r(1280),a.hmac=r(922),a.sha1=a.sha.sha1,a.sha256=a.sha.sha256,a.sha224=a.sha.sha224,a.sha384=a.sha.sha384,a.sha512=a.sha.sha512,a.ripemd160=a.ripemd.ripemd160},(e,t,r)=>{"use strict";var a=r(0).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.assertIsString=t.assertIsArray=t.assertIsBuffer=t.assertIsHexString=void 0;const n=r(17);t.assertIsHexString=function(e){if(!n.isHexString(e)){throw new Error(`This method only supports 0x-prefixed hex strings but input was: ${e}`)}},t.assertIsBuffer=function(e){if(!a.isBuffer(e)){throw new Error(`This method only supports Buffer but input was: ${e}`)}},t.assertIsArray=function(e){if(!Array.isArray(e)){throw new Error(`This method only supports number arrays but input was: ${e}`)}},t.assertIsString=function(e){if("string"!=typeof e){throw new Error(`This method only supports strings but input was: ${e}`)}}},(e,t,r)=>{"use strict";var a=r(246).a.ERR_STREAM_PREMATURE_CLOSE;function noop(){}e.exports=function eos(e,t,r){if("function"==typeof t)return eos(e,null,t);t||(t={}),r=function once(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,a=new Array(r),n=0;n{"use strict";var a=t;a.version=r(1289).a,a.utils=r(82),a.rand=r(362),a.curve=r(558),a.curves=r(363),a.ec=r(960),a.eddsa=r(964)},(e,t,r)=>{var a;function Rand(e){this.rand=e}if(e.exports=function rand(e){return a||(a=new Rand(null)),a.generate(e)},e.exports.Rand=Rand,Rand.prototype.generate=function generate(e){return this._rand(e)},Rand.prototype._rand=function _rand(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r{"use strict";var a,n=t,o=r(364),c=r(558),s=r(82).assert;function PresetCurve(e){"short"===e.type?this.curve=new c.short(e):"edwards"===e.type?this.curve=new c.edwards(e):this.curve=new c.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function defineCurve(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new PresetCurve(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=PresetCurve,defineCurve("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),defineCurve("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),defineCurve("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),defineCurve("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),defineCurve("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),defineCurve("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{a=r(959)}catch(e){a=void 0}defineCurve("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})},(e,t,r)=>{var a=t;a.utils=r(118),a.common=r(287),a.sha=r(1290),a.ripemd=r(1291),a.hmac=r(958),a.sha1=a.sha.sha1,a.sha256=a.sha.sha256,a.sha224=a.sha.sha224,a.sha384=a.sha.sha384,a.sha512=a.sha.sha512,a.ripemd160=a.ripemd.ripemd160},(e,t,r)=>{"use strict";var a=r(1),n=65536,o=4294967295;var c=r(22).Buffer,s=r.g.crypto||r.g.msCrypto;s&&s.getRandomValues?e.exports=function randomBytes(e,t){if(e>o)throw new RangeError("requested too many random bytes");var r=c.allocUnsafe(e);if(e>0)if(e>n)for(var d=0;d=l;)e/=2,t/=2,r>>>=1;return(e+r)/t};return prng.int32=function(){return 0|g.g(4)},prng.quick=function(){return g.g(4)/4294967296},prng.double=prng,mixkey(tostring(g.S),o),(t.pass||r||function(e,t,r,a){return a&&(a.S&©(a,g),e.state=function(){return copy(g,{})}),r?(c.random=e,t):e})(prng,b,"global"in t?t.global:this==c,t.state)}function ARC4(e){var t,r=e.length,a=this,n=0,o=a.i=a.j=0,c=a.S=[];for(r||(e=[r++]);n{const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=e.length;return(r,a)=>{let n="";for(let o=0;o,`, can be specified multiple times. Note that private keys are 64 characters long and must be entered as an 0x-prefixed hex string. Balance can either be input as an integer, or as a 0x-prefixed hex string with either form specifying the initial balance in wei.",legacyName:"accounts",cliAliases:["account"],cliType:"array:string",cliCoerce:e=>e.map((e=>{const[t,r]=e.split(/,(.+)/);return{secretKey:t,balance:BigInt(r)}})),conflicts:["totalAccounts"]},totalAccounts:{normalize:o.normalize,cliDescription:"Number of accounts to generate at startup.",default:e=>null==e.accounts?10:0,legacyName:"total_accounts",cliAliases:["a","accounts"],cliType:"number",conflicts:["accounts"]},deterministic:{normalize:o.normalize,cliDescription:"Use pre-defined, deterministic seed.",default:()=>!1,cliAliases:["d","deterministic"],cliType:"boolean",conflicts:["mnemonic","seed"]},seed:{normalize:o.normalize,cliDescription:"Seed to use to generate a mnemonic.",default:e=>!0===e.deterministic?d.DeterministicSeedPhrase:h(10,u),defaultDescription:"Random value, unless wallet.deterministic is specified",legacyName:"seed",cliAliases:["s","seed"],cliType:"string",conflicts:["mnemonic","deterministic"]},mnemonic:{normalize:o.normalize,cliDescription:"Use a specific HD wallet mnemonic to generate initial addresses.",default:e=>s.entropyToMnemonic(function notVeryRandomBytes(e,t){const r=a.allocUnsafe(e);for(let a=0;a!1,legacyName:"secure",cliAliases:["n","secure"],cliType:"boolean"},accountKeysPath:{normalize:o.normalize,cliDescription:"Specifies a file to save accounts and private keys to, for testing.",legacyName:"account_keys_path",cliAliases:["account_keys_path","acctKeys"],cliType:"string"},defaultBalance:{normalize:o.normalize,cliDescription:"The default account balance, specified in ether.",default:()=>1e3,legacyName:"default_balance_ether",cliAliases:["e","defaultBalanceEther"],cliType:"number"},hdPath:{normalize:o.normalize,cliDescription:"The hierarchical deterministic path to use when generating accounts.",default:()=>"m/44'/60'/0'/0/",legacyName:"hd_path",cliType:"string"}}},function(e,t,r){var a;!function(n,o,c){var s,d=256,u=c.pow(d,6),h=c.pow(2,52),l=2*h,b=255;function seedrandom(e,t,r){var a=[],b=mixkey(flatten((t=1==t?{entropy:!0}:t||{}).entropy?[e,tostring(o)]:null==e?function autoseed(){try{var e;return s&&(e=s.randomBytes)?e=e(d):(e=new Uint8Array(d),(n.crypto||n.msCrypto).getRandomValues(e)),tostring(e)}catch(e){var t=n.navigator,r=t&&t.plugins;return[+new Date,n,r,n.screen,tostring(o)]}}():e,3),a),g=new ARC4(a),prng=function(){for(var e=g.g(6),t=u,r=0;e=l;)e/=2,t/=2,r>>>=1;return(e+r)/t};return prng.int32=function(){return 0|g.g(4)},prng.quick=function(){return g.g(4)/4294967296},prng.double=prng,mixkey(tostring(g.S),o),(t.pass||r||function(e,t,r,a){return a&&(a.S&©(a,g),e.state=function(){return copy(g,{})}),r?(c.random=e,t):e})(prng,b,"global"in t?t.global:this==c,t.state)}function ARC4(e){var t,r=e.length,a=this,n=0,o=a.i=a.j=0,c=a.S=[];for(r||(e=[r++]);n{(t=e.exports=r(582)).Stream=t,t.Readable=t,t.Writable=r(585),t.Duplex=r(200),t.Transform=r(587),t.PassThrough=r(991),t.finished=r(371),t.pipeline=r(992)},(e,t,r)=>{"use strict";var a=r(248).a.ERR_STREAM_PREMATURE_CLOSE;function noop(){}e.exports=function eos(e,t,r){if("function"==typeof t)return eos(e,null,t);t||(t={}),r=function once(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,a=new Array(r),n=0;n{"use strict";t.__esModule=!0;var a=r(249);t.default=a.default,function __export(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(597))},(e,t,r)=>{"use strict";var a=r(0).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.assertIsString=t.assertIsArray=t.assertIsBuffer=t.assertIsHexString=void 0;var n=r(17);t.assertIsHexString=function(e){if(!n.isHexString(e))throw new Error("This method only supports 0x-prefixed hex strings but input was: "+e)},t.assertIsBuffer=function(e){if(!a.isBuffer(e))throw new Error("This method only supports Buffer but input was: "+e)},t.assertIsArray=function(e){if(!Array.isArray(e))throw new Error("This method only supports number arrays but input was: "+e)},t.assertIsString=function(e){if("string"!=typeof e)throw new Error("This method only supports strings but input was: "+e)}},(e,t,r)=>{e.exports=r(1002)(r(1014))},(e,t,r)=>{var a=r(1),n=r(34).EventEmitter,o=r(40).inherits,c=r(204),s=r(1003),d=r(1009),u=r(1010),h=r(376),l=r(289),b=r(6),g=r(604),p=r(378).a,B=r(378).b,m=h.WriteError,I=h.ReadError,y=h.NotFoundError,x=h.OpenError,C=h.InitializationError;function LevelUP(e,t,r){if(!(this instanceof LevelUP))return new LevelUP(e,t,r);var o,c=this;if(n.call(this),this.setMaxListeners(1/0),"function"==typeof t&&(r=t,t={}),t=t||{},!e||"object"!=typeof e){if(o=new C("First argument must be an abstract-leveldown compliant store"),"function"==typeof r)return a.nextTick(r,o);throw o}b.strictEqual(typeof e.status,"string",".status required, old abstract-leveldown"),this.options=B(t),this._db=e,this.db=new s(e),this.open(r||function(e){e&&c.emit("error",e)}),this.supports=l(this.db.supports,{status:!1,deferredOpen:!0,openCallback:!0,promises:!0,streams:!0}),Object.keys(this.supports.additionalMethods).forEach((function(e){null==this[e]&&(this[e]=function(){return this.db[e].apply(this.db,arguments)})}),this)}function maybeError(e,t){if(!e._isOpening()&&!e.isOpen())return a.nextTick(t,new I("Database is not open")),!0}LevelUP.prototype.emit=n.prototype.emit,LevelUP.prototype.once=n.prototype.once,o(LevelUP,n),LevelUP.prototype.open=function(e,t){var r,n=this;return"function"==typeof e&&(t=e,e=null),t||(r=(t=g()).promise),e||(e=this.options),this.isOpen()?(a.nextTick(t,null,n),r):this._isOpening()?(this.once("open",(function(){t(null,n)})),r):(this.emit("opening"),this.db.open(e,(function(e){if(e)return t(new x(e));n.db=n._db,t(null,n),n.emit("open"),n.emit("ready")})),r)},LevelUP.prototype.close=function(e){var t,r=this;return e||(t=(e=g()).promise),this.isOpen()?(this.db.close((function(){r.emit("closed"),e.apply(null,arguments)})),this.emit("closing"),this.db=new s(this._db)):this.isClosed()?a.nextTick(e):"closing"===this.db.status?this.once("closed",e):this._isOpening()&&this.once("open",(function(){r.close(e)})),t},LevelUP.prototype.isOpen=function(){return"open"===this.db.status},LevelUP.prototype._isOpening=function(){return"opening"===this.db.status},LevelUP.prototype.isClosed=function(){return/^clos|new/.test(this.db.status)},LevelUP.prototype.get=function(e,t,r){var a;return(r=p(t,r))||(a=(r=g()).promise),maybeError(this,r)||(t=B(t),this.db.get(e,t,(function(t,a){if(t)return t=/notfound/i.test(t)||t.notFound?new y("Key not found in database ["+e+"]",t):new I(t),r(t);r(null,a)}))),a},LevelUP.prototype.put=function(e,t,r,a){var n,o=this;return(a=p(r,a))||(n=(a=g()).promise),maybeError(this,a)||(r=B(r),this.db.put(e,t,r,(function(r){if(r)return a(new m(r));o.emit("put",e,t),a()}))),n},LevelUP.prototype.del=function(e,t,r){var a,n=this;return(r=p(t,r))||(a=(r=g()).promise),maybeError(this,r)||(t=B(t),this.db.del(e,t,(function(t){if(t)return r(new m(t));n.emit("del",e),r()}))),a},LevelUP.prototype.batch=function(e,t,r){if(!arguments.length)return new u(this);var a,n=this;return(r="function"==typeof e?e:p(t,r))||(a=(r=g()).promise),maybeError(this,r)||(t=B(t),this.db.batch(e,t,(function(t){if(t)return r(new m(t));n.emit("batch",e),r()}))),a},LevelUP.prototype.iterator=function(e){return this.db.iterator(e)},LevelUP.prototype.clear=function(e,t){var r,a=this;return t=p(e,t),e=B(e),t||(r=(t=g()).promise),maybeError(this,t)||this.db.clear(e,(function(r){if(r)return t(new m(r));a.emit("clear",e),t()})),r},LevelUP.prototype.readStream=LevelUP.prototype.createReadStream=function(e){return"number"!=typeof(e=c({keys:!0,values:!0},e)).limit&&(e.limit=-1),new d(this.db.iterator(e),e)},LevelUP.prototype.keyStream=LevelUP.prototype.createKeyStream=function(e){return this.createReadStream(c(e,{keys:!0,values:!1}))},LevelUP.prototype.valueStream=LevelUP.prototype.createValueStream=function(e){return this.createReadStream(c(e,{keys:!1,values:!0}))},LevelUP.prototype.toString=function(){return"LevelUP"},LevelUP.prototype.type="levelup",LevelUP.errors=h,e.exports=LevelUP.default=LevelUP},(e,t,r)=>{var a=r(290).create,n=a("LevelUPError"),o=a("NotFoundError",n);o.prototype.notFound=!0,o.prototype.status=404,e.exports={LevelUPError:n,InitializationError:a("InitializationError",n),OpenError:a("OpenError",n),ReadError:a("ReadError",n),WriteError:a("WriteError",n),NotFoundError:o,EncodingError:a("EncodingError",n)}},function(e){var t,r;t=this,r=function(){var e="function"==typeof Object.defineProperty?function(e,t,r){return Object.defineProperty(e,t,r),e}:function(e,t,r){return e[t]=r.value,e};return function(t,r,a,n){var o;if(n=function(e,t){var r="object"==typeof t,a=!r&&"string"==typeof t,op=function(e){return r?!!t[e]:!!a&&t.indexOf(e[0])>-1};return{enumerable:op("enumerable"),configurable:op("configurable"),writable:op("writable"),value:e}}(a,n),"object"==typeof r){for(o in r)Object.hasOwnProperty.call(r,o)&&(n.value=r[o],e(t,o,n));return t}return e(t,r,n)}},e.exports?e.exports=r():t.prr=r()},(e,t)=>{t.a=function(e,t){return"function"==typeof e?e:t},t.b=function(e){return"object"==typeof e&&null!==e?e:{}}},(e,t,r)=>{"use strict";var a=r(380).AbstractLevelDOWN,n=r(380).AbstractChainedBatch,o=r(380).AbstractIterator,c=r(15),s=r(1013),d=r(376).EncodingError,u=["approximateSize","compactRange"];function DB(e,t){if(!(this instanceof DB))return new DB(e,t);var r=e.supports||{},n=r.additionalMethods||{};a.call(this,r),this.supports.encodings=!0,this.supports.additionalMethods={},u.forEach((function(t){var r="function"==typeof e[t];(n[t]||r)&&(this.supports.additionalMethods[t]=!0,this[t]=function(e,r,a,n){return e=this.codec.encodeKey(e,a),r=this.codec.encodeKey(r,a),this.db[t](e,r,a,n)})}),this),void 0===(t=t||{}).keyEncoding&&(t.keyEncoding="utf8"),void 0===t.valueEncoding&&(t.valueEncoding="utf8"),this.db=e,this.codec=new s(t)}function Iterator(e,t){o.call(this,e),this.codec=e.codec,this.keys=t.keys,this.values=t.values,this.opts=this.codec.encodeLtgt(t),this.it=e.db.iterator(this.opts)}function Batch(e,t){n.call(this,e),this.codec=e.codec,this.batch=e.db.batch()}e.exports=DB.default=DB,c(DB,a),DB.prototype.type="encoding-down",DB.prototype._serializeKey=DB.prototype._serializeValue=function(e){return e},DB.prototype._open=function(e,t){this.db.open(e,t)},DB.prototype._close=function(e){this.db.close(e)},DB.prototype._put=function(e,t,r,a){e=this.codec.encodeKey(e,r),t=this.codec.encodeValue(t,r),this.db.put(e,t,r,a)},DB.prototype._get=function(e,t,r){var a=this;e=this.codec.encodeKey(e,t),t.asBuffer=this.codec.valueAsBuffer(t),this.db.get(e,t,(function(e,n){if(e)return r(e);try{n=a.codec.decodeValue(n,t)}catch(e){return r(new d(e))}r(null,n)}))},DB.prototype._del=function(e,t,r){e=this.codec.encodeKey(e,t),this.db.del(e,t,r)},DB.prototype._chainedBatch=function(){return new Batch(this)},DB.prototype._batch=function(e,t,r){e=this.codec.encodeBatch(e,t),this.db.batch(e,t,r)},DB.prototype._iterator=function(e){return e.keyAsBuffer=this.codec.keyAsBuffer(e),e.valueAsBuffer=this.codec.valueAsBuffer(e),new Iterator(this,e)},DB.prototype._clear=function(e,t){e=this.codec.encodeLtgt(e),this.db.clear(e,t)},c(Iterator,o),Iterator.prototype._next=function(e){var t=this;this.it.next((function(r,a,n){if(r)return e(r);try{a=t.keys&&void 0!==a?t.codec.decodeKey(a,t.opts):void 0,n=t.values&&void 0!==n?t.codec.decodeValue(n,t.opts):void 0}catch(r){return e(new d(r))}e(null,a,n)}))},Iterator.prototype._seek=function(e){e=this.codec.encodeKey(e,this.opts),this.it.seek(e)},Iterator.prototype._end=function(e){this.it.end(e)},c(Batch,n),Batch.prototype._put=function(e,t){e=this.codec.encodeKey(e),t=this.codec.encodeValue(t),this.batch.put(e,t)},Batch.prototype._del=function(e){e=this.codec.encodeKey(e),this.batch.del(e)},Batch.prototype._clear=function(){this.batch.clear()},Batch.prototype._write=function(e,t){this.batch.write(e,t)}},(e,t,r)=>{t.AbstractLevelDOWN=r(1012),t.AbstractIterator=r(605),t.AbstractChainedBatch=r(607)},e=>{"use strict";e.exports=function createRBTree(e){return new RedBlackTree(e||defaultCompare,null)};function RBNode(e,t,r,a,n,o){this._color=e,this.key=t,this.value=r,this.left=a,this.right=n,this._count=o}function cloneNode(e){return new RBNode(e._color,e.key,e.value,e.left,e.right,e._count)}function repaint(e,t){return new RBNode(e,t.key,t.value,t.left,t.right,t._count)}function recount(e){e._count=1+(e.left?e.left._count:0)+(e.right?e.right._count:0)}function RedBlackTree(e,t){this._compare=e,this.root=t}var t=RedBlackTree.prototype;function doVisitFull(e,t){var r;if(t.left&&(r=doVisitFull(e,t.left)))return r;return(r=e(t.key,t.value))||(t.right?doVisitFull(e,t.right):void 0)}function doVisitHalf(e,t,r,a){if(t(e,a.key)<=0){var n;if(a.left)if(n=doVisitHalf(e,t,r,a.left))return n;if(n=r(a.key,a.value))return n}if(a.right)return doVisitHalf(e,t,r,a.right)}function doVisit(e,t,r,a,n){var o,c=r(e,n.key),s=r(t,n.key);if(c<=0){if(n.left&&(o=doVisit(e,t,r,a,n.left)))return o;if(s>0&&(o=a(n.key,n.value)))return o}if(s>0&&n.right)return doVisit(e,t,r,a,n.right)}function RedBlackTreeIterator(e,t){this.tree=e,this._stack=t}Object.defineProperty(t,"keys",{get:function(){var e=[];return this.forEach((function(t,r){e.push(t)})),e}}),Object.defineProperty(t,"values",{get:function(){var e=[];return this.forEach((function(t,r){e.push(r)})),e}}),Object.defineProperty(t,"length",{get:function(){return this.root?this.root._count:0}}),t.insert=function(e,t){for(var r=this._compare,a=this.root,n=[],o=[];a;){var c=r(e,a.key);n.push(a),o.push(c),a=c<=0?a.left:a.right}n.push(new RBNode(0,e,t,null,null,1));for(var s=n.length-2;s>=0;--s){a=n[s];o[s]<=0?n[s]=new RBNode(a._color,a.key,a.value,n[s+1],a.right,a._count+1):n[s]=new RBNode(a._color,a.key,a.value,a.left,n[s+1],a._count+1)}for(s=n.length-1;s>1;--s){var d=n[s-1];a=n[s];if(1===d._color||1===a._color)break;var u=n[s-2];if(u.left===d)if(d.left===a){if(!(h=u.right)||0!==h._color){if(u._color=0,u.left=d.right,d._color=1,d.right=u,n[s-2]=d,n[s-1]=a,recount(u),recount(d),s>=3)(l=n[s-3]).left===u?l.left=d:l.right=d;break}d._color=1,u.right=repaint(1,h),u._color=0,s-=1}else{if(!(h=u.right)||0!==h._color){if(d.right=a.left,u._color=0,u.left=a.right,a._color=1,a.left=d,a.right=u,n[s-2]=a,n[s-1]=d,recount(u),recount(d),recount(a),s>=3)(l=n[s-3]).left===u?l.left=a:l.right=a;break}d._color=1,u.right=repaint(1,h),u._color=0,s-=1}else if(d.right===a){if(!(h=u.left)||0!==h._color){if(u._color=0,u.right=d.left,d._color=1,d.left=u,n[s-2]=d,n[s-1]=a,recount(u),recount(d),s>=3)(l=n[s-3]).right===u?l.right=d:l.left=d;break}d._color=1,u.left=repaint(1,h),u._color=0,s-=1}else{var h;if(!(h=u.left)||0!==h._color){var l;if(d.left=a.right,u._color=0,u.right=a.left,a._color=1,a.right=d,a.left=u,n[s-2]=a,n[s-1]=d,recount(u),recount(d),recount(a),s>=3)(l=n[s-3]).right===u?l.right=a:l.left=a;break}d._color=1,u.left=repaint(1,h),u._color=0,s-=1}}return n[0]._color=1,new RedBlackTree(r,n[0])},t.forEach=function rbTreeForEach(e,t,r){if(this.root)switch(arguments.length){case 1:return doVisitFull(e,this.root);case 2:return doVisitHalf(t,this._compare,e,this.root);case 3:if(this._compare(t,r)>=0)return;return doVisit(t,r,this._compare,e,this.root)}},Object.defineProperty(t,"begin",{get:function(){for(var e=[],t=this.root;t;)e.push(t),t=t.left;return new RedBlackTreeIterator(this,e)}}),Object.defineProperty(t,"end",{get:function(){for(var e=[],t=this.root;t;)e.push(t),t=t.right;return new RedBlackTreeIterator(this,e)}}),t.at=function(e){if(e<0)return new RedBlackTreeIterator(this,[]);for(var t=this.root,r=[];;){if(r.push(t),t.left){if(e=t.right._count)break;t=t.right}return new RedBlackTreeIterator(this,[])},t.ge=function(e){for(var t=this._compare,r=this.root,a=[],n=0;r;){var o=t(e,r.key);a.push(r),o<=0&&(n=a.length),r=o<=0?r.left:r.right}return a.length=n,new RedBlackTreeIterator(this,a)},t.gt=function(e){for(var t=this._compare,r=this.root,a=[],n=0;r;){var o=t(e,r.key);a.push(r),o<0&&(n=a.length),r=o<0?r.left:r.right}return a.length=n,new RedBlackTreeIterator(this,a)},t.lt=function(e){for(var t=this._compare,r=this.root,a=[],n=0;r;){var o=t(e,r.key);a.push(r),o>0&&(n=a.length),r=o<=0?r.left:r.right}return a.length=n,new RedBlackTreeIterator(this,a)},t.le=function(e){for(var t=this._compare,r=this.root,a=[],n=0;r;){var o=t(e,r.key);a.push(r),o>=0&&(n=a.length),r=o<0?r.left:r.right}return a.length=n,new RedBlackTreeIterator(this,a)},t.find=function(e){for(var t=this._compare,r=this.root,a=[];r;){var n=t(e,r.key);if(a.push(r),0===n)return new RedBlackTreeIterator(this,a);r=n<=0?r.left:r.right}return new RedBlackTreeIterator(this,[])},t.remove=function(e){var t=this.find(e);return t?t.remove():this},t.get=function(e){for(var t=this._compare,r=this.root;r;){var a=t(e,r.key);if(0===a)return r.value;r=a<=0?r.left:r.right}};var r=RedBlackTreeIterator.prototype;function swapNode(e,t){e.key=t.key,e.value=t.value,e.left=t.left,e.right=t.right,e._color=t._color,e._count=t._count}function defaultCompare(e,t){return et?1:0}Object.defineProperty(r,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(r,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),r.clone=function(){return new RedBlackTreeIterator(this.tree,this._stack.slice())},r.remove=function(){var e=this._stack;if(0===e.length)return this.tree;var t=new Array(e.length),r=e[e.length-1];t[t.length-1]=new RBNode(r._color,r.key,r.value,r.left,r.right,r._count);for(var a=e.length-2;a>=0;--a){(r=e[a]).left===e[a+1]?t[a]=new RBNode(r._color,r.key,r.value,t[a+1],r.right,r._count):t[a]=new RBNode(r._color,r.key,r.value,r.left,t[a+1],r._count)}if((r=t[t.length-1]).left&&r.right){var n=t.length;for(r=r.left;r.right;)t.push(r),r=r.right;var o=t[n-1];t.push(new RBNode(r._color,o.key,o.value,r.left,r.right,r._count)),t[n-1].key=r.key,t[n-1].value=r.value;for(a=t.length-2;a>=n;--a)r=t[a],t[a]=new RBNode(r._color,r.key,r.value,r.left,t[a+1],r._count);t[n-1].left=t[n]}if(0===(r=t[t.length-1])._color){var c=t[t.length-2];c.left===r?c.left=null:c.right===r&&(c.right=null),t.pop();for(a=0;a=0;--o){if(t=e[o],0===o)return void(t._color=1);if((r=e[o-1]).left===t){if((a=r.right).right&&0===a.right._color)return n=(a=r.right=cloneNode(a)).right=cloneNode(a.right),r.right=a.left,a.left=r,a.right=n,a._color=r._color,t._color=1,r._color=1,n._color=1,recount(r),recount(a),o>1&&((c=e[o-2]).left===r?c.left=a:c.right=a),void(e[o-1]=a);if(a.left&&0===a.left._color)return n=(a=r.right=cloneNode(a)).left=cloneNode(a.left),r.right=n.left,a.left=n.right,n.left=r,n.right=a,n._color=r._color,r._color=1,a._color=1,t._color=1,recount(r),recount(a),recount(n),o>1&&((c=e[o-2]).left===r?c.left=n:c.right=n),void(e[o-1]=n);if(1===a._color){if(0===r._color)return r._color=1,void(r.right=repaint(0,a));r.right=repaint(0,a);continue}a=cloneNode(a),r.right=a.left,a.left=r,a._color=r._color,r._color=0,recount(r),recount(a),o>1&&((c=e[o-2]).left===r?c.left=a:c.right=a),e[o-1]=a,e[o]=r,o+11&&((c=e[o-2]).right===r?c.right=a:c.left=a),void(e[o-1]=a);if(a.right&&0===a.right._color)return n=(a=r.left=cloneNode(a)).right=cloneNode(a.right),r.left=n.right,a.right=n.left,n.right=r,n.left=a,n._color=r._color,r._color=1,a._color=1,t._color=1,recount(r),recount(a),recount(n),o>1&&((c=e[o-2]).right===r?c.right=n:c.left=n),void(e[o-1]=n);if(1===a._color){if(0===r._color)return r._color=1,void(r.left=repaint(0,a));r.left=repaint(0,a);continue}var c;a=cloneNode(a),r.left=a.right,a.right=r,a._color=r._color,r._color=0,recount(r),recount(a),o>1&&((c=e[o-2]).right===r?c.right=a:c.left=a),e[o-1]=a,e[o]=r,o+10)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(r,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(r,"index",{get:function(){var e=0,t=this._stack;if(0===t.length){var r=this.tree.root;return r?r._count:0}t[t.length-1].left&&(e=t[t.length-1].left._count);for(var a=t.length-2;a>=0;--a)t[a+1]===t[a].right&&(++e,t[a].left&&(e+=t[a].left._count));return e},enumerable:!0}),r.next=function(){var e=this._stack;if(0!==e.length){var t=e[e.length-1];if(t.right)for(t=t.right;t;)e.push(t),t=t.left;else for(e.pop();e.length>0&&e[e.length-1].right===t;)t=e[e.length-1],e.pop()}},Object.defineProperty(r,"hasNext",{get:function(){var e=this._stack;if(0===e.length)return!1;if(e[e.length-1].right)return!0;for(var t=e.length-1;t>0;--t)if(e[t-1].left===e[t])return!0;return!1}}),r.update=function(e){var t=this._stack;if(0===t.length)throw new Error("Can't update empty node!");var r=new Array(t.length),a=t[t.length-1];r[r.length-1]=new RBNode(a._color,a.key,e,a.left,a.right,a._count);for(var n=t.length-2;n>=0;--n)(a=t[n]).left===t[n+1]?r[n]=new RBNode(a._color,a.key,a.value,r[n+1],a.right,a._count):r[n]=new RBNode(a._color,a.key,a.value,a.left,r[n+1],a._count);return new RedBlackTree(this.tree._compare,r[0])},r.prev=function(){var e=this._stack;if(0!==e.length){var t=e[e.length-1];if(t.left)for(t=t.left;t;)e.push(t),t=t.right;else for(e.pop();e.length>0&&e[e.length-1].left===t;)t=e[e.length-1],e.pop()}},Object.defineProperty(r,"hasPrev",{get:function(){var e=this._stack;if(0===e.length)return!1;if(e[e.length-1].left)return!0;for(var t=e.length-1;t>0;--t)if(e[t-1].right===e[t])return!0;return!1}})},(e,t,r)=>{"use strict";var a=r(423),n=r(424),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.a=Buffer,t.b=50;var c=2147483647;function createBuffer(e){if(e>c)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,Buffer.prototype),t}function Buffer(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 allocUnsafe(e)}return from(e,t,r)}function from(e,t,r){if("string"==typeof e)return function fromString(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!Buffer.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|byteLength(e,t),a=createBuffer(r),n=a.write(e,t);n!==r&&(a=a.slice(0,n));return a}(e,t);if(ArrayBuffer.isView(e))return function fromArrayView(e){if(isInstance(e,Uint8Array)){var t=new Uint8Array(e);return fromArrayBuffer(t.buffer,t.byteOffset,t.byteLength)}return fromArrayLike(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(isInstance(e,ArrayBuffer)||e&&isInstance(e.buffer,ArrayBuffer))return fromArrayBuffer(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(isInstance(e,SharedArrayBuffer)||e&&isInstance(e.buffer,SharedArrayBuffer)))return fromArrayBuffer(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var a=e.valueOf&&e.valueOf();if(null!=a&&a!==e)return Buffer.from(a,t,r);var n=function fromObject(e){if(Buffer.isBuffer(e)){var t=0|checked(e.length),r=createBuffer(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||numberIsNaN(e.length)?createBuffer(0):fromArrayLike(e);if("Buffer"===e.type&&Array.isArray(e.data))return fromArrayLike(e.data)}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return Buffer.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 assertSize(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 allocUnsafe(e){return assertSize(e),createBuffer(e<0?0:0|checked(e))}function fromArrayLike(e){for(var t=e.length<0?0:0|checked(e.length),r=createBuffer(t),a=0;a=c)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+c.toString(16)+" bytes");return 0|e}function byteLength(e,t){if(Buffer.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||isInstance(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,a=arguments.length>2&&!0===arguments[2];if(!a&&0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return utf8ToBytes(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return base64ToBytes(e).length;default:if(n)return a?-1:utf8ToBytes(e).length;t=(""+t).toLowerCase(),n=!0}}function slowToString(e,t,r){var a=!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 hexSlice(this,t,r);case"utf8":case"utf-8":return utf8Slice(this,t,r);case"ascii":return asciiSlice(this,t,r);case"latin1":case"binary":return latin1Slice(this,t,r);case"base64":return base64Slice(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,t,r);default:if(a)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function swap(e,t,r){var a=e[t];e[t]=e[r],e[r]=a}function bidirectionalIndexOf(e,t,r,a,n){if(0===e.length)return-1;if("string"==typeof r?(a=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),numberIsNaN(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=Buffer.from(t,a)),Buffer.isBuffer(t))return 0===t.length?-1:arrayIndexOf(e,t,r,a,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):arrayIndexOf(e,[t],r,a,n);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(e,t,r,a,n){var o,c=1,s=e.length,d=t.length;if(void 0!==a&&("ucs2"===(a=String(a).toLowerCase())||"ucs-2"===a||"utf16le"===a||"utf-16le"===a)){if(e.length<2||t.length<2)return-1;c=2,s/=2,d/=2,r/=2}function read(e,t){return 1===c?e[t]:e.readUInt16BE(t*c)}if(n){var u=-1;for(o=r;os&&(r=s-d),o=r;o>=0;o--){for(var h=!0,l=0;ln&&(a=n):a=n;var o=t.length;a>o/2&&(a=o/2);for(var c=0;c>8,n=r%256,o.push(n),o.push(a);return o}(t,e.length-r),e,r,a)}function base64Slice(e,t,r){return 0===t&&r===e.length?a.fromByteArray(e):a.fromByteArray(e.slice(t,r))}function utf8Slice(e,t,r){r=Math.min(e.length,r);for(var a=[],n=t;n239?4:h>223?3:h>191?2:1;if(n+b<=r)switch(b){case 1:h<128&&(l=h);break;case 2:128==(192&(o=e[n+1]))&&(u=(31&h)<<6|63&o)>127&&(l=u);break;case 3:o=e[n+1],c=e[n+2],128==(192&o)&&128==(192&c)&&(u=(15&h)<<12|(63&o)<<6|63&c)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[n+1],c=e[n+2],d=e[n+3],128==(192&o)&&128==(192&c)&&128==(192&d)&&(u=(15&h)<<18|(63&o)<<12|(63&c)<<6|63&d)>65535&&u<1114112&&(l=u)}null===l?(l=65533,b=1):l>65535&&(l-=65536,a.push(l>>>10&1023|55296),l=56320|1023&l),a.push(l),n+=b}return function decodeCodePointsArray(e){var t=e.length;if(t<=s)return String.fromCharCode.apply(String,e);var r="",a=0;for(;aa.length?Buffer.from(o).copy(a,n):Uint8Array.prototype.set.call(a,o,n);else{if(!Buffer.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(a,n)}n+=o.length}return a},Buffer.byteLength=byteLength,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function swap16(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tr&&(e+=" ... "),""},o&&(Buffer.prototype[o]=Buffer.prototype.inspect),Buffer.prototype.compare=function compare(e,t,r,a,n){if(isInstance(e,Uint8Array)&&(e=Buffer.from(e,e.offset,e.byteLength)),!Buffer.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===a&&(a=0),void 0===n&&(n=this.length),t<0||r>e.length||a<0||n>this.length)throw new RangeError("out of range index");if(a>=n&&t>=r)return 0;if(a>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(n>>>=0)-(a>>>=0),c=(r>>>=0)-(t>>>=0),s=Math.min(o,c),d=this.slice(a,n),u=e.slice(t,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===a&&(a="utf8")):(a=r,r=void 0)}var n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var o=!1;;)switch(a){case"hex":return hexWrite(this,e,t,r);case"utf8":case"utf-8":return utf8Write(this,e,t,r);case"ascii":case"latin1":case"binary":return asciiWrite(this,e,t,r);case"base64":return base64Write(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),o=!0}},Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var s=4096;function asciiSlice(e,t,r){var a="";r=Math.min(e.length,r);for(var n=t;na)&&(r=a);for(var n="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function checkInt(e,t,r,a,n,o){if(!Buffer.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw new RangeError("Index out of range")}function checkIEEE754(e,t,r,a,n,o){if(r+a>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function writeFloat(e,t,r,a,o){return t=+t,r>>>=0,o||checkIEEE754(e,0,r,4),n.write(e,t,r,a,23,4),r+4}function writeDouble(e,t,r,a,o){return t=+t,r>>>=0,o||checkIEEE754(e,0,r,8),n.write(e,t,r,a,52,8),r+8}Buffer.prototype.slice=function slice(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e],n=1,o=0;++o>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e+--t],n=1;t>0&&(n*=256);)a+=this[e+--t]*n;return a},Buffer.prototype.readUint8=Buffer.prototype.readUInt8=function readUInt8(e,t){return e>>>=0,t||checkOffset(e,1,this.length),this[e]},Buffer.prototype.readUint16LE=Buffer.prototype.readUInt16LE=function readUInt16LE(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]|this[e+1]<<8},Buffer.prototype.readUint16BE=Buffer.prototype.readUInt16BE=function readUInt16BE(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]<<8|this[e+1]},Buffer.prototype.readUint32LE=Buffer.prototype.readUInt32LE=function readUInt32LE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Buffer.prototype.readUint32BE=Buffer.prototype.readUInt32BE=function readUInt32BE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Buffer.prototype.readIntLE=function readIntLE(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=this[e],n=1,o=0;++o=(n*=128)&&(a-=Math.pow(2,8*t)),a},Buffer.prototype.readIntBE=function readIntBE(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var a=t,n=1,o=this[e+--a];a>0&&(n*=256);)o+=this[e+--a]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*t)),o},Buffer.prototype.readInt8=function readInt8(e,t){return e>>>=0,t||checkOffset(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Buffer.prototype.readInt16LE=function readInt16LE(e,t){e>>>=0,t||checkOffset(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt16BE=function readInt16BE(e,t){e>>>=0,t||checkOffset(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt32LE=function readInt32LE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Buffer.prototype.readInt32BE=function readInt32BE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Buffer.prototype.readFloatLE=function readFloatLE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),n.read(this,e,!0,23,4)},Buffer.prototype.readFloatBE=function readFloatBE(e,t){return e>>>=0,t||checkOffset(e,4,this.length),n.read(this,e,!1,23,4)},Buffer.prototype.readDoubleLE=function readDoubleLE(e,t){return e>>>=0,t||checkOffset(e,8,this.length),n.read(this,e,!0,52,8)},Buffer.prototype.readDoubleBE=function readDoubleBE(e,t){return e>>>=0,t||checkOffset(e,8,this.length),n.read(this,e,!1,52,8)},Buffer.prototype.writeUintLE=Buffer.prototype.writeUIntLE=function writeUIntLE(e,t,r,a){(e=+e,t>>>=0,r>>>=0,a)||checkInt(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,a)||checkInt(this,e,t,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[t+n]=255&e;--n>=0&&(o*=256);)this[t+n]=e/o&255;return t+r},Buffer.prototype.writeUint8=Buffer.prototype.writeUInt8=function writeUInt8(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,255,0),this[t]=255&e,t+1},Buffer.prototype.writeUint16LE=Buffer.prototype.writeUInt16LE=function writeUInt16LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeUint16BE=Buffer.prototype.writeUInt16BE=function writeUInt16BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeUint32LE=Buffer.prototype.writeUInt32LE=function writeUInt32LE(e,t,r){return e=+e,t>>>=0,r||checkInt(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},Buffer.prototype.writeUint32BE=Buffer.prototype.writeUInt32BE=function writeUInt32BE(e,t,r){return e=+e,t>>>=0,r||checkInt(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},Buffer.prototype.writeIntLE=function writeIntLE(e,t,r,a){if(e=+e,t>>>=0,!a){var n=Math.pow(2,8*r-1);checkInt(this,e,t,r,n-1,-n)}var o=0,c=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+r},Buffer.prototype.writeIntBE=function writeIntBE(e,t,r,a){if(e=+e,t>>>=0,!a){var n=Math.pow(2,8*r-1);checkInt(this,e,t,r,n-1,-n)}var o=r-1,c=1,s=0;for(this[t+o]=255&e;--o>=0&&(c*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/c>>0)-s&255;return t+r},Buffer.prototype.writeInt8=function writeInt8(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},Buffer.prototype.writeInt16LE=function writeInt16LE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeInt16BE=function writeInt16BE(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeInt32LE=function writeInt32LE(e,t,r){return e=+e,t>>>=0,r||checkInt(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},Buffer.prototype.writeInt32BE=function writeInt32BE(e,t,r){return e=+e,t>>>=0,r||checkInt(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},Buffer.prototype.writeFloatLE=function writeFloatLE(e,t,r){return writeFloat(this,e,t,!0,r)},Buffer.prototype.writeFloatBE=function writeFloatBE(e,t,r){return writeFloat(this,e,t,!1,r)},Buffer.prototype.writeDoubleLE=function writeDoubleLE(e,t,r){return writeDouble(this,e,t,!0,r)},Buffer.prototype.writeDoubleBE=function writeDoubleBE(e,t,r){return writeDouble(this,e,t,!1,r)},Buffer.prototype.copy=function copy(e,t,r,a){if(!Buffer.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),a||0===a||(a=this.length),t>=e.length&&(t=e.length),t||(t=0),a>0&&a=this.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(c+1===a){(t-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&o.push(239,191,189);if(n=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 base64ToBytes(e){return a.toByteArray(function base64clean(e){if((e=(e=e.split("=")[0]).trim().replace(d,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function blitBuffer(e,t,r,a){for(var n=0;n=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function isInstance(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function numberIsNaN(e){return e!=e}var u=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var a=16*r,n=0;n<16;++n)t[a+n]=e[r]+e[n];return t}()},(e,t,r)=>{var a=r(1028),n=r(375),o=r(379);e.exports=function(t,r,c){return"object"!=typeof r||c?(c||(c={}),n(o(a(t,r,c),c),c)):e.exports(t,null,r)}},(e,t,r)=>{"use strict";var a=r(0).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.assertIsString=t.assertIsArray=t.assertIsBuffer=t.assertIsHexString=void 0;var n=r(17);t.assertIsHexString=function(e){if(!n.isHexString(e))throw new Error("This method only supports 0x-prefixed hex strings but input was: "+e)},t.assertIsBuffer=function(e){if(!a.isBuffer(e))throw new Error("This method only supports Buffer but input was: "+e)},t.assertIsArray=function(e){if(!Array.isArray(e))throw new Error("This method only supports number arrays but input was: "+e)},t.assertIsString=function(e){if("string"!=typeof e)throw new Error("This method only supports strings but input was: "+e)}},(e,t,r)=>{"use strict";var a=r(0).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.assertIsString=t.assertIsArray=t.assertIsBuffer=t.assertIsHexString=void 0;var n=r(17);t.assertIsHexString=function(e){if(!n.isHexString(e))throw new Error("This method only supports 0x-prefixed hex strings but input was: "+e)},t.assertIsBuffer=function(e){if(!a.isBuffer(e))throw new Error("This method only supports Buffer but input was: "+e)},t.assertIsArray=function(e){if(!Array.isArray(e))throw new Error("This method only supports number arrays but input was: "+e)},t.assertIsString=function(e){if("string"!=typeof e)throw new Error("This method only supports strings but input was: "+e)}},(e,t,r)=>{"use strict";var a=r(0).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.DBOp=t.DBTarget=void 0;var n,o=r(1040);!function(e){e[e.Heads=0]="Heads",e[e.HeadHeader=1]="HeadHeader",e[e.HeadBlock=2]="HeadBlock",e[e.HashToNumber=3]="HashToNumber",e[e.NumberToHash=4]="NumberToHash",e[e.TotalDifficulty=5]="TotalDifficulty",e[e.Body=6]="Body",e[e.Header=7]="Header",e[e.CliqueSignerStates=8]="CliqueSignerStates",e[e.CliqueVotes=9]="CliqueVotes",e[e.CliqueBlockSigners=10]="CliqueBlockSigners"}(n=t.DBTarget||(t.DBTarget={}));var c=function(){function DBOp(e,t){switch(this.operationTarget=e,this.baseDBOp={key:"",keyEncoding:"binary",valueEncoding:"binary"},e){case n.Heads:this.baseDBOp.key=o.HEADS_KEY,this.baseDBOp.valueEncoding="json";break;case n.HeadHeader:this.baseDBOp.key=o.HEAD_HEADER_KEY;break;case n.HeadBlock:this.baseDBOp.key=o.HEAD_BLOCK_KEY;break;case n.HashToNumber:this.baseDBOp.key=o.hashToNumberKey(t.blockHash),this.cacheString="hashToNumber";break;case n.NumberToHash:this.baseDBOp.key=o.numberToHashKey(t.blockNumber),this.cacheString="numberToHash";break;case n.TotalDifficulty:this.baseDBOp.key=o.tdKey(t.blockNumber,t.blockHash),this.cacheString="td";break;case n.Body:this.baseDBOp.key=o.bodyKey(t.blockNumber,t.blockHash),this.cacheString="body";break;case n.Header:this.baseDBOp.key=o.headerKey(t.blockNumber,t.blockHash),this.cacheString="header";break;case n.CliqueSignerStates:this.baseDBOp.key=o.CLIQUE_SIGNERS_KEY;break;case n.CliqueVotes:this.baseDBOp.key=o.CLIQUE_VOTES_KEY;break;case n.CliqueBlockSigners:this.baseDBOp.key=o.CLIQUE_BLOCK_SIGNERS_KEY}}return DBOp.get=function(e,t){return new DBOp(e,t)},DBOp.set=function(e,t,r){var a=new DBOp(e,r);return a.baseDBOp.value=t,a.baseDBOp.type="put",e==n.Heads?a.baseDBOp.valueEncoding="json":a.baseDBOp.valueEncoding="binary",a},DBOp.del=function(e,t){var r=new DBOp(e,t);return r.baseDBOp.type="del",r},DBOp.prototype.updateCache=function(e){if(this.cacheString&&e[this.cacheString]&&a.isBuffer(this.baseDBOp.value))if("put"==this.baseDBOp.type)e[this.cacheString].set(this.baseDBOp.key,this.baseDBOp.value);else{if("del"!=this.baseDBOp.type)throw new Error("unsupported db operation on cache");e[this.cacheString].del(this.baseDBOp.key)}},DBOp}();t.DBOp=c},e=>{var t={}.toString;e.exports=function(e){return t.call(e).slice(8,-1)}},e=>{e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},(e,t,r)=>{var a=r(107),n=r(1045),o="__core-js_shared__",c=a[o]||n(o,{});e.exports=c},(e,t,r)=>{var a=r(296),n=r(632);e.exports=n?function(e){return"symbol"==typeof e}:function(e){var t=a("Symbol");return"function"==typeof t&&Object(e)instanceof t}},e=>{e.exports={}},e=>{e.exports=!0},(e,t,r)=>{var a=r(388);e.exports=function(e){return Object(a(e))}},e=>{var t=0,r=Math.random();e.exports=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++t+r).toString(36)}},e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},(e,t,r)=>{var a=r(634),n=r(394),o=a("keys");e.exports=function(e){return o[e]||(o[e]=n(e))}},(e,t,r)=>{"use strict";var a=r(398),n=r(1052),o=r(636),c=r(1060),s=r(402),d=r(171),u=r(640),h=r(108),l=r(392),b=r(254),g=r(635),p=g.IteratorPrototype,B=g.BUGGY_SAFARI_ITERATORS,m=h("iterator"),I="keys",y="values",x="entries",returnThis=function(){return this};e.exports=function(e,t,r,h,g,C,v){n(r,t,h);var Q,w,_,getIterationMethod=function(e){if(e===g&&G)return G;if(!B&&e in D)return D[e];switch(e){case I:return function keys(){return new r(this,e)};case y:return function values(){return new r(this,e)};case x:return function entries(){return new r(this,e)}}return function(){return new r(this)}},k=t+" Iterator",N=!1,D=e.prototype,U=D[m]||D["@@iterator"]||g&&D[g],G=!B&&U||getIterationMethod(g),T="Array"==t&&D.entries||U;if(T&&(Q=o(T.call(new e)),p!==Object.prototype&&Q.next&&(l||o(Q)===p||(c?c(Q,p):"function"!=typeof Q[m]&&d(Q,m,returnThis)),s(Q,k,!0,!0),l&&(b[k]=returnThis))),g==y&&U&&U.name!==y&&(N=!0,G=function values(){return U.call(this)}),l&&!v||D[m]===G||d(D,m,G),b[t]=G,g)if(w={values:getIterationMethod(y),keys:C?G:getIterationMethod(I),entries:getIterationMethod(x)},v)for(_ in w)(B||N||!(_ in D))&&u(D,_,w[_]);else a({target:t,proto:!0,forced:B||N},w);return w}},(e,t,r)=>{"use strict";var a=r(107),n=r(1418).f,o=r(1050),c=r(391),s=r(298),d=r(171),u=r(123),wrapConstructor=function(e){var Wrapper=function(t,r,a){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,r)}return new e(t,r,a)}return e.apply(this,arguments)};return Wrapper.prototype=e.prototype,Wrapper};e.exports=function(e,t){var r,h,l,b,g,p,B,m,I=e.target,y=e.global,x=e.stat,C=e.proto,v=y?a:x?a[I]:(a[I]||{}).prototype,Q=y?c:c[I]||(c[I]={}),w=Q.prototype;for(l in t)r=!o(y?l:I+(x?".":"#")+l,e.forced)&&v&&u(v,l),g=Q[l],r&&(p=e.noTargetGet?(m=n(v,l))&&m.value:v[l]),b=r&&p?p:t[l],r&&typeof g==typeof b||(B=e.bind&&r?s(b,a):e.wrap&&r?wrapConstructor(b):C&&"function"==typeof b?s(Function.call,b):b,(e.sham||b&&b.sham||g&&g.sham)&&d(B,"sham",!0),Q[l]=B,C&&(u(c,h=I+"Prototype")||d(c,h,{}),c[h][l]=b,e.real&&w&&!w[l]&&d(w,l,b)))}},(e,t,r)=>{var a=r(400),n=Math.min;e.exports=function(e){return e>0?n(a(e),9007199254740991):0}},e=>{var t=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:t)(e)}},e=>{e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},(e,t,r)=>{var a=r(403),n=r(215).f,o=r(171),c=r(123),s=r(1059),d=r(108)("toStringTag");e.exports=function(e,t,r,u){if(e){var h=r?e:e.prototype;c(h,d)||n(h,d,{configurable:!0,value:t}),u&&!a&&o(h,"toString",s)}}},(e,t,r)=>{var a={};a[r(108)("toStringTag")]="z",e.exports="[object z]"===String(a)},(e,t,r)=>{"use strict";var a=r(0).Buffer;Object.defineProperty(t,"__esModule",{value:!0});var n=r(4),o=function(){function Message(e){this.to=e.to,this.value=e.value?e.value:new n.BN(0),this.caller=e.caller,this.gasLimit=e.gasLimit,this.data=e.data||a.alloc(0),this.depth=e.depth||0,this.code=e.code,this._codeAddress=e.codeAddress,this.isStatic=e.isStatic||!1,this.isCompiled=e.isCompiled||!1,this.salt=e.salt,this.selfdestruct=e.selfdestruct,this.delegatecall=e.delegatecall||!1}return Object.defineProperty(Message.prototype,"codeAddress",{get:function(){return this._codeAddress?this._codeAddress:this.to},enumerable:!1,configurable:!0}),Message}();t.default=o},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=n(r(6)),c=r(4),s=256,d=function(){function Bloom(e){e?(o.default(e.length===s,"bitvectors must be 2048 bits long"),this.bitvector=e):this.bitvector=c.zeros(s)}return Bloom.prototype.add=function(e){o.default(a.isBuffer(e),"Element should be buffer"),e=c.keccak256(e);for(var t=0;t<3;t++){var r=2047&e.readUInt16BE(2*t),n=r>>3,d=1<>3,u=1<{var a=r(660),n=r(1080),o=r(1081),c=a?a.toStringTag:void 0;e.exports=function baseGetTag(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":c&&c in Object(e)?n(e):o(e)}},e=>{e.exports=function isObjectLike(e){return null!=e&&"object"==typeof e}},(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function slice(e,t){t|=0;for(var r=Math.max(e.length-t,0),a=Array(r),n=0;n{"use strict";var a=r(1098),n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,c=Array.prototype.concat,s=Object.defineProperty,d=s&&function(){var e={};try{for(var t in s(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),defineProperty=function(e,t,r,a){var n;(!(t in e)||"function"==typeof(n=a)&&"[object Function]"===o.call(n)&&a())&&(d?s(e,t,{configurable:!0,enumerable:!1,value:r,writable:!0}):e[t]=r)},defineProperties=function(e,t){var r=arguments.length>2?arguments[2]:{},o=a(t);n&&(o=c.call(o,Object.getOwnPropertySymbols(t)));for(var s=0;s{"use strict";var a=r(411),n=r(69),o=n("%Function.prototype.apply%"),c=n("%Function.prototype.call%"),s=n("%Reflect.apply%",!0)||a.call(c,o),d=n("%Object.getOwnPropertyDescriptor%",!0),u=n("%Object.defineProperty%",!0),h=n("%Math.max%");if(u)try{u({},"a",{value:1})}catch(e){u=null}e.exports=function callBind(e){var t=s(a,c,arguments);if(d&&u){var r=d(t,"length");r.configurable&&u(t,"length",{value:1+h(0,e.length-(arguments.length-1))})}return t};var l=function applyBind(){return s(a,o,arguments)};u?u(e.exports,"apply",{value:l}):e.exports.apply=l},(e,t,r)=>{"use strict";var a=r(1102);e.exports=Function.prototype.bind||a},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=r(627),c=r(51),s=r(168),d=r(4),u=r(20),h=n(r(66)),l=r(1077),b=n(r(1129)),g=r(413),p=r(149),B=c.debug("vm:state");class DefaultStateManager{constructor(e={}){let t=e.common;t||(t=new h.default({chain:"mainnet",hardfork:"petersburg"})),this._common=t,this._trie=e.trie||new s.SecureTrie,this._storageTries={},this._cache=new b.default(this._trie),this._touched=new o,this._touchedStack=[],this._checkpointCount=0,this._originalStorageCache=new Map,this._accessedStorage=[new Map]}copy(){return new DefaultStateManager({trie:this._trie.copy(!1),common:this._common})}async getAccount(e){return await this._cache.getOrLoad(e)}async putAccount(e,t){B(`Save account address=${e} nonce=${t.nonce} balance=${t.balance} contract=${t.isContract()?"yes":"no"} empty=${t.isEmpty()?"yes":"no"}`),this._cache.put(e,t),this.touchAccount(e)}async deleteAccount(e){B(`Delete account ${e}`),this._cache.del(e),this.touchAccount(e)}touchAccount(e){this._touched.add(e.buf.toString("hex"))}async putContractCode(e,t){const r=d.keccak256(t);if(r.equals(d.KECCAK256_NULL))return;await this._trie.db.put(r,t);const a=await this.getAccount(e);B(`Update codeHash (-> ${p.short(r)}) for account ${e}`),a.codeHash=r,await this.putAccount(e,a)}async getContractCode(e){const t=await this.getAccount(e);if(!t.isContract())return a.alloc(0);return await this._trie.db.get(t.codeHash)||a.alloc(0)}async _lookupStorageTrie(e){const t=await this.getAccount(e),r=this._trie.copy(!1);return r.root=t.stateRoot,r.db.checkpoints=[],r}async _getStorageTrie(e){const t=e.buf.toString("hex");let r=this._storageTries[t];return r||(r=await this._lookupStorageTrie(e)),r}async getContractStorage(e,t){if(32!==t.length)throw new Error("Storage key must be 32 bytes long");const r=await this._getStorageTrie(e),a=await r.get(t);return u.decode(a)}async getOriginalContractStorage(e,t){if(32!==t.length)throw new Error("Storage key must be 32 bytes long");const r=e.buf.toString("hex"),a=t.toString("hex");let n;if(this._originalStorageCache.has(r)?n=this._originalStorageCache.get(r):(n=new Map,this._originalStorageCache.set(r,n)),n.has(a))return n.get(a);{const r=await this.getContractStorage(e,t);return n.set(a,r),r}}_clearOriginalStorageCache(){this._originalStorageCache=new Map}clearOriginalStorageCache(){this._clearOriginalStorageCache()}async _modifyContractStorage(e,t){return new Promise((async r=>{const a=await this._getStorageTrie(e);t(a,(async()=>{const t=e.buf.toString("hex");this._storageTries[t]=a;const n=this._cache.get(e);n.stateRoot=a.root,await this.putAccount(e,n),this.touchAccount(e),r()}))}))}async putContractStorage(e,t,r){if(32!==t.length)throw new Error("Storage key must be 32 bytes long");if(r.length>32)throw new Error("Storage value cannot be longer than 32 bytes");r=d.unpadBuffer(r),await this._modifyContractStorage(e,(async(a,n)=>{if(r&&r.length){const n=u.encode(r);B(`Update contract storage for account ${e} to ${p.short(r)}`),await a.put(t,n)}else B("Delete contract storage for account"),await a.del(t);n()}))}async clearContractStorage(e){await this._modifyContractStorage(e,((e,t)=>{e.root=e.EMPTY_TRIE_ROOT,t()}))}async checkpoint(){this._trie.checkpoint(),this._cache.checkpoint(),this._touchedStack.push(new o(Array.from(this._touched))),this._accessedStorage.push(new Map),this._checkpointCount++}async commit(){await this._trie.commit(),this._cache.commit(),this._touchedStack.pop(),this._checkpointCount--;const e=this._accessedStorage.pop(),t=this._accessedStorage[this._accessedStorage.length-1];t&&(null==e||e.forEach(((e,r)=>{t.get(r)||t.set(r,new o);const a=t.get(r);e.forEach((e=>{a.add(e)}))}))),0===this._checkpointCount&&(await this._cache.flush(),this._clearOriginalStorageCache())}async revert(){await this._trie.revert(),this._cache.revert(),this._storageTries={},this._accessedStorage.pop();const e=this._touchedStack.pop();if(!e)throw new Error("Reverting to invalid state checkpoint failed");this._touched.has(g.ripemdPrecompileAddress)&&e.add(g.ripemdPrecompileAddress),this._touched=e,this._checkpointCount--,0===this._checkpointCount&&(await this._cache.flush(),this._clearOriginalStorageCache())}async getStateRoot(e=!1){if(!e&&0!==this._checkpointCount)throw new Error("Cannot get state root with uncommitted checkpoints");await this._cache.flush();return this._trie.root}async setStateRoot(e){if(0!==this._checkpointCount)throw new Error("Cannot set state root with uncommitted checkpoints");if(await this._cache.flush(),e===this._trie.EMPTY_TRIE_ROOT)return this._trie.root=e,this._cache.clear(),void(this._storageTries={});if(!await this._trie.checkRoot(e))throw new Error("State trie does not contain state root");this._trie.root=e,this._cache.clear(),this._storageTries={}}async dumpStorage(e){return new Promise(((t,r)=>{this._getStorageTrie(e).then((e=>{const r={},a=e.createReadStream();a.on("data",(e=>{r[e.key.toString("hex")]=e.value.toString("hex")})),a.on("end",(()=>{t(r)}))})).catch((e=>{r(e)}))}))}async hasGenesisState(){const e=this._common.genesis().stateRoot;return await this._trie.checkRoot(e)}async generateCanonicalGenesis(){if(0!==this._checkpointCount)throw new Error("Cannot create genesis state with uncommitted checkpoints");await this.hasGenesisState()||await this.generateGenesis(l.genesisStateByName(this._common.chainName()))}async generateGenesis(e){if(0!==this._checkpointCount)throw new Error("Cannot create genesis state with uncommitted checkpoints");B("Save genesis state into the state trie");const t=Object.keys(e);for(const r of t){const t=new d.BN(d.toBuffer(e[r])),a=d.Account.fromAccountData({balance:t}),n=d.toBuffer(r);await this._trie.put(n,a.serialize())}}async accountIsEmpty(e){return(await this.getAccount(e)).isEmpty()}async accountExists(e){return!(!this._cache.lookup(e)||this._cache.keyIsDeleted(e))||!!await this._cache._trie.get(e.buf)}isWarmedAddress(e){for(let t=this._accessedStorage.length-1;t>=0;t--){if(this._accessedStorage[t].has(e.toString("hex")))return!0}return!1}addWarmedAddress(e){const t=e.toString("hex");if(!this._accessedStorage[this._accessedStorage.length-1].get(t)){const e=new o;this._accessedStorage[this._accessedStorage.length-1].set(t,e)}}isWarmedStorage(e,t){const r=e.toString("hex"),a=t.toString("hex");for(let e=this._accessedStorage.length-1;e>=0;e--){const t=this._accessedStorage[e];if(t.has(r)&&t.get(r).has(a))return!0}return!1}addWarmedStorage(e,t){const r=e.toString("hex");let a=this._accessedStorage[this._accessedStorage.length-1].get(r);a||(a=new o,this._accessedStorage[this._accessedStorage.length-1].set(r,a)),a.add(t.toString("hex"))}clearWarmedAccounts(){this._accessedStorage=[new Map]}async cleanupTouchedAccounts(){if(this._common.gteHardfork("spuriousDragon")){const e=Array.from(this._touched);for(const t of e){const e=new d.Address(a.from(t,"hex"));await this.accountIsEmpty(e)&&(this._cache.del(e),B(`Cleanup touched account address=${e.toString()} (>= SpuriousDragon)`))}}this._touched.clear()}}t.default=DefaultStateManager},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getActivePrecompiles=t.ripemdPrecompileAddress=t.getPrecompile=t.precompiles=void 0;const o=r(4),c=n(r(1451)),s=n(r(1457)),d=n(r(1458)),u=n(r(1459)),h=n(r(1460)),l=n(r(1461)),b=n(r(1462)),g=n(r(1463)),p=n(r(1464)),B=n(r(1465)),m=n(r(1466)),I=n(r(1467)),y=n(r(1468)),x=n(r(1469)),C=n(r(1470)),v=n(r(1471)),Q=n(r(1472)),w=n(r(1473));var _;!function(e){e[e.EIP=0]="EIP",e[e.Hardfork=1]="Hardfork"}(_||(_={}));const k="0000000000000000000000000000000000000003";t.ripemdPrecompileAddress=k;const N={"0000000000000000000000000000000000000001":c.default,"0000000000000000000000000000000000000002":s.default,[k]:d.default,"0000000000000000000000000000000000000004":u.default,"0000000000000000000000000000000000000005":h.default,"0000000000000000000000000000000000000006":l.default,"0000000000000000000000000000000000000007":b.default,"0000000000000000000000000000000000000008":g.default,"0000000000000000000000000000000000000009":p.default,"000000000000000000000000000000000000000a":B.default,"000000000000000000000000000000000000000b":m.default,"000000000000000000000000000000000000000c":I.default,"000000000000000000000000000000000000000d":y.default,"000000000000000000000000000000000000000e":x.default,"000000000000000000000000000000000000000f":C.default,"0000000000000000000000000000000000000010":v.default,"0000000000000000000000000000000000000011":Q.default,"0000000000000000000000000000000000000012":w.default};t.precompiles=N;const D={"0000000000000000000000000000000000000001":{type:_.Hardfork,param:"chainstart"},"0000000000000000000000000000000000000002":{type:_.Hardfork,param:"chainstart"},[k]:{type:_.Hardfork,param:"chainstart"},"0000000000000000000000000000000000000004":{type:_.Hardfork,param:"chainstart"},"0000000000000000000000000000000000000005":{type:_.Hardfork,param:"byzantium"},"0000000000000000000000000000000000000006":{type:_.Hardfork,param:"byzantium"},"0000000000000000000000000000000000000007":{type:_.Hardfork,param:"byzantium"},"0000000000000000000000000000000000000008":{type:_.Hardfork,param:"byzantium"},"0000000000000000000000000000000000000009":{type:_.Hardfork,param:"istanbul"},"000000000000000000000000000000000000000a":{type:_.EIP,param:2537},"000000000000000000000000000000000000000b":{type:_.EIP,param:2537},"000000000000000000000000000000000000000c":{type:_.EIP,param:2537},"000000000000000000000000000000000000000d":{type:_.EIP,param:2537},"000000000000000000000000000000000000000f":{type:_.EIP,param:2537},"000000000000000000000000000000000000000e":{type:_.EIP,param:2537},"0000000000000000000000000000000000000010":{type:_.EIP,param:2537},"0000000000000000000000000000000000000011":{type:_.EIP,param:2537},"0000000000000000000000000000000000000012":{type:_.EIP,param:2537}};function getPrecompile(e,t){const r=e.buf.toString("hex");if(N[r]){const e=D[r];if(e.type==_.Hardfork&&t.gteHardfork(e.param)||e.type==_.EIP&&t.eips().includes(e.param))return N[r]}return N[""]}t.getPrecompile=getPrecompile,t.getActivePrecompiles=function getActivePrecompiles(e){const t=[];for(const r in N){const n=new o.Address(a.from(r,"hex"));getPrecompile(n,e)&&t.push(n)}return t}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseHandler=void 0;const o=n(r(689));class BaseHandler{constructor(e,t){this.id=1,this.requestCache=new Map;const r=e.fork,{requestsPerSecond:a,url:n,userAgent:c,origin:s}=r;this.abortSignal=t,this.limiter=new o.default(30*a,3e4,t);const d={"user-agent":c};s&&(d.origin=s),n.password=n.username="",BaseHandler.setAuthHeaders(r,d),BaseHandler.setUserHeaders(r,d,!n.host.endsWith(".infura.io")),this.headers=d}static setAuthHeaders(e,t){if(null!=e.username||null!=e.password){if(null!=e.jwt)throw new Error("Authentication via both username/password (Basic) and JWT (Bearer) is not possible");t.authorization=`Basic ${a.from(`${e.username||""}:${e.password||""}`).toString("base64")}`}else e.jwt&&(t.authorization=`Bearer ${e.jwt}`)}static setUserHeaders(e,t,r){const a=e.headers;if(a)for(let e=0,n=a.length;e=l;)e/=2,t/=2,r>>>=1;return(e+r)/t};return prng.int32=function(){return 0|g.g(4)},prng.quick=function(){return g.g(4)/4294967296},prng.double=prng,mixkey(tostring(g.S),o),(t.pass||r||function(e,t,r,a){return a&&(a.S&©(a,g),e.state=function(){return copy(g,{})}),r?(c.random=e,t):e})(prng,b,"global"in t?t.global:this==c,t.state)}function ARC4(e){var t,r=e.length,a=this,n=0,o=a.i=a.j=0,c=a.S=[];for(r||(e=[r++]);n{"use strict";var a=r(1145);e.exports=Function.prototype.bind||a},(e,t,r)=>{"use strict";var a="undefined"!=typeof Symbol&&Symbol,n=r(418);e.exports=function hasNativeSymbols(){return"function"==typeof a&&("function"==typeof Symbol&&("symbol"==typeof a("foo")&&("symbol"==typeof Symbol("bar")&&n())))}},e=>{"use strict";e.exports=function hasSymbols(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var a=Object.getOwnPropertySymbols(e);if(1!==a.length||a[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(e,t);if(42!==n.value||!0!==n.enumerable)return!1}return!0}},(e,t,r)=>{"use strict";var a=r(1),n=r(1151);if(r(417)()||r(418)()){var o=Symbol.iterator;e.exports=function getIterator(e){return null!=e&&void 0!==e[o]?e[o]():n(e)?Array.prototype[o].call(e):void 0}}else{var c=r(1152),s=r(703),d=r(14),u=d("%Map%",!0),h=d("%Set%",!0),l=r(113),b=l("Array.prototype.push"),g=l("String.prototype.charCodeAt"),p=l("String.prototype.slice"),B=function getArrayIterator(e){var t=0;return{next:function next(){var r,a=t>=e.length;return a||(r=e[t],t+=1),{done:a,value:r}}}},m=function getNonCollectionIterator(e,t){if(c(e)||n(e))return B(e);if(s(e)){var r=0;return{next:function next(){var t=function advanceStringIndex(e,t){if(t+1>=e.length)return t+1;var r=g(e,t);if(r<55296||r>56319)return t+1;var a=g(e,t+1);return a<56320||a>57343?t+1:t+2}(e,r),a=p(e,r,t);return r=t,{done:t>e.length,value:a}}}}return t&&void 0!==e["_es6-shim iterator_"]?e["_es6-shim iterator_"]():void 0};if(u||h){var I=r(1153),y=r(1154),x=l("Map.prototype.forEach",!0),C=l("Set.prototype.forEach",!0);if(void 0===a||!a.versions||!a.versions.node)var v=l("Map.prototype.iterator",!0),Q=l("Set.prototype.iterator",!0),getStopIterationIterator=function(e){var t=!1;return{next:function next(){try{return{done:t,value:t?void 0:e.next()}}catch(e){return t=!0,{done:!0,value:void 0}}}}};var w=l("Map.prototype.@@iterator",!0)||l("Map.prototype._es6-shim iterator_",!0),_=l("Set.prototype.@@iterator",!0)||l("Set.prototype._es6-shim iterator_",!0);e.exports=function getIterator(e){return function getCollectionIterator(e){if(I(e)){if(v)return getStopIterationIterator(v(e));if(w)return w(e);if(x){var t=[];return x(e,(function(e,r){b(t,[r,e])})),B(t)}}if(y(e)){if(Q)return getStopIterationIterator(Q(e));if(_)return _(e);if(C){var r=[];return C(e,(function(e){b(r,e)})),B(r)}}}(e)||m(e)}}else e.exports=function getIterator(e){if(null!=e)return m(e,!0)}}},(e,t,r)=>{"use strict";var a=r(14)("%Array%"),n=!a.isArray&&r(113)("Object.prototype.toString");e.exports=a.isArray||function IsArray(e){return"[object Array]"===n(e)}},(e,t,r)=>{"use strict";var a=r(14),n=a("%TypeError%"),o=a("%SyntaxError%"),c=r(176),s={"Property Descriptor":function isPropertyDescriptor(e,t){if("Object"!==e(t))return!1;var r={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};for(var a in t)if(c(t,a)&&!r[a])return!1;var o=c(t,"[[Value]]"),s=c(t,"[[Get]]")||c(t,"[[Set]]");if(o&&s)throw new n("Property Descriptors may not be both accessor and data descriptors");return!0}};e.exports=function assertRecord(e,t,r,a){var c=s[t];if("function"!=typeof c)throw new o("unknown record type: "+t);if(!c(e,a))throw new n(r+" must be a "+t)}},function(e,t,r){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.provider=t.server=t.Server=void 0;var n=r(315);Object.defineProperty(t,"Server",{enumerable:!0,get:function(){return n.Server}}),Object.defineProperty(t,"server",{enumerable:!0,get:function(){return n.server}}),Object.defineProperty(t,"provider",{enumerable:!0,get:function(){return n.provider}});const o=a(r(315));t.default=o.default},(e,t)=>{"use strict";t.byteLength=function byteLength(e){var t=getLens(e),r=t[0],a=t[1];return 3*(r+a)/4-a},t.toByteArray=function toByteArray(e){var t,r,o=getLens(e),c=o[0],s=o[1],d=new n(function _byteLength(e,t,r){return 3*(t+r)/4-r}(0,c,s)),u=0,h=s>0?c-4:c;for(r=0;r>16&255,d[u++]=t>>8&255,d[u++]=255&t;2===s&&(t=a[e.charCodeAt(r)]<<2|a[e.charCodeAt(r+1)]>>4,d[u++]=255&t);1===s&&(t=a[e.charCodeAt(r)]<<10|a[e.charCodeAt(r+1)]<<4|a[e.charCodeAt(r+2)]>>2,d[u++]=t>>8&255,d[u++]=255&t);return d},t.fromByteArray=function fromByteArray(e){for(var t,a=e.length,n=a%3,o=[],c=16383,s=0,d=a-n;sd?d:s+c));1===n?(t=e[a-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===n&&(t=(e[a-2]<<8)+e[a-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],a=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,s=o.length;c0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function encodeChunk(e,t,a){for(var n,o,c=[],s=t;s>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return c.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},(e,t)=>{t.read=function(e,t,r,a,n){var o,c,s=8*n-a-1,d=(1<>1,h=-7,l=r?n-1:0,b=r?-1:1,g=e[t+l];for(l+=b,o=g&(1<<-h)-1,g>>=-h,h+=s;h>0;o=256*o+e[t+l],l+=b,h-=8);for(c=o&(1<<-h)-1,o>>=-h,h+=a;h>0;c=256*c+e[t+l],l+=b,h-=8);if(0===o)o=1-u;else{if(o===d)return c?NaN:1/0*(g?-1:1);c+=Math.pow(2,a),o-=u}return(g?-1:1)*c*Math.pow(2,o-a)},t.write=function(e,t,r,a,n,o){var c,s,d,u=8*o-n-1,h=(1<>1,b=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,g=a?0:o-1,p=a?1:-1,B=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,c=h):(c=Math.floor(Math.log(t)/Math.LN2),t*(d=Math.pow(2,-c))<1&&(c--,d*=2),(t+=c+l>=1?b/d:b*Math.pow(2,1-l))*d>=2&&(c++,d/=2),c+l>=h?(s=0,c=h):c+l>=1?(s=(t*d-1)*Math.pow(2,n),c+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,n),c=0));n>=8;e[r+g]=255&s,g+=p,s/=256,n-=8);for(c=c<0;e[r+g]=255&c,g+=p,c/=256,u-=8);e[r+g-p]|=128*B}},function(e,t,r){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.keccak=void 0;const n=a(r(724)),o=n.default("keccak256");t.keccak=function keccak(e){o._state.absorb(e);const t=o._state.squeeze(32);return o._state.initialize(1088,512),o._finalized=!1,t}},(e,t,r)=>{"use strict";var a=r(1);function emitErrorAndCloseNT(e,t){emitErrorNT(e,t),emitCloseNT(e)}function emitCloseNT(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function emitErrorNT(e,t){e.emit("error",t)}e.exports={destroy:function destroy(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return n||o?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,a.nextTick(emitErrorNT,this,e)):a.nextTick(emitErrorNT,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?r._writableState?r._writableState.errorEmitted?a.nextTick(emitCloseNT,r):(r._writableState.errorEmitted=!0,a.nextTick(emitErrorAndCloseNT,r,e)):a.nextTick(emitErrorAndCloseNT,r,e):t?(a.nextTick(emitCloseNT,r),t(e)):a.nextTick(emitCloseNT,r)})),this)},undestroy:function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function errorOrDestroy(e,t){var r=e._readableState,a=e._writableState;r&&r.autoDestroy||a&&a.autoDestroy?e.destroy(t):e.emit("error",t)}}},(e,t,r)=>{"use strict";var a=r(232).a.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function getHighWaterMark(e,t,r,n){var o=function highWaterMarkFrom(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new a(n?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},(e,t,r)=>{"use strict";var a=r(11).Buffer,n=a.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function StringDecoder(e){var t;switch(this.encoding=function normalizeEncoding(e){var t=function _normalizeEncoding(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&&(a.isEncoding===n||!n(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,t=4;break;case"utf8":this.fillLast=utf8FillLast,t=4;break;case"base64":this.text=base64Text,this.end=base64End,t=3;break;default:return this.write=simpleWrite,void(this.end=simpleEnd)}this.lastNeed=0,this.lastTotal=0,this.lastChar=a.allocUnsafe(t)}function utf8CheckByte(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function utf8FillLast(e){var t=this.lastTotal-this.lastNeed,r=function utf8CheckExtraBytes(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 utf16Text(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var a=r.charCodeAt(r.length-1);if(a>=55296&&a<=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 utf16End(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 base64Text(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 base64End(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function simpleWrite(e){return e.toString(this.encoding)}function simpleEnd(e){return e&&e.length?this.write(e):""}t.a=StringDecoder,StringDecoder.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 n>0&&(e.lastNeed=n-1),n;if(--a=0)return n>0&&(e.lastNeed=n-2),n;if(--a=0)return n>0&&(2===n?n=0:e.lastNeed=n-3),n;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var a=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,a),e.toString("utf8",t,a)},StringDecoder.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}},(e,t,r)=>{"use strict";e.exports=PassThrough;var a=r(318);function PassThrough(e){if(!(this instanceof PassThrough))return new PassThrough(e);a.call(this,e)}r(10)(PassThrough,a),PassThrough.prototype._transform=function(e,t,r){r(null,e)}},(e,t,r)=>{"use strict";var a;var n=r(232).a,o=n.ERR_MISSING_ARGS,c=n.ERR_STREAM_DESTROYED;function noop(e){if(e)throw e}function destroyer(e,t,n,o){o=function once(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(o);var s=!1;e.on("close",(function(){s=!0})),void 0===a&&(a=r(264)),a(e,{readable:t,writable:n},(function(e){if(e)return o(e);s=!0,o()}));var d=!1;return function(t){if(!s&&!d)return d=!0,function isRequest(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new c("pipe"))}}function call(e){e()}function pipe(e,t){return e.pipe(t)}function popCallback(e){return e.length?"function"!=typeof e[e.length-1]?noop:e.pop():noop}e.exports=function pipeline(){for(var e=arguments.length,t=new Array(e),r=0;r0,(function(e){a||(a=e),e&&c.forEach(call),o||(c.forEach(call),n(a))}))}));return t.reduce(pipe)}},function(e,t,r){"use strict";var a=r(2).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RandomNumberGenerator=void 0;const o=n(r(734));t.RandomNumberGenerator=class RandomNumberGenerator{constructor(e,t){if("string"==typeof e&&void 0===t)this.rng=o.default.alea(e,{state:!0});else if("object"==typeof t)this.rng=o.default.alea("",{state:t});else{const e=Math.random()*Date.now();this.rng=o.default.alea(`${e}`,{state:!0})}}getNumber(e=1){return 1!==e?this.rng()*e:this.rng()}getNumbers(e,t=1){const r=[];for(let a=0;a>>0,e=(a*=e)>>>0,e+=4294967296*(a-=e)}return 2.3283064365386963e-10*(e>>>0)}}();t.next=function(){var e=2091639*t.s0+2.3283064365386963e-10*t.c;return t.s0=t.s1,t.s1=t.s2,t.s2=e-(t.c=0|e)},t.c=1,t.s0=r(" "),t.s1=r(" "),t.s2=r(" "),t.s0-=r(e),t.s0<0&&(t.s0+=1),t.s1-=r(e),t.s1<0&&(t.s1+=1),t.s2-=r(e),t.s2<0&&(t.s2+=1),r=null}function copy(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function impl(e,t){var r=new Alea(e),a=t&&t.state,n=r.next;return n.int32=function(){return 4294967296*r.next()|0},n.double=function(){return n()+11102230246251565e-32*(2097152*n()|0)},n.quick=n,a&&("object"==typeof a&©(a,r),n.state=function(){return copy(r,{})}),n}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.alea=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this,r="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:r+=e;for(var a=0;a>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&("object"==typeof a&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xor128=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this,r="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:r+=e;for(var a=0;a>>4),t.next()}function copy(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function impl(e,t){var r=new XorGen(e),a=t&&t.state,prng=function(){return(r.next()>>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&("object"==typeof a&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xorwow=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this;t.next=function(){var e,r,a=t.x,n=t.i;return e=a[n],r=(e^=e>>>7)^e<<24,r^=(e=a[n+1&7])^e>>>10,r^=(e=a[n+3&7])^e>>>3,r^=(e=a[n+4&7])^e<<7,e=a[n+7&7],r^=(e^=e<<13)^e<<9,a[n]=r,t.i=n+1&7,r},function init(e,t){var r,a=[];if(t===(0|t))a[0]=t;else for(t=""+t,r=0;r0;--r)e.next()}(t,e)}function copy(e,t){return t.x=e.x.slice(),t.i=e.i,t}function impl(e,t){null==e&&(e=+new Date);var r=new XorGen(e),a=t&&t.state,prng=function(){return(r.next()>>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&(a.x&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xorshift7=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this;t.next=function(){var e,r,a=t.w,n=t.X,o=t.i;return t.w=a=a+1640531527|0,r=n[o+34&127],e=n[o=o+1&127],r^=r<<13,e^=e<<17,r^=r>>>15,e^=e>>>12,r=n[o]=r^e,t.i=o,r+(a^a>>>16)|0},function init(e,t){var r,a,n,o,c,s=[],d=128;for(t===(0|t)?(a=t,t=null):(t+="\0",a=0,d=Math.max(d,t.length)),n=0,o=-32;o>>15,a^=a<<4,a^=a>>>13,o>=0&&(c=c+1640531527|0,n=0==(r=s[127&o]^=a+c)?n+1:0);for(n>=128&&(s[127&(t&&t.length||0)]=-1),n=127,o=512;o>0;--o)a=s[n+34&127],r=s[n=n+1&127],a^=a<<13,r^=r<<17,a^=a>>>15,r^=r>>>12,s[n]=a^r;e.w=c,e.X=s,e.i=n}(t,e)}function copy(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function impl(e,t){null==e&&(e=+new Date);var r=new XorGen(e),a=t&&t.state,prng=function(){return(r.next()>>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&(a.X&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xor4096=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this,r="";t.next=function(){var e=t.b,r=t.c,a=t.d,n=t.a;return e=e<<25^e>>>7^r,r=r-a|0,a=a<<24^a>>>8^n,n=n-e|0,t.b=e=e<<20^e>>>12^r,t.c=r=r-a|0,t.d=a<<16^r>>>16^n,t.a=n-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):r+=e;for(var a=0;a>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&("object"==typeof a&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.tychei=impl}(0,e=r.nmd(e),r.amdD)},e=>{e.exports=function incr32(e){for(var t,r=e.length;r--;){if(255!==(t=e.readUInt8(r))){t++,e.writeUInt8(t,r);break}e.writeUInt8(0,r)}}},(e,t,r)=>{var a=r(322),n=r(11).Buffer,o=r(125),c=r(10),s=r(737),d=r(233),u=r(438);function StreamCipher(e,t,r,c){o.call(this);var d=n.alloc(4,0);this._cipher=new a.AES(t);var h=this._cipher.encryptBlock(d);this._ghash=new s(h),r=function calcIv(e,t,r){if(12===t.length)return e._finID=n.concat([t,n.from([0,0,0,1])]),n.concat([t,n.from([0,0,0,2])]);var a=new s(r),o=t.length,c=o%16;a.update(t),c&&(c=16-c,a.update(n.alloc(c,0))),a.update(n.alloc(8,0));var d=8*o,h=n.alloc(8);h.writeUIntBE(d,0,8),a.update(h),e._finID=a.state;var l=n.from(e._finID);return u(l),l}(this,r,h),this._prev=n.from(r),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=c,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}c(StreamCipher,o),StreamCipher.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=n.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r},StreamCipher.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=d(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function xorTest(e,t){var r=0;e.length!==t.length&&r++;for(var a=Math.min(e.length,t.length),n=0;n{var a=r(322),n=r(11).Buffer,o=r(125);function StreamCipher(e,t,r,c){o.call(this),this._cipher=new a.AES(t),this._prev=n.from(r),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=c,this._mode=e}r(10)(StreamCipher,o),StreamCipher.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},StreamCipher.prototype._final=function(){this._cipher.scrub()},e.exports=StreamCipher},(e,t,r)=>{"use strict";var a=r(11).Buffer,n=r(266).Transform;function HashBase(e){n.call(this),this._block=a.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(10)(HashBase,n),HashBase.prototype._transform=function(e,t,r){var a=null;try{this.update(e,t)}catch(e){a=e}r(a)},HashBase.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},HashBase.prototype.update=function(e,t){if(function throwIfNotStringOrBuffer(e,t){if(!a.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");a.isBuffer(e)||(e=a.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var o=this._blockOffset;o0;++c)this._length[c]+=s,(s=this._length[c]/4294967296|0)>0&&(this._length[c]-=4294967296*s);return this},HashBase.prototype._update=function(){throw new Error("_update is not implemented")},HashBase.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},HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=HashBase},function(e){"use strict";!function(t){const r=2147483647;function SHA256(e){const t=new Uint32Array([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]);let r=1779033703,a=3144134277,n=1013904242,o=2773480762,c=1359893119,s=2600822924,d=528734635,u=1541459225;const h=new Uint32Array(64);function blocks(e){let l=0,b=e.length;for(;b>=64;){let g,p,B,m,I,y=r,x=a,C=n,v=o,Q=c,w=s,_=d,k=u;for(p=0;p<16;p++)B=l+4*p,h[p]=(255&e[B])<<24|(255&e[B+1])<<16|(255&e[B+2])<<8|255&e[B+3];for(p=16;p<64;p++)g=h[p-2],m=(g>>>17|g<<15)^(g>>>19|g<<13)^g>>>10,g=h[p-15],I=(g>>>7|g<<25)^(g>>>18|g<<14)^g>>>3,h[p]=(m+h[p-7]|0)+(I+h[p-16]|0)|0;for(p=0;p<64;p++)m=(((Q>>>6|Q<<26)^(Q>>>11|Q<<21)^(Q>>>25|Q<<7))+(Q&w^~Q&_)|0)+(k+(t[p]+h[p]|0)|0)|0,I=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&x^y&C^x&C)|0,k=_,_=w,w=Q,Q=v+m|0,v=C,C=x,x=y,y=m+I|0;r=r+y|0,a=a+x|0,n=n+C|0,o=o+v|0,c=c+Q|0,s=s+w|0,d=d+_|0,u=u+k|0,l+=64,b-=64}}blocks(e);let l,b=e.length%64,g=e.length/536870912|0,p=e.length<<3,B=b<56?56:120,m=e.slice(e.length-b,e.length);for(m.push(128),l=b+1;l>>24&255),m.push(g>>>16&255),m.push(g>>>8&255),m.push(g>>>0&255),m.push(p>>>24&255),m.push(p>>>16&255),m.push(p>>>8&255),m.push(p>>>0&255),blocks(m),[r>>>24&255,r>>>16&255,r>>>8&255,r>>>0&255,a>>>24&255,a>>>16&255,a>>>8&255,a>>>0&255,n>>>24&255,n>>>16&255,n>>>8&255,n>>>0&255,o>>>24&255,o>>>16&255,o>>>8&255,o>>>0&255,c>>>24&255,c>>>16&255,c>>>8&255,c>>>0&255,s>>>24&255,s>>>16&255,s>>>8&255,s>>>0&255,d>>>24&255,d>>>16&255,d>>>8&255,d>>>0&255,u>>>24&255,u>>>16&255,u>>>8&255,u>>>0&255]}function PBKDF2_HMAC_SHA256_OneIter(e,t,r){e=e.length<=64?e:SHA256(e);const a=64+t.length+4,n=new Array(a),o=new Array(64);let c,s=[];for(c=0;c<64;c++)n[c]=54;for(c=0;c=a-4;e--){if(n[e]++,n[e]<=255)return;n[e]=0}}for(;r>=32;)incrementCounter(),s=s.concat(SHA256(o.concat(SHA256(n)))),r-=32;return r>0&&(incrementCounter(),s=s.concat(SHA256(o.concat(SHA256(n))).slice(0,r))),s}function blockmix_salsa8(e,t,r,a,n){let o;for(arraycopy(e,16*(2*r-1),n,0,16),o=0;o<2*r;o++)blockxor(e,16*o,n,16),salsa20_8(n,a),arraycopy(n,0,e,t+16*o,16);for(o=0;o>>32-t}function salsa20_8(e,t){arraycopy(e,0,t,0,16);for(let e=8;e>0;e-=2)t[4]^=R(t[0]+t[12],7),t[8]^=R(t[4]+t[0],9),t[12]^=R(t[8]+t[4],13),t[0]^=R(t[12]+t[8],18),t[9]^=R(t[5]+t[1],7),t[13]^=R(t[9]+t[5],9),t[1]^=R(t[13]+t[9],13),t[5]^=R(t[1]+t[13],18),t[14]^=R(t[10]+t[6],7),t[2]^=R(t[14]+t[10],9),t[6]^=R(t[2]+t[14],13),t[10]^=R(t[6]+t[2],18),t[3]^=R(t[15]+t[11],7),t[7]^=R(t[3]+t[15],9),t[11]^=R(t[7]+t[3],13),t[15]^=R(t[11]+t[7],18),t[1]^=R(t[0]+t[3],7),t[2]^=R(t[1]+t[0],9),t[3]^=R(t[2]+t[1],13),t[0]^=R(t[3]+t[2],18),t[6]^=R(t[5]+t[4],7),t[7]^=R(t[6]+t[5],9),t[4]^=R(t[7]+t[6],13),t[5]^=R(t[4]+t[7],18),t[11]^=R(t[10]+t[9],7),t[8]^=R(t[11]+t[10],9),t[9]^=R(t[8]+t[11],13),t[10]^=R(t[9]+t[8],18),t[12]^=R(t[15]+t[14],7),t[13]^=R(t[12]+t[15],9),t[14]^=R(t[13]+t[12],13),t[15]^=R(t[14]+t[13],18);for(let r=0;r<16;++r)e[r]+=t[r]}function blockxor(e,t,r,a){for(let n=0;n=256)return!1}return!0}function ensureInteger(e,t){if("number"!=typeof e||e%1)throw new Error("invalid "+t);return e}function _scrypt(e,t,a,n,o,c,s){if(a=ensureInteger(a,"N"),n=ensureInteger(n,"r"),o=ensureInteger(o,"p"),c=ensureInteger(c,"dkLen"),0===a||0!=(a&a-1))throw new Error("N must be power of 2");if(a>r/128/n)throw new Error("N too large");if(n>r/128/o)throw new Error("r too large");if(!checkBufferish(e))throw new Error("password must be an array or buffer");if(e=Array.prototype.slice.call(e),!checkBufferish(t))throw new Error("salt must be an array or buffer");t=Array.prototype.slice.call(t);let d=PBKDF2_HMAC_SHA256_OneIter(e,t,128*o*n);const u=new Uint32Array(32*o*n);for(let e=0;ew&&(t=w);for(let e=0;ew&&(t=w);for(let e=0;e>0&255),d.push(u[e]>>8&255),d.push(u[e]>>16&255),d.push(u[e]>>24&255);const r=PBKDF2_HMAC_SHA256_OneIter(e,d,c);return s&&s(null,1,r),r}s&&_(incrementalSMix)};if(!s)for(;;){const e=incrementalSMix();if(null!=e)return e}incrementalSMix()}const a={scrypt:function(e,t,r,a,n,o,c){return new Promise((function(s,d){let u=0;c&&c(0),_scrypt(e,t,r,a,n,o,(function(e,t,r){if(e)d(e);else if(r)c&&1!==u&&c(1),s(new Uint8Array(r));else if(c&&t!==u)return u=t,c(t)}))}))},syncScrypt:function(e,t,r,a,n,o){return new Uint8Array(_scrypt(e,t,r,a,n,o))}};e.exports=a}()},(e,t,r)=>{var a=r(10),n=r(177),o=r(11).Buffer,c=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function Sha256(){this.init(),this._w=s,n.call(this,64,56)}function ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function sigma1(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function gamma0(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}a(Sha256,n),Sha256.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},Sha256.prototype._update=function(e){for(var t,r=this._w,a=0|this._a,n=0|this._b,o=0|this._c,s=0|this._d,d=0|this._e,u=0|this._f,h=0|this._g,l=0|this._h,b=0;b<16;++b)r[b]=e.readInt32BE(4*b);for(;b<64;++b)r[b]=0|(((t=r[b-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[b-7]+gamma0(r[b-15])+r[b-16];for(var g=0;g<64;++g){var p=l+sigma1(d)+ch(d,u,h)+c[g]+r[g]|0,B=sigma0(a)+maj(a,n,o)|0;l=h,h=u,u=d,d=s+p|0,s=o,o=n,n=a,a=p+B|0}this._a=a+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=d+this._e|0,this._f=u+this._f|0,this._g=h+this._g|0,this._h=l+this._h|0},Sha256.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=Sha256},(e,t,r)=>{var a=r(10),n=r(177),o=r(11).Buffer,c=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],s=new Array(160);function Sha512(){this.init(),this._w=s,n.call(this,128,112)}function Ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function sigma1(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Gamma0(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Gamma0l(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function Gamma1(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Gamma1l(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function getCarry(e,t){return e>>>0>>0?1:0}a(Sha512,n),Sha512.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},Sha512.prototype._update=function(e){for(var t=this._w,r=0|this._ah,a=0|this._bh,n=0|this._ch,o=0|this._dh,s=0|this._eh,d=0|this._fh,u=0|this._gh,h=0|this._hh,l=0|this._al,b=0|this._bl,g=0|this._cl,p=0|this._dl,B=0|this._el,m=0|this._fl,I=0|this._gl,y=0|this._hl,x=0;x<32;x+=2)t[x]=e.readInt32BE(4*x),t[x+1]=e.readInt32BE(4*x+4);for(;x<160;x+=2){var C=t[x-30],v=t[x-30+1],Q=Gamma0(C,v),w=Gamma0l(v,C),_=Gamma1(C=t[x-4],v=t[x-4+1]),k=Gamma1l(v,C),N=t[x-14],D=t[x-14+1],U=t[x-32],G=t[x-32+1],T=w+D|0,L=Q+N+getCarry(T,w)|0;L=(L=L+_+getCarry(T=T+k|0,k)|0)+U+getCarry(T=T+G|0,G)|0,t[x]=L,t[x+1]=T}for(var q=0;q<160;q+=2){L=t[q],T=t[q+1];var P=maj(r,a,n),O=maj(l,b,g),H=sigma0(r,l),Y=sigma0(l,r),J=sigma1(s,B),j=sigma1(B,s),z=c[q],W=c[q+1],V=Ch(s,d,u),X=Ch(B,m,I),$=y+j|0,et=h+J+getCarry($,y)|0;et=(et=(et=et+V+getCarry($=$+X|0,X)|0)+z+getCarry($=$+W|0,W)|0)+L+getCarry($=$+T|0,T)|0;var tt=Y+O|0,rt=H+P+getCarry(tt,Y)|0;h=u,y=I,u=d,I=m,d=s,m=B,s=o+et+getCarry(B=p+$|0,p)|0,o=n,p=g,n=a,g=b,a=r,b=l,r=et+rt+getCarry(l=$+tt|0,$)|0}this._al=this._al+l|0,this._bl=this._bl+b|0,this._cl=this._cl+g|0,this._dl=this._dl+p|0,this._el=this._el+B|0,this._fl=this._fl+m|0,this._gl=this._gl+I|0,this._hl=this._hl+y|0,this._ah=this._ah+r+getCarry(this._al,l)|0,this._bh=this._bh+a+getCarry(this._bl,b)|0,this._ch=this._ch+n+getCarry(this._cl,g)|0,this._dh=this._dh+o+getCarry(this._dl,p)|0,this._eh=this._eh+s+getCarry(this._el,B)|0,this._fh=this._fh+d+getCarry(this._fl,m)|0,this._gh=this._gh+u+getCarry(this._gl,I)|0,this._hh=this._hh+h+getCarry(this._hl,y)|0},Sha512.prototype._hash=function(){var e=o.allocUnsafe(64);function writeInt64BE(t,r,a){e.writeInt32BE(t,a),e.writeInt32BE(r,a+4)}return writeInt64BE(this._ah,this._al,0),writeInt64BE(this._bh,this._bl,8),writeInt64BE(this._ch,this._cl,16),writeInt64BE(this._dh,this._dl,24),writeInt64BE(this._eh,this._el,32),writeInt64BE(this._fh,this._fl,40),writeInt64BE(this._gh,this._gl,48),writeInt64BE(this._hh,this._hl,56),e},e.exports=Sha512},(e,t,r)=>{"use strict";var a=r(10),n=r(742),o=r(125),c=r(11).Buffer,s=r(446),d=r(324),u=r(325),h=c.alloc(128);function Hmac(e,t){o.call(this,"digest"),"string"==typeof t&&(t=c.from(t));var r="sha512"===e||"sha384"===e?128:64;(this._alg=e,this._key=t,t.length>r)?t=("rmd160"===e?new d:u(e)).update(t).digest():t.length{var a=r(323);e.exports=function(e){return(new a).update(e).digest()}},e=>{var t=Math.pow(2,30)-1;e.exports=function(e,r){if("number"!=typeof e)throw new TypeError("Iterations not a number");if(e<0)throw new TypeError("Bad iterations");if("number"!=typeof r)throw new TypeError("Key length not a number");if(r<0||r>t||r!=r)throw new TypeError("Bad key length")}},(e,t,r)=>{var a,n=r(1);if(r.g.process&&r.g.process.browser)a="utf-8";else if(r.g.process&&r.g.process.version){a=parseInt(n.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else a="utf-8";e.exports=a},(e,t,r)=>{var a=r(446),n=r(324),o=r(325),c=r(11).Buffer,s=r(447),d=r(448),u=r(450),h=c.alloc(128),l={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function Hmac(e,t,r){var s=function getDigest(e){function shaFunc(t){return o(e).update(t).digest()}function rmd160Func(e){return(new n).update(e).digest()}return"rmd160"===e||"ripemd160"===e?rmd160Func:"md5"===e?a:shaFunc}(e),d="sha512"===e||"sha384"===e?128:64;t.length>d?t=s(t):t.length{var a=r(11).Buffer;e.exports=function(e,t,r){if(a.isBuffer(e))return e;if("string"==typeof e)return a.from(e,t);if(ArrayBuffer.isView(e))return a.from(e.buffer);throw new TypeError(r+" must be a string, a Buffer, a typed array or a DataView")}},(e,t,r)=>{"use strict";var a=r(70),n=r(10),o=r(747),c=r(326);function DESState(){this.tmp=new Array(2),this.keys=null}function DES(e){c.call(this,e);var t=new DESState;this._desState=t,this.deriveKeys(t,e.key)}n(DES,c),e.exports=DES,DES.create=function create(e){return new DES(e)};var s=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];DES.prototype.deriveKeys=function deriveKeys(e,t){e.keys=new Array(32),a.equal(t.length,this.blockSize,"Invalid key length");var r=o.readUInt32BE(t,0),n=o.readUInt32BE(t,4);o.pc1(r,n,e.tmp,0),r=e.tmp[0],n=e.tmp[1];for(var c=0;c>>1];r=o.r28shl(r,d),n=o.r28shl(n,d),o.pc2(r,n,e.keys,c)}},DES.prototype._update=function _update(e,t,r,a){var n=this._desState,c=o.readUInt32BE(e,t),s=o.readUInt32BE(e,t+4);o.ip(c,s,n.tmp,0),c=n.tmp[0],s=n.tmp[1],"encrypt"===this.type?this._encrypt(n,c,s,n.tmp,0):this._decrypt(n,c,s,n.tmp,0),c=n.tmp[0],s=n.tmp[1],o.writeUInt32BE(r,c,a),o.writeUInt32BE(r,s,a+4)},DES.prototype._pad=function _pad(e,t){for(var r=e.length-t,a=t;a>>0,c=b}o.rip(s,c,a,n)},DES.prototype._decrypt=function _decrypt(e,t,r,a,n){for(var c=r,s=t,d=e.keys.length-2;d>=0;d-=2){var u=e.keys[d],h=e.keys[d+1];o.expand(c,e.tmp,0),u^=e.tmp[0],h^=e.tmp[1];var l=o.substitute(u,h),b=c;c=(s^o.permute(l))>>>0,s=b}o.rip(c,s,a,n)}},(e,t,r)=>{var a=r(158);e.exports=findPrime,findPrime.simpleSieve=simpleSieve,findPrime.fermatTest=fermatTest;var n=r(29),o=new n(24),c=new(r(453)),s=new n(1),d=new n(2),u=new n(5),h=(new n(16),new n(8),new n(10)),l=new n(3),b=(new n(7),new n(11)),g=new n(4),p=(new n(12),null);function _getPrimes(){if(null!==p)return p;var e=[];e[0]=2;for(var t=1,r=3;r<1048576;r+=2){for(var a=Math.ceil(Math.sqrt(r)),n=0;ne;)r.ishrn(1);if(r.isEven()&&r.iadd(s),r.testn(1)||r.iadd(d),t.cmp(d)){if(!t.cmp(u))for(;r.mod(h).cmp(l);)r.iadd(g)}else for(;r.mod(o).cmp(b);)r.iadd(g);if(simpleSieve(p=r.shrn(1))&&simpleSieve(r)&&fermatTest(p)&&fermatTest(r)&&c.test(p)&&c.test(r))return r}}},(e,t,r)=>{var a=r(29),n=r(327);function MillerRabin(e){this.rand=e||new n.Rand}e.exports=MillerRabin,MillerRabin.create=function create(e){return new MillerRabin(e)},MillerRabin.prototype._randbelow=function _randbelow(e){var t=e.bitLength(),r=Math.ceil(t/8);do{var n=new a(this.rand.generate(r))}while(n.cmp(e)>=0);return n},MillerRabin.prototype._randrange=function _randrange(e,t){var r=t.sub(e);return e.add(this._randbelow(r))},MillerRabin.prototype.test=function test(e,t,r){var n=e.bitLength(),o=a.mont(e),c=new a(1).toRed(o);t||(t=Math.max(1,n/48|0));for(var s=e.subn(1),d=0;!s.testn(d);d++);for(var u=e.shrn(d),h=s.toRed(o);t>0;t--){var l=this._randrange(new a(2),s);r&&r(l);var b=l.toRed(o).redPow(u);if(0!==b.cmp(c)&&0!==b.cmp(h)){for(var g=1;g0;t--){var h=this._randrange(new a(2),c),l=e.gcd(h);if(0!==l.cmpn(1))return l;var b=h.toRed(n).redPow(d);if(0!==b.cmp(o)&&0!==b.cmp(u)){for(var g=1;g=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void assert(!1,"Invalid character in "+e)}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=0,c=Math.min(e.length,r),s=t;s=49?d-49+10:d>=17?d-17+10:d,assert(d>=0&&o0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);return this._strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;this._strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,c=o%a,s=Math.min(o,o-c)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{BN.prototype[Symbol.for("nodejs.util.inspect.custom")]=inspect}catch(e){BN.prototype.inspect=inspect}else BN.prototype.inspect=inspect;function inspect(){return(this.red?""}var n=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],o=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,s=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=c[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modrn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16,2)},a&&(BN.prototype.toBuffer=function toBuffer(e,t){return this.toArrayLike(a,e,t)}),BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)};function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],c=n*o,s=67108863&c,d=c/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(c=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&c}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r._strip()}BN.prototype.toArrayLike=function toArrayLike(e,t,r){this._strip();var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0");var o=function allocate(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,n);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,a),o},BN.prototype._toArrayLikeLE=function _toArrayLikeLE(e,t){for(var r=0,a=0,n=0,o=0;n>8&255),r>16&255),6===o?(r>24&255),a=0,o=0):(a=c>>>24,o+=2)}if(r=0&&(e[r--]=c>>8&255),r>=0&&(e[r--]=c>>16&255),6===o?(r>=0&&(e[r--]=c>>24&255),a=0,o=0):(a=c>>>24,o+=2)}if(r>=0)for(e[r--]=a;r>=0;)e[r--]=0},Math.clz32?BN.prototype._countBits=function _countBits(e){return 32-Math.clz32(e)}:BN.prototype._countBits=function _countBits(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this._strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,c=0;c>26,this.words[c]=67108863&t;for(;0!==o&&c>26,this.words[c]=67108863&t;if(0===o&&c>>13,g=0|c[1],p=8191&g,B=g>>>13,m=0|c[2],I=8191&m,y=m>>>13,x=0|c[3],C=8191&x,v=x>>>13,Q=0|c[4],w=8191&Q,_=Q>>>13,k=0|c[5],N=8191&k,D=k>>>13,U=0|c[6],G=8191&U,T=U>>>13,L=0|c[7],q=8191&L,P=L>>>13,O=0|c[8],H=8191&O,Y=O>>>13,J=0|c[9],j=8191&J,z=J>>>13,W=0|s[0],V=8191&W,X=W>>>13,$=0|s[1],et=8191&$,tt=$>>>13,rt=0|s[2],at=8191&rt,it=rt>>>13,nt=0|s[3],ot=8191&nt,At=nt>>>13,ct=0|s[4],st=8191&ct,dt=ct>>>13,ut=0|s[5],ht=8191&ut,bt=ut>>>13,pt=0|s[6],Bt=8191&pt,mt=pt>>>13,It=0|s[7],Et=8191&It,yt=It>>>13,xt=0|s[8],Ct=8191&xt,vt=xt>>>13,Qt=0|s[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(C,V),n=(n=Math.imul(C,X))+Math.imul(v,V)|0,o=Math.imul(v,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(C,et)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(v,et)|0,o=o+Math.imul(v,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,st)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(C,at)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(v,at)|0,o=o+Math.imul(v,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,st)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,st)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,At)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,At)|0,a=a+Math.imul(I,st)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,st)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(q,V),n=(n=Math.imul(q,X))+Math.imul(P,V)|0,o=Math.imul(P,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(C,st)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(v,st)|0,o=o+Math.imul(v,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(q,et)|0,n=(n=n+Math.imul(q,tt)|0)+Math.imul(P,et)|0,o=o+Math.imul(P,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,st)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,st)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,bt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,Ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,vt)|0)+Math.imul(b,Ct)|0))<<13)|0;u=((o=o+Math.imul(b,vt)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(j,V),n=(n=Math.imul(j,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(q,at)|0,n=(n=n+Math.imul(q,it)|0)+Math.imul(P,at)|0,o=o+Math.imul(P,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,st)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,st)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(C,Bt)|0,n=(n=n+Math.imul(C,mt)|0)+Math.imul(v,Bt)|0,o=o+Math.imul(v,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,Ct)|0,n=(n=n+Math.imul(p,vt)|0)+Math.imul(B,Ct)|0,o=o+Math.imul(B,vt)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(j,et),n=(n=Math.imul(j,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(q,ot)|0,n=(n=n+Math.imul(q,At)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,At)|0,a=a+Math.imul(G,st)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,st)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(C,Et)|0,n=(n=n+Math.imul(C,yt)|0)+Math.imul(v,Et)|0,o=o+Math.imul(v,yt)|0,a=a+Math.imul(I,Ct)|0,n=(n=n+Math.imul(I,vt)|0)+Math.imul(y,Ct)|0,o=o+Math.imul(y,vt)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(j,at),n=(n=Math.imul(j,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(q,st)|0,n=(n=n+Math.imul(q,dt)|0)+Math.imul(P,st)|0,o=o+Math.imul(P,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(C,Ct)|0,n=(n=n+Math.imul(C,vt)|0)+Math.imul(v,Ct)|0,o=o+Math.imul(v,vt)|0;var qt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(j,ot),n=(n=Math.imul(j,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,st)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,st)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(q,ht)|0,n=(n=n+Math.imul(q,bt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,Ct)|0,n=(n=n+Math.imul(w,vt)|0)+Math.imul(_,Ct)|0,o=o+Math.imul(_,vt)|0;var Pt=(u+(a=a+Math.imul(C,wt)|0)|0)+((8191&(n=(n=n+Math.imul(C,Mt)|0)+Math.imul(v,wt)|0))<<13)|0;u=((o=o+Math.imul(v,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(j,st),n=(n=Math.imul(j,dt))+Math.imul(z,st)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(q,Bt)|0,n=(n=n+Math.imul(q,mt)|0)+Math.imul(P,Bt)|0,o=o+Math.imul(P,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,Ct)|0,n=(n=n+Math.imul(N,vt)|0)+Math.imul(D,Ct)|0,o=o+Math.imul(D,vt)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(j,ht),n=(n=Math.imul(j,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(q,Et)|0,n=(n=n+Math.imul(q,yt)|0)+Math.imul(P,Et)|0,o=o+Math.imul(P,yt)|0,a=a+Math.imul(G,Ct)|0,n=(n=n+Math.imul(G,vt)|0)+Math.imul(T,Ct)|0,o=o+Math.imul(T,vt)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(j,Bt),n=(n=Math.imul(j,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(q,Ct)|0,n=(n=n+Math.imul(q,vt)|0)+Math.imul(P,Ct)|0,o=o+Math.imul(P,vt)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(j,Et),n=(n=Math.imul(j,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,Ct)|0,n=(n=n+Math.imul(H,vt)|0)+Math.imul(Y,Ct)|0,o=o+Math.imul(Y,vt)|0;var Jt=(u+(a=a+Math.imul(q,wt)|0)|0)+((8191&(n=(n=n+Math.imul(q,Mt)|0)+Math.imul(P,wt)|0))<<13)|0;u=((o=o+Math.imul(P,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(j,Ct),n=(n=Math.imul(j,vt))+Math.imul(z,Ct)|0,o=Math.imul(z,vt);var Kt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863;var jt=(u+(a=Math.imul(j,wt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=qt,d[12]=Pt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=Jt,d[17]=Kt,d[18]=jt,0!==u&&(d[19]=u,r.length++),r};function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,c&=67108863}r.words[o]=s,a=c,c=n}return 0!==a?r.words[o]=a:r.length--,r._strip()}function jumboMulTo(e,t,r){return bigMulTo(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(s=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?s(this,e,t):r<63?smallMulTo(this,e,t):r<1024?bigMulTo(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var c=0;c>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,r+=n/67108864|0,r+=o>>>26,this.words[a]=67108863&o}return 0!==r&&(this.words[a]=r,this.length++),t?this.ineg():this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n&1}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),c=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&c}return s&&0!==u&&(s.words[s.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(s/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===c)return this._strip();for(assert(-1===c),c=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this._strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var c,s=a.length-n.length;if("mod"!==t){(c=new BN(null)).length=s+1,c.words=new Array(c.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);c&&(c.words[h]=l)}return c&&c._strip(),a._strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:c||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modrn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modrn=function modrn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=(1<<26)%e,a=0,n=this.length-1;n>=0;n--)a=(r*a+(0|this.words[n]))%e;return t?-a:a},BN.prototype.modn=function modn(e){return this.modrn(e)},BN.prototype.idivn=function idivn(e){var t=e<0;t&&(e=-e),assert(e<=67108863);for(var r=0,a=this.length-1;a>=0;a--){var n=(0|this.words[a])+67108864*r;this.words[a]=n/e|0,r=n%e}return this._strip(),t?this.ineg():this},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),c=new BN(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(d),c.isub(u)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(c)):(r.isub(t),o.isub(a),c.isub(n))}return{a:o,b:c,gcd:r.iushln(s)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var s=0,d=1;0==(t.words[0]&d)&&s<26;++s,d<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(c),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,c&=67108863,this.words[o]=c}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=c}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(move(e,e.umod(this.m)._forceRed(this)),e)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),c=o.redNeg(),s=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,s).cmp(c);)d.redIAdd(c);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=s-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++c||0===a&&0===u)&&(n=this.mul(n,r[o]),c=0,o=0)):c=0}s=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},(e,t)=>{"use strict";var r=t;function zero2(e){return 1===e.length?"0"+e:e}function toHex(e){for(var t="",r=0;r>8,c=255&n;o?r.push(o,c):r.push(c)}return r},r.zero2=zero2,r.toHex=toHex,r.encode=function encode(e,t){return"hex"===t?toHex(e):e}},(e,t,r)=>{"use strict";var a=t;a.base=r(267),a.short=r(752),a.mont=r(753),a.edwards=r(754)},(e,t,r)=>{"use strict";var a=r(114),n=r(268),o=r(756),c=r(70),s=a.sum32,d=a.sum32_4,u=a.sum32_5,h=o.ch32,l=o.maj32,b=o.s0_256,g=o.s1_256,p=o.g0_256,B=o.g1_256,m=n.BlockHash,I=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function SHA256(){if(!(this instanceof SHA256))return new SHA256;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=I,this.W=new Array(64)}a.inherits(SHA256,m),e.exports=SHA256,SHA256.blockSize=512,SHA256.outSize=256,SHA256.hmacStrength=192,SHA256.padLength=64,SHA256.prototype._update=function _update(e,t){for(var r=this.W,a=0;a<16;a++)r[a]=e[t+a];for(;a{"use strict";var a=r(114),n=r(268),o=r(70),c=a.rotr64_hi,s=a.rotr64_lo,d=a.shr64_hi,u=a.shr64_lo,h=a.sum64,l=a.sum64_hi,b=a.sum64_lo,g=a.sum64_4_hi,p=a.sum64_4_lo,B=a.sum64_5_hi,m=a.sum64_5_lo,I=n.BlockHash,y=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function SHA512(){if(!(this instanceof SHA512))return new SHA512;I.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=y,this.W=new Array(160)}function ch64_hi(e,t,r,a,n){var o=e&r^~e&n;return o<0&&(o+=4294967296),o}function ch64_lo(e,t,r,a,n,o){var c=t&a^~t&o;return c<0&&(c+=4294967296),c}function maj64_hi(e,t,r,a,n){var o=e&r^e&n^r&n;return o<0&&(o+=4294967296),o}function maj64_lo(e,t,r,a,n,o){var c=t&a^t&o^a&o;return c<0&&(c+=4294967296),c}function s0_512_hi(e,t){var r=c(e,t,28)^c(t,e,2)^c(t,e,7);return r<0&&(r+=4294967296),r}function s0_512_lo(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function s1_512_hi(e,t){var r=c(e,t,14)^c(e,t,18)^c(t,e,9);return r<0&&(r+=4294967296),r}function s1_512_lo(e,t){var r=s(e,t,14)^s(e,t,18)^s(t,e,9);return r<0&&(r+=4294967296),r}function g0_512_hi(e,t){var r=c(e,t,1)^c(e,t,8)^d(e,t,7);return r<0&&(r+=4294967296),r}function g0_512_lo(e,t){var r=s(e,t,1)^s(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function g1_512_hi(e,t){var r=c(e,t,19)^c(t,e,29)^d(e,t,6);return r<0&&(r+=4294967296),r}function g1_512_lo(e,t){var r=s(e,t,19)^s(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}a.inherits(SHA512,I),e.exports=SHA512,SHA512.blockSize=1024,SHA512.outSize=512,SHA512.hmacStrength=192,SHA512.padLength=128,SHA512.prototype._prepareBlock=function _prepareBlock(e,t){for(var r=this.W,a=0;a<32;a++)r[a]=e[t+a];for(;a{"use strict";const a=t;a.bignum=r(29),a.define=r(768).define,a.base=r(771),a.constants=r(772),a.decoders=r(463),a.encoders=r(460)},(e,t,r)=>{"use strict";const a=t;a.der=r(461),a.pem=r(769)},(e,t,r)=>{"use strict";const a=r(10),n=r(333).Buffer,o=r(334),c=r(271);function DEREncoder(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new DERNode,this.tree._init(e.body)}function DERNode(e){o.call(this,"der",e)}function two(e){return e<10?"0"+e:e}e.exports=DEREncoder,DEREncoder.prototype.encode=function encode(e,t){return this.tree._encode(e,t).join()},a(DERNode,o),DERNode.prototype._encodeComposite=function encodeComposite(e,t,r,a){const o=function encodeTag(e,t,r,a){let n;"seqof"===e?e="seq":"setof"===e&&(e="set");if(c.tagByName.hasOwnProperty(e))n=c.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return a.error("Unknown tag: "+e);n=e}if(n>=31)return a.error("Multi-octet tag encoding unsupported");t||(n|=32);return n|=c.tagClassByName[r||"universal"]<<6,n}(e,t,r,this.reporter);if(a.length<128){const e=n.alloc(2);return e[0]=o,e[1]=a.length,this._createEncoderBuffer([e,a])}let s=1;for(let e=a.length;e>=256;e>>=8)s++;const d=n.alloc(2+s);d[0]=o,d[1]=128|s;for(let e=1+s,t=a.length;t>0;e--,t>>=8)d[e]=255&t;return this._createEncoderBuffer([d,a])},DERNode.prototype._encodeStr=function encodeStr(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){const t=n.alloc(2*e.length);for(let r=0;r=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}let a=0;for(let t=0;t=128;r>>=7)a++}const o=n.alloc(a);let c=o.length-1;for(let t=e.length-1;t>=0;t--){let r=e[t];for(o[c--]=127&r;(r>>=7)>0;)o[c--]=128|127&r}return this._createEncoderBuffer(o)},DERNode.prototype._encodeTime=function encodeTime(e,t){let r;const a=new Date(e);return"gentime"===t?r=[two(a.getUTCFullYear()),two(a.getUTCMonth()+1),two(a.getUTCDate()),two(a.getUTCHours()),two(a.getUTCMinutes()),two(a.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[two(a.getUTCFullYear()%100),two(a.getUTCMonth()+1),two(a.getUTCDate()),two(a.getUTCHours()),two(a.getUTCMinutes()),two(a.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},DERNode.prototype._encodeNull=function encodeNull(){return this._createEncoderBuffer("")},DERNode.prototype._encodeInt=function encodeInt(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!n.isBuffer(e)){const t=e.toArray();!e.sign&&128&t[0]&&t.unshift(0),e=n.from(t)}if(n.isBuffer(e)){let t=e.length;0===e.length&&t++;const r=n.alloc(t);return e.copy(r),0===e.length&&(r[0]=0),this._createEncoderBuffer(r)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let r=1;for(let t=e;t>=256;t>>=8)r++;const a=new Array(r);for(let t=a.length-1;t>=0;t--)a[t]=255&e,e>>=8;return 128&a[0]&&a.unshift(0),this._createEncoderBuffer(n.from(a))},DERNode.prototype._encodeBool=function encodeBool(e){return this._createEncoderBuffer(e?255:0)},DERNode.prototype._use=function use(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},DERNode.prototype._skipDefault=function skipDefault(e,t,r){const a=this._baseState;let n;if(null===a.default)return!1;const o=e.join();if(void 0===a.defaultBuffer&&(a.defaultBuffer=this._encodeValue(a.default,t,r).join()),o.length!==a.defaultBuffer.length)return!1;for(n=0;n{"use strict";const a=r(10);function Reporter(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function ReporterError(e,t){this.path=e,this.rethrow(t)}t.a=Reporter,Reporter.prototype.isError=function isError(e){return e instanceof ReporterError},Reporter.prototype.save=function save(){const e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},Reporter.prototype.restore=function restore(e){const t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},Reporter.prototype.enterKey=function enterKey(e){return this._reporterState.path.push(e)},Reporter.prototype.exitKey=function exitKey(e){const t=this._reporterState;t.path=t.path.slice(0,e-1)},Reporter.prototype.leaveKey=function leaveKey(e,t,r){const a=this._reporterState;this.exitKey(e),null!==a.obj&&(a.obj[t]=r)},Reporter.prototype.path=function path(){return this._reporterState.path.join("/")},Reporter.prototype.enterObject=function enterObject(){const e=this._reporterState,t=e.obj;return e.obj={},t},Reporter.prototype.leaveObject=function leaveObject(e){const t=this._reporterState,r=t.obj;return t.obj=e,r},Reporter.prototype.error=function error(e){let t;const r=this._reporterState,a=e instanceof ReporterError;if(t=a?e:new ReporterError(r.path.map((function(e){return"["+JSON.stringify(e)+"]"})).join(""),e.message||e,e.stack),!r.options.partial)throw t;return a||r.errors.push(t),t},Reporter.prototype.wrapResult=function wrapResult(e){const t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},a(ReporterError,Error),ReporterError.prototype.rethrow=function rethrow(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,ReporterError),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},(e,t,r)=>{"use strict";const a=t;a.der=r(464),a.pem=r(770)},(e,t,r)=>{"use strict";const a=r(10),n=r(29),o=r(270).a,c=r(334),s=r(271);function DERDecoder(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new DERNode,this.tree._init(e.body)}function DERNode(e){c.call(this,"der",e)}function derDecodeTag(e,t){let r=e.readUInt8(t);if(e.isError(r))return r;const a=s.tagClass[r>>6],n=0==(32&r);if(31==(31&r)){let a=r;for(r=0;128==(128&a);){if(a=e.readUInt8(t),e.isError(a))return a;r<<=7,r|=127&a}}else r&=31;return{cls:a,primitive:n,tag:r,tagStr:s.tag[r]}}function derDecodeLen(e,t,r){let a=e.readUInt8(r);if(e.isError(a))return a;if(!t&&128===a)return null;if(0==(128&a))return a;const n=127&a;if(n>4)return e.error("length octect is too long");a=0;for(let t=0;t{t.publicEncrypt=r(778),t.privateDecrypt=r(779),t.privateEncrypt=function privateEncrypt(e,r){return t.publicEncrypt(e,r,!0)},t.publicDecrypt=function publicDecrypt(e,r){return t.privateDecrypt(e,r,!0)}},(e,t,r)=>{var a=r(234),n=r(11).Buffer;function i2ops(e){var t=n.allocUnsafe(4);return t.writeUInt32BE(e,0),t}e.exports=function(e,t){for(var r,o=n.alloc(0),c=0;o.length{e.exports=function xor(e,t){for(var r=e.length,a=-1;++a{var a=r(29),n=r(11).Buffer;e.exports=function withPublic(e,t){return n.from(e.toRed(a.mont(t.modulus)).redPow(new a(t.publicExponent)).fromRed().toArray())}},(e,t,r)=>{e.exports=r(786)(r(787))},(e,t,r)=>{"use strict";var a=t;a.version=r(1230).a,a.utils=r(72),a.rand=r(472),a.curve=r(473),a.curves=r(336),a.ec=r(797),a.eddsa=r(801)},(e,t)=>{"use strict";var r=t;function zero2(e){return 1===e.length?"0"+e:e}function toHex(e){for(var t="",r=0;r>8,c=255&n;o?r.push(o,c):r.push(c)}return r},r.zero2=zero2,r.toHex=toHex,r.encode=function encode(e,t){return"hex"===t?toHex(e):e}},(e,t,r)=>{var a;function Rand(e){this.rand=e}if(e.exports=function rand(e){return a||(a=new Rand(null)),a.generate(e)},e.exports.Rand=Rand,Rand.prototype.generate=function generate(e){return this._rand(e)},Rand.prototype._rand=function _rand(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r{"use strict";var a=t;a.base=r(273),a.short=r(788),a.mont=r(789),a.edwards=r(790)},(e,t,r)=>{"use strict";var a=r(115),n=r(274),o=r(792),c=r(159),s=a.sum32,d=a.sum32_4,u=a.sum32_5,h=o.ch32,l=o.maj32,b=o.s0_256,g=o.s1_256,p=o.g0_256,B=o.g1_256,m=n.BlockHash,I=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function SHA256(){if(!(this instanceof SHA256))return new SHA256;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=I,this.W=new Array(64)}a.inherits(SHA256,m),e.exports=SHA256,SHA256.blockSize=512,SHA256.outSize=256,SHA256.hmacStrength=192,SHA256.padLength=64,SHA256.prototype._update=function _update(e,t){for(var r=this.W,a=0;a<16;a++)r[a]=e[t+a];for(;a{"use strict";var a=r(115),n=r(274),o=r(159),c=a.rotr64_hi,s=a.rotr64_lo,d=a.shr64_hi,u=a.shr64_lo,h=a.sum64,l=a.sum64_hi,b=a.sum64_lo,g=a.sum64_4_hi,p=a.sum64_4_lo,B=a.sum64_5_hi,m=a.sum64_5_lo,I=n.BlockHash,y=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function SHA512(){if(!(this instanceof SHA512))return new SHA512;I.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=y,this.W=new Array(160)}function ch64_hi(e,t,r,a,n){var o=e&r^~e&n;return o<0&&(o+=4294967296),o}function ch64_lo(e,t,r,a,n,o){var c=t&a^~t&o;return c<0&&(c+=4294967296),c}function maj64_hi(e,t,r,a,n){var o=e&r^e&n^r&n;return o<0&&(o+=4294967296),o}function maj64_lo(e,t,r,a,n,o){var c=t&a^t&o^a&o;return c<0&&(c+=4294967296),c}function s0_512_hi(e,t){var r=c(e,t,28)^c(t,e,2)^c(t,e,7);return r<0&&(r+=4294967296),r}function s0_512_lo(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function s1_512_hi(e,t){var r=c(e,t,14)^c(e,t,18)^c(t,e,9);return r<0&&(r+=4294967296),r}function s1_512_lo(e,t){var r=s(e,t,14)^s(e,t,18)^s(t,e,9);return r<0&&(r+=4294967296),r}function g0_512_hi(e,t){var r=c(e,t,1)^c(e,t,8)^d(e,t,7);return r<0&&(r+=4294967296),r}function g0_512_lo(e,t){var r=s(e,t,1)^s(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function g1_512_hi(e,t){var r=c(e,t,19)^c(t,e,29)^d(e,t,6);return r<0&&(r+=4294967296),r}function g1_512_lo(e,t){var r=s(e,t,19)^s(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}a.inherits(SHA512,I),e.exports=SHA512,SHA512.blockSize=1024,SHA512.outSize=512,SHA512.hmacStrength=192,SHA512.padLength=128,SHA512.prototype._prepareBlock=function _prepareBlock(e,t){for(var r=this.W,a=0;a<32;a++)r[a]=e[t+a];for(;a{"use strict";var a=r(1),n=65536,o=4294967295;var c=r(58).Buffer,s=r.g.crypto||r.g.msCrypto;s&&s.getRandomValues?e.exports=function randomBytes(e,t){if(e>o)throw new RangeError("requested too many random bytes");var r=c.allocUnsafe(e);if(e>0)if(e>n)for(var d=0;d{e.exports=function isHexPrefixed(e){if("string"!=typeof e)throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof e+", while checking isHexPrefixed.");return"0x"===e.slice(0,2)}},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(18).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),c=t;c=49?s-49+10:s>=17?s-17+10:s}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,c=o%a,s=Math.min(o,o-c)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],o=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],c=n*o,s=67108863&c,d=c/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(c=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&c}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,s=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=c[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,c,s="le"===t,d=new e(n),u=this.clone();if(s){for(c=0;!u.isZero();c++)o=u.andln(255),u.iushrn(8),d[c]=o;for(;c=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,c=0;c>26,this.words[c]=67108863&t;for(;0!==o&&c>26,this.words[c]=67108863&t;if(0===o&&c>>13,g=0|c[1],p=8191&g,B=g>>>13,m=0|c[2],I=8191&m,y=m>>>13,x=0|c[3],C=8191&x,v=x>>>13,Q=0|c[4],w=8191&Q,_=Q>>>13,k=0|c[5],N=8191&k,D=k>>>13,U=0|c[6],G=8191&U,T=U>>>13,L=0|c[7],q=8191&L,P=L>>>13,O=0|c[8],H=8191&O,Y=O>>>13,J=0|c[9],j=8191&J,z=J>>>13,W=0|s[0],V=8191&W,X=W>>>13,$=0|s[1],et=8191&$,tt=$>>>13,rt=0|s[2],at=8191&rt,it=rt>>>13,nt=0|s[3],ot=8191&nt,At=nt>>>13,ct=0|s[4],st=8191&ct,dt=ct>>>13,ut=0|s[5],ht=8191&ut,bt=ut>>>13,pt=0|s[6],Bt=8191&pt,mt=pt>>>13,It=0|s[7],Et=8191&It,yt=It>>>13,xt=0|s[8],Ct=8191&xt,vt=xt>>>13,Qt=0|s[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(C,V),n=(n=Math.imul(C,X))+Math.imul(v,V)|0,o=Math.imul(v,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(C,et)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(v,et)|0,o=o+Math.imul(v,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,st)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(C,at)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(v,at)|0,o=o+Math.imul(v,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,st)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,st)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,At)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,At)|0,a=a+Math.imul(I,st)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,st)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(q,V),n=(n=Math.imul(q,X))+Math.imul(P,V)|0,o=Math.imul(P,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(C,st)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(v,st)|0,o=o+Math.imul(v,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(q,et)|0,n=(n=n+Math.imul(q,tt)|0)+Math.imul(P,et)|0,o=o+Math.imul(P,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,st)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,st)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,bt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,Ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,vt)|0)+Math.imul(b,Ct)|0))<<13)|0;u=((o=o+Math.imul(b,vt)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(j,V),n=(n=Math.imul(j,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(q,at)|0,n=(n=n+Math.imul(q,it)|0)+Math.imul(P,at)|0,o=o+Math.imul(P,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,st)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,st)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(C,Bt)|0,n=(n=n+Math.imul(C,mt)|0)+Math.imul(v,Bt)|0,o=o+Math.imul(v,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,Ct)|0,n=(n=n+Math.imul(p,vt)|0)+Math.imul(B,Ct)|0,o=o+Math.imul(B,vt)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(j,et),n=(n=Math.imul(j,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(q,ot)|0,n=(n=n+Math.imul(q,At)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,At)|0,a=a+Math.imul(G,st)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,st)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(C,Et)|0,n=(n=n+Math.imul(C,yt)|0)+Math.imul(v,Et)|0,o=o+Math.imul(v,yt)|0,a=a+Math.imul(I,Ct)|0,n=(n=n+Math.imul(I,vt)|0)+Math.imul(y,Ct)|0,o=o+Math.imul(y,vt)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(j,at),n=(n=Math.imul(j,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(q,st)|0,n=(n=n+Math.imul(q,dt)|0)+Math.imul(P,st)|0,o=o+Math.imul(P,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(C,Ct)|0,n=(n=n+Math.imul(C,vt)|0)+Math.imul(v,Ct)|0,o=o+Math.imul(v,vt)|0;var qt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(j,ot),n=(n=Math.imul(j,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,st)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,st)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(q,ht)|0,n=(n=n+Math.imul(q,bt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,Ct)|0,n=(n=n+Math.imul(w,vt)|0)+Math.imul(_,Ct)|0,o=o+Math.imul(_,vt)|0;var Pt=(u+(a=a+Math.imul(C,wt)|0)|0)+((8191&(n=(n=n+Math.imul(C,Mt)|0)+Math.imul(v,wt)|0))<<13)|0;u=((o=o+Math.imul(v,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(j,st),n=(n=Math.imul(j,dt))+Math.imul(z,st)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(q,Bt)|0,n=(n=n+Math.imul(q,mt)|0)+Math.imul(P,Bt)|0,o=o+Math.imul(P,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,Ct)|0,n=(n=n+Math.imul(N,vt)|0)+Math.imul(D,Ct)|0,o=o+Math.imul(D,vt)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(j,ht),n=(n=Math.imul(j,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(q,Et)|0,n=(n=n+Math.imul(q,yt)|0)+Math.imul(P,Et)|0,o=o+Math.imul(P,yt)|0,a=a+Math.imul(G,Ct)|0,n=(n=n+Math.imul(G,vt)|0)+Math.imul(T,Ct)|0,o=o+Math.imul(T,vt)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(j,Bt),n=(n=Math.imul(j,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(q,Ct)|0,n=(n=n+Math.imul(q,vt)|0)+Math.imul(P,Ct)|0,o=o+Math.imul(P,vt)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(j,Et),n=(n=Math.imul(j,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,Ct)|0,n=(n=n+Math.imul(H,vt)|0)+Math.imul(Y,Ct)|0,o=o+Math.imul(Y,vt)|0;var Jt=(u+(a=a+Math.imul(q,wt)|0)|0)+((8191&(n=(n=n+Math.imul(q,Mt)|0)+Math.imul(P,wt)|0))<<13)|0;u=((o=o+Math.imul(P,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(j,Ct),n=(n=Math.imul(j,vt))+Math.imul(z,Ct)|0,o=Math.imul(z,vt);var Kt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863;var jt=(u+(a=Math.imul(j,wt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=qt,d[12]=Pt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=Jt,d[17]=Kt,d[18]=jt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(s=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?s(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,c&=67108863}r.words[o]=s,a=c,c=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var c=0;c>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),c=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&c}return s&&0!==u&&(s.words[s.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(s/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===c)return this.strip();for(assert(-1===c),c=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var c,s=a.length-n.length;if("mod"!==t){(c=new BN(null)).length=s+1,c.words=new Array(c.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);c&&(c.words[h]=l)}return c&&c.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:c||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),c=new BN(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(d),c.isub(u)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(c)):(r.isub(t),o.isub(a),c.isub(n))}return{a:o,b:c,gcd:r.iushln(s)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var s=0,d=1;0==(t.words[0]&d)&&s<26;++s,d<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(c),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,c&=67108863,this.words[o]=c}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=c}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),c=o.redNeg(),s=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,s).cmp(c);)d.redIAdd(c);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=s-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++c||0===a&&0===u)&&(n=this.mul(n,r[o]),c=0,o=0)):c=0}s=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},e=>{"use strict";e.exports=function hasSymbols(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var a=Object.getOwnPropertySymbols(e);if(1!==a.length||a[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(e,t);if(42!==n.value||!0!==n.enumerable)return!1}return!0}},e=>{var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString;e.exports=function forEach(e,a,n){if("[object Function]"!==r.call(a))throw new TypeError("iterator must be a function");var o=e.length;if(o===+o)for(var c=0;c{"use strict";var a=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"];e.exports=function availableTypedArrays(){for(var e=[],t=0;t{"use strict";var a=r(340)("%Object.getOwnPropertyDescriptor%");if(a)try{a([],"length")}catch(e){a=null}e.exports=a},(e,t,r)=>{"use strict";var a=r(480),n=r(481),o=r(339),c=o("Object.prototype.toString"),s=r(275)(),d=n(),u=o("Array.prototype.indexOf",!0)||function indexOf(e,t){for(var r=0;r-1}return!!b&&function tryAllTypedArrays(e){var t=!1;return a(l,(function(r,a){if(!t)try{t=r.call(e)===a}catch(e){}})),t}(e)}},(e,t,r)=>{"use strict";var a=r(277),n=r(276),o=r(486),c=r(487),s=r(818),d=n(c(),Object);a(d,{getPolyfill:c,implementation:o,shim:s}),e.exports=d},e=>{"use strict";var t=Object.prototype.toString;e.exports=function isArguments(e){var r=t.call(e),a="[object Arguments]"===r;return a||(a="[object Array]"!==r&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===t.call(e.callee)),a}},e=>{"use strict";var numberIsNaN=function(e){return e!=e};e.exports=function is(e,t){return 0===e&&0===t?1/e==1/t:e===t||!(!numberIsNaN(e)||!numberIsNaN(t))}},(e,t,r)=>{"use strict";var a=r(486);e.exports=function getPolyfill(){return"function"==typeof Object.is?Object.is:a}},e=>{"use strict";e.exports=function isNaN(e){return e!=e}},(e,t,r)=>{"use strict";var a=r(488);e.exports=function getPolyfill(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:a}},(e,t,r)=>{"use strict";var a=r(23),n=r(828),o=r(836),c=r(837),s=r(842);function Hash(e){s.call(this,"digest"),this._hash=e}a(Hash,s),Hash.prototype._update=function(e){this._hash.update(e)},Hash.prototype._final=function(){return this._hash.digest()},e.exports=function createHash(e){return"md5"===(e=e.toLowerCase())?new n:"rmd160"===e||"ripemd160"===e?new o:new Hash(c(e))}},(e,t,r)=>{"use strict";var a=r(58).Buffer,n=r(342).Transform;function HashBase(e){n.call(this),this._block=a.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(23)(HashBase,n),HashBase.prototype._transform=function(e,t,r){var a=null;try{this.update(e,t)}catch(e){a=e}r(a)},HashBase.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},HashBase.prototype.update=function(e,t){if(function throwIfNotStringOrBuffer(e,t){if(!a.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");a.isBuffer(e)||(e=a.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var o=this._blockOffset;o0;++c)this._length[c]+=s,(s=this._length[c]/4294967296|0)>0&&(this._length[c]-=4294967296*s);return this},HashBase.prototype._update=function(){throw new Error("_update is not implemented")},HashBase.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},HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=HashBase},(e,t,r)=>{"use strict";var a,n=r(1);e.exports=Readable,Readable.ReadableState=ReadableState;r(34).EventEmitter;var o=function EElistenerCount(e,t){return e.listeners(t).length},c=r(829),s=r(3).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(89);u=h&&h.debuglog?h.debuglog("stream"):function debug(){};var l,b,g,p=r(830),B=r(493),m=r(494).getHighWaterMark,I=r(236).a,y=I.ERR_INVALID_ARG_TYPE,x=I.ERR_STREAM_PUSH_AFTER_EOF,C=I.ERR_METHOD_NOT_IMPLEMENTED,v=I.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(23)(Readable,c);var Q=B.errorOrDestroy,w=["error","close","destroy","pause","resume"];function ReadableState(e,t,n){a=a||r(183),e=e||{},"boolean"!=typeof n&&(n=t instanceof a),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(this,e,"readableHighWaterMark",n),this.buffer=new p,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.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(l||(l=r(496).a),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function Readable(e){if(a=a||r(183),!(this instanceof Readable))return new Readable(e);var t=this instanceof a;this._readableState=new ReadableState(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),c.call(this)}function readableAddChunk(e,t,r,a,n){u("readableAddChunk",t);var o,c=e._readableState;if(null===t)c.reading=!1,function onEofChunk(e,t){if(u("onEofChunk"),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,t.sync?emitReadable(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,emitReadable_(e)))}(e,c);else if(n||(o=function chunkInvalid(e,t){var r;(function _isUint8Array(e){return s.isBuffer(e)||e instanceof d})(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],t));return r}(c,t)),o)Q(e,o);else if(c.objectMode||t&&t.length>0)if("string"==typeof t||c.objectMode||Object.getPrototypeOf(t)===s.prototype||(t=function _uint8ArrayToBuffer(e){return s.from(e)}(t)),a)c.endEmitted?Q(e,new v):addChunk(e,c,t,!0);else if(c.ended)Q(e,new x);else{if(c.destroyed)return!1;c.reading=!1,c.decoder&&!r?(t=c.decoder.write(t),c.objectMode||0!==t.length?addChunk(e,c,t,!1):maybeReadMore(e,c)):addChunk(e,c,t,!1)}else a||(c.reading=!1,maybeReadMore(e,c));return!c.ended&&(c.lengtht.highWaterMark&&(t.highWaterMark=function computeNewHighWaterMark(e){return e>=_?e=_:(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 emitReadable(e){var t=e._readableState;u("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(u("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(emitReadable_,e))}function emitReadable_(e){var t=e._readableState;u("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,flow(e)}function maybeReadMore(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(maybeReadMore_,e,t))}function maybeReadMore_(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function nReadingNextTick(e){u("readable nexttick read 0"),e.read(0)}function resume_(e,t){u("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),flow(e),t.flowing&&!t.reading&&e.read(0)}function flow(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function fromList(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 endReadable(e){var t=e._readableState;u("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(endReadableNT,t,e))}function endReadableNT(e,t){if(u("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 indexOf(e,t){for(var r=0,a=e.length;r=t.highWaterMark:t.length>0)||t.ended))return u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?endReadable(this):emitReadable(this),null;if(0===(e=howMuchToRead(e,t))&&t.ended)return 0===t.length&&endReadable(this),null;var a,n=t.needReadable;return u("need readable",n),(0===t.length||t.length-e0?fromList(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&&endReadable(this)),null!==a&&this.emit("data",a),a},Readable.prototype._read=function(e){Q(this,new C("_read()"))},Readable.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,u("pipe count=%d opts=%j",a.pipesCount,t);var c=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?onend:unpipe;function onunpipe(t,n){u("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,function cleanup(){u("cleanup"),e.removeListener("close",onclose),e.removeListener("finish",onfinish),e.removeListener("drain",s),e.removeListener("error",onerror),e.removeListener("unpipe",onunpipe),r.removeListener("end",onend),r.removeListener("end",unpipe),r.removeListener("data",ondata),d=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}())}function onend(){u("onend"),e.end()}a.endEmitted?n.nextTick(c):r.once("end",c),e.on("unpipe",onunpipe);var s=function pipeOnDrain(e){return function pipeOnDrainFunctionResult(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,flow(e))}}(r);e.on("drain",s);var d=!1;function ondata(t){u("ondata");var n=e.write(t);u("dest.write",n),!1===n&&((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==indexOf(a.pipes,e))&&!d&&(u("false write response, pause",a.awaitDrain),a.awaitDrain++),r.pause())}function onerror(t){u("onerror",t),unpipe(),e.removeListener("error",onerror),0===o(e,"error")&&Q(e,t)}function onclose(){e.removeListener("finish",onfinish),unpipe()}function onfinish(){u("onfinish"),e.removeListener("close",onclose),unpipe()}function unpipe(){u("unpipe"),r.unpipe(e)}return r.on("data",ondata),function prependListener(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",onerror),e.once("close",onclose),e.once("finish",onfinish),e.emit("pipe",r),a.flowing||(u("pipe resume"),r.resume()),e},Readable.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 a=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==a.flowing&&this.resume()):"readable"===e&&(a.endEmitted||a.readableListening||(a.readableListening=a.needReadable=!0,a.flowing=!1,a.emittedReadable=!1,u("on readable",a.length,a.reading),a.length?emitReadable(this):a.reading||n.nextTick(nReadingNextTick,this))),r},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.removeListener=function(e,t){var r=c.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(updateReadableListening,this),r},Readable.prototype.removeAllListeners=function(e){var t=c.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(updateReadableListening,this),t},Readable.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!e.readableListening,function resume(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(resume_,e,t))}(this,e)),e.paused=!1,this},Readable.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},Readable.prototype.wrap=function(e){var t=this,r=this._readableState,a=!1;for(var n in e.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(n){(u("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(a=!0,e.pause()))})),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function methodWrap(t){return function methodWrapReturnFunction(){return e[t].apply(e,arguments)}}(n));for(var o=0;o{"use strict";var a=r(1);function emitErrorAndCloseNT(e,t){emitErrorNT(e,t),emitCloseNT(e)}function emitCloseNT(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function emitErrorNT(e,t){e.emit("error",t)}e.exports={destroy:function destroy(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return n||o?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,a.nextTick(emitErrorNT,this,e)):a.nextTick(emitErrorNT,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?r._writableState?r._writableState.errorEmitted?a.nextTick(emitCloseNT,r):(r._writableState.errorEmitted=!0,a.nextTick(emitErrorAndCloseNT,r,e)):a.nextTick(emitErrorAndCloseNT,r,e):t?(a.nextTick(emitCloseNT,r),t(e)):a.nextTick(emitCloseNT,r)})),this)},undestroy:function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function errorOrDestroy(e,t){var r=e._readableState,a=e._writableState;r&&r.autoDestroy||a&&a.autoDestroy?e.destroy(t):e.emit("error",t)}}},(e,t,r)=>{"use strict";var a=r(236).a.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function getHighWaterMark(e,t,r,n){var o=function highWaterMarkFrom(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new a(n?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},(e,t,r)=>{"use strict";var a,n=r(1);function CorkedRequest(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function onCorkedFinish(e,t,r){var a=e.entry;e.entry=null;for(;a;){var n=a.callback;t.pendingcb--,n(r),a=a.next}t.corkedRequestsFree.next=e}(t,e)}}e.exports=Writable,Writable.WritableState=WritableState;var o={deprecate:r(831)},c=r(829),s=r(3).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(493),l=r(494).getHighWaterMark,b=r(236).a,g=b.ERR_INVALID_ARG_TYPE,p=b.ERR_METHOD_NOT_IMPLEMENTED,B=b.ERR_MULTIPLE_CALLBACK,m=b.ERR_STREAM_CANNOT_PIPE,I=b.ERR_STREAM_DESTROYED,y=b.ERR_STREAM_NULL_VALUES,x=b.ERR_STREAM_WRITE_AFTER_END,C=b.ERR_UNKNOWN_ENCODING,v=h.errorOrDestroy;function nop(){}function WritableState(e,t,o){a=a||r(183),e=e||{},"boolean"!=typeof o&&(o=t instanceof a),this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=l(this,e,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,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 onwrite(e,t){var r=e._writableState,a=r.sync,o=r.writecb;if("function"!=typeof o)throw new B;if(function onwriteStateUpdate(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function onwriteError(e,t,r,a,o){--t.pendingcb,r?(n.nextTick(o,a),n.nextTick(finishMaybe,e,t),e._writableState.errorEmitted=!0,v(e,a)):(o(a),e._writableState.errorEmitted=!0,v(e,a),finishMaybe(e,t))}(e,r,a,t,o);else{var c=needFinish(r)||e.destroyed;c||r.corked||r.bufferProcessing||!r.bufferedRequest||clearBuffer(e,r),a?n.nextTick(afterWrite,e,r,c,o):afterWrite(e,r,c,o)}}(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 CorkedRequest(this)}function Writable(e){var t=this instanceof(a=a||r(183));if(!t&&!u.call(Writable,this))return new Writable(e);this._writableState=new WritableState(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)),c.call(this)}function doWrite(e,t,r,a,n,o,c){t.writelen=a,t.writecb=c,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new I("write")):r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}function afterWrite(e,t,r,a){r||function onwriteDrain(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,a(),finishMaybe(e,t)}function clearBuffer(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var a=t.bufferedRequestCount,n=new Array(a),o=t.corkedRequestsFree;o.entry=r;for(var c=0,s=!0;r;)n[c]=r,r.isBuf||(s=!1),r=r.next,c+=1;n.allBuffers=s,doWrite(e,t,!0,t.length,n,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new CorkedRequest(t),t.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,u=r.encoding,h=r.callback;if(doWrite(e,t,!1,t.objectMode?1:d.length,d,u,h),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function needFinish(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function callFinal(e,t){e._final((function(r){t.pendingcb--,r&&v(e,r),t.prefinished=!0,e.emit("prefinish"),finishMaybe(e,t)}))}function finishMaybe(e,t){var r=needFinish(t);if(r&&(function prefinish(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,n.nextTick(callFinal,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var a=e._readableState;(!a||a.autoDestroy&&a.endEmitted)&&e.destroy()}return r}r(23)(Writable,c),WritableState.prototype.getBuffer=function getBuffer(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:o.deprecate((function writableStateBufferGetter(){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]?(u=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function value(e){return!!u.call(this,e)||this===Writable&&(e&&e._writableState instanceof WritableState)}})):u=function realHasInstance(e){return e instanceof this},Writable.prototype.pipe=function(){v(this,new m)},Writable.prototype.write=function(e,t,r){var a=this._writableState,o=!1,c=!a.objectMode&&function _isUint8Array(e){return s.isBuffer(e)||e instanceof d}(e);return c&&!s.isBuffer(e)&&(e=function _uint8ArrayToBuffer(e){return s.from(e)}(e)),"function"==typeof t&&(r=t,t=null),c?t="buffer":t||(t=a.defaultEncoding),"function"!=typeof r&&(r=nop),a.ending?function writeAfterEnd(e,t){var r=new x;v(e,r),n.nextTick(t,r)}(this,r):(c||function validChunk(e,t,r,a){var o;return null===r?o=new y:"string"==typeof r||t.objectMode||(o=new g("chunk",["string","Buffer"],r)),!o||(v(e,o),n.nextTick(a,o),!1)}(this,a,e,r))&&(a.pendingcb++,o=function writeOrBuffer(e,t,r,a,n,o){if(!r){var c=function decodeChunk(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=s.from(t,r));return t}(t,a,n);a!==c&&(r=!0,n="buffer",a=c)}var d=t.objectMode?1:a.length;t.length+=d;var u=t.length-1))throw new C(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:!1,get:function get(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function get(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(e,t,r){r(new p("_write()"))},Writable.prototype._writev=null,Writable.prototype.end=function(e,t,r){var a=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),a.corked&&(a.corked=1,this.uncork()),a.ending||function endWritable(e,t,r){t.ending=!0,finishMaybe(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,a,r),this},Object.defineProperty(Writable.prototype,"writableLength",{enumerable:!1,get:function get(){return this._writableState.length}}),Object.defineProperty(Writable.prototype,"destroyed",{enumerable:!1,get:function get(){return void 0!==this._writableState&&this._writableState.destroyed},set:function set(e){this._writableState&&(this._writableState.destroyed=e)}}),Writable.prototype.destroy=h.destroy,Writable.prototype._undestroy=h.undestroy,Writable.prototype._destroy=function(e,t){t(e)}},(e,t,r)=>{"use strict";var a=r(58).Buffer,n=a.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function StringDecoder(e){var t;switch(this.encoding=function normalizeEncoding(e){var t=function _normalizeEncoding(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&&(a.isEncoding===n||!n(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,t=4;break;case"utf8":this.fillLast=utf8FillLast,t=4;break;case"base64":this.text=base64Text,this.end=base64End,t=3;break;default:return this.write=simpleWrite,void(this.end=simpleEnd)}this.lastNeed=0,this.lastTotal=0,this.lastChar=a.allocUnsafe(t)}function utf8CheckByte(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function utf8FillLast(e){var t=this.lastTotal-this.lastNeed,r=function utf8CheckExtraBytes(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 utf16Text(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var a=r.charCodeAt(r.length-1);if(a>=55296&&a<=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 utf16End(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 base64Text(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 base64End(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function simpleWrite(e){return e.toString(this.encoding)}function simpleEnd(e){return e&&e.length?this.write(e):""}t.a=StringDecoder,StringDecoder.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 n>0&&(e.lastNeed=n-1),n;if(--a=0)return n>0&&(e.lastNeed=n-2),n;if(--a=0)return n>0&&(2===n?n=0:e.lastNeed=n-3),n;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var a=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,a),e.toString("utf8",t,a)},StringDecoder.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}},(e,t,r)=>{"use strict";e.exports=Transform;var a=r(236).a,n=a.ERR_METHOD_NOT_IMPLEMENTED,o=a.ERR_MULTIPLE_CALLBACK,c=a.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=a.ERR_TRANSFORM_WITH_LENGTH_0,d=r(183);function afterTransform(e,t){var r=this._transformState;r.transforming=!1;var a=r.writecb;if(null===a)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),a(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length{var a=r(23),n=r(184),o=r(58).Buffer,c=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function Sha256(){this.init(),this._w=s,n.call(this,64,56)}function ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function sigma1(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function gamma0(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}a(Sha256,n),Sha256.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},Sha256.prototype._update=function(e){for(var t,r=this._w,a=0|this._a,n=0|this._b,o=0|this._c,s=0|this._d,d=0|this._e,u=0|this._f,h=0|this._g,l=0|this._h,b=0;b<16;++b)r[b]=e.readInt32BE(4*b);for(;b<64;++b)r[b]=0|(((t=r[b-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[b-7]+gamma0(r[b-15])+r[b-16];for(var g=0;g<64;++g){var p=l+sigma1(d)+ch(d,u,h)+c[g]+r[g]|0,B=sigma0(a)+maj(a,n,o)|0;l=h,h=u,u=d,d=s+p|0,s=o,o=n,n=a,a=p+B|0}this._a=a+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=d+this._e|0,this._f=u+this._f|0,this._g=h+this._g|0,this._h=l+this._h|0},Sha256.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=Sha256},(e,t,r)=>{var a=r(23),n=r(184),o=r(58).Buffer,c=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],s=new Array(160);function Sha512(){this.init(),this._w=s,n.call(this,128,112)}function Ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function sigma1(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Gamma0(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Gamma0l(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function Gamma1(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Gamma1l(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function getCarry(e,t){return e>>>0>>0?1:0}a(Sha512,n),Sha512.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},Sha512.prototype._update=function(e){for(var t=this._w,r=0|this._ah,a=0|this._bh,n=0|this._ch,o=0|this._dh,s=0|this._eh,d=0|this._fh,u=0|this._gh,h=0|this._hh,l=0|this._al,b=0|this._bl,g=0|this._cl,p=0|this._dl,B=0|this._el,m=0|this._fl,I=0|this._gl,y=0|this._hl,x=0;x<32;x+=2)t[x]=e.readInt32BE(4*x),t[x+1]=e.readInt32BE(4*x+4);for(;x<160;x+=2){var C=t[x-30],v=t[x-30+1],Q=Gamma0(C,v),w=Gamma0l(v,C),_=Gamma1(C=t[x-4],v=t[x-4+1]),k=Gamma1l(v,C),N=t[x-14],D=t[x-14+1],U=t[x-32],G=t[x-32+1],T=w+D|0,L=Q+N+getCarry(T,w)|0;L=(L=L+_+getCarry(T=T+k|0,k)|0)+U+getCarry(T=T+G|0,G)|0,t[x]=L,t[x+1]=T}for(var q=0;q<160;q+=2){L=t[q],T=t[q+1];var P=maj(r,a,n),O=maj(l,b,g),H=sigma0(r,l),Y=sigma0(l,r),J=sigma1(s,B),j=sigma1(B,s),z=c[q],W=c[q+1],V=Ch(s,d,u),X=Ch(B,m,I),$=y+j|0,et=h+J+getCarry($,y)|0;et=(et=(et=et+V+getCarry($=$+X|0,X)|0)+z+getCarry($=$+W|0,W)|0)+L+getCarry($=$+T|0,T)|0;var tt=Y+O|0,rt=H+P+getCarry(tt,Y)|0;h=u,y=I,u=d,I=m,d=s,m=B,s=o+et+getCarry(B=p+$|0,p)|0,o=n,p=g,n=a,g=b,a=r,b=l,r=et+rt+getCarry(l=$+tt|0,$)|0}this._al=this._al+l|0,this._bl=this._bl+b|0,this._cl=this._cl+g|0,this._dl=this._dl+p|0,this._el=this._el+B|0,this._fl=this._fl+m|0,this._gl=this._gl+I|0,this._hl=this._hl+y|0,this._ah=this._ah+r+getCarry(this._al,l)|0,this._bh=this._bh+a+getCarry(this._bl,b)|0,this._ch=this._ch+n+getCarry(this._cl,g)|0,this._dh=this._dh+o+getCarry(this._dl,p)|0,this._eh=this._eh+s+getCarry(this._el,B)|0,this._fh=this._fh+d+getCarry(this._fl,m)|0,this._gh=this._gh+u+getCarry(this._gl,I)|0,this._hh=this._hh+h+getCarry(this._hl,y)|0},Sha512.prototype._hash=function(){var e=o.allocUnsafe(64);function writeInt64BE(t,r,a){e.writeInt32BE(t,a),e.writeInt32BE(r,a+4)}return writeInt64BE(this._ah,this._al,0),writeInt64BE(this._bh,this._bl,8),writeInt64BE(this._ch,this._cl,16),writeInt64BE(this._dh,this._dl,24),writeInt64BE(this._eh,this._el,32),writeInt64BE(this._fh,this._fl,40),writeInt64BE(this._gh,this._gl,48),writeInt64BE(this._hh,this._hl,56),e},e.exports=Sha512},function(e,t,r){"use strict";var a=r(3).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.hashPersonalMessage=t.isValidSignature=t.fromRpcSig=t.toRpcSig=t.ecrecover=t.ecsign=void 0;const o=r(127),c=n(r(129)),s=r(74),d=r(59),u=r(344),h=r(237);function calculateSigRecovery(e,t){const r=h.toType(e,h.TypeOutput.BN);if(!t)return r.subn(27);const a=h.toType(t,h.TypeOutput.BN);return r.sub(a.muln(2).addn(35))}function isValidSigRecovery(e){const t=new c.default(e);return t.eqn(0)||t.eqn(1)}t.ecsign=function ecsign(e,t,r){const{signature:n,recid:c}=o.ecdsaSign(e,t),s=a.from(n.slice(0,32)),d=a.from(n.slice(32,64));if(!r||"number"==typeof r){if(r&&!Number.isSafeInteger(r))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");return{r:s,s:d,v:r?c+(2*r+35):c+27}}return{r:s,s:d,v:h.toType(r,h.TypeOutput.BN).muln(2).addn(35).addn(c).toArrayLike(a)}},t.ecrecover=function(e,t,r,n,c){const d=a.concat([s.setLengthLeft(r,32),s.setLengthLeft(n,32)],64),u=calculateSigRecovery(t,c);if(!isValidSigRecovery(u))throw new Error("Invalid signature v value");const h=o.ecdsaRecover(d,u.toNumber(),e);return a.from(o.publicKeyConvert(h,!1).slice(1))},t.toRpcSig=function(e,t,r,n){if(!isValidSigRecovery(calculateSigRecovery(e,n)))throw new Error("Invalid signature v value");return s.bufferToHex(a.concat([s.setLengthLeft(t,32),s.setLengthLeft(r,32),s.toBuffer(e)]))},t.fromRpcSig=function(e){const t=s.toBuffer(e);if(t.length<65)throw new Error("Invalid signature length");let r=s.bufferToInt(t.slice(64));return r<27&&(r+=27),{v:r,r:t.slice(0,32),s:t.slice(32,64)}},t.isValidSignature=function(e,t,r,a=!0,n){const o=new c.default("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),s=new c.default("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(32!==t.length||32!==r.length)return!1;if(!isValidSigRecovery(calculateSigRecovery(e,n)))return!1;const d=new c.default(t),u=new c.default(r);return!(d.isZero()||d.gt(s)||u.isZero()||u.gt(s))&&(!a||1!==u.cmp(o))},t.hashPersonalMessage=function(e){u.assertIsBuffer(e);const t=a.from(`Ethereum Signed Message:\n${e.length.toString()}`,"utf-8");return d.keccak(a.concat([t,e]))}},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(18).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),c=t;c=49?s-49+10:s>=17?s-17+10:s}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,c=o%a,s=Math.min(o,o-c)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],o=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],c=n*o,s=67108863&c,d=c/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(c=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&c}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,s=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=c[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,c,s="le"===t,d=new e(n),u=this.clone();if(s){for(c=0;!u.isZero();c++)o=u.andln(255),u.iushrn(8),d[c]=o;for(;c=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,c=0;c>26,this.words[c]=67108863&t;for(;0!==o&&c>26,this.words[c]=67108863&t;if(0===o&&c>>13,g=0|c[1],p=8191&g,B=g>>>13,m=0|c[2],I=8191&m,y=m>>>13,x=0|c[3],C=8191&x,v=x>>>13,Q=0|c[4],w=8191&Q,_=Q>>>13,k=0|c[5],N=8191&k,D=k>>>13,U=0|c[6],G=8191&U,T=U>>>13,L=0|c[7],q=8191&L,P=L>>>13,O=0|c[8],H=8191&O,Y=O>>>13,J=0|c[9],j=8191&J,z=J>>>13,W=0|s[0],V=8191&W,X=W>>>13,$=0|s[1],et=8191&$,tt=$>>>13,rt=0|s[2],at=8191&rt,it=rt>>>13,nt=0|s[3],ot=8191&nt,At=nt>>>13,ct=0|s[4],st=8191&ct,dt=ct>>>13,ut=0|s[5],ht=8191&ut,bt=ut>>>13,pt=0|s[6],Bt=8191&pt,mt=pt>>>13,It=0|s[7],Et=8191&It,yt=It>>>13,xt=0|s[8],Ct=8191&xt,vt=xt>>>13,Qt=0|s[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(C,V),n=(n=Math.imul(C,X))+Math.imul(v,V)|0,o=Math.imul(v,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(C,et)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(v,et)|0,o=o+Math.imul(v,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,st)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(C,at)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(v,at)|0,o=o+Math.imul(v,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,st)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,st)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,At)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,At)|0,a=a+Math.imul(I,st)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,st)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(q,V),n=(n=Math.imul(q,X))+Math.imul(P,V)|0,o=Math.imul(P,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(C,st)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(v,st)|0,o=o+Math.imul(v,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(q,et)|0,n=(n=n+Math.imul(q,tt)|0)+Math.imul(P,et)|0,o=o+Math.imul(P,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,st)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,st)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,bt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,Ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,vt)|0)+Math.imul(b,Ct)|0))<<13)|0;u=((o=o+Math.imul(b,vt)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(j,V),n=(n=Math.imul(j,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(q,at)|0,n=(n=n+Math.imul(q,it)|0)+Math.imul(P,at)|0,o=o+Math.imul(P,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,st)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,st)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(C,Bt)|0,n=(n=n+Math.imul(C,mt)|0)+Math.imul(v,Bt)|0,o=o+Math.imul(v,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,Ct)|0,n=(n=n+Math.imul(p,vt)|0)+Math.imul(B,Ct)|0,o=o+Math.imul(B,vt)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(j,et),n=(n=Math.imul(j,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(q,ot)|0,n=(n=n+Math.imul(q,At)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,At)|0,a=a+Math.imul(G,st)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,st)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(C,Et)|0,n=(n=n+Math.imul(C,yt)|0)+Math.imul(v,Et)|0,o=o+Math.imul(v,yt)|0,a=a+Math.imul(I,Ct)|0,n=(n=n+Math.imul(I,vt)|0)+Math.imul(y,Ct)|0,o=o+Math.imul(y,vt)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(j,at),n=(n=Math.imul(j,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(q,st)|0,n=(n=n+Math.imul(q,dt)|0)+Math.imul(P,st)|0,o=o+Math.imul(P,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(C,Ct)|0,n=(n=n+Math.imul(C,vt)|0)+Math.imul(v,Ct)|0,o=o+Math.imul(v,vt)|0;var qt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(j,ot),n=(n=Math.imul(j,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,st)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,st)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(q,ht)|0,n=(n=n+Math.imul(q,bt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,Ct)|0,n=(n=n+Math.imul(w,vt)|0)+Math.imul(_,Ct)|0,o=o+Math.imul(_,vt)|0;var Pt=(u+(a=a+Math.imul(C,wt)|0)|0)+((8191&(n=(n=n+Math.imul(C,Mt)|0)+Math.imul(v,wt)|0))<<13)|0;u=((o=o+Math.imul(v,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(j,st),n=(n=Math.imul(j,dt))+Math.imul(z,st)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(q,Bt)|0,n=(n=n+Math.imul(q,mt)|0)+Math.imul(P,Bt)|0,o=o+Math.imul(P,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,Ct)|0,n=(n=n+Math.imul(N,vt)|0)+Math.imul(D,Ct)|0,o=o+Math.imul(D,vt)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(j,ht),n=(n=Math.imul(j,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(q,Et)|0,n=(n=n+Math.imul(q,yt)|0)+Math.imul(P,Et)|0,o=o+Math.imul(P,yt)|0,a=a+Math.imul(G,Ct)|0,n=(n=n+Math.imul(G,vt)|0)+Math.imul(T,Ct)|0,o=o+Math.imul(T,vt)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(j,Bt),n=(n=Math.imul(j,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(q,Ct)|0,n=(n=n+Math.imul(q,vt)|0)+Math.imul(P,Ct)|0,o=o+Math.imul(P,vt)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(j,Et),n=(n=Math.imul(j,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,Ct)|0,n=(n=n+Math.imul(H,vt)|0)+Math.imul(Y,Ct)|0,o=o+Math.imul(Y,vt)|0;var Jt=(u+(a=a+Math.imul(q,wt)|0)|0)+((8191&(n=(n=n+Math.imul(q,Mt)|0)+Math.imul(P,wt)|0))<<13)|0;u=((o=o+Math.imul(P,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(j,Ct),n=(n=Math.imul(j,vt))+Math.imul(z,Ct)|0,o=Math.imul(z,vt);var Kt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863;var jt=(u+(a=Math.imul(j,wt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=qt,d[12]=Pt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=Jt,d[17]=Kt,d[18]=jt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(s=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?s(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,c&=67108863}r.words[o]=s,a=c,c=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var c=0;c>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),c=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&c}return s&&0!==u&&(s.words[s.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(s/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===c)return this.strip();for(assert(-1===c),c=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var c,s=a.length-n.length;if("mod"!==t){(c=new BN(null)).length=s+1,c.words=new Array(c.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);c&&(c.words[h]=l)}return c&&c.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:c||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),c=new BN(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(d),c.isub(u)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(c)):(r.isub(t),o.isub(a),c.isub(n))}return{a:o,b:c,gcd:r.iushln(s)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var s=0,d=1;0==(t.words[0]&d)&&s<26;++s,d<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(c),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,c&=67108863,this.words[o]=c}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=c}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),c=o.redNeg(),s=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,s).cmp(c);)d.redIAdd(c);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=s-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++c||0===a&&0===u)&&(n=this.mul(n,r[o]),c=0,o=0)):c=0}s=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.Tag=void 0,function(e){e.EARLIEST="earliest",e.LATEST="latest",e.PENDING="pending"}(t.Tag||(t.Tag={})),function(e){e[e.earliest=0]="earliest",e[e.latest=1]="latest",e[e.pending=2]="pending"}(r||(r={})),function(e){e.normalize=function normalize(t){if("string"==typeof t)return e[t.toUpperCase()];switch(t){case r.earliest:return e.EARLIEST;case r.latest:return e.LATEST;case r.pending:return e.PENDING}}}(t.Tag||(t.Tag={}))},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(18).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),c=t;c=49?s-49+10:s>=17?s-17+10:s}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,c=o%a,s=Math.min(o,o-c)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],o=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],c=n*o,s=67108863&c,d=c/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(c=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&c}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,s=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=c[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,c,s="le"===t,d=new e(n),u=this.clone();if(s){for(c=0;!u.isZero();c++)o=u.andln(255),u.iushrn(8),d[c]=o;for(;c=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,c=0;c>26,this.words[c]=67108863&t;for(;0!==o&&c>26,this.words[c]=67108863&t;if(0===o&&c>>13,g=0|c[1],p=8191&g,B=g>>>13,m=0|c[2],I=8191&m,y=m>>>13,x=0|c[3],C=8191&x,v=x>>>13,Q=0|c[4],w=8191&Q,_=Q>>>13,k=0|c[5],N=8191&k,D=k>>>13,U=0|c[6],G=8191&U,T=U>>>13,L=0|c[7],q=8191&L,P=L>>>13,O=0|c[8],H=8191&O,Y=O>>>13,J=0|c[9],j=8191&J,z=J>>>13,W=0|s[0],V=8191&W,X=W>>>13,$=0|s[1],et=8191&$,tt=$>>>13,rt=0|s[2],at=8191&rt,it=rt>>>13,nt=0|s[3],ot=8191&nt,At=nt>>>13,ct=0|s[4],st=8191&ct,dt=ct>>>13,ut=0|s[5],ht=8191&ut,bt=ut>>>13,pt=0|s[6],Bt=8191&pt,mt=pt>>>13,It=0|s[7],Et=8191&It,yt=It>>>13,xt=0|s[8],Ct=8191&xt,vt=xt>>>13,Qt=0|s[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(C,V),n=(n=Math.imul(C,X))+Math.imul(v,V)|0,o=Math.imul(v,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(C,et)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(v,et)|0,o=o+Math.imul(v,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,st)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(C,at)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(v,at)|0,o=o+Math.imul(v,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,st)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,st)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,At)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,At)|0,a=a+Math.imul(I,st)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,st)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(q,V),n=(n=Math.imul(q,X))+Math.imul(P,V)|0,o=Math.imul(P,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(C,st)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(v,st)|0,o=o+Math.imul(v,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(q,et)|0,n=(n=n+Math.imul(q,tt)|0)+Math.imul(P,et)|0,o=o+Math.imul(P,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,st)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,st)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,bt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,Ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,vt)|0)+Math.imul(b,Ct)|0))<<13)|0;u=((o=o+Math.imul(b,vt)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(j,V),n=(n=Math.imul(j,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(q,at)|0,n=(n=n+Math.imul(q,it)|0)+Math.imul(P,at)|0,o=o+Math.imul(P,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,st)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,st)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(C,Bt)|0,n=(n=n+Math.imul(C,mt)|0)+Math.imul(v,Bt)|0,o=o+Math.imul(v,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,Ct)|0,n=(n=n+Math.imul(p,vt)|0)+Math.imul(B,Ct)|0,o=o+Math.imul(B,vt)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(j,et),n=(n=Math.imul(j,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(q,ot)|0,n=(n=n+Math.imul(q,At)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,At)|0,a=a+Math.imul(G,st)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,st)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(C,Et)|0,n=(n=n+Math.imul(C,yt)|0)+Math.imul(v,Et)|0,o=o+Math.imul(v,yt)|0,a=a+Math.imul(I,Ct)|0,n=(n=n+Math.imul(I,vt)|0)+Math.imul(y,Ct)|0,o=o+Math.imul(y,vt)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(j,at),n=(n=Math.imul(j,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(q,st)|0,n=(n=n+Math.imul(q,dt)|0)+Math.imul(P,st)|0,o=o+Math.imul(P,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(C,Ct)|0,n=(n=n+Math.imul(C,vt)|0)+Math.imul(v,Ct)|0,o=o+Math.imul(v,vt)|0;var qt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(j,ot),n=(n=Math.imul(j,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,st)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,st)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(q,ht)|0,n=(n=n+Math.imul(q,bt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,Ct)|0,n=(n=n+Math.imul(w,vt)|0)+Math.imul(_,Ct)|0,o=o+Math.imul(_,vt)|0;var Pt=(u+(a=a+Math.imul(C,wt)|0)|0)+((8191&(n=(n=n+Math.imul(C,Mt)|0)+Math.imul(v,wt)|0))<<13)|0;u=((o=o+Math.imul(v,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(j,st),n=(n=Math.imul(j,dt))+Math.imul(z,st)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(q,Bt)|0,n=(n=n+Math.imul(q,mt)|0)+Math.imul(P,Bt)|0,o=o+Math.imul(P,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,Ct)|0,n=(n=n+Math.imul(N,vt)|0)+Math.imul(D,Ct)|0,o=o+Math.imul(D,vt)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(j,ht),n=(n=Math.imul(j,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(q,Et)|0,n=(n=n+Math.imul(q,yt)|0)+Math.imul(P,Et)|0,o=o+Math.imul(P,yt)|0,a=a+Math.imul(G,Ct)|0,n=(n=n+Math.imul(G,vt)|0)+Math.imul(T,Ct)|0,o=o+Math.imul(T,vt)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(j,Bt),n=(n=Math.imul(j,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(q,Ct)|0,n=(n=n+Math.imul(q,vt)|0)+Math.imul(P,Ct)|0,o=o+Math.imul(P,vt)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(j,Et),n=(n=Math.imul(j,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,Ct)|0,n=(n=n+Math.imul(H,vt)|0)+Math.imul(Y,Ct)|0,o=o+Math.imul(Y,vt)|0;var Jt=(u+(a=a+Math.imul(q,wt)|0)|0)+((8191&(n=(n=n+Math.imul(q,Mt)|0)+Math.imul(P,wt)|0))<<13)|0;u=((o=o+Math.imul(P,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(j,Ct),n=(n=Math.imul(j,vt))+Math.imul(z,Ct)|0,o=Math.imul(z,vt);var Kt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863;var jt=(u+(a=Math.imul(j,wt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=qt,d[12]=Pt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=Jt,d[17]=Kt,d[18]=jt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(s=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?s(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,c&=67108863}r.words[o]=s,a=c,c=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var c=0;c>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),c=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&c}return s&&0!==u&&(s.words[s.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(s/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===c)return this.strip();for(assert(-1===c),c=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var c,s=a.length-n.length;if("mod"!==t){(c=new BN(null)).length=s+1,c.words=new Array(c.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);c&&(c.words[h]=l)}return c&&c.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:c||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),c=new BN(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(d),c.isub(u)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(c)):(r.isub(t),o.isub(a),c.isub(n))}return{a:o,b:c,gcd:r.iushln(s)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var s=0,d=1;0==(t.words[0]&d)&&s<26;++s,d<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(c),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,c&=67108863,this.words[o]=c}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=c}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),c=o.redNeg(),s=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,s).cmp(c);)d.redIAdd(c);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=s-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++c||0===a&&0===u)&&(n=this.mul(n,r[o]),c=0,o=0)):c=0}s=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},e=>{e.exports=function isHexPrefixed(e){if("string"!=typeof e)throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof e+", while checking isHexPrefixed.");return"0x"===e.slice(0,2)}},(e,t,r)=>{"use strict";var a=r(61).Buffer,n=r(348).Transform;function HashBase(e){n.call(this),this._block=a.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(24)(HashBase,n),HashBase.prototype._transform=function(e,t,r){var a=null;try{this.update(e,t)}catch(e){a=e}r(a)},HashBase.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},HashBase.prototype.update=function(e,t){if(function throwIfNotStringOrBuffer(e,t){if(!a.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");a.isBuffer(e)||(e=a.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var o=this._blockOffset;o0;++c)this._length[c]+=s,(s=this._length[c]/4294967296|0)>0&&(this._length[c]-=4294967296*s);return this},HashBase.prototype._update=function(){throw new Error("_update is not implemented")},HashBase.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},HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=HashBase},(e,t,r)=>{"use strict";var a,n=r(1);e.exports=Readable,Readable.ReadableState=ReadableState;r(34).EventEmitter;var o=function EElistenerCount(e,t){return e.listeners(t).length},c=r(853),s=r(5).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(89);u=h&&h.debuglog?h.debuglog("stream"):function debug(){};var l,b,g,p=r(854),B=r(507),m=r(508).getHighWaterMark,I=r(238).a,y=I.ERR_INVALID_ARG_TYPE,x=I.ERR_STREAM_PUSH_AFTER_EOF,C=I.ERR_METHOD_NOT_IMPLEMENTED,v=I.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(24)(Readable,c);var Q=B.errorOrDestroy,w=["error","close","destroy","pause","resume"];function ReadableState(e,t,n){a=a||r(188),e=e||{},"boolean"!=typeof n&&(n=t instanceof a),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(this,e,"readableHighWaterMark",n),this.buffer=new p,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.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(l||(l=r(510).a),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function Readable(e){if(a=a||r(188),!(this instanceof Readable))return new Readable(e);var t=this instanceof a;this._readableState=new ReadableState(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),c.call(this)}function readableAddChunk(e,t,r,a,n){u("readableAddChunk",t);var o,c=e._readableState;if(null===t)c.reading=!1,function onEofChunk(e,t){if(u("onEofChunk"),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,t.sync?emitReadable(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,emitReadable_(e)))}(e,c);else if(n||(o=function chunkInvalid(e,t){var r;(function _isUint8Array(e){return s.isBuffer(e)||e instanceof d})(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],t));return r}(c,t)),o)Q(e,o);else if(c.objectMode||t&&t.length>0)if("string"==typeof t||c.objectMode||Object.getPrototypeOf(t)===s.prototype||(t=function _uint8ArrayToBuffer(e){return s.from(e)}(t)),a)c.endEmitted?Q(e,new v):addChunk(e,c,t,!0);else if(c.ended)Q(e,new x);else{if(c.destroyed)return!1;c.reading=!1,c.decoder&&!r?(t=c.decoder.write(t),c.objectMode||0!==t.length?addChunk(e,c,t,!1):maybeReadMore(e,c)):addChunk(e,c,t,!1)}else a||(c.reading=!1,maybeReadMore(e,c));return!c.ended&&(c.lengtht.highWaterMark&&(t.highWaterMark=function computeNewHighWaterMark(e){return e>=_?e=_:(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 emitReadable(e){var t=e._readableState;u("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(u("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(emitReadable_,e))}function emitReadable_(e){var t=e._readableState;u("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,flow(e)}function maybeReadMore(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(maybeReadMore_,e,t))}function maybeReadMore_(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function nReadingNextTick(e){u("readable nexttick read 0"),e.read(0)}function resume_(e,t){u("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),flow(e),t.flowing&&!t.reading&&e.read(0)}function flow(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function fromList(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 endReadable(e){var t=e._readableState;u("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(endReadableNT,t,e))}function endReadableNT(e,t){if(u("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 indexOf(e,t){for(var r=0,a=e.length;r=t.highWaterMark:t.length>0)||t.ended))return u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?endReadable(this):emitReadable(this),null;if(0===(e=howMuchToRead(e,t))&&t.ended)return 0===t.length&&endReadable(this),null;var a,n=t.needReadable;return u("need readable",n),(0===t.length||t.length-e0?fromList(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&&endReadable(this)),null!==a&&this.emit("data",a),a},Readable.prototype._read=function(e){Q(this,new C("_read()"))},Readable.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,u("pipe count=%d opts=%j",a.pipesCount,t);var c=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?onend:unpipe;function onunpipe(t,n){u("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,function cleanup(){u("cleanup"),e.removeListener("close",onclose),e.removeListener("finish",onfinish),e.removeListener("drain",s),e.removeListener("error",onerror),e.removeListener("unpipe",onunpipe),r.removeListener("end",onend),r.removeListener("end",unpipe),r.removeListener("data",ondata),d=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}())}function onend(){u("onend"),e.end()}a.endEmitted?n.nextTick(c):r.once("end",c),e.on("unpipe",onunpipe);var s=function pipeOnDrain(e){return function pipeOnDrainFunctionResult(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,flow(e))}}(r);e.on("drain",s);var d=!1;function ondata(t){u("ondata");var n=e.write(t);u("dest.write",n),!1===n&&((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==indexOf(a.pipes,e))&&!d&&(u("false write response, pause",a.awaitDrain),a.awaitDrain++),r.pause())}function onerror(t){u("onerror",t),unpipe(),e.removeListener("error",onerror),0===o(e,"error")&&Q(e,t)}function onclose(){e.removeListener("finish",onfinish),unpipe()}function onfinish(){u("onfinish"),e.removeListener("close",onclose),unpipe()}function unpipe(){u("unpipe"),r.unpipe(e)}return r.on("data",ondata),function prependListener(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",onerror),e.once("close",onclose),e.once("finish",onfinish),e.emit("pipe",r),a.flowing||(u("pipe resume"),r.resume()),e},Readable.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 a=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==a.flowing&&this.resume()):"readable"===e&&(a.endEmitted||a.readableListening||(a.readableListening=a.needReadable=!0,a.flowing=!1,a.emittedReadable=!1,u("on readable",a.length,a.reading),a.length?emitReadable(this):a.reading||n.nextTick(nReadingNextTick,this))),r},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.removeListener=function(e,t){var r=c.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(updateReadableListening,this),r},Readable.prototype.removeAllListeners=function(e){var t=c.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(updateReadableListening,this),t},Readable.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!e.readableListening,function resume(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(resume_,e,t))}(this,e)),e.paused=!1,this},Readable.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},Readable.prototype.wrap=function(e){var t=this,r=this._readableState,a=!1;for(var n in e.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(n){(u("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(a=!0,e.pause()))})),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function methodWrap(t){return function methodWrapReturnFunction(){return e[t].apply(e,arguments)}}(n));for(var o=0;o{"use strict";var a=r(1);function emitErrorAndCloseNT(e,t){emitErrorNT(e,t),emitCloseNT(e)}function emitCloseNT(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function emitErrorNT(e,t){e.emit("error",t)}e.exports={destroy:function destroy(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return n||o?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,a.nextTick(emitErrorNT,this,e)):a.nextTick(emitErrorNT,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?r._writableState?r._writableState.errorEmitted?a.nextTick(emitCloseNT,r):(r._writableState.errorEmitted=!0,a.nextTick(emitErrorAndCloseNT,r,e)):a.nextTick(emitErrorAndCloseNT,r,e):t?(a.nextTick(emitCloseNT,r),t(e)):a.nextTick(emitCloseNT,r)})),this)},undestroy:function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function errorOrDestroy(e,t){var r=e._readableState,a=e._writableState;r&&r.autoDestroy||a&&a.autoDestroy?e.destroy(t):e.emit("error",t)}}},(e,t,r)=>{"use strict";var a=r(238).a.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function getHighWaterMark(e,t,r,n){var o=function highWaterMarkFrom(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new a(n?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},(e,t,r)=>{"use strict";var a,n=r(1);function CorkedRequest(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function onCorkedFinish(e,t,r){var a=e.entry;e.entry=null;for(;a;){var n=a.callback;t.pendingcb--,n(r),a=a.next}t.corkedRequestsFree.next=e}(t,e)}}e.exports=Writable,Writable.WritableState=WritableState;var o={deprecate:r(855)},c=r(853),s=r(5).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(507),l=r(508).getHighWaterMark,b=r(238).a,g=b.ERR_INVALID_ARG_TYPE,p=b.ERR_METHOD_NOT_IMPLEMENTED,B=b.ERR_MULTIPLE_CALLBACK,m=b.ERR_STREAM_CANNOT_PIPE,I=b.ERR_STREAM_DESTROYED,y=b.ERR_STREAM_NULL_VALUES,x=b.ERR_STREAM_WRITE_AFTER_END,C=b.ERR_UNKNOWN_ENCODING,v=h.errorOrDestroy;function nop(){}function WritableState(e,t,o){a=a||r(188),e=e||{},"boolean"!=typeof o&&(o=t instanceof a),this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=l(this,e,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,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 onwrite(e,t){var r=e._writableState,a=r.sync,o=r.writecb;if("function"!=typeof o)throw new B;if(function onwriteStateUpdate(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function onwriteError(e,t,r,a,o){--t.pendingcb,r?(n.nextTick(o,a),n.nextTick(finishMaybe,e,t),e._writableState.errorEmitted=!0,v(e,a)):(o(a),e._writableState.errorEmitted=!0,v(e,a),finishMaybe(e,t))}(e,r,a,t,o);else{var c=needFinish(r)||e.destroyed;c||r.corked||r.bufferProcessing||!r.bufferedRequest||clearBuffer(e,r),a?n.nextTick(afterWrite,e,r,c,o):afterWrite(e,r,c,o)}}(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 CorkedRequest(this)}function Writable(e){var t=this instanceof(a=a||r(188));if(!t&&!u.call(Writable,this))return new Writable(e);this._writableState=new WritableState(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)),c.call(this)}function doWrite(e,t,r,a,n,o,c){t.writelen=a,t.writecb=c,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new I("write")):r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}function afterWrite(e,t,r,a){r||function onwriteDrain(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,a(),finishMaybe(e,t)}function clearBuffer(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var a=t.bufferedRequestCount,n=new Array(a),o=t.corkedRequestsFree;o.entry=r;for(var c=0,s=!0;r;)n[c]=r,r.isBuf||(s=!1),r=r.next,c+=1;n.allBuffers=s,doWrite(e,t,!0,t.length,n,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new CorkedRequest(t),t.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,u=r.encoding,h=r.callback;if(doWrite(e,t,!1,t.objectMode?1:d.length,d,u,h),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function needFinish(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function callFinal(e,t){e._final((function(r){t.pendingcb--,r&&v(e,r),t.prefinished=!0,e.emit("prefinish"),finishMaybe(e,t)}))}function finishMaybe(e,t){var r=needFinish(t);if(r&&(function prefinish(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,n.nextTick(callFinal,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var a=e._readableState;(!a||a.autoDestroy&&a.endEmitted)&&e.destroy()}return r}r(24)(Writable,c),WritableState.prototype.getBuffer=function getBuffer(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:o.deprecate((function writableStateBufferGetter(){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]?(u=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function value(e){return!!u.call(this,e)||this===Writable&&(e&&e._writableState instanceof WritableState)}})):u=function realHasInstance(e){return e instanceof this},Writable.prototype.pipe=function(){v(this,new m)},Writable.prototype.write=function(e,t,r){var a=this._writableState,o=!1,c=!a.objectMode&&function _isUint8Array(e){return s.isBuffer(e)||e instanceof d}(e);return c&&!s.isBuffer(e)&&(e=function _uint8ArrayToBuffer(e){return s.from(e)}(e)),"function"==typeof t&&(r=t,t=null),c?t="buffer":t||(t=a.defaultEncoding),"function"!=typeof r&&(r=nop),a.ending?function writeAfterEnd(e,t){var r=new x;v(e,r),n.nextTick(t,r)}(this,r):(c||function validChunk(e,t,r,a){var o;return null===r?o=new y:"string"==typeof r||t.objectMode||(o=new g("chunk",["string","Buffer"],r)),!o||(v(e,o),n.nextTick(a,o),!1)}(this,a,e,r))&&(a.pendingcb++,o=function writeOrBuffer(e,t,r,a,n,o){if(!r){var c=function decodeChunk(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=s.from(t,r));return t}(t,a,n);a!==c&&(r=!0,n="buffer",a=c)}var d=t.objectMode?1:a.length;t.length+=d;var u=t.length-1))throw new C(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:!1,get:function get(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function get(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(e,t,r){r(new p("_write()"))},Writable.prototype._writev=null,Writable.prototype.end=function(e,t,r){var a=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),a.corked&&(a.corked=1,this.uncork()),a.ending||function endWritable(e,t,r){t.ending=!0,finishMaybe(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,a,r),this},Object.defineProperty(Writable.prototype,"writableLength",{enumerable:!1,get:function get(){return this._writableState.length}}),Object.defineProperty(Writable.prototype,"destroyed",{enumerable:!1,get:function get(){return void 0!==this._writableState&&this._writableState.destroyed},set:function set(e){this._writableState&&(this._writableState.destroyed=e)}}),Writable.prototype.destroy=h.destroy,Writable.prototype._undestroy=h.undestroy,Writable.prototype._destroy=function(e,t){t(e)}},(e,t,r)=>{"use strict";var a=r(61).Buffer,n=a.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function StringDecoder(e){var t;switch(this.encoding=function normalizeEncoding(e){var t=function _normalizeEncoding(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&&(a.isEncoding===n||!n(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,t=4;break;case"utf8":this.fillLast=utf8FillLast,t=4;break;case"base64":this.text=base64Text,this.end=base64End,t=3;break;default:return this.write=simpleWrite,void(this.end=simpleEnd)}this.lastNeed=0,this.lastTotal=0,this.lastChar=a.allocUnsafe(t)}function utf8CheckByte(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function utf8FillLast(e){var t=this.lastTotal-this.lastNeed,r=function utf8CheckExtraBytes(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 utf16Text(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var a=r.charCodeAt(r.length-1);if(a>=55296&&a<=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 utf16End(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 base64Text(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 base64End(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function simpleWrite(e){return e.toString(this.encoding)}function simpleEnd(e){return e&&e.length?this.write(e):""}t.a=StringDecoder,StringDecoder.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 n>0&&(e.lastNeed=n-1),n;if(--a=0)return n>0&&(e.lastNeed=n-2),n;if(--a=0)return n>0&&(2===n?n=0:e.lastNeed=n-3),n;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var a=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,a),e.toString("utf8",t,a)},StringDecoder.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}},(e,t,r)=>{"use strict";e.exports=Transform;var a=r(238).a,n=a.ERR_METHOD_NOT_IMPLEMENTED,o=a.ERR_MULTIPLE_CALLBACK,c=a.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=a.ERR_TRANSFORM_WITH_LENGTH_0,d=r(188);function afterTransform(e,t){var r=this._transformState;r.transforming=!1;var a=r.writecb;if(null===a)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),a(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length{var a=r(24),n=r(189),o=r(61).Buffer,c=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function Sha256(){this.init(),this._w=s,n.call(this,64,56)}function ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function sigma1(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function gamma0(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}a(Sha256,n),Sha256.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},Sha256.prototype._update=function(e){for(var t,r=this._w,a=0|this._a,n=0|this._b,o=0|this._c,s=0|this._d,d=0|this._e,u=0|this._f,h=0|this._g,l=0|this._h,b=0;b<16;++b)r[b]=e.readInt32BE(4*b);for(;b<64;++b)r[b]=0|(((t=r[b-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[b-7]+gamma0(r[b-15])+r[b-16];for(var g=0;g<64;++g){var p=l+sigma1(d)+ch(d,u,h)+c[g]+r[g]|0,B=sigma0(a)+maj(a,n,o)|0;l=h,h=u,u=d,d=s+p|0,s=o,o=n,n=a,a=p+B|0}this._a=a+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=d+this._e|0,this._f=u+this._f|0,this._g=h+this._g|0,this._h=l+this._h|0},Sha256.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=Sha256},(e,t,r)=>{var a=r(24),n=r(189),o=r(61).Buffer,c=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],s=new Array(160);function Sha512(){this.init(),this._w=s,n.call(this,128,112)}function Ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function sigma1(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Gamma0(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Gamma0l(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function Gamma1(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Gamma1l(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function getCarry(e,t){return e>>>0>>0?1:0}a(Sha512,n),Sha512.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},Sha512.prototype._update=function(e){for(var t=this._w,r=0|this._ah,a=0|this._bh,n=0|this._ch,o=0|this._dh,s=0|this._eh,d=0|this._fh,u=0|this._gh,h=0|this._hh,l=0|this._al,b=0|this._bl,g=0|this._cl,p=0|this._dl,B=0|this._el,m=0|this._fl,I=0|this._gl,y=0|this._hl,x=0;x<32;x+=2)t[x]=e.readInt32BE(4*x),t[x+1]=e.readInt32BE(4*x+4);for(;x<160;x+=2){var C=t[x-30],v=t[x-30+1],Q=Gamma0(C,v),w=Gamma0l(v,C),_=Gamma1(C=t[x-4],v=t[x-4+1]),k=Gamma1l(v,C),N=t[x-14],D=t[x-14+1],U=t[x-32],G=t[x-32+1],T=w+D|0,L=Q+N+getCarry(T,w)|0;L=(L=L+_+getCarry(T=T+k|0,k)|0)+U+getCarry(T=T+G|0,G)|0,t[x]=L,t[x+1]=T}for(var q=0;q<160;q+=2){L=t[q],T=t[q+1];var P=maj(r,a,n),O=maj(l,b,g),H=sigma0(r,l),Y=sigma0(l,r),J=sigma1(s,B),j=sigma1(B,s),z=c[q],W=c[q+1],V=Ch(s,d,u),X=Ch(B,m,I),$=y+j|0,et=h+J+getCarry($,y)|0;et=(et=(et=et+V+getCarry($=$+X|0,X)|0)+z+getCarry($=$+W|0,W)|0)+L+getCarry($=$+T|0,T)|0;var tt=Y+O|0,rt=H+P+getCarry(tt,Y)|0;h=u,y=I,u=d,I=m,d=s,m=B,s=o+et+getCarry(B=p+$|0,p)|0,o=n,p=g,n=a,g=b,a=r,b=l,r=et+rt+getCarry(l=$+tt|0,$)|0}this._al=this._al+l|0,this._bl=this._bl+b|0,this._cl=this._cl+g|0,this._dl=this._dl+p|0,this._el=this._el+B|0,this._fl=this._fl+m|0,this._gl=this._gl+I|0,this._hl=this._hl+y|0,this._ah=this._ah+r+getCarry(this._al,l)|0,this._bh=this._bh+a+getCarry(this._bl,b)|0,this._ch=this._ch+n+getCarry(this._cl,g)|0,this._dh=this._dh+o+getCarry(this._dl,p)|0,this._eh=this._eh+s+getCarry(this._el,B)|0,this._fh=this._fh+d+getCarry(this._fl,m)|0,this._gh=this._gh+u+getCarry(this._gl,I)|0,this._hh=this._hh+h+getCarry(this._hl,y)|0},Sha512.prototype._hash=function(){var e=o.allocUnsafe(64);function writeInt64BE(t,r,a){e.writeInt32BE(t,a),e.writeInt32BE(r,a+4)}return writeInt64BE(this._ah,this._al,0),writeInt64BE(this._bh,this._bl,8),writeInt64BE(this._ch,this._cl,16),writeInt64BE(this._dh,this._dl,24),writeInt64BE(this._eh,this._el,32),writeInt64BE(this._fh,this._fl,40),writeInt64BE(this._gh,this._gl,48),writeInt64BE(this._hh,this._hl,56),e},e.exports=Sha512},(e,t,r)=>{e.exports=r(867)(r(515))},(e,t,r)=>{const a=new(0,r(868).ec)("secp256k1"),n=a.curve,o=n.n.constructor;function loadPublicKey(e){const t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:function loadCompressedPublicKey(e,t){let r=new o(t);if(r.cmp(n.p)>=0)return null;r=r.toRed(n.red);let c=r.redSqr().redIMul(r).redIAdd(n.b).redSqrt();return 3===e!==c.isOdd()&&(c=c.redNeg()),a.keyPair({pub:{x:r,y:c}})}(t,e.subarray(1,33));case 4:case 6:case 7:return 65!==e.length?null:function loadUncompressedPublicKey(e,t,r){let c=new o(t),s=new o(r);if(c.cmp(n.p)>=0||s.cmp(n.p)>=0)return null;if(c=c.toRed(n.red),s=s.toRed(n.red),(6===e||7===e)&&s.isOdd()!==(7===e))return null;const d=c.redSqr().redIMul(c);return s.redSqr().redISub(d.redIAdd(n.b)).isZero()?a.keyPair({pub:{x:c,y:s}}):null}(t,e.subarray(1,33),e.subarray(33,65));default:return null}}function savePublicKey(e,t){const r=t.encode(null,33===e.length);for(let t=0;t0,privateKeyVerify(e){const t=new o(e);return t.cmp(n.n)<0&&!t.isZero()?0:1},privateKeyNegate(e){const t=new o(e),r=n.n.sub(t).umod(n.n).toArrayLike(Uint8Array,"be",32);return e.set(r),0},privateKeyTweakAdd(e,t){const r=new o(t);if(r.cmp(n.n)>=0)return 1;if(r.iadd(new o(e)),r.cmp(n.n)>=0&&r.isub(n.n),r.isZero())return 1;const a=r.toArrayLike(Uint8Array,"be",32);return e.set(a),0},privateKeyTweakMul(e,t){let r=new o(t);if(r.cmp(n.n)>=0||r.isZero())return 1;r.imul(new o(e)),r.cmp(n.n)>=0&&(r=r.umod(n.n));const a=r.toArrayLike(Uint8Array,"be",32);return e.set(a),0},publicKeyVerify:e=>null===loadPublicKey(e)?1:0,publicKeyCreate(e,t){const r=new o(t);if(r.cmp(n.n)>=0||r.isZero())return 1;return savePublicKey(e,a.keyFromPrivate(t).getPublic()),0},publicKeyConvert(e,t){const r=loadPublicKey(t);if(null===r)return 1;return savePublicKey(e,r.getPublic()),0},publicKeyNegate(e,t){const r=loadPublicKey(t);if(null===r)return 1;const a=r.getPublic();return a.y=a.y.redNeg(),savePublicKey(e,a),0},publicKeyCombine(e,t){const r=new Array(t.length);for(let e=0;e=0)return 2;const c=a.getPublic().add(n.g.mul(r));return c.isInfinity()?2:(savePublicKey(e,c),0)},publicKeyTweakMul(e,t,r){const a=loadPublicKey(t);if(null===a)return 1;if((r=new o(r)).cmp(n.n)>=0||r.isZero())return 2;return savePublicKey(e,a.getPublic().mul(r)),0},signatureNormalize(e){const t=new o(e.subarray(0,32)),r=new o(e.subarray(32,64));return t.cmp(n.n)>=0||r.cmp(n.n)>=0?1:(1===r.cmp(a.nh)&&e.set(n.n.sub(r).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,t){const r=t.subarray(0,32),a=t.subarray(32,64);if(new o(r).cmp(n.n)>=0)return 1;if(new o(a).cmp(n.n)>=0)return 1;const{output:c}=e;let s=c.subarray(4,37);s[0]=0,s.set(r,1);let d=33,u=0;for(;d>1&&0===s[u]&&!(128&s[u+1]);--d,++u);if(s=s.subarray(u),128&s[0])return 1;if(d>1&&0===s[0]&&!(128&s[1]))return 1;let h=c.subarray(39,72);h[0]=0,h.set(a,1);let l=33,b=0;for(;l>1&&0===h[b]&&!(128&h[b+1]);--l,++b);return h=h.subarray(b),128&h[0]||l>1&&0===h[0]&&!(128&h[1])?1:(e.outputlen=6+d+l,c[0]=48,c[1]=e.outputlen-2,c[2]=2,c[3]=s.length,c.set(s,4),c[4+d]=2,c[5+d]=h.length,c.set(h,6+d),0)},signatureImport(e,t){if(t.length<8)return 1;if(t.length>72)return 1;if(48!==t[0])return 1;if(t[1]!==t.length-2)return 1;if(2!==t[2])return 1;const r=t[3];if(0===r)return 1;if(5+r>=t.length)return 1;if(2!==t[4+r])return 1;const a=t[5+r];if(0===a)return 1;if(6+r+a!==t.length)return 1;if(128&t[4])return 1;if(r>1&&0===t[4]&&!(128&t[5]))return 1;if(128&t[r+6])return 1;if(a>1&&0===t[r+6]&&!(128&t[r+7]))return 1;let c=t.subarray(4,4+r);if(33===c.length&&0===c[0]&&(c=c.subarray(1)),c.length>32)return 1;let s=t.subarray(6+r);if(33===s.length&&0===s[0]&&(s=s.slice(1)),s.length>32)throw new Error("S length is too long");let d=new o(c);d.cmp(n.n)>=0&&(d=new o(0));let u=new o(t.subarray(6+r));return u.cmp(n.n)>=0&&(u=new o(0)),e.set(d.toArrayLike(Uint8Array,"be",32),0),e.set(u.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,t,r,c,s){if(s){const e=s;s=a=>{const n=e(t,r,null,c,a);if(!(n instanceof Uint8Array&&32===n.length))throw new Error("This is the way");return new o(n)}}const d=new o(r);if(d.cmp(n.n)>=0||d.isZero())return 1;let u;try{u=a.sign(t,r,{canonical:!0,k:s,pers:c})}catch(e){return 1}return e.signature.set(u.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(u.s.toArrayLike(Uint8Array,"be",32),32),e.recid=u.recoveryParam,0},ecdsaVerify(e,t,r){const c={r:e.subarray(0,32),s:e.subarray(32,64)},s=new o(c.r),d=new o(c.s);if(s.cmp(n.n)>=0||d.cmp(n.n)>=0)return 1;if(1===d.cmp(a.nh)||s.isZero()||d.isZero())return 3;const u=loadPublicKey(r);if(null===u)return 2;const h=u.getPublic();return a.verify(t,c,h)?0:3},ecdsaRecover(e,t,r,c){const s={r:t.slice(0,32),s:t.slice(32,64)},d=new o(s.r),u=new o(s.s);if(d.cmp(n.n)>=0||u.cmp(n.n)>=0)return 1;if(d.isZero()||u.isZero())return 2;let h;try{h=a.recoverPubKey(c,s,r)}catch(e){return 2}return savePublicKey(e,h),0},ecdh(e,t,r,c,s,d,u){const h=loadPublicKey(t);if(null===h)return 1;const l=new o(r);if(l.cmp(n.n)>=0||l.isZero())return 2;const b=h.getPublic().mul(l);if(void 0===s){const t=b.encode(null,!0),r=a.hash().update(t).digest();for(let t=0;t<32;++t)e[t]=r[t]}else{d||(d=new Uint8Array(32));const t=b.getX().toArray("be",32);for(let e=0;e<32;++e)d[e]=t[e];u||(u=new Uint8Array(32));const r=b.getY().toArray("be",32);for(let e=0;e<32;++e)u[e]=r[e];const a=s(d,u,c);if(!(a instanceof Uint8Array&&a.length===e.length))return 2;e.set(a)}return 0}}},(e,t)=>{"use strict";var r=t;function zero2(e){return 1===e.length?"0"+e:e}function toHex(e){for(var t="",r=0;r>8,c=255&n;o?r.push(o,c):r.push(c)}return r},r.zero2=zero2,r.toHex=toHex,r.encode=function encode(e,t){return"hex"===t?toHex(e):e}},(e,t,r)=>{var a;function Rand(e){this.rand=e}if(e.exports=function rand(e){return a||(a=new Rand(null)),a.generate(e)},e.exports.Rand=Rand,Rand.prototype.generate=function generate(e){return this._rand(e)},Rand.prototype._rand=function _rand(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r{"use strict";var a=t;a.base=r(279),a.short=r(869),a.mont=r(870),a.edwards=r(871)},(e,t,r)=>{"use strict";var a=r(116),n=r(280),o=r(873),c=r(161),s=a.sum32,d=a.sum32_4,u=a.sum32_5,h=o.ch32,l=o.maj32,b=o.s0_256,g=o.s1_256,p=o.g0_256,B=o.g1_256,m=n.BlockHash,I=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function SHA256(){if(!(this instanceof SHA256))return new SHA256;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=I,this.W=new Array(64)}a.inherits(SHA256,m),e.exports=SHA256,SHA256.blockSize=512,SHA256.outSize=256,SHA256.hmacStrength=192,SHA256.padLength=64,SHA256.prototype._update=function _update(e,t){for(var r=this.W,a=0;a<16;a++)r[a]=e[t+a];for(;a{"use strict";var a=r(116),n=r(280),o=r(161),c=a.rotr64_hi,s=a.rotr64_lo,d=a.shr64_hi,u=a.shr64_lo,h=a.sum64,l=a.sum64_hi,b=a.sum64_lo,g=a.sum64_4_hi,p=a.sum64_4_lo,B=a.sum64_5_hi,m=a.sum64_5_lo,I=n.BlockHash,y=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function SHA512(){if(!(this instanceof SHA512))return new SHA512;I.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=y,this.W=new Array(160)}function ch64_hi(e,t,r,a,n){var o=e&r^~e&n;return o<0&&(o+=4294967296),o}function ch64_lo(e,t,r,a,n,o){var c=t&a^~t&o;return c<0&&(c+=4294967296),c}function maj64_hi(e,t,r,a,n){var o=e&r^e&n^r&n;return o<0&&(o+=4294967296),o}function maj64_lo(e,t,r,a,n,o){var c=t&a^t&o^a&o;return c<0&&(c+=4294967296),c}function s0_512_hi(e,t){var r=c(e,t,28)^c(t,e,2)^c(t,e,7);return r<0&&(r+=4294967296),r}function s0_512_lo(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function s1_512_hi(e,t){var r=c(e,t,14)^c(e,t,18)^c(t,e,9);return r<0&&(r+=4294967296),r}function s1_512_lo(e,t){var r=s(e,t,14)^s(e,t,18)^s(t,e,9);return r<0&&(r+=4294967296),r}function g0_512_hi(e,t){var r=c(e,t,1)^c(e,t,8)^d(e,t,7);return r<0&&(r+=4294967296),r}function g0_512_lo(e,t){var r=s(e,t,1)^s(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function g1_512_hi(e,t){var r=c(e,t,19)^c(t,e,29)^d(e,t,6);return r<0&&(r+=4294967296),r}function g1_512_lo(e,t){var r=s(e,t,19)^s(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}a.inherits(SHA512,I),e.exports=SHA512,SHA512.blockSize=1024,SHA512.outSize=512,SHA512.hmacStrength=192,SHA512.padLength=128,SHA512.prototype._prepareBlock=function _prepareBlock(e,t){for(var r=this.W,a=0;a<32;a++)r[a]=e[t+a];for(;a{"use strict";var a=r(1),n=65536,o=4294967295;var c=r(61).Buffer,s=r.g.crypto||r.g.msCrypto;s&&s.getRandomValues?e.exports=function randomBytes(e,t){if(e>o)throw new RangeError("requested too many random bytes");var r=c.allocUnsafe(e);if(e>0)if(e>n)for(var d=0;d=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),c=t;c=49?s-49+10:s>=17?s-17+10:s}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,c=o%a,s=Math.min(o,o-c)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],o=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],c=n*o,s=67108863&c,d=c/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(c=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&c}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,s=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=c[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,c,s="le"===t,d=new e(n),u=this.clone();if(s){for(c=0;!u.isZero();c++)o=u.andln(255),u.iushrn(8),d[c]=o;for(;c=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,c=0;c>26,this.words[c]=67108863&t;for(;0!==o&&c>26,this.words[c]=67108863&t;if(0===o&&c>>13,g=0|c[1],p=8191&g,B=g>>>13,m=0|c[2],I=8191&m,y=m>>>13,x=0|c[3],C=8191&x,v=x>>>13,Q=0|c[4],w=8191&Q,_=Q>>>13,k=0|c[5],N=8191&k,D=k>>>13,U=0|c[6],G=8191&U,T=U>>>13,L=0|c[7],q=8191&L,P=L>>>13,O=0|c[8],H=8191&O,Y=O>>>13,J=0|c[9],j=8191&J,z=J>>>13,W=0|s[0],V=8191&W,X=W>>>13,$=0|s[1],et=8191&$,tt=$>>>13,rt=0|s[2],at=8191&rt,it=rt>>>13,nt=0|s[3],ot=8191&nt,At=nt>>>13,ct=0|s[4],st=8191&ct,dt=ct>>>13,ut=0|s[5],ht=8191&ut,bt=ut>>>13,pt=0|s[6],Bt=8191&pt,mt=pt>>>13,It=0|s[7],Et=8191&It,yt=It>>>13,xt=0|s[8],Ct=8191&xt,vt=xt>>>13,Qt=0|s[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(C,V),n=(n=Math.imul(C,X))+Math.imul(v,V)|0,o=Math.imul(v,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(C,et)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(v,et)|0,o=o+Math.imul(v,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,st)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(C,at)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(v,at)|0,o=o+Math.imul(v,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,st)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,st)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,At)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,At)|0,a=a+Math.imul(I,st)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,st)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(q,V),n=(n=Math.imul(q,X))+Math.imul(P,V)|0,o=Math.imul(P,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(C,st)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(v,st)|0,o=o+Math.imul(v,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(q,et)|0,n=(n=n+Math.imul(q,tt)|0)+Math.imul(P,et)|0,o=o+Math.imul(P,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,st)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,st)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,bt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,Ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,vt)|0)+Math.imul(b,Ct)|0))<<13)|0;u=((o=o+Math.imul(b,vt)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(j,V),n=(n=Math.imul(j,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(q,at)|0,n=(n=n+Math.imul(q,it)|0)+Math.imul(P,at)|0,o=o+Math.imul(P,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,st)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,st)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(C,Bt)|0,n=(n=n+Math.imul(C,mt)|0)+Math.imul(v,Bt)|0,o=o+Math.imul(v,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,Ct)|0,n=(n=n+Math.imul(p,vt)|0)+Math.imul(B,Ct)|0,o=o+Math.imul(B,vt)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(j,et),n=(n=Math.imul(j,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(q,ot)|0,n=(n=n+Math.imul(q,At)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,At)|0,a=a+Math.imul(G,st)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,st)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(C,Et)|0,n=(n=n+Math.imul(C,yt)|0)+Math.imul(v,Et)|0,o=o+Math.imul(v,yt)|0,a=a+Math.imul(I,Ct)|0,n=(n=n+Math.imul(I,vt)|0)+Math.imul(y,Ct)|0,o=o+Math.imul(y,vt)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(j,at),n=(n=Math.imul(j,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(q,st)|0,n=(n=n+Math.imul(q,dt)|0)+Math.imul(P,st)|0,o=o+Math.imul(P,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(C,Ct)|0,n=(n=n+Math.imul(C,vt)|0)+Math.imul(v,Ct)|0,o=o+Math.imul(v,vt)|0;var qt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(j,ot),n=(n=Math.imul(j,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,st)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,st)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(q,ht)|0,n=(n=n+Math.imul(q,bt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,Ct)|0,n=(n=n+Math.imul(w,vt)|0)+Math.imul(_,Ct)|0,o=o+Math.imul(_,vt)|0;var Pt=(u+(a=a+Math.imul(C,wt)|0)|0)+((8191&(n=(n=n+Math.imul(C,Mt)|0)+Math.imul(v,wt)|0))<<13)|0;u=((o=o+Math.imul(v,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(j,st),n=(n=Math.imul(j,dt))+Math.imul(z,st)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(q,Bt)|0,n=(n=n+Math.imul(q,mt)|0)+Math.imul(P,Bt)|0,o=o+Math.imul(P,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,Ct)|0,n=(n=n+Math.imul(N,vt)|0)+Math.imul(D,Ct)|0,o=o+Math.imul(D,vt)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(j,ht),n=(n=Math.imul(j,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(q,Et)|0,n=(n=n+Math.imul(q,yt)|0)+Math.imul(P,Et)|0,o=o+Math.imul(P,yt)|0,a=a+Math.imul(G,Ct)|0,n=(n=n+Math.imul(G,vt)|0)+Math.imul(T,Ct)|0,o=o+Math.imul(T,vt)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(j,Bt),n=(n=Math.imul(j,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(q,Ct)|0,n=(n=n+Math.imul(q,vt)|0)+Math.imul(P,Ct)|0,o=o+Math.imul(P,vt)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(j,Et),n=(n=Math.imul(j,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,Ct)|0,n=(n=n+Math.imul(H,vt)|0)+Math.imul(Y,Ct)|0,o=o+Math.imul(Y,vt)|0;var Jt=(u+(a=a+Math.imul(q,wt)|0)|0)+((8191&(n=(n=n+Math.imul(q,Mt)|0)+Math.imul(P,wt)|0))<<13)|0;u=((o=o+Math.imul(P,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(j,Ct),n=(n=Math.imul(j,vt))+Math.imul(z,Ct)|0,o=Math.imul(z,vt);var Kt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863;var jt=(u+(a=Math.imul(j,wt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=qt,d[12]=Pt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=Jt,d[17]=Kt,d[18]=jt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(s=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?s(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,c&=67108863}r.words[o]=s,a=c,c=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var c=0;c>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),c=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&c}return s&&0!==u&&(s.words[s.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(s/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===c)return this.strip();for(assert(-1===c),c=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var c,s=a.length-n.length;if("mod"!==t){(c=new BN(null)).length=s+1,c.words=new Array(c.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);c&&(c.words[h]=l)}return c&&c.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:c||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),c=new BN(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(d),c.isub(u)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(c)):(r.isub(t),o.isub(a),c.isub(n))}return{a:o,b:c,gcd:r.iushln(s)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var s=0,d=1;0==(t.words[0]&d)&&s<26;++s,d<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(c),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,c&=67108863,this.words[o]=c}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=c}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),c=o.redNeg(),s=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,s).cmp(c);)d.redIAdd(c);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=s-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++c||0===a&&0===u)&&(n=this.mul(n,r[o]),c=0,o=0)):c=0}s=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},e=>{e.exports=function isHexPrefixed(e){if("string"!=typeof e)throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof e+", while checking isHexPrefixed.");return"0x"===e.slice(0,2)}},(e,t,r)=>{"use strict";var a=r(63).Buffer,n=r(355).Transform;function HashBase(e){n.call(this),this._block=a.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(25)(HashBase,n),HashBase.prototype._transform=function(e,t,r){var a=null;try{this.update(e,t)}catch(e){a=e}r(a)},HashBase.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},HashBase.prototype.update=function(e,t){if(function throwIfNotStringOrBuffer(e,t){if(!a.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");a.isBuffer(e)||(e=a.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var o=this._blockOffset;o0;++c)this._length[c]+=s,(s=this._length[c]/4294967296|0)>0&&(this._length[c]-=4294967296*s);return this},HashBase.prototype._update=function(){throw new Error("_update is not implemented")},HashBase.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},HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=HashBase},(e,t,r)=>{"use strict";var a,n=r(1);e.exports=Readable,Readable.ReadableState=ReadableState;r(34).EventEmitter;var o=function EElistenerCount(e,t){return e.listeners(t).length},c=r(898),s=r(2).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(89);u=h&&h.debuglog?h.debuglog("stream"):function debug(){};var l,b,g,p=r(899),B=r(527),m=r(528).getHighWaterMark,I=r(242).a,y=I.ERR_INVALID_ARG_TYPE,x=I.ERR_STREAM_PUSH_AFTER_EOF,C=I.ERR_METHOD_NOT_IMPLEMENTED,v=I.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(25)(Readable,c);var Q=B.errorOrDestroy,w=["error","close","destroy","pause","resume"];function ReadableState(e,t,n){a=a||r(192),e=e||{},"boolean"!=typeof n&&(n=t instanceof a),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(this,e,"readableHighWaterMark",n),this.buffer=new p,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.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(l||(l=r(530).a),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function Readable(e){if(a=a||r(192),!(this instanceof Readable))return new Readable(e);var t=this instanceof a;this._readableState=new ReadableState(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),c.call(this)}function readableAddChunk(e,t,r,a,n){u("readableAddChunk",t);var o,c=e._readableState;if(null===t)c.reading=!1,function onEofChunk(e,t){if(u("onEofChunk"),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,t.sync?emitReadable(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,emitReadable_(e)))}(e,c);else if(n||(o=function chunkInvalid(e,t){var r;(function _isUint8Array(e){return s.isBuffer(e)||e instanceof d})(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],t));return r}(c,t)),o)Q(e,o);else if(c.objectMode||t&&t.length>0)if("string"==typeof t||c.objectMode||Object.getPrototypeOf(t)===s.prototype||(t=function _uint8ArrayToBuffer(e){return s.from(e)}(t)),a)c.endEmitted?Q(e,new v):addChunk(e,c,t,!0);else if(c.ended)Q(e,new x);else{if(c.destroyed)return!1;c.reading=!1,c.decoder&&!r?(t=c.decoder.write(t),c.objectMode||0!==t.length?addChunk(e,c,t,!1):maybeReadMore(e,c)):addChunk(e,c,t,!1)}else a||(c.reading=!1,maybeReadMore(e,c));return!c.ended&&(c.lengtht.highWaterMark&&(t.highWaterMark=function computeNewHighWaterMark(e){return e>=_?e=_:(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 emitReadable(e){var t=e._readableState;u("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(u("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(emitReadable_,e))}function emitReadable_(e){var t=e._readableState;u("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,flow(e)}function maybeReadMore(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(maybeReadMore_,e,t))}function maybeReadMore_(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function nReadingNextTick(e){u("readable nexttick read 0"),e.read(0)}function resume_(e,t){u("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),flow(e),t.flowing&&!t.reading&&e.read(0)}function flow(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function fromList(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 endReadable(e){var t=e._readableState;u("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(endReadableNT,t,e))}function endReadableNT(e,t){if(u("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 indexOf(e,t){for(var r=0,a=e.length;r=t.highWaterMark:t.length>0)||t.ended))return u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?endReadable(this):emitReadable(this),null;if(0===(e=howMuchToRead(e,t))&&t.ended)return 0===t.length&&endReadable(this),null;var a,n=t.needReadable;return u("need readable",n),(0===t.length||t.length-e0?fromList(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&&endReadable(this)),null!==a&&this.emit("data",a),a},Readable.prototype._read=function(e){Q(this,new C("_read()"))},Readable.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,u("pipe count=%d opts=%j",a.pipesCount,t);var c=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?onend:unpipe;function onunpipe(t,n){u("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,function cleanup(){u("cleanup"),e.removeListener("close",onclose),e.removeListener("finish",onfinish),e.removeListener("drain",s),e.removeListener("error",onerror),e.removeListener("unpipe",onunpipe),r.removeListener("end",onend),r.removeListener("end",unpipe),r.removeListener("data",ondata),d=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}())}function onend(){u("onend"),e.end()}a.endEmitted?n.nextTick(c):r.once("end",c),e.on("unpipe",onunpipe);var s=function pipeOnDrain(e){return function pipeOnDrainFunctionResult(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,flow(e))}}(r);e.on("drain",s);var d=!1;function ondata(t){u("ondata");var n=e.write(t);u("dest.write",n),!1===n&&((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==indexOf(a.pipes,e))&&!d&&(u("false write response, pause",a.awaitDrain),a.awaitDrain++),r.pause())}function onerror(t){u("onerror",t),unpipe(),e.removeListener("error",onerror),0===o(e,"error")&&Q(e,t)}function onclose(){e.removeListener("finish",onfinish),unpipe()}function onfinish(){u("onfinish"),e.removeListener("close",onclose),unpipe()}function unpipe(){u("unpipe"),r.unpipe(e)}return r.on("data",ondata),function prependListener(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",onerror),e.once("close",onclose),e.once("finish",onfinish),e.emit("pipe",r),a.flowing||(u("pipe resume"),r.resume()),e},Readable.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 a=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==a.flowing&&this.resume()):"readable"===e&&(a.endEmitted||a.readableListening||(a.readableListening=a.needReadable=!0,a.flowing=!1,a.emittedReadable=!1,u("on readable",a.length,a.reading),a.length?emitReadable(this):a.reading||n.nextTick(nReadingNextTick,this))),r},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.removeListener=function(e,t){var r=c.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(updateReadableListening,this),r},Readable.prototype.removeAllListeners=function(e){var t=c.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(updateReadableListening,this),t},Readable.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!e.readableListening,function resume(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(resume_,e,t))}(this,e)),e.paused=!1,this},Readable.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},Readable.prototype.wrap=function(e){var t=this,r=this._readableState,a=!1;for(var n in e.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(n){(u("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(a=!0,e.pause()))})),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function methodWrap(t){return function methodWrapReturnFunction(){return e[t].apply(e,arguments)}}(n));for(var o=0;o{"use strict";var a=r(1);function emitErrorAndCloseNT(e,t){emitErrorNT(e,t),emitCloseNT(e)}function emitCloseNT(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function emitErrorNT(e,t){e.emit("error",t)}e.exports={destroy:function destroy(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return n||o?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,a.nextTick(emitErrorNT,this,e)):a.nextTick(emitErrorNT,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?r._writableState?r._writableState.errorEmitted?a.nextTick(emitCloseNT,r):(r._writableState.errorEmitted=!0,a.nextTick(emitErrorAndCloseNT,r,e)):a.nextTick(emitErrorAndCloseNT,r,e):t?(a.nextTick(emitCloseNT,r),t(e)):a.nextTick(emitCloseNT,r)})),this)},undestroy:function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function errorOrDestroy(e,t){var r=e._readableState,a=e._writableState;r&&r.autoDestroy||a&&a.autoDestroy?e.destroy(t):e.emit("error",t)}}},(e,t,r)=>{"use strict";var a=r(242).a.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function getHighWaterMark(e,t,r,n){var o=function highWaterMarkFrom(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new a(n?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},(e,t,r)=>{"use strict";var a,n=r(1);function CorkedRequest(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function onCorkedFinish(e,t,r){var a=e.entry;e.entry=null;for(;a;){var n=a.callback;t.pendingcb--,n(r),a=a.next}t.corkedRequestsFree.next=e}(t,e)}}e.exports=Writable,Writable.WritableState=WritableState;var o={deprecate:r(900)},c=r(898),s=r(2).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(527),l=r(528).getHighWaterMark,b=r(242).a,g=b.ERR_INVALID_ARG_TYPE,p=b.ERR_METHOD_NOT_IMPLEMENTED,B=b.ERR_MULTIPLE_CALLBACK,m=b.ERR_STREAM_CANNOT_PIPE,I=b.ERR_STREAM_DESTROYED,y=b.ERR_STREAM_NULL_VALUES,x=b.ERR_STREAM_WRITE_AFTER_END,C=b.ERR_UNKNOWN_ENCODING,v=h.errorOrDestroy;function nop(){}function WritableState(e,t,o){a=a||r(192),e=e||{},"boolean"!=typeof o&&(o=t instanceof a),this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=l(this,e,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,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 onwrite(e,t){var r=e._writableState,a=r.sync,o=r.writecb;if("function"!=typeof o)throw new B;if(function onwriteStateUpdate(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function onwriteError(e,t,r,a,o){--t.pendingcb,r?(n.nextTick(o,a),n.nextTick(finishMaybe,e,t),e._writableState.errorEmitted=!0,v(e,a)):(o(a),e._writableState.errorEmitted=!0,v(e,a),finishMaybe(e,t))}(e,r,a,t,o);else{var c=needFinish(r)||e.destroyed;c||r.corked||r.bufferProcessing||!r.bufferedRequest||clearBuffer(e,r),a?n.nextTick(afterWrite,e,r,c,o):afterWrite(e,r,c,o)}}(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 CorkedRequest(this)}function Writable(e){var t=this instanceof(a=a||r(192));if(!t&&!u.call(Writable,this))return new Writable(e);this._writableState=new WritableState(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)),c.call(this)}function doWrite(e,t,r,a,n,o,c){t.writelen=a,t.writecb=c,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new I("write")):r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}function afterWrite(e,t,r,a){r||function onwriteDrain(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,a(),finishMaybe(e,t)}function clearBuffer(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var a=t.bufferedRequestCount,n=new Array(a),o=t.corkedRequestsFree;o.entry=r;for(var c=0,s=!0;r;)n[c]=r,r.isBuf||(s=!1),r=r.next,c+=1;n.allBuffers=s,doWrite(e,t,!0,t.length,n,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new CorkedRequest(t),t.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,u=r.encoding,h=r.callback;if(doWrite(e,t,!1,t.objectMode?1:d.length,d,u,h),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function needFinish(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function callFinal(e,t){e._final((function(r){t.pendingcb--,r&&v(e,r),t.prefinished=!0,e.emit("prefinish"),finishMaybe(e,t)}))}function finishMaybe(e,t){var r=needFinish(t);if(r&&(function prefinish(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,n.nextTick(callFinal,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var a=e._readableState;(!a||a.autoDestroy&&a.endEmitted)&&e.destroy()}return r}r(25)(Writable,c),WritableState.prototype.getBuffer=function getBuffer(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:o.deprecate((function writableStateBufferGetter(){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]?(u=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function value(e){return!!u.call(this,e)||this===Writable&&(e&&e._writableState instanceof WritableState)}})):u=function realHasInstance(e){return e instanceof this},Writable.prototype.pipe=function(){v(this,new m)},Writable.prototype.write=function(e,t,r){var a=this._writableState,o=!1,c=!a.objectMode&&function _isUint8Array(e){return s.isBuffer(e)||e instanceof d}(e);return c&&!s.isBuffer(e)&&(e=function _uint8ArrayToBuffer(e){return s.from(e)}(e)),"function"==typeof t&&(r=t,t=null),c?t="buffer":t||(t=a.defaultEncoding),"function"!=typeof r&&(r=nop),a.ending?function writeAfterEnd(e,t){var r=new x;v(e,r),n.nextTick(t,r)}(this,r):(c||function validChunk(e,t,r,a){var o;return null===r?o=new y:"string"==typeof r||t.objectMode||(o=new g("chunk",["string","Buffer"],r)),!o||(v(e,o),n.nextTick(a,o),!1)}(this,a,e,r))&&(a.pendingcb++,o=function writeOrBuffer(e,t,r,a,n,o){if(!r){var c=function decodeChunk(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=s.from(t,r));return t}(t,a,n);a!==c&&(r=!0,n="buffer",a=c)}var d=t.objectMode?1:a.length;t.length+=d;var u=t.length-1))throw new C(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:!1,get:function get(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function get(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(e,t,r){r(new p("_write()"))},Writable.prototype._writev=null,Writable.prototype.end=function(e,t,r){var a=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),a.corked&&(a.corked=1,this.uncork()),a.ending||function endWritable(e,t,r){t.ending=!0,finishMaybe(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,a,r),this},Object.defineProperty(Writable.prototype,"writableLength",{enumerable:!1,get:function get(){return this._writableState.length}}),Object.defineProperty(Writable.prototype,"destroyed",{enumerable:!1,get:function get(){return void 0!==this._writableState&&this._writableState.destroyed},set:function set(e){this._writableState&&(this._writableState.destroyed=e)}}),Writable.prototype.destroy=h.destroy,Writable.prototype._undestroy=h.undestroy,Writable.prototype._destroy=function(e,t){t(e)}},(e,t,r)=>{"use strict";var a=r(63).Buffer,n=a.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function StringDecoder(e){var t;switch(this.encoding=function normalizeEncoding(e){var t=function _normalizeEncoding(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&&(a.isEncoding===n||!n(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,t=4;break;case"utf8":this.fillLast=utf8FillLast,t=4;break;case"base64":this.text=base64Text,this.end=base64End,t=3;break;default:return this.write=simpleWrite,void(this.end=simpleEnd)}this.lastNeed=0,this.lastTotal=0,this.lastChar=a.allocUnsafe(t)}function utf8CheckByte(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function utf8FillLast(e){var t=this.lastTotal-this.lastNeed,r=function utf8CheckExtraBytes(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 utf16Text(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var a=r.charCodeAt(r.length-1);if(a>=55296&&a<=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 utf16End(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 base64Text(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 base64End(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function simpleWrite(e){return e.toString(this.encoding)}function simpleEnd(e){return e&&e.length?this.write(e):""}t.a=StringDecoder,StringDecoder.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 n>0&&(e.lastNeed=n-1),n;if(--a=0)return n>0&&(e.lastNeed=n-2),n;if(--a=0)return n>0&&(2===n?n=0:e.lastNeed=n-3),n;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var a=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,a),e.toString("utf8",t,a)},StringDecoder.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}},(e,t,r)=>{"use strict";e.exports=Transform;var a=r(242).a,n=a.ERR_METHOD_NOT_IMPLEMENTED,o=a.ERR_MULTIPLE_CALLBACK,c=a.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=a.ERR_TRANSFORM_WITH_LENGTH_0,d=r(192);function afterTransform(e,t){var r=this._transformState;r.transforming=!1;var a=r.writecb;if(null===a)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),a(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length{var a=r(25),n=r(193),o=r(63).Buffer,c=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function Sha256(){this.init(),this._w=s,n.call(this,64,56)}function ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function sigma1(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function gamma0(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}a(Sha256,n),Sha256.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},Sha256.prototype._update=function(e){for(var t,r=this._w,a=0|this._a,n=0|this._b,o=0|this._c,s=0|this._d,d=0|this._e,u=0|this._f,h=0|this._g,l=0|this._h,b=0;b<16;++b)r[b]=e.readInt32BE(4*b);for(;b<64;++b)r[b]=0|(((t=r[b-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[b-7]+gamma0(r[b-15])+r[b-16];for(var g=0;g<64;++g){var p=l+sigma1(d)+ch(d,u,h)+c[g]+r[g]|0,B=sigma0(a)+maj(a,n,o)|0;l=h,h=u,u=d,d=s+p|0,s=o,o=n,n=a,a=p+B|0}this._a=a+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=d+this._e|0,this._f=u+this._f|0,this._g=h+this._g|0,this._h=l+this._h|0},Sha256.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=Sha256},(e,t,r)=>{var a=r(25),n=r(193),o=r(63).Buffer,c=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],s=new Array(160);function Sha512(){this.init(),this._w=s,n.call(this,128,112)}function Ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function sigma1(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Gamma0(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Gamma0l(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function Gamma1(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Gamma1l(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function getCarry(e,t){return e>>>0>>0?1:0}a(Sha512,n),Sha512.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},Sha512.prototype._update=function(e){for(var t=this._w,r=0|this._ah,a=0|this._bh,n=0|this._ch,o=0|this._dh,s=0|this._eh,d=0|this._fh,u=0|this._gh,h=0|this._hh,l=0|this._al,b=0|this._bl,g=0|this._cl,p=0|this._dl,B=0|this._el,m=0|this._fl,I=0|this._gl,y=0|this._hl,x=0;x<32;x+=2)t[x]=e.readInt32BE(4*x),t[x+1]=e.readInt32BE(4*x+4);for(;x<160;x+=2){var C=t[x-30],v=t[x-30+1],Q=Gamma0(C,v),w=Gamma0l(v,C),_=Gamma1(C=t[x-4],v=t[x-4+1]),k=Gamma1l(v,C),N=t[x-14],D=t[x-14+1],U=t[x-32],G=t[x-32+1],T=w+D|0,L=Q+N+getCarry(T,w)|0;L=(L=L+_+getCarry(T=T+k|0,k)|0)+U+getCarry(T=T+G|0,G)|0,t[x]=L,t[x+1]=T}for(var q=0;q<160;q+=2){L=t[q],T=t[q+1];var P=maj(r,a,n),O=maj(l,b,g),H=sigma0(r,l),Y=sigma0(l,r),J=sigma1(s,B),j=sigma1(B,s),z=c[q],W=c[q+1],V=Ch(s,d,u),X=Ch(B,m,I),$=y+j|0,et=h+J+getCarry($,y)|0;et=(et=(et=et+V+getCarry($=$+X|0,X)|0)+z+getCarry($=$+W|0,W)|0)+L+getCarry($=$+T|0,T)|0;var tt=Y+O|0,rt=H+P+getCarry(tt,Y)|0;h=u,y=I,u=d,I=m,d=s,m=B,s=o+et+getCarry(B=p+$|0,p)|0,o=n,p=g,n=a,g=b,a=r,b=l,r=et+rt+getCarry(l=$+tt|0,$)|0}this._al=this._al+l|0,this._bl=this._bl+b|0,this._cl=this._cl+g|0,this._dl=this._dl+p|0,this._el=this._el+B|0,this._fl=this._fl+m|0,this._gl=this._gl+I|0,this._hl=this._hl+y|0,this._ah=this._ah+r+getCarry(this._al,l)|0,this._bh=this._bh+a+getCarry(this._bl,b)|0,this._ch=this._ch+n+getCarry(this._cl,g)|0,this._dh=this._dh+o+getCarry(this._dl,p)|0,this._eh=this._eh+s+getCarry(this._el,B)|0,this._fh=this._fh+d+getCarry(this._fl,m)|0,this._gh=this._gh+u+getCarry(this._gl,I)|0,this._hh=this._hh+h+getCarry(this._hl,y)|0},Sha512.prototype._hash=function(){var e=o.allocUnsafe(64);function writeInt64BE(t,r,a){e.writeInt32BE(t,a),e.writeInt32BE(r,a+4)}return writeInt64BE(this._ah,this._al,0),writeInt64BE(this._bh,this._bl,8),writeInt64BE(this._ch,this._cl,16),writeInt64BE(this._dh,this._dl,24),writeInt64BE(this._eh,this._el,32),writeInt64BE(this._fh,this._fl,40),writeInt64BE(this._gh,this._gl,48),writeInt64BE(this._hh,this._hl,56),e},e.exports=Sha512},(e,t,r)=>{e.exports=r(912)(r(913))},(e,t)=>{"use strict";var r=t;function zero2(e){return 1===e.length?"0"+e:e}function toHex(e){for(var t="",r=0;r>8,c=255&n;o?r.push(o,c):r.push(c)}return r},r.zero2=zero2,r.toHex=toHex,r.encode=function encode(e,t){return"hex"===t?toHex(e):e}},(e,t,r)=>{var a;function Rand(e){this.rand=e}if(e.exports=function rand(e){return a||(a=new Rand(null)),a.generate(e)},e.exports.Rand=Rand,Rand.prototype.generate=function generate(e){return this._rand(e)},Rand.prototype._rand=function _rand(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r{"use strict";var a=t;a.base=r(283),a.short=r(915),a.mont=r(916),a.edwards=r(917)},(e,t,r)=>{"use strict";var a=r(117),n=r(284),o=r(919),c=r(163),s=a.sum32,d=a.sum32_4,u=a.sum32_5,h=o.ch32,l=o.maj32,b=o.s0_256,g=o.s1_256,p=o.g0_256,B=o.g1_256,m=n.BlockHash,I=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function SHA256(){if(!(this instanceof SHA256))return new SHA256;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=I,this.W=new Array(64)}a.inherits(SHA256,m),e.exports=SHA256,SHA256.blockSize=512,SHA256.outSize=256,SHA256.hmacStrength=192,SHA256.padLength=64,SHA256.prototype._update=function _update(e,t){for(var r=this.W,a=0;a<16;a++)r[a]=e[t+a];for(;a{"use strict";var a=r(117),n=r(284),o=r(163),c=a.rotr64_hi,s=a.rotr64_lo,d=a.shr64_hi,u=a.shr64_lo,h=a.sum64,l=a.sum64_hi,b=a.sum64_lo,g=a.sum64_4_hi,p=a.sum64_4_lo,B=a.sum64_5_hi,m=a.sum64_5_lo,I=n.BlockHash,y=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function SHA512(){if(!(this instanceof SHA512))return new SHA512;I.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=y,this.W=new Array(160)}function ch64_hi(e,t,r,a,n){var o=e&r^~e&n;return o<0&&(o+=4294967296),o}function ch64_lo(e,t,r,a,n,o){var c=t&a^~t&o;return c<0&&(c+=4294967296),c}function maj64_hi(e,t,r,a,n){var o=e&r^e&n^r&n;return o<0&&(o+=4294967296),o}function maj64_lo(e,t,r,a,n,o){var c=t&a^t&o^a&o;return c<0&&(c+=4294967296),c}function s0_512_hi(e,t){var r=c(e,t,28)^c(t,e,2)^c(t,e,7);return r<0&&(r+=4294967296),r}function s0_512_lo(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function s1_512_hi(e,t){var r=c(e,t,14)^c(e,t,18)^c(t,e,9);return r<0&&(r+=4294967296),r}function s1_512_lo(e,t){var r=s(e,t,14)^s(e,t,18)^s(t,e,9);return r<0&&(r+=4294967296),r}function g0_512_hi(e,t){var r=c(e,t,1)^c(e,t,8)^d(e,t,7);return r<0&&(r+=4294967296),r}function g0_512_lo(e,t){var r=s(e,t,1)^s(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function g1_512_hi(e,t){var r=c(e,t,19)^c(t,e,29)^d(e,t,6);return r<0&&(r+=4294967296),r}function g1_512_lo(e,t){var r=s(e,t,19)^s(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}a.inherits(SHA512,I),e.exports=SHA512,SHA512.blockSize=1024,SHA512.outSize=512,SHA512.hmacStrength=192,SHA512.padLength=128,SHA512.prototype._prepareBlock=function _prepareBlock(e,t){for(var r=this.W,a=0;a<32;a++)r[a]=e[t+a];for(;a{"use strict";var a=r(1),n=65536,o=4294967295;var c=r(63).Buffer,s=r.g.crypto||r.g.msCrypto;s&&s.getRandomValues?e.exports=function randomBytes(e,t){if(e>o)throw new RangeError("requested too many random bytes");var r=c.allocUnsafe(e);if(e>0)if(e>n)for(var d=0;d=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),c=t;c=49?s-49+10:s>=17?s-17+10:s}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,c=o%a,s=Math.min(o,o-c)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],o=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],c=n*o,s=67108863&c,d=c/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(c=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&c}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,s=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=c[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,c,s="le"===t,d=new e(n),u=this.clone();if(s){for(c=0;!u.isZero();c++)o=u.andln(255),u.iushrn(8),d[c]=o;for(;c=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,c=0;c>26,this.words[c]=67108863&t;for(;0!==o&&c>26,this.words[c]=67108863&t;if(0===o&&c>>13,g=0|c[1],p=8191&g,B=g>>>13,m=0|c[2],I=8191&m,y=m>>>13,x=0|c[3],C=8191&x,v=x>>>13,Q=0|c[4],w=8191&Q,_=Q>>>13,k=0|c[5],N=8191&k,D=k>>>13,U=0|c[6],G=8191&U,T=U>>>13,L=0|c[7],q=8191&L,P=L>>>13,O=0|c[8],H=8191&O,Y=O>>>13,J=0|c[9],j=8191&J,z=J>>>13,W=0|s[0],V=8191&W,X=W>>>13,$=0|s[1],et=8191&$,tt=$>>>13,rt=0|s[2],at=8191&rt,it=rt>>>13,nt=0|s[3],ot=8191&nt,At=nt>>>13,ct=0|s[4],st=8191&ct,dt=ct>>>13,ut=0|s[5],ht=8191&ut,bt=ut>>>13,pt=0|s[6],Bt=8191&pt,mt=pt>>>13,It=0|s[7],Et=8191&It,yt=It>>>13,xt=0|s[8],Ct=8191&xt,vt=xt>>>13,Qt=0|s[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(C,V),n=(n=Math.imul(C,X))+Math.imul(v,V)|0,o=Math.imul(v,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(C,et)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(v,et)|0,o=o+Math.imul(v,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,st)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(C,at)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(v,at)|0,o=o+Math.imul(v,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,st)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,st)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,At)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,At)|0,a=a+Math.imul(I,st)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,st)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(q,V),n=(n=Math.imul(q,X))+Math.imul(P,V)|0,o=Math.imul(P,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(C,st)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(v,st)|0,o=o+Math.imul(v,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(q,et)|0,n=(n=n+Math.imul(q,tt)|0)+Math.imul(P,et)|0,o=o+Math.imul(P,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,st)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,st)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,bt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,Ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,vt)|0)+Math.imul(b,Ct)|0))<<13)|0;u=((o=o+Math.imul(b,vt)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(j,V),n=(n=Math.imul(j,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(q,at)|0,n=(n=n+Math.imul(q,it)|0)+Math.imul(P,at)|0,o=o+Math.imul(P,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,st)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,st)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(C,Bt)|0,n=(n=n+Math.imul(C,mt)|0)+Math.imul(v,Bt)|0,o=o+Math.imul(v,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,Ct)|0,n=(n=n+Math.imul(p,vt)|0)+Math.imul(B,Ct)|0,o=o+Math.imul(B,vt)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(j,et),n=(n=Math.imul(j,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(q,ot)|0,n=(n=n+Math.imul(q,At)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,At)|0,a=a+Math.imul(G,st)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,st)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(C,Et)|0,n=(n=n+Math.imul(C,yt)|0)+Math.imul(v,Et)|0,o=o+Math.imul(v,yt)|0,a=a+Math.imul(I,Ct)|0,n=(n=n+Math.imul(I,vt)|0)+Math.imul(y,Ct)|0,o=o+Math.imul(y,vt)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(j,at),n=(n=Math.imul(j,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(q,st)|0,n=(n=n+Math.imul(q,dt)|0)+Math.imul(P,st)|0,o=o+Math.imul(P,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(C,Ct)|0,n=(n=n+Math.imul(C,vt)|0)+Math.imul(v,Ct)|0,o=o+Math.imul(v,vt)|0;var qt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(j,ot),n=(n=Math.imul(j,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,st)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,st)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(q,ht)|0,n=(n=n+Math.imul(q,bt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,Ct)|0,n=(n=n+Math.imul(w,vt)|0)+Math.imul(_,Ct)|0,o=o+Math.imul(_,vt)|0;var Pt=(u+(a=a+Math.imul(C,wt)|0)|0)+((8191&(n=(n=n+Math.imul(C,Mt)|0)+Math.imul(v,wt)|0))<<13)|0;u=((o=o+Math.imul(v,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(j,st),n=(n=Math.imul(j,dt))+Math.imul(z,st)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(q,Bt)|0,n=(n=n+Math.imul(q,mt)|0)+Math.imul(P,Bt)|0,o=o+Math.imul(P,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,Ct)|0,n=(n=n+Math.imul(N,vt)|0)+Math.imul(D,Ct)|0,o=o+Math.imul(D,vt)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(j,ht),n=(n=Math.imul(j,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(q,Et)|0,n=(n=n+Math.imul(q,yt)|0)+Math.imul(P,Et)|0,o=o+Math.imul(P,yt)|0,a=a+Math.imul(G,Ct)|0,n=(n=n+Math.imul(G,vt)|0)+Math.imul(T,Ct)|0,o=o+Math.imul(T,vt)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(j,Bt),n=(n=Math.imul(j,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(q,Ct)|0,n=(n=n+Math.imul(q,vt)|0)+Math.imul(P,Ct)|0,o=o+Math.imul(P,vt)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(j,Et),n=(n=Math.imul(j,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,Ct)|0,n=(n=n+Math.imul(H,vt)|0)+Math.imul(Y,Ct)|0,o=o+Math.imul(Y,vt)|0;var Jt=(u+(a=a+Math.imul(q,wt)|0)|0)+((8191&(n=(n=n+Math.imul(q,Mt)|0)+Math.imul(P,wt)|0))<<13)|0;u=((o=o+Math.imul(P,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(j,Ct),n=(n=Math.imul(j,vt))+Math.imul(z,Ct)|0,o=Math.imul(z,vt);var Kt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863;var jt=(u+(a=Math.imul(j,wt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=qt,d[12]=Pt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=Jt,d[17]=Kt,d[18]=jt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(s=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?s(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,c&=67108863}r.words[o]=s,a=c,c=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var c=0;c>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),c=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&c}return s&&0!==u&&(s.words[s.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(s/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===c)return this.strip();for(assert(-1===c),c=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var c,s=a.length-n.length;if("mod"!==t){(c=new BN(null)).length=s+1,c.words=new Array(c.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);c&&(c.words[h]=l)}return c&&c.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:c||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),c=new BN(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(d),c.isub(u)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(c)):(r.isub(t),o.isub(a),c.isub(n))}return{a:o,b:c,gcd:r.iushln(s)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var s=0,d=1;0==(t.words[0]&d)&&s<26;++s,d<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(c),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,c&=67108863,this.words[o]=c}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=c}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),c=o.redNeg(),s=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,s).cmp(c);)d.redIAdd(c);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=s-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++c||0===a&&0===u)&&(n=this.mul(n,r[o]),c=0,o=0)):c=0}s=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},e=>{e.exports=function isHexPrefixed(e){if("string"!=typeof e)throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof e+", while checking isHexPrefixed.");return"0x"===e.slice(0,2)}},(e,t,r)=>{e.exports=r(933)(r(936))},(e,t,r)=>{"use strict";var a=r(15),n=r(546),o=r(22).Buffer,c=new Array(16);function MD5(){n.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function rotl(e,t){return e<>>32-t}function fnF(e,t,r,a,n,o,c){return rotl(e+(t&r|~t&a)+n+o|0,c)+t|0}function fnG(e,t,r,a,n,o,c){return rotl(e+(t&a|r&~a)+n+o|0,c)+t|0}function fnH(e,t,r,a,n,o,c){return rotl(e+(t^r^a)+n+o|0,c)+t|0}function fnI(e,t,r,a,n,o,c){return rotl(e+(r^(t|~a))+n+o|0,c)+t|0}a(MD5,n),MD5.prototype._update=function(){for(var e=c,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,a=this._b,n=this._c,o=this._d;r=fnF(r,a,n,o,e[0],3614090360,7),o=fnF(o,r,a,n,e[1],3905402710,12),n=fnF(n,o,r,a,e[2],606105819,17),a=fnF(a,n,o,r,e[3],3250441966,22),r=fnF(r,a,n,o,e[4],4118548399,7),o=fnF(o,r,a,n,e[5],1200080426,12),n=fnF(n,o,r,a,e[6],2821735955,17),a=fnF(a,n,o,r,e[7],4249261313,22),r=fnF(r,a,n,o,e[8],1770035416,7),o=fnF(o,r,a,n,e[9],2336552879,12),n=fnF(n,o,r,a,e[10],4294925233,17),a=fnF(a,n,o,r,e[11],2304563134,22),r=fnF(r,a,n,o,e[12],1804603682,7),o=fnF(o,r,a,n,e[13],4254626195,12),n=fnF(n,o,r,a,e[14],2792965006,17),r=fnG(r,a=fnF(a,n,o,r,e[15],1236535329,22),n,o,e[1],4129170786,5),o=fnG(o,r,a,n,e[6],3225465664,9),n=fnG(n,o,r,a,e[11],643717713,14),a=fnG(a,n,o,r,e[0],3921069994,20),r=fnG(r,a,n,o,e[5],3593408605,5),o=fnG(o,r,a,n,e[10],38016083,9),n=fnG(n,o,r,a,e[15],3634488961,14),a=fnG(a,n,o,r,e[4],3889429448,20),r=fnG(r,a,n,o,e[9],568446438,5),o=fnG(o,r,a,n,e[14],3275163606,9),n=fnG(n,o,r,a,e[3],4107603335,14),a=fnG(a,n,o,r,e[8],1163531501,20),r=fnG(r,a,n,o,e[13],2850285829,5),o=fnG(o,r,a,n,e[2],4243563512,9),n=fnG(n,o,r,a,e[7],1735328473,14),r=fnH(r,a=fnG(a,n,o,r,e[12],2368359562,20),n,o,e[5],4294588738,4),o=fnH(o,r,a,n,e[8],2272392833,11),n=fnH(n,o,r,a,e[11],1839030562,16),a=fnH(a,n,o,r,e[14],4259657740,23),r=fnH(r,a,n,o,e[1],2763975236,4),o=fnH(o,r,a,n,e[4],1272893353,11),n=fnH(n,o,r,a,e[7],4139469664,16),a=fnH(a,n,o,r,e[10],3200236656,23),r=fnH(r,a,n,o,e[13],681279174,4),o=fnH(o,r,a,n,e[0],3936430074,11),n=fnH(n,o,r,a,e[3],3572445317,16),a=fnH(a,n,o,r,e[6],76029189,23),r=fnH(r,a,n,o,e[9],3654602809,4),o=fnH(o,r,a,n,e[12],3873151461,11),n=fnH(n,o,r,a,e[15],530742520,16),r=fnI(r,a=fnH(a,n,o,r,e[2],3299628645,23),n,o,e[0],4096336452,6),o=fnI(o,r,a,n,e[7],1126891415,10),n=fnI(n,o,r,a,e[14],2878612391,15),a=fnI(a,n,o,r,e[5],4237533241,21),r=fnI(r,a,n,o,e[12],1700485571,6),o=fnI(o,r,a,n,e[3],2399980690,10),n=fnI(n,o,r,a,e[10],4293915773,15),a=fnI(a,n,o,r,e[1],2240044497,21),r=fnI(r,a,n,o,e[8],1873313359,6),o=fnI(o,r,a,n,e[15],4264355552,10),n=fnI(n,o,r,a,e[6],2734768916,15),a=fnI(a,n,o,r,e[13],1309151649,21),r=fnI(r,a,n,o,e[4],4149444226,6),o=fnI(o,r,a,n,e[11],3174756917,10),n=fnI(n,o,r,a,e[2],718787259,15),a=fnI(a,n,o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+a|0,this._c=this._c+n|0,this._d=this._d+o|0},MD5.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=o.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=MD5},(e,t,r)=>{"use strict";var a=r(22).Buffer,n=r(245).Transform;function HashBase(e){n.call(this),this._block=a.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(15)(HashBase,n),HashBase.prototype._transform=function(e,t,r){var a=null;try{this.update(e,t)}catch(e){a=e}r(a)},HashBase.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},HashBase.prototype.update=function(e,t){if(function throwIfNotStringOrBuffer(e,t){if(!a.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");a.isBuffer(e)||(e=a.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var o=this._blockOffset;o0;++c)this._length[c]+=s,(s=this._length[c]/4294967296|0)>0&&(this._length[c]-=4294967296*s);return this},HashBase.prototype._update=function(){throw new Error("_update is not implemented")},HashBase.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},HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=HashBase},(e,t,r)=>{"use strict";var a,n=r(1);e.exports=Readable,Readable.ReadableState=ReadableState;r(34).EventEmitter;var o=function EElistenerCount(e,t){return e.listeners(t).length},c=r(937),s=r(0).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(89);u=h&&h.debuglog?h.debuglog("stream"):function debug(){};var l,b,g,p=r(938),B=r(548),m=r(549).getHighWaterMark,I=r(246).a,y=I.ERR_INVALID_ARG_TYPE,x=I.ERR_STREAM_PUSH_AFTER_EOF,C=I.ERR_METHOD_NOT_IMPLEMENTED,v=I.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(15)(Readable,c);var Q=B.errorOrDestroy,w=["error","close","destroy","pause","resume"];function ReadableState(e,t,n){a=a||r(195),e=e||{},"boolean"!=typeof n&&(n=t instanceof a),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(this,e,"readableHighWaterMark",n),this.buffer=new p,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.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(l||(l=r(551).a),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function Readable(e){if(a=a||r(195),!(this instanceof Readable))return new Readable(e);var t=this instanceof a;this._readableState=new ReadableState(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),c.call(this)}function readableAddChunk(e,t,r,a,n){u("readableAddChunk",t);var o,c=e._readableState;if(null===t)c.reading=!1,function onEofChunk(e,t){if(u("onEofChunk"),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,t.sync?emitReadable(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,emitReadable_(e)))}(e,c);else if(n||(o=function chunkInvalid(e,t){var r;(function _isUint8Array(e){return s.isBuffer(e)||e instanceof d})(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],t));return r}(c,t)),o)Q(e,o);else if(c.objectMode||t&&t.length>0)if("string"==typeof t||c.objectMode||Object.getPrototypeOf(t)===s.prototype||(t=function _uint8ArrayToBuffer(e){return s.from(e)}(t)),a)c.endEmitted?Q(e,new v):addChunk(e,c,t,!0);else if(c.ended)Q(e,new x);else{if(c.destroyed)return!1;c.reading=!1,c.decoder&&!r?(t=c.decoder.write(t),c.objectMode||0!==t.length?addChunk(e,c,t,!1):maybeReadMore(e,c)):addChunk(e,c,t,!1)}else a||(c.reading=!1,maybeReadMore(e,c));return!c.ended&&(c.lengtht.highWaterMark&&(t.highWaterMark=function computeNewHighWaterMark(e){return e>=_?e=_:(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 emitReadable(e){var t=e._readableState;u("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(u("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(emitReadable_,e))}function emitReadable_(e){var t=e._readableState;u("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,flow(e)}function maybeReadMore(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(maybeReadMore_,e,t))}function maybeReadMore_(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function nReadingNextTick(e){u("readable nexttick read 0"),e.read(0)}function resume_(e,t){u("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),flow(e),t.flowing&&!t.reading&&e.read(0)}function flow(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function fromList(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 endReadable(e){var t=e._readableState;u("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(endReadableNT,t,e))}function endReadableNT(e,t){if(u("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 indexOf(e,t){for(var r=0,a=e.length;r=t.highWaterMark:t.length>0)||t.ended))return u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?endReadable(this):emitReadable(this),null;if(0===(e=howMuchToRead(e,t))&&t.ended)return 0===t.length&&endReadable(this),null;var a,n=t.needReadable;return u("need readable",n),(0===t.length||t.length-e0?fromList(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&&endReadable(this)),null!==a&&this.emit("data",a),a},Readable.prototype._read=function(e){Q(this,new C("_read()"))},Readable.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,u("pipe count=%d opts=%j",a.pipesCount,t);var c=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?onend:unpipe;function onunpipe(t,n){u("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,function cleanup(){u("cleanup"),e.removeListener("close",onclose),e.removeListener("finish",onfinish),e.removeListener("drain",s),e.removeListener("error",onerror),e.removeListener("unpipe",onunpipe),r.removeListener("end",onend),r.removeListener("end",unpipe),r.removeListener("data",ondata),d=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}())}function onend(){u("onend"),e.end()}a.endEmitted?n.nextTick(c):r.once("end",c),e.on("unpipe",onunpipe);var s=function pipeOnDrain(e){return function pipeOnDrainFunctionResult(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,flow(e))}}(r);e.on("drain",s);var d=!1;function ondata(t){u("ondata");var n=e.write(t);u("dest.write",n),!1===n&&((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==indexOf(a.pipes,e))&&!d&&(u("false write response, pause",a.awaitDrain),a.awaitDrain++),r.pause())}function onerror(t){u("onerror",t),unpipe(),e.removeListener("error",onerror),0===o(e,"error")&&Q(e,t)}function onclose(){e.removeListener("finish",onfinish),unpipe()}function onfinish(){u("onfinish"),e.removeListener("close",onclose),unpipe()}function unpipe(){u("unpipe"),r.unpipe(e)}return r.on("data",ondata),function prependListener(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",onerror),e.once("close",onclose),e.once("finish",onfinish),e.emit("pipe",r),a.flowing||(u("pipe resume"),r.resume()),e},Readable.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 a=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==a.flowing&&this.resume()):"readable"===e&&(a.endEmitted||a.readableListening||(a.readableListening=a.needReadable=!0,a.flowing=!1,a.emittedReadable=!1,u("on readable",a.length,a.reading),a.length?emitReadable(this):a.reading||n.nextTick(nReadingNextTick,this))),r},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.removeListener=function(e,t){var r=c.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(updateReadableListening,this),r},Readable.prototype.removeAllListeners=function(e){var t=c.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(updateReadableListening,this),t},Readable.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!e.readableListening,function resume(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(resume_,e,t))}(this,e)),e.paused=!1,this},Readable.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},Readable.prototype.wrap=function(e){var t=this,r=this._readableState,a=!1;for(var n in e.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(n){(u("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(a=!0,e.pause()))})),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function methodWrap(t){return function methodWrapReturnFunction(){return e[t].apply(e,arguments)}}(n));for(var o=0;o{"use strict";var a=r(1);function emitErrorAndCloseNT(e,t){emitErrorNT(e,t),emitCloseNT(e)}function emitCloseNT(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function emitErrorNT(e,t){e.emit("error",t)}e.exports={destroy:function destroy(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return n||o?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,a.nextTick(emitErrorNT,this,e)):a.nextTick(emitErrorNT,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?r._writableState?r._writableState.errorEmitted?a.nextTick(emitCloseNT,r):(r._writableState.errorEmitted=!0,a.nextTick(emitErrorAndCloseNT,r,e)):a.nextTick(emitErrorAndCloseNT,r,e):t?(a.nextTick(emitCloseNT,r),t(e)):a.nextTick(emitCloseNT,r)})),this)},undestroy:function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function errorOrDestroy(e,t){var r=e._readableState,a=e._writableState;r&&r.autoDestroy||a&&a.autoDestroy?e.destroy(t):e.emit("error",t)}}},(e,t,r)=>{"use strict";var a=r(246).a.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function getHighWaterMark(e,t,r,n){var o=function highWaterMarkFrom(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new a(n?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},(e,t,r)=>{"use strict";var a,n=r(1);function CorkedRequest(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function onCorkedFinish(e,t,r){var a=e.entry;e.entry=null;for(;a;){var n=a.callback;t.pendingcb--,n(r),a=a.next}t.corkedRequestsFree.next=e}(t,e)}}e.exports=Writable,Writable.WritableState=WritableState;var o={deprecate:r(939)},c=r(937),s=r(0).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(548),l=r(549).getHighWaterMark,b=r(246).a,g=b.ERR_INVALID_ARG_TYPE,p=b.ERR_METHOD_NOT_IMPLEMENTED,B=b.ERR_MULTIPLE_CALLBACK,m=b.ERR_STREAM_CANNOT_PIPE,I=b.ERR_STREAM_DESTROYED,y=b.ERR_STREAM_NULL_VALUES,x=b.ERR_STREAM_WRITE_AFTER_END,C=b.ERR_UNKNOWN_ENCODING,v=h.errorOrDestroy;function nop(){}function WritableState(e,t,o){a=a||r(195),e=e||{},"boolean"!=typeof o&&(o=t instanceof a),this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=l(this,e,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,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 onwrite(e,t){var r=e._writableState,a=r.sync,o=r.writecb;if("function"!=typeof o)throw new B;if(function onwriteStateUpdate(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function onwriteError(e,t,r,a,o){--t.pendingcb,r?(n.nextTick(o,a),n.nextTick(finishMaybe,e,t),e._writableState.errorEmitted=!0,v(e,a)):(o(a),e._writableState.errorEmitted=!0,v(e,a),finishMaybe(e,t))}(e,r,a,t,o);else{var c=needFinish(r)||e.destroyed;c||r.corked||r.bufferProcessing||!r.bufferedRequest||clearBuffer(e,r),a?n.nextTick(afterWrite,e,r,c,o):afterWrite(e,r,c,o)}}(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 CorkedRequest(this)}function Writable(e){var t=this instanceof(a=a||r(195));if(!t&&!u.call(Writable,this))return new Writable(e);this._writableState=new WritableState(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)),c.call(this)}function doWrite(e,t,r,a,n,o,c){t.writelen=a,t.writecb=c,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new I("write")):r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}function afterWrite(e,t,r,a){r||function onwriteDrain(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,a(),finishMaybe(e,t)}function clearBuffer(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var a=t.bufferedRequestCount,n=new Array(a),o=t.corkedRequestsFree;o.entry=r;for(var c=0,s=!0;r;)n[c]=r,r.isBuf||(s=!1),r=r.next,c+=1;n.allBuffers=s,doWrite(e,t,!0,t.length,n,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new CorkedRequest(t),t.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,u=r.encoding,h=r.callback;if(doWrite(e,t,!1,t.objectMode?1:d.length,d,u,h),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function needFinish(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function callFinal(e,t){e._final((function(r){t.pendingcb--,r&&v(e,r),t.prefinished=!0,e.emit("prefinish"),finishMaybe(e,t)}))}function finishMaybe(e,t){var r=needFinish(t);if(r&&(function prefinish(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,n.nextTick(callFinal,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var a=e._readableState;(!a||a.autoDestroy&&a.endEmitted)&&e.destroy()}return r}r(15)(Writable,c),WritableState.prototype.getBuffer=function getBuffer(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:o.deprecate((function writableStateBufferGetter(){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]?(u=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function value(e){return!!u.call(this,e)||this===Writable&&(e&&e._writableState instanceof WritableState)}})):u=function realHasInstance(e){return e instanceof this},Writable.prototype.pipe=function(){v(this,new m)},Writable.prototype.write=function(e,t,r){var a=this._writableState,o=!1,c=!a.objectMode&&function _isUint8Array(e){return s.isBuffer(e)||e instanceof d}(e);return c&&!s.isBuffer(e)&&(e=function _uint8ArrayToBuffer(e){return s.from(e)}(e)),"function"==typeof t&&(r=t,t=null),c?t="buffer":t||(t=a.defaultEncoding),"function"!=typeof r&&(r=nop),a.ending?function writeAfterEnd(e,t){var r=new x;v(e,r),n.nextTick(t,r)}(this,r):(c||function validChunk(e,t,r,a){var o;return null===r?o=new y:"string"==typeof r||t.objectMode||(o=new g("chunk",["string","Buffer"],r)),!o||(v(e,o),n.nextTick(a,o),!1)}(this,a,e,r))&&(a.pendingcb++,o=function writeOrBuffer(e,t,r,a,n,o){if(!r){var c=function decodeChunk(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=s.from(t,r));return t}(t,a,n);a!==c&&(r=!0,n="buffer",a=c)}var d=t.objectMode?1:a.length;t.length+=d;var u=t.length-1))throw new C(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:!1,get:function get(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function get(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(e,t,r){r(new p("_write()"))},Writable.prototype._writev=null,Writable.prototype.end=function(e,t,r){var a=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),a.corked&&(a.corked=1,this.uncork()),a.ending||function endWritable(e,t,r){t.ending=!0,finishMaybe(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,a,r),this},Object.defineProperty(Writable.prototype,"writableLength",{enumerable:!1,get:function get(){return this._writableState.length}}),Object.defineProperty(Writable.prototype,"destroyed",{enumerable:!1,get:function get(){return void 0!==this._writableState&&this._writableState.destroyed},set:function set(e){this._writableState&&(this._writableState.destroyed=e)}}),Writable.prototype.destroy=h.destroy,Writable.prototype._undestroy=h.undestroy,Writable.prototype._destroy=function(e,t){t(e)}},(e,t,r)=>{"use strict";var a=r(22).Buffer,n=a.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function StringDecoder(e){var t;switch(this.encoding=function normalizeEncoding(e){var t=function _normalizeEncoding(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&&(a.isEncoding===n||!n(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,t=4;break;case"utf8":this.fillLast=utf8FillLast,t=4;break;case"base64":this.text=base64Text,this.end=base64End,t=3;break;default:return this.write=simpleWrite,void(this.end=simpleEnd)}this.lastNeed=0,this.lastTotal=0,this.lastChar=a.allocUnsafe(t)}function utf8CheckByte(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function utf8FillLast(e){var t=this.lastTotal-this.lastNeed,r=function utf8CheckExtraBytes(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 utf16Text(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var a=r.charCodeAt(r.length-1);if(a>=55296&&a<=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 utf16End(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 base64Text(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 base64End(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function simpleWrite(e){return e.toString(this.encoding)}function simpleEnd(e){return e&&e.length?this.write(e):""}t.a=StringDecoder,StringDecoder.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 n>0&&(e.lastNeed=n-1),n;if(--a=0)return n>0&&(e.lastNeed=n-2),n;if(--a=0)return n>0&&(2===n?n=0:e.lastNeed=n-3),n;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var a=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,a),e.toString("utf8",t,a)},StringDecoder.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}},(e,t,r)=>{"use strict";e.exports=Transform;var a=r(246).a,n=a.ERR_METHOD_NOT_IMPLEMENTED,o=a.ERR_MULTIPLE_CALLBACK,c=a.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=a.ERR_TRANSFORM_WITH_LENGTH_0,d=r(195);function afterTransform(e,t){var r=this._transformState;r.transforming=!1;var a=r.writecb;if(null===a)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),a(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length{"use strict";var a=r(0).Buffer,n=r(15),o=r(546),c=new Array(16),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],d=[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],u=[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],h=[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],l=[0,1518500249,1859775393,2400959708,2840853838],b=[1352829926,1548603684,1836072691,2053994217,0];function RIPEMD160(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function rotl(e,t){return e<>>32-t}function fn1(e,t,r,a,n,o,c,s){return rotl(e+(t^r^a)+o+c|0,s)+n|0}function fn2(e,t,r,a,n,o,c,s){return rotl(e+(t&r|~t&a)+o+c|0,s)+n|0}function fn3(e,t,r,a,n,o,c,s){return rotl(e+((t|~r)^a)+o+c|0,s)+n|0}function fn4(e,t,r,a,n,o,c,s){return rotl(e+(t&a|r&~a)+o+c|0,s)+n|0}function fn5(e,t,r,a,n,o,c,s){return rotl(e+(t^(r|~a))+o+c|0,s)+n|0}n(RIPEMD160,o),RIPEMD160.prototype._update=function(){for(var e=c,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,a=0|this._b,n=0|this._c,o=0|this._d,g=0|this._e,p=0|this._a,B=0|this._b,m=0|this._c,I=0|this._d,y=0|this._e,x=0;x<80;x+=1){var C,v;x<16?(C=fn1(r,a,n,o,g,e[s[x]],l[0],u[x]),v=fn5(p,B,m,I,y,e[d[x]],b[0],h[x])):x<32?(C=fn2(r,a,n,o,g,e[s[x]],l[1],u[x]),v=fn4(p,B,m,I,y,e[d[x]],b[1],h[x])):x<48?(C=fn3(r,a,n,o,g,e[s[x]],l[2],u[x]),v=fn3(p,B,m,I,y,e[d[x]],b[2],h[x])):x<64?(C=fn4(r,a,n,o,g,e[s[x]],l[3],u[x]),v=fn2(p,B,m,I,y,e[d[x]],b[3],h[x])):(C=fn5(r,a,n,o,g,e[s[x]],l[4],u[x]),v=fn1(p,B,m,I,y,e[d[x]],b[4],h[x])),r=g,g=o,o=rotl(n,10),n=a,a=C,p=y,y=I,I=rotl(m,10),m=B,B=v}var Q=this._b+n+I|0;this._b=this._c+o+y|0,this._c=this._d+g+p|0,this._d=this._e+r+B|0,this._e=this._a+a+m|0,this._a=Q},RIPEMD160.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=a.alloc?a.alloc(20):new a(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},e.exports=RIPEMD160},(e,t,r)=>{var a=e.exports=function SHA(e){e=e.toLowerCase();var t=a[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};a.sha=r(944),a.sha1=r(945),a.sha224=r(946),a.sha256=r(555),a.sha384=r(947),a.sha512=r(556)},(e,t,r)=>{var a=r(15),n=r(196),o=r(22).Buffer,c=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function Sha256(){this.init(),this._w=s,n.call(this,64,56)}function ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function sigma1(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function gamma0(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}a(Sha256,n),Sha256.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},Sha256.prototype._update=function(e){for(var t,r=this._w,a=0|this._a,n=0|this._b,o=0|this._c,s=0|this._d,d=0|this._e,u=0|this._f,h=0|this._g,l=0|this._h,b=0;b<16;++b)r[b]=e.readInt32BE(4*b);for(;b<64;++b)r[b]=0|(((t=r[b-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[b-7]+gamma0(r[b-15])+r[b-16];for(var g=0;g<64;++g){var p=l+sigma1(d)+ch(d,u,h)+c[g]+r[g]|0,B=sigma0(a)+maj(a,n,o)|0;l=h,h=u,u=d,d=s+p|0,s=o,o=n,n=a,a=p+B|0}this._a=a+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=d+this._e|0,this._f=u+this._f|0,this._g=h+this._g|0,this._h=l+this._h|0},Sha256.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=Sha256},(e,t,r)=>{var a=r(15),n=r(196),o=r(22).Buffer,c=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],s=new Array(160);function Sha512(){this.init(),this._w=s,n.call(this,128,112)}function Ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function sigma1(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Gamma0(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Gamma0l(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function Gamma1(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Gamma1l(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function getCarry(e,t){return e>>>0>>0?1:0}a(Sha512,n),Sha512.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},Sha512.prototype._update=function(e){for(var t=this._w,r=0|this._ah,a=0|this._bh,n=0|this._ch,o=0|this._dh,s=0|this._eh,d=0|this._fh,u=0|this._gh,h=0|this._hh,l=0|this._al,b=0|this._bl,g=0|this._cl,p=0|this._dl,B=0|this._el,m=0|this._fl,I=0|this._gl,y=0|this._hl,x=0;x<32;x+=2)t[x]=e.readInt32BE(4*x),t[x+1]=e.readInt32BE(4*x+4);for(;x<160;x+=2){var C=t[x-30],v=t[x-30+1],Q=Gamma0(C,v),w=Gamma0l(v,C),_=Gamma1(C=t[x-4],v=t[x-4+1]),k=Gamma1l(v,C),N=t[x-14],D=t[x-14+1],U=t[x-32],G=t[x-32+1],T=w+D|0,L=Q+N+getCarry(T,w)|0;L=(L=L+_+getCarry(T=T+k|0,k)|0)+U+getCarry(T=T+G|0,G)|0,t[x]=L,t[x+1]=T}for(var q=0;q<160;q+=2){L=t[q],T=t[q+1];var P=maj(r,a,n),O=maj(l,b,g),H=sigma0(r,l),Y=sigma0(l,r),J=sigma1(s,B),j=sigma1(B,s),z=c[q],W=c[q+1],V=Ch(s,d,u),X=Ch(B,m,I),$=y+j|0,et=h+J+getCarry($,y)|0;et=(et=(et=et+V+getCarry($=$+X|0,X)|0)+z+getCarry($=$+W|0,W)|0)+L+getCarry($=$+T|0,T)|0;var tt=Y+O|0,rt=H+P+getCarry(tt,Y)|0;h=u,y=I,u=d,I=m,d=s,m=B,s=o+et+getCarry(B=p+$|0,p)|0,o=n,p=g,n=a,g=b,a=r,b=l,r=et+rt+getCarry(l=$+tt|0,$)|0}this._al=this._al+l|0,this._bl=this._bl+b|0,this._cl=this._cl+g|0,this._dl=this._dl+p|0,this._el=this._el+B|0,this._fl=this._fl+m|0,this._gl=this._gl+I|0,this._hl=this._hl+y|0,this._ah=this._ah+r+getCarry(this._al,l)|0,this._bh=this._bh+a+getCarry(this._bl,b)|0,this._ch=this._ch+n+getCarry(this._cl,g)|0,this._dh=this._dh+o+getCarry(this._dl,p)|0,this._eh=this._eh+s+getCarry(this._el,B)|0,this._fh=this._fh+d+getCarry(this._fl,m)|0,this._gh=this._gh+u+getCarry(this._gl,I)|0,this._hh=this._hh+h+getCarry(this._hl,y)|0},Sha512.prototype._hash=function(){var e=o.allocUnsafe(64);function writeInt64BE(t,r,a){e.writeInt32BE(t,a),e.writeInt32BE(r,a+4)}return writeInt64BE(this._ah,this._al,0),writeInt64BE(this._bh,this._bl,8),writeInt64BE(this._ch,this._cl,16),writeInt64BE(this._dh,this._dl,24),writeInt64BE(this._eh,this._el,32),writeInt64BE(this._fh,this._fl,40),writeInt64BE(this._gh,this._gl,48),writeInt64BE(this._hh,this._hl,56),e},e.exports=Sha512},(e,t)=>{"use strict";var r=t;function zero2(e){return 1===e.length?"0"+e:e}function toHex(e){for(var t="",r=0;r>8,c=255&n;o?r.push(o,c):r.push(c)}return r},r.zero2=zero2,r.toHex=toHex,r.encode=function encode(e,t){return"hex"===t?toHex(e):e}},(e,t,r)=>{"use strict";var a=t;a.base=r(286),a.short=r(951),a.mont=r(952),a.edwards=r(953)},(e,t,r)=>{"use strict";var a=r(118),n=r(287),o=r(955),c=r(164),s=a.sum32,d=a.sum32_4,u=a.sum32_5,h=o.ch32,l=o.maj32,b=o.s0_256,g=o.s1_256,p=o.g0_256,B=o.g1_256,m=n.BlockHash,I=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function SHA256(){if(!(this instanceof SHA256))return new SHA256;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=I,this.W=new Array(64)}a.inherits(SHA256,m),e.exports=SHA256,SHA256.blockSize=512,SHA256.outSize=256,SHA256.hmacStrength=192,SHA256.padLength=64,SHA256.prototype._update=function _update(e,t){for(var r=this.W,a=0;a<16;a++)r[a]=e[t+a];for(;a{"use strict";var a=r(118),n=r(287),o=r(164),c=a.rotr64_hi,s=a.rotr64_lo,d=a.shr64_hi,u=a.shr64_lo,h=a.sum64,l=a.sum64_hi,b=a.sum64_lo,g=a.sum64_4_hi,p=a.sum64_4_lo,B=a.sum64_5_hi,m=a.sum64_5_lo,I=n.BlockHash,y=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function SHA512(){if(!(this instanceof SHA512))return new SHA512;I.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=y,this.W=new Array(160)}function ch64_hi(e,t,r,a,n){var o=e&r^~e&n;return o<0&&(o+=4294967296),o}function ch64_lo(e,t,r,a,n,o){var c=t&a^~t&o;return c<0&&(c+=4294967296),c}function maj64_hi(e,t,r,a,n){var o=e&r^e&n^r&n;return o<0&&(o+=4294967296),o}function maj64_lo(e,t,r,a,n,o){var c=t&a^t&o^a&o;return c<0&&(c+=4294967296),c}function s0_512_hi(e,t){var r=c(e,t,28)^c(t,e,2)^c(t,e,7);return r<0&&(r+=4294967296),r}function s0_512_lo(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function s1_512_hi(e,t){var r=c(e,t,14)^c(e,t,18)^c(t,e,9);return r<0&&(r+=4294967296),r}function s1_512_lo(e,t){var r=s(e,t,14)^s(e,t,18)^s(t,e,9);return r<0&&(r+=4294967296),r}function g0_512_hi(e,t){var r=c(e,t,1)^c(e,t,8)^d(e,t,7);return r<0&&(r+=4294967296),r}function g0_512_lo(e,t){var r=s(e,t,1)^s(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function g1_512_hi(e,t){var r=c(e,t,19)^c(t,e,29)^d(e,t,6);return r<0&&(r+=4294967296),r}function g1_512_lo(e,t){var r=s(e,t,19)^s(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}a.inherits(SHA512,I),e.exports=SHA512,SHA512.blockSize=1024,SHA512.outSize=512,SHA512.hmacStrength=192,SHA512.padLength=128,SHA512.prototype._prepareBlock=function _prepareBlock(e,t){for(var r=this.W,a=0;a<32;a++)r[a]=e[t+a];for(;a0&&(d=n-s-16),c.padding="0".repeat(d),encrypt(e,{data:JSON.stringify(c)},r)},t.decrypt=decrypt,t.decryptSafely=function decryptSafely(e,t){return JSON.parse(decrypt(e,t)).data},t.getEncryptionPublicKey=function getEncryptionPublicKey(e){var t=nacl_decodeHex(e),r=s.box.keyPair.fromSecretKey(t).publicKey;return d.encodeBase64(r)},t.signTypedMessage=function signTypedMessage(e,t,r){switch(void 0===r&&(r="V4"),r){case"V1":return signTypedDataLegacy(e,t);case"V3":return signTypedData(e,t);case"V4":default:return signTypedData_v4(e,t)}},t.recoverTypedMessage=function recoverTypedMessage(e,t){switch(void 0===t&&(t="V4"),t){case"V1":return recoverTypedSignatureLegacy(e);case"V3":return recoverTypedSignature(e);case"V4":default:return recoverTypedSignature_v4(e)}},t.signTypedData=signTypedData,t.signTypedData_v4=signTypedData_v4,t.recoverTypedSignature=recoverTypedSignature,t.recoverTypedSignature_v4=recoverTypedSignature_v4},(e,t,r)=>{!function(e){"use strict";var gf=function(e){var t,r=new Float64Array(16);if(e)for(t=0;t>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r,e[t+4]=a>>24&255,e[t+5]=a>>16&255,e[t+6]=a>>8&255,e[t+7]=255&a}function vn(e,t,r,a,n){var o,c=0;for(o=0;o>>8)-1}function crypto_verify_16(e,t,r,a){return vn(e,t,r,a,16)}function crypto_verify_32(e,t,r,a){return vn(e,t,r,a,32)}function crypto_core_salsa20(e,t,r,a){!function core_salsa20(e,t,r,a){for(var n,o=255&a[0]|(255&a[1])<<8|(255&a[2])<<16|(255&a[3])<<24,c=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,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,h=255&a[4]|(255&a[5])<<8|(255&a[6])<<16|(255&a[7])<<24,l=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,b=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,g=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,B=255&a[8]|(255&a[9])<<8|(255&a[10])<<16|(255&a[11])<<24,m=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,I=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,y=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,x=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,C=255&a[12]|(255&a[13])<<8|(255&a[14])<<16|(255&a[15])<<24,v=o,Q=c,w=s,_=d,k=u,N=h,D=l,U=b,G=g,T=p,L=B,q=m,P=I,O=y,H=x,Y=C,J=0;J<20;J+=2)v^=(n=(P^=(n=(G^=(n=(k^=(n=v+P|0)<<7|n>>>25)+v|0)<<9|n>>>23)+k|0)<<13|n>>>19)+G|0)<<18|n>>>14,N^=(n=(Q^=(n=(O^=(n=(T^=(n=N+Q|0)<<7|n>>>25)+N|0)<<9|n>>>23)+T|0)<<13|n>>>19)+O|0)<<18|n>>>14,L^=(n=(D^=(n=(w^=(n=(H^=(n=L+D|0)<<7|n>>>25)+L|0)<<9|n>>>23)+H|0)<<13|n>>>19)+w|0)<<18|n>>>14,Y^=(n=(q^=(n=(U^=(n=(_^=(n=Y+q|0)<<7|n>>>25)+Y|0)<<9|n>>>23)+_|0)<<13|n>>>19)+U|0)<<18|n>>>14,v^=(n=(_^=(n=(w^=(n=(Q^=(n=v+_|0)<<7|n>>>25)+v|0)<<9|n>>>23)+Q|0)<<13|n>>>19)+w|0)<<18|n>>>14,N^=(n=(k^=(n=(U^=(n=(D^=(n=N+k|0)<<7|n>>>25)+N|0)<<9|n>>>23)+D|0)<<13|n>>>19)+U|0)<<18|n>>>14,L^=(n=(T^=(n=(G^=(n=(q^=(n=L+T|0)<<7|n>>>25)+L|0)<<9|n>>>23)+q|0)<<13|n>>>19)+G|0)<<18|n>>>14,Y^=(n=(H^=(n=(O^=(n=(P^=(n=Y+H|0)<<7|n>>>25)+Y|0)<<9|n>>>23)+P|0)<<13|n>>>19)+O|0)<<18|n>>>14;v=v+o|0,Q=Q+c|0,w=w+s|0,_=_+d|0,k=k+u|0,N=N+h|0,D=D+l|0,U=U+b|0,G=G+g|0,T=T+p|0,L=L+B|0,q=q+m|0,P=P+I|0,O=O+y|0,H=H+x|0,Y=Y+C|0,e[0]=v>>>0&255,e[1]=v>>>8&255,e[2]=v>>>16&255,e[3]=v>>>24&255,e[4]=Q>>>0&255,e[5]=Q>>>8&255,e[6]=Q>>>16&255,e[7]=Q>>>24&255,e[8]=w>>>0&255,e[9]=w>>>8&255,e[10]=w>>>16&255,e[11]=w>>>24&255,e[12]=_>>>0&255,e[13]=_>>>8&255,e[14]=_>>>16&255,e[15]=_>>>24&255,e[16]=k>>>0&255,e[17]=k>>>8&255,e[18]=k>>>16&255,e[19]=k>>>24&255,e[20]=N>>>0&255,e[21]=N>>>8&255,e[22]=N>>>16&255,e[23]=N>>>24&255,e[24]=D>>>0&255,e[25]=D>>>8&255,e[26]=D>>>16&255,e[27]=D>>>24&255,e[28]=U>>>0&255,e[29]=U>>>8&255,e[30]=U>>>16&255,e[31]=U>>>24&255,e[32]=G>>>0&255,e[33]=G>>>8&255,e[34]=G>>>16&255,e[35]=G>>>24&255,e[36]=T>>>0&255,e[37]=T>>>8&255,e[38]=T>>>16&255,e[39]=T>>>24&255,e[40]=L>>>0&255,e[41]=L>>>8&255,e[42]=L>>>16&255,e[43]=L>>>24&255,e[44]=q>>>0&255,e[45]=q>>>8&255,e[46]=q>>>16&255,e[47]=q>>>24&255,e[48]=P>>>0&255,e[49]=P>>>8&255,e[50]=P>>>16&255,e[51]=P>>>24&255,e[52]=O>>>0&255,e[53]=O>>>8&255,e[54]=O>>>16&255,e[55]=O>>>24&255,e[56]=H>>>0&255,e[57]=H>>>8&255,e[58]=H>>>16&255,e[59]=H>>>24&255,e[60]=Y>>>0&255,e[61]=Y>>>8&255,e[62]=Y>>>16&255,e[63]=Y>>>24&255}(e,t,r,a)}function crypto_core_hsalsa20(e,t,r,a){!function core_hsalsa20(e,t,r,a){for(var n,o=255&a[0]|(255&a[1])<<8|(255&a[2])<<16|(255&a[3])<<24,c=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,d=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,h=255&a[4]|(255&a[5])<<8|(255&a[6])<<16|(255&a[7])<<24,l=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,b=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,g=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,B=255&a[8]|(255&a[9])<<8|(255&a[10])<<16|(255&a[11])<<24,m=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,I=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,y=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,x=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,C=255&a[12]|(255&a[13])<<8|(255&a[14])<<16|(255&a[15])<<24,v=0;v<20;v+=2)o^=(n=(I^=(n=(g^=(n=(u^=(n=o+I|0)<<7|n>>>25)+o|0)<<9|n>>>23)+u|0)<<13|n>>>19)+g|0)<<18|n>>>14,h^=(n=(c^=(n=(y^=(n=(p^=(n=h+c|0)<<7|n>>>25)+h|0)<<9|n>>>23)+p|0)<<13|n>>>19)+y|0)<<18|n>>>14,B^=(n=(l^=(n=(s^=(n=(x^=(n=B+l|0)<<7|n>>>25)+B|0)<<9|n>>>23)+x|0)<<13|n>>>19)+s|0)<<18|n>>>14,C^=(n=(m^=(n=(b^=(n=(d^=(n=C+m|0)<<7|n>>>25)+C|0)<<9|n>>>23)+d|0)<<13|n>>>19)+b|0)<<18|n>>>14,o^=(n=(d^=(n=(s^=(n=(c^=(n=o+d|0)<<7|n>>>25)+o|0)<<9|n>>>23)+c|0)<<13|n>>>19)+s|0)<<18|n>>>14,h^=(n=(u^=(n=(b^=(n=(l^=(n=h+u|0)<<7|n>>>25)+h|0)<<9|n>>>23)+l|0)<<13|n>>>19)+b|0)<<18|n>>>14,B^=(n=(p^=(n=(g^=(n=(m^=(n=B+p|0)<<7|n>>>25)+B|0)<<9|n>>>23)+m|0)<<13|n>>>19)+g|0)<<18|n>>>14,C^=(n=(x^=(n=(y^=(n=(I^=(n=C+x|0)<<7|n>>>25)+C|0)<<9|n>>>23)+I|0)<<13|n>>>19)+y|0)<<18|n>>>14;e[0]=o>>>0&255,e[1]=o>>>8&255,e[2]=o>>>16&255,e[3]=o>>>24&255,e[4]=h>>>0&255,e[5]=h>>>8&255,e[6]=h>>>16&255,e[7]=h>>>24&255,e[8]=B>>>0&255,e[9]=B>>>8&255,e[10]=B>>>16&255,e[11]=B>>>24&255,e[12]=C>>>0&255,e[13]=C>>>8&255,e[14]=C>>>16&255,e[15]=C>>>24&255,e[16]=l>>>0&255,e[17]=l>>>8&255,e[18]=l>>>16&255,e[19]=l>>>24&255,e[20]=b>>>0&255,e[21]=b>>>8&255,e[22]=b>>>16&255,e[23]=b>>>24&255,e[24]=g>>>0&255,e[25]=g>>>8&255,e[26]=g>>>16&255,e[27]=g>>>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,a)}var b=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function crypto_stream_salsa20_xor(e,t,r,a,n,o,c){var s,d,u=new Uint8Array(16),h=new Uint8Array(64);for(d=0;d<16;d++)u[d]=0;for(d=0;d<8;d++)u[d]=o[d];for(;n>=64;){for(crypto_core_salsa20(h,u,c,b),d=0;d<64;d++)e[t+d]=r[a+d]^h[d];for(s=1,d=8;d<16;d++)s=s+(255&u[d])|0,u[d]=255&s,s>>>=8;n-=64,t+=64,a+=64}if(n>0)for(crypto_core_salsa20(h,u,c,b),d=0;d=64;){for(crypto_core_salsa20(d,s,n,b),c=0;c<64;c++)e[t+c]=d[c];for(o=1,c=8;c<16;c++)o=o+(255&s[c])|0,s[c]=255&o,o>>>=8;r-=64,t+=64}if(r>0)for(crypto_core_salsa20(d,s,n,b),c=0;c>>13|r<<3),a=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(r>>>10|a<<6),n=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(a>>>7|n<<9),o=255&e[8]|(255&e[9])<<8,this.r[4]=255&(n>>>4|o<<12),this.r[5]=o>>>1&8190,c=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(o>>>14|c<<2),s=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(c>>>11|s<<5),d=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(s>>>8|d<<8),this.r[9]=d>>>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 crypto_onetimeauth(e,t,r,a,n,o){var c=new poly1305(o);return c.update(r,a,n),c.finish(e,t),0}function crypto_onetimeauth_verify(e,t,r,a,n,o){var c=new Uint8Array(16);return crypto_onetimeauth(c,0,r,a,n,o),crypto_verify_16(e,t,c,0)}function crypto_secretbox(e,t,r,a,n){var o;if(r<32)return-1;for(crypto_stream_xor(e,0,t,0,r,a,n),crypto_onetimeauth(e,16,e,32,r-32,e),o=0;o<16;o++)e[o]=0;return 0}function crypto_secretbox_open(e,t,r,a,n){var o,c=new Uint8Array(32);if(r<32)return-1;if(crypto_stream(c,0,32,a,n),0!==crypto_onetimeauth_verify(t,16,t,32,r-32,c))return-1;for(crypto_stream_xor(e,0,t,0,r,a,n),o=0;o<32;o++)e[o]=0;return 0}function set25519(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function car25519(e){var t,r,a=1;for(t=0;t<16;t++)r=e[t]+a+65535,a=Math.floor(r/65536),e[t]=r-65536*a;e[0]+=a-1+37*(a-1)}function sel25519(e,t,r){for(var a,n=~(r-1),o=0;o<16;o++)a=n&(e[o]^t[o]),e[o]^=a,t[o]^=a}function pack25519(e,t){var r,a,n,o=gf(),c=gf();for(r=0;r<16;r++)c[r]=t[r];for(car25519(c),car25519(c),car25519(c),a=0;a<2;a++){for(o[0]=c[0]-65517,r=1;r<15;r++)o[r]=c[r]-65535-(o[r-1]>>16&1),o[r-1]&=65535;o[15]=c[15]-32767-(o[14]>>16&1),n=o[15]>>16&1,o[14]&=65535,sel25519(c,o,1-n)}for(r=0;r<16;r++)e[2*r]=255&c[r],e[2*r+1]=c[r]>>8}function neq25519(e,t){var r=new Uint8Array(32),a=new Uint8Array(32);return pack25519(r,e),pack25519(a,t),crypto_verify_32(r,0,a,0)}function par25519(e){var t=new Uint8Array(32);return pack25519(t,e),1&t[0]}function unpack25519(e,t){var r;for(r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function A(e,t,r){for(var a=0;a<16;a++)e[a]=t[a]+r[a]}function Z(e,t,r){for(var a=0;a<16;a++)e[a]=t[a]-r[a]}function M(e,t,r){var a,n,o=0,c=0,s=0,d=0,u=0,h=0,l=0,b=0,g=0,p=0,B=0,m=0,I=0,y=0,x=0,C=0,v=0,Q=0,w=0,_=0,k=0,N=0,D=0,U=0,G=0,T=0,L=0,q=0,P=0,O=0,H=0,Y=r[0],J=r[1],j=r[2],z=r[3],W=r[4],V=r[5],X=r[6],$=r[7],et=r[8],tt=r[9],rt=r[10],at=r[11],it=r[12],nt=r[13],ot=r[14],At=r[15];o+=(a=t[0])*Y,c+=a*J,s+=a*j,d+=a*z,u+=a*W,h+=a*V,l+=a*X,b+=a*$,g+=a*et,p+=a*tt,B+=a*rt,m+=a*at,I+=a*it,y+=a*nt,x+=a*ot,C+=a*At,c+=(a=t[1])*Y,s+=a*J,d+=a*j,u+=a*z,h+=a*W,l+=a*V,b+=a*X,g+=a*$,p+=a*et,B+=a*tt,m+=a*rt,I+=a*at,y+=a*it,x+=a*nt,C+=a*ot,v+=a*At,s+=(a=t[2])*Y,d+=a*J,u+=a*j,h+=a*z,l+=a*W,b+=a*V,g+=a*X,p+=a*$,B+=a*et,m+=a*tt,I+=a*rt,y+=a*at,x+=a*it,C+=a*nt,v+=a*ot,Q+=a*At,d+=(a=t[3])*Y,u+=a*J,h+=a*j,l+=a*z,b+=a*W,g+=a*V,p+=a*X,B+=a*$,m+=a*et,I+=a*tt,y+=a*rt,x+=a*at,C+=a*it,v+=a*nt,Q+=a*ot,w+=a*At,u+=(a=t[4])*Y,h+=a*J,l+=a*j,b+=a*z,g+=a*W,p+=a*V,B+=a*X,m+=a*$,I+=a*et,y+=a*tt,x+=a*rt,C+=a*at,v+=a*it,Q+=a*nt,w+=a*ot,_+=a*At,h+=(a=t[5])*Y,l+=a*J,b+=a*j,g+=a*z,p+=a*W,B+=a*V,m+=a*X,I+=a*$,y+=a*et,x+=a*tt,C+=a*rt,v+=a*at,Q+=a*it,w+=a*nt,_+=a*ot,k+=a*At,l+=(a=t[6])*Y,b+=a*J,g+=a*j,p+=a*z,B+=a*W,m+=a*V,I+=a*X,y+=a*$,x+=a*et,C+=a*tt,v+=a*rt,Q+=a*at,w+=a*it,_+=a*nt,k+=a*ot,N+=a*At,b+=(a=t[7])*Y,g+=a*J,p+=a*j,B+=a*z,m+=a*W,I+=a*V,y+=a*X,x+=a*$,C+=a*et,v+=a*tt,Q+=a*rt,w+=a*at,_+=a*it,k+=a*nt,N+=a*ot,D+=a*At,g+=(a=t[8])*Y,p+=a*J,B+=a*j,m+=a*z,I+=a*W,y+=a*V,x+=a*X,C+=a*$,v+=a*et,Q+=a*tt,w+=a*rt,_+=a*at,k+=a*it,N+=a*nt,D+=a*ot,U+=a*At,p+=(a=t[9])*Y,B+=a*J,m+=a*j,I+=a*z,y+=a*W,x+=a*V,C+=a*X,v+=a*$,Q+=a*et,w+=a*tt,_+=a*rt,k+=a*at,N+=a*it,D+=a*nt,U+=a*ot,G+=a*At,B+=(a=t[10])*Y,m+=a*J,I+=a*j,y+=a*z,x+=a*W,C+=a*V,v+=a*X,Q+=a*$,w+=a*et,_+=a*tt,k+=a*rt,N+=a*at,D+=a*it,U+=a*nt,G+=a*ot,T+=a*At,m+=(a=t[11])*Y,I+=a*J,y+=a*j,x+=a*z,C+=a*W,v+=a*V,Q+=a*X,w+=a*$,_+=a*et,k+=a*tt,N+=a*rt,D+=a*at,U+=a*it,G+=a*nt,T+=a*ot,L+=a*At,I+=(a=t[12])*Y,y+=a*J,x+=a*j,C+=a*z,v+=a*W,Q+=a*V,w+=a*X,_+=a*$,k+=a*et,N+=a*tt,D+=a*rt,U+=a*at,G+=a*it,T+=a*nt,L+=a*ot,q+=a*At,y+=(a=t[13])*Y,x+=a*J,C+=a*j,v+=a*z,Q+=a*W,w+=a*V,_+=a*X,k+=a*$,N+=a*et,D+=a*tt,U+=a*rt,G+=a*at,T+=a*it,L+=a*nt,q+=a*ot,P+=a*At,x+=(a=t[14])*Y,C+=a*J,v+=a*j,Q+=a*z,w+=a*W,_+=a*V,k+=a*X,N+=a*$,D+=a*et,U+=a*tt,G+=a*rt,T+=a*at,L+=a*it,q+=a*nt,P+=a*ot,O+=a*At,C+=(a=t[15])*Y,c+=38*(Q+=a*j),s+=38*(w+=a*z),d+=38*(_+=a*W),u+=38*(k+=a*V),h+=38*(N+=a*X),l+=38*(D+=a*$),b+=38*(U+=a*et),g+=38*(G+=a*tt),p+=38*(T+=a*rt),B+=38*(L+=a*at),m+=38*(q+=a*it),I+=38*(P+=a*nt),y+=38*(O+=a*ot),x+=38*(H+=a*At),o=(a=(o+=38*(v+=a*J))+(n=1)+65535)-65536*(n=Math.floor(a/65536)),c=(a=c+n+65535)-65536*(n=Math.floor(a/65536)),s=(a=s+n+65535)-65536*(n=Math.floor(a/65536)),d=(a=d+n+65535)-65536*(n=Math.floor(a/65536)),u=(a=u+n+65535)-65536*(n=Math.floor(a/65536)),h=(a=h+n+65535)-65536*(n=Math.floor(a/65536)),l=(a=l+n+65535)-65536*(n=Math.floor(a/65536)),b=(a=b+n+65535)-65536*(n=Math.floor(a/65536)),g=(a=g+n+65535)-65536*(n=Math.floor(a/65536)),p=(a=p+n+65535)-65536*(n=Math.floor(a/65536)),B=(a=B+n+65535)-65536*(n=Math.floor(a/65536)),m=(a=m+n+65535)-65536*(n=Math.floor(a/65536)),I=(a=I+n+65535)-65536*(n=Math.floor(a/65536)),y=(a=y+n+65535)-65536*(n=Math.floor(a/65536)),x=(a=x+n+65535)-65536*(n=Math.floor(a/65536)),C=(a=C+n+65535)-65536*(n=Math.floor(a/65536)),o=(a=(o+=n-1+37*(n-1))+(n=1)+65535)-65536*(n=Math.floor(a/65536)),c=(a=c+n+65535)-65536*(n=Math.floor(a/65536)),s=(a=s+n+65535)-65536*(n=Math.floor(a/65536)),d=(a=d+n+65535)-65536*(n=Math.floor(a/65536)),u=(a=u+n+65535)-65536*(n=Math.floor(a/65536)),h=(a=h+n+65535)-65536*(n=Math.floor(a/65536)),l=(a=l+n+65535)-65536*(n=Math.floor(a/65536)),b=(a=b+n+65535)-65536*(n=Math.floor(a/65536)),g=(a=g+n+65535)-65536*(n=Math.floor(a/65536)),p=(a=p+n+65535)-65536*(n=Math.floor(a/65536)),B=(a=B+n+65535)-65536*(n=Math.floor(a/65536)),m=(a=m+n+65535)-65536*(n=Math.floor(a/65536)),I=(a=I+n+65535)-65536*(n=Math.floor(a/65536)),y=(a=y+n+65535)-65536*(n=Math.floor(a/65536)),x=(a=x+n+65535)-65536*(n=Math.floor(a/65536)),C=(a=C+n+65535)-65536*(n=Math.floor(a/65536)),o+=n-1+37*(n-1),e[0]=o,e[1]=c,e[2]=s,e[3]=d,e[4]=u,e[5]=h,e[6]=l,e[7]=b,e[8]=g,e[9]=p,e[10]=B,e[11]=m,e[12]=I,e[13]=y,e[14]=x,e[15]=C}function S(e,t){M(e,t,t)}function inv25519(e,t){var r,a=gf();for(r=0;r<16;r++)a[r]=t[r];for(r=253;r>=0;r--)S(a,a),2!==r&&4!==r&&M(a,a,t);for(r=0;r<16;r++)e[r]=a[r]}function pow2523(e,t){var r,a=gf();for(r=0;r<16;r++)a[r]=t[r];for(r=250;r>=0;r--)S(a,a),1!==r&&M(a,a,t);for(r=0;r<16;r++)e[r]=a[r]}function crypto_scalarmult(e,t,r){var a,n,o=new Uint8Array(32),s=new Float64Array(80),d=gf(),u=gf(),h=gf(),l=gf(),b=gf(),g=gf();for(n=0;n<31;n++)o[n]=t[n];for(o[31]=127&t[31]|64,o[0]&=248,unpack25519(s,r),n=0;n<16;n++)u[n]=s[n],l[n]=d[n]=h[n]=0;for(d[0]=l[0]=1,n=254;n>=0;--n)sel25519(d,u,a=o[n>>>3]>>>(7&n)&1),sel25519(h,l,a),A(b,d,h),Z(d,d,h),A(h,u,l),Z(u,u,l),S(l,b),S(g,d),M(d,h,d),M(h,u,b),A(b,d,h),Z(d,d,h),S(u,d),Z(h,l,g),M(d,h,c),A(d,d,l),M(h,h,d),M(d,l,g),M(l,u,s),S(u,b),sel25519(d,u,a),sel25519(h,l,a);for(n=0;n<16;n++)s[n+16]=d[n],s[n+32]=h[n],s[n+48]=u[n],s[n+64]=l[n];var p=s.subarray(32),B=s.subarray(16);return inv25519(p,p),M(B,B,p),pack25519(e,B),0}function crypto_scalarmult_base(e,t){return crypto_scalarmult(e,t,a)}function crypto_box_keypair(e,t){return randombytes(t,32),crypto_scalarmult_base(e,t)}function crypto_box_beforenm(e,r,a){var n=new Uint8Array(32);return crypto_scalarmult(n,a,r),crypto_core_hsalsa20(e,t,n,b)}poly1305.prototype.blocks=function(e,t,r){for(var a,n,o,c,s,d,u,h,l,b,g,p,B,m,I,y,x,C,v,Q=this.fin?0:2048,w=this.h[0],_=this.h[1],k=this.h[2],N=this.h[3],D=this.h[4],U=this.h[5],G=this.h[6],T=this.h[7],L=this.h[8],q=this.h[9],P=this.r[0],O=this.r[1],H=this.r[2],Y=this.r[3],J=this.r[4],j=this.r[5],z=this.r[6],W=this.r[7],V=this.r[8],X=this.r[9];r>=16;)b=l=0,b+=(w+=8191&(a=255&e[t+0]|(255&e[t+1])<<8))*P,b+=(_+=8191&(a>>>13|(n=255&e[t+2]|(255&e[t+3])<<8)<<3))*(5*X),b+=(k+=8191&(n>>>10|(o=255&e[t+4]|(255&e[t+5])<<8)<<6))*(5*V),b+=(N+=8191&(o>>>7|(c=255&e[t+6]|(255&e[t+7])<<8)<<9))*(5*W),l=(b+=(D+=8191&(c>>>4|(s=255&e[t+8]|(255&e[t+9])<<8)<<12))*(5*z))>>>13,b&=8191,b+=(U+=s>>>1&8191)*(5*j),b+=(G+=8191&(s>>>14|(d=255&e[t+10]|(255&e[t+11])<<8)<<2))*(5*J),b+=(T+=8191&(d>>>11|(u=255&e[t+12]|(255&e[t+13])<<8)<<5))*(5*Y),b+=(L+=8191&(u>>>8|(h=255&e[t+14]|(255&e[t+15])<<8)<<8))*(5*H),g=l+=(b+=(q+=h>>>5|Q)*(5*O))>>>13,g+=w*O,g+=_*P,g+=k*(5*X),g+=N*(5*V),l=(g+=D*(5*W))>>>13,g&=8191,g+=U*(5*z),g+=G*(5*j),g+=T*(5*J),g+=L*(5*Y),l+=(g+=q*(5*H))>>>13,g&=8191,p=l,p+=w*H,p+=_*O,p+=k*P,p+=N*(5*X),l=(p+=D*(5*V))>>>13,p&=8191,p+=U*(5*W),p+=G*(5*z),p+=T*(5*j),p+=L*(5*J),B=l+=(p+=q*(5*Y))>>>13,B+=w*Y,B+=_*H,B+=k*O,B+=N*P,l=(B+=D*(5*X))>>>13,B&=8191,B+=U*(5*V),B+=G*(5*W),B+=T*(5*z),B+=L*(5*j),m=l+=(B+=q*(5*J))>>>13,m+=w*J,m+=_*Y,m+=k*H,m+=N*O,l=(m+=D*P)>>>13,m&=8191,m+=U*(5*X),m+=G*(5*V),m+=T*(5*W),m+=L*(5*z),I=l+=(m+=q*(5*j))>>>13,I+=w*j,I+=_*J,I+=k*Y,I+=N*H,l=(I+=D*O)>>>13,I&=8191,I+=U*P,I+=G*(5*X),I+=T*(5*V),I+=L*(5*W),y=l+=(I+=q*(5*z))>>>13,y+=w*z,y+=_*j,y+=k*J,y+=N*Y,l=(y+=D*H)>>>13,y&=8191,y+=U*O,y+=G*P,y+=T*(5*X),y+=L*(5*V),x=l+=(y+=q*(5*W))>>>13,x+=w*W,x+=_*z,x+=k*j,x+=N*J,l=(x+=D*Y)>>>13,x&=8191,x+=U*H,x+=G*O,x+=T*P,x+=L*(5*X),C=l+=(x+=q*(5*V))>>>13,C+=w*V,C+=_*W,C+=k*z,C+=N*j,l=(C+=D*J)>>>13,C&=8191,C+=U*Y,C+=G*H,C+=T*O,C+=L*P,v=l+=(C+=q*(5*X))>>>13,v+=w*X,v+=_*V,v+=k*W,v+=N*z,l=(v+=D*j)>>>13,v&=8191,v+=U*J,v+=G*Y,v+=T*H,v+=L*O,w=b=8191&(l=(l=((l+=(v+=q*P)>>>13)<<2)+l|0)+(b&=8191)|0),_=g+=l>>>=13,k=p&=8191,N=B&=8191,D=m&=8191,U=I&=8191,G=y&=8191,T=x&=8191,L=C&=8191,q=v&=8191,t+=16,r-=16;this.h[0]=w,this.h[1]=_,this.h[2]=k,this.h[3]=N,this.h[4]=D,this.h[5]=U,this.h[6]=G,this.h[7]=T,this.h[8]=L,this.h[9]=q},poly1305.prototype.finish=function(e,t){var r,a,n,o,c=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,c[0]=this.h[0]+5,r=c[0]>>>13,c[0]&=8191,o=1;o<10;o++)c[o]=this.h[o]+r,r=c[o]>>>13,c[o]&=8191;for(c[9]-=8192,a=(1^r)-1,o=0;o<10;o++)c[o]&=a;for(a=~a,o=0;o<10;o++)this.h[o]=this.h[o]&a|c[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),n=this.h[0]+this.pad[0],this.h[0]=65535&n,o=1;o<8;o++)n=(this.h[o]+this.pad[o]|0)+(n>>>16)|0,this.h[o]=65535&n;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},poly1305.prototype.update=function(e,t,r){var a,n;if(this.leftover){for((n=16-this.leftover)>r&&(n=r),a=0;a=16&&(n=r-r%16,this.blocks(e,t,n),t+=n,r-=n),r){for(a=0;a=128;){for(w=0;w<16;w++)_=8*w+nt,L[w]=r[_+0]<<24|r[_+1]<<16|r[_+2]<<8|r[_+3],q[w]=r[_+4]<<24|r[_+5]<<16|r[_+6]<<8|r[_+7];for(w=0;w<80;w++)if(n=P,o=O,c=H,s=Y,d=J,u=j,h=z,W,b=V,g=X,p=$,m=et,I=tt,y=rt,x=at,it,D=65535&(N=it),U=N>>>16,G=65535&(k=W),T=k>>>16,D+=65535&(N=(tt>>>14|J<<18)^(tt>>>18|J<<14)^(J>>>9|tt<<23)),U+=N>>>16,G+=65535&(k=(J>>>14|tt<<18)^(J>>>18|tt<<14)^(tt>>>9|J<<23)),T+=k>>>16,D+=65535&(N=tt&rt^~tt&at),U+=N>>>16,G+=65535&(k=J&j^~J&z),T+=k>>>16,D+=65535&(N=B[2*w+1]),U+=N>>>16,G+=65535&(k=B[2*w]),T+=k>>>16,k=L[w%16],U+=(N=q[w%16])>>>16,G+=65535&k,T+=k>>>16,G+=(U+=(D+=65535&N)>>>16)>>>16,D=65535&(N=Q=65535&D|U<<16),U=N>>>16,G=65535&(k=v=65535&G|(T+=G>>>16)<<16),T=k>>>16,D+=65535&(N=(V>>>28|P<<4)^(P>>>2|V<<30)^(P>>>7|V<<25)),U+=N>>>16,G+=65535&(k=(P>>>28|V<<4)^(V>>>2|P<<30)^(V>>>7|P<<25)),T+=k>>>16,U+=(N=V&X^V&$^X&$)>>>16,G+=65535&(k=P&O^P&H^O&H),T+=k>>>16,l=65535&(G+=(U+=(D+=65535&N)>>>16)>>>16)|(T+=G>>>16)<<16,C=65535&D|U<<16,D=65535&(N=m),U=N>>>16,G=65535&(k=s),T=k>>>16,U+=(N=Q)>>>16,G+=65535&(k=v),T+=k>>>16,O=n,H=o,Y=c,J=s=65535&(G+=(U+=(D+=65535&N)>>>16)>>>16)|(T+=G>>>16)<<16,j=d,z=u,W=h,P=l,X=b,$=g,et=p,tt=m=65535&D|U<<16,rt=I,at=y,it=x,V=C,w%16==15)for(_=0;_<16;_++)k=L[_],D=65535&(N=q[_]),U=N>>>16,G=65535&k,T=k>>>16,k=L[(_+9)%16],D+=65535&(N=q[(_+9)%16]),U+=N>>>16,G+=65535&k,T+=k>>>16,v=L[(_+1)%16],D+=65535&(N=((Q=q[(_+1)%16])>>>1|v<<31)^(Q>>>8|v<<24)^(Q>>>7|v<<25)),U+=N>>>16,G+=65535&(k=(v>>>1|Q<<31)^(v>>>8|Q<<24)^v>>>7),T+=k>>>16,v=L[(_+14)%16],U+=(N=((Q=q[(_+14)%16])>>>19|v<<13)^(v>>>29|Q<<3)^(Q>>>6|v<<26))>>>16,G+=65535&(k=(v>>>19|Q<<13)^(Q>>>29|v<<3)^v>>>6),T+=k>>>16,T+=(G+=(U+=(D+=65535&N)>>>16)>>>16)>>>16,L[_]=65535&G|T<<16,q[_]=65535&D|U<<16;D=65535&(N=V),U=N>>>16,G=65535&(k=P),T=k>>>16,k=e[0],U+=(N=t[0])>>>16,G+=65535&k,T+=k>>>16,T+=(G+=(U+=(D+=65535&N)>>>16)>>>16)>>>16,e[0]=P=65535&G|T<<16,t[0]=V=65535&D|U<<16,D=65535&(N=X),U=N>>>16,G=65535&(k=O),T=k>>>16,k=e[1],U+=(N=t[1])>>>16,G+=65535&k,T+=k>>>16,T+=(G+=(U+=(D+=65535&N)>>>16)>>>16)>>>16,e[1]=O=65535&G|T<<16,t[1]=X=65535&D|U<<16,D=65535&(N=$),U=N>>>16,G=65535&(k=H),T=k>>>16,k=e[2],U+=(N=t[2])>>>16,G+=65535&k,T+=k>>>16,T+=(G+=(U+=(D+=65535&N)>>>16)>>>16)>>>16,e[2]=H=65535&G|T<<16,t[2]=$=65535&D|U<<16,D=65535&(N=et),U=N>>>16,G=65535&(k=Y),T=k>>>16,k=e[3],U+=(N=t[3])>>>16,G+=65535&k,T+=k>>>16,T+=(G+=(U+=(D+=65535&N)>>>16)>>>16)>>>16,e[3]=Y=65535&G|T<<16,t[3]=et=65535&D|U<<16,D=65535&(N=tt),U=N>>>16,G=65535&(k=J),T=k>>>16,k=e[4],U+=(N=t[4])>>>16,G+=65535&k,T+=k>>>16,T+=(G+=(U+=(D+=65535&N)>>>16)>>>16)>>>16,e[4]=J=65535&G|T<<16,t[4]=tt=65535&D|U<<16,D=65535&(N=rt),U=N>>>16,G=65535&(k=j),T=k>>>16,k=e[5],U+=(N=t[5])>>>16,G+=65535&k,T+=k>>>16,T+=(G+=(U+=(D+=65535&N)>>>16)>>>16)>>>16,e[5]=j=65535&G|T<<16,t[5]=rt=65535&D|U<<16,D=65535&(N=at),U=N>>>16,G=65535&(k=z),T=k>>>16,k=e[6],U+=(N=t[6])>>>16,G+=65535&k,T+=k>>>16,T+=(G+=(U+=(D+=65535&N)>>>16)>>>16)>>>16,e[6]=z=65535&G|T<<16,t[6]=at=65535&D|U<<16,D=65535&(N=it),U=N>>>16,G=65535&(k=W),T=k>>>16,k=e[7],U+=(N=t[7])>>>16,G+=65535&k,T+=k>>>16,T+=(G+=(U+=(D+=65535&N)>>>16)>>>16)>>>16,e[7]=W=65535&G|T<<16,t[7]=it=65535&D|U<<16,nt+=128,a-=128}return a}function crypto_hash(e,t,r){var a,n=new Int32Array(8),o=new Int32Array(8),c=new Uint8Array(256),s=r;for(n[0]=1779033703,n[1]=3144134277,n[2]=1013904242,n[3]=2773480762,n[4]=1359893119,n[5]=2600822924,n[6]=528734635,n[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,crypto_hashblocks_hl(n,o,t,r),r%=128,a=0;a=0;--c)cswap(e,t,a=r[c/8|0]>>(7&c)&1),add(t,e),add(e,e),cswap(e,t,a)}function scalarbase(e,t){var r=[gf(),gf(),gf(),gf()];set25519(r[0],u),set25519(r[1],h),set25519(r[2],o),M(r[3],u,h),scalarmult(e,r,t)}function crypto_sign_keypair(e,t,r){var a,n=new Uint8Array(64),o=[gf(),gf(),gf(),gf()];for(r||randombytes(t,32),crypto_hash(n,t,32),n[0]&=248,n[31]&=127,n[31]|=64,scalarbase(o,n),pack(e,o),a=0;a<32;a++)t[a+32]=e[a];return 0}var m=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function modL(e,t){var r,a,n,o;for(a=63;a>=32;--a){for(r=0,n=a-32,o=a-12;n>4)*m[n],r=t[n]>>8,t[n]&=255;for(n=0;n<32;n++)t[n]-=r*m[n];for(a=0;a<32;a++)t[a+1]+=t[a]>>8,e[a]=255&t[a]}function reduce(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;modL(e,r)}function crypto_sign(e,t,r,a){var n,o,c=new Uint8Array(64),s=new Uint8Array(64),d=new Uint8Array(64),u=new Float64Array(64),h=[gf(),gf(),gf(),gf()];crypto_hash(c,a,32),c[0]&=248,c[31]&=127,c[31]|=64;var l=r+64;for(n=0;n>7&&Z(e[0],n,e[0]),M(e[3],e[0],e[1]),0)}(b,a))return-1;for(c=0;c=0},e.sign.keyPair=function(){var e=new Uint8Array(x),t=new Uint8Array(C);return crypto_sign_keypair(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(checkArrayTypes(e),e.length!==C)throw new Error("bad secret key size");for(var t=new Uint8Array(x),r=0;r{var t=Math.pow(2,30)-1;e.exports=function(e,r){if("number"!=typeof e)throw new TypeError("Iterations not a number");if(e<0)throw new TypeError("Bad iterations");if("number"!=typeof r)throw new TypeError("Key length not a number");if(r<0||r>t||r!=r)throw new TypeError("Bad key length")}},(e,t,r)=>{var a,n=r(1);if(r.g.process&&r.g.process.browser)a="utf-8";else if(r.g.process&&r.g.process.version){a=parseInt(n.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else a="utf-8";e.exports=a},(e,t,r)=>{var a=r(971),n=r(553),o=r(554),c=r(22).Buffer,s=r(564),d=r(565),u=r(567),h=c.alloc(128),l={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function Hmac(e,t,r){var s=function getDigest(e){function shaFunc(t){return o(e).update(t).digest()}function rmd160Func(e){return(new n).update(e).digest()}return"rmd160"===e||"ripemd160"===e?rmd160Func:"md5"===e?a:shaFunc}(e),d="sha512"===e||"sha384"===e?128:64;t.length>d?t=s(t):t.length{var a=r(22).Buffer;e.exports=function(e,t,r){if(a.isBuffer(e))return e;if("string"==typeof e)return a.from(e,t);if(ArrayBuffer.isView(e))return a.from(e.buffer);throw new TypeError(r+" must be a string, a Buffer, a typed array or a DataView")}},function(e,t,r){var a;!function(e,n,o){function Alea(e){var t=this,r=function Mash(){var e=4022871197;return function(t){t=String(t);for(var r=0;r>>0,e=(a*=e)>>>0,e+=4294967296*(a-=e)}return 2.3283064365386963e-10*(e>>>0)}}();t.next=function(){var e=2091639*t.s0+2.3283064365386963e-10*t.c;return t.s0=t.s1,t.s1=t.s2,t.s2=e-(t.c=0|e)},t.c=1,t.s0=r(" "),t.s1=r(" "),t.s2=r(" "),t.s0-=r(e),t.s0<0&&(t.s0+=1),t.s1-=r(e),t.s1<0&&(t.s1+=1),t.s2-=r(e),t.s2<0&&(t.s2+=1),r=null}function copy(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function impl(e,t){var r=new Alea(e),a=t&&t.state,n=r.next;return n.int32=function(){return 4294967296*r.next()|0},n.double=function(){return n()+11102230246251565e-32*(2097152*n()|0)},n.quick=n,a&&("object"==typeof a&©(a,r),n.state=function(){return copy(r,{})}),n}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.alea=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this,r="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:r+=e;for(var a=0;a>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&("object"==typeof a&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xor128=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this,r="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:r+=e;for(var a=0;a>>4),t.next()}function copy(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function impl(e,t){var r=new XorGen(e),a=t&&t.state,prng=function(){return(r.next()>>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&("object"==typeof a&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xorwow=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this;t.next=function(){var e,r,a=t.x,n=t.i;return e=a[n],r=(e^=e>>>7)^e<<24,r^=(e=a[n+1&7])^e>>>10,r^=(e=a[n+3&7])^e>>>3,r^=(e=a[n+4&7])^e<<7,e=a[n+7&7],r^=(e^=e<<13)^e<<9,a[n]=r,t.i=n+1&7,r},function init(e,t){var r,a=[];if(t===(0|t))a[0]=t;else for(t=""+t,r=0;r0;--r)e.next()}(t,e)}function copy(e,t){return t.x=e.x.slice(),t.i=e.i,t}function impl(e,t){null==e&&(e=+new Date);var r=new XorGen(e),a=t&&t.state,prng=function(){return(r.next()>>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&(a.x&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xorshift7=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this;t.next=function(){var e,r,a=t.w,n=t.X,o=t.i;return t.w=a=a+1640531527|0,r=n[o+34&127],e=n[o=o+1&127],r^=r<<13,e^=e<<17,r^=r>>>15,e^=e>>>12,r=n[o]=r^e,t.i=o,r+(a^a>>>16)|0},function init(e,t){var r,a,n,o,c,s=[],d=128;for(t===(0|t)?(a=t,t=null):(t+="\0",a=0,d=Math.max(d,t.length)),n=0,o=-32;o>>15,a^=a<<4,a^=a>>>13,o>=0&&(c=c+1640531527|0,n=0==(r=s[127&o]^=a+c)?n+1:0);for(n>=128&&(s[127&(t&&t.length||0)]=-1),n=127,o=512;o>0;--o)a=s[n+34&127],r=s[n=n+1&127],a^=a<<13,r^=r<<17,a^=a>>>15,r^=r>>>12,s[n]=a^r;e.w=c,e.X=s,e.i=n}(t,e)}function copy(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function impl(e,t){null==e&&(e=+new Date);var r=new XorGen(e),a=t&&t.state,prng=function(){return(r.next()>>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&(a.X&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xor4096=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this,r="";t.next=function(){var e=t.b,r=t.c,a=t.d,n=t.a;return e=e<<25^e>>>7^r,r=r-a|0,a=a<<24^a>>>8^n,n=n-e|0,t.b=e=e<<20^e>>>12^r,t.c=r=r-a|0,t.d=a<<16^r>>>16^n,t.a=n-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):r+=e;for(var a=0;a>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&("object"==typeof a&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.tychei=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function Alea(e){var t=this,r=function Mash(){var e=4022871197;return function(t){t=String(t);for(var r=0;r>>0,e=(a*=e)>>>0,e+=4294967296*(a-=e)}return 2.3283064365386963e-10*(e>>>0)}}();t.next=function(){var e=2091639*t.s0+2.3283064365386963e-10*t.c;return t.s0=t.s1,t.s1=t.s2,t.s2=e-(t.c=0|e)},t.c=1,t.s0=r(" "),t.s1=r(" "),t.s2=r(" "),t.s0-=r(e),t.s0<0&&(t.s0+=1),t.s1-=r(e),t.s1<0&&(t.s1+=1),t.s2-=r(e),t.s2<0&&(t.s2+=1),r=null}function copy(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function impl(e,t){var r=new Alea(e),a=t&&t.state,n=r.next;return n.int32=function(){return 4294967296*r.next()|0},n.double=function(){return n()+11102230246251565e-32*(2097152*n()|0)},n.quick=n,a&&("object"==typeof a&©(a,r),n.state=function(){return copy(r,{})}),n}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.alea=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this,r="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:r+=e;for(var a=0;a>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&("object"==typeof a&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xor128=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this,r="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:r+=e;for(var a=0;a>>4),t.next()}function copy(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function impl(e,t){var r=new XorGen(e),a=t&&t.state,prng=function(){return(r.next()>>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&("object"==typeof a&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xorwow=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this;t.next=function(){var e,r,a=t.x,n=t.i;return e=a[n],r=(e^=e>>>7)^e<<24,r^=(e=a[n+1&7])^e>>>10,r^=(e=a[n+3&7])^e>>>3,r^=(e=a[n+4&7])^e<<7,e=a[n+7&7],r^=(e^=e<<13)^e<<9,a[n]=r,t.i=n+1&7,r},function init(e,t){var r,a=[];if(t===(0|t))a[0]=t;else for(t=""+t,r=0;r0;--r)e.next()}(t,e)}function copy(e,t){return t.x=e.x.slice(),t.i=e.i,t}function impl(e,t){null==e&&(e=+new Date);var r=new XorGen(e),a=t&&t.state,prng=function(){return(r.next()>>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&(a.x&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xorshift7=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this;t.next=function(){var e,r,a=t.w,n=t.X,o=t.i;return t.w=a=a+1640531527|0,r=n[o+34&127],e=n[o=o+1&127],r^=r<<13,e^=e<<17,r^=r>>>15,e^=e>>>12,r=n[o]=r^e,t.i=o,r+(a^a>>>16)|0},function init(e,t){var r,a,n,o,c,s=[],d=128;for(t===(0|t)?(a=t,t=null):(t+="\0",a=0,d=Math.max(d,t.length)),n=0,o=-32;o>>15,a^=a<<4,a^=a>>>13,o>=0&&(c=c+1640531527|0,n=0==(r=s[127&o]^=a+c)?n+1:0);for(n>=128&&(s[127&(t&&t.length||0)]=-1),n=127,o=512;o>0;--o)a=s[n+34&127],r=s[n=n+1&127],a^=a<<13,r^=r<<17,a^=a>>>15,r^=r>>>12,s[n]=a^r;e.w=c,e.X=s,e.i=n}(t,e)}function copy(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function impl(e,t){null==e&&(e=+new Date);var r=new XorGen(e),a=t&&t.state,prng=function(){return(r.next()>>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&(a.X&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.xor4096=impl}(0,e=r.nmd(e),r.amdD)},function(e,t,r){var a;!function(e,n,o){function XorGen(e){var t=this,r="";t.next=function(){var e=t.b,r=t.c,a=t.d,n=t.a;return e=e<<25^e>>>7^r,r=r-a|0,a=a<<24^a>>>8^n,n=n-e|0,t.b=e=e<<20^e>>>12^r,t.c=r=r-a|0,t.d=a<<16^r>>>16^n,t.a=n-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):r+=e;for(var a=0;a>>0)/4294967296};return prng.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},prng.int32=r.next,prng.quick=prng,a&&("object"==typeof a&©(a,r),prng.state=function(){return copy(r,{})}),prng}n&&n.exports?n.exports=impl:r.amdD&&r.amdO?void 0===(a=function(){return impl}.call(t,r,t,n))||(n.exports=a):this.tychei=impl}(0,e=r.nmd(e),r.amdD)},(e,t,r)=>{"use strict";var a=r(35),n=r(581),o=r(41).Buffer,c=new Array(16);function MD5(){n.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function rotl(e,t){return e<>>32-t}function fnF(e,t,r,a,n,o,c){return rotl(e+(t&r|~t&a)+n+o|0,c)+t|0}function fnG(e,t,r,a,n,o,c){return rotl(e+(t&a|r&~a)+n+o|0,c)+t|0}function fnH(e,t,r,a,n,o,c){return rotl(e+(t^r^a)+n+o|0,c)+t|0}function fnI(e,t,r,a,n,o,c){return rotl(e+(r^(t|~a))+n+o|0,c)+t|0}a(MD5,n),MD5.prototype._update=function(){for(var e=c,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,a=this._b,n=this._c,o=this._d;r=fnF(r,a,n,o,e[0],3614090360,7),o=fnF(o,r,a,n,e[1],3905402710,12),n=fnF(n,o,r,a,e[2],606105819,17),a=fnF(a,n,o,r,e[3],3250441966,22),r=fnF(r,a,n,o,e[4],4118548399,7),o=fnF(o,r,a,n,e[5],1200080426,12),n=fnF(n,o,r,a,e[6],2821735955,17),a=fnF(a,n,o,r,e[7],4249261313,22),r=fnF(r,a,n,o,e[8],1770035416,7),o=fnF(o,r,a,n,e[9],2336552879,12),n=fnF(n,o,r,a,e[10],4294925233,17),a=fnF(a,n,o,r,e[11],2304563134,22),r=fnF(r,a,n,o,e[12],1804603682,7),o=fnF(o,r,a,n,e[13],4254626195,12),n=fnF(n,o,r,a,e[14],2792965006,17),r=fnG(r,a=fnF(a,n,o,r,e[15],1236535329,22),n,o,e[1],4129170786,5),o=fnG(o,r,a,n,e[6],3225465664,9),n=fnG(n,o,r,a,e[11],643717713,14),a=fnG(a,n,o,r,e[0],3921069994,20),r=fnG(r,a,n,o,e[5],3593408605,5),o=fnG(o,r,a,n,e[10],38016083,9),n=fnG(n,o,r,a,e[15],3634488961,14),a=fnG(a,n,o,r,e[4],3889429448,20),r=fnG(r,a,n,o,e[9],568446438,5),o=fnG(o,r,a,n,e[14],3275163606,9),n=fnG(n,o,r,a,e[3],4107603335,14),a=fnG(a,n,o,r,e[8],1163531501,20),r=fnG(r,a,n,o,e[13],2850285829,5),o=fnG(o,r,a,n,e[2],4243563512,9),n=fnG(n,o,r,a,e[7],1735328473,14),r=fnH(r,a=fnG(a,n,o,r,e[12],2368359562,20),n,o,e[5],4294588738,4),o=fnH(o,r,a,n,e[8],2272392833,11),n=fnH(n,o,r,a,e[11],1839030562,16),a=fnH(a,n,o,r,e[14],4259657740,23),r=fnH(r,a,n,o,e[1],2763975236,4),o=fnH(o,r,a,n,e[4],1272893353,11),n=fnH(n,o,r,a,e[7],4139469664,16),a=fnH(a,n,o,r,e[10],3200236656,23),r=fnH(r,a,n,o,e[13],681279174,4),o=fnH(o,r,a,n,e[0],3936430074,11),n=fnH(n,o,r,a,e[3],3572445317,16),a=fnH(a,n,o,r,e[6],76029189,23),r=fnH(r,a,n,o,e[9],3654602809,4),o=fnH(o,r,a,n,e[12],3873151461,11),n=fnH(n,o,r,a,e[15],530742520,16),r=fnI(r,a=fnH(a,n,o,r,e[2],3299628645,23),n,o,e[0],4096336452,6),o=fnI(o,r,a,n,e[7],1126891415,10),n=fnI(n,o,r,a,e[14],2878612391,15),a=fnI(a,n,o,r,e[5],4237533241,21),r=fnI(r,a,n,o,e[12],1700485571,6),o=fnI(o,r,a,n,e[3],2399980690,10),n=fnI(n,o,r,a,e[10],4293915773,15),a=fnI(a,n,o,r,e[1],2240044497,21),r=fnI(r,a,n,o,e[8],1873313359,6),o=fnI(o,r,a,n,e[15],4264355552,10),n=fnI(n,o,r,a,e[6],2734768916,15),a=fnI(a,n,o,r,e[13],1309151649,21),r=fnI(r,a,n,o,e[4],4149444226,6),o=fnI(o,r,a,n,e[11],3174756917,10),n=fnI(n,o,r,a,e[2],718787259,15),a=fnI(a,n,o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+a|0,this._c=this._c+n|0,this._d=this._d+o|0},MD5.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=o.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=MD5},(e,t,r)=>{"use strict";var a=r(41).Buffer,n=r(370).Transform;function HashBase(e){n.call(this),this._block=a.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(35)(HashBase,n),HashBase.prototype._transform=function(e,t,r){var a=null;try{this.update(e,t)}catch(e){a=e}r(a)},HashBase.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},HashBase.prototype.update=function(e,t){if(function throwIfNotStringOrBuffer(e,t){if(!a.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");a.isBuffer(e)||(e=a.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var o=this._blockOffset;o0;++c)this._length[c]+=s,(s=this._length[c]/4294967296|0)>0&&(this._length[c]-=4294967296*s);return this},HashBase.prototype._update=function(){throw new Error("_update is not implemented")},HashBase.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},HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=HashBase},(e,t,r)=>{"use strict";var a,n=r(1);e.exports=Readable,Readable.ReadableState=ReadableState;r(34).EventEmitter;var o=function EElistenerCount(e,t){return e.listeners(t).length},c=r(986),s=r(2).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(89);u=h&&h.debuglog?h.debuglog("stream"):function debug(){};var l,b,g,p=r(987),B=r(583),m=r(584).getHighWaterMark,I=r(248).a,y=I.ERR_INVALID_ARG_TYPE,x=I.ERR_STREAM_PUSH_AFTER_EOF,C=I.ERR_METHOD_NOT_IMPLEMENTED,v=I.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(35)(Readable,c);var Q=B.errorOrDestroy,w=["error","close","destroy","pause","resume"];function ReadableState(e,t,n){a=a||r(200),e=e||{},"boolean"!=typeof n&&(n=t instanceof a),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=m(this,e,"readableHighWaterMark",n),this.buffer=new p,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.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(l||(l=r(586).a),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function Readable(e){if(a=a||r(200),!(this instanceof Readable))return new Readable(e);var t=this instanceof a;this._readableState=new ReadableState(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),c.call(this)}function readableAddChunk(e,t,r,a,n){u("readableAddChunk",t);var o,c=e._readableState;if(null===t)c.reading=!1,function onEofChunk(e,t){if(u("onEofChunk"),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,t.sync?emitReadable(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,emitReadable_(e)))}(e,c);else if(n||(o=function chunkInvalid(e,t){var r;(function _isUint8Array(e){return s.isBuffer(e)||e instanceof d})(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],t));return r}(c,t)),o)Q(e,o);else if(c.objectMode||t&&t.length>0)if("string"==typeof t||c.objectMode||Object.getPrototypeOf(t)===s.prototype||(t=function _uint8ArrayToBuffer(e){return s.from(e)}(t)),a)c.endEmitted?Q(e,new v):addChunk(e,c,t,!0);else if(c.ended)Q(e,new x);else{if(c.destroyed)return!1;c.reading=!1,c.decoder&&!r?(t=c.decoder.write(t),c.objectMode||0!==t.length?addChunk(e,c,t,!1):maybeReadMore(e,c)):addChunk(e,c,t,!1)}else a||(c.reading=!1,maybeReadMore(e,c));return!c.ended&&(c.lengtht.highWaterMark&&(t.highWaterMark=function computeNewHighWaterMark(e){return e>=_?e=_:(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 emitReadable(e){var t=e._readableState;u("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(u("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(emitReadable_,e))}function emitReadable_(e){var t=e._readableState;u("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,flow(e)}function maybeReadMore(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(maybeReadMore_,e,t))}function maybeReadMore_(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function nReadingNextTick(e){u("readable nexttick read 0"),e.read(0)}function resume_(e,t){u("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),flow(e),t.flowing&&!t.reading&&e.read(0)}function flow(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function fromList(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 endReadable(e){var t=e._readableState;u("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(endReadableNT,t,e))}function endReadableNT(e,t){if(u("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 indexOf(e,t){for(var r=0,a=e.length;r=t.highWaterMark:t.length>0)||t.ended))return u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?endReadable(this):emitReadable(this),null;if(0===(e=howMuchToRead(e,t))&&t.ended)return 0===t.length&&endReadable(this),null;var a,n=t.needReadable;return u("need readable",n),(0===t.length||t.length-e0?fromList(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&&endReadable(this)),null!==a&&this.emit("data",a),a},Readable.prototype._read=function(e){Q(this,new C("_read()"))},Readable.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,u("pipe count=%d opts=%j",a.pipesCount,t);var c=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?onend:unpipe;function onunpipe(t,n){u("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,function cleanup(){u("cleanup"),e.removeListener("close",onclose),e.removeListener("finish",onfinish),e.removeListener("drain",s),e.removeListener("error",onerror),e.removeListener("unpipe",onunpipe),r.removeListener("end",onend),r.removeListener("end",unpipe),r.removeListener("data",ondata),d=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}())}function onend(){u("onend"),e.end()}a.endEmitted?n.nextTick(c):r.once("end",c),e.on("unpipe",onunpipe);var s=function pipeOnDrain(e){return function pipeOnDrainFunctionResult(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,flow(e))}}(r);e.on("drain",s);var d=!1;function ondata(t){u("ondata");var n=e.write(t);u("dest.write",n),!1===n&&((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==indexOf(a.pipes,e))&&!d&&(u("false write response, pause",a.awaitDrain),a.awaitDrain++),r.pause())}function onerror(t){u("onerror",t),unpipe(),e.removeListener("error",onerror),0===o(e,"error")&&Q(e,t)}function onclose(){e.removeListener("finish",onfinish),unpipe()}function onfinish(){u("onfinish"),e.removeListener("close",onclose),unpipe()}function unpipe(){u("unpipe"),r.unpipe(e)}return r.on("data",ondata),function prependListener(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",onerror),e.once("close",onclose),e.once("finish",onfinish),e.emit("pipe",r),a.flowing||(u("pipe resume"),r.resume()),e},Readable.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 a=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==a.flowing&&this.resume()):"readable"===e&&(a.endEmitted||a.readableListening||(a.readableListening=a.needReadable=!0,a.flowing=!1,a.emittedReadable=!1,u("on readable",a.length,a.reading),a.length?emitReadable(this):a.reading||n.nextTick(nReadingNextTick,this))),r},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.removeListener=function(e,t){var r=c.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(updateReadableListening,this),r},Readable.prototype.removeAllListeners=function(e){var t=c.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(updateReadableListening,this),t},Readable.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!e.readableListening,function resume(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(resume_,e,t))}(this,e)),e.paused=!1,this},Readable.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},Readable.prototype.wrap=function(e){var t=this,r=this._readableState,a=!1;for(var n in e.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(n){(u("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(a=!0,e.pause()))})),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function methodWrap(t){return function methodWrapReturnFunction(){return e[t].apply(e,arguments)}}(n));for(var o=0;o{"use strict";var a=r(1);function emitErrorAndCloseNT(e,t){emitErrorNT(e,t),emitCloseNT(e)}function emitCloseNT(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function emitErrorNT(e,t){e.emit("error",t)}e.exports={destroy:function destroy(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return n||o?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,a.nextTick(emitErrorNT,this,e)):a.nextTick(emitErrorNT,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?r._writableState?r._writableState.errorEmitted?a.nextTick(emitCloseNT,r):(r._writableState.errorEmitted=!0,a.nextTick(emitErrorAndCloseNT,r,e)):a.nextTick(emitErrorAndCloseNT,r,e):t?(a.nextTick(emitCloseNT,r),t(e)):a.nextTick(emitCloseNT,r)})),this)},undestroy:function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function errorOrDestroy(e,t){var r=e._readableState,a=e._writableState;r&&r.autoDestroy||a&&a.autoDestroy?e.destroy(t):e.emit("error",t)}}},(e,t,r)=>{"use strict";var a=r(248).a.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function getHighWaterMark(e,t,r,n){var o=function highWaterMarkFrom(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new a(n?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},(e,t,r)=>{"use strict";var a,n=r(1);function CorkedRequest(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function onCorkedFinish(e,t,r){var a=e.entry;e.entry=null;for(;a;){var n=a.callback;t.pendingcb--,n(r),a=a.next}t.corkedRequestsFree.next=e}(t,e)}}e.exports=Writable,Writable.WritableState=WritableState;var o={deprecate:r(988)},c=r(986),s=r(2).Buffer,d=r.g.Uint8Array||function(){};var u,h=r(583),l=r(584).getHighWaterMark,b=r(248).a,g=b.ERR_INVALID_ARG_TYPE,p=b.ERR_METHOD_NOT_IMPLEMENTED,B=b.ERR_MULTIPLE_CALLBACK,m=b.ERR_STREAM_CANNOT_PIPE,I=b.ERR_STREAM_DESTROYED,y=b.ERR_STREAM_NULL_VALUES,x=b.ERR_STREAM_WRITE_AFTER_END,C=b.ERR_UNKNOWN_ENCODING,v=h.errorOrDestroy;function nop(){}function WritableState(e,t,o){a=a||r(200),e=e||{},"boolean"!=typeof o&&(o=t instanceof a),this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=l(this,e,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===e.decodeStrings;this.decodeStrings=!c,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 onwrite(e,t){var r=e._writableState,a=r.sync,o=r.writecb;if("function"!=typeof o)throw new B;if(function onwriteStateUpdate(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function onwriteError(e,t,r,a,o){--t.pendingcb,r?(n.nextTick(o,a),n.nextTick(finishMaybe,e,t),e._writableState.errorEmitted=!0,v(e,a)):(o(a),e._writableState.errorEmitted=!0,v(e,a),finishMaybe(e,t))}(e,r,a,t,o);else{var c=needFinish(r)||e.destroyed;c||r.corked||r.bufferProcessing||!r.bufferedRequest||clearBuffer(e,r),a?n.nextTick(afterWrite,e,r,c,o):afterWrite(e,r,c,o)}}(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 CorkedRequest(this)}function Writable(e){var t=this instanceof(a=a||r(200));if(!t&&!u.call(Writable,this))return new Writable(e);this._writableState=new WritableState(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)),c.call(this)}function doWrite(e,t,r,a,n,o,c){t.writelen=a,t.writecb=c,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new I("write")):r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}function afterWrite(e,t,r,a){r||function onwriteDrain(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,a(),finishMaybe(e,t)}function clearBuffer(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var a=t.bufferedRequestCount,n=new Array(a),o=t.corkedRequestsFree;o.entry=r;for(var c=0,s=!0;r;)n[c]=r,r.isBuf||(s=!1),r=r.next,c+=1;n.allBuffers=s,doWrite(e,t,!0,t.length,n,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new CorkedRequest(t),t.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,u=r.encoding,h=r.callback;if(doWrite(e,t,!1,t.objectMode?1:d.length,d,u,h),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function needFinish(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function callFinal(e,t){e._final((function(r){t.pendingcb--,r&&v(e,r),t.prefinished=!0,e.emit("prefinish"),finishMaybe(e,t)}))}function finishMaybe(e,t){var r=needFinish(t);if(r&&(function prefinish(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,n.nextTick(callFinal,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var a=e._readableState;(!a||a.autoDestroy&&a.endEmitted)&&e.destroy()}return r}r(35)(Writable,c),WritableState.prototype.getBuffer=function getBuffer(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:o.deprecate((function writableStateBufferGetter(){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]?(u=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function value(e){return!!u.call(this,e)||this===Writable&&(e&&e._writableState instanceof WritableState)}})):u=function realHasInstance(e){return e instanceof this},Writable.prototype.pipe=function(){v(this,new m)},Writable.prototype.write=function(e,t,r){var a=this._writableState,o=!1,c=!a.objectMode&&function _isUint8Array(e){return s.isBuffer(e)||e instanceof d}(e);return c&&!s.isBuffer(e)&&(e=function _uint8ArrayToBuffer(e){return s.from(e)}(e)),"function"==typeof t&&(r=t,t=null),c?t="buffer":t||(t=a.defaultEncoding),"function"!=typeof r&&(r=nop),a.ending?function writeAfterEnd(e,t){var r=new x;v(e,r),n.nextTick(t,r)}(this,r):(c||function validChunk(e,t,r,a){var o;return null===r?o=new y:"string"==typeof r||t.objectMode||(o=new g("chunk",["string","Buffer"],r)),!o||(v(e,o),n.nextTick(a,o),!1)}(this,a,e,r))&&(a.pendingcb++,o=function writeOrBuffer(e,t,r,a,n,o){if(!r){var c=function decodeChunk(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=s.from(t,r));return t}(t,a,n);a!==c&&(r=!0,n="buffer",a=c)}var d=t.objectMode?1:a.length;t.length+=d;var u=t.length-1))throw new C(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:!1,get:function get(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function get(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(e,t,r){r(new p("_write()"))},Writable.prototype._writev=null,Writable.prototype.end=function(e,t,r){var a=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),a.corked&&(a.corked=1,this.uncork()),a.ending||function endWritable(e,t,r){t.ending=!0,finishMaybe(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,a,r),this},Object.defineProperty(Writable.prototype,"writableLength",{enumerable:!1,get:function get(){return this._writableState.length}}),Object.defineProperty(Writable.prototype,"destroyed",{enumerable:!1,get:function get(){return void 0!==this._writableState&&this._writableState.destroyed},set:function set(e){this._writableState&&(this._writableState.destroyed=e)}}),Writable.prototype.destroy=h.destroy,Writable.prototype._undestroy=h.undestroy,Writable.prototype._destroy=function(e,t){t(e)}},(e,t,r)=>{"use strict";var a=r(41).Buffer,n=a.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function StringDecoder(e){var t;switch(this.encoding=function normalizeEncoding(e){var t=function _normalizeEncoding(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&&(a.isEncoding===n||!n(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,t=4;break;case"utf8":this.fillLast=utf8FillLast,t=4;break;case"base64":this.text=base64Text,this.end=base64End,t=3;break;default:return this.write=simpleWrite,void(this.end=simpleEnd)}this.lastNeed=0,this.lastTotal=0,this.lastChar=a.allocUnsafe(t)}function utf8CheckByte(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function utf8FillLast(e){var t=this.lastTotal-this.lastNeed,r=function utf8CheckExtraBytes(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 utf16Text(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var a=r.charCodeAt(r.length-1);if(a>=55296&&a<=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 utf16End(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 base64Text(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 base64End(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function simpleWrite(e){return e.toString(this.encoding)}function simpleEnd(e){return e&&e.length?this.write(e):""}t.a=StringDecoder,StringDecoder.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 n>0&&(e.lastNeed=n-1),n;if(--a=0)return n>0&&(e.lastNeed=n-2),n;if(--a=0)return n>0&&(2===n?n=0:e.lastNeed=n-3),n;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var a=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,a),e.toString("utf8",t,a)},StringDecoder.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}},(e,t,r)=>{"use strict";e.exports=Transform;var a=r(248).a,n=a.ERR_METHOD_NOT_IMPLEMENTED,o=a.ERR_MULTIPLE_CALLBACK,c=a.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=a.ERR_TRANSFORM_WITH_LENGTH_0,d=r(200);function afterTransform(e,t){var r=this._transformState;r.transforming=!1;var a=r.writecb;if(null===a)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),a(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length{"use strict";var a=r(2).Buffer,n=r(35),o=r(581),c=new Array(16),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],d=[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],u=[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],h=[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],l=[0,1518500249,1859775393,2400959708,2840853838],b=[1352829926,1548603684,1836072691,2053994217,0];function RIPEMD160(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function rotl(e,t){return e<>>32-t}function fn1(e,t,r,a,n,o,c,s){return rotl(e+(t^r^a)+o+c|0,s)+n|0}function fn2(e,t,r,a,n,o,c,s){return rotl(e+(t&r|~t&a)+o+c|0,s)+n|0}function fn3(e,t,r,a,n,o,c,s){return rotl(e+((t|~r)^a)+o+c|0,s)+n|0}function fn4(e,t,r,a,n,o,c,s){return rotl(e+(t&a|r&~a)+o+c|0,s)+n|0}function fn5(e,t,r,a,n,o,c,s){return rotl(e+(t^(r|~a))+o+c|0,s)+n|0}n(RIPEMD160,o),RIPEMD160.prototype._update=function(){for(var e=c,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,a=0|this._b,n=0|this._c,o=0|this._d,g=0|this._e,p=0|this._a,B=0|this._b,m=0|this._c,I=0|this._d,y=0|this._e,x=0;x<80;x+=1){var C,v;x<16?(C=fn1(r,a,n,o,g,e[s[x]],l[0],u[x]),v=fn5(p,B,m,I,y,e[d[x]],b[0],h[x])):x<32?(C=fn2(r,a,n,o,g,e[s[x]],l[1],u[x]),v=fn4(p,B,m,I,y,e[d[x]],b[1],h[x])):x<48?(C=fn3(r,a,n,o,g,e[s[x]],l[2],u[x]),v=fn3(p,B,m,I,y,e[d[x]],b[2],h[x])):x<64?(C=fn4(r,a,n,o,g,e[s[x]],l[3],u[x]),v=fn2(p,B,m,I,y,e[d[x]],b[3],h[x])):(C=fn5(r,a,n,o,g,e[s[x]],l[4],u[x]),v=fn1(p,B,m,I,y,e[d[x]],b[4],h[x])),r=g,g=o,o=rotl(n,10),n=a,a=C,p=y,y=I,I=rotl(m,10),m=B,B=v}var Q=this._b+n+I|0;this._b=this._c+o+y|0,this._c=this._d+g+p|0,this._d=this._e+r+B|0,this._e=this._a+a+m|0,this._a=Q},RIPEMD160.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=a.alloc?a.alloc(20):new a(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},e.exports=RIPEMD160},(e,t,r)=>{var a=e.exports=function SHA(e){e=e.toLowerCase();var t=a[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};a.sha=r(993),a.sha1=r(994),a.sha224=r(995),a.sha256=r(590),a.sha384=r(996),a.sha512=r(591)},(e,t,r)=>{var a=r(35),n=r(201),o=r(41).Buffer,c=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function Sha256(){this.init(),this._w=s,n.call(this,64,56)}function ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function sigma1(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function gamma0(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}a(Sha256,n),Sha256.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},Sha256.prototype._update=function(e){for(var t,r=this._w,a=0|this._a,n=0|this._b,o=0|this._c,s=0|this._d,d=0|this._e,u=0|this._f,h=0|this._g,l=0|this._h,b=0;b<16;++b)r[b]=e.readInt32BE(4*b);for(;b<64;++b)r[b]=0|(((t=r[b-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[b-7]+gamma0(r[b-15])+r[b-16];for(var g=0;g<64;++g){var p=l+sigma1(d)+ch(d,u,h)+c[g]+r[g]|0,B=sigma0(a)+maj(a,n,o)|0;l=h,h=u,u=d,d=s+p|0,s=o,o=n,n=a,a=p+B|0}this._a=a+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=d+this._e|0,this._f=u+this._f|0,this._g=h+this._g|0,this._h=l+this._h|0},Sha256.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=Sha256},(e,t,r)=>{var a=r(35),n=r(201),o=r(41).Buffer,c=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],s=new Array(160);function Sha512(){this.init(),this._w=s,n.call(this,128,112)}function Ch(e,t,r){return r^e&(t^r)}function maj(e,t,r){return e&t|r&(e|t)}function sigma0(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function sigma1(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Gamma0(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Gamma0l(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function Gamma1(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Gamma1l(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function getCarry(e,t){return e>>>0>>0?1:0}a(Sha512,n),Sha512.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},Sha512.prototype._update=function(e){for(var t=this._w,r=0|this._ah,a=0|this._bh,n=0|this._ch,o=0|this._dh,s=0|this._eh,d=0|this._fh,u=0|this._gh,h=0|this._hh,l=0|this._al,b=0|this._bl,g=0|this._cl,p=0|this._dl,B=0|this._el,m=0|this._fl,I=0|this._gl,y=0|this._hl,x=0;x<32;x+=2)t[x]=e.readInt32BE(4*x),t[x+1]=e.readInt32BE(4*x+4);for(;x<160;x+=2){var C=t[x-30],v=t[x-30+1],Q=Gamma0(C,v),w=Gamma0l(v,C),_=Gamma1(C=t[x-4],v=t[x-4+1]),k=Gamma1l(v,C),N=t[x-14],D=t[x-14+1],U=t[x-32],G=t[x-32+1],T=w+D|0,L=Q+N+getCarry(T,w)|0;L=(L=L+_+getCarry(T=T+k|0,k)|0)+U+getCarry(T=T+G|0,G)|0,t[x]=L,t[x+1]=T}for(var q=0;q<160;q+=2){L=t[q],T=t[q+1];var P=maj(r,a,n),O=maj(l,b,g),H=sigma0(r,l),Y=sigma0(l,r),J=sigma1(s,B),j=sigma1(B,s),z=c[q],W=c[q+1],V=Ch(s,d,u),X=Ch(B,m,I),$=y+j|0,et=h+J+getCarry($,y)|0;et=(et=(et=et+V+getCarry($=$+X|0,X)|0)+z+getCarry($=$+W|0,W)|0)+L+getCarry($=$+T|0,T)|0;var tt=Y+O|0,rt=H+P+getCarry(tt,Y)|0;h=u,y=I,u=d,I=m,d=s,m=B,s=o+et+getCarry(B=p+$|0,p)|0,o=n,p=g,n=a,g=b,a=r,b=l,r=et+rt+getCarry(l=$+tt|0,$)|0}this._al=this._al+l|0,this._bl=this._bl+b|0,this._cl=this._cl+g|0,this._dl=this._dl+p|0,this._el=this._el+B|0,this._fl=this._fl+m|0,this._gl=this._gl+I|0,this._hl=this._hl+y|0,this._ah=this._ah+r+getCarry(this._al,l)|0,this._bh=this._bh+a+getCarry(this._bl,b)|0,this._ch=this._ch+n+getCarry(this._cl,g)|0,this._dh=this._dh+o+getCarry(this._dl,p)|0,this._eh=this._eh+s+getCarry(this._el,B)|0,this._fh=this._fh+d+getCarry(this._fl,m)|0,this._gh=this._gh+u+getCarry(this._gl,I)|0,this._hh=this._hh+h+getCarry(this._hl,y)|0},Sha512.prototype._hash=function(){var e=o.allocUnsafe(64);function writeInt64BE(t,r,a){e.writeInt32BE(t,a),e.writeInt32BE(r,a+4)}return writeInt64BE(this._ah,this._al,0),writeInt64BE(this._bh,this._bl,8),writeInt64BE(this._ch,this._cl,16),writeInt64BE(this._dh,this._dl,24),writeInt64BE(this._eh,this._el,32),writeInt64BE(this._fh,this._fl,40),writeInt64BE(this._gh,this._gl,48),writeInt64BE(this._hh,this._hl,56),e},e.exports=Sha512},e=>{var t=Math.pow(2,30)-1;e.exports=function(e,r){if("number"!=typeof e)throw new TypeError("Iterations not a number");if(e<0)throw new TypeError("Bad iterations");if("number"!=typeof r)throw new TypeError("Key length not a number");if(r<0||r>t||r!=r)throw new TypeError("Bad key length")}},(e,t,r)=>{var a,n=r(1);if(r.g.process&&r.g.process.browser)a="utf-8";else if(r.g.process&&r.g.process.version){a=parseInt(n.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else a="utf-8";e.exports=a},(e,t,r)=>{var a=r(999),n=r(588),o=r(589),c=r(41).Buffer,s=r(592),d=r(593),u=r(595),h=c.alloc(128),l={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function Hmac(e,t,r){var s=function getDigest(e){function shaFunc(t){return o(e).update(t).digest()}function rmd160Func(e){return(new n).update(e).digest()}return"rmd160"===e||"ripemd160"===e?rmd160Func:"md5"===e?a:shaFunc}(e),d="sha512"===e||"sha384"===e?128:64;t.length>d?t=s(t):t.length{var a=r(41).Buffer;e.exports=function(e,t,r){if(a.isBuffer(e))return e;if("string"==typeof e)return a.from(e,t);if(ArrayBuffer.isView(e))return a.from(e.buffer);throw new TypeError(r+" must be a string, a Buffer, a typed array or a DataView")}},(e,t,r)=>{"use strict";var a=r(1),n=65536,o=4294967295;var c=r(41).Buffer,s=r.g.crypto||r.g.msCrypto;s&&s.getRandomValues?e.exports=function randomBytes(e,t){if(e>o)throw new RangeError("requested too many random bytes");var r=c.allocUnsafe(e);if(e>0)if(e>n)for(var d=0;d28&&o%2==1||1===o||28===o)&&((c=a.from(r))[0]|=128),s.bufferToHex(a.concat([s.setLengthLeft(t,32),s.setLengthLeft(c,32)]))},t.fromRpcSig=function(e){var t,r,a,n=s.toBuffer(e);if(n.length>=65)t=n.slice(0,32),r=n.slice(32,64),a=s.bufferToInt(n.slice(64));else{if(64!==n.length)throw new Error("Invalid signature length");t=n.slice(0,32),r=n.slice(32,64),a=s.bufferToInt(n.slice(32,33))>>7,r[0]&=127}return a<27&&(a+=27),{v:a,r:t,s:r}},t.isValidSignature=function(e,t,r,a,n){void 0===a&&(a=!0);var o=new c.default("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),s=new c.default("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(32!==t.length||32!==r.length)return!1;if(!isValidSigRecovery(calculateSigRecovery(e,n)))return!1;var d=new c.default(t),u=new c.default(r);return!(d.isZero()||d.gt(s)||u.isZero()||u.gt(s))&&(!a||1!==u.cmp(o))},t.hashPersonalMessage=function(e){u.assertIsBuffer(e);var t=a.from("Ethereum Signed Message:\n"+e.length.toString(),"utf-8");return d.keccak(a.concat([t,e]))}},(e,t,r)=>{var a=r(601);function AbstractIterator(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._ended=!1,this._nexting=!1}AbstractIterator.prototype.next=function(e){var t=this;if("function"!=typeof e)throw new Error("next() requires a callback argument");return t._ended?(a(e,new Error("cannot call next() after end()")),t):t._nexting?(a(e,new Error("cannot call next() before previous next() has completed")),t):(t._nexting=!0,t._next((function(){t._nexting=!1,e.apply(null,arguments)})),t)},AbstractIterator.prototype._next=function(e){a(e)},AbstractIterator.prototype.seek=function(e){if(this._ended)throw new Error("cannot call seek() after end()");if(this._nexting)throw new Error("cannot call seek() before next() has completed");e=this.db._serializeKey(e),this._seek(e)},AbstractIterator.prototype._seek=function(e){},AbstractIterator.prototype.end=function(e){if("function"!=typeof e)throw new Error("end() requires a callback argument");if(this._ended)return a(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},AbstractIterator.prototype._end=function(e){a(e)},AbstractIterator.prototype._nextTick=a,e.exports=AbstractIterator},(e,t,r)=>{e.exports=r(602)},(e,t,r)=>{"use strict";var a,n,o,c=[r(1007),r(1328),r(1329),r(1330),r(1331),r(1332)],s=-1,d=[],u=!1;function cleanUpNextTick(){a&&n&&(a=!1,n.length?d=n.concat(d):s=-1,d.length&&nextTick())}function nextTick(){if(!a){u=!1,a=!0;for(var e=d.length,t=setTimeout(cleanUpNextTick);e;){for(n=d,d=[];n&&++s1)for(var r=1;r{var a=r(601);function AbstractChainedBatch(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._operations=[],this._written=!1}AbstractChainedBatch.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},AbstractChainedBatch.prototype.put=function(e,t){this._checkWritten();var r=this.db._checkKey(e)||this.db._checkValue(t);if(r)throw r;return e=this.db._serializeKey(e),t=this.db._serializeValue(t),this._put(e,t),this},AbstractChainedBatch.prototype._put=function(e,t){this._operations.push({type:"put",key:e,value:t})},AbstractChainedBatch.prototype.del=function(e){this._checkWritten();var t=this.db._checkKey(e);if(t)throw t;return e=this.db._serializeKey(e),this._del(e),this},AbstractChainedBatch.prototype._del=function(e){this._operations.push({type:"del",key:e})},AbstractChainedBatch.prototype.clear=function(){return this._checkWritten(),this._clear(),this},AbstractChainedBatch.prototype._clear=function(){this._operations=[]},AbstractChainedBatch.prototype.write=function(e,t){if(this._checkWritten(),"function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("write() requires a callback argument");"object"==typeof e&&null!==e||(e={}),this._written=!0,this._write(e,t)},AbstractChainedBatch.prototype._write=function(e,t){this.db._batch(this._operations,e,t)},AbstractChainedBatch.prototype._nextTick=a,e.exports=AbstractChainedBatch},e=>{e.exports=function promisify(){var e,t=new Promise((function(t,r){e=function callback(e,a){e?r(e):t(a)}}));return e.promise=t,e}},(e,t,r)=>{var a=r(606);function AbstractIterator(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._ended=!1,this._nexting=!1}AbstractIterator.prototype.next=function(e){var t=this;if("function"!=typeof e)throw new Error("next() requires a callback argument");return t._ended?(a(e,new Error("cannot call next() after end()")),t):t._nexting?(a(e,new Error("cannot call next() before previous next() has completed")),t):(t._nexting=!0,t._next((function(){t._nexting=!1,e.apply(null,arguments)})),t)},AbstractIterator.prototype._next=function(e){a(e)},AbstractIterator.prototype.seek=function(e){if(this._ended)throw new Error("cannot call seek() after end()");if(this._nexting)throw new Error("cannot call seek() before next() has completed");e=this.db._serializeKey(e),this._seek(e)},AbstractIterator.prototype._seek=function(e){},AbstractIterator.prototype.end=function(e){if("function"!=typeof e)throw new Error("end() requires a callback argument");if(this._ended)return a(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},AbstractIterator.prototype._end=function(e){a(e)},AbstractIterator.prototype._nextTick=a,e.exports=AbstractIterator},(e,t,r)=>{e.exports=r(602)},(e,t,r)=>{var a=r(606);function AbstractChainedBatch(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._operations=[],this._written=!1}AbstractChainedBatch.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},AbstractChainedBatch.prototype.put=function(e,t){this._checkWritten();var r=this.db._checkKey(e)||this.db._checkValue(t);if(r)throw r;return e=this.db._serializeKey(e),t=this.db._serializeValue(t),this._put(e,t),this},AbstractChainedBatch.prototype._put=function(e,t){this._operations.push({type:"put",key:e,value:t})},AbstractChainedBatch.prototype.del=function(e){this._checkWritten();var t=this.db._checkKey(e);if(t)throw t;return e=this.db._serializeKey(e),this._del(e),this},AbstractChainedBatch.prototype._del=function(e){this._operations.push({type:"del",key:e})},AbstractChainedBatch.prototype.clear=function(){return this._checkWritten(),this._clear(),this},AbstractChainedBatch.prototype._clear=function(){this._operations=[]},AbstractChainedBatch.prototype.write=function(e,t){if(this._checkWritten(),"function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("write() requires a callback argument");"object"==typeof e&&null!==e||(e={}),this._written=!0,this._write(e,t)},AbstractChainedBatch.prototype._write=function(e,t){this.db._batch(this._operations,e,t)},AbstractChainedBatch.prototype._nextTick=a,e.exports=AbstractChainedBatch},(e,t,r)=>{var a=r(0).Buffer;t.utf8=t["utf-8"]={encode:function(e){return isBinary(e)?e:String(e)},decode:identity,buffer:!1,type:"utf8"},t.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"},t.binary={encode:function(e){return isBinary(e)?e:a.from(e)},decode:identity,buffer:!0,type:"binary"},t.none={encode:identity,decode:identity,buffer:!1,type:"id"},t.id=t.none;function identity(e){return e}function isBinary(e){return null==e||a.isBuffer(e)}["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"].forEach((function(e){t[e]={encode:function(t){return isBinary(t)?t:a.from(t,e)},decode:function(t){return t.toString(e)},buffer:!0,type:e}}))},(e,t,r)=>{var a=r(610);function AbstractIterator(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._ended=!1,this._nexting=!1}AbstractIterator.prototype.next=function(e){var t=this;if("function"!=typeof e)throw new Error("next() requires a callback argument");return t._ended?(a(e,new Error("cannot call next() after end()")),t):t._nexting?(a(e,new Error("cannot call next() before previous next() has completed")),t):(t._nexting=!0,t._next((function(){t._nexting=!1,e.apply(null,arguments)})),t)},AbstractIterator.prototype._next=function(e){a(e)},AbstractIterator.prototype.seek=function(e){if(this._ended)throw new Error("cannot call seek() after end()");if(this._nexting)throw new Error("cannot call seek() before next() has completed");e=this.db._serializeKey(e),this._seek(e)},AbstractIterator.prototype._seek=function(e){},AbstractIterator.prototype.end=function(e){if("function"!=typeof e)throw new Error("end() requires a callback argument");if(this._ended)return a(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},AbstractIterator.prototype._end=function(e){a(e)},AbstractIterator.prototype._nextTick=a,e.exports=AbstractIterator},(e,t,r)=>{e.exports=r(611)},(e,t,r)=>{"use strict";var a,n,o,c=[r(1333),r(1334),r(1335),r(1336),r(1337)],s=-1,d=[],u=!1;function cleanUpNextTick(){a&&n&&(a=!1,n.length?d=n.concat(d):s=-1,d.length&&nextTick())}function nextTick(){if(!a){u=!1,a=!0;for(var e=d.length,t=setTimeout(cleanUpNextTick);e;){for(n=d,d=[];n&&++s1)for(var r=1;r{var a=r(610);function AbstractChainedBatch(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._operations=[],this._written=!1}AbstractChainedBatch.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},AbstractChainedBatch.prototype.put=function(e,t){this._checkWritten();var r=this.db._checkKey(e)||this.db._checkValue(t);if(r)throw r;return e=this.db._serializeKey(e),t=this.db._serializeValue(t),this._put(e,t),this},AbstractChainedBatch.prototype._put=function(e,t){this._operations.push({type:"put",key:e,value:t})},AbstractChainedBatch.prototype.del=function(e){this._checkWritten();var t=this.db._checkKey(e);if(t)throw t;return e=this.db._serializeKey(e),this._del(e),this},AbstractChainedBatch.prototype._del=function(e){this._operations.push({type:"del",key:e})},AbstractChainedBatch.prototype.clear=function(){return this._checkWritten(),this._clear(),this},AbstractChainedBatch.prototype._clear=function(){this._operations=[]},AbstractChainedBatch.prototype.write=function(e,t){if(this._checkWritten(),"function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("write() requires a callback argument");"object"==typeof e&&null!==e||(e={}),this._written=!0,this._write(e,t)},AbstractChainedBatch.prototype._write=function(e,t){this.db._batch(this._operations,e,t)},AbstractChainedBatch.prototype._nextTick=a,e.exports=AbstractChainedBatch},(e,t,r)=>{"use strict";var a=r(0).Buffer;function matchingNibbleLength(e,t){for(var r=0;e[r]===t[r]&&e.length>r;)r++;return r}Object.defineProperty(t,"__esModule",{value:!0}),t.doKeysMatch=t.matchingNibbleLength=t.nibblesToBuffer=t.bufferToNibbles=void 0,t.bufferToNibbles=function bufferToNibbles(e){for(var t=a.from(e),r=[],n=0;n>4,r[++o]=t[n]%16}return r},t.nibblesToBuffer=function nibblesToBuffer(e){for(var t=a.alloc(e.length/2),r=0;r{e.exports=function extend(){for(var e={},r=0;r{var a=r(616);function AbstractIterator(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._ended=!1,this._nexting=!1}AbstractIterator.prototype.next=function(e){var t=this;if("function"!=typeof e)throw new Error("next() requires a callback argument");return t._ended?(a(e,new Error("cannot call next() after end()")),t):t._nexting?(a(e,new Error("cannot call next() before previous next() has completed")),t):(t._nexting=!0,t._next((function(){t._nexting=!1,e.apply(null,arguments)})),t)},AbstractIterator.prototype._next=function(e){a(e)},AbstractIterator.prototype.seek=function(e){if(this._ended)throw new Error("cannot call seek() after end()");if(this._nexting)throw new Error("cannot call seek() before next() has completed");e=this.db._serializeKey(e),this._seek(e)},AbstractIterator.prototype._seek=function(e){},AbstractIterator.prototype.end=function(e){if("function"!=typeof e)throw new Error("end() requires a callback argument");if(this._ended)return a(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)},AbstractIterator.prototype._end=function(e){a(e)},AbstractIterator.prototype._nextTick=a,e.exports=AbstractIterator},(e,t,r)=>{e.exports=r(1023)},(e,t,r)=>{var a=r(616);function AbstractChainedBatch(e){if("object"!=typeof e||null===e)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._operations=[],this._written=!1}AbstractChainedBatch.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")},AbstractChainedBatch.prototype.put=function(e,t){this._checkWritten();var r=this.db._checkKey(e)||this.db._checkValue(t);if(r)throw r;return e=this.db._serializeKey(e),t=this.db._serializeValue(t),this._put(e,t),this},AbstractChainedBatch.prototype._put=function(e,t){this._operations.push({type:"put",key:e,value:t})},AbstractChainedBatch.prototype.del=function(e){this._checkWritten();var t=this.db._checkKey(e);if(t)throw t;return e=this.db._serializeKey(e),this._del(e),this},AbstractChainedBatch.prototype._del=function(e){this._operations.push({type:"del",key:e})},AbstractChainedBatch.prototype.clear=function(){return this._checkWritten(),this._clear(),this},AbstractChainedBatch.prototype._clear=function(){this._operations=[]},AbstractChainedBatch.prototype.write=function(e,t){if(this._checkWritten(),"function"==typeof e&&(t=e),"function"!=typeof t)throw new Error("write() requires a callback argument");"object"==typeof e&&null!==e||(e={}),this._written=!0,this._write(e,t)},AbstractChainedBatch.prototype._write=function(e,t){this.db._batch(this._operations,e,t)},AbstractChainedBatch.prototype._nextTick=a,e.exports=AbstractChainedBatch},(e,t,r)=>{"use strict";var a=r(292),n={};e.exports=function createKeyRange(e){var t=a.lowerBound(e,n),r=a.upperBound(e,n),o=a.lowerBoundExclusive(e,n),c=a.upperBoundExclusive(e,n);return t!==n&&r!==n?IDBKeyRange.bound(t,r,o,c):t!==n?IDBKeyRange.lowerBound(t,o):r!==n?IDBKeyRange.upperBound(r,c):null}},(e,t,r)=>{"use strict";var a=r(382).a,n=function(){if(r.g.TextDecoder){var e=new TextDecoder("utf-8");return e.decode.bind(e)}return function ta2str(e){return ta2buf(e).toString()}}(),o=function(){if(r.g.TextDecoder){var e=new TextDecoder("utf-8");return e.decode.bind(e)}return function ab2str(e){return a.from(e).toString()}}();function ta2buf(e){var t=a.from(e.buffer);return e.byteLength===e.buffer.byteLength?t:t.slice(e.byteOffset,e.byteOffset+e.byteLength)}e.exports=function(e,t){return e instanceof Uint8Array?t?ta2buf(e):n(e):e instanceof ArrayBuffer?t?a.from(e):o(e):t?a.from(String(e)):String(e)}},(e,t)=>{var r;r=function(e){e.version="1.2.0";var t=function signed_crc_table(){for(var e=0,t=new Array(256),r=0;256!=r;++r)e=1&(e=1&(e=1&(e=1&(e=1&(e=1&(e=1&(e=1&(e=r)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1)?-306674912^e>>>1:e>>>1,t[r]=e;return"undefined"!=typeof Int32Array?new Int32Array(t):t}();e.table=t,e.bstr=function crc32_bstr(e,r){for(var a=-1^r,n=e.length-1,o=0;o>>8^t[255&(a^e.charCodeAt(o++))])>>>8^t[255&(a^e.charCodeAt(o++))];return o===n&&(a=a>>>8^t[255&(a^e.charCodeAt(o))]),-1^a},e.buf=function crc32_buf(e,r){if(e.length>1e4)return function crc32_buf_8(e,r){for(var a=-1^r,n=e.length-7,o=0;o>>8^t[255&(a^e[o++])])>>>8^t[255&(a^e[o++])])>>>8^t[255&(a^e[o++])])>>>8^t[255&(a^e[o++])])>>>8^t[255&(a^e[o++])])>>>8^t[255&(a^e[o++])])>>>8^t[255&(a^e[o++])])>>>8^t[255&(a^e[o++])];for(;o>>8^t[255&(a^e[o++])];return-1^a}(e,r);for(var a=-1^r,n=e.length-3,o=0;o>>8^t[255&(a^e[o++])])>>>8^t[255&(a^e[o++])])>>>8^t[255&(a^e[o++])])>>>8^t[255&(a^e[o++])];for(;o>>8^t[255&(a^e[o++])];return-1^a},e.str=function crc32_str(e,r){for(var a,n,o=-1^r,c=0,s=e.length;c>>8^t[255&(o^a)]:a<2048?o=(o=o>>>8^t[255&(o^(192|a>>6&31))])>>>8^t[255&(o^(128|63&a))]:a>=55296&&a<57344?(a=64+(1023&a),n=1023&e.charCodeAt(c++),o=(o=(o=(o=o>>>8^t[255&(o^(240|a>>8&7))])>>>8^t[255&(o^(128|a>>2&63))])>>>8^t[255&(o^(128|n>>6&15|(3&a)<<4))])>>>8^t[255&(o^(128|63&n))]):o=(o=(o=o>>>8^t[255&(o^(224|a>>12&15))])>>>8^t[255&(o^(128|a>>6&63))])>>>8^t[255&(o^(128|63&a))];return-1^o}},"undefined"==typeof DO_NOT_EXPORT_CRC?r(t):r({})},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Address=void 0;var o=n(r(6)),c=n(r(12)),s=r(85),d=r(37),u=function(){function Address(e){o.default(20===e.length,"Invalid address length"),this.buf=e}return Address.zero=function(){return new Address(s.zeros(20))},Address.fromString=function(e){return o.default(d.isValidAddress(e),"Invalid address"),new Address(s.toBuffer(e))},Address.fromPublicKey=function(e){return o.default(a.isBuffer(e),"Public key should be Buffer"),new Address(d.pubToAddress(e))},Address.fromPrivateKey=function(e){return o.default(a.isBuffer(e),"Private key should be Buffer"),new Address(d.privateToAddress(e))},Address.generate=function(e,t){return o.default(c.default.isBN(t)),new Address(d.generateAddress(e.buf,t.toArrayLike(a)))},Address.generate2=function(e,t,r){return o.default(a.isBuffer(t)),o.default(a.isBuffer(r)),new Address(d.generateAddress2(e.buf,t,r))},Address.prototype.equals=function(e){return this.buf.equals(e.buf)},Address.prototype.isZero=function(){return this.equals(Address.zero())},Address.prototype.isPrecompileOrSystemAddress=function(){var e=new c.default(this.buf),t=new c.default(0),r=new c.default("ffff","hex");return e.gte(t)&&e.lte(r)},Address.prototype.toString=function(){return"0x"+this.buf.toString("hex")},Address.prototype.toBuffer=function(){return a.from(this.buf)},Address}();t.Address=u},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.hashPersonalMessage=t.isValidSignature=t.fromRpcSig=t.toCompactSig=t.toRpcSig=t.ecrecover=t.ecsign=void 0;var o=r(50),c=n(r(12)),s=r(85),d=r(67),u=r(384),h=r(251);function calculateSigRecovery(e,t){var r=h.toType(e,h.TypeOutput.BN);if(!t)return r.subn(27);var a=h.toType(t,h.TypeOutput.BN);return r.sub(a.muln(2).addn(35))}function isValidSigRecovery(e){var t=new c.default(e);return t.eqn(0)||t.eqn(1)}t.ecsign=function ecsign(e,t,r){var n=o.ecdsaSign(e,t),c=n.signature,s=n.recid,d=a.from(c.slice(0,32)),u=a.from(c.slice(32,64));if(!r||"number"==typeof r){if(r&&!Number.isSafeInteger(r))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");return{r:d,s:u,v:r?s+(2*r+35):s+27}}return{r:d,s:u,v:h.toType(r,h.TypeOutput.BN).muln(2).addn(35).addn(s).toArrayLike(a)}},t.ecrecover=function(e,t,r,n,c){var d=a.concat([s.setLengthLeft(r,32),s.setLengthLeft(n,32)],64),u=calculateSigRecovery(t,c);if(!isValidSigRecovery(u))throw new Error("Invalid signature v value");var h=o.ecdsaRecover(d,u.toNumber(),e);return a.from(o.publicKeyConvert(h,!1).slice(1))},t.toRpcSig=function(e,t,r,n){if(!isValidSigRecovery(calculateSigRecovery(e,n)))throw new Error("Invalid signature v value");return s.bufferToHex(a.concat([s.setLengthLeft(t,32),s.setLengthLeft(r,32),s.toBuffer(e)]))},t.toCompactSig=function(e,t,r,n){if(!isValidSigRecovery(calculateSigRecovery(e,n)))throw new Error("Invalid signature v value");var o=h.toType(e,h.TypeOutput.Number),c=r;return(o>28&&o%2==1||1===o||28===o)&&((c=a.from(r))[0]|=128),s.bufferToHex(a.concat([s.setLengthLeft(t,32),s.setLengthLeft(c,32)]))},t.fromRpcSig=function(e){var t,r,a,n=s.toBuffer(e);if(n.length>=65)t=n.slice(0,32),r=n.slice(32,64),a=s.bufferToInt(n.slice(64));else{if(64!==n.length)throw new Error("Invalid signature length");t=n.slice(0,32),r=n.slice(32,64),a=s.bufferToInt(n.slice(32,33))>>7,r[0]&=127}return a<27&&(a+=27),{v:a,r:t,s:r}},t.isValidSignature=function(e,t,r,a,n){void 0===a&&(a=!0);var o=new c.default("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),s=new c.default("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(32!==t.length||32!==r.length)return!1;if(!isValidSigRecovery(calculateSigRecovery(e,n)))return!1;var d=new c.default(t),u=new c.default(r);return!(d.isZero()||d.gt(s)||u.isZero()||u.gt(s))&&(!a||1!==u.cmp(o))},t.hashPersonalMessage=function(e){u.assertIsBuffer(e);var t=a.from("Ethereum Signed Message:\n"+e.length.toString(),"utf-8");return d.keccak(a.concat([t,e]))}},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Address=void 0;var o=n(r(6)),c=n(r(12)),s=r(87),d=r(38),u=function(){function Address(e){o.default(20===e.length,"Invalid address length"),this.buf=e}return Address.zero=function(){return new Address(s.zeros(20))},Address.fromString=function(e){return o.default(d.isValidAddress(e),"Invalid address"),new Address(s.toBuffer(e))},Address.fromPublicKey=function(e){return o.default(a.isBuffer(e),"Public key should be Buffer"),new Address(d.pubToAddress(e))},Address.fromPrivateKey=function(e){return o.default(a.isBuffer(e),"Private key should be Buffer"),new Address(d.privateToAddress(e))},Address.generate=function(e,t){return o.default(c.default.isBN(t)),new Address(d.generateAddress(e.buf,t.toArrayLike(a)))},Address.generate2=function(e,t,r){return o.default(a.isBuffer(t)),o.default(a.isBuffer(r)),new Address(d.generateAddress2(e.buf,t,r))},Address.prototype.equals=function(e){return this.buf.equals(e.buf)},Address.prototype.isZero=function(){return this.equals(Address.zero())},Address.prototype.isPrecompileOrSystemAddress=function(){var e=new c.default(this.buf),t=new c.default(0),r=new c.default("ffff","hex");return e.gte(t)&&e.lte(r)},Address.prototype.toString=function(){return"0x"+this.buf.toString("hex")},Address.prototype.toBuffer=function(){return a.from(this.buf)},Address}();t.Address=u},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.hashPersonalMessage=t.isValidSignature=t.fromRpcSig=t.toCompactSig=t.toRpcSig=t.ecrecover=t.ecsign=void 0;var o=r(50),c=n(r(12)),s=r(87),d=r(68),u=r(385),h=r(252);function calculateSigRecovery(e,t){var r=h.toType(e,h.TypeOutput.BN);if(!t)return r.subn(27);var a=h.toType(t,h.TypeOutput.BN);return r.sub(a.muln(2).addn(35))}function isValidSigRecovery(e){var t=new c.default(e);return t.eqn(0)||t.eqn(1)}t.ecsign=function ecsign(e,t,r){var n=o.ecdsaSign(e,t),c=n.signature,s=n.recid,d=a.from(c.slice(0,32)),u=a.from(c.slice(32,64));if(!r||"number"==typeof r){if(r&&!Number.isSafeInteger(r))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");return{r:d,s:u,v:r?s+(2*r+35):s+27}}return{r:d,s:u,v:h.toType(r,h.TypeOutput.BN).muln(2).addn(35).addn(s).toArrayLike(a)}},t.ecrecover=function(e,t,r,n,c){var d=a.concat([s.setLengthLeft(r,32),s.setLengthLeft(n,32)],64),u=calculateSigRecovery(t,c);if(!isValidSigRecovery(u))throw new Error("Invalid signature v value");var h=o.ecdsaRecover(d,u.toNumber(),e);return a.from(o.publicKeyConvert(h,!1).slice(1))},t.toRpcSig=function(e,t,r,n){if(!isValidSigRecovery(calculateSigRecovery(e,n)))throw new Error("Invalid signature v value");return s.bufferToHex(a.concat([s.setLengthLeft(t,32),s.setLengthLeft(r,32),s.toBuffer(e)]))},t.toCompactSig=function(e,t,r,n){if(!isValidSigRecovery(calculateSigRecovery(e,n)))throw new Error("Invalid signature v value");var o=h.toType(e,h.TypeOutput.Number),c=r;return(o>28&&o%2==1||1===o||28===o)&&((c=a.from(r))[0]|=128),s.bufferToHex(a.concat([s.setLengthLeft(t,32),s.setLengthLeft(c,32)]))},t.fromRpcSig=function(e){var t,r,a,n=s.toBuffer(e);if(n.length>=65)t=n.slice(0,32),r=n.slice(32,64),a=s.bufferToInt(n.slice(64));else{if(64!==n.length)throw new Error("Invalid signature length");t=n.slice(0,32),r=n.slice(32,64),a=s.bufferToInt(n.slice(32,33))>>7,r[0]&=127}return a<27&&(a+=27),{v:a,r:t,s:r}},t.isValidSignature=function(e,t,r,a,n){void 0===a&&(a=!0);var o=new c.default("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),s=new c.default("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(32!==t.length||32!==r.length)return!1;if(!isValidSigRecovery(calculateSigRecovery(e,n)))return!1;var d=new c.default(t),u=new c.default(r);return!(d.isZero()||d.gt(s)||u.isZero()||u.gt(s))&&(!a||1!==u.cmp(o))},t.hashPersonalMessage=function(e){u.assertIsBuffer(e);var t=a.from("Ethereum Signed Message:\n"+e.length.toString(),"utf-8");return d.keccak(a.concat([t,e]))}},function(e,t,r){!function(e,t){"use strict";function assert(e,t){if(!e)throw new Error(t||"Assertion failed")}function inherits(e,t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype,e.prototype=new TempCtor,e.prototype.constructor=e}function BN(e,t,r){if(BN.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=BN:t.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(18).Buffer}catch(e){}function parseHex4Bits(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function parseHexByte(e,t,r){var a=parseHex4Bits(e,r);return r-1>=t&&(a|=parseHex4Bits(e,r-1)<<4),a}function parseBase(e,t,r,a){for(var n=0,o=Math.min(e.length,r),c=t;c=49?s-49+10:s>=17?s-17+10:s}return n}BN.isBN=function isBN(e){return e instanceof BN||null!==e&&"object"==typeof e&&e.constructor.wordSize===BN.wordSize&&Array.isArray(e.words)},BN.max=function max(e,t){return e.cmp(t)>0?e:t},BN.min=function min(e,t){return e.cmp(t)<0?e:t},BN.prototype._init=function init(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),assert(t===(0|t)&&t>=2&&t<=36);var a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[n]|=o<>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);else if("le"===r)for(a=0,n=0;a>>26-c&67108863,(c+=24)>=26&&(c-=26,n++);return this.strip()},BN.prototype._parseHex=function _parseHex(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var a=0;a=t;a-=2)n=parseHexByte(e,t,a)<=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;else for(a=(e.length-t)%2==0?t+1:t;a=18?(o-=18,c+=1,this.words[c]|=n>>>26):o+=8;this.strip()},BN.prototype._parseBase=function _parseBase(e,t,r){this.words=[0],this.length=1;for(var a=0,n=1;n<=67108863;n*=t)a++;a--,n=n/t|0;for(var o=e.length-r,c=o%a,s=Math.min(o,o-c)+r,d=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?""};var n=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],o=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function smallMulTo(e,t,r){r.negative=t.negative^e.negative;var a=e.length+t.length|0;r.length=a,a=a-1|0;var n=0|e.words[0],o=0|t.words[0],c=n*o,s=67108863&c,d=c/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&d,b=Math.min(u,t.length-1),g=Math.max(0,u-e.length+1);g<=b;g++){var p=u-g|0;h+=(c=(n=0|e.words[p])*(o=0|t.words[g])+l)/67108864|0,l=67108863&c}r.words[u]=0|l,d=0|h}return 0!==d?r.words[u]=0|d:r.length--,r.strip()}BN.prototype.toString=function toString(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,s=0,d=0;d>>24-a&16777215)||d!==this.length-1?n[6-h.length]+h+r:h+r,(a+=2)>=26&&(a-=26,d--)}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=o[e],b=c[e];r="";var g=this.clone();for(g.negative=0;!g.isZero();){var p=g.modn(b).toString(e);r=(g=g.idivn(b)).isZero()?p+r:n[l-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(e,t){return assert(void 0!==a),this.toArrayLike(a,e,t)},BN.prototype.toArray=function toArray(e,t){return this.toArrayLike(Array,e,t)},BN.prototype.toArrayLike=function toArrayLike(e,t,r){var a=this.byteLength(),n=r||Math.max(1,a);assert(a<=n,"byte array longer than desired length"),assert(n>0,"Requested array length <= 0"),this.strip();var o,c,s="le"===t,d=new e(n),u=this.clone();if(s){for(c=0;!u.isZero();c++)o=u.andln(255),u.iushrn(8),d[c]=o;for(;c=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},BN.prototype._zeroBits=function _zeroBits(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},BN.prototype.bitLength=function bitLength(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},BN.prototype.uor=function uor(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},BN.prototype.iuand=function iuand(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},BN.prototype.uand=function uand(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},BN.prototype.iuxor=function iuxor(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var a=0;ae.length?this.clone().ixor(e):e.clone().ixor(this)},BN.prototype.uxor=function uxor(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},BN.prototype.inotn=function inotn(e){assert("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},BN.prototype.notn=function notn(e){return this.clone().inotn(e)},BN.prototype.setn=function setn(e,t){assert("number"==typeof e&&e>=0);var r=e/26|0,a=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,a=e):(r=e,a=this);for(var n=0,o=0;o>>26;for(;0!==n&&o>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},BN.prototype.isub=function isub(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,a,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,a=e):(r=e,a=this);for(var o=0,c=0;c>26,this.words[c]=67108863&t;for(;0!==o&&c>26,this.words[c]=67108863&t;if(0===o&&c>>13,g=0|c[1],p=8191&g,B=g>>>13,m=0|c[2],I=8191&m,y=m>>>13,x=0|c[3],C=8191&x,v=x>>>13,Q=0|c[4],w=8191&Q,_=Q>>>13,k=0|c[5],N=8191&k,D=k>>>13,U=0|c[6],G=8191&U,T=U>>>13,L=0|c[7],q=8191&L,P=L>>>13,O=0|c[8],H=8191&O,Y=O>>>13,J=0|c[9],j=8191&J,z=J>>>13,W=0|s[0],V=8191&W,X=W>>>13,$=0|s[1],et=8191&$,tt=$>>>13,rt=0|s[2],at=8191&rt,it=rt>>>13,nt=0|s[3],ot=8191&nt,At=nt>>>13,ct=0|s[4],st=8191&ct,dt=ct>>>13,ut=0|s[5],ht=8191&ut,bt=ut>>>13,pt=0|s[6],Bt=8191&pt,mt=pt>>>13,It=0|s[7],Et=8191&It,yt=It>>>13,xt=0|s[8],Ct=8191&xt,vt=xt>>>13,Qt=0|s[9],wt=8191&Qt,Mt=Qt>>>13;r.negative=e.negative^t.negative,r.length=19;var _t=(u+(a=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(b,V)|0))<<13)|0;u=((o=Math.imul(b,X))+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,a=Math.imul(p,V),n=(n=Math.imul(p,X))+Math.imul(B,V)|0,o=Math.imul(B,X);var kt=(u+(a=a+Math.imul(l,et)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(b,et)|0))<<13)|0;u=((o=o+Math.imul(b,tt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,a=Math.imul(I,V),n=(n=Math.imul(I,X))+Math.imul(y,V)|0,o=Math.imul(y,X),a=a+Math.imul(p,et)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(B,et)|0,o=o+Math.imul(B,tt)|0;var St=(u+(a=a+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(b,at)|0))<<13)|0;u=((o=o+Math.imul(b,it)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,a=Math.imul(C,V),n=(n=Math.imul(C,X))+Math.imul(v,V)|0,o=Math.imul(v,X),a=a+Math.imul(I,et)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(y,et)|0,o=o+Math.imul(y,tt)|0,a=a+Math.imul(p,at)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(B,at)|0,o=o+Math.imul(B,it)|0;var Nt=(u+(a=a+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,At)|0)+Math.imul(b,ot)|0))<<13)|0;u=((o=o+Math.imul(b,At)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,a=Math.imul(w,V),n=(n=Math.imul(w,X))+Math.imul(_,V)|0,o=Math.imul(_,X),a=a+Math.imul(C,et)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(v,et)|0,o=o+Math.imul(v,tt)|0,a=a+Math.imul(I,at)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(y,at)|0,o=o+Math.imul(y,it)|0,a=a+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,At)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,At)|0;var Dt=(u+(a=a+Math.imul(l,st)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(b,st)|0))<<13)|0;u=((o=o+Math.imul(b,dt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,a=Math.imul(N,V),n=(n=Math.imul(N,X))+Math.imul(D,V)|0,o=Math.imul(D,X),a=a+Math.imul(w,et)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,et)|0,o=o+Math.imul(_,tt)|0,a=a+Math.imul(C,at)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(v,at)|0,o=o+Math.imul(v,it)|0,a=a+Math.imul(I,ot)|0,n=(n=n+Math.imul(I,At)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,At)|0,a=a+Math.imul(p,st)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(B,st)|0,o=o+Math.imul(B,dt)|0;var Rt=(u+(a=a+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,bt)|0)+Math.imul(b,ht)|0))<<13)|0;u=((o=o+Math.imul(b,bt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,a=Math.imul(G,V),n=(n=Math.imul(G,X))+Math.imul(T,V)|0,o=Math.imul(T,X),a=a+Math.imul(N,et)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(D,et)|0,o=o+Math.imul(D,tt)|0,a=a+Math.imul(w,at)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,at)|0,o=o+Math.imul(_,it)|0,a=a+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,At)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,At)|0,a=a+Math.imul(I,st)|0,n=(n=n+Math.imul(I,dt)|0)+Math.imul(y,st)|0,o=o+Math.imul(y,dt)|0,a=a+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,bt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,bt)|0;var Ft=(u+(a=a+Math.imul(l,Bt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(b,Bt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,a=Math.imul(q,V),n=(n=Math.imul(q,X))+Math.imul(P,V)|0,o=Math.imul(P,X),a=a+Math.imul(G,et)|0,n=(n=n+Math.imul(G,tt)|0)+Math.imul(T,et)|0,o=o+Math.imul(T,tt)|0,a=a+Math.imul(N,at)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(D,at)|0,o=o+Math.imul(D,it)|0,a=a+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,At)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,At)|0,a=a+Math.imul(C,st)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(v,st)|0,o=o+Math.imul(v,dt)|0,a=a+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,bt)|0)+Math.imul(y,ht)|0,o=o+Math.imul(y,bt)|0,a=a+Math.imul(p,Bt)|0,n=(n=n+Math.imul(p,mt)|0)+Math.imul(B,Bt)|0,o=o+Math.imul(B,mt)|0;var Ut=(u+(a=a+Math.imul(l,Et)|0)|0)+((8191&(n=(n=n+Math.imul(l,yt)|0)+Math.imul(b,Et)|0))<<13)|0;u=((o=o+Math.imul(b,yt)|0)+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,a=Math.imul(H,V),n=(n=Math.imul(H,X))+Math.imul(Y,V)|0,o=Math.imul(Y,X),a=a+Math.imul(q,et)|0,n=(n=n+Math.imul(q,tt)|0)+Math.imul(P,et)|0,o=o+Math.imul(P,tt)|0,a=a+Math.imul(G,at)|0,n=(n=n+Math.imul(G,it)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,it)|0,a=a+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,At)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,At)|0,a=a+Math.imul(w,st)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,st)|0,o=o+Math.imul(_,dt)|0,a=a+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,bt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,bt)|0,a=a+Math.imul(I,Bt)|0,n=(n=n+Math.imul(I,mt)|0)+Math.imul(y,Bt)|0,o=o+Math.imul(y,mt)|0,a=a+Math.imul(p,Et)|0,n=(n=n+Math.imul(p,yt)|0)+Math.imul(B,Et)|0,o=o+Math.imul(B,yt)|0;var Gt=(u+(a=a+Math.imul(l,Ct)|0)|0)+((8191&(n=(n=n+Math.imul(l,vt)|0)+Math.imul(b,Ct)|0))<<13)|0;u=((o=o+Math.imul(b,vt)|0)+(n>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,a=Math.imul(j,V),n=(n=Math.imul(j,X))+Math.imul(z,V)|0,o=Math.imul(z,X),a=a+Math.imul(H,et)|0,n=(n=n+Math.imul(H,tt)|0)+Math.imul(Y,et)|0,o=o+Math.imul(Y,tt)|0,a=a+Math.imul(q,at)|0,n=(n=n+Math.imul(q,it)|0)+Math.imul(P,at)|0,o=o+Math.imul(P,it)|0,a=a+Math.imul(G,ot)|0,n=(n=n+Math.imul(G,At)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,At)|0,a=a+Math.imul(N,st)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(D,st)|0,o=o+Math.imul(D,dt)|0,a=a+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,bt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,bt)|0,a=a+Math.imul(C,Bt)|0,n=(n=n+Math.imul(C,mt)|0)+Math.imul(v,Bt)|0,o=o+Math.imul(v,mt)|0,a=a+Math.imul(I,Et)|0,n=(n=n+Math.imul(I,yt)|0)+Math.imul(y,Et)|0,o=o+Math.imul(y,yt)|0,a=a+Math.imul(p,Ct)|0,n=(n=n+Math.imul(p,vt)|0)+Math.imul(B,Ct)|0,o=o+Math.imul(B,vt)|0;var Tt=(u+(a=a+Math.imul(l,wt)|0)|0)+((8191&(n=(n=n+Math.imul(l,Mt)|0)+Math.imul(b,wt)|0))<<13)|0;u=((o=o+Math.imul(b,Mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,a=Math.imul(j,et),n=(n=Math.imul(j,tt))+Math.imul(z,et)|0,o=Math.imul(z,tt),a=a+Math.imul(H,at)|0,n=(n=n+Math.imul(H,it)|0)+Math.imul(Y,at)|0,o=o+Math.imul(Y,it)|0,a=a+Math.imul(q,ot)|0,n=(n=n+Math.imul(q,At)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,At)|0,a=a+Math.imul(G,st)|0,n=(n=n+Math.imul(G,dt)|0)+Math.imul(T,st)|0,o=o+Math.imul(T,dt)|0,a=a+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,bt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,bt)|0,a=a+Math.imul(w,Bt)|0,n=(n=n+Math.imul(w,mt)|0)+Math.imul(_,Bt)|0,o=o+Math.imul(_,mt)|0,a=a+Math.imul(C,Et)|0,n=(n=n+Math.imul(C,yt)|0)+Math.imul(v,Et)|0,o=o+Math.imul(v,yt)|0,a=a+Math.imul(I,Ct)|0,n=(n=n+Math.imul(I,vt)|0)+Math.imul(y,Ct)|0,o=o+Math.imul(y,vt)|0;var Lt=(u+(a=a+Math.imul(p,wt)|0)|0)+((8191&(n=(n=n+Math.imul(p,Mt)|0)+Math.imul(B,wt)|0))<<13)|0;u=((o=o+Math.imul(B,Mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,a=Math.imul(j,at),n=(n=Math.imul(j,it))+Math.imul(z,at)|0,o=Math.imul(z,it),a=a+Math.imul(H,ot)|0,n=(n=n+Math.imul(H,At)|0)+Math.imul(Y,ot)|0,o=o+Math.imul(Y,At)|0,a=a+Math.imul(q,st)|0,n=(n=n+Math.imul(q,dt)|0)+Math.imul(P,st)|0,o=o+Math.imul(P,dt)|0,a=a+Math.imul(G,ht)|0,n=(n=n+Math.imul(G,bt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,bt)|0,a=a+Math.imul(N,Bt)|0,n=(n=n+Math.imul(N,mt)|0)+Math.imul(D,Bt)|0,o=o+Math.imul(D,mt)|0,a=a+Math.imul(w,Et)|0,n=(n=n+Math.imul(w,yt)|0)+Math.imul(_,Et)|0,o=o+Math.imul(_,yt)|0,a=a+Math.imul(C,Ct)|0,n=(n=n+Math.imul(C,vt)|0)+Math.imul(v,Ct)|0,o=o+Math.imul(v,vt)|0;var qt=(u+(a=a+Math.imul(I,wt)|0)|0)+((8191&(n=(n=n+Math.imul(I,Mt)|0)+Math.imul(y,wt)|0))<<13)|0;u=((o=o+Math.imul(y,Mt)|0)+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,a=Math.imul(j,ot),n=(n=Math.imul(j,At))+Math.imul(z,ot)|0,o=Math.imul(z,At),a=a+Math.imul(H,st)|0,n=(n=n+Math.imul(H,dt)|0)+Math.imul(Y,st)|0,o=o+Math.imul(Y,dt)|0,a=a+Math.imul(q,ht)|0,n=(n=n+Math.imul(q,bt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,bt)|0,a=a+Math.imul(G,Bt)|0,n=(n=n+Math.imul(G,mt)|0)+Math.imul(T,Bt)|0,o=o+Math.imul(T,mt)|0,a=a+Math.imul(N,Et)|0,n=(n=n+Math.imul(N,yt)|0)+Math.imul(D,Et)|0,o=o+Math.imul(D,yt)|0,a=a+Math.imul(w,Ct)|0,n=(n=n+Math.imul(w,vt)|0)+Math.imul(_,Ct)|0,o=o+Math.imul(_,vt)|0;var Pt=(u+(a=a+Math.imul(C,wt)|0)|0)+((8191&(n=(n=n+Math.imul(C,Mt)|0)+Math.imul(v,wt)|0))<<13)|0;u=((o=o+Math.imul(v,Mt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a=Math.imul(j,st),n=(n=Math.imul(j,dt))+Math.imul(z,st)|0,o=Math.imul(z,dt),a=a+Math.imul(H,ht)|0,n=(n=n+Math.imul(H,bt)|0)+Math.imul(Y,ht)|0,o=o+Math.imul(Y,bt)|0,a=a+Math.imul(q,Bt)|0,n=(n=n+Math.imul(q,mt)|0)+Math.imul(P,Bt)|0,o=o+Math.imul(P,mt)|0,a=a+Math.imul(G,Et)|0,n=(n=n+Math.imul(G,yt)|0)+Math.imul(T,Et)|0,o=o+Math.imul(T,yt)|0,a=a+Math.imul(N,Ct)|0,n=(n=n+Math.imul(N,vt)|0)+Math.imul(D,Ct)|0,o=o+Math.imul(D,vt)|0;var Ot=(u+(a=a+Math.imul(w,wt)|0)|0)+((8191&(n=(n=n+Math.imul(w,Mt)|0)+Math.imul(_,wt)|0))<<13)|0;u=((o=o+Math.imul(_,Mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,a=Math.imul(j,ht),n=(n=Math.imul(j,bt))+Math.imul(z,ht)|0,o=Math.imul(z,bt),a=a+Math.imul(H,Bt)|0,n=(n=n+Math.imul(H,mt)|0)+Math.imul(Y,Bt)|0,o=o+Math.imul(Y,mt)|0,a=a+Math.imul(q,Et)|0,n=(n=n+Math.imul(q,yt)|0)+Math.imul(P,Et)|0,o=o+Math.imul(P,yt)|0,a=a+Math.imul(G,Ct)|0,n=(n=n+Math.imul(G,vt)|0)+Math.imul(T,Ct)|0,o=o+Math.imul(T,vt)|0;var Ht=(u+(a=a+Math.imul(N,wt)|0)|0)+((8191&(n=(n=n+Math.imul(N,Mt)|0)+Math.imul(D,wt)|0))<<13)|0;u=((o=o+Math.imul(D,Mt)|0)+(n>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,a=Math.imul(j,Bt),n=(n=Math.imul(j,mt))+Math.imul(z,Bt)|0,o=Math.imul(z,mt),a=a+Math.imul(H,Et)|0,n=(n=n+Math.imul(H,yt)|0)+Math.imul(Y,Et)|0,o=o+Math.imul(Y,yt)|0,a=a+Math.imul(q,Ct)|0,n=(n=n+Math.imul(q,vt)|0)+Math.imul(P,Ct)|0,o=o+Math.imul(P,vt)|0;var Yt=(u+(a=a+Math.imul(G,wt)|0)|0)+((8191&(n=(n=n+Math.imul(G,Mt)|0)+Math.imul(T,wt)|0))<<13)|0;u=((o=o+Math.imul(T,Mt)|0)+(n>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(j,Et),n=(n=Math.imul(j,yt))+Math.imul(z,Et)|0,o=Math.imul(z,yt),a=a+Math.imul(H,Ct)|0,n=(n=n+Math.imul(H,vt)|0)+Math.imul(Y,Ct)|0,o=o+Math.imul(Y,vt)|0;var Jt=(u+(a=a+Math.imul(q,wt)|0)|0)+((8191&(n=(n=n+Math.imul(q,Mt)|0)+Math.imul(P,wt)|0))<<13)|0;u=((o=o+Math.imul(P,Mt)|0)+(n>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(j,Ct),n=(n=Math.imul(j,vt))+Math.imul(z,Ct)|0,o=Math.imul(z,vt);var Kt=(u+(a=a+Math.imul(H,wt)|0)|0)+((8191&(n=(n=n+Math.imul(H,Mt)|0)+Math.imul(Y,wt)|0))<<13)|0;u=((o=o+Math.imul(Y,Mt)|0)+(n>>>13)|0)+(Kt>>>26)|0,Kt&=67108863;var jt=(u+(a=Math.imul(j,wt))|0)+((8191&(n=(n=Math.imul(j,Mt))+Math.imul(z,wt)|0))<<13)|0;return u=((o=Math.imul(z,Mt))+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,d[0]=_t,d[1]=kt,d[2]=St,d[3]=Nt,d[4]=Dt,d[5]=Rt,d[6]=Ft,d[7]=Ut,d[8]=Gt,d[9]=Tt,d[10]=Lt,d[11]=qt,d[12]=Pt,d[13]=Ot,d[14]=Ht,d[15]=Yt,d[16]=Jt,d[17]=Kt,d[18]=jt,0!==u&&(d[19]=u,r.length++),r};function jumboMulTo(e,t,r){return(new FFTM).mulp(e,t,r)}function FFTM(e,t){this.x=e,this.y=t}Math.imul||(s=smallMulTo),BN.prototype.mulTo=function mulTo(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?s(this,e,t):r<63?smallMulTo(this,e,t):r<1024?function bigMulTo(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var a=0,n=0,o=0;o>>26)|0)>>>26,c&=67108863}r.words[o]=s,a=c,c=n}return 0!==a?r.words[o]=a:r.length--,r.strip()}(this,e,t):jumboMulTo(this,e,t)},FFTM.prototype.makeRBT=function makeRBT(e){for(var t=new Array(e),r=BN.prototype._countBits(e)-1,a=0;a>=1;return a},FFTM.prototype.permute=function permute(e,t,r,a,n,o){for(var c=0;c>>=1)n++;return 1<>>=13,r[2*o+1]=8191&n,n>>>=13;for(o=2*t;o>=26,t+=a/67108864|0,t+=n>>>26,this.words[r]=67108863&n}return 0!==t&&(this.words[r]=t,this.length++),this},BN.prototype.muln=function muln(e){return this.clone().imuln(e)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(e){var t=function toBitArray(e){for(var t=new Array(e.bitLength()),r=0;r>>n}return t}(e);if(0===t.length)return new BN(1);for(var r=this,a=0;a=0);var t,r=e%26,a=(e-r)/26,n=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var n=e%26,o=Math.min((e-n)/26,this.length),c=67108863^67108863>>>n<o)for(this.length-=o,d=0;d=0&&(0!==u||d>=a);d--){var h=0|this.words[d];this.words[d]=u<<26-n|h>>>n,u=h&c}return s&&0!==u&&(s.words[s.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(e,t,r){return assert(0===this.negative),this.iushrn(e,t,r)},BN.prototype.shln=function shln(e){return this.clone().ishln(e)},BN.prototype.ushln=function ushln(e){return this.clone().iushln(e)},BN.prototype.shrn=function shrn(e){return this.clone().ishrn(e)},BN.prototype.ushrn=function ushrn(e){return this.clone().iushrn(e)},BN.prototype.testn=function testn(e){assert("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=1<=0);var t=e%26,r=(e-t)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var a=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},BN.prototype.isubn=function isubn(e){if(assert("number"==typeof e),assert(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(s/67108864|0),this.words[a+r]=67108863&n}for(;a>26,this.words[a+r]=67108863&n;if(0===c)return this.strip();for(assert(-1===c),c=0,a=0;a>26,this.words[a]=67108863&n;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(e,t){var r=(this.length,e.length),a=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),a.iushln(r),o=0|n.words[n.length-1]);var c,s=a.length-n.length;if("mod"!==t){(c=new BN(null)).length=s+1,c.words=new Array(c.length);for(var d=0;d=0;h--){var l=67108864*(0|a.words[n.length+h])+(0|a.words[n.length+h-1]);for(l=Math.min(l/o|0,67108863),a._ishlnsubmul(n,l,h);0!==a.negative;)l--,a.negative=0,a._ishlnsubmul(n,1,h),a.isZero()||(a.negative^=1);c&&(c.words[h]=l)}return c&&c.strip(),a.strip(),"div"!==t&&0!==r&&a.iushrn(r),{div:c||null,mod:a}},BN.prototype.divmod=function divmod(e,t,r){return assert(!e.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(a=o.div.neg()),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.iadd(e)),{div:a,mod:n}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(a=o.div.neg()),{div:a,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(n=o.mod.neg(),r&&0!==n.negative&&n.isub(e)),{div:o.div,mod:n}):e.length>this.length||this.cmp(e)<0?{div:new BN(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new BN(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new BN(this.modn(e.words[0]))}:this._wordDiv(e,t);var a,n,o},BN.prototype.div=function div(e){return this.divmod(e,"div",!1).div},BN.prototype.mod=function mod(e){return this.divmod(e,"mod",!1).mod},BN.prototype.umod=function umod(e){return this.divmod(e,"mod",!0).mod},BN.prototype.divRound=function divRound(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,a=e.ushrn(1),n=e.andln(1),o=r.cmp(a);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},BN.prototype.modn=function modn(e){assert(e<=67108863);for(var t=(1<<26)%e,r=0,a=this.length-1;a>=0;a--)r=(t*r+(0|this.words[a]))%e;return r},BN.prototype.idivn=function idivn(e){assert(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*t;this.words[r]=a/e|0,t=a%e}return this.strip()},BN.prototype.divn=function divn(e){return this.clone().idivn(e)},BN.prototype.egcd=function egcd(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a=new BN(1),n=new BN(0),o=new BN(0),c=new BN(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var d=r.clone(),u=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(a.isOdd()||n.isOdd())&&(a.iadd(d),n.isub(u)),a.iushrn(1),n.iushrn(1);for(var b=0,g=1;0==(r.words[0]&g)&&b<26;++b,g<<=1);if(b>0)for(r.iushrn(b);b-- >0;)(o.isOdd()||c.isOdd())&&(o.iadd(d),c.isub(u)),o.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o),n.isub(c)):(r.isub(t),o.isub(a),c.isub(n))}return{a:o,b:c,gcd:r.iushln(s)}},BN.prototype._invmp=function _invmp(e){assert(0===e.negative),assert(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var a,n=new BN(1),o=new BN(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var s=0,d=1;0==(t.words[0]&d)&&s<26;++s,d<<=1);if(s>0)for(t.iushrn(s);s-- >0;)n.isOdd()&&n.iadd(c),n.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(o)):(r.isub(t),o.isub(n))}return(a=0===t.cmpn(1)?n:o).cmpn(0)<0&&a.iadd(e),a},BN.prototype.gcd=function gcd(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var a=0;t.isEven()&&r.isEven();a++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var o=t;t=r,r=o}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(a)},BN.prototype.invm=function invm(e){return this.egcd(e).a.umod(e)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(e){return this.words[0]&e},BN.prototype.bincn=function bincn(e){assert("number"==typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,c&=67108863,this.words[o]=c}return 0!==n&&(this.words[o]=n,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),assert(e<=67108863,"Number is too big");var a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var a=0|this.words[r],n=0|e.words[r];if(a!==n){an&&(t=1);break}}return t},BN.prototype.gtn=function gtn(e){return 1===this.cmpn(e)},BN.prototype.gt=function gt(e){return 1===this.cmp(e)},BN.prototype.gten=function gten(e){return this.cmpn(e)>=0},BN.prototype.gte=function gte(e){return this.cmp(e)>=0},BN.prototype.ltn=function ltn(e){return-1===this.cmpn(e)},BN.prototype.lt=function lt(e){return-1===this.cmp(e)},BN.prototype.lten=function lten(e){return this.cmpn(e)<=0},BN.prototype.lte=function lte(e){return this.cmp(e)<=0},BN.prototype.eqn=function eqn(e){return 0===this.cmpn(e)},BN.prototype.eq=function eq(e){return 0===this.cmp(e)},BN.red=function red(e){return new Red(e)},BN.prototype.toRed=function toRed(e){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(e){return this.red=e,this},BN.prototype.forceRed=function forceRed(e){return assert(!this.red,"Already a number in reduction context"),this._forceRed(e)},BN.prototype.redAdd=function redAdd(e){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},BN.prototype.redIAdd=function redIAdd(e){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},BN.prototype.redSub=function redSub(e){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},BN.prototype.redISub=function redISub(e){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},BN.prototype.redShl=function redShl(e){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},BN.prototype.redMul=function redMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},BN.prototype.redIMul=function redIMul(e){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(e){return assert(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(e,t){this.name=e,this.p=new BN(t,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(e){if("string"==typeof e){var t=BN._prime(e);this.m=t.p,this.prime=t}else assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function Mont(e){Red.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var e=new BN(null);return e.words=new Array(Math.ceil(this.n/13)),e},MPrime.prototype.ireduce=function ireduce(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var a=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},MPrime.prototype.split=function split(e,t){e.iushrn(this.n,0,t)},MPrime.prototype.imulK=function imulK(e){return e.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(e,t){for(var r=4194303,a=Math.min(e.length,9),n=0;n>>22,o=c}o>>>=22,e.words[n-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},K256.prototype.imulK=function imulK(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=n,t=a}return 0!==t&&(e.words[e.length++]=t),e},BN._prime=function prime(e){if(d[e])return d[e];var prime;if("k256"===e)prime=new K256;else if("p224"===e)prime=new P224;else if("p192"===e)prime=new P192;else{if("p25519"!==e)throw new Error("Unknown prime "+e);prime=new P25519}return d[e]=prime,prime},Red.prototype._verify1=function _verify1(e){assert(0===e.negative,"red works only with positives"),assert(e.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(e,t){assert(0==(e.negative|t.negative),"red works only with positives"),assert(e.red&&e.red===t.red,"red works only with red numbers")},Red.prototype.imod=function imod(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},Red.prototype.add=function add(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},Red.prototype.iadd=function iadd(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},Red.prototype.sub=function sub(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},Red.prototype.isub=function isub(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},Red.prototype.shl=function shl(e,t){return this._verify1(e),this.imod(e.ushln(t))},Red.prototype.imul=function imul(e,t){return this._verify2(e,t),this.imod(e.imul(t))},Red.prototype.mul=function mul(e,t){return this._verify2(e,t),this.imod(e.mul(t))},Red.prototype.isqr=function isqr(e){return this.imul(e,e.clone())},Red.prototype.sqr=function sqr(e){return this.mul(e,e)},Red.prototype.sqrt=function sqrt(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(assert(t%2==1),3===t){var r=this.m.add(new BN(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),n=0;!a.isZero()&&0===a.andln(1);)n++,a.iushrn(1);assert(!a.isZero());var o=new BN(1).toRed(this),c=o.redNeg(),s=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,s).cmp(c);)d.redIAdd(c);for(var u=this.pow(d,a),h=this.pow(e,a.addn(1).iushrn(1)),l=this.pow(e,a),b=n;0!==l.cmp(o);){for(var g=l,p=0;0!==g.cmp(o);p++)g=g.redSqr();assert(p=0;a--){for(var d=t.words[a],u=s-1;u>=0;u--){var h=d>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==h||0!==o?(o<<=1,o|=h,(4===++c||0===a&&0===u)&&(n=this.mul(n,r[o]),c=0,o=0)):c=0}s=26}return n},Red.prototype.convertTo=function convertTo(e){var t=e.umod(this.m);return t===e?t.clone():t},Red.prototype.convertFrom=function convertFrom(e){var t=e.clone();return t.red=null,t},BN.mont=function mont(e){return new Mont(e)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(e){return this.imod(e.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},Mont.prototype.imul=function imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.mul=function mul(e,t){if(e.isZero()||t.isZero())return new BN(0)._forceRed(this);var r=e.mul(t),a=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(a).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},Mont.prototype.invm=function invm(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},function(e,t,r){"use strict";var a=r(0).Buffer,n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=n(r(1037)),c=function(){function Cache(e){this._cache=new o.default(e)}return Cache.prototype.set=function(e,t){e instanceof a&&(e=e.toString("hex")),this._cache.set(e,t)},Cache.prototype.get=function(e){return e instanceof a&&(e=e.toString("hex")),this._cache.get(e)},Cache.prototype.del=function(e){e instanceof a&&(e=e.toString("hex")),this._cache.del(e)},Cache}();t.default=c},(e,t,r)=>{r(1041),r(1420),r(1062),r(1422);var a=r(391);e.exports=a.Set},(e,t,r)=>{var a=r(121),n=r(387),o="".split;e.exports=a((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==n(e)?o.call(e,""):Object(e)}:Object},(e,t,r)=>{var a=r(146),n=r(121),o=r(630);e.exports=!a&&!n((function(){return 7!=Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},(e,t,r)=>{var a=r(107),n=r(122),o=a.document,c=n(o)&&n(o.createElement);e.exports=function(e){return c?o.createElement(e):{}}},(e,t,r)=>{var a=r(1046),n=r(390);e.exports=function(e){var t=a(e,"string");return n(t)?t:String(t)}},(e,t,r)=>{var a=r(633);e.exports=a&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},(e,t,r)=>{var a=r(1047),n=r(121);e.exports=!!Object.getOwnPropertySymbols&&!n((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&a&&a<41}))},(e,t,r)=>{var a=r(392),n=r(389);(e.exports=function(e,t){return n[e]||(n[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.16.1",mode:a?"pure":"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})},(e,t,r)=>{"use strict";var a,n,o,c=r(121),s=r(636),d=r(171),u=r(123),h=r(108),l=r(392),b=h("iterator"),g=!1;[].keys&&("next"in(o=[].keys())?(n=s(s(o)))!==Object.prototype&&(a=n):g=!0);var p=null==a||c((function(){var e={};return a[b].call(e)!==e}));p&&(a={}),l&&!p||u(a,b)||d(a,b,(function(){return this})),e.exports={IteratorPrototype:a,BUGGY_SAFARI_ITERATORS:g}},(e,t,r)=>{var a=r(123),n=r(393),o=r(396),c=r(1053),s=o("IE_PROTO"),d=Object.prototype;e.exports=c?Object.getPrototypeOf:function(e){return e=n(e),a(e,s)?e[s]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?d:null}},(e,t,r)=>{var a,n=r(216),o=r(1054),c=r(401),s=r(297),d=r(1058),u=r(630),h=r(396),l=h("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(e){return"