@smartledger/bsv 4.0.1 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +69 -0
- package/README.md +71 -40
- package/bsv-covenant.min.js +4 -4
- package/bsv-gdaf.min.js +3 -3
- package/bsv-ltp.min.js +3 -3
- package/bsv-smartcontract.min.js +3 -3
- package/bsv.bundle.js +3 -3
- package/bsv.d.ts +15 -0
- package/bsv.min.js +3 -3
- package/docs/COVENANT_DEVELOPMENT_RESOLVED.md +2 -2
- package/docs/MODULE_REFERENCE_COMPLETE.md +27 -27
- package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
- package/docs/getting-started/INSTALLATION.md +25 -25
- package/docs/getting-started/QUICK_START.md +7 -7
- package/docs/migration/FROM_BSV_1_5_6.md +5 -5
- package/lib/script/interpreter.js +41 -7
- package/package.json +1 -1
package/bsv-gdaf.min.js
CHANGED
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
*/
|
|
8
8
|
var i=r(159),n=r(160),o=r(161);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return f(this,e)}return c(this,e,t,r)}function c(e,t,r,i){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,i){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===i?new Uint8Array(t):void 0===i?new Uint8Array(t,r):new Uint8Array(t,r,i);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=l(e,t);return e}(e,t,r,i):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var i=0|p(t,r),n=(e=s(e,i)).write(t,r);n!==i&&(e=e.slice(0,n));return e}(e,t,r):function(e,t){if(u.isBuffer(t)){var r=0|d(t.length);return 0===(e=s(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(i=t.length)!=i?s(e,0):l(e,t);if("Buffer"===t.type&&o(t.data))return l(e,t.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function h(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function f(e,t){if(h(t),e=s(e,t<0?0:0|d(t)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function l(e,t){var r=t.length<0?0:0|d(t.length);e=s(e,r);for(var i=0;i<r;i+=1)e[i]=255&t[i];return e}function d(e){if(e>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function p(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(e).length;default:if(i)return H(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){var i=!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 P(this,t,r);case"utf8":case"utf-8":return A(this,t,r);case"ascii":return O(this,t,r);case"latin1":case"binary":return x(this,t,r);case"base64":return E(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function g(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function b(e,t,r,i,n){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(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=u.from(t,i)),u.isBuffer(t))return 0===t.length?-1:y(e,t,r,i,n);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,i,n){var o,a=1,s=e.length,u=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,r/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(n){var h=-1;for(o=r;o<s;o++)if(c(e,o)===c(t,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===u)return h*a}else-1!==h&&(o-=o-h),h=-1}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){for(var f=!0,l=0;l<u;l++)if(c(e,o+l)!==c(t,l)){f=!1;break}if(f)return o}return-1}function v(e,t,r,i){r=Number(r)||0;var n=e.length-r;i?(i=Number(i))>n&&(i=n):i=n;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var a=0;a<i;++a){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))return a;e[r+a]=s}return a}function _(e,t,r,i){return F(H(t,e.length-r),e,r,i)}function w(e,t,r,i){return F(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,i)}function S(e,t,r,i){return w(e,t,r,i)}function k(e,t,r,i){return F(z(t),e,r,i)}function I(e,t,r,i){return F(function(e,t){for(var r,i,n,o=[],a=0;a<e.length&&!((t-=2)<0);++a)r=e.charCodeAt(a),i=r>>8,n=r%256,o.push(n),o.push(i);return o}(t,e.length-r),e,r,i)}function E(e,t,r){return 0===t&&r===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,r))}function A(e,t,r){r=Math.min(e.length,r);for(var i=[],n=t;n<r;){var o,a,s,u,c=e[n],h=null,f=c>239?4:c>223?3:c>191?2:1;if(n+f<=r)switch(f){case 1:c<128&&(h=c);break;case 2:128==(192&(o=e[n+1]))&&(u=(31&c)<<6|63&o)>127&&(h=u);break;case 3:o=e[n+1],a=e[n+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=e[n+1],a=e[n+2],s=e[n+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(h=u)}null===h?(h=65533,f=1):h>65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h),n+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",i=0;for(;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=4096));return r}(i)}t.Buffer=u,t.SlowBuffer=function(e){+e!=e&&(e=0);return u.alloc(+e)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=a(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,r){return c(null,e,t,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,r){return function(e,t,r,i){return h(t),t<=0?s(e,t):void 0!==r?"string"==typeof i?s(e,t).fill(r,i):s(e,t).fill(r):s(e,t)}(null,e,t,r)},u.allocUnsafe=function(e){return f(null,e)},u.allocUnsafeSlow=function(e){return f(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,i=t.length,n=0,o=Math.min(r,i);n<o;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}return r<i?-1:i<r?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!o(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var i=u.allocUnsafe(t),n=0;for(r=0;r<e.length;++r){var a=e[r];if(!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,n),n+=a.length}return i},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?A(this,0,e):m.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},u.prototype.compare=function(e,t,r,i,n){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(n>>>=0)-(i>>>=0),a=(r>>>=0)-(t>>>=0),s=Math.min(o,a),c=this.slice(i,n),h=e.slice(t,r),f=0;f<s;++f)if(c[f]!==h[f]){o=c[f],a=h[f];break}return o<a?-1:a<o?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return b(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return b(this,e,t,r,!1)},u.prototype.write=function(e,t,r,i){if(void 0===t)i="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)i=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===i&&(i="utf8")):(i=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");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return _(this,e,t,r);case"ascii":return w(this,e,t,r);case"latin1":case"binary":return S(this,e,t,r);case"base64":return k(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function O(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;++n)i+=String.fromCharCode(127&e[n]);return i}function x(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}function P(e,t,r){var i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);for(var n="",o=t;o<r;++o)n+=U(e[o]);return n}function M(e,t,r){for(var i=e.slice(t,r),n="",o=0;o<i.length;o+=2)n+=String.fromCharCode(i[o]+256*i[o+1]);return n}function T(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,r,i,n,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<o)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}function B(e,t,r,i){t<0&&(t=65535+t+1);for(var n=0,o=Math.min(e.length-r,2);n<o;++n)e[r+n]=(t&255<<8*(i?n:1-n))>>>8*(i?n:1-n)}function N(e,t,r,i){t<0&&(t=4294967295+t+1);for(var n=0,o=Math.min(e.length-r,4);n<o;++n)e[r+n]=t>>>8*(i?n:3-n)&255}function C(e,t,r,i,n,o){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,r,i,o){return o||C(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function j(e,t,r,i,o){return o||C(e,0,r,8),n.write(e,t,r,i,52,8),r+8}u.prototype.slice=function(e,t){var r,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=u.prototype;else{var n=t-e;r=new u(n,void 0);for(var o=0;o<n;++o)r[o]=this[o+e]}return r},u.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||T(e,t,this.length);for(var i=this[e],n=1,o=0;++o<t&&(n*=256);)i+=this[e+o]*n;return i},u.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||T(e,t,this.length);for(var i=this[e+--t],n=1;t>0&&(n*=256);)i+=this[e+--t]*n;return i},u.prototype.readUInt8=function(e,t){return t||T(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||T(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||T(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||T(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||T(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||T(e,t,this.length);for(var i=this[e],n=1,o=0;++o<t&&(n*=256);)i+=this[e+o]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*t)),i},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||T(e,t,this.length);for(var i=t,n=1,o=this[e+--i];i>0&&(n*=256);)o+=this[e+--i]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return t||T(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||T(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||T(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return t||T(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||T(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||T(e,4,this.length),n.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||T(e,4,this.length),n.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||T(e,8,this.length),n.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||T(e,8,this.length),n.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,i){(e=+e,t|=0,r|=0,i)||R(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[t]=255&e;++o<r&&(n*=256);)this[t+o]=e/n&255;return t+r},u.prototype.writeUIntBE=function(e,t,r,i){(e=+e,t|=0,r|=0,i)||R(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},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):B(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):B(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):N(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);R(this,e,t,r,n-1,-n)}var o=0,a=1,s=0;for(this[t]=255&e;++o<r&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},u.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);R(this,e,t,r,n-1,-n)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):B(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):B(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):N(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return j(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return j(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,i){if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<r&&(i=r),i===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-r&&(i=e.length-t+r);var n,o=i-r;if(this===e&&r<t&&t<i)for(n=o-1;n>=0;--n)e[n+t]=this[n+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(n=0;n<o;++n)e[n+t]=this[n+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+o),t);return o},u.prototype.fill=function(e,t,r,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),1===e.length){var n=e.charCodeAt(0);n<256&&(e=n)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var a=u.isBuffer(e)?e:H(new u(e,i).toString()),s=a.length;for(o=0;o<r-t;++o)this[o+t]=a[o%s]}return this};var L=/[^+\/0-9A-Za-z-_]/g;function U(e){return e<16?"0"+e.toString(16):e.toString(16)}function H(e,t){var r;t=t||1/0;for(var i=e.length,n=null,o=[],a=0;a<i;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===i){(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 z(e){return i.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(L,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(e,t,r,i){for(var n=0;n<i&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}}).call(this,r(13))},function(e,t,r){
|
|
9
9
|
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
10
|
-
var i=r(0),n=i.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=i:(o(i,t),t.Buffer=a),a.prototype=Object.create(n.prototype),o(n,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},function(e,t,r){"use strict";(function(t,i,n){var o=e.exports;if(o.deps=o.deps||{},o.deps._=r(3),o.deps.Buffer=void 0!==t?t:null,"undefined"==typeof window)o.deps.bnjs=r(7),o.deps.bs58=r(86),o.deps.elliptic=r(29);else{try{o.deps.bnjs=r(7)}catch(e){}try{o.deps.bs58=r(86)}catch(e){}try{o.deps.elliptic=r(29)}catch(e){}}o.version="v"+r(284).version,o.versionGuard=function(e){if(void 0!==e){console.warn("\n More than one instance of bsv found.\n Please make sure to require bsv and check that submodules do\n not also include their own bsv dependency.")}},o.versionGuard(i._bsv),i._bsv=o.version,o.isHardened=!0,o.hardenedBy="SmartLedger",o.baseVersion="v1.5.6",o.securityFeatures=["canonical-signatures","malleability-protection","enhanced-validation","elliptic-patches"],o.crypto={},o.crypto.BN=r(8),o.crypto.ECDSA=r(87),o.crypto.Hash=r(10),o.crypto.Random=r(32),o.crypto.Point=r(17),o.crypto.Signature=r(11),o.crypto.Shamir=r(147),o.crypto.SmartVerify=r(92),o.crypto.EllipticFixed=r(93),o.encoding={},o.encoding.Base58=r(61),o.encoding.Base58Check=r(47),o.encoding.BufferReader=r(25),o.encoding.BufferWriter=r(21),o.encoding.Varint=r(49),o.util={},o.util.js=r(12),o.util.preconditions=r(5),o.errors=r(16),o.Address=r(36),o.Block=r(301),o.MerkleBlock=r(148),o.BlockHeader=r(62),o.HDPrivateKey=r(149),o.HDPublicKey=r(150),o.Networks=r(30),o.Opcode=r(89),o.PrivateKey=r(60),o.PublicKey=r(20),o.Script=r(18),o.Transaction=r(31),o.Input=r(31).Input,o.Output=r(31).Output,o.UnspentOutput=r(31).UnspentOutput,o.Message=r(303),o.Mnemonic=r(305),o.ECIES=r(319),o.Signature=r(11),o.Shamir=r(147),o.SmartLedger={version:o.version,hardenedBy:o.hardenedBy,baseVersion:o.baseVersion,securityFeatures:o.securityFeatures,SmartVerify:r(92),EllipticFixed:r(93)},o.SmartVerify=r(92),o.EllipticFixed=r(93);try{o.SmartContract=r(323)}catch(e){"undefined"==typeof window&&console.warn("SmartContract module not available:",e.message)}try{o.BrowserUTXOManager=r(333)}catch(e){"undefined"==typeof window&&console.warn("[bsv] BrowserUTXOManager failed to load:",e.message)}if("undefined"==typeof window)try{var a,s=!1;Object.defineProperty(o,"SmartUTXO",{configurable:!0,enumerable:!0,get:function(){return s||n.env&&n.env.BSV_HIDE_DEPRECATIONS||(s=!0,console.warn("[bsv] bsv.SmartUTXO is a development-only simulator and is deprecated; it will be removed in v5.0.0. Import directly: require('@smartledger/bsv/lib/smartutxo'). Set BSV_HIDE_DEPRECATIONS=1 to silence this warning.")),a||(a=r(152)),a}}),o.SmartMiner=r(334),o.CustomScriptHelper=r(335)}catch(e){}o.GDAF=r(97);try{o.DIDWeb=r(336)}catch(e){"undefined"==typeof window&&console.warn("[bsv] DIDWeb module failed to load:",e.message)}try{o.VcJwt=r(155)}catch(e){"undefined"==typeof window&&console.warn("[bsv] VcJwt module failed to load:",e.message)}try{o.StatusList=r(337)}catch(e){"undefined"==typeof window&&console.warn("[bsv] StatusList module failed to load:",e.message)}try{o.Anchor=r(347)}catch(e){"undefined"==typeof window&&console.warn("[bsv] Anchor module failed to load:",e.message)}o.createDID=function(e){return(new o.GDAF).createDID(e)},o.resolveDID=function(e){return(new o.GDAF).resolveDID(e)},o.createEmailCredential=function(e,t,r,i){return(new o.GDAF).createEmailCredential(e,t,r,i)},o.createAgeCredential=function(e,t,r,i,n){return(new o.GDAF).createAgeCredential(e,t,r,i,n)},o.createKYCCredential=function(e,t,r,i,n){return(new o.GDAF).createKYCCredential(e,t,r,i,n)},o.verifyCredential=function(e,t){return(new o.GDAF).verifyCredential(e,t)},o.validateCredential=function(e,t){return(new o.GDAF).validateCredential(e,t)},o.generateSelectiveProof=function(e,t,r){return(new o.GDAF).generateSelectiveProof(e,t,r)},o.generateAgeProof=function(e,t,r){return(new o.GDAF).generateAgeProof(e,t,r)},o.verifyAgeProof=function(e,t,r){return(new o.GDAF).verifyAgeProof(e,t,r)},o.createPresentation=function(e,t,r,i){return(new o.GDAF).createPresentation(e,t,r,i)},o.getCredentialSchemas=function(){return(new o.GDAF).getAllSchemas()},o.createCredentialTemplate=function(e){return(new o.GDAF).createTemplate(e)},o.LTP=r(348),o.prepareRightToken=function(e,t,r,i,n,a){return o.LTP.Right.prepareRightToken(e,t,r,i,n,a)},o.prepareRightTokenVerification=function(e,t){return o.LTP.Right.prepareRightTokenVerification(e,t)},o.prepareRightTokenTransfer=function(e,t,r,i){return o.LTP.Right.prepareRightTokenTransfer(e,t,r,i)},o.prepareRightTypeValidation=function(e){return o.LTP.Right.prepareRightTypeValidation(e)},o.prepareObligationToken=function(e,t,r,i,n,a){return o.LTP.Obligation.prepareObligationToken(e,t,r,i,n,a)},o.prepareObligationVerification=function(e,t){return o.LTP.Obligation.prepareObligationVerification(e,t)},o.prepareObligationFulfillment=function(e,t,r,i){return o.LTP.Obligation.prepareObligationFulfillment(e,t,r,i)},o.prepareObligationBreachAssessment=function(e,t,r){return o.LTP.Obligation.prepareObligationBreachAssessment(e,t,r)},o.prepareObligationMonitoringReport=function(e,t){return o.LTP.Obligation.prepareObligationMonitoringReport(e,t)},o.prepareClaimValidation=function(e,t){return o.LTP.Claim.prepareClaimValidation(e,t)},o.prepareClaimAttestation=function(e,t,r){return o.LTP.Claim.prepareClaimAttestation(e,t,r)},o.prepareClaimDispute=function(e,t,r){return o.LTP.Claim.prepareClaimDispute(e,t,r)},o.prepareBulkClaimValidation=function(e,t){return o.LTP.Claim.prepareBulkClaimValidation(e,t)},o.prepareClaimTemplate=function(e,t){return o.LTP.Claim.prepareClaimTemplate(e,t)},o.prepareSignatureProof=function(e,t,r){return o.LTP.Proof.prepareSignatureProof(e,t,r)},o.prepareSignatureVerification=function(e,t){return o.LTP.Proof.prepareSignatureVerification(e,t)},o.prepareSelectiveDisclosure=function(e,t,r){return o.LTP.Proof.prepareSelectiveDisclosure(e,t,r)},o.prepareSelectiveDisclosureVerification=function(e,t){return o.LTP.Proof.prepareSelectiveDisclosureVerification(e,t)},o.prepareLegalValidityProof=function(e,t,r){return o.LTP.Proof.prepareLegalValidityProof(e,t,r)},o.prepareZeroKnowledgeProof=function(e,t,r){return o.LTP.Proof.prepareZeroKnowledgeProof(e,t,r)},o.prepareRegistry=function(e){return o.LTP.Registry.prepareRegistry(e)},o.prepareTokenRegistration=function(e,t,r){return o.LTP.Registry.prepareTokenRegistration(e,t,r)},o.prepareTokenApproval=function(e,t,r){return o.LTP.Registry.prepareTokenApproval(e,t,r)},o.prepareTokenRevocation=function(e,t,r){return o.LTP.Registry.prepareTokenRevocation(e,t,r)},o.prepareTokenStatusQuery=function(e,t){return o.LTP.Registry.prepareTokenStatusQuery(e,t)},o.prepareTokenSearch=function(e,t){return o.LTP.Registry.prepareTokenSearch(e,t)},o.prepareStatisticsQuery=function(e){return o.LTP.Registry.prepareStatisticsQuery(e)},o.prepareAuditLogQuery=function(e,t){return o.LTP.Registry.prepareAuditLogQuery(e,t)},o.prepareTokenCommitment=function(e,t){return o.LTP.Anchor.prepareTokenCommitment(e,t)},o.prepareBatchCommitment=function(e,t){return o.LTP.Anchor.prepareBatchCommitment(e,t)},o.verifyTokenAnchor=function(e,t,r){return o.LTP.Anchor.verifyTokenAnchor(e,t,r)},o.formatRevocation=function(e,t){return o.LTP.Anchor.formatRevocation(e,t)},o.createRightToken=function(e,t,r){return(new o.LTP).createRightToken(e,t,r)},o.verifyLegalToken=function(e,t){return(new o.LTP).verifyToken(e,t)},o.validateLegalClaim=function(e,t){return(new o.LTP).validateClaim(e,t)},o.createSelectiveDisclosure=function(e,t,r){return(new o.LTP).createSelectiveDisclosure(e,t,r)},o.createLegalRegistry=function(e){return o.LTP.Registry.prepareRegistry(e)},o.createLegalValidityProof=function(e,t,r){return(new o.LTP).createLegalValidityProof(e,t,r)},o.getRightTypes=function(){return o.LTP.Right.getRightTypes()},o.getObligationTypes=function(){return o.LTP.Obligation.getObligationTypes()},o.getObligationPriority=function(){return o.LTP.Obligation.getObligationPriority()},o.getObligationStatus=function(){return o.LTP.Obligation.getObligationStatus()},o.getClaimSchemas=function(){return o.LTP.Claim.getSchemas()},o.getClaimSchemaNames=function(){return o.LTP.Claim.getSchemaNames()},o.getClaimSchema=function(e){return o.LTP.Claim.getSchema(e)},o.createClaimTemplate=function(e){return o.LTP.Claim.createTemplate(e)},o.canonicalizeClaim=function(e){return o.LTP.Claim.canonicalize(e)},o.hashClaim=function(e){return o.LTP.Claim.hash(e)},o.addCustomClaimSchema=function(e,t){return o.LTP.Claim.addSchema(e,t)},o.Transaction.sighash=r(26)}).call(this,r(0).Buffer,r(13),r(6))},function(e,t,r){"use strict";var i=r(32),n={isArray:e=>Array.isArray(e),isNumber:e=>"number"==typeof e,isObject:e=>e&&"object"==typeof e,isString:e=>"string"==typeof e,isUndefined:e=>void 0===e,isFunction:e=>"function"==typeof e,isNull:e=>null===e,isDate:e=>e instanceof Date,extend:(e,t)=>Object.assign(e,t),noop:()=>{},every:(e,t)=>e.every(t||(e=>e)),map:(e,t)=>Array.from(e).map(t||(e=>e)),includes:(e,t)=>e.includes(t),each:(e,t)=>e.forEach(t),clone:e=>Object.assign({},e),pick:(e,t)=>{const r={};return t.forEach(t=>{void 0!==e[t]&&(r[t]=e[t])}),r},values:e=>Object.values(e),filter:(e,t)=>e.filter(t),reduce:(e,t,r)=>e.reduce(t,r),without:(e,t)=>e.filter(e=>e!==t),shuffle:e=>{const t=e.slice(0);for(let e=t.length-1;e>0;e--){const r=i.getRandomBuffer(4).readUInt32BE(0)/4294967296,n=Math.floor(r*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t},difference:(e,t)=>e.filter(e=>!t.includes(e)),findIndex:(e,t)=>e.findIndex(t),some:(e,t)=>e.some(t),range:e=>[...Array(e).keys()]};e.exports=n},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},function(e,t,r){"use strict";var i=r(16),n=r(3);e.exports={checkState:function(e,t){if(!e)throw new i.InvalidState(t)},checkArgument:function(e,t,r,n){if(!e)throw new i.InvalidArgument(t,r,n)},checkArgumentType:function(e,t,o){if(o=o||"(unknown name)",n.isString(t)){if("Buffer"===t){if(!r(0).Buffer.isBuffer(e))throw new i.InvalidArgumentType(e,t,o)}else if(typeof e!==t)throw new i.InvalidArgumentType(e,t,o)}else if(!(e instanceof t))throw new i.InvalidArgumentType(e,t.name,o)}}},function(e,t){var r,i,n=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(e){i=a}}();var u,c=[],h=!1,f=-1;function l(){h&&u&&(h=!1,u.length?c=u.concat(c):f=-1,c.length&&d())}function d(){if(!h){var e=s(l);h=!0;for(var t=c.length;t;){for(u=c,c=[];++f<t;)u&&u[f].run();f=-1,t=c.length}u=null,h=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===a||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function m(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new p(e,t)),1!==c.length||h||s(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=m,n.addListener=m,n.once=m,n.off=m,n.removeListener=m,n.removeAllListeners=m,n.emit=m,n.prependListener=m,n.prependOnceListener=m,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},function(e,t,r){(function(e){!function(e,t){"use strict";function i(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{a=r(236).Buffer}catch(e){}function s(e,t,r){for(var i=0,n=Math.min(e.length,r),o=t;o<n;o++){var a=e.charCodeAt(o)-48;i<<=4,i|=a>=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return i}function u(e,t,r,i){for(var n=0,o=Math.min(e.length,r),a=t;a<o;a++){var s=e.charCodeAt(a)-48;n*=i,n+=s>=49?s-49+10:s>=17?s-17+10:s}return n}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),i(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&n++,16===t?this._parseHex(e,n):this._parseBase(e,t,n),"-"===e[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(i(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initArray=function(e,t,r){if(i("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,a,s=0;if("be"===r)for(n=e.length-1,o=0;n>=0;n-=3)a=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(n=0,o=0;n<e.length;n+=3)a=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,n,o=0;for(r=e.length-6,i=0;r>=t;r-=6)n=s(e,r,r+6),this.words[i]|=n<<o&67108863,this.words[i+1]|=n>>>26-o&4194303,(o+=24)>=26&&(o-=26,i++);r+6!==t&&(n=s(e,t,r+6),this.words[i]|=n<<o&67108863,this.words[i+1]|=n>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var o=e.length-r,a=o%i,s=Math.min(o,o-a)+r,c=0,h=r;h<s;h+=i)c=u(e,h,h+i,t),this.imuln(n),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var f=1;for(c=u(e,h,e.length,t),h=0;h<a;h++)f*=t;this.imuln(f),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[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 l(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],o=0|t.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c<i;c++){for(var h=u>>>26,f=67108863&u,l=Math.min(c,t.length-1),d=Math.max(0,c-e.length+1);d<=l;d++){var p=c-d|0;h+=(a=(n=0|e.words[p])*(o=0|t.words[d])+f)/67108864|0,f=67108863&a}r.words[c]=0|f,u=0|h}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<n|o)).toString(16);r=0!==(o=s>>>24-n&16777215)||a!==this.length-1?c[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=h[e],d=f[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(e);r=(p=p.idivn(d)).isZero()?m+r:c[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return i(void 0!==a),this.toArrayLike(a,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,r){var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===t,c=new e(o),h=this.clone();if(u){for(s=0;!h.isZero();s++)a=h.andln(255),h.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-n;s++)c[s]=0;for(s=0;!h.isZero();s++)a=h.andln(255),h.iushrn(8),c[o-s-1]=a}return c},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},o.prototype.ior=function(e){return i(0==(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},o.prototype.iand=function(e){return i(0==(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var i=0;i<r.length;i++)this.words[i]=t.words[i]^r.words[i];if(this!==t)for(;i<t.length;i++)this.words[i]=t.words[i];return this.length=t.length,this.strip()},o.prototype.ixor=function(e){return i(0==(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<n:this.words[r]&~(1<<n),this.strip()},o.prototype.iadd=function(e){var t,r,i;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,i=e):(r=e,i=this);for(var n=0,o=0;o<i.length;o++)t=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&t,n=t>>>26;for(;0!==n&&o<r.length;o++)t=(0|r.words[o])+n,this.words[o]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,i,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=e):(r=e,i=this);for(var o=0,a=0;a<i.length;a++)o=(t=(0|r.words[a])-(0|i.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<r.length;a++)o=(t=(0|r.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var d=function(e,t,r){var i,n,o,a=e.words,s=t.words,u=r.words,c=0,h=0|a[0],f=8191&h,l=h>>>13,d=0|a[1],p=8191&d,m=d>>>13,g=0|a[2],b=8191&g,y=g>>>13,v=0|a[3],_=8191&v,w=v>>>13,S=0|a[4],k=8191&S,I=S>>>13,E=0|a[5],A=8191&E,O=E>>>13,x=0|a[6],P=8191&x,M=x>>>13,T=0|a[7],R=8191&T,B=T>>>13,N=0|a[8],C=8191&N,D=N>>>13,j=0|a[9],L=8191&j,U=j>>>13,H=0|s[0],z=8191&H,F=H>>>13,K=0|s[1],V=8191&K,q=K>>>13,G=0|s[2],Y=8191&G,Z=G>>>13,W=0|s[3],X=8191&W,J=W>>>13,$=0|s[4],Q=8191&$,ee=$>>>13,te=0|s[5],re=8191&te,ie=te>>>13,ne=0|s[6],oe=8191&ne,ae=ne>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,he=0|s[8],fe=8191&he,le=he>>>13,de=0|s[9],pe=8191&de,me=de>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(c+(i=Math.imul(f,z))|0)+((8191&(n=(n=Math.imul(f,F))+Math.imul(l,z)|0))<<13)|0;c=((o=Math.imul(l,F))+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,i=Math.imul(p,z),n=(n=Math.imul(p,F))+Math.imul(m,z)|0,o=Math.imul(m,F);var be=(c+(i=i+Math.imul(f,V)|0)|0)+((8191&(n=(n=n+Math.imul(f,q)|0)+Math.imul(l,V)|0))<<13)|0;c=((o=o+Math.imul(l,q)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,i=Math.imul(b,z),n=(n=Math.imul(b,F))+Math.imul(y,z)|0,o=Math.imul(y,F),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,q)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,q)|0;var ye=(c+(i=i+Math.imul(f,Y)|0)|0)+((8191&(n=(n=n+Math.imul(f,Z)|0)+Math.imul(l,Y)|0))<<13)|0;c=((o=o+Math.imul(l,Z)|0)+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,i=Math.imul(_,z),n=(n=Math.imul(_,F))+Math.imul(w,z)|0,o=Math.imul(w,F),i=i+Math.imul(b,V)|0,n=(n=n+Math.imul(b,q)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,q)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,Z)|0;var ve=(c+(i=i+Math.imul(f,X)|0)|0)+((8191&(n=(n=n+Math.imul(f,J)|0)+Math.imul(l,X)|0))<<13)|0;c=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,i=Math.imul(k,z),n=(n=Math.imul(k,F))+Math.imul(I,z)|0,o=Math.imul(I,F),i=i+Math.imul(_,V)|0,n=(n=n+Math.imul(_,q)|0)+Math.imul(w,V)|0,o=o+Math.imul(w,q)|0,i=i+Math.imul(b,Y)|0,n=(n=n+Math.imul(b,Z)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,Z)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,J)|0;var _e=(c+(i=i+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,ee)|0)+Math.imul(l,Q)|0))<<13)|0;c=((o=o+Math.imul(l,ee)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,i=Math.imul(A,z),n=(n=Math.imul(A,F))+Math.imul(O,z)|0,o=Math.imul(O,F),i=i+Math.imul(k,V)|0,n=(n=n+Math.imul(k,q)|0)+Math.imul(I,V)|0,o=o+Math.imul(I,q)|0,i=i+Math.imul(_,Y)|0,n=(n=n+Math.imul(_,Z)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,Z)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,J)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,ee)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,ee)|0;var we=(c+(i=i+Math.imul(f,re)|0)|0)+((8191&(n=(n=n+Math.imul(f,ie)|0)+Math.imul(l,re)|0))<<13)|0;c=((o=o+Math.imul(l,ie)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,i=Math.imul(P,z),n=(n=Math.imul(P,F))+Math.imul(M,z)|0,o=Math.imul(M,F),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,q)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,q)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,Z)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,Z)|0,i=i+Math.imul(_,X)|0,n=(n=n+Math.imul(_,J)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,ee)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,ee)|0,i=i+Math.imul(p,re)|0,n=(n=n+Math.imul(p,ie)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ie)|0;var Se=(c+(i=i+Math.imul(f,oe)|0)|0)+((8191&(n=(n=n+Math.imul(f,ae)|0)+Math.imul(l,oe)|0))<<13)|0;c=((o=o+Math.imul(l,ae)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,i=Math.imul(R,z),n=(n=Math.imul(R,F))+Math.imul(B,z)|0,o=Math.imul(B,F),i=i+Math.imul(P,V)|0,n=(n=n+Math.imul(P,q)|0)+Math.imul(M,V)|0,o=o+Math.imul(M,q)|0,i=i+Math.imul(A,Y)|0,n=(n=n+Math.imul(A,Z)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,Z)|0,i=i+Math.imul(k,X)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,ee)|0,i=i+Math.imul(b,re)|0,n=(n=n+Math.imul(b,ie)|0)+Math.imul(y,re)|0,o=o+Math.imul(y,ie)|0,i=i+Math.imul(p,oe)|0,n=(n=n+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var ke=(c+(i=i+Math.imul(f,ue)|0)|0)+((8191&(n=(n=n+Math.imul(f,ce)|0)+Math.imul(l,ue)|0))<<13)|0;c=((o=o+Math.imul(l,ce)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,i=Math.imul(C,z),n=(n=Math.imul(C,F))+Math.imul(D,z)|0,o=Math.imul(D,F),i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,q)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,q)|0,i=i+Math.imul(P,Y)|0,n=(n=n+Math.imul(P,Z)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,Z)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,J)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,ee)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,ee)|0,i=i+Math.imul(_,re)|0,n=(n=n+Math.imul(_,ie)|0)+Math.imul(w,re)|0,o=o+Math.imul(w,ie)|0,i=i+Math.imul(b,oe)|0,n=(n=n+Math.imul(b,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0,i=i+Math.imul(p,ue)|0,n=(n=n+Math.imul(p,ce)|0)+Math.imul(m,ue)|0,o=o+Math.imul(m,ce)|0;var Ie=(c+(i=i+Math.imul(f,fe)|0)|0)+((8191&(n=(n=n+Math.imul(f,le)|0)+Math.imul(l,fe)|0))<<13)|0;c=((o=o+Math.imul(l,le)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,i=Math.imul(L,z),n=(n=Math.imul(L,F))+Math.imul(U,z)|0,o=Math.imul(U,F),i=i+Math.imul(C,V)|0,n=(n=n+Math.imul(C,q)|0)+Math.imul(D,V)|0,o=o+Math.imul(D,q)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(B,Y)|0,o=o+Math.imul(B,Z)|0,i=i+Math.imul(P,X)|0,n=(n=n+Math.imul(P,J)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,J)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,ee)|0,i=i+Math.imul(k,re)|0,n=(n=n+Math.imul(k,ie)|0)+Math.imul(I,re)|0,o=o+Math.imul(I,ie)|0,i=i+Math.imul(_,oe)|0,n=(n=n+Math.imul(_,ae)|0)+Math.imul(w,oe)|0,o=o+Math.imul(w,ae)|0,i=i+Math.imul(b,ue)|0,n=(n=n+Math.imul(b,ce)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,ce)|0,i=i+Math.imul(p,fe)|0,n=(n=n+Math.imul(p,le)|0)+Math.imul(m,fe)|0,o=o+Math.imul(m,le)|0;var Ee=(c+(i=i+Math.imul(f,pe)|0)|0)+((8191&(n=(n=n+Math.imul(f,me)|0)+Math.imul(l,pe)|0))<<13)|0;c=((o=o+Math.imul(l,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,i=Math.imul(L,V),n=(n=Math.imul(L,q))+Math.imul(U,V)|0,o=Math.imul(U,q),i=i+Math.imul(C,Y)|0,n=(n=n+Math.imul(C,Z)|0)+Math.imul(D,Y)|0,o=o+Math.imul(D,Z)|0,i=i+Math.imul(R,X)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,J)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,ee)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,ee)|0,i=i+Math.imul(A,re)|0,n=(n=n+Math.imul(A,ie)|0)+Math.imul(O,re)|0,o=o+Math.imul(O,ie)|0,i=i+Math.imul(k,oe)|0,n=(n=n+Math.imul(k,ae)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,ae)|0,i=i+Math.imul(_,ue)|0,n=(n=n+Math.imul(_,ce)|0)+Math.imul(w,ue)|0,o=o+Math.imul(w,ce)|0,i=i+Math.imul(b,fe)|0,n=(n=n+Math.imul(b,le)|0)+Math.imul(y,fe)|0,o=o+Math.imul(y,le)|0;var Ae=(c+(i=i+Math.imul(p,pe)|0)|0)+((8191&(n=(n=n+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;c=((o=o+Math.imul(m,me)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,i=Math.imul(L,Y),n=(n=Math.imul(L,Z))+Math.imul(U,Y)|0,o=Math.imul(U,Z),i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,J)|0)+Math.imul(D,X)|0,o=o+Math.imul(D,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,ee)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,ee)|0,i=i+Math.imul(P,re)|0,n=(n=n+Math.imul(P,ie)|0)+Math.imul(M,re)|0,o=o+Math.imul(M,ie)|0,i=i+Math.imul(A,oe)|0,n=(n=n+Math.imul(A,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,i=i+Math.imul(k,ue)|0,n=(n=n+Math.imul(k,ce)|0)+Math.imul(I,ue)|0,o=o+Math.imul(I,ce)|0,i=i+Math.imul(_,fe)|0,n=(n=n+Math.imul(_,le)|0)+Math.imul(w,fe)|0,o=o+Math.imul(w,le)|0;var Oe=(c+(i=i+Math.imul(b,pe)|0)|0)+((8191&(n=(n=n+Math.imul(b,me)|0)+Math.imul(y,pe)|0))<<13)|0;c=((o=o+Math.imul(y,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,i=Math.imul(L,X),n=(n=Math.imul(L,J))+Math.imul(U,X)|0,o=Math.imul(U,J),i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,ee)|0,i=i+Math.imul(R,re)|0,n=(n=n+Math.imul(R,ie)|0)+Math.imul(B,re)|0,o=o+Math.imul(B,ie)|0,i=i+Math.imul(P,oe)|0,n=(n=n+Math.imul(P,ae)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,ae)|0,i=i+Math.imul(A,ue)|0,n=(n=n+Math.imul(A,ce)|0)+Math.imul(O,ue)|0,o=o+Math.imul(O,ce)|0,i=i+Math.imul(k,fe)|0,n=(n=n+Math.imul(k,le)|0)+Math.imul(I,fe)|0,o=o+Math.imul(I,le)|0;var xe=(c+(i=i+Math.imul(_,pe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(w,pe)|0))<<13)|0;c=((o=o+Math.imul(w,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,i=Math.imul(L,Q),n=(n=Math.imul(L,ee))+Math.imul(U,Q)|0,o=Math.imul(U,ee),i=i+Math.imul(C,re)|0,n=(n=n+Math.imul(C,ie)|0)+Math.imul(D,re)|0,o=o+Math.imul(D,ie)|0,i=i+Math.imul(R,oe)|0,n=(n=n+Math.imul(R,ae)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,ae)|0,i=i+Math.imul(P,ue)|0,n=(n=n+Math.imul(P,ce)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,ce)|0,i=i+Math.imul(A,fe)|0,n=(n=n+Math.imul(A,le)|0)+Math.imul(O,fe)|0,o=o+Math.imul(O,le)|0;var Pe=(c+(i=i+Math.imul(k,pe)|0)|0)+((8191&(n=(n=n+Math.imul(k,me)|0)+Math.imul(I,pe)|0))<<13)|0;c=((o=o+Math.imul(I,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,i=Math.imul(L,re),n=(n=Math.imul(L,ie))+Math.imul(U,re)|0,o=Math.imul(U,ie),i=i+Math.imul(C,oe)|0,n=(n=n+Math.imul(C,ae)|0)+Math.imul(D,oe)|0,o=o+Math.imul(D,ae)|0,i=i+Math.imul(R,ue)|0,n=(n=n+Math.imul(R,ce)|0)+Math.imul(B,ue)|0,o=o+Math.imul(B,ce)|0,i=i+Math.imul(P,fe)|0,n=(n=n+Math.imul(P,le)|0)+Math.imul(M,fe)|0,o=o+Math.imul(M,le)|0;var Me=(c+(i=i+Math.imul(A,pe)|0)|0)+((8191&(n=(n=n+Math.imul(A,me)|0)+Math.imul(O,pe)|0))<<13)|0;c=((o=o+Math.imul(O,me)|0)+(n>>>13)|0)+(Me>>>26)|0,Me&=67108863,i=Math.imul(L,oe),n=(n=Math.imul(L,ae))+Math.imul(U,oe)|0,o=Math.imul(U,ae),i=i+Math.imul(C,ue)|0,n=(n=n+Math.imul(C,ce)|0)+Math.imul(D,ue)|0,o=o+Math.imul(D,ce)|0,i=i+Math.imul(R,fe)|0,n=(n=n+Math.imul(R,le)|0)+Math.imul(B,fe)|0,o=o+Math.imul(B,le)|0;var Te=(c+(i=i+Math.imul(P,pe)|0)|0)+((8191&(n=(n=n+Math.imul(P,me)|0)+Math.imul(M,pe)|0))<<13)|0;c=((o=o+Math.imul(M,me)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,i=Math.imul(L,ue),n=(n=Math.imul(L,ce))+Math.imul(U,ue)|0,o=Math.imul(U,ce),i=i+Math.imul(C,fe)|0,n=(n=n+Math.imul(C,le)|0)+Math.imul(D,fe)|0,o=o+Math.imul(D,le)|0;var Re=(c+(i=i+Math.imul(R,pe)|0)|0)+((8191&(n=(n=n+Math.imul(R,me)|0)+Math.imul(B,pe)|0))<<13)|0;c=((o=o+Math.imul(B,me)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,i=Math.imul(L,fe),n=(n=Math.imul(L,le))+Math.imul(U,fe)|0,o=Math.imul(U,le);var Be=(c+(i=i+Math.imul(C,pe)|0)|0)+((8191&(n=(n=n+Math.imul(C,me)|0)+Math.imul(D,pe)|0))<<13)|0;c=((o=o+Math.imul(D,me)|0)+(n>>>13)|0)+(Be>>>26)|0,Be&=67108863;var Ne=(c+(i=Math.imul(L,pe))|0)+((8191&(n=(n=Math.imul(L,me))+Math.imul(U,pe)|0))<<13)|0;return c=((o=Math.imul(U,me))+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,u[0]=ge,u[1]=be,u[2]=ye,u[3]=ve,u[4]=_e,u[5]=we,u[6]=Se,u[7]=ke,u[8]=Ie,u[9]=Ee,u[10]=Ae,u[11]=Oe,u[12]=xe,u[13]=Pe,u[14]=Me,u[15]=Te,u[16]=Re,u[17]=Be,u[18]=Ne,0!==c&&(u[19]=c,r.length++),r};function p(e,t,r){return(new m).mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(d=l),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?d(this,e,t):r<63?l(this,e,t):r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var a=n;n=0;for(var s=67108863&i,u=Math.min(o,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var h=o-c,f=(0|e.words[h])*(0|t.words[c]),l=67108863&f;s=67108863&(l=l+s|0),n+=(a=(a=a+(f/67108864|0)|0)+(l>>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,e,t):p(this,e,t)},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,i=0;i<e;i++)t[i]=this.revBin(i,r,e);return t},m.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var i=0,n=0;n<t;n++)i|=(1&e)<<t-n-1,e>>=1;return i},m.prototype.permute=function(e,t,r,i,n,o){for(var a=0;a<o;a++)i[a]=t[e[a]],n[a]=r[e[a]]},m.prototype.transform=function(e,t,r,i,n,o){this.permute(o,e,t,r,i,n);for(var a=1;a<n;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),h=0;h<n;h+=s)for(var f=u,l=c,d=0;d<a;d++){var p=r[h+d],m=i[h+d],g=r[h+d+a],b=i[h+d+a],y=f*g-l*b;b=f*b+l*g,g=y,r[h+d]=p+g,i[h+d]=m+b,r[h+d+a]=p-g,i[h+d+a]=m-b,d!==s&&(y=u*f-c*l,l=u*l+c*f,f=y)}},m.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},m.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=e[i];e[i]=e[r-i-1],e[r-i-1]=n,n=t[i],t[i]=-t[r-i-1],t[r-i-1]=-n}},m.prototype.normalize13b=function(e,t){for(var r=0,i=0;i<t/2;i++){var n=8192*Math.round(e[2*i+1]/t)+Math.round(e[2*i]/t)+r;e[i]=67108863&n,r=n<67108864?0:n/67108864|0}return e},m.prototype.convert13b=function(e,t,r,n){for(var o=0,a=0;a<t;a++)o+=0|e[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*t;a<n;++a)r[a]=0;i(0===o),i(0==(-8192&o))},m.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},m.prototype.mulp=function(e,t,r){var i=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(i),o=this.stub(i),a=new Array(i),s=new Array(i),u=new Array(i),c=new Array(i),h=new Array(i),f=new Array(i),l=r.words;l.length=i,this.convert13b(e.words,e.length,a,i),this.convert13b(t.words,t.length,c,i),this.transform(a,o,s,u,i,n),this.transform(c,o,h,f,i,n);for(var d=0;d<i;d++){var p=s[d]*h[d]-u[d]*f[d];u[d]=s[d]*f[d]+u[d]*h[d],s[d]=p}return this.conjugate(s,u,i),this.transform(s,u,l,o,i,n),this.conjugate(l,o,i),this.normalize13b(l,i),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),p(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){i("number"==typeof e),i(e<67108864);for(var t=0,r=0;r<this.length;r++){var n=(0|this.words[r])*e,o=(67108863&n)+(67108863&t);t>>=26,t+=n/67108864|0,t+=o>>>26,this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var i=r/26|0,n=r%26;t[r]=(e.words[i]&1<<n)>>>n}return t}(e);if(0===t.length)return new o(1);for(var r=this,i=0;i<t.length&&0===t[i];i++,r=r.sqr());if(++i<t.length)for(var n=r.sqr();i<t.length;i++,n=n.sqr())0!==t[i]&&(r=r.mul(n));return r},o.prototype.iushln=function(e){i("number"==typeof e&&e>=0);var t,r=e%26,n=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<r;this.words[t]=u|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t<n;t++)this.words[t]=0;this.length+=n}return this.strip()},o.prototype.ishln=function(e){return i(0===this.negative),this.iushln(e)},o.prototype.iushrn=function(e,t,r){var n;i("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(n-=a,n=Math.max(0,n),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var h=0;for(c=this.length-1;c>=0&&(0!==h||c>=n);c--){var f=0|this.words[c];this.words[c]=h<<26-o|f>>>o,h=f&s}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,r){return i(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,n=1<<t;return!(this.length<=r)&&!!(this.words[r]&n)},o.prototype.imaskn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(i(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 n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this.strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return i("number"==typeof e),i(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(i("number"==typeof e),i(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,r){var n,o,a=e.length+r;this._expand(a);var s=0;for(n=0;n<e.length;n++){o=(0|this.words[n+r])+s;var u=(0|e.words[n])*t;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[n+r]=67108863&o}for(;n<this.length-r;n++)s=(o=(0|this.words[n+r])+s)>>26,this.words[n+r]=67108863&o;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n<this.length;n++)s=(o=-(0|this.words[n])+s)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),i=this.clone(),n=e,a=0|n.words[n.length-1];0!==(r=26-this._countBits(a))&&(n=n.ushln(r),i.iushln(r),a=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==t){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var h=i.clone()._ishlnsubmul(n,1,u);0===h.negative&&(i=h,s&&(s.words[u]=1));for(var f=u-1;f>=0;f--){var l=67108864*(0|i.words[n.length+f])+(0|i.words[n.length+f-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(n,l,f);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(n,1,f),i.isZero()||(i.negative^=1);s&&(s.words[f]=l)}return s&&s.strip(),i.strip(),"div"!==t&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},o.prototype.divmod=function(e,t,r){return i(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(n=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:n,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var n,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){i(e<=67108863);for(var t=(1<<26)%e,r=0,n=this.length-1;n>=0;n--)r=(t*r+(0|this.words[n]))%e;return r},o.prototype.idivn=function(e){i(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*t;this.words[r]=n/e|0,t=n%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var h=r.clone(),f=t.clone();!t.isZero();){for(var l=0,d=1;0==(t.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(t.iushrn(l);l-- >0;)(n.isOdd()||a.isOdd())&&(n.iadd(h),a.isub(f)),n.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(h),u.isub(f)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(s),a.isub(u)):(r.isub(t),s.isub(n),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},o.prototype._invmp=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n,a=new o(1),s=new o(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,h=1;0==(t.words[0]&h)&&c<26;++c,h<<=1);if(c>0)for(t.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var f=0,l=1;0==(r.words[0]&l)&&f<26;++f,l<<=1);if(f>0)for(r.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(n=0===t.cmpn(1)?a:s).cmpn(0)<0&&n.iadd(e),n},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)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(i)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){i("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var o=n,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),i(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:n<e?-1:1}return 0!==this.negative?0|-t:t},o.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){i<n?t=-1:i>n&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new S(e)},o.prototype.toRed=function(e){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return i(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return i(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function k(e){S.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var i=t<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},n(y,b),y.prototype.split=function(e,t){for(var r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var n=e.words[9];for(t.words[t.length++]=4194303&n,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,e.words[i-10]=n,0===n&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var i=0|e.words[r];t+=977*i,e.words[r]=67108863&t,t=64*i+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(v,b),n(_,b),n(w,b),w.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var i=19*(0|e.words[r])+t,n=67108863&i;i>>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new y;else if("p224"===e)t=new v;else if("p192"===e)t=new _;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new w}return g[e]=t,t},S.prototype._verify1=function(e){i(0===e.negative,"red works only with positives"),i(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){i(0==(e.negative|t.negative),"red works only with positives"),i(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(i(t%2==1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),a=0;!n.isZero()&&0===n.andln(1);)a++,n.iushrn(1);i(!n.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,c).cmp(u);)h.redIAdd(u);for(var f=this.pow(h,n),l=this.pow(e,n.addn(1).iushrn(1)),d=this.pow(e,n),p=a;0!==d.cmp(s);){for(var m=d,g=0;0!==m.cmp(s);g++)m=m.redSqr();i(g<p);var b=this.pow(f,new o(1).iushln(p-g-1));l=l.redMul(b),f=b.redSqr(),d=d.redMul(f),p=g}return l},S.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},S.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=e;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],e);var n=r[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),i=t.length-1;i>=0;i--){for(var c=t.words[i],h=u-1;h>=0;h--){var f=c>>h&1;n!==r[0]&&(n=this.sqr(n)),0!==f||0!==a?(a<<=1,a|=f,(4===++s||0===i&&0===h)&&(n=this.mul(n,r[a]),s=0,a=0)):s=0}u=26}return n},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new k(e)},n(k,S),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},k.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).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)},k.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,this)}).call(this,r(24)(e))},function(e,t,r){"use strict";(function(t){var i=r(7),n=r(5),o=r(3),a=function(e){for(var r=t.alloc(e.length),i=0;i<e.length;i++)r[i]=e[e.length-1-i];return r};i.Zero=new i(0),i.One=new i(1),i.Minus1=new i(-1),i.fromNumber=function(e){return n.checkArgument(o.isNumber(e)),new i(e)},i.fromString=function(e,t){return n.checkArgument(o.isString(e)),new i(e,t)},i.fromBuffer=function(e,t){void 0!==t&&"little"===t.endian&&(e=a(e));var r=e.toString("hex");return new i(r,16)},i.fromSM=function(e,r){var n;if(0===e.length)return i.fromBuffer(t.from([0]));var o="big";return r&&(o=r.endian),"little"===o&&(e=a(e)),128&e[0]?(e[0]=127&e[0],(n=i.fromBuffer(e)).neg().copy(n)):n=i.fromBuffer(e),n},i.prototype.toNumber=function(){return parseInt(this.toString(10),10)},i.prototype.toBuffer=function(e){var r,n;if(e&&e.size){var o=(n=this.toString(16,2)).length/2;r=t.from(n,"hex"),o===e.size||(o>e.size?r=i.trim(r,o):o<e.size&&(r=i.pad(r,o,e.size)))}else n=this.toString(16,2),r=t.from(n,"hex");return void 0!==e&&"little"===e.endian&&(r=a(r)),r},i.prototype.toSMBigEndian=function(){var e;return-1===this.cmp(i.Zero)?128&(e=this.neg().toBuffer())[0]?e=t.concat([t.from([128]),e]):e[0]=128|e[0]:128&(e=this.toBuffer())[0]&&(e=t.concat([t.from([0]),e])),1===e.length&0===e[0]&&(e=t.from([])),e},i.prototype.toSM=function(e){var t=e?e.endian:"big",r=this.toSMBigEndian();return"little"===t&&(r=a(r)),r},i.fromScriptNumBuffer=function(e,t,r){var o=r||4;if(n.checkArgument(e.length<=o,new Error("script number overflow")),t&&e.length>0&&0==(127&e[e.length-1])&&(e.length<=1||0==(128&e[e.length-2])))throw new Error("non-minimally encoded script number");return i.fromSM(e,{endian:"little"})},i.prototype.toScriptNumBuffer=function(){return this.toSM({endian:"little"})},i.trim=function(e,t){return e.slice(t-e.length,e.length)},i.pad=function(e,r,i){for(var n=t.alloc(i),o=0;o<e.length;o++)n[n.length-1-o]=e[e.length-1-o];for(o=0;o<i-r;o++)n[o]=0;return n},i.prototype.toHex=function(...e){return this.toBuffer(...e).toString("hex")},i.fromHex=function(e,...r){return i.fromBuffer(t.from(e,"hex"),...r)},e.exports=i}).call(this,r(0).Buffer)},function(e,t,r){"use strict";t.randomBytes=t.rng=t.pseudoRandomBytes=t.prng=r(33),t.createHash=t.Hash=r(37),t.createHmac=t.Hmac=r(111);var i=r(218),n=Object.keys(i),o=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(n);t.getHashes=function(){return o};var a=r(114);t.pbkdf2=a.pbkdf2,t.pbkdf2Sync=a.pbkdf2Sync;var s=r(220);t.Cipher=s.Cipher,t.createCipher=s.createCipher,t.Cipheriv=s.Cipheriv,t.createCipheriv=s.createCipheriv,t.Decipher=s.Decipher,t.createDecipher=s.createDecipher,t.Decipheriv=s.Decipheriv,t.createDecipheriv=s.createDecipheriv,t.getCiphers=s.getCiphers,t.listCiphers=s.listCiphers;var u=r(235);t.DiffieHellmanGroup=u.DiffieHellmanGroup,t.createDiffieHellmanGroup=u.createDiffieHellmanGroup,t.getDiffieHellman=u.getDiffieHellman,t.createDiffieHellman=u.createDiffieHellman,t.DiffieHellman=u.DiffieHellman;var c=r(240);t.createSign=c.createSign,t.Sign=c.Sign,t.createVerify=c.createVerify,t.Verify=c.Verify,t.createECDH=r(278);var h=r(279);t.publicEncrypt=h.publicEncrypt,t.privateEncrypt=h.privateEncrypt,t.publicDecrypt=h.publicDecrypt,t.privateDecrypt=h.privateDecrypt;var f=r(282);t.randomFill=f.randomFill,t.randomFillSync=f.randomFillSync,t.createCredentials=function(){throw new Error("sorry, createCredentials is not implemented yet\nwe accept pull requests\nhttps://github.com/browserify/crypto-browserify")},t.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},function(e,t,r){(function(t){t.browser?e.exports=r(286):e.exports=r(287)}).call(this,r(6))},function(e,t,r){"use strict";(function(t){var i=r(8),n=r(3),o=r(5),a=r(12),s=function e(t,r){if(!(this instanceof e))return new e(t,r);if(t instanceof i)this.set({r:t,s:r});else if(t){var n=t;this.set(n)}};s.prototype.set=function(e){return this.r=e.r||this.r||void 0,this.s=e.s||this.s||void 0,this.i=void 0!==e.i?e.i:this.i,this.compressed=void 0!==e.compressed?e.compressed:this.compressed,this.nhashtype=e.nhashtype||this.nhashtype||void 0,this},s.fromCompact=function(e){o.checkArgument(t.isBuffer(e),"Argument is expected to be a Buffer");var r=new s,n=!0,a=e.slice(0,1)[0]-27-4;a<0&&(n=!1,a+=4);var u=e.slice(1,33),c=e.slice(33,65);return o.checkArgument(0===a||1===a||2===a||3===a,new Error("i must be 0, 1, 2, or 3")),o.checkArgument(32===u.length,new Error("r must be 32 bytes")),o.checkArgument(32===c.length,new Error("s must be 32 bytes")),r.compressed=n,r.i=a,r.r=i.fromBuffer(u),r.s=i.fromBuffer(c),r},s.fromDER=s.fromBuffer=function(e,t){var r=s.parseDER(e,t),i=new s;return i.r=r.r,i.s=r.s,i},s.fromTxFormat=function(e){var t=e.readUInt8(e.length-1),r=e.slice(0,e.length-1),i=s.fromDER(r,!1);return i.nhashtype=t,i},s.fromString=function(e){var r=t.from(e,"hex");return s.fromDER(r)},s.parseDER=function(e,r){o.checkArgument(t.isBuffer(e),new Error("DER formatted signature should be a buffer")),n.isUndefined(r)&&(r=!0);var a=e[0];o.checkArgument(48===a,new Error("Header byte should be 0x30"));var s=e[1],u=e.slice(2).length;o.checkArgument(!r||s===u,new Error("Length byte should length of what follows")),s=s<u?s:u;var c=e[2];o.checkArgument(2===c,new Error("Integer byte for r should be 0x02"));var h=e[3],f=e.slice(4,4+h),l=i.fromBuffer(f),d=0===e[4];o.checkArgument(h===f.length,new Error("Length of r incorrect"));var p=e[4+h+0];o.checkArgument(2===p,new Error("Integer byte for s should be 0x02"));var m=e[4+h+1],g=e.slice(4+h+2,4+h+2+m),b=i.fromBuffer(g),y=0===e[4+h+2+2];o.checkArgument(m===g.length,new Error("Length of s incorrect"));var v=4+h+2+m;return o.checkArgument(s===v-2,new Error("Length of signature incorrect")),{header:a,length:s,rheader:c,rlength:h,rneg:d,rbuf:f,r:l,sheader:p,slength:m,sneg:y,sbuf:g,s:b}},s.prototype.toCompact=function(e,r){if(e="number"==typeof e?e:this.i,r="boolean"==typeof r?r:this.compressed,0!==e&&1!==e&&2!==e&&3!==e)throw new Error("i must be equal to 0, 1, 2, or 3");var i=e+27+4;!1===r&&(i-=4);var n=t.from([i]),o=this.r.toBuffer({size:32}),a=this.s.toBuffer({size:32});return t.concat([n,o,a])},s.prototype.toBuffer=s.prototype.toDER=function(){var e=this.r.toBuffer(),r=this.s.toBuffer(),i=!!(128&e[0]),n=!!(128&r[0]),o=i?t.concat([t.from([0]),e]):e,a=n?t.concat([t.from([0]),r]):r,s=o.length,u=a.length,c=2+s+2+u;return t.concat([t.from([48,c,2,s]),o,t.from([2,u]),a])},s.prototype.toString=function(){return this.toDER().toString("hex")},s.isTxDER=function(e){if(e.length<9)return!1;if(e.length>73)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-3)return!1;var t=e[3];if(5+t>=e.length)return!1;var r=e[5+t];if(t+r+7!==e.length)return!1;var i=e.slice(4);if(2!==e[2])return!1;if(0===t)return!1;if(128&i[0])return!1;if(t>1&&0===i[0]&&!(128&i[1]))return!1;var n=e.slice(6+t);return 2===e[6+t-2]&&(0!==r&&(!(128&n[0])&&!(r>1&&0===n[0]&&!(128&n[1]))))},s.prototype.hasLowS=function(){return!this.s.lt(new i(1))&&!this.s.gt(new i("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex"))},s.prototype.hasDefinedHashtype=function(){if(!a.isNaturalNumber(this.nhashtype))return!1;var e=31&this.nhashtype;return!(e<s.SIGHASH_ALL||e>s.SIGHASH_SINGLE)},s.prototype.toTxFormat=function(){var e=this.toDER(),r=t.alloc(1);return r.writeUInt8(this.nhashtype,0),t.concat([e,r])},s.SIGHASH_ALL=1,s.SIGHASH_NONE=2,s.SIGHASH_SINGLE=3,s.SIGHASH_FORKID=64,s.SIGHASH_ANYONECANPAY=128,s.prototype.isCanonical=function(){var e=r(17).getN().shrn(1);return this.s.lte(e)},s.prototype.toCanonical=function(){if(this.isCanonical())return new s({r:this.r,s:this.s,i:this.i,compressed:this.compressed,nhashtype:this.nhashtype});var e=r(17).getN().sub(this.s);return new s({r:this.r,s:e,i:this.i,compressed:this.compressed,nhashtype:this.nhashtype})},s.prototype.validate=function(){if(!this.r||!this.s)throw new Error("Signature missing r or s component");if(this.r.isZero())throw new Error("Signature r component is zero");if(this.s.isZero())throw new Error("Signature s component is zero");var e=r(17).getN();if(this.r.gte(e))throw new Error("Signature r component >= curve order");if(this.s.gte(e))throw new Error("Signature s component >= curve order");if(this.r.isNeg())throw new Error("Signature r component is negative");if(this.s.isNeg())throw new Error("Signature s component is negative");return!0},s.prototype.isValid=function(){try{return this.validate(),!0}catch(e){return!1}},s.prototype.applySecurityPatches=function(){var e=r(17).getN(),t=e.shrn(1);if(this.r.isZero()||this.s.isZero())throw new Error("Invalid signature: zero r or s");if(this.r.gte(e)||this.s.gte(e))throw new Error("Invalid signature: out of range");return this.s.gt(t)&&(this.s=e.sub(this.s)),this},e.exports=s}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(5),o=function(e){return!!i.isString(e)&&/^[0-9a-fA-F]+$/.test(e)};e.exports={isValidJSON:function(e){var t;if(!i.isString(e))return!1;try{t=JSON.parse(e)}catch(e){return!1}return"object"==typeof t},isHexa:o,isHexaString:o,defineImmutable:function(e,t){return Object.keys(t).forEach((function(r){Object.defineProperty(e,r,{configurable:!1,enumerable:!0,value:t[r]})})),e},isNaturalNumber:function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e&&e>=0},integerAsBuffer:function(e){n.checkArgumentType(e,"number","integer");const r=t.allocUnsafe(4);return r.writeUInt32BE(e,0),r}}}).call(this,r(0).Buffer)},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=r,r.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},function(e,t,r){"use strict";var i=t,n=r(7),o=r(14),a=r(128);i.assert=o,i.toArray=a.toArray,i.zero2=a.zero2,i.toHex=a.toHex,i.encode=a.encode,i.getNAF=function(e,t,r){var i,n=new Array(Math.max(e.bitLength(),r)+1);for(i=0;i<n.length;i+=1)n[i]=0;var o=1<<t+1,a=e.clone();for(i=0;i<n.length;i++){var s,u=a.andln(o-1);a.isOdd()?(s=u>(o>>1)-1?(o>>1)-u:u,a.isubn(s)):s=0,n[i]=s,a.iushrn(1)}return n},i.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var i,n=0,o=0;e.cmpn(-n)>0||t.cmpn(-o)>0;){var a,s,u=e.andln(3)+n&3,c=t.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=0==(1&u)?0:3!==(i=e.andln(7)+n&7)&&5!==i||2!==c?u:-u,r[0].push(a),s=0==(1&c)?0:3!==(i=t.andln(7)+o&7)&&5!==i||2!==u?c:-c,r[1].push(s),2*n===a+1&&(n=1-n),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},i.cachedProperty=function(e,t,r){var i="_"+t;e.prototype[t]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},i.parseBytes=function(e){return"string"==typeof e?i.toArray(e,"hex"):e},i.intFromLE=function(e){return new n(e,"hex","le")}},function(e,t,r){"use strict";var i=r(3);function n(e,t){return e.replace("{0}",t[0]).replace("{1}",t[1]).replace("{2}",t[2])}var o=function(e,t){var r=function(){if(i.isString(t.message))this.message=n(t.message,arguments);else{if(!i.isFunction(t.message))throw new Error("Invalid error definition for "+t.name);this.message=t.message.apply(null,arguments)}this.stack=this.message+"\n"+(new Error).stack};return(r.prototype=Object.create(e.prototype)).name=e.prototype.name+t.name,e[t.name]=r,t.errors&&a(r,t.errors),r},a=function(e,t){i.each(t,(function(t){o(e,t)}))},s={Error:function(){this.message="Internal error",this.stack=this.message+"\n"+(new Error).stack}};s.Error.prototype=Object.create(Error.prototype),s.Error.prototype.name="bsv.Error";var u,c=r(285);u=s.Error,a(u,c),e.exports=s.Error,e.exports.extend=function(e){return o(s.Error,e)}},function(e,t,r){"use strict";(function(t){var i=r(8),n=new(0,r(29).ec)("secp256k1"),o=n.curve.point.bind(n.curve),a=n.curve.pointFromX.bind(n.curve),s=function(e,t,r){try{var i=o(e,t,r)}catch(e){throw new Error("Invalid Point")}return i.validate(),i};s.prototype=Object.getPrototypeOf(n.curve.point()),s.fromX=function(e,t){try{var r=a(t,e)}catch(e){throw new Error("Invalid X")}return r.validate(),r},s.getG=function(){return n.curve.g},s.getN=function(){return new i(n.curve.n.toArray())},s.prototype._getX||(s.prototype._getX=s.prototype.getX),s.prototype.getX=function(){return new i(this._getX().toArray())},s.prototype._getY||(s.prototype._getY=s.prototype.getY),s.prototype.getY=function(){return new i(this._getY().toArray())},s.prototype.validate=function(){if(this.isInfinity())throw new Error("Point cannot be equal to Infinity");var e;try{e=a(this.getX(),this.getY().isOdd())}catch(e){throw new Error("Point does not lie on the curve")}if(0!==e.y.cmp(this.y))throw new Error("Invalid y value for curve.");if(!this.mul(s.getN()).isInfinity())throw new Error("Point times N must be infinity");return this},s.pointToCompressed=function(e){var r,i=e.getX().toBuffer({size:32}),n=e.getY().toBuffer({size:32});return r=n[n.length-1]%2?t.from([3]):t.from([2]),t.concat([r,i])},s.pointFromCompressed=function(e){if(33!==e.length)throw new Error("invalid buffer length");let t,r=e[0];if(3===r)t=!0;else{if(2!==r)throw new Error("invalid value of compressed prefix");t=!1}let n=e.slice(1,33),o=i.fromBuffer(n);return s.fromX(t,o)},s.prototype.toBuffer=function(){return s.pointToCompressed(this)},s.prototype.toHex=function(){return this.toBuffer().toString("hex")},s.fromBuffer=function(e){return s.pointFromCompressed(e)},s.fromHex=function(e){return s.fromBuffer(t.from(e,"hex"))},e.exports=s}).call(this,r(0).Buffer)},function(e,t,r){e.exports=r(142),e.exports.Interpreter=r(90)},function(e,t,r){"use strict";var i=r(14),n=r(4);function o(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function a(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function s(e){return 1===e.length?"0"+e:e}function u(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=n,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(var i=0,n=0;n<e.length;n++){var a=e.charCodeAt(n);a<128?r[i++]=a:a<2048?(r[i++]=a>>6|192,r[i++]=63&a|128):o(e,n)?(a=65536+((1023&a)<<10)+(1023&e.charCodeAt(++n)),r[i++]=a>>18|240,r[i++]=a>>12&63|128,r[i++]=a>>6&63|128,r[i++]=63&a|128):(r[i++]=a>>12|224,r[i++]=a>>6&63|128,r[i++]=63&a|128)}else for(n=0;n<e.length;n++)r[n]=0|e[n];return r},t.toHex=function(e){for(var t="",r=0;r<e.length;r++)t+=s(e[r].toString(16));return t},t.htonl=a,t.toHex32=function(e,t){for(var r="",i=0;i<e.length;i++){var n=e[i];"little"===t&&(n=a(n)),r+=u(n.toString(16))}return r},t.zero2=s,t.zero8=u,t.join32=function(e,t,r,n){var o=r-t;i(o%4==0);for(var a=new Array(o/4),s=0,u=t;s<a.length;s++,u+=4){var c;c="big"===n?e[u]<<24|e[u+1]<<16|e[u+2]<<8|e[u+3]:e[u+3]<<24|e[u+2]<<16|e[u+1]<<8|e[u],a[s]=c>>>0}return a},t.split32=function(e,t){for(var r=new Array(4*e.length),i=0,n=0;i<e.length;i++,n+=4){var o=e[i];"big"===t?(r[n]=o>>>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(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<<t|e>>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,i){return e+t+r+i>>>0},t.sum32_5=function(e,t,r,i,n){return e+t+r+i+n>>>0},t.sum64=function(e,t,r,i){var n=e[t],o=i+e[t+1]>>>0,a=(o<i?1:0)+r+n;e[t]=a>>>0,e[t+1]=o},t.sum64_hi=function(e,t,r,i){return(t+i>>>0<t?1:0)+e+r>>>0},t.sum64_lo=function(e,t,r,i){return t+i>>>0},t.sum64_4_hi=function(e,t,r,i,n,o,a,s){var u=0,c=t;return u+=(c=c+i>>>0)<t?1:0,u+=(c=c+o>>>0)<o?1:0,e+r+n+a+(u+=(c=c+s>>>0)<s?1:0)>>>0},t.sum64_4_lo=function(e,t,r,i,n,o,a,s){return t+i+o+s>>>0},t.sum64_5_hi=function(e,t,r,i,n,o,a,s,u,c){var h=0,f=t;return h+=(f=f+i>>>0)<t?1:0,h+=(f=f+o>>>0)<o?1:0,h+=(f=f+s>>>0)<s?1:0,e+r+n+a+u+(h+=(f=f+c>>>0)<c?1:0)>>>0},t.sum64_5_lo=function(e,t,r,i,n,o,a,s,u,c){return t+i+o+s+c>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},function(e,t,r){"use strict";(function(t){var i=r(8),n=r(17),o=r(10),a=r(12),s=r(30),u=r(3),c=r(5);function h(e,t){if(!(this instanceof h))return new h(e,t);if(c.checkArgument(e,"First argument is required, please include public key data."),e instanceof h)return e;t=t||{};var r=this._classifyArgs(e,t);return r.point.validate(),a.defineImmutable(this,{point:r.point,compressed:r.compressed,network:r.network||s.defaultNetwork}),this}h.prototype._classifyArgs=function(e,r){var i={compressed:u.isUndefined(r.compressed)||r.compressed};if(e instanceof n)i.point=e;else if(e.x&&e.y)i=h._transformObject(e);else if("string"==typeof e)i=h._transformDER(t.from(e,"hex"));else if(h._isBuffer(e))i=h._transformDER(e);else{if(!h._isPrivateKey(e))throw new TypeError("First argument is an unrecognized data format.");i=h._transformPrivateKey(e)}return i.network||(i.network=u.isUndefined(r.network)?void 0:s.get(r.network)),i},h._isPrivateKey=function(e){return e instanceof r(60)},h._isBuffer=function(e){return e instanceof t||e instanceof Uint8Array},h._transformPrivateKey=function(e){c.checkArgument(h._isPrivateKey(e),"Must be an instance of PrivateKey");var t={};return t.point=n.getG().mul(e.bn),t.compressed=e.compressed,t.network=e.network,t},h._transformDER=function(e,t){c.checkArgument(h._isBuffer(e),"Must be a buffer of DER encoded public key");var r,o,a,s,f={};if(t=!!u.isUndefined(t)||t,4!==e[0]&&(t||6!==e[0]&&7!==e[0]))if(3===e[0])a=e.slice(1),r=new i(a),(f=h._transformX(!0,r)).compressed=!0;else{if(2!==e[0])throw new TypeError("Invalid DER format public key");a=e.slice(1),r=new i(a),(f=h._transformX(!1,r)).compressed=!0}else{if(a=e.slice(1,33),s=e.slice(33,65),32!==a.length||32!==s.length||65!==e.length)throw new TypeError("Length of x and y must be 32 bytes");r=new i(a),o=new i(s),f.point=new n(r,o),f.compressed=!1}return f},h._transformX=function(e,t){c.checkArgument("boolean"==typeof e,"Must specify whether y is odd or not (true or false)");var r={};return r.point=n.fromX(e,t),r},h._transformObject=function(e){var t=new i(e.x,"hex"),r=new i(e.y,"hex");return new h(new n(t,r),{compressed:e.compressed})},h.fromPrivateKey=function(e){c.checkArgument(h._isPrivateKey(e),"Must be an instance of PrivateKey");var t=h._transformPrivateKey(e);return new h(t.point,{compressed:t.compressed,network:t.network})},h.fromDER=h.fromBuffer=function(e,t){c.checkArgument(h._isBuffer(e),"Must be a buffer of DER encoded public key");var r=h._transformDER(e,t);return new h(r.point,{compressed:r.compressed})},h.fromPoint=function(e,t){return c.checkArgument(e instanceof n,"First argument must be an instance of Point."),new h(e,{compressed:t})},h.fromHex=h.fromString=function(e,r){var i=t.from(e,r||"hex"),n=h._transformDER(i);return new h(n.point,{compressed:n.compressed})},h.fromX=function(e,t){var r=h._transformX(e,t);return new h(r.point,{compressed:r.compressed})},h.getValidationError=function(e){var t;try{new h(e)}catch(e){t=e}return t},h.isValid=function(e){return!h.getValidationError(e)},h.prototype.toObject=h.prototype.toJSON=function(){return{x:this.point.getX().toString("hex",2),y:this.point.getY().toString("hex",2),compressed:this.compressed}},h.prototype.toBuffer=h.prototype.toDER=function(){var e,r=this.point.getX(),i=this.point.getY(),n=r.toBuffer({size:32}),o=i.toBuffer({size:32});return this.compressed?(e=o[o.length-1]%2?t.from([3]):t.from([2]),t.concat([e,n])):(e=t.from([4]),t.concat([e,n,o]))},h.prototype._getID=function(){return o.sha256ripemd160(this.toBuffer())},h.prototype.toAddress=function(e){return r(36).fromPublicKey(this,e||this.network)},h.prototype.toString=h.prototype.toHex=function(){return this.toDER().toString("hex")},h.prototype.inspect=function(){return"<PublicKey: "+this.toHex()+(this.compressed?"":", uncompressed")+">"},e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(48),n=function e(t){if(!(this instanceof e))return new e(t);this.bufLen=0,t?this.set(t):this.bufs=[]};n.prototype.set=function(e){return this.bufs=e.bufs||this.bufs||[],this.bufLen=this.bufs.reduce((function(e,t){return e+t.length}),0),this},n.prototype.toBuffer=function(){return this.concat()},n.prototype.concat=function(){return t.concat(this.bufs,this.bufLen)},n.prototype.write=function(e){return i(t.isBuffer(e)),this.bufs.push(e),this.bufLen+=e.length,this},n.prototype.writeReverse=function(e){return i(t.isBuffer(e)),this.bufs.push(t.from(e).reverse()),this.bufLen+=e.length,this},n.prototype.writeUInt8=function(e){var r=t.alloc(1);return r.writeUInt8(e,0),this.write(r),this},n.prototype.writeUInt16BE=function(e){var r=t.alloc(2);return r.writeUInt16BE(e,0),this.write(r),this},n.prototype.writeUInt16LE=function(e){var r=t.alloc(2);return r.writeUInt16LE(e,0),this.write(r),this},n.prototype.writeUInt32BE=function(e){var r=t.alloc(4);return r.writeUInt32BE(e,0),this.write(r),this},n.prototype.writeInt32LE=function(e){var r=t.alloc(4);return r.writeInt32LE(e,0),this.write(r),this},n.prototype.writeUInt32LE=function(e){var r=t.alloc(4);return r.writeUInt32LE(e,0),this.write(r),this},n.prototype.writeUInt64BEBN=function(e){var t=e.toBuffer({size:8});return this.write(t),this},n.prototype.writeUInt64LEBN=function(e){var t=e.toBuffer({size:8});return this.writeReverse(t),this},n.prototype.writeVarintNum=function(e){var t=n.varintBufNum(e);return this.write(t),this},n.prototype.writeVarintBN=function(e){var t=n.varintBufBN(e);return this.write(t),this},n.varintBufNum=function(e){var r;return e<253?(r=t.alloc(1)).writeUInt8(e,0):e<65536?((r=t.alloc(3)).writeUInt8(253,0),r.writeUInt16LE(e,1)):e<4294967296?((r=t.alloc(5)).writeUInt8(254,0),r.writeUInt32LE(e,1)):((r=t.alloc(9)).writeUInt8(255,0),r.writeInt32LE(-1&e,1),r.writeUInt32LE(Math.floor(e/4294967296),5)),r},n.varintBufBN=function(e){var r,i=e.toNumber();if(i<253)(r=t.alloc(1)).writeUInt8(i,0);else if(i<65536)(r=t.alloc(3)).writeUInt8(253,0),r.writeUInt16LE(i,1);else if(i<4294967296)(r=t.alloc(5)).writeUInt8(254,0),r.writeUInt32LE(i,1);else{var o=new n;o.writeUInt8(255),o.writeUInt64LEBN(e),r=o.concat()}return r},e.exports=n}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(2);r(9);function n(e,r){if(!(this instanceof n))return new n(e,r);this.preimage=t.isBuffer(e)?e:t.from(e,"hex"),this.options=r||{},this.strategy=this.options.strategy||"DYNAMIC",this.fields=null,this.sighashInfo=null,this.options.deferExtraction||this._extractFields()}n.prototype.extract=function(e){return this.strategy=e||this.strategy,this._extractFields(),this.fields},n.prototype.getSighashInfo=function(){return this.fields||this._extractFields(),this.sighashInfo},n.prototype.getField=function(e){return this.fields||this._extractFields(),this.fields[e]},n.prototype.extractField=function(e,t){t=t||{},this.fields||this._extractFields();var r=this._parsePreimageStructure(),i=this._generateBidirectionalASM(e,r,t.includeComments),n=this._extractSpecificField(e,r),o=this._interpretField(e,n,r);return{field:e,value:n?n.toString("hex"):null,buffer:n,asm:i,interpretation:o,strategy:this._getExtractionStrategy(e),structure:r._structure}},n.prototype.generateASM=function(e,t){var r=this._parsePreimageStructure();return this._generateBidirectionalASM(e,r,t)},n.prototype.extractFields=function(e){var t={};return e.forEach(function(e){t[e]=this.extractField(e)}.bind(this)),t},n.prototype.validate=function(){this.fields||this._extractFields();var e=[],t=[];return["version","hashPrevouts","hashSequence","outpoint","scriptCode","amount","sequence","hashOutputs","locktime","sighash"].forEach(function(t){this.fields[t]||e.push("Missing required field: "+t)}.bind(this)),this.sighashInfo.hasZeroHashes&&t.push("Zero hashes detected - check SIGHASH flags: "+this.sighashInfo.zeroFields.join(", ")),this.preimage.length<104&&e.push("Preimage too short: "+this.preimage.length+" bytes (minimum 104)"),{valid:0===e.length,errors:e,warnings:t,sighashInfo:this.sighashInfo}},n.prototype.toObject=function(){return this.fields||this._extractFields(),{preimage:this.preimage.toString("hex"),length:this.preimage.length,strategy:this.strategy,fields:{version:this.fields.version?this.fields.version.toString("hex"):null,hashPrevouts:this.fields.hashPrevouts?this.fields.hashPrevouts.toString("hex"):null,hashSequence:this.fields.hashSequence?this.fields.hashSequence.toString("hex"):null,outpoint:this.fields.outpoint?this.fields.outpoint.toString("hex"):null,scriptCode:this.fields.scriptCode?this.fields.scriptCode.toString("hex"):null,scriptCodeLength:this.fields.scriptCodeLength,amount:this.fields.amount?this.fields.amount.toString("hex"):null,sequence:this.fields.sequence?this.fields.sequence.toString("hex"):null,hashOutputs:this.fields.hashOutputs?this.fields.hashOutputs.toString("hex"):null,locktime:this.fields.locktime?this.fields.locktime.toString("hex"):null,sighash:this.fields.sighash?this.fields.sighash.toString("hex"):null},sighashInfo:this.sighashInfo,validation:this.validate()}},n.prototype._extractFields=function(){this.fields={},this.sighashInfo={flag:null,hasZeroHashes:!1,zeroFields:[],warnings:[]};try{"LEFT"===this.strategy||"DYNAMIC"===this.strategy?this._extractFromLeft():"RIGHT"===this.strategy&&this._extractFromRight(),this._analyzeSighash()}catch(e){if("DYNAMIC"!==this.strategy)throw e;try{this.strategy="RIGHT",this._extractFromRight(),this._analyzeSighash()}catch(t){throw new Error("Failed to extract preimage fields with any strategy: "+e.message)}}},n.prototype._extractFromLeft=function(){var e=0;this.fields.version=this.preimage.slice(e,e+4),e+=4,this.fields.hashPrevouts=this.preimage.slice(e,e+32),e+=32,this.fields.hashSequence=this.preimage.slice(e,e+32),e+=32,this.fields.outpoint=this.preimage.slice(e,e+36),e+=36;var t=n.decodeCompactSize(this.preimage,e);this.fields.scriptCodeLength=t.value,e=t.nextOffset,this.fields.scriptCode=this.preimage.slice(e,e+this.fields.scriptCodeLength),e+=this.fields.scriptCodeLength,this.fields.amount=this.preimage.slice(e,e+8),e+=8,this.fields.sequence=this.preimage.slice(e,e+4),e+=4,this.fields.hashOutputs=this.preimage.slice(e,e+32),e+=32,this.fields.locktime=this.preimage.slice(e,e+4),e+=4,this.fields.sighash=this.preimage.slice(e,e+4)},n.prototype._extractFromRight=function(){var e=this.preimage.length;e-=4,this.fields.sighash=this.preimage.slice(e,e+4),e-=4,this.fields.locktime=this.preimage.slice(e,e+4),e-=32,this.fields.hashOutputs=this.preimage.slice(e,e+32),e-=4,this.fields.sequence=this.preimage.slice(e,e+4),e-=8,this.fields.amount=this.preimage.slice(e,e+8);var t=n.decodeCompactSize(this.preimage,104);this.fields.scriptCodeLength=t.value,this.fields.scriptCode=this.preimage.slice(t.nextOffset,t.nextOffset+this.fields.scriptCodeLength),this.fields.version=this.preimage.slice(0,4),this.fields.hashPrevouts=this.preimage.slice(4,36),this.fields.hashSequence=this.preimage.slice(36,68),this.fields.outpoint=this.preimage.slice(68,104)},n.prototype._analyzeSighash=function(){if(this.fields.sighash){var e=this.fields.sighash.readUInt32LE(0);this.sighashInfo.flag=e;var r=31&e,i=0!=(128&e),n=0!=(64&e),o=t.alloc(32);i&&this.fields.hashPrevouts.equals(o)&&(this.sighashInfo.hasZeroHashes=!0,this.sighashInfo.zeroFields.push("hashPrevouts"),this.sighashInfo.warnings.push("ANYONECANPAY flag detected - hashPrevouts is zero")),2===r&&this.fields.hashSequence.equals(o)&&(this.sighashInfo.hasZeroHashes=!0,this.sighashInfo.zeroFields.push("hashSequence"),this.sighashInfo.warnings.push("SIGHASH_NONE flag detected - hashSequence is zero")),2!==r&&3!==r||!this.fields.hashOutputs.equals(o)||(this.sighashInfo.hasZeroHashes=!0,this.sighashInfo.zeroFields.push("hashOutputs"),this.sighashInfo.warnings.push("SIGHASH_NONE/SINGLE flag detected - hashOutputs is zero"));var a=[];1===r?a.push("ALL"):2===r?a.push("NONE"):3===r&&a.push("SINGLE"),i&&a.push("ANYONECANPAY"),n&&a.push("FORKID"),this.sighashInfo.flagName=a.join(" | ")}},n.prototype._parsePreimageStructure=function(){for(var e=this.preimage,t=0,r={},i=[{name:"nVersion",len:4},{name:"hashPrevouts",len:32},{name:"hashSequence",len:32},{name:"outpoint_txid",len:32},{name:"outpoint_vout",len:4}],o=[{name:"value",len:8},{name:"nSequence",len:4},{name:"hashOutputs",len:32},{name:"nLocktime",len:4},{name:"sighashType",len:4}],a=0;a<i.length;a++){var s=i[a];r[s.name]=e.slice(t,t+s.len).toString("hex"),t+=s.len}var u=n.decodeCompactSize(e,t);r.scriptLen=u.value,r.scriptLenSize=u.bytes,r.scriptLenRaw=e.slice(t,t+u.bytes).toString("hex"),t+=u.bytes,r.scriptCode=e.slice(t,t+r.scriptLen).toString("hex"),t+=r.scriptLen;for(var c=0;c<o.length;c++){var h=o[c];r[h.name]=e.slice(t,t+h.len).toString("hex"),t+=h.len}var f=i.reduce((function(e,t){return e+t.len}),0),l=o.reduce((function(e,t){return e+t.len}),0);return r._structure={leftFixed:f,scriptLenVarint:u.bytes,scriptCode:r.scriptLen,rightFixed:l,totalCalculated:f+u.bytes+r.scriptLen+l,totalActual:e.length},r},n.prototype._generateBidirectionalASM=function(e,t,r){if(["value","nSequence","hashOutputs","nLocktime","sighashType"].includes(e))return this._generateRightExtractionASM(e,r);if(["nVersion","hashPrevouts","hashSequence","outpoint_txid","outpoint_vout"].includes(e))return this._generateLeftExtractionASM(e,r);if("scriptCode"===e)return this._generateDynamicExtractionASM(t,r);if("scriptLen"===e)return this._generateScriptLenExtractionASM(t,r);throw new Error("Unknown field: "+e)},n.prototype._generateRightExtractionASM=function(e,t){for(var r=[{name:"value",len:8},{name:"nSequence",len:4},{name:"hashOutputs",len:32},{name:"nLocktime",len:4},{name:"sighashType",len:4}],i=0,n=0,o=!1,a=0;a<r.length;a++){var s=r[a];if(s.name===e){n=s.len,o=!0;break}i+=s.len}if(!o)throw new Error("Field not found in RIGHT fields: "+e);var u=52-i,c=[];return t?(c.push("# 🔄 Extract "+e+" from RIGHT side (bidirectional strategy)"),c.push("OP_SIZE # Push preimage size: [preimage, size]")):c.push("OP_SIZE"),(c=t?c.concat([u+" OP_SUB # Calculate split point: [preimage, split_point]","OP_SPLIT # Split: [left_part, right_part]","OP_DROP # Drop left: [right_part]",n+" OP_SPLIT # Extract field: [remaining, "+e+"]","OP_DROP # Clean up: ["+e+"]","# ✅ Result: "+e+" is now on top of stack"]):c.concat([u+" OP_SUB","OP_SPLIT","OP_DROP",n+" OP_SPLIT","OP_DROP"])).join("\n")},n.prototype._generateLeftExtractionASM=function(e,t){var r=[{name:"nVersion",len:4,offset:0},{name:"hashPrevouts",len:32,offset:4},{name:"hashSequence",len:32,offset:36},{name:"outpoint_txid",len:32,offset:68},{name:"outpoint_vout",len:4,offset:100}].find((function(t){return t.name===e}));if(!r)throw new Error("Field not found in LEFT fields: "+e);return(t?["# 🔄 Extract "+e+" from LEFT side (bidirectional strategy)",r.offset+" OP_SPLIT # Skip to field: [prefix, remainder]","OP_DROP # Drop prefix: [remainder]",r.len+" OP_SPLIT # Extract field: ["+e+", suffix]","OP_DROP # Clean up: ["+e+"]","# ✅ Result: "+e+" is now on top of stack"]:[r.offset+" OP_SPLIT","OP_DROP",r.len+" OP_SPLIT","OP_DROP"]).join("\n")},n.prototype._generateDynamicExtractionASM=function(e,t){return["# 🎯 Extract scriptCode DYNAMICALLY with CompactSize varint support",104+e.scriptLenSize+" OP_SPLIT # Skip left zone + scriptLen varint: [left_zone, remainder]","OP_DROP # Drop left: [remainder]",e.scriptLen+" OP_SPLIT # Extract scriptCode: [scriptCode, right_zone]","OP_DROP # Clean up: [scriptCode]","# ✅ Result: scriptCode extracted with "+e.scriptLenSize+"-byte varint awareness"].join("\n")},n.prototype._generateScriptLenExtractionASM=function(e,t){return["# 🎯 Extract scriptLen CompactSize varint ("+e.scriptLenSize+" bytes)","104 OP_SPLIT # Skip left fixed fields: [left_zone, remainder]","OP_DROP # Drop left: [remainder]",e.scriptLenSize+" OP_SPLIT # Extract varint: [scriptLen_varint, suffix]","OP_DROP # Clean up: [scriptLen_varint]","# ✅ Result: CompactSize varint (decode off-chain to get "+e.scriptLen+")"].join("\n")},n.prototype._extractSpecificField=function(e,r){var i=r[e];return i?t.from(i,"hex"):null},n.prototype._interpretField=function(e,r,i){if(!r)return null;var n={raw:r.toString("hex"),bytes:r.length};try{switch(e){case"nVersion":n.value=r.readUInt32LE(0),n.description="Transaction version "+n.value;break;case"value":8===r.length&&(n.satoshis=r.readBigUInt64LE(0).toString(),n.description=n.satoshis+" satoshis");break;case"sighashType":var o=r.readUInt32LE(0);n.value=o,n.description={1:"SIGHASH_ALL",65:"SIGHASH_ALL | FORKID",2:"SIGHASH_NONE",66:"SIGHASH_NONE | FORKID",3:"SIGHASH_SINGLE",67:"SIGHASH_SINGLE | FORKID"}[o]||"Custom ("+o+")";break;case"outpoint_vout":n.value=r.readUInt32LE(0),n.description="Output index "+n.value;break;case"scriptLen":n.varintSize=i.scriptLenSize,n.scriptLength=i.scriptLen,n.description=i.scriptLen+" bytes encoded as "+i.scriptLenSize+"-byte varint";break;case"scriptCode":25===r.length&&118===r[0]&&169===r[1]?(n.description="Standard P2PKH script (25 bytes)",n.type="P2PKH"):r.length>0&&106===r[0]?(n.description="OP_RETURN data script ("+r.length+" bytes)",n.type="OP_RETURN"):(n.description="Custom script ("+r.length+" bytes)",n.type="CUSTOM");break;default:if(["hashPrevouts","hashSequence","hashOutputs"].includes(e)){var a=t.alloc(32);r.equals(a)?(n.isZero=!0,n.description="Zero hash (check SIGHASH flags)"):n.description="32-byte hash"}}}catch(e){n.error=e.message}return n},n.prototype._getExtractionStrategy=function(e){return["value","nSequence","hashOutputs","nLocktime","sighashType"].includes(e)?"RIGHT":["nVersion","hashPrevouts","hashSequence","outpoint_txid","outpoint_vout"].includes(e)?"LEFT":"scriptCode"===e?"DYNAMIC":"scriptLen"===e?"VARINT":"UNKNOWN"},n.decodeCompactSize=function(e,t){var r=e[t];if(r<253)return{value:r,nextOffset:t+1,bytes:1};if(253===r)return{value:e.readUInt16LE(t+1),nextOffset:t+3,bytes:3};if(254===r)return{value:e.readUInt32LE(t+1),nextOffset:t+5,bytes:5};console.warn("Encountered 8-byte CompactSize - this is very unusual for script lengths");try{return{value:e.readUInt32LE(t+1),nextOffset:t+9,bytes:9}}catch(e){throw new Error("Invalid 8-byte CompactSize encoding in preimage")}},n.fromTransaction=function(e,t,r,o,a){return new n(i.Transaction.sighash.sighashPreimage(e,a,t,r,new i.crypto.BN(o)),{transaction:e,inputIndex:t,subscript:r,satoshis:o,sighashType:a})},n.createExample=function(e){var t=i.PrivateKey.fromRandom().toAddress(),r={txId:"0".repeat(64),outputIndex:0,script:i.Script.buildPublicKeyHashOut(t).toHex(),satoshis:1e5},o=(new i.Transaction).from(r).to(t,99e3),a=i.Script.fromHex(r.script);return n.fromTransaction(o,0,a,r.satoshis,e)},n.extractFromHex=function(e,t,r){return new n(e,{deferExtraction:!0}).extractField(t,r)},n.generateASMFromHex=function(e,t,r){return new n(e,{deferExtraction:!0}).generateASM(t,r)},n.extractMultipleFromHex=function(e,t){return new n(e,{deferExtraction:!0}).extractFields(t)},n.validateFromHex=function(e){return new n(e).validate()},n.analyzeFromHex=function(e){var t=new n(e),r=t._parsePreimageStructure(),i=t.validate();return{hex:e,length:e.length/2,structure:r._structure,fields:r,validation:i,sighashInfo:t.getSighashInfo(),extractField:function(e){return t.extractField(e)},generateASM:function(e){return t.generateASM(e)},getSummary:function(){return{totalBytes:r._structure.totalActual,scriptLength:r.scriptLen,scriptVarintSize:r.scriptLenSize,sighashType:r.sighashType,valid:i.valid,warnings:i.warnings}}}},e.exports=n}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var i=r(1).Buffer,n=r(66).Transform,o=r(70).StringDecoder,a=r(216),s=r(53);function u(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}a(u,n),u.prototype.update=function(e,t,r){var i=s(e,t),n=this._update(i);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)},u.prototype.setAutoPadding=function(){},u.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},u.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},u.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},u.prototype._transform=function(e,t,r){var i;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){i=e}finally{r(i)}},u.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},u.prototype._finalOrDigest=function(e){var t=this.__final()||i.alloc(0);return e&&(t=this._toString(t,e,!0)),t},u.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 i=this._decoder.write(e);return r&&(i+=this._decoder.end()),i},e.exports=u},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(5),o=r(8),a=function e(r){if(!(this instanceof e))return new e(r);if(!i.isUndefined(r))if(t.isBuffer(r))this.set({buf:r});else if(i.isString(r)){var n=t.from(r,"hex");if(2*n.length!==r.length)throw new TypeError("Invalid hex string");this.set({buf:n})}else{if(!i.isObject(r))throw new TypeError("Unrecognized argument for BufferReader");var o=r;this.set(o)}};a.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this.pos=e.pos||this.pos||0,this},a.prototype.eof=function(){return this.pos>=this.buf.length},a.prototype.finished=a.prototype.eof,a.prototype.read=function(e){n.checkArgument(!i.isUndefined(e),"Must specify a length");var t=this.buf.slice(this.pos,this.pos+e);return this.pos=this.pos+e,t},a.prototype.readAll=function(){var e=this.buf.slice(this.pos,this.buf.length);return this.pos=this.buf.length,e},a.prototype.readUInt8=function(){var e=this.buf.readUInt8(this.pos);return this.pos=this.pos+1,e},a.prototype.readUInt16BE=function(){var e=this.buf.readUInt16BE(this.pos);return this.pos=this.pos+2,e},a.prototype.readUInt16LE=function(){var e=this.buf.readUInt16LE(this.pos);return this.pos=this.pos+2,e},a.prototype.readUInt32BE=function(){var e=this.buf.readUInt32BE(this.pos);return this.pos=this.pos+4,e},a.prototype.readUInt32LE=function(){var e=this.buf.readUInt32LE(this.pos);return this.pos=this.pos+4,e},a.prototype.readInt32LE=function(){var e=this.buf.readInt32LE(this.pos);return this.pos=this.pos+4,e},a.prototype.readUInt64BEBN=function(){var e=this.buf.slice(this.pos,this.pos+8),t=o.fromBuffer(e);return this.pos=this.pos+8,t},a.prototype.readUInt64LEBN=function(){var e,t=this.buf.readUInt32LE(this.pos),r=4294967296*this.buf.readUInt32LE(this.pos+4)+t;if(r<=9007199254740991)e=new o(r);else{var i=Array.prototype.slice.call(this.buf,this.pos,this.pos+8);e=new o(i,10,"le")}return this.pos=this.pos+8,e},a.prototype.readVarintNum=function(){var e=this.readUInt8();switch(e){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:var t=this.readUInt64LEBN().toNumber();if(t<=Math.pow(2,53))return t;throw new Error("number too large to retain precision - use readVarintBN");default:return e}},a.prototype.readVarLengthBuffer=function(){var e=this.readVarintNum(),t=this.read(e);return n.checkState(t.length===e,"Invalid length while reading varlength buffer. Expected to read: "+e+" and read "+t.length),t},a.prototype.readVarintBuf=function(){switch(this.buf.readUInt8(this.pos)){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}},a.prototype.readVarintBN=function(){var e=this.readUInt8();switch(e){case 253:return new o(this.readUInt16LE());case 254:return new o(this.readUInt32LE());case 255:return this.readUInt64LEBN();default:return new o(e)}},a.prototype.reverse=function(){for(var e=t.alloc(this.buf.length),r=0;r<e.length;r++)e[r]=this.buf[this.buf.length-1-r];return this.buf=e,this},a.prototype.readReverse=function(e){i.isUndefined(e)&&(e=this.buf.length);var r=this.buf.slice(this.pos,this.pos+e);return this.pos=this.pos+e,t.from(r).reverse()},e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(0),n=r(11),o=r(18),a=r(27),s=r(25),u=r(21),c=r(8),h=r(10),f=r(87),l=r(5),d=r(90),p=r(3),m=t.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),g=d.SCRIPT_ENABLE_SIGHASH_FORKID,b=function(e,s,f,b,y,v){var _=r(145),w=r(91);p.isUndefined(v)&&(v=g);var S,k=_.shallowCopy(e);(b=new o(b),v&d.SCRIPT_ENABLE_REPLAY_PROTECTION)&&(s=(16711680|57005^s>>8)<<8|255&s);if(s&n.SIGHASH_FORKID&&v&d.SCRIPT_ENABLE_SIGHASH_FORKID)return function(e,r,i,o,a){var s=e.inputs[i];function f(e,t){var r=new u;p.isUndefined(t)?p.each(e.outputs,(function(e){e.toBufferWriter(r)})):e.outputs[t].toBufferWriter(r);var i=r.toBuffer();return h.sha256sha256(i)}l.checkArgument(a instanceof c,"For ForkId=0 signatures, satoshis or complete input must be provided");var d=t.alloc(32),m=t.alloc(32),g=t.alloc(32);r&n.SIGHASH_ANYONECANPAY||(d=function(e){var t=new u;p.each(e.inputs,(function(e){t.writeReverse(e.prevTxId),t.writeUInt32LE(e.outputIndex)}));var r=t.toBuffer();return h.sha256sha256(r)}(e)),r&n.SIGHASH_ANYONECANPAY||(31&r)===n.SIGHASH_SINGLE||(31&r)===n.SIGHASH_NONE||(m=function(e){var t=new u;p.each(e.inputs,(function(e){t.writeUInt32LE(e.sequenceNumber)}));var r=t.toBuffer();return h.sha256sha256(r)}(e)),(31&r)!==n.SIGHASH_SINGLE&&(31&r)!==n.SIGHASH_NONE?g=f(e):(31&r)===n.SIGHASH_SINGLE&&i<e.outputs.length&&(g=f(e,i));var b=new u;b.writeInt32LE(e.version),b.write(d),b.write(m),b.writeReverse(s.prevTxId),b.writeUInt32LE(s.outputIndex),b.writeVarintNum(o.toBuffer().length),b.write(o.toBuffer()),b.writeUInt64LEBN(a);var y=s.sequenceNumber;return b.writeUInt32LE(y),b.write(g),b.writeUInt32LE(e.nLockTime),b.writeUInt32LE(r>>>0),b.toBuffer()}(k,s,f,b,y);for(b.removeCodeseparators(),S=0;S<k.inputs.length;S++)k.inputs[S]=new w(k.inputs[S]).setScript(o.empty());if(k.inputs[f]=new w(k.inputs[f]).setScript(b),(31&s)===n.SIGHASH_NONE||(31&s)===n.SIGHASH_SINGLE)for(S=0;S<k.inputs.length;S++)S!==f&&(k.inputs[S].sequenceNumber=0);if((31&s)===n.SIGHASH_NONE)k.outputs=[];else if((31&s)===n.SIGHASH_SINGLE){if(f>=k.outputs.length)return m;for(k.outputs.length=f+1,S=0;S<f;S++)k.outputs[S]=new a({satoshis:c.fromBuffer(i.Buffer.from("ffffffffffffffff","hex")),script:o.empty()})}return s&n.SIGHASH_ANYONECANPAY&&(k.inputs=[k.inputs[f]]),(new u).write(k.toBuffer()).writeInt32LE(s).toBuffer()},y=function(e,t,r,i,n,o){var a=b(e,t,r,i,n,o);if(0===a.compare(m))return a;var u=h.sha256sha256(a);return u=new s(u).readReverse()};e.exports={sighashPreimage:b,sighash:y,sign:function(e,t,r,i,n,o,a){var s=y(e,r,i,n,o,a);return f.sign(s,t,"little").set({nhashtype:r})},verify:function(e,t,r,i,n,o,a){l.checkArgument(!p.isUndefined(e)),l.checkArgument(!p.isUndefined(t)&&!p.isUndefined(t.nhashtype));var s=y(e,t.nhashtype,i,n,o,a);return f.verify(s,t,r,"little")}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(8),o=r(0),a=r(12),s=r(21),u=r(49),c=r(18),h=r(5),f=r(16);function l(e){if(!(this instanceof l))return new l(e);if(!i.isObject(e))throw new TypeError("Unrecognized argument for Output");var r;this.satoshis=e.satoshis,t.isBuffer(e.script)?this._scriptBuffer=e.script:(r=i.isString(e.script)&&a.isHexa(e.script)?o.Buffer.from(e.script,"hex"):e.script,this.setScript(r))}Object.defineProperty(l.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this._script||this.setScriptFromBuffer(this._scriptBuffer),this._script}}),Object.defineProperty(l.prototype,"satoshis",{configurable:!1,enumerable:!0,get:function(){return this._satoshis},set:function(e){e instanceof n?(this._satoshisBN=e,this._satoshis=e.toNumber()):i.isString(e)?(this._satoshis=parseInt(e),this._satoshisBN=n.fromNumber(this._satoshis)):(h.checkArgument(a.isNaturalNumber(e),"Output satoshis is not a natural number"),this._satoshisBN=n.fromNumber(e),this._satoshis=e),h.checkState(a.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}}),l.prototype.invalidSatoshis=function(){return this._satoshis>9007199254740991?"transaction txout satoshis greater than max safe integer":this._satoshis!==this._satoshisBN.toNumber()?"transaction txout satoshis has corrupted value":this._satoshis<0&&"transaction txout negative"},Object.defineProperty(l.prototype,"satoshisBN",{configurable:!1,enumerable:!0,get:function(){return this._satoshisBN},set:function(e){this._satoshisBN=e,this._satoshis=e.toNumber(),h.checkState(a.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}}),l.prototype.toObject=l.prototype.toJSON=function(){var e={satoshis:this.satoshis};return e.script=this._scriptBuffer.toString("hex"),e},l.fromObject=function(e){return new l(e)},l.prototype.setScriptFromBuffer=function(e){this._scriptBuffer=e;try{this._script=c.fromBuffer(this._scriptBuffer),this._script._isOutput=!0}catch(e){if(!(e instanceof f.Script.InvalidBuffer))throw e;this._script=null}},l.prototype.setScript=function(e){if(e instanceof c)this._scriptBuffer=e.toBuffer(),this._script=e,this._script._isOutput=!0;else if(i.isString(e))this._script=c.fromString(e),this._scriptBuffer=this._script.toBuffer(),this._script._isOutput=!0;else{if(!t.isBuffer(e))throw new TypeError("Invalid argument type: script");this.setScriptFromBuffer(e)}return this},l.prototype.inspect=function(){var e;return e=this.script?this.script.inspect():this._scriptBuffer.toString("hex"),"<Output ("+this.satoshis+" sats) "+e+">"},l.fromBufferReader=function(e){var t={};t.satoshis=e.readUInt64LEBN();var r=e.readVarintNum();return t.script=0!==r?e.read(r):o.Buffer.from([]),new l(t)},l.prototype.toBufferWriter=function(e){e||(e=new s),e.writeUInt64LEBN(this._satoshisBN);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e},l.prototype.getSize=function(){var e=this.script.toBuffer().length;return 8+u(e).toBuffer().length+e},e.exports=l}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var i=r(52),n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=f;var o=Object.create(r(39));o.inherits=r(4);var a=r(98),s=r(69);o.inherits(f,a);for(var u=n(s.prototype),c=0;c<u.length;c++){var h=u[c];f.prototype[h]||(f.prototype[h]=s.prototype[h])}function f(e){if(!(this instanceof f))return new f(e);a.call(this,e),s.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",l)}function l(){this.allowHalfOpen||this._writableState.ended||i.nextTick(d,this)}function d(e){e.end()}Object.defineProperty(f.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(f.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),f.prototype._destroy=function(e,t){this.push(null),this.end(),i.nextTick(t,e)}},function(e,t,r){"use strict";var i=t;i.version=r(245).version,i.utils=r(15),i.rand=r(82),i.curve=r(129),i.curves=r(85),i.ec=r(256),i.eddsa=r(260)},function(e,t,r){"use strict";var i=r(3),n=r(12),o=[],a={};function s(){}function u(e,t){if(~o.indexOf(e))return e;if(!t)return a[e];i.isArray(t)||(t=[t]);for(var r=0;r<o.length;r++){var n=o[r],s=i.pick(n,t);if(~i.values(s).indexOf(e))return n}}function c(e){for(var t=[],r=0;r<e.length;r++)t.push(31&e.charCodeAt(r));return t}function h(e){var t=new s;n.defineImmutable(t,{name:e.name,alias:e.alias,pubkeyhash:e.pubkeyhash,privatekey:e.privatekey,scripthash:e.scripthash,xpubkey:e.xpubkey,xprivkey:e.xprivkey});var r=e.indexBy||Object.keys(e);return e.cashAddrPrefix&&i.extend(t,{cashAddrPrefix:e.cashAddrPrefix,cashAddrPrefixArray:c(e.cashAddrPrefix)}),e.networkMagic&&i.extend(t,{networkMagic:n.integerAsBuffer(e.networkMagic)}),e.port&&i.extend(t,{port:e.port}),e.dnsSeeds&&i.extend(t,{dnsSeeds:e.dnsSeeds}),o.push(t),function(e,t){for(var r=0;r<t.length;r++){var n=t[r],o=e[n];i.isUndefined(o)||i.isObject(o)||(a[o]=e)}}(t,r),t}s.prototype.toString=function(){return this.name};var f=["seed.bitcoinsv.org","seed.bitcoinunlimited.info"],l={PORT:18333,NETWORK_MAGIC:4108710900,DNS_SEEDS:f,PREFIX:"testnet",CASHADDRPREFIX:"bchtest"},d={PORT:18444,NETWORK_MAGIC:3669344250,DNS_SEEDS:[],PREFIX:"regtest",CASHADDRPREFIX:"bchreg"},p={PORT:9333,NETWORK_MAGIC:4224632057,DNS_SEEDS:["stn-seed.bitcoinsv.io"],PREFIX:"stn",CASHADDRPREFIX:"bsvstn"},m={name:"livenet",alias:"mainnet",prefix:"bitcoin",cashAddrPrefix:"bitcoincash",pubkeyhash:0,privatekey:128,scripthash:5,xpubkey:76067358,xprivkey:76066276,networkMagic:3823236072,port:8333,dnsSeeds:f},g={name:"testnet",prefix:l.PREFIX,cashAddrPrefix:l.CASHADDRPREFIX,pubkeyhash:111,privatekey:239,scripthash:196,xpubkey:70617039,xprivkey:70615956,networkMagic:l.NETWORK_MAGIC},b={name:"regtest",prefix:d.PREFIX,cashAddrPrefix:d.CASHADDRPREFIX,pubkeyhash:111,privatekey:239,scripthash:196,xpubkey:70617039,xprivkey:70615956,networkMagic:d.NETWORK_MAGIC,port:d.PORT,dnsSeeds:[],indexBy:["port","name","cashAddrPrefix","networkMagic"]},y={name:"stn",prefix:p.PREFIX,cashAddrPrefix:p.CASHADDRPREFIX,pubkeyhash:111,privatekey:239,scripthash:196,xpubkey:70617039,xprivkey:70615956,networkMagic:p.NETWORK_MAGIC,indexBy:["port","name","cashAddrPrefix","networkMagic"]};h(g),h(y),h(b),h(m);var v=u("livenet"),_=u("regtest"),w=u("testnet"),S=u("stn");Object.defineProperty(w,"port",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?d.PORT:this.stnEnabled?p.PORT:l.PORT}}),Object.defineProperty(w,"networkMagic",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?n.integerAsBuffer(d.NETWORK_MAGIC):this.stnEnabled?n.integerAsBuffer(p.NETWORK_MAGIC):n.integerAsBuffer(l.NETWORK_MAGIC)}}),Object.defineProperty(w,"dnsSeeds",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?d.DNS_SEEDS:this.stnEnabled?p.DNS_SEEDS:l.DNS_SEEDS}}),Object.defineProperty(w,"cashAddrPrefix",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?d.CASHADDRPREFIX:this.stnEnabled?p.CASHADDRPREFIX:l.CASHADDRPREFIX}}),Object.defineProperty(w,"cashAddrPrefixArray",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?c(d.CASHADDRPREFIX):this.stnEnabled?p.cashAddrPrefixToArray(p.CASHADDRPREFIX):c(l.CASHADDRPREFIX)}}),e.exports={add:h,remove:function(e){for(var t=0;t<o.length;t++)o[t]===e&&o.splice(t,1);!function(e,t){for(var r=0;r<t.length;r++){var i=t[r];a[i]===e&&delete a[i]}}(e,Object.keys(a))},defaultNetwork:v,livenet:v,mainnet:v,testnet:w,regtest:_,stn:S,get:u,enableRegtest:function(){w.regtestEnabled=!0},disableRegtest:function(){w.regtestEnabled=!1},enableStn:function(){w.stnEnabled=!0},disableStn:function(){w.stnEnabled=!1}}},function(e,t,r){e.exports=r(145),e.exports.Input=r(91),e.exports.Output=r(27),e.exports.UnspentOutput=r(146),e.exports.Signature=r(51),e.exports.Sighash=r(26)},function(e,t,r){"use strict";(function(t,i){function n(){}n.getRandomBuffer=function(e){return t.browser?n.getRandomBufferBrowser(e):n.getRandomBufferNode(e)},n.getRandomBufferNode=function(e){return r(9).randomBytes(e)},n.getRandomBufferBrowser=function(e){if(!window.crypto&&!window.msCrypto)throw new Error("window.crypto not available");var t;if(window.crypto&&window.crypto.getRandomValues)t=window.crypto;else{if(!window.msCrypto||!window.msCrypto.getRandomValues)throw new Error("window.crypto.getRandomValues not available");t=window.msCrypto}var r=new Uint8Array(e);return t.getRandomValues(r),i.from(r)},e.exports=n}).call(this,r(6),r(0).Buffer)},function(e,t,r){"use strict";(function(t,i){var n=r(1).Buffer,o=t.crypto||t.msCrypto;o&&o.getRandomValues?e.exports=function(e,t){if(e>4294967295)throw new RangeError("requested too many random bytes");var r=n.allocUnsafe(e);if(e>0)if(e>65536)for(var a=0;a<e;a+=65536)o.getRandomValues(r.slice(a,a+65536));else o.getRandomValues(r);if("function"==typeof t)return i.nextTick((function(){t(null,r)}));return r}:e.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,r(13),r(6))},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){"use strict";var i=r(1).Buffer,n=r(53);function o(e,t){this._block=i.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}o.prototype.update=function(e,t){e=n(e,t||"utf8");for(var r=this._block,i=this._blockSize,o=e.length,a=this._len,s=0;s<o;){for(var u=a%i,c=Math.min(o-s,i-u),h=0;h<c;h++)r[u+h]=e[s+h];s+=c,(a+=c)%i==0&&this._update(r)}return this._len+=o,this},o.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=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 i=(4294967295&r)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},o.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=o},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(5),o=r(16),a=r(47),s=r(30),u=r(10),c=r(12),h=r(20);function f(e,t,r){if(!(this instanceof f))return new f(e,t,r);if(i.isArray(e)&&i.isNumber(t))return f.createMultisig(e,t,r);if(e instanceof f)return e;if(n.checkArgument(e,"First argument is required, please include address data.","guide/address.html"),t&&!s.get(t))throw new TypeError('Second argument must be "livenet", "testnet", or "regtest".');if(r&&r!==f.PayToPublicKeyHash&&r!==f.PayToScriptHash)throw new TypeError('Third argument must be "pubkeyhash" or "scripthash".');var o=this._classifyArguments(e,t,r);return o.network=o.network||s.get(t)||s.defaultNetwork,o.type=o.type||r||f.PayToPublicKeyHash,c.defineImmutable(this,{hashBuffer:o.hashBuffer,network:o.network,type:o.type}),this}f.prototype._classifyArguments=function(e,r,n){if((e instanceof t||e instanceof Uint8Array)&&20===e.length)return f._transformHash(e);if((e instanceof t||e instanceof Uint8Array)&&21===e.length)return f._transformBuffer(e,r,n);if(e instanceof h)return f._transformPublicKey(e);if(e instanceof l)return f._transformScript(e,r);if("string"==typeof e)return f._transformString(e,r,n);if(i.isObject(e))return f._transformObject(e);throw new TypeError("First argument is an unrecognized data format.")},f.PayToPublicKeyHash="pubkeyhash",f.PayToScriptHash="scripthash",f._transformHash=function(e){var r={};if(!(e instanceof t||e instanceof Uint8Array))throw new TypeError("Address supplied is not a buffer.");if(20!==e.length)throw new TypeError("Address hashbuffers must be exactly 20 bytes.");return r.hashBuffer=e,r},f._transformObject=function(e){return n.checkArgument(e.hash||e.hashBuffer,"Must provide a `hash` or `hashBuffer` property"),n.checkArgument(e.type,"Must provide a `type` property"),{hashBuffer:e.hash?t.from(e.hash,"hex"):e.hashBuffer,network:s.get(e.network)||s.defaultNetwork,type:e.type}},f._classifyFromVersion=function(e){var t={},r=s.get(e[0],"pubkeyhash"),i=s.get(e[0],"scripthash");return r?(t.network=r,t.type=f.PayToPublicKeyHash):i&&(t.network=i,t.type=f.PayToScriptHash),t},f._transformBuffer=function(e,r,i){var n={};if(!(e instanceof t||e instanceof Uint8Array))throw new TypeError("Address supplied is not a buffer.");if(21!==e.length)throw new TypeError("Address buffers must be exactly 21 bytes.");var o=s.get(r),a=f._classifyFromVersion(e);if(r&&!o)throw new TypeError("Unknown network");if(!a.network||o&&o!==a.network)throw new TypeError("Address has mismatched network type.");if(!a.type||i&&i!==a.type)throw new TypeError("Address has mismatched type.");return n.hashBuffer=e.slice(1),n.network=a.network,n.type=a.type,n},f._transformPublicKey=function(e){var t={};if(!(e instanceof h))throw new TypeError("Address must be an instance of PublicKey.");return t.hashBuffer=u.sha256ripemd160(e.toBuffer()),t.type=f.PayToPublicKeyHash,t},f._transformScript=function(e,t){n.checkArgument(e instanceof l,"script must be a Script instance");var r=e.getAddressInfo(t);if(!r)throw new o.Script.CantDeriveAddress(e);return r},f.createMultisig=function(e,t,r){return r=r||e[0].network||s.defaultNetwork,f.payingTo(l.buildMultisigOut(e,t),r)},f._transformString=function(e,t,r){if("string"!=typeof e)throw new TypeError("data parameter supplied is not a string.");if(e.length<27)throw new Error("Invalid Address string provided");e=e.trim();var i=s.get(t);if(t&&!i)throw new TypeError("Unknown network");var n=a.decode(e);return f._transformBuffer(n,t,r)},f.fromPublicKey=function(e,t){var r=f._transformPublicKey(e);return t=t||s.defaultNetwork,new f(r.hashBuffer,t,r.type)},f.fromPrivateKey=function(e,t){let r=h.fromPrivateKey(e);return t=t||e.network||s.defaultNetwork,f.fromPublicKey(r,t)},f.fromPublicKeyHash=function(e,t){var r=f._transformHash(e);return new f(r.hashBuffer,t,f.PayToPublicKeyHash)},f.fromScriptHash=function(e,t){n.checkArgument(e,"hash parameter is required");var r=f._transformHash(e);return new f(r.hashBuffer,t,f.PayToScriptHash)},f.payingTo=function(e,t){return n.checkArgument(e,"script is required"),n.checkArgument(e instanceof l,"script must be instance of Script"),f.fromScriptHash(u.sha256ripemd160(e.toBuffer()),t)},f.fromScript=function(e,t){n.checkArgument(e instanceof l,"script must be a Script instance");var r=f._transformScript(e,t);return new f(r.hashBuffer,t,r.type)},f.fromBuffer=function(e,t,r){var i=f._transformBuffer(e,t,r);return new f(i.hashBuffer,i.network,i.type)},f.fromHex=function(e,r,i){return f.fromBuffer(t.from(e,"hex"),r,i)},f.fromString=function(e,t,r){var i=f._transformString(e,t,r);return new f(i.hashBuffer,i.network,i.type)},f.fromObject=function(e){return n.checkState(c.isHexa(e.hash),'Unexpected hash property, "'+e.hash+'", expected to be hex.'),new f(t.from(e.hash,"hex"),e.network,e.type)},f.getValidationError=function(e,t,r){var i;try{new f(e,t,r)}catch(e){i=e}return i},f.isValid=function(e,t,r){return!f.getValidationError(e,t,r)},f.prototype.isPayToPublicKeyHash=function(){return this.type===f.PayToPublicKeyHash},f.prototype.isPayToScriptHash=function(){return this.type===f.PayToScriptHash},f.prototype.toBuffer=function(){var e=t.from([this.network[this.type]]);return t.concat([e,this.hashBuffer])},f.prototype.toHex=function(){return this.toBuffer().toString("hex")},f.prototype.toObject=f.prototype.toJSON=function(){return{hash:this.hashBuffer.toString("hex"),type:this.type,network:this.network.toString()}},f.prototype.inspect=function(){return"<Address: "+this.toString()+", type: "+this.type+", network: "+this.network+">"},f.prototype.toString=function(){return a.encode(this.toBuffer())},e.exports=f;var l=r(18)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var i=r(4),n=r(65),o=r(71),a=r(78),s=r(23);function u(e){s.call(this,"digest"),this._hash=e}i(u,s),u.prototype._update=function(e){this._hash.update(e)},u.prototype._final=function(){return this._hash.digest()},e.exports=function(e){return"md5"===(e=e.toLowerCase())?new n:"rmd160"===e||"ripemd160"===e?new o:new u(a(e))}},function(e,t,r){(t=e.exports=r(98)).Stream=t,t.Readable=t,t.Writable=r(69),t.Duplex=r(28),t.Transform=r(101),t.PassThrough=r(171)},function(e,t,r){function i(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===i(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===i(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===i(e)},t.isError=function(e){return"[object Error]"===i(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(0).Buffer.isBuffer},function(e,t,r){"use strict";e.exports=TypeError},function(e,t,r){"use strict";var i=r(194);if(i)try{i([],"length")}catch(e){i=null}e.exports=i},function(e,t,r){"use strict";var i=r(197);e.exports=Function.prototype.bind||i},function(e,t,r){(function(t){e.exports=function(e,r){for(var i=Math.min(e.length,r.length),n=new t(i),o=0;o<i;++o)n[o]=e[o]^r[o];return n}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var i=r(19),n=r(14);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=o,o.prototype.update=function(e,t){if(e=i.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=i.join32(e,0,e.length-r,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},o.prototype.digest=function(e){return this.update(this._pad()),n(null===this.pending),this._digest(e)},o.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,i=new Array(r+this.padLength);i[0]=128;for(var n=1;n<r;n++)i[n]=0;if(e<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)i[n++]=0;i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=e>>>24&255,i[n++]=e>>>16&255,i[n++]=e>>>8&255,i[n++]=255&e}else for(i[n++]=255&e,i[n++]=e>>>8&255,i[n++]=e>>>16&255,i[n++]=e>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,o=8;o<this.padLength;o++)i[n++]=0;return i}},function(e,t,r){var i=t;i.bignum=r(7),i.define=r(265).define,i.base=r(46),i.constants=r(135),i.decoders=r(270),i.encoders=r(272)},function(e,t,r){var i=t;i.Reporter=r(267).Reporter,i.DecoderBuffer=r(134).DecoderBuffer,i.EncoderBuffer=r(134).EncoderBuffer,i.Node=r(268)},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(61),o=r(0),a=r(10).sha256sha256,s=function e(r){if(!(this instanceof e))return new e(r);if(t.isBuffer(r)){var i=r;this.fromBuffer(i)}else if("string"==typeof r){var n=r;this.fromString(n)}};s.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this},s.validChecksum=function(e,t){return i.isString(e)&&(e=o.Buffer.from(n.decode(e))),i.isString(t)&&(t=o.Buffer.from(n.decode(t))),t||(t=e.slice(-4),e=e.slice(0,-4)),s.checksum(e).toString("hex")===t.toString("hex")},s.decode=function(e){if("string"!=typeof e)throw new Error("Input must be a string");var r=t.from(n.decode(e));if(r.length<4)throw new Error("Input string too short");var i=r.slice(0,-4),o=r.slice(-4),s=a(i).slice(0,4);if(o.toString("hex")!==s.toString("hex"))throw new Error("Checksum mismatch");return i},s.checksum=function(e){return a(e).slice(0,4)},s.encode=function(e){if(!t.isBuffer(e))throw new Error("Input must be a buffer");var r=t.alloc(e.length+4),i=s.checksum(e);return e.copy(r),i.copy(r,e.length),n.encode(r)},s.prototype.fromBuffer=function(e){return this.buf=e,this},s.fromBuffer=function(e){return(new s).fromBuffer(e)},s.fromHex=function(e){return s.fromBuffer(t.from(e,"hex"))},s.prototype.fromString=function(e){var t=s.decode(e);return this.buf=t,this},s.fromString=function(e){var t=s.decode(e);return new n(t)},s.prototype.toBuffer=function(){return this.buf},s.prototype.toHex=function(){return this.toBuffer().toString("hex")},s.prototype.toString=function(){return s.encode(this.buf)},e.exports=s}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(288)();
|
|
10
|
+
var i=r(0),n=i.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=i:(o(i,t),t.Buffer=a),a.prototype=Object.create(n.prototype),o(n,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},function(e,t,r){"use strict";(function(t,i,n){var o=e.exports;if(o.deps=o.deps||{},o.deps._=r(3),o.deps.Buffer=void 0!==t?t:null,"undefined"==typeof window)o.deps.bnjs=r(7),o.deps.bs58=r(86),o.deps.elliptic=r(29);else{try{o.deps.bnjs=r(7)}catch(e){}try{o.deps.bs58=r(86)}catch(e){}try{o.deps.elliptic=r(29)}catch(e){}}o.version="v"+r(284).version,o.versionGuard=function(e){if(void 0!==e){console.warn("\n More than one instance of bsv found.\n Please make sure to require bsv and check that submodules do\n not also include their own bsv dependency.")}},o.versionGuard(i._bsv),i._bsv=o.version,o.isHardened=!0,o.hardenedBy="SmartLedger",o.baseVersion="v1.5.6",o.securityFeatures=["canonical-signatures","malleability-protection","enhanced-validation","elliptic-patches"],o.crypto={},o.crypto.BN=r(8),o.crypto.ECDSA=r(87),o.crypto.Hash=r(10),o.crypto.Random=r(32),o.crypto.Point=r(17),o.crypto.Signature=r(11),o.crypto.Shamir=r(147),o.crypto.SmartVerify=r(92),o.crypto.EllipticFixed=r(93),o.encoding={},o.encoding.Base58=r(61),o.encoding.Base58Check=r(47),o.encoding.BufferReader=r(25),o.encoding.BufferWriter=r(21),o.encoding.Varint=r(49),o.util={},o.util.js=r(12),o.util.preconditions=r(5),o.errors=r(16),o.Address=r(36),o.Block=r(301),o.MerkleBlock=r(148),o.BlockHeader=r(62),o.HDPrivateKey=r(149),o.HDPublicKey=r(150),o.Networks=r(30),o.Opcode=r(89),o.PrivateKey=r(60),o.PublicKey=r(20),o.Script=r(18),o.Transaction=r(31),o.Input=r(31).Input,o.Output=r(31).Output,o.UnspentOutput=r(31).UnspentOutput,o.Message=r(303),o.Mnemonic=r(305),o.ECIES=r(319),o.Signature=r(11),o.Shamir=r(147),o.SmartLedger={version:o.version,hardenedBy:o.hardenedBy,baseVersion:o.baseVersion,securityFeatures:o.securityFeatures,SmartVerify:r(92),EllipticFixed:r(93)},o.SmartVerify=r(92),o.EllipticFixed=r(93);try{o.SmartContract=r(323)}catch(e){"undefined"==typeof window&&console.warn("SmartContract module not available:",e.message)}try{o.BrowserUTXOManager=r(333)}catch(e){"undefined"==typeof window&&console.warn("[bsv] BrowserUTXOManager failed to load:",e.message)}if("undefined"==typeof window)try{var a,s=!1;Object.defineProperty(o,"SmartUTXO",{configurable:!0,enumerable:!0,get:function(){return s||n.env&&n.env.BSV_HIDE_DEPRECATIONS||(s=!0,console.warn("[bsv] bsv.SmartUTXO is a development-only simulator and is deprecated; it will be removed in v5.0.0. Import directly: require('@smartledger/bsv/lib/smartutxo'). Set BSV_HIDE_DEPRECATIONS=1 to silence this warning.")),a||(a=r(152)),a}}),o.SmartMiner=r(334),o.CustomScriptHelper=r(335)}catch(e){}o.GDAF=r(97);try{o.DIDWeb=r(336)}catch(e){"undefined"==typeof window&&console.warn("[bsv] DIDWeb module failed to load:",e.message)}try{o.VcJwt=r(155)}catch(e){"undefined"==typeof window&&console.warn("[bsv] VcJwt module failed to load:",e.message)}try{o.StatusList=r(337)}catch(e){"undefined"==typeof window&&console.warn("[bsv] StatusList module failed to load:",e.message)}try{o.Anchor=r(347)}catch(e){"undefined"==typeof window&&console.warn("[bsv] Anchor module failed to load:",e.message)}o.createDID=function(e){return(new o.GDAF).createDID(e)},o.resolveDID=function(e){return(new o.GDAF).resolveDID(e)},o.createEmailCredential=function(e,t,r,i){return(new o.GDAF).createEmailCredential(e,t,r,i)},o.createAgeCredential=function(e,t,r,i,n){return(new o.GDAF).createAgeCredential(e,t,r,i,n)},o.createKYCCredential=function(e,t,r,i,n){return(new o.GDAF).createKYCCredential(e,t,r,i,n)},o.verifyCredential=function(e,t){return(new o.GDAF).verifyCredential(e,t)},o.validateCredential=function(e,t){return(new o.GDAF).validateCredential(e,t)},o.generateSelectiveProof=function(e,t,r){return(new o.GDAF).generateSelectiveProof(e,t,r)},o.generateAgeProof=function(e,t,r){return(new o.GDAF).generateAgeProof(e,t,r)},o.verifyAgeProof=function(e,t,r){return(new o.GDAF).verifyAgeProof(e,t,r)},o.createPresentation=function(e,t,r,i){return(new o.GDAF).createPresentation(e,t,r,i)},o.getCredentialSchemas=function(){return(new o.GDAF).getAllSchemas()},o.createCredentialTemplate=function(e){return(new o.GDAF).createTemplate(e)},o.LTP=r(348),o.prepareRightToken=function(e,t,r,i,n,a){return o.LTP.Right.prepareRightToken(e,t,r,i,n,a)},o.prepareRightTokenVerification=function(e,t){return o.LTP.Right.prepareRightTokenVerification(e,t)},o.prepareRightTokenTransfer=function(e,t,r,i){return o.LTP.Right.prepareRightTokenTransfer(e,t,r,i)},o.prepareRightTypeValidation=function(e){return o.LTP.Right.prepareRightTypeValidation(e)},o.prepareObligationToken=function(e,t,r,i,n,a){return o.LTP.Obligation.prepareObligationToken(e,t,r,i,n,a)},o.prepareObligationVerification=function(e,t){return o.LTP.Obligation.prepareObligationVerification(e,t)},o.prepareObligationFulfillment=function(e,t,r,i){return o.LTP.Obligation.prepareObligationFulfillment(e,t,r,i)},o.prepareObligationBreachAssessment=function(e,t,r){return o.LTP.Obligation.prepareObligationBreachAssessment(e,t,r)},o.prepareObligationMonitoringReport=function(e,t){return o.LTP.Obligation.prepareObligationMonitoringReport(e,t)},o.prepareClaimValidation=function(e,t){return o.LTP.Claim.prepareClaimValidation(e,t)},o.prepareClaimAttestation=function(e,t,r){return o.LTP.Claim.prepareClaimAttestation(e,t,r)},o.prepareClaimDispute=function(e,t,r){return o.LTP.Claim.prepareClaimDispute(e,t,r)},o.prepareBulkClaimValidation=function(e,t){return o.LTP.Claim.prepareBulkClaimValidation(e,t)},o.prepareClaimTemplate=function(e,t){return o.LTP.Claim.prepareClaimTemplate(e,t)},o.prepareSignatureProof=function(e,t,r){return o.LTP.Proof.prepareSignatureProof(e,t,r)},o.prepareSignatureVerification=function(e,t){return o.LTP.Proof.prepareSignatureVerification(e,t)},o.prepareSelectiveDisclosure=function(e,t,r){return o.LTP.Proof.prepareSelectiveDisclosure(e,t,r)},o.prepareSelectiveDisclosureVerification=function(e,t){return o.LTP.Proof.prepareSelectiveDisclosureVerification(e,t)},o.prepareLegalValidityProof=function(e,t,r){return o.LTP.Proof.prepareLegalValidityProof(e,t,r)},o.prepareZeroKnowledgeProof=function(e,t,r){return o.LTP.Proof.prepareZeroKnowledgeProof(e,t,r)},o.prepareRegistry=function(e){return o.LTP.Registry.prepareRegistry(e)},o.prepareTokenRegistration=function(e,t,r){return o.LTP.Registry.prepareTokenRegistration(e,t,r)},o.prepareTokenApproval=function(e,t,r){return o.LTP.Registry.prepareTokenApproval(e,t,r)},o.prepareTokenRevocation=function(e,t,r){return o.LTP.Registry.prepareTokenRevocation(e,t,r)},o.prepareTokenStatusQuery=function(e,t){return o.LTP.Registry.prepareTokenStatusQuery(e,t)},o.prepareTokenSearch=function(e,t){return o.LTP.Registry.prepareTokenSearch(e,t)},o.prepareStatisticsQuery=function(e){return o.LTP.Registry.prepareStatisticsQuery(e)},o.prepareAuditLogQuery=function(e,t){return o.LTP.Registry.prepareAuditLogQuery(e,t)},o.prepareTokenCommitment=function(e,t){return o.LTP.Anchor.prepareTokenCommitment(e,t)},o.prepareBatchCommitment=function(e,t){return o.LTP.Anchor.prepareBatchCommitment(e,t)},o.verifyTokenAnchor=function(e,t,r){return o.LTP.Anchor.verifyTokenAnchor(e,t,r)},o.formatRevocation=function(e,t){return o.LTP.Anchor.formatRevocation(e,t)},o.createRightToken=function(e,t,r){return(new o.LTP).createRightToken(e,t,r)},o.verifyLegalToken=function(e,t){return(new o.LTP).verifyToken(e,t)},o.validateLegalClaim=function(e,t){return(new o.LTP).validateClaim(e,t)},o.createSelectiveDisclosure=function(e,t,r){return(new o.LTP).createSelectiveDisclosure(e,t,r)},o.createLegalRegistry=function(e){return o.LTP.Registry.prepareRegistry(e)},o.createLegalValidityProof=function(e,t,r){return(new o.LTP).createLegalValidityProof(e,t,r)},o.getRightTypes=function(){return o.LTP.Right.getRightTypes()},o.getObligationTypes=function(){return o.LTP.Obligation.getObligationTypes()},o.getObligationPriority=function(){return o.LTP.Obligation.getObligationPriority()},o.getObligationStatus=function(){return o.LTP.Obligation.getObligationStatus()},o.getClaimSchemas=function(){return o.LTP.Claim.getSchemas()},o.getClaimSchemaNames=function(){return o.LTP.Claim.getSchemaNames()},o.getClaimSchema=function(e){return o.LTP.Claim.getSchema(e)},o.createClaimTemplate=function(e){return o.LTP.Claim.createTemplate(e)},o.canonicalizeClaim=function(e){return o.LTP.Claim.canonicalize(e)},o.hashClaim=function(e){return o.LTP.Claim.hash(e)},o.addCustomClaimSchema=function(e,t){return o.LTP.Claim.addSchema(e,t)},o.Transaction.sighash=r(26)}).call(this,r(0).Buffer,r(13),r(6))},function(e,t,r){"use strict";var i=r(32),n={isArray:e=>Array.isArray(e),isNumber:e=>"number"==typeof e,isObject:e=>e&&"object"==typeof e,isString:e=>"string"==typeof e,isUndefined:e=>void 0===e,isFunction:e=>"function"==typeof e,isNull:e=>null===e,isDate:e=>e instanceof Date,extend:(e,t)=>Object.assign(e,t),noop:()=>{},every:(e,t)=>e.every(t||(e=>e)),map:(e,t)=>Array.from(e).map(t||(e=>e)),includes:(e,t)=>e.includes(t),each:(e,t)=>e.forEach(t),clone:e=>Object.assign({},e),pick:(e,t)=>{const r={};return t.forEach(t=>{void 0!==e[t]&&(r[t]=e[t])}),r},values:e=>Object.values(e),filter:(e,t)=>e.filter(t),reduce:(e,t,r)=>e.reduce(t,r),without:(e,t)=>e.filter(e=>e!==t),shuffle:e=>{const t=e.slice(0);for(let e=t.length-1;e>0;e--){const r=i.getRandomBuffer(4).readUInt32BE(0)/4294967296,n=Math.floor(r*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t},difference:(e,t)=>e.filter(e=>!t.includes(e)),findIndex:(e,t)=>e.findIndex(t),some:(e,t)=>e.some(t),range:e=>[...Array(e).keys()]};e.exports=n},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},function(e,t,r){"use strict";var i=r(16),n=r(3);e.exports={checkState:function(e,t){if(!e)throw new i.InvalidState(t)},checkArgument:function(e,t,r,n){if(!e)throw new i.InvalidArgument(t,r,n)},checkArgumentType:function(e,t,o){if(o=o||"(unknown name)",n.isString(t)){if("Buffer"===t){if(!r(0).Buffer.isBuffer(e))throw new i.InvalidArgumentType(e,t,o)}else if(typeof e!==t)throw new i.InvalidArgumentType(e,t,o)}else if(!(e instanceof t))throw new i.InvalidArgumentType(e,t.name,o)}}},function(e,t){var r,i,n=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(e){i=a}}();var u,c=[],h=!1,f=-1;function l(){h&&u&&(h=!1,u.length?c=u.concat(c):f=-1,c.length&&d())}function d(){if(!h){var e=s(l);h=!0;for(var t=c.length;t;){for(u=c,c=[];++f<t;)u&&u[f].run();f=-1,t=c.length}u=null,h=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===a||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function m(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new p(e,t)),1!==c.length||h||s(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=m,n.addListener=m,n.once=m,n.off=m,n.removeListener=m,n.removeAllListeners=m,n.emit=m,n.prependListener=m,n.prependOnceListener=m,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},function(e,t,r){(function(e){!function(e,t){"use strict";function i(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{a=r(236).Buffer}catch(e){}function s(e,t,r){for(var i=0,n=Math.min(e.length,r),o=t;o<n;o++){var a=e.charCodeAt(o)-48;i<<=4,i|=a>=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return i}function u(e,t,r,i){for(var n=0,o=Math.min(e.length,r),a=t;a<o;a++){var s=e.charCodeAt(a)-48;n*=i,n+=s>=49?s-49+10:s>=17?s-17+10:s}return n}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),i(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&n++,16===t?this._parseHex(e,n):this._parseBase(e,t,n),"-"===e[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(i(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initArray=function(e,t,r){if(i("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,a,s=0;if("be"===r)for(n=e.length-1,o=0;n>=0;n-=3)a=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(n=0,o=0;n<e.length;n+=3)a=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,n,o=0;for(r=e.length-6,i=0;r>=t;r-=6)n=s(e,r,r+6),this.words[i]|=n<<o&67108863,this.words[i+1]|=n>>>26-o&4194303,(o+=24)>=26&&(o-=26,i++);r+6!==t&&(n=s(e,t,r+6),this.words[i]|=n<<o&67108863,this.words[i+1]|=n>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var o=e.length-r,a=o%i,s=Math.min(o,o-a)+r,c=0,h=r;h<s;h+=i)c=u(e,h,h+i,t),this.imuln(n),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var f=1;for(c=u(e,h,e.length,t),h=0;h<a;h++)f*=t;this.imuln(f),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[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 l(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],o=0|t.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c<i;c++){for(var h=u>>>26,f=67108863&u,l=Math.min(c,t.length-1),d=Math.max(0,c-e.length+1);d<=l;d++){var p=c-d|0;h+=(a=(n=0|e.words[p])*(o=0|t.words[d])+f)/67108864|0,f=67108863&a}r.words[c]=0|f,u=0|h}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<n|o)).toString(16);r=0!==(o=s>>>24-n&16777215)||a!==this.length-1?c[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=h[e],d=f[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(e);r=(p=p.idivn(d)).isZero()?m+r:c[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return i(void 0!==a),this.toArrayLike(a,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,r){var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===t,c=new e(o),h=this.clone();if(u){for(s=0;!h.isZero();s++)a=h.andln(255),h.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-n;s++)c[s]=0;for(s=0;!h.isZero();s++)a=h.andln(255),h.iushrn(8),c[o-s-1]=a}return c},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},o.prototype.ior=function(e){return i(0==(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},o.prototype.iand=function(e){return i(0==(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var i=0;i<r.length;i++)this.words[i]=t.words[i]^r.words[i];if(this!==t)for(;i<t.length;i++)this.words[i]=t.words[i];return this.length=t.length,this.strip()},o.prototype.ixor=function(e){return i(0==(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<n:this.words[r]&~(1<<n),this.strip()},o.prototype.iadd=function(e){var t,r,i;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,i=e):(r=e,i=this);for(var n=0,o=0;o<i.length;o++)t=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&t,n=t>>>26;for(;0!==n&&o<r.length;o++)t=(0|r.words[o])+n,this.words[o]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,i,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=e):(r=e,i=this);for(var o=0,a=0;a<i.length;a++)o=(t=(0|r.words[a])-(0|i.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<r.length;a++)o=(t=(0|r.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var d=function(e,t,r){var i,n,o,a=e.words,s=t.words,u=r.words,c=0,h=0|a[0],f=8191&h,l=h>>>13,d=0|a[1],p=8191&d,m=d>>>13,g=0|a[2],b=8191&g,y=g>>>13,v=0|a[3],_=8191&v,w=v>>>13,S=0|a[4],k=8191&S,I=S>>>13,E=0|a[5],A=8191&E,O=E>>>13,x=0|a[6],P=8191&x,M=x>>>13,T=0|a[7],R=8191&T,B=T>>>13,N=0|a[8],C=8191&N,D=N>>>13,j=0|a[9],L=8191&j,U=j>>>13,H=0|s[0],z=8191&H,F=H>>>13,K=0|s[1],V=8191&K,q=K>>>13,G=0|s[2],Z=8191&G,Y=G>>>13,W=0|s[3],X=8191&W,J=W>>>13,$=0|s[4],Q=8191&$,ee=$>>>13,te=0|s[5],re=8191&te,ie=te>>>13,ne=0|s[6],oe=8191&ne,ae=ne>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,he=0|s[8],fe=8191&he,le=he>>>13,de=0|s[9],pe=8191&de,me=de>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(c+(i=Math.imul(f,z))|0)+((8191&(n=(n=Math.imul(f,F))+Math.imul(l,z)|0))<<13)|0;c=((o=Math.imul(l,F))+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,i=Math.imul(p,z),n=(n=Math.imul(p,F))+Math.imul(m,z)|0,o=Math.imul(m,F);var be=(c+(i=i+Math.imul(f,V)|0)|0)+((8191&(n=(n=n+Math.imul(f,q)|0)+Math.imul(l,V)|0))<<13)|0;c=((o=o+Math.imul(l,q)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,i=Math.imul(b,z),n=(n=Math.imul(b,F))+Math.imul(y,z)|0,o=Math.imul(y,F),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,q)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,q)|0;var ye=(c+(i=i+Math.imul(f,Z)|0)|0)+((8191&(n=(n=n+Math.imul(f,Y)|0)+Math.imul(l,Z)|0))<<13)|0;c=((o=o+Math.imul(l,Y)|0)+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,i=Math.imul(_,z),n=(n=Math.imul(_,F))+Math.imul(w,z)|0,o=Math.imul(w,F),i=i+Math.imul(b,V)|0,n=(n=n+Math.imul(b,q)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,q)|0,i=i+Math.imul(p,Z)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,Y)|0;var ve=(c+(i=i+Math.imul(f,X)|0)|0)+((8191&(n=(n=n+Math.imul(f,J)|0)+Math.imul(l,X)|0))<<13)|0;c=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,i=Math.imul(k,z),n=(n=Math.imul(k,F))+Math.imul(I,z)|0,o=Math.imul(I,F),i=i+Math.imul(_,V)|0,n=(n=n+Math.imul(_,q)|0)+Math.imul(w,V)|0,o=o+Math.imul(w,q)|0,i=i+Math.imul(b,Z)|0,n=(n=n+Math.imul(b,Y)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,J)|0;var _e=(c+(i=i+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,ee)|0)+Math.imul(l,Q)|0))<<13)|0;c=((o=o+Math.imul(l,ee)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,i=Math.imul(A,z),n=(n=Math.imul(A,F))+Math.imul(O,z)|0,o=Math.imul(O,F),i=i+Math.imul(k,V)|0,n=(n=n+Math.imul(k,q)|0)+Math.imul(I,V)|0,o=o+Math.imul(I,q)|0,i=i+Math.imul(_,Z)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(w,Z)|0,o=o+Math.imul(w,Y)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,J)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,ee)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,ee)|0;var we=(c+(i=i+Math.imul(f,re)|0)|0)+((8191&(n=(n=n+Math.imul(f,ie)|0)+Math.imul(l,re)|0))<<13)|0;c=((o=o+Math.imul(l,ie)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,i=Math.imul(P,z),n=(n=Math.imul(P,F))+Math.imul(M,z)|0,o=Math.imul(M,F),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,q)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,q)|0,i=i+Math.imul(k,Z)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,Y)|0,i=i+Math.imul(_,X)|0,n=(n=n+Math.imul(_,J)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,ee)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,ee)|0,i=i+Math.imul(p,re)|0,n=(n=n+Math.imul(p,ie)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ie)|0;var Se=(c+(i=i+Math.imul(f,oe)|0)|0)+((8191&(n=(n=n+Math.imul(f,ae)|0)+Math.imul(l,oe)|0))<<13)|0;c=((o=o+Math.imul(l,ae)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,i=Math.imul(R,z),n=(n=Math.imul(R,F))+Math.imul(B,z)|0,o=Math.imul(B,F),i=i+Math.imul(P,V)|0,n=(n=n+Math.imul(P,q)|0)+Math.imul(M,V)|0,o=o+Math.imul(M,q)|0,i=i+Math.imul(A,Z)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,Y)|0,i=i+Math.imul(k,X)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,ee)|0,i=i+Math.imul(b,re)|0,n=(n=n+Math.imul(b,ie)|0)+Math.imul(y,re)|0,o=o+Math.imul(y,ie)|0,i=i+Math.imul(p,oe)|0,n=(n=n+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var ke=(c+(i=i+Math.imul(f,ue)|0)|0)+((8191&(n=(n=n+Math.imul(f,ce)|0)+Math.imul(l,ue)|0))<<13)|0;c=((o=o+Math.imul(l,ce)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,i=Math.imul(C,z),n=(n=Math.imul(C,F))+Math.imul(D,z)|0,o=Math.imul(D,F),i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,q)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,q)|0,i=i+Math.imul(P,Z)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,J)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,ee)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,ee)|0,i=i+Math.imul(_,re)|0,n=(n=n+Math.imul(_,ie)|0)+Math.imul(w,re)|0,o=o+Math.imul(w,ie)|0,i=i+Math.imul(b,oe)|0,n=(n=n+Math.imul(b,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0,i=i+Math.imul(p,ue)|0,n=(n=n+Math.imul(p,ce)|0)+Math.imul(m,ue)|0,o=o+Math.imul(m,ce)|0;var Ie=(c+(i=i+Math.imul(f,fe)|0)|0)+((8191&(n=(n=n+Math.imul(f,le)|0)+Math.imul(l,fe)|0))<<13)|0;c=((o=o+Math.imul(l,le)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,i=Math.imul(L,z),n=(n=Math.imul(L,F))+Math.imul(U,z)|0,o=Math.imul(U,F),i=i+Math.imul(C,V)|0,n=(n=n+Math.imul(C,q)|0)+Math.imul(D,V)|0,o=o+Math.imul(D,q)|0,i=i+Math.imul(R,Z)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,Y)|0,i=i+Math.imul(P,X)|0,n=(n=n+Math.imul(P,J)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,J)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,ee)|0,i=i+Math.imul(k,re)|0,n=(n=n+Math.imul(k,ie)|0)+Math.imul(I,re)|0,o=o+Math.imul(I,ie)|0,i=i+Math.imul(_,oe)|0,n=(n=n+Math.imul(_,ae)|0)+Math.imul(w,oe)|0,o=o+Math.imul(w,ae)|0,i=i+Math.imul(b,ue)|0,n=(n=n+Math.imul(b,ce)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,ce)|0,i=i+Math.imul(p,fe)|0,n=(n=n+Math.imul(p,le)|0)+Math.imul(m,fe)|0,o=o+Math.imul(m,le)|0;var Ee=(c+(i=i+Math.imul(f,pe)|0)|0)+((8191&(n=(n=n+Math.imul(f,me)|0)+Math.imul(l,pe)|0))<<13)|0;c=((o=o+Math.imul(l,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,i=Math.imul(L,V),n=(n=Math.imul(L,q))+Math.imul(U,V)|0,o=Math.imul(U,q),i=i+Math.imul(C,Z)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(D,Z)|0,o=o+Math.imul(D,Y)|0,i=i+Math.imul(R,X)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,J)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,ee)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,ee)|0,i=i+Math.imul(A,re)|0,n=(n=n+Math.imul(A,ie)|0)+Math.imul(O,re)|0,o=o+Math.imul(O,ie)|0,i=i+Math.imul(k,oe)|0,n=(n=n+Math.imul(k,ae)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,ae)|0,i=i+Math.imul(_,ue)|0,n=(n=n+Math.imul(_,ce)|0)+Math.imul(w,ue)|0,o=o+Math.imul(w,ce)|0,i=i+Math.imul(b,fe)|0,n=(n=n+Math.imul(b,le)|0)+Math.imul(y,fe)|0,o=o+Math.imul(y,le)|0;var Ae=(c+(i=i+Math.imul(p,pe)|0)|0)+((8191&(n=(n=n+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;c=((o=o+Math.imul(m,me)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,i=Math.imul(L,Z),n=(n=Math.imul(L,Y))+Math.imul(U,Z)|0,o=Math.imul(U,Y),i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,J)|0)+Math.imul(D,X)|0,o=o+Math.imul(D,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,ee)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,ee)|0,i=i+Math.imul(P,re)|0,n=(n=n+Math.imul(P,ie)|0)+Math.imul(M,re)|0,o=o+Math.imul(M,ie)|0,i=i+Math.imul(A,oe)|0,n=(n=n+Math.imul(A,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,i=i+Math.imul(k,ue)|0,n=(n=n+Math.imul(k,ce)|0)+Math.imul(I,ue)|0,o=o+Math.imul(I,ce)|0,i=i+Math.imul(_,fe)|0,n=(n=n+Math.imul(_,le)|0)+Math.imul(w,fe)|0,o=o+Math.imul(w,le)|0;var Oe=(c+(i=i+Math.imul(b,pe)|0)|0)+((8191&(n=(n=n+Math.imul(b,me)|0)+Math.imul(y,pe)|0))<<13)|0;c=((o=o+Math.imul(y,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,i=Math.imul(L,X),n=(n=Math.imul(L,J))+Math.imul(U,X)|0,o=Math.imul(U,J),i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,ee)|0,i=i+Math.imul(R,re)|0,n=(n=n+Math.imul(R,ie)|0)+Math.imul(B,re)|0,o=o+Math.imul(B,ie)|0,i=i+Math.imul(P,oe)|0,n=(n=n+Math.imul(P,ae)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,ae)|0,i=i+Math.imul(A,ue)|0,n=(n=n+Math.imul(A,ce)|0)+Math.imul(O,ue)|0,o=o+Math.imul(O,ce)|0,i=i+Math.imul(k,fe)|0,n=(n=n+Math.imul(k,le)|0)+Math.imul(I,fe)|0,o=o+Math.imul(I,le)|0;var xe=(c+(i=i+Math.imul(_,pe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(w,pe)|0))<<13)|0;c=((o=o+Math.imul(w,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,i=Math.imul(L,Q),n=(n=Math.imul(L,ee))+Math.imul(U,Q)|0,o=Math.imul(U,ee),i=i+Math.imul(C,re)|0,n=(n=n+Math.imul(C,ie)|0)+Math.imul(D,re)|0,o=o+Math.imul(D,ie)|0,i=i+Math.imul(R,oe)|0,n=(n=n+Math.imul(R,ae)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,ae)|0,i=i+Math.imul(P,ue)|0,n=(n=n+Math.imul(P,ce)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,ce)|0,i=i+Math.imul(A,fe)|0,n=(n=n+Math.imul(A,le)|0)+Math.imul(O,fe)|0,o=o+Math.imul(O,le)|0;var Pe=(c+(i=i+Math.imul(k,pe)|0)|0)+((8191&(n=(n=n+Math.imul(k,me)|0)+Math.imul(I,pe)|0))<<13)|0;c=((o=o+Math.imul(I,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,i=Math.imul(L,re),n=(n=Math.imul(L,ie))+Math.imul(U,re)|0,o=Math.imul(U,ie),i=i+Math.imul(C,oe)|0,n=(n=n+Math.imul(C,ae)|0)+Math.imul(D,oe)|0,o=o+Math.imul(D,ae)|0,i=i+Math.imul(R,ue)|0,n=(n=n+Math.imul(R,ce)|0)+Math.imul(B,ue)|0,o=o+Math.imul(B,ce)|0,i=i+Math.imul(P,fe)|0,n=(n=n+Math.imul(P,le)|0)+Math.imul(M,fe)|0,o=o+Math.imul(M,le)|0;var Me=(c+(i=i+Math.imul(A,pe)|0)|0)+((8191&(n=(n=n+Math.imul(A,me)|0)+Math.imul(O,pe)|0))<<13)|0;c=((o=o+Math.imul(O,me)|0)+(n>>>13)|0)+(Me>>>26)|0,Me&=67108863,i=Math.imul(L,oe),n=(n=Math.imul(L,ae))+Math.imul(U,oe)|0,o=Math.imul(U,ae),i=i+Math.imul(C,ue)|0,n=(n=n+Math.imul(C,ce)|0)+Math.imul(D,ue)|0,o=o+Math.imul(D,ce)|0,i=i+Math.imul(R,fe)|0,n=(n=n+Math.imul(R,le)|0)+Math.imul(B,fe)|0,o=o+Math.imul(B,le)|0;var Te=(c+(i=i+Math.imul(P,pe)|0)|0)+((8191&(n=(n=n+Math.imul(P,me)|0)+Math.imul(M,pe)|0))<<13)|0;c=((o=o+Math.imul(M,me)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,i=Math.imul(L,ue),n=(n=Math.imul(L,ce))+Math.imul(U,ue)|0,o=Math.imul(U,ce),i=i+Math.imul(C,fe)|0,n=(n=n+Math.imul(C,le)|0)+Math.imul(D,fe)|0,o=o+Math.imul(D,le)|0;var Re=(c+(i=i+Math.imul(R,pe)|0)|0)+((8191&(n=(n=n+Math.imul(R,me)|0)+Math.imul(B,pe)|0))<<13)|0;c=((o=o+Math.imul(B,me)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,i=Math.imul(L,fe),n=(n=Math.imul(L,le))+Math.imul(U,fe)|0,o=Math.imul(U,le);var Be=(c+(i=i+Math.imul(C,pe)|0)|0)+((8191&(n=(n=n+Math.imul(C,me)|0)+Math.imul(D,pe)|0))<<13)|0;c=((o=o+Math.imul(D,me)|0)+(n>>>13)|0)+(Be>>>26)|0,Be&=67108863;var Ne=(c+(i=Math.imul(L,pe))|0)+((8191&(n=(n=Math.imul(L,me))+Math.imul(U,pe)|0))<<13)|0;return c=((o=Math.imul(U,me))+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,u[0]=ge,u[1]=be,u[2]=ye,u[3]=ve,u[4]=_e,u[5]=we,u[6]=Se,u[7]=ke,u[8]=Ie,u[9]=Ee,u[10]=Ae,u[11]=Oe,u[12]=xe,u[13]=Pe,u[14]=Me,u[15]=Te,u[16]=Re,u[17]=Be,u[18]=Ne,0!==c&&(u[19]=c,r.length++),r};function p(e,t,r){return(new m).mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(d=l),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?d(this,e,t):r<63?l(this,e,t):r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var a=n;n=0;for(var s=67108863&i,u=Math.min(o,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var h=o-c,f=(0|e.words[h])*(0|t.words[c]),l=67108863&f;s=67108863&(l=l+s|0),n+=(a=(a=a+(f/67108864|0)|0)+(l>>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,e,t):p(this,e,t)},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,i=0;i<e;i++)t[i]=this.revBin(i,r,e);return t},m.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var i=0,n=0;n<t;n++)i|=(1&e)<<t-n-1,e>>=1;return i},m.prototype.permute=function(e,t,r,i,n,o){for(var a=0;a<o;a++)i[a]=t[e[a]],n[a]=r[e[a]]},m.prototype.transform=function(e,t,r,i,n,o){this.permute(o,e,t,r,i,n);for(var a=1;a<n;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),h=0;h<n;h+=s)for(var f=u,l=c,d=0;d<a;d++){var p=r[h+d],m=i[h+d],g=r[h+d+a],b=i[h+d+a],y=f*g-l*b;b=f*b+l*g,g=y,r[h+d]=p+g,i[h+d]=m+b,r[h+d+a]=p-g,i[h+d+a]=m-b,d!==s&&(y=u*f-c*l,l=u*l+c*f,f=y)}},m.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},m.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=e[i];e[i]=e[r-i-1],e[r-i-1]=n,n=t[i],t[i]=-t[r-i-1],t[r-i-1]=-n}},m.prototype.normalize13b=function(e,t){for(var r=0,i=0;i<t/2;i++){var n=8192*Math.round(e[2*i+1]/t)+Math.round(e[2*i]/t)+r;e[i]=67108863&n,r=n<67108864?0:n/67108864|0}return e},m.prototype.convert13b=function(e,t,r,n){for(var o=0,a=0;a<t;a++)o+=0|e[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*t;a<n;++a)r[a]=0;i(0===o),i(0==(-8192&o))},m.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},m.prototype.mulp=function(e,t,r){var i=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(i),o=this.stub(i),a=new Array(i),s=new Array(i),u=new Array(i),c=new Array(i),h=new Array(i),f=new Array(i),l=r.words;l.length=i,this.convert13b(e.words,e.length,a,i),this.convert13b(t.words,t.length,c,i),this.transform(a,o,s,u,i,n),this.transform(c,o,h,f,i,n);for(var d=0;d<i;d++){var p=s[d]*h[d]-u[d]*f[d];u[d]=s[d]*f[d]+u[d]*h[d],s[d]=p}return this.conjugate(s,u,i),this.transform(s,u,l,o,i,n),this.conjugate(l,o,i),this.normalize13b(l,i),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),p(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){i("number"==typeof e),i(e<67108864);for(var t=0,r=0;r<this.length;r++){var n=(0|this.words[r])*e,o=(67108863&n)+(67108863&t);t>>=26,t+=n/67108864|0,t+=o>>>26,this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var i=r/26|0,n=r%26;t[r]=(e.words[i]&1<<n)>>>n}return t}(e);if(0===t.length)return new o(1);for(var r=this,i=0;i<t.length&&0===t[i];i++,r=r.sqr());if(++i<t.length)for(var n=r.sqr();i<t.length;i++,n=n.sqr())0!==t[i]&&(r=r.mul(n));return r},o.prototype.iushln=function(e){i("number"==typeof e&&e>=0);var t,r=e%26,n=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<r;this.words[t]=u|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t<n;t++)this.words[t]=0;this.length+=n}return this.strip()},o.prototype.ishln=function(e){return i(0===this.negative),this.iushln(e)},o.prototype.iushrn=function(e,t,r){var n;i("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(n-=a,n=Math.max(0,n),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var h=0;for(c=this.length-1;c>=0&&(0!==h||c>=n);c--){var f=0|this.words[c];this.words[c]=h<<26-o|f>>>o,h=f&s}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,r){return i(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,n=1<<t;return!(this.length<=r)&&!!(this.words[r]&n)},o.prototype.imaskn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(i(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 n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this.strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return i("number"==typeof e),i(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(i("number"==typeof e),i(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,r){var n,o,a=e.length+r;this._expand(a);var s=0;for(n=0;n<e.length;n++){o=(0|this.words[n+r])+s;var u=(0|e.words[n])*t;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[n+r]=67108863&o}for(;n<this.length-r;n++)s=(o=(0|this.words[n+r])+s)>>26,this.words[n+r]=67108863&o;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n<this.length;n++)s=(o=-(0|this.words[n])+s)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),i=this.clone(),n=e,a=0|n.words[n.length-1];0!==(r=26-this._countBits(a))&&(n=n.ushln(r),i.iushln(r),a=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==t){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var h=i.clone()._ishlnsubmul(n,1,u);0===h.negative&&(i=h,s&&(s.words[u]=1));for(var f=u-1;f>=0;f--){var l=67108864*(0|i.words[n.length+f])+(0|i.words[n.length+f-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(n,l,f);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(n,1,f),i.isZero()||(i.negative^=1);s&&(s.words[f]=l)}return s&&s.strip(),i.strip(),"div"!==t&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},o.prototype.divmod=function(e,t,r){return i(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(n=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:n,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var n,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){i(e<=67108863);for(var t=(1<<26)%e,r=0,n=this.length-1;n>=0;n--)r=(t*r+(0|this.words[n]))%e;return r},o.prototype.idivn=function(e){i(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*t;this.words[r]=n/e|0,t=n%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var h=r.clone(),f=t.clone();!t.isZero();){for(var l=0,d=1;0==(t.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(t.iushrn(l);l-- >0;)(n.isOdd()||a.isOdd())&&(n.iadd(h),a.isub(f)),n.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(h),u.isub(f)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(s),a.isub(u)):(r.isub(t),s.isub(n),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},o.prototype._invmp=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n,a=new o(1),s=new o(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,h=1;0==(t.words[0]&h)&&c<26;++c,h<<=1);if(c>0)for(t.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var f=0,l=1;0==(r.words[0]&l)&&f<26;++f,l<<=1);if(f>0)for(r.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(n=0===t.cmpn(1)?a:s).cmpn(0)<0&&n.iadd(e),n},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)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(i)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){i("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var o=n,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),i(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:n<e?-1:1}return 0!==this.negative?0|-t:t},o.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){i<n?t=-1:i>n&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new S(e)},o.prototype.toRed=function(e){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return i(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return i(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function k(e){S.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var i=t<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},n(y,b),y.prototype.split=function(e,t){for(var r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var n=e.words[9];for(t.words[t.length++]=4194303&n,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,e.words[i-10]=n,0===n&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var i=0|e.words[r];t+=977*i,e.words[r]=67108863&t,t=64*i+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(v,b),n(_,b),n(w,b),w.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var i=19*(0|e.words[r])+t,n=67108863&i;i>>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new y;else if("p224"===e)t=new v;else if("p192"===e)t=new _;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new w}return g[e]=t,t},S.prototype._verify1=function(e){i(0===e.negative,"red works only with positives"),i(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){i(0==(e.negative|t.negative),"red works only with positives"),i(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(i(t%2==1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),a=0;!n.isZero()&&0===n.andln(1);)a++,n.iushrn(1);i(!n.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,c).cmp(u);)h.redIAdd(u);for(var f=this.pow(h,n),l=this.pow(e,n.addn(1).iushrn(1)),d=this.pow(e,n),p=a;0!==d.cmp(s);){for(var m=d,g=0;0!==m.cmp(s);g++)m=m.redSqr();i(g<p);var b=this.pow(f,new o(1).iushln(p-g-1));l=l.redMul(b),f=b.redSqr(),d=d.redMul(f),p=g}return l},S.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},S.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=e;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],e);var n=r[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),i=t.length-1;i>=0;i--){for(var c=t.words[i],h=u-1;h>=0;h--){var f=c>>h&1;n!==r[0]&&(n=this.sqr(n)),0!==f||0!==a?(a<<=1,a|=f,(4===++s||0===i&&0===h)&&(n=this.mul(n,r[a]),s=0,a=0)):s=0}u=26}return n},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new k(e)},n(k,S),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},k.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).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)},k.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,this)}).call(this,r(24)(e))},function(e,t,r){"use strict";(function(t){var i=r(7),n=r(5),o=r(3),a=function(e){for(var r=t.alloc(e.length),i=0;i<e.length;i++)r[i]=e[e.length-1-i];return r};i.Zero=new i(0),i.One=new i(1),i.Minus1=new i(-1),i.fromNumber=function(e){return n.checkArgument(o.isNumber(e)),new i(e)},i.fromString=function(e,t){return n.checkArgument(o.isString(e)),new i(e,t)},i.fromBuffer=function(e,t){void 0!==t&&"little"===t.endian&&(e=a(e));var r=e.toString("hex");return new i(r,16)},i.fromSM=function(e,r){var n;if(0===e.length)return i.fromBuffer(t.from([0]));var o="big";return r&&(o=r.endian),"little"===o&&(e=a(e)),128&e[0]?(e[0]=127&e[0],(n=i.fromBuffer(e)).neg().copy(n)):n=i.fromBuffer(e),n},i.prototype.toNumber=function(){return parseInt(this.toString(10),10)},i.prototype.toBuffer=function(e){var r,n;if(e&&e.size){var o=(n=this.toString(16,2)).length/2;r=t.from(n,"hex"),o===e.size||(o>e.size?r=i.trim(r,o):o<e.size&&(r=i.pad(r,o,e.size)))}else n=this.toString(16,2),r=t.from(n,"hex");return void 0!==e&&"little"===e.endian&&(r=a(r)),r},i.prototype.toSMBigEndian=function(){var e;return-1===this.cmp(i.Zero)?128&(e=this.neg().toBuffer())[0]?e=t.concat([t.from([128]),e]):e[0]=128|e[0]:128&(e=this.toBuffer())[0]&&(e=t.concat([t.from([0]),e])),1===e.length&0===e[0]&&(e=t.from([])),e},i.prototype.toSM=function(e){var t=e?e.endian:"big",r=this.toSMBigEndian();return"little"===t&&(r=a(r)),r},i.fromScriptNumBuffer=function(e,t,r){var o=r||4;if(n.checkArgument(e.length<=o,new Error("script number overflow")),t&&e.length>0&&0==(127&e[e.length-1])&&(e.length<=1||0==(128&e[e.length-2])))throw new Error("non-minimally encoded script number");return i.fromSM(e,{endian:"little"})},i.prototype.toScriptNumBuffer=function(){return this.toSM({endian:"little"})},i.trim=function(e,t){return e.slice(t-e.length,e.length)},i.pad=function(e,r,i){for(var n=t.alloc(i),o=0;o<e.length;o++)n[n.length-1-o]=e[e.length-1-o];for(o=0;o<i-r;o++)n[o]=0;return n},i.prototype.toHex=function(...e){return this.toBuffer(...e).toString("hex")},i.fromHex=function(e,...r){return i.fromBuffer(t.from(e,"hex"),...r)},e.exports=i}).call(this,r(0).Buffer)},function(e,t,r){"use strict";t.randomBytes=t.rng=t.pseudoRandomBytes=t.prng=r(33),t.createHash=t.Hash=r(37),t.createHmac=t.Hmac=r(111);var i=r(218),n=Object.keys(i),o=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(n);t.getHashes=function(){return o};var a=r(114);t.pbkdf2=a.pbkdf2,t.pbkdf2Sync=a.pbkdf2Sync;var s=r(220);t.Cipher=s.Cipher,t.createCipher=s.createCipher,t.Cipheriv=s.Cipheriv,t.createCipheriv=s.createCipheriv,t.Decipher=s.Decipher,t.createDecipher=s.createDecipher,t.Decipheriv=s.Decipheriv,t.createDecipheriv=s.createDecipheriv,t.getCiphers=s.getCiphers,t.listCiphers=s.listCiphers;var u=r(235);t.DiffieHellmanGroup=u.DiffieHellmanGroup,t.createDiffieHellmanGroup=u.createDiffieHellmanGroup,t.getDiffieHellman=u.getDiffieHellman,t.createDiffieHellman=u.createDiffieHellman,t.DiffieHellman=u.DiffieHellman;var c=r(240);t.createSign=c.createSign,t.Sign=c.Sign,t.createVerify=c.createVerify,t.Verify=c.Verify,t.createECDH=r(278);var h=r(279);t.publicEncrypt=h.publicEncrypt,t.privateEncrypt=h.privateEncrypt,t.publicDecrypt=h.publicDecrypt,t.privateDecrypt=h.privateDecrypt;var f=r(282);t.randomFill=f.randomFill,t.randomFillSync=f.randomFillSync,t.createCredentials=function(){throw new Error("sorry, createCredentials is not implemented yet\nwe accept pull requests\nhttps://github.com/browserify/crypto-browserify")},t.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},function(e,t,r){(function(t){t.browser?e.exports=r(286):e.exports=r(287)}).call(this,r(6))},function(e,t,r){"use strict";(function(t){var i=r(8),n=r(3),o=r(5),a=r(12),s=function e(t,r){if(!(this instanceof e))return new e(t,r);if(t instanceof i)this.set({r:t,s:r});else if(t){var n=t;this.set(n)}};s.prototype.set=function(e){return this.r=e.r||this.r||void 0,this.s=e.s||this.s||void 0,this.i=void 0!==e.i?e.i:this.i,this.compressed=void 0!==e.compressed?e.compressed:this.compressed,this.nhashtype=e.nhashtype||this.nhashtype||void 0,this},s.fromCompact=function(e){o.checkArgument(t.isBuffer(e),"Argument is expected to be a Buffer");var r=new s,n=!0,a=e.slice(0,1)[0]-27-4;a<0&&(n=!1,a+=4);var u=e.slice(1,33),c=e.slice(33,65);return o.checkArgument(0===a||1===a||2===a||3===a,new Error("i must be 0, 1, 2, or 3")),o.checkArgument(32===u.length,new Error("r must be 32 bytes")),o.checkArgument(32===c.length,new Error("s must be 32 bytes")),r.compressed=n,r.i=a,r.r=i.fromBuffer(u),r.s=i.fromBuffer(c),r},s.fromDER=s.fromBuffer=function(e,t){var r=s.parseDER(e,t),i=new s;return i.r=r.r,i.s=r.s,i},s.fromTxFormat=function(e){var t=e.readUInt8(e.length-1),r=e.slice(0,e.length-1),i=s.fromDER(r,!1);return i.nhashtype=t,i},s.fromString=function(e){var r=t.from(e,"hex");return s.fromDER(r)},s.parseDER=function(e,r){o.checkArgument(t.isBuffer(e),new Error("DER formatted signature should be a buffer")),n.isUndefined(r)&&(r=!0);var a=e[0];o.checkArgument(48===a,new Error("Header byte should be 0x30"));var s=e[1],u=e.slice(2).length;o.checkArgument(!r||s===u,new Error("Length byte should length of what follows")),s=s<u?s:u;var c=e[2];o.checkArgument(2===c,new Error("Integer byte for r should be 0x02"));var h=e[3],f=e.slice(4,4+h),l=i.fromBuffer(f),d=0===e[4];o.checkArgument(h===f.length,new Error("Length of r incorrect"));var p=e[4+h+0];o.checkArgument(2===p,new Error("Integer byte for s should be 0x02"));var m=e[4+h+1],g=e.slice(4+h+2,4+h+2+m),b=i.fromBuffer(g),y=0===e[4+h+2+2];o.checkArgument(m===g.length,new Error("Length of s incorrect"));var v=4+h+2+m;return o.checkArgument(s===v-2,new Error("Length of signature incorrect")),{header:a,length:s,rheader:c,rlength:h,rneg:d,rbuf:f,r:l,sheader:p,slength:m,sneg:y,sbuf:g,s:b}},s.prototype.toCompact=function(e,r){if(e="number"==typeof e?e:this.i,r="boolean"==typeof r?r:this.compressed,0!==e&&1!==e&&2!==e&&3!==e)throw new Error("i must be equal to 0, 1, 2, or 3");var i=e+27+4;!1===r&&(i-=4);var n=t.from([i]),o=this.r.toBuffer({size:32}),a=this.s.toBuffer({size:32});return t.concat([n,o,a])},s.prototype.toBuffer=s.prototype.toDER=function(){var e=this.r.toBuffer(),r=this.s.toBuffer(),i=!!(128&e[0]),n=!!(128&r[0]),o=i?t.concat([t.from([0]),e]):e,a=n?t.concat([t.from([0]),r]):r,s=o.length,u=a.length,c=2+s+2+u;return t.concat([t.from([48,c,2,s]),o,t.from([2,u]),a])},s.prototype.toString=function(){return this.toDER().toString("hex")},s.isTxDER=function(e){if(e.length<9)return!1;if(e.length>73)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-3)return!1;var t=e[3];if(5+t>=e.length)return!1;var r=e[5+t];if(t+r+7!==e.length)return!1;var i=e.slice(4);if(2!==e[2])return!1;if(0===t)return!1;if(128&i[0])return!1;if(t>1&&0===i[0]&&!(128&i[1]))return!1;var n=e.slice(6+t);return 2===e[6+t-2]&&(0!==r&&(!(128&n[0])&&!(r>1&&0===n[0]&&!(128&n[1]))))},s.prototype.hasLowS=function(){return!this.s.lt(new i(1))&&!this.s.gt(new i("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex"))},s.prototype.hasDefinedHashtype=function(){if(!a.isNaturalNumber(this.nhashtype))return!1;var e=31&this.nhashtype;return!(e<s.SIGHASH_ALL||e>s.SIGHASH_SINGLE)},s.prototype.toTxFormat=function(){var e=this.toDER(),r=t.alloc(1);return r.writeUInt8(this.nhashtype,0),t.concat([e,r])},s.SIGHASH_ALL=1,s.SIGHASH_NONE=2,s.SIGHASH_SINGLE=3,s.SIGHASH_FORKID=64,s.SIGHASH_ANYONECANPAY=128,s.prototype.isCanonical=function(){var e=r(17).getN().shrn(1);return this.s.lte(e)},s.prototype.toCanonical=function(){if(this.isCanonical())return new s({r:this.r,s:this.s,i:this.i,compressed:this.compressed,nhashtype:this.nhashtype});var e=r(17).getN().sub(this.s);return new s({r:this.r,s:e,i:this.i,compressed:this.compressed,nhashtype:this.nhashtype})},s.prototype.validate=function(){if(!this.r||!this.s)throw new Error("Signature missing r or s component");if(this.r.isZero())throw new Error("Signature r component is zero");if(this.s.isZero())throw new Error("Signature s component is zero");var e=r(17).getN();if(this.r.gte(e))throw new Error("Signature r component >= curve order");if(this.s.gte(e))throw new Error("Signature s component >= curve order");if(this.r.isNeg())throw new Error("Signature r component is negative");if(this.s.isNeg())throw new Error("Signature s component is negative");return!0},s.prototype.isValid=function(){try{return this.validate(),!0}catch(e){return!1}},s.prototype.applySecurityPatches=function(){var e=r(17).getN(),t=e.shrn(1);if(this.r.isZero()||this.s.isZero())throw new Error("Invalid signature: zero r or s");if(this.r.gte(e)||this.s.gte(e))throw new Error("Invalid signature: out of range");return this.s.gt(t)&&(this.s=e.sub(this.s)),this},e.exports=s}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(5),o=function(e){return!!i.isString(e)&&/^[0-9a-fA-F]+$/.test(e)};e.exports={isValidJSON:function(e){var t;if(!i.isString(e))return!1;try{t=JSON.parse(e)}catch(e){return!1}return"object"==typeof t},isHexa:o,isHexaString:o,defineImmutable:function(e,t){return Object.keys(t).forEach((function(r){Object.defineProperty(e,r,{configurable:!1,enumerable:!0,value:t[r]})})),e},isNaturalNumber:function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e&&e>=0},integerAsBuffer:function(e){n.checkArgumentType(e,"number","integer");const r=t.allocUnsafe(4);return r.writeUInt32BE(e,0),r}}}).call(this,r(0).Buffer)},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=r,r.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},function(e,t,r){"use strict";var i=t,n=r(7),o=r(14),a=r(128);i.assert=o,i.toArray=a.toArray,i.zero2=a.zero2,i.toHex=a.toHex,i.encode=a.encode,i.getNAF=function(e,t,r){var i,n=new Array(Math.max(e.bitLength(),r)+1);for(i=0;i<n.length;i+=1)n[i]=0;var o=1<<t+1,a=e.clone();for(i=0;i<n.length;i++){var s,u=a.andln(o-1);a.isOdd()?(s=u>(o>>1)-1?(o>>1)-u:u,a.isubn(s)):s=0,n[i]=s,a.iushrn(1)}return n},i.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var i,n=0,o=0;e.cmpn(-n)>0||t.cmpn(-o)>0;){var a,s,u=e.andln(3)+n&3,c=t.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=0==(1&u)?0:3!==(i=e.andln(7)+n&7)&&5!==i||2!==c?u:-u,r[0].push(a),s=0==(1&c)?0:3!==(i=t.andln(7)+o&7)&&5!==i||2!==u?c:-c,r[1].push(s),2*n===a+1&&(n=1-n),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},i.cachedProperty=function(e,t,r){var i="_"+t;e.prototype[t]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},i.parseBytes=function(e){return"string"==typeof e?i.toArray(e,"hex"):e},i.intFromLE=function(e){return new n(e,"hex","le")}},function(e,t,r){"use strict";var i=r(3);function n(e,t){return e.replace("{0}",t[0]).replace("{1}",t[1]).replace("{2}",t[2])}var o=function(e,t){var r=function(){if(i.isString(t.message))this.message=n(t.message,arguments);else{if(!i.isFunction(t.message))throw new Error("Invalid error definition for "+t.name);this.message=t.message.apply(null,arguments)}this.stack=this.message+"\n"+(new Error).stack};return(r.prototype=Object.create(e.prototype)).name=e.prototype.name+t.name,e[t.name]=r,t.errors&&a(r,t.errors),r},a=function(e,t){i.each(t,(function(t){o(e,t)}))},s={Error:function(){this.message="Internal error",this.stack=this.message+"\n"+(new Error).stack}};s.Error.prototype=Object.create(Error.prototype),s.Error.prototype.name="bsv.Error";var u,c=r(285);u=s.Error,a(u,c),e.exports=s.Error,e.exports.extend=function(e){return o(s.Error,e)}},function(e,t,r){"use strict";(function(t){var i=r(8),n=new(0,r(29).ec)("secp256k1"),o=n.curve.point.bind(n.curve),a=n.curve.pointFromX.bind(n.curve),s=function(e,t,r){try{var i=o(e,t,r)}catch(e){throw new Error("Invalid Point")}return i.validate(),i};s.prototype=Object.getPrototypeOf(n.curve.point()),s.fromX=function(e,t){try{var r=a(t,e)}catch(e){throw new Error("Invalid X")}return r.validate(),r},s.getG=function(){return n.curve.g},s.getN=function(){return new i(n.curve.n.toArray())},s.prototype._getX||(s.prototype._getX=s.prototype.getX),s.prototype.getX=function(){return new i(this._getX().toArray())},s.prototype._getY||(s.prototype._getY=s.prototype.getY),s.prototype.getY=function(){return new i(this._getY().toArray())},s.prototype.validate=function(){if(this.isInfinity())throw new Error("Point cannot be equal to Infinity");var e;try{e=a(this.getX(),this.getY().isOdd())}catch(e){throw new Error("Point does not lie on the curve")}if(0!==e.y.cmp(this.y))throw new Error("Invalid y value for curve.");if(!this.mul(s.getN()).isInfinity())throw new Error("Point times N must be infinity");return this},s.pointToCompressed=function(e){var r,i=e.getX().toBuffer({size:32}),n=e.getY().toBuffer({size:32});return r=n[n.length-1]%2?t.from([3]):t.from([2]),t.concat([r,i])},s.pointFromCompressed=function(e){if(33!==e.length)throw new Error("invalid buffer length");let t,r=e[0];if(3===r)t=!0;else{if(2!==r)throw new Error("invalid value of compressed prefix");t=!1}let n=e.slice(1,33),o=i.fromBuffer(n);return s.fromX(t,o)},s.prototype.toBuffer=function(){return s.pointToCompressed(this)},s.prototype.toHex=function(){return this.toBuffer().toString("hex")},s.fromBuffer=function(e){return s.pointFromCompressed(e)},s.fromHex=function(e){return s.fromBuffer(t.from(e,"hex"))},e.exports=s}).call(this,r(0).Buffer)},function(e,t,r){e.exports=r(142),e.exports.Interpreter=r(90)},function(e,t,r){"use strict";var i=r(14),n=r(4);function o(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function a(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function s(e){return 1===e.length?"0"+e:e}function u(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=n,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(var i=0,n=0;n<e.length;n++){var a=e.charCodeAt(n);a<128?r[i++]=a:a<2048?(r[i++]=a>>6|192,r[i++]=63&a|128):o(e,n)?(a=65536+((1023&a)<<10)+(1023&e.charCodeAt(++n)),r[i++]=a>>18|240,r[i++]=a>>12&63|128,r[i++]=a>>6&63|128,r[i++]=63&a|128):(r[i++]=a>>12|224,r[i++]=a>>6&63|128,r[i++]=63&a|128)}else for(n=0;n<e.length;n++)r[n]=0|e[n];return r},t.toHex=function(e){for(var t="",r=0;r<e.length;r++)t+=s(e[r].toString(16));return t},t.htonl=a,t.toHex32=function(e,t){for(var r="",i=0;i<e.length;i++){var n=e[i];"little"===t&&(n=a(n)),r+=u(n.toString(16))}return r},t.zero2=s,t.zero8=u,t.join32=function(e,t,r,n){var o=r-t;i(o%4==0);for(var a=new Array(o/4),s=0,u=t;s<a.length;s++,u+=4){var c;c="big"===n?e[u]<<24|e[u+1]<<16|e[u+2]<<8|e[u+3]:e[u+3]<<24|e[u+2]<<16|e[u+1]<<8|e[u],a[s]=c>>>0}return a},t.split32=function(e,t){for(var r=new Array(4*e.length),i=0,n=0;i<e.length;i++,n+=4){var o=e[i];"big"===t?(r[n]=o>>>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(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<<t|e>>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,i){return e+t+r+i>>>0},t.sum32_5=function(e,t,r,i,n){return e+t+r+i+n>>>0},t.sum64=function(e,t,r,i){var n=e[t],o=i+e[t+1]>>>0,a=(o<i?1:0)+r+n;e[t]=a>>>0,e[t+1]=o},t.sum64_hi=function(e,t,r,i){return(t+i>>>0<t?1:0)+e+r>>>0},t.sum64_lo=function(e,t,r,i){return t+i>>>0},t.sum64_4_hi=function(e,t,r,i,n,o,a,s){var u=0,c=t;return u+=(c=c+i>>>0)<t?1:0,u+=(c=c+o>>>0)<o?1:0,e+r+n+a+(u+=(c=c+s>>>0)<s?1:0)>>>0},t.sum64_4_lo=function(e,t,r,i,n,o,a,s){return t+i+o+s>>>0},t.sum64_5_hi=function(e,t,r,i,n,o,a,s,u,c){var h=0,f=t;return h+=(f=f+i>>>0)<t?1:0,h+=(f=f+o>>>0)<o?1:0,h+=(f=f+s>>>0)<s?1:0,e+r+n+a+u+(h+=(f=f+c>>>0)<c?1:0)>>>0},t.sum64_5_lo=function(e,t,r,i,n,o,a,s,u,c){return t+i+o+s+c>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},function(e,t,r){"use strict";(function(t){var i=r(8),n=r(17),o=r(10),a=r(12),s=r(30),u=r(3),c=r(5);function h(e,t){if(!(this instanceof h))return new h(e,t);if(c.checkArgument(e,"First argument is required, please include public key data."),e instanceof h)return e;t=t||{};var r=this._classifyArgs(e,t);return r.point.validate(),a.defineImmutable(this,{point:r.point,compressed:r.compressed,network:r.network||s.defaultNetwork}),this}h.prototype._classifyArgs=function(e,r){var i={compressed:u.isUndefined(r.compressed)||r.compressed};if(e instanceof n)i.point=e;else if(e.x&&e.y)i=h._transformObject(e);else if("string"==typeof e)i=h._transformDER(t.from(e,"hex"));else if(h._isBuffer(e))i=h._transformDER(e);else{if(!h._isPrivateKey(e))throw new TypeError("First argument is an unrecognized data format.");i=h._transformPrivateKey(e)}return i.network||(i.network=u.isUndefined(r.network)?void 0:s.get(r.network)),i},h._isPrivateKey=function(e){return e instanceof r(60)},h._isBuffer=function(e){return e instanceof t||e instanceof Uint8Array},h._transformPrivateKey=function(e){c.checkArgument(h._isPrivateKey(e),"Must be an instance of PrivateKey");var t={};return t.point=n.getG().mul(e.bn),t.compressed=e.compressed,t.network=e.network,t},h._transformDER=function(e,t){c.checkArgument(h._isBuffer(e),"Must be a buffer of DER encoded public key");var r,o,a,s,f={};if(t=!!u.isUndefined(t)||t,4!==e[0]&&(t||6!==e[0]&&7!==e[0]))if(3===e[0])a=e.slice(1),r=new i(a),(f=h._transformX(!0,r)).compressed=!0;else{if(2!==e[0])throw new TypeError("Invalid DER format public key");a=e.slice(1),r=new i(a),(f=h._transformX(!1,r)).compressed=!0}else{if(a=e.slice(1,33),s=e.slice(33,65),32!==a.length||32!==s.length||65!==e.length)throw new TypeError("Length of x and y must be 32 bytes");r=new i(a),o=new i(s),f.point=new n(r,o),f.compressed=!1}return f},h._transformX=function(e,t){c.checkArgument("boolean"==typeof e,"Must specify whether y is odd or not (true or false)");var r={};return r.point=n.fromX(e,t),r},h._transformObject=function(e){var t=new i(e.x,"hex"),r=new i(e.y,"hex");return new h(new n(t,r),{compressed:e.compressed})},h.fromPrivateKey=function(e){c.checkArgument(h._isPrivateKey(e),"Must be an instance of PrivateKey");var t=h._transformPrivateKey(e);return new h(t.point,{compressed:t.compressed,network:t.network})},h.fromDER=h.fromBuffer=function(e,t){c.checkArgument(h._isBuffer(e),"Must be a buffer of DER encoded public key");var r=h._transformDER(e,t);return new h(r.point,{compressed:r.compressed})},h.fromPoint=function(e,t){return c.checkArgument(e instanceof n,"First argument must be an instance of Point."),new h(e,{compressed:t})},h.fromHex=h.fromString=function(e,r){var i=t.from(e,r||"hex"),n=h._transformDER(i);return new h(n.point,{compressed:n.compressed})},h.fromX=function(e,t){var r=h._transformX(e,t);return new h(r.point,{compressed:r.compressed})},h.getValidationError=function(e){var t;try{new h(e)}catch(e){t=e}return t},h.isValid=function(e){return!h.getValidationError(e)},h.prototype.toObject=h.prototype.toJSON=function(){return{x:this.point.getX().toString("hex",2),y:this.point.getY().toString("hex",2),compressed:this.compressed}},h.prototype.toBuffer=h.prototype.toDER=function(){var e,r=this.point.getX(),i=this.point.getY(),n=r.toBuffer({size:32}),o=i.toBuffer({size:32});return this.compressed?(e=o[o.length-1]%2?t.from([3]):t.from([2]),t.concat([e,n])):(e=t.from([4]),t.concat([e,n,o]))},h.prototype._getID=function(){return o.sha256ripemd160(this.toBuffer())},h.prototype.toAddress=function(e){return r(36).fromPublicKey(this,e||this.network)},h.prototype.toString=h.prototype.toHex=function(){return this.toDER().toString("hex")},h.prototype.inspect=function(){return"<PublicKey: "+this.toHex()+(this.compressed?"":", uncompressed")+">"},e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(48),n=function e(t){if(!(this instanceof e))return new e(t);this.bufLen=0,t?this.set(t):this.bufs=[]};n.prototype.set=function(e){return this.bufs=e.bufs||this.bufs||[],this.bufLen=this.bufs.reduce((function(e,t){return e+t.length}),0),this},n.prototype.toBuffer=function(){return this.concat()},n.prototype.concat=function(){return t.concat(this.bufs,this.bufLen)},n.prototype.write=function(e){return i(t.isBuffer(e)),this.bufs.push(e),this.bufLen+=e.length,this},n.prototype.writeReverse=function(e){return i(t.isBuffer(e)),this.bufs.push(t.from(e).reverse()),this.bufLen+=e.length,this},n.prototype.writeUInt8=function(e){var r=t.alloc(1);return r.writeUInt8(e,0),this.write(r),this},n.prototype.writeUInt16BE=function(e){var r=t.alloc(2);return r.writeUInt16BE(e,0),this.write(r),this},n.prototype.writeUInt16LE=function(e){var r=t.alloc(2);return r.writeUInt16LE(e,0),this.write(r),this},n.prototype.writeUInt32BE=function(e){var r=t.alloc(4);return r.writeUInt32BE(e,0),this.write(r),this},n.prototype.writeInt32LE=function(e){var r=t.alloc(4);return r.writeInt32LE(e,0),this.write(r),this},n.prototype.writeUInt32LE=function(e){var r=t.alloc(4);return r.writeUInt32LE(e,0),this.write(r),this},n.prototype.writeUInt64BEBN=function(e){var t=e.toBuffer({size:8});return this.write(t),this},n.prototype.writeUInt64LEBN=function(e){var t=e.toBuffer({size:8});return this.writeReverse(t),this},n.prototype.writeVarintNum=function(e){var t=n.varintBufNum(e);return this.write(t),this},n.prototype.writeVarintBN=function(e){var t=n.varintBufBN(e);return this.write(t),this},n.varintBufNum=function(e){var r;return e<253?(r=t.alloc(1)).writeUInt8(e,0):e<65536?((r=t.alloc(3)).writeUInt8(253,0),r.writeUInt16LE(e,1)):e<4294967296?((r=t.alloc(5)).writeUInt8(254,0),r.writeUInt32LE(e,1)):((r=t.alloc(9)).writeUInt8(255,0),r.writeInt32LE(-1&e,1),r.writeUInt32LE(Math.floor(e/4294967296),5)),r},n.varintBufBN=function(e){var r,i=e.toNumber();if(i<253)(r=t.alloc(1)).writeUInt8(i,0);else if(i<65536)(r=t.alloc(3)).writeUInt8(253,0),r.writeUInt16LE(i,1);else if(i<4294967296)(r=t.alloc(5)).writeUInt8(254,0),r.writeUInt32LE(i,1);else{var o=new n;o.writeUInt8(255),o.writeUInt64LEBN(e),r=o.concat()}return r},e.exports=n}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(2);r(9);function n(e,r){if(!(this instanceof n))return new n(e,r);this.preimage=t.isBuffer(e)?e:t.from(e,"hex"),this.options=r||{},this.strategy=this.options.strategy||"DYNAMIC",this.fields=null,this.sighashInfo=null,this.options.deferExtraction||this._extractFields()}n.prototype.extract=function(e){return this.strategy=e||this.strategy,this._extractFields(),this.fields},n.prototype.getSighashInfo=function(){return this.fields||this._extractFields(),this.sighashInfo},n.prototype.getField=function(e){return this.fields||this._extractFields(),this.fields[e]},n.prototype.extractField=function(e,t){t=t||{},this.fields||this._extractFields();var r=this._parsePreimageStructure(),i=this._generateBidirectionalASM(e,r,t.includeComments),n=this._extractSpecificField(e,r),o=this._interpretField(e,n,r);return{field:e,value:n?n.toString("hex"):null,buffer:n,asm:i,interpretation:o,strategy:this._getExtractionStrategy(e),structure:r._structure}},n.prototype.generateASM=function(e,t){var r=this._parsePreimageStructure();return this._generateBidirectionalASM(e,r,t)},n.prototype.extractFields=function(e){var t={};return e.forEach(function(e){t[e]=this.extractField(e)}.bind(this)),t},n.prototype.validate=function(){this.fields||this._extractFields();var e=[],t=[];return["version","hashPrevouts","hashSequence","outpoint","scriptCode","amount","sequence","hashOutputs","locktime","sighash"].forEach(function(t){this.fields[t]||e.push("Missing required field: "+t)}.bind(this)),this.sighashInfo.hasZeroHashes&&t.push("Zero hashes detected - check SIGHASH flags: "+this.sighashInfo.zeroFields.join(", ")),this.preimage.length<104&&e.push("Preimage too short: "+this.preimage.length+" bytes (minimum 104)"),{valid:0===e.length,errors:e,warnings:t,sighashInfo:this.sighashInfo}},n.prototype.toObject=function(){return this.fields||this._extractFields(),{preimage:this.preimage.toString("hex"),length:this.preimage.length,strategy:this.strategy,fields:{version:this.fields.version?this.fields.version.toString("hex"):null,hashPrevouts:this.fields.hashPrevouts?this.fields.hashPrevouts.toString("hex"):null,hashSequence:this.fields.hashSequence?this.fields.hashSequence.toString("hex"):null,outpoint:this.fields.outpoint?this.fields.outpoint.toString("hex"):null,scriptCode:this.fields.scriptCode?this.fields.scriptCode.toString("hex"):null,scriptCodeLength:this.fields.scriptCodeLength,amount:this.fields.amount?this.fields.amount.toString("hex"):null,sequence:this.fields.sequence?this.fields.sequence.toString("hex"):null,hashOutputs:this.fields.hashOutputs?this.fields.hashOutputs.toString("hex"):null,locktime:this.fields.locktime?this.fields.locktime.toString("hex"):null,sighash:this.fields.sighash?this.fields.sighash.toString("hex"):null},sighashInfo:this.sighashInfo,validation:this.validate()}},n.prototype._extractFields=function(){this.fields={},this.sighashInfo={flag:null,hasZeroHashes:!1,zeroFields:[],warnings:[]};try{"LEFT"===this.strategy||"DYNAMIC"===this.strategy?this._extractFromLeft():"RIGHT"===this.strategy&&this._extractFromRight(),this._analyzeSighash()}catch(e){if("DYNAMIC"!==this.strategy)throw e;try{this.strategy="RIGHT",this._extractFromRight(),this._analyzeSighash()}catch(t){throw new Error("Failed to extract preimage fields with any strategy: "+e.message)}}},n.prototype._extractFromLeft=function(){var e=0;this.fields.version=this.preimage.slice(e,e+4),e+=4,this.fields.hashPrevouts=this.preimage.slice(e,e+32),e+=32,this.fields.hashSequence=this.preimage.slice(e,e+32),e+=32,this.fields.outpoint=this.preimage.slice(e,e+36),e+=36;var t=n.decodeCompactSize(this.preimage,e);this.fields.scriptCodeLength=t.value,e=t.nextOffset,this.fields.scriptCode=this.preimage.slice(e,e+this.fields.scriptCodeLength),e+=this.fields.scriptCodeLength,this.fields.amount=this.preimage.slice(e,e+8),e+=8,this.fields.sequence=this.preimage.slice(e,e+4),e+=4,this.fields.hashOutputs=this.preimage.slice(e,e+32),e+=32,this.fields.locktime=this.preimage.slice(e,e+4),e+=4,this.fields.sighash=this.preimage.slice(e,e+4)},n.prototype._extractFromRight=function(){var e=this.preimage.length;e-=4,this.fields.sighash=this.preimage.slice(e,e+4),e-=4,this.fields.locktime=this.preimage.slice(e,e+4),e-=32,this.fields.hashOutputs=this.preimage.slice(e,e+32),e-=4,this.fields.sequence=this.preimage.slice(e,e+4),e-=8,this.fields.amount=this.preimage.slice(e,e+8);var t=n.decodeCompactSize(this.preimage,104);this.fields.scriptCodeLength=t.value,this.fields.scriptCode=this.preimage.slice(t.nextOffset,t.nextOffset+this.fields.scriptCodeLength),this.fields.version=this.preimage.slice(0,4),this.fields.hashPrevouts=this.preimage.slice(4,36),this.fields.hashSequence=this.preimage.slice(36,68),this.fields.outpoint=this.preimage.slice(68,104)},n.prototype._analyzeSighash=function(){if(this.fields.sighash){var e=this.fields.sighash.readUInt32LE(0);this.sighashInfo.flag=e;var r=31&e,i=0!=(128&e),n=0!=(64&e),o=t.alloc(32);i&&this.fields.hashPrevouts.equals(o)&&(this.sighashInfo.hasZeroHashes=!0,this.sighashInfo.zeroFields.push("hashPrevouts"),this.sighashInfo.warnings.push("ANYONECANPAY flag detected - hashPrevouts is zero")),2===r&&this.fields.hashSequence.equals(o)&&(this.sighashInfo.hasZeroHashes=!0,this.sighashInfo.zeroFields.push("hashSequence"),this.sighashInfo.warnings.push("SIGHASH_NONE flag detected - hashSequence is zero")),2!==r&&3!==r||!this.fields.hashOutputs.equals(o)||(this.sighashInfo.hasZeroHashes=!0,this.sighashInfo.zeroFields.push("hashOutputs"),this.sighashInfo.warnings.push("SIGHASH_NONE/SINGLE flag detected - hashOutputs is zero"));var a=[];1===r?a.push("ALL"):2===r?a.push("NONE"):3===r&&a.push("SINGLE"),i&&a.push("ANYONECANPAY"),n&&a.push("FORKID"),this.sighashInfo.flagName=a.join(" | ")}},n.prototype._parsePreimageStructure=function(){for(var e=this.preimage,t=0,r={},i=[{name:"nVersion",len:4},{name:"hashPrevouts",len:32},{name:"hashSequence",len:32},{name:"outpoint_txid",len:32},{name:"outpoint_vout",len:4}],o=[{name:"value",len:8},{name:"nSequence",len:4},{name:"hashOutputs",len:32},{name:"nLocktime",len:4},{name:"sighashType",len:4}],a=0;a<i.length;a++){var s=i[a];r[s.name]=e.slice(t,t+s.len).toString("hex"),t+=s.len}var u=n.decodeCompactSize(e,t);r.scriptLen=u.value,r.scriptLenSize=u.bytes,r.scriptLenRaw=e.slice(t,t+u.bytes).toString("hex"),t+=u.bytes,r.scriptCode=e.slice(t,t+r.scriptLen).toString("hex"),t+=r.scriptLen;for(var c=0;c<o.length;c++){var h=o[c];r[h.name]=e.slice(t,t+h.len).toString("hex"),t+=h.len}var f=i.reduce((function(e,t){return e+t.len}),0),l=o.reduce((function(e,t){return e+t.len}),0);return r._structure={leftFixed:f,scriptLenVarint:u.bytes,scriptCode:r.scriptLen,rightFixed:l,totalCalculated:f+u.bytes+r.scriptLen+l,totalActual:e.length},r},n.prototype._generateBidirectionalASM=function(e,t,r){if(["value","nSequence","hashOutputs","nLocktime","sighashType"].includes(e))return this._generateRightExtractionASM(e,r);if(["nVersion","hashPrevouts","hashSequence","outpoint_txid","outpoint_vout"].includes(e))return this._generateLeftExtractionASM(e,r);if("scriptCode"===e)return this._generateDynamicExtractionASM(t,r);if("scriptLen"===e)return this._generateScriptLenExtractionASM(t,r);throw new Error("Unknown field: "+e)},n.prototype._generateRightExtractionASM=function(e,t){for(var r=[{name:"value",len:8},{name:"nSequence",len:4},{name:"hashOutputs",len:32},{name:"nLocktime",len:4},{name:"sighashType",len:4}],i=0,n=0,o=!1,a=0;a<r.length;a++){var s=r[a];if(s.name===e){n=s.len,o=!0;break}i+=s.len}if(!o)throw new Error("Field not found in RIGHT fields: "+e);var u=52-i,c=[];return t?(c.push("# 🔄 Extract "+e+" from RIGHT side (bidirectional strategy)"),c.push("OP_SIZE # Push preimage size: [preimage, size]")):c.push("OP_SIZE"),(c=t?c.concat([u+" OP_SUB # Calculate split point: [preimage, split_point]","OP_SPLIT # Split: [left_part, right_part]","OP_DROP # Drop left: [right_part]",n+" OP_SPLIT # Extract field: [remaining, "+e+"]","OP_DROP # Clean up: ["+e+"]","# ✅ Result: "+e+" is now on top of stack"]):c.concat([u+" OP_SUB","OP_SPLIT","OP_DROP",n+" OP_SPLIT","OP_DROP"])).join("\n")},n.prototype._generateLeftExtractionASM=function(e,t){var r=[{name:"nVersion",len:4,offset:0},{name:"hashPrevouts",len:32,offset:4},{name:"hashSequence",len:32,offset:36},{name:"outpoint_txid",len:32,offset:68},{name:"outpoint_vout",len:4,offset:100}].find((function(t){return t.name===e}));if(!r)throw new Error("Field not found in LEFT fields: "+e);return(t?["# 🔄 Extract "+e+" from LEFT side (bidirectional strategy)",r.offset+" OP_SPLIT # Skip to field: [prefix, remainder]","OP_DROP # Drop prefix: [remainder]",r.len+" OP_SPLIT # Extract field: ["+e+", suffix]","OP_DROP # Clean up: ["+e+"]","# ✅ Result: "+e+" is now on top of stack"]:[r.offset+" OP_SPLIT","OP_DROP",r.len+" OP_SPLIT","OP_DROP"]).join("\n")},n.prototype._generateDynamicExtractionASM=function(e,t){return["# 🎯 Extract scriptCode DYNAMICALLY with CompactSize varint support",104+e.scriptLenSize+" OP_SPLIT # Skip left zone + scriptLen varint: [left_zone, remainder]","OP_DROP # Drop left: [remainder]",e.scriptLen+" OP_SPLIT # Extract scriptCode: [scriptCode, right_zone]","OP_DROP # Clean up: [scriptCode]","# ✅ Result: scriptCode extracted with "+e.scriptLenSize+"-byte varint awareness"].join("\n")},n.prototype._generateScriptLenExtractionASM=function(e,t){return["# 🎯 Extract scriptLen CompactSize varint ("+e.scriptLenSize+" bytes)","104 OP_SPLIT # Skip left fixed fields: [left_zone, remainder]","OP_DROP # Drop left: [remainder]",e.scriptLenSize+" OP_SPLIT # Extract varint: [scriptLen_varint, suffix]","OP_DROP # Clean up: [scriptLen_varint]","# ✅ Result: CompactSize varint (decode off-chain to get "+e.scriptLen+")"].join("\n")},n.prototype._extractSpecificField=function(e,r){var i=r[e];return i?t.from(i,"hex"):null},n.prototype._interpretField=function(e,r,i){if(!r)return null;var n={raw:r.toString("hex"),bytes:r.length};try{switch(e){case"nVersion":n.value=r.readUInt32LE(0),n.description="Transaction version "+n.value;break;case"value":8===r.length&&(n.satoshis=r.readBigUInt64LE(0).toString(),n.description=n.satoshis+" satoshis");break;case"sighashType":var o=r.readUInt32LE(0);n.value=o,n.description={1:"SIGHASH_ALL",65:"SIGHASH_ALL | FORKID",2:"SIGHASH_NONE",66:"SIGHASH_NONE | FORKID",3:"SIGHASH_SINGLE",67:"SIGHASH_SINGLE | FORKID"}[o]||"Custom ("+o+")";break;case"outpoint_vout":n.value=r.readUInt32LE(0),n.description="Output index "+n.value;break;case"scriptLen":n.varintSize=i.scriptLenSize,n.scriptLength=i.scriptLen,n.description=i.scriptLen+" bytes encoded as "+i.scriptLenSize+"-byte varint";break;case"scriptCode":25===r.length&&118===r[0]&&169===r[1]?(n.description="Standard P2PKH script (25 bytes)",n.type="P2PKH"):r.length>0&&106===r[0]?(n.description="OP_RETURN data script ("+r.length+" bytes)",n.type="OP_RETURN"):(n.description="Custom script ("+r.length+" bytes)",n.type="CUSTOM");break;default:if(["hashPrevouts","hashSequence","hashOutputs"].includes(e)){var a=t.alloc(32);r.equals(a)?(n.isZero=!0,n.description="Zero hash (check SIGHASH flags)"):n.description="32-byte hash"}}}catch(e){n.error=e.message}return n},n.prototype._getExtractionStrategy=function(e){return["value","nSequence","hashOutputs","nLocktime","sighashType"].includes(e)?"RIGHT":["nVersion","hashPrevouts","hashSequence","outpoint_txid","outpoint_vout"].includes(e)?"LEFT":"scriptCode"===e?"DYNAMIC":"scriptLen"===e?"VARINT":"UNKNOWN"},n.decodeCompactSize=function(e,t){var r=e[t];if(r<253)return{value:r,nextOffset:t+1,bytes:1};if(253===r)return{value:e.readUInt16LE(t+1),nextOffset:t+3,bytes:3};if(254===r)return{value:e.readUInt32LE(t+1),nextOffset:t+5,bytes:5};console.warn("Encountered 8-byte CompactSize - this is very unusual for script lengths");try{return{value:e.readUInt32LE(t+1),nextOffset:t+9,bytes:9}}catch(e){throw new Error("Invalid 8-byte CompactSize encoding in preimage")}},n.fromTransaction=function(e,t,r,o,a){return new n(i.Transaction.sighash.sighashPreimage(e,a,t,r,new i.crypto.BN(o)),{transaction:e,inputIndex:t,subscript:r,satoshis:o,sighashType:a})},n.createExample=function(e){var t=i.PrivateKey.fromRandom().toAddress(),r={txId:"0".repeat(64),outputIndex:0,script:i.Script.buildPublicKeyHashOut(t).toHex(),satoshis:1e5},o=(new i.Transaction).from(r).to(t,99e3),a=i.Script.fromHex(r.script);return n.fromTransaction(o,0,a,r.satoshis,e)},n.extractFromHex=function(e,t,r){return new n(e,{deferExtraction:!0}).extractField(t,r)},n.generateASMFromHex=function(e,t,r){return new n(e,{deferExtraction:!0}).generateASM(t,r)},n.extractMultipleFromHex=function(e,t){return new n(e,{deferExtraction:!0}).extractFields(t)},n.validateFromHex=function(e){return new n(e).validate()},n.analyzeFromHex=function(e){var t=new n(e),r=t._parsePreimageStructure(),i=t.validate();return{hex:e,length:e.length/2,structure:r._structure,fields:r,validation:i,sighashInfo:t.getSighashInfo(),extractField:function(e){return t.extractField(e)},generateASM:function(e){return t.generateASM(e)},getSummary:function(){return{totalBytes:r._structure.totalActual,scriptLength:r.scriptLen,scriptVarintSize:r.scriptLenSize,sighashType:r.sighashType,valid:i.valid,warnings:i.warnings}}}},e.exports=n}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var i=r(1).Buffer,n=r(66).Transform,o=r(70).StringDecoder,a=r(216),s=r(53);function u(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}a(u,n),u.prototype.update=function(e,t,r){var i=s(e,t),n=this._update(i);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)},u.prototype.setAutoPadding=function(){},u.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},u.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},u.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},u.prototype._transform=function(e,t,r){var i;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){i=e}finally{r(i)}},u.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},u.prototype._finalOrDigest=function(e){var t=this.__final()||i.alloc(0);return e&&(t=this._toString(t,e,!0)),t},u.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 i=this._decoder.write(e);return r&&(i+=this._decoder.end()),i},e.exports=u},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(5),o=r(8),a=function e(r){if(!(this instanceof e))return new e(r);if(!i.isUndefined(r))if(t.isBuffer(r))this.set({buf:r});else if(i.isString(r)){var n=t.from(r,"hex");if(2*n.length!==r.length)throw new TypeError("Invalid hex string");this.set({buf:n})}else{if(!i.isObject(r))throw new TypeError("Unrecognized argument for BufferReader");var o=r;this.set(o)}};a.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this.pos=e.pos||this.pos||0,this},a.prototype.eof=function(){return this.pos>=this.buf.length},a.prototype.finished=a.prototype.eof,a.prototype.read=function(e){n.checkArgument(!i.isUndefined(e),"Must specify a length");var t=this.buf.slice(this.pos,this.pos+e);return this.pos=this.pos+e,t},a.prototype.readAll=function(){var e=this.buf.slice(this.pos,this.buf.length);return this.pos=this.buf.length,e},a.prototype.readUInt8=function(){var e=this.buf.readUInt8(this.pos);return this.pos=this.pos+1,e},a.prototype.readUInt16BE=function(){var e=this.buf.readUInt16BE(this.pos);return this.pos=this.pos+2,e},a.prototype.readUInt16LE=function(){var e=this.buf.readUInt16LE(this.pos);return this.pos=this.pos+2,e},a.prototype.readUInt32BE=function(){var e=this.buf.readUInt32BE(this.pos);return this.pos=this.pos+4,e},a.prototype.readUInt32LE=function(){var e=this.buf.readUInt32LE(this.pos);return this.pos=this.pos+4,e},a.prototype.readInt32LE=function(){var e=this.buf.readInt32LE(this.pos);return this.pos=this.pos+4,e},a.prototype.readUInt64BEBN=function(){var e=this.buf.slice(this.pos,this.pos+8),t=o.fromBuffer(e);return this.pos=this.pos+8,t},a.prototype.readUInt64LEBN=function(){var e,t=this.buf.readUInt32LE(this.pos),r=4294967296*this.buf.readUInt32LE(this.pos+4)+t;if(r<=9007199254740991)e=new o(r);else{var i=Array.prototype.slice.call(this.buf,this.pos,this.pos+8);e=new o(i,10,"le")}return this.pos=this.pos+8,e},a.prototype.readVarintNum=function(){var e=this.readUInt8();switch(e){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:var t=this.readUInt64LEBN().toNumber();if(t<=Math.pow(2,53))return t;throw new Error("number too large to retain precision - use readVarintBN");default:return e}},a.prototype.readVarLengthBuffer=function(){var e=this.readVarintNum(),t=this.read(e);return n.checkState(t.length===e,"Invalid length while reading varlength buffer. Expected to read: "+e+" and read "+t.length),t},a.prototype.readVarintBuf=function(){switch(this.buf.readUInt8(this.pos)){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}},a.prototype.readVarintBN=function(){var e=this.readUInt8();switch(e){case 253:return new o(this.readUInt16LE());case 254:return new o(this.readUInt32LE());case 255:return this.readUInt64LEBN();default:return new o(e)}},a.prototype.reverse=function(){for(var e=t.alloc(this.buf.length),r=0;r<e.length;r++)e[r]=this.buf[this.buf.length-1-r];return this.buf=e,this},a.prototype.readReverse=function(e){i.isUndefined(e)&&(e=this.buf.length);var r=this.buf.slice(this.pos,this.pos+e);return this.pos=this.pos+e,t.from(r).reverse()},e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(0),n=r(11),o=r(18),a=r(27),s=r(25),u=r(21),c=r(8),h=r(10),f=r(87),l=r(5),d=r(90),p=r(3),m=t.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),g=d.SCRIPT_ENABLE_SIGHASH_FORKID,b=function(e,s,f,b,y,v){var _=r(145),w=r(91);p.isUndefined(v)&&(v=g);var S,k=_.shallowCopy(e);(b=new o(b),v&d.SCRIPT_ENABLE_REPLAY_PROTECTION)&&(s=(16711680|57005^s>>8)<<8|255&s);if(s&n.SIGHASH_FORKID&&v&d.SCRIPT_ENABLE_SIGHASH_FORKID)return function(e,r,i,o,a){var s=e.inputs[i];function f(e,t){var r=new u;p.isUndefined(t)?p.each(e.outputs,(function(e){e.toBufferWriter(r)})):e.outputs[t].toBufferWriter(r);var i=r.toBuffer();return h.sha256sha256(i)}l.checkArgument(a instanceof c,"For ForkId=0 signatures, satoshis or complete input must be provided");var d=t.alloc(32),m=t.alloc(32),g=t.alloc(32);r&n.SIGHASH_ANYONECANPAY||(d=function(e){var t=new u;p.each(e.inputs,(function(e){t.writeReverse(e.prevTxId),t.writeUInt32LE(e.outputIndex)}));var r=t.toBuffer();return h.sha256sha256(r)}(e)),r&n.SIGHASH_ANYONECANPAY||(31&r)===n.SIGHASH_SINGLE||(31&r)===n.SIGHASH_NONE||(m=function(e){var t=new u;p.each(e.inputs,(function(e){t.writeUInt32LE(e.sequenceNumber)}));var r=t.toBuffer();return h.sha256sha256(r)}(e)),(31&r)!==n.SIGHASH_SINGLE&&(31&r)!==n.SIGHASH_NONE?g=f(e):(31&r)===n.SIGHASH_SINGLE&&i<e.outputs.length&&(g=f(e,i));var b=new u;b.writeInt32LE(e.version),b.write(d),b.write(m),b.writeReverse(s.prevTxId),b.writeUInt32LE(s.outputIndex),b.writeVarintNum(o.toBuffer().length),b.write(o.toBuffer()),b.writeUInt64LEBN(a);var y=s.sequenceNumber;return b.writeUInt32LE(y),b.write(g),b.writeUInt32LE(e.nLockTime),b.writeUInt32LE(r>>>0),b.toBuffer()}(k,s,f,b,y);for(b.removeCodeseparators(),S=0;S<k.inputs.length;S++)k.inputs[S]=new w(k.inputs[S]).setScript(o.empty());if(k.inputs[f]=new w(k.inputs[f]).setScript(b),(31&s)===n.SIGHASH_NONE||(31&s)===n.SIGHASH_SINGLE)for(S=0;S<k.inputs.length;S++)S!==f&&(k.inputs[S].sequenceNumber=0);if((31&s)===n.SIGHASH_NONE)k.outputs=[];else if((31&s)===n.SIGHASH_SINGLE){if(f>=k.outputs.length)return m;for(k.outputs.length=f+1,S=0;S<f;S++)k.outputs[S]=new a({satoshis:c.fromBuffer(i.Buffer.from("ffffffffffffffff","hex")),script:o.empty()})}return s&n.SIGHASH_ANYONECANPAY&&(k.inputs=[k.inputs[f]]),(new u).write(k.toBuffer()).writeInt32LE(s).toBuffer()},y=function(e,t,r,i,n,o){var a=b(e,t,r,i,n,o);if(0===a.compare(m))return a;var u=h.sha256sha256(a);return u=new s(u).readReverse()};e.exports={sighashPreimage:b,sighash:y,sign:function(e,t,r,i,n,o,a){var s=y(e,r,i,n,o,a);return f.sign(s,t,"little").set({nhashtype:r})},verify:function(e,t,r,i,n,o,a){l.checkArgument(!p.isUndefined(e)),l.checkArgument(!p.isUndefined(t)&&!p.isUndefined(t.nhashtype));var s=y(e,t.nhashtype,i,n,o,a);return f.verify(s,t,r,"little")}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(8),o=r(0),a=r(12),s=r(21),u=r(49),c=r(18),h=r(5),f=r(16);function l(e){if(!(this instanceof l))return new l(e);if(!i.isObject(e))throw new TypeError("Unrecognized argument for Output");var r;this.satoshis=e.satoshis,t.isBuffer(e.script)?this._scriptBuffer=e.script:(r=i.isString(e.script)&&a.isHexa(e.script)?o.Buffer.from(e.script,"hex"):e.script,this.setScript(r))}Object.defineProperty(l.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this._script||this.setScriptFromBuffer(this._scriptBuffer),this._script}}),Object.defineProperty(l.prototype,"satoshis",{configurable:!1,enumerable:!0,get:function(){return this._satoshis},set:function(e){e instanceof n?(this._satoshisBN=e,this._satoshis=e.toNumber()):i.isString(e)?(this._satoshis=parseInt(e),this._satoshisBN=n.fromNumber(this._satoshis)):(h.checkArgument(a.isNaturalNumber(e),"Output satoshis is not a natural number"),this._satoshisBN=n.fromNumber(e),this._satoshis=e),h.checkState(a.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}}),l.prototype.invalidSatoshis=function(){return this._satoshis>9007199254740991?"transaction txout satoshis greater than max safe integer":this._satoshis!==this._satoshisBN.toNumber()?"transaction txout satoshis has corrupted value":this._satoshis<0&&"transaction txout negative"},Object.defineProperty(l.prototype,"satoshisBN",{configurable:!1,enumerable:!0,get:function(){return this._satoshisBN},set:function(e){this._satoshisBN=e,this._satoshis=e.toNumber(),h.checkState(a.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}}),l.prototype.toObject=l.prototype.toJSON=function(){var e={satoshis:this.satoshis};return e.script=this._scriptBuffer.toString("hex"),e},l.fromObject=function(e){return new l(e)},l.prototype.setScriptFromBuffer=function(e){this._scriptBuffer=e;try{this._script=c.fromBuffer(this._scriptBuffer),this._script._isOutput=!0}catch(e){if(!(e instanceof f.Script.InvalidBuffer))throw e;this._script=null}},l.prototype.setScript=function(e){if(e instanceof c)this._scriptBuffer=e.toBuffer(),this._script=e,this._script._isOutput=!0;else if(i.isString(e))this._script=c.fromString(e),this._scriptBuffer=this._script.toBuffer(),this._script._isOutput=!0;else{if(!t.isBuffer(e))throw new TypeError("Invalid argument type: script");this.setScriptFromBuffer(e)}return this},l.prototype.inspect=function(){var e;return e=this.script?this.script.inspect():this._scriptBuffer.toString("hex"),"<Output ("+this.satoshis+" sats) "+e+">"},l.fromBufferReader=function(e){var t={};t.satoshis=e.readUInt64LEBN();var r=e.readVarintNum();return t.script=0!==r?e.read(r):o.Buffer.from([]),new l(t)},l.prototype.toBufferWriter=function(e){e||(e=new s),e.writeUInt64LEBN(this._satoshisBN);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e},l.prototype.getSize=function(){var e=this.script.toBuffer().length;return 8+u(e).toBuffer().length+e},e.exports=l}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var i=r(52),n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=f;var o=Object.create(r(39));o.inherits=r(4);var a=r(98),s=r(69);o.inherits(f,a);for(var u=n(s.prototype),c=0;c<u.length;c++){var h=u[c];f.prototype[h]||(f.prototype[h]=s.prototype[h])}function f(e){if(!(this instanceof f))return new f(e);a.call(this,e),s.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",l)}function l(){this.allowHalfOpen||this._writableState.ended||i.nextTick(d,this)}function d(e){e.end()}Object.defineProperty(f.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(f.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),f.prototype._destroy=function(e,t){this.push(null),this.end(),i.nextTick(t,e)}},function(e,t,r){"use strict";var i=t;i.version=r(245).version,i.utils=r(15),i.rand=r(82),i.curve=r(129),i.curves=r(85),i.ec=r(256),i.eddsa=r(260)},function(e,t,r){"use strict";var i=r(3),n=r(12),o=[],a={};function s(){}function u(e,t){if(~o.indexOf(e))return e;if(!t)return a[e];i.isArray(t)||(t=[t]);for(var r=0;r<o.length;r++){var n=o[r],s=i.pick(n,t);if(~i.values(s).indexOf(e))return n}}function c(e){for(var t=[],r=0;r<e.length;r++)t.push(31&e.charCodeAt(r));return t}function h(e){var t=new s;n.defineImmutable(t,{name:e.name,alias:e.alias,pubkeyhash:e.pubkeyhash,privatekey:e.privatekey,scripthash:e.scripthash,xpubkey:e.xpubkey,xprivkey:e.xprivkey});var r=e.indexBy||Object.keys(e);return e.cashAddrPrefix&&i.extend(t,{cashAddrPrefix:e.cashAddrPrefix,cashAddrPrefixArray:c(e.cashAddrPrefix)}),e.networkMagic&&i.extend(t,{networkMagic:n.integerAsBuffer(e.networkMagic)}),e.port&&i.extend(t,{port:e.port}),e.dnsSeeds&&i.extend(t,{dnsSeeds:e.dnsSeeds}),o.push(t),function(e,t){for(var r=0;r<t.length;r++){var n=t[r],o=e[n];i.isUndefined(o)||i.isObject(o)||(a[o]=e)}}(t,r),t}s.prototype.toString=function(){return this.name};var f=["seed.bitcoinsv.org","seed.bitcoinunlimited.info"],l={PORT:18333,NETWORK_MAGIC:4108710900,DNS_SEEDS:f,PREFIX:"testnet",CASHADDRPREFIX:"bchtest"},d={PORT:18444,NETWORK_MAGIC:3669344250,DNS_SEEDS:[],PREFIX:"regtest",CASHADDRPREFIX:"bchreg"},p={PORT:9333,NETWORK_MAGIC:4224632057,DNS_SEEDS:["stn-seed.bitcoinsv.io"],PREFIX:"stn",CASHADDRPREFIX:"bsvstn"},m={name:"livenet",alias:"mainnet",prefix:"bitcoin",cashAddrPrefix:"bitcoincash",pubkeyhash:0,privatekey:128,scripthash:5,xpubkey:76067358,xprivkey:76066276,networkMagic:3823236072,port:8333,dnsSeeds:f},g={name:"testnet",prefix:l.PREFIX,cashAddrPrefix:l.CASHADDRPREFIX,pubkeyhash:111,privatekey:239,scripthash:196,xpubkey:70617039,xprivkey:70615956,networkMagic:l.NETWORK_MAGIC},b={name:"regtest",prefix:d.PREFIX,cashAddrPrefix:d.CASHADDRPREFIX,pubkeyhash:111,privatekey:239,scripthash:196,xpubkey:70617039,xprivkey:70615956,networkMagic:d.NETWORK_MAGIC,port:d.PORT,dnsSeeds:[],indexBy:["port","name","cashAddrPrefix","networkMagic"]},y={name:"stn",prefix:p.PREFIX,cashAddrPrefix:p.CASHADDRPREFIX,pubkeyhash:111,privatekey:239,scripthash:196,xpubkey:70617039,xprivkey:70615956,networkMagic:p.NETWORK_MAGIC,indexBy:["port","name","cashAddrPrefix","networkMagic"]};h(g),h(y),h(b),h(m);var v=u("livenet"),_=u("regtest"),w=u("testnet"),S=u("stn");Object.defineProperty(w,"port",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?d.PORT:this.stnEnabled?p.PORT:l.PORT}}),Object.defineProperty(w,"networkMagic",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?n.integerAsBuffer(d.NETWORK_MAGIC):this.stnEnabled?n.integerAsBuffer(p.NETWORK_MAGIC):n.integerAsBuffer(l.NETWORK_MAGIC)}}),Object.defineProperty(w,"dnsSeeds",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?d.DNS_SEEDS:this.stnEnabled?p.DNS_SEEDS:l.DNS_SEEDS}}),Object.defineProperty(w,"cashAddrPrefix",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?d.CASHADDRPREFIX:this.stnEnabled?p.CASHADDRPREFIX:l.CASHADDRPREFIX}}),Object.defineProperty(w,"cashAddrPrefixArray",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?c(d.CASHADDRPREFIX):this.stnEnabled?p.cashAddrPrefixToArray(p.CASHADDRPREFIX):c(l.CASHADDRPREFIX)}}),e.exports={add:h,remove:function(e){for(var t=0;t<o.length;t++)o[t]===e&&o.splice(t,1);!function(e,t){for(var r=0;r<t.length;r++){var i=t[r];a[i]===e&&delete a[i]}}(e,Object.keys(a))},defaultNetwork:v,livenet:v,mainnet:v,testnet:w,regtest:_,stn:S,get:u,enableRegtest:function(){w.regtestEnabled=!0},disableRegtest:function(){w.regtestEnabled=!1},enableStn:function(){w.stnEnabled=!0},disableStn:function(){w.stnEnabled=!1}}},function(e,t,r){e.exports=r(145),e.exports.Input=r(91),e.exports.Output=r(27),e.exports.UnspentOutput=r(146),e.exports.Signature=r(51),e.exports.Sighash=r(26)},function(e,t,r){"use strict";(function(t,i){function n(){}n.getRandomBuffer=function(e){return t.browser?n.getRandomBufferBrowser(e):n.getRandomBufferNode(e)},n.getRandomBufferNode=function(e){return r(9).randomBytes(e)},n.getRandomBufferBrowser=function(e){if(!window.crypto&&!window.msCrypto)throw new Error("window.crypto not available");var t;if(window.crypto&&window.crypto.getRandomValues)t=window.crypto;else{if(!window.msCrypto||!window.msCrypto.getRandomValues)throw new Error("window.crypto.getRandomValues not available");t=window.msCrypto}var r=new Uint8Array(e);return t.getRandomValues(r),i.from(r)},e.exports=n}).call(this,r(6),r(0).Buffer)},function(e,t,r){"use strict";(function(t,i){var n=r(1).Buffer,o=t.crypto||t.msCrypto;o&&o.getRandomValues?e.exports=function(e,t){if(e>4294967295)throw new RangeError("requested too many random bytes");var r=n.allocUnsafe(e);if(e>0)if(e>65536)for(var a=0;a<e;a+=65536)o.getRandomValues(r.slice(a,a+65536));else o.getRandomValues(r);if("function"==typeof t)return i.nextTick((function(){t(null,r)}));return r}:e.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,r(13),r(6))},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){"use strict";var i=r(1).Buffer,n=r(53);function o(e,t){this._block=i.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}o.prototype.update=function(e,t){e=n(e,t||"utf8");for(var r=this._block,i=this._blockSize,o=e.length,a=this._len,s=0;s<o;){for(var u=a%i,c=Math.min(o-s,i-u),h=0;h<c;h++)r[u+h]=e[s+h];s+=c,(a+=c)%i==0&&this._update(r)}return this._len+=o,this},o.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=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 i=(4294967295&r)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},o.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=o},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(5),o=r(16),a=r(47),s=r(30),u=r(10),c=r(12),h=r(20);function f(e,t,r){if(!(this instanceof f))return new f(e,t,r);if(i.isArray(e)&&i.isNumber(t))return f.createMultisig(e,t,r);if(e instanceof f)return e;if(n.checkArgument(e,"First argument is required, please include address data.","guide/address.html"),t&&!s.get(t))throw new TypeError('Second argument must be "livenet", "testnet", or "regtest".');if(r&&r!==f.PayToPublicKeyHash&&r!==f.PayToScriptHash)throw new TypeError('Third argument must be "pubkeyhash" or "scripthash".');var o=this._classifyArguments(e,t,r);return o.network=o.network||s.get(t)||s.defaultNetwork,o.type=o.type||r||f.PayToPublicKeyHash,c.defineImmutable(this,{hashBuffer:o.hashBuffer,network:o.network,type:o.type}),this}f.prototype._classifyArguments=function(e,r,n){if((e instanceof t||e instanceof Uint8Array)&&20===e.length)return f._transformHash(e);if((e instanceof t||e instanceof Uint8Array)&&21===e.length)return f._transformBuffer(e,r,n);if(e instanceof h)return f._transformPublicKey(e);if(e instanceof l)return f._transformScript(e,r);if("string"==typeof e)return f._transformString(e,r,n);if(i.isObject(e))return f._transformObject(e);throw new TypeError("First argument is an unrecognized data format.")},f.PayToPublicKeyHash="pubkeyhash",f.PayToScriptHash="scripthash",f._transformHash=function(e){var r={};if(!(e instanceof t||e instanceof Uint8Array))throw new TypeError("Address supplied is not a buffer.");if(20!==e.length)throw new TypeError("Address hashbuffers must be exactly 20 bytes.");return r.hashBuffer=e,r},f._transformObject=function(e){return n.checkArgument(e.hash||e.hashBuffer,"Must provide a `hash` or `hashBuffer` property"),n.checkArgument(e.type,"Must provide a `type` property"),{hashBuffer:e.hash?t.from(e.hash,"hex"):e.hashBuffer,network:s.get(e.network)||s.defaultNetwork,type:e.type}},f._classifyFromVersion=function(e){var t={},r=s.get(e[0],"pubkeyhash"),i=s.get(e[0],"scripthash");return r?(t.network=r,t.type=f.PayToPublicKeyHash):i&&(t.network=i,t.type=f.PayToScriptHash),t},f._transformBuffer=function(e,r,i){var n={};if(!(e instanceof t||e instanceof Uint8Array))throw new TypeError("Address supplied is not a buffer.");if(21!==e.length)throw new TypeError("Address buffers must be exactly 21 bytes.");var o=s.get(r),a=f._classifyFromVersion(e);if(r&&!o)throw new TypeError("Unknown network");if(!a.network||o&&o!==a.network)throw new TypeError("Address has mismatched network type.");if(!a.type||i&&i!==a.type)throw new TypeError("Address has mismatched type.");return n.hashBuffer=e.slice(1),n.network=a.network,n.type=a.type,n},f._transformPublicKey=function(e){var t={};if(!(e instanceof h))throw new TypeError("Address must be an instance of PublicKey.");return t.hashBuffer=u.sha256ripemd160(e.toBuffer()),t.type=f.PayToPublicKeyHash,t},f._transformScript=function(e,t){n.checkArgument(e instanceof l,"script must be a Script instance");var r=e.getAddressInfo(t);if(!r)throw new o.Script.CantDeriveAddress(e);return r},f.createMultisig=function(e,t,r){return r=r||e[0].network||s.defaultNetwork,f.payingTo(l.buildMultisigOut(e,t),r)},f._transformString=function(e,t,r){if("string"!=typeof e)throw new TypeError("data parameter supplied is not a string.");if(e.length<27)throw new Error("Invalid Address string provided");e=e.trim();var i=s.get(t);if(t&&!i)throw new TypeError("Unknown network");var n=a.decode(e);return f._transformBuffer(n,t,r)},f.fromPublicKey=function(e,t){var r=f._transformPublicKey(e);return t=t||s.defaultNetwork,new f(r.hashBuffer,t,r.type)},f.fromPrivateKey=function(e,t){let r=h.fromPrivateKey(e);return t=t||e.network||s.defaultNetwork,f.fromPublicKey(r,t)},f.fromPublicKeyHash=function(e,t){var r=f._transformHash(e);return new f(r.hashBuffer,t,f.PayToPublicKeyHash)},f.fromScriptHash=function(e,t){n.checkArgument(e,"hash parameter is required");var r=f._transformHash(e);return new f(r.hashBuffer,t,f.PayToScriptHash)},f.payingTo=function(e,t){return n.checkArgument(e,"script is required"),n.checkArgument(e instanceof l,"script must be instance of Script"),f.fromScriptHash(u.sha256ripemd160(e.toBuffer()),t)},f.fromScript=function(e,t){n.checkArgument(e instanceof l,"script must be a Script instance");var r=f._transformScript(e,t);return new f(r.hashBuffer,t,r.type)},f.fromBuffer=function(e,t,r){var i=f._transformBuffer(e,t,r);return new f(i.hashBuffer,i.network,i.type)},f.fromHex=function(e,r,i){return f.fromBuffer(t.from(e,"hex"),r,i)},f.fromString=function(e,t,r){var i=f._transformString(e,t,r);return new f(i.hashBuffer,i.network,i.type)},f.fromObject=function(e){return n.checkState(c.isHexa(e.hash),'Unexpected hash property, "'+e.hash+'", expected to be hex.'),new f(t.from(e.hash,"hex"),e.network,e.type)},f.getValidationError=function(e,t,r){var i;try{new f(e,t,r)}catch(e){i=e}return i},f.isValid=function(e,t,r){return!f.getValidationError(e,t,r)},f.prototype.isPayToPublicKeyHash=function(){return this.type===f.PayToPublicKeyHash},f.prototype.isPayToScriptHash=function(){return this.type===f.PayToScriptHash},f.prototype.toBuffer=function(){var e=t.from([this.network[this.type]]);return t.concat([e,this.hashBuffer])},f.prototype.toHex=function(){return this.toBuffer().toString("hex")},f.prototype.toObject=f.prototype.toJSON=function(){return{hash:this.hashBuffer.toString("hex"),type:this.type,network:this.network.toString()}},f.prototype.inspect=function(){return"<Address: "+this.toString()+", type: "+this.type+", network: "+this.network+">"},f.prototype.toString=function(){return a.encode(this.toBuffer())},e.exports=f;var l=r(18)}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var i=r(4),n=r(65),o=r(71),a=r(78),s=r(23);function u(e){s.call(this,"digest"),this._hash=e}i(u,s),u.prototype._update=function(e){this._hash.update(e)},u.prototype._final=function(){return this._hash.digest()},e.exports=function(e){return"md5"===(e=e.toLowerCase())?new n:"rmd160"===e||"ripemd160"===e?new o:new u(a(e))}},function(e,t,r){(t=e.exports=r(98)).Stream=t,t.Readable=t,t.Writable=r(69),t.Duplex=r(28),t.Transform=r(101),t.PassThrough=r(171)},function(e,t,r){function i(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===i(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===i(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===i(e)},t.isError=function(e){return"[object Error]"===i(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(0).Buffer.isBuffer},function(e,t,r){"use strict";e.exports=TypeError},function(e,t,r){"use strict";var i=r(194);if(i)try{i([],"length")}catch(e){i=null}e.exports=i},function(e,t,r){"use strict";var i=r(197);e.exports=Function.prototype.bind||i},function(e,t,r){(function(t){e.exports=function(e,r){for(var i=Math.min(e.length,r.length),n=new t(i),o=0;o<i;++o)n[o]=e[o]^r[o];return n}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var i=r(19),n=r(14);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=o,o.prototype.update=function(e,t){if(e=i.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=i.join32(e,0,e.length-r,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},o.prototype.digest=function(e){return this.update(this._pad()),n(null===this.pending),this._digest(e)},o.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,i=new Array(r+this.padLength);i[0]=128;for(var n=1;n<r;n++)i[n]=0;if(e<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)i[n++]=0;i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=e>>>24&255,i[n++]=e>>>16&255,i[n++]=e>>>8&255,i[n++]=255&e}else for(i[n++]=255&e,i[n++]=e>>>8&255,i[n++]=e>>>16&255,i[n++]=e>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,o=8;o<this.padLength;o++)i[n++]=0;return i}},function(e,t,r){var i=t;i.bignum=r(7),i.define=r(265).define,i.base=r(46),i.constants=r(135),i.decoders=r(270),i.encoders=r(272)},function(e,t,r){var i=t;i.Reporter=r(267).Reporter,i.DecoderBuffer=r(134).DecoderBuffer,i.EncoderBuffer=r(134).EncoderBuffer,i.Node=r(268)},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(61),o=r(0),a=r(10).sha256sha256,s=function e(r){if(!(this instanceof e))return new e(r);if(t.isBuffer(r)){var i=r;this.fromBuffer(i)}else if("string"==typeof r){var n=r;this.fromString(n)}};s.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this},s.validChecksum=function(e,t){return i.isString(e)&&(e=o.Buffer.from(n.decode(e))),i.isString(t)&&(t=o.Buffer.from(n.decode(t))),t||(t=e.slice(-4),e=e.slice(0,-4)),s.checksum(e).toString("hex")===t.toString("hex")},s.decode=function(e){if("string"!=typeof e)throw new Error("Input must be a string");var r=t.from(n.decode(e));if(r.length<4)throw new Error("Input string too short");var i=r.slice(0,-4),o=r.slice(-4),s=a(i).slice(0,4);if(o.toString("hex")!==s.toString("hex"))throw new Error("Checksum mismatch");return i},s.checksum=function(e){return a(e).slice(0,4)},s.encode=function(e){if(!t.isBuffer(e))throw new Error("Input must be a buffer");var r=t.alloc(e.length+4),i=s.checksum(e);return e.copy(r),i.copy(r,e.length),n.encode(r)},s.prototype.fromBuffer=function(e){return this.buf=e,this},s.fromBuffer=function(e){return(new s).fromBuffer(e)},s.fromHex=function(e){return s.fromBuffer(t.from(e,"hex"))},s.prototype.fromString=function(e){var t=s.decode(e);return this.buf=t,this},s.fromString=function(e){var t=s.decode(e);return new n(t)},s.prototype.toBuffer=function(){return this.buf},s.prototype.toHex=function(){return this.toBuffer().toString("hex")},s.prototype.toString=function(){return s.encode(this.buf)},e.exports=s}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(288)();
|
|
11
11
|
/*!
|
|
12
12
|
* The buffer module from node.js, for the browser.
|
|
13
13
|
*
|
|
14
14
|
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
15
15
|
* @license MIT
|
|
16
|
-
*/function n(e,t){if(e===t)return 0;for(var r=e.length,i=t.length,n=0,o=Math.min(r,i);n<o;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}return r<i?-1:i<r?1:0}function o(e){return t.Buffer&&"function"==typeof t.Buffer.isBuffer?t.Buffer.isBuffer(e):!(null==e||!e._isBuffer)}var a=r(88),s=Object.prototype.hasOwnProperty,u=Array.prototype.slice,c="foo"===function(){}.name;function h(e){return Object.prototype.toString.call(e)}function f(e){return!o(e)&&("function"==typeof t.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer))))}var l=e.exports=y,d=/\s*function\s+([^\(\s]*)\s*/;function p(e){if(a.isFunction(e)){if(c)return e.name;var t=e.toString().match(d);return t&&t[1]}}function m(e,t){return"string"==typeof e?e.length<t?e:e.slice(0,t):e}function g(e){if(c||!a.isFunction(e))return a.inspect(e);var t=p(e);return"[Function"+(t?": "+t:"")+"]"}function b(e,t,r,i,n){throw new l.AssertionError({message:r,actual:e,expected:t,operator:i,stackStartFunction:n})}function y(e,t){e||b(e,!0,t,"==",l.ok)}function v(e,t,r,i){if(e===t)return!0;if(o(e)&&o(t))return 0===n(e,t);if(a.isDate(e)&&a.isDate(t))return e.getTime()===t.getTime();if(a.isRegExp(e)&&a.isRegExp(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(null!==e&&"object"==typeof e||null!==t&&"object"==typeof t){if(f(e)&&f(t)&&h(e)===h(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return 0===n(new Uint8Array(e.buffer),new Uint8Array(t.buffer));if(o(e)!==o(t))return!1;var s=(i=i||{actual:[],expected:[]}).actual.indexOf(e);return-1!==s&&s===i.expected.indexOf(t)||(i.actual.push(e),i.expected.push(t),function(e,t,r,i){if(null==e||null==t)return!1;if(a.isPrimitive(e)||a.isPrimitive(t))return e===t;if(r&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var n=_(e),o=_(t);if(n&&!o||!n&&o)return!1;if(n)return e=u.call(e),t=u.call(t),v(e,t,r);var s,c,h=k(e),f=k(t);if(h.length!==f.length)return!1;for(h.sort(),f.sort(),c=h.length-1;c>=0;c--)if(h[c]!==f[c])return!1;for(c=h.length-1;c>=0;c--)if(s=h[c],!v(e[s],t[s],r,i))return!1;return!0}(e,t,r,i))}return r?e===t:e==t}function _(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function w(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function S(e,t,r,i){var n;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(i=r,r=null),n=function(e){var t;try{e()}catch(e){t=e}return t}(t),i=(r&&r.name?" ("+r.name+").":".")+(i?" "+i:"."),e&&!n&&b(n,r,"Missing expected exception"+i);var o="string"==typeof i,s=!e&&n&&!r;if((!e&&a.isError(n)&&o&&w(n,r)||s)&&b(n,r,"Got unwanted exception"+i),e&&n&&r&&!w(n,r)||!e&&n)throw n}l.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return m(g(e.actual),128)+" "+e.operator+" "+m(g(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||b;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var i=r.stack,n=p(t),o=i.indexOf("\n"+n);if(o>=0){var a=i.indexOf("\n",o+1);i=i.substring(a+1)}this.stack=i}}},a.inherits(l.AssertionError,Error),l.fail=b,l.ok=y,l.equal=function(e,t,r){e!=t&&b(e,t,r,"==",l.equal)},l.notEqual=function(e,t,r){e==t&&b(e,t,r,"!=",l.notEqual)},l.deepEqual=function(e,t,r){v(e,t,!1)||b(e,t,r,"deepEqual",l.deepEqual)},l.deepStrictEqual=function(e,t,r){v(e,t,!0)||b(e,t,r,"deepStrictEqual",l.deepStrictEqual)},l.notDeepEqual=function(e,t,r){v(e,t,!1)&&b(e,t,r,"notDeepEqual",l.notDeepEqual)},l.notDeepStrictEqual=function e(t,r,i){v(t,r,!0)&&b(t,r,i,"notDeepStrictEqual",e)},l.strictEqual=function(e,t,r){e!==t&&b(e,t,r,"===",l.strictEqual)},l.notStrictEqual=function(e,t,r){e===t&&b(e,t,r,"!==",l.notStrictEqual)},l.throws=function(e,t,r){S(!0,e,t,r)},l.doesNotThrow=function(e,t,r){S(!1,e,t,r)},l.ifError=function(e){if(e)throw e},l.strict=i((function e(t,r){t||b(t,!0,r,"==",e)}),l,{equal:l.strictEqual,deepEqual:l.deepStrictEqual,notEqual:l.notStrictEqual,notDeepEqual:l.notDeepStrictEqual}),l.strict.strict=l.strict;var k=Object.keys||function(e){var t=[];for(var r in e)s.call(e,r)&&t.push(r);return t}}).call(this,r(13))},function(e,t,r){"use strict";(function(t){var i=r(21),n=r(25),o=r(8),a=function e(r){if(!(this instanceof e))return new e(r);if(t.isBuffer(r))this.buf=r;else if("number"==typeof r){var i=r;this.fromNumber(i)}else if(r instanceof o){var n=r;this.fromBN(n)}else if(r){var a=r;this.set(a)}};a.prototype.set=function(e){return this.buf=e.buf||this.buf,this},a.prototype.fromString=function(e){return this.set({buf:t.from(e,"hex")}),this},a.prototype.toString=function(){return this.buf.toString("hex")},a.prototype.fromBuffer=function(e){return this.buf=e,this},a.prototype.fromBufferReader=function(e){return this.buf=e.readVarintBuf(),this},a.prototype.fromBN=function(e){return this.buf=i().writeVarintBN(e).concat(),this},a.prototype.fromNumber=function(e){return this.buf=i().writeVarintNum(e).concat(),this},a.prototype.toBuffer=function(){return this.buf},a.prototype.toBN=function(){return n(this.buf).readVarintBN()},a.prototype.toNumber=function(){return n(this.buf).readVarintNum()},e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(5),o=r(16),a=r(21),s=r(0),u=r(12),c=r(18),h=r(26),f=r(27);function l(e){return this instanceof l?e?this._fromObject(e):void 0:new l(e)}l.MAXINT=4294967295,l.DEFAULT_SEQNUMBER=4294967295,l.DEFAULT_LOCKTIME_SEQNUMBER=4294967294,l.DEFAULT_RBF_SEQNUMBER=4294967293,l.BASE_SIZE=40,Object.defineProperty(l.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this.isNull()?null:(this._script||(this._script=new c(this._scriptBuffer),this._script._isInput=!0),this._script)}}),l.fromObject=function(e){return n.checkArgument(i.isObject(e)),(new l)._fromObject(e)},l.prototype._fromObject=function(e){var t;if(t=i.isString(e.prevTxId)&&u.isHexa(e.prevTxId)?s.Buffer.from(e.prevTxId,"hex"):e.prevTxId,this.output=e.output?e.output instanceof f?e.output:new f(e.output):void 0,this.prevTxId=t||e.txidbuf,this.outputIndex=i.isUndefined(e.outputIndex)?e.txoutnum:e.outputIndex,this.sequenceNumber=i.isUndefined(e.sequenceNumber)?i.isUndefined(e.seqnum)?4294967295:e.seqnum:e.sequenceNumber,i.isUndefined(e.script)&&i.isUndefined(e.scriptBuffer))throw new o.Transaction.Input.MissingScript;return this.setScript(e.scriptBuffer||e.script),this},l.prototype.toObject=l.prototype.toJSON=function(){var e={prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,sequenceNumber:this.sequenceNumber,script:this._scriptBuffer.toString("hex")};return this.script&&(e.scriptString=this.script.toString()),this.output&&(e.output=this.output.toObject()),e},l.fromBufferReader=function(e){var t=new l;return t.prevTxId=e.readReverse(32),t.outputIndex=e.readUInt32LE(),t._scriptBuffer=e.readVarLengthBuffer(),t.sequenceNumber=e.readUInt32LE(),t},l.prototype.toBufferWriter=function(e){e||(e=new a),e.writeReverse(this.prevTxId),e.writeUInt32LE(this.outputIndex);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e.writeUInt32LE(this.sequenceNumber),e},l.prototype.setScript=function(e){if(this._script=null,e instanceof c)this._script=e,this._script._isInput=!0,this._scriptBuffer=e.toBuffer();else if(null===e)this._script=c.empty(),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else if(u.isHexa(e))this._scriptBuffer=s.Buffer.from(e,"hex");else if(i.isString(e))this._script=new c(e),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else{if(!t.isBuffer(e))throw new TypeError("Invalid argument type: script");this._scriptBuffer=s.Buffer.from(e)}return this},l.prototype.getSignatures=function(){throw new o.AbstractMethodInvoked("Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported) for input: "+JSON.stringify(this))},l.prototype.isFullySigned=function(){throw new o.AbstractMethodInvoked("Input#isFullySigned")},l.prototype.isFinal=function(){return this.sequenceNumber===l.MAXINT},l.prototype.addSignature=function(){throw new o.AbstractMethodInvoked("Input#addSignature")},l.prototype.clearSignatures=function(){throw new o.AbstractMethodInvoked("Input#clearSignatures")},l.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,h.verify(e,t.signature,t.publicKey,t.inputIndex,this.output.script,this.output.satoshisBN)},l.prototype.isNull=function(){return"0000000000000000000000000000000000000000000000000000000000000000"===this.prevTxId.toString("hex")&&4294967295===this.outputIndex},l.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length},e.exports=l}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(5),o=r(4),a=r(12),s=r(20),u=r(16),c=r(11);function h(e){if(!(this instanceof h))return new h(e);if(e instanceof h)return e;if(i.isObject(e))return this._fromObject(e);throw new u.InvalidArgument("TransactionSignatures must be instantiated from an object")}o(h,c),h.prototype._fromObject=function(e){return this._checkObjectArgs(e),this.publicKey=new s(e.publicKey),this.prevTxId=t.isBuffer(e.prevTxId)?e.prevTxId:t.from(e.prevTxId,"hex"),this.outputIndex=e.outputIndex,this.inputIndex=e.inputIndex,this.signature=e.signature instanceof c?e.signature:t.isBuffer(e.signature)?c.fromBuffer(e.signature):c.fromString(e.signature),this.sigtype=e.sigtype,this},h.prototype._checkObjectArgs=function(e){n.checkArgument(s(e.publicKey),"publicKey"),n.checkArgument(!i.isUndefined(e.inputIndex),"inputIndex"),n.checkArgument(!i.isUndefined(e.outputIndex),"outputIndex"),n.checkState(i.isNumber(e.inputIndex),"inputIndex must be a number"),n.checkState(i.isNumber(e.outputIndex),"outputIndex must be a number"),n.checkArgument(e.signature,"signature"),n.checkArgument(e.prevTxId,"prevTxId"),n.checkState(e.signature instanceof c||t.isBuffer(e.signature)||a.isHexa(e.signature),"signature must be a buffer or hexa value"),n.checkState(t.isBuffer(e.prevTxId)||a.isHexa(e.prevTxId),"prevTxId must be a buffer or hexa value"),n.checkArgument(e.sigtype,"sigtype"),n.checkState(i.isNumber(e.sigtype),"sigtype must be a number")},h.prototype.toObject=h.prototype.toJSON=function(){return{publicKey:this.publicKey.toString(),prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,inputIndex:this.inputIndex,signature:this.signature.toString(),sigtype:this.sigtype}},h.fromObject=function(e){return n.checkArgument(e),new h(e)},e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){void 0===t||!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,r,i,n){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o,a,s=arguments.length;switch(s){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick((function(){e.call(null,r)}));case 3:return t.nextTick((function(){e.call(null,r,i)}));case 4:return t.nextTick((function(){e.call(null,r,i,n)}));default:for(o=new Array(s-1),a=0;a<o.length;)o[a++]=arguments[a];return t.nextTick((function(){e.apply(null,o)}))}}}:e.exports=t}).call(this,r(6))},function(e,t,r){"use strict";var i=r(1).Buffer,n=r(179),o=r(180),a=ArrayBuffer.isView||function(e){try{return o(e),!0}catch(e){return!1}},s="undefined"!=typeof Uint8Array,u="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,c=u&&(i.prototype instanceof Uint8Array||i.TYPED_ARRAY_SUPPORT);e.exports=function(e,t){if(i.isBuffer(e))return e.constructor&&!("isBuffer"in e)?i.from(e):e;if("string"==typeof e)return i.from(e,t);if(u&&a(e)){if(0===e.byteLength)return i.alloc(0);if(c){var r=i.from(e.buffer,e.byteOffset,e.byteLength);if(r.byteLength===e.byteLength)return r}var o=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),h=i.from(o);if(h.length===e.byteLength)return h}if(s&&e instanceof Uint8Array)return i.from(e);var f=n(e);if(f)for(var l=0;l<e.length;l+=1){var d=e[l];if("number"!=typeof d||d<0||d>255||~~d!==d)throw new RangeError("Array items must be numbers in the range 0-255.")}if(f||i.isBuffer(e)&&e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e))return i.from(e);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}},function(e,t,r){"use strict";var i=Object.defineProperty||!1;if(i)try{i({},"a",{value:1})}catch(e){i=!1}e.exports=i},function(e,t,r){var i=r(1).Buffer;function n(e){i.isBuffer(e)||(e=i.from(e));for(var t=e.length/4|0,r=new Array(t),n=0;n<t;n++)r[n]=e.readUInt32BE(4*n);return r}function o(e){for(;0<e.length;e++)e[0]=0}function a(e,t,r,i,n){for(var o,a,s,u,c=r[0],h=r[1],f=r[2],l=r[3],d=e[0]^t[0],p=e[1]^t[1],m=e[2]^t[2],g=e[3]^t[3],b=4,y=1;y<n;y++)o=c[d>>>24]^h[p>>>16&255]^f[m>>>8&255]^l[255&g]^t[b++],a=c[p>>>24]^h[m>>>16&255]^f[g>>>8&255]^l[255&d]^t[b++],s=c[m>>>24]^h[g>>>16&255]^f[d>>>8&255]^l[255&p]^t[b++],u=c[g>>>24]^h[d>>>16&255]^f[p>>>8&255]^l[255&m]^t[b++],d=o,p=a,m=s,g=u;return o=(i[d>>>24]<<24|i[p>>>16&255]<<16|i[m>>>8&255]<<8|i[255&g])^t[b++],a=(i[p>>>24]<<24|i[m>>>16&255]<<16|i[g>>>8&255]<<8|i[255&d])^t[b++],s=(i[m>>>24]<<24|i[g>>>16&255]<<16|i[d>>>8&255]<<8|i[255&p])^t[b++],u=(i[g>>>24]<<24|i[d>>>16&255]<<16|i[p>>>8&255]<<8|i[255&m])^t[b++],[o>>>=0,a>>>=0,s>>>=0,u>>>=0]}var s=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var r=[],i=[],n=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,u=0;u<256;++u){var c=s^s<<1^s<<2^s<<3^s<<4;c=c>>>8^255&c^99,r[a]=c,i[c]=a;var h=e[a],f=e[h],l=e[f],d=257*e[c]^16843008*c;n[0][a]=d<<24|d>>>8,n[1][a]=d<<16|d>>>16,n[2][a]=d<<8|d>>>24,n[3][a]=d,d=16843009*l^65537*f^257*h^16843008*a,o[0][c]=d<<24|d>>>8,o[1][c]=d<<16|d>>>16,o[2][c]=d<<8|d>>>24,o[3][c]=d,0===a?a=s=1:(a=h^e[e[e[l^h]]],s^=e[e[s]])}return{SBOX:r,INV_SBOX:i,SUB_MIX:n,INV_SUB_MIX:o}}();function c(e){this._key=n(e),this._reset()}c.blockSize=16,c.keySize=32,c.prototype.blockSize=c.blockSize,c.prototype.keySize=c.keySize,c.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,i=4*(r+1),n=[],o=0;o<t;o++)n[o]=e[o];for(o=t;o<i;o++){var a=n[o-1];o%t==0?(a=a<<8|a>>>24,a=u.SBOX[a>>>24]<<24|u.SBOX[a>>>16&255]<<16|u.SBOX[a>>>8&255]<<8|u.SBOX[255&a],a^=s[o/t|0]<<24):t>6&&o%t==4&&(a=u.SBOX[a>>>24]<<24|u.SBOX[a>>>16&255]<<16|u.SBOX[a>>>8&255]<<8|u.SBOX[255&a]),n[o]=n[o-t]^a}for(var c=[],h=0;h<i;h++){var f=i-h,l=n[f-(h%4?0:4)];c[h]=h<4||f<=4?l:u.INV_SUB_MIX[0][u.SBOX[l>>>24]]^u.INV_SUB_MIX[1][u.SBOX[l>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[l>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&l]]}this._nRounds=r,this._keySchedule=n,this._invKeySchedule=c},c.prototype.encryptBlockRaw=function(e){return a(e=n(e),this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},c.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=i.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},c.prototype.decryptBlock=function(e){var t=(e=n(e))[1];e[1]=e[3],e[3]=t;var r=a(e,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),o=i.allocUnsafe(16);return o.writeUInt32BE(r[0],0),o.writeUInt32BE(r[3],4),o.writeUInt32BE(r[2],8),o.writeUInt32BE(r[1],12),o},c.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},e.exports.AES=c},function(e,t,r){var i=r(1).Buffer,n=r(65);e.exports=function(e,t,r,o){if(i.isBuffer(e)||(e=i.from(e,"binary")),t&&(i.isBuffer(t)||(t=i.from(t,"binary")),8!==t.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var a=r/8,s=i.alloc(a),u=i.alloc(o||0),c=i.alloc(0);a>0||o>0;){var h=new n;h.update(c),h.update(e),t&&h.update(t),c=h.digest();var f=0;if(a>0){var l=s.length-a;f=Math.min(a,c.length),c.copy(s,l,0,f),a-=f}if(f<c.length&&o>0){var d=u.length-o,p=Math.min(o,c.length-f);c.copy(u,d,f,f+p),o-=p}}return c.fill(0),{key:s,iv:u}}},function(e,t,r){"use strict";var i=r(7),n=r(15),o=n.getNAF,a=n.getJSF,s=n.assert;function u(e,t){this.type=e,this.p=new i(t.p,16),this.red=t.prime?i.red(t.prime):i.mont(this.p),this.zero=new i(0).toRed(this.red),this.one=new i(1).toRed(this.red),this.two=new i(2).toRed(this.red),this.n=t.n&&new i(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 c(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(e,t){s(e.precomputed);var r=e._getDoubles(),i=o(t,1,this._bitLength),n=(1<<r.step+1)-(r.step%2==0?2:1);n/=3;var a,u,c=[];for(a=0;a<i.length;a+=r.step){u=0;for(var h=a+r.step-1;h>=a;h--)u=(u<<1)+i[h];c.push(u)}for(var f=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=n;d>0;d--){for(a=0;a<c.length;a++)(u=c[a])===d?l=l.mixedAdd(r.points[a]):u===-d&&(l=l.mixedAdd(r.points[a].neg()));f=f.add(l)}return f.toP()},u.prototype._wnafMul=function(e,t){var r=4,i=e._getNAFPoints(r);r=i.wnd;for(var n=i.points,a=o(t,r,this._bitLength),u=this.jpoint(null,null,null),c=a.length-1;c>=0;c--){for(var h=0;c>=0&&0===a[c];c--)h++;if(c>=0&&h++,u=u.dblp(h),c<0)break;var f=a[c];s(0!==f),u="affine"===e.type?f>0?u.mixedAdd(n[f-1>>1]):u.mixedAdd(n[-f-1>>1].neg()):f>0?u.add(n[f-1>>1]):u.add(n[-f-1>>1].neg())}return"affine"===e.type?u.toP():u},u.prototype._wnafMulAdd=function(e,t,r,i,n){var s,u,c,h=this._wnafT1,f=this._wnafT2,l=this._wnafT3,d=0;for(s=0;s<i;s++){var p=(c=t[s])._getNAFPoints(e);h[s]=p.wnd,f[s]=p.points}for(s=i-1;s>=1;s-=2){var m=s-1,g=s;if(1===h[m]&&1===h[g]){var b=[t[m],null,null,t[g]];0===t[m].y.cmp(t[g].y)?(b[1]=t[m].add(t[g]),b[2]=t[m].toJ().mixedAdd(t[g].neg())):0===t[m].y.cmp(t[g].y.redNeg())?(b[1]=t[m].toJ().mixedAdd(t[g]),b[2]=t[m].add(t[g].neg())):(b[1]=t[m].toJ().mixedAdd(t[g]),b[2]=t[m].toJ().mixedAdd(t[g].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],v=a(r[m],r[g]);for(d=Math.max(v[0].length,d),l[m]=new Array(d),l[g]=new Array(d),u=0;u<d;u++){var _=0|v[0][u],w=0|v[1][u];l[m][u]=y[3*(_+1)+(w+1)],l[g][u]=0,f[m]=b}}else l[m]=o(r[m],h[m],this._bitLength),l[g]=o(r[g],h[g],this._bitLength),d=Math.max(l[m].length,d),d=Math.max(l[g].length,d)}var S=this.jpoint(null,null,null),k=this._wnafT4;for(s=d;s>=0;s--){for(var I=0;s>=0;){var E=!0;for(u=0;u<i;u++)k[u]=0|l[u][s],0!==k[u]&&(E=!1);if(!E)break;I++,s--}if(s>=0&&I++,S=S.dblp(I),s<0)break;for(u=0;u<i;u++){var A=k[u];0!==A&&(A>0?c=f[u][A-1>>1]:A<0&&(c=f[u][-A-1>>1].neg()),S="affine"===c.type?S.mixedAdd(c):S.add(c))}}for(s=0;s<i;s++)f[s]=null;return n?S:S.toP()},u.BasePoint=c,c.prototype.eq=function(){throw new Error("Not implemented")},c.prototype.validate=function(){return this.curve.validate(this)},u.prototype.decodePoint=function(e,t){e=n.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?s(e[e.length-1]%2==0):7===e[0]&&s(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},c.prototype.encodeCompressed=function(e){return this.encode(e,!0)},c.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},c.prototype.encode=function(e,t){return n.encode(this._encode(t),e)},c.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},c.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},c.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n<t;n+=e){for(var o=0;o<e;o++)i=i.dbl();r.push(i)}return{step:e,points:r}},c.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,i=1===r?null:this.dbl(),n=1;n<r;n++)t[n]=t[n-1].add(i);return{wnd:e,points:t}},c.prototype._getBeta=function(){return null},c.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t}},function(e,t,r){var i=t;i.utils=r(19),i.common=r(44),i.sha=r(249),i.ripemd=r(253),i.hmac=r(254),i.sha1=i.sha.sha1,i.sha256=i.sha.sha256,i.sha224=i.sha.sha224,i.sha384=i.sha.sha384,i.sha512=i.sha.sha512,i.ripemd160=i.ripemd.ripemd160},function(e,t,r){"use strict";var i=r(264),n=r(275),o=r(276),a=r(80),s=r(114).pbkdf2Sync,u=r(1).Buffer;function c(e){var t;"object"!=typeof e||u.isBuffer(e)||(t=e.passphrase,e=e.key),"string"==typeof e&&(e=u.from(e));var r,c,h=o(e,t),f=h.tag,l=h.data;switch(f){case"CERTIFICATE":c=i.certificate.decode(l,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(c||(c=i.PublicKey.decode(l,"der")),r=c.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return i.RSAPublicKey.decode(c.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return c.subjectPrivateKey=c.subjectPublicKey,{type:"ec",data:c};case"1.2.840.10040.4.1":return c.algorithm.params.pub_key=i.DSAparam.decode(c.subjectPublicKey.data,"der"),{type:"dsa",data:c.algorithm.params};default:throw new Error("unknown key id "+r)}case"ENCRYPTED PRIVATE KEY":l=function(e,t){var r=e.algorithm.decrypt.kde.kdeparams.salt,i=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),o=n[e.algorithm.decrypt.cipher.algo.join(".")],c=e.algorithm.decrypt.cipher.iv,h=e.subjectPrivateKey,f=parseInt(o.split("-")[1],10)/8,l=s(t,r,i,f,"sha1"),d=a.createDecipheriv(o,l,c),p=[];return p.push(d.update(h)),p.push(d.final()),u.concat(p)}(l=i.EncryptedPrivateKey.decode(l,"der"),t);case"PRIVATE KEY":switch(r=(c=i.PrivateKey.decode(l,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return i.RSAPrivateKey.decode(c.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:c.algorithm.curve,privateKey:i.ECPrivateKey.decode(c.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return c.algorithm.params.priv_key=i.DSAparam.decode(c.subjectPrivateKey,"der"),{type:"dsa",params:c.algorithm.params};default:throw new Error("unknown key id "+r)}case"RSA PUBLIC KEY":return i.RSAPublicKey.decode(l,"der");case"RSA PRIVATE KEY":return i.RSAPrivateKey.decode(l,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:i.DSAPrivateKey.decode(l,"der")};case"EC PRIVATE KEY":return{curve:(l=i.ECPrivateKey.decode(l,"der")).parameters.value,privateKey:l.privateKey};default:throw new Error("unknown key type "+f)}}c.signature=i.signature,e.exports=c},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(36),o=r(47),a=r(8),s=r(12),u=r(30),c=r(17),h=r(20),f=r(32),l=r(5);function d(e,t){if(!(this instanceof d))return new d(e,t);if(e instanceof d)return e;var r=this._classifyArguments(e,t);if(!r.bn||0===r.bn.cmp(new a(0)))throw new TypeError("Number can not be equal to zero, undefined, null or false");if(!r.bn.lt(c.getN()))throw new TypeError("Number must be less than N");if(void 0===r.network)throw new TypeError('Must specify the network ("livenet" or "testnet")');return s.defineImmutable(this,{bn:r.bn,compressed:r.compressed,network:r.network}),Object.defineProperty(this,"publicKey",{configurable:!1,enumerable:!0,get:this.toPublicKey.bind(this)}),this}d.prototype._classifyArguments=function(e,r){var n={compressed:!0,network:r?u.get(r):u.defaultNetwork};if(i.isUndefined(e)||i.isNull(e))n.bn=d._getRandomBN();else if(e instanceof a)n.bn=e;else if(e instanceof t||e instanceof Uint8Array)n=d._transformBuffer(e,r);else if(e.bn&&e.network)n=d._transformObject(e);else if(!r&&u.get(e))n.bn=d._getRandomBN(),n.network=u.get(e);else{if("string"!=typeof e)throw new TypeError("First argument is an unrecognized data type.");s.isHexa(e)?n.bn=new a(t.from(e,"hex")):n=d._transformWIF(e,r)}return n},d._getRandomBN=function(){var e,t;do{var r=f.getRandomBuffer(32);e=(t=a.fromBuffer(r)).lt(c.getN())}while(!e);return t},d._transformBuffer=function(e,t){var r={};if(32===e.length)return d._transformBNBuffer(e,t);if(r.network=u.get(e[0],"privatekey"),!r.network)throw new Error("Invalid network");if(t&&r.network!==u.get(t))throw new TypeError("Private key network mismatch");if(34===e.length&&1===e[33])r.compressed=!0;else{if(33!==e.length)throw new Error("Length of buffer must be 33 (uncompressed) or 34 (compressed)");r.compressed=!1}return r.bn=a.fromBuffer(e.slice(1,33)),r},d._transformBNBuffer=function(e,t){var r={};return r.network=u.get(t)||u.defaultNetwork,r.bn=a.fromBuffer(e),r.compressed=!1,r},d._transformWIF=function(e,t){return d._transformBuffer(o.decode(e),t)},d.fromBuffer=function(e,t){return new d(e,t)},d.fromHex=function(e,r){return d.fromBuffer(t.from(e,"hex"),r)},d._transformObject=function(e){return{bn:new a(e.bn,"hex"),network:u.get(e.network),compressed:e.compressed}},d.fromString=d.fromWIF=function(e){return l.checkArgument(i.isString(e),"First argument is expected to be a string."),new d(e)},d.fromObject=d.fromJSON=function(e){return l.checkArgument(i.isObject(e),"First argument is expected to be an object."),new d(e)},d.fromRandom=function(e){var t=d._getRandomBN();return new d(t,e)},d.getValidationError=function(e,t){var r;try{new d(e,t)}catch(e){r=e}return r},d.isValid=function(e,t){return!!e&&!d.getValidationError(e,t)},d.prototype.toString=function(){return this.toWIF()},d.prototype.toWIF=function(){var e,r=this.network;return e=this.compressed?t.concat([t.from([r.privatekey]),this.bn.toBuffer({size:32}),t.from([1])]):t.concat([t.from([r.privatekey]),this.bn.toBuffer({size:32})]),o.encode(e)},d.prototype.toBigNumber=function(){return this.bn},d.prototype.toBuffer=function(){return this.bn.toBuffer({size:32})},d.prototype.toHex=function(){return this.toBuffer().toString("hex")},d.prototype.toPublicKey=function(){return this._pubkey||(this._pubkey=h.fromPrivateKey(this)),this._pubkey},d.prototype.toAddress=function(e){var t=this.toPublicKey();return n.fromPublicKey(t,e||this.network)},d.prototype.toObject=d.prototype.toJSON=function(){return{bn:this.bn.toString("hex"),compressed:this.compressed,network:this.network.toString()}},d.prototype.inspect=function(){var e=this.compressed?"":", uncompressed";return"<PrivateKey: "+this.toHex()+", network: "+this.network+e+">"},e.exports=d}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(86),o=r(0),a="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".split(""),s=function e(r){if(!(this instanceof e))return new e(r);if(t.isBuffer(r)){var i=r;this.fromBuffer(i)}else if("string"==typeof r){var n=r;this.fromString(n)}};s.validCharacters=function(e){return o.Buffer.isBuffer(e)&&(e=e.toString()),i.every(i.map(e,(function(e){return i.includes(a,e)})))},s.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this},s.encode=function(e){if(!o.Buffer.isBuffer(e))throw new Error("Input should be a buffer");return n.encode(e)},s.decode=function(e){if("string"!=typeof e)throw new Error("Input should be a string");return t.from(n.decode(e))},s.prototype.fromBuffer=function(e){return this.buf=e,this},s.fromBuffer=function(e){return(new s).fromBuffer(e)},s.fromHex=function(e){return s.fromBuffer(t.from(e,"hex"))},s.prototype.fromString=function(e){var t=s.decode(e);return this.buf=t,this},s.fromString=function(e){return(new s).fromString(e)},s.prototype.toBuffer=function(){return this.buf},s.prototype.toHex=function(){return this.toBuffer().toString("hex")},s.prototype.toString=function(){return s.encode(this.buf)},e.exports=s}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(8),o=r(25),a=r(21),s=r(10),u=r(5),c=function e(t){if(!(this instanceof e))return new e(t);var r=e._from(t);return this.version=r.version,this.prevHash=r.prevHash,this.merkleRoot=r.merkleRoot,this.time=r.time,this.timestamp=r.time,this.bits=r.bits,this.nonce=r.nonce,r.hash&&u.checkState(this.hash===r.hash,"Argument object hash property does not match block hash."),this};c._from=function(e){var r={};if(t.isBuffer(e))r=c._fromBufferReader(o(e));else{if(!i.isObject(e))throw new TypeError("Unrecognized argument for BlockHeader");r=c._fromObject(e)}return r},c._fromObject=function(e){u.checkArgument(e,"data is required");var r=e.prevHash,n=e.merkleRoot;return i.isString(e.prevHash)&&(r=t.from(e.prevHash,"hex").reverse()),i.isString(e.merkleRoot)&&(n=t.from(e.merkleRoot,"hex").reverse()),{hash:e.hash,version:e.version,prevHash:r,merkleRoot:n,time:e.time,timestamp:e.time,bits:e.bits,nonce:e.nonce}},c.fromObject=function(e){var t=c._fromObject(e);return new c(t)},c.fromRawBlock=function(e){t.isBuffer(e)||(e=t.from(e,"binary"));var r=o(e);r.pos=c.Constants.START_OF_HEADER;var i=c._fromBufferReader(r);return new c(i)},c.fromBuffer=function(e){var t=c._fromBufferReader(o(e));return new c(t)},c.fromString=function(e){var r=t.from(e,"hex");return c.fromBuffer(r)},c._fromBufferReader=function(e){var t={};return t.version=e.readInt32LE(),t.prevHash=e.read(32),t.merkleRoot=e.read(32),t.time=e.readUInt32LE(),t.bits=e.readUInt32LE(),t.nonce=e.readUInt32LE(),t},c.fromBufferReader=function(e){var t=c._fromBufferReader(e);return new c(t)},c.prototype.toObject=c.prototype.toJSON=function(){return{hash:this.hash,version:this.version,prevHash:t.from(this.prevHash).reverse().toString("hex"),merkleRoot:t.from(this.merkleRoot).reverse().toString("hex"),time:this.time,bits:this.bits,nonce:this.nonce}},c.prototype.toBuffer=function(){return this.toBufferWriter().concat()},c.prototype.toString=function(){return this.toBuffer().toString("hex")},c.prototype.toBufferWriter=function(e){return e||(e=new a),e.writeInt32LE(this.version),e.write(this.prevHash),e.write(this.merkleRoot),e.writeUInt32LE(this.time),e.writeUInt32LE(this.bits),e.writeUInt32LE(this.nonce),e},c.prototype.getTargetDifficulty=function(e){e=e||this.bits;for(var t=new n(16777215&e),r=8*((e>>>24)-3);r-- >0;)t=t.mul(new n(2));return t},c.prototype.getDifficulty=function(){var e=this.getTargetDifficulty(486604799).mul(new n(Math.pow(10,8))),t=this.getTargetDifficulty(),r=e.div(t).toString(10),i=r.length-8;return r=r.slice(0,i)+"."+r.slice(i),parseFloat(r)},c.prototype._getHash=function(){var e=this.toBuffer();return s.sha256sha256(e)};var h={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=o(this._getHash()).readReverse().toString("hex")),this._id},set:i.noop};Object.defineProperty(c.prototype,"id",h),Object.defineProperty(c.prototype,"hash",h),c.prototype.validTimestamp=function(){var e=Math.round((new Date).getTime()/1e3);return!(this.time>e+c.Constants.MAX_TIME_OFFSET)},c.prototype.validProofOfWork=function(){var e=new n(this.id,"hex"),t=this.getTargetDifficulty();return!(e.cmp(t)>0)},c.prototype.inspect=function(){return"<BlockHeader "+this.id+">"},c.Constants={START_OF_HEADER:8,MAX_TIME_OFFSET:7200,LARGEST_HASH:new n("10000000000000000000000000000000000000000000000000000000000000000","hex")},e.exports=c}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var i in r)n(r,i)&&(e[i]=r[i])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var o={arraySet:function(e,t,r,i,n){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+i),n);else for(var o=0;o<i;o++)e[n+o]=t[r+o]},flattenChunks:function(e){var t,r,i,n,o,a;for(i=0,t=0,r=e.length;t<r;t++)i+=e[t].length;for(a=new Uint8Array(i),n=0,t=0,r=e.length;t<r;t++)o=e[t],a.set(o,n),n+=o.length;return a}},a={arraySet:function(e,t,r,i,n){for(var o=0;o<i;o++)e[n+o]=t[r+o]},flattenChunks:function(e){return[].concat.apply([],e)}};t.setTyped=function(e){e?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,o)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,a))},t.setTyped(i)},function(e,t,r){"use strict";(function(t){var i=r(2),n=i.PublicKey,o=i.PrivateKey,a=i.crypto.Hash,s=i.util.preconditions;i.errors;function u(e){return this instanceof u?(this.options=e||{},this.network=this.options.network||"mainnet",this.registry=this.options.registry||null,this):new u(e)}u.fromPublicKey=function(e,t){t=t||{},"string"==typeof e&&(e=n.fromString(e)),s.checkArgument(e instanceof n,"Invalid public key");var r=e.toString("hex"),i=t.network||"mainnet",o=t.path||"",a="did:smartledger:"+r;return"mainnet"!==i&&(a+=":"+i),o&&(a+=":"+o),a},u.fromPrivateKey=function(e,t){return"string"==typeof e&&(e=o.fromWIF(e)),s.checkArgument(e instanceof o,"Invalid private key"),u.fromPublicKey(e.toPublicKey(),t)},u.parseDID=function(e){if(s.checkArgument("string"==typeof e,"DID must be a string"),!e.startsWith("did:smartledger:"))throw new Error("Invalid SmartLedger DID format");var t=e.split(":");if(t.length<3)throw new Error("Invalid DID format");var r={method:"smartledger",identifier:t[2],network:"mainnet",path:""};return t.length>3&&""!==t[3]&&(r.network=t[3]),t.length>4&&(r.path=t.slice(4).join(":")),r},u.isValidDID=function(e){try{var t=u.parseDID(e);return!(!/^[0-9a-fA-F]{66}$/.test(t.identifier)&&!/^[0-9a-fA-F]{130}$/.test(t.identifier))&&!!["mainnet","testnet","regtest"].includes(t.network)}catch(e){return!1}},u.getPublicKey=function(e){var t=u.parseDID(e);return n.fromString(t.identifier)},u.createDocument=function(e,t){t=t||{},s.checkArgument(u.isValidDID(e),"Invalid DID");var r=e+"#keys-1",i={"@context":["https://www.w3.org/ns/did/v1","https://w3id.org/security/suites/secp256k1-2019/v1"],id:e,verificationMethod:[{id:r,type:"EcdsaSecp256k1VerificationKey2019",controller:e,publicKeyHex:u.getPublicKey(e).toString("hex")}],authentication:[r],assertionMethod:[r],keyAgreement:[r],capabilityInvocation:[r],capabilityDelegation:[r]};return t.services&&Array.isArray(t.services)&&(i.service=t.services),t.verificationMethods&&(i.verificationMethod=i.verificationMethod.concat(t.verificationMethods)),t.created&&(i.created=t.created),t.updated&&(i.updated=t.updated),i},u.resolve=async function(e,t){t=t||{};try{return s.checkArgument(u.isValidDID(e),"Invalid DID"),{"@context":"https://w3id.org/did-resolution/v1",didDocument:u.createDocument(e,t),didResolutionMetadata:{contentType:"application/did+ld+json",retrieved:(new Date).toISOString()},didDocumentMetadata:{method:{published:!0,recoveryCommitment:null,updateCommitment:null}}}}catch(e){return{"@context":"https://w3id.org/did-resolution/v1",didDocument:null,didResolutionMetadata:{error:"notFound",errorMessage:e.message},didDocumentMetadata:{}}}},u.verifyOwnership=function(e,r,n){try{var o=u.getPublicKey(e),s=a.sha256(t.isBuffer(n)?n:t.from(n,"utf8")),c=i.crypto.Signature.fromString(r),h=new i.crypto.ECDSA;return h.hashbuf=s,h.pubkey=o,h.sig=c,h.verify()}catch(e){return!1}},u.signMessage=function(e,r){s.checkArgument(r instanceof o,"Invalid private key");var n=a.sha256(t.isBuffer(e)?e:t.from(e,"utf8")),u=new i.crypto.ECDSA;return u.hashbuf=n,u.privkey=r,u.pubkey=r.toPublicKey(),u.sign().toString()},u.createProofOfOwnership=function(e,t){s.checkArgument(e instanceof o,"Invalid private key"),s.checkArgument("string"==typeof t,"Challenge must be a string");var r=u.fromPrivateKey(e),i=(new Date).toISOString(),n=t+":"+i+":"+r;return{type:"EcdsaSecp256k1Signature2019",created:i,verificationMethod:r+"#keys-1",proofPurpose:"authentication",challenge:t,jws:u.signMessage(n,e)}},u.verifyProofOfOwnership=function(e,t){try{s.checkArgument(e&&"object"==typeof e,"Invalid proof object"),s.checkArgument("string"==typeof t,"DID must be a string");var r=e.challenge+":"+e.created+":"+t;return u.verifyOwnership(t,e.jws,r)}catch(e){return!1}},u.createDIDURL=function(e,t){return s.checkArgument("string"==typeof e,"DID must be a string"),s.checkArgument("string"==typeof t,"Fragment must be a string"),e+"#"+t},u.generateTestDID=function(e){e=e||{};var t=new o,r=u.fromPrivateKey(t,e),i=u.createDocument(r,e);return{did:r,privateKey:t.toWIF(),publicKey:t.toPublicKey().toString("hex"),document:i}},e.exports=u}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var i=r(4),n=r(162),o=r(1).Buffer,a=new Array(16);function s(){n.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(e,t){return e<<t|e>>>32-t}function c(e,t,r,i,n,o,a){return u(e+(t&r|~t&i)+n+o|0,a)+t|0}function h(e,t,r,i,n,o,a){return u(e+(t&i|r&~i)+n+o|0,a)+t|0}function f(e,t,r,i,n,o,a){return u(e+(t^r^i)+n+o|0,a)+t|0}function l(e,t,r,i,n,o,a){return u(e+(r^(t|~i))+n+o|0,a)+t|0}i(s,n),s.prototype._update=function(){for(var e=a,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,i=this._b,n=this._c,o=this._d;r=c(r,i,n,o,e[0],3614090360,7),o=c(o,r,i,n,e[1],3905402710,12),n=c(n,o,r,i,e[2],606105819,17),i=c(i,n,o,r,e[3],3250441966,22),r=c(r,i,n,o,e[4],4118548399,7),o=c(o,r,i,n,e[5],1200080426,12),n=c(n,o,r,i,e[6],2821735955,17),i=c(i,n,o,r,e[7],4249261313,22),r=c(r,i,n,o,e[8],1770035416,7),o=c(o,r,i,n,e[9],2336552879,12),n=c(n,o,r,i,e[10],4294925233,17),i=c(i,n,o,r,e[11],2304563134,22),r=c(r,i,n,o,e[12],1804603682,7),o=c(o,r,i,n,e[13],4254626195,12),n=c(n,o,r,i,e[14],2792965006,17),r=h(r,i=c(i,n,o,r,e[15],1236535329,22),n,o,e[1],4129170786,5),o=h(o,r,i,n,e[6],3225465664,9),n=h(n,o,r,i,e[11],643717713,14),i=h(i,n,o,r,e[0],3921069994,20),r=h(r,i,n,o,e[5],3593408605,5),o=h(o,r,i,n,e[10],38016083,9),n=h(n,o,r,i,e[15],3634488961,14),i=h(i,n,o,r,e[4],3889429448,20),r=h(r,i,n,o,e[9],568446438,5),o=h(o,r,i,n,e[14],3275163606,9),n=h(n,o,r,i,e[3],4107603335,14),i=h(i,n,o,r,e[8],1163531501,20),r=h(r,i,n,o,e[13],2850285829,5),o=h(o,r,i,n,e[2],4243563512,9),n=h(n,o,r,i,e[7],1735328473,14),r=f(r,i=h(i,n,o,r,e[12],2368359562,20),n,o,e[5],4294588738,4),o=f(o,r,i,n,e[8],2272392833,11),n=f(n,o,r,i,e[11],1839030562,16),i=f(i,n,o,r,e[14],4259657740,23),r=f(r,i,n,o,e[1],2763975236,4),o=f(o,r,i,n,e[4],1272893353,11),n=f(n,o,r,i,e[7],4139469664,16),i=f(i,n,o,r,e[10],3200236656,23),r=f(r,i,n,o,e[13],681279174,4),o=f(o,r,i,n,e[0],3936430074,11),n=f(n,o,r,i,e[3],3572445317,16),i=f(i,n,o,r,e[6],76029189,23),r=f(r,i,n,o,e[9],3654602809,4),o=f(o,r,i,n,e[12],3873151461,11),n=f(n,o,r,i,e[15],530742520,16),r=l(r,i=f(i,n,o,r,e[2],3299628645,23),n,o,e[0],4096336452,6),o=l(o,r,i,n,e[7],1126891415,10),n=l(n,o,r,i,e[14],2878612391,15),i=l(i,n,o,r,e[5],4237533241,21),r=l(r,i,n,o,e[12],1700485571,6),o=l(o,r,i,n,e[3],2399980690,10),n=l(n,o,r,i,e[10],4293915773,15),i=l(i,n,o,r,e[1],2240044497,21),r=l(r,i,n,o,e[8],1873313359,6),o=l(o,r,i,n,e[15],4264355552,10),n=l(n,o,r,i,e[6],2734768916,15),i=l(i,n,o,r,e[13],1309151649,21),r=l(r,i,n,o,e[4],4149444226,6),o=l(o,r,i,n,e[11],3174756917,10),n=l(n,o,r,i,e[2],718787259,15),i=l(i,n,o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+i|0,this._c=this._c+n|0,this._d=this._d+o|0},s.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=o.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=s},function(e,t,r){e.exports=n;var i=r(67).EventEmitter;function n(){i.call(this)}r(4)(n,i),n.Readable=r(38),n.Writable=r(172),n.Duplex=r(173),n.Transform=r(174),n.PassThrough=r(175),n.Stream=n,n.prototype.pipe=function(e,t){var r=this;function n(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",n),e.on("drain",o),e._isStdio||t&&!1===t.end||(r.on("end",s),r.on("close",u));var a=!1;function s(){a||(a=!0,e.end())}function u(){a||(a=!0,"function"==typeof e.destroy&&e.destroy())}function c(e){if(h(),0===i.listenerCount(this,"error"))throw e}function h(){r.removeListener("data",n),e.removeListener("drain",o),r.removeListener("end",s),r.removeListener("close",u),r.removeListener("error",c),e.removeListener("error",c),r.removeListener("end",h),r.removeListener("close",h),e.removeListener("close",h)}return r.on("error",c),e.on("error",c),r.on("end",h),r.on("close",h),e.on("close",h),e.emit("pipe",r),e}},function(e,t,r){"use strict";var i,n="object"==typeof Reflect?Reflect:null,o=n&&"function"==typeof n.apply?n.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};i=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(r,i){function n(r){e.removeListener(t,o),i(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",n),r([].slice.call(arguments))}b(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&b(e,"error",t,r)}(e,n,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var u=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function h(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function f(e,t,r,i){var n,o,a,s;if(c(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]),void 0===a)a=o[t]=r,++e._eventsCount;else if("function"==typeof a?a=o[t]=i?[r,a]:[a,r]:i?a.unshift(r):a.push(r),(n=h(e))>0&&a.length>n&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,s=u,console&&console.warn&&console.warn(s)}return e}function l(){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 d(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=l.bind(i);return n.listener=r,i.wrapFn=n,n}function p(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(n):g(n,n.length)}function m(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function g(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}function b(e,t,r,i){if("function"==typeof e.on)i.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function n(o){i.once&&e.removeEventListener(t,n),r(o)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||a(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");u=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||a(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return h(this)},s.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,n=this._events;if(void 0!==n)i=i&&void 0===n.error;else if(!i)return!1;if(i){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=n[e];if(void 0===u)return!1;if("function"==typeof u)o(u,this,t);else{var c=u.length,h=g(u,c);for(r=0;r<c;++r)o(h[r],this,t)}return!0},s.prototype.addListener=function(e,t){return f(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return f(this,e,t,!0)},s.prototype.once=function(e,t){return c(t),this.on(e,d(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return c(t),this.prependListener(e,d(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,i,n,o,a;if(c(t),void 0===(i=this._events))return this;if(void 0===(r=i[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,n=o;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,n),1===r.length&&(i[e]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",e,a||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var n,o=Object.keys(r);for(i=0;i<o.length;++i)"removeListener"!==(n=o[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},s.prototype.listeners=function(e){return p(this,e,!0)},s.prototype.rawListeners=function(e){return p(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(e,t,r){var i=r(0),n=i.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=i:(o(i,t),t.Buffer=a),o(n,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},function(e,t,r){"use strict";(function(t,i,n){var o=r(52);function a(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var i=e.entry;e.entry=null;for(;i;){var n=i.callback;t.pendingcb--,n(r),i=i.next}t.corkedRequestsFree.next=e}(t,e)}}e.exports=y;var s,u=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?i:o.nextTick;y.WritableState=b;var c=Object.create(r(39));c.inherits=r(4);var h={deprecate:r(169)},f=r(99),l=r(68).Buffer,d=(void 0!==n?n:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var p,m=r(100);function g(){}function b(e,t){s=s||r(28),e=e||{};var i=t instanceof s;this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,c=e.writableHighWaterMark,h=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(c||0===c)?c:h,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===e.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,i=r.sync,n=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,i,n){--t.pendingcb,r?(o.nextTick(n,i),o.nextTick(I,e,t),e._writableState.errorEmitted=!0,e.emit("error",i)):(n(i),e._writableState.errorEmitted=!0,e.emit("error",i),I(e,t))}(e,r,i,t,n);else{var a=S(r);a||r.corked||r.bufferProcessing||!r.bufferedRequest||w(e,r),i?u(_,e,r,a,n):_(e,r,a,n)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}function y(e){if(s=s||r(28),!(p.call(y,this)||this instanceof s))return new y(e);this._writableState=new b(e,this),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)),f.call(this)}function v(e,t,r,i,n,o,a){t.writelen=i,t.writecb=a,t.writing=!0,t.sync=!0,r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}function _(e,t,r,i){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,i(),I(e,t)}function w(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,n=new Array(i),o=t.corkedRequestsFree;o.entry=r;for(var s=0,u=!0;r;)n[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;n.allBuffers=u,v(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 a(t),t.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,h=r.encoding,f=r.callback;if(v(e,t,!1,t.objectMode?1:c.length,c,h,f),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function S(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function k(e,t){e._final((function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),I(e,t)}))}function I(e,t){var r=S(t);return r&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,o.nextTick(k,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}c.inherits(y,f),b.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(b.prototype,"buffer",{get:h.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(e){return!!p.call(this,e)||this===y&&(e&&e._writableState instanceof b)}})):p=function(e){return e instanceof this},y.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},y.prototype.write=function(e,t,r){var i,n=this._writableState,a=!1,s=!n.objectMode&&(i=e,l.isBuffer(i)||i instanceof d);return s&&!l.isBuffer(e)&&(e=function(e){return l.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=n.defaultEncoding),"function"!=typeof r&&(r=g),n.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),o.nextTick(t,r)}(this,r):(s||function(e,t,r,i){var n=!0,a=!1;return null===r?a=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(e.emit("error",a),o.nextTick(i,a),n=!1),n}(this,n,e,r))&&(n.pendingcb++,a=function(e,t,r,i,n,o){if(!r){var a=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,r));return t}(t,i,n);i!==a&&(r=!0,n="buffer",i=a)}var s=t.objectMode?1:i.length;t.length+=s;var u=t.length<t.highWaterMark;u||(t.needDrain=!0);if(t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:o,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else v(e,t,!1,s,i,n,o);return u}(this,n,s,e,t,r)),a},y.prototype.cork=function(){this._writableState.corked++},y.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||w(this,e))},y.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},y.prototype._writev=null,y.prototype.end=function(e,t,r){var i=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,t,r){t.ending=!0,I(e,t),r&&(t.finished?o.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,i,r)},Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),y.prototype.destroy=m.destroy,y.prototype._undestroy=m.undestroy,y.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(6),r(167).setImmediate,r(13))},function(e,t,r){"use strict";var i=r(170).Buffer,n=i.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(i.isEncoding===n||!n(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=c,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=h,this.end=f,t=3;break;default:return this.write=l,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=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 c(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 h(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 f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function l(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}t.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},o.prototype.text=function(e,t){var r=function(e,t,r){var i=t.length-1;if(i<r)return 0;var n=a(t[i]);if(n>=0)return n>0&&(e.lastNeed=n-1),n;if(--i<r||-2===n)return 0;if((n=a(t[i]))>=0)return n>0&&(e.lastNeed=n-2),n;if(--i<r||-2===n)return 0;if((n=a(t[i]))>=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 i=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,r){"use strict";var i=r(0).Buffer,n=r(102),o=r(177),a=new Array(16),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],u=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],c=[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],f=[0,1518500249,1859775393,2400959708,2840853838],l=[1352829926,1548603684,1836072691,2053994217,0];function d(e,t){return e<<t|e>>>32-t}function p(e,t,r,i,n,o,a,s){return d(e+(t^r^i)+o+a|0,s)+n|0}function m(e,t,r,i,n,o,a,s){return d(e+(t&r|~t&i)+o+a|0,s)+n|0}function g(e,t,r,i,n,o,a,s){return d(e+((t|~r)^i)+o+a|0,s)+n|0}function b(e,t,r,i,n,o,a,s){return d(e+(t&i|r&~i)+o+a|0,s)+n|0}function y(e,t,r,i,n,o,a,s){return d(e+(t^(r|~i))+o+a|0,s)+n|0}function v(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}n(v,o),v.prototype._update=function(){for(var e=a,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,i=0|this._b,n=0|this._c,o=0|this._d,v=0|this._e,_=0|this._a,w=0|this._b,S=0|this._c,k=0|this._d,I=0|this._e,E=0;E<80;E+=1){var A,O;E<16?(A=p(r,i,n,o,v,e[s[E]],f[0],c[E]),O=y(_,w,S,k,I,e[u[E]],l[0],h[E])):E<32?(A=m(r,i,n,o,v,e[s[E]],f[1],c[E]),O=b(_,w,S,k,I,e[u[E]],l[1],h[E])):E<48?(A=g(r,i,n,o,v,e[s[E]],f[2],c[E]),O=g(_,w,S,k,I,e[u[E]],l[2],h[E])):E<64?(A=b(r,i,n,o,v,e[s[E]],f[3],c[E]),O=m(_,w,S,k,I,e[u[E]],l[3],h[E])):(A=y(r,i,n,o,v,e[s[E]],f[4],c[E]),O=p(_,w,S,k,I,e[u[E]],l[4],h[E])),r=v,v=o,o=d(n,10),n=i,i=A,_=I,I=k,k=d(S,10),S=w,w=O}var x=this._b+n+k|0;this._b=this._c+o+I|0,this._c=this._d+v+_|0,this._d=this._e+r+w|0,this._e=this._a+i+S|0,this._a=x},v.prototype._digest=function(){this._block[this._blockOffset]=128,this._blockOffset+=1,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=i.alloc?i.alloc(20):new i(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=v},function(e,t,r){"use strict";var i=r(103),n=r(75),o=n([i("%String.prototype.indexOf%")]);e.exports=function(e,t){var r=i(e,!!t);return"function"==typeof r&&o(e,".prototype.")>-1?n([r]):r}},function(e,t,r){"use strict";e.exports=Object},function(e,t,r){"use strict";e.exports=function(){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(var i 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 n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},function(e,t,r){"use strict";var i=r(42),n=r(40),o=r(76),a=r(108);e.exports=function(e){if(e.length<1||"function"!=typeof e[0])throw new n("a function is required");return a(i,o,e)}},function(e,t,r){"use strict";e.exports=Function.prototype.call},function(e,t,r){"use strict";e.exports=Function.prototype.apply},function(e,t,r){"use strict";e.exports=function(t){var r=t.toLowerCase(),i=e.exports[r];if(!i)throw new Error(r+" is not supported (we accept pull requests)");return new i},e.exports.sha=r(212),e.exports.sha1=r(213),e.exports.sha224=r(214),e.exports.sha256=r(109),e.exports.sha384=r(215),e.exports.sha512=r(110)},function(e,t,r){"use strict";var i=r(14);function n(e){this.options=e,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=!1!==e.padding}e.exports=n,n.prototype._init=function(){},n.prototype.update=function(e){return 0===e.length?[]:"decrypt"===this.type?this._updateDecrypt(e):this._updateEncrypt(e)},n.prototype._buffer=function(e,t){for(var r=Math.min(this.buffer.length-this.bufferOff,e.length-t),i=0;i<r;i++)this.buffer[this.bufferOff+i]=e[t+i];return this.bufferOff+=r,r},n.prototype._flushBuffer=function(e,t){return this._update(this.buffer,0,e,t),this.bufferOff=0,this.blockSize},n.prototype._updateEncrypt=function(e){var t=0,r=0,i=(this.bufferOff+e.length)/this.blockSize|0,n=new Array(i*this.blockSize);0!==this.bufferOff&&(t+=this._buffer(e,t),this.bufferOff===this.buffer.length&&(r+=this._flushBuffer(n,r)));for(var o=e.length-(e.length-t)%this.blockSize;t<o;t+=this.blockSize)this._update(e,t,n,r),r+=this.blockSize;for(;t<e.length;t++,this.bufferOff++)this.buffer[this.bufferOff]=e[t];return n},n.prototype._updateDecrypt=function(e){for(var t=0,r=0,i=Math.ceil((this.bufferOff+e.length)/this.blockSize)-1,n=new Array(i*this.blockSize);i>0;i--)t+=this._buffer(e,t),r+=this._flushBuffer(n,r);return t+=this._buffer(e,t),n},n.prototype.final=function(e){var t,r;return e&&(t=this.update(e)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),t?t.concat(r):r},n.prototype._pad=function(e,t){if(0===t)return!1;for(;t<e.length;)e[t++]=0;return!0},n.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var e=new Array(this.blockSize);return this._update(this.buffer,0,e,0),e},n.prototype._unpad=function(e){return e},n.prototype._finalDecrypt=function(){i.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var e=new Array(this.blockSize);return this._flushBuffer(e,0),this._unpad(e)}},function(e,t,r){var i=r(225),n=r(233),o=r(123);t.createCipher=t.Cipher=i.createCipher,t.createCipheriv=t.Cipheriv=i.createCipheriv,t.createDecipher=t.Decipher=n.createDecipher,t.createDecipheriv=t.Decipheriv=n.createDecipheriv,t.listCiphers=t.getCiphers=function(){return Object.keys(o)}},function(e,t,r){var i={ECB:r(226),CBC:r(227),CFB:r(228),CFB8:r(229),CFB1:r(230),OFB:r(231),CTR:r(121),GCM:r(121)},n=r(123);for(var o in n)n[o].module=i[n[o].mode];e.exports=n},function(e,t,r){var i;function n(e){this.rand=e}if(e.exports=function(e){return i||(i=new n(null)),i.generate(e)},e.exports.Rand=n,n.prototype.generate=function(e){return this._rand(e)},n.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r<t.length;r++)t[r]=this.rand.getByte();return t},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?n.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?n.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(n.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var o=r(237);if("function"!=typeof o.randomBytes)throw new Error("Not supported");n.prototype._rand=function(e){return o.randomBytes(e)}}catch(e){}},function(e,t,r){"use strict";var i=r(243),n=r(33),o=r(1).Buffer;function a(e){var t,r=e.modulus.byteLength();do{t=new i(n(r))}while(t.cmp(e.modulus)>=0||!t.umod(e.prime1)||!t.umod(e.prime2));return t}function s(e,t){var r=function(e){var t=a(e);return{blinder:t.toRed(i.mont(e.modulus)).redPow(new i(e.publicExponent)).fromRed(),unblinder:t.invm(e.modulus)}}(t),n=t.modulus.byteLength(),s=new i(e).mul(r.blinder).umod(t.modulus),u=s.toRed(i.mont(t.prime1)),c=s.toRed(i.mont(t.prime2)),h=t.coefficient,f=t.prime1,l=t.prime2,d=u.redPow(t.exponent1).fromRed(),p=c.redPow(t.exponent2).fromRed(),m=d.isub(p).imul(h).umod(f).imul(l);return p.iadd(m).imul(r.unblinder).umod(t.modulus).toArrayLike(o,"be",n)}s.getr=a,e.exports=s},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){"use strict";var i,n=t,o=r(58),a=r(129),s=r(15).assert;function u(e){"short"===e.type?this.curve=new a.short(e):"edwards"===e.type?this.curve=new a.edwards(e):this.curve=new a.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new u(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=u,c("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"]}),c("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"]}),c("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"]}),c("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"]}),c("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"]}),c("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"]}),c("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{i=r(255)}catch(e){i=void 0}c("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",i]})},function(e,t,r){var i=r(283);e.exports=i("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},function(e,t,r){"use strict";(function(t){var i=r(8),n=r(17),o=r(11),a=r(20),s=r(32),u=r(10),c=r(3),h=r(5),f=function e(t){if(!(this instanceof e))return new e(t);t&&this.set(t)};f.prototype.set=function(e){if(this.hashbuf=e.hashbuf||this.hashbuf,this.endian=e.endian||this.endian,this.privkey=e.privkey||this.privkey,this.pubkey=e.pubkey||(this.privkey?this.privkey.publicKey:this.pubkey),e.sig)if(t.isBuffer(e.sig)){var i=r(11);this.sig=i.fromDER(e.sig)}else this.sig=e.sig;else this.sig=this.sig;return this.k=e.k||this.k,this.verified=e.verified||this.verified,this},f.prototype.privkey2pubkey=function(){this.pubkey=this.privkey.toPublicKey()},f.prototype.calci=function(){for(var e=0;e<4;e++){var t;this.sig.i=e;try{t=this.toPublicKey()}catch(e){console.error(e);continue}if(t.point.eq(this.pubkey.point))return this.sig.compressed=this.pubkey.compressed,this}throw this.sig.i=void 0,new Error("Unable to find valid recovery factor")},f.fromString=function(e){var t=JSON.parse(e);return new f(t)},f.prototype.randomK=function(){var e,t=n.getN();do{e=i.fromBuffer(s.getRandomBuffer(32))}while(!e.lt(t)||!e.gt(i.Zero));return this.k=e,this},f.prototype.deterministicK=function(e){c.isUndefined(e)&&(e=0);var r=t.alloc(32);r.fill(1);var o=t.alloc(32);o.fill(0);var a=this.privkey.bn.toBuffer({size:32}),s="little"===this.endian?t.from(this.hashbuf).reverse():this.hashbuf;o=u.sha256hmac(t.concat([r,t.from([0]),a,s]),o),r=u.sha256hmac(r,o),o=u.sha256hmac(t.concat([r,t.from([1]),a,s]),o),r=u.sha256hmac(r,o),r=u.sha256hmac(r,o);for(var h=i.fromBuffer(r),f=n.getN(),l=0;l<e||!h.lt(f)||!h.gt(i.Zero);l++)o=u.sha256hmac(t.concat([r,t.from([0])]),o),r=u.sha256hmac(r,o),r=u.sha256hmac(r,o),h=i.fromBuffer(r);return this.k=h,this},f.prototype.toPublicKey=function(){var e=this.sig.i;h.checkArgument(0===e||1===e||2===e||3===e,new Error("i must be equal to 0, 1, 2, or 3"));var t=i.fromBuffer(this.hashbuf),r=this.sig.r,o=this.sig.s,s=1&e,u=e>>1,c=n.getN(),f=n.getG(),l=u?r.add(c):r,d=n.fromX(s,l);if(!d.mul(c).isInfinity())throw new Error("nR is not a valid curve point");var p=t.neg().umod(c),m=r.invm(c),g=d.mul(o).add(f.mul(p)).mul(m);return a.fromPoint(g,this.sig.compressed)},f.prototype.sigError=function(){if(!t.isBuffer(this.hashbuf)||32!==this.hashbuf.length)return"hashbuf must be a 32 byte buffer";var e=this.sig.r,r=this.sig.s,o=n.getN();try{if(e.lte(i.Zero)||r.lte(i.Zero)||e.gte(o)||r.gte(o))return"r and s not in range";var a=i.fromBuffer(this.hashbuf,this.endian?{endian:this.endian}:void 0),s=r.invm(o),u=s.mul(a).umod(o),c=s.mul(e).umod(o),h=n.getG().mulAdd(u,this.pubkey.point,c);return h.isInfinity()?"p is infinity":0!==h.getX().umod(o).cmp(e)&&"Invalid signature"}catch(e){return"Signature security validation failed: "+e.message}},f.toLowS=function(e){return e.gt(i.fromBuffer(t.from("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))&&(e=n.getN().sub(e)),e},f.prototype._findSignature=function(e,t){var r,o,a,s=n.getN(),u=n.getG(),c=0;do{(!this.k||c>0)&&this.deterministicK(c),c++,r=this.k,o=u.mul(r).x.umod(s),a=r.invm(s).mul(t.add(e.mul(o))).umod(s)}while(o.cmp(i.Zero)<=0||a.cmp(i.Zero)<=0);return{s:a=f.toLowS(a),r:o}},f.prototype.sign=function(){var e=this.hashbuf,r=this.privkey,n=r.bn;h.checkState(e&&r&&n,new Error("invalid parameters")),h.checkState(t.isBuffer(e)&&32===e.length,new Error("hashbuf must be a 32 byte buffer"));var a=i.fromBuffer(e,this.endian?{endian:this.endian}:void 0),s=this._findSignature(n,a);return s.compressed=this.pubkey.compressed,this.sig=new o(s),this},f.prototype.signRandomK=function(){return this.randomK(),this.sign()},f.prototype.toString=function(){var e={};return this.hashbuf&&(e.hashbuf=this.hashbuf.toString("hex")),this.privkey&&(e.privkey=this.privkey.toString()),this.pubkey&&(e.pubkey=this.pubkey.toString()),this.sig&&(e.sig=this.sig.toString()),this.k&&(e.k=this.k.toString()),JSON.stringify(e)},f.prototype.verify=function(){return this.sigError()?this.verified=!1:this.verified=!0,this},f.sign=function(e,t,r){return f().set({hashbuf:e,endian:r,privkey:t}).sign().sig},f.signWithCalcI=function(e,t,r){return f().set({hashbuf:e,endian:r,privkey:t}).sign().calci().sig},f.signRandomK=function(e,t,r){return f().set({hashbuf:e,endian:r,privkey:t}).signRandomK().sig},f.verify=function(e,t,r,i){return f().set({hashbuf:e,endian:i,sig:t,pubkey:r}).verify().verified},e.exports=f}).call(this,r(0).Buffer)},function(e,t,r){(function(e){var i=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},i=0;i<t.length;i++)r[t[i]]=Object.getOwnPropertyDescriptor(e,t[i]);return r},n=/%[sdj%]/g;t.format=function(e){if(!b(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(s(arguments[r]));return t.join(" ")}r=1;for(var i=arguments,o=i.length,a=String(e).replace(n,(function(e){if("%%"===e)return"%";if(r>=o)return e;switch(e){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(e){return"[Circular]"}default:return e}})),u=i[r];r<o;u=i[++r])m(u)||!_(u)?a+=" "+u:a+=" "+s(u);return a},t.deprecate=function(r,i){if(void 0!==e&&!0===e.noDeprecation)return r;if(void 0===e)return function(){return t.deprecate(r,i).apply(this,arguments)};var n=!1;return function(){if(!n){if(e.throwDeprecation)throw new Error(i);e.traceDeprecation?console.trace(i):console.error(i),n=!0}return r.apply(this,arguments)}};var o,a={};function s(e,r){var i={seen:[],stylize:c};return arguments.length>=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),p(r)?i.showHidden=r:r&&t._extend(i,r),y(i.showHidden)&&(i.showHidden=!1),y(i.depth)&&(i.depth=2),y(i.colors)&&(i.colors=!1),y(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=u),h(i,e,i.depth)}function u(e,t){var r=s.styles[t];return r?"["+s.colors[r][0]+"m"+e+"["+s.colors[r][1]+"m":e}function c(e,t){return e}function h(e,r,i){if(e.customInspect&&r&&k(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(i,e);return b(n)||(n=h(e,n,i)),n}var o=function(e,t){if(y(t))return e.stylize("undefined","undefined");if(b(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(g(t))return e.stylize(""+t,"number");if(p(t))return e.stylize(""+t,"boolean");if(m(t))return e.stylize("null","null")}(e,r);if(o)return o;var a=Object.keys(r),s=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(r)),S(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return f(r);if(0===a.length){if(k(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(v(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(w(r))return e.stylize(Date.prototype.toString.call(r),"date");if(S(r))return f(r)}var c,_="",I=!1,E=["{","}"];(d(r)&&(I=!0,E=["[","]"]),k(r))&&(_=" [Function"+(r.name?": "+r.name:"")+"]");return v(r)&&(_=" "+RegExp.prototype.toString.call(r)),w(r)&&(_=" "+Date.prototype.toUTCString.call(r)),S(r)&&(_=" "+f(r)),0!==a.length||I&&0!=r.length?i<0?v(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),c=I?function(e,t,r,i,n){for(var o=[],a=0,s=t.length;a<s;++a)x(t,String(a))?o.push(l(e,t,r,i,String(a),!0)):o.push("");return n.forEach((function(n){n.match(/^\d+$/)||o.push(l(e,t,r,i,n,!0))})),o}(e,r,i,s,a):a.map((function(t){return l(e,r,i,s,t,I)})),e.seen.pop(),function(e,t,r){if(e.reduce((function(e,t){return t.indexOf("\n")>=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]}(c,_,E)):E[0]+_+E[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,r,i,n,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(t,n)||{value:t[n]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),x(i,n)||(a="["+n+"]"),s||(e.seen.indexOf(u.value)<0?(s=m(r)?h(e,u.value,null):h(e,u.value,r-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),y(a)){if(o&&n.match(/^\d+$/))return s;(a=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function d(e){return Array.isArray(e)}function p(e){return"boolean"==typeof e}function m(e){return null===e}function g(e){return"number"==typeof e}function b(e){return"string"==typeof e}function y(e){return void 0===e}function v(e){return _(e)&&"[object RegExp]"===I(e)}function _(e){return"object"==typeof e&&null!==e}function w(e){return _(e)&&"[object Date]"===I(e)}function S(e){return _(e)&&("[object Error]"===I(e)||e instanceof Error)}function k(e){return"function"==typeof e}function I(e){return Object.prototype.toString.call(e)}function E(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(r){if(y(o)&&(o=e.env.NODE_DEBUG||""),r=r.toUpperCase(),!a[r])if(new RegExp("\\b"+r+"\\b","i").test(o)){var i=e.pid;a[r]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",r,i,e)}}else a[r]=function(){};return a[r]},t.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=d,t.isBoolean=p,t.isNull=m,t.isNullOrUndefined=function(e){return null==e},t.isNumber=g,t.isString=b,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=y,t.isRegExp=v,t.isObject=_,t.isDate=w,t.isError=S,t.isFunction=k,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(292);var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function O(){var e=new Date,t=[E(e.getHours()),E(e.getMinutes()),E(e.getSeconds())].join(":");return[e.getDate(),A[e.getMonth()],t].join(" ")}function x(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",O(),t.format.apply(t,arguments))},t.inherits=r(4),t._extend=function(e,t){if(!t||!_(t))return e;for(var r=Object.keys(t),i=r.length;i--;)e[r[i]]=t[r[i]];return e};var P="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function M(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(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(P&&e[P]){var t;if("function"!=typeof(t=e[P]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,P,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,i=new Promise((function(e,i){t=e,r=i})),n=[],o=0;o<arguments.length;o++)n.push(arguments[o]);n.push((function(e,i){e?r(e):t(i)}));try{e.apply(this,n)}catch(e){r(e)}return i}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),P&&Object.defineProperty(t,P,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,i(e))},t.promisify.custom=P,t.callbackify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');function r(){for(var r=[],i=0;i<arguments.length;i++)r.push(arguments[i]);var n=r.pop();if("function"!=typeof n)throw new TypeError("The last argument must be of type Function");var o=this,a=function(){return n.apply(o,arguments)};t.apply(this,r).then((function(t){e.nextTick(a,null,t)}),(function(t){e.nextTick(M,t,a)}))}return Object.setPrototypeOf(r,Object.getPrototypeOf(t)),Object.defineProperties(r,i(t)),r}}).call(this,r(6))},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(5),o=r(12);function a(e){if(!(this instanceof a))return new a(e);var t;if(i.isNumber(e))t=e;else{if(!i.isString(e))throw new TypeError('Unrecognized num type: "'+typeof e+'" for Opcode');t=a.map[e]}return o.defineImmutable(this,{num:t}),this}for(var s in a.fromBuffer=function(e){return n.checkArgument(t.isBuffer(e)),new a(Number("0x"+e.toString("hex")))},a.fromNumber=function(e){return n.checkArgument(i.isNumber(e)),new a(e)},a.fromString=function(e){n.checkArgument(i.isString(e));var t=a.map[e];if(void 0===t)throw new TypeError("Invalid opcodestr");return new a(t)},a.prototype.toHex=function(){return this.num.toString(16)},a.prototype.toBuffer=function(){return t.from(this.toHex(),"hex")},a.prototype.toNumber=function(){return this.num},a.prototype.toString=function(){var e=a.reverseMap[this.num];if(void 0===e)throw new Error("Opcode does not have a string representation");return e},a.smallInt=function(e){return n.checkArgument(i.isNumber(e),"Invalid Argument: n should be number"),n.checkArgument(e>=0&&e<=16,"Invalid Argument: n must be between 0 and 16"),0===e?a("OP_0"):new a(a.map.OP_1+e-1)},a.map={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SPLIT:127,OP_NUM2BIN:128,OP_BIN2NUM:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_CHECKLOCKTIMEVERIFY:177,OP_CHECKSEQUENCEVERIFY:178,OP_NOP1:176,OP_NOP2:177,OP_NOP3:178,OP_SUBSTR:179,OP_LEFT:180,OP_RIGHT:181,OP_NOP4:182,OP_NOP5:183,OP_NOP6:184,OP_NOP7:185,OP_NOP8:186,OP_NOP9:187,OP_NOP10:188,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255},a.reverseMap=[],a.map)a.reverseMap[a.map[s]]=s;i.extend(a,a.map),a.isSmallIntOp=function(e){return e instanceof a&&(e=e.toNumber()),e===a.map.OP_0||e>=a.map.OP_1&&e<=a.map.OP_16},a.prototype.inspect=function(){return"<Opcode: "+this.toString()+", hex: "+this.toHex()+", decimal: "+this.num+">"},e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(142),o=r(89),a=r(8),s=r(10),u=r(11),c=r(20),h=r(293),f=function e(t){if(!(this instanceof e))return new e(t);t?(this.initialize(),this.set(t)):this.initialize()};f.prototype.verify=function(e,t,o,a,s,u){var c,h=r(31);if(i.isUndefined(o)&&(o=new h),i.isUndefined(a)&&(a=0),i.isUndefined(s)&&(s=0),s&f.SCRIPT_ENABLE_SIGHASH_FORKID&&(s|=f.SCRIPT_VERIFY_STRICTENC,!u))throw new Error("internal error - need satoshisBN to verify FORKID transactions");if(this.set({script:e,tx:o,nin:a,flags:s,satoshisBN:u}),0!=(s&f.SCRIPT_VERIFY_SIGPUSHONLY)&&!e.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(!this.evaluate())return!1;s&f.SCRIPT_VERIFY_P2SH&&(c=this.stack.slice());var l=this.stack;if(this.initialize(),this.set({script:t,stack:l,tx:o,nin:a,flags:s,satoshisBN:u}),!this.evaluate())return!1;if(0===this.stack.length)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_RESULT",!1;var d=this.stack[this.stack.length-1];if(!f.castToBool(d))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_STACK",!1;if(s&f.SCRIPT_VERIFY_P2SH&&t.isScriptHashOut()){if(!e.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(0===c.length)throw new Error("internal error - stack copy empty");var p=c[c.length-1],m=n.fromBuffer(p);if(c.pop(),this.initialize(),this.set({script:m,stack:c,tx:o,nin:a,flags:s,satoshisBN:u}),!this.evaluate())return!1;if(0===c.length)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_P2SH_STACK",!1;if(!f.castToBool(c[c.length-1]))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK",!1}if(0!=(s&f.SCRIPT_VERIFY_CLEANSTACK)){if(0==(s&f.SCRIPT_VERIFY_P2SH))throw new Error("internal error - CLEANSTACK without P2SH");if(1!==c.length)return this.errstr="SCRIPT_ERR_CLEANSTACK",!1}return!0},e.exports=f,f.prototype.initialize=function(e){this.stack=[],this.altstack=[],this.pc=0,this.pbegincodehash=0,this.nOpCount=0,this.vfExec=[],this.errstr="",this.flags=0},f.prototype.set=function(e){this.script=e.script||this.script,this.tx=e.tx||this.tx,this.nin=void 0!==e.nin?e.nin:this.nin,this.satoshisBN=e.satoshisBN||this.satoshisBN,this.stack=e.stack||this.stack,this.altstack=e.altstack||this.altstack,this.pc=void 0!==e.pc?e.pc:this.pc,this.pbegincodehash=void 0!==e.pbegincodehash?e.pbegincodehash:this.pbegincodehash,this.nOpCount=void 0!==e.nOpCount?e.nOpCount:this.nOpCount,this.vfExec=e.vfExec||this.vfExec,this.errstr=e.errstr||this.errstr,this.flags=void 0!==e.flags?e.flags:this.flags},f.true=t.from([1]),f.false=t.from([]),f.MAX_SCRIPT_ELEMENT_SIZE=520,f.MAXIMUM_ELEMENT_SIZE=4,f.LOCKTIME_THRESHOLD_BN=new a(f.LOCKTIME_THRESHOLD=5e8),f.SCRIPT_VERIFY_NONE=0,f.SCRIPT_VERIFY_P2SH=1,f.SCRIPT_VERIFY_STRICTENC=2,f.SCRIPT_VERIFY_DERSIG=4,f.SCRIPT_VERIFY_LOW_S=8,f.SCRIPT_VERIFY_NULLDUMMY=16,f.SCRIPT_VERIFY_SIGPUSHONLY=32,f.SCRIPT_VERIFY_MINIMALDATA=64,f.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS=128,f.SCRIPT_VERIFY_CLEANSTACK=256,f.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY=512,f.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY=1024,f.SCRIPT_VERIFY_MINIMALIF=8192,f.SCRIPT_VERIFY_NULLFAIL=16384,f.SCRIPT_VERIFY_COMPRESSED_PUBKEYTYPE=32768,f.SCRIPT_ENABLE_SIGHASH_FORKID=65536,f.SCRIPT_ENABLE_REPLAY_PROTECTION=1<<17,f.SCRIPT_ENABLE_MONOLITH_OPCODES=1<<18,f.SCRIPT_ENABLE_MAGNETIC_OPCODES=1<<19,f.SEQUENCE_LOCKTIME_DISABLE_FLAG=1<<31,f.SEQUENCE_LOCKTIME_TYPE_FLAG=1<<22,f.SEQUENCE_LOCKTIME_MASK=65535,f.castToBool=function(e){for(var t=0;t<e.length;t++)if(0!==e[t])return t!==e.length-1||128!==e[t];return!1},f.prototype.checkSignatureEncoding=function(e){var t;if(0===e.length)return!0;if(0!=(this.flags&(f.SCRIPT_VERIFY_DERSIG|f.SCRIPT_VERIFY_LOW_S|f.SCRIPT_VERIFY_STRICTENC))&&!u.isTxDER(e))return this.errstr="SCRIPT_ERR_SIG_DER_INVALID_FORMAT",!1;if(0!=(this.flags&f.SCRIPT_VERIFY_LOW_S)){if(!(t=u.fromTxFormat(e)).hasLowS())return this.errstr="SCRIPT_ERR_SIG_DER_HIGH_S",!1}else if(0!=(this.flags&f.SCRIPT_VERIFY_STRICTENC)){if(!(t=u.fromTxFormat(e)).hasDefinedHashtype())return this.errstr="SCRIPT_ERR_SIG_HASHTYPE",!1;if(!(this.flags&f.SCRIPT_ENABLE_SIGHASH_FORKID)&&t.nhashtype&u.SIGHASH_FORKID)return this.errstr="SCRIPT_ERR_ILLEGAL_FORKID",!1;if(this.flags&f.SCRIPT_ENABLE_SIGHASH_FORKID&&!(t.nhashtype&u.SIGHASH_FORKID))return this.errstr="SCRIPT_ERR_MUST_USE_FORKID",!1}return!0},f.prototype.checkPubkeyEncoding=function(e){return!(0!=(this.flags&f.SCRIPT_VERIFY_STRICTENC)&&!c.isValid(e))||(this.errstr="SCRIPT_ERR_PUBKEYTYPE",!1)},f._isMinimallyEncoded=function(e,t){return t=t||f.MAXIMUM_ELEMENT_SIZE,!(e.length>t)&&!(e.length>0&&0==(127&e[e.length-1])&&(e.length<=1||0==(128&e[e.length-2])))},f._minimallyEncode=function(e){if(0===e.length)return e;var r=e[e.length-1];if(127&r)return e;if(1===e.length)return t.from("");if(128&e[e.length-2])return e;for(var i=e.length-1;i>0;i--)if(0!==e[i-1])return 128&e[i-1]?e[i++]=r:e[i-1]|=r,e.slice(0,i);return t.from("")},f.prototype.evaluate=function(){if(this.script.toBuffer().length>1e4)return this.errstr="SCRIPT_ERR_SCRIPT_SIZE",!1;try{for(;this.pc<this.script.chunks.length;){let e={pc:this.pc,opcode:o.fromNumber(this.script.chunks[this.pc].opcodenum)};if(!this.step())return!1;this._callbackStep(e)}if(this.stack.length+this.altstack.length>1e3)return this.errstr="SCRIPT_ERR_STACK_SIZE",!1}catch(e){return this.errstr="SCRIPT_ERR_UNKNOWN_ERROR: "+e,!1}return!(this.vfExec.length>0)||(this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1)},f.prototype._callbackStep=function(e){if("function"==typeof this.stepListener)try{this.stepListener(e,h(this.stack,!0),h(this.altstack,!0))}catch(e){console.log("Error in Step callback:"+e)}},f.prototype.checkLockTime=function(e){return!!(this.tx.nLockTime<f.LOCKTIME_THRESHOLD&&e.lt(f.LOCKTIME_THRESHOLD_BN)||this.tx.nLockTime>=f.LOCKTIME_THRESHOLD&&e.gte(f.LOCKTIME_THRESHOLD_BN))&&(!e.gt(new a(this.tx.nLockTime))&&!this.tx.inputs[this.nin].isFinal())},f.prototype.checkSequence=function(e){var t=this.tx.inputs[this.nin].sequenceNumber;if(this.tx.version<2)return!1;if(t&f.SEQUENCE_LOCKTIME_DISABLE_FLAG)return!1;var r=f.SEQUENCE_LOCKTIME_TYPE_FLAG|f.SEQUENCE_LOCKTIME_MASK,i=new a(t&r),n=e.and(r),o=new a(f.SEQUENCE_LOCKTIME_TYPE_FLAG);return!!(i.lt(o)&&n.lt(o)||i.gte(o)&&n.gte(o))&&!n.gt(i)},f.prototype.step=function(){var e=this;function r(t){return e.stack[e.stack.length+t]}var h,l,d,p,m,g,b,y,v,_,w,S,k,I,E,A,O,x=0!=(this.flags&f.SCRIPT_VERIFY_MINIMALDATA),P=-1===this.vfExec.indexOf(!1),M=this.script.chunks[this.pc];this.pc++;var T=M.opcodenum;if(i.isUndefined(T))return this.errstr="SCRIPT_ERR_UNDEFINED_OPCODE",!1;if(M.buf&&M.buf.length>f.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;if(T>o.OP_16&&++this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;if(function(t){switch(t){case o.OP_2MUL:case o.OP_2DIV:return!0;case o.OP_INVERT:case o.OP_MUL:case o.OP_LSHIFT:case o.OP_RSHIFT:if(0==(e.flags&f.SCRIPT_ENABLE_MAGNETIC_OPCODES))return!0;break;case o.OP_DIV:case o.OP_MOD:case o.OP_SPLIT:case o.OP_CAT:case o.OP_AND:case o.OP_OR:case o.OP_XOR:case o.OP_BIN2NUM:case o.OP_NUM2BIN:return!1}return!1}(T))return this.errstr="SCRIPT_ERR_DISABLED_OPCODE",!1;if(P&&T>=0&&T<=o.OP_PUSHDATA4){if(x&&!this.script.checkMinimalPush(this.pc-1))return this.errstr="SCRIPT_ERR_MINIMALDATA",!1;if(M.buf){if(M.len!==M.buf.length)throw new Error(`Length of push value not equal to length of data (${M.len},${M.buf.length})`);this.stack.push(M.buf)}else this.stack.push(f.false)}else if(P||o.OP_IF<=T&&T<=o.OP_ENDIF)switch(T){case o.OP_1NEGATE:case o.OP_1:case o.OP_2:case o.OP_3:case o.OP_4:case o.OP_5:case o.OP_6:case o.OP_7:case o.OP_8:case o.OP_9:case o.OP_10:case o.OP_11:case o.OP_12:case o.OP_13:case o.OP_14:case o.OP_15:case o.OP_16:m=T-(o.OP_1-1),h=new a(m).toScriptNumBuffer(),this.stack.push(h);break;case o.OP_NOP:break;case o.OP_NOP2:case o.OP_CHECKLOCKTIMEVERIFY:if(!(this.flags&f.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY)){if(this.flags&f.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var R=a.fromScriptNumBuffer(this.stack[this.stack.length-1],x,5);if(R.lt(new a(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(!this.checkLockTime(R))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case o.OP_NOP3:case o.OP_CHECKSEQUENCEVERIFY:if(!(this.flags&f.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY)){if(this.flags&f.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var B=a.fromScriptNumBuffer(r(-1),x,5);if(B.lt(new a(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(0!=(B&f.SEQUENCE_LOCKTIME_DISABLE_FLAG))break;if(!this.checkSequence(B))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case o.OP_NOP1:case o.OP_NOP4:case o.OP_NOP5:case o.OP_NOP6:case o.OP_NOP7:case o.OP_NOP8:case o.OP_NOP9:case o.OP_NOP10:if(this.flags&f.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break;case o.OP_IF:case o.OP_NOTIF:if(A=!1,P){if(this.stack.length<1)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;if(h=r(-1),this.flags&f.SCRIPT_VERIFY_MINIMALIF){if(h.length>1)return this.errstr="SCRIPT_ERR_MINIMALIF",!1;if(1===h.length&&1!==h[0])return this.errstr="SCRIPT_ERR_MINIMALIF",!1}A=f.castToBool(h),T===o.OP_NOTIF&&(A=!A),this.stack.pop()}this.vfExec.push(A);break;case o.OP_ELSE:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec[this.vfExec.length-1]=!this.vfExec[this.vfExec.length-1];break;case o.OP_ENDIF:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec.pop();break;case o.OP_VERIFY:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(h=r(-1),!(A=f.castToBool(h)))return this.errstr="SCRIPT_ERR_VERIFY",!1;this.stack.pop();break;case o.OP_RETURN:return this.errstr="SCRIPT_ERR_OP_RETURN",!1;case o.OP_TOALTSTACK:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.altstack.push(this.stack.pop());break;case o.OP_FROMALTSTACK:if(this.altstack.length<1)return this.errstr="SCRIPT_ERR_INVALID_ALTSTACK_OPERATION",!1;this.stack.push(this.altstack.pop());break;case o.OP_2DROP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop(),this.stack.pop();break;case o.OP_2DUP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=r(-2),d=r(-1),this.stack.push(t.from(l)),this.stack.push(t.from(d));break;case o.OP_3DUP:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=r(-3),d=r(-2);var N=r(-1);this.stack.push(t.from(l)),this.stack.push(t.from(d)),this.stack.push(t.from(N));break;case o.OP_2OVER:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=r(-4),d=r(-3),this.stack.push(t.from(l)),this.stack.push(t.from(d));break;case o.OP_2ROT:if(this.stack.length<6)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=this.stack.splice(this.stack.length-6,2),this.stack.push(p[0]),this.stack.push(p[1]);break;case o.OP_2SWAP:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=this.stack.splice(this.stack.length-4,2),this.stack.push(p[0]),this.stack.push(p[1]);break;case o.OP_IFDUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;h=r(-1),(A=f.castToBool(h))&&this.stack.push(t.from(h));break;case o.OP_DEPTH:h=new a(this.stack.length).toScriptNumBuffer(),this.stack.push(h);break;case o.OP_DROP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop();break;case o.OP_DUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(t.from(r(-1)));break;case o.OP_NIP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,1);break;case o.OP_OVER:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(t.from(r(-2)));break;case o.OP_PICK:case o.OP_ROLL:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(h=r(-1),m=(y=a.fromScriptNumBuffer(h,x)).toNumber(),this.stack.pop(),m<0||m>=this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;h=r(-m-1),T===o.OP_ROLL&&this.stack.splice(this.stack.length-m-1,1),this.stack.push(t.from(h));break;case o.OP_ROT:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;g=r(-3),b=r(-2);var C=r(-1);this.stack[this.stack.length-3]=b,this.stack[this.stack.length-2]=C,this.stack[this.stack.length-1]=g;break;case o.OP_SWAP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;g=r(-2),b=r(-1),this.stack[this.stack.length-2]=b,this.stack[this.stack.length-1]=g;break;case o.OP_TUCK:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,0,t.from(r(-1)));break;case o.OP_SIZE:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;y=new a(r(-1).length),this.stack.push(y.toScriptNumBuffer());break;case o.OP_AND:case o.OP_OR:case o.OP_XOR:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(l=r(-2),d=r(-1),l.length!==d.length)return this.errstr="SCRIPT_ERR_INVALID_OPERAND_SIZE",!1;switch(T){case o.OP_AND:for(let e=0;e<l.length;e++)l[e]&=d[e];break;case o.OP_OR:for(let e=0;e<l.length;e++)l[e]|=d[e];break;case o.OP_XOR:for(let e=0;e<l.length;e++)l[e]^=d[e]}this.stack.pop();break;case o.OP_INVERT:this.stack.length<1&&(this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION"),h=r(-1);for(let e=0;e<h.length;e++)h[e]=~h[e];break;case o.OP_LSHIFT:case o.OP_RSHIFT:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(0===(l=r(-2)).length)this.stack.pop();else{if(v=new a(l),(m=(_=a.fromScriptNumBuffer(r(-1),x)).toNumber())<0)return this.errstr="SCRIPT_ERR_INVALID_NUMBER_RANGE",!1;let e;this.stack.pop(),this.stack.pop(),T===o.OP_LSHIFT&&(e=v.ushln(m)),T===o.OP_RSHIFT&&(e=v.ushrn(m));let i=function(e,r){let i=e;for(;i.length<r;)i=t.concat([t.from([0]),i]);return i}(t.from(e.toArray().slice(-1*l.length)),l.length);this.stack.push(i)}break;case o.OP_EQUAL:case o.OP_EQUALVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=r(-2),d=r(-1);var D=l.toString("hex")===d.toString("hex");if(this.stack.pop(),this.stack.pop(),this.stack.push(D?f.true:f.false),T===o.OP_EQUALVERIFY){if(!D)return this.errstr="SCRIPT_ERR_EQUALVERIFY",!1;this.stack.pop()}break;case o.OP_1ADD:case o.OP_1SUB:case o.OP_NEGATE:case o.OP_ABS:case o.OP_NOT:case o.OP_0NOTEQUAL:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(h=r(-1),y=a.fromScriptNumBuffer(h,x),T){case o.OP_1ADD:y=y.add(a.One);break;case o.OP_1SUB:y=y.sub(a.One);break;case o.OP_NEGATE:y=y.neg();break;case o.OP_ABS:y.cmp(a.Zero)<0&&(y=y.neg());break;case o.OP_NOT:y=new a((0===y.cmp(a.Zero))+0);break;case o.OP_0NOTEQUAL:y=new a((0!==y.cmp(a.Zero))+0)}this.stack.pop(),this.stack.push(y.toScriptNumBuffer());break;case o.OP_ADD:case o.OP_SUB:case o.OP_MUL:case o.OP_MOD:case o.OP_DIV:case o.OP_BOOLAND:case o.OP_BOOLOR:case o.OP_NUMEQUAL:case o.OP_NUMEQUALVERIFY:case o.OP_NUMNOTEQUAL:case o.OP_LESSTHAN:case o.OP_GREATERTHAN:case o.OP_LESSTHANOREQUAL:case o.OP_GREATERTHANOREQUAL:case o.OP_MIN:case o.OP_MAX:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(v=a.fromScriptNumBuffer(r(-2),x),_=a.fromScriptNumBuffer(r(-1),x),y=new a(0),T){case o.OP_ADD:y=v.add(_);break;case o.OP_SUB:y=v.sub(_);break;case o.OP_MUL:y=v.mul(_);break;case o.OP_DIV:if(0===_)return this.errstr="SCRIPT_ERR_DIV_BY_ZERO",!1;y=v.div(_);break;case o.OP_MOD:if(0===_)return this.errstr="SCRIPT_ERR_DIV_BY_ZERO",!1;y=v.mod(_);break;case o.OP_BOOLAND:y=new a((0!==v.cmp(a.Zero)&&0!==_.cmp(a.Zero))+0);break;case o.OP_BOOLOR:y=new a((0!==v.cmp(a.Zero)||0!==_.cmp(a.Zero))+0);break;case o.OP_NUMEQUAL:case o.OP_NUMEQUALVERIFY:y=new a((0===v.cmp(_))+0);break;case o.OP_NUMNOTEQUAL:y=new a((0!==v.cmp(_))+0);break;case o.OP_LESSTHAN:y=new a((v.cmp(_)<0)+0);break;case o.OP_GREATERTHAN:y=new a((v.cmp(_)>0)+0);break;case o.OP_LESSTHANOREQUAL:y=new a((v.cmp(_)<=0)+0);break;case o.OP_GREATERTHANOREQUAL:y=new a((v.cmp(_)>=0)+0);break;case o.OP_MIN:y=v.cmp(_)<0?v:_;break;case o.OP_MAX:y=v.cmp(_)>0?v:_}if(this.stack.pop(),this.stack.pop(),this.stack.push(y.toScriptNumBuffer()),T===o.OP_NUMEQUALVERIFY){if(!f.castToBool(r(-1)))return this.errstr="SCRIPT_ERR_NUMEQUALVERIFY",!1;this.stack.pop()}break;case o.OP_WITHIN:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;v=a.fromScriptNumBuffer(r(-3),x),_=a.fromScriptNumBuffer(r(-2),x);var j=a.fromScriptNumBuffer(r(-1),x);A=_.cmp(v)<=0&&v.cmp(j)<0,this.stack.pop(),this.stack.pop(),this.stack.pop(),this.stack.push(A?f.true:f.false);break;case o.OP_RIPEMD160:case o.OP_SHA1:case o.OP_SHA256:case o.OP_HASH160:case o.OP_HASH256:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var L;h=r(-1),T===o.OP_RIPEMD160?L=s.ripemd160(h):T===o.OP_SHA1?L=s.sha1(h):T===o.OP_SHA256?L=s.sha256(h):T===o.OP_HASH160?L=s.sha256ripemd160(h):T===o.OP_HASH256&&(L=s.sha256sha256(h)),this.stack.pop(),this.stack.push(L);break;case o.OP_CODESEPARATOR:this.pbegincodehash=this.pc;break;case o.OP_CHECKSIG:case o.OP_CHECKSIGVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(w=r(-2),S=r(-1),!this.checkSignatureEncoding(w)||!this.checkPubkeyEncoding(S))return!1;k=(new n).set({chunks:this.script.chunks.slice(this.pbegincodehash)});var U=(new n).add(w);k.findAndDelete(U);try{I=u.fromTxFormat(w),E=c.fromBuffer(S,!1),O=this.tx.verifySignature(I,E,this.nin,k,this.satoshisBN,this.flags)}catch(e){O=!1}if(!O&&this.flags&f.SCRIPT_VERIFY_NULLFAIL&&w.length)return this.errstr="SCRIPT_ERR_NULLFAIL",!1;if(this.stack.pop(),this.stack.pop(),this.stack.push(O?f.true:f.false),T===o.OP_CHECKSIGVERIFY){if(!O)return this.errstr="SCRIPT_ERR_CHECKSIGVERIFY",!1;this.stack.pop()}break;case o.OP_CHECKMULTISIG:case o.OP_CHECKMULTISIGVERIFY:var H=1;if(this.stack.length<H)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var z=a.fromScriptNumBuffer(r(-H),x).toNumber();if(z<0||z>20)return this.errstr="SCRIPT_ERR_PUBKEY_COUNT",!1;if(this.nOpCount+=z,this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;var F=++H;H+=z;var K=z+2;if(this.stack.length<H)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var V=a.fromScriptNumBuffer(r(-H),x).toNumber();if(V<0||V>z)return this.errstr="SCRIPT_ERR_SIG_COUNT",!1;var q=++H;if(H+=V,this.stack.length<H)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;k=(new n).set({chunks:this.script.chunks.slice(this.pbegincodehash)});for(var G=0;G<V;G++)w=r(-q-G),k.findAndDelete((new n).add(w));for(O=!0;O&&V>0;){if(w=r(-q),S=r(-F),!this.checkSignatureEncoding(w)||!this.checkPubkeyEncoding(S))return!1;var Y;try{I=u.fromTxFormat(w),E=c.fromBuffer(S,!1),Y=this.tx.verifySignature(I,E,this.nin,k,this.satoshisBN,this.flags)}catch(e){Y=!1}Y&&(q++,V--),F++,V>--z&&(O=!1)}for(;H-- >1;){if(!O&&this.flags&f.SCRIPT_VERIFY_NULLFAIL&&!K&&r(-1).length)return this.errstr="SCRIPT_ERR_NULLFAIL",!1;K>0&&K--,this.stack.pop()}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(this.flags&f.SCRIPT_VERIFY_NULLDUMMY&&r(-1).length)return this.errstr="SCRIPT_ERR_SIG_NULLDUMMY",!1;if(this.stack.pop(),this.stack.push(O?f.true:f.false),T===o.OP_CHECKMULTISIGVERIFY){if(!O)return this.errstr="SCRIPT_ERR_CHECKMULTISIGVERIFY",!1;this.stack.pop()}break;case o.OP_CAT:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(l=r(-2),d=r(-1),l.length+d.length>f.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;this.stack[this.stack.length-2]=t.concat([l,d]),this.stack.pop();break;case o.OP_SPLIT:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=r(-2);var Z=a.fromScriptNumBuffer(r(-1),x).toNumber();if(Z<0||Z>l.length)return this.errstr="SCRIPT_ERR_INVALID_SPLIT_RANGE",!1;var W=t.from(l);this.stack[this.stack.length-2]=W.slice(0,Z),this.stack[this.stack.length-1]=W.slice(Z);break;case o.OP_NUM2BIN:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var X=a.fromScriptNumBuffer(r(-1),x).toNumber();if(X>f.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;this.stack.pop();var J=r(-1);if((J=f._minimallyEncode(J)).length>X)return this.errstr="SCRIPT_ERR_IMPOSSIBLE_ENCODING",!1;if(J.length===X){this.stack[this.stack.length-1]=J;break}var $=0;J.length>0&&($=128&J[J.length-1],J[J.length-1]&=127);var Q=t.alloc(X);J.copy(Q,0);for(var ee=J.length-1;ee++<X-2;)Q[ee]=0;Q[ee]=$,this.stack[this.stack.length-1]=Q;break;case o.OP_BIN2NUM:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(l=r(-1),d=f._minimallyEncode(l),this.stack[this.stack.length-1]=d,!f._isMinimallyEncoded(d))return this.errstr="SCRIPT_ERR_INVALID_NUMBER_RANGE",!1;break;default:return this.errstr="SCRIPT_ERR_BAD_OPCODE",!1}return!0}}).call(this,r(0).Buffer)},function(e,t,r){e.exports=r(50),e.exports.PublicKey=r(297),e.exports.PublicKeyHash=r(298),e.exports.MultiSig=r(299),e.exports.MultiSigScriptHash=r(300)},function(e,t,r){"use strict";(function(t){const i=r(8),n=r(17),o=r(87),a=n.getN(),s=a.shrn(1);e.exports={smartVerify:function(e,n,u){if(!t.isBuffer(e)||32!==e.length)throw new Error("Invalid message hash: must be 32-byte buffer");if(!n)return!1;let c=n;if(t.isBuffer(n))try{c=r(11).fromDER(n)}catch(e){return!1}if(!c||!c.r||!c.s)return!1;const h=i.isBN(c.r)?c.r:new i(c.r),f=i.isBN(c.s)?c.s:new i(c.s);if(h.isZero()||f.isZero())return!1;if(h.gte(a)||f.gte(a))return!1;let l=f;f.gt(s)&&(l=a.sub(f));const d=new(r(11))({r:h,s:l});return o.verify(e,d,u)},isCanonical:function(e){if(!e)return!1;let n=e;if(t.isBuffer(e))try{n=r(11).fromDER(e)}catch(e){return!1}return!(!n||!n.s)&&(i.isBN(n.s)?n.s:new i(n.s)).lte(s)},canonicalize:function(e){if(!e||!e.r||!e.s)throw new Error("Invalid signature object");const t=i.isBN(e.r)?e.r:new i(e.r),r=i.isBN(e.s)?e.s:new i(e.s);let n=r;return r.gt(s)&&(n=a.sub(r)),{r:t,s:n}},constants:{n:a,nh:s}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const{ec:i}=r(29),n=new i("secp256k1"),o=n.verify.bind(n);n.verify=function(e,t,r,i,n){if(!t||"object"!=typeof t)return!1;if(!t.r||!t.s)return!1;const a="function"==typeof t.r.cmp?t.r:this.curve.n.red?this.curve.n.fromRed(t.r):t.r,s="function"==typeof t.s.cmp?t.s:this.curve.n.red?this.curve.n.fromRed(t.s):t.s;return!(a&&a.cmp&&a.cmp(this.curve.n)>=0)&&(!(s&&s.cmp&&s.cmp(this.curve.n)>=0)&&(!(a&&a.isZero&&a.isZero())&&(!(s&&s.isZero&&s.isZero())&&o(e,t,r,i,n))))};const a=n.sign.bind(n);n.sign=function(e,t,r,i){const n=a(e,t,r,i);if(n.s&&n.s.cmp){const e=this.curve.n.shrn(1);n.s.cmp(e)>0&&(n.s=this.curve.n.sub(n.s))}return n},e.exports=n},function(e,t,r){(function(e){function r(e,t){for(var r=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function i(e,t){if(e.filter)return e.filter(t);for(var r=[],i=0;i<e.length;i++)t(e[i],i,e)&&r.push(e[i]);return r}t.resolve=function(){for(var t="",n=!1,o=arguments.length-1;o>=-1&&!n;o--){var a=o>=0?arguments[o]:e.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(t=a+"/"+t,n="/"===a.charAt(0))}return(n?"/":"")+(t=r(i(t.split("/"),(function(e){return!!e})),!n).join("/"))||"."},t.normalize=function(e){var o=t.isAbsolute(e),a="/"===n(e,-1);return(e=r(i(e.split("/"),(function(e){return!!e})),!o).join("/"))||o||(e="."),e&&a&&(e+="/"),(o?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(i(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))},t.relative=function(e,r){function i(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=t.resolve(e).substr(1),r=t.resolve(r).substr(1);for(var n=i(e.split("/")),o=i(r.split("/")),a=Math.min(n.length,o.length),s=a,u=0;u<a;u++)if(n[u]!==o[u]){s=u;break}var c=[];for(u=s;u<n.length;u++)c.push("..");return(c=c.concat(o.slice(s))).join("/")},t.sep="/",t.delimiter=":",t.dirname=function(e){if("string"!=typeof e&&(e+=""),0===e.length)return".";for(var t=e.charCodeAt(0),r=47===t,i=-1,n=!0,o=e.length-1;o>=1;--o)if(47===(t=e.charCodeAt(o))){if(!n){i=o;break}}else n=!1;return-1===i?r?"/":".":r&&1===i?"/":e.slice(0,i)},t.basename=function(e,t){var r=function(e){"string"!=typeof e&&(e+="");var t,r=0,i=-1,n=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!n){r=t+1;break}}else-1===i&&(n=!1,i=t+1);return-1===i?"":e.slice(r,i)}(e);return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},t.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,r=0,i=-1,n=!0,o=0,a=e.length-1;a>=0;--a){var s=e.charCodeAt(a);if(47!==s)-1===i&&(n=!1,i=a+1),46===s?-1===t?t=a:1!==o&&(o=1):-1!==t&&(o=-1);else if(!n){r=a+1;break}}return-1===t||-1===i||0===o||1===o&&t===i-1&&t===r+1?"":e.slice(t,i)};var n="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return t<0&&(t=e.length+t),e.substr(t,r)}}).call(this,r(6))},function(e,t,r){"use strict";(function(e){var i=r(0).Buffer,n=r(66).Transform,o=r(338),a=r(88),s=r(48).ok,u=r(0).kMaxLength,c="Cannot create final Buffer. It would be larger than 0x"+u.toString(16)+" bytes";o.Z_MIN_WINDOWBITS=8,o.Z_MAX_WINDOWBITS=15,o.Z_DEFAULT_WINDOWBITS=15,o.Z_MIN_CHUNK=64,o.Z_MAX_CHUNK=1/0,o.Z_DEFAULT_CHUNK=16384,o.Z_MIN_MEMLEVEL=1,o.Z_MAX_MEMLEVEL=9,o.Z_DEFAULT_MEMLEVEL=8,o.Z_MIN_LEVEL=-1,o.Z_MAX_LEVEL=9,o.Z_DEFAULT_LEVEL=o.Z_DEFAULT_COMPRESSION;for(var h=Object.keys(o),f=0;f<h.length;f++){var l=h[f];l.match(/^Z/)&&Object.defineProperty(t,l,{enumerable:!0,value:o[l],writable:!1})}for(var d={Z_OK:o.Z_OK,Z_STREAM_END:o.Z_STREAM_END,Z_NEED_DICT:o.Z_NEED_DICT,Z_ERRNO:o.Z_ERRNO,Z_STREAM_ERROR:o.Z_STREAM_ERROR,Z_DATA_ERROR:o.Z_DATA_ERROR,Z_MEM_ERROR:o.Z_MEM_ERROR,Z_BUF_ERROR:o.Z_BUF_ERROR,Z_VERSION_ERROR:o.Z_VERSION_ERROR},p=Object.keys(d),m=0;m<p.length;m++){var g=p[m];d[d[g]]=g}function b(e,t,r){var n=[],o=0;function a(){for(var t;null!==(t=e.read());)n.push(t),o+=t.length;e.once("readable",a)}function s(){var t,a=null;o>=u?a=new RangeError(c):t=i.concat(n,o),n=[],e.close(),r(a,t)}e.on("error",(function(t){e.removeListener("end",s),e.removeListener("readable",a),r(t)})),e.on("end",s),e.end(t),a()}function y(e,t){if("string"==typeof t&&(t=i.from(t)),!i.isBuffer(t))throw new TypeError("Not a string or buffer");var r=e._finishFlushFlag;return e._processChunk(t,r)}function v(e){if(!(this instanceof v))return new v(e);O.call(this,e,o.DEFLATE)}function _(e){if(!(this instanceof _))return new _(e);O.call(this,e,o.INFLATE)}function w(e){if(!(this instanceof w))return new w(e);O.call(this,e,o.GZIP)}function S(e){if(!(this instanceof S))return new S(e);O.call(this,e,o.GUNZIP)}function k(e){if(!(this instanceof k))return new k(e);O.call(this,e,o.DEFLATERAW)}function I(e){if(!(this instanceof I))return new I(e);O.call(this,e,o.INFLATERAW)}function E(e){if(!(this instanceof E))return new E(e);O.call(this,e,o.UNZIP)}function A(e){return e===o.Z_NO_FLUSH||e===o.Z_PARTIAL_FLUSH||e===o.Z_SYNC_FLUSH||e===o.Z_FULL_FLUSH||e===o.Z_FINISH||e===o.Z_BLOCK}function O(e,r){var a=this;if(this._opts=e=e||{},this._chunkSize=e.chunkSize||t.Z_DEFAULT_CHUNK,n.call(this,e),e.flush&&!A(e.flush))throw new Error("Invalid flush flag: "+e.flush);if(e.finishFlush&&!A(e.finishFlush))throw new Error("Invalid flush flag: "+e.finishFlush);if(this._flushFlag=e.flush||o.Z_NO_FLUSH,this._finishFlushFlag=void 0!==e.finishFlush?e.finishFlush:o.Z_FINISH,e.chunkSize&&(e.chunkSize<t.Z_MIN_CHUNK||e.chunkSize>t.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBits<t.Z_MIN_WINDOWBITS||e.windowBits>t.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.level<t.Z_MIN_LEVEL||e.level>t.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevel<t.Z_MIN_MEMLEVEL||e.memLevel>t.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=t.Z_FILTERED&&e.strategy!=t.Z_HUFFMAN_ONLY&&e.strategy!=t.Z_RLE&&e.strategy!=t.Z_FIXED&&e.strategy!=t.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!i.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new o.Zlib(r);var s=this;this._hadError=!1,this._handle.onerror=function(e,r){x(s),s._hadError=!0;var i=new Error(e);i.errno=r,i.code=t.codes[r],s.emit("error",i)};var u=t.Z_DEFAULT_COMPRESSION;"number"==typeof e.level&&(u=e.level);var c=t.Z_DEFAULT_STRATEGY;"number"==typeof e.strategy&&(c=e.strategy),this._handle.init(e.windowBits||t.Z_DEFAULT_WINDOWBITS,u,e.memLevel||t.Z_DEFAULT_MEMLEVEL,c,e.dictionary),this._buffer=i.allocUnsafe(this._chunkSize),this._offset=0,this._level=u,this._strategy=c,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!a._handle},configurable:!0,enumerable:!0})}function x(t,r){r&&e.nextTick(r),t._handle&&(t._handle.close(),t._handle=null)}function P(e){e.emit("close")}Object.defineProperty(t,"codes",{enumerable:!0,value:Object.freeze(d),writable:!1}),t.Deflate=v,t.Inflate=_,t.Gzip=w,t.Gunzip=S,t.DeflateRaw=k,t.InflateRaw=I,t.Unzip=E,t.createDeflate=function(e){return new v(e)},t.createInflate=function(e){return new _(e)},t.createDeflateRaw=function(e){return new k(e)},t.createInflateRaw=function(e){return new I(e)},t.createGzip=function(e){return new w(e)},t.createGunzip=function(e){return new S(e)},t.createUnzip=function(e){return new E(e)},t.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),b(new v(t),e,r)},t.deflateSync=function(e,t){return y(new v(t),e)},t.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),b(new w(t),e,r)},t.gzipSync=function(e,t){return y(new w(t),e)},t.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),b(new k(t),e,r)},t.deflateRawSync=function(e,t){return y(new k(t),e)},t.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),b(new E(t),e,r)},t.unzipSync=function(e,t){return y(new E(t),e)},t.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),b(new _(t),e,r)},t.inflateSync=function(e,t){return y(new _(t),e)},t.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),b(new S(t),e,r)},t.gunzipSync=function(e,t){return y(new S(t),e)},t.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),b(new I(t),e,r)},t.inflateRawSync=function(e,t){return y(new I(t),e)},a.inherits(O,n),O.prototype.params=function(r,i,n){if(r<t.Z_MIN_LEVEL||r>t.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+r);if(i!=t.Z_FILTERED&&i!=t.Z_HUFFMAN_ONLY&&i!=t.Z_RLE&&i!=t.Z_FIXED&&i!=t.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+i);if(this._level!==r||this._strategy!==i){var a=this;this.flush(o.Z_SYNC_FLUSH,(function(){s(a._handle,"zlib binding closed"),a._handle.params(r,i),a._hadError||(a._level=r,a._strategy=i,n&&n())}))}else e.nextTick(n)},O.prototype.reset=function(){return s(this._handle,"zlib binding closed"),this._handle.reset()},O.prototype._flush=function(e){this._transform(i.alloc(0),"",e)},O.prototype.flush=function(t,r){var n=this,a=this._writableState;("function"==typeof t||void 0===t&&!r)&&(r=t,t=o.Z_FULL_FLUSH),a.ended?r&&e.nextTick(r):a.ending?r&&this.once("end",r):a.needDrain?r&&this.once("drain",(function(){return n.flush(t,r)})):(this._flushFlag=t,this.write(i.alloc(0),"",r))},O.prototype.close=function(t){x(this,t),e.nextTick(P,this)},O.prototype._transform=function(e,t,r){var n,a=this._writableState,s=(a.ending||a.ended)&&(!e||a.length===e.length);return null===e||i.isBuffer(e)?this._handle?(s?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=a.length&&(this._flushFlag=this._opts.flush||o.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},O.prototype._processChunk=function(e,t,r){var n=e&&e.length,o=this._chunkSize-this._offset,a=0,h=this,f="function"==typeof r;if(!f){var l,d=[],p=0;this.on("error",(function(e){l=e})),s(this._handle,"zlib binding closed");do{var m=this._handle.writeSync(t,e,a,n,this._buffer,this._offset,o)}while(!this._hadError&&y(m[0],m[1]));if(this._hadError)throw l;if(p>=u)throw x(this),new RangeError(c);var g=i.concat(d,p);return x(this),g}s(this._handle,"zlib binding closed");var b=this._handle.write(t,e,a,n,this._buffer,this._offset,o);function y(u,c){if(this&&(this.buffer=null,this.callback=null),!h._hadError){var l=o-c;if(s(l>=0,"have should not go down"),l>0){var m=h._buffer.slice(h._offset,h._offset+l);h._offset+=l,f?h.push(m):(d.push(m),p+=m.length)}if((0===c||h._offset>=h._chunkSize)&&(o=h._chunkSize,h._offset=0,h._buffer=i.allocUnsafe(h._chunkSize)),0===c){if(a+=n-u,n=u,!f)return!0;var g=h._handle.write(t,e,a,n,h._buffer,h._offset,h._chunkSize);return g.callback=y,void(g.buffer=e)}if(!f)return!1;r()}}b.buffer=e,b.callback=y},a.inherits(v,O),a.inherits(_,O),a.inherits(w,O),a.inherits(S,O),a.inherits(k,O),a.inherits(I,O),a.inherits(E,O)}).call(this,r(6))},function(e,t,r){"use strict";(function(t){var i=r(2),n=r(64),o=i.PrivateKey,a=i.crypto.Hash,s=i.crypto.ECDSA,u=(i.crypto.Signature,i.util.preconditions);r(3);function c(e,t){return this instanceof c?("string"==typeof e&&(e=o.fromWIF(e)),u.checkArgument(e instanceof o,"Invalid private key"),this.privateKey=e,this.publicKey=e.toPublicKey(),this.options=t||{},this.did=n.fromPrivateKey(e,this.options),this):new c(e,t)}c._sortValue=function(e){return Array.isArray(e)?e.map((function(e){return c._sortValue(e)})):null!==e&&"object"==typeof e?Object.keys(e).sort().reduce((function(t,r){return t[r]=c._sortValue(e[r]),t}),{}):e},c._canonicalizeJSON=function(e){return JSON.stringify(c._sortValue(e))},c._hashCredential=function(e){var r=c._canonicalizeJSON(e);return a.sha256(t.from(r,"utf8"))},c.prototype.createCredential=function(e,t){t=t||{},u.checkArgument(e&&"object"==typeof e,"Invalid credential subject");var r=(new Date).toISOString(),i={"@context":["https://www.w3.org/2018/credentials/v1"],id:t.id||"urn:uuid:"+this._generateUUID(),type:["VerifiableCredential"],issuer:this.did,issuanceDate:r,credentialSubject:e};return t.type&&(Array.isArray(t.type)?i.type=i.type.concat(t.type):i.type.push(t.type)),t.context&&(Array.isArray(t.context)?i["@context"]=i["@context"].concat(t.context):i["@context"].push(t.context)),t.expirationDate&&(i.expirationDate=t.expirationDate),t.termsOfUse&&(i.termsOfUse=t.termsOfUse),t.evidence&&(i.evidence=t.evidence),t.refreshService&&(i.refreshService=t.refreshService),i},c.prototype.signCredential=function(e,t){t=t||{},u.checkArgument(e&&"object"==typeof e,"Invalid credential");var r=JSON.parse(JSON.stringify(e));delete r.proof;var i=c._hashCredential(r),n=new s;n.hashbuf=i,n.privkey=this.privateKey,n.pubkey=this.publicKey,n.sign();var o=n.sig,a=this._createJWSSignature(i,o),h={type:"EcdsaSecp256k1Signature2019",created:(new Date).toISOString(),verificationMethod:this.did+"#keys-1",proofPurpose:t.proofPurpose||"assertionMethod",jws:a};t.challenge&&(h.challenge=t.challenge),t.domain&&(h.domain=t.domain);var f=JSON.parse(JSON.stringify(r));return f.proof=h,f.rootHash=i.toString("hex"),f},c.prototype._createJWSSignature=function(e,r){var i=t.from(JSON.stringify({alg:"ES256K",typ:"JWT"})).toString("base64url");e.toString("base64url");return i+".."+r.toDER().toString("base64url")},c.prototype.createEmailCredential=function(e,r){r=r||{},u.checkArgument("string"==typeof e&&e.includes("@"),"Invalid email address");var i={id:r.subjectId||"did:smartledger:"+a.sha256(t.from(e)).toString("hex"),email:e,verified:!0,verificationMethod:"email_verification",verificationTimestamp:(new Date).toISOString()},n={type:"EmailVerifiedCredential",context:"https://smartledger.technology/contexts/email/v1",...r},o=this.createCredential(i,n);return this.signCredential(o,r)},c.prototype.createAgeCredential=function(e,r,i){i=i||{},u.checkArgument("number"==typeof e&&e>0,"Invalid age");var n={id:i.subjectId||"urn:uuid:"+this._generateUUID(),ageOver:e,verified:!0,verificationMethod:"age_verification"};r&&(n.birthDateHash=a.sha256(t.from(r.toISOString())).toString("hex"));var o={type:"AgeVerifiedCredential",context:"https://smartledger.technology/contexts/age/v1",...i},s=this.createCredential(n,o);return this.signCredential(s,i)},c.prototype.createKYCCredential=function(e,r){r=r||{},u.checkArgument(e&&"object"==typeof e,"Invalid KYC data");var i={id:r.subjectId||"urn:uuid:"+this._generateUUID(),kycLevel:e.level||"basic",verified:!0,verificationMethod:"kyc_verification",verificationTimestamp:(new Date).toISOString(),verifyingAuthority:e.authority||this.did};e.firstName&&(i.firstNameHash=a.sha256(t.from(e.firstName)).toString("hex")),e.lastName&&(i.lastNameHash=a.sha256(t.from(e.lastName)).toString("hex")),e.ssn&&(i.ssnHash=a.sha256(t.from(e.ssn)).toString("hex"));var n={type:"KYCVerifiedCredential",context:"https://smartledger.technology/contexts/kyc/v1",...r},o=this.createCredential(i,n);return this.signCredential(o,r)},c.prototype.createOrganizationCredential=function(e,r){r=r||{},u.checkArgument(e&&"object"==typeof e,"Invalid organization data");var i={id:r.subjectId||"did:smartledger:org:"+a.sha256(t.from(e.name||"")).toString("hex"),name:e.name,type:e.type||"Organization",verified:!0,verificationMethod:"organization_verification",verificationTimestamp:(new Date).toISOString()};e.taxId&&(i.taxIdHash=a.sha256(t.from(e.taxId)).toString("hex")),e.incorporationState&&(i.incorporationState=e.incorporationState),e.industry&&(i.industry=e.industry);var n={type:"OrganizationCredential",context:"https://smartledger.technology/contexts/organization/v1",...r},o=this.createCredential(i,n);return this.signCredential(o,r)},c.prototype._generateUUID=function(){var e=i.crypto.Random.getRandomBuffer(16);e[6]=15&e[6]|64,e[8]=63&e[8]|128;var t=e.toString("hex");return[t.substring(0,8),t.substring(8,12),t.substring(12,16),t.substring(16,20),t.substring(20,32)].join("-")},c.prototype.createPresentation=function(e,t){t=t||{},u.checkArgument(Array.isArray(e),"Credentials must be an array");var r={"@context":["https://www.w3.org/2018/credentials/v1"],type:["VerifiablePresentation"],id:t.id||"urn:uuid:"+this._generateUUID(),holder:this.did,verifiableCredential:e};t.context&&(Array.isArray(t.context)?r["@context"]=r["@context"].concat(t.context):r["@context"].push(t.context));var i=c._hashCredential(r),n=new s;n.hashbuf=i,n.privkey=this.privateKey,n.pubkey=this.publicKey,n.sign();var o=n.sig,a=this._createJWSSignature(i,o),h={type:"EcdsaSecp256k1Signature2019",created:(new Date).toISOString(),verificationMethod:this.did+"#keys-1",proofPurpose:"authentication",jws:a};return t.challenge&&(h.challenge=t.challenge),t.domain&&(h.domain=t.domain),r.proof=h,r},c.prototype.getIssuerInfo=function(){return{did:this.did,publicKey:this.publicKey.toString("hex"),verificationMethod:this.did+"#keys-1"}},e.exports=c}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var i=r(64),n=r(96),o=r(355),a=r(356),s=r(357),u=r(358);function c(e){if(!(this instanceof c))return new c(e);e=e||{},this.didResolver=i,this.attestationVerifier=o,this.zkProver=a,this.schemaValidator=u,this._attestationSignerOptions=e.attestationSigner||{},this._anchorOptions=e.anchor||{}}c.prototype.createDID=function(e){return this.didResolver.fromPublicKey(e)},c.prototype.resolveDID=function(e){return this.didResolver.resolve(e)},c.prototype.verifyDIDOwnership=function(e,t){return this.didResolver.verifyOwnership(e,t)},c.prototype.createEmailCredential=function(e,t,r,i){return new n(i,this._attestationSignerOptions).createEmailCredential(r,{issuerDID:e,subjectId:t})},c.prototype.createAgeCredential=function(e,t,r,i,o){return new n(o,this._attestationSignerOptions).createAgeCredential(r,i,{issuerDID:e,subjectId:t})},c.prototype.createKYCCredential=function(e,t,r,i,o){var a=new n(o,this._attestationSignerOptions),s=Object.assign({level:r},i);return a.createKYCCredential(s,{issuerDID:e,subjectId:t})},c.prototype.createOrganizationCredential=function(e,t,r,i){return new n(i,this._attestationSignerOptions).createOrganizationCredential(r,{issuerDID:e,subjectId:t})},c.prototype.createPresentation=function(e,t,r,i){return new n(r,this._attestationSignerOptions).createPresentation(e,t,r,i)},c.prototype.signCredential=function(e,t){return new n(t,this._attestationSignerOptions).signCredential(e,t)},c.prototype.verifyCredential=function(e,t){return this.attestationVerifier.verifyCredential(e,t)},c.prototype.verifyPresentation=function(e,t){return this.attestationVerifier.verifyPresentation(e,t)},c.prototype.extractClaims=function(e){return this.attestationVerifier.extractClaims(e)},c.prototype.generateSelectiveProof=function(e,t,r){return this.zkProver.generateSelectiveProof(e,t,r)},c.prototype.verifySelectiveProof=function(e,t){return this.zkProver.verifySelectiveProof(e,t)},c.prototype.generateAgeProof=function(e,t,r){var i=new Date("1995-06-15");return this.zkProver.generateAgeProof(i,t,r)},c.prototype.verifyAgeProof=function(e,t,r){return this.zkProver.verifyAgeProof(e,t,r)},c.prototype.generateRangeProof=function(e,t,r,i){return this.zkProver.generateRangeProof(e,t,r,i)},c.prototype.verifyRangeProof=function(e,t,r){return this.zkProver.verifyRangeProof(e,t,r)},c.prototype.generateMembershipProof=function(e,t,r){return this.zkProver.generateMembershipProof(e,t,r)},c.prototype.verifyMembershipProof=function(e,t){return this.zkProver.verifyMembershipProof(e,t)},c.prototype.anchorCredential=function(e,t,r){return new s(t,this._anchorOptions).anchorCredential(e,t,r)},c.prototype.anchorBatch=function(e,t,r){return new s(t,this._anchorOptions).anchorBatch(e,t,r)},c.prototype.registerDID=function(e,t,r,i){return new s(r,this._anchorOptions).registerDID(e,t,r,i)},c.prototype.revokeCredential=function(e,t,r,i){return new s(r,this._anchorOptions).revokeCredential(e,t,r,i)},c.prototype.queryAnchoredData=function(e){return new s(null,this._anchorOptions).queryAnchoredData(e)},c.prototype.validateCredential=function(e,t){return this.schemaValidator.validate(e,t)},c.prototype.getSchema=function(e){return this.schemaValidator.getSchema(e)},c.prototype.getAllSchemas=function(){return this.schemaValidator.getAllSchemas()},c.prototype.addSchema=function(e,t){return this.schemaValidator.addSchema(e,t)},c.prototype.createTemplate=function(e){return this.schemaValidator.createTemplate(e)},c.prototype.generateNonce=function(e){return e=e||32,r(9).randomBytes(e).toString("hex")},c.prototype.hashData=function(e,t){var i=r(9).createHash("sha256");return i.update(e),t&&i.update(t),i.digest("hex")},c.prototype.getVersion=function(){return"1.0.0"},c.prototype.getInfo=function(){return{name:"SmartLedger BSV Global Digital Attestation Framework",version:this.getVersion(),description:"W3C-compliant verifiable credentials with DID resolution, zero-knowledge proofs, and blockchain anchoring",components:{didResolver:"DID Resolution and Management",attestationSigner:"Verifiable Credential Creation",attestationVerifier:"Credential and Presentation Verification",zkProver:"Zero-Knowledge Proof Generation and Verification",anchor:"Blockchain Anchoring and Timestamping",schemaValidator:"W3C VC Schema Validation"},standards:["W3C Verifiable Credentials Data Model v1.1","W3C Decentralized Identifiers (DIDs) v1.0","RFC 7515 JSON Web Signature (JWS)","BSV Blockchain Protocol"]}},e.exports=c},function(e,t,r){"use strict";(function(t,i){var n=r(52);e.exports=v;var o,a=r(163);v.ReadableState=y;r(67).EventEmitter;var s=function(e,t){return e.listeners(t).length},u=r(99),c=r(68).Buffer,h=(void 0!==t?t:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var f=Object.create(r(39));f.inherits=r(4);var l=r(164),d=void 0;d=l&&l.debuglog?l.debuglog("stream"):function(){};var p,m=r(165),g=r(100);f.inherits(v,u);var b=["error","close","destroy","pause","resume"];function y(e,t){e=e||{};var i=t instanceof(o=o||r(28));this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,a=e.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(a||0===a)?a:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(p||(p=r(70).StringDecoder),this.decoder=new p(e.encoding),this.encoding=e.encoding)}function v(e){if(o=o||r(28),!(this instanceof v))return new v(e);this._readableState=new y(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),u.call(this)}function _(e,t,r,i,n){var o,a=e._readableState;null===t?(a.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,k(e)}(e,a)):(n||(o=function(e,t){var r;i=t,c.isBuffer(i)||i instanceof h||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var i;return r}(a,t)),o?e.emit("error",o):a.objectMode||t&&t.length>0?("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),i?a.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):w(e,a,t,!0):a.ended?e.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!r?(t=a.decoder.write(t),a.objectMode||0!==t.length?w(e,a,t,!1):E(e,a)):w(e,a,t,!1))):i||(a.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(a)}function w(e,t,r,i){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&k(e)),E(e,t)}Object.defineProperty(v.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),v.prototype.destroy=g.destroy,v.prototype._undestroy=g.undestroy,v.prototype._destroy=function(e,t){this.push(null),t(e)},v.prototype.push=function(e,t){var r,i=this._readableState;return i.objectMode?r=!0:"string"==typeof e&&((t=t||i.defaultEncoding)!==i.encoding&&(e=c.from(e,t),t=""),r=!0),_(this,e,t,!1,r)},v.prototype.unshift=function(e){return _(this,e,null,!0,!1)},v.prototype.isPaused=function(){return!1===this._readableState.flowing},v.prototype.setEncoding=function(e){return p||(p=r(70).StringDecoder),this._readableState.decoder=new p(e),this._readableState.encoding=e,this};function S(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function k(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?n.nextTick(I,e):I(e))}function I(e){d("emit readable"),e.emit("readable"),P(e)}function E(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(A,e,t))}function A(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(d("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}function O(e){d("readable nexttick read 0"),e.read(0)}function x(e,t){t.reading||(d("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),P(e),t.flowing&&!t.reading&&e.read(0)}function P(e){var t=e._readableState;for(d("flow",t.flowing);t.flowing&&null!==e.read(););}function M(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.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var i;e<t.head.data.length?(i=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):i=e===t.head.data.length?t.shift():r?function(e,t){var r=t.head,i=1,n=r.data;e-=n.length;for(;r=r.next;){var o=r.data,a=e>o.length?o.length:e;if(a===o.length?n+=o:n+=o.slice(0,e),0===(e-=a)){a===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++i}return t.length-=i,n}(e,t):function(e,t){var r=c.allocUnsafe(e),i=t.head,n=1;i.data.copy(r),e-=i.data.length;for(;i=i.next;){var o=i.data,a=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,a),0===(e-=a)){a===o.length?(++n,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=o.slice(a));break}++n}return t.length-=n,r}(e,t);return i}(e,t.buffer,t.decoder),r);var r}function T(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,n.nextTick(R,t,e))}function R(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function B(e,t){for(var r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1}v.prototype.read=function(e){d("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return d("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?T(this):k(this),null;if(0===(e=S(e,t))&&t.ended)return 0===t.length&&T(this),null;var i,n=t.needReadable;return d("need readable",n),(0===t.length||t.length-e<t.highWaterMark)&&d("length less than watermark",n=!0),t.ended||t.reading?d("reading or ended",n=!1):n&&(d("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=S(r,t))),null===(i=e>0?M(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&T(this)),null!==i&&this.emit("data",i),i},v.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},v.prototype.pipe=function(e,t){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,d("pipe count=%d opts=%j",o.pipesCount,t);var u=(!t||!1!==t.end)&&e!==i.stdout&&e!==i.stderr?h:v;function c(t,i){d("onunpipe"),t===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,d("cleanup"),e.removeListener("close",b),e.removeListener("finish",y),e.removeListener("drain",f),e.removeListener("error",g),e.removeListener("unpipe",c),r.removeListener("end",h),r.removeListener("end",v),r.removeListener("data",m),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function h(){d("onend"),e.end()}o.endEmitted?n.nextTick(u):r.once("end",u),e.on("unpipe",c);var f=function(e){return function(){var t=e._readableState;d("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,P(e))}}(r);e.on("drain",f);var l=!1;var p=!1;function m(t){d("ondata"),p=!1,!1!==e.write(t)||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==B(o.pipes,e))&&!l&&(d("false write response, pause",o.awaitDrain),o.awaitDrain++,p=!0),r.pause())}function g(t){d("onerror",t),v(),e.removeListener("error",g),0===s(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",y),v()}function y(){d("onfinish"),e.removeListener("close",b),v()}function v(){d("unpipe"),r.unpipe(e)}return r.on("data",m),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?a(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",g),e.once("close",b),e.once("finish",y),e.emit("pipe",r),o.flowing||(d("pipe resume"),r.resume()),e},v.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 i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<n;o++)i[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=B(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},v.prototype.on=function(e,t){var r=u.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var i=this._readableState;i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.emittedReadable=!1,i.reading?i.length&&k(this):n.nextTick(O,this))}return r},v.prototype.addListener=v.prototype.on,v.prototype.resume=function(){var e=this._readableState;return e.flowing||(d("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(x,e,t))}(this,e)),this},v.prototype.pause=function(){return d("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(d("pause"),this._readableState.flowing=!1,this.emit("pause")),this},v.prototype.wrap=function(e){var t=this,r=this._readableState,i=!1;for(var n in e.on("end",(function(){if(d("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){(d("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(i=!0,e.pause()))})),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function(t){return function(){return e[t].apply(e,arguments)}}(n));for(var o=0;o<b.length;o++)e.on(b[o],this.emit.bind(this,b[o]));return this._read=function(t){d("wrapped _read",t),i&&(i=!1,e.resume())},this},Object.defineProperty(v.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),v._fromList=M}).call(this,r(13),r(6))},function(e,t,r){e.exports=r(67).EventEmitter},function(e,t,r){"use strict";var i=r(52);function n(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var r=this,o=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return o||a?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,i.nextTick(n,this,e)):i.nextTick(n,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||(r._writableState.errorEmitted=!0,i.nextTick(n,r,e)):i.nextTick(n,r,e):t&&t(e)})),this)},undestroy:function(){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)}}},function(e,t,r){"use strict";e.exports=a;var i=r(28),n=Object.create(r(39));function o(e,t){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),i(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function a(e){if(!(this instanceof a))return new a(e);i.call(this,e),this._transformState={afterTransform:o.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",s)}function s(){var e=this;"function"==typeof this._flush?this._flush((function(t,r){u(e,t,r)})):u(this,null,null)}function u(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}n.inherits=r(4),n.inherits(a,i),a.prototype.push=function(e,t){return this._transformState.needTransform=!1,i.prototype.push.call(this,e,t)},a.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")},a.prototype._write=function(e,t,r){var i=this._transformState;if(i.writecb=r,i.writechunk=e,i.writeencoding=t,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},a.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},a.prototype._destroy=function(e,t){var r=this;i.prototype._destroy.call(this,e,(function(e){t(e),r.emit("close")}))}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){"use strict";var i=r(73),n=r(181),o=r(182),a=r(183),s=r(184),u=r(104),c=r(40),h=r(185),f=r(186),l=r(187),d=r(188),p=r(189),m=r(190),g=r(191),b=r(192),y=Function,v=function(e){try{return y('"use strict"; return ('+e+").constructor;")()}catch(e){}},_=r(41),w=r(54),S=function(){throw new c},k=_?function(){try{return S}catch(e){try{return _(arguments,"callee").get}catch(e){return S}}}():S,I=r(195)(),E=r(105),A=r(107),O=r(106),x=r(77),P=r(76),M={},T="undefined"!=typeof Uint8Array&&E?E(Uint8Array):void 0,R={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?void 0:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer,"%ArrayIteratorPrototype%":I&&E?E([][Symbol.iterator]()):void 0,"%AsyncFromSyncIteratorPrototype%":void 0,"%AsyncFunction%":M,"%AsyncGenerator%":M,"%AsyncGeneratorFunction%":M,"%AsyncIteratorPrototype%":M,"%Atomics%":"undefined"==typeof Atomics?void 0:Atomics,"%BigInt%":"undefined"==typeof BigInt?void 0:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?void 0:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?void 0:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?void 0:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":n,"%eval%":eval,"%EvalError%":o,"%Float16Array%":"undefined"==typeof Float16Array?void 0:Float16Array,"%Float32Array%":"undefined"==typeof Float32Array?void 0:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?void 0:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?void 0:FinalizationRegistry,"%Function%":y,"%GeneratorFunction%":M,"%Int8Array%":"undefined"==typeof Int8Array?void 0:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?void 0:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?void 0:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":I&&E?E(E([][Symbol.iterator]())):void 0,"%JSON%":"object"==typeof JSON?JSON:void 0,"%Map%":"undefined"==typeof Map?void 0:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&I&&E?E((new Map)[Symbol.iterator]()):void 0,"%Math%":Math,"%Number%":Number,"%Object%":i,"%Object.getOwnPropertyDescriptor%":_,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?void 0:Promise,"%Proxy%":"undefined"==typeof Proxy?void 0:Proxy,"%RangeError%":a,"%ReferenceError%":s,"%Reflect%":"undefined"==typeof Reflect?void 0:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?void 0:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&I&&E?E((new Set)[Symbol.iterator]()):void 0,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":I&&E?E(""[Symbol.iterator]()):void 0,"%Symbol%":I?Symbol:void 0,"%SyntaxError%":u,"%ThrowTypeError%":k,"%TypedArray%":T,"%TypeError%":c,"%Uint8Array%":"undefined"==typeof Uint8Array?void 0:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?void 0:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?void 0:Uint32Array,"%URIError%":h,"%WeakMap%":"undefined"==typeof WeakMap?void 0:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?void 0:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?void 0:WeakSet,"%Function.prototype.call%":P,"%Function.prototype.apply%":x,"%Object.defineProperty%":w,"%Object.getPrototypeOf%":A,"%Math.abs%":f,"%Math.floor%":l,"%Math.max%":d,"%Math.min%":p,"%Math.pow%":m,"%Math.round%":g,"%Math.sign%":b,"%Reflect.getPrototypeOf%":O};if(E)try{null.error}catch(e){var B=E(E(e));R["%Error.prototype%"]=B}var N={__proto__:null,"%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"]},C=r(42),D=r(199),j=C.call(P,Array.prototype.concat),L=C.call(x,Array.prototype.splice),U=C.call(P,String.prototype.replace),H=C.call(P,String.prototype.slice),z=C.call(P,RegExp.prototype.exec),F=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,K=/\\(\\)?/g,V=function(e){var t=H(e,0,1),r=H(e,-1);if("%"===t&&"%"!==r)throw new u("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new u("invalid intrinsic syntax, expected opening `%`");var i=[];return U(e,F,(function(e,t,r,n){i[i.length]=r?U(n,K,"$1"):t||e})),i},q=function(e,t){var r,i=e;if(D(N,i)&&(i="%"+(r=N[i])[0]+"%"),D(R,i)){var n=R[i];if(n===M&&(n=function e(t){var r;if("%AsyncFunction%"===t)r=v("async function () {}");else if("%GeneratorFunction%"===t)r=v("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=v("async function* () {}");else if("%AsyncGenerator%"===t){var i=e("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if("%AsyncIteratorPrototype%"===t){var n=e("%AsyncGenerator%");n&&E&&(r=E(n.prototype))}return R[t]=r,r}(i)),void 0===n&&!t)throw new c("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:i,value:n}}throw new u("intrinsic "+e+" does not exist!")};e.exports=function(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');if(null===z(/^%?[^%]*%?$/,e))throw new u("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=V(e),i=r.length>0?r[0]:"",n=q("%"+i+"%",t),o=n.name,a=n.value,s=!1,h=n.alias;h&&(i=h[0],L(r,j([0,1],h)));for(var f=1,l=!0;f<r.length;f+=1){var d=r[f],p=H(d,0,1),m=H(d,-1);if(('"'===p||"'"===p||"`"===p||'"'===m||"'"===m||"`"===m)&&p!==m)throw new u("property names with quotes must have matching quotes");if("constructor"!==d&&l||(s=!0),D(R,o="%"+(i+="."+d)+"%"))a=R[o];else if(null!=a){if(!(d in a)){if(!t)throw new c("base intrinsic for "+e+" exists, but the property is not available.");return}if(_&&f+1>=r.length){var g=_(a,d);a=(l=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:a[d]}else l=D(a,d),a=a[d];l&&!s&&(R[o]=a)}}return a}},function(e,t,r){"use strict";e.exports=SyntaxError},function(e,t,r){"use strict";var i=r(106),n=r(107),o=r(196);e.exports=i?function(e){return i(e)}:n?function(e){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new TypeError("getProto: not an object");return n(e)}:o?function(e){return o(e)}:null},function(e,t,r){"use strict";e.exports="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null},function(e,t,r){"use strict";var i=r(73);e.exports=i.getPrototypeOf||null},function(e,t,r){"use strict";var i=r(42),n=r(77),o=r(76),a=r(198);e.exports=a||i.call(o,n)},function(e,t,r){"use strict";var i=r(34),n=r(35),o=r(1).Buffer,a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function u(){this.init(),this._w=s,n.call(this,64,56)}function c(e,t,r){return r^e&(t^r)}function h(e,t,r){return e&t|r&(e|t)}function f(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function l(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function d(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}i(u,n),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(e){for(var t,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,p=0|this._f,m=0|this._g,g=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]+d(r[b-15])+r[b-16];for(var y=0;y<64;++y){var v=g+l(u)+c(u,p,m)+a[y]+r[y]|0,_=f(i)+h(i,n,o)|0;g=m,m=p,p=u,u=s+v|0,s=o,o=n,n=i,i=v+_|0}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0,this._f=p+this._f|0,this._g=m+this._g|0,this._h=g+this._h|0},u.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=u},function(e,t,r){"use strict";var i=r(34),n=r(35),o=r(1).Buffer,a=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],s=new Array(160);function u(){this.init(),this._w=s,n.call(this,128,112)}function c(e,t,r){return r^e&(t^r)}function h(e,t,r){return e&t|r&(e|t)}function f(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function l(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function d(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function p(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function m(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function g(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function b(e,t){return e>>>0<t>>>0?1:0}i(u,n),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(e){for(var t=this._w,r=0|this._ah,i=0|this._bh,n=0|this._ch,o=0|this._dh,s=0|this._eh,u=0|this._fh,y=0|this._gh,v=0|this._hh,_=0|this._al,w=0|this._bl,S=0|this._cl,k=0|this._dl,I=0|this._el,E=0|this._fl,A=0|this._gl,O=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 P=t[x-30],M=t[x-30+1],T=d(P,M),R=p(M,P),B=m(P=t[x-4],M=t[x-4+1]),N=g(M,P),C=t[x-14],D=t[x-14+1],j=t[x-32],L=t[x-32+1],U=R+D|0,H=T+C+b(U,R)|0;H=(H=H+B+b(U=U+N|0,N)|0)+j+b(U=U+L|0,L)|0,t[x]=H,t[x+1]=U}for(var z=0;z<160;z+=2){H=t[z],U=t[z+1];var F=h(r,i,n),K=h(_,w,S),V=f(r,_),q=f(_,r),G=l(s,I),Y=l(I,s),Z=a[z],W=a[z+1],X=c(s,u,y),J=c(I,E,A),$=O+Y|0,Q=v+G+b($,O)|0;Q=(Q=(Q=Q+X+b($=$+J|0,J)|0)+Z+b($=$+W|0,W)|0)+H+b($=$+U|0,U)|0;var ee=q+K|0,te=V+F+b(ee,q)|0;v=y,O=A,y=u,A=E,u=s,E=I,s=o+Q+b(I=k+$|0,k)|0,o=n,k=S,n=i,S=w,i=r,w=_,r=Q+te+b(_=$+ee|0,$)|0}this._al=this._al+_|0,this._bl=this._bl+w|0,this._cl=this._cl+S|0,this._dl=this._dl+k|0,this._el=this._el+I|0,this._fl=this._fl+E|0,this._gl=this._gl+A|0,this._hl=this._hl+O|0,this._ah=this._ah+r+b(this._al,_)|0,this._bh=this._bh+i+b(this._bl,w)|0,this._ch=this._ch+n+b(this._cl,S)|0,this._dh=this._dh+o+b(this._dl,k)|0,this._eh=this._eh+s+b(this._el,I)|0,this._fh=this._fh+u+b(this._fl,E)|0,this._gh=this._gh+y+b(this._gl,A)|0,this._hh=this._hh+v+b(this._hl,O)|0},u.prototype._hash=function(){var e=o.allocUnsafe(64);function t(t,r,i){e.writeInt32BE(t,i),e.writeInt32BE(r,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},e.exports=u},function(e,t,r){"use strict";var i=r(4),n=r(217),o=r(23),a=r(1).Buffer,s=r(112),u=r(71),c=r(78),h=a.alloc(128);function f(e,t){o.call(this,"digest"),"string"==typeof t&&(t=a.from(t));var r="sha512"===e||"sha384"===e?128:64;(this._alg=e,this._key=t,t.length>r)?t=("rmd160"===e?new u:c(e)).update(t).digest():t.length<r&&(t=a.concat([t,h],r));for(var i=this._ipad=a.allocUnsafe(r),n=this._opad=a.allocUnsafe(r),s=0;s<r;s++)i[s]=54^t[s],n[s]=92^t[s];this._hash="rmd160"===e?new u:c(e),this._hash.update(i)}i(f,o),f.prototype._update=function(e){this._hash.update(e)},f.prototype._final=function(){var e=this._hash.digest();return("rmd160"===this._alg?new u:c(this._alg)).update(this._opad).update(e).digest()},e.exports=function(e,t){return"rmd160"===(e=e.toLowerCase())||"ripemd160"===e?new f("rmd160",t):"md5"===e?new n(s,t):new f(e,t)}},function(e,t,r){var i=r(65);e.exports=function(e){return(new i).update(e).digest()}},function(e){e.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}},function(e,t,r){"use strict";t.pbkdf2=r(219),t.pbkdf2Sync=r(117)},function(e,t,r){"use strict";var i=isFinite,n=Math.pow(2,30)-1;e.exports=function(e,t){if("number"!=typeof e)throw new TypeError("Iterations not a number");if(e<0||!i(e))throw new TypeError("Bad iterations");if("number"!=typeof t)throw new TypeError("Key length not a number");if(t<0||t>n||t!=t)throw new TypeError("Bad key length")}},function(e,t,r){"use strict";(function(t,r){var i;if(t.process&&t.process.browser)i="utf-8";else if(t.process&&t.process.version){i=parseInt(r.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else i="utf-8";e.exports=i}).call(this,r(13),r(6))},function(e,t,r){"use strict";var i=r(112),n=r(71),o=r(78),a=r(1).Buffer,s=r(115),u=r(116),c=r(118),h=a.alloc(128),f={__proto__:null,md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,"sha512-256":32,ripemd160:20,rmd160:20},l={__proto__:null,"sha-1":"sha1","sha-224":"sha224","sha-256":"sha256","sha-384":"sha384","sha-512":"sha512","ripemd-160":"ripemd160"};function d(e){return(new n).update(e).digest()}function p(e,t,r){var n=function(e){return"rmd160"===e||"ripemd160"===e?d:"md5"===e?i:function(t){return o(e).update(t).digest()}}(e),s="sha512"===e||"sha384"===e?128:64;t.length>s?t=n(t):t.length<s&&(t=a.concat([t,h],s));for(var u=a.allocUnsafe(s+f[e]),c=a.allocUnsafe(s+f[e]),l=0;l<s;l++)u[l]=54^t[l],c[l]=92^t[l];var p=a.allocUnsafe(s+r+4);u.copy(p,0,0,s),this.ipad1=p,this.ipad2=u,this.opad=c,this.alg=e,this.blocksize=s,this.hash=n,this.size=f[e]}p.prototype.run=function(e,t){return e.copy(t,this.blocksize),this.hash(t).copy(this.opad,this.blocksize),this.hash(this.opad)},e.exports=function(e,t,r,i,n){s(r,i),e=c(e,u,"Password"),t=c(t,u,"Salt");var o=(n||"sha1").toLowerCase(),h=l[o]||o,d=f[h];if("number"!=typeof d||!d)throw new TypeError("Digest algorithm not supported: "+n);var m=new p(h,e,t.length),g=a.allocUnsafe(i),b=a.allocUnsafe(t.length+4);t.copy(b,0,0,t.length);for(var y=0,v=d,_=Math.ceil(i/v),w=1;w<=_;w++){b.writeUInt32BE(w,t.length);for(var S=m.run(b,m.ipad1),k=S,I=1;I<r;I++){k=m.run(k,m.ipad2);for(var E=0;E<v;E++)S[E]^=k[E]}S.copy(g,y),y+=v}return g}},function(e,t,r){"use strict";var i=r(1).Buffer,n=r(53),o="undefined"!=typeof Uint8Array,a=o&&"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView;e.exports=function(e,t,r){if("string"==typeof e||i.isBuffer(e)||o&&e instanceof Uint8Array||a&&a(e))return n(e,t);throw new TypeError(r+" must be a string, a Buffer, a Uint8Array, or a DataView")}},function(e,t,r){"use strict";t.readUInt32BE=function(e,t){return(e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])>>>0},t.writeUInt32BE=function(e,t,r){e[0+r]=t>>>24,e[1+r]=t>>>16&255,e[2+r]=t>>>8&255,e[3+r]=255&t},t.ip=function(e,t,r,i){for(var n=0,o=0,a=6;a>=0;a-=2){for(var s=0;s<=24;s+=8)n<<=1,n|=t>>>s+a&1;for(s=0;s<=24;s+=8)n<<=1,n|=e>>>s+a&1}for(a=6;a>=0;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1}r[i+0]=n>>>0,r[i+1]=o>>>0},t.rip=function(e,t,r,i){for(var n=0,o=0,a=0;a<4;a++)for(var s=24;s>=0;s-=8)n<<=1,n|=t>>>s+a&1,n<<=1,n|=e>>>s+a&1;for(a=4;a<8;a++)for(s=24;s>=0;s-=8)o<<=1,o|=t>>>s+a&1,o<<=1,o|=e>>>s+a&1;r[i+0]=n>>>0,r[i+1]=o>>>0},t.pc1=function(e,t,r,i){for(var n=0,o=0,a=7;a>=5;a--){for(var s=0;s<=24;s+=8)n<<=1,n|=t>>s+a&1;for(s=0;s<=24;s+=8)n<<=1,n|=e>>s+a&1}for(s=0;s<=24;s+=8)n<<=1,n|=t>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;r[i+0]=n>>>0,r[i+1]=o>>>0},t.r28shl=function(e,t){return e<<t&268435455|e>>>28-t};var i=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];t.pc2=function(e,t,r,n){for(var o=0,a=0,s=i.length>>>1,u=0;u<s;u++)o<<=1,o|=e>>>i[u]&1;for(u=s;u<i.length;u++)a<<=1,a|=t>>>i[u]&1;r[n+0]=o>>>0,r[n+1]=a>>>0},t.expand=function(e,t,r){var i=0,n=0;i=(1&e)<<5|e>>>27;for(var o=23;o>=15;o-=4)i<<=6,i|=e>>>o&63;for(o=11;o>=3;o-=4)n|=e>>>o&63,n<<=6;n|=(31&e)<<1|e>>>31,t[r+0]=i>>>0,t[r+1]=n>>>0};var n=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];t.substitute=function(e,t){for(var r=0,i=0;i<4;i++){r<<=4,r|=n[64*i+(e>>>18-6*i&63)]}for(i=0;i<4;i++){r<<=4,r|=n[256+64*i+(t>>>18-6*i&63)]}return r>>>0};var o=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];t.permute=function(e){for(var t=0,r=0;r<o.length;r++)t<<=1,t|=e>>>o[r]&1;return t>>>0},t.padSplit=function(e,t,r){for(var i=e.toString(2);i.length<t;)i="0"+i;for(var n=[],o=0;o<t;o+=r)n.push(i.slice(o,o+r));return n.join(" ")}},function(e,t,r){"use strict";var i=r(14),n=r(4),o=r(119),a=r(79);function s(){this.tmp=new Array(2),this.keys=null}function u(e){a.call(this,e);var t=new s;this._desState=t,this.deriveKeys(t,e.key)}n(u,a),e.exports=u,u.create=function(e){return new u(e)};var c=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];u.prototype.deriveKeys=function(e,t){e.keys=new Array(32),i.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 a=0;a<e.keys.length;a+=2){var s=c[a>>>1];r=o.r28shl(r,s),n=o.r28shl(n,s),o.pc2(r,n,e.keys,a)}},u.prototype._update=function(e,t,r,i){var n=this._desState,a=o.readUInt32BE(e,t),s=o.readUInt32BE(e,t+4);o.ip(a,s,n.tmp,0),a=n.tmp[0],s=n.tmp[1],"encrypt"===this.type?this._encrypt(n,a,s,n.tmp,0):this._decrypt(n,a,s,n.tmp,0),a=n.tmp[0],s=n.tmp[1],o.writeUInt32BE(r,a,i),o.writeUInt32BE(r,s,i+4)},u.prototype._pad=function(e,t){if(!1===this.padding)return!1;for(var r=e.length-t,i=t;i<e.length;i++)e[i]=r;return!0},u.prototype._unpad=function(e){if(!1===this.padding)return e;for(var t=e[e.length-1],r=e.length-t;r<e.length;r++)i.equal(e[r],t);return e.slice(0,e.length-t)},u.prototype._encrypt=function(e,t,r,i,n){for(var a=t,s=r,u=0;u<e.keys.length;u+=2){var c=e.keys[u],h=e.keys[u+1];o.expand(s,e.tmp,0),c^=e.tmp[0],h^=e.tmp[1];var f=o.substitute(c,h),l=s;s=(a^o.permute(f))>>>0,a=l}o.rip(s,a,i,n)},u.prototype._decrypt=function(e,t,r,i,n){for(var a=r,s=t,u=e.keys.length-2;u>=0;u-=2){var c=e.keys[u],h=e.keys[u+1];o.expand(a,e.tmp,0),c^=e.tmp[0],h^=e.tmp[1];var f=o.substitute(c,h),l=a;a=(s^o.permute(f))>>>0,s=l}o.rip(a,s,i,n)}},function(e,t,r){var i=r(43),n=r(1).Buffer,o=r(122);function a(e){var t=e._cipher.encryptBlockRaw(e._prev);return o(e._prev),t}t.encrypt=function(e,t){var r=Math.ceil(t.length/16),o=e._cache.length;e._cache=n.concat([e._cache,n.allocUnsafe(16*r)]);for(var s=0;s<r;s++){var u=a(e),c=o+16*s;e._cache.writeUInt32BE(u[0],c+0),e._cache.writeUInt32BE(u[1],c+4),e._cache.writeUInt32BE(u[2],c+8),e._cache.writeUInt32BE(u[3],c+12)}var h=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),i(t,h)}},function(e,t){e.exports=function(e){for(var t,r=e.length;r--;){if(255!==(t=e.readUInt8(r))){t++,e.writeUInt8(t,r);break}e.writeUInt8(0,r)}}},function(e){e.exports={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192:{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256:{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}}},function(e,t,r){var i=r(55),n=r(1).Buffer,o=r(23),a=r(4),s=r(232),u=r(43),c=r(122);function h(e,t,r,a){o.call(this);var u=n.alloc(4,0);this._cipher=new i.AES(t);var h=this._cipher.encryptBlock(u);this._ghash=new s(h),r=function(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 i=new s(r),o=t.length,a=o%16;i.update(t),a&&(a=16-a,i.update(n.alloc(a,0))),i.update(n.alloc(8,0));var u=8*o,h=n.alloc(8);h.writeUIntBE(u,0,8),i.update(h),e._finID=i.state;var f=n.from(e._finID);return c(f),f}(this,r,h),this._prev=n.from(r),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=a,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}a(h,o),h.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},h.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=u(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var r=0;e.length!==t.length&&r++;for(var i=Math.min(e.length,t.length),n=0;n<i;++n)r+=e[n]^t[n];return r}(e,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=e,this._cipher.scrub()},h.prototype.getAuthTag=function(){if(this._decrypt||!n.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},h.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=e},h.prototype.setAAD=function(e){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(e),this._alen+=e.length},e.exports=h},function(e,t,r){var i=r(55),n=r(1).Buffer,o=r(23);function a(e,t,r,a){o.call(this),this._cipher=new i.AES(t),this._prev=n.from(r),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=a,this._mode=e}r(4)(a,o),a.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},a.prototype._final=function(){this._cipher.scrub()},e.exports=a},function(e,t,r){var i=r(33);e.exports=y,y.simpleSieve=g,y.fermatTest=b;var n=r(7),o=new n(24),a=new(r(127)),s=new n(1),u=new n(2),c=new n(5),h=(new n(16),new n(8),new n(10)),f=new n(3),l=(new n(7),new n(11)),d=new n(4),p=(new n(12),null);function m(){if(null!==p)return p;var e=[];e[0]=2;for(var t=1,r=3;r<1048576;r+=2){for(var i=Math.ceil(Math.sqrt(r)),n=0;n<t&&e[n]<=i&&r%e[n]!=0;n++);t!==n&&e[n]<=i||(e[t++]=r)}return p=e,e}function g(e){for(var t=m(),r=0;r<t.length;r++)if(0===e.modn(t[r]))return 0===e.cmpn(t[r]);return!0}function b(e){var t=n.mont(e);return 0===u.toRed(t).redPow(e.subn(1)).fromRed().cmpn(1)}function y(e,t){if(e<16)return new n(2===t||5===t?[140,123]:[140,39]);var r,p;for(t=new n(t);;){for(r=new n(i(Math.ceil(e/8)));r.bitLength()>e;)r.ishrn(1);if(r.isEven()&&r.iadd(s),r.testn(1)||r.iadd(u),t.cmp(u)){if(!t.cmp(c))for(;r.mod(h).cmp(f);)r.iadd(d)}else for(;r.mod(o).cmp(l);)r.iadd(d);if(g(p=r.shrn(1))&&g(r)&&b(p)&&b(r)&&a.test(p)&&a.test(r))return r}}},function(e,t,r){var i=r(7),n=r(82);function o(e){this.rand=e||new n.Rand}e.exports=o,o.create=function(e){return new o(e)},o.prototype._randbelow=function(e){var t=e.bitLength(),r=Math.ceil(t/8);do{var n=new i(this.rand.generate(r))}while(n.cmp(e)>=0);return n},o.prototype._randrange=function(e,t){var r=t.sub(e);return e.add(this._randbelow(r))},o.prototype.test=function(e,t,r){var n=e.bitLength(),o=i.mont(e),a=new i(1).toRed(o);t||(t=Math.max(1,n/48|0));for(var s=e.subn(1),u=0;!s.testn(u);u++);for(var c=e.shrn(u),h=s.toRed(o);t>0;t--){var f=this._randrange(new i(2),s);r&&r(f);var l=f.toRed(o).redPow(c);if(0!==l.cmp(a)&&0!==l.cmp(h)){for(var d=1;d<u;d++){if(0===(l=l.redSqr()).cmp(a))return!1;if(0===l.cmp(h))break}if(d===u)return!1}}return!0},o.prototype.getDivisor=function(e,t){var r=e.bitLength(),n=i.mont(e),o=new i(1).toRed(n);t||(t=Math.max(1,r/48|0));for(var a=e.subn(1),s=0;!a.testn(s);s++);for(var u=e.shrn(s),c=a.toRed(n);t>0;t--){var h=this._randrange(new i(2),a),f=e.gcd(h);if(0!==f.cmpn(1))return f;var l=h.toRed(n).redPow(u);if(0!==l.cmp(o)&&0!==l.cmp(c)){for(var d=1;d<s;d++){if(0===(l=l.redSqr()).cmp(o))return l.fromRed().subn(1).gcd(e);if(0===l.cmp(c))break}if(d===s)return(l=l.redSqr()).fromRed().subn(1).gcd(e)}}return!1}},function(e,t,r){"use strict";var i=t;function n(e){return 1===e.length?"0"+e:e}function o(e){for(var t="",r=0;r<e.length;r++)t+=n(e[r].toString(16));return t}i.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var i=0;i<e.length;i++)r[i]=0|e[i];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(i=0;i<e.length;i+=2)r.push(parseInt(e[i]+e[i+1],16))}else for(i=0;i<e.length;i++){var n=e.charCodeAt(i),o=n>>8,a=255&n;o?r.push(o,a):r.push(a)}return r},i.zero2=n,i.toHex=o,i.encode=function(e,t){return"hex"===t?o(e):e}},function(e,t,r){"use strict";var i=t;i.base=r(57),i.short=r(246),i.mont=r(247),i.edwards=r(248)},function(e,t,r){"use strict";var i=r(19).rotr32;function n(e,t,r){return e&t^~e&r}function o(e,t,r){return e&t^e&r^t&r}function a(e,t,r){return e^t^r}t.ft_1=function(e,t,r,i){return 0===e?n(t,r,i):1===e||3===e?a(t,r,i):2===e?o(t,r,i):void 0},t.ch32=n,t.maj32=o,t.p32=a,t.s0_256=function(e){return i(e,2)^i(e,13)^i(e,22)},t.s1_256=function(e){return i(e,6)^i(e,11)^i(e,25)},t.g0_256=function(e){return i(e,7)^i(e,18)^e>>>3},t.g1_256=function(e){return i(e,17)^i(e,19)^e>>>10}},function(e,t,r){"use strict";var i=r(19),n=r(44),o=r(130),a=r(14),s=i.sum32,u=i.sum32_4,c=i.sum32_5,h=o.ch32,f=o.maj32,l=o.s0_256,d=o.s1_256,p=o.g0_256,m=o.g1_256,g=n.BlockHash,b=[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 y(){if(!(this instanceof y))return new y;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=b,this.W=new Array(64)}i.inherits(y,g),e.exports=y,y.blockSize=512,y.outSize=256,y.hmacStrength=192,y.padLength=64,y.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;i<r.length;i++)r[i]=u(m(r[i-2]),r[i-7],p(r[i-15]),r[i-16]);var n=this.h[0],o=this.h[1],g=this.h[2],b=this.h[3],y=this.h[4],v=this.h[5],_=this.h[6],w=this.h[7];for(a(this.k.length===r.length),i=0;i<r.length;i++){var S=c(w,d(y),h(y,v,_),this.k[i],r[i]),k=s(l(n),f(n,o,g));w=_,_=v,v=y,y=s(b,S),b=g,g=o,o=n,n=s(S,k)}this.h[0]=s(this.h[0],n),this.h[1]=s(this.h[1],o),this.h[2]=s(this.h[2],g),this.h[3]=s(this.h[3],b),this.h[4]=s(this.h[4],y),this.h[5]=s(this.h[5],v),this.h[6]=s(this.h[6],_),this.h[7]=s(this.h[7],w)},y.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},function(e,t,r){"use strict";var i=r(19),n=r(44),o=r(14),a=i.rotr64_hi,s=i.rotr64_lo,u=i.shr64_hi,c=i.shr64_lo,h=i.sum64,f=i.sum64_hi,l=i.sum64_lo,d=i.sum64_4_hi,p=i.sum64_4_lo,m=i.sum64_5_hi,g=i.sum64_5_lo,b=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 v(){if(!(this instanceof v))return new v;b.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 _(e,t,r,i,n){var o=e&r^~e&n;return o<0&&(o+=4294967296),o}function w(e,t,r,i,n,o){var a=t&i^~t&o;return a<0&&(a+=4294967296),a}function S(e,t,r,i,n){var o=e&r^e&n^r&n;return o<0&&(o+=4294967296),o}function k(e,t,r,i,n,o){var a=t&i^t&o^i&o;return a<0&&(a+=4294967296),a}function I(e,t){var r=a(e,t,28)^a(t,e,2)^a(t,e,7);return r<0&&(r+=4294967296),r}function E(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function A(e,t){var r=a(e,t,14)^a(e,t,18)^a(t,e,9);return r<0&&(r+=4294967296),r}function O(e,t){var r=s(e,t,14)^s(e,t,18)^s(t,e,9);return r<0&&(r+=4294967296),r}function x(e,t){var r=a(e,t,1)^a(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function P(e,t){var r=s(e,t,1)^s(e,t,8)^c(e,t,7);return r<0&&(r+=4294967296),r}function M(e,t){var r=a(e,t,19)^a(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}function T(e,t){var r=s(e,t,19)^s(t,e,29)^c(e,t,6);return r<0&&(r+=4294967296),r}i.inherits(v,b),e.exports=v,v.blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(e,t){for(var r=this.W,i=0;i<32;i++)r[i]=e[t+i];for(;i<r.length;i+=2){var n=M(r[i-4],r[i-3]),o=T(r[i-4],r[i-3]),a=r[i-14],s=r[i-13],u=x(r[i-30],r[i-29]),c=P(r[i-30],r[i-29]),h=r[i-32],f=r[i-31];r[i]=d(n,o,a,s,u,c,h,f),r[i+1]=p(n,o,a,s,u,c,h,f)}},v.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,i=this.h[0],n=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4],c=this.h[5],d=this.h[6],p=this.h[7],b=this.h[8],y=this.h[9],v=this.h[10],x=this.h[11],P=this.h[12],M=this.h[13],T=this.h[14],R=this.h[15];o(this.k.length===r.length);for(var B=0;B<r.length;B+=2){var N=T,C=R,D=A(b,y),j=O(b,y),L=_(b,y,v,x,P),U=w(b,y,v,x,P,M),H=this.k[B],z=this.k[B+1],F=r[B],K=r[B+1],V=m(N,C,D,j,L,U,H,z,F,K),q=g(N,C,D,j,L,U,H,z,F,K);N=I(i,n),C=E(i,n),D=S(i,n,a,s,u),j=k(i,n,a,s,u,c);var G=f(N,C,D,j),Y=l(N,C,D,j);T=P,R=M,P=v,M=x,v=b,x=y,b=f(d,p,V,q),y=l(p,p,V,q),d=u,p=c,u=a,c=s,a=i,s=n,i=f(V,q,G,Y),n=l(V,q,G,Y)}h(this.h,0,i,n),h(this.h,2,a,s),h(this.h,4,u,c),h(this.h,6,d,p),h(this.h,8,b,y),h(this.h,10,v,x),h(this.h,12,P,M),h(this.h,14,T,R)},v.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},function(e,t,r){(function(e){!function(e,t){"use strict";function i(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(263).Buffer}catch(e){}function s(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void i(!1,"Invalid character in "+e)}function u(e,t,r){var i=s(e,r);return r-1>=t&&(i|=s(e,r-1)<<4),i}function c(e,t,r,n){for(var o=0,a=0,s=Math.min(e.length,r),u=t;u<s;u++){var c=e.charCodeAt(u)-48;o*=n,a=c>=49?c-49+10:c>=17?c-17+10:c,i(c>=0&&a<n,"Invalid character"),o+=a}return o}function h(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),i(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<e.length&&(16===t?this._parseHex(e,n,r):(this._parseBase(e,t,n),"le"===r&&this._initArray(this.toArray(),t,r)))},o.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(i(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initArray=function(e,t,r){if(i("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,a,s=0;if("be"===r)for(n=e.length-1,o=0;n>=0;n-=3)a=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(n=0,o=0;n<e.length;n+=3)a=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,a=0;if("be"===r)for(i=e.length-1;i>=t;i-=2)n=u(e,t,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;else for(i=(e.length-t)%2==0?t+1:t;i<e.length;i+=2)n=u(e,t,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;this._strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var o=e.length-r,a=o%i,s=Math.min(o,o-a)+r,u=0,h=r;h<s;h+=i)u=c(e,h,h+i,t),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var f=1;for(u=c(e,h,e.length,t),h=0;h<a;h++)f*=t;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype._move=function(e){h(e,this)},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch(e){o.prototype.inspect=f}else o.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<n|o)).toString(16);o=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),r=0!==o||a!==this.length-1?l[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var c=d[e],h=p[e];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var m=f.modrn(h).toString(e);r=(f=f.idivn(h)).isZero()?m+r:l[c-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},a&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(a,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function m(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],o=0|t.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c<i;c++){for(var h=u>>>26,f=67108863&u,l=Math.min(c,t.length-1),d=Math.max(0,c-e.length+1);d<=l;d++){var p=c-d|0;h+=(a=(n=0|e.words[p])*(o=0|t.words[d])+f)/67108864|0,f=67108863&a}r.words[c]=0|f,u=0|h}return 0!==u?r.words[c]=0|u:r.length--,r._strip()}o.prototype.toArrayLike=function(e,t,r){this._strip();var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,n),a},o.prototype._toArrayLikeLE=function(e,t){for(var r=0,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;e[r++]=255&a,r<e.length&&(e[r++]=a>>8&255),r<e.length&&(e[r++]=a>>16&255),6===o?(r<e.length&&(e[r++]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r<e.length)for(e[r++]=i;r<e.length;)e[r++]=0},o.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;e[r--]=255&a,r>=0&&(e[r--]=a>>8&255),r>=0&&(e[r--]=a>>16&255),6===o?(r>=0&&(e[r--]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r>=0)for(e[r--]=i;r>=0;)e[r--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},o.prototype.ior=function(e){return i(0==(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},o.prototype.iand=function(e){return i(0==(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var i=0;i<r.length;i++)this.words[i]=t.words[i]^r.words[i];if(this!==t)for(;i<t.length;i++)this.words[i]=t.words[i];return this.length=t.length,this._strip()},o.prototype.ixor=function(e){return i(0==(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<n:this.words[r]&~(1<<n),this._strip()},o.prototype.iadd=function(e){var t,r,i;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,i=e):(r=e,i=this);for(var n=0,o=0;o<i.length;o++)t=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&t,n=t>>>26;for(;0!==n&&o<r.length;o++)t=(0|r.words[o])+n,this.words[o]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,i,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=e):(r=e,i=this);for(var o=0,a=0;a<i.length;a++)o=(t=(0|r.words[a])-(0|i.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<r.length;a++)o=(t=(0|r.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var g=function(e,t,r){var i,n,o,a=e.words,s=t.words,u=r.words,c=0,h=0|a[0],f=8191&h,l=h>>>13,d=0|a[1],p=8191&d,m=d>>>13,g=0|a[2],b=8191&g,y=g>>>13,v=0|a[3],_=8191&v,w=v>>>13,S=0|a[4],k=8191&S,I=S>>>13,E=0|a[5],A=8191&E,O=E>>>13,x=0|a[6],P=8191&x,M=x>>>13,T=0|a[7],R=8191&T,B=T>>>13,N=0|a[8],C=8191&N,D=N>>>13,j=0|a[9],L=8191&j,U=j>>>13,H=0|s[0],z=8191&H,F=H>>>13,K=0|s[1],V=8191&K,q=K>>>13,G=0|s[2],Y=8191&G,Z=G>>>13,W=0|s[3],X=8191&W,J=W>>>13,$=0|s[4],Q=8191&$,ee=$>>>13,te=0|s[5],re=8191&te,ie=te>>>13,ne=0|s[6],oe=8191&ne,ae=ne>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,he=0|s[8],fe=8191&he,le=he>>>13,de=0|s[9],pe=8191&de,me=de>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(c+(i=Math.imul(f,z))|0)+((8191&(n=(n=Math.imul(f,F))+Math.imul(l,z)|0))<<13)|0;c=((o=Math.imul(l,F))+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,i=Math.imul(p,z),n=(n=Math.imul(p,F))+Math.imul(m,z)|0,o=Math.imul(m,F);var be=(c+(i=i+Math.imul(f,V)|0)|0)+((8191&(n=(n=n+Math.imul(f,q)|0)+Math.imul(l,V)|0))<<13)|0;c=((o=o+Math.imul(l,q)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,i=Math.imul(b,z),n=(n=Math.imul(b,F))+Math.imul(y,z)|0,o=Math.imul(y,F),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,q)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,q)|0;var ye=(c+(i=i+Math.imul(f,Y)|0)|0)+((8191&(n=(n=n+Math.imul(f,Z)|0)+Math.imul(l,Y)|0))<<13)|0;c=((o=o+Math.imul(l,Z)|0)+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,i=Math.imul(_,z),n=(n=Math.imul(_,F))+Math.imul(w,z)|0,o=Math.imul(w,F),i=i+Math.imul(b,V)|0,n=(n=n+Math.imul(b,q)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,q)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,Z)|0;var ve=(c+(i=i+Math.imul(f,X)|0)|0)+((8191&(n=(n=n+Math.imul(f,J)|0)+Math.imul(l,X)|0))<<13)|0;c=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,i=Math.imul(k,z),n=(n=Math.imul(k,F))+Math.imul(I,z)|0,o=Math.imul(I,F),i=i+Math.imul(_,V)|0,n=(n=n+Math.imul(_,q)|0)+Math.imul(w,V)|0,o=o+Math.imul(w,q)|0,i=i+Math.imul(b,Y)|0,n=(n=n+Math.imul(b,Z)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,Z)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,J)|0;var _e=(c+(i=i+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,ee)|0)+Math.imul(l,Q)|0))<<13)|0;c=((o=o+Math.imul(l,ee)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,i=Math.imul(A,z),n=(n=Math.imul(A,F))+Math.imul(O,z)|0,o=Math.imul(O,F),i=i+Math.imul(k,V)|0,n=(n=n+Math.imul(k,q)|0)+Math.imul(I,V)|0,o=o+Math.imul(I,q)|0,i=i+Math.imul(_,Y)|0,n=(n=n+Math.imul(_,Z)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,Z)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,J)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,ee)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,ee)|0;var we=(c+(i=i+Math.imul(f,re)|0)|0)+((8191&(n=(n=n+Math.imul(f,ie)|0)+Math.imul(l,re)|0))<<13)|0;c=((o=o+Math.imul(l,ie)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,i=Math.imul(P,z),n=(n=Math.imul(P,F))+Math.imul(M,z)|0,o=Math.imul(M,F),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,q)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,q)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,Z)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,Z)|0,i=i+Math.imul(_,X)|0,n=(n=n+Math.imul(_,J)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,ee)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,ee)|0,i=i+Math.imul(p,re)|0,n=(n=n+Math.imul(p,ie)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ie)|0;var Se=(c+(i=i+Math.imul(f,oe)|0)|0)+((8191&(n=(n=n+Math.imul(f,ae)|0)+Math.imul(l,oe)|0))<<13)|0;c=((o=o+Math.imul(l,ae)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,i=Math.imul(R,z),n=(n=Math.imul(R,F))+Math.imul(B,z)|0,o=Math.imul(B,F),i=i+Math.imul(P,V)|0,n=(n=n+Math.imul(P,q)|0)+Math.imul(M,V)|0,o=o+Math.imul(M,q)|0,i=i+Math.imul(A,Y)|0,n=(n=n+Math.imul(A,Z)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,Z)|0,i=i+Math.imul(k,X)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,ee)|0,i=i+Math.imul(b,re)|0,n=(n=n+Math.imul(b,ie)|0)+Math.imul(y,re)|0,o=o+Math.imul(y,ie)|0,i=i+Math.imul(p,oe)|0,n=(n=n+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var ke=(c+(i=i+Math.imul(f,ue)|0)|0)+((8191&(n=(n=n+Math.imul(f,ce)|0)+Math.imul(l,ue)|0))<<13)|0;c=((o=o+Math.imul(l,ce)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,i=Math.imul(C,z),n=(n=Math.imul(C,F))+Math.imul(D,z)|0,o=Math.imul(D,F),i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,q)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,q)|0,i=i+Math.imul(P,Y)|0,n=(n=n+Math.imul(P,Z)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,Z)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,J)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,ee)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,ee)|0,i=i+Math.imul(_,re)|0,n=(n=n+Math.imul(_,ie)|0)+Math.imul(w,re)|0,o=o+Math.imul(w,ie)|0,i=i+Math.imul(b,oe)|0,n=(n=n+Math.imul(b,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0,i=i+Math.imul(p,ue)|0,n=(n=n+Math.imul(p,ce)|0)+Math.imul(m,ue)|0,o=o+Math.imul(m,ce)|0;var Ie=(c+(i=i+Math.imul(f,fe)|0)|0)+((8191&(n=(n=n+Math.imul(f,le)|0)+Math.imul(l,fe)|0))<<13)|0;c=((o=o+Math.imul(l,le)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,i=Math.imul(L,z),n=(n=Math.imul(L,F))+Math.imul(U,z)|0,o=Math.imul(U,F),i=i+Math.imul(C,V)|0,n=(n=n+Math.imul(C,q)|0)+Math.imul(D,V)|0,o=o+Math.imul(D,q)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(B,Y)|0,o=o+Math.imul(B,Z)|0,i=i+Math.imul(P,X)|0,n=(n=n+Math.imul(P,J)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,J)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,ee)|0,i=i+Math.imul(k,re)|0,n=(n=n+Math.imul(k,ie)|0)+Math.imul(I,re)|0,o=o+Math.imul(I,ie)|0,i=i+Math.imul(_,oe)|0,n=(n=n+Math.imul(_,ae)|0)+Math.imul(w,oe)|0,o=o+Math.imul(w,ae)|0,i=i+Math.imul(b,ue)|0,n=(n=n+Math.imul(b,ce)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,ce)|0,i=i+Math.imul(p,fe)|0,n=(n=n+Math.imul(p,le)|0)+Math.imul(m,fe)|0,o=o+Math.imul(m,le)|0;var Ee=(c+(i=i+Math.imul(f,pe)|0)|0)+((8191&(n=(n=n+Math.imul(f,me)|0)+Math.imul(l,pe)|0))<<13)|0;c=((o=o+Math.imul(l,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,i=Math.imul(L,V),n=(n=Math.imul(L,q))+Math.imul(U,V)|0,o=Math.imul(U,q),i=i+Math.imul(C,Y)|0,n=(n=n+Math.imul(C,Z)|0)+Math.imul(D,Y)|0,o=o+Math.imul(D,Z)|0,i=i+Math.imul(R,X)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,J)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,ee)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,ee)|0,i=i+Math.imul(A,re)|0,n=(n=n+Math.imul(A,ie)|0)+Math.imul(O,re)|0,o=o+Math.imul(O,ie)|0,i=i+Math.imul(k,oe)|0,n=(n=n+Math.imul(k,ae)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,ae)|0,i=i+Math.imul(_,ue)|0,n=(n=n+Math.imul(_,ce)|0)+Math.imul(w,ue)|0,o=o+Math.imul(w,ce)|0,i=i+Math.imul(b,fe)|0,n=(n=n+Math.imul(b,le)|0)+Math.imul(y,fe)|0,o=o+Math.imul(y,le)|0;var Ae=(c+(i=i+Math.imul(p,pe)|0)|0)+((8191&(n=(n=n+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;c=((o=o+Math.imul(m,me)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,i=Math.imul(L,Y),n=(n=Math.imul(L,Z))+Math.imul(U,Y)|0,o=Math.imul(U,Z),i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,J)|0)+Math.imul(D,X)|0,o=o+Math.imul(D,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,ee)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,ee)|0,i=i+Math.imul(P,re)|0,n=(n=n+Math.imul(P,ie)|0)+Math.imul(M,re)|0,o=o+Math.imul(M,ie)|0,i=i+Math.imul(A,oe)|0,n=(n=n+Math.imul(A,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,i=i+Math.imul(k,ue)|0,n=(n=n+Math.imul(k,ce)|0)+Math.imul(I,ue)|0,o=o+Math.imul(I,ce)|0,i=i+Math.imul(_,fe)|0,n=(n=n+Math.imul(_,le)|0)+Math.imul(w,fe)|0,o=o+Math.imul(w,le)|0;var Oe=(c+(i=i+Math.imul(b,pe)|0)|0)+((8191&(n=(n=n+Math.imul(b,me)|0)+Math.imul(y,pe)|0))<<13)|0;c=((o=o+Math.imul(y,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,i=Math.imul(L,X),n=(n=Math.imul(L,J))+Math.imul(U,X)|0,o=Math.imul(U,J),i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,ee)|0,i=i+Math.imul(R,re)|0,n=(n=n+Math.imul(R,ie)|0)+Math.imul(B,re)|0,o=o+Math.imul(B,ie)|0,i=i+Math.imul(P,oe)|0,n=(n=n+Math.imul(P,ae)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,ae)|0,i=i+Math.imul(A,ue)|0,n=(n=n+Math.imul(A,ce)|0)+Math.imul(O,ue)|0,o=o+Math.imul(O,ce)|0,i=i+Math.imul(k,fe)|0,n=(n=n+Math.imul(k,le)|0)+Math.imul(I,fe)|0,o=o+Math.imul(I,le)|0;var xe=(c+(i=i+Math.imul(_,pe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(w,pe)|0))<<13)|0;c=((o=o+Math.imul(w,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,i=Math.imul(L,Q),n=(n=Math.imul(L,ee))+Math.imul(U,Q)|0,o=Math.imul(U,ee),i=i+Math.imul(C,re)|0,n=(n=n+Math.imul(C,ie)|0)+Math.imul(D,re)|0,o=o+Math.imul(D,ie)|0,i=i+Math.imul(R,oe)|0,n=(n=n+Math.imul(R,ae)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,ae)|0,i=i+Math.imul(P,ue)|0,n=(n=n+Math.imul(P,ce)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,ce)|0,i=i+Math.imul(A,fe)|0,n=(n=n+Math.imul(A,le)|0)+Math.imul(O,fe)|0,o=o+Math.imul(O,le)|0;var Pe=(c+(i=i+Math.imul(k,pe)|0)|0)+((8191&(n=(n=n+Math.imul(k,me)|0)+Math.imul(I,pe)|0))<<13)|0;c=((o=o+Math.imul(I,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,i=Math.imul(L,re),n=(n=Math.imul(L,ie))+Math.imul(U,re)|0,o=Math.imul(U,ie),i=i+Math.imul(C,oe)|0,n=(n=n+Math.imul(C,ae)|0)+Math.imul(D,oe)|0,o=o+Math.imul(D,ae)|0,i=i+Math.imul(R,ue)|0,n=(n=n+Math.imul(R,ce)|0)+Math.imul(B,ue)|0,o=o+Math.imul(B,ce)|0,i=i+Math.imul(P,fe)|0,n=(n=n+Math.imul(P,le)|0)+Math.imul(M,fe)|0,o=o+Math.imul(M,le)|0;var Me=(c+(i=i+Math.imul(A,pe)|0)|0)+((8191&(n=(n=n+Math.imul(A,me)|0)+Math.imul(O,pe)|0))<<13)|0;c=((o=o+Math.imul(O,me)|0)+(n>>>13)|0)+(Me>>>26)|0,Me&=67108863,i=Math.imul(L,oe),n=(n=Math.imul(L,ae))+Math.imul(U,oe)|0,o=Math.imul(U,ae),i=i+Math.imul(C,ue)|0,n=(n=n+Math.imul(C,ce)|0)+Math.imul(D,ue)|0,o=o+Math.imul(D,ce)|0,i=i+Math.imul(R,fe)|0,n=(n=n+Math.imul(R,le)|0)+Math.imul(B,fe)|0,o=o+Math.imul(B,le)|0;var Te=(c+(i=i+Math.imul(P,pe)|0)|0)+((8191&(n=(n=n+Math.imul(P,me)|0)+Math.imul(M,pe)|0))<<13)|0;c=((o=o+Math.imul(M,me)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,i=Math.imul(L,ue),n=(n=Math.imul(L,ce))+Math.imul(U,ue)|0,o=Math.imul(U,ce),i=i+Math.imul(C,fe)|0,n=(n=n+Math.imul(C,le)|0)+Math.imul(D,fe)|0,o=o+Math.imul(D,le)|0;var Re=(c+(i=i+Math.imul(R,pe)|0)|0)+((8191&(n=(n=n+Math.imul(R,me)|0)+Math.imul(B,pe)|0))<<13)|0;c=((o=o+Math.imul(B,me)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,i=Math.imul(L,fe),n=(n=Math.imul(L,le))+Math.imul(U,fe)|0,o=Math.imul(U,le);var Be=(c+(i=i+Math.imul(C,pe)|0)|0)+((8191&(n=(n=n+Math.imul(C,me)|0)+Math.imul(D,pe)|0))<<13)|0;c=((o=o+Math.imul(D,me)|0)+(n>>>13)|0)+(Be>>>26)|0,Be&=67108863;var Ne=(c+(i=Math.imul(L,pe))|0)+((8191&(n=(n=Math.imul(L,me))+Math.imul(U,pe)|0))<<13)|0;return c=((o=Math.imul(U,me))+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,u[0]=ge,u[1]=be,u[2]=ye,u[3]=ve,u[4]=_e,u[5]=we,u[6]=Se,u[7]=ke,u[8]=Ie,u[9]=Ee,u[10]=Ae,u[11]=Oe,u[12]=xe,u[13]=Pe,u[14]=Me,u[15]=Te,u[16]=Re,u[17]=Be,u[18]=Ne,0!==c&&(u[19]=c,r.length++),r};function b(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var a=n;n=0;for(var s=67108863&i,u=Math.min(o,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var h=o-c,f=(0|e.words[h])*(0|t.words[c]),l=67108863&f;s=67108863&(l=l+s|0),n+=(a=(a=a+(f/67108864|0)|0)+(l>>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(e,t,r){return b(e,t,r)}function v(e,t){this.x=e,this.y=t}Math.imul||(g=m),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?g(this,e,t):r<63?m(this,e,t):r<1024?b(this,e,t):y(this,e,t)},v.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,i=0;i<e;i++)t[i]=this.revBin(i,r,e);return t},v.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var i=0,n=0;n<t;n++)i|=(1&e)<<t-n-1,e>>=1;return i},v.prototype.permute=function(e,t,r,i,n,o){for(var a=0;a<o;a++)i[a]=t[e[a]],n[a]=r[e[a]]},v.prototype.transform=function(e,t,r,i,n,o){this.permute(o,e,t,r,i,n);for(var a=1;a<n;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),h=0;h<n;h+=s)for(var f=u,l=c,d=0;d<a;d++){var p=r[h+d],m=i[h+d],g=r[h+d+a],b=i[h+d+a],y=f*g-l*b;b=f*b+l*g,g=y,r[h+d]=p+g,i[h+d]=m+b,r[h+d+a]=p-g,i[h+d+a]=m-b,d!==s&&(y=u*f-c*l,l=u*l+c*f,f=y)}},v.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},v.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=e[i];e[i]=e[r-i-1],e[r-i-1]=n,n=t[i],t[i]=-t[r-i-1],t[r-i-1]=-n}},v.prototype.normalize13b=function(e,t){for(var r=0,i=0;i<t/2;i++){var n=8192*Math.round(e[2*i+1]/t)+Math.round(e[2*i]/t)+r;e[i]=67108863&n,r=n<67108864?0:n/67108864|0}return e},v.prototype.convert13b=function(e,t,r,n){for(var o=0,a=0;a<t;a++)o+=0|e[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*t;a<n;++a)r[a]=0;i(0===o),i(0==(-8192&o))},v.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},v.prototype.mulp=function(e,t,r){var i=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(i),o=this.stub(i),a=new Array(i),s=new Array(i),u=new Array(i),c=new Array(i),h=new Array(i),f=new Array(i),l=r.words;l.length=i,this.convert13b(e.words,e.length,a,i),this.convert13b(t.words,t.length,c,i),this.transform(a,o,s,u,i,n),this.transform(c,o,h,f,i,n);for(var d=0;d<i;d++){var p=s[d]*h[d]-u[d]*f[d];u[d]=s[d]*f[d]+u[d]*h[d],s[d]=p}return this.conjugate(s,u,i),this.transform(s,u,l,o,i,n),this.conjugate(l,o,i),this.normalize13b(l,i),r.negative=e.negative^t.negative,r.length=e.length+t.length,r._strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),y(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){var t=e<0;t&&(e=-e),i("number"==typeof e),i(e<67108864);for(var r=0,n=0;n<this.length;n++){var o=(0|this.words[n])*e,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[n]=67108863&a}return 0!==r&&(this.words[n]=r,this.length++),this.length=0===e?1:this.length,t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var i=r/26|0,n=r%26;t[r]=e.words[i]>>>n&1}return t}(e);if(0===t.length)return new o(1);for(var r=this,i=0;i<t.length&&0===t[i];i++,r=r.sqr());if(++i<t.length)for(var n=r.sqr();i<t.length;i++,n=n.sqr())0!==t[i]&&(r=r.mul(n));return r},o.prototype.iushln=function(e){i("number"==typeof e&&e>=0);var t,r=e%26,n=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<r;this.words[t]=u|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t<n;t++)this.words[t]=0;this.length+=n}return this._strip()},o.prototype.ishln=function(e){return i(0===this.negative),this.iushln(e)},o.prototype.iushrn=function(e,t,r){var n;i("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(n-=a,n=Math.max(0,n),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var h=0;for(c=this.length-1;c>=0&&(0!==h||c>=n);c--){var f=0|this.words[c];this.words[c]=h<<26-o|f>>>o,h=f&s}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,r){return i(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,n=1<<t;return!(this.length<=r)&&!!(this.words[r]&n)},o.prototype.imaskn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(i(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 n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return 0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return i("number"==typeof e),i(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(i("number"==typeof e),i(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,r){var n,o,a=e.length+r;this._expand(a);var s=0;for(n=0;n<e.length;n++){o=(0|this.words[n+r])+s;var u=(0|e.words[n])*t;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[n+r]=67108863&o}for(;n<this.length-r;n++)s=(o=(0|this.words[n+r])+s)>>26,this.words[n+r]=67108863&o;if(0===s)return this._strip();for(i(-1===s),s=0,n=0;n<this.length;n++)s=(o=-(0|this.words[n])+s)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),i=this.clone(),n=e,a=0|n.words[n.length-1];0!==(r=26-this._countBits(a))&&(n=n.ushln(r),i.iushln(r),a=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==t){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var h=i.clone()._ishlnsubmul(n,1,u);0===h.negative&&(i=h,s&&(s.words[u]=1));for(var f=u-1;f>=0;f--){var l=67108864*(0|i.words[n.length+f])+(0|i.words[n.length+f-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(n,l,f);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(n,1,f),i.isZero()||(i.negative^=1);s&&(s.words[f]=l)}return s&&s._strip(),i._strip(),"div"!==t&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},o.prototype.divmod=function(e,t,r){return i(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(n=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:n,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var n,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),i(e<=67108863);for(var r=(1<<26)%e,n=0,o=this.length-1;o>=0;o--)n=(r*n+(0|this.words[o]))%e;return t?-n:n},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),i(e<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*r;this.words[n]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var h=r.clone(),f=t.clone();!t.isZero();){for(var l=0,d=1;0==(t.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(t.iushrn(l);l-- >0;)(n.isOdd()||a.isOdd())&&(n.iadd(h),a.isub(f)),n.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(h),u.isub(f)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(s),a.isub(u)):(r.isub(t),s.isub(n),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},o.prototype._invmp=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n,a=new o(1),s=new o(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,h=1;0==(t.words[0]&h)&&c<26;++c,h<<=1);if(c>0)for(t.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var f=0,l=1;0==(r.words[0]&l)&&f<26;++f,l<<=1);if(f>0)for(r.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(n=0===t.cmpn(1)?a:s).cmpn(0)<0&&n.iadd(e),n},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)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(i)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){i("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var o=n,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),i(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:n<e?-1:1}return 0!==this.negative?0|-t:t},o.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){i<n?t=-1:i>n&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new A(e)},o.prototype.toRed=function(e){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return i(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return i(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var _={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function S(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function k(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function I(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function O(e){A.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var i=t<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},n(S,w),S.prototype.split=function(e,t){for(var r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var n=e.words[9];for(t.words[t.length++]=4194303&n,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,e.words[i-10]=n,0===n&&e.length>10?e.length-=10:e.length-=9},S.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var i=0|e.words[r];t+=977*i,e.words[r]=67108863&t,t=64*i+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(k,w),n(I,w),n(E,w),E.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var i=19*(0|e.words[r])+t,n=67108863&i;i>>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(_[e])return _[e];var t;if("k256"===e)t=new S;else if("p224"===e)t=new k;else if("p192"===e)t=new I;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return _[e]=t,t},A.prototype._verify1=function(e){i(0===e.negative,"red works only with positives"),i(e.red,"red works only with red numbers")},A.prototype._verify2=function(e,t){i(0==(e.negative|t.negative),"red works only with positives"),i(e.red&&e.red===t.red,"red works only with red numbers")},A.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(h(e,e.umod(this.m)._forceRed(this)),e)},A.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},A.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},A.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},A.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},A.prototype.isqr=function(e){return this.imul(e,e.clone())},A.prototype.sqr=function(e){return this.mul(e,e)},A.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(i(t%2==1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),a=0;!n.isZero()&&0===n.andln(1);)a++,n.iushrn(1);i(!n.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,c).cmp(u);)h.redIAdd(u);for(var f=this.pow(h,n),l=this.pow(e,n.addn(1).iushrn(1)),d=this.pow(e,n),p=a;0!==d.cmp(s);){for(var m=d,g=0;0!==m.cmp(s);g++)m=m.redSqr();i(g<p);var b=this.pow(f,new o(1).iushln(p-g-1));l=l.redMul(b),f=b.redSqr(),d=d.redMul(f),p=g}return l},A.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},A.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=e;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],e);var n=r[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),i=t.length-1;i>=0;i--){for(var c=t.words[i],h=u-1;h>=0;h--){var f=c>>h&1;n!==r[0]&&(n=this.sqr(n)),0!==f||0!==a?(a<<=1,a|=f,(4===++s||0===i&&0===h)&&(n=this.mul(n,r[a]),s=0,a=0)):s=0}u=26}return n},A.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},A.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new O(e)},n(O,A),O.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},O.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},O.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).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)},O.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},O.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,this)}).call(this,r(24)(e))},function(e,t,r){var i=r(4),n=r(46).Reporter,o=r(0).Buffer;function a(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 s(e,t){if(Array.isArray(e))this.length=0,this.value=e.map((function(e){return e instanceof s||(e=new s(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}}i(a,n),t.DecoderBuffer=a,a.prototype.save=function(){return{offset:this.offset,reporter:n.prototype.save.call(this)}},a.prototype.restore=function(e){var t=new a(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,n.prototype.restore.call(this,e.reporter),t},a.prototype.isEmpty=function(){return this.offset===this.length},a.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},a.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");var r=new a(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},a.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},t.EncoderBuffer=s,s.prototype.join=function(e,t){return e||(e=new o(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}},function(e,t,r){var i=t;i._reverse=function(e){var t={};return Object.keys(e).forEach((function(r){(0|r)==r&&(r|=0);var i=e[r];t[i]=r})),t},i.der=r(269)},function(e,t,r){var i=r(4),n=r(45),o=n.base,a=n.bignum,s=n.constants.der;function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){o.Node.call(this,"der",e)}function h(e,t){var r=e.readUInt8(t);if(e.isError(r))return r;var i=s.tagClass[r>>6],n=0==(32&r);if(31==(31&r)){var o=r;for(r=0;128==(128&o);){if(o=e.readUInt8(t),e.isError(o))return o;r<<=7,r|=127&o}}else r&=31;return{cls:i,primitive:n,tag:r,tagStr:s.tag[r]}}function f(e,t,r){var i=e.readUInt8(r);if(e.isError(i))return i;if(!t&&128===i)return null;if(0==(128&i))return i;var n=127&i;if(n>4)return e.error("length octect is too long");i=0;for(var o=0;o<n;o++){i<<=8;var a=e.readUInt8(r);if(e.isError(a))return a;i|=a}return i}e.exports=u,u.prototype.decode=function(e,t){return e instanceof o.DecoderBuffer||(e=new o.DecoderBuffer(e,t)),this.tree._decode(e,t)},i(c,o.Node),c.prototype._peekTag=function(e,t,r){if(e.isEmpty())return!1;var i=e.save(),n=h(e,'Failed to peek tag: "'+t+'"');return e.isError(n)?n:(e.restore(i),n.tag===t||n.tagStr===t||n.tagStr+"of"===t||r)},c.prototype._decodeTag=function(e,t,r){var i=h(e,'Failed to decode tag of "'+t+'"');if(e.isError(i))return i;var n=f(e,i.primitive,'Failed to get length of "'+t+'"');if(e.isError(n))return n;if(!r&&i.tag!==t&&i.tagStr!==t&&i.tagStr+"of"!==t)return e.error('Failed to match tag: "'+t+'"');if(i.primitive||null!==n)return e.skip(n,'Failed to match body of: "'+t+'"');var o=e.save(),a=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(a)?a:(n=e.offset-o.offset,e.restore(o),e.skip(n,'Failed to match body of: "'+t+'"'))},c.prototype._skipUntilEnd=function(e,t){for(;;){var r=h(e,t);if(e.isError(r))return r;var i,n=f(e,r.primitive,t);if(e.isError(n))return n;if(i=r.primitive||null!==n?e.skip(n):this._skipUntilEnd(e,t),e.isError(i))return i;if("end"===r.tagStr)break}},c.prototype._decodeList=function(e,t,r,i){for(var n=[];!e.isEmpty();){var o=this._peekTag(e,"end");if(e.isError(o))return o;var a=r.decode(e,"der",i);if(e.isError(a)&&o)break;n.push(a)}return n},c.prototype._decodeStr=function(e,t){if("bitstr"===t){var r=e.readUInt8();return e.isError(r)?r:{unused:r,data:e.raw()}}if("bmpstr"===t){var i=e.raw();if(i.length%2==1)return e.error("Decoding of string type: bmpstr length mismatch");for(var n="",o=0;o<i.length/2;o++)n+=String.fromCharCode(i.readUInt16BE(2*o));return n}if("numstr"===t){var a=e.raw().toString("ascii");return this._isNumstr(a)?a:e.error("Decoding of string type: numstr unsupported characters")}if("octstr"===t)return e.raw();if("objDesc"===t)return e.raw();if("printstr"===t){var s=e.raw().toString("ascii");return this._isPrintstr(s)?s:e.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(t)?e.raw().toString():e.error("Decoding of string type: "+t+" unsupported")},c.prototype._decodeObjid=function(e,t,r){for(var i,n=[],o=0;!e.isEmpty();){var a=e.readUInt8();o<<=7,o|=127&a,0==(128&a)&&(n.push(o),o=0)}128&a&&n.push(o);var s=n[0]/40|0,u=n[0]%40;if(i=r?n:[s,u].concat(n.slice(1)),t){var c=t[i.join(" ")];void 0===c&&(c=t[i.join(".")]),void 0!==c&&(i=c)}return i},c.prototype._decodeTime=function(e,t){var r=e.raw().toString();if("gentime"===t)var i=0|r.slice(0,4),n=0|r.slice(4,6),o=0|r.slice(6,8),a=0|r.slice(8,10),s=0|r.slice(10,12),u=0|r.slice(12,14);else{if("utctime"!==t)return e.error("Decoding "+t+" time is not supported yet");i=0|r.slice(0,2),n=0|r.slice(2,4),o=0|r.slice(4,6),a=0|r.slice(6,8),s=0|r.slice(8,10),u=0|r.slice(10,12);i=i<70?2e3+i:1900+i}return Date.UTC(i,n-1,o,a,s,u,0)},c.prototype._decodeNull=function(e){return null},c.prototype._decodeBool=function(e){var t=e.readUInt8();return e.isError(t)?t:0!==t},c.prototype._decodeInt=function(e,t){var r=e.raw(),i=new a(r);return t&&(i=t[i.toString(10)]||i),i},c.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree}},function(e,t,r){var i=r(4),n=r(0).Buffer,o=r(45),a=o.base,s=o.constants.der;function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){a.Node.call(this,"der",e)}function h(e){return e<10?"0"+e:e}e.exports=u,u.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},i(c,a.Node),c.prototype._encodeComposite=function(e,t,r,i){var o,a=function(e,t,r,i){var n;"seqof"===e?e="seq":"setof"===e&&(e="set");if(s.tagByName.hasOwnProperty(e))n=s.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return i.error("Unknown tag: "+e);n=e}if(n>=31)return i.error("Multi-octet tag encoding unsupported");t||(n|=32);return n|=s.tagClassByName[r||"universal"]<<6}(e,t,r,this.reporter);if(i.length<128)return(o=new n(2))[0]=a,o[1]=i.length,this._createEncoderBuffer([o,i]);for(var u=1,c=i.length;c>=256;c>>=8)u++;(o=new n(2+u))[0]=a,o[1]=128|u;c=1+u;for(var h=i.length;h>0;c--,h>>=8)o[c]=255&h;return this._createEncoderBuffer([o,i])},c.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){for(var r=new n(2*e.length),i=0;i<e.length;i++)r.writeUInt16BE(e.charCodeAt(i),2*i);return this._createEncoderBuffer(r)}return"numstr"===t?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===t?this._isPrintstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(t)||"objDesc"===t?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+t+" unsupported")},c.prototype._encodeObjid=function(e,t,r){if("string"==typeof e){if(!t)return this.reporter.error("string objid given, but no values map found");if(!t.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=t[e].split(/[\s\.]+/g);for(var i=0;i<e.length;i++)e[i]|=0}else if(Array.isArray(e)){e=e.slice();for(i=0;i<e.length;i++)e[i]|=0}if(!Array.isArray(e))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(e));if(!r){if(e[1]>=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}var o=0;for(i=0;i<e.length;i++){var a=e[i];for(o++;a>=128;a>>=7)o++}var s=new n(o),u=s.length-1;for(i=e.length-1;i>=0;i--){a=e[i];for(s[u--]=127&a;(a>>=7)>0;)s[u--]=128|127&a}return this._createEncoderBuffer(s)},c.prototype._encodeTime=function(e,t){var r,i=new Date(e);return"gentime"===t?r=[h(i.getFullYear()),h(i.getUTCMonth()+1),h(i.getUTCDate()),h(i.getUTCHours()),h(i.getUTCMinutes()),h(i.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[h(i.getFullYear()%100),h(i.getUTCMonth()+1),h(i.getUTCDate()),h(i.getUTCHours()),h(i.getUTCMinutes()),h(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},c.prototype._encodeNull=function(){return this._createEncoderBuffer("")},c.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!n.isBuffer(e)){var r=e.toArray();!e.sign&&128&r[0]&&r.unshift(0),e=new n(r)}if(n.isBuffer(e)){var i=e.length;0===e.length&&i++;var o=new n(i);return e.copy(o),0===e.length&&(o[0]=0),this._createEncoderBuffer(o)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);i=1;for(var a=e;a>=256;a>>=8)i++;for(a=(o=new Array(i)).length-1;a>=0;a--)o[a]=255&e,e>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new n(o))},c.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},c.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},c.prototype._skipDefault=function(e,t,r){var i,n=this._baseState;if(null===n.default)return!1;var o=e.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,t,r).join()),o.length!==n.defaultBuffer.length)return!1;for(i=0;i<o.length;i++)if(o[i]!==n.defaultBuffer[i])return!1;return!0}},function(e){e.exports={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}},function(e,t,r){var i=r(37),n=r(1).Buffer;function o(e){var t=n.allocUnsafe(4);return t.writeUInt32BE(e,0),t}e.exports=function(e,t){for(var r,a=n.alloc(0),s=0;a.length<t;)r=o(s++),a=n.concat([a,i("sha1").update(e).update(r).digest()]);return a.slice(0,t)}},function(e,t){e.exports=function(e,t){for(var r=e.length,i=-1;++i<r;)e[i]^=t[i];return e}},function(e,t,r){var i=r(7),n=r(1).Buffer;e.exports=function(e,t){return n.from(e.toRed(i.mont(t.modulus)).redPow(new i(t.publicExponent)).fromRed().toArray())}},function(e,t,r){"use strict";(function(t){var i=r(36),n=r(25),o=r(21),a=r(10),s=r(89),u=r(20),c=r(11),h=r(30),f=r(5),l=r(3),d=r(16),p=r(0),m=r(12),g=function e(r){return this instanceof e?(this.chunks=[],t.isBuffer(r)?e.fromBuffer(r):r instanceof i?e.fromAddress(r):r instanceof e?e.fromBuffer(r.toBuffer()):l.isString(r)?e.fromString(r):void(l.isObject(r)&&l.isArray(r.chunks)&&this.set(r))):new e(r)};g.prototype.set=function(e){return f.checkArgument(l.isObject(e)),f.checkArgument(l.isArray(e.chunks)),this.chunks=e.chunks,this},g.fromBuffer=function(e){var t=new g;t.chunks=[];for(var r=new n(e);!r.finished();)try{var i,o,a=r.readUInt8();a>0&&a<s.OP_PUSHDATA1?(i=a,t.chunks.push({buf:r.read(i),len:i,opcodenum:a})):a===s.OP_PUSHDATA1?(i=r.readUInt8(),o=r.read(i),t.chunks.push({buf:o,len:i,opcodenum:a})):a===s.OP_PUSHDATA2?(i=r.readUInt16LE(),o=r.read(i),t.chunks.push({buf:o,len:i,opcodenum:a})):a===s.OP_PUSHDATA4?(i=r.readUInt32LE(),o=r.read(i),t.chunks.push({buf:o,len:i,opcodenum:a})):t.chunks.push({opcodenum:a})}catch(t){if(t instanceof RangeError)throw new d.Script.InvalidBuffer(e.toString("hex"));throw t}return t},g.prototype.toBuffer=function(){for(var e=new o,t=0;t<this.chunks.length;t++){var r=this.chunks[t],i=r.opcodenum;e.writeUInt8(r.opcodenum),r.buf&&(i<s.OP_PUSHDATA1?e.write(r.buf):i===s.OP_PUSHDATA1?(e.writeUInt8(r.len),e.write(r.buf)):i===s.OP_PUSHDATA2?(e.writeUInt16LE(r.len),e.write(r.buf)):i===s.OP_PUSHDATA4&&(e.writeUInt32LE(r.len),e.write(r.buf)))}return e.concat()},g.fromASM=function(e){var r=new g;r.chunks=[];for(var i=e.split(" "),n=0;n<i.length;){var o=i[n],a=s(o).toNumber();if("0"===o)a=0,r.chunks.push({opcodenum:a}),n+=1;else if("-1"===o)a=s.OP_1NEGATE,r.chunks.push({opcodenum:a}),n+=1;else if(l.isUndefined(a)){var u=t.from(i[n],"hex");if(u.toString("hex")!==i[n])throw new Error("invalid hex string in script");var c=u.length;c>=0&&c<s.OP_PUSHDATA1?a=c:c<Math.pow(2,8)?a=s.OP_PUSHDATA1:c<Math.pow(2,16)?a=s.OP_PUSHDATA2:c<Math.pow(2,32)&&(a=s.OP_PUSHDATA4),r.chunks.push({buf:u,len:u.length,opcodenum:a}),n+=1}else r.chunks.push({opcodenum:a}),n+=1}return r},g.fromHex=function(e){return new g(p.Buffer.from(e,"hex"))},g.fromString=function(e){if(m.isHexa(e)||0===e.length)return new g(p.Buffer.from(e,"hex"));var r=new g;r.chunks=[];for(var i=e.split(" "),n=0;n<i.length;){var o=i[n],a=s(o).toNumber();if(l.isUndefined(a)){if(!((a=parseInt(o))>0&&a<s.OP_PUSHDATA1))throw new Error("Invalid script: "+JSON.stringify(e));r.chunks.push({buf:t.from(i[n+1].slice(2),"hex"),len:a,opcodenum:a}),n+=2}else if(a===s.OP_PUSHDATA1||a===s.OP_PUSHDATA2||a===s.OP_PUSHDATA4){if("0x"!==i[n+2].slice(0,2))throw new Error("Pushdata data must start with 0x");r.chunks.push({buf:t.from(i[n+2].slice(2),"hex"),len:parseInt(i[n+1]),opcodenum:a}),n+=3}else r.chunks.push({opcodenum:a}),n+=1}return r},g.prototype._chunkToString=function(e,t){var r=e.opcodenum,i="asm"===t,n="";if(e.buf)i||r!==s.OP_PUSHDATA1&&r!==s.OP_PUSHDATA2&&r!==s.OP_PUSHDATA4||(n=n+" "+s(r).toString()),e.len>0&&(n=i?n+" "+e.buf.toString("hex"):n+" "+e.len+" 0x"+e.buf.toString("hex"));else if(void 0!==s.reverseMap[r])i?0===r?n+=" 0":79===r?n+=" -1":n=n+" "+s(r).toString():n=n+" "+s(r).toString();else{var o=r.toString(16);o.length%2!=0&&(o="0"+o),n=i?n+" "+o:n+" 0x"+o}return n},g.prototype.toASM=function(){for(var e="",t=0;t<this.chunks.length;t++){var r=this.chunks[t];e+=this._chunkToString(r,"asm")}return e.substr(1)},g.prototype.toString=function(){for(var e="",t=0;t<this.chunks.length;t++){var r=this.chunks[t];e+=this._chunkToString(r)}return e.substr(1)},g.prototype.toHex=function(){return this.toBuffer().toString("hex")},g.prototype.inspect=function(){return"<Script: "+this.toString()+">"},g.prototype.isPublicKeyHashOut=function(){return!(5!==this.chunks.length||this.chunks[0].opcodenum!==s.OP_DUP||this.chunks[1].opcodenum!==s.OP_HASH160||!this.chunks[2].buf||20!==this.chunks[2].buf.length||this.chunks[3].opcodenum!==s.OP_EQUALVERIFY||this.chunks[4].opcodenum!==s.OP_CHECKSIG)},g.prototype.isPublicKeyHashOutPrefix=function(){return!!(this.chunks.length>=5&&this.chunks[0].opcodenum===s.OP_DUP&&this.chunks[1].opcodenum===s.OP_HASH160&&this.chunks[2].buf&&20===this.chunks[2].buf.length&&this.chunks[3].opcodenum===s.OP_EQUALVERIFY&&this.chunks[4].opcodenum===s.OP_CHECKSIG)},g.prototype.isPublicKeyHashIn=function(){if(2===this.chunks.length){var e=this.chunks[0].buf,t=this.chunks[1].buf;if(e&&e.length&&48===e[0]&&t&&t.length){var r=t[0];if((4===r||6===r||7===r)&&65===t.length)return!0;if((3===r||2===r)&&33===t.length)return!0}}return!1},g.prototype.getPublicKey=function(){return f.checkState(this.isPublicKeyOut(),"Can't retrieve PublicKey from a non-PK output"),this.chunks[0].buf},g.prototype.getPublicKeyHash=function(){return f.checkState(this.isPublicKeyHashOut(),"Can't retrieve PublicKeyHash from a non-PKH output"),this.chunks[2].buf},g.prototype.isPublicKeyOut=function(){if(2===this.chunks.length&&this.chunks[0].buf&&this.chunks[0].buf.length&&this.chunks[1].opcodenum===s.OP_CHECKSIG){var e=this.chunks[0].buf,t=e[0],r=!1;if((4!==t&&6!==t&&7!==t||65!==e.length)&&(3!==t&&2!==t||33!==e.length)||(r=!0),r)return u.isValid(e)}return!1},g.prototype.isPublicKeyIn=function(){if(1===this.chunks.length){var e=this.chunks[0].buf;if(e&&e.length&&48===e[0])return!0}return!1},g.prototype.isScriptHashOut=function(){var e=this.toBuffer();return 23===e.length&&e[0]===s.OP_HASH160&&20===e[1]&&e[e.length-1]===s.OP_EQUAL},g.prototype.isScriptHashIn=function(){if(this.chunks.length<=1)return!1;var e,t=this.chunks[this.chunks.length-1].buf;if(!t)return!1;try{e=g.fromBuffer(t)}catch(e){if(e instanceof d.Script.InvalidBuffer)return!1;throw e}return e.classify()!==g.types.UNKNOWN},g.prototype.isMultisigOut=function(){return this.chunks.length>3&&s.isSmallIntOp(this.chunks[0].opcodenum)&&this.chunks.slice(1,this.chunks.length-2).every((function(e){return e.buf&&t.isBuffer(e.buf)}))&&s.isSmallIntOp(this.chunks[this.chunks.length-2].opcodenum)&&this.chunks[this.chunks.length-1].opcodenum===s.OP_CHECKMULTISIG},g.prototype.isMultisigIn=function(){return this.chunks.length>=2&&0===this.chunks[0].opcodenum&&this.chunks.slice(1,this.chunks.length).every((function(e){return e.buf&&t.isBuffer(e.buf)&&c.isTxDER(e.buf)}))},g.prototype.isDataOut=function(){if(!(this.chunks.length>=1&&this.chunks[0].opcodenum===s.OP_RETURN))return!1;var e=this.chunks.slice(1);return new g({chunks:e}).isPushOnly()},g.prototype.isSafeDataOut=function(){if(this.chunks.length<2)return!1;if(this.chunks[0].opcodenum!==s.OP_FALSE)return!1;var e=this.chunks.slice(1);return new g({chunks:e}).isDataOut()},g.prototype.getData=function(){if(this.isSafeDataOut())return this.chunks.slice(2).map(e=>e.buf);if(this.isDataOut()||this.isScriptHashOut())return l.isUndefined(this.chunks[1])?t.alloc(0):t.from(this.chunks[1].buf);if(this.isPublicKeyHashOut())return t.from(this.chunks[2].buf);throw new Error("Unrecognized script type to get data from")},g.prototype.isPushOnly=function(){return l.every(this.chunks,(function(e){return e.opcodenum<=s.OP_16||e.opcodenum===s.OP_PUSHDATA1||e.opcodenum===s.OP_PUSHDATA2||e.opcodenum===s.OP_PUSHDATA4}))},(g.types={}).UNKNOWN="Unknown",g.types.PUBKEY_OUT="Pay to public key",g.types.PUBKEY_IN="Spend from public key",g.types.PUBKEYHASH_OUT="Pay to public key hash",g.types.PUBKEYHASH_IN="Spend from public key hash",g.types.SCRIPTHASH_OUT="Pay to script hash",g.types.SCRIPTHASH_IN="Spend from script hash",g.types.MULTISIG_OUT="Pay to multisig",g.types.MULTISIG_IN="Spend from multisig",g.types.DATA_OUT="Data push",g.types.SAFE_DATA_OUT="Safe data push",g.OP_RETURN_STANDARD_SIZE=220,g.prototype.classify=function(){if(this._isInput)return this.classifyInput();if(this._isOutput)return this.classifyOutput();var e=this.classifyOutput();return e!==g.types.UNKNOWN?e:this.classifyInput()},(g.outputIdentifiers={}).PUBKEY_OUT=g.prototype.isPublicKeyOut,g.outputIdentifiers.PUBKEYHASH_OUT=g.prototype.isPublicKeyHashOut,g.outputIdentifiers.MULTISIG_OUT=g.prototype.isMultisigOut,g.outputIdentifiers.SCRIPTHASH_OUT=g.prototype.isScriptHashOut,g.outputIdentifiers.DATA_OUT=g.prototype.isDataOut,g.outputIdentifiers.SAFE_DATA_OUT=g.prototype.isSafeDataOut,g.prototype.classifyOutput=function(){for(var e in g.outputIdentifiers)if(g.outputIdentifiers[e].bind(this)())return g.types[e];return g.types.UNKNOWN},(g.inputIdentifiers={}).PUBKEY_IN=g.prototype.isPublicKeyIn,g.inputIdentifiers.PUBKEYHASH_IN=g.prototype.isPublicKeyHashIn,g.inputIdentifiers.MULTISIG_IN=g.prototype.isMultisigIn,g.inputIdentifiers.SCRIPTHASH_IN=g.prototype.isScriptHashIn,g.prototype.classifyInput=function(){for(var e in g.inputIdentifiers)if(g.inputIdentifiers[e].bind(this)())return g.types[e];return g.types.UNKNOWN},g.prototype.isStandard=function(){return this.classify()!==g.types.UNKNOWN},g.prototype.prepend=function(e){return this._addByType(e,!0),this},g.prototype.equals=function(e){if(f.checkState(e instanceof g,"Must provide another script"),this.chunks.length!==e.chunks.length)return!1;var r;for(r=0;r<this.chunks.length;r++){if(t.isBuffer(this.chunks[r].buf)&&!t.isBuffer(e.chunks[r].buf))return!1;if(t.isBuffer(this.chunks[r].buf)&&!this.chunks[r].buf.equals(e.chunks[r].buf))return!1;if(this.chunks[r].opcodenum!==e.chunks[r].opcodenum)return!1}return!0},g.prototype.add=function(e){return this._addByType(e,!1),this},g.prototype._addByType=function(e,r){if("string"==typeof e)this._addOpcode(e,r);else if("number"==typeof e)this._addOpcode(e,r);else if(e instanceof s)this._addOpcode(e,r);else if(t.isBuffer(e))this._addBuffer(e,r);else if(e instanceof g)this.chunks=this.chunks.concat(e.chunks);else{if("object"!=typeof e)throw new Error("Invalid script chunk");this._insertAtPosition(e,r)}},g.prototype._insertAtPosition=function(e,t){t?this.chunks.unshift(e):this.chunks.push(e)},g.prototype._addOpcode=function(e,t){var r;return r="number"==typeof e?e:e instanceof s?e.toNumber():s(e).toNumber(),this._insertAtPosition({opcodenum:r},t),this},g.prototype._addBuffer=function(e,t){var r,i=e.length;if(i>=0&&i<s.OP_PUSHDATA1)r=i;else if(i<Math.pow(2,8))r=s.OP_PUSHDATA1;else if(i<Math.pow(2,16))r=s.OP_PUSHDATA2;else{if(!(i<Math.pow(2,32)))throw new Error("You can't push that much data");r=s.OP_PUSHDATA4}return this._insertAtPosition({buf:e,len:i,opcodenum:r},t),this},g.prototype.removeCodeseparators=function(){for(var e=[],t=0;t<this.chunks.length;t++)this.chunks[t].opcodenum!==s.OP_CODESEPARATOR&&e.push(this.chunks[t]);return this.chunks=e,this},g.buildMultisigOut=function(e,t,r){f.checkArgument(t<=e.length,"Number of required signatures must be less than or equal to the number of public keys"),r=r||{};var i=new g;i.add(s.smallInt(t));var n=e=l.map(e,u);r.noSorting||(n=e.map(e=>e.toString("hex")).sort().map(e=>new u(e)));for(var o=0;o<n.length;o++){var a=n[o];i.add(a.toBuffer())}return i.add(s.smallInt(e.length)),i.add(s.OP_CHECKMULTISIG),i},g.buildMultisigIn=function(e,r,i,n){f.checkArgument(l.isArray(e)),f.checkArgument(l.isNumber(r)),f.checkArgument(l.isArray(i)),n=n||{};var o=new g;return o.add(s.OP_0),l.each(i,(function(e){f.checkArgument(t.isBuffer(e),"Signatures must be an array of Buffers"),o.add(e)})),o},g.buildP2SHMultisigIn=function(e,r,i,n){f.checkArgument(l.isArray(e)),f.checkArgument(l.isNumber(r)),f.checkArgument(l.isArray(i)),n=n||{};var o=new g;return o.add(s.OP_0),l.each(i,(function(e){f.checkArgument(t.isBuffer(e),"Signatures must be an array of Buffers"),o.add(e)})),o.add((n.cachedMultisig||g.buildMultisigOut(e,r,n)).toBuffer()),o},g.buildPublicKeyHashOut=function(e){f.checkArgument(!l.isUndefined(e)),f.checkArgument(e instanceof u||e instanceof i||l.isString(e)),e instanceof u?e=e.toAddress():l.isString(e)&&(e=new i(e));var t=new g;return t.add(s.OP_DUP).add(s.OP_HASH160).add(e.hashBuffer).add(s.OP_EQUALVERIFY).add(s.OP_CHECKSIG),t._network=e.network,t},g.buildPublicKeyOut=function(e){f.checkArgument(e instanceof u);var t=new g;return t.add(e.toBuffer()).add(s.OP_CHECKSIG),t},g.buildDataOut=function(e,r){f.checkArgument(l.isUndefined(e)||l.isString(e)||l.isArray(e)||t.isBuffer(e));var i=e;l.isArray(i)||(i=[e]);var n=new g;n.add(s.OP_RETURN);for(let e of i)f.checkArgument(l.isUndefined(e)||l.isString(e)||t.isBuffer(e)),l.isString(e)&&(e=t.from(e,r)),l.isUndefined(e)||n.add(e);return n},g.buildSafeDataOut=function(e,t){var r=g.buildDataOut(e,t),i=new g;return i.add(s.OP_FALSE),i.add(r),i},g.buildScriptHashOut=function(e){f.checkArgument(e instanceof g||e instanceof i&&e.isPayToScriptHash());var t=new g;return t.add(s.OP_HASH160).add(e instanceof i?e.hashBuffer:a.sha256ripemd160(e.toBuffer())).add(s.OP_EQUAL),t._network=e._network||e.network,t},g.buildPublicKeyIn=function(e,r){f.checkArgument(e instanceof c||t.isBuffer(e)),f.checkArgument(l.isUndefined(r)||l.isNumber(r)),e instanceof c&&(e=e.toBuffer());var i=new g;return i.add(t.concat([e,t.from([255&(r||c.SIGHASH_ALL)])])),i},g.buildPublicKeyHashIn=function(e,r,i){return f.checkArgument(r instanceof c||t.isBuffer(r)),f.checkArgument(l.isUndefined(i)||l.isNumber(i)),r instanceof c&&(r=r.toBuffer()),(new g).add(t.concat([r,t.from([255&(i||c.SIGHASH_ALL)])])).add(new u(e).toBuffer())},g.empty=function(){return new g},g.prototype.toScriptHashOut=function(){return g.buildScriptHashOut(this)},g.fromAddress=function(e){if((e=i(e)).isPayToScriptHash())return g.buildScriptHashOut(e);if(e.isPayToPublicKeyHash())return g.buildPublicKeyHashOut(e);throw new d.Script.UnrecognizedAddress(e)},g.prototype.getAddressInfo=function(e){if(this._isInput)return this._getInputAddressInfo();if(this._isOutput)return this._getOutputAddressInfo();var t=this._getOutputAddressInfo();return t||this._getInputAddressInfo()},g.prototype._getOutputAddressInfo=function(){var e={};if(this.isScriptHashOut())e.hashBuffer=this.getData(),e.type=i.PayToScriptHash;else{if(!this.isPublicKeyHashOut())return!1;e.hashBuffer=this.getData(),e.type=i.PayToPublicKeyHash}return e},g.prototype._getInputAddressInfo=function(){var e={};if(this.isPublicKeyHashIn())e.hashBuffer=a.sha256ripemd160(this.chunks[1].buf),e.type=i.PayToPublicKeyHash;else{if(!this.isScriptHashIn())return!1;e.hashBuffer=a.sha256ripemd160(this.chunks[this.chunks.length-1].buf),e.type=i.PayToScriptHash}return e},g.prototype.toAddress=function(e){var t=this.getAddressInfo();return!!t&&(t.network=h.get(e)||this._network||h.defaultNetwork,new i(t))},g.prototype.findAndDelete=function(e){for(var t=e.toBuffer().toString("hex"),r=0;r<this.chunks.length;r++){t===g({chunks:[this.chunks[r]]}).toBuffer().toString("hex")&&this.chunks.splice(r,1)}return this},g.prototype.checkMinimalPush=function(e){var t=this.chunks[e],r=t.buf,i=t.opcodenum;return!r||(0===r.length?i===s.OP_0:1===r.length&&r[0]>=1&&r[0]<=16?i===s.OP_1+(r[0]-1):1===r.length&&129===r[0]?i===s.OP_1NEGATE:r.length<=75?i===r.length:r.length<=255?i===s.OP_PUSHDATA1:!(r.length<=65535)||i===s.OP_PUSHDATA2)},g.prototype._decodeOP_N=function(e){if(e===s.OP_0)return 0;if(e>=s.OP_1&&e<=s.OP_16)return e-(s.OP_1-1);throw new Error("Invalid opcode: "+JSON.stringify(e))},g.prototype.getSignatureOperationsCount=function(e){e=!!l.isUndefined(e)||e;var t=this,r=0,i=s.OP_INVALIDOPCODE;return l.each(t.chunks,(function(n){var o=n.opcodenum;o===s.OP_CHECKSIG||o===s.OP_CHECKSIGVERIFY?r++:o!==s.OP_CHECKMULTISIG&&o!==s.OP_CHECKMULTISIGVERIFY||(e&&i>=s.OP_1&&i<=s.OP_16?r+=t._decodeOP_N(i):r+=20),i=o})),r},e.exports=g}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var i=Object.prototype.toString;e.exports=function(e){var t=i.call(e),r="[object Arguments]"===t;return r||(r="[object Array]"!==t&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===i.call(e.callee)),r}},function(e,t){var r=Object.prototype.toString;function i(e){return"function"==typeof e.constructor?e.constructor.name:null}e.exports=function(e){if(void 0===e)return"undefined";if(null===e)return"null";var t=typeof e;if("boolean"===t)return"boolean";if("string"===t)return"string";if("number"===t)return"number";if("symbol"===t)return"symbol";if("function"===t)return"GeneratorFunction"===i(e)?"generatorfunction":"function";if(function(e){return Array.isArray?Array.isArray(e):e instanceof Array}(e))return"array";if(function(e){if(e.constructor&&"function"==typeof e.constructor.isBuffer)return e.constructor.isBuffer(e);return!1}(e))return"buffer";if(function(e){try{if("number"==typeof e.length&&"function"==typeof e.callee)return!0}catch(e){if(-1!==e.message.indexOf("callee"))return!0}return!1}(e))return"arguments";if(function(e){return e instanceof Date||"function"==typeof e.toDateString&&"function"==typeof e.getDate&&"function"==typeof e.setDate}(e))return"date";if(function(e){return e instanceof Error||"string"==typeof e.message&&e.constructor&&"number"==typeof e.constructor.stackTraceLimit}(e))return"error";if(function(e){return e instanceof RegExp||"string"==typeof e.flags&&"boolean"==typeof e.ignoreCase&&"boolean"==typeof e.multiline&&"boolean"==typeof e.global}(e))return"regexp";switch(i(e)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(function(e){return"function"==typeof e.throw&&"function"==typeof e.return&&"function"==typeof e.next}(e))return"generator";switch(t=r.call(e)){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")}},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(5),o=r(0),a=r(16),s=r(12),u=r(25),c=r(21),h=r(49),f=r(10),l=r(11),d=r(26),p=r(36),m=r(146),g=r(91),b=g.PublicKeyHash,y=g.PublicKey,v=g.MultiSigScriptHash,_=g.MultiSig,w=r(27),S=r(18),k=r(60),I=r(8),E=r(90).SCRIPT_ENABLE_SIGHASH_FORKID;function A(e){if(!(this instanceof A))return new A(e);if(this.inputs=[],this.outputs=[],this._inputAmount=void 0,this._outputAmount=void 0,e){if(e instanceof A)return A.shallowCopy(e);if(s.isHexa(e))this.fromString(e);else if(t.isBuffer(e))this.fromBuffer(e);else{if(!i.isObject(e))throw new a.InvalidArgument("Must provide an object or string to deserialize a transaction");this.fromObject(e)}}else this._newTransaction()}A.DUST_AMOUNT=546,A.FEE_SECURITY_MARGIN=150,A.MAX_MONEY=21e14,A.NLOCKTIME_BLOCKHEIGHT_LIMIT=5e8,A.NLOCKTIME_MAX_VALUE=4294967295,A.FEE_PER_KB=500,A.CHANGE_OUTPUT_MAX_SIZE=62,A.shallowCopy=function(e){return new A(e.toBuffer())};var O={configurable:!1,enumerable:!0,get:function(){return this._hash=new u(this._getHash()).readReverse().toString("hex"),this._hash}};Object.defineProperty(A.prototype,"hash",O),Object.defineProperty(A.prototype,"id",O);var x={configurable:!1,enumerable:!0,get:function(){return this._getInputAmount()}};Object.defineProperty(A.prototype,"inputAmount",x),x.get=function(){return this._getOutputAmount()},Object.defineProperty(A.prototype,"outputAmount",x),A.prototype._getHash=function(){return f.sha256sha256(this.toBuffer())},A.prototype.serialize=function(e){return!0===e||e&&e.disableAll?this.uncheckedSerialize():this.checkedSerialize(e)},A.prototype.uncheckedSerialize=A.prototype.toString=function(){return this.toBuffer().toString("hex")},A.prototype.checkedSerialize=function(e){var t=this.getSerializationError(e);if(t)throw t.message+=" - For more information please see: https://bsv.io/api/lib/transaction#serialization-checks",t;return this.uncheckedSerialize()},A.prototype.invalidSatoshis=function(){for(var e=!1,t=0;t<this.outputs.length;t++)this.outputs[t].invalidSatoshis()&&(e=!0);return e},A.prototype.getSerializationError=function(e){if(e=e||{},this.invalidSatoshis())return new a.Transaction.InvalidSatoshis;var t,r=this._getUnspentValue();return r<0?e.disableMoreOutputThanInput||(t=new a.Transaction.InvalidOutputAmountSum):t=this._hasFeeError(e,r),t||this._hasDustOutputs(e)||this._isMissingSignatures(e)},A.prototype._hasFeeError=function(e,t){if(!i.isUndefined(this._fee)&&this._fee!==t)return new a.Transaction.FeeError.Different("Unspent value is "+t+" but specified fee is "+this._fee);if(!e.disableLargeFees){var r=Math.floor(A.FEE_SECURITY_MARGIN*this._estimateFee());if(t>r)return this._missingChange()?new a.Transaction.ChangeAddressMissing("Fee is too large and no change address was provided"):new a.Transaction.FeeError.TooLarge("expected less than "+r+" but got "+t)}},A.prototype._missingChange=function(){return!this._changeScript},A.prototype._hasDustOutputs=function(e){var t,r;if(!e.disableDustOutputs)for(t in this.outputs)if((r=this.outputs[t]).satoshis<A.DUST_AMOUNT&&!r.script.isDataOut()&&!r.script.isSafeDataOut())return new a.Transaction.DustOutputs},A.prototype._isMissingSignatures=function(e){if(!e.disableIsFullySigned)return this.isFullySigned()?void 0:new a.Transaction.MissingSignatures},A.prototype.inspect=function(){return"<Transaction: "+this.uncheckedSerialize()+">"},A.prototype.toBuffer=function(){var e=new c;return this.toBufferWriter(e).toBuffer()},A.prototype.toBufferWriter=function(e){return e.writeInt32LE(this.version),e.writeVarintNum(this.inputs.length),i.each(this.inputs,(function(t){t.toBufferWriter(e)})),e.writeVarintNum(this.outputs.length),i.each(this.outputs,(function(t){t.toBufferWriter(e)})),e.writeUInt32LE(this.nLockTime),e},A.prototype.fromBuffer=function(e){var t=new u(e);return this.fromBufferReader(t)},A.prototype.fromBufferReader=function(e){var t,r,i;for(n.checkArgument(!e.finished(),"No transaction data received"),this.version=e.readInt32LE(),r=e.readVarintNum(),t=0;t<r;t++){var o=g.fromBufferReader(e);this.inputs.push(o)}for(i=e.readVarintNum(),t=0;t<i;t++)this.outputs.push(w.fromBufferReader(e));return this.nLockTime=e.readUInt32LE(),this},A.prototype.toObject=A.prototype.toJSON=function(){var e=[];this.inputs.forEach((function(t){e.push(t.toObject())}));var t=[];this.outputs.forEach((function(e){t.push(e.toObject())}));var r={hash:this.hash,version:this.version,inputs:e,outputs:t,nLockTime:this.nLockTime};return this._changeScript&&(r.changeScript=this._changeScript.toString()),i.isUndefined(this._changeIndex)||(r.changeIndex=this._changeIndex),i.isUndefined(this._fee)||(r.fee=this._fee),r},A.prototype.fromObject=function(e){n.checkArgument(i.isObject(e)||e instanceof A);var t,r=this;return t=e instanceof A?t.toObject():e,i.each(t.inputs,(function(e){if(e.output&&e.output.script){var t,i=new S(e.output.script);if(i.isPublicKeyHashOut())t=new g.PublicKeyHash(e);else if(i.isScriptHashOut()&&e.publicKeys&&e.threshold)t=new g.MultiSigScriptHash(e,e.publicKeys,e.threshold,e.signatures);else{if(!i.isPublicKeyOut())throw new a.Transaction.Input.UnsupportedScript(e.output.script);t=new g.PublicKey(e)}r.addInput(t)}else r.uncheckedAddInput(new g(e))})),i.each(t.outputs,(function(e){r.addOutput(new w(e))})),t.changeIndex&&(this._changeIndex=t.changeIndex),t.changeScript&&(this._changeScript=new S(t.changeScript)),t.fee&&(this._fee=t.fee),this.nLockTime=t.nLockTime,this.version=t.version,this._checkConsistency(e),this},A.prototype._checkConsistency=function(e){i.isUndefined(this._changeIndex)||(n.checkState(this._changeScript,"Change script is expected."),n.checkState(this.outputs[this._changeIndex],"Change index points to undefined output."),n.checkState(this.outputs[this._changeIndex].script.toString()===this._changeScript.toString(),"Change output has an unexpected script.")),e&&e.hash&&n.checkState(e.hash===this.hash,"Hash in object does not match transaction hash.")},A.prototype.lockUntilDate=function(e){if(n.checkArgument(e),i.isNumber(e)&&e<A.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new a.Transaction.LockTimeTooEarly;i.isDate(e)&&(e=e.getTime()/1e3);for(var t=0;t<this.inputs.length;t++)this.inputs[t].sequenceNumber===g.DEFAULT_SEQNUMBER&&(this.inputs[t].sequenceNumber=g.DEFAULT_LOCKTIME_SEQNUMBER);return this.nLockTime=e,this},A.prototype.lockUntilBlockHeight=function(e){if(n.checkArgument(i.isNumber(e)),e>=A.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new a.Transaction.BlockHeightTooHigh;if(e<0)throw new a.Transaction.NLockTimeOutOfRange;for(var t=0;t<this.inputs.length;t++)this.inputs[t].sequenceNumber===g.DEFAULT_SEQNUMBER&&(this.inputs[t].sequenceNumber=g.DEFAULT_LOCKTIME_SEQNUMBER);return this.nLockTime=e,this},A.prototype.getLockTime=function(){return this.nLockTime?this.nLockTime<A.NLOCKTIME_BLOCKHEIGHT_LIMIT?this.nLockTime:new Date(1e3*this.nLockTime):null},A.prototype.fromString=function(e){this.fromBuffer(o.Buffer.from(e,"hex"))},A.prototype._newTransaction=function(){this.version=1,this.nLockTime=0},A.prototype.from=function(e,t,r){if(i.isArray(e)){var n=this;return i.each(e,(function(e){n.from(e,t,r)})),this}return i.some(this.inputs,(function(t){return t.prevTxId.toString("hex")===e.txId&&t.outputIndex===e.outputIndex}))||(t&&r?this._fromMultisigUtxo(e,t,r):this._fromNonP2SH(e)),this},A.prototype._fromNonP2SH=function(e){var t;t=(e=new m(e)).script.isPublicKeyHashOutPrefix()?b:e.script.isPublicKeyOut()?y:g,this.addInput(new t({output:new w({script:e.script,satoshis:e.satoshis}),prevTxId:e.txId,outputIndex:e.outputIndex,script:S.empty()}))},A.prototype._fromMultisigUtxo=function(e,t,r){var i;if(n.checkArgument(r<=t.length,"Number of required signatures must be greater than the number of public keys"),(e=new m(e)).script.isMultisigOut())i=_;else{if(!e.script.isScriptHashOut())throw new a.Transaction.Input.UnsupportedScript(e.script.toString());i=v}this.addInput(new i({output:new w({script:e.script,satoshis:e.satoshis}),prevTxId:e.txId,outputIndex:e.outputIndex,script:S.empty()},t,r))},A.prototype.addInput=function(e,t,r){if(n.checkArgumentType(e,g,"input"),!e.output&&(i.isUndefined(t)||i.isUndefined(r)))throw new a.Transaction.NeedMoreInfo("Need information about the UTXO script and satoshis");return e.output||!t||i.isUndefined(r)||(t=t instanceof S?t:new S(t),n.checkArgumentType(r,"number","satoshis"),e.output=new w({script:t,satoshis:r})),this.uncheckedAddInput(e)},A.prototype.uncheckedAddInput=function(e){return n.checkArgumentType(e,g,"input"),this.inputs.push(e),this._inputAmount=void 0,this._updateChangeOutput(),this},A.prototype.hasAllUtxoInfo=function(){return i.every(this.inputs.map((function(e){return!!e.output})))},A.prototype.fee=function(e){return n.checkArgument(i.isNumber(e),"amount must be a number"),this._fee=e,this._updateChangeOutput(),this},A.prototype.feePerKb=function(e){return n.checkArgument(i.isNumber(e),"amount must be a number"),this._feePerKb=e,this._updateChangeOutput(),this},A.prototype.change=function(e){return n.checkArgument(e,"address is required"),this._changeScript=S.fromAddress(e),this._updateChangeOutput(),this},A.prototype.getChangeOutput=function(){return i.isUndefined(this._changeIndex)?null:this.outputs[this._changeIndex]},A.prototype.to=function(e,t){if(i.isArray(e)){var r=this;return i.each(e,(function(e){r.to(e.address,e.satoshis)})),this}return n.checkArgument(s.isNaturalNumber(t),"Amount is expected to be a positive integer"),this.addOutput(new w({script:S(new p(e)),satoshis:t})),this},A.prototype.addData=function(e){return this.addOutput(new w({script:S.buildDataOut(e),satoshis:0})),this},A.prototype.addSafeData=function(e){return this.addOutput(new w({script:S.buildSafeDataOut(e),satoshis:0})),this},A.prototype.addOutput=function(e){return n.checkArgumentType(e,w,"output"),this._addOutput(e),this._updateChangeOutput(),this},A.prototype.clearOutputs=function(){return this.outputs=[],this._clearSignatures(),this._outputAmount=void 0,this._changeIndex=void 0,this._updateChangeOutput(),this},A.prototype._addOutput=function(e){this.outputs.push(e),this._outputAmount=void 0},A.prototype._getOutputAmount=function(){if(i.isUndefined(this._outputAmount)){var e=this;this._outputAmount=0,i.each(this.outputs,(function(t){e._outputAmount+=t.satoshis}))}return this._outputAmount},A.prototype._getInputAmount=function(){if(i.isUndefined(this._inputAmount)){var e=this;this._inputAmount=0,i.each(this.inputs,(function(t){if(i.isUndefined(t.output))throw new a.Transaction.Input.MissingPreviousOutput;e._inputAmount+=t.output.satoshis}))}return this._inputAmount},A.prototype._updateChangeOutput=function(){if(this._changeScript){this._clearSignatures(),i.isUndefined(this._changeIndex)||this._removeOutput(this._changeIndex),this._changeIndex=this.outputs.length,this._addOutput(new w({script:this._changeScript,satoshis:0}));var e=this._getUnspentValue()-this.getFee();this._removeOutput(this._changeIndex),this._changeIndex=void 0,e>=A.DUST_AMOUNT&&(this._changeIndex=this.outputs.length,this._addOutput(new w({script:this._changeScript,satoshis:e})))}},A.prototype.getFee=function(){return this.isCoinbase()?0:i.isUndefined(this._fee)?this._changeScript?this._estimateFee():this._getUnspentValue():this._fee},A.prototype._estimateFee=function(){var e=this._estimateSize();return Math.ceil(e/1e3*(this._feePerKb||A.FEE_PER_KB))},A.prototype._getUnspentValue=function(){return this._getInputAmount()-this._getOutputAmount()},A.prototype._clearSignatures=function(){i.each(this.inputs,(function(e){e.clearSignatures!==g.prototype.clearSignatures&&e.clearSignatures()}))},A.prototype._estimateSize=function(){var e=8;return e+=h(this.inputs.length).toBuffer().length,e+=h(this.outputs.length).toBuffer().length,i.each(this.inputs,(function(t){e+=t._estimateSize()})),i.each(this.outputs,(function(t){e+=t.getSize()})),e},A.prototype._removeOutput=function(e){var t=this.outputs[e];this.outputs=i.without(this.outputs,t),this._outputAmount=void 0},A.prototype.removeOutput=function(e){this._removeOutput(e),this._updateChangeOutput()},A.prototype.sort=function(){return this.sortInputs((function(e){var t=Array.prototype.concat.apply([],e);return t.sort((function(e,t){return e.prevTxId.compare(t.prevTxId)||e.outputIndex-t.outputIndex})),t})),this.sortOutputs((function(e){var t=Array.prototype.concat.apply([],e);return t.sort((function(e,t){return e.satoshis-t.satoshis||e.script.toBuffer().compare(t.script.toBuffer())})),t})),this},A.prototype.shuffleOutputs=function(){return this.sortOutputs(i.shuffle)},A.prototype.sortOutputs=function(e){var t=e(this.outputs);return this._newOutputOrder(t)},A.prototype.sortInputs=function(e){return this.inputs=e(this.inputs),this._clearSignatures(),this},A.prototype._newOutputOrder=function(e){if(this.outputs.length!==e.length||0!==i.difference(this.outputs,e).length)throw new a.Transaction.InvalidSorting;if(!i.isUndefined(this._changeIndex)){var t=this.outputs[this._changeIndex];this._changeIndex=e.indexOf(t)}return this.outputs=e,this},A.prototype.removeInput=function(e,t){var r;if((r=!t&&i.isNumber(e)?e:i.findIndex(this.inputs,(function(r){return r.prevTxId.toString("hex")===e&&r.outputIndex===t})))<0||r>=this.inputs.length)throw new a.Transaction.InvalidIndex(r,this.inputs.length);var n=this.inputs[r];this.inputs=i.without(this.inputs,n),this._inputAmount=void 0,this._updateChangeOutput()},A.prototype.sign=function(e,t){n.checkState(this.hasAllUtxoInfo(),"Not all utxo information is available to sign the transaction.");var r=this;return i.isArray(e)?(i.each(e,(function(e){r.sign(e,t)})),this):(i.each(this.getSignatures(e,t),(function(e){r.applySignature(e)})),this)},A.prototype.getSignatures=function(e,t){e=new k(e),t=t||l.SIGHASH_ALL|l.SIGHASH_FORKID;var r=this,n=[],o=f.sha256ripemd160(e.publicKey.toBuffer());return i.each(this.inputs,(function(a,s){i.each(a.getSignatures(r,e,s,t,o),(function(e){n.push(e)}))})),n},A.prototype.applySignature=function(e){return this.inputs[e.inputIndex].addSignature(this,e),this},A.prototype.isFullySigned=function(){return i.each(this.inputs,(function(e){if(e.isFullySigned===g.prototype.isFullySigned)throw new a.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction")})),i.every(i.map(this.inputs,(function(e){return e.isFullySigned()})))},A.prototype.isValidSignature=function(e){if(this.inputs[e.inputIndex].isValidSignature===g.prototype.isValidSignature)throw new a.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction");return this.inputs[e.inputIndex].isValidSignature(this,e)},A.prototype.verifySignature=function(e,t,r,i,n,o){return d.verify(this,e,t,r,i,n,o)},A.prototype.verify=function(){if(0===this.inputs.length)return"transaction txins empty";if(0===this.outputs.length)return"transaction txouts empty";for(var e=new I(0),t=0;t<this.outputs.length;t++){var r=this.outputs[t];if(r.invalidSatoshis())return"transaction txout "+t+" satoshis is invalid";if(r._satoshisBN.gt(new I(A.MAX_MONEY,10)))return"transaction txout "+t+" greater than MAX_MONEY";if((e=e.add(r._satoshisBN)).gt(new I(A.MAX_MONEY)))return"transaction txout "+t+" total output greater than MAX_MONEY"}if(this.toBuffer().length>1e6)return"transaction over the maximum block size";var n={};for(t=0;t<this.inputs.length;t++){var o=this.inputs[t],a=o.prevTxId+":"+o.outputIndex;if(!i.isUndefined(n[a]))return"transaction input "+t+" duplicate input";n[a]=!0}if(this.isCoinbase()){var s=this.inputs[0]._scriptBuffer;if(s.length<2||s.length>100)return"coinbase transaction script size invalid"}else for(t=0;t<this.inputs.length;t++)if(this.inputs[t].isNull())return"transaction input "+t+" has null input";return!0},A.prototype.isCoinbase=function(){return 1===this.inputs.length&&this.inputs[0].isNull()},A.prototype.sighash=function(e,t,r,i,n){t=t||l.SIGHASH_ALL|l.SIGHASH_FORKID;var o=this.inputs[e];if(!o)throw new Error("Input index "+e+" does not exist");return!r&&o.output&&(r=o.output.script),!i&&o.output&&(i=new I(o.output.satoshis)),n=n||E,d.sighash(this,t,e,r,i,n)},e.exports=A}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var i=r(3),n=r(5),o=r(12),a=r(18),s=r(36);function u(e){if(!(this instanceof u))return new u(e);n.checkArgument(i.isObject(e),"Must provide an object from where to extract data");var t=e.address?new s(e.address):void 0,r=e.txid?e.txid:e.txId;if(!r||!o.isHexaString(r)||r.length>64)throw new Error("Invalid TXID in object",e);var c=i.isUndefined(e.vout)?e.outputIndex:e.vout;if(!i.isNumber(c))throw new Error("Invalid outputIndex, received "+c);n.checkArgument(!i.isUndefined(e.scriptPubKey)||!i.isUndefined(e.script),"Must provide the scriptPubKey for that output!");var h=new a(e.scriptPubKey||e.script);n.checkArgument(!i.isUndefined(e.amount)||!i.isUndefined(e.satoshis),"Must provide an amount for the output");var f=i.isUndefined(e.amount)?e.satoshis:Math.round(1e8*e.amount);n.checkArgument(i.isNumber(f),"Amount must be a number"),o.defineImmutable(this,{address:t,txId:r,outputIndex:c,script:h,satoshis:f})}u.prototype.inspect=function(){return"<UnspentOutput: "+this.txId+":"+this.outputIndex+", satoshis: "+this.satoshis+", address: "+this.address+">"},u.prototype.toString=function(){return this.txId+":"+this.outputIndex},u.fromObject=function(e){return new u(e)},u.prototype.toObject=u.prototype.toJSON=function(){return{address:this.address?this.address.toString():void 0,txid:this.txId,vout:this.outputIndex,scriptPubKey:this.script.toBuffer().toString("hex"),amount:Number.parseFloat((this.satoshis/1e8).toFixed(8))}},e.exports=u},function(e,t,r){"use strict";(function(t){var i=r(8),n=r(32),o=(r(10),r(3),new i(2147483647));function a(e){return this instanceof a?(this.options=e||{},this):new a(e)}a.split=function(e,r,i,n){if(n=n||{},!e)throw new Error("Secret is required");if(r<2)throw new Error("Threshold must be at least 2");if(i<r)throw new Error("Number of shares must be at least threshold");if(r>255||i>255)throw new Error("Threshold and shares must be <= 255");for(var o=t.isBuffer(e)?e:t.from(e,"utf8"),s=[],u=0;u<o.length;u++){var c=o[u],h=a._splitByte(c,r,i);s.push(h)}for(var f=[],l=0;l<i;l++){for(var d={id:l+1,threshold:r,shares:i,length:o.length,bytes:[]},p=0;p<s.length;p++)d.bytes.push(s[p][l]);f.push(d)}return f},a.combine=function(e){if(!e||0===e.length)throw new Error("Shares array is required");var r=e[0].threshold,i=e[0].shares,n=e[0].length;if(e.length<r)throw new Error("Insufficient shares: need "+r+", got "+e.length);for(var o=0;o<e.length;o++){if(e[o].threshold!==r||e[o].shares!==i)throw new Error("Shares have inconsistent parameters");if(e[o].length!==n)throw new Error("Shares have different secret lengths")}for(var s=[],u=0;u<n;u++){for(var c=[],h=0;h<Math.min(e.length,r);h++)c.push(e[h].bytes[u]);var f=a._combineByte(c);s.push(f)}return t.from(s)},a._splitByte=function(e,t,r){for(var n=[new i(e)],o=1;o<t;o++){var s=a._randomFieldElement();n.push(s)}for(var u=[],c=1;c<=r;c++){var h=a._evaluatePolynomial(n,new i(c));u.push({x:c,y:h.toString(16)})}return u},a._combineByte=function(e){if(0===e.length)throw new Error("No shares provided");for(var t=new i(0),r=0;r<e.length;r++){for(var n=new i(e[r].x),s=new i(e[r].y,16),u=new i(1),c=new i(1),h=0;h<e.length;h++)if(r!==h){var f=new i(e[h].x),l=new i(0).sub(f);l.lt(new i(0))&&(l=l.add(o)),u=u.mul(l).mod(o);var d=n.sub(f);d.lt(new i(0))&&(d=d.add(o)),c=c.mul(d).mod(o)}var p=a._modInverse(c,o),m=u.mul(p).mod(o);t=t.add(s.mul(m)).mod(o)}return t.mod(o).mod(new i(256)).toNumber()},a._evaluatePolynomial=function(e,t){for(var r=new i(0),n=new i(1),a=0;a<e.length;a++)r=r.add(e[a].mul(n)).mod(o),n=n.mul(t).mod(o);return r},a._randomFieldElement=function(){var e=n.getRandomBuffer(32);return new i(e).mod(o.sub(new i(1))).add(new i(1))},a._modInverse=function(e,t){e.lt(new i(0))&&(e=e.mod(t).add(t));var r=a._extendedGCD(e,t);if(!r.gcd.eq(new i(1)))throw new Error("Modular inverse does not exist");return r.x.mod(t).add(t).mod(t)},a._extendedGCD=function(e,t){if(e.eq(new i(0)))return{gcd:t,x:new i(0),y:new i(1)};var r=a._extendedGCD(t.mod(e),e);return{gcd:r.gcd,x:r.y.sub(t.div(e).mul(r.x)),y:r.x}},a.verifyShare=function(e){try{if(!e||"object"!=typeof e)return!1;if(!(e.id&&e.threshold&&e.shares&&e.bytes&&"number"==typeof e.length))return!1;if(e.threshold<2||e.shares<e.threshold)return!1;if(!Array.isArray(e.bytes)||e.bytes.length!==e.length)return!1;for(var t=0;t<e.bytes.length;t++){var r=e.bytes[t];if(!r.x||!r.y)return!1;if(r.x<1||r.x>e.shares)return!1;try{var n=r.y;if(!/^[0-9a-fA-F]+$/.test(n))return!1;new i(n,16)}catch(e){return!1}}return!0}catch(e){return!1}},a.generateTestVectors=function(){var e="Hello, Bitcoin SV!",t=a.split(e,3,5),r=a.combine(t.slice(0,3));return{secret:e,threshold:3,totalShares:5,shares:t,reconstructed:r.toString("utf8"),valid:r.toString("utf8")===e}},e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(62),o=r(25),a=r(21),s=r(10),u=r(31),c=r(16),h=r(5);function f(e){if(!(this instanceof f))return new f(e);var r={};if(t.isBuffer(e))r=f._fromBufferReader(o(e));else{if(!i.isObject(e))throw new TypeError("Unrecognized argument for MerkleBlock");r={header:e.header instanceof n?e.header:n.fromObject(e.header),numTransactions:e.numTransactions,hashes:e.hashes,flags:e.flags}}return i.extend(this,r),this._flagBitsUsed=0,this._hashesUsed=0,this}f.fromBuffer=function(e){return f.fromBufferReader(o(e))},f.fromBufferReader=function(e){return new f(f._fromBufferReader(e))},f.prototype.toBuffer=function(){return this.toBufferWriter().concat()},f.prototype.toBufferWriter=function(e){e||(e=new a),e.write(this.header.toBuffer()),e.writeUInt32LE(this.numTransactions),e.writeVarintNum(this.hashes.length);for(var r=0;r<this.hashes.length;r++)e.write(t.from(this.hashes[r],"hex"));for(e.writeVarintNum(this.flags.length),r=0;r<this.flags.length;r++)e.writeUInt8(this.flags[r]);return e},f.prototype.toObject=f.prototype.toJSON=function(){return{header:this.header.toObject(),numTransactions:this.numTransactions,hashes:this.hashes,flags:this.flags}},f.prototype.validMerkleTree=function(){if(h.checkState(i.isArray(this.flags),"MerkleBlock flags is not an array"),h.checkState(i.isArray(this.hashes),"MerkleBlock hashes is not an array"),this.hashes.length>this.numTransactions)return!1;if(8*this.flags.length<this.hashes.length)return!1;var e=this._calcTreeHeight(),t={hashesUsed:0,flagBitsUsed:0},r=this._traverseMerkleTree(e,0,t);return t.hashesUsed===this.hashes.length&&r.equals(this.header.merkleRoot)},f.prototype.filterdTxsHash=function(){throw new Error("filterdTxsHash has been deprecated. use filteredTxsHash.")},f.prototype.filteredTxsHash=function(){if(h.checkState(i.isArray(this.flags),"MerkleBlock flags is not an array"),h.checkState(i.isArray(this.hashes),"MerkleBlock hashes is not an array"),this.hashes.length>this.numTransactions)throw new c.MerkleBlock.InvalidMerkleTree;if(8*this.flags.length<this.hashes.length)throw new c.MerkleBlock.InvalidMerkleTree;if(1===this.hashes.length)return[];var e=this._calcTreeHeight(),t={hashesUsed:0,flagBitsUsed:0},r=this._traverseMerkleTree(e,0,t,!0);if(t.hashesUsed!==this.hashes.length)throw new c.MerkleBlock.InvalidMerkleTree;return r},f.prototype._traverseMerkleTree=function(e,r,i,n){if((i=i||{}).txs=i.txs||[],i.flagBitsUsed=i.flagBitsUsed||0,i.hashesUsed=i.hashesUsed||0,n=n||!1,i.flagBitsUsed>8*this.flags.length)return null;var o=this.flags[i.flagBitsUsed>>3]>>>(7&i.flagBitsUsed++)&1;if(0!==e&&o){var a=this._traverseMerkleTree(e-1,2*r,i),u=a;return 2*r+1<this._calcTreeWidth(e-1)&&(u=this._traverseMerkleTree(e-1,2*r+1,i)),n?i.txs:s.sha256sha256(t.concat([a,u]))}if(i.hashesUsed>=this.hashes.length)return null;var c=this.hashes[i.hashesUsed++];return 0===e&&o&&i.txs.push(c),t.from(c,"hex")},f.prototype._calcTreeWidth=function(e){return this.numTransactions+(1<<e)-1>>e},f.prototype._calcTreeHeight=function(){for(var e=0;this._calcTreeWidth(e)>1;)e++;return e},f.prototype.hasTransaction=function(e){h.checkArgument(!i.isUndefined(e),"tx cannot be undefined"),h.checkArgument(e instanceof u||"string"==typeof e,'Invalid tx given, tx must be a "string" or "Transaction"');var r=e;e instanceof u&&(r=t.from(e.id,"hex").reverse().toString("hex"));var n=[],o=this._calcTreeHeight();return this._traverseMerkleTree(o,0,{txs:n}),-1!==n.indexOf(r)},f._fromBufferReader=function(e){h.checkState(!e.finished(),"No merkleblock data received");var t={};t.header=n.fromBufferReader(e),t.numTransactions=e.readUInt32LE();var r=e.readVarintNum();t.hashes=[];for(var i=0;i<r;i++)t.hashes.push(e.read(32).toString("hex"));var o=e.readVarintNum();for(t.flags=[],i=0;i<o;i++)t.flags.push(e.readUInt8());return t},f.fromObject=function(e){return new f(e)},e.exports=f}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(48),n=r(0),o=r(3),a=r(5),s=r(8),u=r(61),c=r(47),h=r(10),f=r(30),l=r(17),d=r(60),p=r(32),m=r(16),g=m.HDPrivateKey,b=r(12);function y(e){if(e instanceof y)return e;if(!(this instanceof y))return new y(e);if(!e)return this._generateRandomly();if(f.get(e))return this._generateRandomly(e);if(o.isString(e)||t.isBuffer(e))if(y.isValidSerialized(e))this._buildFromSerialized(e);else if(b.isValidJSON(e))this._buildFromJSON(e);else{if(!t.isBuffer(e)||!y.isValidSerialized(e.toString()))throw y.getSerializedError(e);this._buildFromSerialized(e.toString())}else{if(!o.isObject(e))throw new g.UnrecognizedArgument(e);this._buildFromObject(e)}}y.fromRandom=function(){return new y},y.isValidPath=function(e,t){if(o.isString(e)){var r=y._getDerivationIndexes(e);return null!==r&&o.every(r,y.isValidPath)}return!!o.isNumber(e)&&(e<y.Hardened&&!0===t&&(e+=y.Hardened),e>=0&&e<y.MaxIndex)},y._getDerivationIndexes=function(e){var t=e.split("/");if(o.includes(y.RootElementAlias,e))return[];if(!o.includes(y.RootElementAlias,t[0]))return null;var r=t.slice(1).map((function(e){var t="'"===e.slice(-1);if(t&&(e=e.slice(0,-1)),!e||"-"===e[0])return NaN;var r=+e;return t&&(r+=y.Hardened),r}));return o.some(r,isNaN)?null:r},y.prototype.derive=function(){throw new Error("derive has been deprecated. use deriveChild or, for the old way, deriveNonCompliantChild.")},y.prototype.deriveChild=function(e,t){if(o.isNumber(e))return this._deriveWithNumber(e,t);if(o.isString(e))return this._deriveFromString(e);throw new g.InvalidDerivationArgument(e)},y.prototype.deriveNonCompliantChild=function(e,t){if(o.isNumber(e))return this._deriveWithNumber(e,t,!0);if(o.isString(e))return this._deriveFromString(e,!0);throw new g.InvalidDerivationArgument(e)},y.prototype._deriveWithNumber=function(e,r,o){if(!y.isValidPath(e,r))throw new g.InvalidPath(e);r=e>=y.Hardened||r,e<y.Hardened&&!0===r&&(e+=y.Hardened);var a,u=b.integerAsBuffer(e);if(r&&o){var c=this.privateKey.bn.toBuffer();a=t.concat([n.Buffer.from([0]),c,u])}else if(r){var f=this.privateKey.bn.toBuffer({size:32});i(32===f.length,"length of private key buffer is expected to be 32 bytes"),a=t.concat([n.Buffer.from([0]),f,u])}else a=t.concat([this.publicKey.toBuffer(),u]);var p=h.sha512hmac(a,this._buffers.chainCode),m=s.fromBuffer(p.slice(0,32),{size:32}),v=p.slice(32,64),_=m.add(this.privateKey.toBigNumber()).umod(l.getN()).toBuffer({size:32});return d.isValid(_)?new y({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:e,chainCode:v,privateKey:_}):this._deriveWithNumber(e+1,null,o)},y.prototype._deriveFromString=function(e,t){if(!y.isValidPath(e))throw new g.InvalidPath(e);return y._getDerivationIndexes(e).reduce((function(e,r){return e._deriveWithNumber(r,null,t)}),this)},y.isValidSerialized=function(e,t){return!y.getSerializedError(e,t)},y.getSerializedError=function(e,r){if(!o.isString(e)&&!t.isBuffer(e))return new g.UnrecognizedArgument("Expected string or buffer");if(!u.validCharacters(e))return new m.InvalidB58Char("(unknown)",e);try{e=c.decode(e)}catch(t){return new m.InvalidB58Checksum(e)}if(e.length!==y.DataLength)return new g.InvalidLength(e);if(!o.isUndefined(r)){var i=y._validateNetwork(e,r);if(i)return i}return null},y._validateNetwork=function(e,t){var r=f.get(t);if(!r)return new m.InvalidNetworkArgument(t);var i=e.slice(0,4);return i.readUInt32BE(0)!==r.xprivkey?new m.InvalidNetwork(i):null},y.fromString=function(e){return a.checkArgument(o.isString(e),"No valid string was provided"),new y(e)},y.fromObject=function(e){return a.checkArgument(o.isObject(e),"No valid argument was provided"),new y(e)},y.prototype._buildFromJSON=function(e){return this._buildFromObject(JSON.parse(e))},y.prototype._buildFromObject=function(e){var r={version:e.network?b.integerAsBuffer(f.get(e.network).xprivkey):e.version,depth:o.isNumber(e.depth)?t.from([255&e.depth]):e.depth,parentFingerPrint:o.isNumber(e.parentFingerPrint)?b.integerAsBuffer(e.parentFingerPrint):e.parentFingerPrint,childIndex:o.isNumber(e.childIndex)?b.integerAsBuffer(e.childIndex):e.childIndex,chainCode:o.isString(e.chainCode)?t.from(e.chainCode,"hex"):e.chainCode,privateKey:o.isString(e.privateKey)&&b.isHexa(e.privateKey)?t.from(e.privateKey,"hex"):e.privateKey,checksum:e.checksum?e.checksum.length?e.checksum:b.integerAsBuffer(e.checksum):void 0};return this._buildFromBuffers(r)},y.prototype._buildFromSerialized=function(e){var t=c.decode(e),r={version:t.slice(y.VersionStart,y.VersionEnd),depth:t.slice(y.DepthStart,y.DepthEnd),parentFingerPrint:t.slice(y.ParentFingerPrintStart,y.ParentFingerPrintEnd),childIndex:t.slice(y.ChildIndexStart,y.ChildIndexEnd),chainCode:t.slice(y.ChainCodeStart,y.ChainCodeEnd),privateKey:t.slice(y.PrivateKeyStart,y.PrivateKeyEnd),checksum:t.slice(y.ChecksumStart,y.ChecksumEnd),xprivkey:e};return this._buildFromBuffers(r)},y.prototype._generateRandomly=function(e){return y.fromSeed(p.getRandomBuffer(64),e)},y.fromSeed=function(e,r){if(b.isHexaString(e)&&(e=t.from(e,"hex")),!t.isBuffer(e))throw new g.InvalidEntropyArgument(e);if(e.length<16)throw new g.InvalidEntropyArgument.NotEnoughEntropy(e);if(e.length>64)throw new g.InvalidEntropyArgument.TooMuchEntropy(e);var i=h.sha512hmac(e,n.Buffer.from("Bitcoin seed"));return new y({network:f.get(r)||f.defaultNetwork,depth:0,parentFingerPrint:0,childIndex:0,privateKey:i.slice(0,32),chainCode:i.slice(32,64)})},y.prototype._calcHDPublicKey=function(){if(!this._hdPublicKey){var e=r(150);this._hdPublicKey=new e(this)}},y.prototype._buildFromBuffers=function(e){y._validateBufferArguments(e),b.defineImmutable(this,{_buffers:e});var r=[e.version,e.depth,e.parentFingerPrint,e.childIndex,e.chainCode,t.alloc(1),e.privateKey],i=n.Buffer.concat(r);if(e.checksum&&e.checksum.length){if(e.checksum.toString()!==c.checksum(i).toString())throw new m.InvalidB58Checksum(i)}else e.checksum=c.checksum(i);var o,a=f.get(e.version.readUInt32BE(0));o=c.encode(n.Buffer.concat(r)),e.xprivkey=t.from(o);var u=new d(s.fromBuffer(e.privateKey),a),l=u.toPublicKey(),p=y.ParentFingerPrintSize,g=h.sha256ripemd160(l.toBuffer()).slice(0,p);return b.defineImmutable(this,{xprivkey:o,network:a,depth:e.depth[0],privateKey:u,publicKey:l,fingerPrint:g}),this._hdPublicKey=null,Object.defineProperty(this,"hdPublicKey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey}}),Object.defineProperty(this,"xpubkey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey.xpubkey}}),this},y._validateBufferArguments=function(e){var r=function(r,n){var o=e[r];i(t.isBuffer(o),r+" argument is not a buffer"),i(o.length===n,r+" has not the expected size: found "+o.length+", expected "+n)};r("version",y.VersionSize),r("depth",y.DepthSize),r("parentFingerPrint",y.ParentFingerPrintSize),r("childIndex",y.ChildIndexSize),r("chainCode",y.ChainCodeSize),r("privateKey",y.PrivateKeySize),e.checksum&&e.checksum.length&&r("checksum",y.CheckSumSize)},y.prototype.toString=function(){return this.xprivkey},y.prototype.inspect=function(){return"<HDPrivateKey: "+this.xprivkey+">"},y.prototype.toObject=y.prototype.toJSON=function(){return{network:f.get(this._buffers.version.readUInt32BE(0),"xprivkey").name,depth:this._buffers.depth[0],fingerPrint:this.fingerPrint.readUInt32BE(0),parentFingerPrint:this._buffers.parentFingerPrint.readUInt32BE(0),childIndex:this._buffers.childIndex.readUInt32BE(0),chainCode:this._buffers.chainCode.toString("hex"),privateKey:this.privateKey.toBuffer().toString("hex"),checksum:this._buffers.checksum.readUInt32BE(0),xprivkey:this.xprivkey}},y.fromBuffer=function(e){return new y(e.toString())},y.fromHex=function(e){return y.fromBuffer(t.from(e,"hex"))},y.prototype.toBuffer=function(){return t.from(this.toString())},y.prototype.toHex=function(){return this.toBuffer().toString("hex")},y.DefaultDepth=0,y.DefaultFingerprint=0,y.DefaultChildIndex=0,y.Hardened=2147483648,y.MaxIndex=2*y.Hardened,y.RootElementAlias=["m","M","m'","M'"],y.VersionSize=4,y.DepthSize=1,y.ParentFingerPrintSize=4,y.ChildIndexSize=4,y.ChainCodeSize=32,y.PrivateKeySize=32,y.CheckSumSize=4,y.DataLength=78,y.SerializedByteSize=82,y.VersionStart=0,y.VersionEnd=y.VersionStart+y.VersionSize,y.DepthStart=y.VersionEnd,y.DepthEnd=y.DepthStart+y.DepthSize,y.ParentFingerPrintStart=y.DepthEnd,y.ParentFingerPrintEnd=y.ParentFingerPrintStart+y.ParentFingerPrintSize,y.ChildIndexStart=y.ParentFingerPrintEnd,y.ChildIndexEnd=y.ChildIndexStart+y.ChildIndexSize,y.ChainCodeStart=y.ChildIndexEnd,y.ChainCodeEnd=y.ChainCodeStart+y.ChainCodeSize,y.PrivateKeyStart=y.ChainCodeEnd+1,y.PrivateKeyEnd=y.PrivateKeyStart+y.PrivateKeySize,y.ChecksumStart=y.PrivateKeyEnd,y.ChecksumEnd=y.ChecksumStart+y.CheckSumSize,i(y.ChecksumEnd===y.SerializedByteSize),e.exports=y}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(5),o=r(8),a=r(61),s=r(47),u=r(10),c=r(149),h=r(30),f=r(17),l=r(20),d=r(16),p=d,m=d.HDPublicKey,g=r(48),b=r(12);function y(e){if(e instanceof y)return e;if(!(this instanceof y))return new y(e);if(e){if(i.isString(e)||t.isBuffer(e)){var r=y.getSerializedError(e);if(r){if(t.isBuffer(e)&&!y.getSerializedError(e.toString()))return this._buildFromSerialized(e.toString());if(r instanceof m.ArgumentIsPrivateExtended)return new c(e).hdPublicKey;throw r}return this._buildFromSerialized(e)}if(i.isObject(e))return e instanceof c?this._buildFromPrivate(e):this._buildFromObject(e);throw new m.UnrecognizedArgument(e)}throw new m.MustSupplyArgument}y.fromHDPrivateKey=function(e){return new y(e)},y.isValidPath=function(e){if(i.isString(e)){var t=c._getDerivationIndexes(e);return null!==t&&i.every(t,y.isValidPath)}return!!i.isNumber(e)&&(e>=0&&e<y.Hardened)},y.prototype.derive=function(){throw new Error("derive has been deprecated. use deriveChild or, for the old way, deriveNonCompliantChild.")},y.prototype.deriveChild=function(e,t){if(i.isNumber(e))return this._deriveWithNumber(e,t);if(i.isString(e))return this._deriveFromString(e);throw new m.InvalidDerivationArgument(e)},y.prototype._deriveWithNumber=function(e,r){if(e>=y.Hardened||r)throw new m.InvalidIndexCantDeriveHardened;if(e<0)throw new m.InvalidPath(e);var i,n=b.integerAsBuffer(e),a=t.concat([this.publicKey.toBuffer(),n]),s=u.sha512hmac(a,this._buffers.chainCode),c=o.fromBuffer(s.slice(0,32),{size:32}),h=s.slice(32,64);try{i=l.fromPoint(f.getG().mul(c).add(this.publicKey.point))}catch(t){return this._deriveWithNumber(e+1)}return new y({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:e,chainCode:h,publicKey:i})},y.prototype._deriveFromString=function(e){if(i.includes(e,"'"))throw new m.InvalidIndexCantDeriveHardened;if(!y.isValidPath(e))throw new m.InvalidPath(e);return c._getDerivationIndexes(e).reduce((function(e,t){return e._deriveWithNumber(t)}),this)},y.isValidSerialized=function(e,t){return i.isNull(y.getSerializedError(e,t))},y.getSerializedError=function(e,r){if(!i.isString(e)&&!t.isBuffer(e))return new m.UnrecognizedArgument("expected buffer or string");if(!a.validCharacters(e))return new p.InvalidB58Char("(unknown)",e);try{e=s.decode(e)}catch(t){return new p.InvalidB58Checksum(e)}if(e.length!==y.DataSize)return new m.InvalidLength(e);if(!i.isUndefined(r)){var n=y._validateNetwork(e,r);if(n)return n}var o=e.readUInt32BE(0);return o===h.livenet.xprivkey||o===h.testnet.xprivkey?new m.ArgumentIsPrivateExtended:null},y._validateNetwork=function(e,t){var r=h.get(t);if(!r)return new p.InvalidNetworkArgument(t);var i=e.slice(y.VersionStart,y.VersionEnd);return i.readUInt32BE(0)!==r.xpubkey?new p.InvalidNetwork(i):null},y.prototype._buildFromPrivate=function(e){var t=i.clone(e._buffers),r=f.getG().mul(o.fromBuffer(t.privateKey));return t.publicKey=f.pointToCompressed(r),t.version=b.integerAsBuffer(h.get(t.version.readUInt32BE(0)).xpubkey),t.privateKey=void 0,t.checksum=void 0,t.xprivkey=void 0,this._buildFromBuffers(t)},y.prototype._buildFromObject=function(e){var r={version:e.network?b.integerAsBuffer(h.get(e.network).xpubkey):e.version,depth:i.isNumber(e.depth)?t.from([255&e.depth]):e.depth,parentFingerPrint:i.isNumber(e.parentFingerPrint)?b.integerAsBuffer(e.parentFingerPrint):e.parentFingerPrint,childIndex:i.isNumber(e.childIndex)?b.integerAsBuffer(e.childIndex):e.childIndex,chainCode:i.isString(e.chainCode)?t.from(e.chainCode,"hex"):e.chainCode,publicKey:i.isString(e.publicKey)?t.from(e.publicKey,"hex"):t.isBuffer(e.publicKey)?e.publicKey:e.publicKey.toBuffer(),checksum:i.isNumber(e.checksum)?b.integerAsBuffer(e.checksum):e.checksum};return this._buildFromBuffers(r)},y.prototype._buildFromSerialized=function(e){var t=s.decode(e),r={version:t.slice(y.VersionStart,y.VersionEnd),depth:t.slice(y.DepthStart,y.DepthEnd),parentFingerPrint:t.slice(y.ParentFingerPrintStart,y.ParentFingerPrintEnd),childIndex:t.slice(y.ChildIndexStart,y.ChildIndexEnd),chainCode:t.slice(y.ChainCodeStart,y.ChainCodeEnd),publicKey:t.slice(y.PublicKeyStart,y.PublicKeyEnd),checksum:t.slice(y.ChecksumStart,y.ChecksumEnd),xpubkey:e};return this._buildFromBuffers(r)},y.prototype._buildFromBuffers=function(e){y._validateBufferArguments(e),b.defineImmutable(this,{_buffers:e});var r=[e.version,e.depth,e.parentFingerPrint,e.childIndex,e.chainCode,e.publicKey],i=t.concat(r),n=s.checksum(i);if(e.checksum&&e.checksum.length){if(e.checksum.toString("hex")!==n.toString("hex"))throw new p.InvalidB58Checksum(i,n)}else e.checksum=n;var o,a=h.get(e.version.readUInt32BE(0));o=s.encode(t.concat(r)),e.xpubkey=t.from(o);var c=new l(e.publicKey,{network:a}),f=y.ParentFingerPrintSize,d=u.sha256ripemd160(c.toBuffer()).slice(0,f);return b.defineImmutable(this,{xpubkey:o,network:a,depth:e.depth[0],publicKey:c,fingerPrint:d}),this},y._validateBufferArguments=function(e){var r=function(r,i){var n=e[r];g(t.isBuffer(n),r+" argument is not a buffer, it's "+typeof n),g(n.length===i,r+" has not the expected size: found "+n.length+", expected "+i)};r("version",y.VersionSize),r("depth",y.DepthSize),r("parentFingerPrint",y.ParentFingerPrintSize),r("childIndex",y.ChildIndexSize),r("chainCode",y.ChainCodeSize),r("publicKey",y.PublicKeySize),e.checksum&&e.checksum.length&&r("checksum",y.CheckSumSize)},y.fromString=function(e){return n.checkArgument(i.isString(e),"No valid string was provided"),new y(e)},y.fromObject=function(e){return n.checkArgument(i.isObject(e),"No valid argument was provided"),new y(e)},y.prototype.toString=function(){return this.xpubkey},y.prototype.inspect=function(){return"<HDPublicKey: "+this.xpubkey+">"},y.prototype.toObject=y.prototype.toJSON=function(){return{network:h.get(this._buffers.version.readUInt32BE(0)).name,depth:this._buffers.depth[0],fingerPrint:this.fingerPrint.readUInt32BE(0),parentFingerPrint:this._buffers.parentFingerPrint.readUInt32BE(0),childIndex:this._buffers.childIndex.readUInt32BE(0),chainCode:this._buffers.chainCode.toString("hex"),publicKey:this.publicKey.toString(),checksum:this._buffers.checksum.readUInt32BE(0),xpubkey:this.xpubkey}},y.fromBuffer=function(e){return new y(e)},y.fromHex=function(e){return y.fromBuffer(t.from(e,"hex"))},y.prototype.toBuffer=function(){return t.from(this._buffers.xpubkey)},y.prototype.toHex=function(){return this.toBuffer().toString("hex")},y.Hardened=2147483648,y.RootElementAlias=["m","M"],y.VersionSize=4,y.DepthSize=1,y.ParentFingerPrintSize=4,y.ChildIndexSize=4,y.ChainCodeSize=32,y.PublicKeySize=33,y.CheckSumSize=4,y.DataSize=78,y.SerializedByteSize=82,y.VersionStart=0,y.VersionEnd=y.VersionStart+y.VersionSize,y.DepthStart=y.VersionEnd,y.DepthEnd=y.DepthStart+y.DepthSize,y.ParentFingerPrintStart=y.DepthEnd,y.ParentFingerPrintEnd=y.ParentFingerPrintStart+y.ParentFingerPrintSize,y.ChildIndexStart=y.ParentFingerPrintEnd,y.ChildIndexEnd=y.ChildIndexStart+y.ChildIndexSize,y.ChainCodeStart=y.ChildIndexEnd,y.ChainCodeEnd=y.ChainCodeStart+y.ChainCodeSize,y.PublicKeyStart=y.ChainCodeEnd,y.PublicKeyEnd=y.PublicKeyStart+y.PublicKeySize,y.ChecksumStart=y.PublicKeyEnd,y.ChecksumEnd=y.ChecksumStart+y.CheckSumSize,g(y.PublicKeyEnd===y.DataSize),g(y.ChecksumEnd===y.SerializedByteSize),e.exports=y}).call(this,r(0).Buffer)},function(e,t,r){
|
|
16
|
+
*/function n(e,t){if(e===t)return 0;for(var r=e.length,i=t.length,n=0,o=Math.min(r,i);n<o;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}return r<i?-1:i<r?1:0}function o(e){return t.Buffer&&"function"==typeof t.Buffer.isBuffer?t.Buffer.isBuffer(e):!(null==e||!e._isBuffer)}var a=r(88),s=Object.prototype.hasOwnProperty,u=Array.prototype.slice,c="foo"===function(){}.name;function h(e){return Object.prototype.toString.call(e)}function f(e){return!o(e)&&("function"==typeof t.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer))))}var l=e.exports=y,d=/\s*function\s+([^\(\s]*)\s*/;function p(e){if(a.isFunction(e)){if(c)return e.name;var t=e.toString().match(d);return t&&t[1]}}function m(e,t){return"string"==typeof e?e.length<t?e:e.slice(0,t):e}function g(e){if(c||!a.isFunction(e))return a.inspect(e);var t=p(e);return"[Function"+(t?": "+t:"")+"]"}function b(e,t,r,i,n){throw new l.AssertionError({message:r,actual:e,expected:t,operator:i,stackStartFunction:n})}function y(e,t){e||b(e,!0,t,"==",l.ok)}function v(e,t,r,i){if(e===t)return!0;if(o(e)&&o(t))return 0===n(e,t);if(a.isDate(e)&&a.isDate(t))return e.getTime()===t.getTime();if(a.isRegExp(e)&&a.isRegExp(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(null!==e&&"object"==typeof e||null!==t&&"object"==typeof t){if(f(e)&&f(t)&&h(e)===h(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return 0===n(new Uint8Array(e.buffer),new Uint8Array(t.buffer));if(o(e)!==o(t))return!1;var s=(i=i||{actual:[],expected:[]}).actual.indexOf(e);return-1!==s&&s===i.expected.indexOf(t)||(i.actual.push(e),i.expected.push(t),function(e,t,r,i){if(null==e||null==t)return!1;if(a.isPrimitive(e)||a.isPrimitive(t))return e===t;if(r&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var n=_(e),o=_(t);if(n&&!o||!n&&o)return!1;if(n)return e=u.call(e),t=u.call(t),v(e,t,r);var s,c,h=k(e),f=k(t);if(h.length!==f.length)return!1;for(h.sort(),f.sort(),c=h.length-1;c>=0;c--)if(h[c]!==f[c])return!1;for(c=h.length-1;c>=0;c--)if(s=h[c],!v(e[s],t[s],r,i))return!1;return!0}(e,t,r,i))}return r?e===t:e==t}function _(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function w(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function S(e,t,r,i){var n;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(i=r,r=null),n=function(e){var t;try{e()}catch(e){t=e}return t}(t),i=(r&&r.name?" ("+r.name+").":".")+(i?" "+i:"."),e&&!n&&b(n,r,"Missing expected exception"+i);var o="string"==typeof i,s=!e&&n&&!r;if((!e&&a.isError(n)&&o&&w(n,r)||s)&&b(n,r,"Got unwanted exception"+i),e&&n&&r&&!w(n,r)||!e&&n)throw n}l.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return m(g(e.actual),128)+" "+e.operator+" "+m(g(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||b;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var i=r.stack,n=p(t),o=i.indexOf("\n"+n);if(o>=0){var a=i.indexOf("\n",o+1);i=i.substring(a+1)}this.stack=i}}},a.inherits(l.AssertionError,Error),l.fail=b,l.ok=y,l.equal=function(e,t,r){e!=t&&b(e,t,r,"==",l.equal)},l.notEqual=function(e,t,r){e==t&&b(e,t,r,"!=",l.notEqual)},l.deepEqual=function(e,t,r){v(e,t,!1)||b(e,t,r,"deepEqual",l.deepEqual)},l.deepStrictEqual=function(e,t,r){v(e,t,!0)||b(e,t,r,"deepStrictEqual",l.deepStrictEqual)},l.notDeepEqual=function(e,t,r){v(e,t,!1)&&b(e,t,r,"notDeepEqual",l.notDeepEqual)},l.notDeepStrictEqual=function e(t,r,i){v(t,r,!0)&&b(t,r,i,"notDeepStrictEqual",e)},l.strictEqual=function(e,t,r){e!==t&&b(e,t,r,"===",l.strictEqual)},l.notStrictEqual=function(e,t,r){e===t&&b(e,t,r,"!==",l.notStrictEqual)},l.throws=function(e,t,r){S(!0,e,t,r)},l.doesNotThrow=function(e,t,r){S(!1,e,t,r)},l.ifError=function(e){if(e)throw e},l.strict=i((function e(t,r){t||b(t,!0,r,"==",e)}),l,{equal:l.strictEqual,deepEqual:l.deepStrictEqual,notEqual:l.notStrictEqual,notDeepEqual:l.notDeepStrictEqual}),l.strict.strict=l.strict;var k=Object.keys||function(e){var t=[];for(var r in e)s.call(e,r)&&t.push(r);return t}}).call(this,r(13))},function(e,t,r){"use strict";(function(t){var i=r(21),n=r(25),o=r(8),a=function e(r){if(!(this instanceof e))return new e(r);if(t.isBuffer(r))this.buf=r;else if("number"==typeof r){var i=r;this.fromNumber(i)}else if(r instanceof o){var n=r;this.fromBN(n)}else if(r){var a=r;this.set(a)}};a.prototype.set=function(e){return this.buf=e.buf||this.buf,this},a.prototype.fromString=function(e){return this.set({buf:t.from(e,"hex")}),this},a.prototype.toString=function(){return this.buf.toString("hex")},a.prototype.fromBuffer=function(e){return this.buf=e,this},a.prototype.fromBufferReader=function(e){return this.buf=e.readVarintBuf(),this},a.prototype.fromBN=function(e){return this.buf=i().writeVarintBN(e).concat(),this},a.prototype.fromNumber=function(e){return this.buf=i().writeVarintNum(e).concat(),this},a.prototype.toBuffer=function(){return this.buf},a.prototype.toBN=function(){return n(this.buf).readVarintBN()},a.prototype.toNumber=function(){return n(this.buf).readVarintNum()},e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(5),o=r(16),a=r(21),s=r(0),u=r(12),c=r(18),h=r(26),f=r(27);function l(e){return this instanceof l?e?this._fromObject(e):void 0:new l(e)}l.MAXINT=4294967295,l.DEFAULT_SEQNUMBER=4294967295,l.DEFAULT_LOCKTIME_SEQNUMBER=4294967294,l.DEFAULT_RBF_SEQNUMBER=4294967293,l.BASE_SIZE=40,Object.defineProperty(l.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this.isNull()?null:(this._script||(this._script=new c(this._scriptBuffer),this._script._isInput=!0),this._script)}}),l.fromObject=function(e){return n.checkArgument(i.isObject(e)),(new l)._fromObject(e)},l.prototype._fromObject=function(e){var t;if(t=i.isString(e.prevTxId)&&u.isHexa(e.prevTxId)?s.Buffer.from(e.prevTxId,"hex"):e.prevTxId,this.output=e.output?e.output instanceof f?e.output:new f(e.output):void 0,this.prevTxId=t||e.txidbuf,this.outputIndex=i.isUndefined(e.outputIndex)?e.txoutnum:e.outputIndex,this.sequenceNumber=i.isUndefined(e.sequenceNumber)?i.isUndefined(e.seqnum)?4294967295:e.seqnum:e.sequenceNumber,i.isUndefined(e.script)&&i.isUndefined(e.scriptBuffer))throw new o.Transaction.Input.MissingScript;return this.setScript(e.scriptBuffer||e.script),this},l.prototype.toObject=l.prototype.toJSON=function(){var e={prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,sequenceNumber:this.sequenceNumber,script:this._scriptBuffer.toString("hex")};return this.script&&(e.scriptString=this.script.toString()),this.output&&(e.output=this.output.toObject()),e},l.fromBufferReader=function(e){var t=new l;return t.prevTxId=e.readReverse(32),t.outputIndex=e.readUInt32LE(),t._scriptBuffer=e.readVarLengthBuffer(),t.sequenceNumber=e.readUInt32LE(),t},l.prototype.toBufferWriter=function(e){e||(e=new a),e.writeReverse(this.prevTxId),e.writeUInt32LE(this.outputIndex);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e.writeUInt32LE(this.sequenceNumber),e},l.prototype.setScript=function(e){if(this._script=null,e instanceof c)this._script=e,this._script._isInput=!0,this._scriptBuffer=e.toBuffer();else if(null===e)this._script=c.empty(),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else if(u.isHexa(e))this._scriptBuffer=s.Buffer.from(e,"hex");else if(i.isString(e))this._script=new c(e),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else{if(!t.isBuffer(e))throw new TypeError("Invalid argument type: script");this._scriptBuffer=s.Buffer.from(e)}return this},l.prototype.getSignatures=function(){throw new o.AbstractMethodInvoked("Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported) for input: "+JSON.stringify(this))},l.prototype.isFullySigned=function(){throw new o.AbstractMethodInvoked("Input#isFullySigned")},l.prototype.isFinal=function(){return this.sequenceNumber===l.MAXINT},l.prototype.addSignature=function(){throw new o.AbstractMethodInvoked("Input#addSignature")},l.prototype.clearSignatures=function(){throw new o.AbstractMethodInvoked("Input#clearSignatures")},l.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,h.verify(e,t.signature,t.publicKey,t.inputIndex,this.output.script,this.output.satoshisBN)},l.prototype.isNull=function(){return"0000000000000000000000000000000000000000000000000000000000000000"===this.prevTxId.toString("hex")&&4294967295===this.outputIndex},l.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length},e.exports=l}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(5),o=r(4),a=r(12),s=r(20),u=r(16),c=r(11);function h(e){if(!(this instanceof h))return new h(e);if(e instanceof h)return e;if(i.isObject(e))return this._fromObject(e);throw new u.InvalidArgument("TransactionSignatures must be instantiated from an object")}o(h,c),h.prototype._fromObject=function(e){return this._checkObjectArgs(e),this.publicKey=new s(e.publicKey),this.prevTxId=t.isBuffer(e.prevTxId)?e.prevTxId:t.from(e.prevTxId,"hex"),this.outputIndex=e.outputIndex,this.inputIndex=e.inputIndex,this.signature=e.signature instanceof c?e.signature:t.isBuffer(e.signature)?c.fromBuffer(e.signature):c.fromString(e.signature),this.sigtype=e.sigtype,this},h.prototype._checkObjectArgs=function(e){n.checkArgument(s(e.publicKey),"publicKey"),n.checkArgument(!i.isUndefined(e.inputIndex),"inputIndex"),n.checkArgument(!i.isUndefined(e.outputIndex),"outputIndex"),n.checkState(i.isNumber(e.inputIndex),"inputIndex must be a number"),n.checkState(i.isNumber(e.outputIndex),"outputIndex must be a number"),n.checkArgument(e.signature,"signature"),n.checkArgument(e.prevTxId,"prevTxId"),n.checkState(e.signature instanceof c||t.isBuffer(e.signature)||a.isHexa(e.signature),"signature must be a buffer or hexa value"),n.checkState(t.isBuffer(e.prevTxId)||a.isHexa(e.prevTxId),"prevTxId must be a buffer or hexa value"),n.checkArgument(e.sigtype,"sigtype"),n.checkState(i.isNumber(e.sigtype),"sigtype must be a number")},h.prototype.toObject=h.prototype.toJSON=function(){return{publicKey:this.publicKey.toString(),prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,inputIndex:this.inputIndex,signature:this.signature.toString(),sigtype:this.sigtype}},h.fromObject=function(e){return n.checkArgument(e),new h(e)},e.exports=h}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){void 0===t||!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,r,i,n){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o,a,s=arguments.length;switch(s){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick((function(){e.call(null,r)}));case 3:return t.nextTick((function(){e.call(null,r,i)}));case 4:return t.nextTick((function(){e.call(null,r,i,n)}));default:for(o=new Array(s-1),a=0;a<o.length;)o[a++]=arguments[a];return t.nextTick((function(){e.apply(null,o)}))}}}:e.exports=t}).call(this,r(6))},function(e,t,r){"use strict";var i=r(1).Buffer,n=r(179),o=r(180),a=ArrayBuffer.isView||function(e){try{return o(e),!0}catch(e){return!1}},s="undefined"!=typeof Uint8Array,u="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,c=u&&(i.prototype instanceof Uint8Array||i.TYPED_ARRAY_SUPPORT);e.exports=function(e,t){if(i.isBuffer(e))return e.constructor&&!("isBuffer"in e)?i.from(e):e;if("string"==typeof e)return i.from(e,t);if(u&&a(e)){if(0===e.byteLength)return i.alloc(0);if(c){var r=i.from(e.buffer,e.byteOffset,e.byteLength);if(r.byteLength===e.byteLength)return r}var o=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),h=i.from(o);if(h.length===e.byteLength)return h}if(s&&e instanceof Uint8Array)return i.from(e);var f=n(e);if(f)for(var l=0;l<e.length;l+=1){var d=e[l];if("number"!=typeof d||d<0||d>255||~~d!==d)throw new RangeError("Array items must be numbers in the range 0-255.")}if(f||i.isBuffer(e)&&e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e))return i.from(e);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}},function(e,t,r){"use strict";var i=Object.defineProperty||!1;if(i)try{i({},"a",{value:1})}catch(e){i=!1}e.exports=i},function(e,t,r){var i=r(1).Buffer;function n(e){i.isBuffer(e)||(e=i.from(e));for(var t=e.length/4|0,r=new Array(t),n=0;n<t;n++)r[n]=e.readUInt32BE(4*n);return r}function o(e){for(;0<e.length;e++)e[0]=0}function a(e,t,r,i,n){for(var o,a,s,u,c=r[0],h=r[1],f=r[2],l=r[3],d=e[0]^t[0],p=e[1]^t[1],m=e[2]^t[2],g=e[3]^t[3],b=4,y=1;y<n;y++)o=c[d>>>24]^h[p>>>16&255]^f[m>>>8&255]^l[255&g]^t[b++],a=c[p>>>24]^h[m>>>16&255]^f[g>>>8&255]^l[255&d]^t[b++],s=c[m>>>24]^h[g>>>16&255]^f[d>>>8&255]^l[255&p]^t[b++],u=c[g>>>24]^h[d>>>16&255]^f[p>>>8&255]^l[255&m]^t[b++],d=o,p=a,m=s,g=u;return o=(i[d>>>24]<<24|i[p>>>16&255]<<16|i[m>>>8&255]<<8|i[255&g])^t[b++],a=(i[p>>>24]<<24|i[m>>>16&255]<<16|i[g>>>8&255]<<8|i[255&d])^t[b++],s=(i[m>>>24]<<24|i[g>>>16&255]<<16|i[d>>>8&255]<<8|i[255&p])^t[b++],u=(i[g>>>24]<<24|i[d>>>16&255]<<16|i[p>>>8&255]<<8|i[255&m])^t[b++],[o>>>=0,a>>>=0,s>>>=0,u>>>=0]}var s=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var r=[],i=[],n=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,u=0;u<256;++u){var c=s^s<<1^s<<2^s<<3^s<<4;c=c>>>8^255&c^99,r[a]=c,i[c]=a;var h=e[a],f=e[h],l=e[f],d=257*e[c]^16843008*c;n[0][a]=d<<24|d>>>8,n[1][a]=d<<16|d>>>16,n[2][a]=d<<8|d>>>24,n[3][a]=d,d=16843009*l^65537*f^257*h^16843008*a,o[0][c]=d<<24|d>>>8,o[1][c]=d<<16|d>>>16,o[2][c]=d<<8|d>>>24,o[3][c]=d,0===a?a=s=1:(a=h^e[e[e[l^h]]],s^=e[e[s]])}return{SBOX:r,INV_SBOX:i,SUB_MIX:n,INV_SUB_MIX:o}}();function c(e){this._key=n(e),this._reset()}c.blockSize=16,c.keySize=32,c.prototype.blockSize=c.blockSize,c.prototype.keySize=c.keySize,c.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,i=4*(r+1),n=[],o=0;o<t;o++)n[o]=e[o];for(o=t;o<i;o++){var a=n[o-1];o%t==0?(a=a<<8|a>>>24,a=u.SBOX[a>>>24]<<24|u.SBOX[a>>>16&255]<<16|u.SBOX[a>>>8&255]<<8|u.SBOX[255&a],a^=s[o/t|0]<<24):t>6&&o%t==4&&(a=u.SBOX[a>>>24]<<24|u.SBOX[a>>>16&255]<<16|u.SBOX[a>>>8&255]<<8|u.SBOX[255&a]),n[o]=n[o-t]^a}for(var c=[],h=0;h<i;h++){var f=i-h,l=n[f-(h%4?0:4)];c[h]=h<4||f<=4?l:u.INV_SUB_MIX[0][u.SBOX[l>>>24]]^u.INV_SUB_MIX[1][u.SBOX[l>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[l>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&l]]}this._nRounds=r,this._keySchedule=n,this._invKeySchedule=c},c.prototype.encryptBlockRaw=function(e){return a(e=n(e),this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},c.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=i.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},c.prototype.decryptBlock=function(e){var t=(e=n(e))[1];e[1]=e[3],e[3]=t;var r=a(e,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),o=i.allocUnsafe(16);return o.writeUInt32BE(r[0],0),o.writeUInt32BE(r[3],4),o.writeUInt32BE(r[2],8),o.writeUInt32BE(r[1],12),o},c.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},e.exports.AES=c},function(e,t,r){var i=r(1).Buffer,n=r(65);e.exports=function(e,t,r,o){if(i.isBuffer(e)||(e=i.from(e,"binary")),t&&(i.isBuffer(t)||(t=i.from(t,"binary")),8!==t.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var a=r/8,s=i.alloc(a),u=i.alloc(o||0),c=i.alloc(0);a>0||o>0;){var h=new n;h.update(c),h.update(e),t&&h.update(t),c=h.digest();var f=0;if(a>0){var l=s.length-a;f=Math.min(a,c.length),c.copy(s,l,0,f),a-=f}if(f<c.length&&o>0){var d=u.length-o,p=Math.min(o,c.length-f);c.copy(u,d,f,f+p),o-=p}}return c.fill(0),{key:s,iv:u}}},function(e,t,r){"use strict";var i=r(7),n=r(15),o=n.getNAF,a=n.getJSF,s=n.assert;function u(e,t){this.type=e,this.p=new i(t.p,16),this.red=t.prime?i.red(t.prime):i.mont(this.p),this.zero=new i(0).toRed(this.red),this.one=new i(1).toRed(this.red),this.two=new i(2).toRed(this.red),this.n=t.n&&new i(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 c(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(e,t){s(e.precomputed);var r=e._getDoubles(),i=o(t,1,this._bitLength),n=(1<<r.step+1)-(r.step%2==0?2:1);n/=3;var a,u,c=[];for(a=0;a<i.length;a+=r.step){u=0;for(var h=a+r.step-1;h>=a;h--)u=(u<<1)+i[h];c.push(u)}for(var f=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=n;d>0;d--){for(a=0;a<c.length;a++)(u=c[a])===d?l=l.mixedAdd(r.points[a]):u===-d&&(l=l.mixedAdd(r.points[a].neg()));f=f.add(l)}return f.toP()},u.prototype._wnafMul=function(e,t){var r=4,i=e._getNAFPoints(r);r=i.wnd;for(var n=i.points,a=o(t,r,this._bitLength),u=this.jpoint(null,null,null),c=a.length-1;c>=0;c--){for(var h=0;c>=0&&0===a[c];c--)h++;if(c>=0&&h++,u=u.dblp(h),c<0)break;var f=a[c];s(0!==f),u="affine"===e.type?f>0?u.mixedAdd(n[f-1>>1]):u.mixedAdd(n[-f-1>>1].neg()):f>0?u.add(n[f-1>>1]):u.add(n[-f-1>>1].neg())}return"affine"===e.type?u.toP():u},u.prototype._wnafMulAdd=function(e,t,r,i,n){var s,u,c,h=this._wnafT1,f=this._wnafT2,l=this._wnafT3,d=0;for(s=0;s<i;s++){var p=(c=t[s])._getNAFPoints(e);h[s]=p.wnd,f[s]=p.points}for(s=i-1;s>=1;s-=2){var m=s-1,g=s;if(1===h[m]&&1===h[g]){var b=[t[m],null,null,t[g]];0===t[m].y.cmp(t[g].y)?(b[1]=t[m].add(t[g]),b[2]=t[m].toJ().mixedAdd(t[g].neg())):0===t[m].y.cmp(t[g].y.redNeg())?(b[1]=t[m].toJ().mixedAdd(t[g]),b[2]=t[m].add(t[g].neg())):(b[1]=t[m].toJ().mixedAdd(t[g]),b[2]=t[m].toJ().mixedAdd(t[g].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],v=a(r[m],r[g]);for(d=Math.max(v[0].length,d),l[m]=new Array(d),l[g]=new Array(d),u=0;u<d;u++){var _=0|v[0][u],w=0|v[1][u];l[m][u]=y[3*(_+1)+(w+1)],l[g][u]=0,f[m]=b}}else l[m]=o(r[m],h[m],this._bitLength),l[g]=o(r[g],h[g],this._bitLength),d=Math.max(l[m].length,d),d=Math.max(l[g].length,d)}var S=this.jpoint(null,null,null),k=this._wnafT4;for(s=d;s>=0;s--){for(var I=0;s>=0;){var E=!0;for(u=0;u<i;u++)k[u]=0|l[u][s],0!==k[u]&&(E=!1);if(!E)break;I++,s--}if(s>=0&&I++,S=S.dblp(I),s<0)break;for(u=0;u<i;u++){var A=k[u];0!==A&&(A>0?c=f[u][A-1>>1]:A<0&&(c=f[u][-A-1>>1].neg()),S="affine"===c.type?S.mixedAdd(c):S.add(c))}}for(s=0;s<i;s++)f[s]=null;return n?S:S.toP()},u.BasePoint=c,c.prototype.eq=function(){throw new Error("Not implemented")},c.prototype.validate=function(){return this.curve.validate(this)},u.prototype.decodePoint=function(e,t){e=n.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?s(e[e.length-1]%2==0):7===e[0]&&s(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},c.prototype.encodeCompressed=function(e){return this.encode(e,!0)},c.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},c.prototype.encode=function(e,t){return n.encode(this._encode(t),e)},c.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},c.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},c.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n<t;n+=e){for(var o=0;o<e;o++)i=i.dbl();r.push(i)}return{step:e,points:r}},c.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,i=1===r?null:this.dbl(),n=1;n<r;n++)t[n]=t[n-1].add(i);return{wnd:e,points:t}},c.prototype._getBeta=function(){return null},c.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t}},function(e,t,r){var i=t;i.utils=r(19),i.common=r(44),i.sha=r(249),i.ripemd=r(253),i.hmac=r(254),i.sha1=i.sha.sha1,i.sha256=i.sha.sha256,i.sha224=i.sha.sha224,i.sha384=i.sha.sha384,i.sha512=i.sha.sha512,i.ripemd160=i.ripemd.ripemd160},function(e,t,r){"use strict";var i=r(264),n=r(275),o=r(276),a=r(80),s=r(114).pbkdf2Sync,u=r(1).Buffer;function c(e){var t;"object"!=typeof e||u.isBuffer(e)||(t=e.passphrase,e=e.key),"string"==typeof e&&(e=u.from(e));var r,c,h=o(e,t),f=h.tag,l=h.data;switch(f){case"CERTIFICATE":c=i.certificate.decode(l,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(c||(c=i.PublicKey.decode(l,"der")),r=c.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return i.RSAPublicKey.decode(c.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return c.subjectPrivateKey=c.subjectPublicKey,{type:"ec",data:c};case"1.2.840.10040.4.1":return c.algorithm.params.pub_key=i.DSAparam.decode(c.subjectPublicKey.data,"der"),{type:"dsa",data:c.algorithm.params};default:throw new Error("unknown key id "+r)}case"ENCRYPTED PRIVATE KEY":l=function(e,t){var r=e.algorithm.decrypt.kde.kdeparams.salt,i=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),o=n[e.algorithm.decrypt.cipher.algo.join(".")],c=e.algorithm.decrypt.cipher.iv,h=e.subjectPrivateKey,f=parseInt(o.split("-")[1],10)/8,l=s(t,r,i,f,"sha1"),d=a.createDecipheriv(o,l,c),p=[];return p.push(d.update(h)),p.push(d.final()),u.concat(p)}(l=i.EncryptedPrivateKey.decode(l,"der"),t);case"PRIVATE KEY":switch(r=(c=i.PrivateKey.decode(l,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return i.RSAPrivateKey.decode(c.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:c.algorithm.curve,privateKey:i.ECPrivateKey.decode(c.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return c.algorithm.params.priv_key=i.DSAparam.decode(c.subjectPrivateKey,"der"),{type:"dsa",params:c.algorithm.params};default:throw new Error("unknown key id "+r)}case"RSA PUBLIC KEY":return i.RSAPublicKey.decode(l,"der");case"RSA PRIVATE KEY":return i.RSAPrivateKey.decode(l,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:i.DSAPrivateKey.decode(l,"der")};case"EC PRIVATE KEY":return{curve:(l=i.ECPrivateKey.decode(l,"der")).parameters.value,privateKey:l.privateKey};default:throw new Error("unknown key type "+f)}}c.signature=i.signature,e.exports=c},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(36),o=r(47),a=r(8),s=r(12),u=r(30),c=r(17),h=r(20),f=r(32),l=r(5);function d(e,t){if(!(this instanceof d))return new d(e,t);if(e instanceof d)return e;var r=this._classifyArguments(e,t);if(!r.bn||0===r.bn.cmp(new a(0)))throw new TypeError("Number can not be equal to zero, undefined, null or false");if(!r.bn.lt(c.getN()))throw new TypeError("Number must be less than N");if(void 0===r.network)throw new TypeError('Must specify the network ("livenet" or "testnet")');return s.defineImmutable(this,{bn:r.bn,compressed:r.compressed,network:r.network}),Object.defineProperty(this,"publicKey",{configurable:!1,enumerable:!0,get:this.toPublicKey.bind(this)}),this}d.prototype._classifyArguments=function(e,r){var n={compressed:!0,network:r?u.get(r):u.defaultNetwork};if(i.isUndefined(e)||i.isNull(e))n.bn=d._getRandomBN();else if(e instanceof a)n.bn=e;else if(e instanceof t||e instanceof Uint8Array)n=d._transformBuffer(e,r);else if(e.bn&&e.network)n=d._transformObject(e);else if(!r&&u.get(e))n.bn=d._getRandomBN(),n.network=u.get(e);else{if("string"!=typeof e)throw new TypeError("First argument is an unrecognized data type.");s.isHexa(e)?n.bn=new a(t.from(e,"hex")):n=d._transformWIF(e,r)}return n},d._getRandomBN=function(){var e,t;do{var r=f.getRandomBuffer(32);e=(t=a.fromBuffer(r)).lt(c.getN())}while(!e);return t},d._transformBuffer=function(e,t){var r={};if(32===e.length)return d._transformBNBuffer(e,t);if(r.network=u.get(e[0],"privatekey"),!r.network)throw new Error("Invalid network");if(t&&r.network!==u.get(t))throw new TypeError("Private key network mismatch");if(34===e.length&&1===e[33])r.compressed=!0;else{if(33!==e.length)throw new Error("Length of buffer must be 33 (uncompressed) or 34 (compressed)");r.compressed=!1}return r.bn=a.fromBuffer(e.slice(1,33)),r},d._transformBNBuffer=function(e,t){var r={};return r.network=u.get(t)||u.defaultNetwork,r.bn=a.fromBuffer(e),r.compressed=!1,r},d._transformWIF=function(e,t){return d._transformBuffer(o.decode(e),t)},d.fromBuffer=function(e,t){return new d(e,t)},d.fromHex=function(e,r){return d.fromBuffer(t.from(e,"hex"),r)},d._transformObject=function(e){return{bn:new a(e.bn,"hex"),network:u.get(e.network),compressed:e.compressed}},d.fromString=d.fromWIF=function(e){return l.checkArgument(i.isString(e),"First argument is expected to be a string."),new d(e)},d.fromObject=d.fromJSON=function(e){return l.checkArgument(i.isObject(e),"First argument is expected to be an object."),new d(e)},d.fromRandom=function(e){var t=d._getRandomBN();return new d(t,e)},d.getValidationError=function(e,t){var r;try{new d(e,t)}catch(e){r=e}return r},d.isValid=function(e,t){return!!e&&!d.getValidationError(e,t)},d.prototype.toString=function(){return this.toWIF()},d.prototype.toWIF=function(){var e,r=this.network;return e=this.compressed?t.concat([t.from([r.privatekey]),this.bn.toBuffer({size:32}),t.from([1])]):t.concat([t.from([r.privatekey]),this.bn.toBuffer({size:32})]),o.encode(e)},d.prototype.toBigNumber=function(){return this.bn},d.prototype.toBuffer=function(){return this.bn.toBuffer({size:32})},d.prototype.toHex=function(){return this.toBuffer().toString("hex")},d.prototype.toPublicKey=function(){return this._pubkey||(this._pubkey=h.fromPrivateKey(this)),this._pubkey},d.prototype.toAddress=function(e){var t=this.toPublicKey();return n.fromPublicKey(t,e||this.network)},d.prototype.toObject=d.prototype.toJSON=function(){return{bn:this.bn.toString("hex"),compressed:this.compressed,network:this.network.toString()}},d.prototype.inspect=function(){var e=this.compressed?"":", uncompressed";return"<PrivateKey: "+this.toHex()+", network: "+this.network+e+">"},e.exports=d}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(86),o=r(0),a="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".split(""),s=function e(r){if(!(this instanceof e))return new e(r);if(t.isBuffer(r)){var i=r;this.fromBuffer(i)}else if("string"==typeof r){var n=r;this.fromString(n)}};s.validCharacters=function(e){return o.Buffer.isBuffer(e)&&(e=e.toString()),i.every(i.map(e,(function(e){return i.includes(a,e)})))},s.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this},s.encode=function(e){if(!o.Buffer.isBuffer(e))throw new Error("Input should be a buffer");return n.encode(e)},s.decode=function(e){if("string"!=typeof e)throw new Error("Input should be a string");return t.from(n.decode(e))},s.prototype.fromBuffer=function(e){return this.buf=e,this},s.fromBuffer=function(e){return(new s).fromBuffer(e)},s.fromHex=function(e){return s.fromBuffer(t.from(e,"hex"))},s.prototype.fromString=function(e){var t=s.decode(e);return this.buf=t,this},s.fromString=function(e){return(new s).fromString(e)},s.prototype.toBuffer=function(){return this.buf},s.prototype.toHex=function(){return this.toBuffer().toString("hex")},s.prototype.toString=function(){return s.encode(this.buf)},e.exports=s}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(8),o=r(25),a=r(21),s=r(10),u=r(5),c=function e(t){if(!(this instanceof e))return new e(t);var r=e._from(t);return this.version=r.version,this.prevHash=r.prevHash,this.merkleRoot=r.merkleRoot,this.time=r.time,this.timestamp=r.time,this.bits=r.bits,this.nonce=r.nonce,r.hash&&u.checkState(this.hash===r.hash,"Argument object hash property does not match block hash."),this};c._from=function(e){var r={};if(t.isBuffer(e))r=c._fromBufferReader(o(e));else{if(!i.isObject(e))throw new TypeError("Unrecognized argument for BlockHeader");r=c._fromObject(e)}return r},c._fromObject=function(e){u.checkArgument(e,"data is required");var r=e.prevHash,n=e.merkleRoot;return i.isString(e.prevHash)&&(r=t.from(e.prevHash,"hex").reverse()),i.isString(e.merkleRoot)&&(n=t.from(e.merkleRoot,"hex").reverse()),{hash:e.hash,version:e.version,prevHash:r,merkleRoot:n,time:e.time,timestamp:e.time,bits:e.bits,nonce:e.nonce}},c.fromObject=function(e){var t=c._fromObject(e);return new c(t)},c.fromRawBlock=function(e){t.isBuffer(e)||(e=t.from(e,"binary"));var r=o(e);r.pos=c.Constants.START_OF_HEADER;var i=c._fromBufferReader(r);return new c(i)},c.fromBuffer=function(e){var t=c._fromBufferReader(o(e));return new c(t)},c.fromString=function(e){var r=t.from(e,"hex");return c.fromBuffer(r)},c._fromBufferReader=function(e){var t={};return t.version=e.readInt32LE(),t.prevHash=e.read(32),t.merkleRoot=e.read(32),t.time=e.readUInt32LE(),t.bits=e.readUInt32LE(),t.nonce=e.readUInt32LE(),t},c.fromBufferReader=function(e){var t=c._fromBufferReader(e);return new c(t)},c.prototype.toObject=c.prototype.toJSON=function(){return{hash:this.hash,version:this.version,prevHash:t.from(this.prevHash).reverse().toString("hex"),merkleRoot:t.from(this.merkleRoot).reverse().toString("hex"),time:this.time,bits:this.bits,nonce:this.nonce}},c.prototype.toBuffer=function(){return this.toBufferWriter().concat()},c.prototype.toString=function(){return this.toBuffer().toString("hex")},c.prototype.toBufferWriter=function(e){return e||(e=new a),e.writeInt32LE(this.version),e.write(this.prevHash),e.write(this.merkleRoot),e.writeUInt32LE(this.time),e.writeUInt32LE(this.bits),e.writeUInt32LE(this.nonce),e},c.prototype.getTargetDifficulty=function(e){e=e||this.bits;for(var t=new n(16777215&e),r=8*((e>>>24)-3);r-- >0;)t=t.mul(new n(2));return t},c.prototype.getDifficulty=function(){var e=this.getTargetDifficulty(486604799).mul(new n(Math.pow(10,8))),t=this.getTargetDifficulty(),r=e.div(t).toString(10),i=r.length-8;return r=r.slice(0,i)+"."+r.slice(i),parseFloat(r)},c.prototype._getHash=function(){var e=this.toBuffer();return s.sha256sha256(e)};var h={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=o(this._getHash()).readReverse().toString("hex")),this._id},set:i.noop};Object.defineProperty(c.prototype,"id",h),Object.defineProperty(c.prototype,"hash",h),c.prototype.validTimestamp=function(){var e=Math.round((new Date).getTime()/1e3);return!(this.time>e+c.Constants.MAX_TIME_OFFSET)},c.prototype.validProofOfWork=function(){var e=new n(this.id,"hex"),t=this.getTargetDifficulty();return!(e.cmp(t)>0)},c.prototype.inspect=function(){return"<BlockHeader "+this.id+">"},c.Constants={START_OF_HEADER:8,MAX_TIME_OFFSET:7200,LARGEST_HASH:new n("10000000000000000000000000000000000000000000000000000000000000000","hex")},e.exports=c}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var i in r)n(r,i)&&(e[i]=r[i])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var o={arraySet:function(e,t,r,i,n){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+i),n);else for(var o=0;o<i;o++)e[n+o]=t[r+o]},flattenChunks:function(e){var t,r,i,n,o,a;for(i=0,t=0,r=e.length;t<r;t++)i+=e[t].length;for(a=new Uint8Array(i),n=0,t=0,r=e.length;t<r;t++)o=e[t],a.set(o,n),n+=o.length;return a}},a={arraySet:function(e,t,r,i,n){for(var o=0;o<i;o++)e[n+o]=t[r+o]},flattenChunks:function(e){return[].concat.apply([],e)}};t.setTyped=function(e){e?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,o)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,a))},t.setTyped(i)},function(e,t,r){"use strict";(function(t){var i=r(2),n=i.PublicKey,o=i.PrivateKey,a=i.crypto.Hash,s=i.util.preconditions;i.errors;function u(e){return this instanceof u?(this.options=e||{},this.network=this.options.network||"mainnet",this.registry=this.options.registry||null,this):new u(e)}u.fromPublicKey=function(e,t){t=t||{},"string"==typeof e&&(e=n.fromString(e)),s.checkArgument(e instanceof n,"Invalid public key");var r=e.toString("hex"),i=t.network||"mainnet",o=t.path||"",a="did:smartledger:"+r;return"mainnet"!==i&&(a+=":"+i),o&&(a+=":"+o),a},u.fromPrivateKey=function(e,t){return"string"==typeof e&&(e=o.fromWIF(e)),s.checkArgument(e instanceof o,"Invalid private key"),u.fromPublicKey(e.toPublicKey(),t)},u.parseDID=function(e){if(s.checkArgument("string"==typeof e,"DID must be a string"),!e.startsWith("did:smartledger:"))throw new Error("Invalid SmartLedger DID format");var t=e.split(":");if(t.length<3)throw new Error("Invalid DID format");var r={method:"smartledger",identifier:t[2],network:"mainnet",path:""};return t.length>3&&""!==t[3]&&(r.network=t[3]),t.length>4&&(r.path=t.slice(4).join(":")),r},u.isValidDID=function(e){try{var t=u.parseDID(e);return!(!/^[0-9a-fA-F]{66}$/.test(t.identifier)&&!/^[0-9a-fA-F]{130}$/.test(t.identifier))&&!!["mainnet","testnet","regtest"].includes(t.network)}catch(e){return!1}},u.getPublicKey=function(e){var t=u.parseDID(e);return n.fromString(t.identifier)},u.createDocument=function(e,t){t=t||{},s.checkArgument(u.isValidDID(e),"Invalid DID");var r=e+"#keys-1",i={"@context":["https://www.w3.org/ns/did/v1","https://w3id.org/security/suites/secp256k1-2019/v1"],id:e,verificationMethod:[{id:r,type:"EcdsaSecp256k1VerificationKey2019",controller:e,publicKeyHex:u.getPublicKey(e).toString("hex")}],authentication:[r],assertionMethod:[r],keyAgreement:[r],capabilityInvocation:[r],capabilityDelegation:[r]};return t.services&&Array.isArray(t.services)&&(i.service=t.services),t.verificationMethods&&(i.verificationMethod=i.verificationMethod.concat(t.verificationMethods)),t.created&&(i.created=t.created),t.updated&&(i.updated=t.updated),i},u.resolve=async function(e,t){t=t||{};try{return s.checkArgument(u.isValidDID(e),"Invalid DID"),{"@context":"https://w3id.org/did-resolution/v1",didDocument:u.createDocument(e,t),didResolutionMetadata:{contentType:"application/did+ld+json",retrieved:(new Date).toISOString()},didDocumentMetadata:{method:{published:!0,recoveryCommitment:null,updateCommitment:null}}}}catch(e){return{"@context":"https://w3id.org/did-resolution/v1",didDocument:null,didResolutionMetadata:{error:"notFound",errorMessage:e.message},didDocumentMetadata:{}}}},u.verifyOwnership=function(e,r,n){try{var o=u.getPublicKey(e),s=a.sha256(t.isBuffer(n)?n:t.from(n,"utf8")),c=i.crypto.Signature.fromString(r),h=new i.crypto.ECDSA;return h.hashbuf=s,h.pubkey=o,h.sig=c,h.verify()}catch(e){return!1}},u.signMessage=function(e,r){s.checkArgument(r instanceof o,"Invalid private key");var n=a.sha256(t.isBuffer(e)?e:t.from(e,"utf8")),u=new i.crypto.ECDSA;return u.hashbuf=n,u.privkey=r,u.pubkey=r.toPublicKey(),u.sign().toString()},u.createProofOfOwnership=function(e,t){s.checkArgument(e instanceof o,"Invalid private key"),s.checkArgument("string"==typeof t,"Challenge must be a string");var r=u.fromPrivateKey(e),i=(new Date).toISOString(),n=t+":"+i+":"+r;return{type:"EcdsaSecp256k1Signature2019",created:i,verificationMethod:r+"#keys-1",proofPurpose:"authentication",challenge:t,jws:u.signMessage(n,e)}},u.verifyProofOfOwnership=function(e,t){try{s.checkArgument(e&&"object"==typeof e,"Invalid proof object"),s.checkArgument("string"==typeof t,"DID must be a string");var r=e.challenge+":"+e.created+":"+t;return u.verifyOwnership(t,e.jws,r)}catch(e){return!1}},u.createDIDURL=function(e,t){return s.checkArgument("string"==typeof e,"DID must be a string"),s.checkArgument("string"==typeof t,"Fragment must be a string"),e+"#"+t},u.generateTestDID=function(e){e=e||{};var t=new o,r=u.fromPrivateKey(t,e),i=u.createDocument(r,e);return{did:r,privateKey:t.toWIF(),publicKey:t.toPublicKey().toString("hex"),document:i}},e.exports=u}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var i=r(4),n=r(162),o=r(1).Buffer,a=new Array(16);function s(){n.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(e,t){return e<<t|e>>>32-t}function c(e,t,r,i,n,o,a){return u(e+(t&r|~t&i)+n+o|0,a)+t|0}function h(e,t,r,i,n,o,a){return u(e+(t&i|r&~i)+n+o|0,a)+t|0}function f(e,t,r,i,n,o,a){return u(e+(t^r^i)+n+o|0,a)+t|0}function l(e,t,r,i,n,o,a){return u(e+(r^(t|~i))+n+o|0,a)+t|0}i(s,n),s.prototype._update=function(){for(var e=a,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,i=this._b,n=this._c,o=this._d;r=c(r,i,n,o,e[0],3614090360,7),o=c(o,r,i,n,e[1],3905402710,12),n=c(n,o,r,i,e[2],606105819,17),i=c(i,n,o,r,e[3],3250441966,22),r=c(r,i,n,o,e[4],4118548399,7),o=c(o,r,i,n,e[5],1200080426,12),n=c(n,o,r,i,e[6],2821735955,17),i=c(i,n,o,r,e[7],4249261313,22),r=c(r,i,n,o,e[8],1770035416,7),o=c(o,r,i,n,e[9],2336552879,12),n=c(n,o,r,i,e[10],4294925233,17),i=c(i,n,o,r,e[11],2304563134,22),r=c(r,i,n,o,e[12],1804603682,7),o=c(o,r,i,n,e[13],4254626195,12),n=c(n,o,r,i,e[14],2792965006,17),r=h(r,i=c(i,n,o,r,e[15],1236535329,22),n,o,e[1],4129170786,5),o=h(o,r,i,n,e[6],3225465664,9),n=h(n,o,r,i,e[11],643717713,14),i=h(i,n,o,r,e[0],3921069994,20),r=h(r,i,n,o,e[5],3593408605,5),o=h(o,r,i,n,e[10],38016083,9),n=h(n,o,r,i,e[15],3634488961,14),i=h(i,n,o,r,e[4],3889429448,20),r=h(r,i,n,o,e[9],568446438,5),o=h(o,r,i,n,e[14],3275163606,9),n=h(n,o,r,i,e[3],4107603335,14),i=h(i,n,o,r,e[8],1163531501,20),r=h(r,i,n,o,e[13],2850285829,5),o=h(o,r,i,n,e[2],4243563512,9),n=h(n,o,r,i,e[7],1735328473,14),r=f(r,i=h(i,n,o,r,e[12],2368359562,20),n,o,e[5],4294588738,4),o=f(o,r,i,n,e[8],2272392833,11),n=f(n,o,r,i,e[11],1839030562,16),i=f(i,n,o,r,e[14],4259657740,23),r=f(r,i,n,o,e[1],2763975236,4),o=f(o,r,i,n,e[4],1272893353,11),n=f(n,o,r,i,e[7],4139469664,16),i=f(i,n,o,r,e[10],3200236656,23),r=f(r,i,n,o,e[13],681279174,4),o=f(o,r,i,n,e[0],3936430074,11),n=f(n,o,r,i,e[3],3572445317,16),i=f(i,n,o,r,e[6],76029189,23),r=f(r,i,n,o,e[9],3654602809,4),o=f(o,r,i,n,e[12],3873151461,11),n=f(n,o,r,i,e[15],530742520,16),r=l(r,i=f(i,n,o,r,e[2],3299628645,23),n,o,e[0],4096336452,6),o=l(o,r,i,n,e[7],1126891415,10),n=l(n,o,r,i,e[14],2878612391,15),i=l(i,n,o,r,e[5],4237533241,21),r=l(r,i,n,o,e[12],1700485571,6),o=l(o,r,i,n,e[3],2399980690,10),n=l(n,o,r,i,e[10],4293915773,15),i=l(i,n,o,r,e[1],2240044497,21),r=l(r,i,n,o,e[8],1873313359,6),o=l(o,r,i,n,e[15],4264355552,10),n=l(n,o,r,i,e[6],2734768916,15),i=l(i,n,o,r,e[13],1309151649,21),r=l(r,i,n,o,e[4],4149444226,6),o=l(o,r,i,n,e[11],3174756917,10),n=l(n,o,r,i,e[2],718787259,15),i=l(i,n,o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+i|0,this._c=this._c+n|0,this._d=this._d+o|0},s.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=o.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=s},function(e,t,r){e.exports=n;var i=r(67).EventEmitter;function n(){i.call(this)}r(4)(n,i),n.Readable=r(38),n.Writable=r(172),n.Duplex=r(173),n.Transform=r(174),n.PassThrough=r(175),n.Stream=n,n.prototype.pipe=function(e,t){var r=this;function n(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",n),e.on("drain",o),e._isStdio||t&&!1===t.end||(r.on("end",s),r.on("close",u));var a=!1;function s(){a||(a=!0,e.end())}function u(){a||(a=!0,"function"==typeof e.destroy&&e.destroy())}function c(e){if(h(),0===i.listenerCount(this,"error"))throw e}function h(){r.removeListener("data",n),e.removeListener("drain",o),r.removeListener("end",s),r.removeListener("close",u),r.removeListener("error",c),e.removeListener("error",c),r.removeListener("end",h),r.removeListener("close",h),e.removeListener("close",h)}return r.on("error",c),e.on("error",c),r.on("end",h),r.on("close",h),e.on("close",h),e.emit("pipe",r),e}},function(e,t,r){"use strict";var i,n="object"==typeof Reflect?Reflect:null,o=n&&"function"==typeof n.apply?n.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};i=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(r,i){function n(r){e.removeListener(t,o),i(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",n),r([].slice.call(arguments))}b(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&b(e,"error",t,r)}(e,n,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var u=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function h(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function f(e,t,r,i){var n,o,a,s;if(c(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]),void 0===a)a=o[t]=r,++e._eventsCount;else if("function"==typeof a?a=o[t]=i?[r,a]:[a,r]:i?a.unshift(r):a.push(r),(n=h(e))>0&&a.length>n&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,s=u,console&&console.warn&&console.warn(s)}return e}function l(){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 d(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=l.bind(i);return n.listener=r,i.wrapFn=n,n}function p(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(n):g(n,n.length)}function m(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function g(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}function b(e,t,r,i){if("function"==typeof e.on)i.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function n(o){i.once&&e.removeEventListener(t,n),r(o)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||a(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");u=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||a(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return h(this)},s.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,n=this._events;if(void 0!==n)i=i&&void 0===n.error;else if(!i)return!1;if(i){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=n[e];if(void 0===u)return!1;if("function"==typeof u)o(u,this,t);else{var c=u.length,h=g(u,c);for(r=0;r<c;++r)o(h[r],this,t)}return!0},s.prototype.addListener=function(e,t){return f(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return f(this,e,t,!0)},s.prototype.once=function(e,t){return c(t),this.on(e,d(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return c(t),this.prependListener(e,d(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,i,n,o,a;if(c(t),void 0===(i=this._events))return this;if(void 0===(r=i[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,n=o;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,n),1===r.length&&(i[e]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",e,a||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var n,o=Object.keys(r);for(i=0;i<o.length;++i)"removeListener"!==(n=o[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},s.prototype.listeners=function(e){return p(this,e,!0)},s.prototype.rawListeners=function(e){return p(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(e,t,r){var i=r(0),n=i.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=i:(o(i,t),t.Buffer=a),o(n,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},function(e,t,r){"use strict";(function(t,i,n){var o=r(52);function a(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var i=e.entry;e.entry=null;for(;i;){var n=i.callback;t.pendingcb--,n(r),i=i.next}t.corkedRequestsFree.next=e}(t,e)}}e.exports=y;var s,u=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?i:o.nextTick;y.WritableState=b;var c=Object.create(r(39));c.inherits=r(4);var h={deprecate:r(169)},f=r(99),l=r(68).Buffer,d=(void 0!==n?n:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var p,m=r(100);function g(){}function b(e,t){s=s||r(28),e=e||{};var i=t instanceof s;this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,c=e.writableHighWaterMark,h=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(c||0===c)?c:h,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===e.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,i=r.sync,n=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,i,n){--t.pendingcb,r?(o.nextTick(n,i),o.nextTick(I,e,t),e._writableState.errorEmitted=!0,e.emit("error",i)):(n(i),e._writableState.errorEmitted=!0,e.emit("error",i),I(e,t))}(e,r,i,t,n);else{var a=S(r);a||r.corked||r.bufferProcessing||!r.bufferedRequest||w(e,r),i?u(_,e,r,a,n):_(e,r,a,n)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}function y(e){if(s=s||r(28),!(p.call(y,this)||this instanceof s))return new y(e);this._writableState=new b(e,this),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)),f.call(this)}function v(e,t,r,i,n,o,a){t.writelen=i,t.writecb=a,t.writing=!0,t.sync=!0,r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}function _(e,t,r,i){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,i(),I(e,t)}function w(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,n=new Array(i),o=t.corkedRequestsFree;o.entry=r;for(var s=0,u=!0;r;)n[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;n.allBuffers=u,v(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 a(t),t.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,h=r.encoding,f=r.callback;if(v(e,t,!1,t.objectMode?1:c.length,c,h,f),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function S(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function k(e,t){e._final((function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),I(e,t)}))}function I(e,t){var r=S(t);return r&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,o.nextTick(k,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}c.inherits(y,f),b.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(b.prototype,"buffer",{get:h.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(e){return!!p.call(this,e)||this===y&&(e&&e._writableState instanceof b)}})):p=function(e){return e instanceof this},y.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},y.prototype.write=function(e,t,r){var i,n=this._writableState,a=!1,s=!n.objectMode&&(i=e,l.isBuffer(i)||i instanceof d);return s&&!l.isBuffer(e)&&(e=function(e){return l.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=n.defaultEncoding),"function"!=typeof r&&(r=g),n.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),o.nextTick(t,r)}(this,r):(s||function(e,t,r,i){var n=!0,a=!1;return null===r?a=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(e.emit("error",a),o.nextTick(i,a),n=!1),n}(this,n,e,r))&&(n.pendingcb++,a=function(e,t,r,i,n,o){if(!r){var a=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,r));return t}(t,i,n);i!==a&&(r=!0,n="buffer",i=a)}var s=t.objectMode?1:i.length;t.length+=s;var u=t.length<t.highWaterMark;u||(t.needDrain=!0);if(t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:o,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else v(e,t,!1,s,i,n,o);return u}(this,n,s,e,t,r)),a},y.prototype.cork=function(){this._writableState.corked++},y.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||w(this,e))},y.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},y.prototype._writev=null,y.prototype.end=function(e,t,r){var i=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,t,r){t.ending=!0,I(e,t),r&&(t.finished?o.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,i,r)},Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),y.prototype.destroy=m.destroy,y.prototype._undestroy=m.undestroy,y.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(6),r(167).setImmediate,r(13))},function(e,t,r){"use strict";var i=r(170).Buffer,n=i.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(i.isEncoding===n||!n(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=c,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=h,this.end=f,t=3;break;default:return this.write=l,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=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 c(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 h(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 f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function l(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}t.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},o.prototype.text=function(e,t){var r=function(e,t,r){var i=t.length-1;if(i<r)return 0;var n=a(t[i]);if(n>=0)return n>0&&(e.lastNeed=n-1),n;if(--i<r||-2===n)return 0;if((n=a(t[i]))>=0)return n>0&&(e.lastNeed=n-2),n;if(--i<r||-2===n)return 0;if((n=a(t[i]))>=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 i=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,r){"use strict";var i=r(0).Buffer,n=r(102),o=r(177),a=new Array(16),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],u=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],c=[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],f=[0,1518500249,1859775393,2400959708,2840853838],l=[1352829926,1548603684,1836072691,2053994217,0];function d(e,t){return e<<t|e>>>32-t}function p(e,t,r,i,n,o,a,s){return d(e+(t^r^i)+o+a|0,s)+n|0}function m(e,t,r,i,n,o,a,s){return d(e+(t&r|~t&i)+o+a|0,s)+n|0}function g(e,t,r,i,n,o,a,s){return d(e+((t|~r)^i)+o+a|0,s)+n|0}function b(e,t,r,i,n,o,a,s){return d(e+(t&i|r&~i)+o+a|0,s)+n|0}function y(e,t,r,i,n,o,a,s){return d(e+(t^(r|~i))+o+a|0,s)+n|0}function v(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}n(v,o),v.prototype._update=function(){for(var e=a,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,i=0|this._b,n=0|this._c,o=0|this._d,v=0|this._e,_=0|this._a,w=0|this._b,S=0|this._c,k=0|this._d,I=0|this._e,E=0;E<80;E+=1){var A,O;E<16?(A=p(r,i,n,o,v,e[s[E]],f[0],c[E]),O=y(_,w,S,k,I,e[u[E]],l[0],h[E])):E<32?(A=m(r,i,n,o,v,e[s[E]],f[1],c[E]),O=b(_,w,S,k,I,e[u[E]],l[1],h[E])):E<48?(A=g(r,i,n,o,v,e[s[E]],f[2],c[E]),O=g(_,w,S,k,I,e[u[E]],l[2],h[E])):E<64?(A=b(r,i,n,o,v,e[s[E]],f[3],c[E]),O=m(_,w,S,k,I,e[u[E]],l[3],h[E])):(A=y(r,i,n,o,v,e[s[E]],f[4],c[E]),O=p(_,w,S,k,I,e[u[E]],l[4],h[E])),r=v,v=o,o=d(n,10),n=i,i=A,_=I,I=k,k=d(S,10),S=w,w=O}var x=this._b+n+k|0;this._b=this._c+o+I|0,this._c=this._d+v+_|0,this._d=this._e+r+w|0,this._e=this._a+i+S|0,this._a=x},v.prototype._digest=function(){this._block[this._blockOffset]=128,this._blockOffset+=1,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=i.alloc?i.alloc(20):new i(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=v},function(e,t,r){"use strict";var i=r(103),n=r(75),o=n([i("%String.prototype.indexOf%")]);e.exports=function(e,t){var r=i(e,!!t);return"function"==typeof r&&o(e,".prototype.")>-1?n([r]):r}},function(e,t,r){"use strict";e.exports=Object},function(e,t,r){"use strict";e.exports=function(){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(var i 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 n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},function(e,t,r){"use strict";var i=r(42),n=r(40),o=r(76),a=r(108);e.exports=function(e){if(e.length<1||"function"!=typeof e[0])throw new n("a function is required");return a(i,o,e)}},function(e,t,r){"use strict";e.exports=Function.prototype.call},function(e,t,r){"use strict";e.exports=Function.prototype.apply},function(e,t,r){"use strict";e.exports=function(t){var r=t.toLowerCase(),i=e.exports[r];if(!i)throw new Error(r+" is not supported (we accept pull requests)");return new i},e.exports.sha=r(212),e.exports.sha1=r(213),e.exports.sha224=r(214),e.exports.sha256=r(109),e.exports.sha384=r(215),e.exports.sha512=r(110)},function(e,t,r){"use strict";var i=r(14);function n(e){this.options=e,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=!1!==e.padding}e.exports=n,n.prototype._init=function(){},n.prototype.update=function(e){return 0===e.length?[]:"decrypt"===this.type?this._updateDecrypt(e):this._updateEncrypt(e)},n.prototype._buffer=function(e,t){for(var r=Math.min(this.buffer.length-this.bufferOff,e.length-t),i=0;i<r;i++)this.buffer[this.bufferOff+i]=e[t+i];return this.bufferOff+=r,r},n.prototype._flushBuffer=function(e,t){return this._update(this.buffer,0,e,t),this.bufferOff=0,this.blockSize},n.prototype._updateEncrypt=function(e){var t=0,r=0,i=(this.bufferOff+e.length)/this.blockSize|0,n=new Array(i*this.blockSize);0!==this.bufferOff&&(t+=this._buffer(e,t),this.bufferOff===this.buffer.length&&(r+=this._flushBuffer(n,r)));for(var o=e.length-(e.length-t)%this.blockSize;t<o;t+=this.blockSize)this._update(e,t,n,r),r+=this.blockSize;for(;t<e.length;t++,this.bufferOff++)this.buffer[this.bufferOff]=e[t];return n},n.prototype._updateDecrypt=function(e){for(var t=0,r=0,i=Math.ceil((this.bufferOff+e.length)/this.blockSize)-1,n=new Array(i*this.blockSize);i>0;i--)t+=this._buffer(e,t),r+=this._flushBuffer(n,r);return t+=this._buffer(e,t),n},n.prototype.final=function(e){var t,r;return e&&(t=this.update(e)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),t?t.concat(r):r},n.prototype._pad=function(e,t){if(0===t)return!1;for(;t<e.length;)e[t++]=0;return!0},n.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var e=new Array(this.blockSize);return this._update(this.buffer,0,e,0),e},n.prototype._unpad=function(e){return e},n.prototype._finalDecrypt=function(){i.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var e=new Array(this.blockSize);return this._flushBuffer(e,0),this._unpad(e)}},function(e,t,r){var i=r(225),n=r(233),o=r(123);t.createCipher=t.Cipher=i.createCipher,t.createCipheriv=t.Cipheriv=i.createCipheriv,t.createDecipher=t.Decipher=n.createDecipher,t.createDecipheriv=t.Decipheriv=n.createDecipheriv,t.listCiphers=t.getCiphers=function(){return Object.keys(o)}},function(e,t,r){var i={ECB:r(226),CBC:r(227),CFB:r(228),CFB8:r(229),CFB1:r(230),OFB:r(231),CTR:r(121),GCM:r(121)},n=r(123);for(var o in n)n[o].module=i[n[o].mode];e.exports=n},function(e,t,r){var i;function n(e){this.rand=e}if(e.exports=function(e){return i||(i=new n(null)),i.generate(e)},e.exports.Rand=n,n.prototype.generate=function(e){return this._rand(e)},n.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r<t.length;r++)t[r]=this.rand.getByte();return t},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?n.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?n.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(n.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var o=r(237);if("function"!=typeof o.randomBytes)throw new Error("Not supported");n.prototype._rand=function(e){return o.randomBytes(e)}}catch(e){}},function(e,t,r){"use strict";var i=r(243),n=r(33),o=r(1).Buffer;function a(e){var t,r=e.modulus.byteLength();do{t=new i(n(r))}while(t.cmp(e.modulus)>=0||!t.umod(e.prime1)||!t.umod(e.prime2));return t}function s(e,t){var r=function(e){var t=a(e);return{blinder:t.toRed(i.mont(e.modulus)).redPow(new i(e.publicExponent)).fromRed(),unblinder:t.invm(e.modulus)}}(t),n=t.modulus.byteLength(),s=new i(e).mul(r.blinder).umod(t.modulus),u=s.toRed(i.mont(t.prime1)),c=s.toRed(i.mont(t.prime2)),h=t.coefficient,f=t.prime1,l=t.prime2,d=u.redPow(t.exponent1).fromRed(),p=c.redPow(t.exponent2).fromRed(),m=d.isub(p).imul(h).umod(f).imul(l);return p.iadd(m).imul(r.unblinder).umod(t.modulus).toArrayLike(o,"be",n)}s.getr=a,e.exports=s},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){"use strict";var i,n=t,o=r(58),a=r(129),s=r(15).assert;function u(e){"short"===e.type?this.curve=new a.short(e):"edwards"===e.type?this.curve=new a.edwards(e):this.curve=new a.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new u(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=u,c("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"]}),c("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"]}),c("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"]}),c("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"]}),c("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"]}),c("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"]}),c("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{i=r(255)}catch(e){i=void 0}c("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",i]})},function(e,t,r){var i=r(283);e.exports=i("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},function(e,t,r){"use strict";(function(t){var i=r(8),n=r(17),o=r(11),a=r(20),s=r(32),u=r(10),c=r(3),h=r(5),f=function e(t){if(!(this instanceof e))return new e(t);t&&this.set(t)};f.prototype.set=function(e){if(this.hashbuf=e.hashbuf||this.hashbuf,this.endian=e.endian||this.endian,this.privkey=e.privkey||this.privkey,this.pubkey=e.pubkey||(this.privkey?this.privkey.publicKey:this.pubkey),e.sig)if(t.isBuffer(e.sig)){var i=r(11);this.sig=i.fromDER(e.sig)}else this.sig=e.sig;else this.sig=this.sig;return this.k=e.k||this.k,this.verified=e.verified||this.verified,this},f.prototype.privkey2pubkey=function(){this.pubkey=this.privkey.toPublicKey()},f.prototype.calci=function(){for(var e=0;e<4;e++){var t;this.sig.i=e;try{t=this.toPublicKey()}catch(e){console.error(e);continue}if(t.point.eq(this.pubkey.point))return this.sig.compressed=this.pubkey.compressed,this}throw this.sig.i=void 0,new Error("Unable to find valid recovery factor")},f.fromString=function(e){var t=JSON.parse(e);return new f(t)},f.prototype.randomK=function(){var e,t=n.getN();do{e=i.fromBuffer(s.getRandomBuffer(32))}while(!e.lt(t)||!e.gt(i.Zero));return this.k=e,this},f.prototype.deterministicK=function(e){c.isUndefined(e)&&(e=0);var r=t.alloc(32);r.fill(1);var o=t.alloc(32);o.fill(0);var a=this.privkey.bn.toBuffer({size:32}),s="little"===this.endian?t.from(this.hashbuf).reverse():this.hashbuf;o=u.sha256hmac(t.concat([r,t.from([0]),a,s]),o),r=u.sha256hmac(r,o),o=u.sha256hmac(t.concat([r,t.from([1]),a,s]),o),r=u.sha256hmac(r,o),r=u.sha256hmac(r,o);for(var h=i.fromBuffer(r),f=n.getN(),l=0;l<e||!h.lt(f)||!h.gt(i.Zero);l++)o=u.sha256hmac(t.concat([r,t.from([0])]),o),r=u.sha256hmac(r,o),r=u.sha256hmac(r,o),h=i.fromBuffer(r);return this.k=h,this},f.prototype.toPublicKey=function(){var e=this.sig.i;h.checkArgument(0===e||1===e||2===e||3===e,new Error("i must be equal to 0, 1, 2, or 3"));var t=i.fromBuffer(this.hashbuf),r=this.sig.r,o=this.sig.s,s=1&e,u=e>>1,c=n.getN(),f=n.getG(),l=u?r.add(c):r,d=n.fromX(s,l);if(!d.mul(c).isInfinity())throw new Error("nR is not a valid curve point");var p=t.neg().umod(c),m=r.invm(c),g=d.mul(o).add(f.mul(p)).mul(m);return a.fromPoint(g,this.sig.compressed)},f.prototype.sigError=function(){if(!t.isBuffer(this.hashbuf)||32!==this.hashbuf.length)return"hashbuf must be a 32 byte buffer";var e=this.sig.r,r=this.sig.s,o=n.getN();try{if(e.lte(i.Zero)||r.lte(i.Zero)||e.gte(o)||r.gte(o))return"r and s not in range";var a=i.fromBuffer(this.hashbuf,this.endian?{endian:this.endian}:void 0),s=r.invm(o),u=s.mul(a).umod(o),c=s.mul(e).umod(o),h=n.getG().mulAdd(u,this.pubkey.point,c);return h.isInfinity()?"p is infinity":0!==h.getX().umod(o).cmp(e)&&"Invalid signature"}catch(e){return"Signature security validation failed: "+e.message}},f.toLowS=function(e){return e.gt(i.fromBuffer(t.from("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))&&(e=n.getN().sub(e)),e},f.prototype._findSignature=function(e,t){var r,o,a,s=n.getN(),u=n.getG(),c=0;do{(!this.k||c>0)&&this.deterministicK(c),c++,r=this.k,o=u.mul(r).x.umod(s),a=r.invm(s).mul(t.add(e.mul(o))).umod(s)}while(o.cmp(i.Zero)<=0||a.cmp(i.Zero)<=0);return{s:a=f.toLowS(a),r:o}},f.prototype.sign=function(){var e=this.hashbuf,r=this.privkey,n=r.bn;h.checkState(e&&r&&n,new Error("invalid parameters")),h.checkState(t.isBuffer(e)&&32===e.length,new Error("hashbuf must be a 32 byte buffer"));var a=i.fromBuffer(e,this.endian?{endian:this.endian}:void 0),s=this._findSignature(n,a);return s.compressed=this.pubkey.compressed,this.sig=new o(s),this},f.prototype.signRandomK=function(){return this.randomK(),this.sign()},f.prototype.toString=function(){var e={};return this.hashbuf&&(e.hashbuf=this.hashbuf.toString("hex")),this.privkey&&(e.privkey=this.privkey.toString()),this.pubkey&&(e.pubkey=this.pubkey.toString()),this.sig&&(e.sig=this.sig.toString()),this.k&&(e.k=this.k.toString()),JSON.stringify(e)},f.prototype.verify=function(){return this.sigError()?this.verified=!1:this.verified=!0,this},f.sign=function(e,t,r){return f().set({hashbuf:e,endian:r,privkey:t}).sign().sig},f.signWithCalcI=function(e,t,r){return f().set({hashbuf:e,endian:r,privkey:t}).sign().calci().sig},f.signRandomK=function(e,t,r){return f().set({hashbuf:e,endian:r,privkey:t}).signRandomK().sig},f.verify=function(e,t,r,i){return f().set({hashbuf:e,endian:i,sig:t,pubkey:r}).verify().verified},e.exports=f}).call(this,r(0).Buffer)},function(e,t,r){(function(e){var i=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},i=0;i<t.length;i++)r[t[i]]=Object.getOwnPropertyDescriptor(e,t[i]);return r},n=/%[sdj%]/g;t.format=function(e){if(!b(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(s(arguments[r]));return t.join(" ")}r=1;for(var i=arguments,o=i.length,a=String(e).replace(n,(function(e){if("%%"===e)return"%";if(r>=o)return e;switch(e){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(e){return"[Circular]"}default:return e}})),u=i[r];r<o;u=i[++r])m(u)||!_(u)?a+=" "+u:a+=" "+s(u);return a},t.deprecate=function(r,i){if(void 0!==e&&!0===e.noDeprecation)return r;if(void 0===e)return function(){return t.deprecate(r,i).apply(this,arguments)};var n=!1;return function(){if(!n){if(e.throwDeprecation)throw new Error(i);e.traceDeprecation?console.trace(i):console.error(i),n=!0}return r.apply(this,arguments)}};var o,a={};function s(e,r){var i={seen:[],stylize:c};return arguments.length>=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),p(r)?i.showHidden=r:r&&t._extend(i,r),y(i.showHidden)&&(i.showHidden=!1),y(i.depth)&&(i.depth=2),y(i.colors)&&(i.colors=!1),y(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=u),h(i,e,i.depth)}function u(e,t){var r=s.styles[t];return r?"["+s.colors[r][0]+"m"+e+"["+s.colors[r][1]+"m":e}function c(e,t){return e}function h(e,r,i){if(e.customInspect&&r&&k(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(i,e);return b(n)||(n=h(e,n,i)),n}var o=function(e,t){if(y(t))return e.stylize("undefined","undefined");if(b(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(g(t))return e.stylize(""+t,"number");if(p(t))return e.stylize(""+t,"boolean");if(m(t))return e.stylize("null","null")}(e,r);if(o)return o;var a=Object.keys(r),s=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(r)),S(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return f(r);if(0===a.length){if(k(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(v(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(w(r))return e.stylize(Date.prototype.toString.call(r),"date");if(S(r))return f(r)}var c,_="",I=!1,E=["{","}"];(d(r)&&(I=!0,E=["[","]"]),k(r))&&(_=" [Function"+(r.name?": "+r.name:"")+"]");return v(r)&&(_=" "+RegExp.prototype.toString.call(r)),w(r)&&(_=" "+Date.prototype.toUTCString.call(r)),S(r)&&(_=" "+f(r)),0!==a.length||I&&0!=r.length?i<0?v(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),c=I?function(e,t,r,i,n){for(var o=[],a=0,s=t.length;a<s;++a)x(t,String(a))?o.push(l(e,t,r,i,String(a),!0)):o.push("");return n.forEach((function(n){n.match(/^\d+$/)||o.push(l(e,t,r,i,n,!0))})),o}(e,r,i,s,a):a.map((function(t){return l(e,r,i,s,t,I)})),e.seen.pop(),function(e,t,r){if(e.reduce((function(e,t){return t.indexOf("\n")>=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]}(c,_,E)):E[0]+_+E[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,r,i,n,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(t,n)||{value:t[n]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),x(i,n)||(a="["+n+"]"),s||(e.seen.indexOf(u.value)<0?(s=m(r)?h(e,u.value,null):h(e,u.value,r-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),y(a)){if(o&&n.match(/^\d+$/))return s;(a=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function d(e){return Array.isArray(e)}function p(e){return"boolean"==typeof e}function m(e){return null===e}function g(e){return"number"==typeof e}function b(e){return"string"==typeof e}function y(e){return void 0===e}function v(e){return _(e)&&"[object RegExp]"===I(e)}function _(e){return"object"==typeof e&&null!==e}function w(e){return _(e)&&"[object Date]"===I(e)}function S(e){return _(e)&&("[object Error]"===I(e)||e instanceof Error)}function k(e){return"function"==typeof e}function I(e){return Object.prototype.toString.call(e)}function E(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(r){if(y(o)&&(o=e.env.NODE_DEBUG||""),r=r.toUpperCase(),!a[r])if(new RegExp("\\b"+r+"\\b","i").test(o)){var i=e.pid;a[r]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",r,i,e)}}else a[r]=function(){};return a[r]},t.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=d,t.isBoolean=p,t.isNull=m,t.isNullOrUndefined=function(e){return null==e},t.isNumber=g,t.isString=b,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=y,t.isRegExp=v,t.isObject=_,t.isDate=w,t.isError=S,t.isFunction=k,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(292);var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function O(){var e=new Date,t=[E(e.getHours()),E(e.getMinutes()),E(e.getSeconds())].join(":");return[e.getDate(),A[e.getMonth()],t].join(" ")}function x(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",O(),t.format.apply(t,arguments))},t.inherits=r(4),t._extend=function(e,t){if(!t||!_(t))return e;for(var r=Object.keys(t),i=r.length;i--;)e[r[i]]=t[r[i]];return e};var P="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function M(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(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(P&&e[P]){var t;if("function"!=typeof(t=e[P]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,P,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,i=new Promise((function(e,i){t=e,r=i})),n=[],o=0;o<arguments.length;o++)n.push(arguments[o]);n.push((function(e,i){e?r(e):t(i)}));try{e.apply(this,n)}catch(e){r(e)}return i}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),P&&Object.defineProperty(t,P,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,i(e))},t.promisify.custom=P,t.callbackify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');function r(){for(var r=[],i=0;i<arguments.length;i++)r.push(arguments[i]);var n=r.pop();if("function"!=typeof n)throw new TypeError("The last argument must be of type Function");var o=this,a=function(){return n.apply(o,arguments)};t.apply(this,r).then((function(t){e.nextTick(a,null,t)}),(function(t){e.nextTick(M,t,a)}))}return Object.setPrototypeOf(r,Object.getPrototypeOf(t)),Object.defineProperties(r,i(t)),r}}).call(this,r(6))},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(5),o=r(12);function a(e){if(!(this instanceof a))return new a(e);var t;if(i.isNumber(e))t=e;else{if(!i.isString(e))throw new TypeError('Unrecognized num type: "'+typeof e+'" for Opcode');t=a.map[e]}return o.defineImmutable(this,{num:t}),this}for(var s in a.fromBuffer=function(e){return n.checkArgument(t.isBuffer(e)),new a(Number("0x"+e.toString("hex")))},a.fromNumber=function(e){return n.checkArgument(i.isNumber(e)),new a(e)},a.fromString=function(e){n.checkArgument(i.isString(e));var t=a.map[e];if(void 0===t)throw new TypeError("Invalid opcodestr");return new a(t)},a.prototype.toHex=function(){return this.num.toString(16)},a.prototype.toBuffer=function(){return t.from(this.toHex(),"hex")},a.prototype.toNumber=function(){return this.num},a.prototype.toString=function(){var e=a.reverseMap[this.num];if(void 0===e)throw new Error("Opcode does not have a string representation");return e},a.smallInt=function(e){return n.checkArgument(i.isNumber(e),"Invalid Argument: n should be number"),n.checkArgument(e>=0&&e<=16,"Invalid Argument: n must be between 0 and 16"),0===e?a("OP_0"):new a(a.map.OP_1+e-1)},a.map={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SPLIT:127,OP_NUM2BIN:128,OP_BIN2NUM:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_CHECKLOCKTIMEVERIFY:177,OP_CHECKSEQUENCEVERIFY:178,OP_NOP1:176,OP_NOP2:177,OP_NOP3:178,OP_SUBSTR:179,OP_LEFT:180,OP_RIGHT:181,OP_NOP4:182,OP_NOP5:183,OP_NOP6:184,OP_NOP7:185,OP_NOP8:186,OP_NOP9:187,OP_NOP10:188,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255},a.reverseMap=[],a.map)a.reverseMap[a.map[s]]=s;i.extend(a,a.map),a.isSmallIntOp=function(e){return e instanceof a&&(e=e.toNumber()),e===a.map.OP_0||e>=a.map.OP_1&&e<=a.map.OP_16},a.prototype.inspect=function(){return"<Opcode: "+this.toString()+", hex: "+this.toHex()+", decimal: "+this.num+">"},e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(142),o=r(89),a=r(8),s=r(10),u=r(11),c=r(20),h=r(293),f=function e(t){if(!(this instanceof e))return new e(t);t?(this.initialize(),this.set(t)):this.initialize()};f.prototype.verify=function(e,t,o,a,s,u){var c,h=r(31);if(i.isUndefined(o)&&(o=new h),i.isUndefined(a)&&(a=0),i.isUndefined(s)&&(s=0),s&f.SCRIPT_ENABLE_SIGHASH_FORKID&&(s|=f.SCRIPT_VERIFY_STRICTENC,!u))throw new Error("internal error - need satoshisBN to verify FORKID transactions");if(this.set({script:e,tx:o,nin:a,flags:s,satoshisBN:u}),0!=(s&f.SCRIPT_VERIFY_SIGPUSHONLY)&&!e.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(!this.evaluate())return!1;s&f.SCRIPT_VERIFY_P2SH&&(c=this.stack.slice());var l=this.stack;if(this.initialize(),this.set({script:t,stack:l,tx:o,nin:a,flags:s,satoshisBN:u}),!this.evaluate())return!1;if(0===this.stack.length)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_RESULT",!1;var d=this.stack[this.stack.length-1];if(!f.castToBool(d))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_STACK",!1;if(s&f.SCRIPT_VERIFY_P2SH&&t.isScriptHashOut()){if(!e.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(0===c.length)throw new Error("internal error - stack copy empty");var p=c[c.length-1],m=n.fromBuffer(p);if(c.pop(),this.initialize(),this.set({script:m,stack:c,tx:o,nin:a,flags:s,satoshisBN:u}),!this.evaluate())return!1;if(0===c.length)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_P2SH_STACK",!1;if(!f.castToBool(c[c.length-1]))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK",!1}if(0!=(s&f.SCRIPT_VERIFY_CLEANSTACK)){if(0==(s&f.SCRIPT_VERIFY_P2SH))throw new Error("internal error - CLEANSTACK without P2SH");if(1!==c.length)return this.errstr="SCRIPT_ERR_CLEANSTACK",!1}return!0},e.exports=f,f.prototype.initialize=function(e){this.stack=[],this.altstack=[],this.pc=0,this.pbegincodehash=0,this.nOpCount=0,this.vfExec=[],this.errstr="",this.flags=0},f.prototype.set=function(e){this.script=e.script||this.script,this.tx=e.tx||this.tx,this.nin=void 0!==e.nin?e.nin:this.nin,this.satoshisBN=e.satoshisBN||this.satoshisBN,this.stack=e.stack||this.stack,this.altstack=e.altstack||this.altstack,this.pc=void 0!==e.pc?e.pc:this.pc,this.pbegincodehash=void 0!==e.pbegincodehash?e.pbegincodehash:this.pbegincodehash,this.nOpCount=void 0!==e.nOpCount?e.nOpCount:this.nOpCount,this.vfExec=e.vfExec||this.vfExec,this.errstr=e.errstr||this.errstr,this.flags=void 0!==e.flags?e.flags:this.flags},f.true=t.from([1]),f.false=t.from([]),f.MAX_SCRIPT_ELEMENT_SIZE=520,f.MAXIMUM_ELEMENT_SIZE=4,f.MAX_OPS_PER_SCRIPT=201,f.LOCKTIME_THRESHOLD_BN=new a(f.LOCKTIME_THRESHOLD=5e8),f.useGenesisLimits=function(e){return f.MAX_SCRIPT_ELEMENT_SIZE=e=e||2147483647,f.MAXIMUM_ELEMENT_SIZE=e,f.MAX_OPS_PER_SCRIPT=e,f},f.SCRIPT_VERIFY_NONE=0,f.SCRIPT_VERIFY_P2SH=1,f.SCRIPT_VERIFY_STRICTENC=2,f.SCRIPT_VERIFY_DERSIG=4,f.SCRIPT_VERIFY_LOW_S=8,f.SCRIPT_VERIFY_NULLDUMMY=16,f.SCRIPT_VERIFY_SIGPUSHONLY=32,f.SCRIPT_VERIFY_MINIMALDATA=64,f.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS=128,f.SCRIPT_VERIFY_CLEANSTACK=256,f.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY=512,f.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY=1024,f.SCRIPT_VERIFY_MINIMALIF=8192,f.SCRIPT_VERIFY_NULLFAIL=16384,f.SCRIPT_VERIFY_COMPRESSED_PUBKEYTYPE=32768,f.SCRIPT_ENABLE_SIGHASH_FORKID=65536,f.SCRIPT_ENABLE_REPLAY_PROTECTION=1<<17,f.SCRIPT_ENABLE_MONOLITH_OPCODES=1<<18,f.SCRIPT_ENABLE_MAGNETIC_OPCODES=1<<19,f.SEQUENCE_LOCKTIME_DISABLE_FLAG=1<<31,f.SEQUENCE_LOCKTIME_TYPE_FLAG=1<<22,f.SEQUENCE_LOCKTIME_MASK=65535,f.castToBool=function(e){for(var t=0;t<e.length;t++)if(0!==e[t])return t!==e.length-1||128!==e[t];return!1},f.prototype.checkSignatureEncoding=function(e){var t;if(0===e.length)return!0;if(0!=(this.flags&(f.SCRIPT_VERIFY_DERSIG|f.SCRIPT_VERIFY_LOW_S|f.SCRIPT_VERIFY_STRICTENC))&&!u.isTxDER(e))return this.errstr="SCRIPT_ERR_SIG_DER_INVALID_FORMAT",!1;if(0!=(this.flags&f.SCRIPT_VERIFY_LOW_S)){if(!(t=u.fromTxFormat(e)).hasLowS())return this.errstr="SCRIPT_ERR_SIG_DER_HIGH_S",!1}else if(0!=(this.flags&f.SCRIPT_VERIFY_STRICTENC)){if(!(t=u.fromTxFormat(e)).hasDefinedHashtype())return this.errstr="SCRIPT_ERR_SIG_HASHTYPE",!1;if(!(this.flags&f.SCRIPT_ENABLE_SIGHASH_FORKID)&&t.nhashtype&u.SIGHASH_FORKID)return this.errstr="SCRIPT_ERR_ILLEGAL_FORKID",!1;if(this.flags&f.SCRIPT_ENABLE_SIGHASH_FORKID&&!(t.nhashtype&u.SIGHASH_FORKID))return this.errstr="SCRIPT_ERR_MUST_USE_FORKID",!1}return!0},f.prototype.checkPubkeyEncoding=function(e){return!(0!=(this.flags&f.SCRIPT_VERIFY_STRICTENC)&&!c.isValid(e))||(this.errstr="SCRIPT_ERR_PUBKEYTYPE",!1)},f._isMinimallyEncoded=function(e,t){return t=t||f.MAXIMUM_ELEMENT_SIZE,!(e.length>t)&&!(e.length>0&&0==(127&e[e.length-1])&&(e.length<=1||0==(128&e[e.length-2])))},f._minimallyEncode=function(e){if(0===e.length)return e;var r=e[e.length-1];if(127&r)return e;if(1===e.length)return t.from("");if(128&e[e.length-2])return e;for(var i=e.length-1;i>0;i--)if(0!==e[i-1])return 128&e[i-1]?e[i++]=r:e[i-1]|=r,e.slice(0,i);return t.from("")},f.prototype.evaluate=function(){if(this.script.toBuffer().length>1e4)return this.errstr="SCRIPT_ERR_SCRIPT_SIZE",!1;try{for(;this.pc<this.script.chunks.length;){let e={pc:this.pc,opcode:o.fromNumber(this.script.chunks[this.pc].opcodenum)};if(!this.step())return!1;this._callbackStep(e)}if(this.stack.length+this.altstack.length>1e3)return this.errstr="SCRIPT_ERR_STACK_SIZE",!1}catch(e){return this.errstr="SCRIPT_ERR_UNKNOWN_ERROR: "+e,!1}return!(this.vfExec.length>0)||(this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1)},f.prototype._callbackStep=function(e){if("function"==typeof this.stepListener)try{this.stepListener(e,h(this.stack,!0),h(this.altstack,!0))}catch(e){console.log("Error in Step callback:"+e)}},f.prototype.checkLockTime=function(e){return!!(this.tx.nLockTime<f.LOCKTIME_THRESHOLD&&e.lt(f.LOCKTIME_THRESHOLD_BN)||this.tx.nLockTime>=f.LOCKTIME_THRESHOLD&&e.gte(f.LOCKTIME_THRESHOLD_BN))&&(!e.gt(new a(this.tx.nLockTime))&&!this.tx.inputs[this.nin].isFinal())},f.prototype.checkSequence=function(e){var t=this.tx.inputs[this.nin].sequenceNumber;if(this.tx.version<2)return!1;if(t&f.SEQUENCE_LOCKTIME_DISABLE_FLAG)return!1;var r=f.SEQUENCE_LOCKTIME_TYPE_FLAG|f.SEQUENCE_LOCKTIME_MASK,i=new a(t&r),n=e.and(r),o=new a(f.SEQUENCE_LOCKTIME_TYPE_FLAG);return!!(i.lt(o)&&n.lt(o)||i.gte(o)&&n.gte(o))&&!n.gt(i)},f.prototype.step=function(){var e=this;function r(t){return e.stack[e.stack.length+t]}var h,l,d,p,m,g,b,y,v,_,w,S,k,I,E,A,O,x=0!=(this.flags&f.SCRIPT_VERIFY_MINIMALDATA),P=-1===this.vfExec.indexOf(!1),M=this.script.chunks[this.pc];this.pc++;var T=M.opcodenum;if(i.isUndefined(T))return this.errstr="SCRIPT_ERR_UNDEFINED_OPCODE",!1;if(M.buf&&M.buf.length>f.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;if(T>o.OP_16&&++this.nOpCount>f.MAX_OPS_PER_SCRIPT)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;if(function(t){switch(t){case o.OP_2MUL:case o.OP_2DIV:return!0;case o.OP_INVERT:case o.OP_MUL:case o.OP_LSHIFT:case o.OP_RSHIFT:if(0==(e.flags&f.SCRIPT_ENABLE_MAGNETIC_OPCODES))return!0;break;case o.OP_DIV:case o.OP_MOD:case o.OP_SPLIT:case o.OP_CAT:case o.OP_AND:case o.OP_OR:case o.OP_XOR:case o.OP_BIN2NUM:case o.OP_NUM2BIN:return!1}return!1}(T))return this.errstr="SCRIPT_ERR_DISABLED_OPCODE",!1;if(P&&T>=0&&T<=o.OP_PUSHDATA4){if(x&&!this.script.checkMinimalPush(this.pc-1))return this.errstr="SCRIPT_ERR_MINIMALDATA",!1;if(M.buf){if(M.len!==M.buf.length)throw new Error(`Length of push value not equal to length of data (${M.len},${M.buf.length})`);this.stack.push(M.buf)}else this.stack.push(f.false)}else if(P||o.OP_IF<=T&&T<=o.OP_ENDIF)switch(T){case o.OP_1NEGATE:case o.OP_1:case o.OP_2:case o.OP_3:case o.OP_4:case o.OP_5:case o.OP_6:case o.OP_7:case o.OP_8:case o.OP_9:case o.OP_10:case o.OP_11:case o.OP_12:case o.OP_13:case o.OP_14:case o.OP_15:case o.OP_16:m=T-(o.OP_1-1),h=new a(m).toScriptNumBuffer(),this.stack.push(h);break;case o.OP_NOP:break;case o.OP_NOP2:case o.OP_CHECKLOCKTIMEVERIFY:if(!(this.flags&f.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY)){if(this.flags&f.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var R=a.fromScriptNumBuffer(this.stack[this.stack.length-1],x,5);if(R.lt(new a(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(!this.checkLockTime(R))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case o.OP_NOP3:case o.OP_CHECKSEQUENCEVERIFY:if(!(this.flags&f.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY)){if(this.flags&f.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var B=a.fromScriptNumBuffer(r(-1),x,5);if(B.lt(new a(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(0!=(B&f.SEQUENCE_LOCKTIME_DISABLE_FLAG))break;if(!this.checkSequence(B))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case o.OP_NOP1:case o.OP_NOP4:case o.OP_NOP5:case o.OP_NOP6:case o.OP_NOP7:case o.OP_NOP8:case o.OP_NOP9:case o.OP_NOP10:if(this.flags&f.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break;case o.OP_IF:case o.OP_NOTIF:if(A=!1,P){if(this.stack.length<1)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;if(h=r(-1),this.flags&f.SCRIPT_VERIFY_MINIMALIF){if(h.length>1)return this.errstr="SCRIPT_ERR_MINIMALIF",!1;if(1===h.length&&1!==h[0])return this.errstr="SCRIPT_ERR_MINIMALIF",!1}A=f.castToBool(h),T===o.OP_NOTIF&&(A=!A),this.stack.pop()}this.vfExec.push(A);break;case o.OP_ELSE:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec[this.vfExec.length-1]=!this.vfExec[this.vfExec.length-1];break;case o.OP_ENDIF:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec.pop();break;case o.OP_VERIFY:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(h=r(-1),!(A=f.castToBool(h)))return this.errstr="SCRIPT_ERR_VERIFY",!1;this.stack.pop();break;case o.OP_RETURN:return this.errstr="SCRIPT_ERR_OP_RETURN",!1;case o.OP_TOALTSTACK:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.altstack.push(this.stack.pop());break;case o.OP_FROMALTSTACK:if(this.altstack.length<1)return this.errstr="SCRIPT_ERR_INVALID_ALTSTACK_OPERATION",!1;this.stack.push(this.altstack.pop());break;case o.OP_2DROP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop(),this.stack.pop();break;case o.OP_2DUP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=r(-2),d=r(-1),this.stack.push(t.from(l)),this.stack.push(t.from(d));break;case o.OP_3DUP:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=r(-3),d=r(-2);var N=r(-1);this.stack.push(t.from(l)),this.stack.push(t.from(d)),this.stack.push(t.from(N));break;case o.OP_2OVER:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=r(-4),d=r(-3),this.stack.push(t.from(l)),this.stack.push(t.from(d));break;case o.OP_2ROT:if(this.stack.length<6)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=this.stack.splice(this.stack.length-6,2),this.stack.push(p[0]),this.stack.push(p[1]);break;case o.OP_2SWAP:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=this.stack.splice(this.stack.length-4,2),this.stack.push(p[0]),this.stack.push(p[1]);break;case o.OP_IFDUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;h=r(-1),(A=f.castToBool(h))&&this.stack.push(t.from(h));break;case o.OP_DEPTH:h=new a(this.stack.length).toScriptNumBuffer(),this.stack.push(h);break;case o.OP_DROP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop();break;case o.OP_DUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(t.from(r(-1)));break;case o.OP_NIP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,1);break;case o.OP_OVER:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(t.from(r(-2)));break;case o.OP_PICK:case o.OP_ROLL:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(h=r(-1),m=(y=a.fromScriptNumBuffer(h,x)).toNumber(),this.stack.pop(),m<0||m>=this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;h=r(-m-1),T===o.OP_ROLL&&this.stack.splice(this.stack.length-m-1,1),this.stack.push(t.from(h));break;case o.OP_ROT:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;g=r(-3),b=r(-2);var C=r(-1);this.stack[this.stack.length-3]=b,this.stack[this.stack.length-2]=C,this.stack[this.stack.length-1]=g;break;case o.OP_SWAP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;g=r(-2),b=r(-1),this.stack[this.stack.length-2]=b,this.stack[this.stack.length-1]=g;break;case o.OP_TUCK:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,0,t.from(r(-1)));break;case o.OP_SIZE:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;y=new a(r(-1).length),this.stack.push(y.toScriptNumBuffer());break;case o.OP_AND:case o.OP_OR:case o.OP_XOR:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(l=r(-2),d=r(-1),l.length!==d.length)return this.errstr="SCRIPT_ERR_INVALID_OPERAND_SIZE",!1;switch(T){case o.OP_AND:for(let e=0;e<l.length;e++)l[e]&=d[e];break;case o.OP_OR:for(let e=0;e<l.length;e++)l[e]|=d[e];break;case o.OP_XOR:for(let e=0;e<l.length;e++)l[e]^=d[e]}this.stack.pop();break;case o.OP_INVERT:this.stack.length<1&&(this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION"),h=r(-1);for(let e=0;e<h.length;e++)h[e]=~h[e];break;case o.OP_LSHIFT:case o.OP_RSHIFT:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(0===(l=r(-2)).length)this.stack.pop();else{if(v=new a(l),(m=(_=a.fromScriptNumBuffer(r(-1),x)).toNumber())<0)return this.errstr="SCRIPT_ERR_INVALID_NUMBER_RANGE",!1;let e;this.stack.pop(),this.stack.pop(),T===o.OP_LSHIFT&&(e=v.ushln(m)),T===o.OP_RSHIFT&&(e=v.ushrn(m));let i=function(e,r){let i=e;for(;i.length<r;)i=t.concat([t.from([0]),i]);return i}(t.from(e.toArray().slice(-1*l.length)),l.length);this.stack.push(i)}break;case o.OP_EQUAL:case o.OP_EQUALVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=r(-2),d=r(-1);var D=l.toString("hex")===d.toString("hex");if(this.stack.pop(),this.stack.pop(),this.stack.push(D?f.true:f.false),T===o.OP_EQUALVERIFY){if(!D)return this.errstr="SCRIPT_ERR_EQUALVERIFY",!1;this.stack.pop()}break;case o.OP_1ADD:case o.OP_1SUB:case o.OP_NEGATE:case o.OP_ABS:case o.OP_NOT:case o.OP_0NOTEQUAL:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(h=r(-1),y=a.fromScriptNumBuffer(h,x),T){case o.OP_1ADD:y=y.add(a.One);break;case o.OP_1SUB:y=y.sub(a.One);break;case o.OP_NEGATE:y=y.neg();break;case o.OP_ABS:y.cmp(a.Zero)<0&&(y=y.neg());break;case o.OP_NOT:y=new a((0===y.cmp(a.Zero))+0);break;case o.OP_0NOTEQUAL:y=new a((0!==y.cmp(a.Zero))+0)}this.stack.pop(),this.stack.push(y.toScriptNumBuffer());break;case o.OP_ADD:case o.OP_SUB:case o.OP_MUL:case o.OP_MOD:case o.OP_DIV:case o.OP_BOOLAND:case o.OP_BOOLOR:case o.OP_NUMEQUAL:case o.OP_NUMEQUALVERIFY:case o.OP_NUMNOTEQUAL:case o.OP_LESSTHAN:case o.OP_GREATERTHAN:case o.OP_LESSTHANOREQUAL:case o.OP_GREATERTHANOREQUAL:case o.OP_MIN:case o.OP_MAX:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(v=a.fromScriptNumBuffer(r(-2),x,f.MAXIMUM_ELEMENT_SIZE),_=a.fromScriptNumBuffer(r(-1),x,f.MAXIMUM_ELEMENT_SIZE),y=new a(0),T){case o.OP_ADD:y=v.add(_);break;case o.OP_SUB:y=v.sub(_);break;case o.OP_MUL:y=v.mul(_);break;case o.OP_DIV:if(0===_)return this.errstr="SCRIPT_ERR_DIV_BY_ZERO",!1;y=v.div(_);break;case o.OP_MOD:if(0===_)return this.errstr="SCRIPT_ERR_DIV_BY_ZERO",!1;y=v.mod(_);break;case o.OP_BOOLAND:y=new a((0!==v.cmp(a.Zero)&&0!==_.cmp(a.Zero))+0);break;case o.OP_BOOLOR:y=new a((0!==v.cmp(a.Zero)||0!==_.cmp(a.Zero))+0);break;case o.OP_NUMEQUAL:case o.OP_NUMEQUALVERIFY:y=new a((0===v.cmp(_))+0);break;case o.OP_NUMNOTEQUAL:y=new a((0!==v.cmp(_))+0);break;case o.OP_LESSTHAN:y=new a((v.cmp(_)<0)+0);break;case o.OP_GREATERTHAN:y=new a((v.cmp(_)>0)+0);break;case o.OP_LESSTHANOREQUAL:y=new a((v.cmp(_)<=0)+0);break;case o.OP_GREATERTHANOREQUAL:y=new a((v.cmp(_)>=0)+0);break;case o.OP_MIN:y=v.cmp(_)<0?v:_;break;case o.OP_MAX:y=v.cmp(_)>0?v:_}if(this.stack.pop(),this.stack.pop(),this.stack.push(y.toScriptNumBuffer()),T===o.OP_NUMEQUALVERIFY){if(!f.castToBool(r(-1)))return this.errstr="SCRIPT_ERR_NUMEQUALVERIFY",!1;this.stack.pop()}break;case o.OP_WITHIN:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;v=a.fromScriptNumBuffer(r(-3),x,f.MAXIMUM_ELEMENT_SIZE),_=a.fromScriptNumBuffer(r(-2),x,f.MAXIMUM_ELEMENT_SIZE);var j=a.fromScriptNumBuffer(r(-1),x,f.MAXIMUM_ELEMENT_SIZE);A=_.cmp(v)<=0&&v.cmp(j)<0,this.stack.pop(),this.stack.pop(),this.stack.pop(),this.stack.push(A?f.true:f.false);break;case o.OP_RIPEMD160:case o.OP_SHA1:case o.OP_SHA256:case o.OP_HASH160:case o.OP_HASH256:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var L;h=r(-1),T===o.OP_RIPEMD160?L=s.ripemd160(h):T===o.OP_SHA1?L=s.sha1(h):T===o.OP_SHA256?L=s.sha256(h):T===o.OP_HASH160?L=s.sha256ripemd160(h):T===o.OP_HASH256&&(L=s.sha256sha256(h)),this.stack.pop(),this.stack.push(L);break;case o.OP_CODESEPARATOR:this.pbegincodehash=this.pc;break;case o.OP_CHECKSIG:case o.OP_CHECKSIGVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(w=r(-2),S=r(-1),!this.checkSignatureEncoding(w)||!this.checkPubkeyEncoding(S))return!1;k=(new n).set({chunks:this.script.chunks.slice(this.pbegincodehash)});var U=(new n).add(w);k.findAndDelete(U);try{I=u.fromTxFormat(w),E=c.fromBuffer(S,!1),O=this.tx.verifySignature(I,E,this.nin,k,this.satoshisBN,this.flags)}catch(e){O=!1}if(!O&&this.flags&f.SCRIPT_VERIFY_NULLFAIL&&w.length)return this.errstr="SCRIPT_ERR_NULLFAIL",!1;if(this.stack.pop(),this.stack.pop(),this.stack.push(O?f.true:f.false),T===o.OP_CHECKSIGVERIFY){if(!O)return this.errstr="SCRIPT_ERR_CHECKSIGVERIFY",!1;this.stack.pop()}break;case o.OP_CHECKMULTISIG:case o.OP_CHECKMULTISIGVERIFY:var H=1;if(this.stack.length<H)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var z=a.fromScriptNumBuffer(r(-H),x).toNumber();if(z<0||z>20)return this.errstr="SCRIPT_ERR_PUBKEY_COUNT",!1;if(this.nOpCount+=z,this.nOpCount>f.MAX_OPS_PER_SCRIPT)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;var F=++H;H+=z;var K=z+2;if(this.stack.length<H)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var V=a.fromScriptNumBuffer(r(-H),x).toNumber();if(V<0||V>z)return this.errstr="SCRIPT_ERR_SIG_COUNT",!1;var q=++H;if(H+=V,this.stack.length<H)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;k=(new n).set({chunks:this.script.chunks.slice(this.pbegincodehash)});for(var G=0;G<V;G++)w=r(-q-G),k.findAndDelete((new n).add(w));for(O=!0;O&&V>0;){if(w=r(-q),S=r(-F),!this.checkSignatureEncoding(w)||!this.checkPubkeyEncoding(S))return!1;var Z;try{I=u.fromTxFormat(w),E=c.fromBuffer(S,!1),Z=this.tx.verifySignature(I,E,this.nin,k,this.satoshisBN,this.flags)}catch(e){Z=!1}Z&&(q++,V--),F++,V>--z&&(O=!1)}for(;H-- >1;){if(!O&&this.flags&f.SCRIPT_VERIFY_NULLFAIL&&!K&&r(-1).length)return this.errstr="SCRIPT_ERR_NULLFAIL",!1;K>0&&K--,this.stack.pop()}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(this.flags&f.SCRIPT_VERIFY_NULLDUMMY&&r(-1).length)return this.errstr="SCRIPT_ERR_SIG_NULLDUMMY",!1;if(this.stack.pop(),this.stack.push(O?f.true:f.false),T===o.OP_CHECKMULTISIGVERIFY){if(!O)return this.errstr="SCRIPT_ERR_CHECKMULTISIGVERIFY",!1;this.stack.pop()}break;case o.OP_CAT:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(l=r(-2),d=r(-1),l.length+d.length>f.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;this.stack[this.stack.length-2]=t.concat([l,d]),this.stack.pop();break;case o.OP_SPLIT:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;l=r(-2);var Y=a.fromScriptNumBuffer(r(-1),x).toNumber();if(Y<0||Y>l.length)return this.errstr="SCRIPT_ERR_INVALID_SPLIT_RANGE",!1;var W=t.from(l);this.stack[this.stack.length-2]=W.slice(0,Y),this.stack[this.stack.length-1]=W.slice(Y);break;case o.OP_NUM2BIN:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var X=a.fromScriptNumBuffer(r(-1),x).toNumber();if(X>f.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;this.stack.pop();var J=r(-1);if((J=f._minimallyEncode(J)).length>X)return this.errstr="SCRIPT_ERR_IMPOSSIBLE_ENCODING",!1;if(J.length===X){this.stack[this.stack.length-1]=J;break}var $=0;J.length>0&&($=128&J[J.length-1],J[J.length-1]&=127);var Q=t.alloc(X);J.copy(Q,0);for(var ee=J.length-1;ee++<X-2;)Q[ee]=0;Q[ee]=$,this.stack[this.stack.length-1]=Q;break;case o.OP_BIN2NUM:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(l=r(-1),d=f._minimallyEncode(l),this.stack[this.stack.length-1]=d,!f._isMinimallyEncoded(d))return this.errstr="SCRIPT_ERR_INVALID_NUMBER_RANGE",!1;break;default:return this.errstr="SCRIPT_ERR_BAD_OPCODE",!1}return!0}}).call(this,r(0).Buffer)},function(e,t,r){e.exports=r(50),e.exports.PublicKey=r(297),e.exports.PublicKeyHash=r(298),e.exports.MultiSig=r(299),e.exports.MultiSigScriptHash=r(300)},function(e,t,r){"use strict";(function(t){const i=r(8),n=r(17),o=r(87),a=n.getN(),s=a.shrn(1);e.exports={smartVerify:function(e,n,u){if(!t.isBuffer(e)||32!==e.length)throw new Error("Invalid message hash: must be 32-byte buffer");if(!n)return!1;let c=n;if(t.isBuffer(n))try{c=r(11).fromDER(n)}catch(e){return!1}if(!c||!c.r||!c.s)return!1;const h=i.isBN(c.r)?c.r:new i(c.r),f=i.isBN(c.s)?c.s:new i(c.s);if(h.isZero()||f.isZero())return!1;if(h.gte(a)||f.gte(a))return!1;let l=f;f.gt(s)&&(l=a.sub(f));const d=new(r(11))({r:h,s:l});return o.verify(e,d,u)},isCanonical:function(e){if(!e)return!1;let n=e;if(t.isBuffer(e))try{n=r(11).fromDER(e)}catch(e){return!1}return!(!n||!n.s)&&(i.isBN(n.s)?n.s:new i(n.s)).lte(s)},canonicalize:function(e){if(!e||!e.r||!e.s)throw new Error("Invalid signature object");const t=i.isBN(e.r)?e.r:new i(e.r),r=i.isBN(e.s)?e.s:new i(e.s);let n=r;return r.gt(s)&&(n=a.sub(r)),{r:t,s:n}},constants:{n:a,nh:s}}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";const{ec:i}=r(29),n=new i("secp256k1"),o=n.verify.bind(n);n.verify=function(e,t,r,i,n){if(!t||"object"!=typeof t)return!1;if(!t.r||!t.s)return!1;const a="function"==typeof t.r.cmp?t.r:this.curve.n.red?this.curve.n.fromRed(t.r):t.r,s="function"==typeof t.s.cmp?t.s:this.curve.n.red?this.curve.n.fromRed(t.s):t.s;return!(a&&a.cmp&&a.cmp(this.curve.n)>=0)&&(!(s&&s.cmp&&s.cmp(this.curve.n)>=0)&&(!(a&&a.isZero&&a.isZero())&&(!(s&&s.isZero&&s.isZero())&&o(e,t,r,i,n))))};const a=n.sign.bind(n);n.sign=function(e,t,r,i){const n=a(e,t,r,i);if(n.s&&n.s.cmp){const e=this.curve.n.shrn(1);n.s.cmp(e)>0&&(n.s=this.curve.n.sub(n.s))}return n},e.exports=n},function(e,t,r){(function(e){function r(e,t){for(var r=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function i(e,t){if(e.filter)return e.filter(t);for(var r=[],i=0;i<e.length;i++)t(e[i],i,e)&&r.push(e[i]);return r}t.resolve=function(){for(var t="",n=!1,o=arguments.length-1;o>=-1&&!n;o--){var a=o>=0?arguments[o]:e.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(t=a+"/"+t,n="/"===a.charAt(0))}return(n?"/":"")+(t=r(i(t.split("/"),(function(e){return!!e})),!n).join("/"))||"."},t.normalize=function(e){var o=t.isAbsolute(e),a="/"===n(e,-1);return(e=r(i(e.split("/"),(function(e){return!!e})),!o).join("/"))||o||(e="."),e&&a&&(e+="/"),(o?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(i(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))},t.relative=function(e,r){function i(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=t.resolve(e).substr(1),r=t.resolve(r).substr(1);for(var n=i(e.split("/")),o=i(r.split("/")),a=Math.min(n.length,o.length),s=a,u=0;u<a;u++)if(n[u]!==o[u]){s=u;break}var c=[];for(u=s;u<n.length;u++)c.push("..");return(c=c.concat(o.slice(s))).join("/")},t.sep="/",t.delimiter=":",t.dirname=function(e){if("string"!=typeof e&&(e+=""),0===e.length)return".";for(var t=e.charCodeAt(0),r=47===t,i=-1,n=!0,o=e.length-1;o>=1;--o)if(47===(t=e.charCodeAt(o))){if(!n){i=o;break}}else n=!1;return-1===i?r?"/":".":r&&1===i?"/":e.slice(0,i)},t.basename=function(e,t){var r=function(e){"string"!=typeof e&&(e+="");var t,r=0,i=-1,n=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!n){r=t+1;break}}else-1===i&&(n=!1,i=t+1);return-1===i?"":e.slice(r,i)}(e);return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},t.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,r=0,i=-1,n=!0,o=0,a=e.length-1;a>=0;--a){var s=e.charCodeAt(a);if(47!==s)-1===i&&(n=!1,i=a+1),46===s?-1===t?t=a:1!==o&&(o=1):-1!==t&&(o=-1);else if(!n){r=a+1;break}}return-1===t||-1===i||0===o||1===o&&t===i-1&&t===r+1?"":e.slice(t,i)};var n="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return t<0&&(t=e.length+t),e.substr(t,r)}}).call(this,r(6))},function(e,t,r){"use strict";(function(e){var i=r(0).Buffer,n=r(66).Transform,o=r(338),a=r(88),s=r(48).ok,u=r(0).kMaxLength,c="Cannot create final Buffer. It would be larger than 0x"+u.toString(16)+" bytes";o.Z_MIN_WINDOWBITS=8,o.Z_MAX_WINDOWBITS=15,o.Z_DEFAULT_WINDOWBITS=15,o.Z_MIN_CHUNK=64,o.Z_MAX_CHUNK=1/0,o.Z_DEFAULT_CHUNK=16384,o.Z_MIN_MEMLEVEL=1,o.Z_MAX_MEMLEVEL=9,o.Z_DEFAULT_MEMLEVEL=8,o.Z_MIN_LEVEL=-1,o.Z_MAX_LEVEL=9,o.Z_DEFAULT_LEVEL=o.Z_DEFAULT_COMPRESSION;for(var h=Object.keys(o),f=0;f<h.length;f++){var l=h[f];l.match(/^Z/)&&Object.defineProperty(t,l,{enumerable:!0,value:o[l],writable:!1})}for(var d={Z_OK:o.Z_OK,Z_STREAM_END:o.Z_STREAM_END,Z_NEED_DICT:o.Z_NEED_DICT,Z_ERRNO:o.Z_ERRNO,Z_STREAM_ERROR:o.Z_STREAM_ERROR,Z_DATA_ERROR:o.Z_DATA_ERROR,Z_MEM_ERROR:o.Z_MEM_ERROR,Z_BUF_ERROR:o.Z_BUF_ERROR,Z_VERSION_ERROR:o.Z_VERSION_ERROR},p=Object.keys(d),m=0;m<p.length;m++){var g=p[m];d[d[g]]=g}function b(e,t,r){var n=[],o=0;function a(){for(var t;null!==(t=e.read());)n.push(t),o+=t.length;e.once("readable",a)}function s(){var t,a=null;o>=u?a=new RangeError(c):t=i.concat(n,o),n=[],e.close(),r(a,t)}e.on("error",(function(t){e.removeListener("end",s),e.removeListener("readable",a),r(t)})),e.on("end",s),e.end(t),a()}function y(e,t){if("string"==typeof t&&(t=i.from(t)),!i.isBuffer(t))throw new TypeError("Not a string or buffer");var r=e._finishFlushFlag;return e._processChunk(t,r)}function v(e){if(!(this instanceof v))return new v(e);O.call(this,e,o.DEFLATE)}function _(e){if(!(this instanceof _))return new _(e);O.call(this,e,o.INFLATE)}function w(e){if(!(this instanceof w))return new w(e);O.call(this,e,o.GZIP)}function S(e){if(!(this instanceof S))return new S(e);O.call(this,e,o.GUNZIP)}function k(e){if(!(this instanceof k))return new k(e);O.call(this,e,o.DEFLATERAW)}function I(e){if(!(this instanceof I))return new I(e);O.call(this,e,o.INFLATERAW)}function E(e){if(!(this instanceof E))return new E(e);O.call(this,e,o.UNZIP)}function A(e){return e===o.Z_NO_FLUSH||e===o.Z_PARTIAL_FLUSH||e===o.Z_SYNC_FLUSH||e===o.Z_FULL_FLUSH||e===o.Z_FINISH||e===o.Z_BLOCK}function O(e,r){var a=this;if(this._opts=e=e||{},this._chunkSize=e.chunkSize||t.Z_DEFAULT_CHUNK,n.call(this,e),e.flush&&!A(e.flush))throw new Error("Invalid flush flag: "+e.flush);if(e.finishFlush&&!A(e.finishFlush))throw new Error("Invalid flush flag: "+e.finishFlush);if(this._flushFlag=e.flush||o.Z_NO_FLUSH,this._finishFlushFlag=void 0!==e.finishFlush?e.finishFlush:o.Z_FINISH,e.chunkSize&&(e.chunkSize<t.Z_MIN_CHUNK||e.chunkSize>t.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBits<t.Z_MIN_WINDOWBITS||e.windowBits>t.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.level<t.Z_MIN_LEVEL||e.level>t.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevel<t.Z_MIN_MEMLEVEL||e.memLevel>t.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=t.Z_FILTERED&&e.strategy!=t.Z_HUFFMAN_ONLY&&e.strategy!=t.Z_RLE&&e.strategy!=t.Z_FIXED&&e.strategy!=t.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!i.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new o.Zlib(r);var s=this;this._hadError=!1,this._handle.onerror=function(e,r){x(s),s._hadError=!0;var i=new Error(e);i.errno=r,i.code=t.codes[r],s.emit("error",i)};var u=t.Z_DEFAULT_COMPRESSION;"number"==typeof e.level&&(u=e.level);var c=t.Z_DEFAULT_STRATEGY;"number"==typeof e.strategy&&(c=e.strategy),this._handle.init(e.windowBits||t.Z_DEFAULT_WINDOWBITS,u,e.memLevel||t.Z_DEFAULT_MEMLEVEL,c,e.dictionary),this._buffer=i.allocUnsafe(this._chunkSize),this._offset=0,this._level=u,this._strategy=c,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!a._handle},configurable:!0,enumerable:!0})}function x(t,r){r&&e.nextTick(r),t._handle&&(t._handle.close(),t._handle=null)}function P(e){e.emit("close")}Object.defineProperty(t,"codes",{enumerable:!0,value:Object.freeze(d),writable:!1}),t.Deflate=v,t.Inflate=_,t.Gzip=w,t.Gunzip=S,t.DeflateRaw=k,t.InflateRaw=I,t.Unzip=E,t.createDeflate=function(e){return new v(e)},t.createInflate=function(e){return new _(e)},t.createDeflateRaw=function(e){return new k(e)},t.createInflateRaw=function(e){return new I(e)},t.createGzip=function(e){return new w(e)},t.createGunzip=function(e){return new S(e)},t.createUnzip=function(e){return new E(e)},t.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),b(new v(t),e,r)},t.deflateSync=function(e,t){return y(new v(t),e)},t.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),b(new w(t),e,r)},t.gzipSync=function(e,t){return y(new w(t),e)},t.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),b(new k(t),e,r)},t.deflateRawSync=function(e,t){return y(new k(t),e)},t.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),b(new E(t),e,r)},t.unzipSync=function(e,t){return y(new E(t),e)},t.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),b(new _(t),e,r)},t.inflateSync=function(e,t){return y(new _(t),e)},t.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),b(new S(t),e,r)},t.gunzipSync=function(e,t){return y(new S(t),e)},t.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),b(new I(t),e,r)},t.inflateRawSync=function(e,t){return y(new I(t),e)},a.inherits(O,n),O.prototype.params=function(r,i,n){if(r<t.Z_MIN_LEVEL||r>t.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+r);if(i!=t.Z_FILTERED&&i!=t.Z_HUFFMAN_ONLY&&i!=t.Z_RLE&&i!=t.Z_FIXED&&i!=t.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+i);if(this._level!==r||this._strategy!==i){var a=this;this.flush(o.Z_SYNC_FLUSH,(function(){s(a._handle,"zlib binding closed"),a._handle.params(r,i),a._hadError||(a._level=r,a._strategy=i,n&&n())}))}else e.nextTick(n)},O.prototype.reset=function(){return s(this._handle,"zlib binding closed"),this._handle.reset()},O.prototype._flush=function(e){this._transform(i.alloc(0),"",e)},O.prototype.flush=function(t,r){var n=this,a=this._writableState;("function"==typeof t||void 0===t&&!r)&&(r=t,t=o.Z_FULL_FLUSH),a.ended?r&&e.nextTick(r):a.ending?r&&this.once("end",r):a.needDrain?r&&this.once("drain",(function(){return n.flush(t,r)})):(this._flushFlag=t,this.write(i.alloc(0),"",r))},O.prototype.close=function(t){x(this,t),e.nextTick(P,this)},O.prototype._transform=function(e,t,r){var n,a=this._writableState,s=(a.ending||a.ended)&&(!e||a.length===e.length);return null===e||i.isBuffer(e)?this._handle?(s?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=a.length&&(this._flushFlag=this._opts.flush||o.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},O.prototype._processChunk=function(e,t,r){var n=e&&e.length,o=this._chunkSize-this._offset,a=0,h=this,f="function"==typeof r;if(!f){var l,d=[],p=0;this.on("error",(function(e){l=e})),s(this._handle,"zlib binding closed");do{var m=this._handle.writeSync(t,e,a,n,this._buffer,this._offset,o)}while(!this._hadError&&y(m[0],m[1]));if(this._hadError)throw l;if(p>=u)throw x(this),new RangeError(c);var g=i.concat(d,p);return x(this),g}s(this._handle,"zlib binding closed");var b=this._handle.write(t,e,a,n,this._buffer,this._offset,o);function y(u,c){if(this&&(this.buffer=null,this.callback=null),!h._hadError){var l=o-c;if(s(l>=0,"have should not go down"),l>0){var m=h._buffer.slice(h._offset,h._offset+l);h._offset+=l,f?h.push(m):(d.push(m),p+=m.length)}if((0===c||h._offset>=h._chunkSize)&&(o=h._chunkSize,h._offset=0,h._buffer=i.allocUnsafe(h._chunkSize)),0===c){if(a+=n-u,n=u,!f)return!0;var g=h._handle.write(t,e,a,n,h._buffer,h._offset,h._chunkSize);return g.callback=y,void(g.buffer=e)}if(!f)return!1;r()}}b.buffer=e,b.callback=y},a.inherits(v,O),a.inherits(_,O),a.inherits(w,O),a.inherits(S,O),a.inherits(k,O),a.inherits(I,O),a.inherits(E,O)}).call(this,r(6))},function(e,t,r){"use strict";(function(t){var i=r(2),n=r(64),o=i.PrivateKey,a=i.crypto.Hash,s=i.crypto.ECDSA,u=(i.crypto.Signature,i.util.preconditions);r(3);function c(e,t){return this instanceof c?("string"==typeof e&&(e=o.fromWIF(e)),u.checkArgument(e instanceof o,"Invalid private key"),this.privateKey=e,this.publicKey=e.toPublicKey(),this.options=t||{},this.did=n.fromPrivateKey(e,this.options),this):new c(e,t)}c._sortValue=function(e){return Array.isArray(e)?e.map((function(e){return c._sortValue(e)})):null!==e&&"object"==typeof e?Object.keys(e).sort().reduce((function(t,r){return t[r]=c._sortValue(e[r]),t}),{}):e},c._canonicalizeJSON=function(e){return JSON.stringify(c._sortValue(e))},c._hashCredential=function(e){var r=c._canonicalizeJSON(e);return a.sha256(t.from(r,"utf8"))},c.prototype.createCredential=function(e,t){t=t||{},u.checkArgument(e&&"object"==typeof e,"Invalid credential subject");var r=(new Date).toISOString(),i={"@context":["https://www.w3.org/2018/credentials/v1"],id:t.id||"urn:uuid:"+this._generateUUID(),type:["VerifiableCredential"],issuer:this.did,issuanceDate:r,credentialSubject:e};return t.type&&(Array.isArray(t.type)?i.type=i.type.concat(t.type):i.type.push(t.type)),t.context&&(Array.isArray(t.context)?i["@context"]=i["@context"].concat(t.context):i["@context"].push(t.context)),t.expirationDate&&(i.expirationDate=t.expirationDate),t.termsOfUse&&(i.termsOfUse=t.termsOfUse),t.evidence&&(i.evidence=t.evidence),t.refreshService&&(i.refreshService=t.refreshService),i},c.prototype.signCredential=function(e,t){t=t||{},u.checkArgument(e&&"object"==typeof e,"Invalid credential");var r=JSON.parse(JSON.stringify(e));delete r.proof;var i=c._hashCredential(r),n=new s;n.hashbuf=i,n.privkey=this.privateKey,n.pubkey=this.publicKey,n.sign();var o=n.sig,a=this._createJWSSignature(i,o),h={type:"EcdsaSecp256k1Signature2019",created:(new Date).toISOString(),verificationMethod:this.did+"#keys-1",proofPurpose:t.proofPurpose||"assertionMethod",jws:a};t.challenge&&(h.challenge=t.challenge),t.domain&&(h.domain=t.domain);var f=JSON.parse(JSON.stringify(r));return f.proof=h,f.rootHash=i.toString("hex"),f},c.prototype._createJWSSignature=function(e,r){var i=t.from(JSON.stringify({alg:"ES256K",typ:"JWT"})).toString("base64url");e.toString("base64url");return i+".."+r.toDER().toString("base64url")},c.prototype.createEmailCredential=function(e,r){r=r||{},u.checkArgument("string"==typeof e&&e.includes("@"),"Invalid email address");var i={id:r.subjectId||"did:smartledger:"+a.sha256(t.from(e)).toString("hex"),email:e,verified:!0,verificationMethod:"email_verification",verificationTimestamp:(new Date).toISOString()},n={type:"EmailVerifiedCredential",context:"https://smartledger.technology/contexts/email/v1",...r},o=this.createCredential(i,n);return this.signCredential(o,r)},c.prototype.createAgeCredential=function(e,r,i){i=i||{},u.checkArgument("number"==typeof e&&e>0,"Invalid age");var n={id:i.subjectId||"urn:uuid:"+this._generateUUID(),ageOver:e,verified:!0,verificationMethod:"age_verification"};r&&(n.birthDateHash=a.sha256(t.from(r.toISOString())).toString("hex"));var o={type:"AgeVerifiedCredential",context:"https://smartledger.technology/contexts/age/v1",...i},s=this.createCredential(n,o);return this.signCredential(s,i)},c.prototype.createKYCCredential=function(e,r){r=r||{},u.checkArgument(e&&"object"==typeof e,"Invalid KYC data");var i={id:r.subjectId||"urn:uuid:"+this._generateUUID(),kycLevel:e.level||"basic",verified:!0,verificationMethod:"kyc_verification",verificationTimestamp:(new Date).toISOString(),verifyingAuthority:e.authority||this.did};e.firstName&&(i.firstNameHash=a.sha256(t.from(e.firstName)).toString("hex")),e.lastName&&(i.lastNameHash=a.sha256(t.from(e.lastName)).toString("hex")),e.ssn&&(i.ssnHash=a.sha256(t.from(e.ssn)).toString("hex"));var n={type:"KYCVerifiedCredential",context:"https://smartledger.technology/contexts/kyc/v1",...r},o=this.createCredential(i,n);return this.signCredential(o,r)},c.prototype.createOrganizationCredential=function(e,r){r=r||{},u.checkArgument(e&&"object"==typeof e,"Invalid organization data");var i={id:r.subjectId||"did:smartledger:org:"+a.sha256(t.from(e.name||"")).toString("hex"),name:e.name,type:e.type||"Organization",verified:!0,verificationMethod:"organization_verification",verificationTimestamp:(new Date).toISOString()};e.taxId&&(i.taxIdHash=a.sha256(t.from(e.taxId)).toString("hex")),e.incorporationState&&(i.incorporationState=e.incorporationState),e.industry&&(i.industry=e.industry);var n={type:"OrganizationCredential",context:"https://smartledger.technology/contexts/organization/v1",...r},o=this.createCredential(i,n);return this.signCredential(o,r)},c.prototype._generateUUID=function(){var e=i.crypto.Random.getRandomBuffer(16);e[6]=15&e[6]|64,e[8]=63&e[8]|128;var t=e.toString("hex");return[t.substring(0,8),t.substring(8,12),t.substring(12,16),t.substring(16,20),t.substring(20,32)].join("-")},c.prototype.createPresentation=function(e,t){t=t||{},u.checkArgument(Array.isArray(e),"Credentials must be an array");var r={"@context":["https://www.w3.org/2018/credentials/v1"],type:["VerifiablePresentation"],id:t.id||"urn:uuid:"+this._generateUUID(),holder:this.did,verifiableCredential:e};t.context&&(Array.isArray(t.context)?r["@context"]=r["@context"].concat(t.context):r["@context"].push(t.context));var i=c._hashCredential(r),n=new s;n.hashbuf=i,n.privkey=this.privateKey,n.pubkey=this.publicKey,n.sign();var o=n.sig,a=this._createJWSSignature(i,o),h={type:"EcdsaSecp256k1Signature2019",created:(new Date).toISOString(),verificationMethod:this.did+"#keys-1",proofPurpose:"authentication",jws:a};return t.challenge&&(h.challenge=t.challenge),t.domain&&(h.domain=t.domain),r.proof=h,r},c.prototype.getIssuerInfo=function(){return{did:this.did,publicKey:this.publicKey.toString("hex"),verificationMethod:this.did+"#keys-1"}},e.exports=c}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var i=r(64),n=r(96),o=r(355),a=r(356),s=r(357),u=r(358);function c(e){if(!(this instanceof c))return new c(e);e=e||{},this.didResolver=i,this.attestationVerifier=o,this.zkProver=a,this.schemaValidator=u,this._attestationSignerOptions=e.attestationSigner||{},this._anchorOptions=e.anchor||{}}c.prototype.createDID=function(e){return this.didResolver.fromPublicKey(e)},c.prototype.resolveDID=function(e){return this.didResolver.resolve(e)},c.prototype.verifyDIDOwnership=function(e,t){return this.didResolver.verifyOwnership(e,t)},c.prototype.createEmailCredential=function(e,t,r,i){return new n(i,this._attestationSignerOptions).createEmailCredential(r,{issuerDID:e,subjectId:t})},c.prototype.createAgeCredential=function(e,t,r,i,o){return new n(o,this._attestationSignerOptions).createAgeCredential(r,i,{issuerDID:e,subjectId:t})},c.prototype.createKYCCredential=function(e,t,r,i,o){var a=new n(o,this._attestationSignerOptions),s=Object.assign({level:r},i);return a.createKYCCredential(s,{issuerDID:e,subjectId:t})},c.prototype.createOrganizationCredential=function(e,t,r,i){return new n(i,this._attestationSignerOptions).createOrganizationCredential(r,{issuerDID:e,subjectId:t})},c.prototype.createPresentation=function(e,t,r,i){return new n(r,this._attestationSignerOptions).createPresentation(e,t,r,i)},c.prototype.signCredential=function(e,t){return new n(t,this._attestationSignerOptions).signCredential(e,t)},c.prototype.verifyCredential=function(e,t){return this.attestationVerifier.verifyCredential(e,t)},c.prototype.verifyPresentation=function(e,t){return this.attestationVerifier.verifyPresentation(e,t)},c.prototype.extractClaims=function(e){return this.attestationVerifier.extractClaims(e)},c.prototype.generateSelectiveProof=function(e,t,r){return this.zkProver.generateSelectiveProof(e,t,r)},c.prototype.verifySelectiveProof=function(e,t){return this.zkProver.verifySelectiveProof(e,t)},c.prototype.generateAgeProof=function(e,t,r){var i=new Date("1995-06-15");return this.zkProver.generateAgeProof(i,t,r)},c.prototype.verifyAgeProof=function(e,t,r){return this.zkProver.verifyAgeProof(e,t,r)},c.prototype.generateRangeProof=function(e,t,r,i){return this.zkProver.generateRangeProof(e,t,r,i)},c.prototype.verifyRangeProof=function(e,t,r){return this.zkProver.verifyRangeProof(e,t,r)},c.prototype.generateMembershipProof=function(e,t,r){return this.zkProver.generateMembershipProof(e,t,r)},c.prototype.verifyMembershipProof=function(e,t){return this.zkProver.verifyMembershipProof(e,t)},c.prototype.anchorCredential=function(e,t,r){return new s(t,this._anchorOptions).anchorCredential(e,t,r)},c.prototype.anchorBatch=function(e,t,r){return new s(t,this._anchorOptions).anchorBatch(e,t,r)},c.prototype.registerDID=function(e,t,r,i){return new s(r,this._anchorOptions).registerDID(e,t,r,i)},c.prototype.revokeCredential=function(e,t,r,i){return new s(r,this._anchorOptions).revokeCredential(e,t,r,i)},c.prototype.queryAnchoredData=function(e){return new s(null,this._anchorOptions).queryAnchoredData(e)},c.prototype.validateCredential=function(e,t){return this.schemaValidator.validate(e,t)},c.prototype.getSchema=function(e){return this.schemaValidator.getSchema(e)},c.prototype.getAllSchemas=function(){return this.schemaValidator.getAllSchemas()},c.prototype.addSchema=function(e,t){return this.schemaValidator.addSchema(e,t)},c.prototype.createTemplate=function(e){return this.schemaValidator.createTemplate(e)},c.prototype.generateNonce=function(e){return e=e||32,r(9).randomBytes(e).toString("hex")},c.prototype.hashData=function(e,t){var i=r(9).createHash("sha256");return i.update(e),t&&i.update(t),i.digest("hex")},c.prototype.getVersion=function(){return"1.0.0"},c.prototype.getInfo=function(){return{name:"SmartLedger BSV Global Digital Attestation Framework",version:this.getVersion(),description:"W3C-compliant verifiable credentials with DID resolution, zero-knowledge proofs, and blockchain anchoring",components:{didResolver:"DID Resolution and Management",attestationSigner:"Verifiable Credential Creation",attestationVerifier:"Credential and Presentation Verification",zkProver:"Zero-Knowledge Proof Generation and Verification",anchor:"Blockchain Anchoring and Timestamping",schemaValidator:"W3C VC Schema Validation"},standards:["W3C Verifiable Credentials Data Model v1.1","W3C Decentralized Identifiers (DIDs) v1.0","RFC 7515 JSON Web Signature (JWS)","BSV Blockchain Protocol"]}},e.exports=c},function(e,t,r){"use strict";(function(t,i){var n=r(52);e.exports=v;var o,a=r(163);v.ReadableState=y;r(67).EventEmitter;var s=function(e,t){return e.listeners(t).length},u=r(99),c=r(68).Buffer,h=(void 0!==t?t:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var f=Object.create(r(39));f.inherits=r(4);var l=r(164),d=void 0;d=l&&l.debuglog?l.debuglog("stream"):function(){};var p,m=r(165),g=r(100);f.inherits(v,u);var b=["error","close","destroy","pause","resume"];function y(e,t){e=e||{};var i=t instanceof(o=o||r(28));this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,a=e.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(a||0===a)?a:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(p||(p=r(70).StringDecoder),this.decoder=new p(e.encoding),this.encoding=e.encoding)}function v(e){if(o=o||r(28),!(this instanceof v))return new v(e);this._readableState=new y(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),u.call(this)}function _(e,t,r,i,n){var o,a=e._readableState;null===t?(a.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,k(e)}(e,a)):(n||(o=function(e,t){var r;i=t,c.isBuffer(i)||i instanceof h||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var i;return r}(a,t)),o?e.emit("error",o):a.objectMode||t&&t.length>0?("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),i?a.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):w(e,a,t,!0):a.ended?e.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!r?(t=a.decoder.write(t),a.objectMode||0!==t.length?w(e,a,t,!1):E(e,a)):w(e,a,t,!1))):i||(a.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(a)}function w(e,t,r,i){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&k(e)),E(e,t)}Object.defineProperty(v.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),v.prototype.destroy=g.destroy,v.prototype._undestroy=g.undestroy,v.prototype._destroy=function(e,t){this.push(null),t(e)},v.prototype.push=function(e,t){var r,i=this._readableState;return i.objectMode?r=!0:"string"==typeof e&&((t=t||i.defaultEncoding)!==i.encoding&&(e=c.from(e,t),t=""),r=!0),_(this,e,t,!1,r)},v.prototype.unshift=function(e){return _(this,e,null,!0,!1)},v.prototype.isPaused=function(){return!1===this._readableState.flowing},v.prototype.setEncoding=function(e){return p||(p=r(70).StringDecoder),this._readableState.decoder=new p(e),this._readableState.encoding=e,this};function S(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function k(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?n.nextTick(I,e):I(e))}function I(e){d("emit readable"),e.emit("readable"),P(e)}function E(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(A,e,t))}function A(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(d("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}function O(e){d("readable nexttick read 0"),e.read(0)}function x(e,t){t.reading||(d("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),P(e),t.flowing&&!t.reading&&e.read(0)}function P(e){var t=e._readableState;for(d("flow",t.flowing);t.flowing&&null!==e.read(););}function M(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.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var i;e<t.head.data.length?(i=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):i=e===t.head.data.length?t.shift():r?function(e,t){var r=t.head,i=1,n=r.data;e-=n.length;for(;r=r.next;){var o=r.data,a=e>o.length?o.length:e;if(a===o.length?n+=o:n+=o.slice(0,e),0===(e-=a)){a===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++i}return t.length-=i,n}(e,t):function(e,t){var r=c.allocUnsafe(e),i=t.head,n=1;i.data.copy(r),e-=i.data.length;for(;i=i.next;){var o=i.data,a=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,a),0===(e-=a)){a===o.length?(++n,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=o.slice(a));break}++n}return t.length-=n,r}(e,t);return i}(e,t.buffer,t.decoder),r);var r}function T(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,n.nextTick(R,t,e))}function R(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function B(e,t){for(var r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1}v.prototype.read=function(e){d("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return d("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?T(this):k(this),null;if(0===(e=S(e,t))&&t.ended)return 0===t.length&&T(this),null;var i,n=t.needReadable;return d("need readable",n),(0===t.length||t.length-e<t.highWaterMark)&&d("length less than watermark",n=!0),t.ended||t.reading?d("reading or ended",n=!1):n&&(d("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=S(r,t))),null===(i=e>0?M(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&T(this)),null!==i&&this.emit("data",i),i},v.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},v.prototype.pipe=function(e,t){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,d("pipe count=%d opts=%j",o.pipesCount,t);var u=(!t||!1!==t.end)&&e!==i.stdout&&e!==i.stderr?h:v;function c(t,i){d("onunpipe"),t===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,d("cleanup"),e.removeListener("close",b),e.removeListener("finish",y),e.removeListener("drain",f),e.removeListener("error",g),e.removeListener("unpipe",c),r.removeListener("end",h),r.removeListener("end",v),r.removeListener("data",m),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function h(){d("onend"),e.end()}o.endEmitted?n.nextTick(u):r.once("end",u),e.on("unpipe",c);var f=function(e){return function(){var t=e._readableState;d("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,P(e))}}(r);e.on("drain",f);var l=!1;var p=!1;function m(t){d("ondata"),p=!1,!1!==e.write(t)||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==B(o.pipes,e))&&!l&&(d("false write response, pause",o.awaitDrain),o.awaitDrain++,p=!0),r.pause())}function g(t){d("onerror",t),v(),e.removeListener("error",g),0===s(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",y),v()}function y(){d("onfinish"),e.removeListener("close",b),v()}function v(){d("unpipe"),r.unpipe(e)}return r.on("data",m),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?a(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",g),e.once("close",b),e.once("finish",y),e.emit("pipe",r),o.flowing||(d("pipe resume"),r.resume()),e},v.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 i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<n;o++)i[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=B(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},v.prototype.on=function(e,t){var r=u.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var i=this._readableState;i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.emittedReadable=!1,i.reading?i.length&&k(this):n.nextTick(O,this))}return r},v.prototype.addListener=v.prototype.on,v.prototype.resume=function(){var e=this._readableState;return e.flowing||(d("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(x,e,t))}(this,e)),this},v.prototype.pause=function(){return d("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(d("pause"),this._readableState.flowing=!1,this.emit("pause")),this},v.prototype.wrap=function(e){var t=this,r=this._readableState,i=!1;for(var n in e.on("end",(function(){if(d("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){(d("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(i=!0,e.pause()))})),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function(t){return function(){return e[t].apply(e,arguments)}}(n));for(var o=0;o<b.length;o++)e.on(b[o],this.emit.bind(this,b[o]));return this._read=function(t){d("wrapped _read",t),i&&(i=!1,e.resume())},this},Object.defineProperty(v.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),v._fromList=M}).call(this,r(13),r(6))},function(e,t,r){e.exports=r(67).EventEmitter},function(e,t,r){"use strict";var i=r(52);function n(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var r=this,o=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return o||a?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,i.nextTick(n,this,e)):i.nextTick(n,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||(r._writableState.errorEmitted=!0,i.nextTick(n,r,e)):i.nextTick(n,r,e):t&&t(e)})),this)},undestroy:function(){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)}}},function(e,t,r){"use strict";e.exports=a;var i=r(28),n=Object.create(r(39));function o(e,t){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),i(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function a(e){if(!(this instanceof a))return new a(e);i.call(this,e),this._transformState={afterTransform:o.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",s)}function s(){var e=this;"function"==typeof this._flush?this._flush((function(t,r){u(e,t,r)})):u(this,null,null)}function u(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}n.inherits=r(4),n.inherits(a,i),a.prototype.push=function(e,t){return this._transformState.needTransform=!1,i.prototype.push.call(this,e,t)},a.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")},a.prototype._write=function(e,t,r){var i=this._transformState;if(i.writecb=r,i.writechunk=e,i.writeencoding=t,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},a.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},a.prototype._destroy=function(e,t){var r=this;i.prototype._destroy.call(this,e,(function(e){t(e),r.emit("close")}))}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){"use strict";var i=r(73),n=r(181),o=r(182),a=r(183),s=r(184),u=r(104),c=r(40),h=r(185),f=r(186),l=r(187),d=r(188),p=r(189),m=r(190),g=r(191),b=r(192),y=Function,v=function(e){try{return y('"use strict"; return ('+e+").constructor;")()}catch(e){}},_=r(41),w=r(54),S=function(){throw new c},k=_?function(){try{return S}catch(e){try{return _(arguments,"callee").get}catch(e){return S}}}():S,I=r(195)(),E=r(105),A=r(107),O=r(106),x=r(77),P=r(76),M={},T="undefined"!=typeof Uint8Array&&E?E(Uint8Array):void 0,R={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?void 0:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer,"%ArrayIteratorPrototype%":I&&E?E([][Symbol.iterator]()):void 0,"%AsyncFromSyncIteratorPrototype%":void 0,"%AsyncFunction%":M,"%AsyncGenerator%":M,"%AsyncGeneratorFunction%":M,"%AsyncIteratorPrototype%":M,"%Atomics%":"undefined"==typeof Atomics?void 0:Atomics,"%BigInt%":"undefined"==typeof BigInt?void 0:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?void 0:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?void 0:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?void 0:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":n,"%eval%":eval,"%EvalError%":o,"%Float16Array%":"undefined"==typeof Float16Array?void 0:Float16Array,"%Float32Array%":"undefined"==typeof Float32Array?void 0:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?void 0:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?void 0:FinalizationRegistry,"%Function%":y,"%GeneratorFunction%":M,"%Int8Array%":"undefined"==typeof Int8Array?void 0:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?void 0:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?void 0:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":I&&E?E(E([][Symbol.iterator]())):void 0,"%JSON%":"object"==typeof JSON?JSON:void 0,"%Map%":"undefined"==typeof Map?void 0:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&I&&E?E((new Map)[Symbol.iterator]()):void 0,"%Math%":Math,"%Number%":Number,"%Object%":i,"%Object.getOwnPropertyDescriptor%":_,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?void 0:Promise,"%Proxy%":"undefined"==typeof Proxy?void 0:Proxy,"%RangeError%":a,"%ReferenceError%":s,"%Reflect%":"undefined"==typeof Reflect?void 0:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?void 0:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&I&&E?E((new Set)[Symbol.iterator]()):void 0,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":I&&E?E(""[Symbol.iterator]()):void 0,"%Symbol%":I?Symbol:void 0,"%SyntaxError%":u,"%ThrowTypeError%":k,"%TypedArray%":T,"%TypeError%":c,"%Uint8Array%":"undefined"==typeof Uint8Array?void 0:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?void 0:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?void 0:Uint32Array,"%URIError%":h,"%WeakMap%":"undefined"==typeof WeakMap?void 0:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?void 0:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?void 0:WeakSet,"%Function.prototype.call%":P,"%Function.prototype.apply%":x,"%Object.defineProperty%":w,"%Object.getPrototypeOf%":A,"%Math.abs%":f,"%Math.floor%":l,"%Math.max%":d,"%Math.min%":p,"%Math.pow%":m,"%Math.round%":g,"%Math.sign%":b,"%Reflect.getPrototypeOf%":O};if(E)try{null.error}catch(e){var B=E(E(e));R["%Error.prototype%"]=B}var N={__proto__:null,"%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"]},C=r(42),D=r(199),j=C.call(P,Array.prototype.concat),L=C.call(x,Array.prototype.splice),U=C.call(P,String.prototype.replace),H=C.call(P,String.prototype.slice),z=C.call(P,RegExp.prototype.exec),F=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,K=/\\(\\)?/g,V=function(e){var t=H(e,0,1),r=H(e,-1);if("%"===t&&"%"!==r)throw new u("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new u("invalid intrinsic syntax, expected opening `%`");var i=[];return U(e,F,(function(e,t,r,n){i[i.length]=r?U(n,K,"$1"):t||e})),i},q=function(e,t){var r,i=e;if(D(N,i)&&(i="%"+(r=N[i])[0]+"%"),D(R,i)){var n=R[i];if(n===M&&(n=function e(t){var r;if("%AsyncFunction%"===t)r=v("async function () {}");else if("%GeneratorFunction%"===t)r=v("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=v("async function* () {}");else if("%AsyncGenerator%"===t){var i=e("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if("%AsyncIteratorPrototype%"===t){var n=e("%AsyncGenerator%");n&&E&&(r=E(n.prototype))}return R[t]=r,r}(i)),void 0===n&&!t)throw new c("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:i,value:n}}throw new u("intrinsic "+e+" does not exist!")};e.exports=function(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');if(null===z(/^%?[^%]*%?$/,e))throw new u("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=V(e),i=r.length>0?r[0]:"",n=q("%"+i+"%",t),o=n.name,a=n.value,s=!1,h=n.alias;h&&(i=h[0],L(r,j([0,1],h)));for(var f=1,l=!0;f<r.length;f+=1){var d=r[f],p=H(d,0,1),m=H(d,-1);if(('"'===p||"'"===p||"`"===p||'"'===m||"'"===m||"`"===m)&&p!==m)throw new u("property names with quotes must have matching quotes");if("constructor"!==d&&l||(s=!0),D(R,o="%"+(i+="."+d)+"%"))a=R[o];else if(null!=a){if(!(d in a)){if(!t)throw new c("base intrinsic for "+e+" exists, but the property is not available.");return}if(_&&f+1>=r.length){var g=_(a,d);a=(l=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:a[d]}else l=D(a,d),a=a[d];l&&!s&&(R[o]=a)}}return a}},function(e,t,r){"use strict";e.exports=SyntaxError},function(e,t,r){"use strict";var i=r(106),n=r(107),o=r(196);e.exports=i?function(e){return i(e)}:n?function(e){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new TypeError("getProto: not an object");return n(e)}:o?function(e){return o(e)}:null},function(e,t,r){"use strict";e.exports="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null},function(e,t,r){"use strict";var i=r(73);e.exports=i.getPrototypeOf||null},function(e,t,r){"use strict";var i=r(42),n=r(77),o=r(76),a=r(198);e.exports=a||i.call(o,n)},function(e,t,r){"use strict";var i=r(34),n=r(35),o=r(1).Buffer,a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function u(){this.init(),this._w=s,n.call(this,64,56)}function c(e,t,r){return r^e&(t^r)}function h(e,t,r){return e&t|r&(e|t)}function f(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function l(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function d(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}i(u,n),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(e){for(var t,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,p=0|this._f,m=0|this._g,g=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]+d(r[b-15])+r[b-16];for(var y=0;y<64;++y){var v=g+l(u)+c(u,p,m)+a[y]+r[y]|0,_=f(i)+h(i,n,o)|0;g=m,m=p,p=u,u=s+v|0,s=o,o=n,n=i,i=v+_|0}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0,this._f=p+this._f|0,this._g=m+this._g|0,this._h=g+this._h|0},u.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=u},function(e,t,r){"use strict";var i=r(34),n=r(35),o=r(1).Buffer,a=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],s=new Array(160);function u(){this.init(),this._w=s,n.call(this,128,112)}function c(e,t,r){return r^e&(t^r)}function h(e,t,r){return e&t|r&(e|t)}function f(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function l(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function d(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function p(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function m(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function g(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function b(e,t){return e>>>0<t>>>0?1:0}i(u,n),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(e){for(var t=this._w,r=0|this._ah,i=0|this._bh,n=0|this._ch,o=0|this._dh,s=0|this._eh,u=0|this._fh,y=0|this._gh,v=0|this._hh,_=0|this._al,w=0|this._bl,S=0|this._cl,k=0|this._dl,I=0|this._el,E=0|this._fl,A=0|this._gl,O=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 P=t[x-30],M=t[x-30+1],T=d(P,M),R=p(M,P),B=m(P=t[x-4],M=t[x-4+1]),N=g(M,P),C=t[x-14],D=t[x-14+1],j=t[x-32],L=t[x-32+1],U=R+D|0,H=T+C+b(U,R)|0;H=(H=H+B+b(U=U+N|0,N)|0)+j+b(U=U+L|0,L)|0,t[x]=H,t[x+1]=U}for(var z=0;z<160;z+=2){H=t[z],U=t[z+1];var F=h(r,i,n),K=h(_,w,S),V=f(r,_),q=f(_,r),G=l(s,I),Z=l(I,s),Y=a[z],W=a[z+1],X=c(s,u,y),J=c(I,E,A),$=O+Z|0,Q=v+G+b($,O)|0;Q=(Q=(Q=Q+X+b($=$+J|0,J)|0)+Y+b($=$+W|0,W)|0)+H+b($=$+U|0,U)|0;var ee=q+K|0,te=V+F+b(ee,q)|0;v=y,O=A,y=u,A=E,u=s,E=I,s=o+Q+b(I=k+$|0,k)|0,o=n,k=S,n=i,S=w,i=r,w=_,r=Q+te+b(_=$+ee|0,$)|0}this._al=this._al+_|0,this._bl=this._bl+w|0,this._cl=this._cl+S|0,this._dl=this._dl+k|0,this._el=this._el+I|0,this._fl=this._fl+E|0,this._gl=this._gl+A|0,this._hl=this._hl+O|0,this._ah=this._ah+r+b(this._al,_)|0,this._bh=this._bh+i+b(this._bl,w)|0,this._ch=this._ch+n+b(this._cl,S)|0,this._dh=this._dh+o+b(this._dl,k)|0,this._eh=this._eh+s+b(this._el,I)|0,this._fh=this._fh+u+b(this._fl,E)|0,this._gh=this._gh+y+b(this._gl,A)|0,this._hh=this._hh+v+b(this._hl,O)|0},u.prototype._hash=function(){var e=o.allocUnsafe(64);function t(t,r,i){e.writeInt32BE(t,i),e.writeInt32BE(r,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},e.exports=u},function(e,t,r){"use strict";var i=r(4),n=r(217),o=r(23),a=r(1).Buffer,s=r(112),u=r(71),c=r(78),h=a.alloc(128);function f(e,t){o.call(this,"digest"),"string"==typeof t&&(t=a.from(t));var r="sha512"===e||"sha384"===e?128:64;(this._alg=e,this._key=t,t.length>r)?t=("rmd160"===e?new u:c(e)).update(t).digest():t.length<r&&(t=a.concat([t,h],r));for(var i=this._ipad=a.allocUnsafe(r),n=this._opad=a.allocUnsafe(r),s=0;s<r;s++)i[s]=54^t[s],n[s]=92^t[s];this._hash="rmd160"===e?new u:c(e),this._hash.update(i)}i(f,o),f.prototype._update=function(e){this._hash.update(e)},f.prototype._final=function(){var e=this._hash.digest();return("rmd160"===this._alg?new u:c(this._alg)).update(this._opad).update(e).digest()},e.exports=function(e,t){return"rmd160"===(e=e.toLowerCase())||"ripemd160"===e?new f("rmd160",t):"md5"===e?new n(s,t):new f(e,t)}},function(e,t,r){var i=r(65);e.exports=function(e){return(new i).update(e).digest()}},function(e){e.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}},function(e,t,r){"use strict";t.pbkdf2=r(219),t.pbkdf2Sync=r(117)},function(e,t,r){"use strict";var i=isFinite,n=Math.pow(2,30)-1;e.exports=function(e,t){if("number"!=typeof e)throw new TypeError("Iterations not a number");if(e<0||!i(e))throw new TypeError("Bad iterations");if("number"!=typeof t)throw new TypeError("Key length not a number");if(t<0||t>n||t!=t)throw new TypeError("Bad key length")}},function(e,t,r){"use strict";(function(t,r){var i;if(t.process&&t.process.browser)i="utf-8";else if(t.process&&t.process.version){i=parseInt(r.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else i="utf-8";e.exports=i}).call(this,r(13),r(6))},function(e,t,r){"use strict";var i=r(112),n=r(71),o=r(78),a=r(1).Buffer,s=r(115),u=r(116),c=r(118),h=a.alloc(128),f={__proto__:null,md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,"sha512-256":32,ripemd160:20,rmd160:20},l={__proto__:null,"sha-1":"sha1","sha-224":"sha224","sha-256":"sha256","sha-384":"sha384","sha-512":"sha512","ripemd-160":"ripemd160"};function d(e){return(new n).update(e).digest()}function p(e,t,r){var n=function(e){return"rmd160"===e||"ripemd160"===e?d:"md5"===e?i:function(t){return o(e).update(t).digest()}}(e),s="sha512"===e||"sha384"===e?128:64;t.length>s?t=n(t):t.length<s&&(t=a.concat([t,h],s));for(var u=a.allocUnsafe(s+f[e]),c=a.allocUnsafe(s+f[e]),l=0;l<s;l++)u[l]=54^t[l],c[l]=92^t[l];var p=a.allocUnsafe(s+r+4);u.copy(p,0,0,s),this.ipad1=p,this.ipad2=u,this.opad=c,this.alg=e,this.blocksize=s,this.hash=n,this.size=f[e]}p.prototype.run=function(e,t){return e.copy(t,this.blocksize),this.hash(t).copy(this.opad,this.blocksize),this.hash(this.opad)},e.exports=function(e,t,r,i,n){s(r,i),e=c(e,u,"Password"),t=c(t,u,"Salt");var o=(n||"sha1").toLowerCase(),h=l[o]||o,d=f[h];if("number"!=typeof d||!d)throw new TypeError("Digest algorithm not supported: "+n);var m=new p(h,e,t.length),g=a.allocUnsafe(i),b=a.allocUnsafe(t.length+4);t.copy(b,0,0,t.length);for(var y=0,v=d,_=Math.ceil(i/v),w=1;w<=_;w++){b.writeUInt32BE(w,t.length);for(var S=m.run(b,m.ipad1),k=S,I=1;I<r;I++){k=m.run(k,m.ipad2);for(var E=0;E<v;E++)S[E]^=k[E]}S.copy(g,y),y+=v}return g}},function(e,t,r){"use strict";var i=r(1).Buffer,n=r(53),o="undefined"!=typeof Uint8Array,a=o&&"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView;e.exports=function(e,t,r){if("string"==typeof e||i.isBuffer(e)||o&&e instanceof Uint8Array||a&&a(e))return n(e,t);throw new TypeError(r+" must be a string, a Buffer, a Uint8Array, or a DataView")}},function(e,t,r){"use strict";t.readUInt32BE=function(e,t){return(e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])>>>0},t.writeUInt32BE=function(e,t,r){e[0+r]=t>>>24,e[1+r]=t>>>16&255,e[2+r]=t>>>8&255,e[3+r]=255&t},t.ip=function(e,t,r,i){for(var n=0,o=0,a=6;a>=0;a-=2){for(var s=0;s<=24;s+=8)n<<=1,n|=t>>>s+a&1;for(s=0;s<=24;s+=8)n<<=1,n|=e>>>s+a&1}for(a=6;a>=0;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1}r[i+0]=n>>>0,r[i+1]=o>>>0},t.rip=function(e,t,r,i){for(var n=0,o=0,a=0;a<4;a++)for(var s=24;s>=0;s-=8)n<<=1,n|=t>>>s+a&1,n<<=1,n|=e>>>s+a&1;for(a=4;a<8;a++)for(s=24;s>=0;s-=8)o<<=1,o|=t>>>s+a&1,o<<=1,o|=e>>>s+a&1;r[i+0]=n>>>0,r[i+1]=o>>>0},t.pc1=function(e,t,r,i){for(var n=0,o=0,a=7;a>=5;a--){for(var s=0;s<=24;s+=8)n<<=1,n|=t>>s+a&1;for(s=0;s<=24;s+=8)n<<=1,n|=e>>s+a&1}for(s=0;s<=24;s+=8)n<<=1,n|=t>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;r[i+0]=n>>>0,r[i+1]=o>>>0},t.r28shl=function(e,t){return e<<t&268435455|e>>>28-t};var i=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];t.pc2=function(e,t,r,n){for(var o=0,a=0,s=i.length>>>1,u=0;u<s;u++)o<<=1,o|=e>>>i[u]&1;for(u=s;u<i.length;u++)a<<=1,a|=t>>>i[u]&1;r[n+0]=o>>>0,r[n+1]=a>>>0},t.expand=function(e,t,r){var i=0,n=0;i=(1&e)<<5|e>>>27;for(var o=23;o>=15;o-=4)i<<=6,i|=e>>>o&63;for(o=11;o>=3;o-=4)n|=e>>>o&63,n<<=6;n|=(31&e)<<1|e>>>31,t[r+0]=i>>>0,t[r+1]=n>>>0};var n=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];t.substitute=function(e,t){for(var r=0,i=0;i<4;i++){r<<=4,r|=n[64*i+(e>>>18-6*i&63)]}for(i=0;i<4;i++){r<<=4,r|=n[256+64*i+(t>>>18-6*i&63)]}return r>>>0};var o=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];t.permute=function(e){for(var t=0,r=0;r<o.length;r++)t<<=1,t|=e>>>o[r]&1;return t>>>0},t.padSplit=function(e,t,r){for(var i=e.toString(2);i.length<t;)i="0"+i;for(var n=[],o=0;o<t;o+=r)n.push(i.slice(o,o+r));return n.join(" ")}},function(e,t,r){"use strict";var i=r(14),n=r(4),o=r(119),a=r(79);function s(){this.tmp=new Array(2),this.keys=null}function u(e){a.call(this,e);var t=new s;this._desState=t,this.deriveKeys(t,e.key)}n(u,a),e.exports=u,u.create=function(e){return new u(e)};var c=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];u.prototype.deriveKeys=function(e,t){e.keys=new Array(32),i.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 a=0;a<e.keys.length;a+=2){var s=c[a>>>1];r=o.r28shl(r,s),n=o.r28shl(n,s),o.pc2(r,n,e.keys,a)}},u.prototype._update=function(e,t,r,i){var n=this._desState,a=o.readUInt32BE(e,t),s=o.readUInt32BE(e,t+4);o.ip(a,s,n.tmp,0),a=n.tmp[0],s=n.tmp[1],"encrypt"===this.type?this._encrypt(n,a,s,n.tmp,0):this._decrypt(n,a,s,n.tmp,0),a=n.tmp[0],s=n.tmp[1],o.writeUInt32BE(r,a,i),o.writeUInt32BE(r,s,i+4)},u.prototype._pad=function(e,t){if(!1===this.padding)return!1;for(var r=e.length-t,i=t;i<e.length;i++)e[i]=r;return!0},u.prototype._unpad=function(e){if(!1===this.padding)return e;for(var t=e[e.length-1],r=e.length-t;r<e.length;r++)i.equal(e[r],t);return e.slice(0,e.length-t)},u.prototype._encrypt=function(e,t,r,i,n){for(var a=t,s=r,u=0;u<e.keys.length;u+=2){var c=e.keys[u],h=e.keys[u+1];o.expand(s,e.tmp,0),c^=e.tmp[0],h^=e.tmp[1];var f=o.substitute(c,h),l=s;s=(a^o.permute(f))>>>0,a=l}o.rip(s,a,i,n)},u.prototype._decrypt=function(e,t,r,i,n){for(var a=r,s=t,u=e.keys.length-2;u>=0;u-=2){var c=e.keys[u],h=e.keys[u+1];o.expand(a,e.tmp,0),c^=e.tmp[0],h^=e.tmp[1];var f=o.substitute(c,h),l=a;a=(s^o.permute(f))>>>0,s=l}o.rip(a,s,i,n)}},function(e,t,r){var i=r(43),n=r(1).Buffer,o=r(122);function a(e){var t=e._cipher.encryptBlockRaw(e._prev);return o(e._prev),t}t.encrypt=function(e,t){var r=Math.ceil(t.length/16),o=e._cache.length;e._cache=n.concat([e._cache,n.allocUnsafe(16*r)]);for(var s=0;s<r;s++){var u=a(e),c=o+16*s;e._cache.writeUInt32BE(u[0],c+0),e._cache.writeUInt32BE(u[1],c+4),e._cache.writeUInt32BE(u[2],c+8),e._cache.writeUInt32BE(u[3],c+12)}var h=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),i(t,h)}},function(e,t){e.exports=function(e){for(var t,r=e.length;r--;){if(255!==(t=e.readUInt8(r))){t++,e.writeUInt8(t,r);break}e.writeUInt8(0,r)}}},function(e){e.exports={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192:{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256:{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}}},function(e,t,r){var i=r(55),n=r(1).Buffer,o=r(23),a=r(4),s=r(232),u=r(43),c=r(122);function h(e,t,r,a){o.call(this);var u=n.alloc(4,0);this._cipher=new i.AES(t);var h=this._cipher.encryptBlock(u);this._ghash=new s(h),r=function(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 i=new s(r),o=t.length,a=o%16;i.update(t),a&&(a=16-a,i.update(n.alloc(a,0))),i.update(n.alloc(8,0));var u=8*o,h=n.alloc(8);h.writeUIntBE(u,0,8),i.update(h),e._finID=i.state;var f=n.from(e._finID);return c(f),f}(this,r,h),this._prev=n.from(r),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=a,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}a(h,o),h.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},h.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=u(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var r=0;e.length!==t.length&&r++;for(var i=Math.min(e.length,t.length),n=0;n<i;++n)r+=e[n]^t[n];return r}(e,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=e,this._cipher.scrub()},h.prototype.getAuthTag=function(){if(this._decrypt||!n.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},h.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=e},h.prototype.setAAD=function(e){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(e),this._alen+=e.length},e.exports=h},function(e,t,r){var i=r(55),n=r(1).Buffer,o=r(23);function a(e,t,r,a){o.call(this),this._cipher=new i.AES(t),this._prev=n.from(r),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=a,this._mode=e}r(4)(a,o),a.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},a.prototype._final=function(){this._cipher.scrub()},e.exports=a},function(e,t,r){var i=r(33);e.exports=y,y.simpleSieve=g,y.fermatTest=b;var n=r(7),o=new n(24),a=new(r(127)),s=new n(1),u=new n(2),c=new n(5),h=(new n(16),new n(8),new n(10)),f=new n(3),l=(new n(7),new n(11)),d=new n(4),p=(new n(12),null);function m(){if(null!==p)return p;var e=[];e[0]=2;for(var t=1,r=3;r<1048576;r+=2){for(var i=Math.ceil(Math.sqrt(r)),n=0;n<t&&e[n]<=i&&r%e[n]!=0;n++);t!==n&&e[n]<=i||(e[t++]=r)}return p=e,e}function g(e){for(var t=m(),r=0;r<t.length;r++)if(0===e.modn(t[r]))return 0===e.cmpn(t[r]);return!0}function b(e){var t=n.mont(e);return 0===u.toRed(t).redPow(e.subn(1)).fromRed().cmpn(1)}function y(e,t){if(e<16)return new n(2===t||5===t?[140,123]:[140,39]);var r,p;for(t=new n(t);;){for(r=new n(i(Math.ceil(e/8)));r.bitLength()>e;)r.ishrn(1);if(r.isEven()&&r.iadd(s),r.testn(1)||r.iadd(u),t.cmp(u)){if(!t.cmp(c))for(;r.mod(h).cmp(f);)r.iadd(d)}else for(;r.mod(o).cmp(l);)r.iadd(d);if(g(p=r.shrn(1))&&g(r)&&b(p)&&b(r)&&a.test(p)&&a.test(r))return r}}},function(e,t,r){var i=r(7),n=r(82);function o(e){this.rand=e||new n.Rand}e.exports=o,o.create=function(e){return new o(e)},o.prototype._randbelow=function(e){var t=e.bitLength(),r=Math.ceil(t/8);do{var n=new i(this.rand.generate(r))}while(n.cmp(e)>=0);return n},o.prototype._randrange=function(e,t){var r=t.sub(e);return e.add(this._randbelow(r))},o.prototype.test=function(e,t,r){var n=e.bitLength(),o=i.mont(e),a=new i(1).toRed(o);t||(t=Math.max(1,n/48|0));for(var s=e.subn(1),u=0;!s.testn(u);u++);for(var c=e.shrn(u),h=s.toRed(o);t>0;t--){var f=this._randrange(new i(2),s);r&&r(f);var l=f.toRed(o).redPow(c);if(0!==l.cmp(a)&&0!==l.cmp(h)){for(var d=1;d<u;d++){if(0===(l=l.redSqr()).cmp(a))return!1;if(0===l.cmp(h))break}if(d===u)return!1}}return!0},o.prototype.getDivisor=function(e,t){var r=e.bitLength(),n=i.mont(e),o=new i(1).toRed(n);t||(t=Math.max(1,r/48|0));for(var a=e.subn(1),s=0;!a.testn(s);s++);for(var u=e.shrn(s),c=a.toRed(n);t>0;t--){var h=this._randrange(new i(2),a),f=e.gcd(h);if(0!==f.cmpn(1))return f;var l=h.toRed(n).redPow(u);if(0!==l.cmp(o)&&0!==l.cmp(c)){for(var d=1;d<s;d++){if(0===(l=l.redSqr()).cmp(o))return l.fromRed().subn(1).gcd(e);if(0===l.cmp(c))break}if(d===s)return(l=l.redSqr()).fromRed().subn(1).gcd(e)}}return!1}},function(e,t,r){"use strict";var i=t;function n(e){return 1===e.length?"0"+e:e}function o(e){for(var t="",r=0;r<e.length;r++)t+=n(e[r].toString(16));return t}i.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var i=0;i<e.length;i++)r[i]=0|e[i];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(i=0;i<e.length;i+=2)r.push(parseInt(e[i]+e[i+1],16))}else for(i=0;i<e.length;i++){var n=e.charCodeAt(i),o=n>>8,a=255&n;o?r.push(o,a):r.push(a)}return r},i.zero2=n,i.toHex=o,i.encode=function(e,t){return"hex"===t?o(e):e}},function(e,t,r){"use strict";var i=t;i.base=r(57),i.short=r(246),i.mont=r(247),i.edwards=r(248)},function(e,t,r){"use strict";var i=r(19).rotr32;function n(e,t,r){return e&t^~e&r}function o(e,t,r){return e&t^e&r^t&r}function a(e,t,r){return e^t^r}t.ft_1=function(e,t,r,i){return 0===e?n(t,r,i):1===e||3===e?a(t,r,i):2===e?o(t,r,i):void 0},t.ch32=n,t.maj32=o,t.p32=a,t.s0_256=function(e){return i(e,2)^i(e,13)^i(e,22)},t.s1_256=function(e){return i(e,6)^i(e,11)^i(e,25)},t.g0_256=function(e){return i(e,7)^i(e,18)^e>>>3},t.g1_256=function(e){return i(e,17)^i(e,19)^e>>>10}},function(e,t,r){"use strict";var i=r(19),n=r(44),o=r(130),a=r(14),s=i.sum32,u=i.sum32_4,c=i.sum32_5,h=o.ch32,f=o.maj32,l=o.s0_256,d=o.s1_256,p=o.g0_256,m=o.g1_256,g=n.BlockHash,b=[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 y(){if(!(this instanceof y))return new y;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=b,this.W=new Array(64)}i.inherits(y,g),e.exports=y,y.blockSize=512,y.outSize=256,y.hmacStrength=192,y.padLength=64,y.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;i<r.length;i++)r[i]=u(m(r[i-2]),r[i-7],p(r[i-15]),r[i-16]);var n=this.h[0],o=this.h[1],g=this.h[2],b=this.h[3],y=this.h[4],v=this.h[5],_=this.h[6],w=this.h[7];for(a(this.k.length===r.length),i=0;i<r.length;i++){var S=c(w,d(y),h(y,v,_),this.k[i],r[i]),k=s(l(n),f(n,o,g));w=_,_=v,v=y,y=s(b,S),b=g,g=o,o=n,n=s(S,k)}this.h[0]=s(this.h[0],n),this.h[1]=s(this.h[1],o),this.h[2]=s(this.h[2],g),this.h[3]=s(this.h[3],b),this.h[4]=s(this.h[4],y),this.h[5]=s(this.h[5],v),this.h[6]=s(this.h[6],_),this.h[7]=s(this.h[7],w)},y.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},function(e,t,r){"use strict";var i=r(19),n=r(44),o=r(14),a=i.rotr64_hi,s=i.rotr64_lo,u=i.shr64_hi,c=i.shr64_lo,h=i.sum64,f=i.sum64_hi,l=i.sum64_lo,d=i.sum64_4_hi,p=i.sum64_4_lo,m=i.sum64_5_hi,g=i.sum64_5_lo,b=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 v(){if(!(this instanceof v))return new v;b.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 _(e,t,r,i,n){var o=e&r^~e&n;return o<0&&(o+=4294967296),o}function w(e,t,r,i,n,o){var a=t&i^~t&o;return a<0&&(a+=4294967296),a}function S(e,t,r,i,n){var o=e&r^e&n^r&n;return o<0&&(o+=4294967296),o}function k(e,t,r,i,n,o){var a=t&i^t&o^i&o;return a<0&&(a+=4294967296),a}function I(e,t){var r=a(e,t,28)^a(t,e,2)^a(t,e,7);return r<0&&(r+=4294967296),r}function E(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function A(e,t){var r=a(e,t,14)^a(e,t,18)^a(t,e,9);return r<0&&(r+=4294967296),r}function O(e,t){var r=s(e,t,14)^s(e,t,18)^s(t,e,9);return r<0&&(r+=4294967296),r}function x(e,t){var r=a(e,t,1)^a(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function P(e,t){var r=s(e,t,1)^s(e,t,8)^c(e,t,7);return r<0&&(r+=4294967296),r}function M(e,t){var r=a(e,t,19)^a(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}function T(e,t){var r=s(e,t,19)^s(t,e,29)^c(e,t,6);return r<0&&(r+=4294967296),r}i.inherits(v,b),e.exports=v,v.blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(e,t){for(var r=this.W,i=0;i<32;i++)r[i]=e[t+i];for(;i<r.length;i+=2){var n=M(r[i-4],r[i-3]),o=T(r[i-4],r[i-3]),a=r[i-14],s=r[i-13],u=x(r[i-30],r[i-29]),c=P(r[i-30],r[i-29]),h=r[i-32],f=r[i-31];r[i]=d(n,o,a,s,u,c,h,f),r[i+1]=p(n,o,a,s,u,c,h,f)}},v.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,i=this.h[0],n=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4],c=this.h[5],d=this.h[6],p=this.h[7],b=this.h[8],y=this.h[9],v=this.h[10],x=this.h[11],P=this.h[12],M=this.h[13],T=this.h[14],R=this.h[15];o(this.k.length===r.length);for(var B=0;B<r.length;B+=2){var N=T,C=R,D=A(b,y),j=O(b,y),L=_(b,y,v,x,P),U=w(b,y,v,x,P,M),H=this.k[B],z=this.k[B+1],F=r[B],K=r[B+1],V=m(N,C,D,j,L,U,H,z,F,K),q=g(N,C,D,j,L,U,H,z,F,K);N=I(i,n),C=E(i,n),D=S(i,n,a,s,u),j=k(i,n,a,s,u,c);var G=f(N,C,D,j),Z=l(N,C,D,j);T=P,R=M,P=v,M=x,v=b,x=y,b=f(d,p,V,q),y=l(p,p,V,q),d=u,p=c,u=a,c=s,a=i,s=n,i=f(V,q,G,Z),n=l(V,q,G,Z)}h(this.h,0,i,n),h(this.h,2,a,s),h(this.h,4,u,c),h(this.h,6,d,p),h(this.h,8,b,y),h(this.h,10,v,x),h(this.h,12,P,M),h(this.h,14,T,R)},v.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},function(e,t,r){(function(e){!function(e,t){"use strict";function i(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(263).Buffer}catch(e){}function s(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void i(!1,"Invalid character in "+e)}function u(e,t,r){var i=s(e,r);return r-1>=t&&(i|=s(e,r-1)<<4),i}function c(e,t,r,n){for(var o=0,a=0,s=Math.min(e.length,r),u=t;u<s;u++){var c=e.charCodeAt(u)-48;o*=n,a=c>=49?c-49+10:c>=17?c-17+10:c,i(c>=0&&a<n,"Invalid character"),o+=a}return o}function h(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),i(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<e.length&&(16===t?this._parseHex(e,n,r):(this._parseBase(e,t,n),"le"===r&&this._initArray(this.toArray(),t,r)))},o.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(i(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initArray=function(e,t,r){if(i("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,a,s=0;if("be"===r)for(n=e.length-1,o=0;n>=0;n-=3)a=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(n=0,o=0;n<e.length;n+=3)a=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,a=0;if("be"===r)for(i=e.length-1;i>=t;i-=2)n=u(e,t,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;else for(i=(e.length-t)%2==0?t+1:t;i<e.length;i+=2)n=u(e,t,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;this._strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var o=e.length-r,a=o%i,s=Math.min(o,o-a)+r,u=0,h=r;h<s;h+=i)u=c(e,h,h+i,t),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var f=1;for(u=c(e,h,e.length,t),h=0;h<a;h++)f*=t;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype._move=function(e){h(e,this)},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch(e){o.prototype.inspect=f}else o.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<n|o)).toString(16);o=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),r=0!==o||a!==this.length-1?l[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var c=d[e],h=p[e];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var m=f.modrn(h).toString(e);r=(f=f.idivn(h)).isZero()?m+r:l[c-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},a&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(a,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function m(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],o=0|t.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c<i;c++){for(var h=u>>>26,f=67108863&u,l=Math.min(c,t.length-1),d=Math.max(0,c-e.length+1);d<=l;d++){var p=c-d|0;h+=(a=(n=0|e.words[p])*(o=0|t.words[d])+f)/67108864|0,f=67108863&a}r.words[c]=0|f,u=0|h}return 0!==u?r.words[c]=0|u:r.length--,r._strip()}o.prototype.toArrayLike=function(e,t,r){this._strip();var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,n),a},o.prototype._toArrayLikeLE=function(e,t){for(var r=0,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;e[r++]=255&a,r<e.length&&(e[r++]=a>>8&255),r<e.length&&(e[r++]=a>>16&255),6===o?(r<e.length&&(e[r++]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r<e.length)for(e[r++]=i;r<e.length;)e[r++]=0},o.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;e[r--]=255&a,r>=0&&(e[r--]=a>>8&255),r>=0&&(e[r--]=a>>16&255),6===o?(r>=0&&(e[r--]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r>=0)for(e[r--]=i;r>=0;)e[r--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},o.prototype.ior=function(e){return i(0==(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},o.prototype.iand=function(e){return i(0==(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var i=0;i<r.length;i++)this.words[i]=t.words[i]^r.words[i];if(this!==t)for(;i<t.length;i++)this.words[i]=t.words[i];return this.length=t.length,this._strip()},o.prototype.ixor=function(e){return i(0==(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<n:this.words[r]&~(1<<n),this._strip()},o.prototype.iadd=function(e){var t,r,i;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,i=e):(r=e,i=this);for(var n=0,o=0;o<i.length;o++)t=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&t,n=t>>>26;for(;0!==n&&o<r.length;o++)t=(0|r.words[o])+n,this.words[o]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,i,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=e):(r=e,i=this);for(var o=0,a=0;a<i.length;a++)o=(t=(0|r.words[a])-(0|i.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<r.length;a++)o=(t=(0|r.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var g=function(e,t,r){var i,n,o,a=e.words,s=t.words,u=r.words,c=0,h=0|a[0],f=8191&h,l=h>>>13,d=0|a[1],p=8191&d,m=d>>>13,g=0|a[2],b=8191&g,y=g>>>13,v=0|a[3],_=8191&v,w=v>>>13,S=0|a[4],k=8191&S,I=S>>>13,E=0|a[5],A=8191&E,O=E>>>13,x=0|a[6],P=8191&x,M=x>>>13,T=0|a[7],R=8191&T,B=T>>>13,N=0|a[8],C=8191&N,D=N>>>13,j=0|a[9],L=8191&j,U=j>>>13,H=0|s[0],z=8191&H,F=H>>>13,K=0|s[1],V=8191&K,q=K>>>13,G=0|s[2],Z=8191&G,Y=G>>>13,W=0|s[3],X=8191&W,J=W>>>13,$=0|s[4],Q=8191&$,ee=$>>>13,te=0|s[5],re=8191&te,ie=te>>>13,ne=0|s[6],oe=8191&ne,ae=ne>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,he=0|s[8],fe=8191&he,le=he>>>13,de=0|s[9],pe=8191&de,me=de>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(c+(i=Math.imul(f,z))|0)+((8191&(n=(n=Math.imul(f,F))+Math.imul(l,z)|0))<<13)|0;c=((o=Math.imul(l,F))+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,i=Math.imul(p,z),n=(n=Math.imul(p,F))+Math.imul(m,z)|0,o=Math.imul(m,F);var be=(c+(i=i+Math.imul(f,V)|0)|0)+((8191&(n=(n=n+Math.imul(f,q)|0)+Math.imul(l,V)|0))<<13)|0;c=((o=o+Math.imul(l,q)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,i=Math.imul(b,z),n=(n=Math.imul(b,F))+Math.imul(y,z)|0,o=Math.imul(y,F),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,q)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,q)|0;var ye=(c+(i=i+Math.imul(f,Z)|0)|0)+((8191&(n=(n=n+Math.imul(f,Y)|0)+Math.imul(l,Z)|0))<<13)|0;c=((o=o+Math.imul(l,Y)|0)+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,i=Math.imul(_,z),n=(n=Math.imul(_,F))+Math.imul(w,z)|0,o=Math.imul(w,F),i=i+Math.imul(b,V)|0,n=(n=n+Math.imul(b,q)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,q)|0,i=i+Math.imul(p,Z)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,Y)|0;var ve=(c+(i=i+Math.imul(f,X)|0)|0)+((8191&(n=(n=n+Math.imul(f,J)|0)+Math.imul(l,X)|0))<<13)|0;c=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,i=Math.imul(k,z),n=(n=Math.imul(k,F))+Math.imul(I,z)|0,o=Math.imul(I,F),i=i+Math.imul(_,V)|0,n=(n=n+Math.imul(_,q)|0)+Math.imul(w,V)|0,o=o+Math.imul(w,q)|0,i=i+Math.imul(b,Z)|0,n=(n=n+Math.imul(b,Y)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,J)|0;var _e=(c+(i=i+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,ee)|0)+Math.imul(l,Q)|0))<<13)|0;c=((o=o+Math.imul(l,ee)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,i=Math.imul(A,z),n=(n=Math.imul(A,F))+Math.imul(O,z)|0,o=Math.imul(O,F),i=i+Math.imul(k,V)|0,n=(n=n+Math.imul(k,q)|0)+Math.imul(I,V)|0,o=o+Math.imul(I,q)|0,i=i+Math.imul(_,Z)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(w,Z)|0,o=o+Math.imul(w,Y)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,J)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,ee)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,ee)|0;var we=(c+(i=i+Math.imul(f,re)|0)|0)+((8191&(n=(n=n+Math.imul(f,ie)|0)+Math.imul(l,re)|0))<<13)|0;c=((o=o+Math.imul(l,ie)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,i=Math.imul(P,z),n=(n=Math.imul(P,F))+Math.imul(M,z)|0,o=Math.imul(M,F),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,q)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,q)|0,i=i+Math.imul(k,Z)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,Y)|0,i=i+Math.imul(_,X)|0,n=(n=n+Math.imul(_,J)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,ee)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,ee)|0,i=i+Math.imul(p,re)|0,n=(n=n+Math.imul(p,ie)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ie)|0;var Se=(c+(i=i+Math.imul(f,oe)|0)|0)+((8191&(n=(n=n+Math.imul(f,ae)|0)+Math.imul(l,oe)|0))<<13)|0;c=((o=o+Math.imul(l,ae)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,i=Math.imul(R,z),n=(n=Math.imul(R,F))+Math.imul(B,z)|0,o=Math.imul(B,F),i=i+Math.imul(P,V)|0,n=(n=n+Math.imul(P,q)|0)+Math.imul(M,V)|0,o=o+Math.imul(M,q)|0,i=i+Math.imul(A,Z)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,Y)|0,i=i+Math.imul(k,X)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,ee)|0,i=i+Math.imul(b,re)|0,n=(n=n+Math.imul(b,ie)|0)+Math.imul(y,re)|0,o=o+Math.imul(y,ie)|0,i=i+Math.imul(p,oe)|0,n=(n=n+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var ke=(c+(i=i+Math.imul(f,ue)|0)|0)+((8191&(n=(n=n+Math.imul(f,ce)|0)+Math.imul(l,ue)|0))<<13)|0;c=((o=o+Math.imul(l,ce)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,i=Math.imul(C,z),n=(n=Math.imul(C,F))+Math.imul(D,z)|0,o=Math.imul(D,F),i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,q)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,q)|0,i=i+Math.imul(P,Z)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,J)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,ee)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,ee)|0,i=i+Math.imul(_,re)|0,n=(n=n+Math.imul(_,ie)|0)+Math.imul(w,re)|0,o=o+Math.imul(w,ie)|0,i=i+Math.imul(b,oe)|0,n=(n=n+Math.imul(b,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0,i=i+Math.imul(p,ue)|0,n=(n=n+Math.imul(p,ce)|0)+Math.imul(m,ue)|0,o=o+Math.imul(m,ce)|0;var Ie=(c+(i=i+Math.imul(f,fe)|0)|0)+((8191&(n=(n=n+Math.imul(f,le)|0)+Math.imul(l,fe)|0))<<13)|0;c=((o=o+Math.imul(l,le)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,i=Math.imul(L,z),n=(n=Math.imul(L,F))+Math.imul(U,z)|0,o=Math.imul(U,F),i=i+Math.imul(C,V)|0,n=(n=n+Math.imul(C,q)|0)+Math.imul(D,V)|0,o=o+Math.imul(D,q)|0,i=i+Math.imul(R,Z)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,Y)|0,i=i+Math.imul(P,X)|0,n=(n=n+Math.imul(P,J)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,J)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,ee)|0,i=i+Math.imul(k,re)|0,n=(n=n+Math.imul(k,ie)|0)+Math.imul(I,re)|0,o=o+Math.imul(I,ie)|0,i=i+Math.imul(_,oe)|0,n=(n=n+Math.imul(_,ae)|0)+Math.imul(w,oe)|0,o=o+Math.imul(w,ae)|0,i=i+Math.imul(b,ue)|0,n=(n=n+Math.imul(b,ce)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,ce)|0,i=i+Math.imul(p,fe)|0,n=(n=n+Math.imul(p,le)|0)+Math.imul(m,fe)|0,o=o+Math.imul(m,le)|0;var Ee=(c+(i=i+Math.imul(f,pe)|0)|0)+((8191&(n=(n=n+Math.imul(f,me)|0)+Math.imul(l,pe)|0))<<13)|0;c=((o=o+Math.imul(l,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,i=Math.imul(L,V),n=(n=Math.imul(L,q))+Math.imul(U,V)|0,o=Math.imul(U,q),i=i+Math.imul(C,Z)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(D,Z)|0,o=o+Math.imul(D,Y)|0,i=i+Math.imul(R,X)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,J)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,ee)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,ee)|0,i=i+Math.imul(A,re)|0,n=(n=n+Math.imul(A,ie)|0)+Math.imul(O,re)|0,o=o+Math.imul(O,ie)|0,i=i+Math.imul(k,oe)|0,n=(n=n+Math.imul(k,ae)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,ae)|0,i=i+Math.imul(_,ue)|0,n=(n=n+Math.imul(_,ce)|0)+Math.imul(w,ue)|0,o=o+Math.imul(w,ce)|0,i=i+Math.imul(b,fe)|0,n=(n=n+Math.imul(b,le)|0)+Math.imul(y,fe)|0,o=o+Math.imul(y,le)|0;var Ae=(c+(i=i+Math.imul(p,pe)|0)|0)+((8191&(n=(n=n+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;c=((o=o+Math.imul(m,me)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,i=Math.imul(L,Z),n=(n=Math.imul(L,Y))+Math.imul(U,Z)|0,o=Math.imul(U,Y),i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,J)|0)+Math.imul(D,X)|0,o=o+Math.imul(D,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,ee)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,ee)|0,i=i+Math.imul(P,re)|0,n=(n=n+Math.imul(P,ie)|0)+Math.imul(M,re)|0,o=o+Math.imul(M,ie)|0,i=i+Math.imul(A,oe)|0,n=(n=n+Math.imul(A,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,i=i+Math.imul(k,ue)|0,n=(n=n+Math.imul(k,ce)|0)+Math.imul(I,ue)|0,o=o+Math.imul(I,ce)|0,i=i+Math.imul(_,fe)|0,n=(n=n+Math.imul(_,le)|0)+Math.imul(w,fe)|0,o=o+Math.imul(w,le)|0;var Oe=(c+(i=i+Math.imul(b,pe)|0)|0)+((8191&(n=(n=n+Math.imul(b,me)|0)+Math.imul(y,pe)|0))<<13)|0;c=((o=o+Math.imul(y,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,i=Math.imul(L,X),n=(n=Math.imul(L,J))+Math.imul(U,X)|0,o=Math.imul(U,J),i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,ee)|0,i=i+Math.imul(R,re)|0,n=(n=n+Math.imul(R,ie)|0)+Math.imul(B,re)|0,o=o+Math.imul(B,ie)|0,i=i+Math.imul(P,oe)|0,n=(n=n+Math.imul(P,ae)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,ae)|0,i=i+Math.imul(A,ue)|0,n=(n=n+Math.imul(A,ce)|0)+Math.imul(O,ue)|0,o=o+Math.imul(O,ce)|0,i=i+Math.imul(k,fe)|0,n=(n=n+Math.imul(k,le)|0)+Math.imul(I,fe)|0,o=o+Math.imul(I,le)|0;var xe=(c+(i=i+Math.imul(_,pe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(w,pe)|0))<<13)|0;c=((o=o+Math.imul(w,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,i=Math.imul(L,Q),n=(n=Math.imul(L,ee))+Math.imul(U,Q)|0,o=Math.imul(U,ee),i=i+Math.imul(C,re)|0,n=(n=n+Math.imul(C,ie)|0)+Math.imul(D,re)|0,o=o+Math.imul(D,ie)|0,i=i+Math.imul(R,oe)|0,n=(n=n+Math.imul(R,ae)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,ae)|0,i=i+Math.imul(P,ue)|0,n=(n=n+Math.imul(P,ce)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,ce)|0,i=i+Math.imul(A,fe)|0,n=(n=n+Math.imul(A,le)|0)+Math.imul(O,fe)|0,o=o+Math.imul(O,le)|0;var Pe=(c+(i=i+Math.imul(k,pe)|0)|0)+((8191&(n=(n=n+Math.imul(k,me)|0)+Math.imul(I,pe)|0))<<13)|0;c=((o=o+Math.imul(I,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,i=Math.imul(L,re),n=(n=Math.imul(L,ie))+Math.imul(U,re)|0,o=Math.imul(U,ie),i=i+Math.imul(C,oe)|0,n=(n=n+Math.imul(C,ae)|0)+Math.imul(D,oe)|0,o=o+Math.imul(D,ae)|0,i=i+Math.imul(R,ue)|0,n=(n=n+Math.imul(R,ce)|0)+Math.imul(B,ue)|0,o=o+Math.imul(B,ce)|0,i=i+Math.imul(P,fe)|0,n=(n=n+Math.imul(P,le)|0)+Math.imul(M,fe)|0,o=o+Math.imul(M,le)|0;var Me=(c+(i=i+Math.imul(A,pe)|0)|0)+((8191&(n=(n=n+Math.imul(A,me)|0)+Math.imul(O,pe)|0))<<13)|0;c=((o=o+Math.imul(O,me)|0)+(n>>>13)|0)+(Me>>>26)|0,Me&=67108863,i=Math.imul(L,oe),n=(n=Math.imul(L,ae))+Math.imul(U,oe)|0,o=Math.imul(U,ae),i=i+Math.imul(C,ue)|0,n=(n=n+Math.imul(C,ce)|0)+Math.imul(D,ue)|0,o=o+Math.imul(D,ce)|0,i=i+Math.imul(R,fe)|0,n=(n=n+Math.imul(R,le)|0)+Math.imul(B,fe)|0,o=o+Math.imul(B,le)|0;var Te=(c+(i=i+Math.imul(P,pe)|0)|0)+((8191&(n=(n=n+Math.imul(P,me)|0)+Math.imul(M,pe)|0))<<13)|0;c=((o=o+Math.imul(M,me)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,i=Math.imul(L,ue),n=(n=Math.imul(L,ce))+Math.imul(U,ue)|0,o=Math.imul(U,ce),i=i+Math.imul(C,fe)|0,n=(n=n+Math.imul(C,le)|0)+Math.imul(D,fe)|0,o=o+Math.imul(D,le)|0;var Re=(c+(i=i+Math.imul(R,pe)|0)|0)+((8191&(n=(n=n+Math.imul(R,me)|0)+Math.imul(B,pe)|0))<<13)|0;c=((o=o+Math.imul(B,me)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,i=Math.imul(L,fe),n=(n=Math.imul(L,le))+Math.imul(U,fe)|0,o=Math.imul(U,le);var Be=(c+(i=i+Math.imul(C,pe)|0)|0)+((8191&(n=(n=n+Math.imul(C,me)|0)+Math.imul(D,pe)|0))<<13)|0;c=((o=o+Math.imul(D,me)|0)+(n>>>13)|0)+(Be>>>26)|0,Be&=67108863;var Ne=(c+(i=Math.imul(L,pe))|0)+((8191&(n=(n=Math.imul(L,me))+Math.imul(U,pe)|0))<<13)|0;return c=((o=Math.imul(U,me))+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,u[0]=ge,u[1]=be,u[2]=ye,u[3]=ve,u[4]=_e,u[5]=we,u[6]=Se,u[7]=ke,u[8]=Ie,u[9]=Ee,u[10]=Ae,u[11]=Oe,u[12]=xe,u[13]=Pe,u[14]=Me,u[15]=Te,u[16]=Re,u[17]=Be,u[18]=Ne,0!==c&&(u[19]=c,r.length++),r};function b(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var a=n;n=0;for(var s=67108863&i,u=Math.min(o,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var h=o-c,f=(0|e.words[h])*(0|t.words[c]),l=67108863&f;s=67108863&(l=l+s|0),n+=(a=(a=a+(f/67108864|0)|0)+(l>>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(e,t,r){return b(e,t,r)}function v(e,t){this.x=e,this.y=t}Math.imul||(g=m),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?g(this,e,t):r<63?m(this,e,t):r<1024?b(this,e,t):y(this,e,t)},v.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,i=0;i<e;i++)t[i]=this.revBin(i,r,e);return t},v.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var i=0,n=0;n<t;n++)i|=(1&e)<<t-n-1,e>>=1;return i},v.prototype.permute=function(e,t,r,i,n,o){for(var a=0;a<o;a++)i[a]=t[e[a]],n[a]=r[e[a]]},v.prototype.transform=function(e,t,r,i,n,o){this.permute(o,e,t,r,i,n);for(var a=1;a<n;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),h=0;h<n;h+=s)for(var f=u,l=c,d=0;d<a;d++){var p=r[h+d],m=i[h+d],g=r[h+d+a],b=i[h+d+a],y=f*g-l*b;b=f*b+l*g,g=y,r[h+d]=p+g,i[h+d]=m+b,r[h+d+a]=p-g,i[h+d+a]=m-b,d!==s&&(y=u*f-c*l,l=u*l+c*f,f=y)}},v.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},v.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=e[i];e[i]=e[r-i-1],e[r-i-1]=n,n=t[i],t[i]=-t[r-i-1],t[r-i-1]=-n}},v.prototype.normalize13b=function(e,t){for(var r=0,i=0;i<t/2;i++){var n=8192*Math.round(e[2*i+1]/t)+Math.round(e[2*i]/t)+r;e[i]=67108863&n,r=n<67108864?0:n/67108864|0}return e},v.prototype.convert13b=function(e,t,r,n){for(var o=0,a=0;a<t;a++)o+=0|e[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*t;a<n;++a)r[a]=0;i(0===o),i(0==(-8192&o))},v.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},v.prototype.mulp=function(e,t,r){var i=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(i),o=this.stub(i),a=new Array(i),s=new Array(i),u=new Array(i),c=new Array(i),h=new Array(i),f=new Array(i),l=r.words;l.length=i,this.convert13b(e.words,e.length,a,i),this.convert13b(t.words,t.length,c,i),this.transform(a,o,s,u,i,n),this.transform(c,o,h,f,i,n);for(var d=0;d<i;d++){var p=s[d]*h[d]-u[d]*f[d];u[d]=s[d]*f[d]+u[d]*h[d],s[d]=p}return this.conjugate(s,u,i),this.transform(s,u,l,o,i,n),this.conjugate(l,o,i),this.normalize13b(l,i),r.negative=e.negative^t.negative,r.length=e.length+t.length,r._strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),y(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){var t=e<0;t&&(e=-e),i("number"==typeof e),i(e<67108864);for(var r=0,n=0;n<this.length;n++){var o=(0|this.words[n])*e,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[n]=67108863&a}return 0!==r&&(this.words[n]=r,this.length++),this.length=0===e?1:this.length,t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var i=r/26|0,n=r%26;t[r]=e.words[i]>>>n&1}return t}(e);if(0===t.length)return new o(1);for(var r=this,i=0;i<t.length&&0===t[i];i++,r=r.sqr());if(++i<t.length)for(var n=r.sqr();i<t.length;i++,n=n.sqr())0!==t[i]&&(r=r.mul(n));return r},o.prototype.iushln=function(e){i("number"==typeof e&&e>=0);var t,r=e%26,n=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<r;this.words[t]=u|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t<n;t++)this.words[t]=0;this.length+=n}return this._strip()},o.prototype.ishln=function(e){return i(0===this.negative),this.iushln(e)},o.prototype.iushrn=function(e,t,r){var n;i("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(n-=a,n=Math.max(0,n),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var h=0;for(c=this.length-1;c>=0&&(0!==h||c>=n);c--){var f=0|this.words[c];this.words[c]=h<<26-o|f>>>o,h=f&s}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,r){return i(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,n=1<<t;return!(this.length<=r)&&!!(this.words[r]&n)},o.prototype.imaskn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(i(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 n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return 0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return i("number"==typeof e),i(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(i("number"==typeof e),i(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,r){var n,o,a=e.length+r;this._expand(a);var s=0;for(n=0;n<e.length;n++){o=(0|this.words[n+r])+s;var u=(0|e.words[n])*t;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[n+r]=67108863&o}for(;n<this.length-r;n++)s=(o=(0|this.words[n+r])+s)>>26,this.words[n+r]=67108863&o;if(0===s)return this._strip();for(i(-1===s),s=0,n=0;n<this.length;n++)s=(o=-(0|this.words[n])+s)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),i=this.clone(),n=e,a=0|n.words[n.length-1];0!==(r=26-this._countBits(a))&&(n=n.ushln(r),i.iushln(r),a=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==t){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var h=i.clone()._ishlnsubmul(n,1,u);0===h.negative&&(i=h,s&&(s.words[u]=1));for(var f=u-1;f>=0;f--){var l=67108864*(0|i.words[n.length+f])+(0|i.words[n.length+f-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(n,l,f);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(n,1,f),i.isZero()||(i.negative^=1);s&&(s.words[f]=l)}return s&&s._strip(),i._strip(),"div"!==t&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},o.prototype.divmod=function(e,t,r){return i(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(n=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:n,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var n,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),i(e<=67108863);for(var r=(1<<26)%e,n=0,o=this.length-1;o>=0;o--)n=(r*n+(0|this.words[o]))%e;return t?-n:n},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),i(e<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*r;this.words[n]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var h=r.clone(),f=t.clone();!t.isZero();){for(var l=0,d=1;0==(t.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(t.iushrn(l);l-- >0;)(n.isOdd()||a.isOdd())&&(n.iadd(h),a.isub(f)),n.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(h),u.isub(f)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(s),a.isub(u)):(r.isub(t),s.isub(n),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},o.prototype._invmp=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n,a=new o(1),s=new o(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,h=1;0==(t.words[0]&h)&&c<26;++c,h<<=1);if(c>0)for(t.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var f=0,l=1;0==(r.words[0]&l)&&f<26;++f,l<<=1);if(f>0)for(r.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(n=0===t.cmpn(1)?a:s).cmpn(0)<0&&n.iadd(e),n},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)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(i)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){i("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var o=n,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),i(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:n<e?-1:1}return 0!==this.negative?0|-t:t},o.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){i<n?t=-1:i>n&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new A(e)},o.prototype.toRed=function(e){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return i(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return i(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var _={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function S(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function k(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function I(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function O(e){A.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var i=t<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},n(S,w),S.prototype.split=function(e,t){for(var r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var n=e.words[9];for(t.words[t.length++]=4194303&n,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,e.words[i-10]=n,0===n&&e.length>10?e.length-=10:e.length-=9},S.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var i=0|e.words[r];t+=977*i,e.words[r]=67108863&t,t=64*i+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(k,w),n(I,w),n(E,w),E.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var i=19*(0|e.words[r])+t,n=67108863&i;i>>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(_[e])return _[e];var t;if("k256"===e)t=new S;else if("p224"===e)t=new k;else if("p192"===e)t=new I;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return _[e]=t,t},A.prototype._verify1=function(e){i(0===e.negative,"red works only with positives"),i(e.red,"red works only with red numbers")},A.prototype._verify2=function(e,t){i(0==(e.negative|t.negative),"red works only with positives"),i(e.red&&e.red===t.red,"red works only with red numbers")},A.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(h(e,e.umod(this.m)._forceRed(this)),e)},A.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},A.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},A.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},A.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},A.prototype.isqr=function(e){return this.imul(e,e.clone())},A.prototype.sqr=function(e){return this.mul(e,e)},A.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(i(t%2==1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),a=0;!n.isZero()&&0===n.andln(1);)a++,n.iushrn(1);i(!n.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,c).cmp(u);)h.redIAdd(u);for(var f=this.pow(h,n),l=this.pow(e,n.addn(1).iushrn(1)),d=this.pow(e,n),p=a;0!==d.cmp(s);){for(var m=d,g=0;0!==m.cmp(s);g++)m=m.redSqr();i(g<p);var b=this.pow(f,new o(1).iushln(p-g-1));l=l.redMul(b),f=b.redSqr(),d=d.redMul(f),p=g}return l},A.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},A.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=e;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],e);var n=r[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),i=t.length-1;i>=0;i--){for(var c=t.words[i],h=u-1;h>=0;h--){var f=c>>h&1;n!==r[0]&&(n=this.sqr(n)),0!==f||0!==a?(a<<=1,a|=f,(4===++s||0===i&&0===h)&&(n=this.mul(n,r[a]),s=0,a=0)):s=0}u=26}return n},A.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},A.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new O(e)},n(O,A),O.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},O.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},O.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).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)},O.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},O.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,this)}).call(this,r(24)(e))},function(e,t,r){var i=r(4),n=r(46).Reporter,o=r(0).Buffer;function a(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 s(e,t){if(Array.isArray(e))this.length=0,this.value=e.map((function(e){return e instanceof s||(e=new s(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}}i(a,n),t.DecoderBuffer=a,a.prototype.save=function(){return{offset:this.offset,reporter:n.prototype.save.call(this)}},a.prototype.restore=function(e){var t=new a(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,n.prototype.restore.call(this,e.reporter),t},a.prototype.isEmpty=function(){return this.offset===this.length},a.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},a.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");var r=new a(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},a.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},t.EncoderBuffer=s,s.prototype.join=function(e,t){return e||(e=new o(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}},function(e,t,r){var i=t;i._reverse=function(e){var t={};return Object.keys(e).forEach((function(r){(0|r)==r&&(r|=0);var i=e[r];t[i]=r})),t},i.der=r(269)},function(e,t,r){var i=r(4),n=r(45),o=n.base,a=n.bignum,s=n.constants.der;function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){o.Node.call(this,"der",e)}function h(e,t){var r=e.readUInt8(t);if(e.isError(r))return r;var i=s.tagClass[r>>6],n=0==(32&r);if(31==(31&r)){var o=r;for(r=0;128==(128&o);){if(o=e.readUInt8(t),e.isError(o))return o;r<<=7,r|=127&o}}else r&=31;return{cls:i,primitive:n,tag:r,tagStr:s.tag[r]}}function f(e,t,r){var i=e.readUInt8(r);if(e.isError(i))return i;if(!t&&128===i)return null;if(0==(128&i))return i;var n=127&i;if(n>4)return e.error("length octect is too long");i=0;for(var o=0;o<n;o++){i<<=8;var a=e.readUInt8(r);if(e.isError(a))return a;i|=a}return i}e.exports=u,u.prototype.decode=function(e,t){return e instanceof o.DecoderBuffer||(e=new o.DecoderBuffer(e,t)),this.tree._decode(e,t)},i(c,o.Node),c.prototype._peekTag=function(e,t,r){if(e.isEmpty())return!1;var i=e.save(),n=h(e,'Failed to peek tag: "'+t+'"');return e.isError(n)?n:(e.restore(i),n.tag===t||n.tagStr===t||n.tagStr+"of"===t||r)},c.prototype._decodeTag=function(e,t,r){var i=h(e,'Failed to decode tag of "'+t+'"');if(e.isError(i))return i;var n=f(e,i.primitive,'Failed to get length of "'+t+'"');if(e.isError(n))return n;if(!r&&i.tag!==t&&i.tagStr!==t&&i.tagStr+"of"!==t)return e.error('Failed to match tag: "'+t+'"');if(i.primitive||null!==n)return e.skip(n,'Failed to match body of: "'+t+'"');var o=e.save(),a=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(a)?a:(n=e.offset-o.offset,e.restore(o),e.skip(n,'Failed to match body of: "'+t+'"'))},c.prototype._skipUntilEnd=function(e,t){for(;;){var r=h(e,t);if(e.isError(r))return r;var i,n=f(e,r.primitive,t);if(e.isError(n))return n;if(i=r.primitive||null!==n?e.skip(n):this._skipUntilEnd(e,t),e.isError(i))return i;if("end"===r.tagStr)break}},c.prototype._decodeList=function(e,t,r,i){for(var n=[];!e.isEmpty();){var o=this._peekTag(e,"end");if(e.isError(o))return o;var a=r.decode(e,"der",i);if(e.isError(a)&&o)break;n.push(a)}return n},c.prototype._decodeStr=function(e,t){if("bitstr"===t){var r=e.readUInt8();return e.isError(r)?r:{unused:r,data:e.raw()}}if("bmpstr"===t){var i=e.raw();if(i.length%2==1)return e.error("Decoding of string type: bmpstr length mismatch");for(var n="",o=0;o<i.length/2;o++)n+=String.fromCharCode(i.readUInt16BE(2*o));return n}if("numstr"===t){var a=e.raw().toString("ascii");return this._isNumstr(a)?a:e.error("Decoding of string type: numstr unsupported characters")}if("octstr"===t)return e.raw();if("objDesc"===t)return e.raw();if("printstr"===t){var s=e.raw().toString("ascii");return this._isPrintstr(s)?s:e.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(t)?e.raw().toString():e.error("Decoding of string type: "+t+" unsupported")},c.prototype._decodeObjid=function(e,t,r){for(var i,n=[],o=0;!e.isEmpty();){var a=e.readUInt8();o<<=7,o|=127&a,0==(128&a)&&(n.push(o),o=0)}128&a&&n.push(o);var s=n[0]/40|0,u=n[0]%40;if(i=r?n:[s,u].concat(n.slice(1)),t){var c=t[i.join(" ")];void 0===c&&(c=t[i.join(".")]),void 0!==c&&(i=c)}return i},c.prototype._decodeTime=function(e,t){var r=e.raw().toString();if("gentime"===t)var i=0|r.slice(0,4),n=0|r.slice(4,6),o=0|r.slice(6,8),a=0|r.slice(8,10),s=0|r.slice(10,12),u=0|r.slice(12,14);else{if("utctime"!==t)return e.error("Decoding "+t+" time is not supported yet");i=0|r.slice(0,2),n=0|r.slice(2,4),o=0|r.slice(4,6),a=0|r.slice(6,8),s=0|r.slice(8,10),u=0|r.slice(10,12);i=i<70?2e3+i:1900+i}return Date.UTC(i,n-1,o,a,s,u,0)},c.prototype._decodeNull=function(e){return null},c.prototype._decodeBool=function(e){var t=e.readUInt8();return e.isError(t)?t:0!==t},c.prototype._decodeInt=function(e,t){var r=e.raw(),i=new a(r);return t&&(i=t[i.toString(10)]||i),i},c.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree}},function(e,t,r){var i=r(4),n=r(0).Buffer,o=r(45),a=o.base,s=o.constants.der;function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){a.Node.call(this,"der",e)}function h(e){return e<10?"0"+e:e}e.exports=u,u.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},i(c,a.Node),c.prototype._encodeComposite=function(e,t,r,i){var o,a=function(e,t,r,i){var n;"seqof"===e?e="seq":"setof"===e&&(e="set");if(s.tagByName.hasOwnProperty(e))n=s.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return i.error("Unknown tag: "+e);n=e}if(n>=31)return i.error("Multi-octet tag encoding unsupported");t||(n|=32);return n|=s.tagClassByName[r||"universal"]<<6}(e,t,r,this.reporter);if(i.length<128)return(o=new n(2))[0]=a,o[1]=i.length,this._createEncoderBuffer([o,i]);for(var u=1,c=i.length;c>=256;c>>=8)u++;(o=new n(2+u))[0]=a,o[1]=128|u;c=1+u;for(var h=i.length;h>0;c--,h>>=8)o[c]=255&h;return this._createEncoderBuffer([o,i])},c.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){for(var r=new n(2*e.length),i=0;i<e.length;i++)r.writeUInt16BE(e.charCodeAt(i),2*i);return this._createEncoderBuffer(r)}return"numstr"===t?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===t?this._isPrintstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(t)||"objDesc"===t?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+t+" unsupported")},c.prototype._encodeObjid=function(e,t,r){if("string"==typeof e){if(!t)return this.reporter.error("string objid given, but no values map found");if(!t.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=t[e].split(/[\s\.]+/g);for(var i=0;i<e.length;i++)e[i]|=0}else if(Array.isArray(e)){e=e.slice();for(i=0;i<e.length;i++)e[i]|=0}if(!Array.isArray(e))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(e));if(!r){if(e[1]>=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}var o=0;for(i=0;i<e.length;i++){var a=e[i];for(o++;a>=128;a>>=7)o++}var s=new n(o),u=s.length-1;for(i=e.length-1;i>=0;i--){a=e[i];for(s[u--]=127&a;(a>>=7)>0;)s[u--]=128|127&a}return this._createEncoderBuffer(s)},c.prototype._encodeTime=function(e,t){var r,i=new Date(e);return"gentime"===t?r=[h(i.getFullYear()),h(i.getUTCMonth()+1),h(i.getUTCDate()),h(i.getUTCHours()),h(i.getUTCMinutes()),h(i.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[h(i.getFullYear()%100),h(i.getUTCMonth()+1),h(i.getUTCDate()),h(i.getUTCHours()),h(i.getUTCMinutes()),h(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},c.prototype._encodeNull=function(){return this._createEncoderBuffer("")},c.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!n.isBuffer(e)){var r=e.toArray();!e.sign&&128&r[0]&&r.unshift(0),e=new n(r)}if(n.isBuffer(e)){var i=e.length;0===e.length&&i++;var o=new n(i);return e.copy(o),0===e.length&&(o[0]=0),this._createEncoderBuffer(o)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);i=1;for(var a=e;a>=256;a>>=8)i++;for(a=(o=new Array(i)).length-1;a>=0;a--)o[a]=255&e,e>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new n(o))},c.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},c.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},c.prototype._skipDefault=function(e,t,r){var i,n=this._baseState;if(null===n.default)return!1;var o=e.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,t,r).join()),o.length!==n.defaultBuffer.length)return!1;for(i=0;i<o.length;i++)if(o[i]!==n.defaultBuffer[i])return!1;return!0}},function(e){e.exports={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}},function(e,t,r){var i=r(37),n=r(1).Buffer;function o(e){var t=n.allocUnsafe(4);return t.writeUInt32BE(e,0),t}e.exports=function(e,t){for(var r,a=n.alloc(0),s=0;a.length<t;)r=o(s++),a=n.concat([a,i("sha1").update(e).update(r).digest()]);return a.slice(0,t)}},function(e,t){e.exports=function(e,t){for(var r=e.length,i=-1;++i<r;)e[i]^=t[i];return e}},function(e,t,r){var i=r(7),n=r(1).Buffer;e.exports=function(e,t){return n.from(e.toRed(i.mont(t.modulus)).redPow(new i(t.publicExponent)).fromRed().toArray())}},function(e,t,r){"use strict";(function(t){var i=r(36),n=r(25),o=r(21),a=r(10),s=r(89),u=r(20),c=r(11),h=r(30),f=r(5),l=r(3),d=r(16),p=r(0),m=r(12),g=function e(r){return this instanceof e?(this.chunks=[],t.isBuffer(r)?e.fromBuffer(r):r instanceof i?e.fromAddress(r):r instanceof e?e.fromBuffer(r.toBuffer()):l.isString(r)?e.fromString(r):void(l.isObject(r)&&l.isArray(r.chunks)&&this.set(r))):new e(r)};g.prototype.set=function(e){return f.checkArgument(l.isObject(e)),f.checkArgument(l.isArray(e.chunks)),this.chunks=e.chunks,this},g.fromBuffer=function(e){var t=new g;t.chunks=[];for(var r=new n(e);!r.finished();)try{var i,o,a=r.readUInt8();a>0&&a<s.OP_PUSHDATA1?(i=a,t.chunks.push({buf:r.read(i),len:i,opcodenum:a})):a===s.OP_PUSHDATA1?(i=r.readUInt8(),o=r.read(i),t.chunks.push({buf:o,len:i,opcodenum:a})):a===s.OP_PUSHDATA2?(i=r.readUInt16LE(),o=r.read(i),t.chunks.push({buf:o,len:i,opcodenum:a})):a===s.OP_PUSHDATA4?(i=r.readUInt32LE(),o=r.read(i),t.chunks.push({buf:o,len:i,opcodenum:a})):t.chunks.push({opcodenum:a})}catch(t){if(t instanceof RangeError)throw new d.Script.InvalidBuffer(e.toString("hex"));throw t}return t},g.prototype.toBuffer=function(){for(var e=new o,t=0;t<this.chunks.length;t++){var r=this.chunks[t],i=r.opcodenum;e.writeUInt8(r.opcodenum),r.buf&&(i<s.OP_PUSHDATA1?e.write(r.buf):i===s.OP_PUSHDATA1?(e.writeUInt8(r.len),e.write(r.buf)):i===s.OP_PUSHDATA2?(e.writeUInt16LE(r.len),e.write(r.buf)):i===s.OP_PUSHDATA4&&(e.writeUInt32LE(r.len),e.write(r.buf)))}return e.concat()},g.fromASM=function(e){var r=new g;r.chunks=[];for(var i=e.split(" "),n=0;n<i.length;){var o=i[n],a=s(o).toNumber();if("0"===o)a=0,r.chunks.push({opcodenum:a}),n+=1;else if("-1"===o)a=s.OP_1NEGATE,r.chunks.push({opcodenum:a}),n+=1;else if(l.isUndefined(a)){var u=t.from(i[n],"hex");if(u.toString("hex")!==i[n])throw new Error("invalid hex string in script");var c=u.length;c>=0&&c<s.OP_PUSHDATA1?a=c:c<Math.pow(2,8)?a=s.OP_PUSHDATA1:c<Math.pow(2,16)?a=s.OP_PUSHDATA2:c<Math.pow(2,32)&&(a=s.OP_PUSHDATA4),r.chunks.push({buf:u,len:u.length,opcodenum:a}),n+=1}else r.chunks.push({opcodenum:a}),n+=1}return r},g.fromHex=function(e){return new g(p.Buffer.from(e,"hex"))},g.fromString=function(e){if(m.isHexa(e)||0===e.length)return new g(p.Buffer.from(e,"hex"));var r=new g;r.chunks=[];for(var i=e.split(" "),n=0;n<i.length;){var o=i[n],a=s(o).toNumber();if(l.isUndefined(a)){if(!((a=parseInt(o))>0&&a<s.OP_PUSHDATA1))throw new Error("Invalid script: "+JSON.stringify(e));r.chunks.push({buf:t.from(i[n+1].slice(2),"hex"),len:a,opcodenum:a}),n+=2}else if(a===s.OP_PUSHDATA1||a===s.OP_PUSHDATA2||a===s.OP_PUSHDATA4){if("0x"!==i[n+2].slice(0,2))throw new Error("Pushdata data must start with 0x");r.chunks.push({buf:t.from(i[n+2].slice(2),"hex"),len:parseInt(i[n+1]),opcodenum:a}),n+=3}else r.chunks.push({opcodenum:a}),n+=1}return r},g.prototype._chunkToString=function(e,t){var r=e.opcodenum,i="asm"===t,n="";if(e.buf)i||r!==s.OP_PUSHDATA1&&r!==s.OP_PUSHDATA2&&r!==s.OP_PUSHDATA4||(n=n+" "+s(r).toString()),e.len>0&&(n=i?n+" "+e.buf.toString("hex"):n+" "+e.len+" 0x"+e.buf.toString("hex"));else if(void 0!==s.reverseMap[r])i?0===r?n+=" 0":79===r?n+=" -1":n=n+" "+s(r).toString():n=n+" "+s(r).toString();else{var o=r.toString(16);o.length%2!=0&&(o="0"+o),n=i?n+" "+o:n+" 0x"+o}return n},g.prototype.toASM=function(){for(var e="",t=0;t<this.chunks.length;t++){var r=this.chunks[t];e+=this._chunkToString(r,"asm")}return e.substr(1)},g.prototype.toString=function(){for(var e="",t=0;t<this.chunks.length;t++){var r=this.chunks[t];e+=this._chunkToString(r)}return e.substr(1)},g.prototype.toHex=function(){return this.toBuffer().toString("hex")},g.prototype.inspect=function(){return"<Script: "+this.toString()+">"},g.prototype.isPublicKeyHashOut=function(){return!(5!==this.chunks.length||this.chunks[0].opcodenum!==s.OP_DUP||this.chunks[1].opcodenum!==s.OP_HASH160||!this.chunks[2].buf||20!==this.chunks[2].buf.length||this.chunks[3].opcodenum!==s.OP_EQUALVERIFY||this.chunks[4].opcodenum!==s.OP_CHECKSIG)},g.prototype.isPublicKeyHashOutPrefix=function(){return!!(this.chunks.length>=5&&this.chunks[0].opcodenum===s.OP_DUP&&this.chunks[1].opcodenum===s.OP_HASH160&&this.chunks[2].buf&&20===this.chunks[2].buf.length&&this.chunks[3].opcodenum===s.OP_EQUALVERIFY&&this.chunks[4].opcodenum===s.OP_CHECKSIG)},g.prototype.isPublicKeyHashIn=function(){if(2===this.chunks.length){var e=this.chunks[0].buf,t=this.chunks[1].buf;if(e&&e.length&&48===e[0]&&t&&t.length){var r=t[0];if((4===r||6===r||7===r)&&65===t.length)return!0;if((3===r||2===r)&&33===t.length)return!0}}return!1},g.prototype.getPublicKey=function(){return f.checkState(this.isPublicKeyOut(),"Can't retrieve PublicKey from a non-PK output"),this.chunks[0].buf},g.prototype.getPublicKeyHash=function(){return f.checkState(this.isPublicKeyHashOut(),"Can't retrieve PublicKeyHash from a non-PKH output"),this.chunks[2].buf},g.prototype.isPublicKeyOut=function(){if(2===this.chunks.length&&this.chunks[0].buf&&this.chunks[0].buf.length&&this.chunks[1].opcodenum===s.OP_CHECKSIG){var e=this.chunks[0].buf,t=e[0],r=!1;if((4!==t&&6!==t&&7!==t||65!==e.length)&&(3!==t&&2!==t||33!==e.length)||(r=!0),r)return u.isValid(e)}return!1},g.prototype.isPublicKeyIn=function(){if(1===this.chunks.length){var e=this.chunks[0].buf;if(e&&e.length&&48===e[0])return!0}return!1},g.prototype.isScriptHashOut=function(){var e=this.toBuffer();return 23===e.length&&e[0]===s.OP_HASH160&&20===e[1]&&e[e.length-1]===s.OP_EQUAL},g.prototype.isScriptHashIn=function(){if(this.chunks.length<=1)return!1;var e,t=this.chunks[this.chunks.length-1].buf;if(!t)return!1;try{e=g.fromBuffer(t)}catch(e){if(e instanceof d.Script.InvalidBuffer)return!1;throw e}return e.classify()!==g.types.UNKNOWN},g.prototype.isMultisigOut=function(){return this.chunks.length>3&&s.isSmallIntOp(this.chunks[0].opcodenum)&&this.chunks.slice(1,this.chunks.length-2).every((function(e){return e.buf&&t.isBuffer(e.buf)}))&&s.isSmallIntOp(this.chunks[this.chunks.length-2].opcodenum)&&this.chunks[this.chunks.length-1].opcodenum===s.OP_CHECKMULTISIG},g.prototype.isMultisigIn=function(){return this.chunks.length>=2&&0===this.chunks[0].opcodenum&&this.chunks.slice(1,this.chunks.length).every((function(e){return e.buf&&t.isBuffer(e.buf)&&c.isTxDER(e.buf)}))},g.prototype.isDataOut=function(){if(!(this.chunks.length>=1&&this.chunks[0].opcodenum===s.OP_RETURN))return!1;var e=this.chunks.slice(1);return new g({chunks:e}).isPushOnly()},g.prototype.isSafeDataOut=function(){if(this.chunks.length<2)return!1;if(this.chunks[0].opcodenum!==s.OP_FALSE)return!1;var e=this.chunks.slice(1);return new g({chunks:e}).isDataOut()},g.prototype.getData=function(){if(this.isSafeDataOut())return this.chunks.slice(2).map(e=>e.buf);if(this.isDataOut()||this.isScriptHashOut())return l.isUndefined(this.chunks[1])?t.alloc(0):t.from(this.chunks[1].buf);if(this.isPublicKeyHashOut())return t.from(this.chunks[2].buf);throw new Error("Unrecognized script type to get data from")},g.prototype.isPushOnly=function(){return l.every(this.chunks,(function(e){return e.opcodenum<=s.OP_16||e.opcodenum===s.OP_PUSHDATA1||e.opcodenum===s.OP_PUSHDATA2||e.opcodenum===s.OP_PUSHDATA4}))},(g.types={}).UNKNOWN="Unknown",g.types.PUBKEY_OUT="Pay to public key",g.types.PUBKEY_IN="Spend from public key",g.types.PUBKEYHASH_OUT="Pay to public key hash",g.types.PUBKEYHASH_IN="Spend from public key hash",g.types.SCRIPTHASH_OUT="Pay to script hash",g.types.SCRIPTHASH_IN="Spend from script hash",g.types.MULTISIG_OUT="Pay to multisig",g.types.MULTISIG_IN="Spend from multisig",g.types.DATA_OUT="Data push",g.types.SAFE_DATA_OUT="Safe data push",g.OP_RETURN_STANDARD_SIZE=220,g.prototype.classify=function(){if(this._isInput)return this.classifyInput();if(this._isOutput)return this.classifyOutput();var e=this.classifyOutput();return e!==g.types.UNKNOWN?e:this.classifyInput()},(g.outputIdentifiers={}).PUBKEY_OUT=g.prototype.isPublicKeyOut,g.outputIdentifiers.PUBKEYHASH_OUT=g.prototype.isPublicKeyHashOut,g.outputIdentifiers.MULTISIG_OUT=g.prototype.isMultisigOut,g.outputIdentifiers.SCRIPTHASH_OUT=g.prototype.isScriptHashOut,g.outputIdentifiers.DATA_OUT=g.prototype.isDataOut,g.outputIdentifiers.SAFE_DATA_OUT=g.prototype.isSafeDataOut,g.prototype.classifyOutput=function(){for(var e in g.outputIdentifiers)if(g.outputIdentifiers[e].bind(this)())return g.types[e];return g.types.UNKNOWN},(g.inputIdentifiers={}).PUBKEY_IN=g.prototype.isPublicKeyIn,g.inputIdentifiers.PUBKEYHASH_IN=g.prototype.isPublicKeyHashIn,g.inputIdentifiers.MULTISIG_IN=g.prototype.isMultisigIn,g.inputIdentifiers.SCRIPTHASH_IN=g.prototype.isScriptHashIn,g.prototype.classifyInput=function(){for(var e in g.inputIdentifiers)if(g.inputIdentifiers[e].bind(this)())return g.types[e];return g.types.UNKNOWN},g.prototype.isStandard=function(){return this.classify()!==g.types.UNKNOWN},g.prototype.prepend=function(e){return this._addByType(e,!0),this},g.prototype.equals=function(e){if(f.checkState(e instanceof g,"Must provide another script"),this.chunks.length!==e.chunks.length)return!1;var r;for(r=0;r<this.chunks.length;r++){if(t.isBuffer(this.chunks[r].buf)&&!t.isBuffer(e.chunks[r].buf))return!1;if(t.isBuffer(this.chunks[r].buf)&&!this.chunks[r].buf.equals(e.chunks[r].buf))return!1;if(this.chunks[r].opcodenum!==e.chunks[r].opcodenum)return!1}return!0},g.prototype.add=function(e){return this._addByType(e,!1),this},g.prototype._addByType=function(e,r){if("string"==typeof e)this._addOpcode(e,r);else if("number"==typeof e)this._addOpcode(e,r);else if(e instanceof s)this._addOpcode(e,r);else if(t.isBuffer(e))this._addBuffer(e,r);else if(e instanceof g)this.chunks=this.chunks.concat(e.chunks);else{if("object"!=typeof e)throw new Error("Invalid script chunk");this._insertAtPosition(e,r)}},g.prototype._insertAtPosition=function(e,t){t?this.chunks.unshift(e):this.chunks.push(e)},g.prototype._addOpcode=function(e,t){var r;return r="number"==typeof e?e:e instanceof s?e.toNumber():s(e).toNumber(),this._insertAtPosition({opcodenum:r},t),this},g.prototype._addBuffer=function(e,t){var r,i=e.length;if(i>=0&&i<s.OP_PUSHDATA1)r=i;else if(i<Math.pow(2,8))r=s.OP_PUSHDATA1;else if(i<Math.pow(2,16))r=s.OP_PUSHDATA2;else{if(!(i<Math.pow(2,32)))throw new Error("You can't push that much data");r=s.OP_PUSHDATA4}return this._insertAtPosition({buf:e,len:i,opcodenum:r},t),this},g.prototype.removeCodeseparators=function(){for(var e=[],t=0;t<this.chunks.length;t++)this.chunks[t].opcodenum!==s.OP_CODESEPARATOR&&e.push(this.chunks[t]);return this.chunks=e,this},g.buildMultisigOut=function(e,t,r){f.checkArgument(t<=e.length,"Number of required signatures must be less than or equal to the number of public keys"),r=r||{};var i=new g;i.add(s.smallInt(t));var n=e=l.map(e,u);r.noSorting||(n=e.map(e=>e.toString("hex")).sort().map(e=>new u(e)));for(var o=0;o<n.length;o++){var a=n[o];i.add(a.toBuffer())}return i.add(s.smallInt(e.length)),i.add(s.OP_CHECKMULTISIG),i},g.buildMultisigIn=function(e,r,i,n){f.checkArgument(l.isArray(e)),f.checkArgument(l.isNumber(r)),f.checkArgument(l.isArray(i)),n=n||{};var o=new g;return o.add(s.OP_0),l.each(i,(function(e){f.checkArgument(t.isBuffer(e),"Signatures must be an array of Buffers"),o.add(e)})),o},g.buildP2SHMultisigIn=function(e,r,i,n){f.checkArgument(l.isArray(e)),f.checkArgument(l.isNumber(r)),f.checkArgument(l.isArray(i)),n=n||{};var o=new g;return o.add(s.OP_0),l.each(i,(function(e){f.checkArgument(t.isBuffer(e),"Signatures must be an array of Buffers"),o.add(e)})),o.add((n.cachedMultisig||g.buildMultisigOut(e,r,n)).toBuffer()),o},g.buildPublicKeyHashOut=function(e){f.checkArgument(!l.isUndefined(e)),f.checkArgument(e instanceof u||e instanceof i||l.isString(e)),e instanceof u?e=e.toAddress():l.isString(e)&&(e=new i(e));var t=new g;return t.add(s.OP_DUP).add(s.OP_HASH160).add(e.hashBuffer).add(s.OP_EQUALVERIFY).add(s.OP_CHECKSIG),t._network=e.network,t},g.buildPublicKeyOut=function(e){f.checkArgument(e instanceof u);var t=new g;return t.add(e.toBuffer()).add(s.OP_CHECKSIG),t},g.buildDataOut=function(e,r){f.checkArgument(l.isUndefined(e)||l.isString(e)||l.isArray(e)||t.isBuffer(e));var i=e;l.isArray(i)||(i=[e]);var n=new g;n.add(s.OP_RETURN);for(let e of i)f.checkArgument(l.isUndefined(e)||l.isString(e)||t.isBuffer(e)),l.isString(e)&&(e=t.from(e,r)),l.isUndefined(e)||n.add(e);return n},g.buildSafeDataOut=function(e,t){var r=g.buildDataOut(e,t),i=new g;return i.add(s.OP_FALSE),i.add(r),i},g.buildScriptHashOut=function(e){f.checkArgument(e instanceof g||e instanceof i&&e.isPayToScriptHash());var t=new g;return t.add(s.OP_HASH160).add(e instanceof i?e.hashBuffer:a.sha256ripemd160(e.toBuffer())).add(s.OP_EQUAL),t._network=e._network||e.network,t},g.buildPublicKeyIn=function(e,r){f.checkArgument(e instanceof c||t.isBuffer(e)),f.checkArgument(l.isUndefined(r)||l.isNumber(r)),e instanceof c&&(e=e.toBuffer());var i=new g;return i.add(t.concat([e,t.from([255&(r||c.SIGHASH_ALL)])])),i},g.buildPublicKeyHashIn=function(e,r,i){return f.checkArgument(r instanceof c||t.isBuffer(r)),f.checkArgument(l.isUndefined(i)||l.isNumber(i)),r instanceof c&&(r=r.toBuffer()),(new g).add(t.concat([r,t.from([255&(i||c.SIGHASH_ALL)])])).add(new u(e).toBuffer())},g.empty=function(){return new g},g.prototype.toScriptHashOut=function(){return g.buildScriptHashOut(this)},g.fromAddress=function(e){if((e=i(e)).isPayToScriptHash())return g.buildScriptHashOut(e);if(e.isPayToPublicKeyHash())return g.buildPublicKeyHashOut(e);throw new d.Script.UnrecognizedAddress(e)},g.prototype.getAddressInfo=function(e){if(this._isInput)return this._getInputAddressInfo();if(this._isOutput)return this._getOutputAddressInfo();var t=this._getOutputAddressInfo();return t||this._getInputAddressInfo()},g.prototype._getOutputAddressInfo=function(){var e={};if(this.isScriptHashOut())e.hashBuffer=this.getData(),e.type=i.PayToScriptHash;else{if(!this.isPublicKeyHashOut())return!1;e.hashBuffer=this.getData(),e.type=i.PayToPublicKeyHash}return e},g.prototype._getInputAddressInfo=function(){var e={};if(this.isPublicKeyHashIn())e.hashBuffer=a.sha256ripemd160(this.chunks[1].buf),e.type=i.PayToPublicKeyHash;else{if(!this.isScriptHashIn())return!1;e.hashBuffer=a.sha256ripemd160(this.chunks[this.chunks.length-1].buf),e.type=i.PayToScriptHash}return e},g.prototype.toAddress=function(e){var t=this.getAddressInfo();return!!t&&(t.network=h.get(e)||this._network||h.defaultNetwork,new i(t))},g.prototype.findAndDelete=function(e){for(var t=e.toBuffer().toString("hex"),r=0;r<this.chunks.length;r++){t===g({chunks:[this.chunks[r]]}).toBuffer().toString("hex")&&this.chunks.splice(r,1)}return this},g.prototype.checkMinimalPush=function(e){var t=this.chunks[e],r=t.buf,i=t.opcodenum;return!r||(0===r.length?i===s.OP_0:1===r.length&&r[0]>=1&&r[0]<=16?i===s.OP_1+(r[0]-1):1===r.length&&129===r[0]?i===s.OP_1NEGATE:r.length<=75?i===r.length:r.length<=255?i===s.OP_PUSHDATA1:!(r.length<=65535)||i===s.OP_PUSHDATA2)},g.prototype._decodeOP_N=function(e){if(e===s.OP_0)return 0;if(e>=s.OP_1&&e<=s.OP_16)return e-(s.OP_1-1);throw new Error("Invalid opcode: "+JSON.stringify(e))},g.prototype.getSignatureOperationsCount=function(e){e=!!l.isUndefined(e)||e;var t=this,r=0,i=s.OP_INVALIDOPCODE;return l.each(t.chunks,(function(n){var o=n.opcodenum;o===s.OP_CHECKSIG||o===s.OP_CHECKSIGVERIFY?r++:o!==s.OP_CHECKMULTISIG&&o!==s.OP_CHECKMULTISIGVERIFY||(e&&i>=s.OP_1&&i<=s.OP_16?r+=t._decodeOP_N(i):r+=20),i=o})),r},e.exports=g}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var i=Object.prototype.toString;e.exports=function(e){var t=i.call(e),r="[object Arguments]"===t;return r||(r="[object Array]"!==t&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===i.call(e.callee)),r}},function(e,t){var r=Object.prototype.toString;function i(e){return"function"==typeof e.constructor?e.constructor.name:null}e.exports=function(e){if(void 0===e)return"undefined";if(null===e)return"null";var t=typeof e;if("boolean"===t)return"boolean";if("string"===t)return"string";if("number"===t)return"number";if("symbol"===t)return"symbol";if("function"===t)return"GeneratorFunction"===i(e)?"generatorfunction":"function";if(function(e){return Array.isArray?Array.isArray(e):e instanceof Array}(e))return"array";if(function(e){if(e.constructor&&"function"==typeof e.constructor.isBuffer)return e.constructor.isBuffer(e);return!1}(e))return"buffer";if(function(e){try{if("number"==typeof e.length&&"function"==typeof e.callee)return!0}catch(e){if(-1!==e.message.indexOf("callee"))return!0}return!1}(e))return"arguments";if(function(e){return e instanceof Date||"function"==typeof e.toDateString&&"function"==typeof e.getDate&&"function"==typeof e.setDate}(e))return"date";if(function(e){return e instanceof Error||"string"==typeof e.message&&e.constructor&&"number"==typeof e.constructor.stackTraceLimit}(e))return"error";if(function(e){return e instanceof RegExp||"string"==typeof e.flags&&"boolean"==typeof e.ignoreCase&&"boolean"==typeof e.multiline&&"boolean"==typeof e.global}(e))return"regexp";switch(i(e)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(function(e){return"function"==typeof e.throw&&"function"==typeof e.return&&"function"==typeof e.next}(e))return"generator";switch(t=r.call(e)){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")}},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(5),o=r(0),a=r(16),s=r(12),u=r(25),c=r(21),h=r(49),f=r(10),l=r(11),d=r(26),p=r(36),m=r(146),g=r(91),b=g.PublicKeyHash,y=g.PublicKey,v=g.MultiSigScriptHash,_=g.MultiSig,w=r(27),S=r(18),k=r(60),I=r(8),E=r(90).SCRIPT_ENABLE_SIGHASH_FORKID;function A(e){if(!(this instanceof A))return new A(e);if(this.inputs=[],this.outputs=[],this._inputAmount=void 0,this._outputAmount=void 0,e){if(e instanceof A)return A.shallowCopy(e);if(s.isHexa(e))this.fromString(e);else if(t.isBuffer(e))this.fromBuffer(e);else{if(!i.isObject(e))throw new a.InvalidArgument("Must provide an object or string to deserialize a transaction");this.fromObject(e)}}else this._newTransaction()}A.DUST_AMOUNT=546,A.FEE_SECURITY_MARGIN=150,A.MAX_MONEY=21e14,A.NLOCKTIME_BLOCKHEIGHT_LIMIT=5e8,A.NLOCKTIME_MAX_VALUE=4294967295,A.FEE_PER_KB=500,A.CHANGE_OUTPUT_MAX_SIZE=62,A.shallowCopy=function(e){return new A(e.toBuffer())};var O={configurable:!1,enumerable:!0,get:function(){return this._hash=new u(this._getHash()).readReverse().toString("hex"),this._hash}};Object.defineProperty(A.prototype,"hash",O),Object.defineProperty(A.prototype,"id",O);var x={configurable:!1,enumerable:!0,get:function(){return this._getInputAmount()}};Object.defineProperty(A.prototype,"inputAmount",x),x.get=function(){return this._getOutputAmount()},Object.defineProperty(A.prototype,"outputAmount",x),A.prototype._getHash=function(){return f.sha256sha256(this.toBuffer())},A.prototype.serialize=function(e){return!0===e||e&&e.disableAll?this.uncheckedSerialize():this.checkedSerialize(e)},A.prototype.uncheckedSerialize=A.prototype.toString=function(){return this.toBuffer().toString("hex")},A.prototype.checkedSerialize=function(e){var t=this.getSerializationError(e);if(t)throw t.message+=" - For more information please see: https://bsv.io/api/lib/transaction#serialization-checks",t;return this.uncheckedSerialize()},A.prototype.invalidSatoshis=function(){for(var e=!1,t=0;t<this.outputs.length;t++)this.outputs[t].invalidSatoshis()&&(e=!0);return e},A.prototype.getSerializationError=function(e){if(e=e||{},this.invalidSatoshis())return new a.Transaction.InvalidSatoshis;var t,r=this._getUnspentValue();return r<0?e.disableMoreOutputThanInput||(t=new a.Transaction.InvalidOutputAmountSum):t=this._hasFeeError(e,r),t||this._hasDustOutputs(e)||this._isMissingSignatures(e)},A.prototype._hasFeeError=function(e,t){if(!i.isUndefined(this._fee)&&this._fee!==t)return new a.Transaction.FeeError.Different("Unspent value is "+t+" but specified fee is "+this._fee);if(!e.disableLargeFees){var r=Math.floor(A.FEE_SECURITY_MARGIN*this._estimateFee());if(t>r)return this._missingChange()?new a.Transaction.ChangeAddressMissing("Fee is too large and no change address was provided"):new a.Transaction.FeeError.TooLarge("expected less than "+r+" but got "+t)}},A.prototype._missingChange=function(){return!this._changeScript},A.prototype._hasDustOutputs=function(e){var t,r;if(!e.disableDustOutputs)for(t in this.outputs)if((r=this.outputs[t]).satoshis<A.DUST_AMOUNT&&!r.script.isDataOut()&&!r.script.isSafeDataOut())return new a.Transaction.DustOutputs},A.prototype._isMissingSignatures=function(e){if(!e.disableIsFullySigned)return this.isFullySigned()?void 0:new a.Transaction.MissingSignatures},A.prototype.inspect=function(){return"<Transaction: "+this.uncheckedSerialize()+">"},A.prototype.toBuffer=function(){var e=new c;return this.toBufferWriter(e).toBuffer()},A.prototype.toBufferWriter=function(e){return e.writeInt32LE(this.version),e.writeVarintNum(this.inputs.length),i.each(this.inputs,(function(t){t.toBufferWriter(e)})),e.writeVarintNum(this.outputs.length),i.each(this.outputs,(function(t){t.toBufferWriter(e)})),e.writeUInt32LE(this.nLockTime),e},A.prototype.fromBuffer=function(e){var t=new u(e);return this.fromBufferReader(t)},A.prototype.fromBufferReader=function(e){var t,r,i;for(n.checkArgument(!e.finished(),"No transaction data received"),this.version=e.readInt32LE(),r=e.readVarintNum(),t=0;t<r;t++){var o=g.fromBufferReader(e);this.inputs.push(o)}for(i=e.readVarintNum(),t=0;t<i;t++)this.outputs.push(w.fromBufferReader(e));return this.nLockTime=e.readUInt32LE(),this},A.prototype.toObject=A.prototype.toJSON=function(){var e=[];this.inputs.forEach((function(t){e.push(t.toObject())}));var t=[];this.outputs.forEach((function(e){t.push(e.toObject())}));var r={hash:this.hash,version:this.version,inputs:e,outputs:t,nLockTime:this.nLockTime};return this._changeScript&&(r.changeScript=this._changeScript.toString()),i.isUndefined(this._changeIndex)||(r.changeIndex=this._changeIndex),i.isUndefined(this._fee)||(r.fee=this._fee),r},A.prototype.fromObject=function(e){n.checkArgument(i.isObject(e)||e instanceof A);var t,r=this;return t=e instanceof A?t.toObject():e,i.each(t.inputs,(function(e){if(e.output&&e.output.script){var t,i=new S(e.output.script);if(i.isPublicKeyHashOut())t=new g.PublicKeyHash(e);else if(i.isScriptHashOut()&&e.publicKeys&&e.threshold)t=new g.MultiSigScriptHash(e,e.publicKeys,e.threshold,e.signatures);else{if(!i.isPublicKeyOut())throw new a.Transaction.Input.UnsupportedScript(e.output.script);t=new g.PublicKey(e)}r.addInput(t)}else r.uncheckedAddInput(new g(e))})),i.each(t.outputs,(function(e){r.addOutput(new w(e))})),t.changeIndex&&(this._changeIndex=t.changeIndex),t.changeScript&&(this._changeScript=new S(t.changeScript)),t.fee&&(this._fee=t.fee),this.nLockTime=t.nLockTime,this.version=t.version,this._checkConsistency(e),this},A.prototype._checkConsistency=function(e){i.isUndefined(this._changeIndex)||(n.checkState(this._changeScript,"Change script is expected."),n.checkState(this.outputs[this._changeIndex],"Change index points to undefined output."),n.checkState(this.outputs[this._changeIndex].script.toString()===this._changeScript.toString(),"Change output has an unexpected script.")),e&&e.hash&&n.checkState(e.hash===this.hash,"Hash in object does not match transaction hash.")},A.prototype.lockUntilDate=function(e){if(n.checkArgument(e),i.isNumber(e)&&e<A.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new a.Transaction.LockTimeTooEarly;i.isDate(e)&&(e=e.getTime()/1e3);for(var t=0;t<this.inputs.length;t++)this.inputs[t].sequenceNumber===g.DEFAULT_SEQNUMBER&&(this.inputs[t].sequenceNumber=g.DEFAULT_LOCKTIME_SEQNUMBER);return this.nLockTime=e,this},A.prototype.lockUntilBlockHeight=function(e){if(n.checkArgument(i.isNumber(e)),e>=A.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new a.Transaction.BlockHeightTooHigh;if(e<0)throw new a.Transaction.NLockTimeOutOfRange;for(var t=0;t<this.inputs.length;t++)this.inputs[t].sequenceNumber===g.DEFAULT_SEQNUMBER&&(this.inputs[t].sequenceNumber=g.DEFAULT_LOCKTIME_SEQNUMBER);return this.nLockTime=e,this},A.prototype.getLockTime=function(){return this.nLockTime?this.nLockTime<A.NLOCKTIME_BLOCKHEIGHT_LIMIT?this.nLockTime:new Date(1e3*this.nLockTime):null},A.prototype.fromString=function(e){this.fromBuffer(o.Buffer.from(e,"hex"))},A.prototype._newTransaction=function(){this.version=1,this.nLockTime=0},A.prototype.from=function(e,t,r){if(i.isArray(e)){var n=this;return i.each(e,(function(e){n.from(e,t,r)})),this}return i.some(this.inputs,(function(t){return t.prevTxId.toString("hex")===e.txId&&t.outputIndex===e.outputIndex}))||(t&&r?this._fromMultisigUtxo(e,t,r):this._fromNonP2SH(e)),this},A.prototype._fromNonP2SH=function(e){var t;t=(e=new m(e)).script.isPublicKeyHashOutPrefix()?b:e.script.isPublicKeyOut()?y:g,this.addInput(new t({output:new w({script:e.script,satoshis:e.satoshis}),prevTxId:e.txId,outputIndex:e.outputIndex,script:S.empty()}))},A.prototype._fromMultisigUtxo=function(e,t,r){var i;if(n.checkArgument(r<=t.length,"Number of required signatures must be greater than the number of public keys"),(e=new m(e)).script.isMultisigOut())i=_;else{if(!e.script.isScriptHashOut())throw new a.Transaction.Input.UnsupportedScript(e.script.toString());i=v}this.addInput(new i({output:new w({script:e.script,satoshis:e.satoshis}),prevTxId:e.txId,outputIndex:e.outputIndex,script:S.empty()},t,r))},A.prototype.addInput=function(e,t,r){if(n.checkArgumentType(e,g,"input"),!e.output&&(i.isUndefined(t)||i.isUndefined(r)))throw new a.Transaction.NeedMoreInfo("Need information about the UTXO script and satoshis");return e.output||!t||i.isUndefined(r)||(t=t instanceof S?t:new S(t),n.checkArgumentType(r,"number","satoshis"),e.output=new w({script:t,satoshis:r})),this.uncheckedAddInput(e)},A.prototype.uncheckedAddInput=function(e){return n.checkArgumentType(e,g,"input"),this.inputs.push(e),this._inputAmount=void 0,this._updateChangeOutput(),this},A.prototype.hasAllUtxoInfo=function(){return i.every(this.inputs.map((function(e){return!!e.output})))},A.prototype.fee=function(e){return n.checkArgument(i.isNumber(e),"amount must be a number"),this._fee=e,this._updateChangeOutput(),this},A.prototype.feePerKb=function(e){return n.checkArgument(i.isNumber(e),"amount must be a number"),this._feePerKb=e,this._updateChangeOutput(),this},A.prototype.change=function(e){return n.checkArgument(e,"address is required"),this._changeScript=S.fromAddress(e),this._updateChangeOutput(),this},A.prototype.getChangeOutput=function(){return i.isUndefined(this._changeIndex)?null:this.outputs[this._changeIndex]},A.prototype.to=function(e,t){if(i.isArray(e)){var r=this;return i.each(e,(function(e){r.to(e.address,e.satoshis)})),this}return n.checkArgument(s.isNaturalNumber(t),"Amount is expected to be a positive integer"),this.addOutput(new w({script:S(new p(e)),satoshis:t})),this},A.prototype.addData=function(e){return this.addOutput(new w({script:S.buildDataOut(e),satoshis:0})),this},A.prototype.addSafeData=function(e){return this.addOutput(new w({script:S.buildSafeDataOut(e),satoshis:0})),this},A.prototype.addOutput=function(e){return n.checkArgumentType(e,w,"output"),this._addOutput(e),this._updateChangeOutput(),this},A.prototype.clearOutputs=function(){return this.outputs=[],this._clearSignatures(),this._outputAmount=void 0,this._changeIndex=void 0,this._updateChangeOutput(),this},A.prototype._addOutput=function(e){this.outputs.push(e),this._outputAmount=void 0},A.prototype._getOutputAmount=function(){if(i.isUndefined(this._outputAmount)){var e=this;this._outputAmount=0,i.each(this.outputs,(function(t){e._outputAmount+=t.satoshis}))}return this._outputAmount},A.prototype._getInputAmount=function(){if(i.isUndefined(this._inputAmount)){var e=this;this._inputAmount=0,i.each(this.inputs,(function(t){if(i.isUndefined(t.output))throw new a.Transaction.Input.MissingPreviousOutput;e._inputAmount+=t.output.satoshis}))}return this._inputAmount},A.prototype._updateChangeOutput=function(){if(this._changeScript){this._clearSignatures(),i.isUndefined(this._changeIndex)||this._removeOutput(this._changeIndex),this._changeIndex=this.outputs.length,this._addOutput(new w({script:this._changeScript,satoshis:0}));var e=this._getUnspentValue()-this.getFee();this._removeOutput(this._changeIndex),this._changeIndex=void 0,e>=A.DUST_AMOUNT&&(this._changeIndex=this.outputs.length,this._addOutput(new w({script:this._changeScript,satoshis:e})))}},A.prototype.getFee=function(){return this.isCoinbase()?0:i.isUndefined(this._fee)?this._changeScript?this._estimateFee():this._getUnspentValue():this._fee},A.prototype._estimateFee=function(){var e=this._estimateSize();return Math.ceil(e/1e3*(this._feePerKb||A.FEE_PER_KB))},A.prototype._getUnspentValue=function(){return this._getInputAmount()-this._getOutputAmount()},A.prototype._clearSignatures=function(){i.each(this.inputs,(function(e){e.clearSignatures!==g.prototype.clearSignatures&&e.clearSignatures()}))},A.prototype._estimateSize=function(){var e=8;return e+=h(this.inputs.length).toBuffer().length,e+=h(this.outputs.length).toBuffer().length,i.each(this.inputs,(function(t){e+=t._estimateSize()})),i.each(this.outputs,(function(t){e+=t.getSize()})),e},A.prototype._removeOutput=function(e){var t=this.outputs[e];this.outputs=i.without(this.outputs,t),this._outputAmount=void 0},A.prototype.removeOutput=function(e){this._removeOutput(e),this._updateChangeOutput()},A.prototype.sort=function(){return this.sortInputs((function(e){var t=Array.prototype.concat.apply([],e);return t.sort((function(e,t){return e.prevTxId.compare(t.prevTxId)||e.outputIndex-t.outputIndex})),t})),this.sortOutputs((function(e){var t=Array.prototype.concat.apply([],e);return t.sort((function(e,t){return e.satoshis-t.satoshis||e.script.toBuffer().compare(t.script.toBuffer())})),t})),this},A.prototype.shuffleOutputs=function(){return this.sortOutputs(i.shuffle)},A.prototype.sortOutputs=function(e){var t=e(this.outputs);return this._newOutputOrder(t)},A.prototype.sortInputs=function(e){return this.inputs=e(this.inputs),this._clearSignatures(),this},A.prototype._newOutputOrder=function(e){if(this.outputs.length!==e.length||0!==i.difference(this.outputs,e).length)throw new a.Transaction.InvalidSorting;if(!i.isUndefined(this._changeIndex)){var t=this.outputs[this._changeIndex];this._changeIndex=e.indexOf(t)}return this.outputs=e,this},A.prototype.removeInput=function(e,t){var r;if((r=!t&&i.isNumber(e)?e:i.findIndex(this.inputs,(function(r){return r.prevTxId.toString("hex")===e&&r.outputIndex===t})))<0||r>=this.inputs.length)throw new a.Transaction.InvalidIndex(r,this.inputs.length);var n=this.inputs[r];this.inputs=i.without(this.inputs,n),this._inputAmount=void 0,this._updateChangeOutput()},A.prototype.sign=function(e,t){n.checkState(this.hasAllUtxoInfo(),"Not all utxo information is available to sign the transaction.");var r=this;return i.isArray(e)?(i.each(e,(function(e){r.sign(e,t)})),this):(i.each(this.getSignatures(e,t),(function(e){r.applySignature(e)})),this)},A.prototype.getSignatures=function(e,t){e=new k(e),t=t||l.SIGHASH_ALL|l.SIGHASH_FORKID;var r=this,n=[],o=f.sha256ripemd160(e.publicKey.toBuffer());return i.each(this.inputs,(function(a,s){i.each(a.getSignatures(r,e,s,t,o),(function(e){n.push(e)}))})),n},A.prototype.applySignature=function(e){return this.inputs[e.inputIndex].addSignature(this,e),this},A.prototype.isFullySigned=function(){return i.each(this.inputs,(function(e){if(e.isFullySigned===g.prototype.isFullySigned)throw new a.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction")})),i.every(i.map(this.inputs,(function(e){return e.isFullySigned()})))},A.prototype.isValidSignature=function(e){if(this.inputs[e.inputIndex].isValidSignature===g.prototype.isValidSignature)throw new a.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction");return this.inputs[e.inputIndex].isValidSignature(this,e)},A.prototype.verifySignature=function(e,t,r,i,n,o){return d.verify(this,e,t,r,i,n,o)},A.prototype.verify=function(){if(0===this.inputs.length)return"transaction txins empty";if(0===this.outputs.length)return"transaction txouts empty";for(var e=new I(0),t=0;t<this.outputs.length;t++){var r=this.outputs[t];if(r.invalidSatoshis())return"transaction txout "+t+" satoshis is invalid";if(r._satoshisBN.gt(new I(A.MAX_MONEY,10)))return"transaction txout "+t+" greater than MAX_MONEY";if((e=e.add(r._satoshisBN)).gt(new I(A.MAX_MONEY)))return"transaction txout "+t+" total output greater than MAX_MONEY"}if(this.toBuffer().length>1e6)return"transaction over the maximum block size";var n={};for(t=0;t<this.inputs.length;t++){var o=this.inputs[t],a=o.prevTxId+":"+o.outputIndex;if(!i.isUndefined(n[a]))return"transaction input "+t+" duplicate input";n[a]=!0}if(this.isCoinbase()){var s=this.inputs[0]._scriptBuffer;if(s.length<2||s.length>100)return"coinbase transaction script size invalid"}else for(t=0;t<this.inputs.length;t++)if(this.inputs[t].isNull())return"transaction input "+t+" has null input";return!0},A.prototype.isCoinbase=function(){return 1===this.inputs.length&&this.inputs[0].isNull()},A.prototype.sighash=function(e,t,r,i,n){t=t||l.SIGHASH_ALL|l.SIGHASH_FORKID;var o=this.inputs[e];if(!o)throw new Error("Input index "+e+" does not exist");return!r&&o.output&&(r=o.output.script),!i&&o.output&&(i=new I(o.output.satoshis)),n=n||E,d.sighash(this,t,e,r,i,n)},e.exports=A}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var i=r(3),n=r(5),o=r(12),a=r(18),s=r(36);function u(e){if(!(this instanceof u))return new u(e);n.checkArgument(i.isObject(e),"Must provide an object from where to extract data");var t=e.address?new s(e.address):void 0,r=e.txid?e.txid:e.txId;if(!r||!o.isHexaString(r)||r.length>64)throw new Error("Invalid TXID in object",e);var c=i.isUndefined(e.vout)?e.outputIndex:e.vout;if(!i.isNumber(c))throw new Error("Invalid outputIndex, received "+c);n.checkArgument(!i.isUndefined(e.scriptPubKey)||!i.isUndefined(e.script),"Must provide the scriptPubKey for that output!");var h=new a(e.scriptPubKey||e.script);n.checkArgument(!i.isUndefined(e.amount)||!i.isUndefined(e.satoshis),"Must provide an amount for the output");var f=i.isUndefined(e.amount)?e.satoshis:Math.round(1e8*e.amount);n.checkArgument(i.isNumber(f),"Amount must be a number"),o.defineImmutable(this,{address:t,txId:r,outputIndex:c,script:h,satoshis:f})}u.prototype.inspect=function(){return"<UnspentOutput: "+this.txId+":"+this.outputIndex+", satoshis: "+this.satoshis+", address: "+this.address+">"},u.prototype.toString=function(){return this.txId+":"+this.outputIndex},u.fromObject=function(e){return new u(e)},u.prototype.toObject=u.prototype.toJSON=function(){return{address:this.address?this.address.toString():void 0,txid:this.txId,vout:this.outputIndex,scriptPubKey:this.script.toBuffer().toString("hex"),amount:Number.parseFloat((this.satoshis/1e8).toFixed(8))}},e.exports=u},function(e,t,r){"use strict";(function(t){var i=r(8),n=r(32),o=(r(10),r(3),new i(2147483647));function a(e){return this instanceof a?(this.options=e||{},this):new a(e)}a.split=function(e,r,i,n){if(n=n||{},!e)throw new Error("Secret is required");if(r<2)throw new Error("Threshold must be at least 2");if(i<r)throw new Error("Number of shares must be at least threshold");if(r>255||i>255)throw new Error("Threshold and shares must be <= 255");for(var o=t.isBuffer(e)?e:t.from(e,"utf8"),s=[],u=0;u<o.length;u++){var c=o[u],h=a._splitByte(c,r,i);s.push(h)}for(var f=[],l=0;l<i;l++){for(var d={id:l+1,threshold:r,shares:i,length:o.length,bytes:[]},p=0;p<s.length;p++)d.bytes.push(s[p][l]);f.push(d)}return f},a.combine=function(e){if(!e||0===e.length)throw new Error("Shares array is required");var r=e[0].threshold,i=e[0].shares,n=e[0].length;if(e.length<r)throw new Error("Insufficient shares: need "+r+", got "+e.length);for(var o=0;o<e.length;o++){if(e[o].threshold!==r||e[o].shares!==i)throw new Error("Shares have inconsistent parameters");if(e[o].length!==n)throw new Error("Shares have different secret lengths")}for(var s=[],u=0;u<n;u++){for(var c=[],h=0;h<Math.min(e.length,r);h++)c.push(e[h].bytes[u]);var f=a._combineByte(c);s.push(f)}return t.from(s)},a._splitByte=function(e,t,r){for(var n=[new i(e)],o=1;o<t;o++){var s=a._randomFieldElement();n.push(s)}for(var u=[],c=1;c<=r;c++){var h=a._evaluatePolynomial(n,new i(c));u.push({x:c,y:h.toString(16)})}return u},a._combineByte=function(e){if(0===e.length)throw new Error("No shares provided");for(var t=new i(0),r=0;r<e.length;r++){for(var n=new i(e[r].x),s=new i(e[r].y,16),u=new i(1),c=new i(1),h=0;h<e.length;h++)if(r!==h){var f=new i(e[h].x),l=new i(0).sub(f);l.lt(new i(0))&&(l=l.add(o)),u=u.mul(l).mod(o);var d=n.sub(f);d.lt(new i(0))&&(d=d.add(o)),c=c.mul(d).mod(o)}var p=a._modInverse(c,o),m=u.mul(p).mod(o);t=t.add(s.mul(m)).mod(o)}return t.mod(o).mod(new i(256)).toNumber()},a._evaluatePolynomial=function(e,t){for(var r=new i(0),n=new i(1),a=0;a<e.length;a++)r=r.add(e[a].mul(n)).mod(o),n=n.mul(t).mod(o);return r},a._randomFieldElement=function(){var e=n.getRandomBuffer(32);return new i(e).mod(o.sub(new i(1))).add(new i(1))},a._modInverse=function(e,t){e.lt(new i(0))&&(e=e.mod(t).add(t));var r=a._extendedGCD(e,t);if(!r.gcd.eq(new i(1)))throw new Error("Modular inverse does not exist");return r.x.mod(t).add(t).mod(t)},a._extendedGCD=function(e,t){if(e.eq(new i(0)))return{gcd:t,x:new i(0),y:new i(1)};var r=a._extendedGCD(t.mod(e),e);return{gcd:r.gcd,x:r.y.sub(t.div(e).mul(r.x)),y:r.x}},a.verifyShare=function(e){try{if(!e||"object"!=typeof e)return!1;if(!(e.id&&e.threshold&&e.shares&&e.bytes&&"number"==typeof e.length))return!1;if(e.threshold<2||e.shares<e.threshold)return!1;if(!Array.isArray(e.bytes)||e.bytes.length!==e.length)return!1;for(var t=0;t<e.bytes.length;t++){var r=e.bytes[t];if(!r.x||!r.y)return!1;if(r.x<1||r.x>e.shares)return!1;try{var n=r.y;if(!/^[0-9a-fA-F]+$/.test(n))return!1;new i(n,16)}catch(e){return!1}}return!0}catch(e){return!1}},a.generateTestVectors=function(){var e="Hello, Bitcoin SV!",t=a.split(e,3,5),r=a.combine(t.slice(0,3));return{secret:e,threshold:3,totalShares:5,shares:t,reconstructed:r.toString("utf8"),valid:r.toString("utf8")===e}},e.exports=a}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(62),o=r(25),a=r(21),s=r(10),u=r(31),c=r(16),h=r(5);function f(e){if(!(this instanceof f))return new f(e);var r={};if(t.isBuffer(e))r=f._fromBufferReader(o(e));else{if(!i.isObject(e))throw new TypeError("Unrecognized argument for MerkleBlock");r={header:e.header instanceof n?e.header:n.fromObject(e.header),numTransactions:e.numTransactions,hashes:e.hashes,flags:e.flags}}return i.extend(this,r),this._flagBitsUsed=0,this._hashesUsed=0,this}f.fromBuffer=function(e){return f.fromBufferReader(o(e))},f.fromBufferReader=function(e){return new f(f._fromBufferReader(e))},f.prototype.toBuffer=function(){return this.toBufferWriter().concat()},f.prototype.toBufferWriter=function(e){e||(e=new a),e.write(this.header.toBuffer()),e.writeUInt32LE(this.numTransactions),e.writeVarintNum(this.hashes.length);for(var r=0;r<this.hashes.length;r++)e.write(t.from(this.hashes[r],"hex"));for(e.writeVarintNum(this.flags.length),r=0;r<this.flags.length;r++)e.writeUInt8(this.flags[r]);return e},f.prototype.toObject=f.prototype.toJSON=function(){return{header:this.header.toObject(),numTransactions:this.numTransactions,hashes:this.hashes,flags:this.flags}},f.prototype.validMerkleTree=function(){if(h.checkState(i.isArray(this.flags),"MerkleBlock flags is not an array"),h.checkState(i.isArray(this.hashes),"MerkleBlock hashes is not an array"),this.hashes.length>this.numTransactions)return!1;if(8*this.flags.length<this.hashes.length)return!1;var e=this._calcTreeHeight(),t={hashesUsed:0,flagBitsUsed:0},r=this._traverseMerkleTree(e,0,t);return t.hashesUsed===this.hashes.length&&r.equals(this.header.merkleRoot)},f.prototype.filterdTxsHash=function(){throw new Error("filterdTxsHash has been deprecated. use filteredTxsHash.")},f.prototype.filteredTxsHash=function(){if(h.checkState(i.isArray(this.flags),"MerkleBlock flags is not an array"),h.checkState(i.isArray(this.hashes),"MerkleBlock hashes is not an array"),this.hashes.length>this.numTransactions)throw new c.MerkleBlock.InvalidMerkleTree;if(8*this.flags.length<this.hashes.length)throw new c.MerkleBlock.InvalidMerkleTree;if(1===this.hashes.length)return[];var e=this._calcTreeHeight(),t={hashesUsed:0,flagBitsUsed:0},r=this._traverseMerkleTree(e,0,t,!0);if(t.hashesUsed!==this.hashes.length)throw new c.MerkleBlock.InvalidMerkleTree;return r},f.prototype._traverseMerkleTree=function(e,r,i,n){if((i=i||{}).txs=i.txs||[],i.flagBitsUsed=i.flagBitsUsed||0,i.hashesUsed=i.hashesUsed||0,n=n||!1,i.flagBitsUsed>8*this.flags.length)return null;var o=this.flags[i.flagBitsUsed>>3]>>>(7&i.flagBitsUsed++)&1;if(0!==e&&o){var a=this._traverseMerkleTree(e-1,2*r,i),u=a;return 2*r+1<this._calcTreeWidth(e-1)&&(u=this._traverseMerkleTree(e-1,2*r+1,i)),n?i.txs:s.sha256sha256(t.concat([a,u]))}if(i.hashesUsed>=this.hashes.length)return null;var c=this.hashes[i.hashesUsed++];return 0===e&&o&&i.txs.push(c),t.from(c,"hex")},f.prototype._calcTreeWidth=function(e){return this.numTransactions+(1<<e)-1>>e},f.prototype._calcTreeHeight=function(){for(var e=0;this._calcTreeWidth(e)>1;)e++;return e},f.prototype.hasTransaction=function(e){h.checkArgument(!i.isUndefined(e),"tx cannot be undefined"),h.checkArgument(e instanceof u||"string"==typeof e,'Invalid tx given, tx must be a "string" or "Transaction"');var r=e;e instanceof u&&(r=t.from(e.id,"hex").reverse().toString("hex"));var n=[],o=this._calcTreeHeight();return this._traverseMerkleTree(o,0,{txs:n}),-1!==n.indexOf(r)},f._fromBufferReader=function(e){h.checkState(!e.finished(),"No merkleblock data received");var t={};t.header=n.fromBufferReader(e),t.numTransactions=e.readUInt32LE();var r=e.readVarintNum();t.hashes=[];for(var i=0;i<r;i++)t.hashes.push(e.read(32).toString("hex"));var o=e.readVarintNum();for(t.flags=[],i=0;i<o;i++)t.flags.push(e.readUInt8());return t},f.fromObject=function(e){return new f(e)},e.exports=f}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(48),n=r(0),o=r(3),a=r(5),s=r(8),u=r(61),c=r(47),h=r(10),f=r(30),l=r(17),d=r(60),p=r(32),m=r(16),g=m.HDPrivateKey,b=r(12);function y(e){if(e instanceof y)return e;if(!(this instanceof y))return new y(e);if(!e)return this._generateRandomly();if(f.get(e))return this._generateRandomly(e);if(o.isString(e)||t.isBuffer(e))if(y.isValidSerialized(e))this._buildFromSerialized(e);else if(b.isValidJSON(e))this._buildFromJSON(e);else{if(!t.isBuffer(e)||!y.isValidSerialized(e.toString()))throw y.getSerializedError(e);this._buildFromSerialized(e.toString())}else{if(!o.isObject(e))throw new g.UnrecognizedArgument(e);this._buildFromObject(e)}}y.fromRandom=function(){return new y},y.isValidPath=function(e,t){if(o.isString(e)){var r=y._getDerivationIndexes(e);return null!==r&&o.every(r,y.isValidPath)}return!!o.isNumber(e)&&(e<y.Hardened&&!0===t&&(e+=y.Hardened),e>=0&&e<y.MaxIndex)},y._getDerivationIndexes=function(e){var t=e.split("/");if(o.includes(y.RootElementAlias,e))return[];if(!o.includes(y.RootElementAlias,t[0]))return null;var r=t.slice(1).map((function(e){var t="'"===e.slice(-1);if(t&&(e=e.slice(0,-1)),!e||"-"===e[0])return NaN;var r=+e;return t&&(r+=y.Hardened),r}));return o.some(r,isNaN)?null:r},y.prototype.derive=function(){throw new Error("derive has been deprecated. use deriveChild or, for the old way, deriveNonCompliantChild.")},y.prototype.deriveChild=function(e,t){if(o.isNumber(e))return this._deriveWithNumber(e,t);if(o.isString(e))return this._deriveFromString(e);throw new g.InvalidDerivationArgument(e)},y.prototype.deriveNonCompliantChild=function(e,t){if(o.isNumber(e))return this._deriveWithNumber(e,t,!0);if(o.isString(e))return this._deriveFromString(e,!0);throw new g.InvalidDerivationArgument(e)},y.prototype._deriveWithNumber=function(e,r,o){if(!y.isValidPath(e,r))throw new g.InvalidPath(e);r=e>=y.Hardened||r,e<y.Hardened&&!0===r&&(e+=y.Hardened);var a,u=b.integerAsBuffer(e);if(r&&o){var c=this.privateKey.bn.toBuffer();a=t.concat([n.Buffer.from([0]),c,u])}else if(r){var f=this.privateKey.bn.toBuffer({size:32});i(32===f.length,"length of private key buffer is expected to be 32 bytes"),a=t.concat([n.Buffer.from([0]),f,u])}else a=t.concat([this.publicKey.toBuffer(),u]);var p=h.sha512hmac(a,this._buffers.chainCode),m=s.fromBuffer(p.slice(0,32),{size:32}),v=p.slice(32,64),_=m.add(this.privateKey.toBigNumber()).umod(l.getN()).toBuffer({size:32});return d.isValid(_)?new y({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:e,chainCode:v,privateKey:_}):this._deriveWithNumber(e+1,null,o)},y.prototype._deriveFromString=function(e,t){if(!y.isValidPath(e))throw new g.InvalidPath(e);return y._getDerivationIndexes(e).reduce((function(e,r){return e._deriveWithNumber(r,null,t)}),this)},y.isValidSerialized=function(e,t){return!y.getSerializedError(e,t)},y.getSerializedError=function(e,r){if(!o.isString(e)&&!t.isBuffer(e))return new g.UnrecognizedArgument("Expected string or buffer");if(!u.validCharacters(e))return new m.InvalidB58Char("(unknown)",e);try{e=c.decode(e)}catch(t){return new m.InvalidB58Checksum(e)}if(e.length!==y.DataLength)return new g.InvalidLength(e);if(!o.isUndefined(r)){var i=y._validateNetwork(e,r);if(i)return i}return null},y._validateNetwork=function(e,t){var r=f.get(t);if(!r)return new m.InvalidNetworkArgument(t);var i=e.slice(0,4);return i.readUInt32BE(0)!==r.xprivkey?new m.InvalidNetwork(i):null},y.fromString=function(e){return a.checkArgument(o.isString(e),"No valid string was provided"),new y(e)},y.fromObject=function(e){return a.checkArgument(o.isObject(e),"No valid argument was provided"),new y(e)},y.prototype._buildFromJSON=function(e){return this._buildFromObject(JSON.parse(e))},y.prototype._buildFromObject=function(e){var r={version:e.network?b.integerAsBuffer(f.get(e.network).xprivkey):e.version,depth:o.isNumber(e.depth)?t.from([255&e.depth]):e.depth,parentFingerPrint:o.isNumber(e.parentFingerPrint)?b.integerAsBuffer(e.parentFingerPrint):e.parentFingerPrint,childIndex:o.isNumber(e.childIndex)?b.integerAsBuffer(e.childIndex):e.childIndex,chainCode:o.isString(e.chainCode)?t.from(e.chainCode,"hex"):e.chainCode,privateKey:o.isString(e.privateKey)&&b.isHexa(e.privateKey)?t.from(e.privateKey,"hex"):e.privateKey,checksum:e.checksum?e.checksum.length?e.checksum:b.integerAsBuffer(e.checksum):void 0};return this._buildFromBuffers(r)},y.prototype._buildFromSerialized=function(e){var t=c.decode(e),r={version:t.slice(y.VersionStart,y.VersionEnd),depth:t.slice(y.DepthStart,y.DepthEnd),parentFingerPrint:t.slice(y.ParentFingerPrintStart,y.ParentFingerPrintEnd),childIndex:t.slice(y.ChildIndexStart,y.ChildIndexEnd),chainCode:t.slice(y.ChainCodeStart,y.ChainCodeEnd),privateKey:t.slice(y.PrivateKeyStart,y.PrivateKeyEnd),checksum:t.slice(y.ChecksumStart,y.ChecksumEnd),xprivkey:e};return this._buildFromBuffers(r)},y.prototype._generateRandomly=function(e){return y.fromSeed(p.getRandomBuffer(64),e)},y.fromSeed=function(e,r){if(b.isHexaString(e)&&(e=t.from(e,"hex")),!t.isBuffer(e))throw new g.InvalidEntropyArgument(e);if(e.length<16)throw new g.InvalidEntropyArgument.NotEnoughEntropy(e);if(e.length>64)throw new g.InvalidEntropyArgument.TooMuchEntropy(e);var i=h.sha512hmac(e,n.Buffer.from("Bitcoin seed"));return new y({network:f.get(r)||f.defaultNetwork,depth:0,parentFingerPrint:0,childIndex:0,privateKey:i.slice(0,32),chainCode:i.slice(32,64)})},y.prototype._calcHDPublicKey=function(){if(!this._hdPublicKey){var e=r(150);this._hdPublicKey=new e(this)}},y.prototype._buildFromBuffers=function(e){y._validateBufferArguments(e),b.defineImmutable(this,{_buffers:e});var r=[e.version,e.depth,e.parentFingerPrint,e.childIndex,e.chainCode,t.alloc(1),e.privateKey],i=n.Buffer.concat(r);if(e.checksum&&e.checksum.length){if(e.checksum.toString()!==c.checksum(i).toString())throw new m.InvalidB58Checksum(i)}else e.checksum=c.checksum(i);var o,a=f.get(e.version.readUInt32BE(0));o=c.encode(n.Buffer.concat(r)),e.xprivkey=t.from(o);var u=new d(s.fromBuffer(e.privateKey),a),l=u.toPublicKey(),p=y.ParentFingerPrintSize,g=h.sha256ripemd160(l.toBuffer()).slice(0,p);return b.defineImmutable(this,{xprivkey:o,network:a,depth:e.depth[0],privateKey:u,publicKey:l,fingerPrint:g}),this._hdPublicKey=null,Object.defineProperty(this,"hdPublicKey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey}}),Object.defineProperty(this,"xpubkey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey.xpubkey}}),this},y._validateBufferArguments=function(e){var r=function(r,n){var o=e[r];i(t.isBuffer(o),r+" argument is not a buffer"),i(o.length===n,r+" has not the expected size: found "+o.length+", expected "+n)};r("version",y.VersionSize),r("depth",y.DepthSize),r("parentFingerPrint",y.ParentFingerPrintSize),r("childIndex",y.ChildIndexSize),r("chainCode",y.ChainCodeSize),r("privateKey",y.PrivateKeySize),e.checksum&&e.checksum.length&&r("checksum",y.CheckSumSize)},y.prototype.toString=function(){return this.xprivkey},y.prototype.inspect=function(){return"<HDPrivateKey: "+this.xprivkey+">"},y.prototype.toObject=y.prototype.toJSON=function(){return{network:f.get(this._buffers.version.readUInt32BE(0),"xprivkey").name,depth:this._buffers.depth[0],fingerPrint:this.fingerPrint.readUInt32BE(0),parentFingerPrint:this._buffers.parentFingerPrint.readUInt32BE(0),childIndex:this._buffers.childIndex.readUInt32BE(0),chainCode:this._buffers.chainCode.toString("hex"),privateKey:this.privateKey.toBuffer().toString("hex"),checksum:this._buffers.checksum.readUInt32BE(0),xprivkey:this.xprivkey}},y.fromBuffer=function(e){return new y(e.toString())},y.fromHex=function(e){return y.fromBuffer(t.from(e,"hex"))},y.prototype.toBuffer=function(){return t.from(this.toString())},y.prototype.toHex=function(){return this.toBuffer().toString("hex")},y.DefaultDepth=0,y.DefaultFingerprint=0,y.DefaultChildIndex=0,y.Hardened=2147483648,y.MaxIndex=2*y.Hardened,y.RootElementAlias=["m","M","m'","M'"],y.VersionSize=4,y.DepthSize=1,y.ParentFingerPrintSize=4,y.ChildIndexSize=4,y.ChainCodeSize=32,y.PrivateKeySize=32,y.CheckSumSize=4,y.DataLength=78,y.SerializedByteSize=82,y.VersionStart=0,y.VersionEnd=y.VersionStart+y.VersionSize,y.DepthStart=y.VersionEnd,y.DepthEnd=y.DepthStart+y.DepthSize,y.ParentFingerPrintStart=y.DepthEnd,y.ParentFingerPrintEnd=y.ParentFingerPrintStart+y.ParentFingerPrintSize,y.ChildIndexStart=y.ParentFingerPrintEnd,y.ChildIndexEnd=y.ChildIndexStart+y.ChildIndexSize,y.ChainCodeStart=y.ChildIndexEnd,y.ChainCodeEnd=y.ChainCodeStart+y.ChainCodeSize,y.PrivateKeyStart=y.ChainCodeEnd+1,y.PrivateKeyEnd=y.PrivateKeyStart+y.PrivateKeySize,y.ChecksumStart=y.PrivateKeyEnd,y.ChecksumEnd=y.ChecksumStart+y.CheckSumSize,i(y.ChecksumEnd===y.SerializedByteSize),e.exports=y}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(3),n=r(5),o=r(8),a=r(61),s=r(47),u=r(10),c=r(149),h=r(30),f=r(17),l=r(20),d=r(16),p=d,m=d.HDPublicKey,g=r(48),b=r(12);function y(e){if(e instanceof y)return e;if(!(this instanceof y))return new y(e);if(e){if(i.isString(e)||t.isBuffer(e)){var r=y.getSerializedError(e);if(r){if(t.isBuffer(e)&&!y.getSerializedError(e.toString()))return this._buildFromSerialized(e.toString());if(r instanceof m.ArgumentIsPrivateExtended)return new c(e).hdPublicKey;throw r}return this._buildFromSerialized(e)}if(i.isObject(e))return e instanceof c?this._buildFromPrivate(e):this._buildFromObject(e);throw new m.UnrecognizedArgument(e)}throw new m.MustSupplyArgument}y.fromHDPrivateKey=function(e){return new y(e)},y.isValidPath=function(e){if(i.isString(e)){var t=c._getDerivationIndexes(e);return null!==t&&i.every(t,y.isValidPath)}return!!i.isNumber(e)&&(e>=0&&e<y.Hardened)},y.prototype.derive=function(){throw new Error("derive has been deprecated. use deriveChild or, for the old way, deriveNonCompliantChild.")},y.prototype.deriveChild=function(e,t){if(i.isNumber(e))return this._deriveWithNumber(e,t);if(i.isString(e))return this._deriveFromString(e);throw new m.InvalidDerivationArgument(e)},y.prototype._deriveWithNumber=function(e,r){if(e>=y.Hardened||r)throw new m.InvalidIndexCantDeriveHardened;if(e<0)throw new m.InvalidPath(e);var i,n=b.integerAsBuffer(e),a=t.concat([this.publicKey.toBuffer(),n]),s=u.sha512hmac(a,this._buffers.chainCode),c=o.fromBuffer(s.slice(0,32),{size:32}),h=s.slice(32,64);try{i=l.fromPoint(f.getG().mul(c).add(this.publicKey.point))}catch(t){return this._deriveWithNumber(e+1)}return new y({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:e,chainCode:h,publicKey:i})},y.prototype._deriveFromString=function(e){if(i.includes(e,"'"))throw new m.InvalidIndexCantDeriveHardened;if(!y.isValidPath(e))throw new m.InvalidPath(e);return c._getDerivationIndexes(e).reduce((function(e,t){return e._deriveWithNumber(t)}),this)},y.isValidSerialized=function(e,t){return i.isNull(y.getSerializedError(e,t))},y.getSerializedError=function(e,r){if(!i.isString(e)&&!t.isBuffer(e))return new m.UnrecognizedArgument("expected buffer or string");if(!a.validCharacters(e))return new p.InvalidB58Char("(unknown)",e);try{e=s.decode(e)}catch(t){return new p.InvalidB58Checksum(e)}if(e.length!==y.DataSize)return new m.InvalidLength(e);if(!i.isUndefined(r)){var n=y._validateNetwork(e,r);if(n)return n}var o=e.readUInt32BE(0);return o===h.livenet.xprivkey||o===h.testnet.xprivkey?new m.ArgumentIsPrivateExtended:null},y._validateNetwork=function(e,t){var r=h.get(t);if(!r)return new p.InvalidNetworkArgument(t);var i=e.slice(y.VersionStart,y.VersionEnd);return i.readUInt32BE(0)!==r.xpubkey?new p.InvalidNetwork(i):null},y.prototype._buildFromPrivate=function(e){var t=i.clone(e._buffers),r=f.getG().mul(o.fromBuffer(t.privateKey));return t.publicKey=f.pointToCompressed(r),t.version=b.integerAsBuffer(h.get(t.version.readUInt32BE(0)).xpubkey),t.privateKey=void 0,t.checksum=void 0,t.xprivkey=void 0,this._buildFromBuffers(t)},y.prototype._buildFromObject=function(e){var r={version:e.network?b.integerAsBuffer(h.get(e.network).xpubkey):e.version,depth:i.isNumber(e.depth)?t.from([255&e.depth]):e.depth,parentFingerPrint:i.isNumber(e.parentFingerPrint)?b.integerAsBuffer(e.parentFingerPrint):e.parentFingerPrint,childIndex:i.isNumber(e.childIndex)?b.integerAsBuffer(e.childIndex):e.childIndex,chainCode:i.isString(e.chainCode)?t.from(e.chainCode,"hex"):e.chainCode,publicKey:i.isString(e.publicKey)?t.from(e.publicKey,"hex"):t.isBuffer(e.publicKey)?e.publicKey:e.publicKey.toBuffer(),checksum:i.isNumber(e.checksum)?b.integerAsBuffer(e.checksum):e.checksum};return this._buildFromBuffers(r)},y.prototype._buildFromSerialized=function(e){var t=s.decode(e),r={version:t.slice(y.VersionStart,y.VersionEnd),depth:t.slice(y.DepthStart,y.DepthEnd),parentFingerPrint:t.slice(y.ParentFingerPrintStart,y.ParentFingerPrintEnd),childIndex:t.slice(y.ChildIndexStart,y.ChildIndexEnd),chainCode:t.slice(y.ChainCodeStart,y.ChainCodeEnd),publicKey:t.slice(y.PublicKeyStart,y.PublicKeyEnd),checksum:t.slice(y.ChecksumStart,y.ChecksumEnd),xpubkey:e};return this._buildFromBuffers(r)},y.prototype._buildFromBuffers=function(e){y._validateBufferArguments(e),b.defineImmutable(this,{_buffers:e});var r=[e.version,e.depth,e.parentFingerPrint,e.childIndex,e.chainCode,e.publicKey],i=t.concat(r),n=s.checksum(i);if(e.checksum&&e.checksum.length){if(e.checksum.toString("hex")!==n.toString("hex"))throw new p.InvalidB58Checksum(i,n)}else e.checksum=n;var o,a=h.get(e.version.readUInt32BE(0));o=s.encode(t.concat(r)),e.xpubkey=t.from(o);var c=new l(e.publicKey,{network:a}),f=y.ParentFingerPrintSize,d=u.sha256ripemd160(c.toBuffer()).slice(0,f);return b.defineImmutable(this,{xpubkey:o,network:a,depth:e.depth[0],publicKey:c,fingerPrint:d}),this},y._validateBufferArguments=function(e){var r=function(r,i){var n=e[r];g(t.isBuffer(n),r+" argument is not a buffer, it's "+typeof n),g(n.length===i,r+" has not the expected size: found "+n.length+", expected "+i)};r("version",y.VersionSize),r("depth",y.DepthSize),r("parentFingerPrint",y.ParentFingerPrintSize),r("childIndex",y.ChildIndexSize),r("chainCode",y.ChainCodeSize),r("publicKey",y.PublicKeySize),e.checksum&&e.checksum.length&&r("checksum",y.CheckSumSize)},y.fromString=function(e){return n.checkArgument(i.isString(e),"No valid string was provided"),new y(e)},y.fromObject=function(e){return n.checkArgument(i.isObject(e),"No valid argument was provided"),new y(e)},y.prototype.toString=function(){return this.xpubkey},y.prototype.inspect=function(){return"<HDPublicKey: "+this.xpubkey+">"},y.prototype.toObject=y.prototype.toJSON=function(){return{network:h.get(this._buffers.version.readUInt32BE(0)).name,depth:this._buffers.depth[0],fingerPrint:this.fingerPrint.readUInt32BE(0),parentFingerPrint:this._buffers.parentFingerPrint.readUInt32BE(0),childIndex:this._buffers.childIndex.readUInt32BE(0),chainCode:this._buffers.chainCode.toString("hex"),publicKey:this.publicKey.toString(),checksum:this._buffers.checksum.readUInt32BE(0),xpubkey:this.xpubkey}},y.fromBuffer=function(e){return new y(e)},y.fromHex=function(e){return y.fromBuffer(t.from(e,"hex"))},y.prototype.toBuffer=function(){return t.from(this._buffers.xpubkey)},y.prototype.toHex=function(){return this.toBuffer().toString("hex")},y.Hardened=2147483648,y.RootElementAlias=["m","M"],y.VersionSize=4,y.DepthSize=1,y.ParentFingerPrintSize=4,y.ChildIndexSize=4,y.ChainCodeSize=32,y.PublicKeySize=33,y.CheckSumSize=4,y.DataSize=78,y.SerializedByteSize=82,y.VersionStart=0,y.VersionEnd=y.VersionStart+y.VersionSize,y.DepthStart=y.VersionEnd,y.DepthEnd=y.DepthStart+y.DepthSize,y.ParentFingerPrintStart=y.DepthEnd,y.ParentFingerPrintEnd=y.ParentFingerPrintStart+y.ParentFingerPrintSize,y.ChildIndexStart=y.ParentFingerPrintEnd,y.ChildIndexEnd=y.ChildIndexStart+y.ChildIndexSize,y.ChainCodeStart=y.ChildIndexEnd,y.ChainCodeEnd=y.ChainCodeStart+y.ChainCodeSize,y.PublicKeyStart=y.ChainCodeEnd,y.PublicKeyEnd=y.PublicKeyStart+y.PublicKeySize,y.ChecksumStart=y.PublicKeyEnd,y.ChecksumEnd=y.ChecksumStart+y.CheckSumSize,g(y.PublicKeyEnd===y.DataSize),g(y.ChecksumEnd===y.SerializedByteSize),e.exports=y}).call(this,r(0).Buffer)},function(e,t,r){
|
|
17
17
|
/*! MIT License. Copyright 2015-2018 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */
|
|
18
18
|
!function(t){"use strict";function r(e){return parseInt(e)===e}function i(e){if(!r(e.length))return!1;for(var t=0;t<e.length;t++)if(!r(e[t])||e[t]<0||e[t]>255)return!1;return!0}function n(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!i(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(r(e.length)&&i(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function o(e){return new Uint8Array(e)}function a(e,t,r,i,n){null==i&&null==n||(e=e.slice?e.slice(i,n):Array.prototype.slice.call(e,i,n)),t.set(e,r)}var s,u={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r<e.length;){var i=e.charCodeAt(r++);37===i?(t.push(parseInt(e.substr(r,2),16)),r+=2):t.push(i)}return n(t)},fromBytes:function(e){for(var t=[],r=0;r<e.length;){var i=e[r];i<128?(t.push(String.fromCharCode(i)),r++):i>191&&i<224?(t.push(String.fromCharCode((31&i)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&i)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},c=(s="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r<e.length;r+=2)t.push(parseInt(e.substr(r,2),16));return t},fromBytes:function(e){for(var t=[],r=0;r<e.length;r++){var i=e[r];t.push(s[(240&i)>>4]+s[15&i])}return t.join("")}}),h={16:10,24:12,32:14},f=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],l=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],d=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],p=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],m=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],g=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],b=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],y=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],v=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],_=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],w=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],S=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],k=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],I=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],E=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function A(e){for(var t=[],r=0;r<e.length;r+=4)t.push(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]);return t}var O=function(e){if(!(this instanceof O))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:n(e,!0)}),this._prepare()};O.prototype._prepare=function(){var e=h[this.key.length];if(null==e)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var t=0;t<=e;t++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);var r,i=4*(e+1),n=this.key.length/4,o=A(this.key);for(t=0;t<n;t++)r=t>>2,this._Ke[r][t%4]=o[t],this._Kd[e-r][t%4]=o[t];for(var a,s=0,u=n;u<i;){if(a=o[n-1],o[0]^=l[a>>16&255]<<24^l[a>>8&255]<<16^l[255&a]<<8^l[a>>24&255]^f[s]<<24,s+=1,8!=n)for(t=1;t<n;t++)o[t]^=o[t-1];else{for(t=1;t<n/2;t++)o[t]^=o[t-1];a=o[n/2-1],o[n/2]^=l[255&a]^l[a>>8&255]<<8^l[a>>16&255]<<16^l[a>>24&255]<<24;for(t=n/2+1;t<n;t++)o[t]^=o[t-1]}for(t=0;t<n&&u<i;)c=u>>2,d=u%4,this._Ke[c][d]=o[t],this._Kd[e-c][d]=o[t++],u++}for(var c=1;c<e;c++)for(var d=0;d<4;d++)a=this._Kd[c][d],this._Kd[c][d]=S[a>>24&255]^k[a>>16&255]^I[a>>8&255]^E[255&a]},O.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],i=A(e),n=0;n<4;n++)i[n]^=this._Ke[0][n];for(var a=1;a<t;a++){for(n=0;n<4;n++)r[n]=p[i[n]>>24&255]^m[i[(n+1)%4]>>16&255]^g[i[(n+2)%4]>>8&255]^b[255&i[(n+3)%4]]^this._Ke[a][n];i=r.slice()}var s,u=o(16);for(n=0;n<4;n++)s=this._Ke[t][n],u[4*n]=255&(l[i[n]>>24&255]^s>>24),u[4*n+1]=255&(l[i[(n+1)%4]>>16&255]^s>>16),u[4*n+2]=255&(l[i[(n+2)%4]>>8&255]^s>>8),u[4*n+3]=255&(l[255&i[(n+3)%4]]^s);return u},O.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],i=A(e),n=0;n<4;n++)i[n]^=this._Kd[0][n];for(var a=1;a<t;a++){for(n=0;n<4;n++)r[n]=y[i[n]>>24&255]^v[i[(n+3)%4]>>16&255]^_[i[(n+2)%4]>>8&255]^w[255&i[(n+1)%4]]^this._Kd[a][n];i=r.slice()}var s,u=o(16);for(n=0;n<4;n++)s=this._Kd[t][n],u[4*n]=255&(d[i[n]>>24&255]^s>>24),u[4*n+1]=255&(d[i[(n+3)%4]>>16&255]^s>>16),u[4*n+2]=255&(d[i[(n+2)%4]>>8&255]^s>>8),u[4*n+3]=255&(d[255&i[(n+1)%4]]^s);return u};var x=function(e){if(!(this instanceof x))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new O(e)};x.prototype.encrypt=function(e){if((e=n(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=o(e.length),r=o(16),i=0;i<e.length;i+=16)a(e,r,0,i,i+16),a(r=this._aes.encrypt(r),t,i);return t},x.prototype.decrypt=function(e){if((e=n(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=o(e.length),r=o(16),i=0;i<e.length;i+=16)a(e,r,0,i,i+16),a(r=this._aes.decrypt(r),t,i);return t};var P=function(e,t){if(!(this instanceof P))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=o(16);this._lastCipherblock=n(t,!0),this._aes=new O(e)};P.prototype.encrypt=function(e){if((e=n(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=o(e.length),r=o(16),i=0;i<e.length;i+=16){a(e,r,0,i,i+16);for(var s=0;s<16;s++)r[s]^=this._lastCipherblock[s];this._lastCipherblock=this._aes.encrypt(r),a(this._lastCipherblock,t,i)}return t},P.prototype.decrypt=function(e){if((e=n(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=o(e.length),r=o(16),i=0;i<e.length;i+=16){a(e,r,0,i,i+16),r=this._aes.decrypt(r);for(var s=0;s<16;s++)t[i+s]=r[s]^this._lastCipherblock[s];a(e,this._lastCipherblock,0,i,i+16)}return t};var M=function(e,t,r){if(!(this instanceof M))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 size)")}else t=o(16);r||(r=1),this.segmentSize=r,this._shiftRegister=n(t,!0),this._aes=new O(e)};M.prototype.encrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var t,r=n(e,!0),i=0;i<r.length;i+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var o=0;o<this.segmentSize;o++)r[i+o]^=t[o];a(this._shiftRegister,this._shiftRegister,0,this.segmentSize),a(r,this._shiftRegister,16-this.segmentSize,i,i+this.segmentSize)}return r},M.prototype.decrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var t,r=n(e,!0),i=0;i<r.length;i+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var o=0;o<this.segmentSize;o++)r[i+o]^=t[o];a(this._shiftRegister,this._shiftRegister,0,this.segmentSize),a(e,this._shiftRegister,16-this.segmentSize,i,i+this.segmentSize)}return r};var T=function(e,t){if(!(this instanceof T))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=o(16);this._lastPrecipher=n(t,!0),this._lastPrecipherIndex=16,this._aes=new O(e)};T.prototype.encrypt=function(e){for(var t=n(e,!0),r=0;r<t.length;r++)16===this._lastPrecipherIndex&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),t[r]^=this._lastPrecipher[this._lastPrecipherIndex++];return t},T.prototype.decrypt=T.prototype.encrypt;var R=function(e){if(!(this instanceof R))throw Error("Counter must be instanitated with `new`");0===e||e||(e=1),"number"==typeof e?(this._counter=o(16),this.setValue(e)):this.setBytes(e)};R.prototype.setValue=function(e){if("number"!=typeof e||parseInt(e)!=e)throw new Error("invalid counter value (must be an integer)");if(e>Number.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},R.prototype.setBytes=function(e){if(16!=(e=n(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},R.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var B=function(e,t){if(!(this instanceof B))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof R||(t=new R(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new O(e)};B.prototype.encrypt=function(e){for(var t=n(e,!0),r=0;r<t.length;r++)16===this._remainingCounterIndex&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),t[r]^=this._remainingCounter[this._remainingCounterIndex++];return t},B.prototype.decrypt=B.prototype.encrypt;var N={AES:O,Counter:R,ModeOfOperation:{ecb:x,cbc:P,cfb:M,ofb:T,ctr:B},utils:{hex:c,utf8:u},padding:{pkcs7:{pad:function(e){var t=16-(e=n(e,!0)).length%16,r=o(e.length+t);a(e,r);for(var i=e.length;i<r.length;i++)r[i]=t;return r},strip:function(e){if((e=n(e,!0)).length<16)throw new Error("PKCS#7 invalid length");var t=e[e.length-1];if(t>16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,i=0;i<t;i++)if(e[r+i]!==t)throw new Error("PKCS#7 invalid padding byte");var s=o(r);return a(e,s,0,0,r),s}}},_arrayTest:{coerceArray:n,createArray:o,copyArray:a}};e.exports=N}()},function(e,t,r){"use strict";(function(t,i){const n=function(){const e=void 0!==t&&t.env&&t.env.BSV_DEBUG||"undefined"!=typeof window&&window.BSV_DEBUG;e&&console.log.apply(console,arguments)};let o,a,s,u;if("undefined"==typeof window)try{o=r(!function(){var e=new Error("Cannot find module 'fs'");throw e.code="MODULE_NOT_FOUND",e}()),a=r(94),s=r(9),u=r(328)}catch(e){n("SmartUTXO: Running in browser mode - some features may be limited")}e.exports=class{constructor(e={}){this.options=e||{},this.loadState()}loadState(){try{return u.loadBlockchainState()}catch(e){return n("⚠️ Could not load blockchain state:",e.message),null}}saveState(){try{const e=u.loadBlockchainState();u.saveBlockchainState(e);const t=Object.keys(e.globalUTXOSet||{}).length;n(`💾 Saved blockchain state with ${t} UTXOs`)}catch(e){n("⚠️ Could not save blockchain state:",e.message)}}getUTXOsForAddress(e){try{const t=u.loadBlockchainState();return t.wallets&&t.wallets[e]&&t.wallets[e].utxos||[]}catch(e){return n("⚠️ Error getting UTXOs:",e.message),[]}}addUTXO(e){try{u.addUTXO(e,e.address)}catch(e){n("⚠️ Error adding UTXO:",e.message)}}spendUTXOs(e,t="manual-spend"){try{for(const r of e)u.spendUTXO(r.txid,r.vout,t)}catch(e){n("⚠️ Error spending UTXOs:",e.message)}}createMockUTXOs(e,t=5,i=1e5){const n=r(2),o=n.Script.buildPublicKeyHashOut(n.Address.fromString(e)).toHex(),a=[];for(let r=0;r<t;r++)a.push({txid:n.crypto.Random.getRandomBuffer(32).toString("hex"),vout:r,address:e,satoshis:i,script:o});return a}getBalance(e){try{const t=u.loadBlockchainState();return t.wallets&&t.wallets[e]&&t.wallets[e].totalValue||0}catch(e){return n("⚠️ Error getting balance:",e.message),0}}getStats(){try{const e=u.getBlockchainStats();return{totalUTXOs:e.metadata.totalUTXOs,totalValue:e.metadata.totalValue,totalWallets:e.metadata.totalWallets,blockHeight:e.metadata.blockHeight,lastUpdated:e.metadata.lastUpdated}}catch(e){return n("⚠️ Error getting stats:",e.message),{totalUTXOs:0,totalValue:0,totalWallets:0,blockHeight:0}}}reset(){try{const e=a.join(i,"../utilities/blockchain-state.json");o.existsSync(e)&&(o.unlinkSync(e),n("🔄 Blockchain state reset"))}catch(e){n("⚠️ Could not reset blockchain state:",e.message)}}}}).call(this,r(6),"/")},function(e,t,r){"use strict";(function(e,t){const{opcodeMap:i,scriptNum:n,utils:o}=r(154);class a{constructor(){this.operations=[],this.comments=[]}comment(e){return this.comments.push("// "+e),this}push(t){if("number"==typeof t)if(t>=-1&&t<=16)-1===t?this.operations.push("OP_1NEGATE"):0===t?this.operations.push("OP_0"):this.operations.push("OP_"+t);else{const e=n.encode(t);this.operations.push(e.toString("hex"))}else if("string"==typeof t)this.operations.push(t);else{if(!e.isBuffer(t))throw new Error("Invalid value type: "+typeof t);this.operations.push(t.toString("hex"))}return this}dup(){return this.operations.push("OP_DUP"),this}drop(){return this.operations.push("OP_DROP"),this}swap(){return this.operations.push("OP_SWAP"),this}over(){return this.operations.push("OP_OVER"),this}rot(){return this.operations.push("OP_ROT"),this}pick(e){return this.push(e),this.operations.push("OP_PICK"),this}roll(e){return this.push(e),this.operations.push("OP_ROLL"),this}depth(){return this.operations.push("OP_DEPTH"),this}add(){return this.operations.push("OP_ADD"),this}sub(){return this.operations.push("OP_SUB"),this}mul(){return this.operations.push("OP_MUL"),this}div(){return this.operations.push("OP_DIV"),this}mod(){return this.operations.push("OP_MOD"),this}negate(){return this.operations.push("OP_NEGATE"),this}abs(){return this.operations.push("OP_ABS"),this}min(){return this.operations.push("OP_MIN"),this}max(){return this.operations.push("OP_MAX"),this}equal(){return this.operations.push("OP_EQUAL"),this}equalVerify(){return this.operations.push("OP_EQUALVERIFY"),this}numEqual(){return this.operations.push("OP_NUMEQUAL"),this}numNotEqual(){return this.operations.push("OP_NUMNOTEQUAL"),this}lessThan(){return this.operations.push("OP_LESSTHAN"),this}greaterThan(){return this.operations.push("OP_GREATERTHAN"),this}lessThanOrEqual(){return this.operations.push("OP_LESSTHANOREQUAL"),this}greaterThanOrEqual(){return this.operations.push("OP_GREATERTHANOREQUAL"),this}within(){return this.operations.push("OP_WITHIN"),this}not(){return this.operations.push("OP_NOT"),this}boolAnd(){return this.operations.push("OP_BOOLAND"),this}boolOr(){return this.operations.push("OP_BOOLOR"),this}and(){return this.operations.push("OP_AND"),this}or(){return this.operations.push("OP_OR"),this}xor(){return this.operations.push("OP_XOR"),this}invert(){return this.operations.push("OP_INVERT"),this}cat(){return this.operations.push("OP_CAT"),this}split(){return this.operations.push("OP_SPLIT"),this}size(){return this.operations.push("OP_SIZE"),this}left(e){return this.push(e),this.operations.push("OP_LEFT"),this}right(e){return this.push(e),this.operations.push("OP_RIGHT"),this}substr(e,t){return this.push(t).push(e),this.operations.push("OP_SUBSTR"),this}sha256(){return this.operations.push("OP_SHA256"),this}hash256(){return this.operations.push("OP_HASH256"),this}hash160(){return this.operations.push("OP_HASH160"),this}ripemd160(){return this.operations.push("OP_RIPEMD160"),this}verify(){return this.operations.push("OP_VERIFY"),this}return(){return this.operations.push("OP_RETURN"),this}extractField(e){this.comment(`Extract ${e} field from preimage`);const t={nVersion:{strategy:"LEFT",offset:0,length:4},hashPrevouts:{strategy:"LEFT",offset:4,length:32},hashSequence:{strategy:"LEFT",offset:36,length:32},outpoint:{strategy:"LEFT",offset:68,length:36},scriptLen:{strategy:"DYNAMIC",position:"after_outpoint"},scriptCode:{strategy:"DYNAMIC",variable_length:!0},value:{strategy:"RIGHT",offsetFromEnd:52,length:8},nSequence:{strategy:"RIGHT",offsetFromEnd:44,length:4},hashOutputs:{strategy:"RIGHT",offsetFromEnd:40,length:32},nLocktime:{strategy:"RIGHT",offsetFromEnd:8,length:4},sighashType:{strategy:"RIGHT",offsetFromEnd:4,length:4}}[e];if(!t)throw new Error("Unknown field: "+e);if("LEFT"===t.strategy)this.push(t.offset+t.length).split().drop().push(t.offset).split().swap().drop();else if("RIGHT"===t.strategy)this.size().push(t.offsetFromEnd).sub().split().drop().push(t.length).split().drop();else if("DYNAMIC"===t.strategy){if("scriptLen"!==e)throw new Error(`Dynamic extraction for ${e} not implemented`);this.push(104).split().drop().push(1).split().swap().drop()}return this}validateField(e,t){return this.comment(`Validate ${e} equals expected value`),this.extractField(e),this.push(t),this.equalVerify(),this}validateRange(e,t,r){return this.comment(`Validate ${e} is within range [${t}, ${r})`),this.extractField(e),this.dup(),this.push(t),this.greaterThanOrEqual(),this.verify(),this.push(r),this.lessThan(),this.verify(),this}validateFields(e){return this.comment("Multi-field validation"),Object.entries(e).forEach(([e,t])=>{t.equals?this.validateField(e,t.equals):void 0===t.min&&void 0===t.max||this.validateRange(e,t.min||0,t.max||Number.MAX_SAFE_INTEGER)}),this}if(e){return this.comment("Begin IF block"),"function"==typeof e&&e(this),this.operations.push("OP_IF"),this}else(){return this.comment("ELSE block"),this.operations.push("OP_ELSE"),this}endif(){return this.comment("End IF block"),this.operations.push("OP_ENDIF"),this}build(){const e=this.operations.join(" "),t=this._cleanASM(e);return{operations:[...this.operations],comments:[...this.comments],asm:e,cleanedASM:t,hex:this._asmToHex(t),size:t.split(" ").length}}_cleanASM(e){return e.split(" ").map(e=>{if(/^\d+$/.test(e)){const t=parseInt(e);return t>=1&&t<=75?t.toString(16).padStart(2,"0"):n.encode(t).toString("hex")}return e}).join(" ")}_asmToHex(e){return e.split(" ").map(e=>i[e]?i[e].code.toString(16).padStart(2,"0"):/^[0-9a-fA-F]+$/.test(e)?e:"00").join("")}simulate(e=[]){return o.simulate(this.operations,e)}document(){const e=this.build();return{title:"Covenant Script Documentation",operations:e.operations.length,size:e.size,asm:e.cleanedASM,comments:this.comments,structure:this._analyzeStructure()}}_analyzeStructure(){const e={stack_operations:0,arithmetic:0,comparisons:0,crypto:0,data_manipulation:0,flow_control:0};return this.operations.forEach(t=>{const r=i[t];if(r)switch(r.category){case"stack":e.stack_operations++;break;case"arithmetic":e.arithmetic++;break;case"bitwise":e.comparisons++;break;case"crypto":e.crypto++;break;case"data":e.data_manipulation++;break;case"flow_control":e.flow_control++}}),e}}const s={valueLock:e=>(new a).comment("Value Lock Covenant").comment("Expected value: "+e).validateField("value",e).push(1),hashLock:e=>(new a).comment("Hash Lock Covenant").comment("Expected hash: "+e).sha256().push(e).equalVerify().push(1),multiSigWithValidation:(e,t,r)=>{const i=(new a).comment("Multi-Signature Covenant with Field Validation").comment("Required signatures: "+e);return i.validateFields(r),i.comment("Signature validation (placeholder)").push(1),i},timeLock:e=>(new a).comment("Time Lock Covenant").comment("Locktime: "+e).validateField("nLocktime",e).push(1),complexValidation:e=>{const t=(new a).comment("Complex Validation Covenant");return e.valueRange&&t.validateRange("value",e.valueRange.min,e.valueRange.max),e.fields&&t.validateFields(e.fields),e.hashValidation&&t.sha256().push(e.hashValidation.expectedHash).equalVerify(),t.push(1),t}};if(t.exports={CovenantBuilder:a,CovenantTemplates:s},r.c[r.s]===t){console.log("🏗️ Covenant Builder Demonstration"),console.log("=================================="),console.log("\n📊 Example 1: Value Lock Covenant");const e=s.valueLock("50c3000000000000").build();console.log("ASM:",e.cleanedASM),console.log("Size:",e.size,"operations"),console.log("\n📊 Example 2: Custom Arithmetic Covenant");const t=(new a).comment("Validate that value field equals 5 + 3").extractField("value").push(5).push(3).add().numEqual().verify().push(1),r=t.build();console.log("Operations:",r.operations.length),console.log("ASM:",r.cleanedASM),console.log("\n📊 Example 3: Documentation Generation");const i=t.document();console.log("Structure analysis:",i.structure),console.log("Comments:"),i.comments.forEach(e=>console.log(" "+e))}}).call(this,r(0).Buffer,r(24)(e))},function(e,t,r){(function(e,t){const i={encode:t=>{if(0===t)return e.alloc(0);const r=t<0,i=[];let n=Math.abs(t);for(;n>0;)i.push(255&n),n>>=8;return 128&i[i.length-1]?i.push(r?128:0):r&&(i[i.length-1]|=128),e.from(i)},decode:e=>{if(0===e.length)return 0;const t=Array.from(e),r=128&t[t.length-1];r&&(t[t.length-1]&=127);let i=0;for(let e=t.length-1;e>=0;e--)i=(i<<8)+t[e];return r?-i:i}},n={OP_FALSE:{code:0,category:"constants",description:"Push empty array (false value)",action:t=>t.push(e.alloc(0))},OP_0:{code:0,category:"constants",description:"Push empty array (alias for OP_FALSE)",action:t=>t.push(e.alloc(0))},OP_PUSHDATA1:{code:76,category:"pushdata",description:"Push next [1 byte] bytes of data",action:"Read next byte as length; push that many bytes"},OP_PUSHDATA2:{code:77,category:"pushdata",description:"Push next [2 bytes LE] bytes of data",action:"Read next 2 bytes as length; push that many bytes"},OP_PUSHDATA4:{code:78,category:"pushdata",description:"Push next [4 bytes LE] bytes of data",action:"Read next 4 bytes as length; push that many bytes"},OP_1NEGATE:{code:79,category:"constants",description:"Push number -1",action:e=>e.push(i.encode(-1))},OP_RESERVED:{code:80,category:"reserved",description:"Reserved opcode (makes transaction invalid)",action:()=>{throw new Error("OP_RESERVED encountered")}},OP_TRUE:{code:81,category:"constants",description:"Push number 1 (true value)",action:e=>e.push(i.encode(1))},OP_1:{code:81,category:"constants",description:"Push number 1 (alias for OP_TRUE)",action:e=>e.push(i.encode(1))},OP_2:{code:82,category:"constants",description:"Push number 2",action:e=>e.push(i.encode(2))},OP_3:{code:83,category:"constants",description:"Push number 3",action:e=>e.push(i.encode(3))},OP_4:{code:84,category:"constants",description:"Push number 4",action:e=>e.push(i.encode(4))},OP_5:{code:85,category:"constants",description:"Push number 5",action:e=>e.push(i.encode(5))},OP_6:{code:86,category:"constants",description:"Push number 6",action:e=>e.push(i.encode(6))},OP_7:{code:87,category:"constants",description:"Push number 7",action:e=>e.push(i.encode(7))},OP_8:{code:88,category:"constants",description:"Push number 8",action:e=>e.push(i.encode(8))},OP_9:{code:89,category:"constants",description:"Push number 9",action:e=>e.push(i.encode(9))},OP_10:{code:90,category:"constants",description:"Push number 10",action:e=>e.push(i.encode(10))},OP_11:{code:91,category:"constants",description:"Push number 11",action:e=>e.push(i.encode(11))},OP_12:{code:92,category:"constants",description:"Push number 12",action:e=>e.push(i.encode(12))},OP_13:{code:93,category:"constants",description:"Push number 13",action:e=>e.push(i.encode(13))},OP_14:{code:94,category:"constants",description:"Push number 14",action:e=>e.push(i.encode(14))},OP_15:{code:95,category:"constants",description:"Push number 15",action:e=>e.push(i.encode(15))},OP_16:{code:96,category:"constants",description:"Push number 16",action:e=>e.push(i.encode(16))},OP_NOP:{code:97,category:"flow_control",description:"No operation (do nothing)",action:e=>{}},OP_VER:{code:98,category:"flow_control",description:"Push transaction version (disabled)",action:()=>{throw new Error("OP_VER is disabled")}},OP_IF:{code:99,category:"flow_control",description:"Execute if top stack value is true",action:"// Conditional execution (requires parser state)"},OP_NOTIF:{code:100,category:"flow_control",description:"Execute if top stack value is false",action:"// Conditional execution (requires parser state)"},OP_VERIF:{code:101,category:"flow_control",description:"Conditional execution based on transaction version (disabled)",action:()=>{throw new Error("OP_VERIF is disabled")}},OP_VERNOTIF:{code:102,category:"flow_control",description:"Conditional execution based on transaction version (disabled)",action:()=>{throw new Error("OP_VERNOTIF is disabled")}},OP_ELSE:{code:103,category:"flow_control",description:"Else branch of conditional",action:"// Conditional execution (requires parser state)"},OP_ENDIF:{code:104,category:"flow_control",description:"End conditional block",action:"// Conditional execution (requires parser state)"},OP_VERIFY:{code:105,category:"flow_control",description:"Fail if top stack value is not true",action:e=>{const t=e.pop();if(!t||0===t.length||0===i.decode(t))throw new Error("OP_VERIFY failed")}},OP_RETURN:{code:106,category:"flow_control",description:"Terminate script execution immediately",action:()=>{throw new Error("Script terminated by OP_RETURN")}},OP_TOALTSTACK:{code:107,category:"stack",description:"Move top item from main stack to alt stack",action:(e,t)=>t.push(e.pop())},OP_FROMALTSTACK:{code:108,category:"stack",description:"Move top item from alt stack to main stack",action:(e,t)=>e.push(t.pop())},OP_2DROP:{code:109,category:"stack",description:"Remove top two stack items",action:e=>{e.pop(),e.pop()}},OP_2DUP:{code:110,category:"stack",description:"Duplicate top two stack items",action:t=>{const r=t[t.length-1],i=t[t.length-2];t.push(e.from(i),e.from(r))}},OP_3DUP:{code:111,category:"stack",description:"Duplicate top three stack items",action:t=>{const r=t[t.length-1],i=t[t.length-2],n=t[t.length-3];t.push(e.from(n),e.from(i),e.from(r))}},OP_2OVER:{code:112,category:"stack",description:"Copy 3rd and 4th items to top",action:t=>{const r=t[t.length-3],i=t[t.length-4];t.push(e.from(i),e.from(r))}},OP_2ROT:{code:113,category:"stack",description:"Move 5th and 6th items to top",action:e=>{const t=e.splice(-5,1)[0],r=e.splice(-5,1)[0];e.push(t,r)}},OP_2SWAP:{code:114,category:"stack",description:"Swap top two pairs of items",action:e=>{const t=e.pop(),r=e.pop(),i=e.pop(),n=e.pop();e.push(r,t,n,i)}},OP_IFDUP:{code:115,category:"stack",description:"Duplicate top item if it is not zero",action:t=>{const r=t[t.length-1];r.length>0&&0!==i.decode(r)&&t.push(e.from(r))}},OP_DEPTH:{code:116,category:"stack",description:"Push stack size as number",action:e=>e.push(i.encode(e.length))},OP_DROP:{code:117,category:"stack",description:"Remove top stack item",action:e=>e.pop()},OP_DUP:{code:118,category:"stack",description:"Duplicate top stack item",action:t=>t.push(e.from(t[t.length-1]))},OP_NIP:{code:119,category:"stack",description:"Remove second-to-top item",action:e=>{const t=e.pop();e.pop(),e.push(t)}},OP_OVER:{code:120,category:"stack",description:"Copy second-to-top item to top",action:t=>t.push(e.from(t[t.length-2]))},OP_PICK:{code:121,category:"stack",description:"Copy nth item to top (0-indexed from top)",action:t=>{const r=i.decode(t.pop());t.push(e.from(t[t.length-1-r]))}},OP_ROLL:{code:122,category:"stack",description:"Move nth item to top (0-indexed from top)",action:e=>{const t=i.decode(e.pop()),r=e.splice(e.length-1-t,1)[0];e.push(r)}},OP_ROT:{code:123,category:"stack",description:"Rotate top three items left",action:e=>{const t=e.pop(),r=e.pop(),i=e.pop();e.push(r,t,i)}},OP_SWAP:{code:124,category:"stack",description:"Swap top two items",action:e=>{const t=e.pop(),r=e.pop();e.push(t,r)}},OP_TUCK:{code:125,category:"stack",description:"Copy top item below second item",action:e=>{const t=e.pop(),r=e.pop();e.push(t,r,t)}},OP_CAT:{code:126,category:"data",description:"Concatenate top two items",action:t=>{const r=t.pop(),i=t.pop();t.push(e.concat([i,r]))}},OP_SPLIT:{code:127,category:"data",description:"Split item at position n",action:e=>{const t=i.decode(e.pop()),r=e.pop();e.push(r.slice(0,t),r.slice(t))}},OP_NUM2BIN:{code:128,category:"data",description:"Convert number to byte sequence of length n",action:t=>{const r=i.decode(t.pop()),n=i.decode(t.pop()),o=e.alloc(r),a=i.encode(n);a.copy(o,0,0,Math.min(a.length,r)),t.push(o)}},OP_BIN2NUM:{code:129,category:"data",description:"Convert byte sequence to number",action:e=>{const t=e.pop();e.push(i.encode(i.decode(t)))}},OP_SIZE:{code:130,category:"data",description:"Push size of top item (without removing item)",action:e=>e.push(i.encode(e[e.length-1].length))},OP_INVERT:{code:131,category:"bitwise",description:"Bitwise NOT of top item",action:t=>{const r=t.pop();t.push(e.from(r.map(e=>~e)))}},OP_AND:{code:132,category:"bitwise",description:"Bitwise AND of top two items",action:t=>{const r=t.pop(),i=t.pop(),n=Math.max(r.length,i.length),o=e.alloc(n);for(let e=0;e<n;e++)o[e]=(r[e]||0)&(i[e]||0);t.push(o)}},OP_OR:{code:133,category:"bitwise",description:"Bitwise OR of top two items",action:t=>{const r=t.pop(),i=t.pop(),n=Math.max(r.length,i.length),o=e.alloc(n);for(let e=0;e<n;e++)o[e]=(r[e]||0)|(i[e]||0);t.push(o)}},OP_XOR:{code:134,category:"bitwise",description:"Bitwise XOR of top two items",action:t=>{const r=t.pop(),i=t.pop(),n=Math.max(r.length,i.length),o=e.alloc(n);for(let e=0;e<n;e++)o[e]=(r[e]||0)^(i[e]||0);t.push(o)}},OP_EQUAL:{code:135,category:"bitwise",description:"Push 1 if top two items are equal, 0 otherwise",action:e=>{const t=e.pop(),r=e.pop();e.push(t.equals(r)?i.encode(1):i.encode(0))}},OP_EQUALVERIFY:{code:136,category:"bitwise",description:"Fail if top two items are not equal",action:e=>{const t=e.pop(),r=e.pop();if(!t.equals(r))throw new Error("OP_EQUALVERIFY failed")}},OP_1ADD:{code:139,category:"arithmetic",description:"Add 1 to top item",action:e=>{const t=i.decode(e.pop());e.push(i.encode(t+1))}},OP_1SUB:{code:140,category:"arithmetic",description:"Subtract 1 from top item",action:e=>{const t=i.decode(e.pop());e.push(i.encode(t-1))}},OP_2MUL:{code:141,category:"arithmetic",description:"Multiply top item by 2 (disabled)",action:()=>{throw new Error("OP_2MUL is disabled")}},OP_2DIV:{code:142,category:"arithmetic",description:"Divide top item by 2 (disabled)",action:()=>{throw new Error("OP_2DIV is disabled")}},OP_NEGATE:{code:143,category:"arithmetic",description:"Negate top item",action:e=>{const t=i.decode(e.pop());e.push(i.encode(-t))}},OP_ABS:{code:144,category:"arithmetic",description:"Absolute value of top item",action:e=>{const t=i.decode(e.pop());e.push(i.encode(Math.abs(t)))}},OP_NOT:{code:145,category:"arithmetic",description:"Logical NOT (0→1, non-zero→0)",action:e=>{const t=i.decode(e.pop());e.push(i.encode(0===t?1:0))}},OP_0NOTEQUAL:{code:146,category:"arithmetic",description:"Push 1 if top item is not zero, 0 otherwise",action:e=>{const t=i.decode(e.pop());e.push(i.encode(0!==t?1:0))}},OP_ADD:{code:147,category:"arithmetic",description:"Add top two items",action:e=>{const t=i.decode(e.pop()),r=i.decode(e.pop());e.push(i.encode(r+t))}},OP_SUB:{code:148,category:"arithmetic",description:"Subtract: second - first",action:e=>{const t=i.decode(e.pop()),r=i.decode(e.pop());e.push(i.encode(r-t))}},OP_MUL:{code:149,category:"arithmetic",description:"Multiply top two items",action:e=>{const t=i.decode(e.pop()),r=i.decode(e.pop());e.push(i.encode(r*t))}},OP_DIV:{code:150,category:"arithmetic",description:"Divide: second / first",action:e=>{const t=i.decode(e.pop()),r=i.decode(e.pop());if(0===t)throw new Error("Division by zero");e.push(i.encode(Math.floor(r/t)))}},OP_MOD:{code:151,category:"arithmetic",description:"Modulo: second % first",action:e=>{const t=i.decode(e.pop()),r=i.decode(e.pop());if(0===t)throw new Error("Division by zero");e.push(i.encode(r%t))}},OP_LSHIFT:{code:152,category:"arithmetic",description:"Left shift: second << first",action:e=>{const t=i.decode(e.pop()),r=i.decode(e.pop());e.push(i.encode(r<<t))}},OP_RSHIFT:{code:153,category:"arithmetic",description:"Right shift: second >> first",action:e=>{const t=i.decode(e.pop()),r=i.decode(e.pop());e.push(i.encode(r>>t))}},OP_BOOLAND:{code:154,category:"arithmetic",description:"Boolean AND: 1 if both non-zero, 0 otherwise",action:e=>{const t=i.decode(e.pop()),r=i.decode(e.pop());e.push(i.encode(0!==t&&0!==r?1:0))}},OP_BOOLOR:{code:155,category:"arithmetic",description:"Boolean OR: 1 if either non-zero, 0 otherwise",action:e=>{const t=i.decode(e.pop()),r=i.decode(e.pop());e.push(i.encode(0!==t||0!==r?1:0))}},OP_NUMEQUAL:{code:156,category:"arithmetic",description:"Push 1 if numbers are equal, 0 otherwise",action:e=>{const t=i.decode(e.pop()),r=i.decode(e.pop());e.push(i.encode(t===r?1:0))}},OP_NUMEQUALVERIFY:{code:157,category:"arithmetic",description:"Fail if numbers are not equal",action:e=>{if(i.decode(e.pop())!==i.decode(e.pop()))throw new Error("OP_NUMEQUALVERIFY failed")}},OP_NUMNOTEQUAL:{code:158,category:"arithmetic",description:"Push 1 if numbers are not equal, 0 otherwise",action:e=>{const t=i.decode(e.pop()),r=i.decode(e.pop());e.push(i.encode(t!==r?1:0))}},OP_LESSTHAN:{code:159,category:"arithmetic",description:"Push 1 if second < first, 0 otherwise",action:e=>{const t=i.decode(e.pop()),r=i.decode(e.pop());e.push(i.encode(r<t?1:0))}},OP_GREATERTHAN:{code:160,category:"arithmetic",description:"Push 1 if second > first, 0 otherwise",action:e=>{const t=i.decode(e.pop()),r=i.decode(e.pop());e.push(i.encode(r>t?1:0))}},OP_LESSTHANOREQUAL:{code:161,category:"arithmetic",description:"Push 1 if second <= first, 0 otherwise",action:e=>{const t=i.decode(e.pop()),r=i.decode(e.pop());e.push(i.encode(r<=t?1:0))}},OP_GREATERTHANOREQUAL:{code:162,category:"arithmetic",description:"Push 1 if second >= first, 0 otherwise",action:e=>{const t=i.decode(e.pop()),r=i.decode(e.pop());e.push(i.encode(r>=t?1:0))}},OP_MIN:{code:163,category:"arithmetic",description:"Push smaller of top two numbers",action:e=>{const t=i.decode(e.pop()),r=i.decode(e.pop());e.push(i.encode(Math.min(t,r)))}},OP_MAX:{code:164,category:"arithmetic",description:"Push larger of top two numbers",action:e=>{const t=i.decode(e.pop()),r=i.decode(e.pop());e.push(i.encode(Math.max(t,r)))}},OP_WITHIN:{code:165,category:"arithmetic",description:"Push 1 if x is within [min, max), 0 otherwise",action:e=>{const t=i.decode(e.pop()),r=i.decode(e.pop()),n=i.decode(e.pop());e.push(i.encode(n>=r&&n<t?1:0))}},OP_RIPEMD160:{code:166,category:"crypto",description:"RIPEMD-160 hash of top item",action:e=>{const t=r(9).createHash("ripemd160").update(e.pop()).digest();e.push(t)}},OP_SHA1:{code:167,category:"crypto",description:"SHA-1 hash of top item",action:e=>{const t=r(9).createHash("sha1").update(e.pop()).digest();e.push(t)}},OP_SHA256:{code:168,category:"crypto",description:"SHA-256 hash of top item",action:e=>{const t=r(9).createHash("sha256").update(e.pop()).digest();e.push(t)}},OP_HASH160:{code:169,category:"crypto",description:"SHA-256 then RIPEMD-160 hash of top item",action:e=>{const t=r(9),i=t.createHash("sha256").update(e.pop()).digest(),n=t.createHash("ripemd160").update(i).digest();e.push(n)}},OP_HASH256:{code:170,category:"crypto",description:"Double SHA-256 hash of top item",action:e=>{const t=r(9),i=t.createHash("sha256").update(e.pop()).digest(),n=t.createHash("sha256").update(i).digest();e.push(n)}},OP_CODESEPARATOR:{code:171,category:"crypto",description:"Mark signature checking boundary",action:e=>{}},OP_CHECKSIG:{code:172,category:"crypto",description:"Verify signature against public key",action:"// Signature verification (requires transaction context)"},OP_CHECKSIGVERIFY:{code:173,category:"crypto",description:"Verify signature, then fail if invalid",action:"// Signature verification with VERIFY (requires transaction context)"},OP_CHECKMULTISIG:{code:174,category:"crypto",description:"Verify multiple signatures against public keys",action:"// Multi-signature verification (requires transaction context)"},OP_CHECKMULTISIGVERIFY:{code:175,category:"crypto",description:"Verify multiple signatures, then fail if invalid",action:"// Multi-signature verification with VERIFY (requires transaction context)"},OP_SUBSTR:{code:179,category:"string",description:"Extract substring: string[start:start+length]",action:e=>{const t=i.decode(e.pop()),r=i.decode(e.pop()),n=e.pop();e.push(n.slice(r,r+t))}},OP_LEFT:{code:180,category:"string",description:"Extract leftmost n bytes",action:e=>{const t=i.decode(e.pop()),r=e.pop();e.push(r.slice(0,t))}},OP_RIGHT:{code:181,category:"string",description:"Extract rightmost n bytes",action:e=>{const t=i.decode(e.pop()),r=e.pop();e.push(r.slice(-t))}},OP_NOP1:{code:176,category:"nop",description:"No operation (reserved for future use)",action:e=>{}},OP_NOP2:{code:177,category:"nop",description:"No operation (formerly CHECKLOCKTIMEVERIFY)",action:e=>{}},OP_NOP3:{code:178,category:"nop",description:"No operation (formerly CHECKSEQUENCEVERIFY)",action:e=>{}},OP_NOP4:{code:182,category:"nop",description:"No operation (reserved for future use)",action:e=>{}},OP_NOP5:{code:183,category:"nop",description:"No operation (reserved for future use)",action:e=>{}},OP_NOP6:{code:184,category:"nop",description:"No operation (reserved for future use)",action:e=>{}},OP_NOP7:{code:185,category:"nop",description:"No operation (reserved for future use)",action:e=>{}},OP_NOP8:{code:186,category:"nop",description:"No operation (reserved for future use)",action:e=>{}},OP_NOP9:{code:187,category:"nop",description:"No operation (reserved for future use)",action:e=>{}},OP_NOP10:{code:188,category:"nop",description:"No operation (reserved for future use)",action:e=>{}},OP_RESERVED1:{code:137,category:"reserved",description:"Reserved opcode (makes transaction invalid)",action:()=>{throw new Error("OP_RESERVED1 encountered")}},OP_RESERVED2:{code:138,category:"reserved",description:"Reserved opcode (makes transaction invalid)",action:()=>{throw new Error("OP_RESERVED2 encountered")}},OP_CHECKLOCKTIMEVERIFY:{code:177,category:"disabled",description:"Check locktime (disabled post-Genesis)",action:e=>{}},OP_CHECKSEQUENCEVERIFY:{code:178,category:"disabled",description:"Check sequence (disabled post-Genesis)",action:e=>{}},OP_PUBKEYHASH:{code:253,category:"pseudo",description:"Template matching: public key hash",action:"// Template matching only"},OP_PUBKEY:{code:254,category:"pseudo",description:"Template matching: public key",action:"// Template matching only"},OP_INVALIDOPCODE:{code:255,category:"pseudo",description:"Invalid opcode placeholder",action:()=>{throw new Error("Invalid opcode encountered")}}},o={getByCategory:e=>Object.entries(n).filter(([t,r])=>r.category===e).reduce((e,[t,r])=>({...e,[t]:r}),{}),getCategories:()=>{const e=new Set;return Object.values(n).forEach(t=>e.add(t.category)),Array.from(e).sort()},createASM:t=>{const r=[];return t.forEach(t=>{if("string"==typeof t&&n[t])r.push(t);else if("number"==typeof t)if(t>=1&&t<=16)r.push("OP_"+t);else if(0===t)r.push("OP_0");else if(-1===t)r.push("OP_1NEGATE");else{const e=i.encode(t);r.push(e.toString("hex"))}else{if(!e.isBuffer(t))throw new Error("Invalid operation: "+t);r.push(t.toString("hex"))}}),r.join(" ")},simulate:(e,t=[])=>{const r=[...t],i=[],o=[];return e.forEach((e,t)=>{if(!n[e])throw new Error("Unknown opcode: "+e);const a=n[e],s=[...r];if("function"==typeof a.action)try{a.action(r,i),o.push({step:t+1,opcode:e,beforeStack:s.map(e=>e.toString("hex")),afterStack:r.map(e=>e.toString("hex")),description:a.description})}catch(r){throw o.push({step:t+1,opcode:e,beforeStack:s.map(e=>e.toString("hex")),afterStack:[],error:r.message,description:a.description}),r}else o.push({step:t+1,opcode:e,beforeStack:s.map(e=>e.toString("hex")),afterStack:s.map(e=>e.toString("hex")),note:a.action,description:a.description})}),{finalStack:r.map(e=>e.toString("hex")),finalAltStack:i.map(e=>e.toString("hex")),history:o}},opcodeToName:e=>{const t=Object.entries(n).find(([t,r])=>r.code===e);return t?t[0]:"UNKNOWN_"+e.toString(16).padStart(2,"0")},nameToOpcode:e=>n[e]&&n[e].code,generateCovenantTemplate:(t,r)=>{const i=[];return"value"===t&&(i.push("OP_SIZE"),i.push(52),i.push("OP_SUB"),i.push("OP_SPLIT"),i.push("OP_DROP"),i.push(8),i.push("OP_SPLIT"),i.push("OP_DROP")),r&&(i.push(e.from(r,"hex")),i.push("OP_EQUAL")),{operations:i,asm:o.createASM(i),description:`Extract ${t} field and compare with expected value`}}};if(t.exports={opcodeMap:n,scriptNum:i,utils:o},r.c[r.s]===t){console.log("🔧 Comprehensive Bitcoin Script Opcode Map"),console.log("=========================================="),console.log("Total opcodes mapped: "+Object.keys(n).length),console.log("\n📊 Categories:"),o.getCategories().forEach(e=>{const t=Object.values(n).filter(t=>t.category===e).length;console.log(` ${e}: ${t} opcodes`)}),console.log("\n🧪 Example: Stack manipulation simulation");try{const e=["OP_1","OP_2","OP_ADD","OP_3","OP_EQUAL"],t=o.simulate(e);console.log("Operations:",e.join(" ")),console.log("Final stack:",t.finalStack),console.log("Expected: ['01'] (true, since 1+2=3)"),console.log("\n📝 Step-by-step execution:"),t.history.forEach(e=>{console.log(` ${e.step}. ${e.opcode}: ${e.description}`),console.log(` Stack: [${e.beforeStack.join(", ")}] → [${e.afterStack.join(", ")}]`)})}catch(e){console.log("❌ Simulation error:",e.message)}console.log("\n🎯 Example: Covenant template generation");const e=o.generateCovenantTemplate("value","50c3000000000000");console.log("Generated ASM:",e.asm),console.log("Description:",e.description)}}).call(this,r(0).Buffer,r(24)(e))},function(e,t,r){"use strict";(function(t){var i=r(9);function n(e){return e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function o(e){for(e=e.replace(/-/g,"+").replace(/_/g,"/");e.length%4;)e+="=";return t.from(e,"base64")}e.exports={issueVcJwt:async function(e){if(!(e.issuerDid&&e.subjectId&&e.credentialSubject&&e.privateJwk))throw new Error("issuerDid, subjectId, credentialSubject, and privateJwk are required");var r,o=e.alg||"ES256",a=e.kid||e.privateJwk.kid,s=e.types||["VerifiableCredential"],u=e.expSeconds||31536e3,c=Math.floor(Date.now()/1e3),h=(new Date).toISOString(),f={"@context":["https://www.w3.org/2018/credentials/v1"],type:s,issuer:e.issuerDid,issuanceDate:h,credentialSubject:Object.assign({id:e.subjectId},e.credentialSubject)},l={iss:e.issuerDid,sub:e.subjectId,iat:c,exp:c+u,vc:f},d={alg:o,typ:"JWT",kid:a},p=n(t.from(JSON.stringify(d)))+"."+n(t.from(JSON.stringify(l))),m=i.createPrivateKey({key:e.privateJwk,format:"jwk"});if("ES256"===o)r=i.sign("sha256",t.from(p),m);else{if("ES256K"!==o)throw new Error("Unsupported algorithm: "+o);r=i.sign("sha256",t.from(p),m)}return{jwt:p+"."+n(r)}},verifyVcJwt:async function(e,r){r=r||{};try{var n=e.split(".");if(3!==n.length)return{valid:!1,error:"Invalid JWT format"};var a,s=n[0],u=n[1],c=n[2],h=JSON.parse(o(s).toString()),f=JSON.parse(o(u).toString()),l=o(c),d=Math.floor(Date.now()/1e3),p=r.clockToleranceSec||60;if(f.exp&&f.exp<d-p)return{valid:!1,error:"JWT expired",header:h,payload:f};if(r.expectedIssuerDid&&f.iss!==r.expectedIssuerDid)return{valid:!1,error:"Unexpected issuer",header:h,payload:f};if(!r.didResolver)return{valid:!1,error:"DID resolver required for verification",header:h,payload:f};var m=await r.didResolver(f.iss);if(!m||!m.jwks||!m.jwks.keys)return{valid:!1,error:"Failed to resolve issuer DID",header:h,payload:f};var g=m.jwks.keys.find((function(e){return e.kid===h.kid}));if(!g)return{valid:!1,error:"Key not found in JWKS",header:h,payload:f};a=g;var b=s+"."+u,y=i.createPublicKey({key:a,format:"jwk"});return i.verify("sha256",t.from(b),y,l)?{valid:!0,header:h,payload:f}:{valid:!1,error:"Invalid signature",header:h,payload:f}}catch(e){return{valid:!1,error:e.message||"Verification failed"}}},base64UrlEncode:n,base64UrlDecode:o}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";e.exports=function(e,t,r,i){for(var n=65535&e|0,o=e>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(n=n+t[i++]|0)|0}while(--a);n%=65521,o%=65521}return n|o<<16|0}},function(e,t,r){"use strict";var i=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();e.exports=function(e,t,r,n){var o=i,a=n+r;e^=-1;for(var s=n;s<a;s++)e=e>>>8^o[255&(e^t[s])];return-1^e}},function(e,t,r){e.exports=r(97)},function(e,t,r){"use strict";t.byteLength=function(e){var t=c(e),r=t[0],i=t[1];return 3*(r+i)/4-i},t.toByteArray=function(e){var t,r,i=c(e),a=i[0],s=i[1],u=new o(function(e,t,r){return 3*(t+r)/4-r}(0,a,s)),h=0,f=s>0?a-4:a;for(r=0;r<f;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[h++]=t>>16&255,u[h++]=t>>8&255,u[h++]=255&t;2===s&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[h++]=255&t);1===s&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[h++]=t>>8&255,u[h++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,n=r%3,o=[],a=0,s=r-n;a<s;a+=16383)o.push(h(e,a,a+16383>s?s:a+16383));1===n?(t=e[r-1],o.push(i[t>>2]+i[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],o.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"="));return o.join("")};for(var i=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s<u;++s)i[s]=a[s],n[a.charCodeAt(s)]=s;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function h(e,t,r){for(var n,o,a=[],s=t;s<r;s+=3)n=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(i[(o=n)>>18&63]+i[o>>12&63]+i[o>>6&63]+i[63&o]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},function(e,t){
|
|
19
19
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
20
|
-
t.read=function(e,t,r,i,n){var o,a,s=8*n-i-1,u=(1<<s)-1,c=u>>1,h=-7,f=r?n-1:0,l=r?-1:1,d=e[t+f];for(f+=l,o=d&(1<<-h)-1,d>>=-h,h+=s;h>0;o=256*o+e[t+f],f+=l,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=i;h>0;a=256*a+e[t+f],f+=l,h-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,i),o-=c}return(d?-1:1)*a*Math.pow(2,o-i)},t.write=function(e,t,r,i,n,o){var a,s,u,c=8*o-n-1,h=(1<<c)-1,f=h>>1,l=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:o-1,p=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=h):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+f>=1?l/u:l*Math.pow(2,1-f))*u>=2&&(a++,u/=2),a+f>=h?(s=0,a=h):a+f>=1?(s=(t*u-1)*Math.pow(2,n),a+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,n),a=0));n>=8;e[r+d]=255&s,d+=p,s/=256,n-=8);for(a=a<<n|s,c+=n;c>0;e[r+d]=255&a,d+=p,a/=256,c-=8);e[r+d-p]|=128*m}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){"use strict";var i=r(1).Buffer,n=r(66).Transform;function o(e){n.call(this),this._block=i.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(176)(o,n),o.prototype._transform=function(e,t,r){var i=null;try{this.update(e,t)}catch(e){i=e}r(i)},o.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)};var a="undefined"!=typeof Uint8Array,s="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&ArrayBuffer.isView&&(i.prototype instanceof Uint8Array||i.TYPED_ARRAY_SUPPORT);o.prototype.update=function(e,t){if(this._finalized)throw new Error("Digest already called");e=function(e,t){if(e instanceof i)return e;if("string"==typeof e)return i.from(e,t);if(s&&ArrayBuffer.isView(e)){if(0===e.byteLength)return i.alloc(0);var r=i.from(e.buffer,e.byteOffset,e.byteLength);if(r.byteLength===e.byteLength)return r}if(a&&e instanceof Uint8Array)return i.from(e);if(i.isBuffer(e)&&e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e))return i.from(e);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}(e,t);for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)r[o++]=e[n++];this._update(),this._blockOffset=0}for(;n<e.length;)r[this._blockOffset++]=e[n++];for(var u=0,c=8*e.length;c>0;++u)this._length[u]+=c,(c=this._length[u]/4294967296|0)>0&&(this._length[u]-=4294967296*c);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},o.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=o},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t){},function(e,t,r){"use strict";var i=r(68).Buffer,n=r(166);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return i.alloc(0);for(var t,r,n,o=i.allocUnsafe(e>>>0),a=this.head,s=0;a;)t=a.data,r=o,n=s,t.copy(r,n),s+=a.data.length,a=a.next;return o},e}(),n&&n.inspect&&n.inspect.custom&&(e.exports.prototype[n.inspect.custom]=function(){var e=n.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,r){(function(e){var i=void 0!==e&&e||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function o(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new o(n.call(setTimeout,i,arguments),clearTimeout)},t.setInterval=function(){return new o(n.call(setInterval,i,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(i,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},r(168),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,r(13))},function(e,t,r){(function(e,t){!function(e,r){"use strict";if(!e.setImmediate){var i,n,o,a,s,u=1,c={},h=!1,f=e.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(e);l=l&&l.setTimeout?l:e,"[object process]"==={}.toString.call(e.process)?i=function(e){t.nextTick((function(){p(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?e.MessageChannel?((o=new MessageChannel).port1.onmessage=function(e){p(e.data)},i=function(e){o.port2.postMessage(e)}):f&&"onreadystatechange"in f.createElement("script")?(n=f.documentElement,i=function(e){var t=f.createElement("script");t.onreadystatechange=function(){p(e),t.onreadystatechange=null,n.removeChild(t),t=null},n.appendChild(t)}):i=function(e){setTimeout(p,0,e)}:(a="setImmediate$"+Math.random()+"$",s=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(a)&&p(+t.data.slice(a.length))},e.addEventListener?e.addEventListener("message",s,!1):e.attachEvent("onmessage",s),i=function(t){e.postMessage(a+t,"*")}),l.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r<t.length;r++)t[r]=arguments[r+1];var n={callback:e,args:t};return c[u]=n,i(u),u++},l.clearImmediate=d}function d(e){delete c[e]}function p(e){if(h)setTimeout(p,0,e);else{var t=c[e];if(t){h=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(void 0,r)}}(t)}finally{d(e),h=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,r(13),r(6))},function(e,t,r){(function(t){function r(e){try{if(!t.localStorage)return!1}catch(e){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=function(e,t){if(r("noDeprecation"))return e;var i=!1;return function(){if(!i){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),i=!0}return e.apply(this,arguments)}}}).call(this,r(13))},function(e,t,r){var i=r(0),n=i.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=i:(o(i,t),t.Buffer=a),o(n,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},function(e,t,r){"use strict";e.exports=o;var i=r(101),n=Object.create(r(39));function o(e){if(!(this instanceof o))return new o(e);i.call(this,e)}n.inherits=r(4),n.inherits(o,i),o.prototype._transform=function(e,t,r){r(null,e)}},function(e,t,r){e.exports=r(69)},function(e,t,r){e.exports=r(28)},function(e,t,r){e.exports=r(38).Transform},function(e,t,r){e.exports=r(38).PassThrough},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){"use strict";var i=r(1).Buffer,n=r(178),o=r(38).Transform;function a(e){o.call(this),this._block=i.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(102)(a,o),a.prototype._transform=function(e,t,r){var i=null;try{this.update(e,t)}catch(e){i=e}r(i)},a.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},a.prototype.update=function(e,t){if(this._finalized)throw new Error("Digest already called");for(var r=n(e,t),i=this._block,o=0;this._blockOffset+r.length-o>=this._blockSize;){for(var a=this._blockOffset;a<this._blockSize;)i[a]=r[o],a+=1,o+=1;this._update(),this._blockOffset=0}for(;o<r.length;)i[this._blockOffset]=r[o],this._blockOffset+=1,o+=1;for(var s=0,u=8*r.length;u>0;++s)this._length[s]+=u,(u=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*u);return this},a.prototype._update=function(){throw new Error("_update is not implemented")},a.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},a.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=a},function(e,t,r){"use strict";var i=r(1).Buffer,n=r(53),o="undefined"!=typeof Uint8Array,a=o&&"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView;e.exports=function(e,t){if("string"==typeof e||i.isBuffer(e)||o&&e instanceof Uint8Array||a&&a(e))return n(e,t);throw new TypeError('The "data" argument must be a string, a Buffer, a Uint8Array, or a DataView')}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){"use strict";var i=r(40),n=r(72)("TypedArray.prototype.buffer",!0),o=r(200);e.exports=n||function(e){if(!o(e))throw new i("Not a Typed Array");return e.buffer}},function(e,t,r){"use strict";e.exports=Error},function(e,t,r){"use strict";e.exports=EvalError},function(e,t,r){"use strict";e.exports=RangeError},function(e,t,r){"use strict";e.exports=ReferenceError},function(e,t,r){"use strict";e.exports=URIError},function(e,t,r){"use strict";e.exports=Math.abs},function(e,t,r){"use strict";e.exports=Math.floor},function(e,t,r){"use strict";e.exports=Math.max},function(e,t,r){"use strict";e.exports=Math.min},function(e,t,r){"use strict";e.exports=Math.pow},function(e,t,r){"use strict";e.exports=Math.round},function(e,t,r){"use strict";var i=r(193);e.exports=function(e){return i(e)||0===e?e:e<0?-1:1}},function(e,t,r){"use strict";e.exports=Number.isNaN||function(e){return e!=e}},function(e,t,r){"use strict";e.exports=Object.getOwnPropertyDescriptor},function(e,t,r){"use strict";var i="undefined"!=typeof Symbol&&Symbol,n=r(74);e.exports=function(){return"function"==typeof i&&("function"==typeof Symbol&&("symbol"==typeof i("foo")&&("symbol"==typeof Symbol("bar")&&n())))}},function(e,t,r){"use strict";var i,n=r(75),o=r(41);try{i=[].__proto__===Array.prototype}catch(e){if(!e||"object"!=typeof e||!("code"in e)||"ERR_PROTO_ACCESS"!==e.code)throw e}var a=!!i&&o&&o(Object.prototype,"__proto__"),s=Object,u=s.getPrototypeOf;e.exports=a&&"function"==typeof a.get?n([a.get]):"function"==typeof u&&function(e){return u(null==e?e:s(e))}},function(e,t,r){"use strict";var i="Function.prototype.bind called on incompatible ",n=Object.prototype.toString,o=Math.max,a=function(e,t){for(var r=[],i=0;i<e.length;i+=1)r[i]=e[i];for(var n=0;n<t.length;n+=1)r[n+e.length]=t[n];return r},s=function(e,t){for(var r=[],i=t||0,n=0;i<e.length;i+=1,n+=1)r[n]=e[i];return r},u=function(e,t){for(var r="",i=0;i<e.length;i+=1)r+=e[i],i+1<e.length&&(r+=t);return r};e.exports=function(e){var t=this;if("function"!=typeof t||"[object Function]"!==n.apply(t))throw new TypeError(i+t);for(var r,c=s(arguments,1),h=function(){if(this instanceof r){var i=t.apply(this,a(c,arguments));return Object(i)===i?i:this}return t.apply(e,a(c,arguments))},f=o(0,t.length-c.length),l=[],d=0;d<f;d++)l[d]="$"+d;if(r=Function("binder","return function ("+u(l,",")+"){ return binder.apply(this,arguments); }")(h),t.prototype){var p=function(){};p.prototype=t.prototype,r.prototype=new p,p.prototype=null}return r}},function(e,t,r){"use strict";e.exports="undefined"!=typeof Reflect&&Reflect&&Reflect.apply},function(e,t,r){"use strict";var i=Function.prototype.call,n=Object.prototype.hasOwnProperty,o=r(42);e.exports=o.call(i,n)},function(e,t,r){"use strict";var i=r(201);e.exports=function(e){return!!i(e)}},function(e,t,r){"use strict";(function(t){var i=r(202),n=r(204),o=r(206),a=r(72),s=r(41),u=r(105),c=a("Object.prototype.toString"),h=r(211)(),f="undefined"==typeof globalThis?t:globalThis,l=n(),d=a("String.prototype.slice"),p=a("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r<e.length;r+=1)if(e[r]===t)return r;return-1},m={__proto__:null};i(l,h&&s&&u?function(e){var t=new f[e];if(Symbol.toStringTag in t&&u){var r=u(t),i=s(r,Symbol.toStringTag);if(!i&&r){var n=u(r);i=s(n,Symbol.toStringTag)}if(i&&i.get){var a=o(i.get);m["$"+e]=a}}}:function(e){var t=new f[e],r=t.slice||t.set;if(r){var i=o(r);m["$"+e]=i}});e.exports=function(e){if(!e||"object"!=typeof e)return!1;if(!h){var t=d(c(e),8,-1);return p(l,t)>-1?t:"Object"===t&&function(e){var t=!1;return i(m,(function(r,i){if(!t)try{r(e),t=d(i,1)}catch(e){}})),t}(e)}return s?function(e){var t=!1;return i(m,(function(r,i){if(!t)try{"$"+r(e)===i&&(t=d(i,1))}catch(e){}})),t}(e):null}}).call(this,r(13))},function(e,t,r){"use strict";var i=r(203),n=Object.prototype.toString,o=Object.prototype.hasOwnProperty,a=function(e,t,r){for(var i=0,n=e.length;i<n;i++)o.call(e,i)&&(null==r?t(e[i],i,e):t.call(r,e[i],i,e))},s=function(e,t,r){for(var i=0,n=e.length;i<n;i++)null==r?t(e.charAt(i),i,e):t.call(r,e.charAt(i),i,e)},u=function(e,t,r){for(var i in e)o.call(e,i)&&(null==r?t(e[i],i,e):t.call(r,e[i],i,e))};function c(e){return"[object Array]"===n.call(e)}e.exports=function(e,t,r){if(!i(t))throw new TypeError("iterator must be a function");var n;arguments.length>=3&&(n=r),c(e)?a(e,t,n):"string"==typeof e?s(e,t,n):u(e,t,n)}},function(e,t,r){"use strict";var i,n,o=Function.prototype.toString,a="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof a&&"function"==typeof Object.defineProperty)try{i=Object.defineProperty({},"length",{get:function(){throw n}}),n={},a((function(){throw 42}),null,i)}catch(e){e!==n&&(a=null)}else a=null;var s=/^\s*class\b/,u=function(e){try{var t=o.call(e);return s.test(t)}catch(e){return!1}},c=function(e){try{return!u(e)&&(o.call(e),!0)}catch(e){return!1}},h=Object.prototype.toString,f="function"==typeof Symbol&&!!Symbol.toStringTag,l=!(0 in[,]),d=function(){return!1};if("object"==typeof document){var p=document.all;h.call(p)===h.call(document.all)&&(d=function(e){if((l||!e)&&(void 0===e||"object"==typeof e))try{var t=h.call(e);return("[object HTMLAllCollection]"===t||"[object HTML document.all class]"===t||"[object HTMLCollection]"===t||"[object Object]"===t)&&null==e("")}catch(e){}return!1})}e.exports=a?function(e){if(d(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;try{a(e,null,i)}catch(e){if(e!==n)return!1}return!u(e)&&c(e)}:function(e){if(d(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(f)return c(e);if(u(e))return!1;var t=h.call(e);return!("[object Function]"!==t&&"[object GeneratorFunction]"!==t&&!/^\[object HTML/.test(t))&&c(e)}},function(e,t,r){"use strict";(function(t){var i=r(205),n="undefined"==typeof globalThis?t:globalThis;e.exports=function(){for(var e=[],t=0;t<i.length;t++)"function"==typeof n[i[t]]&&(e[e.length]=i[t]);return e}}).call(this,r(13))},function(e,t,r){"use strict";e.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]},function(e,t,r){"use strict";var i=r(207),n=r(54),o=r(75),a=r(210);e.exports=function(e){var t=o(arguments),r=1+e.length-(arguments.length-1);return i(t,r>0?r:0,!0)},n?n(e.exports,"apply",{value:a}):e.exports.apply=a},function(e,t,r){"use strict";var i=r(103),n=r(208),o=r(209)(),a=r(41),s=r(40),u=i("%Math.floor%");e.exports=function(e,t){if("function"!=typeof e)throw new s("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||u(t)!==t)throw new s("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,c=!0;if("length"in e&&a){var h=a(e,"length");h&&!h.configurable&&(i=!1),h&&!h.writable&&(c=!1)}return(i||c||!r)&&(o?n(e,"length",t,!0,!0):n(e,"length",t)),e}},function(e,t,r){"use strict";var i=r(54),n=r(104),o=r(40),a=r(41);e.exports=function(e,t,r){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new o("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new o("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new o("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new o("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new o("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new o("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,h=arguments.length>6&&arguments[6],f=!!a&&a(e,t);if(i)i(e,t,{configurable:null===c&&f?f.configurable:!c,enumerable:null===s&&f?f.enumerable:!s,value:r,writable:null===u&&f?f.writable:!u});else{if(!h&&(s||u||c))throw new n("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=r}}},function(e,t,r){"use strict";var i=r(54),n=function(){return!!i};n.hasArrayLengthDefineBug=function(){if(!i)return null;try{return 1!==i([],"length",{value:1}).length}catch(e){return!0}},e.exports=n},function(e,t,r){"use strict";var i=r(42),n=r(77),o=r(108);e.exports=function(){return o(i,n,arguments)}},function(e,t,r){"use strict";var i=r(74);e.exports=function(){return i()&&!!Symbol.toStringTag}},function(e,t,r){"use strict";var i=r(34),n=r(35),o=r(1).Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,n.call(this,64,56)}function c(e){return e<<30|e>>>2}function h(e,t,r,i){return 0===e?t&r|~t&i:2===e?t&r|t&i|r&i:t^r^i}i(u,n),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,f=0;f<16;++f)r[f]=e.readInt32BE(4*f);for(;f<80;++f)r[f]=r[f-3]^r[f-8]^r[f-14]^r[f-16];for(var l=0;l<80;++l){var d=~~(l/20),p=0|((t=i)<<5|t>>>27)+h(d,n,o,s)+u+r[l]+a[d];u=s,s=o,o=c(n),n=i,i=p}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},function(e,t,r){"use strict";var i=r(34),n=r(35),o=r(1).Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,n.call(this,64,56)}function c(e){return e<<5|e>>>27}function h(e){return e<<30|e>>>2}function f(e,t,r,i){return 0===e?t&r|~t&i:2===e?t&r|t&i|r&i:t^r^i}i(u,n),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,l=0;l<16;++l)r[l]=e.readInt32BE(4*l);for(;l<80;++l)r[l]=(t=r[l-3]^r[l-8]^r[l-14]^r[l-16])<<1|t>>>31;for(var d=0;d<80;++d){var p=~~(d/20),m=c(i)+f(p,n,o,s)+u+r[d]+a[p]|0;u=s,s=o,o=h(n),n=i,i=m}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},function(e,t,r){"use strict";var i=r(34),n=r(109),o=r(35),a=r(1).Buffer,s=new Array(64);function u(){this.init(),this._w=s,o.call(this,64,56)}i(u,n),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var e=a.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},e.exports=u},function(e,t,r){"use strict";var i=r(34),n=r(110),o=r(35),a=r(1).Buffer,s=new Array(160);function u(){this.init(),this._w=s,o.call(this,128,112)}i(u,n),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var e=a.allocUnsafe(48);function t(t,r,i){e.writeInt32BE(t,i),e.writeInt32BE(r,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},e.exports=u},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){"use strict";var i=r(4),n=r(1).Buffer,o=r(23),a=n.alloc(128);function s(e,t){o.call(this,"digest"),"string"==typeof t&&(t=n.from(t)),this._alg=e,this._key=t,t.length>64?t=e(t):t.length<64&&(t=n.concat([t,a],64));for(var r=this._ipad=n.allocUnsafe(64),i=this._opad=n.allocUnsafe(64),s=0;s<64;s++)r[s]=54^t[s],i[s]=92^t[s];this._hash=[r]}i(s,o),s.prototype._update=function(e){this._hash.push(e)},s.prototype._final=function(){var e=this._alg(n.concat(this._hash));return this._alg(n.concat([this._opad,e]))},e.exports=s},function(e,t,r){"use strict";e.exports=r(113)},function(e,t,r){"use strict";(function(t){var i,n,o=r(1).Buffer,a=r(115),s=r(116),u=r(117),c=r(118),h=t.crypto&&t.crypto.subtle,f={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},l=[];function d(){return n||(n=t.process&&t.process.nextTick?t.process.nextTick:t.queueMicrotask?t.queueMicrotask:t.setImmediate?t.setImmediate:t.setTimeout)}function p(e,t,r,i,n){return h.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]).then((function(e){return h.deriveBits({name:"PBKDF2",salt:t,iterations:r,hash:{name:n}},e,i<<3)})).then((function(e){return o.from(e)}))}e.exports=function(e,r,n,m,g,b){if("function"==typeof g&&(b=g,g=void 0),a(n,m),e=c(e,s,"Password"),r=c(r,s,"Salt"),"function"!=typeof b)throw new Error("No callback provided to pbkdf2");var y=f[(g=g||"sha1").toLowerCase()];y&&"function"==typeof t.Promise?function(e,t){e.then((function(e){d()((function(){t(null,e)}))}),(function(e){d()((function(){t(e)}))}))}(function(e){if(t.process&&!t.process.browser)return Promise.resolve(!1);if(!h||!h.importKey||!h.deriveBits)return Promise.resolve(!1);if(void 0!==l[e])return l[e];var r=p(i=i||o.alloc(8),i,10,128,e).then((function(){return!0}),(function(){return!1}));return l[e]=r,r}(y).then((function(t){return t?p(e,r,n,m,y):u(e,r,n,m,g)})),b):d()((function(){var t;try{t=u(e,r,n,m,g)}catch(e){return void b(e)}b(null,t)}))}}).call(this,r(13))},function(e,t,r){var i=r(221),n=r(80),o=r(81),a=r(234),s=r(56);function u(e,t,r){if(e=e.toLowerCase(),o[e])return n.createCipheriv(e,t,r);if(a[e])return new i({key:t,iv:r,mode:e});throw new TypeError("invalid suite type")}function c(e,t,r){if(e=e.toLowerCase(),o[e])return n.createDecipheriv(e,t,r);if(a[e])return new i({key:t,iv:r,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}t.createCipher=t.Cipher=function(e,t){var r,i;if(e=e.toLowerCase(),o[e])r=o[e].key,i=o[e].iv;else{if(!a[e])throw new TypeError("invalid suite type");r=8*a[e].key,i=a[e].iv}var n=s(t,!1,r,i);return u(e,n.key,n.iv)},t.createCipheriv=t.Cipheriv=u,t.createDecipher=t.Decipher=function(e,t){var r,i;if(e=e.toLowerCase(),o[e])r=o[e].key,i=o[e].iv;else{if(!a[e])throw new TypeError("invalid suite type");r=8*a[e].key,i=a[e].iv}var n=s(t,!1,r,i);return c(e,n.key,n.iv)},t.createDecipheriv=t.Decipheriv=c,t.listCiphers=t.getCiphers=function(){return Object.keys(a).concat(n.getCiphers())}},function(e,t,r){var i=r(23),n=r(222),o=r(4),a=r(1).Buffer,s={"des-ede3-cbc":n.CBC.instantiate(n.EDE),"des-ede3":n.EDE,"des-ede-cbc":n.CBC.instantiate(n.EDE),"des-ede":n.EDE,"des-cbc":n.CBC.instantiate(n.DES),"des-ecb":n.DES};function u(e){i.call(this);var t,r=e.mode.toLowerCase(),n=s[r];t=e.decrypt?"decrypt":"encrypt";var o=e.key;a.isBuffer(o)||(o=a.from(o)),"des-ede"!==r&&"des-ede-cbc"!==r||(o=a.concat([o,o.slice(0,8)]));var u=e.iv;a.isBuffer(u)||(u=a.from(u)),this._des=n.create({key:o,iv:u,type:t})}s.des=s["des-cbc"],s.des3=s["des-ede3-cbc"],e.exports=u,o(u,i),u.prototype._update=function(e){return a.from(this._des.update(e))},u.prototype._final=function(){return a.from(this._des.final())}},function(e,t,r){"use strict";t.utils=r(119),t.Cipher=r(79),t.DES=r(120),t.CBC=r(223),t.EDE=r(224)},function(e,t,r){"use strict";var i=r(14),n=r(4),o={};function a(e){i.equal(e.length,8,"Invalid IV length"),this.iv=new Array(8);for(var t=0;t<this.iv.length;t++)this.iv[t]=e[t]}t.instantiate=function(e){function t(t){e.call(this,t),this._cbcInit()}n(t,e);for(var r=Object.keys(o),i=0;i<r.length;i++){var a=r[i];t.prototype[a]=o[a]}return t.create=function(e){return new t(e)},t},o._cbcInit=function(){var e=new a(this.options.iv);this._cbcState=e},o._update=function(e,t,r,i){var n=this._cbcState,o=this.constructor.super_.prototype,a=n.iv;if("encrypt"===this.type){for(var s=0;s<this.blockSize;s++)a[s]^=e[t+s];o._update.call(this,a,0,r,i);for(s=0;s<this.blockSize;s++)a[s]=r[i+s]}else{o._update.call(this,e,t,r,i);for(s=0;s<this.blockSize;s++)r[i+s]^=a[s];for(s=0;s<this.blockSize;s++)a[s]=e[t+s]}}},function(e,t,r){"use strict";var i=r(14),n=r(4),o=r(79),a=r(120);function s(e,t){i.equal(t.length,24,"Invalid key length");var r=t.slice(0,8),n=t.slice(8,16),o=t.slice(16,24);this.ciphers="encrypt"===e?[a.create({type:"encrypt",key:r}),a.create({type:"decrypt",key:n}),a.create({type:"encrypt",key:o})]:[a.create({type:"decrypt",key:o}),a.create({type:"encrypt",key:n}),a.create({type:"decrypt",key:r})]}function u(e){o.call(this,e);var t=new s(this.type,this.options.key);this._edeState=t}n(u,o),e.exports=u,u.create=function(e){return new u(e)},u.prototype._update=function(e,t,r,i){var n=this._edeState;n.ciphers[0]._update(e,t,r,i),n.ciphers[1]._update(r,i,r,i),n.ciphers[2]._update(r,i,r,i)},u.prototype._pad=a.prototype._pad,u.prototype._unpad=a.prototype._unpad},function(e,t,r){var i=r(81),n=r(124),o=r(1).Buffer,a=r(125),s=r(23),u=r(55),c=r(56);function h(e,t,r){s.call(this),this._cache=new l,this._cipher=new u.AES(t),this._prev=o.from(r),this._mode=e,this._autopadding=!0}r(4)(h,s),h.prototype._update=function(e){var t,r;this._cache.add(e);for(var i=[];t=this._cache.get();)r=this._mode.encrypt(this,t),i.push(r);return o.concat(i)};var f=o.alloc(16,16);function l(){this.cache=o.allocUnsafe(0)}function d(e,t,r){var s=i[e.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=o.from(t)),t.length!==s.key/8)throw new TypeError("invalid key length "+t.length);if("string"==typeof r&&(r=o.from(r)),"GCM"!==s.mode&&r.length!==s.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===s.type?new a(s.module,t,r):"auth"===s.type?new n(s.module,t,r):new h(s.module,t,r)}h.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(f))throw this._cipher.scrub(),new Error("data not multiple of block length")},h.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},l.prototype.add=function(e){this.cache=o.concat([this.cache,e])},l.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},l.prototype.flush=function(){for(var e=16-this.cache.length,t=o.allocUnsafe(e),r=-1;++r<e;)t.writeUInt8(e,r);return o.concat([this.cache,t])},t.createCipheriv=d,t.createCipher=function(e,t){var r=i[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=c(t,!1,r.key,r.iv);return d(e,n.key,n.iv)}},function(e,t){t.encrypt=function(e,t){return e._cipher.encryptBlock(t)},t.decrypt=function(e,t){return e._cipher.decryptBlock(t)}},function(e,t,r){var i=r(43);t.encrypt=function(e,t){var r=i(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev},t.decrypt=function(e,t){var r=e._prev;e._prev=t;var n=e._cipher.decryptBlock(t);return i(n,r)}},function(e,t,r){var i=r(1).Buffer,n=r(43);function o(e,t,r){var o=t.length,a=n(t,e._cache);return e._cache=e._cache.slice(o),e._prev=i.concat([e._prev,r?t:a]),a}t.encrypt=function(e,t,r){for(var n,a=i.allocUnsafe(0);t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=i.allocUnsafe(0)),!(e._cache.length<=t.length)){a=i.concat([a,o(e,t,r)]);break}n=e._cache.length,a=i.concat([a,o(e,t.slice(0,n),r)]),t=t.slice(n)}return a}},function(e,t,r){var i=r(1).Buffer;function n(e,t,r){var n=e._cipher.encryptBlock(e._prev)[0]^t;return e._prev=i.concat([e._prev.slice(1),i.from([r?t:n])]),n}t.encrypt=function(e,t,r){for(var o=t.length,a=i.allocUnsafe(o),s=-1;++s<o;)a[s]=n(e,t[s],r);return a}},function(e,t,r){var i=r(1).Buffer;function n(e,t,r){for(var i,n,a=-1,s=0;++a<8;)i=t&1<<7-a?128:0,s+=(128&(n=e._cipher.encryptBlock(e._prev)[0]^i))>>a%8,e._prev=o(e._prev,r?i:n);return s}function o(e,t){var r=e.length,n=-1,o=i.allocUnsafe(e.length);for(e=i.concat([e,i.from([t])]);++n<r;)o[n]=e[n]<<1|e[n+1]>>7;return o}t.encrypt=function(e,t,r){for(var o=t.length,a=i.allocUnsafe(o),s=-1;++s<o;)a[s]=n(e,t[s],r);return a}},function(e,t,r){(function(e){var i=r(43);function n(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}t.encrypt=function(t,r){for(;t._cache.length<r.length;)t._cache=e.concat([t._cache,n(t)]);var o=t._cache.slice(0,r.length);return t._cache=t._cache.slice(r.length),i(r,o)}}).call(this,r(0).Buffer)},function(e,t,r){var i=r(1).Buffer,n=i.alloc(16,0);function o(e){var t=i.allocUnsafe(16);return t.writeUInt32BE(e[0]>>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function a(e){this.h=e,this.state=i.alloc(16,0),this.cache=i.allocUnsafe(0)}a.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()},a.prototype._multiply=function(){for(var e,t,r,i=[(e=this.h).readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.readUInt32BE(12)],n=[0,0,0,0],a=-1;++a<128;){for(0!=(this.state[~~(a/8)]&1<<7-a%8)&&(n[0]^=i[0],n[1]^=i[1],n[2]^=i[2],n[3]^=i[3]),r=0!=(1&i[3]),t=3;t>0;t--)i[t]=i[t]>>>1|(1&i[t-1])<<31;i[0]=i[0]>>>1,r&&(i[0]=i[0]^225<<24)}this.state=o(n)},a.prototype.update=function(e){var t;for(this.cache=i.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},a.prototype.final=function(e,t){return this.cache.length&&this.ghash(i.concat([this.cache,n],16)),this.ghash(o([0,e,0,t])),this.state},e.exports=a},function(e,t,r){var i=r(124),n=r(1).Buffer,o=r(81),a=r(125),s=r(23),u=r(55),c=r(56);function h(e,t,r){s.call(this),this._cache=new f,this._last=void 0,this._cipher=new u.AES(t),this._prev=n.from(r),this._mode=e,this._autopadding=!0}function f(){this.cache=n.allocUnsafe(0)}function l(e,t,r){var s=o[e.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=n.from(r)),"GCM"!==s.mode&&r.length!==s.iv)throw new TypeError("invalid iv length "+r.length);if("string"==typeof t&&(t=n.from(t)),t.length!==s.key/8)throw new TypeError("invalid key length "+t.length);return"stream"===s.type?new a(s.module,t,r,!0):"auth"===s.type?new i(s.module,t,r,!0):new h(s.module,t,r)}r(4)(h,s),h.prototype._update=function(e){var t,r;this._cache.add(e);for(var i=[];t=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,t),i.push(r);return n.concat(i)},h.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return function(e){var t=e[15];if(t<1||t>16)throw new Error("unable to decrypt data");var r=-1;for(;++r<t;)if(e[r+(16-t)]!==t)throw new Error("unable to decrypt data");if(16===t)return;return e.slice(0,16-t)}(this._mode.decrypt(this,e));if(e)throw new Error("data not multiple of block length")},h.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},f.prototype.add=function(e){this.cache=n.concat([this.cache,e])},f.prototype.get=function(e){var t;if(e){if(this.cache.length>16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},f.prototype.flush=function(){if(this.cache.length)return this.cache},t.createDecipher=function(e,t){var r=o[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=c(t,!1,r.key,r.iv);return l(e,i.key,i.iv)},t.createDecipheriv=l},function(e,t){t["des-ecb"]={key:8,iv:0},t["des-cbc"]=t.des={key:8,iv:8},t["des-ede3-cbc"]=t.des3={key:24,iv:8},t["des-ede3"]={key:24,iv:0},t["des-ede-cbc"]={key:16,iv:8},t["des-ede"]={key:16,iv:0}},function(e,t,r){(function(e){var i=r(126),n=r(238),o=r(239);var a={binary:!0,hex:!0,base64:!0};t.DiffieHellmanGroup=t.createDiffieHellmanGroup=t.getDiffieHellman=function(t){var r=new e(n[t].prime,"hex"),i=new e(n[t].gen,"hex");return new o(r,i)},t.createDiffieHellman=t.DiffieHellman=function t(r,n,s,u){return e.isBuffer(n)||void 0===a[n]?t(r,"binary",n,s):(n=n||"binary",u=u||"binary",s=s||new e([2]),e.isBuffer(s)||(s=new e(s,u)),"number"==typeof r?new o(i(r,s),s,!0):(e.isBuffer(r)||(r=new e(r,n)),new o(r,s,!0)))}}).call(this,r(0).Buffer)},function(e,t){},function(e,t){},function(e){e.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}},function(e,t,r){(function(t){var i=r(7),n=new(r(127)),o=new i(24),a=new i(11),s=new i(10),u=new i(3),c=new i(7),h=r(126),f=r(33);function l(e,r){return r=r||"utf8",t.isBuffer(e)||(e=new t(e,r)),this._pub=new i(e),this}function d(e,r){return r=r||"utf8",t.isBuffer(e)||(e=new t(e,r)),this._priv=new i(e),this}e.exports=m;var p={};function m(e,t,r){this.setGenerator(t),this.__prime=new i(e),this._prime=i.mont(this.__prime),this._primeLen=e.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=l,this.setPrivateKey=d):this._primeCode=8}function g(e,r){var i=new t(e.toArray());return r?i.toString(r):i}Object.defineProperty(m.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(e,t){var r=t.toString("hex"),i=[r,e.toString(16)].join("_");if(i in p)return p[i];var f,l=0;if(e.isEven()||!h.simpleSieve||!h.fermatTest(e)||!n.test(e))return l+=1,l+="02"===r||"05"===r?8:4,p[i]=l,l;switch(n.test(e.shrn(1))||(l+=2),r){case"02":e.mod(o).cmp(a)&&(l+=8);break;case"05":(f=e.mod(s)).cmp(u)&&f.cmp(c)&&(l+=8);break;default:l+=4}return p[i]=l,l}(this.__prime,this.__gen)),this._primeCode}}),m.prototype.generateKeys=function(){return this._priv||(this._priv=new i(f(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},m.prototype.computeSecret=function(e){var r=(e=(e=new i(e)).toRed(this._prime)).redPow(this._priv).fromRed(),n=new t(r.toArray()),o=this.getPrime();if(n.length<o.length){var a=new t(o.length-n.length);a.fill(0),n=t.concat([a,n])}return n},m.prototype.getPublicKey=function(e){return g(this._pub,e)},m.prototype.getPrivateKey=function(e){return g(this._priv,e)},m.prototype.getPrime=function(e){return g(this.__prime,e)},m.prototype.getGenerator=function(e){return g(this._gen,e)},m.prototype.setGenerator=function(e,r){return r=r||"utf8",t.isBuffer(e)||(e=new t(e,r)),this.__gen=e,this._gen=new i(e),this}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var i=r(1).Buffer,n=r(37),o=r(38),a=r(241),s=r(242),u=r(277),c=r(113);function h(e){o.Writable.call(this);var t=c[e];if(!t)throw new Error("Unknown message digest");this._hashType=t.hash,this._hash=n(t.hash),this._tag=t.id,this._signType=t.sign}function f(e){o.Writable.call(this);var t=c[e];if(!t)throw new Error("Unknown message digest");this._hash=n(t.hash),this._tag=t.id,this._signType=t.sign}function l(e){return new h(e)}function d(e){return new f(e)}Object.keys(c).forEach((function(e){c[e].id=i.from(c[e].id,"hex"),c[e.toLowerCase()]=c[e]})),a(h,o.Writable),h.prototype._write=function(e,t,r){this._hash.update(e),r()},h.prototype.update=function(e,t){return this._hash.update("string"==typeof e?i.from(e,t):e),this},h.prototype.sign=function(e,t){this.end();var r=this._hash.digest(),i=s(r,e,this._hashType,this._signType,this._tag);return t?i.toString(t):i},a(f,o.Writable),f.prototype._write=function(e,t,r){this._hash.update(e),r()},f.prototype.update=function(e,t){return this._hash.update("string"==typeof e?i.from(e,t):e),this},f.prototype.verify=function(e,t,r){var n="string"==typeof t?i.from(t,r):t;this.end();var o=this._hash.digest();return u(n,o,e,this._signType,this._tag)},e.exports={Sign:l,Verify:d,createSign:l,createVerify:d}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){"use strict";var i=r(1).Buffer,n=r(111),o=r(83),a=r(29).ec,s=r(133),u=r(59),c=r(138);function h(e,t,r,o){if((e=i.from(e.toArray())).length<t.byteLength()){var a=i.alloc(t.byteLength()-e.length);e=i.concat([a,e])}var s=r.length,u=function(e,t){e=(e=f(e,t)).mod(t);var r=i.from(e.toArray());if(r.length<t.byteLength()){var n=i.alloc(t.byteLength()-r.length);r=i.concat([n,r])}return r}(r,t),c=i.alloc(s);c.fill(1);var h=i.alloc(s);return h=n(o,h).update(c).update(i.from([0])).update(e).update(u).digest(),c=n(o,h).update(c).digest(),{k:h=n(o,h).update(c).update(i.from([1])).update(e).update(u).digest(),v:c=n(o,h).update(c).digest()}}function f(e,t){var r=new s(e),i=(e.length<<3)-t.bitLength();return i>0&&r.ishrn(i),r}function l(e,t,r){var o,a;do{for(o=i.alloc(0);8*o.length<e.bitLength();)t.v=n(r,t.k).update(t.v).digest(),o=i.concat([o,t.v]);a=f(o,e),t.k=n(r,t.k).update(t.v).update(i.from([0])).digest(),t.v=n(r,t.k).update(t.v).digest()}while(-1!==a.cmp(e));return a}function d(e,t,r,i){return e.toRed(s.mont(r)).redPow(t).fromRed().mod(i)}e.exports=function(e,t,r,n,p){var m=u(t);if(m.curve){if("ecdsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong private key type");return function(e,t){var r=c[t.curve.join(".")];if(!r)throw new Error("unknown curve "+t.curve.join("."));var n=new a(r).keyFromPrivate(t.privateKey).sign(e);return i.from(n.toDER())}(e,m)}if("dsa"===m.type){if("dsa"!==n)throw new Error("wrong private key type");return function(e,t,r){var n,o=t.params.priv_key,a=t.params.p,u=t.params.q,c=t.params.g,p=new s(0),m=f(e,u).mod(u),g=!1,b=h(o,u,e,r);for(;!1===g;)n=l(u,b,r),p=d(c,n,a,u),0===(g=n.invm(u).imul(m.add(o.mul(p))).mod(u)).cmpn(0)&&(g=!1,p=new s(0));return function(e,t){e=e.toArray(),t=t.toArray(),128&e[0]&&(e=[0].concat(e));128&t[0]&&(t=[0].concat(t));var r=[48,e.length+t.length+4,2,e.length];return r=r.concat(e,[2,t.length],t),i.from(r)}(p,g)}(e,m,r)}if("rsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong private key type");if(void 0!==t.padding&&1!==t.padding)throw new Error("illegal or unsupported padding mode");e=i.concat([p,e]);for(var g=m.modulus.byteLength(),b=[0,1];e.length+b.length+1<g;)b.push(255);b.push(0);for(var y=-1;++y<e.length;)b.push(e[y]);return o(b,m)},e.exports.getKey=h,e.exports.makeKey=l},function(e,t,r){(function(e){!function(e,t){"use strict";function i(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(244).Buffer}catch(e){}function s(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void i(!1,"Invalid character in "+e)}function u(e,t,r){var i=s(e,r);return r-1>=t&&(i|=s(e,r-1)<<4),i}function c(e,t,r,n){for(var o=0,a=0,s=Math.min(e.length,r),u=t;u<s;u++){var c=e.charCodeAt(u)-48;o*=n,a=c>=49?c-49+10:c>=17?c-17+10:c,i(c>=0&&a<n,"Invalid character"),o+=a}return o}function h(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),i(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<e.length&&(16===t?this._parseHex(e,n,r):(this._parseBase(e,t,n),"le"===r&&this._initArray(this.toArray(),t,r)))},o.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(i(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initArray=function(e,t,r){if(i("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,a,s=0;if("be"===r)for(n=e.length-1,o=0;n>=0;n-=3)a=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(n=0,o=0;n<e.length;n+=3)a=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,a=0;if("be"===r)for(i=e.length-1;i>=t;i-=2)n=u(e,t,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;else for(i=(e.length-t)%2==0?t+1:t;i<e.length;i+=2)n=u(e,t,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;this._strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var o=e.length-r,a=o%i,s=Math.min(o,o-a)+r,u=0,h=r;h<s;h+=i)u=c(e,h,h+i,t),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var f=1;for(u=c(e,h,e.length,t),h=0;h<a;h++)f*=t;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype._move=function(e){h(e,this)},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch(e){o.prototype.inspect=f}else o.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<n|o)).toString(16);o=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),r=0!==o||a!==this.length-1?l[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var c=d[e],h=p[e];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var m=f.modrn(h).toString(e);r=(f=f.idivn(h)).isZero()?m+r:l[c-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},a&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(a,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function m(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],o=0|t.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c<i;c++){for(var h=u>>>26,f=67108863&u,l=Math.min(c,t.length-1),d=Math.max(0,c-e.length+1);d<=l;d++){var p=c-d|0;h+=(a=(n=0|e.words[p])*(o=0|t.words[d])+f)/67108864|0,f=67108863&a}r.words[c]=0|f,u=0|h}return 0!==u?r.words[c]=0|u:r.length--,r._strip()}o.prototype.toArrayLike=function(e,t,r){this._strip();var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,n),a},o.prototype._toArrayLikeLE=function(e,t){for(var r=0,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;e[r++]=255&a,r<e.length&&(e[r++]=a>>8&255),r<e.length&&(e[r++]=a>>16&255),6===o?(r<e.length&&(e[r++]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r<e.length)for(e[r++]=i;r<e.length;)e[r++]=0},o.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;e[r--]=255&a,r>=0&&(e[r--]=a>>8&255),r>=0&&(e[r--]=a>>16&255),6===o?(r>=0&&(e[r--]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r>=0)for(e[r--]=i;r>=0;)e[r--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},o.prototype.ior=function(e){return i(0==(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},o.prototype.iand=function(e){return i(0==(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var i=0;i<r.length;i++)this.words[i]=t.words[i]^r.words[i];if(this!==t)for(;i<t.length;i++)this.words[i]=t.words[i];return this.length=t.length,this._strip()},o.prototype.ixor=function(e){return i(0==(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<n:this.words[r]&~(1<<n),this._strip()},o.prototype.iadd=function(e){var t,r,i;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,i=e):(r=e,i=this);for(var n=0,o=0;o<i.length;o++)t=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&t,n=t>>>26;for(;0!==n&&o<r.length;o++)t=(0|r.words[o])+n,this.words[o]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,i,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=e):(r=e,i=this);for(var o=0,a=0;a<i.length;a++)o=(t=(0|r.words[a])-(0|i.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<r.length;a++)o=(t=(0|r.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var g=function(e,t,r){var i,n,o,a=e.words,s=t.words,u=r.words,c=0,h=0|a[0],f=8191&h,l=h>>>13,d=0|a[1],p=8191&d,m=d>>>13,g=0|a[2],b=8191&g,y=g>>>13,v=0|a[3],_=8191&v,w=v>>>13,S=0|a[4],k=8191&S,I=S>>>13,E=0|a[5],A=8191&E,O=E>>>13,x=0|a[6],P=8191&x,M=x>>>13,T=0|a[7],R=8191&T,B=T>>>13,N=0|a[8],C=8191&N,D=N>>>13,j=0|a[9],L=8191&j,U=j>>>13,H=0|s[0],z=8191&H,F=H>>>13,K=0|s[1],V=8191&K,q=K>>>13,G=0|s[2],Y=8191&G,Z=G>>>13,W=0|s[3],X=8191&W,J=W>>>13,$=0|s[4],Q=8191&$,ee=$>>>13,te=0|s[5],re=8191&te,ie=te>>>13,ne=0|s[6],oe=8191&ne,ae=ne>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,he=0|s[8],fe=8191&he,le=he>>>13,de=0|s[9],pe=8191&de,me=de>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(c+(i=Math.imul(f,z))|0)+((8191&(n=(n=Math.imul(f,F))+Math.imul(l,z)|0))<<13)|0;c=((o=Math.imul(l,F))+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,i=Math.imul(p,z),n=(n=Math.imul(p,F))+Math.imul(m,z)|0,o=Math.imul(m,F);var be=(c+(i=i+Math.imul(f,V)|0)|0)+((8191&(n=(n=n+Math.imul(f,q)|0)+Math.imul(l,V)|0))<<13)|0;c=((o=o+Math.imul(l,q)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,i=Math.imul(b,z),n=(n=Math.imul(b,F))+Math.imul(y,z)|0,o=Math.imul(y,F),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,q)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,q)|0;var ye=(c+(i=i+Math.imul(f,Y)|0)|0)+((8191&(n=(n=n+Math.imul(f,Z)|0)+Math.imul(l,Y)|0))<<13)|0;c=((o=o+Math.imul(l,Z)|0)+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,i=Math.imul(_,z),n=(n=Math.imul(_,F))+Math.imul(w,z)|0,o=Math.imul(w,F),i=i+Math.imul(b,V)|0,n=(n=n+Math.imul(b,q)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,q)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,Z)|0;var ve=(c+(i=i+Math.imul(f,X)|0)|0)+((8191&(n=(n=n+Math.imul(f,J)|0)+Math.imul(l,X)|0))<<13)|0;c=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,i=Math.imul(k,z),n=(n=Math.imul(k,F))+Math.imul(I,z)|0,o=Math.imul(I,F),i=i+Math.imul(_,V)|0,n=(n=n+Math.imul(_,q)|0)+Math.imul(w,V)|0,o=o+Math.imul(w,q)|0,i=i+Math.imul(b,Y)|0,n=(n=n+Math.imul(b,Z)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,Z)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,J)|0;var _e=(c+(i=i+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,ee)|0)+Math.imul(l,Q)|0))<<13)|0;c=((o=o+Math.imul(l,ee)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,i=Math.imul(A,z),n=(n=Math.imul(A,F))+Math.imul(O,z)|0,o=Math.imul(O,F),i=i+Math.imul(k,V)|0,n=(n=n+Math.imul(k,q)|0)+Math.imul(I,V)|0,o=o+Math.imul(I,q)|0,i=i+Math.imul(_,Y)|0,n=(n=n+Math.imul(_,Z)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,Z)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,J)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,ee)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,ee)|0;var we=(c+(i=i+Math.imul(f,re)|0)|0)+((8191&(n=(n=n+Math.imul(f,ie)|0)+Math.imul(l,re)|0))<<13)|0;c=((o=o+Math.imul(l,ie)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,i=Math.imul(P,z),n=(n=Math.imul(P,F))+Math.imul(M,z)|0,o=Math.imul(M,F),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,q)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,q)|0,i=i+Math.imul(k,Y)|0,n=(n=n+Math.imul(k,Z)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,Z)|0,i=i+Math.imul(_,X)|0,n=(n=n+Math.imul(_,J)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,ee)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,ee)|0,i=i+Math.imul(p,re)|0,n=(n=n+Math.imul(p,ie)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ie)|0;var Se=(c+(i=i+Math.imul(f,oe)|0)|0)+((8191&(n=(n=n+Math.imul(f,ae)|0)+Math.imul(l,oe)|0))<<13)|0;c=((o=o+Math.imul(l,ae)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,i=Math.imul(R,z),n=(n=Math.imul(R,F))+Math.imul(B,z)|0,o=Math.imul(B,F),i=i+Math.imul(P,V)|0,n=(n=n+Math.imul(P,q)|0)+Math.imul(M,V)|0,o=o+Math.imul(M,q)|0,i=i+Math.imul(A,Y)|0,n=(n=n+Math.imul(A,Z)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,Z)|0,i=i+Math.imul(k,X)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,ee)|0,i=i+Math.imul(b,re)|0,n=(n=n+Math.imul(b,ie)|0)+Math.imul(y,re)|0,o=o+Math.imul(y,ie)|0,i=i+Math.imul(p,oe)|0,n=(n=n+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var ke=(c+(i=i+Math.imul(f,ue)|0)|0)+((8191&(n=(n=n+Math.imul(f,ce)|0)+Math.imul(l,ue)|0))<<13)|0;c=((o=o+Math.imul(l,ce)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,i=Math.imul(C,z),n=(n=Math.imul(C,F))+Math.imul(D,z)|0,o=Math.imul(D,F),i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,q)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,q)|0,i=i+Math.imul(P,Y)|0,n=(n=n+Math.imul(P,Z)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,Z)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,J)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,ee)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,ee)|0,i=i+Math.imul(_,re)|0,n=(n=n+Math.imul(_,ie)|0)+Math.imul(w,re)|0,o=o+Math.imul(w,ie)|0,i=i+Math.imul(b,oe)|0,n=(n=n+Math.imul(b,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0,i=i+Math.imul(p,ue)|0,n=(n=n+Math.imul(p,ce)|0)+Math.imul(m,ue)|0,o=o+Math.imul(m,ce)|0;var Ie=(c+(i=i+Math.imul(f,fe)|0)|0)+((8191&(n=(n=n+Math.imul(f,le)|0)+Math.imul(l,fe)|0))<<13)|0;c=((o=o+Math.imul(l,le)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,i=Math.imul(L,z),n=(n=Math.imul(L,F))+Math.imul(U,z)|0,o=Math.imul(U,F),i=i+Math.imul(C,V)|0,n=(n=n+Math.imul(C,q)|0)+Math.imul(D,V)|0,o=o+Math.imul(D,q)|0,i=i+Math.imul(R,Y)|0,n=(n=n+Math.imul(R,Z)|0)+Math.imul(B,Y)|0,o=o+Math.imul(B,Z)|0,i=i+Math.imul(P,X)|0,n=(n=n+Math.imul(P,J)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,J)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,ee)|0,i=i+Math.imul(k,re)|0,n=(n=n+Math.imul(k,ie)|0)+Math.imul(I,re)|0,o=o+Math.imul(I,ie)|0,i=i+Math.imul(_,oe)|0,n=(n=n+Math.imul(_,ae)|0)+Math.imul(w,oe)|0,o=o+Math.imul(w,ae)|0,i=i+Math.imul(b,ue)|0,n=(n=n+Math.imul(b,ce)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,ce)|0,i=i+Math.imul(p,fe)|0,n=(n=n+Math.imul(p,le)|0)+Math.imul(m,fe)|0,o=o+Math.imul(m,le)|0;var Ee=(c+(i=i+Math.imul(f,pe)|0)|0)+((8191&(n=(n=n+Math.imul(f,me)|0)+Math.imul(l,pe)|0))<<13)|0;c=((o=o+Math.imul(l,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,i=Math.imul(L,V),n=(n=Math.imul(L,q))+Math.imul(U,V)|0,o=Math.imul(U,q),i=i+Math.imul(C,Y)|0,n=(n=n+Math.imul(C,Z)|0)+Math.imul(D,Y)|0,o=o+Math.imul(D,Z)|0,i=i+Math.imul(R,X)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,J)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,ee)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,ee)|0,i=i+Math.imul(A,re)|0,n=(n=n+Math.imul(A,ie)|0)+Math.imul(O,re)|0,o=o+Math.imul(O,ie)|0,i=i+Math.imul(k,oe)|0,n=(n=n+Math.imul(k,ae)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,ae)|0,i=i+Math.imul(_,ue)|0,n=(n=n+Math.imul(_,ce)|0)+Math.imul(w,ue)|0,o=o+Math.imul(w,ce)|0,i=i+Math.imul(b,fe)|0,n=(n=n+Math.imul(b,le)|0)+Math.imul(y,fe)|0,o=o+Math.imul(y,le)|0;var Ae=(c+(i=i+Math.imul(p,pe)|0)|0)+((8191&(n=(n=n+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;c=((o=o+Math.imul(m,me)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,i=Math.imul(L,Y),n=(n=Math.imul(L,Z))+Math.imul(U,Y)|0,o=Math.imul(U,Z),i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,J)|0)+Math.imul(D,X)|0,o=o+Math.imul(D,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,ee)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,ee)|0,i=i+Math.imul(P,re)|0,n=(n=n+Math.imul(P,ie)|0)+Math.imul(M,re)|0,o=o+Math.imul(M,ie)|0,i=i+Math.imul(A,oe)|0,n=(n=n+Math.imul(A,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,i=i+Math.imul(k,ue)|0,n=(n=n+Math.imul(k,ce)|0)+Math.imul(I,ue)|0,o=o+Math.imul(I,ce)|0,i=i+Math.imul(_,fe)|0,n=(n=n+Math.imul(_,le)|0)+Math.imul(w,fe)|0,o=o+Math.imul(w,le)|0;var Oe=(c+(i=i+Math.imul(b,pe)|0)|0)+((8191&(n=(n=n+Math.imul(b,me)|0)+Math.imul(y,pe)|0))<<13)|0;c=((o=o+Math.imul(y,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,i=Math.imul(L,X),n=(n=Math.imul(L,J))+Math.imul(U,X)|0,o=Math.imul(U,J),i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,ee)|0,i=i+Math.imul(R,re)|0,n=(n=n+Math.imul(R,ie)|0)+Math.imul(B,re)|0,o=o+Math.imul(B,ie)|0,i=i+Math.imul(P,oe)|0,n=(n=n+Math.imul(P,ae)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,ae)|0,i=i+Math.imul(A,ue)|0,n=(n=n+Math.imul(A,ce)|0)+Math.imul(O,ue)|0,o=o+Math.imul(O,ce)|0,i=i+Math.imul(k,fe)|0,n=(n=n+Math.imul(k,le)|0)+Math.imul(I,fe)|0,o=o+Math.imul(I,le)|0;var xe=(c+(i=i+Math.imul(_,pe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(w,pe)|0))<<13)|0;c=((o=o+Math.imul(w,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,i=Math.imul(L,Q),n=(n=Math.imul(L,ee))+Math.imul(U,Q)|0,o=Math.imul(U,ee),i=i+Math.imul(C,re)|0,n=(n=n+Math.imul(C,ie)|0)+Math.imul(D,re)|0,o=o+Math.imul(D,ie)|0,i=i+Math.imul(R,oe)|0,n=(n=n+Math.imul(R,ae)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,ae)|0,i=i+Math.imul(P,ue)|0,n=(n=n+Math.imul(P,ce)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,ce)|0,i=i+Math.imul(A,fe)|0,n=(n=n+Math.imul(A,le)|0)+Math.imul(O,fe)|0,o=o+Math.imul(O,le)|0;var Pe=(c+(i=i+Math.imul(k,pe)|0)|0)+((8191&(n=(n=n+Math.imul(k,me)|0)+Math.imul(I,pe)|0))<<13)|0;c=((o=o+Math.imul(I,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,i=Math.imul(L,re),n=(n=Math.imul(L,ie))+Math.imul(U,re)|0,o=Math.imul(U,ie),i=i+Math.imul(C,oe)|0,n=(n=n+Math.imul(C,ae)|0)+Math.imul(D,oe)|0,o=o+Math.imul(D,ae)|0,i=i+Math.imul(R,ue)|0,n=(n=n+Math.imul(R,ce)|0)+Math.imul(B,ue)|0,o=o+Math.imul(B,ce)|0,i=i+Math.imul(P,fe)|0,n=(n=n+Math.imul(P,le)|0)+Math.imul(M,fe)|0,o=o+Math.imul(M,le)|0;var Me=(c+(i=i+Math.imul(A,pe)|0)|0)+((8191&(n=(n=n+Math.imul(A,me)|0)+Math.imul(O,pe)|0))<<13)|0;c=((o=o+Math.imul(O,me)|0)+(n>>>13)|0)+(Me>>>26)|0,Me&=67108863,i=Math.imul(L,oe),n=(n=Math.imul(L,ae))+Math.imul(U,oe)|0,o=Math.imul(U,ae),i=i+Math.imul(C,ue)|0,n=(n=n+Math.imul(C,ce)|0)+Math.imul(D,ue)|0,o=o+Math.imul(D,ce)|0,i=i+Math.imul(R,fe)|0,n=(n=n+Math.imul(R,le)|0)+Math.imul(B,fe)|0,o=o+Math.imul(B,le)|0;var Te=(c+(i=i+Math.imul(P,pe)|0)|0)+((8191&(n=(n=n+Math.imul(P,me)|0)+Math.imul(M,pe)|0))<<13)|0;c=((o=o+Math.imul(M,me)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,i=Math.imul(L,ue),n=(n=Math.imul(L,ce))+Math.imul(U,ue)|0,o=Math.imul(U,ce),i=i+Math.imul(C,fe)|0,n=(n=n+Math.imul(C,le)|0)+Math.imul(D,fe)|0,o=o+Math.imul(D,le)|0;var Re=(c+(i=i+Math.imul(R,pe)|0)|0)+((8191&(n=(n=n+Math.imul(R,me)|0)+Math.imul(B,pe)|0))<<13)|0;c=((o=o+Math.imul(B,me)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,i=Math.imul(L,fe),n=(n=Math.imul(L,le))+Math.imul(U,fe)|0,o=Math.imul(U,le);var Be=(c+(i=i+Math.imul(C,pe)|0)|0)+((8191&(n=(n=n+Math.imul(C,me)|0)+Math.imul(D,pe)|0))<<13)|0;c=((o=o+Math.imul(D,me)|0)+(n>>>13)|0)+(Be>>>26)|0,Be&=67108863;var Ne=(c+(i=Math.imul(L,pe))|0)+((8191&(n=(n=Math.imul(L,me))+Math.imul(U,pe)|0))<<13)|0;return c=((o=Math.imul(U,me))+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,u[0]=ge,u[1]=be,u[2]=ye,u[3]=ve,u[4]=_e,u[5]=we,u[6]=Se,u[7]=ke,u[8]=Ie,u[9]=Ee,u[10]=Ae,u[11]=Oe,u[12]=xe,u[13]=Pe,u[14]=Me,u[15]=Te,u[16]=Re,u[17]=Be,u[18]=Ne,0!==c&&(u[19]=c,r.length++),r};function b(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var a=n;n=0;for(var s=67108863&i,u=Math.min(o,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var h=o-c,f=(0|e.words[h])*(0|t.words[c]),l=67108863&f;s=67108863&(l=l+s|0),n+=(a=(a=a+(f/67108864|0)|0)+(l>>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(e,t,r){return b(e,t,r)}function v(e,t){this.x=e,this.y=t}Math.imul||(g=m),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?g(this,e,t):r<63?m(this,e,t):r<1024?b(this,e,t):y(this,e,t)},v.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,i=0;i<e;i++)t[i]=this.revBin(i,r,e);return t},v.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var i=0,n=0;n<t;n++)i|=(1&e)<<t-n-1,e>>=1;return i},v.prototype.permute=function(e,t,r,i,n,o){for(var a=0;a<o;a++)i[a]=t[e[a]],n[a]=r[e[a]]},v.prototype.transform=function(e,t,r,i,n,o){this.permute(o,e,t,r,i,n);for(var a=1;a<n;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),h=0;h<n;h+=s)for(var f=u,l=c,d=0;d<a;d++){var p=r[h+d],m=i[h+d],g=r[h+d+a],b=i[h+d+a],y=f*g-l*b;b=f*b+l*g,g=y,r[h+d]=p+g,i[h+d]=m+b,r[h+d+a]=p-g,i[h+d+a]=m-b,d!==s&&(y=u*f-c*l,l=u*l+c*f,f=y)}},v.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},v.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=e[i];e[i]=e[r-i-1],e[r-i-1]=n,n=t[i],t[i]=-t[r-i-1],t[r-i-1]=-n}},v.prototype.normalize13b=function(e,t){for(var r=0,i=0;i<t/2;i++){var n=8192*Math.round(e[2*i+1]/t)+Math.round(e[2*i]/t)+r;e[i]=67108863&n,r=n<67108864?0:n/67108864|0}return e},v.prototype.convert13b=function(e,t,r,n){for(var o=0,a=0;a<t;a++)o+=0|e[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*t;a<n;++a)r[a]=0;i(0===o),i(0==(-8192&o))},v.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},v.prototype.mulp=function(e,t,r){var i=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(i),o=this.stub(i),a=new Array(i),s=new Array(i),u=new Array(i),c=new Array(i),h=new Array(i),f=new Array(i),l=r.words;l.length=i,this.convert13b(e.words,e.length,a,i),this.convert13b(t.words,t.length,c,i),this.transform(a,o,s,u,i,n),this.transform(c,o,h,f,i,n);for(var d=0;d<i;d++){var p=s[d]*h[d]-u[d]*f[d];u[d]=s[d]*f[d]+u[d]*h[d],s[d]=p}return this.conjugate(s,u,i),this.transform(s,u,l,o,i,n),this.conjugate(l,o,i),this.normalize13b(l,i),r.negative=e.negative^t.negative,r.length=e.length+t.length,r._strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),y(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){var t=e<0;t&&(e=-e),i("number"==typeof e),i(e<67108864);for(var r=0,n=0;n<this.length;n++){var o=(0|this.words[n])*e,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[n]=67108863&a}return 0!==r&&(this.words[n]=r,this.length++),this.length=0===e?1:this.length,t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var i=r/26|0,n=r%26;t[r]=e.words[i]>>>n&1}return t}(e);if(0===t.length)return new o(1);for(var r=this,i=0;i<t.length&&0===t[i];i++,r=r.sqr());if(++i<t.length)for(var n=r.sqr();i<t.length;i++,n=n.sqr())0!==t[i]&&(r=r.mul(n));return r},o.prototype.iushln=function(e){i("number"==typeof e&&e>=0);var t,r=e%26,n=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<r;this.words[t]=u|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t<n;t++)this.words[t]=0;this.length+=n}return this._strip()},o.prototype.ishln=function(e){return i(0===this.negative),this.iushln(e)},o.prototype.iushrn=function(e,t,r){var n;i("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(n-=a,n=Math.max(0,n),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var h=0;for(c=this.length-1;c>=0&&(0!==h||c>=n);c--){var f=0|this.words[c];this.words[c]=h<<26-o|f>>>o,h=f&s}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,r){return i(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,n=1<<t;return!(this.length<=r)&&!!(this.words[r]&n)},o.prototype.imaskn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(i(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 n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return 0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return i("number"==typeof e),i(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(i("number"==typeof e),i(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,r){var n,o,a=e.length+r;this._expand(a);var s=0;for(n=0;n<e.length;n++){o=(0|this.words[n+r])+s;var u=(0|e.words[n])*t;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[n+r]=67108863&o}for(;n<this.length-r;n++)s=(o=(0|this.words[n+r])+s)>>26,this.words[n+r]=67108863&o;if(0===s)return this._strip();for(i(-1===s),s=0,n=0;n<this.length;n++)s=(o=-(0|this.words[n])+s)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),i=this.clone(),n=e,a=0|n.words[n.length-1];0!==(r=26-this._countBits(a))&&(n=n.ushln(r),i.iushln(r),a=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==t){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var h=i.clone()._ishlnsubmul(n,1,u);0===h.negative&&(i=h,s&&(s.words[u]=1));for(var f=u-1;f>=0;f--){var l=67108864*(0|i.words[n.length+f])+(0|i.words[n.length+f-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(n,l,f);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(n,1,f),i.isZero()||(i.negative^=1);s&&(s.words[f]=l)}return s&&s._strip(),i._strip(),"div"!==t&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},o.prototype.divmod=function(e,t,r){return i(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(n=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:n,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var n,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),i(e<=67108863);for(var r=(1<<26)%e,n=0,o=this.length-1;o>=0;o--)n=(r*n+(0|this.words[o]))%e;return t?-n:n},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),i(e<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*r;this.words[n]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var h=r.clone(),f=t.clone();!t.isZero();){for(var l=0,d=1;0==(t.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(t.iushrn(l);l-- >0;)(n.isOdd()||a.isOdd())&&(n.iadd(h),a.isub(f)),n.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(h),u.isub(f)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(s),a.isub(u)):(r.isub(t),s.isub(n),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},o.prototype._invmp=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n,a=new o(1),s=new o(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,h=1;0==(t.words[0]&h)&&c<26;++c,h<<=1);if(c>0)for(t.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var f=0,l=1;0==(r.words[0]&l)&&f<26;++f,l<<=1);if(f>0)for(r.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(n=0===t.cmpn(1)?a:s).cmpn(0)<0&&n.iadd(e),n},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)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(i)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){i("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var o=n,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),i(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:n<e?-1:1}return 0!==this.negative?0|-t:t},o.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){i<n?t=-1:i>n&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new A(e)},o.prototype.toRed=function(e){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return i(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return i(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var _={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function S(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function k(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function I(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function O(e){A.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var i=t<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},n(S,w),S.prototype.split=function(e,t){for(var r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var n=e.words[9];for(t.words[t.length++]=4194303&n,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,e.words[i-10]=n,0===n&&e.length>10?e.length-=10:e.length-=9},S.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var i=0|e.words[r];t+=977*i,e.words[r]=67108863&t,t=64*i+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(k,w),n(I,w),n(E,w),E.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var i=19*(0|e.words[r])+t,n=67108863&i;i>>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(_[e])return _[e];var t;if("k256"===e)t=new S;else if("p224"===e)t=new k;else if("p192"===e)t=new I;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return _[e]=t,t},A.prototype._verify1=function(e){i(0===e.negative,"red works only with positives"),i(e.red,"red works only with red numbers")},A.prototype._verify2=function(e,t){i(0==(e.negative|t.negative),"red works only with positives"),i(e.red&&e.red===t.red,"red works only with red numbers")},A.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(h(e,e.umod(this.m)._forceRed(this)),e)},A.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},A.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},A.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},A.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},A.prototype.isqr=function(e){return this.imul(e,e.clone())},A.prototype.sqr=function(e){return this.mul(e,e)},A.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(i(t%2==1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),a=0;!n.isZero()&&0===n.andln(1);)a++,n.iushrn(1);i(!n.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,c).cmp(u);)h.redIAdd(u);for(var f=this.pow(h,n),l=this.pow(e,n.addn(1).iushrn(1)),d=this.pow(e,n),p=a;0!==d.cmp(s);){for(var m=d,g=0;0!==m.cmp(s);g++)m=m.redSqr();i(g<p);var b=this.pow(f,new o(1).iushln(p-g-1));l=l.redMul(b),f=b.redSqr(),d=d.redMul(f),p=g}return l},A.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},A.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=e;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],e);var n=r[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),i=t.length-1;i>=0;i--){for(var c=t.words[i],h=u-1;h>=0;h--){var f=c>>h&1;n!==r[0]&&(n=this.sqr(n)),0!==f||0!==a?(a<<=1,a|=f,(4===++s||0===i&&0===h)&&(n=this.mul(n,r[a]),s=0,a=0)):s=0}u=26}return n},A.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},A.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new O(e)},n(O,A),O.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},O.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},O.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).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)},O.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},O.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,this)}).call(this,r(24)(e))},function(e,t){},function(e){e.exports={name:"elliptic",version:"6.6.1",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny <fedor@indutny.com>",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}},function(e,t,r){"use strict";var i=r(15),n=r(7),o=r(84),a=r(57),s=i.assert;function u(e){a.call(this,"short",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function c(e,t,r,i){a.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new n(t,16),this.y=new n(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function h(e,t,r,i){a.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new n(0)):(this.x=new n(t,16),this.y=new n(r,16),this.z=new n(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,a),e.exports=u,u.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new n(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);t=(t=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(e.lambda)r=new n(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?r=o[0]:(r=o[1],s(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new n(e.a,16),b:new n(e.b,16)}})):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:n.mont(e),r=new n(2).toRed(t).redInvm(),i=r.redNeg(),o=new n(3).toRed(t).redNeg().redSqrt().redMul(r);return[i.redAdd(o).fromRed(),i.redSub(o).fromRed()]},u.prototype._getEndoBasis=function(e){for(var t,r,i,o,a,s,u,c,h,f=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=e,d=this.n.clone(),p=new n(1),m=new n(0),g=new n(0),b=new n(1),y=0;0!==l.cmpn(0);){var v=d.div(l);c=d.sub(v.mul(l)),h=g.sub(v.mul(p));var _=b.sub(v.mul(m));if(!i&&c.cmp(f)<0)t=u.neg(),r=p,i=c.neg(),o=h;else if(i&&2==++y)break;u=c,d=l,l=c,g=p,p=h,b=m,m=_}a=c.neg(),s=h;var w=i.sqr().add(o.sqr());return a.sqr().add(s.sqr()).cmp(w)>=0&&(a=t,s=r),i.negative&&(i=i.neg(),o=o.neg()),a.negative&&(a=a.neg(),s=s.neg()),[{a:i,b:o},{a:a,b:s}]},u.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],i=t[1],n=i.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=n.mul(r.a),s=o.mul(i.a),u=n.mul(r.b),c=o.mul(i.b);return{k1:e.sub(a).sub(s),k2:u.add(c).neg()}},u.prototype.pointFromX=function(e,t){(e=new n(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=i.fromRed().isOdd();return(t&&!o||!t&&o)&&(i=i.redNeg()),this.point(e,i)},u.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,i=this.a.redMul(t),n=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},u.prototype._endoWnafMulAdd=function(e,t,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,o=0;o<e.length;o++){var a=this._endoSplit(t[o]),s=e[o],u=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),u=u.neg(!0)),i[2*o]=s,i[2*o+1]=u,n[2*o]=a.k1,n[2*o+1]=a.k2}for(var c=this._wnafMulAdd(1,i,n,2*o,r),h=0;h<2*o;h++)i[h]=null,n[h]=null;return c},o(c,a.BasePoint),u.prototype.point=function(e,t,r){return new c(this,e,t,r)},u.prototype.pointFromJSON=function(e,t){return c.fromJSON(this,e,t)},c.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,i=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(i)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(i)}}}return t}},c.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},c.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var i=e.point(t[0],t[1],r);if(!t[2])return i;function n(t){return e.point(t[0],t[1],r)}var o=t[2];return i.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[i].concat(o.doubles.points.map(n))},naf:o.naf&&{wnd:o.naf.wnd,points:[i].concat(o.naf.points.map(n))}},i},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return this.inf},c.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},c.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),i=e.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(i),o=n.redSqr().redISub(this.x.redAdd(this.x)),a=n.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(e){return e=new n(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,r){var i=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},c.prototype.jmulAdd=function(e,t,r){var i=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},c.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},c.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,i=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return t},c.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(h,a.BasePoint),u.prototype.jpoint=function(e,t,r){return new h(this,e,t,r)},h.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(r,i)},h.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},h.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(t),n=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=i.redSub(n),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),h=c.redMul(s),f=i.redMul(c),l=u.redSqr().redIAdd(h).redISub(f).redISub(f),d=u.redMul(f.redISub(l)).redISub(o.redMul(h)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(l,d,p)},h.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,i=e.x.redMul(t),n=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(i),s=n.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),h=r.redMul(u),f=s.redSqr().redIAdd(c).redISub(h).redISub(h),l=s.redMul(h.redISub(f)).redISub(n.redMul(c)),d=this.z.redMul(a);return this.curve.jpoint(f,l,d)},h.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t<e;t++)r=r.dbl();return r}var i=this.curve.a,n=this.curve.tinv,o=this.x,a=this.y,s=this.z,u=s.redSqr().redSqr(),c=a.redAdd(a);for(t=0;t<e;t++){var h=o.redSqr(),f=c.redSqr(),l=f.redSqr(),d=h.redAdd(h).redIAdd(h).redIAdd(i.redMul(u)),p=o.redMul(f),m=d.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),b=d.redMul(g);b=b.redIAdd(b).redISub(l);var y=c.redMul(s);t+1<e&&(u=u.redMul(l)),o=m,s=y,c=b}return this.curve.jpoint(o,c.redMul(n),s)},h.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},h.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),o=n.redSqr(),a=this.x.redAdd(n).redSqr().redISub(i).redISub(o);a=a.redIAdd(a);var s=i.redAdd(i).redIAdd(i),u=s.redSqr().redISub(a).redISub(a),c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),e=u,t=s.redMul(a.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var h=this.x.redSqr(),f=this.y.redSqr(),l=f.redSqr(),d=this.x.redAdd(f).redSqr().redISub(h).redISub(l);d=d.redIAdd(d);var p=h.redAdd(h).redIAdd(h),m=p.redSqr(),g=l.redIAdd(l);g=(g=g.redIAdd(g)).redIAdd(g),e=m.redISub(d).redISub(d),t=p.redMul(d.redISub(e)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},h.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),o=n.redSqr(),a=this.x.redAdd(n).redSqr().redISub(i).redISub(o);a=a.redIAdd(a);var s=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),u=s.redSqr().redISub(a).redISub(a);e=u;var c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),t=s.redMul(a.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var h=this.z.redSqr(),f=this.y.redSqr(),l=this.x.redMul(f),d=this.x.redSub(h).redMul(this.x.redAdd(h));d=d.redAdd(d).redIAdd(d);var p=l.redIAdd(l),m=(p=p.redIAdd(p)).redAdd(p);e=d.redSqr().redISub(m),r=this.y.redAdd(this.z).redSqr().redISub(f).redISub(h);var g=f.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),t=d.redMul(p.redISub(e)).redISub(g)}return this.curve.jpoint(e,t,r)},h.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,i=this.z,n=i.redSqr().redSqr(),o=t.redSqr(),a=r.redSqr(),s=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(n)),u=t.redAdd(t),c=(u=u.redIAdd(u)).redMul(a),h=s.redSqr().redISub(c.redAdd(c)),f=c.redISub(h),l=a.redSqr();l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=s.redMul(f).redISub(l),p=r.redAdd(r).redMul(i);return this.curve.jpoint(h,d,p)},h.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),i=t.redSqr(),n=e.redAdd(e).redIAdd(e),o=n.redSqr(),a=this.x.redAdd(t).redSqr().redISub(e).redISub(i),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),u=i.redIAdd(i);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=n.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(u),h=t.redMul(c);h=(h=h.redIAdd(h)).redIAdd(h);var f=this.x.redMul(s).redISub(h);f=(f=f.redIAdd(f)).redIAdd(f);var l=this.y.redMul(c.redMul(u.redISub(c)).redISub(a.redMul(s)));l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=this.z.redAdd(a).redSqr().redISub(r).redISub(s);return this.curve.jpoint(f,l,d)},h.prototype.mul=function(e,t){return e=new n(e,t),this.curve._wnafMul(this,e)},h.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var i=t.redMul(this.z),n=r.redMul(e.z);return 0===this.y.redMul(n).redISub(e.y.redMul(i)).cmpn(0)},h.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var i=e.clone(),n=this.curve.redN.redMul(t);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},h.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},h.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(e,t,r){"use strict";var i=r(7),n=r(84),o=r(57),a=r(15);function s(e){o.call(this,"mont",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(e,t,r){o.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(t,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}n(s,o),e.exports=s,s.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),i=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===i.redSqrt().redSqr().cmp(i)},n(u,o.BasePoint),s.prototype.decodePoint=function(e,t){return this.point(a.toArray(e,t),1)},s.prototype.point=function(e,t){return new u(this,e,t)},s.prototype.pointFromJSON=function(e){return u.fromJSON(this,e)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(e,t){return new u(e,t[0],t[1]||e.one)},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),i=e.redMul(t),n=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(r),a=n.redMul(i),s=t.z.redMul(o.redAdd(a).redSqr()),u=t.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},u.prototype.mul=function(e){for(var t=e.clone(),r=this,i=this.curve.point(null,null),n=[];0!==t.cmpn(0);t.iushrn(1))n.push(t.andln(1));for(var o=n.length-1;o>=0;o--)0===n[o]?(r=r.diffAdd(i,this),i=i.dbl()):(i=r.diffAdd(i,this),r=r.dbl());return i},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(e,t,r){"use strict";var i=r(15),n=r(7),o=r(84),a=r(57),s=i.assert;function u(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,a.call(this,"edwards",e),this.a=new n(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new n(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new n(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),s(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function c(e,t,r,i,o){a.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new n(t,16),this.y=new n(r,16),this.z=i?new n(i,16):this.curve.one,this.t=o&&new n(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}o(u,a),e.exports=u,u.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},u.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},u.prototype.jpoint=function(e,t,r,i){return this.point(e,t,r,i)},u.prototype.pointFromX=function(e,t){(e=new n(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),i=this.c2.redSub(this.a.redMul(r)),o=this.one.redSub(this.c2.redMul(this.d).redMul(r)),a=i.redMul(o.redInvm()),s=a.redSqrt();if(0!==s.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");var u=s.fromRed().isOdd();return(t&&!u||!t&&u)&&(s=s.redNeg()),this.point(e,s)},u.prototype.pointFromY=function(e,t){(e=new n(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),i=r.redSub(this.c2),o=r.redMul(this.d).redMul(this.c2).redSub(this.a),a=i.redMul(o.redInvm());if(0===a.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var s=a.redSqrt();if(0!==s.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");return s.fromRed().isOdd()!==t&&(s=s.redNeg()),this.point(s,e)},u.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),i=t.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===i.cmp(n)},o(c,a.BasePoint),u.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},u.prototype.point=function(e,t,r,i){return new c(this,e,t,r,i)},c.fromJSON=function(e,t){return new c(e,t[0],t[1],t[2])},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},c.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(e),n=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=i.redAdd(t),a=o.redSub(r),s=i.redSub(t),u=n.redMul(a),c=o.redMul(s),h=n.redMul(s),f=a.redMul(o);return this.curve.point(u,c,f,h)},c.prototype._projDbl=function(){var e,t,r,i,n,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var c=(i=this.curve._mulA(s)).redAdd(u);this.zOne?(e=a.redSub(s).redSub(u).redMul(c.redSub(this.curve.two)),t=c.redMul(i.redSub(u)),r=c.redSqr().redSub(c).redSub(c)):(n=this.z.redSqr(),o=c.redSub(n).redISub(n),e=a.redSub(s).redISub(u).redMul(o),t=c.redMul(i.redSub(u)),r=c.redMul(o))}else i=s.redAdd(u),n=this.curve._mulC(this.z).redSqr(),o=i.redSub(n).redSub(n),e=this.curve._mulC(a.redISub(i)).redMul(o),t=this.curve._mulC(i).redMul(s.redISub(u)),r=i.redMul(o);return this.curve.point(e,t,r)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),n=this.z.redMul(e.z.redAdd(e.z)),o=r.redSub(t),a=n.redSub(i),s=n.redAdd(i),u=r.redAdd(t),c=o.redMul(a),h=s.redMul(u),f=o.redMul(u),l=a.redMul(s);return this.curve.point(c,h,l,f)},c.prototype._projAdd=function(e){var t,r,i=this.z.redMul(e.z),n=i.redSqr(),o=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(o).redMul(a),u=n.redSub(s),c=n.redAdd(s),h=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a),f=i.redMul(u).redMul(h);return this.curve.twisted?(t=i.redMul(c).redMul(a.redSub(this.curve._mulA(o))),r=u.redMul(c)):(t=i.redMul(c).redMul(a.redSub(o)),r=this.curve._mulC(u).redMul(c)),this.curve.point(f,t,r)},c.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},c.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},c.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},c.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},c.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(i),0===this.x.cmp(t))return!0}},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add},function(e,t,r){"use strict";t.sha1=r(250),t.sha224=r(251),t.sha256=r(131),t.sha384=r(252),t.sha512=r(132)},function(e,t,r){"use strict";var i=r(19),n=r(44),o=r(130),a=i.rotl32,s=i.sum32,u=i.sum32_5,c=o.ft_1,h=n.BlockHash,f=[1518500249,1859775393,2400959708,3395469782];function l(){if(!(this instanceof l))return new l;h.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}i.inherits(l,h),e.exports=l,l.blockSize=512,l.outSize=160,l.hmacStrength=80,l.padLength=64,l.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;i<r.length;i++)r[i]=a(r[i-3]^r[i-8]^r[i-14]^r[i-16],1);var n=this.h[0],o=this.h[1],h=this.h[2],l=this.h[3],d=this.h[4];for(i=0;i<r.length;i++){var p=~~(i/20),m=u(a(n,5),c(p,o,h,l),d,r[i],f[p]);d=l,l=h,h=a(o,30),o=n,n=m}this.h[0]=s(this.h[0],n),this.h[1]=s(this.h[1],o),this.h[2]=s(this.h[2],h),this.h[3]=s(this.h[3],l),this.h[4]=s(this.h[4],d)},l.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},function(e,t,r){"use strict";var i=r(19),n=r(131);function o(){if(!(this instanceof o))return new o;n.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}i.inherits(o,n),e.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h.slice(0,7),"big"):i.split32(this.h.slice(0,7),"big")}},function(e,t,r){"use strict";var i=r(19),n=r(132);function o(){if(!(this instanceof o))return new o;n.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}i.inherits(o,n),e.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h.slice(0,12),"big"):i.split32(this.h.slice(0,12),"big")}},function(e,t,r){"use strict";var i=r(19),n=r(44),o=i.rotl32,a=i.sum32,s=i.sum32_3,u=i.sum32_4,c=n.BlockHash;function h(){if(!(this instanceof h))return new h;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function f(e,t,r,i){return e<=15?t^r^i:e<=31?t&r|~t&i:e<=47?(t|~r)^i:e<=63?t&i|r&~i:t^(r|~i)}function l(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function d(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}i.inherits(h,c),t.ripemd160=h,h.blockSize=512,h.outSize=160,h.hmacStrength=192,h.padLength=64,h.prototype._update=function(e,t){for(var r=this.h[0],i=this.h[1],n=this.h[2],c=this.h[3],h=this.h[4],y=r,v=i,_=n,w=c,S=h,k=0;k<80;k++){var I=a(o(u(r,f(k,i,n,c),e[p[k]+t],l(k)),g[k]),h);r=h,h=c,c=o(n,10),n=i,i=I,I=a(o(u(y,f(79-k,v,_,w),e[m[k]+t],d(k)),b[k]),S),y=S,S=w,w=o(_,10),_=v,v=I}I=s(this.h[1],n,w),this.h[1]=s(this.h[2],c,S),this.h[2]=s(this.h[3],h,y),this.h[3]=s(this.h[4],r,v),this.h[4]=s(this.h[0],i,_),this.h[0]=I},h.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"little"):i.split32(this.h,"little")};var p=[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],m=[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],g=[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],b=[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]},function(e,t,r){"use strict";var i=r(19),n=r(14);function o(e,t,r){if(!(this instanceof o))return new o(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(i.toArray(t,r))}e.exports=o,o.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),n(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},o.prototype.update=function(e,t){return this.inner.update(e,t),this},o.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}},function(e,t){e.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},function(e,t,r){"use strict";var i=r(7),n=r(257),o=r(15),a=r(85),s=r(82),u=o.assert,c=r(258),h=r(259);function f(e){if(!(this instanceof f))return new f(e);"string"==typeof e&&(u(Object.prototype.hasOwnProperty.call(a,e),"Unknown curve "+e),e=a[e]),e instanceof a.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=f,f.prototype.keyPair=function(e){return new c(this,e)},f.prototype.keyFromPrivate=function(e,t){return c.fromPrivate(this,e,t)},f.prototype.keyFromPublic=function(e,t){return c.fromPublic(this,e,t)},f.prototype.genKeyPair=function(e){e||(e={});for(var t=new n({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||s(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new i(2));;){var a=new i(t.generate(r));if(!(a.cmp(o)>0))return a.iaddn(1),this.keyFromPrivate(a)}},f.prototype._truncateToN=function(e,t,r){var n;if(i.isBN(e)||"number"==typeof e)n=(e=new i(e,16)).byteLength();else if("object"==typeof e)n=e.length,e=new i(e,16);else{var o=e.toString();n=o.length+1>>>1,e=new i(o,16)}"number"!=typeof r&&(r=8*n);var a=r-this.n.bitLength();return a>0&&(e=e.ushrn(a)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},f.prototype.sign=function(e,t,r,o){if("object"==typeof r&&(o=r,r=null),o||(o={}),"string"!=typeof e&&"number"!=typeof e&&!i.isBN(e)){u("object"==typeof e&&e&&"number"==typeof e.length,"Expected message to be an array-like, a hex string, or a BN instance"),u(e.length>>>0===e.length);for(var a=0;a<e.length;a++)u((255&e[a])===e[a])}t=this.keyFromPrivate(t,r),e=this._truncateToN(e,!1,o.msgBitLength),u(!e.isNeg(),"Can not sign a negative message");var s=this.n.byteLength(),c=t.getPrivate().toArray("be",s),f=e.toArray("be",s);u(new i(f).eq(e),"Can not sign message");for(var l=new n({hash:this.hash,entropy:c,nonce:f,pers:o.pers,persEnc:o.persEnc||"utf8"}),d=this.n.sub(new i(1)),p=0;;p++){var m=o.k?o.k(p):new i(l.generate(this.n.byteLength()));if(!((m=this._truncateToN(m,!0)).cmpn(1)<=0||m.cmp(d)>=0)){var g=this.g.mul(m);if(!g.isInfinity()){var b=g.getX(),y=b.umod(this.n);if(0!==y.cmpn(0)){var v=m.invm(this.n).mul(y.mul(t.getPrivate()).iadd(e));if(0!==(v=v.umod(this.n)).cmpn(0)){var _=(g.getY().isOdd()?1:0)|(0!==b.cmp(y)?2:0);return o.canonical&&v.cmp(this.nh)>0&&(v=this.n.sub(v),_^=1),new h({r:y,s:v,recoveryParam:_})}}}}}},f.prototype.verify=function(e,t,r,i,n){n||(n={}),e=this._truncateToN(e,!1,n.msgBitLength),r=this.keyFromPublic(r,i);var o=(t=new h(t,"hex")).r,a=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var s,u=a.invm(this.n),c=u.mul(e).umod(this.n),f=u.mul(o).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(c,r.getPublic(),f)).isInfinity()&&s.eqXToP(o):!(s=this.g.mulAdd(c,r.getPublic(),f)).isInfinity()&&0===s.getX().umod(this.n).cmp(o)},f.prototype.recoverPubKey=function(e,t,r,n){u((3&r)===r,"The recovery param is more than two bits"),t=new h(t,n);var o=this.n,a=new i(e),s=t.r,c=t.s,f=1&r,l=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");s=l?this.curve.pointFromX(s.add(this.curve.n),f):this.curve.pointFromX(s,f);var d=t.r.invm(o),p=o.sub(a).mul(d).umod(o),m=c.mul(d).umod(o);return this.g.mulAdd(p,s,m)},f.prototype.getKeyRecoveryParam=function(e,t,r,i){if(null!==(t=new h(t,i)).recoveryParam)return t.recoveryParam;for(var n=0;n<4;n++){var o;try{o=this.recoverPubKey(e,t,n)}catch(e){continue}if(o.eq(r))return n}throw new Error("Unable to find valid recovery factor")}},function(e,t,r){"use strict";var i=r(58),n=r(128),o=r(14);function a(e){if(!(this instanceof a))return new a(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=n.toArray(e.entropy,e.entropyEnc||"hex"),r=n.toArray(e.nonce,e.nonceEnc||"hex"),i=n.toArray(e.pers,e.persEnc||"hex");o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,i)}e.exports=a,a.prototype._init=function(e,t,r){var i=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n<this.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},a.prototype._hmac=function(){return new i.hmac(this.hash,this.K)},a.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},a.prototype.reseed=function(e,t,r,i){"string"!=typeof t&&(i=r,r=t,t=null),e=n.toArray(e,t),r=n.toArray(r,i),o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},a.prototype.generate=function(e,t,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(i=r,r=t,t=null),r&&(r=n.toArray(r,i||"hex"),this._update(r));for(var o=[];o.length<e;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var a=o.slice(0,e);return this._update(r),this._reseed++,n.encode(a,t)}},function(e,t,r){"use strict";var i=r(7),n=r(15).assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=o,o.fromPublic=function(e,t,r){return t instanceof o?t:new o(e,{pub:t,pubEnc:r})},o.fromPrivate=function(e,t,r){return t instanceof o?t:new o(e,{priv:t,privEnc:r})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new i(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?n(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||n(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.validate()||n(e.validate(),"public point not validated"),e.mul(this.priv).getX()},o.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},o.prototype.verify=function(e,t,r){return this.ec.verify(e,t,this,void 0,r)},o.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},function(e,t,r){"use strict";var i=r(7),n=r(15),o=n.assert;function a(e,t){if(e instanceof a)return e;this._importDER(e,t)||(o(e.r&&e.s,"Signature without r or s"),this.r=new i(e.r,16),this.s=new i(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function s(){this.place=0}function u(e,t){var r=e[t.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;if(0===e[t.place])return!1;for(var n=0,o=0,a=t.place;o<i;o++,a++)n<<=8,n|=e[a],n>>>=0;return!(n<=127)&&(t.place=a,n)}function c(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function h(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}e.exports=a,a.prototype._importDER=function(e,t){e=n.toArray(e,t);var r=new s;if(48!==e[r.place++])return!1;var o=u(e,r);if(!1===o)return!1;if(o+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var a=u(e,r);if(!1===a)return!1;if(0!=(128&e[r.place]))return!1;var c=e.slice(r.place,a+r.place);if(r.place+=a,2!==e[r.place++])return!1;var h=u(e,r);if(!1===h)return!1;if(e.length!==h+r.place)return!1;if(0!=(128&e[r.place]))return!1;var f=e.slice(r.place,h+r.place);if(0===c[0]){if(!(128&c[1]))return!1;c=c.slice(1)}if(0===f[0]){if(!(128&f[1]))return!1;f=f.slice(1)}return this.r=new i(c),this.s=new i(f),this.recoveryParam=null,!0},a.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=c(t),r=c(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];h(i,t.length),(i=i.concat(t)).push(2),h(i,r.length);var o=i.concat(r),a=[48];return h(a,o.length),a=a.concat(o),n.encode(a,e)}},function(e,t,r){"use strict";var i=r(58),n=r(85),o=r(15),a=o.assert,s=o.parseBytes,u=r(261),c=r(262);function h(e){if(a("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof h))return new h(e);e=n[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=i.sha512}e.exports=h,h.prototype.sign=function(e,t){e=s(e);var r=this.keyFromSecret(t),i=this.hashInt(r.messagePrefix(),e),n=this.g.mul(i),o=this.encodePoint(n),a=this.hashInt(o,r.pubBytes(),e).mul(r.priv()),u=i.add(a).umod(this.curve.n);return this.makeSignature({R:n,S:u,Rencoded:o})},h.prototype.verify=function(e,t,r){if(e=s(e),(t=this.makeSignature(t)).S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var i=this.keyFromPublic(r),n=this.hashInt(t.Rencoded(),i.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(i.pub().mul(n)).eq(o)},h.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return o.intFromLE(e.digest()).umod(this.curve.n)},h.prototype.keyFromPublic=function(e){return u.fromPublic(this,e)},h.prototype.keyFromSecret=function(e){return u.fromSecret(this,e)},h.prototype.makeSignature=function(e){return e instanceof c?e:new c(this,e)},h.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},h.prototype.decodePoint=function(e){var t=(e=o.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),i=0!=(128&e[t]),n=o.intFromLE(r);return this.curve.pointFromY(n,i)},h.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},h.prototype.decodeInt=function(e){return o.intFromLE(e)},h.prototype.isPoint=function(e){return e instanceof this.pointClass}},function(e,t,r){"use strict";var i=r(15),n=i.assert,o=i.parseBytes,a=i.cachedProperty;function s(e,t){this.eddsa=e,this._secret=o(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=o(t.pub)}s.fromPublic=function(e,t){return t instanceof s?t:new s(e,{pub:t})},s.fromSecret=function(e,t){return t instanceof s?t:new s(e,{secret:t})},s.prototype.secret=function(){return this._secret},a(s,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),a(s,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),a(s,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,i=t.slice(0,e.encodingLength);return i[0]&=248,i[r]&=127,i[r]|=64,i})),a(s,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),a(s,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),a(s,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),s.prototype.sign=function(e){return n(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},s.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},s.prototype.getSecret=function(e){return n(this._secret,"KeyPair is public only"),i.encode(this.secret(),e)},s.prototype.getPublic=function(e){return i.encode(this.pubBytes(),e)},e.exports=s},function(e,t,r){"use strict";var i=r(7),n=r(15),o=n.assert,a=n.cachedProperty,s=n.parseBytes;function u(e,t){this.eddsa=e,"object"!=typeof t&&(t=s(t)),Array.isArray(t)&&(o(t.length===2*e.encodingLength,"Signature has invalid size"),t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),o(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof i&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}a(u,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),a(u,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),a(u,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),a(u,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),u.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},u.prototype.toHex=function(){return n.encode(this.toBytes(),"hex").toUpperCase()},e.exports=u},function(e,t){},function(e,t,r){"use strict";var i=r(45);t.certificate=r(274);var n=i.define("RSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}));t.RSAPrivateKey=n;var o=i.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));t.RSAPublicKey=o;var a=i.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())})),s=i.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(a),this.key("subjectPublicKey").bitstr())}));t.PublicKey=s;var u=i.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(a),this.key("subjectPrivateKey").octstr())}));t.PrivateKey=u;var c=i.define("EncryptedPrivateKeyInfo",(function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())}));t.EncryptedPrivateKey=c;var h=i.define("DSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())}));t.DSAPrivateKey=h,t.DSAparam=i.define("DSAparam",(function(){this.int()}));var f=i.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})})),l=i.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(f),this.key("publicKey").optional().explicit(1).bitstr())}));t.ECPrivateKey=l,t.signature=i.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())}))},function(e,t,r){var i=r(45),n=r(4);function o(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}t.define=function(e,t){return new o(e,t)},o.prototype._createNamed=function(e){var t;try{t=r(266).runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(e){t=function(e){this._initNamed(e)}}return n(t,e),t.prototype._initNamed=function(t){e.call(this,t)},new t(this)},o.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(i.decoders[e])),this.decoders[e]},o.prototype.decode=function(e,t,r){return this._getDecoder(t).decode(e,r)},o.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(i.encoders[e])),this.encoders[e]},o.prototype.encode=function(e,t,r){return this._getEncoder(t).encode(e,r)}},function(module,exports){var indexOf=function(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0;r<e.length;r++)if(e[r]===t)return r;return-1},Object_keys=function(e){if(Object.keys)return Object.keys(e);var t=[];for(var r in e)t.push(r);return t},forEach=function(e,t){if(e.forEach)return e.forEach(t);for(var r=0;r<e.length;r++)t(e[r],r,e)},defineProp=function(){try{return Object.defineProperty({},"_",{}),function(e,t,r){Object.defineProperty(e,t,{writable:!0,enumerable:!1,configurable:!0,value:r})}}catch(e){return function(e,t,r){e[t]=r}}}(),globals=["Array","Boolean","Date","Error","EvalError","Function","Infinity","JSON","Math","NaN","Number","Object","RangeError","ReferenceError","RegExp","String","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","undefined","unescape"];function Context(){}Context.prototype={};var Script=exports.Script=function(e){if(!(this instanceof Script))return new Script(e);this.code=e};Script.prototype.runInContext=function(e){if(!(e instanceof Context))throw new TypeError("needs a 'context' argument.");var t=document.createElement("iframe");t.style||(t.style={}),t.style.display="none",document.body.appendChild(t);var r=t.contentWindow,i=r.eval,n=r.execScript;!i&&n&&(n.call(r,"null"),i=r.eval),forEach(Object_keys(e),(function(t){r[t]=e[t]})),forEach(globals,(function(t){e[t]&&(r[t]=e[t])}));var o=Object_keys(r),a=i.call(r,this.code);return forEach(Object_keys(r),(function(t){(t in e||-1===indexOf(o,t))&&(e[t]=r[t])})),forEach(globals,(function(t){t in e||defineProp(e,t,r[t])})),document.body.removeChild(t),a},Script.prototype.runInThisContext=function(){return eval(this.code)},Script.prototype.runInNewContext=function(e){var t=Script.createContext(e),r=this.runInContext(t);return e&&forEach(Object_keys(t),(function(r){e[r]=t[r]})),r},forEach(Object_keys(Script.prototype),(function(e){exports[e]=Script[e]=function(t){var r=Script(t);return r[e].apply(r,[].slice.call(arguments,1))}})),exports.isContext=function(e){return e instanceof Context},exports.createScript=function(e){return exports.Script(e)},exports.createContext=Script.createContext=function(e){var t=new Context;return"object"==typeof e&&forEach(Object_keys(e),(function(r){t[r]=e[r]})),t}},function(e,t,r){var i=r(4);function n(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function o(e,t){this.path=e,this.rethrow(t)}t.Reporter=n,n.prototype.isError=function(e){return e instanceof o},n.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},n.prototype.restore=function(e){var t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},n.prototype.enterKey=function(e){return this._reporterState.path.push(e)},n.prototype.exitKey=function(e){var t=this._reporterState;t.path=t.path.slice(0,e-1)},n.prototype.leaveKey=function(e,t,r){var i=this._reporterState;this.exitKey(e),null!==i.obj&&(i.obj[t]=r)},n.prototype.path=function(){return this._reporterState.path.join("/")},n.prototype.enterObject=function(){var e=this._reporterState,t=e.obj;return e.obj={},t},n.prototype.leaveObject=function(e){var t=this._reporterState,r=t.obj;return t.obj=e,r},n.prototype.error=function(e){var t,r=this._reporterState,i=e instanceof o;if(t=i?e:new o(r.path.map((function(e){return"["+JSON.stringify(e)+"]"})).join(""),e.message||e,e.stack),!r.options.partial)throw t;return i||r.errors.push(t),t},n.prototype.wrapResult=function(e){var t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},i(o,Error),o.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},function(e,t,r){var i=r(46).Reporter,n=r(46).EncoderBuffer,o=r(46).DecoderBuffer,a=r(14),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"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(s);function c(e,t){var r={};this._baseState=r,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}e.exports=c;var h=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];c.prototype.clone=function(){var e=this._baseState,t={};h.forEach((function(r){t[r]=e[r]}));var r=new this.constructor(t.parent);return r._baseState=t,r},c.prototype._wrap=function(){var e=this._baseState;u.forEach((function(t){this[t]=function(){var r=new this.constructor(this);return e.children.push(r),r[t].apply(r,arguments)}}),this)},c.prototype._init=function(e){var t=this._baseState;a(null===t.parent),e.call(this),t.children=t.children.filter((function(e){return e._baseState.parent===this}),this),a.equal(t.children.length,1,"Root node can have only one child")},c.prototype._useArgs=function(e){var 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&&(a(null===t.children),t.children=r,r.forEach((function(e){e._baseState.parent=this}),this)),0!==e.length&&(a(null===t.args),t.args=e,t.reverseArgs=e.map((function(e){if("object"!=typeof e||e.constructor!==Object)return e;var t={};return Object.keys(e).forEach((function(r){r==(0|r)&&(r|=0);var i=e[r];t[i]=r})),t})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(e){c.prototype[e]=function(){var t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}})),s.forEach((function(e){c.prototype[e]=function(){var t=this._baseState,r=Array.prototype.slice.call(arguments);return a(null===t.tag),t.tag=e,this._useArgs(r),this}})),c.prototype.use=function(e){a(e);var t=this._baseState;return a(null===t.use),t.use=e,this},c.prototype.optional=function(){return this._baseState.optional=!0,this},c.prototype.def=function(e){var t=this._baseState;return a(null===t.default),t.default=e,t.optional=!0,this},c.prototype.explicit=function(e){var t=this._baseState;return a(null===t.explicit&&null===t.implicit),t.explicit=e,this},c.prototype.implicit=function(e){var t=this._baseState;return a(null===t.explicit&&null===t.implicit),t.implicit=e,this},c.prototype.obj=function(){var e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},c.prototype.key=function(e){var t=this._baseState;return a(null===t.key),t.key=e,this},c.prototype.any=function(){return this._baseState.any=!0,this},c.prototype.choice=function(e){var t=this._baseState;return a(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map((function(t){return e[t]}))),this},c.prototype.contains=function(e){var t=this._baseState;return a(null===t.use),t.contains=e,this},c.prototype._decode=function(e,t){var r=this._baseState;if(null===r.parent)return e.wrapResult(r.children[0]._decode(e,t));var i,n=r.default,a=!0,s=null;if(null!==r.key&&(s=e.enterKey(r.key)),r.optional){var u=null;if(null!==r.explicit?u=r.explicit:null!==r.implicit?u=r.implicit:null!==r.tag&&(u=r.tag),null!==u||r.any){if(a=this._peekTag(e,u,r.any),e.isError(a))return a}else{var c=e.save();try{null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t),a=!0}catch(e){a=!1}e.restore(c)}}if(r.obj&&a&&(i=e.enterObject()),a){if(null!==r.explicit){var h=this._decodeTag(e,r.explicit);if(e.isError(h))return h;e=h}var f=e.offset;if(null===r.use&&null===r.choice){if(r.any)c=e.save();var l=this._decodeTag(e,null!==r.implicit?r.implicit:r.tag,r.any);if(e.isError(l))return l;r.any?n=e.raw(c):e=l}if(t&&t.track&&null!==r.tag&&t.track(e.path(),f,e.length,"tagged"),t&&t.track&&null!==r.tag&&t.track(e.path(),e.offset,e.length,"content"),n=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(r){r._decode(e,t)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){var d=new o(n);n=this._getUse(r.contains,e._reporterState.obj)._decode(d,t)}}return r.obj&&a&&(n=e.leaveObject(i)),null===r.key||null===n&&!0!==a?null!==s&&e.exitKey(s):e.leaveKey(s,r.key,n),n},c.prototype._decodeGeneric=function(e,t,r){var i=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,i.args[0],r):/str$/.test(e)?this._decodeStr(t,e,r):"objid"===e&&i.args?this._decodeObjid(t,i.args[0],i.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,i.args&&i.args[0],r):null!==i.use?this._getUse(i.use,t._reporterState.obj)._decode(t,r):t.error("unknown tag: "+e)},c.prototype._getUse=function(e,t){var r=this._baseState;return r.useDecoder=this._use(e,t),a(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},c.prototype._decodeChoice=function(e,t){var r=this._baseState,i=null,n=!1;return Object.keys(r.choice).some((function(o){var a=e.save(),s=r.choice[o];try{var u=s._decode(e,t);if(e.isError(u))return!1;i={type:o,value:u},n=!0}catch(t){return e.restore(a),!1}return!0}),this),n?i:e.error("Choice not matched")},c.prototype._createEncoderBuffer=function(e){return new n(e,this.reporter)},c.prototype._encode=function(e,t,r){var i=this._baseState;if(null===i.default||i.default!==e){var n=this._encodeValue(e,t,r);if(void 0!==n&&!this._skipDefault(n,t,r))return n}},c.prototype._encodeValue=function(e,t,r){var n=this._baseState;if(null===n.parent)return n.children[0]._encode(e,t||new i);var o=null;if(this.reporter=t,n.optional&&void 0===e){if(null===n.default)return;e=n.default}var a=null,s=!1;if(n.any)o=this._createEncoderBuffer(e);else if(n.choice)o=this._encodeChoice(e,t);else if(n.contains)a=this._getUse(n.contains,r)._encode(e,t),s=!0;else if(n.children)a=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");var i=t.enterKey(r._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");var n=r._encode(e[r._baseState.key],t,e);return t.leaveKey(i),n}),this).filter((function(e){return e})),a=this._createEncoderBuffer(a);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");var u=this.clone();u._baseState.implicit=null,a=this._createEncoderBuffer(e.map((function(r){var i=this._baseState;return this._getUse(i.args[0],e)._encode(r,t)}),u))}else null!==n.use?o=this._getUse(n.use,r)._encode(e,t):(a=this._encodePrimitive(n.tag,e),s=!0);if(!n.any&&null===n.choice){var c=null!==n.implicit?n.implicit:n.tag,h=null===n.implicit?"universal":"context";null===c?null===n.use&&t.error("Tag could be omitted only for .use()"):null===n.use&&(o=this._encodeComposite(c,s,h,a))}return null!==n.explicit&&(o=this._encodeComposite(n.explicit,!1,"context",o)),o},c.prototype._encodeChoice=function(e,t){var r=this._baseState,i=r.choice[e.type];return i||a(!1,e.type+" not found in "+JSON.stringify(Object.keys(r.choice))),i._encode(e.value,t)},c.prototype._encodePrimitive=function(e,t){var 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)},c.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},c.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e)}},function(e,t,r){var i=r(135);t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=i._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=i._reverse(t.tag)},function(e,t,r){var i=t;i.der=r(136),i.pem=r(271)},function(e,t,r){var i=r(4),n=r(0).Buffer,o=r(136);function a(e){o.call(this,e),this.enc="pem"}i(a,o),e.exports=a,a.prototype.decode=function(e,t){for(var r=e.toString().split(/[\r\n]+/g),i=t.label.toUpperCase(),a=/^-----(BEGIN|END) ([^-]+)-----$/,s=-1,u=-1,c=0;c<r.length;c++){var h=r[c].match(a);if(null!==h&&h[2]===i){if(-1!==s){if("END"!==h[1])break;u=c;break}if("BEGIN"!==h[1])break;s=c}}if(-1===s||-1===u)throw new Error("PEM section not found for: "+i);var f=r.slice(s+1,u).join("");f.replace(/[^a-z0-9\+\/=]+/gi,"");var l=new n(f,"base64");return o.prototype.decode.call(this,l,t)}},function(e,t,r){var i=t;i.der=r(137),i.pem=r(273)},function(e,t,r){var i=r(4),n=r(137);function o(e){n.call(this,e),this.enc="pem"}i(o,n),e.exports=o,o.prototype.encode=function(e,t){for(var r=n.prototype.encode.call(this,e).toString("base64"),i=["-----BEGIN "+t.label+"-----"],o=0;o<r.length;o+=64)i.push(r.slice(o,o+64));return i.push("-----END "+t.label+"-----"),i.join("\n")}},function(e,t,r){"use strict";var i=r(45),n=i.define("Time",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),o=i.define("AttributeTypeValue",(function(){this.seq().obj(this.key("type").objid(),this.key("value").any())})),a=i.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())})),s=i.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(a),this.key("subjectPublicKey").bitstr())})),u=i.define("RelativeDistinguishedName",(function(){this.setof(o)})),c=i.define("RDNSequence",(function(){this.seqof(u)})),h=i.define("Name",(function(){this.choice({rdnSequence:this.use(c)})})),f=i.define("Validity",(function(){this.seq().obj(this.key("notBefore").use(n),this.key("notAfter").use(n))})),l=i.define("Extension",(function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())})),d=i.define("TBSCertificate",(function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(a),this.key("issuer").use(h),this.key("validity").use(f),this.key("subject").use(h),this.key("subjectPublicKeyInfo").use(s),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(l).optional())})),p=i.define("X509Certificate",(function(){this.seq().obj(this.key("tbsCertificate").use(d),this.key("signatureAlgorithm").use(a),this.key("signatureValue").bitstr())}));e.exports=p},function(e){e.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}},function(e,t,r){"use strict";var i=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,n=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,o=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,a=r(56),s=r(80),u=r(1).Buffer;e.exports=function(e,t){var r,c=e.toString(),h=c.match(i);if(h){var f="aes"+h[1],l=u.from(h[2],"hex"),d=u.from(h[3].replace(/[\r\n]/g,""),"base64"),p=a(t,l.slice(0,8),parseInt(h[1],10)).key,m=[],g=s.createDecipheriv(f,p,l);m.push(g.update(d)),m.push(g.final()),r=u.concat(m)}else{var b=c.match(o);r=u.from(b[2].replace(/[\r\n]/g,""),"base64")}return{tag:c.match(n)[1],data:r}}},function(e,t,r){"use strict";var i=r(1).Buffer,n=r(133),o=r(29).ec,a=r(59),s=r(138);function u(e,t){if(e.cmpn(0)<=0)throw new Error("invalid sig");if(e.cmp(t)>=0)throw new Error("invalid sig")}e.exports=function(e,t,r,c,h){var f=a(r);if("ec"===f.type){if("ecdsa"!==c&&"ecdsa/rsa"!==c)throw new Error("wrong public key type");return function(e,t,r){var i=s[r.data.algorithm.curve.join(".")];if(!i)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var n=new o(i),a=r.data.subjectPrivateKey.data;return n.verify(t,e,a)}(e,t,f)}if("dsa"===f.type){if("dsa"!==c)throw new Error("wrong public key type");return function(e,t,r){var i=r.data.p,o=r.data.q,s=r.data.g,c=r.data.pub_key,h=a.signature.decode(e,"der"),f=h.s,l=h.r;u(f,o),u(l,o);var d=n.mont(i),p=f.invm(o);return 0===s.toRed(d).redPow(new n(t).mul(p).mod(o)).fromRed().mul(c.toRed(d).redPow(l.mul(p).mod(o)).fromRed()).mod(i).mod(o).cmp(l)}(e,t,f)}if("rsa"!==c&&"ecdsa/rsa"!==c)throw new Error("wrong public key type");t=i.concat([h,t]);for(var l=f.modulus.byteLength(),d=[1],p=0;t.length+d.length+2<l;)d.push(255),p+=1;d.push(0);for(var m=-1;++m<t.length;)d.push(t[m]);d=i.from(d);var g=n.mont(f.modulus);e=(e=new n(e).toRed(g)).redPow(new n(f.publicExponent)),e=i.from(e.fromRed().toArray());var b=p<8?1:0;for(l=Math.min(e.length,d.length),e.length!==d.length&&(b=1),m=-1;++m<l;)b|=e[m]^d[m];return 0===b}},function(e,t,r){(function(t){var i=r(29),n=r(7);e.exports=function(e){return new a(e)};var o={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function a(e){this.curveType=o[e],this.curveType||(this.curveType={name:e}),this.curve=new i.ec(this.curveType.name),this.keys=void 0}function s(e,r,i){Array.isArray(e)||(e=e.toArray());var n=new t(e);if(i&&n.length<i){var o=new t(i-n.length);o.fill(0),n=t.concat([o,n])}return r?n.toString(r):n}o.p224=o.secp224r1,o.p256=o.secp256r1=o.prime256v1,o.p192=o.secp192r1=o.prime192v1,o.p384=o.secp384r1,o.p521=o.secp521r1,a.prototype.generateKeys=function(e,t){return this.keys=this.curve.genKeyPair(),this.getPublicKey(e,t)},a.prototype.computeSecret=function(e,r,i){return r=r||"utf8",t.isBuffer(e)||(e=new t(e,r)),s(this.curve.keyFromPublic(e).getPublic().mul(this.keys.getPrivate()).getX(),i,this.curveType.byteLength)},a.prototype.getPublicKey=function(e,t){var r=this.keys.getPublic("compressed"===t,!0);return"hybrid"===t&&(r[r.length-1]%2?r[0]=7:r[0]=6),s(r,e)},a.prototype.getPrivateKey=function(e){return s(this.keys.getPrivate(),e)},a.prototype.setPublicKey=function(e,r){return r=r||"utf8",t.isBuffer(e)||(e=new t(e,r)),this.keys._importPublic(e),this},a.prototype.setPrivateKey=function(e,r){r=r||"utf8",t.isBuffer(e)||(e=new t(e,r));var i=new n(e);return i=i.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(i),this}}).call(this,r(0).Buffer)},function(e,t,r){t.publicEncrypt=r(280),t.privateDecrypt=r(281),t.privateEncrypt=function(e,r){return t.publicEncrypt(e,r,!0)},t.publicDecrypt=function(e,r){return t.privateDecrypt(e,r,!0)}},function(e,t,r){var i=r(59),n=r(33),o=r(37),a=r(139),s=r(140),u=r(7),c=r(141),h=r(83),f=r(1).Buffer;e.exports=function(e,t,r){var l;l=e.padding?e.padding:r?1:4;var d,p=i(e);if(4===l)d=function(e,t){var r=e.modulus.byteLength(),i=t.length,c=o("sha1").update(f.alloc(0)).digest(),h=c.length,l=2*h;if(i>r-l-2)throw new Error("message too long");var d=f.alloc(r-i-l-2),p=r-h-1,m=n(h),g=s(f.concat([c,d,f.alloc(1,1),t],p),a(m,p)),b=s(m,a(g,h));return new u(f.concat([f.alloc(1),b,g],r))}(p,t);else if(1===l)d=function(e,t,r){var i,o=t.length,a=e.modulus.byteLength();if(o>a-11)throw new Error("message too long");i=r?f.alloc(a-o-3,255):function(e){var t,r=f.allocUnsafe(e),i=0,o=n(2*e),a=0;for(;i<e;)a===o.length&&(o=n(2*e),a=0),(t=o[a++])&&(r[i++]=t);return r}(a-o-3);return new u(f.concat([f.from([0,r?1:2]),i,f.alloc(1),t],a))}(p,t,r);else{if(3!==l)throw new Error("unknown padding");if((d=new u(t)).cmp(p.modulus)>=0)throw new Error("data too long for modulus")}return r?h(d,p):c(d,p)}},function(e,t,r){var i=r(59),n=r(139),o=r(140),a=r(7),s=r(83),u=r(37),c=r(141),h=r(1).Buffer;e.exports=function(e,t,r){var f;f=e.padding?e.padding:r?1:4;var l,d=i(e),p=d.modulus.byteLength();if(t.length>p||new a(t).cmp(d.modulus)>=0)throw new Error("decryption error");l=r?c(new a(t),d):s(t,d);var m=h.alloc(p-l.length);if(l=h.concat([m,l],p),4===f)return function(e,t){var r=e.modulus.byteLength(),i=u("sha1").update(h.alloc(0)).digest(),a=i.length;if(0!==t[0])throw new Error("decryption error");var s=t.slice(1,a+1),c=t.slice(a+1),f=o(s,n(c,a)),l=o(c,n(f,r-a-1));if(function(e,t){e=h.from(e),t=h.from(t);var r=0,i=e.length;e.length!==t.length&&(r++,i=Math.min(e.length,t.length));var n=-1;for(;++n<i;)r+=e[n]^t[n];return r}(i,l.slice(0,a)))throw new Error("decryption error");var d=a;for(;0===l[d];)d++;if(1!==l[d++])throw new Error("decryption error");return l.slice(d)}(d,l);if(1===f)return function(e,t,r){var i=t.slice(0,2),n=2,o=0;for(;0!==t[n++];)if(n>=t.length){o++;break}var a=t.slice(2,n-1);("0002"!==i.toString("hex")&&!r||"0001"!==i.toString("hex")&&r)&&o++;a.length<8&&o++;if(o)throw new Error("decryption error");return t.slice(n)}(0,l,r);if(3===f)return l;throw new Error("unknown padding")}},function(e,t,r){"use strict";(function(e,i){function n(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var o=r(1),a=r(33),s=o.Buffer,u=o.kMaxLength,c=e.crypto||e.msCrypto,h=Math.pow(2,32)-1;function f(e,t){if("number"!=typeof e||e!=e)throw new TypeError("offset must be a number");if(e>h||e<0)throw new TypeError("offset must be a uint32");if(e>u||e>t)throw new RangeError("offset out of range")}function l(e,t,r){if("number"!=typeof e||e!=e)throw new TypeError("size must be a number");if(e>h||e<0)throw new TypeError("size must be a uint32");if(e+t>r||e>u)throw new RangeError("buffer too small")}function d(e,t,r,n){if(i.browser){var o=e.buffer,s=new Uint8Array(o,t,r);return c.getRandomValues(s),n?void i.nextTick((function(){n(null,e)})):e}if(!n)return a(r).copy(e,t),e;a(r,(function(r,i){if(r)return n(r);i.copy(e,t),n(null,e)}))}c&&c.getRandomValues||!i.browser?(t.randomFill=function(t,r,i,n){if(!(s.isBuffer(t)||t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof r)n=r,r=0,i=t.length;else if("function"==typeof i)n=i,i=t.length-r;else if("function"!=typeof n)throw new TypeError('"cb" argument must be a function');return f(r,t.length),l(i,r,t.length),d(t,r,i,n)},t.randomFillSync=function(t,r,i){void 0===r&&(r=0);if(!(s.isBuffer(t)||t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');f(r,t.length),void 0===i&&(i=t.length-r);return l(i,r,t.length),d(t,r,i)}):(t.randomFill=n,t.randomFillSync=n)}).call(this,r(13),r(6))},function(e,t,r){"use strict";var i=r(1).Buffer;e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var o=e.charAt(n),a=o.charCodeAt(0);if(255!==t[a])throw new TypeError(o+" is ambiguous");t[a]=n}var s=e.length,u=e.charAt(0),c=Math.log(s)/Math.log(256),h=Math.log(256)/Math.log(s);function f(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return i.alloc(0);for(var r=0,n=0,o=0;e[r]===u;)n++,r++;for(var a=(e.length-r)*c+1>>>0,h=new Uint8Array(a);r<e.length;){var f=e.charCodeAt(r);if(f>255)return;var l=t[f];if(255===l)return;for(var d=0,p=a-1;(0!==l||d<o)&&-1!==p;p--,d++)l+=s*h[p]>>>0,h[p]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");o=d,r++}for(var m=a-o;m!==a&&0===h[m];)m++;var g=i.allocUnsafe(n+(a-m));g.fill(0,0,n);for(var b=n;m!==a;)g[b++]=h[m++];return g}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=i.from(t)),!i.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,n=0,o=0,a=t.length;o!==a&&0===t[o];)o++,r++;for(var c=(a-o)*h+1>>>0,f=new Uint8Array(c);o!==a;){for(var l=t[o],d=0,p=c-1;(0!==l||d<n)&&-1!==p;p--,d++)l+=256*f[p]>>>0,f[p]=l%s>>>0,l=l/s>>>0;if(0!==l)throw new Error("Non-zero carry");n=d,o++}for(var m=c-n;m!==c&&0===f[m];)m++;for(var g=u.repeat(r);m<c;++m)g+=e.charAt(f[m]);return g},decodeUnsafe:f,decode:function(e){var t=f(e);if(t)return t;throw new Error("Non-base"+s+" character")}}}},function(e){e.exports={name:"@smartledger/bsv",version:"4.0.1",description:"🚀 Complete Bitcoin SV development framework with legally-recognizable DID:web + W3C VC-JWT toolkit, Legal Token Protocol (LTP), Global Digital Attestation Framework (GDAF), StatusList2021 revocation, and 16 flexible loading options. Standards-based credentials with ES256/ES256K support, on-chain BSV anchoring, and comprehensive Bitcoin SV API. Perfect for legal tokens, verifiable credentials, DeFi, smart contracts, and secure Bitcoin applications.",author:"SmartLedger Technology <hello@smartledger.technology> (https://smartledger.technology)",homepage:"https://github.com/codenlighten/smartledger-bsv#readme",bugs:{url:"https://github.com/codenlighten/smartledger-bsv/issues"},main:"index.js",types:"bsv.d.ts",bin:{"smartledger-bsv":"./bin/cli.js"},scripts:{lint:"standard",test:"mocha","test:cli":"mocha test/cli/smoke.js --timeout 25000","test:ltp":"node complete_ltp_demo.js","test:ltp-primitives":"node simple_demo.js","test:architecture":"node architecture_demo.js","test:js2script":"node lib/smart_contract/opcode_map.js && node lib/smart_contract/covenant_builder.js","test:opcodes":"node lib/smart_contract/opcode_list.js","test:covenants":"node examples/covenants/advanced_covenant_demo.js","test:scripts":"node examples/scripts/custom_script_signature_test.js","test:basic":"node examples/basic/transaction-creation.js","test:all":"npm test && npm run test:covenants && npm run test:scripts",coverage:"nyc --reporter=text npm run test",demo:"node demos/smart_contract_demo.js","demo:web":"echo '🌐 Open demos/smart_contract_demo.html in your browser'","demo:basics":"node demos/smart_contract_demo.js --feature basics","demo:covenant":"node demos/smart_contract_demo.js --feature covenant","demo:preimage":"node demos/smart_contract_demo.js --feature preimage","demo:utxo":"node demos/smart_contract_demo.js --feature utxo","demo:scripts":"node demos/smart_contract_demo.js --feature scripts","demo:legacy":"npm run test:covenants","demo:legacy:basic":"npm run test:basic","demo:legacy:scripts":"npm run test:scripts","demo:legacy:preimage":"echo '🧠 BIP-143 Preimage Extractor Demo' && node examples/preimage/extract_preimage_bidirectional.js","smart-contracts":"node examples/smart_contract_templates.js","smart-contracts:working":"node examples/final_working_contracts.js",workflow:"node examples/complete_workflow_demo.js","build-bsv":'NODE_OPTIONS="--openssl-legacy-provider" webpack index.js --config build/webpack.config.js',"build-ecies":'NODE_OPTIONS="--openssl-legacy-provider" webpack ecies/index.js --config build/webpack.subproject.config.js --output-library bsvEcies -o bsv-ecies.min.js',"build-message":'NODE_OPTIONS="--openssl-legacy-provider" webpack message/index.js --config build/webpack.subproject.config.js --output-library bsvMessage -o bsv-message.min.js',"build-mnemonic":'NODE_OPTIONS="--openssl-legacy-provider" webpack mnemonic/index.js --config build/webpack.subproject.config.js --output-library bsvMnemonic -o bsv-mnemonic.min.js',"build-shamir":'NODE_OPTIONS="--openssl-legacy-provider" webpack shamir-entry.js --config build/webpack.subproject.config.js --output-library bsvShamir -o bsv-shamir.min.js',"build-ltp":'NODE_OPTIONS="--openssl-legacy-provider" webpack ltp-entry.js --config build/webpack.ltp.config.js',"build-gdaf":'NODE_OPTIONS="--openssl-legacy-provider" webpack gdaf-entry.js --config build/webpack.gdaf.config.js',"build-smartcontract":'NODE_OPTIONS="--openssl-legacy-provider" webpack smartcontract-entry.js --config build/webpack.smartcontract.config.js',"build-covenant":'NODE_OPTIONS="--openssl-legacy-provider" webpack covenant-entry.js --config build/webpack.covenant.config.js',"build-script-helper":'NODE_OPTIONS="--openssl-legacy-provider" webpack script-helper-entry.js --config build/webpack.script-helper.config.js',"build-security":'NODE_OPTIONS="--openssl-legacy-provider" webpack security-entry.js --config build/webpack.security.config.js',"build-didweb":'NODE_OPTIONS="--openssl-legacy-provider" webpack didweb-entry.js --config build/webpack.didweb.config.js',"build-vcjwt":'NODE_OPTIONS="--openssl-legacy-provider" webpack vcjwt-entry.js --config build/webpack.vcjwt.config.js',"build-statuslist":'NODE_OPTIONS="--openssl-legacy-provider" webpack statuslist-entry.js --config build/webpack.statuslist.config.js',"build-anchor":'NODE_OPTIONS="--openssl-legacy-provider" webpack anchor-entry.js --config build/webpack.anchor.config.js',"build-bundle":'NODE_OPTIONS="--openssl-legacy-provider" webpack bundle-entry.js --config build/webpack.bundle.config.js',build:"npm run build-bsv && npm run build-ecies && npm run build-message && npm run build-mnemonic && npm run build-shamir && npm run build-smartcontract","build-specialized":"npm run build-covenant && npm run build-script-helper && npm run build-security","build-credentials":"npm run build-didweb && npm run build-vcjwt && npm run build-statuslist && npm run build-anchor","build-advanced":"npm run build-ltp && npm run build-gdaf","build-all":"npm run build && npm run build-bundle && npm run build-specialized && npm run build-advanced && npm run build-credentials","test:browser":"echo 'Open tests/standalone-modules-test.html in browser for comprehensive testing'","test:bundle":"echo 'Open tests/bundle-completeness-test.html in browser to verify bundle completeness'","preimage:extract":"node examples/preimage/extract_preimage_bidirectional.js",prepublishOnly:'NODE_OPTIONS="--openssl-legacy-provider" npm run build-all'},unpkg:"bsv.min.js",jsdelivr:"bsv.min.js",cdn:"bsv.min.js",files:["index.js","lib/","utilities/*.js","utilities/README.md","ecies/","message/","mnemonic/","build/","*-entry.js","bsv.min.js","bsv.bundle.js","bsv-ecies.min.js","bsv-message.min.js","bsv-mnemonic.min.js","bsv-shamir.min.js","bsv-gdaf.min.js","bsv-ltp.min.js","bsv-smartcontract.min.js","bsv-covenant.min.js","bsv-script-helper.min.js","bsv-security.min.js","bsv-didweb.min.js","bsv-vcjwt.min.js","bsv-statuslist.min.js","bsv-anchor.min.js","bsv.d.ts","docs/","LICENSE","README.md","SECURITY.md","CHANGELOG.md"],keywords:["bitcoin","bitcoin-sv","bsv","legal-token-protocol","ltp","legal-tokens","primitives-only","legal-compliance","property-rights","obligations","attestations","gdaf","global-digital-attestation","w3c-credentials","verifiable-credentials","decentralized-identity","shamir-secret-sharing","threshold-cryptography","cryptocurrency","blockchain","smart-contracts","defi","covenant","covenants","script-debugger","debug-tools","modular-loading","standalone-modules","elliptic-curve-fix","smartledger","transaction","address","signature","wallet","hd-wallet","mnemonic","ecies","encryption","message-signing","pushtx","pels","bip143","preimage","shamir-secret-sharing","threshold-cryptography","secret-splitting","global-digital-attestation","gdaf","verifiable-credentials","w3c-credentials","decentralized-identity","did-resolution","zero-knowledge-proofs","blockchain-anchoring","attestation-framework","nchain","custom-scripts","multisig","timelock","conditional-scripts","utxo-management","ultra-low-fees","javascript-to-script","opcode-mapping","covenant-builder","script-simulation","bitcoin-script","asm-generation","advanced-features","script-development","blockchain-simulator","miner-simulator","testing-tools","development-framework","browser-compatible","nodejs-compatible","webpack-ready","cdn-ready","typescript-definitions","drop-in-replacement","performance-optimized","bip21","bip32","bip37","bip69","bip70"],repository:{type:"git",url:"https://github.com/codenlighten/smartledger-bsv"},browser:{request:"browser-request"},dependencies:{"aes-js":"^3.1.2","bn.js":"=4.11.9",bs58:"=4.0.1","clone-deep":"^4.0.1",elliptic:"6.6.1","hash.js":"^1.1.7",inherits:"2.0.3",unorm:"1.4.1"},devDependencies:{brfs:"2.0.1",chai:"4.2.0",mocha:"^8.4.0",nyc:"^14.1.1",sinon:"7.2.3",standard:"12.0.1",webpack:"4.29.3","webpack-cli":"^3.3.12"},license:"MIT",standard:{globals:["after","afterEach","before","beforeEach","describe","it"],ignore:["dist/**"]}}},function(e,t,r){"use strict";var i="https://docs.moneybutton.com/";e.exports=[{name:"InvalidB58Char",message:"Invalid Base58 character: {0} in {1}"},{name:"InvalidB58Checksum",message:"Invalid Base58 checksum for {0}"},{name:"InvalidNetwork",message:"Invalid version for network: got {0}"},{name:"InvalidState",message:"Invalid state: {0}"},{name:"NotImplemented",message:"Function {0} was not implemented yet"},{name:"InvalidNetworkArgument",message:'Invalid network: must be "livenet" or "testnet", got {0}'},{name:"InvalidArgument",message:function(){return"Invalid Argument"+(arguments[0]?": "+arguments[0]:"")+(arguments[1]?" Documentation: "+i+arguments[1]:"")}},{name:"AbstractMethodInvoked",message:"Abstract Method Invocation: {0}"},{name:"InvalidArgumentType",message:function(){return"Invalid Argument for "+arguments[2]+", expected "+arguments[1]+" but got "+typeof arguments[0]}},{name:"Unit",message:"Internal Error on Unit {0}",errors:[{name:"UnknownCode",message:"Unrecognized unit code: {0}"},{name:"InvalidRate",message:"Invalid exchange rate: {0}"}]},{name:"MerkleBlock",message:"Internal Error on MerkleBlock {0}",errors:[{name:"InvalidMerkleTree",message:"This MerkleBlock contain an invalid Merkle Tree"}]},{name:"Transaction",message:"Internal Error on Transaction {0}",errors:[{name:"Input",message:"Internal Error on Input {0}",errors:[{name:"MissingScript",message:"Need a script to create an input"},{name:"UnsupportedScript",message:"Unsupported input script type: {0}"},{name:"MissingPreviousOutput",message:"No previous output information."}]},{name:"NeedMoreInfo",message:"{0}"},{name:"InvalidSorting",message:"The sorting function provided did not return the change output as one of the array elements"},{name:"InvalidOutputAmountSum",message:"{0}"},{name:"MissingSignatures",message:"Some inputs have not been fully signed"},{name:"InvalidIndex",message:"Invalid index: {0} is not between 0, {1}"},{name:"UnableToVerifySignature",message:"Unable to verify signature: {0}"},{name:"DustOutputs",message:"Dust amount detected in one output"},{name:"InvalidSatoshis",message:"Output satoshis are invalid"},{name:"FeeError",message:"Internal Error on Fee {0}",errors:[{name:"TooSmall",message:"Fee is too small: {0}"},{name:"TooLarge",message:"Fee is too large: {0}"},{name:"Different",message:"Unspent value is different from specified fee: {0}"}]},{name:"ChangeAddressMissing",message:"Change address is missing"},{name:"BlockHeightTooHigh",message:"Block Height can be at most 2^32 -1"},{name:"NLockTimeOutOfRange",message:"Block Height can only be between 0 and 499 999 999"},{name:"LockTimeTooEarly",message:"Lock Time can't be earlier than UNIX date 500 000 000"}]},{name:"Script",message:"Internal Error on Script {0}",errors:[{name:"UnrecognizedAddress",message:"Expected argument {0} to be an address"},{name:"CantDeriveAddress",message:"Can't derive address associated with script {0}, needs to be p2pkh in, p2pkh out, p2sh in, or p2sh out."},{name:"InvalidBuffer",message:"Invalid script buffer: can't parse valid script from given buffer {0}"}]},{name:"HDPrivateKey",message:"Internal Error on HDPrivateKey {0}",errors:[{name:"InvalidDerivationArgument",message:"Invalid derivation argument {0}, expected string, or number and boolean"},{name:"InvalidEntropyArgument",message:"Invalid entropy: must be an hexa string or binary buffer, got {0}",errors:[{name:"TooMuchEntropy",message:'Invalid entropy: more than 512 bits is non standard, got "{0}"'},{name:"NotEnoughEntropy",message:'Invalid entropy: at least 128 bits needed, got "{0}"'}]},{name:"InvalidLength",message:"Invalid length for xprivkey string in {0}"},{name:"InvalidPath",message:"Invalid derivation path: {0}"},{name:"UnrecognizedArgument",message:'Invalid argument: creating a HDPrivateKey requires a string, buffer, json or object, got "{0}"'}]},{name:"HDPublicKey",message:"Internal Error on HDPublicKey {0}",errors:[{name:"ArgumentIsPrivateExtended",message:"Argument is an extended private key: {0}"},{name:"InvalidDerivationArgument",message:"Invalid derivation argument: got {0}"},{name:"InvalidLength",message:'Invalid length for xpubkey: got "{0}"'},{name:"InvalidPath",message:'Invalid derivation path, it should look like: "m/1/100", got "{0}"'},{name:"InvalidIndexCantDeriveHardened",message:"Invalid argument: creating a hardened path requires an HDPrivateKey"},{name:"MustSupplyArgument",message:"Must supply an argument to create a HDPublicKey"},{name:"UnrecognizedArgument",message:"Invalid argument for creation, must be string, json, buffer, or object"}]}]},function(e,t,r){"use strict";(function(t){var i=r(58),n=r(5),o=e.exports;o.sha1=function(e){return n.checkArgument(t.isBuffer(e)),t.from(i.sha1().update(e).digest("hex"),"hex")},o.sha1.blocksize=512,o.sha256=function(e){return n.checkArgument(t.isBuffer(e)),t.from(i.sha256().update(e).digest("hex"),"hex")},o.sha256.blocksize=512,o.sha256sha256=function(e){return n.checkArgument(t.isBuffer(e)),o.sha256(o.sha256(e))},o.ripemd160=function(e){return n.checkArgument(t.isBuffer(e)),t.from(i.ripemd160().update(e).digest("hex"),"hex")},o.sha256ripemd160=function(e){return n.checkArgument(t.isBuffer(e)),o.ripemd160(o.sha256(e))},o.sha512=function(e){return n.checkArgument(t.isBuffer(e)),t.from(i.sha512().update(e).digest("hex"),"hex")},o.sha512.blocksize=1024,o.hmac=function(e,r,i){n.checkArgument(t.isBuffer(r)),n.checkArgument(t.isBuffer(i)),n.checkArgument(e.blocksize);var o=e.blocksize/8;if(i.length>o)i=e(i);else if(i<o){var a=t.alloc(o);a.fill(0),i.copy(a),i=a}var s=t.alloc(o);s.fill(92);var u=t.alloc(o);u.fill(54);for(var c=t.alloc(o),h=t.alloc(o),f=0;f<o;f++)c[f]=s[f]^i[f],h[f]=u[f]^i[f];return e(t.concat([c,e(t.concat([h,r]))]))},o.sha256hmac=function(e,t){return o.hmac(o.sha256,e,t)},o.sha512hmac=function(e,t){return o.hmac(o.sha512,e,t)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(9),n=r(5),o=e.exports;o.sha1=function(e){return n.checkArgument(t.isBuffer(e)),i.createHash("sha1").update(e).digest()},o.sha1.blocksize=512,o.sha256=function(e){return n.checkArgument(t.isBuffer(e)),i.createHash("sha256").update(e).digest()},o.sha256.blocksize=512,o.sha256sha256=function(e){return n.checkArgument(t.isBuffer(e)),o.sha256(o.sha256(e))},o.ripemd160=function(e){return n.checkArgument(t.isBuffer(e)),i.createHash("ripemd160").update(e).digest()},o.sha256ripemd160=function(e){return n.checkArgument(t.isBuffer(e)),o.ripemd160(o.sha256(e))},o.sha512=function(e){return n.checkArgument(t.isBuffer(e)),i.createHash("sha512").update(e).digest()},o.sha512.blocksize=1024,o.hmac=function(e,r,i){n.checkArgument(t.isBuffer(r)),n.checkArgument(t.isBuffer(i)),n.checkArgument(e.blocksize);var o=e.blocksize/8;if(i.length>o)i=e(i);else if(i<o){var a=t.alloc(o);a.fill(0),i.copy(a),i=a}var s=t.alloc(o);s.fill(92);var u=t.alloc(o);u.fill(54);for(var c=t.alloc(o),h=t.alloc(o),f=0;f<o;f++)c[f]=s[f]^i[f],h[f]=u[f]^i[f];return e(t.concat([c,e(t.concat([h,r]))]))},o.sha256hmac=function(e,t){return o.hmac(o.sha256,e,t)},o.sha512hmac=function(e,t){return o.hmac(o.sha512,e,t)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var i=r(289);e.exports=function(){return Object.assign?function(){if(!Object.assign)return!1;for(var e="abcdefghijklmnopqrst",t=e.split(""),r={},i=0;i<t.length;++i)r[t[i]]=t[i];var n=Object.assign({},r),o="";for(var a in n)o+=a;return e!==o}()||function(){if(!Object.assign||!Object.preventExtensions)return!1;var e=Object.preventExtensions({1:2});try{Object.assign(e,"xy")}catch(t){return"y"===e[1]}return!1}()?i:Object.assign:i}},function(e,t,r){"use strict";var i=r(290),n=r(74)(),o=r(72),a=r(73),s=o("Array.prototype.push"),u=o("Object.prototype.propertyIsEnumerable"),c=n?a.getOwnPropertySymbols:null;e.exports=function(e,t){if(null==e)throw new TypeError("target must be an object");var r=a(e);if(1===arguments.length)return r;for(var o=1;o<arguments.length;++o){var h=a(arguments[o]),f=i(h),l=n&&(a.getOwnPropertySymbols||c);if(l)for(var d=l(h),p=0;p<d.length;++p){var m=d[p];u(h,m)&&s(f,m)}for(var g=0;g<f.length;++g){var b=f[g];if(u(h,b)){var y=h[b];r[b]=y}}}return r}},function(e,t,r){"use strict";var i=Array.prototype.slice,n=r(143),o=Object.keys,a=o?function(e){return o(e)}:r(291),s=Object.keys;a.shim=function(){Object.keys?function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2)||(Object.keys=function(e){return n(e)?s(i.call(e)):s(e)}):Object.keys=a;return Object.keys||a},e.exports=a},function(e,t,r){"use strict";var i;if(!Object.keys){var n=Object.prototype.hasOwnProperty,o=Object.prototype.toString,a=r(143),s=Object.prototype.propertyIsEnumerable,u=!s.call({toString:null},"toString"),c=s.call((function(){}),"prototype"),h=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],f=function(e){var t=e.constructor;return t&&t.prototype===e},l={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},d=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!l["$"+e]&&n.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{f(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();i=function(e){var t=null!==e&&"object"==typeof e,r="[object Function]"===o.call(e),i=a(e),s=t&&"[object String]"===o.call(e),l=[];if(!t&&!r&&!i)throw new TypeError("Object.keys called on a non-object");var p=c&&r;if(s&&e.length>0&&!n.call(e,0))for(var m=0;m<e.length;++m)l.push(String(m));if(i&&e.length>0)for(var g=0;g<e.length;++g)l.push(String(g));else for(var b in e)p&&"prototype"===b||!n.call(e,b)||l.push(String(b));if(u)for(var y=function(e){if("undefined"==typeof window||!d)return f(e);try{return f(e)}catch(e){return!1}}(e),v=0;v<h.length;++v)y&&"constructor"===h[v]||!n.call(e,h[v])||l.push(h[v]);return l}}e.exports=i},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t,r){"use strict";const i=r(294),n=r(144),o=r(295);function a(e,t){switch(n(e)){case"object":return function(e,t){if("function"==typeof t)return t(e);if(t||o(e)){const r=new e.constructor;for(let i in e)r[i]=a(e[i],t);return r}return e}(e,t);case"array":return function(e,t){const r=new e.constructor(e.length);for(let i=0;i<e.length;i++)r[i]=a(e[i],t);return r}(e,t);default:return i(e)}}e.exports=a},function(e,t,r){"use strict";(function(t){
|
|
20
|
+
t.read=function(e,t,r,i,n){var o,a,s=8*n-i-1,u=(1<<s)-1,c=u>>1,h=-7,f=r?n-1:0,l=r?-1:1,d=e[t+f];for(f+=l,o=d&(1<<-h)-1,d>>=-h,h+=s;h>0;o=256*o+e[t+f],f+=l,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=i;h>0;a=256*a+e[t+f],f+=l,h-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,i),o-=c}return(d?-1:1)*a*Math.pow(2,o-i)},t.write=function(e,t,r,i,n,o){var a,s,u,c=8*o-n-1,h=(1<<c)-1,f=h>>1,l=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:o-1,p=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=h):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+f>=1?l/u:l*Math.pow(2,1-f))*u>=2&&(a++,u/=2),a+f>=h?(s=0,a=h):a+f>=1?(s=(t*u-1)*Math.pow(2,n),a+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,n),a=0));n>=8;e[r+d]=255&s,d+=p,s/=256,n-=8);for(a=a<<n|s,c+=n;c>0;e[r+d]=255&a,d+=p,a/=256,c-=8);e[r+d-p]|=128*m}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){"use strict";var i=r(1).Buffer,n=r(66).Transform;function o(e){n.call(this),this._block=i.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(176)(o,n),o.prototype._transform=function(e,t,r){var i=null;try{this.update(e,t)}catch(e){i=e}r(i)},o.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)};var a="undefined"!=typeof Uint8Array,s="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&ArrayBuffer.isView&&(i.prototype instanceof Uint8Array||i.TYPED_ARRAY_SUPPORT);o.prototype.update=function(e,t){if(this._finalized)throw new Error("Digest already called");e=function(e,t){if(e instanceof i)return e;if("string"==typeof e)return i.from(e,t);if(s&&ArrayBuffer.isView(e)){if(0===e.byteLength)return i.alloc(0);var r=i.from(e.buffer,e.byteOffset,e.byteLength);if(r.byteLength===e.byteLength)return r}if(a&&e instanceof Uint8Array)return i.from(e);if(i.isBuffer(e)&&e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e))return i.from(e);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}(e,t);for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)r[o++]=e[n++];this._update(),this._blockOffset=0}for(;n<e.length;)r[this._blockOffset++]=e[n++];for(var u=0,c=8*e.length;c>0;++u)this._length[u]+=c,(c=this._length[u]/4294967296|0)>0&&(this._length[u]-=4294967296*c);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},o.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=o},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t){},function(e,t,r){"use strict";var i=r(68).Buffer,n=r(166);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return i.alloc(0);for(var t,r,n,o=i.allocUnsafe(e>>>0),a=this.head,s=0;a;)t=a.data,r=o,n=s,t.copy(r,n),s+=a.data.length,a=a.next;return o},e}(),n&&n.inspect&&n.inspect.custom&&(e.exports.prototype[n.inspect.custom]=function(){var e=n.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,r){(function(e){var i=void 0!==e&&e||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function o(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new o(n.call(setTimeout,i,arguments),clearTimeout)},t.setInterval=function(){return new o(n.call(setInterval,i,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(i,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},r(168),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,r(13))},function(e,t,r){(function(e,t){!function(e,r){"use strict";if(!e.setImmediate){var i,n,o,a,s,u=1,c={},h=!1,f=e.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(e);l=l&&l.setTimeout?l:e,"[object process]"==={}.toString.call(e.process)?i=function(e){t.nextTick((function(){p(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?e.MessageChannel?((o=new MessageChannel).port1.onmessage=function(e){p(e.data)},i=function(e){o.port2.postMessage(e)}):f&&"onreadystatechange"in f.createElement("script")?(n=f.documentElement,i=function(e){var t=f.createElement("script");t.onreadystatechange=function(){p(e),t.onreadystatechange=null,n.removeChild(t),t=null},n.appendChild(t)}):i=function(e){setTimeout(p,0,e)}:(a="setImmediate$"+Math.random()+"$",s=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(a)&&p(+t.data.slice(a.length))},e.addEventListener?e.addEventListener("message",s,!1):e.attachEvent("onmessage",s),i=function(t){e.postMessage(a+t,"*")}),l.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r<t.length;r++)t[r]=arguments[r+1];var n={callback:e,args:t};return c[u]=n,i(u),u++},l.clearImmediate=d}function d(e){delete c[e]}function p(e){if(h)setTimeout(p,0,e);else{var t=c[e];if(t){h=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(void 0,r)}}(t)}finally{d(e),h=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,r(13),r(6))},function(e,t,r){(function(t){function r(e){try{if(!t.localStorage)return!1}catch(e){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=function(e,t){if(r("noDeprecation"))return e;var i=!1;return function(){if(!i){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),i=!0}return e.apply(this,arguments)}}}).call(this,r(13))},function(e,t,r){var i=r(0),n=i.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=i:(o(i,t),t.Buffer=a),o(n,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},function(e,t,r){"use strict";e.exports=o;var i=r(101),n=Object.create(r(39));function o(e){if(!(this instanceof o))return new o(e);i.call(this,e)}n.inherits=r(4),n.inherits(o,i),o.prototype._transform=function(e,t,r){r(null,e)}},function(e,t,r){e.exports=r(69)},function(e,t,r){e.exports=r(28)},function(e,t,r){e.exports=r(38).Transform},function(e,t,r){e.exports=r(38).PassThrough},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){"use strict";var i=r(1).Buffer,n=r(178),o=r(38).Transform;function a(e){o.call(this),this._block=i.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(102)(a,o),a.prototype._transform=function(e,t,r){var i=null;try{this.update(e,t)}catch(e){i=e}r(i)},a.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},a.prototype.update=function(e,t){if(this._finalized)throw new Error("Digest already called");for(var r=n(e,t),i=this._block,o=0;this._blockOffset+r.length-o>=this._blockSize;){for(var a=this._blockOffset;a<this._blockSize;)i[a]=r[o],a+=1,o+=1;this._update(),this._blockOffset=0}for(;o<r.length;)i[this._blockOffset]=r[o],this._blockOffset+=1,o+=1;for(var s=0,u=8*r.length;u>0;++s)this._length[s]+=u,(u=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*u);return this},a.prototype._update=function(){throw new Error("_update is not implemented")},a.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},a.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=a},function(e,t,r){"use strict";var i=r(1).Buffer,n=r(53),o="undefined"!=typeof Uint8Array,a=o&&"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView;e.exports=function(e,t){if("string"==typeof e||i.isBuffer(e)||o&&e instanceof Uint8Array||a&&a(e))return n(e,t);throw new TypeError('The "data" argument must be a string, a Buffer, a Uint8Array, or a DataView')}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){"use strict";var i=r(40),n=r(72)("TypedArray.prototype.buffer",!0),o=r(200);e.exports=n||function(e){if(!o(e))throw new i("Not a Typed Array");return e.buffer}},function(e,t,r){"use strict";e.exports=Error},function(e,t,r){"use strict";e.exports=EvalError},function(e,t,r){"use strict";e.exports=RangeError},function(e,t,r){"use strict";e.exports=ReferenceError},function(e,t,r){"use strict";e.exports=URIError},function(e,t,r){"use strict";e.exports=Math.abs},function(e,t,r){"use strict";e.exports=Math.floor},function(e,t,r){"use strict";e.exports=Math.max},function(e,t,r){"use strict";e.exports=Math.min},function(e,t,r){"use strict";e.exports=Math.pow},function(e,t,r){"use strict";e.exports=Math.round},function(e,t,r){"use strict";var i=r(193);e.exports=function(e){return i(e)||0===e?e:e<0?-1:1}},function(e,t,r){"use strict";e.exports=Number.isNaN||function(e){return e!=e}},function(e,t,r){"use strict";e.exports=Object.getOwnPropertyDescriptor},function(e,t,r){"use strict";var i="undefined"!=typeof Symbol&&Symbol,n=r(74);e.exports=function(){return"function"==typeof i&&("function"==typeof Symbol&&("symbol"==typeof i("foo")&&("symbol"==typeof Symbol("bar")&&n())))}},function(e,t,r){"use strict";var i,n=r(75),o=r(41);try{i=[].__proto__===Array.prototype}catch(e){if(!e||"object"!=typeof e||!("code"in e)||"ERR_PROTO_ACCESS"!==e.code)throw e}var a=!!i&&o&&o(Object.prototype,"__proto__"),s=Object,u=s.getPrototypeOf;e.exports=a&&"function"==typeof a.get?n([a.get]):"function"==typeof u&&function(e){return u(null==e?e:s(e))}},function(e,t,r){"use strict";var i="Function.prototype.bind called on incompatible ",n=Object.prototype.toString,o=Math.max,a=function(e,t){for(var r=[],i=0;i<e.length;i+=1)r[i]=e[i];for(var n=0;n<t.length;n+=1)r[n+e.length]=t[n];return r},s=function(e,t){for(var r=[],i=t||0,n=0;i<e.length;i+=1,n+=1)r[n]=e[i];return r},u=function(e,t){for(var r="",i=0;i<e.length;i+=1)r+=e[i],i+1<e.length&&(r+=t);return r};e.exports=function(e){var t=this;if("function"!=typeof t||"[object Function]"!==n.apply(t))throw new TypeError(i+t);for(var r,c=s(arguments,1),h=function(){if(this instanceof r){var i=t.apply(this,a(c,arguments));return Object(i)===i?i:this}return t.apply(e,a(c,arguments))},f=o(0,t.length-c.length),l=[],d=0;d<f;d++)l[d]="$"+d;if(r=Function("binder","return function ("+u(l,",")+"){ return binder.apply(this,arguments); }")(h),t.prototype){var p=function(){};p.prototype=t.prototype,r.prototype=new p,p.prototype=null}return r}},function(e,t,r){"use strict";e.exports="undefined"!=typeof Reflect&&Reflect&&Reflect.apply},function(e,t,r){"use strict";var i=Function.prototype.call,n=Object.prototype.hasOwnProperty,o=r(42);e.exports=o.call(i,n)},function(e,t,r){"use strict";var i=r(201);e.exports=function(e){return!!i(e)}},function(e,t,r){"use strict";(function(t){var i=r(202),n=r(204),o=r(206),a=r(72),s=r(41),u=r(105),c=a("Object.prototype.toString"),h=r(211)(),f="undefined"==typeof globalThis?t:globalThis,l=n(),d=a("String.prototype.slice"),p=a("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r<e.length;r+=1)if(e[r]===t)return r;return-1},m={__proto__:null};i(l,h&&s&&u?function(e){var t=new f[e];if(Symbol.toStringTag in t&&u){var r=u(t),i=s(r,Symbol.toStringTag);if(!i&&r){var n=u(r);i=s(n,Symbol.toStringTag)}if(i&&i.get){var a=o(i.get);m["$"+e]=a}}}:function(e){var t=new f[e],r=t.slice||t.set;if(r){var i=o(r);m["$"+e]=i}});e.exports=function(e){if(!e||"object"!=typeof e)return!1;if(!h){var t=d(c(e),8,-1);return p(l,t)>-1?t:"Object"===t&&function(e){var t=!1;return i(m,(function(r,i){if(!t)try{r(e),t=d(i,1)}catch(e){}})),t}(e)}return s?function(e){var t=!1;return i(m,(function(r,i){if(!t)try{"$"+r(e)===i&&(t=d(i,1))}catch(e){}})),t}(e):null}}).call(this,r(13))},function(e,t,r){"use strict";var i=r(203),n=Object.prototype.toString,o=Object.prototype.hasOwnProperty,a=function(e,t,r){for(var i=0,n=e.length;i<n;i++)o.call(e,i)&&(null==r?t(e[i],i,e):t.call(r,e[i],i,e))},s=function(e,t,r){for(var i=0,n=e.length;i<n;i++)null==r?t(e.charAt(i),i,e):t.call(r,e.charAt(i),i,e)},u=function(e,t,r){for(var i in e)o.call(e,i)&&(null==r?t(e[i],i,e):t.call(r,e[i],i,e))};function c(e){return"[object Array]"===n.call(e)}e.exports=function(e,t,r){if(!i(t))throw new TypeError("iterator must be a function");var n;arguments.length>=3&&(n=r),c(e)?a(e,t,n):"string"==typeof e?s(e,t,n):u(e,t,n)}},function(e,t,r){"use strict";var i,n,o=Function.prototype.toString,a="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof a&&"function"==typeof Object.defineProperty)try{i=Object.defineProperty({},"length",{get:function(){throw n}}),n={},a((function(){throw 42}),null,i)}catch(e){e!==n&&(a=null)}else a=null;var s=/^\s*class\b/,u=function(e){try{var t=o.call(e);return s.test(t)}catch(e){return!1}},c=function(e){try{return!u(e)&&(o.call(e),!0)}catch(e){return!1}},h=Object.prototype.toString,f="function"==typeof Symbol&&!!Symbol.toStringTag,l=!(0 in[,]),d=function(){return!1};if("object"==typeof document){var p=document.all;h.call(p)===h.call(document.all)&&(d=function(e){if((l||!e)&&(void 0===e||"object"==typeof e))try{var t=h.call(e);return("[object HTMLAllCollection]"===t||"[object HTML document.all class]"===t||"[object HTMLCollection]"===t||"[object Object]"===t)&&null==e("")}catch(e){}return!1})}e.exports=a?function(e){if(d(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;try{a(e,null,i)}catch(e){if(e!==n)return!1}return!u(e)&&c(e)}:function(e){if(d(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(f)return c(e);if(u(e))return!1;var t=h.call(e);return!("[object Function]"!==t&&"[object GeneratorFunction]"!==t&&!/^\[object HTML/.test(t))&&c(e)}},function(e,t,r){"use strict";(function(t){var i=r(205),n="undefined"==typeof globalThis?t:globalThis;e.exports=function(){for(var e=[],t=0;t<i.length;t++)"function"==typeof n[i[t]]&&(e[e.length]=i[t]);return e}}).call(this,r(13))},function(e,t,r){"use strict";e.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]},function(e,t,r){"use strict";var i=r(207),n=r(54),o=r(75),a=r(210);e.exports=function(e){var t=o(arguments),r=1+e.length-(arguments.length-1);return i(t,r>0?r:0,!0)},n?n(e.exports,"apply",{value:a}):e.exports.apply=a},function(e,t,r){"use strict";var i=r(103),n=r(208),o=r(209)(),a=r(41),s=r(40),u=i("%Math.floor%");e.exports=function(e,t){if("function"!=typeof e)throw new s("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||u(t)!==t)throw new s("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,c=!0;if("length"in e&&a){var h=a(e,"length");h&&!h.configurable&&(i=!1),h&&!h.writable&&(c=!1)}return(i||c||!r)&&(o?n(e,"length",t,!0,!0):n(e,"length",t)),e}},function(e,t,r){"use strict";var i=r(54),n=r(104),o=r(40),a=r(41);e.exports=function(e,t,r){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new o("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new o("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new o("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new o("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new o("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new o("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,h=arguments.length>6&&arguments[6],f=!!a&&a(e,t);if(i)i(e,t,{configurable:null===c&&f?f.configurable:!c,enumerable:null===s&&f?f.enumerable:!s,value:r,writable:null===u&&f?f.writable:!u});else{if(!h&&(s||u||c))throw new n("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=r}}},function(e,t,r){"use strict";var i=r(54),n=function(){return!!i};n.hasArrayLengthDefineBug=function(){if(!i)return null;try{return 1!==i([],"length",{value:1}).length}catch(e){return!0}},e.exports=n},function(e,t,r){"use strict";var i=r(42),n=r(77),o=r(108);e.exports=function(){return o(i,n,arguments)}},function(e,t,r){"use strict";var i=r(74);e.exports=function(){return i()&&!!Symbol.toStringTag}},function(e,t,r){"use strict";var i=r(34),n=r(35),o=r(1).Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,n.call(this,64,56)}function c(e){return e<<30|e>>>2}function h(e,t,r,i){return 0===e?t&r|~t&i:2===e?t&r|t&i|r&i:t^r^i}i(u,n),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,f=0;f<16;++f)r[f]=e.readInt32BE(4*f);for(;f<80;++f)r[f]=r[f-3]^r[f-8]^r[f-14]^r[f-16];for(var l=0;l<80;++l){var d=~~(l/20),p=0|((t=i)<<5|t>>>27)+h(d,n,o,s)+u+r[l]+a[d];u=s,s=o,o=c(n),n=i,i=p}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},function(e,t,r){"use strict";var i=r(34),n=r(35),o=r(1).Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,n.call(this,64,56)}function c(e){return e<<5|e>>>27}function h(e){return e<<30|e>>>2}function f(e,t,r,i){return 0===e?t&r|~t&i:2===e?t&r|t&i|r&i:t^r^i}i(u,n),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t,r=this._w,i=0|this._a,n=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,l=0;l<16;++l)r[l]=e.readInt32BE(4*l);for(;l<80;++l)r[l]=(t=r[l-3]^r[l-8]^r[l-14]^r[l-16])<<1|t>>>31;for(var d=0;d<80;++d){var p=~~(d/20),m=c(i)+f(p,n,o,s)+u+r[d]+a[p]|0;u=s,s=o,o=h(n),n=i,i=m}this._a=i+this._a|0,this._b=n+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},function(e,t,r){"use strict";var i=r(34),n=r(109),o=r(35),a=r(1).Buffer,s=new Array(64);function u(){this.init(),this._w=s,o.call(this,64,56)}i(u,n),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var e=a.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},e.exports=u},function(e,t,r){"use strict";var i=r(34),n=r(110),o=r(35),a=r(1).Buffer,s=new Array(160);function u(){this.init(),this._w=s,o.call(this,128,112)}i(u,n),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var e=a.allocUnsafe(48);function t(t,r,i){e.writeInt32BE(t,i),e.writeInt32BE(r,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},e.exports=u},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){"use strict";var i=r(4),n=r(1).Buffer,o=r(23),a=n.alloc(128);function s(e,t){o.call(this,"digest"),"string"==typeof t&&(t=n.from(t)),this._alg=e,this._key=t,t.length>64?t=e(t):t.length<64&&(t=n.concat([t,a],64));for(var r=this._ipad=n.allocUnsafe(64),i=this._opad=n.allocUnsafe(64),s=0;s<64;s++)r[s]=54^t[s],i[s]=92^t[s];this._hash=[r]}i(s,o),s.prototype._update=function(e){this._hash.push(e)},s.prototype._final=function(){var e=this._alg(n.concat(this._hash));return this._alg(n.concat([this._opad,e]))},e.exports=s},function(e,t,r){"use strict";e.exports=r(113)},function(e,t,r){"use strict";(function(t){var i,n,o=r(1).Buffer,a=r(115),s=r(116),u=r(117),c=r(118),h=t.crypto&&t.crypto.subtle,f={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},l=[];function d(){return n||(n=t.process&&t.process.nextTick?t.process.nextTick:t.queueMicrotask?t.queueMicrotask:t.setImmediate?t.setImmediate:t.setTimeout)}function p(e,t,r,i,n){return h.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]).then((function(e){return h.deriveBits({name:"PBKDF2",salt:t,iterations:r,hash:{name:n}},e,i<<3)})).then((function(e){return o.from(e)}))}e.exports=function(e,r,n,m,g,b){if("function"==typeof g&&(b=g,g=void 0),a(n,m),e=c(e,s,"Password"),r=c(r,s,"Salt"),"function"!=typeof b)throw new Error("No callback provided to pbkdf2");var y=f[(g=g||"sha1").toLowerCase()];y&&"function"==typeof t.Promise?function(e,t){e.then((function(e){d()((function(){t(null,e)}))}),(function(e){d()((function(){t(e)}))}))}(function(e){if(t.process&&!t.process.browser)return Promise.resolve(!1);if(!h||!h.importKey||!h.deriveBits)return Promise.resolve(!1);if(void 0!==l[e])return l[e];var r=p(i=i||o.alloc(8),i,10,128,e).then((function(){return!0}),(function(){return!1}));return l[e]=r,r}(y).then((function(t){return t?p(e,r,n,m,y):u(e,r,n,m,g)})),b):d()((function(){var t;try{t=u(e,r,n,m,g)}catch(e){return void b(e)}b(null,t)}))}}).call(this,r(13))},function(e,t,r){var i=r(221),n=r(80),o=r(81),a=r(234),s=r(56);function u(e,t,r){if(e=e.toLowerCase(),o[e])return n.createCipheriv(e,t,r);if(a[e])return new i({key:t,iv:r,mode:e});throw new TypeError("invalid suite type")}function c(e,t,r){if(e=e.toLowerCase(),o[e])return n.createDecipheriv(e,t,r);if(a[e])return new i({key:t,iv:r,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}t.createCipher=t.Cipher=function(e,t){var r,i;if(e=e.toLowerCase(),o[e])r=o[e].key,i=o[e].iv;else{if(!a[e])throw new TypeError("invalid suite type");r=8*a[e].key,i=a[e].iv}var n=s(t,!1,r,i);return u(e,n.key,n.iv)},t.createCipheriv=t.Cipheriv=u,t.createDecipher=t.Decipher=function(e,t){var r,i;if(e=e.toLowerCase(),o[e])r=o[e].key,i=o[e].iv;else{if(!a[e])throw new TypeError("invalid suite type");r=8*a[e].key,i=a[e].iv}var n=s(t,!1,r,i);return c(e,n.key,n.iv)},t.createDecipheriv=t.Decipheriv=c,t.listCiphers=t.getCiphers=function(){return Object.keys(a).concat(n.getCiphers())}},function(e,t,r){var i=r(23),n=r(222),o=r(4),a=r(1).Buffer,s={"des-ede3-cbc":n.CBC.instantiate(n.EDE),"des-ede3":n.EDE,"des-ede-cbc":n.CBC.instantiate(n.EDE),"des-ede":n.EDE,"des-cbc":n.CBC.instantiate(n.DES),"des-ecb":n.DES};function u(e){i.call(this);var t,r=e.mode.toLowerCase(),n=s[r];t=e.decrypt?"decrypt":"encrypt";var o=e.key;a.isBuffer(o)||(o=a.from(o)),"des-ede"!==r&&"des-ede-cbc"!==r||(o=a.concat([o,o.slice(0,8)]));var u=e.iv;a.isBuffer(u)||(u=a.from(u)),this._des=n.create({key:o,iv:u,type:t})}s.des=s["des-cbc"],s.des3=s["des-ede3-cbc"],e.exports=u,o(u,i),u.prototype._update=function(e){return a.from(this._des.update(e))},u.prototype._final=function(){return a.from(this._des.final())}},function(e,t,r){"use strict";t.utils=r(119),t.Cipher=r(79),t.DES=r(120),t.CBC=r(223),t.EDE=r(224)},function(e,t,r){"use strict";var i=r(14),n=r(4),o={};function a(e){i.equal(e.length,8,"Invalid IV length"),this.iv=new Array(8);for(var t=0;t<this.iv.length;t++)this.iv[t]=e[t]}t.instantiate=function(e){function t(t){e.call(this,t),this._cbcInit()}n(t,e);for(var r=Object.keys(o),i=0;i<r.length;i++){var a=r[i];t.prototype[a]=o[a]}return t.create=function(e){return new t(e)},t},o._cbcInit=function(){var e=new a(this.options.iv);this._cbcState=e},o._update=function(e,t,r,i){var n=this._cbcState,o=this.constructor.super_.prototype,a=n.iv;if("encrypt"===this.type){for(var s=0;s<this.blockSize;s++)a[s]^=e[t+s];o._update.call(this,a,0,r,i);for(s=0;s<this.blockSize;s++)a[s]=r[i+s]}else{o._update.call(this,e,t,r,i);for(s=0;s<this.blockSize;s++)r[i+s]^=a[s];for(s=0;s<this.blockSize;s++)a[s]=e[t+s]}}},function(e,t,r){"use strict";var i=r(14),n=r(4),o=r(79),a=r(120);function s(e,t){i.equal(t.length,24,"Invalid key length");var r=t.slice(0,8),n=t.slice(8,16),o=t.slice(16,24);this.ciphers="encrypt"===e?[a.create({type:"encrypt",key:r}),a.create({type:"decrypt",key:n}),a.create({type:"encrypt",key:o})]:[a.create({type:"decrypt",key:o}),a.create({type:"encrypt",key:n}),a.create({type:"decrypt",key:r})]}function u(e){o.call(this,e);var t=new s(this.type,this.options.key);this._edeState=t}n(u,o),e.exports=u,u.create=function(e){return new u(e)},u.prototype._update=function(e,t,r,i){var n=this._edeState;n.ciphers[0]._update(e,t,r,i),n.ciphers[1]._update(r,i,r,i),n.ciphers[2]._update(r,i,r,i)},u.prototype._pad=a.prototype._pad,u.prototype._unpad=a.prototype._unpad},function(e,t,r){var i=r(81),n=r(124),o=r(1).Buffer,a=r(125),s=r(23),u=r(55),c=r(56);function h(e,t,r){s.call(this),this._cache=new l,this._cipher=new u.AES(t),this._prev=o.from(r),this._mode=e,this._autopadding=!0}r(4)(h,s),h.prototype._update=function(e){var t,r;this._cache.add(e);for(var i=[];t=this._cache.get();)r=this._mode.encrypt(this,t),i.push(r);return o.concat(i)};var f=o.alloc(16,16);function l(){this.cache=o.allocUnsafe(0)}function d(e,t,r){var s=i[e.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=o.from(t)),t.length!==s.key/8)throw new TypeError("invalid key length "+t.length);if("string"==typeof r&&(r=o.from(r)),"GCM"!==s.mode&&r.length!==s.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===s.type?new a(s.module,t,r):"auth"===s.type?new n(s.module,t,r):new h(s.module,t,r)}h.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(f))throw this._cipher.scrub(),new Error("data not multiple of block length")},h.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},l.prototype.add=function(e){this.cache=o.concat([this.cache,e])},l.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},l.prototype.flush=function(){for(var e=16-this.cache.length,t=o.allocUnsafe(e),r=-1;++r<e;)t.writeUInt8(e,r);return o.concat([this.cache,t])},t.createCipheriv=d,t.createCipher=function(e,t){var r=i[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=c(t,!1,r.key,r.iv);return d(e,n.key,n.iv)}},function(e,t){t.encrypt=function(e,t){return e._cipher.encryptBlock(t)},t.decrypt=function(e,t){return e._cipher.decryptBlock(t)}},function(e,t,r){var i=r(43);t.encrypt=function(e,t){var r=i(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev},t.decrypt=function(e,t){var r=e._prev;e._prev=t;var n=e._cipher.decryptBlock(t);return i(n,r)}},function(e,t,r){var i=r(1).Buffer,n=r(43);function o(e,t,r){var o=t.length,a=n(t,e._cache);return e._cache=e._cache.slice(o),e._prev=i.concat([e._prev,r?t:a]),a}t.encrypt=function(e,t,r){for(var n,a=i.allocUnsafe(0);t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=i.allocUnsafe(0)),!(e._cache.length<=t.length)){a=i.concat([a,o(e,t,r)]);break}n=e._cache.length,a=i.concat([a,o(e,t.slice(0,n),r)]),t=t.slice(n)}return a}},function(e,t,r){var i=r(1).Buffer;function n(e,t,r){var n=e._cipher.encryptBlock(e._prev)[0]^t;return e._prev=i.concat([e._prev.slice(1),i.from([r?t:n])]),n}t.encrypt=function(e,t,r){for(var o=t.length,a=i.allocUnsafe(o),s=-1;++s<o;)a[s]=n(e,t[s],r);return a}},function(e,t,r){var i=r(1).Buffer;function n(e,t,r){for(var i,n,a=-1,s=0;++a<8;)i=t&1<<7-a?128:0,s+=(128&(n=e._cipher.encryptBlock(e._prev)[0]^i))>>a%8,e._prev=o(e._prev,r?i:n);return s}function o(e,t){var r=e.length,n=-1,o=i.allocUnsafe(e.length);for(e=i.concat([e,i.from([t])]);++n<r;)o[n]=e[n]<<1|e[n+1]>>7;return o}t.encrypt=function(e,t,r){for(var o=t.length,a=i.allocUnsafe(o),s=-1;++s<o;)a[s]=n(e,t[s],r);return a}},function(e,t,r){(function(e){var i=r(43);function n(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}t.encrypt=function(t,r){for(;t._cache.length<r.length;)t._cache=e.concat([t._cache,n(t)]);var o=t._cache.slice(0,r.length);return t._cache=t._cache.slice(r.length),i(r,o)}}).call(this,r(0).Buffer)},function(e,t,r){var i=r(1).Buffer,n=i.alloc(16,0);function o(e){var t=i.allocUnsafe(16);return t.writeUInt32BE(e[0]>>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function a(e){this.h=e,this.state=i.alloc(16,0),this.cache=i.allocUnsafe(0)}a.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()},a.prototype._multiply=function(){for(var e,t,r,i=[(e=this.h).readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.readUInt32BE(12)],n=[0,0,0,0],a=-1;++a<128;){for(0!=(this.state[~~(a/8)]&1<<7-a%8)&&(n[0]^=i[0],n[1]^=i[1],n[2]^=i[2],n[3]^=i[3]),r=0!=(1&i[3]),t=3;t>0;t--)i[t]=i[t]>>>1|(1&i[t-1])<<31;i[0]=i[0]>>>1,r&&(i[0]=i[0]^225<<24)}this.state=o(n)},a.prototype.update=function(e){var t;for(this.cache=i.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},a.prototype.final=function(e,t){return this.cache.length&&this.ghash(i.concat([this.cache,n],16)),this.ghash(o([0,e,0,t])),this.state},e.exports=a},function(e,t,r){var i=r(124),n=r(1).Buffer,o=r(81),a=r(125),s=r(23),u=r(55),c=r(56);function h(e,t,r){s.call(this),this._cache=new f,this._last=void 0,this._cipher=new u.AES(t),this._prev=n.from(r),this._mode=e,this._autopadding=!0}function f(){this.cache=n.allocUnsafe(0)}function l(e,t,r){var s=o[e.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=n.from(r)),"GCM"!==s.mode&&r.length!==s.iv)throw new TypeError("invalid iv length "+r.length);if("string"==typeof t&&(t=n.from(t)),t.length!==s.key/8)throw new TypeError("invalid key length "+t.length);return"stream"===s.type?new a(s.module,t,r,!0):"auth"===s.type?new i(s.module,t,r,!0):new h(s.module,t,r)}r(4)(h,s),h.prototype._update=function(e){var t,r;this._cache.add(e);for(var i=[];t=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,t),i.push(r);return n.concat(i)},h.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return function(e){var t=e[15];if(t<1||t>16)throw new Error("unable to decrypt data");var r=-1;for(;++r<t;)if(e[r+(16-t)]!==t)throw new Error("unable to decrypt data");if(16===t)return;return e.slice(0,16-t)}(this._mode.decrypt(this,e));if(e)throw new Error("data not multiple of block length")},h.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},f.prototype.add=function(e){this.cache=n.concat([this.cache,e])},f.prototype.get=function(e){var t;if(e){if(this.cache.length>16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},f.prototype.flush=function(){if(this.cache.length)return this.cache},t.createDecipher=function(e,t){var r=o[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=c(t,!1,r.key,r.iv);return l(e,i.key,i.iv)},t.createDecipheriv=l},function(e,t){t["des-ecb"]={key:8,iv:0},t["des-cbc"]=t.des={key:8,iv:8},t["des-ede3-cbc"]=t.des3={key:24,iv:8},t["des-ede3"]={key:24,iv:0},t["des-ede-cbc"]={key:16,iv:8},t["des-ede"]={key:16,iv:0}},function(e,t,r){(function(e){var i=r(126),n=r(238),o=r(239);var a={binary:!0,hex:!0,base64:!0};t.DiffieHellmanGroup=t.createDiffieHellmanGroup=t.getDiffieHellman=function(t){var r=new e(n[t].prime,"hex"),i=new e(n[t].gen,"hex");return new o(r,i)},t.createDiffieHellman=t.DiffieHellman=function t(r,n,s,u){return e.isBuffer(n)||void 0===a[n]?t(r,"binary",n,s):(n=n||"binary",u=u||"binary",s=s||new e([2]),e.isBuffer(s)||(s=new e(s,u)),"number"==typeof r?new o(i(r,s),s,!0):(e.isBuffer(r)||(r=new e(r,n)),new o(r,s,!0)))}}).call(this,r(0).Buffer)},function(e,t){},function(e,t){},function(e){e.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}},function(e,t,r){(function(t){var i=r(7),n=new(r(127)),o=new i(24),a=new i(11),s=new i(10),u=new i(3),c=new i(7),h=r(126),f=r(33);function l(e,r){return r=r||"utf8",t.isBuffer(e)||(e=new t(e,r)),this._pub=new i(e),this}function d(e,r){return r=r||"utf8",t.isBuffer(e)||(e=new t(e,r)),this._priv=new i(e),this}e.exports=m;var p={};function m(e,t,r){this.setGenerator(t),this.__prime=new i(e),this._prime=i.mont(this.__prime),this._primeLen=e.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=l,this.setPrivateKey=d):this._primeCode=8}function g(e,r){var i=new t(e.toArray());return r?i.toString(r):i}Object.defineProperty(m.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(e,t){var r=t.toString("hex"),i=[r,e.toString(16)].join("_");if(i in p)return p[i];var f,l=0;if(e.isEven()||!h.simpleSieve||!h.fermatTest(e)||!n.test(e))return l+=1,l+="02"===r||"05"===r?8:4,p[i]=l,l;switch(n.test(e.shrn(1))||(l+=2),r){case"02":e.mod(o).cmp(a)&&(l+=8);break;case"05":(f=e.mod(s)).cmp(u)&&f.cmp(c)&&(l+=8);break;default:l+=4}return p[i]=l,l}(this.__prime,this.__gen)),this._primeCode}}),m.prototype.generateKeys=function(){return this._priv||(this._priv=new i(f(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},m.prototype.computeSecret=function(e){var r=(e=(e=new i(e)).toRed(this._prime)).redPow(this._priv).fromRed(),n=new t(r.toArray()),o=this.getPrime();if(n.length<o.length){var a=new t(o.length-n.length);a.fill(0),n=t.concat([a,n])}return n},m.prototype.getPublicKey=function(e){return g(this._pub,e)},m.prototype.getPrivateKey=function(e){return g(this._priv,e)},m.prototype.getPrime=function(e){return g(this.__prime,e)},m.prototype.getGenerator=function(e){return g(this._gen,e)},m.prototype.setGenerator=function(e,r){return r=r||"utf8",t.isBuffer(e)||(e=new t(e,r)),this.__gen=e,this._gen=new i(e),this}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var i=r(1).Buffer,n=r(37),o=r(38),a=r(241),s=r(242),u=r(277),c=r(113);function h(e){o.Writable.call(this);var t=c[e];if(!t)throw new Error("Unknown message digest");this._hashType=t.hash,this._hash=n(t.hash),this._tag=t.id,this._signType=t.sign}function f(e){o.Writable.call(this);var t=c[e];if(!t)throw new Error("Unknown message digest");this._hash=n(t.hash),this._tag=t.id,this._signType=t.sign}function l(e){return new h(e)}function d(e){return new f(e)}Object.keys(c).forEach((function(e){c[e].id=i.from(c[e].id,"hex"),c[e.toLowerCase()]=c[e]})),a(h,o.Writable),h.prototype._write=function(e,t,r){this._hash.update(e),r()},h.prototype.update=function(e,t){return this._hash.update("string"==typeof e?i.from(e,t):e),this},h.prototype.sign=function(e,t){this.end();var r=this._hash.digest(),i=s(r,e,this._hashType,this._signType,this._tag);return t?i.toString(t):i},a(f,o.Writable),f.prototype._write=function(e,t,r){this._hash.update(e),r()},f.prototype.update=function(e,t){return this._hash.update("string"==typeof e?i.from(e,t):e),this},f.prototype.verify=function(e,t,r){var n="string"==typeof t?i.from(t,r):t;this.end();var o=this._hash.digest();return u(n,o,e,this._signType,this._tag)},e.exports={Sign:l,Verify:d,createSign:l,createVerify:d}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){"use strict";var i=r(1).Buffer,n=r(111),o=r(83),a=r(29).ec,s=r(133),u=r(59),c=r(138);function h(e,t,r,o){if((e=i.from(e.toArray())).length<t.byteLength()){var a=i.alloc(t.byteLength()-e.length);e=i.concat([a,e])}var s=r.length,u=function(e,t){e=(e=f(e,t)).mod(t);var r=i.from(e.toArray());if(r.length<t.byteLength()){var n=i.alloc(t.byteLength()-r.length);r=i.concat([n,r])}return r}(r,t),c=i.alloc(s);c.fill(1);var h=i.alloc(s);return h=n(o,h).update(c).update(i.from([0])).update(e).update(u).digest(),c=n(o,h).update(c).digest(),{k:h=n(o,h).update(c).update(i.from([1])).update(e).update(u).digest(),v:c=n(o,h).update(c).digest()}}function f(e,t){var r=new s(e),i=(e.length<<3)-t.bitLength();return i>0&&r.ishrn(i),r}function l(e,t,r){var o,a;do{for(o=i.alloc(0);8*o.length<e.bitLength();)t.v=n(r,t.k).update(t.v).digest(),o=i.concat([o,t.v]);a=f(o,e),t.k=n(r,t.k).update(t.v).update(i.from([0])).digest(),t.v=n(r,t.k).update(t.v).digest()}while(-1!==a.cmp(e));return a}function d(e,t,r,i){return e.toRed(s.mont(r)).redPow(t).fromRed().mod(i)}e.exports=function(e,t,r,n,p){var m=u(t);if(m.curve){if("ecdsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong private key type");return function(e,t){var r=c[t.curve.join(".")];if(!r)throw new Error("unknown curve "+t.curve.join("."));var n=new a(r).keyFromPrivate(t.privateKey).sign(e);return i.from(n.toDER())}(e,m)}if("dsa"===m.type){if("dsa"!==n)throw new Error("wrong private key type");return function(e,t,r){var n,o=t.params.priv_key,a=t.params.p,u=t.params.q,c=t.params.g,p=new s(0),m=f(e,u).mod(u),g=!1,b=h(o,u,e,r);for(;!1===g;)n=l(u,b,r),p=d(c,n,a,u),0===(g=n.invm(u).imul(m.add(o.mul(p))).mod(u)).cmpn(0)&&(g=!1,p=new s(0));return function(e,t){e=e.toArray(),t=t.toArray(),128&e[0]&&(e=[0].concat(e));128&t[0]&&(t=[0].concat(t));var r=[48,e.length+t.length+4,2,e.length];return r=r.concat(e,[2,t.length],t),i.from(r)}(p,g)}(e,m,r)}if("rsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong private key type");if(void 0!==t.padding&&1!==t.padding)throw new Error("illegal or unsupported padding mode");e=i.concat([p,e]);for(var g=m.modulus.byteLength(),b=[0,1];e.length+b.length+1<g;)b.push(255);b.push(0);for(var y=-1;++y<e.length;)b.push(e[y]);return o(b,m)},e.exports.getKey=h,e.exports.makeKey=l},function(e,t,r){(function(e){!function(e,t){"use strict";function i(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(244).Buffer}catch(e){}function s(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void i(!1,"Invalid character in "+e)}function u(e,t,r){var i=s(e,r);return r-1>=t&&(i|=s(e,r-1)<<4),i}function c(e,t,r,n){for(var o=0,a=0,s=Math.min(e.length,r),u=t;u<s;u++){var c=e.charCodeAt(u)-48;o*=n,a=c>=49?c-49+10:c>=17?c-17+10:c,i(c>=0&&a<n,"Invalid character"),o+=a}return o}function h(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),i(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<e.length&&(16===t?this._parseHex(e,n,r):(this._parseBase(e,t,n),"le"===r&&this._initArray(this.toArray(),t,r)))},o.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(i(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initArray=function(e,t,r){if(i("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,a,s=0;if("be"===r)for(n=e.length-1,o=0;n>=0;n-=3)a=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(n=0,o=0;n<e.length;n+=3)a=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,a=0;if("be"===r)for(i=e.length-1;i>=t;i-=2)n=u(e,t,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;else for(i=(e.length-t)%2==0?t+1:t;i<e.length;i+=2)n=u(e,t,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;this._strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var o=e.length-r,a=o%i,s=Math.min(o,o-a)+r,u=0,h=r;h<s;h+=i)u=c(e,h,h+i,t),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var f=1;for(u=c(e,h,e.length,t),h=0;h<a;h++)f*=t;this.imuln(f),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype._move=function(e){h(e,this)},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch(e){o.prototype.inspect=f}else o.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<n|o)).toString(16);o=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),r=0!==o||a!==this.length-1?l[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var c=d[e],h=p[e];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var m=f.modrn(h).toString(e);r=(f=f.idivn(h)).isZero()?m+r:l[c-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},a&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(a,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function m(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],o=0|t.words[0],a=n*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c<i;c++){for(var h=u>>>26,f=67108863&u,l=Math.min(c,t.length-1),d=Math.max(0,c-e.length+1);d<=l;d++){var p=c-d|0;h+=(a=(n=0|e.words[p])*(o=0|t.words[d])+f)/67108864|0,f=67108863&a}r.words[c]=0|f,u=0|h}return 0!==u?r.words[c]=0|u:r.length--,r._strip()}o.prototype.toArrayLike=function(e,t,r){this._strip();var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,n),a},o.prototype._toArrayLikeLE=function(e,t){for(var r=0,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;e[r++]=255&a,r<e.length&&(e[r++]=a>>8&255),r<e.length&&(e[r++]=a>>16&255),6===o?(r<e.length&&(e[r++]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r<e.length)for(e[r++]=i;r<e.length;)e[r++]=0},o.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;e[r--]=255&a,r>=0&&(e[r--]=a>>8&255),r>=0&&(e[r--]=a>>16&255),6===o?(r>=0&&(e[r--]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r>=0)for(e[r--]=i;r>=0;)e[r--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},o.prototype.ior=function(e){return i(0==(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},o.prototype.iand=function(e){return i(0==(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var i=0;i<r.length;i++)this.words[i]=t.words[i]^r.words[i];if(this!==t)for(;i<t.length;i++)this.words[i]=t.words[i];return this.length=t.length,this._strip()},o.prototype.ixor=function(e){return i(0==(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<n:this.words[r]&~(1<<n),this._strip()},o.prototype.iadd=function(e){var t,r,i;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,i=e):(r=e,i=this);for(var n=0,o=0;o<i.length;o++)t=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&t,n=t>>>26;for(;0!==n&&o<r.length;o++)t=(0|r.words[o])+n,this.words[o]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,i,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=e):(r=e,i=this);for(var o=0,a=0;a<i.length;a++)o=(t=(0|r.words[a])-(0|i.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<r.length;a++)o=(t=(0|r.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var g=function(e,t,r){var i,n,o,a=e.words,s=t.words,u=r.words,c=0,h=0|a[0],f=8191&h,l=h>>>13,d=0|a[1],p=8191&d,m=d>>>13,g=0|a[2],b=8191&g,y=g>>>13,v=0|a[3],_=8191&v,w=v>>>13,S=0|a[4],k=8191&S,I=S>>>13,E=0|a[5],A=8191&E,O=E>>>13,x=0|a[6],P=8191&x,M=x>>>13,T=0|a[7],R=8191&T,B=T>>>13,N=0|a[8],C=8191&N,D=N>>>13,j=0|a[9],L=8191&j,U=j>>>13,H=0|s[0],z=8191&H,F=H>>>13,K=0|s[1],V=8191&K,q=K>>>13,G=0|s[2],Z=8191&G,Y=G>>>13,W=0|s[3],X=8191&W,J=W>>>13,$=0|s[4],Q=8191&$,ee=$>>>13,te=0|s[5],re=8191&te,ie=te>>>13,ne=0|s[6],oe=8191&ne,ae=ne>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,he=0|s[8],fe=8191&he,le=he>>>13,de=0|s[9],pe=8191&de,me=de>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(c+(i=Math.imul(f,z))|0)+((8191&(n=(n=Math.imul(f,F))+Math.imul(l,z)|0))<<13)|0;c=((o=Math.imul(l,F))+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,i=Math.imul(p,z),n=(n=Math.imul(p,F))+Math.imul(m,z)|0,o=Math.imul(m,F);var be=(c+(i=i+Math.imul(f,V)|0)|0)+((8191&(n=(n=n+Math.imul(f,q)|0)+Math.imul(l,V)|0))<<13)|0;c=((o=o+Math.imul(l,q)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,i=Math.imul(b,z),n=(n=Math.imul(b,F))+Math.imul(y,z)|0,o=Math.imul(y,F),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,q)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,q)|0;var ye=(c+(i=i+Math.imul(f,Z)|0)|0)+((8191&(n=(n=n+Math.imul(f,Y)|0)+Math.imul(l,Z)|0))<<13)|0;c=((o=o+Math.imul(l,Y)|0)+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,i=Math.imul(_,z),n=(n=Math.imul(_,F))+Math.imul(w,z)|0,o=Math.imul(w,F),i=i+Math.imul(b,V)|0,n=(n=n+Math.imul(b,q)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,q)|0,i=i+Math.imul(p,Z)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,Y)|0;var ve=(c+(i=i+Math.imul(f,X)|0)|0)+((8191&(n=(n=n+Math.imul(f,J)|0)+Math.imul(l,X)|0))<<13)|0;c=((o=o+Math.imul(l,J)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,i=Math.imul(k,z),n=(n=Math.imul(k,F))+Math.imul(I,z)|0,o=Math.imul(I,F),i=i+Math.imul(_,V)|0,n=(n=n+Math.imul(_,q)|0)+Math.imul(w,V)|0,o=o+Math.imul(w,q)|0,i=i+Math.imul(b,Z)|0,n=(n=n+Math.imul(b,Y)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,Y)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,J)|0;var _e=(c+(i=i+Math.imul(f,Q)|0)|0)+((8191&(n=(n=n+Math.imul(f,ee)|0)+Math.imul(l,Q)|0))<<13)|0;c=((o=o+Math.imul(l,ee)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,i=Math.imul(A,z),n=(n=Math.imul(A,F))+Math.imul(O,z)|0,o=Math.imul(O,F),i=i+Math.imul(k,V)|0,n=(n=n+Math.imul(k,q)|0)+Math.imul(I,V)|0,o=o+Math.imul(I,q)|0,i=i+Math.imul(_,Z)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(w,Z)|0,o=o+Math.imul(w,Y)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,J)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,J)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,ee)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,ee)|0;var we=(c+(i=i+Math.imul(f,re)|0)|0)+((8191&(n=(n=n+Math.imul(f,ie)|0)+Math.imul(l,re)|0))<<13)|0;c=((o=o+Math.imul(l,ie)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,i=Math.imul(P,z),n=(n=Math.imul(P,F))+Math.imul(M,z)|0,o=Math.imul(M,F),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,q)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,q)|0,i=i+Math.imul(k,Z)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,Y)|0,i=i+Math.imul(_,X)|0,n=(n=n+Math.imul(_,J)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,J)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,ee)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,ee)|0,i=i+Math.imul(p,re)|0,n=(n=n+Math.imul(p,ie)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ie)|0;var Se=(c+(i=i+Math.imul(f,oe)|0)|0)+((8191&(n=(n=n+Math.imul(f,ae)|0)+Math.imul(l,oe)|0))<<13)|0;c=((o=o+Math.imul(l,ae)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,i=Math.imul(R,z),n=(n=Math.imul(R,F))+Math.imul(B,z)|0,o=Math.imul(B,F),i=i+Math.imul(P,V)|0,n=(n=n+Math.imul(P,q)|0)+Math.imul(M,V)|0,o=o+Math.imul(M,q)|0,i=i+Math.imul(A,Z)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,Y)|0,i=i+Math.imul(k,X)|0,n=(n=n+Math.imul(k,J)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,J)|0,i=i+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,ee)|0,i=i+Math.imul(b,re)|0,n=(n=n+Math.imul(b,ie)|0)+Math.imul(y,re)|0,o=o+Math.imul(y,ie)|0,i=i+Math.imul(p,oe)|0,n=(n=n+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var ke=(c+(i=i+Math.imul(f,ue)|0)|0)+((8191&(n=(n=n+Math.imul(f,ce)|0)+Math.imul(l,ue)|0))<<13)|0;c=((o=o+Math.imul(l,ce)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,i=Math.imul(C,z),n=(n=Math.imul(C,F))+Math.imul(D,z)|0,o=Math.imul(D,F),i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,q)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,q)|0,i=i+Math.imul(P,Z)|0,n=(n=n+Math.imul(P,Y)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,Y)|0,i=i+Math.imul(A,X)|0,n=(n=n+Math.imul(A,J)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,J)|0,i=i+Math.imul(k,Q)|0,n=(n=n+Math.imul(k,ee)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,ee)|0,i=i+Math.imul(_,re)|0,n=(n=n+Math.imul(_,ie)|0)+Math.imul(w,re)|0,o=o+Math.imul(w,ie)|0,i=i+Math.imul(b,oe)|0,n=(n=n+Math.imul(b,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0,i=i+Math.imul(p,ue)|0,n=(n=n+Math.imul(p,ce)|0)+Math.imul(m,ue)|0,o=o+Math.imul(m,ce)|0;var Ie=(c+(i=i+Math.imul(f,fe)|0)|0)+((8191&(n=(n=n+Math.imul(f,le)|0)+Math.imul(l,fe)|0))<<13)|0;c=((o=o+Math.imul(l,le)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,i=Math.imul(L,z),n=(n=Math.imul(L,F))+Math.imul(U,z)|0,o=Math.imul(U,F),i=i+Math.imul(C,V)|0,n=(n=n+Math.imul(C,q)|0)+Math.imul(D,V)|0,o=o+Math.imul(D,q)|0,i=i+Math.imul(R,Z)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,Y)|0,i=i+Math.imul(P,X)|0,n=(n=n+Math.imul(P,J)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,J)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,ee)|0,i=i+Math.imul(k,re)|0,n=(n=n+Math.imul(k,ie)|0)+Math.imul(I,re)|0,o=o+Math.imul(I,ie)|0,i=i+Math.imul(_,oe)|0,n=(n=n+Math.imul(_,ae)|0)+Math.imul(w,oe)|0,o=o+Math.imul(w,ae)|0,i=i+Math.imul(b,ue)|0,n=(n=n+Math.imul(b,ce)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,ce)|0,i=i+Math.imul(p,fe)|0,n=(n=n+Math.imul(p,le)|0)+Math.imul(m,fe)|0,o=o+Math.imul(m,le)|0;var Ee=(c+(i=i+Math.imul(f,pe)|0)|0)+((8191&(n=(n=n+Math.imul(f,me)|0)+Math.imul(l,pe)|0))<<13)|0;c=((o=o+Math.imul(l,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,i=Math.imul(L,V),n=(n=Math.imul(L,q))+Math.imul(U,V)|0,o=Math.imul(U,q),i=i+Math.imul(C,Z)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(D,Z)|0,o=o+Math.imul(D,Y)|0,i=i+Math.imul(R,X)|0,n=(n=n+Math.imul(R,J)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,J)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,ee)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,ee)|0,i=i+Math.imul(A,re)|0,n=(n=n+Math.imul(A,ie)|0)+Math.imul(O,re)|0,o=o+Math.imul(O,ie)|0,i=i+Math.imul(k,oe)|0,n=(n=n+Math.imul(k,ae)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,ae)|0,i=i+Math.imul(_,ue)|0,n=(n=n+Math.imul(_,ce)|0)+Math.imul(w,ue)|0,o=o+Math.imul(w,ce)|0,i=i+Math.imul(b,fe)|0,n=(n=n+Math.imul(b,le)|0)+Math.imul(y,fe)|0,o=o+Math.imul(y,le)|0;var Ae=(c+(i=i+Math.imul(p,pe)|0)|0)+((8191&(n=(n=n+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;c=((o=o+Math.imul(m,me)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,i=Math.imul(L,Z),n=(n=Math.imul(L,Y))+Math.imul(U,Z)|0,o=Math.imul(U,Y),i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,J)|0)+Math.imul(D,X)|0,o=o+Math.imul(D,J)|0,i=i+Math.imul(R,Q)|0,n=(n=n+Math.imul(R,ee)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,ee)|0,i=i+Math.imul(P,re)|0,n=(n=n+Math.imul(P,ie)|0)+Math.imul(M,re)|0,o=o+Math.imul(M,ie)|0,i=i+Math.imul(A,oe)|0,n=(n=n+Math.imul(A,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,i=i+Math.imul(k,ue)|0,n=(n=n+Math.imul(k,ce)|0)+Math.imul(I,ue)|0,o=o+Math.imul(I,ce)|0,i=i+Math.imul(_,fe)|0,n=(n=n+Math.imul(_,le)|0)+Math.imul(w,fe)|0,o=o+Math.imul(w,le)|0;var Oe=(c+(i=i+Math.imul(b,pe)|0)|0)+((8191&(n=(n=n+Math.imul(b,me)|0)+Math.imul(y,pe)|0))<<13)|0;c=((o=o+Math.imul(y,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,i=Math.imul(L,X),n=(n=Math.imul(L,J))+Math.imul(U,X)|0,o=Math.imul(U,J),i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,ee)|0,i=i+Math.imul(R,re)|0,n=(n=n+Math.imul(R,ie)|0)+Math.imul(B,re)|0,o=o+Math.imul(B,ie)|0,i=i+Math.imul(P,oe)|0,n=(n=n+Math.imul(P,ae)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,ae)|0,i=i+Math.imul(A,ue)|0,n=(n=n+Math.imul(A,ce)|0)+Math.imul(O,ue)|0,o=o+Math.imul(O,ce)|0,i=i+Math.imul(k,fe)|0,n=(n=n+Math.imul(k,le)|0)+Math.imul(I,fe)|0,o=o+Math.imul(I,le)|0;var xe=(c+(i=i+Math.imul(_,pe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(w,pe)|0))<<13)|0;c=((o=o+Math.imul(w,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,i=Math.imul(L,Q),n=(n=Math.imul(L,ee))+Math.imul(U,Q)|0,o=Math.imul(U,ee),i=i+Math.imul(C,re)|0,n=(n=n+Math.imul(C,ie)|0)+Math.imul(D,re)|0,o=o+Math.imul(D,ie)|0,i=i+Math.imul(R,oe)|0,n=(n=n+Math.imul(R,ae)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,ae)|0,i=i+Math.imul(P,ue)|0,n=(n=n+Math.imul(P,ce)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,ce)|0,i=i+Math.imul(A,fe)|0,n=(n=n+Math.imul(A,le)|0)+Math.imul(O,fe)|0,o=o+Math.imul(O,le)|0;var Pe=(c+(i=i+Math.imul(k,pe)|0)|0)+((8191&(n=(n=n+Math.imul(k,me)|0)+Math.imul(I,pe)|0))<<13)|0;c=((o=o+Math.imul(I,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,i=Math.imul(L,re),n=(n=Math.imul(L,ie))+Math.imul(U,re)|0,o=Math.imul(U,ie),i=i+Math.imul(C,oe)|0,n=(n=n+Math.imul(C,ae)|0)+Math.imul(D,oe)|0,o=o+Math.imul(D,ae)|0,i=i+Math.imul(R,ue)|0,n=(n=n+Math.imul(R,ce)|0)+Math.imul(B,ue)|0,o=o+Math.imul(B,ce)|0,i=i+Math.imul(P,fe)|0,n=(n=n+Math.imul(P,le)|0)+Math.imul(M,fe)|0,o=o+Math.imul(M,le)|0;var Me=(c+(i=i+Math.imul(A,pe)|0)|0)+((8191&(n=(n=n+Math.imul(A,me)|0)+Math.imul(O,pe)|0))<<13)|0;c=((o=o+Math.imul(O,me)|0)+(n>>>13)|0)+(Me>>>26)|0,Me&=67108863,i=Math.imul(L,oe),n=(n=Math.imul(L,ae))+Math.imul(U,oe)|0,o=Math.imul(U,ae),i=i+Math.imul(C,ue)|0,n=(n=n+Math.imul(C,ce)|0)+Math.imul(D,ue)|0,o=o+Math.imul(D,ce)|0,i=i+Math.imul(R,fe)|0,n=(n=n+Math.imul(R,le)|0)+Math.imul(B,fe)|0,o=o+Math.imul(B,le)|0;var Te=(c+(i=i+Math.imul(P,pe)|0)|0)+((8191&(n=(n=n+Math.imul(P,me)|0)+Math.imul(M,pe)|0))<<13)|0;c=((o=o+Math.imul(M,me)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,i=Math.imul(L,ue),n=(n=Math.imul(L,ce))+Math.imul(U,ue)|0,o=Math.imul(U,ce),i=i+Math.imul(C,fe)|0,n=(n=n+Math.imul(C,le)|0)+Math.imul(D,fe)|0,o=o+Math.imul(D,le)|0;var Re=(c+(i=i+Math.imul(R,pe)|0)|0)+((8191&(n=(n=n+Math.imul(R,me)|0)+Math.imul(B,pe)|0))<<13)|0;c=((o=o+Math.imul(B,me)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,i=Math.imul(L,fe),n=(n=Math.imul(L,le))+Math.imul(U,fe)|0,o=Math.imul(U,le);var Be=(c+(i=i+Math.imul(C,pe)|0)|0)+((8191&(n=(n=n+Math.imul(C,me)|0)+Math.imul(D,pe)|0))<<13)|0;c=((o=o+Math.imul(D,me)|0)+(n>>>13)|0)+(Be>>>26)|0,Be&=67108863;var Ne=(c+(i=Math.imul(L,pe))|0)+((8191&(n=(n=Math.imul(L,me))+Math.imul(U,pe)|0))<<13)|0;return c=((o=Math.imul(U,me))+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,u[0]=ge,u[1]=be,u[2]=ye,u[3]=ve,u[4]=_e,u[5]=we,u[6]=Se,u[7]=ke,u[8]=Ie,u[9]=Ee,u[10]=Ae,u[11]=Oe,u[12]=xe,u[13]=Pe,u[14]=Me,u[15]=Te,u[16]=Re,u[17]=Be,u[18]=Ne,0!==c&&(u[19]=c,r.length++),r};function b(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var a=n;n=0;for(var s=67108863&i,u=Math.min(o,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var h=o-c,f=(0|e.words[h])*(0|t.words[c]),l=67108863&f;s=67108863&(l=l+s|0),n+=(a=(a=a+(f/67108864|0)|0)+(l>>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(e,t,r){return b(e,t,r)}function v(e,t){this.x=e,this.y=t}Math.imul||(g=m),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?g(this,e,t):r<63?m(this,e,t):r<1024?b(this,e,t):y(this,e,t)},v.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,i=0;i<e;i++)t[i]=this.revBin(i,r,e);return t},v.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var i=0,n=0;n<t;n++)i|=(1&e)<<t-n-1,e>>=1;return i},v.prototype.permute=function(e,t,r,i,n,o){for(var a=0;a<o;a++)i[a]=t[e[a]],n[a]=r[e[a]]},v.prototype.transform=function(e,t,r,i,n,o){this.permute(o,e,t,r,i,n);for(var a=1;a<n;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),h=0;h<n;h+=s)for(var f=u,l=c,d=0;d<a;d++){var p=r[h+d],m=i[h+d],g=r[h+d+a],b=i[h+d+a],y=f*g-l*b;b=f*b+l*g,g=y,r[h+d]=p+g,i[h+d]=m+b,r[h+d+a]=p-g,i[h+d+a]=m-b,d!==s&&(y=u*f-c*l,l=u*l+c*f,f=y)}},v.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},v.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=e[i];e[i]=e[r-i-1],e[r-i-1]=n,n=t[i],t[i]=-t[r-i-1],t[r-i-1]=-n}},v.prototype.normalize13b=function(e,t){for(var r=0,i=0;i<t/2;i++){var n=8192*Math.round(e[2*i+1]/t)+Math.round(e[2*i]/t)+r;e[i]=67108863&n,r=n<67108864?0:n/67108864|0}return e},v.prototype.convert13b=function(e,t,r,n){for(var o=0,a=0;a<t;a++)o+=0|e[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*t;a<n;++a)r[a]=0;i(0===o),i(0==(-8192&o))},v.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},v.prototype.mulp=function(e,t,r){var i=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(i),o=this.stub(i),a=new Array(i),s=new Array(i),u=new Array(i),c=new Array(i),h=new Array(i),f=new Array(i),l=r.words;l.length=i,this.convert13b(e.words,e.length,a,i),this.convert13b(t.words,t.length,c,i),this.transform(a,o,s,u,i,n),this.transform(c,o,h,f,i,n);for(var d=0;d<i;d++){var p=s[d]*h[d]-u[d]*f[d];u[d]=s[d]*f[d]+u[d]*h[d],s[d]=p}return this.conjugate(s,u,i),this.transform(s,u,l,o,i,n),this.conjugate(l,o,i),this.normalize13b(l,i),r.negative=e.negative^t.negative,r.length=e.length+t.length,r._strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),y(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){var t=e<0;t&&(e=-e),i("number"==typeof e),i(e<67108864);for(var r=0,n=0;n<this.length;n++){var o=(0|this.words[n])*e,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[n]=67108863&a}return 0!==r&&(this.words[n]=r,this.length++),this.length=0===e?1:this.length,t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var i=r/26|0,n=r%26;t[r]=e.words[i]>>>n&1}return t}(e);if(0===t.length)return new o(1);for(var r=this,i=0;i<t.length&&0===t[i];i++,r=r.sqr());if(++i<t.length)for(var n=r.sqr();i<t.length;i++,n=n.sqr())0!==t[i]&&(r=r.mul(n));return r},o.prototype.iushln=function(e){i("number"==typeof e&&e>=0);var t,r=e%26,n=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<r;this.words[t]=u|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t<n;t++)this.words[t]=0;this.length+=n}return this._strip()},o.prototype.ishln=function(e){return i(0===this.negative),this.iushln(e)},o.prototype.iushrn=function(e,t,r){var n;i("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(n-=a,n=Math.max(0,n),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var h=0;for(c=this.length-1;c>=0&&(0!==h||c>=n);c--){var f=0|this.words[c];this.words[c]=h<<26-o|f>>>o,h=f&s}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,r){return i(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,n=1<<t;return!(this.length<=r)&&!!(this.words[r]&n)},o.prototype.imaskn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(i(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 n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return 0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return i("number"==typeof e),i(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(i("number"==typeof e),i(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,r){var n,o,a=e.length+r;this._expand(a);var s=0;for(n=0;n<e.length;n++){o=(0|this.words[n+r])+s;var u=(0|e.words[n])*t;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[n+r]=67108863&o}for(;n<this.length-r;n++)s=(o=(0|this.words[n+r])+s)>>26,this.words[n+r]=67108863&o;if(0===s)return this._strip();for(i(-1===s),s=0,n=0;n<this.length;n++)s=(o=-(0|this.words[n])+s)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),i=this.clone(),n=e,a=0|n.words[n.length-1];0!==(r=26-this._countBits(a))&&(n=n.ushln(r),i.iushln(r),a=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==t){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var h=i.clone()._ishlnsubmul(n,1,u);0===h.negative&&(i=h,s&&(s.words[u]=1));for(var f=u-1;f>=0;f--){var l=67108864*(0|i.words[n.length+f])+(0|i.words[n.length+f-1]);for(l=Math.min(l/a|0,67108863),i._ishlnsubmul(n,l,f);0!==i.negative;)l--,i.negative=0,i._ishlnsubmul(n,1,f),i.isZero()||(i.negative^=1);s&&(s.words[f]=l)}return s&&s._strip(),i._strip(),"div"!==t&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},o.prototype.divmod=function(e,t,r){return i(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(n=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:n,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var n,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),i(e<=67108863);for(var r=(1<<26)%e,n=0,o=this.length-1;o>=0;o--)n=(r*n+(0|this.words[o]))%e;return t?-n:n},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),i(e<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*r;this.words[n]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var h=r.clone(),f=t.clone();!t.isZero();){for(var l=0,d=1;0==(t.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(t.iushrn(l);l-- >0;)(n.isOdd()||a.isOdd())&&(n.iadd(h),a.isub(f)),n.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(h),u.isub(f)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(s),a.isub(u)):(r.isub(t),s.isub(n),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},o.prototype._invmp=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n,a=new o(1),s=new o(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,h=1;0==(t.words[0]&h)&&c<26;++c,h<<=1);if(c>0)for(t.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var f=0,l=1;0==(r.words[0]&l)&&f<26;++f,l<<=1);if(f>0)for(r.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(n=0===t.cmpn(1)?a:s).cmpn(0)<0&&n.iadd(e),n},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)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(i)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){i("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var o=n,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),i(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:n<e?-1:1}return 0!==this.negative?0|-t:t},o.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){i<n?t=-1:i>n&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new A(e)},o.prototype.toRed=function(e){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return i(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return i(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var _={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function S(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function k(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function I(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function O(e){A.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var i=t<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},n(S,w),S.prototype.split=function(e,t){for(var r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var n=e.words[9];for(t.words[t.length++]=4194303&n,i=10;i<e.length;i++){var o=0|e.words[i];e.words[i-10]=(4194303&o)<<4|n>>>22,n=o}n>>>=22,e.words[i-10]=n,0===n&&e.length>10?e.length-=10:e.length-=9},S.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var i=0|e.words[r];t+=977*i,e.words[r]=67108863&t,t=64*i+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(k,w),n(I,w),n(E,w),E.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var i=19*(0|e.words[r])+t,n=67108863&i;i>>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(_[e])return _[e];var t;if("k256"===e)t=new S;else if("p224"===e)t=new k;else if("p192"===e)t=new I;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return _[e]=t,t},A.prototype._verify1=function(e){i(0===e.negative,"red works only with positives"),i(e.red,"red works only with red numbers")},A.prototype._verify2=function(e,t){i(0==(e.negative|t.negative),"red works only with positives"),i(e.red&&e.red===t.red,"red works only with red numbers")},A.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(h(e,e.umod(this.m)._forceRed(this)),e)},A.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},A.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},A.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},A.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},A.prototype.isqr=function(e){return this.imul(e,e.clone())},A.prototype.sqr=function(e){return this.mul(e,e)},A.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(i(t%2==1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),a=0;!n.isZero()&&0===n.andln(1);)a++,n.iushrn(1);i(!n.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);0!==this.pow(h,c).cmp(u);)h.redIAdd(u);for(var f=this.pow(h,n),l=this.pow(e,n.addn(1).iushrn(1)),d=this.pow(e,n),p=a;0!==d.cmp(s);){for(var m=d,g=0;0!==m.cmp(s);g++)m=m.redSqr();i(g<p);var b=this.pow(f,new o(1).iushln(p-g-1));l=l.redMul(b),f=b.redSqr(),d=d.redMul(f),p=g}return l},A.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},A.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=e;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],e);var n=r[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),i=t.length-1;i>=0;i--){for(var c=t.words[i],h=u-1;h>=0;h--){var f=c>>h&1;n!==r[0]&&(n=this.sqr(n)),0!==f||0!==a?(a<<=1,a|=f,(4===++s||0===i&&0===h)&&(n=this.mul(n,r[a]),s=0,a=0)):s=0}u=26}return n},A.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},A.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new O(e)},n(O,A),O.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},O.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},O.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).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)},O.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},O.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,this)}).call(this,r(24)(e))},function(e,t){},function(e){e.exports={name:"elliptic",version:"6.6.1",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny <fedor@indutny.com>",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}},function(e,t,r){"use strict";var i=r(15),n=r(7),o=r(84),a=r(57),s=i.assert;function u(e){a.call(this,"short",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function c(e,t,r,i){a.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new n(t,16),this.y=new n(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function h(e,t,r,i){a.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new n(0)):(this.x=new n(t,16),this.y=new n(r,16),this.z=new n(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,a),e.exports=u,u.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new n(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);t=(t=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(e.lambda)r=new n(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?r=o[0]:(r=o[1],s(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new n(e.a,16),b:new n(e.b,16)}})):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:n.mont(e),r=new n(2).toRed(t).redInvm(),i=r.redNeg(),o=new n(3).toRed(t).redNeg().redSqrt().redMul(r);return[i.redAdd(o).fromRed(),i.redSub(o).fromRed()]},u.prototype._getEndoBasis=function(e){for(var t,r,i,o,a,s,u,c,h,f=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=e,d=this.n.clone(),p=new n(1),m=new n(0),g=new n(0),b=new n(1),y=0;0!==l.cmpn(0);){var v=d.div(l);c=d.sub(v.mul(l)),h=g.sub(v.mul(p));var _=b.sub(v.mul(m));if(!i&&c.cmp(f)<0)t=u.neg(),r=p,i=c.neg(),o=h;else if(i&&2==++y)break;u=c,d=l,l=c,g=p,p=h,b=m,m=_}a=c.neg(),s=h;var w=i.sqr().add(o.sqr());return a.sqr().add(s.sqr()).cmp(w)>=0&&(a=t,s=r),i.negative&&(i=i.neg(),o=o.neg()),a.negative&&(a=a.neg(),s=s.neg()),[{a:i,b:o},{a:a,b:s}]},u.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],i=t[1],n=i.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=n.mul(r.a),s=o.mul(i.a),u=n.mul(r.b),c=o.mul(i.b);return{k1:e.sub(a).sub(s),k2:u.add(c).neg()}},u.prototype.pointFromX=function(e,t){(e=new n(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=i.fromRed().isOdd();return(t&&!o||!t&&o)&&(i=i.redNeg()),this.point(e,i)},u.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,i=this.a.redMul(t),n=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},u.prototype._endoWnafMulAdd=function(e,t,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,o=0;o<e.length;o++){var a=this._endoSplit(t[o]),s=e[o],u=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),u=u.neg(!0)),i[2*o]=s,i[2*o+1]=u,n[2*o]=a.k1,n[2*o+1]=a.k2}for(var c=this._wnafMulAdd(1,i,n,2*o,r),h=0;h<2*o;h++)i[h]=null,n[h]=null;return c},o(c,a.BasePoint),u.prototype.point=function(e,t,r){return new c(this,e,t,r)},u.prototype.pointFromJSON=function(e,t){return c.fromJSON(this,e,t)},c.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,i=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(i)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(i)}}}return t}},c.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},c.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var i=e.point(t[0],t[1],r);if(!t[2])return i;function n(t){return e.point(t[0],t[1],r)}var o=t[2];return i.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[i].concat(o.doubles.points.map(n))},naf:o.naf&&{wnd:o.naf.wnd,points:[i].concat(o.naf.points.map(n))}},i},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return this.inf},c.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},c.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),i=e.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(i),o=n.redSqr().redISub(this.x.redAdd(this.x)),a=n.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(e){return e=new n(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,r){var i=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},c.prototype.jmulAdd=function(e,t,r){var i=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},c.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},c.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,i=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return t},c.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(h,a.BasePoint),u.prototype.jpoint=function(e,t,r){return new h(this,e,t,r)},h.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(r,i)},h.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},h.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(t),n=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=i.redSub(n),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),h=c.redMul(s),f=i.redMul(c),l=u.redSqr().redIAdd(h).redISub(f).redISub(f),d=u.redMul(f.redISub(l)).redISub(o.redMul(h)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(l,d,p)},h.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,i=e.x.redMul(t),n=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(i),s=n.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),h=r.redMul(u),f=s.redSqr().redIAdd(c).redISub(h).redISub(h),l=s.redMul(h.redISub(f)).redISub(n.redMul(c)),d=this.z.redMul(a);return this.curve.jpoint(f,l,d)},h.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t<e;t++)r=r.dbl();return r}var i=this.curve.a,n=this.curve.tinv,o=this.x,a=this.y,s=this.z,u=s.redSqr().redSqr(),c=a.redAdd(a);for(t=0;t<e;t++){var h=o.redSqr(),f=c.redSqr(),l=f.redSqr(),d=h.redAdd(h).redIAdd(h).redIAdd(i.redMul(u)),p=o.redMul(f),m=d.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),b=d.redMul(g);b=b.redIAdd(b).redISub(l);var y=c.redMul(s);t+1<e&&(u=u.redMul(l)),o=m,s=y,c=b}return this.curve.jpoint(o,c.redMul(n),s)},h.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},h.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),o=n.redSqr(),a=this.x.redAdd(n).redSqr().redISub(i).redISub(o);a=a.redIAdd(a);var s=i.redAdd(i).redIAdd(i),u=s.redSqr().redISub(a).redISub(a),c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),e=u,t=s.redMul(a.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var h=this.x.redSqr(),f=this.y.redSqr(),l=f.redSqr(),d=this.x.redAdd(f).redSqr().redISub(h).redISub(l);d=d.redIAdd(d);var p=h.redAdd(h).redIAdd(h),m=p.redSqr(),g=l.redIAdd(l);g=(g=g.redIAdd(g)).redIAdd(g),e=m.redISub(d).redISub(d),t=p.redMul(d.redISub(e)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},h.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),o=n.redSqr(),a=this.x.redAdd(n).redSqr().redISub(i).redISub(o);a=a.redIAdd(a);var s=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),u=s.redSqr().redISub(a).redISub(a);e=u;var c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),t=s.redMul(a.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var h=this.z.redSqr(),f=this.y.redSqr(),l=this.x.redMul(f),d=this.x.redSub(h).redMul(this.x.redAdd(h));d=d.redAdd(d).redIAdd(d);var p=l.redIAdd(l),m=(p=p.redIAdd(p)).redAdd(p);e=d.redSqr().redISub(m),r=this.y.redAdd(this.z).redSqr().redISub(f).redISub(h);var g=f.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),t=d.redMul(p.redISub(e)).redISub(g)}return this.curve.jpoint(e,t,r)},h.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,i=this.z,n=i.redSqr().redSqr(),o=t.redSqr(),a=r.redSqr(),s=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(n)),u=t.redAdd(t),c=(u=u.redIAdd(u)).redMul(a),h=s.redSqr().redISub(c.redAdd(c)),f=c.redISub(h),l=a.redSqr();l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=s.redMul(f).redISub(l),p=r.redAdd(r).redMul(i);return this.curve.jpoint(h,d,p)},h.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),i=t.redSqr(),n=e.redAdd(e).redIAdd(e),o=n.redSqr(),a=this.x.redAdd(t).redSqr().redISub(e).redISub(i),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),u=i.redIAdd(i);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=n.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(u),h=t.redMul(c);h=(h=h.redIAdd(h)).redIAdd(h);var f=this.x.redMul(s).redISub(h);f=(f=f.redIAdd(f)).redIAdd(f);var l=this.y.redMul(c.redMul(u.redISub(c)).redISub(a.redMul(s)));l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=this.z.redAdd(a).redSqr().redISub(r).redISub(s);return this.curve.jpoint(f,l,d)},h.prototype.mul=function(e,t){return e=new n(e,t),this.curve._wnafMul(this,e)},h.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var i=t.redMul(this.z),n=r.redMul(e.z);return 0===this.y.redMul(n).redISub(e.y.redMul(i)).cmpn(0)},h.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var i=e.clone(),n=this.curve.redN.redMul(t);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},h.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},h.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(e,t,r){"use strict";var i=r(7),n=r(84),o=r(57),a=r(15);function s(e){o.call(this,"mont",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(e,t,r){o.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(t,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}n(s,o),e.exports=s,s.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),i=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===i.redSqrt().redSqr().cmp(i)},n(u,o.BasePoint),s.prototype.decodePoint=function(e,t){return this.point(a.toArray(e,t),1)},s.prototype.point=function(e,t){return new u(this,e,t)},s.prototype.pointFromJSON=function(e){return u.fromJSON(this,e)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(e,t){return new u(e,t[0],t[1]||e.one)},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),i=e.redMul(t),n=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(r),a=n.redMul(i),s=t.z.redMul(o.redAdd(a).redSqr()),u=t.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},u.prototype.mul=function(e){for(var t=e.clone(),r=this,i=this.curve.point(null,null),n=[];0!==t.cmpn(0);t.iushrn(1))n.push(t.andln(1));for(var o=n.length-1;o>=0;o--)0===n[o]?(r=r.diffAdd(i,this),i=i.dbl()):(i=r.diffAdd(i,this),r=r.dbl());return i},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(e,t,r){"use strict";var i=r(15),n=r(7),o=r(84),a=r(57),s=i.assert;function u(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,a.call(this,"edwards",e),this.a=new n(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new n(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new n(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),s(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function c(e,t,r,i,o){a.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new n(t,16),this.y=new n(r,16),this.z=i?new n(i,16):this.curve.one,this.t=o&&new n(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}o(u,a),e.exports=u,u.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},u.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},u.prototype.jpoint=function(e,t,r,i){return this.point(e,t,r,i)},u.prototype.pointFromX=function(e,t){(e=new n(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),i=this.c2.redSub(this.a.redMul(r)),o=this.one.redSub(this.c2.redMul(this.d).redMul(r)),a=i.redMul(o.redInvm()),s=a.redSqrt();if(0!==s.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");var u=s.fromRed().isOdd();return(t&&!u||!t&&u)&&(s=s.redNeg()),this.point(e,s)},u.prototype.pointFromY=function(e,t){(e=new n(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),i=r.redSub(this.c2),o=r.redMul(this.d).redMul(this.c2).redSub(this.a),a=i.redMul(o.redInvm());if(0===a.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var s=a.redSqrt();if(0!==s.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");return s.fromRed().isOdd()!==t&&(s=s.redNeg()),this.point(s,e)},u.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),i=t.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===i.cmp(n)},o(c,a.BasePoint),u.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},u.prototype.point=function(e,t,r,i){return new c(this,e,t,r,i)},c.fromJSON=function(e,t){return new c(e,t[0],t[1],t[2])},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},c.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(e),n=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=i.redAdd(t),a=o.redSub(r),s=i.redSub(t),u=n.redMul(a),c=o.redMul(s),h=n.redMul(s),f=a.redMul(o);return this.curve.point(u,c,f,h)},c.prototype._projDbl=function(){var e,t,r,i,n,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var c=(i=this.curve._mulA(s)).redAdd(u);this.zOne?(e=a.redSub(s).redSub(u).redMul(c.redSub(this.curve.two)),t=c.redMul(i.redSub(u)),r=c.redSqr().redSub(c).redSub(c)):(n=this.z.redSqr(),o=c.redSub(n).redISub(n),e=a.redSub(s).redISub(u).redMul(o),t=c.redMul(i.redSub(u)),r=c.redMul(o))}else i=s.redAdd(u),n=this.curve._mulC(this.z).redSqr(),o=i.redSub(n).redSub(n),e=this.curve._mulC(a.redISub(i)).redMul(o),t=this.curve._mulC(i).redMul(s.redISub(u)),r=i.redMul(o);return this.curve.point(e,t,r)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),n=this.z.redMul(e.z.redAdd(e.z)),o=r.redSub(t),a=n.redSub(i),s=n.redAdd(i),u=r.redAdd(t),c=o.redMul(a),h=s.redMul(u),f=o.redMul(u),l=a.redMul(s);return this.curve.point(c,h,l,f)},c.prototype._projAdd=function(e){var t,r,i=this.z.redMul(e.z),n=i.redSqr(),o=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(o).redMul(a),u=n.redSub(s),c=n.redAdd(s),h=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a),f=i.redMul(u).redMul(h);return this.curve.twisted?(t=i.redMul(c).redMul(a.redSub(this.curve._mulA(o))),r=u.redMul(c)):(t=i.redMul(c).redMul(a.redSub(o)),r=this.curve._mulC(u).redMul(c)),this.curve.point(f,t,r)},c.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},c.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},c.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},c.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},c.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(i),0===this.x.cmp(t))return!0}},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add},function(e,t,r){"use strict";t.sha1=r(250),t.sha224=r(251),t.sha256=r(131),t.sha384=r(252),t.sha512=r(132)},function(e,t,r){"use strict";var i=r(19),n=r(44),o=r(130),a=i.rotl32,s=i.sum32,u=i.sum32_5,c=o.ft_1,h=n.BlockHash,f=[1518500249,1859775393,2400959708,3395469782];function l(){if(!(this instanceof l))return new l;h.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}i.inherits(l,h),e.exports=l,l.blockSize=512,l.outSize=160,l.hmacStrength=80,l.padLength=64,l.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;i<r.length;i++)r[i]=a(r[i-3]^r[i-8]^r[i-14]^r[i-16],1);var n=this.h[0],o=this.h[1],h=this.h[2],l=this.h[3],d=this.h[4];for(i=0;i<r.length;i++){var p=~~(i/20),m=u(a(n,5),c(p,o,h,l),d,r[i],f[p]);d=l,l=h,h=a(o,30),o=n,n=m}this.h[0]=s(this.h[0],n),this.h[1]=s(this.h[1],o),this.h[2]=s(this.h[2],h),this.h[3]=s(this.h[3],l),this.h[4]=s(this.h[4],d)},l.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},function(e,t,r){"use strict";var i=r(19),n=r(131);function o(){if(!(this instanceof o))return new o;n.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}i.inherits(o,n),e.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h.slice(0,7),"big"):i.split32(this.h.slice(0,7),"big")}},function(e,t,r){"use strict";var i=r(19),n=r(132);function o(){if(!(this instanceof o))return new o;n.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}i.inherits(o,n),e.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h.slice(0,12),"big"):i.split32(this.h.slice(0,12),"big")}},function(e,t,r){"use strict";var i=r(19),n=r(44),o=i.rotl32,a=i.sum32,s=i.sum32_3,u=i.sum32_4,c=n.BlockHash;function h(){if(!(this instanceof h))return new h;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function f(e,t,r,i){return e<=15?t^r^i:e<=31?t&r|~t&i:e<=47?(t|~r)^i:e<=63?t&i|r&~i:t^(r|~i)}function l(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function d(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}i.inherits(h,c),t.ripemd160=h,h.blockSize=512,h.outSize=160,h.hmacStrength=192,h.padLength=64,h.prototype._update=function(e,t){for(var r=this.h[0],i=this.h[1],n=this.h[2],c=this.h[3],h=this.h[4],y=r,v=i,_=n,w=c,S=h,k=0;k<80;k++){var I=a(o(u(r,f(k,i,n,c),e[p[k]+t],l(k)),g[k]),h);r=h,h=c,c=o(n,10),n=i,i=I,I=a(o(u(y,f(79-k,v,_,w),e[m[k]+t],d(k)),b[k]),S),y=S,S=w,w=o(_,10),_=v,v=I}I=s(this.h[1],n,w),this.h[1]=s(this.h[2],c,S),this.h[2]=s(this.h[3],h,y),this.h[3]=s(this.h[4],r,v),this.h[4]=s(this.h[0],i,_),this.h[0]=I},h.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"little"):i.split32(this.h,"little")};var p=[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],m=[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],g=[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],b=[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]},function(e,t,r){"use strict";var i=r(19),n=r(14);function o(e,t,r){if(!(this instanceof o))return new o(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(i.toArray(t,r))}e.exports=o,o.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),n(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},o.prototype.update=function(e,t){return this.inner.update(e,t),this},o.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}},function(e,t){e.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},function(e,t,r){"use strict";var i=r(7),n=r(257),o=r(15),a=r(85),s=r(82),u=o.assert,c=r(258),h=r(259);function f(e){if(!(this instanceof f))return new f(e);"string"==typeof e&&(u(Object.prototype.hasOwnProperty.call(a,e),"Unknown curve "+e),e=a[e]),e instanceof a.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=f,f.prototype.keyPair=function(e){return new c(this,e)},f.prototype.keyFromPrivate=function(e,t){return c.fromPrivate(this,e,t)},f.prototype.keyFromPublic=function(e,t){return c.fromPublic(this,e,t)},f.prototype.genKeyPair=function(e){e||(e={});for(var t=new n({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||s(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new i(2));;){var a=new i(t.generate(r));if(!(a.cmp(o)>0))return a.iaddn(1),this.keyFromPrivate(a)}},f.prototype._truncateToN=function(e,t,r){var n;if(i.isBN(e)||"number"==typeof e)n=(e=new i(e,16)).byteLength();else if("object"==typeof e)n=e.length,e=new i(e,16);else{var o=e.toString();n=o.length+1>>>1,e=new i(o,16)}"number"!=typeof r&&(r=8*n);var a=r-this.n.bitLength();return a>0&&(e=e.ushrn(a)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},f.prototype.sign=function(e,t,r,o){if("object"==typeof r&&(o=r,r=null),o||(o={}),"string"!=typeof e&&"number"!=typeof e&&!i.isBN(e)){u("object"==typeof e&&e&&"number"==typeof e.length,"Expected message to be an array-like, a hex string, or a BN instance"),u(e.length>>>0===e.length);for(var a=0;a<e.length;a++)u((255&e[a])===e[a])}t=this.keyFromPrivate(t,r),e=this._truncateToN(e,!1,o.msgBitLength),u(!e.isNeg(),"Can not sign a negative message");var s=this.n.byteLength(),c=t.getPrivate().toArray("be",s),f=e.toArray("be",s);u(new i(f).eq(e),"Can not sign message");for(var l=new n({hash:this.hash,entropy:c,nonce:f,pers:o.pers,persEnc:o.persEnc||"utf8"}),d=this.n.sub(new i(1)),p=0;;p++){var m=o.k?o.k(p):new i(l.generate(this.n.byteLength()));if(!((m=this._truncateToN(m,!0)).cmpn(1)<=0||m.cmp(d)>=0)){var g=this.g.mul(m);if(!g.isInfinity()){var b=g.getX(),y=b.umod(this.n);if(0!==y.cmpn(0)){var v=m.invm(this.n).mul(y.mul(t.getPrivate()).iadd(e));if(0!==(v=v.umod(this.n)).cmpn(0)){var _=(g.getY().isOdd()?1:0)|(0!==b.cmp(y)?2:0);return o.canonical&&v.cmp(this.nh)>0&&(v=this.n.sub(v),_^=1),new h({r:y,s:v,recoveryParam:_})}}}}}},f.prototype.verify=function(e,t,r,i,n){n||(n={}),e=this._truncateToN(e,!1,n.msgBitLength),r=this.keyFromPublic(r,i);var o=(t=new h(t,"hex")).r,a=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var s,u=a.invm(this.n),c=u.mul(e).umod(this.n),f=u.mul(o).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(c,r.getPublic(),f)).isInfinity()&&s.eqXToP(o):!(s=this.g.mulAdd(c,r.getPublic(),f)).isInfinity()&&0===s.getX().umod(this.n).cmp(o)},f.prototype.recoverPubKey=function(e,t,r,n){u((3&r)===r,"The recovery param is more than two bits"),t=new h(t,n);var o=this.n,a=new i(e),s=t.r,c=t.s,f=1&r,l=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");s=l?this.curve.pointFromX(s.add(this.curve.n),f):this.curve.pointFromX(s,f);var d=t.r.invm(o),p=o.sub(a).mul(d).umod(o),m=c.mul(d).umod(o);return this.g.mulAdd(p,s,m)},f.prototype.getKeyRecoveryParam=function(e,t,r,i){if(null!==(t=new h(t,i)).recoveryParam)return t.recoveryParam;for(var n=0;n<4;n++){var o;try{o=this.recoverPubKey(e,t,n)}catch(e){continue}if(o.eq(r))return n}throw new Error("Unable to find valid recovery factor")}},function(e,t,r){"use strict";var i=r(58),n=r(128),o=r(14);function a(e){if(!(this instanceof a))return new a(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=n.toArray(e.entropy,e.entropyEnc||"hex"),r=n.toArray(e.nonce,e.nonceEnc||"hex"),i=n.toArray(e.pers,e.persEnc||"hex");o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,i)}e.exports=a,a.prototype._init=function(e,t,r){var i=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n<this.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},a.prototype._hmac=function(){return new i.hmac(this.hash,this.K)},a.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},a.prototype.reseed=function(e,t,r,i){"string"!=typeof t&&(i=r,r=t,t=null),e=n.toArray(e,t),r=n.toArray(r,i),o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},a.prototype.generate=function(e,t,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(i=r,r=t,t=null),r&&(r=n.toArray(r,i||"hex"),this._update(r));for(var o=[];o.length<e;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var a=o.slice(0,e);return this._update(r),this._reseed++,n.encode(a,t)}},function(e,t,r){"use strict";var i=r(7),n=r(15).assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=o,o.fromPublic=function(e,t,r){return t instanceof o?t:new o(e,{pub:t,pubEnc:r})},o.fromPrivate=function(e,t,r){return t instanceof o?t:new o(e,{priv:t,privEnc:r})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new i(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?n(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||n(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.validate()||n(e.validate(),"public point not validated"),e.mul(this.priv).getX()},o.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},o.prototype.verify=function(e,t,r){return this.ec.verify(e,t,this,void 0,r)},o.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},function(e,t,r){"use strict";var i=r(7),n=r(15),o=n.assert;function a(e,t){if(e instanceof a)return e;this._importDER(e,t)||(o(e.r&&e.s,"Signature without r or s"),this.r=new i(e.r,16),this.s=new i(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function s(){this.place=0}function u(e,t){var r=e[t.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;if(0===e[t.place])return!1;for(var n=0,o=0,a=t.place;o<i;o++,a++)n<<=8,n|=e[a],n>>>=0;return!(n<=127)&&(t.place=a,n)}function c(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function h(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}e.exports=a,a.prototype._importDER=function(e,t){e=n.toArray(e,t);var r=new s;if(48!==e[r.place++])return!1;var o=u(e,r);if(!1===o)return!1;if(o+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var a=u(e,r);if(!1===a)return!1;if(0!=(128&e[r.place]))return!1;var c=e.slice(r.place,a+r.place);if(r.place+=a,2!==e[r.place++])return!1;var h=u(e,r);if(!1===h)return!1;if(e.length!==h+r.place)return!1;if(0!=(128&e[r.place]))return!1;var f=e.slice(r.place,h+r.place);if(0===c[0]){if(!(128&c[1]))return!1;c=c.slice(1)}if(0===f[0]){if(!(128&f[1]))return!1;f=f.slice(1)}return this.r=new i(c),this.s=new i(f),this.recoveryParam=null,!0},a.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=c(t),r=c(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];h(i,t.length),(i=i.concat(t)).push(2),h(i,r.length);var o=i.concat(r),a=[48];return h(a,o.length),a=a.concat(o),n.encode(a,e)}},function(e,t,r){"use strict";var i=r(58),n=r(85),o=r(15),a=o.assert,s=o.parseBytes,u=r(261),c=r(262);function h(e){if(a("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof h))return new h(e);e=n[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=i.sha512}e.exports=h,h.prototype.sign=function(e,t){e=s(e);var r=this.keyFromSecret(t),i=this.hashInt(r.messagePrefix(),e),n=this.g.mul(i),o=this.encodePoint(n),a=this.hashInt(o,r.pubBytes(),e).mul(r.priv()),u=i.add(a).umod(this.curve.n);return this.makeSignature({R:n,S:u,Rencoded:o})},h.prototype.verify=function(e,t,r){if(e=s(e),(t=this.makeSignature(t)).S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var i=this.keyFromPublic(r),n=this.hashInt(t.Rencoded(),i.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(i.pub().mul(n)).eq(o)},h.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return o.intFromLE(e.digest()).umod(this.curve.n)},h.prototype.keyFromPublic=function(e){return u.fromPublic(this,e)},h.prototype.keyFromSecret=function(e){return u.fromSecret(this,e)},h.prototype.makeSignature=function(e){return e instanceof c?e:new c(this,e)},h.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},h.prototype.decodePoint=function(e){var t=(e=o.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),i=0!=(128&e[t]),n=o.intFromLE(r);return this.curve.pointFromY(n,i)},h.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},h.prototype.decodeInt=function(e){return o.intFromLE(e)},h.prototype.isPoint=function(e){return e instanceof this.pointClass}},function(e,t,r){"use strict";var i=r(15),n=i.assert,o=i.parseBytes,a=i.cachedProperty;function s(e,t){this.eddsa=e,this._secret=o(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=o(t.pub)}s.fromPublic=function(e,t){return t instanceof s?t:new s(e,{pub:t})},s.fromSecret=function(e,t){return t instanceof s?t:new s(e,{secret:t})},s.prototype.secret=function(){return this._secret},a(s,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),a(s,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),a(s,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,i=t.slice(0,e.encodingLength);return i[0]&=248,i[r]&=127,i[r]|=64,i})),a(s,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),a(s,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),a(s,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),s.prototype.sign=function(e){return n(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},s.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},s.prototype.getSecret=function(e){return n(this._secret,"KeyPair is public only"),i.encode(this.secret(),e)},s.prototype.getPublic=function(e){return i.encode(this.pubBytes(),e)},e.exports=s},function(e,t,r){"use strict";var i=r(7),n=r(15),o=n.assert,a=n.cachedProperty,s=n.parseBytes;function u(e,t){this.eddsa=e,"object"!=typeof t&&(t=s(t)),Array.isArray(t)&&(o(t.length===2*e.encodingLength,"Signature has invalid size"),t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),o(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof i&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}a(u,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),a(u,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),a(u,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),a(u,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),u.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},u.prototype.toHex=function(){return n.encode(this.toBytes(),"hex").toUpperCase()},e.exports=u},function(e,t){},function(e,t,r){"use strict";var i=r(45);t.certificate=r(274);var n=i.define("RSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}));t.RSAPrivateKey=n;var o=i.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));t.RSAPublicKey=o;var a=i.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())})),s=i.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(a),this.key("subjectPublicKey").bitstr())}));t.PublicKey=s;var u=i.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(a),this.key("subjectPrivateKey").octstr())}));t.PrivateKey=u;var c=i.define("EncryptedPrivateKeyInfo",(function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())}));t.EncryptedPrivateKey=c;var h=i.define("DSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())}));t.DSAPrivateKey=h,t.DSAparam=i.define("DSAparam",(function(){this.int()}));var f=i.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})})),l=i.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(f),this.key("publicKey").optional().explicit(1).bitstr())}));t.ECPrivateKey=l,t.signature=i.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())}))},function(e,t,r){var i=r(45),n=r(4);function o(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}t.define=function(e,t){return new o(e,t)},o.prototype._createNamed=function(e){var t;try{t=r(266).runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(e){t=function(e){this._initNamed(e)}}return n(t,e),t.prototype._initNamed=function(t){e.call(this,t)},new t(this)},o.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(i.decoders[e])),this.decoders[e]},o.prototype.decode=function(e,t,r){return this._getDecoder(t).decode(e,r)},o.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(i.encoders[e])),this.encoders[e]},o.prototype.encode=function(e,t,r){return this._getEncoder(t).encode(e,r)}},function(module,exports){var indexOf=function(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0;r<e.length;r++)if(e[r]===t)return r;return-1},Object_keys=function(e){if(Object.keys)return Object.keys(e);var t=[];for(var r in e)t.push(r);return t},forEach=function(e,t){if(e.forEach)return e.forEach(t);for(var r=0;r<e.length;r++)t(e[r],r,e)},defineProp=function(){try{return Object.defineProperty({},"_",{}),function(e,t,r){Object.defineProperty(e,t,{writable:!0,enumerable:!1,configurable:!0,value:r})}}catch(e){return function(e,t,r){e[t]=r}}}(),globals=["Array","Boolean","Date","Error","EvalError","Function","Infinity","JSON","Math","NaN","Number","Object","RangeError","ReferenceError","RegExp","String","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","undefined","unescape"];function Context(){}Context.prototype={};var Script=exports.Script=function(e){if(!(this instanceof Script))return new Script(e);this.code=e};Script.prototype.runInContext=function(e){if(!(e instanceof Context))throw new TypeError("needs a 'context' argument.");var t=document.createElement("iframe");t.style||(t.style={}),t.style.display="none",document.body.appendChild(t);var r=t.contentWindow,i=r.eval,n=r.execScript;!i&&n&&(n.call(r,"null"),i=r.eval),forEach(Object_keys(e),(function(t){r[t]=e[t]})),forEach(globals,(function(t){e[t]&&(r[t]=e[t])}));var o=Object_keys(r),a=i.call(r,this.code);return forEach(Object_keys(r),(function(t){(t in e||-1===indexOf(o,t))&&(e[t]=r[t])})),forEach(globals,(function(t){t in e||defineProp(e,t,r[t])})),document.body.removeChild(t),a},Script.prototype.runInThisContext=function(){return eval(this.code)},Script.prototype.runInNewContext=function(e){var t=Script.createContext(e),r=this.runInContext(t);return e&&forEach(Object_keys(t),(function(r){e[r]=t[r]})),r},forEach(Object_keys(Script.prototype),(function(e){exports[e]=Script[e]=function(t){var r=Script(t);return r[e].apply(r,[].slice.call(arguments,1))}})),exports.isContext=function(e){return e instanceof Context},exports.createScript=function(e){return exports.Script(e)},exports.createContext=Script.createContext=function(e){var t=new Context;return"object"==typeof e&&forEach(Object_keys(e),(function(r){t[r]=e[r]})),t}},function(e,t,r){var i=r(4);function n(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function o(e,t){this.path=e,this.rethrow(t)}t.Reporter=n,n.prototype.isError=function(e){return e instanceof o},n.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},n.prototype.restore=function(e){var t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},n.prototype.enterKey=function(e){return this._reporterState.path.push(e)},n.prototype.exitKey=function(e){var t=this._reporterState;t.path=t.path.slice(0,e-1)},n.prototype.leaveKey=function(e,t,r){var i=this._reporterState;this.exitKey(e),null!==i.obj&&(i.obj[t]=r)},n.prototype.path=function(){return this._reporterState.path.join("/")},n.prototype.enterObject=function(){var e=this._reporterState,t=e.obj;return e.obj={},t},n.prototype.leaveObject=function(e){var t=this._reporterState,r=t.obj;return t.obj=e,r},n.prototype.error=function(e){var t,r=this._reporterState,i=e instanceof o;if(t=i?e:new o(r.path.map((function(e){return"["+JSON.stringify(e)+"]"})).join(""),e.message||e,e.stack),!r.options.partial)throw t;return i||r.errors.push(t),t},n.prototype.wrapResult=function(e){var t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},i(o,Error),o.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},function(e,t,r){var i=r(46).Reporter,n=r(46).EncoderBuffer,o=r(46).DecoderBuffer,a=r(14),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"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(s);function c(e,t){var r={};this._baseState=r,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}e.exports=c;var h=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];c.prototype.clone=function(){var e=this._baseState,t={};h.forEach((function(r){t[r]=e[r]}));var r=new this.constructor(t.parent);return r._baseState=t,r},c.prototype._wrap=function(){var e=this._baseState;u.forEach((function(t){this[t]=function(){var r=new this.constructor(this);return e.children.push(r),r[t].apply(r,arguments)}}),this)},c.prototype._init=function(e){var t=this._baseState;a(null===t.parent),e.call(this),t.children=t.children.filter((function(e){return e._baseState.parent===this}),this),a.equal(t.children.length,1,"Root node can have only one child")},c.prototype._useArgs=function(e){var 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&&(a(null===t.children),t.children=r,r.forEach((function(e){e._baseState.parent=this}),this)),0!==e.length&&(a(null===t.args),t.args=e,t.reverseArgs=e.map((function(e){if("object"!=typeof e||e.constructor!==Object)return e;var t={};return Object.keys(e).forEach((function(r){r==(0|r)&&(r|=0);var i=e[r];t[i]=r})),t})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(e){c.prototype[e]=function(){var t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}})),s.forEach((function(e){c.prototype[e]=function(){var t=this._baseState,r=Array.prototype.slice.call(arguments);return a(null===t.tag),t.tag=e,this._useArgs(r),this}})),c.prototype.use=function(e){a(e);var t=this._baseState;return a(null===t.use),t.use=e,this},c.prototype.optional=function(){return this._baseState.optional=!0,this},c.prototype.def=function(e){var t=this._baseState;return a(null===t.default),t.default=e,t.optional=!0,this},c.prototype.explicit=function(e){var t=this._baseState;return a(null===t.explicit&&null===t.implicit),t.explicit=e,this},c.prototype.implicit=function(e){var t=this._baseState;return a(null===t.explicit&&null===t.implicit),t.implicit=e,this},c.prototype.obj=function(){var e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},c.prototype.key=function(e){var t=this._baseState;return a(null===t.key),t.key=e,this},c.prototype.any=function(){return this._baseState.any=!0,this},c.prototype.choice=function(e){var t=this._baseState;return a(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map((function(t){return e[t]}))),this},c.prototype.contains=function(e){var t=this._baseState;return a(null===t.use),t.contains=e,this},c.prototype._decode=function(e,t){var r=this._baseState;if(null===r.parent)return e.wrapResult(r.children[0]._decode(e,t));var i,n=r.default,a=!0,s=null;if(null!==r.key&&(s=e.enterKey(r.key)),r.optional){var u=null;if(null!==r.explicit?u=r.explicit:null!==r.implicit?u=r.implicit:null!==r.tag&&(u=r.tag),null!==u||r.any){if(a=this._peekTag(e,u,r.any),e.isError(a))return a}else{var c=e.save();try{null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t),a=!0}catch(e){a=!1}e.restore(c)}}if(r.obj&&a&&(i=e.enterObject()),a){if(null!==r.explicit){var h=this._decodeTag(e,r.explicit);if(e.isError(h))return h;e=h}var f=e.offset;if(null===r.use&&null===r.choice){if(r.any)c=e.save();var l=this._decodeTag(e,null!==r.implicit?r.implicit:r.tag,r.any);if(e.isError(l))return l;r.any?n=e.raw(c):e=l}if(t&&t.track&&null!==r.tag&&t.track(e.path(),f,e.length,"tagged"),t&&t.track&&null!==r.tag&&t.track(e.path(),e.offset,e.length,"content"),n=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(r){r._decode(e,t)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){var d=new o(n);n=this._getUse(r.contains,e._reporterState.obj)._decode(d,t)}}return r.obj&&a&&(n=e.leaveObject(i)),null===r.key||null===n&&!0!==a?null!==s&&e.exitKey(s):e.leaveKey(s,r.key,n),n},c.prototype._decodeGeneric=function(e,t,r){var i=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,i.args[0],r):/str$/.test(e)?this._decodeStr(t,e,r):"objid"===e&&i.args?this._decodeObjid(t,i.args[0],i.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,i.args&&i.args[0],r):null!==i.use?this._getUse(i.use,t._reporterState.obj)._decode(t,r):t.error("unknown tag: "+e)},c.prototype._getUse=function(e,t){var r=this._baseState;return r.useDecoder=this._use(e,t),a(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},c.prototype._decodeChoice=function(e,t){var r=this._baseState,i=null,n=!1;return Object.keys(r.choice).some((function(o){var a=e.save(),s=r.choice[o];try{var u=s._decode(e,t);if(e.isError(u))return!1;i={type:o,value:u},n=!0}catch(t){return e.restore(a),!1}return!0}),this),n?i:e.error("Choice not matched")},c.prototype._createEncoderBuffer=function(e){return new n(e,this.reporter)},c.prototype._encode=function(e,t,r){var i=this._baseState;if(null===i.default||i.default!==e){var n=this._encodeValue(e,t,r);if(void 0!==n&&!this._skipDefault(n,t,r))return n}},c.prototype._encodeValue=function(e,t,r){var n=this._baseState;if(null===n.parent)return n.children[0]._encode(e,t||new i);var o=null;if(this.reporter=t,n.optional&&void 0===e){if(null===n.default)return;e=n.default}var a=null,s=!1;if(n.any)o=this._createEncoderBuffer(e);else if(n.choice)o=this._encodeChoice(e,t);else if(n.contains)a=this._getUse(n.contains,r)._encode(e,t),s=!0;else if(n.children)a=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");var i=t.enterKey(r._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");var n=r._encode(e[r._baseState.key],t,e);return t.leaveKey(i),n}),this).filter((function(e){return e})),a=this._createEncoderBuffer(a);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");var u=this.clone();u._baseState.implicit=null,a=this._createEncoderBuffer(e.map((function(r){var i=this._baseState;return this._getUse(i.args[0],e)._encode(r,t)}),u))}else null!==n.use?o=this._getUse(n.use,r)._encode(e,t):(a=this._encodePrimitive(n.tag,e),s=!0);if(!n.any&&null===n.choice){var c=null!==n.implicit?n.implicit:n.tag,h=null===n.implicit?"universal":"context";null===c?null===n.use&&t.error("Tag could be omitted only for .use()"):null===n.use&&(o=this._encodeComposite(c,s,h,a))}return null!==n.explicit&&(o=this._encodeComposite(n.explicit,!1,"context",o)),o},c.prototype._encodeChoice=function(e,t){var r=this._baseState,i=r.choice[e.type];return i||a(!1,e.type+" not found in "+JSON.stringify(Object.keys(r.choice))),i._encode(e.value,t)},c.prototype._encodePrimitive=function(e,t){var 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)},c.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},c.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e)}},function(e,t,r){var i=r(135);t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=i._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=i._reverse(t.tag)},function(e,t,r){var i=t;i.der=r(136),i.pem=r(271)},function(e,t,r){var i=r(4),n=r(0).Buffer,o=r(136);function a(e){o.call(this,e),this.enc="pem"}i(a,o),e.exports=a,a.prototype.decode=function(e,t){for(var r=e.toString().split(/[\r\n]+/g),i=t.label.toUpperCase(),a=/^-----(BEGIN|END) ([^-]+)-----$/,s=-1,u=-1,c=0;c<r.length;c++){var h=r[c].match(a);if(null!==h&&h[2]===i){if(-1!==s){if("END"!==h[1])break;u=c;break}if("BEGIN"!==h[1])break;s=c}}if(-1===s||-1===u)throw new Error("PEM section not found for: "+i);var f=r.slice(s+1,u).join("");f.replace(/[^a-z0-9\+\/=]+/gi,"");var l=new n(f,"base64");return o.prototype.decode.call(this,l,t)}},function(e,t,r){var i=t;i.der=r(137),i.pem=r(273)},function(e,t,r){var i=r(4),n=r(137);function o(e){n.call(this,e),this.enc="pem"}i(o,n),e.exports=o,o.prototype.encode=function(e,t){for(var r=n.prototype.encode.call(this,e).toString("base64"),i=["-----BEGIN "+t.label+"-----"],o=0;o<r.length;o+=64)i.push(r.slice(o,o+64));return i.push("-----END "+t.label+"-----"),i.join("\n")}},function(e,t,r){"use strict";var i=r(45),n=i.define("Time",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),o=i.define("AttributeTypeValue",(function(){this.seq().obj(this.key("type").objid(),this.key("value").any())})),a=i.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())})),s=i.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(a),this.key("subjectPublicKey").bitstr())})),u=i.define("RelativeDistinguishedName",(function(){this.setof(o)})),c=i.define("RDNSequence",(function(){this.seqof(u)})),h=i.define("Name",(function(){this.choice({rdnSequence:this.use(c)})})),f=i.define("Validity",(function(){this.seq().obj(this.key("notBefore").use(n),this.key("notAfter").use(n))})),l=i.define("Extension",(function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())})),d=i.define("TBSCertificate",(function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(a),this.key("issuer").use(h),this.key("validity").use(f),this.key("subject").use(h),this.key("subjectPublicKeyInfo").use(s),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(l).optional())})),p=i.define("X509Certificate",(function(){this.seq().obj(this.key("tbsCertificate").use(d),this.key("signatureAlgorithm").use(a),this.key("signatureValue").bitstr())}));e.exports=p},function(e){e.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}},function(e,t,r){"use strict";var i=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,n=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,o=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,a=r(56),s=r(80),u=r(1).Buffer;e.exports=function(e,t){var r,c=e.toString(),h=c.match(i);if(h){var f="aes"+h[1],l=u.from(h[2],"hex"),d=u.from(h[3].replace(/[\r\n]/g,""),"base64"),p=a(t,l.slice(0,8),parseInt(h[1],10)).key,m=[],g=s.createDecipheriv(f,p,l);m.push(g.update(d)),m.push(g.final()),r=u.concat(m)}else{var b=c.match(o);r=u.from(b[2].replace(/[\r\n]/g,""),"base64")}return{tag:c.match(n)[1],data:r}}},function(e,t,r){"use strict";var i=r(1).Buffer,n=r(133),o=r(29).ec,a=r(59),s=r(138);function u(e,t){if(e.cmpn(0)<=0)throw new Error("invalid sig");if(e.cmp(t)>=0)throw new Error("invalid sig")}e.exports=function(e,t,r,c,h){var f=a(r);if("ec"===f.type){if("ecdsa"!==c&&"ecdsa/rsa"!==c)throw new Error("wrong public key type");return function(e,t,r){var i=s[r.data.algorithm.curve.join(".")];if(!i)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var n=new o(i),a=r.data.subjectPrivateKey.data;return n.verify(t,e,a)}(e,t,f)}if("dsa"===f.type){if("dsa"!==c)throw new Error("wrong public key type");return function(e,t,r){var i=r.data.p,o=r.data.q,s=r.data.g,c=r.data.pub_key,h=a.signature.decode(e,"der"),f=h.s,l=h.r;u(f,o),u(l,o);var d=n.mont(i),p=f.invm(o);return 0===s.toRed(d).redPow(new n(t).mul(p).mod(o)).fromRed().mul(c.toRed(d).redPow(l.mul(p).mod(o)).fromRed()).mod(i).mod(o).cmp(l)}(e,t,f)}if("rsa"!==c&&"ecdsa/rsa"!==c)throw new Error("wrong public key type");t=i.concat([h,t]);for(var l=f.modulus.byteLength(),d=[1],p=0;t.length+d.length+2<l;)d.push(255),p+=1;d.push(0);for(var m=-1;++m<t.length;)d.push(t[m]);d=i.from(d);var g=n.mont(f.modulus);e=(e=new n(e).toRed(g)).redPow(new n(f.publicExponent)),e=i.from(e.fromRed().toArray());var b=p<8?1:0;for(l=Math.min(e.length,d.length),e.length!==d.length&&(b=1),m=-1;++m<l;)b|=e[m]^d[m];return 0===b}},function(e,t,r){(function(t){var i=r(29),n=r(7);e.exports=function(e){return new a(e)};var o={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function a(e){this.curveType=o[e],this.curveType||(this.curveType={name:e}),this.curve=new i.ec(this.curveType.name),this.keys=void 0}function s(e,r,i){Array.isArray(e)||(e=e.toArray());var n=new t(e);if(i&&n.length<i){var o=new t(i-n.length);o.fill(0),n=t.concat([o,n])}return r?n.toString(r):n}o.p224=o.secp224r1,o.p256=o.secp256r1=o.prime256v1,o.p192=o.secp192r1=o.prime192v1,o.p384=o.secp384r1,o.p521=o.secp521r1,a.prototype.generateKeys=function(e,t){return this.keys=this.curve.genKeyPair(),this.getPublicKey(e,t)},a.prototype.computeSecret=function(e,r,i){return r=r||"utf8",t.isBuffer(e)||(e=new t(e,r)),s(this.curve.keyFromPublic(e).getPublic().mul(this.keys.getPrivate()).getX(),i,this.curveType.byteLength)},a.prototype.getPublicKey=function(e,t){var r=this.keys.getPublic("compressed"===t,!0);return"hybrid"===t&&(r[r.length-1]%2?r[0]=7:r[0]=6),s(r,e)},a.prototype.getPrivateKey=function(e){return s(this.keys.getPrivate(),e)},a.prototype.setPublicKey=function(e,r){return r=r||"utf8",t.isBuffer(e)||(e=new t(e,r)),this.keys._importPublic(e),this},a.prototype.setPrivateKey=function(e,r){r=r||"utf8",t.isBuffer(e)||(e=new t(e,r));var i=new n(e);return i=i.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(i),this}}).call(this,r(0).Buffer)},function(e,t,r){t.publicEncrypt=r(280),t.privateDecrypt=r(281),t.privateEncrypt=function(e,r){return t.publicEncrypt(e,r,!0)},t.publicDecrypt=function(e,r){return t.privateDecrypt(e,r,!0)}},function(e,t,r){var i=r(59),n=r(33),o=r(37),a=r(139),s=r(140),u=r(7),c=r(141),h=r(83),f=r(1).Buffer;e.exports=function(e,t,r){var l;l=e.padding?e.padding:r?1:4;var d,p=i(e);if(4===l)d=function(e,t){var r=e.modulus.byteLength(),i=t.length,c=o("sha1").update(f.alloc(0)).digest(),h=c.length,l=2*h;if(i>r-l-2)throw new Error("message too long");var d=f.alloc(r-i-l-2),p=r-h-1,m=n(h),g=s(f.concat([c,d,f.alloc(1,1),t],p),a(m,p)),b=s(m,a(g,h));return new u(f.concat([f.alloc(1),b,g],r))}(p,t);else if(1===l)d=function(e,t,r){var i,o=t.length,a=e.modulus.byteLength();if(o>a-11)throw new Error("message too long");i=r?f.alloc(a-o-3,255):function(e){var t,r=f.allocUnsafe(e),i=0,o=n(2*e),a=0;for(;i<e;)a===o.length&&(o=n(2*e),a=0),(t=o[a++])&&(r[i++]=t);return r}(a-o-3);return new u(f.concat([f.from([0,r?1:2]),i,f.alloc(1),t],a))}(p,t,r);else{if(3!==l)throw new Error("unknown padding");if((d=new u(t)).cmp(p.modulus)>=0)throw new Error("data too long for modulus")}return r?h(d,p):c(d,p)}},function(e,t,r){var i=r(59),n=r(139),o=r(140),a=r(7),s=r(83),u=r(37),c=r(141),h=r(1).Buffer;e.exports=function(e,t,r){var f;f=e.padding?e.padding:r?1:4;var l,d=i(e),p=d.modulus.byteLength();if(t.length>p||new a(t).cmp(d.modulus)>=0)throw new Error("decryption error");l=r?c(new a(t),d):s(t,d);var m=h.alloc(p-l.length);if(l=h.concat([m,l],p),4===f)return function(e,t){var r=e.modulus.byteLength(),i=u("sha1").update(h.alloc(0)).digest(),a=i.length;if(0!==t[0])throw new Error("decryption error");var s=t.slice(1,a+1),c=t.slice(a+1),f=o(s,n(c,a)),l=o(c,n(f,r-a-1));if(function(e,t){e=h.from(e),t=h.from(t);var r=0,i=e.length;e.length!==t.length&&(r++,i=Math.min(e.length,t.length));var n=-1;for(;++n<i;)r+=e[n]^t[n];return r}(i,l.slice(0,a)))throw new Error("decryption error");var d=a;for(;0===l[d];)d++;if(1!==l[d++])throw new Error("decryption error");return l.slice(d)}(d,l);if(1===f)return function(e,t,r){var i=t.slice(0,2),n=2,o=0;for(;0!==t[n++];)if(n>=t.length){o++;break}var a=t.slice(2,n-1);("0002"!==i.toString("hex")&&!r||"0001"!==i.toString("hex")&&r)&&o++;a.length<8&&o++;if(o)throw new Error("decryption error");return t.slice(n)}(0,l,r);if(3===f)return l;throw new Error("unknown padding")}},function(e,t,r){"use strict";(function(e,i){function n(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var o=r(1),a=r(33),s=o.Buffer,u=o.kMaxLength,c=e.crypto||e.msCrypto,h=Math.pow(2,32)-1;function f(e,t){if("number"!=typeof e||e!=e)throw new TypeError("offset must be a number");if(e>h||e<0)throw new TypeError("offset must be a uint32");if(e>u||e>t)throw new RangeError("offset out of range")}function l(e,t,r){if("number"!=typeof e||e!=e)throw new TypeError("size must be a number");if(e>h||e<0)throw new TypeError("size must be a uint32");if(e+t>r||e>u)throw new RangeError("buffer too small")}function d(e,t,r,n){if(i.browser){var o=e.buffer,s=new Uint8Array(o,t,r);return c.getRandomValues(s),n?void i.nextTick((function(){n(null,e)})):e}if(!n)return a(r).copy(e,t),e;a(r,(function(r,i){if(r)return n(r);i.copy(e,t),n(null,e)}))}c&&c.getRandomValues||!i.browser?(t.randomFill=function(t,r,i,n){if(!(s.isBuffer(t)||t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof r)n=r,r=0,i=t.length;else if("function"==typeof i)n=i,i=t.length-r;else if("function"!=typeof n)throw new TypeError('"cb" argument must be a function');return f(r,t.length),l(i,r,t.length),d(t,r,i,n)},t.randomFillSync=function(t,r,i){void 0===r&&(r=0);if(!(s.isBuffer(t)||t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');f(r,t.length),void 0===i&&(i=t.length-r);return l(i,r,t.length),d(t,r,i)}):(t.randomFill=n,t.randomFillSync=n)}).call(this,r(13),r(6))},function(e,t,r){"use strict";var i=r(1).Buffer;e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var o=e.charAt(n),a=o.charCodeAt(0);if(255!==t[a])throw new TypeError(o+" is ambiguous");t[a]=n}var s=e.length,u=e.charAt(0),c=Math.log(s)/Math.log(256),h=Math.log(256)/Math.log(s);function f(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return i.alloc(0);for(var r=0,n=0,o=0;e[r]===u;)n++,r++;for(var a=(e.length-r)*c+1>>>0,h=new Uint8Array(a);r<e.length;){var f=e.charCodeAt(r);if(f>255)return;var l=t[f];if(255===l)return;for(var d=0,p=a-1;(0!==l||d<o)&&-1!==p;p--,d++)l+=s*h[p]>>>0,h[p]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");o=d,r++}for(var m=a-o;m!==a&&0===h[m];)m++;var g=i.allocUnsafe(n+(a-m));g.fill(0,0,n);for(var b=n;m!==a;)g[b++]=h[m++];return g}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=i.from(t)),!i.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,n=0,o=0,a=t.length;o!==a&&0===t[o];)o++,r++;for(var c=(a-o)*h+1>>>0,f=new Uint8Array(c);o!==a;){for(var l=t[o],d=0,p=c-1;(0!==l||d<n)&&-1!==p;p--,d++)l+=256*f[p]>>>0,f[p]=l%s>>>0,l=l/s>>>0;if(0!==l)throw new Error("Non-zero carry");n=d,o++}for(var m=c-n;m!==c&&0===f[m];)m++;for(var g=u.repeat(r);m<c;++m)g+=e.charAt(f[m]);return g},decodeUnsafe:f,decode:function(e){var t=f(e);if(t)return t;throw new Error("Non-base"+s+" character")}}}},function(e){e.exports={name:"@smartledger/bsv",version:"4.1.0",description:"🚀 Complete Bitcoin SV development framework with legally-recognizable DID:web + W3C VC-JWT toolkit, Legal Token Protocol (LTP), Global Digital Attestation Framework (GDAF), StatusList2021 revocation, and 16 flexible loading options. Standards-based credentials with ES256/ES256K support, on-chain BSV anchoring, and comprehensive Bitcoin SV API. Perfect for legal tokens, verifiable credentials, DeFi, smart contracts, and secure Bitcoin applications.",author:"SmartLedger Technology <hello@smartledger.technology> (https://smartledger.technology)",homepage:"https://github.com/codenlighten/smartledger-bsv#readme",bugs:{url:"https://github.com/codenlighten/smartledger-bsv/issues"},main:"index.js",types:"bsv.d.ts",bin:{"smartledger-bsv":"./bin/cli.js"},scripts:{lint:"standard",test:"mocha","test:cli":"mocha test/cli/smoke.js --timeout 25000","test:ltp":"node complete_ltp_demo.js","test:ltp-primitives":"node simple_demo.js","test:architecture":"node architecture_demo.js","test:js2script":"node lib/smart_contract/opcode_map.js && node lib/smart_contract/covenant_builder.js","test:opcodes":"node lib/smart_contract/opcode_list.js","test:covenants":"node examples/covenants/advanced_covenant_demo.js","test:scripts":"node examples/scripts/custom_script_signature_test.js","test:basic":"node examples/basic/transaction-creation.js","test:all":"npm test && npm run test:covenants && npm run test:scripts",coverage:"nyc --reporter=text npm run test",demo:"node demos/smart_contract_demo.js","demo:web":"echo '🌐 Open demos/smart_contract_demo.html in your browser'","demo:basics":"node demos/smart_contract_demo.js --feature basics","demo:covenant":"node demos/smart_contract_demo.js --feature covenant","demo:preimage":"node demos/smart_contract_demo.js --feature preimage","demo:utxo":"node demos/smart_contract_demo.js --feature utxo","demo:scripts":"node demos/smart_contract_demo.js --feature scripts","demo:legacy":"npm run test:covenants","demo:legacy:basic":"npm run test:basic","demo:legacy:scripts":"npm run test:scripts","demo:legacy:preimage":"echo '🧠 BIP-143 Preimage Extractor Demo' && node examples/preimage/extract_preimage_bidirectional.js","smart-contracts":"node examples/smart_contract_templates.js","smart-contracts:working":"node examples/final_working_contracts.js",workflow:"node examples/complete_workflow_demo.js","build-bsv":'NODE_OPTIONS="--openssl-legacy-provider" webpack index.js --config build/webpack.config.js',"build-ecies":'NODE_OPTIONS="--openssl-legacy-provider" webpack ecies/index.js --config build/webpack.subproject.config.js --output-library bsvEcies -o bsv-ecies.min.js',"build-message":'NODE_OPTIONS="--openssl-legacy-provider" webpack message/index.js --config build/webpack.subproject.config.js --output-library bsvMessage -o bsv-message.min.js',"build-mnemonic":'NODE_OPTIONS="--openssl-legacy-provider" webpack mnemonic/index.js --config build/webpack.subproject.config.js --output-library bsvMnemonic -o bsv-mnemonic.min.js',"build-shamir":'NODE_OPTIONS="--openssl-legacy-provider" webpack shamir-entry.js --config build/webpack.subproject.config.js --output-library bsvShamir -o bsv-shamir.min.js',"build-ltp":'NODE_OPTIONS="--openssl-legacy-provider" webpack ltp-entry.js --config build/webpack.ltp.config.js',"build-gdaf":'NODE_OPTIONS="--openssl-legacy-provider" webpack gdaf-entry.js --config build/webpack.gdaf.config.js',"build-smartcontract":'NODE_OPTIONS="--openssl-legacy-provider" webpack smartcontract-entry.js --config build/webpack.smartcontract.config.js',"build-covenant":'NODE_OPTIONS="--openssl-legacy-provider" webpack covenant-entry.js --config build/webpack.covenant.config.js',"build-script-helper":'NODE_OPTIONS="--openssl-legacy-provider" webpack script-helper-entry.js --config build/webpack.script-helper.config.js',"build-security":'NODE_OPTIONS="--openssl-legacy-provider" webpack security-entry.js --config build/webpack.security.config.js',"build-didweb":'NODE_OPTIONS="--openssl-legacy-provider" webpack didweb-entry.js --config build/webpack.didweb.config.js',"build-vcjwt":'NODE_OPTIONS="--openssl-legacy-provider" webpack vcjwt-entry.js --config build/webpack.vcjwt.config.js',"build-statuslist":'NODE_OPTIONS="--openssl-legacy-provider" webpack statuslist-entry.js --config build/webpack.statuslist.config.js',"build-anchor":'NODE_OPTIONS="--openssl-legacy-provider" webpack anchor-entry.js --config build/webpack.anchor.config.js',"build-bundle":'NODE_OPTIONS="--openssl-legacy-provider" webpack bundle-entry.js --config build/webpack.bundle.config.js',build:"npm run build-bsv && npm run build-ecies && npm run build-message && npm run build-mnemonic && npm run build-shamir && npm run build-smartcontract","build-specialized":"npm run build-covenant && npm run build-script-helper && npm run build-security","build-credentials":"npm run build-didweb && npm run build-vcjwt && npm run build-statuslist && npm run build-anchor","build-advanced":"npm run build-ltp && npm run build-gdaf","build-all":"npm run build && npm run build-bundle && npm run build-specialized && npm run build-advanced && npm run build-credentials","test:browser":"echo 'Open tests/standalone-modules-test.html in browser for comprehensive testing'","test:bundle":"echo 'Open tests/bundle-completeness-test.html in browser to verify bundle completeness'","preimage:extract":"node examples/preimage/extract_preimage_bidirectional.js",prepublishOnly:'NODE_OPTIONS="--openssl-legacy-provider" npm run build-all'},unpkg:"bsv.min.js",jsdelivr:"bsv.min.js",cdn:"bsv.min.js",files:["index.js","lib/","utilities/*.js","utilities/README.md","ecies/","message/","mnemonic/","build/","*-entry.js","bsv.min.js","bsv.bundle.js","bsv-ecies.min.js","bsv-message.min.js","bsv-mnemonic.min.js","bsv-shamir.min.js","bsv-gdaf.min.js","bsv-ltp.min.js","bsv-smartcontract.min.js","bsv-covenant.min.js","bsv-script-helper.min.js","bsv-security.min.js","bsv-didweb.min.js","bsv-vcjwt.min.js","bsv-statuslist.min.js","bsv-anchor.min.js","bsv.d.ts","docs/","LICENSE","README.md","SECURITY.md","CHANGELOG.md"],keywords:["bitcoin","bitcoin-sv","bsv","legal-token-protocol","ltp","legal-tokens","primitives-only","legal-compliance","property-rights","obligations","attestations","gdaf","global-digital-attestation","w3c-credentials","verifiable-credentials","decentralized-identity","shamir-secret-sharing","threshold-cryptography","cryptocurrency","blockchain","smart-contracts","defi","covenant","covenants","script-debugger","debug-tools","modular-loading","standalone-modules","elliptic-curve-fix","smartledger","transaction","address","signature","wallet","hd-wallet","mnemonic","ecies","encryption","message-signing","pushtx","pels","bip143","preimage","shamir-secret-sharing","threshold-cryptography","secret-splitting","global-digital-attestation","gdaf","verifiable-credentials","w3c-credentials","decentralized-identity","did-resolution","zero-knowledge-proofs","blockchain-anchoring","attestation-framework","nchain","custom-scripts","multisig","timelock","conditional-scripts","utxo-management","ultra-low-fees","javascript-to-script","opcode-mapping","covenant-builder","script-simulation","bitcoin-script","asm-generation","advanced-features","script-development","blockchain-simulator","miner-simulator","testing-tools","development-framework","browser-compatible","nodejs-compatible","webpack-ready","cdn-ready","typescript-definitions","drop-in-replacement","performance-optimized","bip21","bip32","bip37","bip69","bip70"],repository:{type:"git",url:"https://github.com/codenlighten/smartledger-bsv"},browser:{request:"browser-request"},dependencies:{"aes-js":"^3.1.2","bn.js":"=4.11.9",bs58:"=4.0.1","clone-deep":"^4.0.1",elliptic:"6.6.1","hash.js":"^1.1.7",inherits:"2.0.3",unorm:"1.4.1"},devDependencies:{brfs:"2.0.1",chai:"4.2.0",mocha:"^8.4.0",nyc:"^14.1.1",sinon:"7.2.3",standard:"12.0.1",webpack:"4.29.3","webpack-cli":"^3.3.12"},license:"MIT",standard:{globals:["after","afterEach","before","beforeEach","describe","it"],ignore:["dist/**"]}}},function(e,t,r){"use strict";var i="https://docs.moneybutton.com/";e.exports=[{name:"InvalidB58Char",message:"Invalid Base58 character: {0} in {1}"},{name:"InvalidB58Checksum",message:"Invalid Base58 checksum for {0}"},{name:"InvalidNetwork",message:"Invalid version for network: got {0}"},{name:"InvalidState",message:"Invalid state: {0}"},{name:"NotImplemented",message:"Function {0} was not implemented yet"},{name:"InvalidNetworkArgument",message:'Invalid network: must be "livenet" or "testnet", got {0}'},{name:"InvalidArgument",message:function(){return"Invalid Argument"+(arguments[0]?": "+arguments[0]:"")+(arguments[1]?" Documentation: "+i+arguments[1]:"")}},{name:"AbstractMethodInvoked",message:"Abstract Method Invocation: {0}"},{name:"InvalidArgumentType",message:function(){return"Invalid Argument for "+arguments[2]+", expected "+arguments[1]+" but got "+typeof arguments[0]}},{name:"Unit",message:"Internal Error on Unit {0}",errors:[{name:"UnknownCode",message:"Unrecognized unit code: {0}"},{name:"InvalidRate",message:"Invalid exchange rate: {0}"}]},{name:"MerkleBlock",message:"Internal Error on MerkleBlock {0}",errors:[{name:"InvalidMerkleTree",message:"This MerkleBlock contain an invalid Merkle Tree"}]},{name:"Transaction",message:"Internal Error on Transaction {0}",errors:[{name:"Input",message:"Internal Error on Input {0}",errors:[{name:"MissingScript",message:"Need a script to create an input"},{name:"UnsupportedScript",message:"Unsupported input script type: {0}"},{name:"MissingPreviousOutput",message:"No previous output information."}]},{name:"NeedMoreInfo",message:"{0}"},{name:"InvalidSorting",message:"The sorting function provided did not return the change output as one of the array elements"},{name:"InvalidOutputAmountSum",message:"{0}"},{name:"MissingSignatures",message:"Some inputs have not been fully signed"},{name:"InvalidIndex",message:"Invalid index: {0} is not between 0, {1}"},{name:"UnableToVerifySignature",message:"Unable to verify signature: {0}"},{name:"DustOutputs",message:"Dust amount detected in one output"},{name:"InvalidSatoshis",message:"Output satoshis are invalid"},{name:"FeeError",message:"Internal Error on Fee {0}",errors:[{name:"TooSmall",message:"Fee is too small: {0}"},{name:"TooLarge",message:"Fee is too large: {0}"},{name:"Different",message:"Unspent value is different from specified fee: {0}"}]},{name:"ChangeAddressMissing",message:"Change address is missing"},{name:"BlockHeightTooHigh",message:"Block Height can be at most 2^32 -1"},{name:"NLockTimeOutOfRange",message:"Block Height can only be between 0 and 499 999 999"},{name:"LockTimeTooEarly",message:"Lock Time can't be earlier than UNIX date 500 000 000"}]},{name:"Script",message:"Internal Error on Script {0}",errors:[{name:"UnrecognizedAddress",message:"Expected argument {0} to be an address"},{name:"CantDeriveAddress",message:"Can't derive address associated with script {0}, needs to be p2pkh in, p2pkh out, p2sh in, or p2sh out."},{name:"InvalidBuffer",message:"Invalid script buffer: can't parse valid script from given buffer {0}"}]},{name:"HDPrivateKey",message:"Internal Error on HDPrivateKey {0}",errors:[{name:"InvalidDerivationArgument",message:"Invalid derivation argument {0}, expected string, or number and boolean"},{name:"InvalidEntropyArgument",message:"Invalid entropy: must be an hexa string or binary buffer, got {0}",errors:[{name:"TooMuchEntropy",message:'Invalid entropy: more than 512 bits is non standard, got "{0}"'},{name:"NotEnoughEntropy",message:'Invalid entropy: at least 128 bits needed, got "{0}"'}]},{name:"InvalidLength",message:"Invalid length for xprivkey string in {0}"},{name:"InvalidPath",message:"Invalid derivation path: {0}"},{name:"UnrecognizedArgument",message:'Invalid argument: creating a HDPrivateKey requires a string, buffer, json or object, got "{0}"'}]},{name:"HDPublicKey",message:"Internal Error on HDPublicKey {0}",errors:[{name:"ArgumentIsPrivateExtended",message:"Argument is an extended private key: {0}"},{name:"InvalidDerivationArgument",message:"Invalid derivation argument: got {0}"},{name:"InvalidLength",message:'Invalid length for xpubkey: got "{0}"'},{name:"InvalidPath",message:'Invalid derivation path, it should look like: "m/1/100", got "{0}"'},{name:"InvalidIndexCantDeriveHardened",message:"Invalid argument: creating a hardened path requires an HDPrivateKey"},{name:"MustSupplyArgument",message:"Must supply an argument to create a HDPublicKey"},{name:"UnrecognizedArgument",message:"Invalid argument for creation, must be string, json, buffer, or object"}]}]},function(e,t,r){"use strict";(function(t){var i=r(58),n=r(5),o=e.exports;o.sha1=function(e){return n.checkArgument(t.isBuffer(e)),t.from(i.sha1().update(e).digest("hex"),"hex")},o.sha1.blocksize=512,o.sha256=function(e){return n.checkArgument(t.isBuffer(e)),t.from(i.sha256().update(e).digest("hex"),"hex")},o.sha256.blocksize=512,o.sha256sha256=function(e){return n.checkArgument(t.isBuffer(e)),o.sha256(o.sha256(e))},o.ripemd160=function(e){return n.checkArgument(t.isBuffer(e)),t.from(i.ripemd160().update(e).digest("hex"),"hex")},o.sha256ripemd160=function(e){return n.checkArgument(t.isBuffer(e)),o.ripemd160(o.sha256(e))},o.sha512=function(e){return n.checkArgument(t.isBuffer(e)),t.from(i.sha512().update(e).digest("hex"),"hex")},o.sha512.blocksize=1024,o.hmac=function(e,r,i){n.checkArgument(t.isBuffer(r)),n.checkArgument(t.isBuffer(i)),n.checkArgument(e.blocksize);var o=e.blocksize/8;if(i.length>o)i=e(i);else if(i<o){var a=t.alloc(o);a.fill(0),i.copy(a),i=a}var s=t.alloc(o);s.fill(92);var u=t.alloc(o);u.fill(54);for(var c=t.alloc(o),h=t.alloc(o),f=0;f<o;f++)c[f]=s[f]^i[f],h[f]=u[f]^i[f];return e(t.concat([c,e(t.concat([h,r]))]))},o.sha256hmac=function(e,t){return o.hmac(o.sha256,e,t)},o.sha512hmac=function(e,t){return o.hmac(o.sha512,e,t)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";(function(t){var i=r(9),n=r(5),o=e.exports;o.sha1=function(e){return n.checkArgument(t.isBuffer(e)),i.createHash("sha1").update(e).digest()},o.sha1.blocksize=512,o.sha256=function(e){return n.checkArgument(t.isBuffer(e)),i.createHash("sha256").update(e).digest()},o.sha256.blocksize=512,o.sha256sha256=function(e){return n.checkArgument(t.isBuffer(e)),o.sha256(o.sha256(e))},o.ripemd160=function(e){return n.checkArgument(t.isBuffer(e)),i.createHash("ripemd160").update(e).digest()},o.sha256ripemd160=function(e){return n.checkArgument(t.isBuffer(e)),o.ripemd160(o.sha256(e))},o.sha512=function(e){return n.checkArgument(t.isBuffer(e)),i.createHash("sha512").update(e).digest()},o.sha512.blocksize=1024,o.hmac=function(e,r,i){n.checkArgument(t.isBuffer(r)),n.checkArgument(t.isBuffer(i)),n.checkArgument(e.blocksize);var o=e.blocksize/8;if(i.length>o)i=e(i);else if(i<o){var a=t.alloc(o);a.fill(0),i.copy(a),i=a}var s=t.alloc(o);s.fill(92);var u=t.alloc(o);u.fill(54);for(var c=t.alloc(o),h=t.alloc(o),f=0;f<o;f++)c[f]=s[f]^i[f],h[f]=u[f]^i[f];return e(t.concat([c,e(t.concat([h,r]))]))},o.sha256hmac=function(e,t){return o.hmac(o.sha256,e,t)},o.sha512hmac=function(e,t){return o.hmac(o.sha512,e,t)}}).call(this,r(0).Buffer)},function(e,t,r){"use strict";var i=r(289);e.exports=function(){return Object.assign?function(){if(!Object.assign)return!1;for(var e="abcdefghijklmnopqrst",t=e.split(""),r={},i=0;i<t.length;++i)r[t[i]]=t[i];var n=Object.assign({},r),o="";for(var a in n)o+=a;return e!==o}()||function(){if(!Object.assign||!Object.preventExtensions)return!1;var e=Object.preventExtensions({1:2});try{Object.assign(e,"xy")}catch(t){return"y"===e[1]}return!1}()?i:Object.assign:i}},function(e,t,r){"use strict";var i=r(290),n=r(74)(),o=r(72),a=r(73),s=o("Array.prototype.push"),u=o("Object.prototype.propertyIsEnumerable"),c=n?a.getOwnPropertySymbols:null;e.exports=function(e,t){if(null==e)throw new TypeError("target must be an object");var r=a(e);if(1===arguments.length)return r;for(var o=1;o<arguments.length;++o){var h=a(arguments[o]),f=i(h),l=n&&(a.getOwnPropertySymbols||c);if(l)for(var d=l(h),p=0;p<d.length;++p){var m=d[p];u(h,m)&&s(f,m)}for(var g=0;g<f.length;++g){var b=f[g];if(u(h,b)){var y=h[b];r[b]=y}}}return r}},function(e,t,r){"use strict";var i=Array.prototype.slice,n=r(143),o=Object.keys,a=o?function(e){return o(e)}:r(291),s=Object.keys;a.shim=function(){Object.keys?function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2)||(Object.keys=function(e){return n(e)?s(i.call(e)):s(e)}):Object.keys=a;return Object.keys||a},e.exports=a},function(e,t,r){"use strict";var i;if(!Object.keys){var n=Object.prototype.hasOwnProperty,o=Object.prototype.toString,a=r(143),s=Object.prototype.propertyIsEnumerable,u=!s.call({toString:null},"toString"),c=s.call((function(){}),"prototype"),h=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],f=function(e){var t=e.constructor;return t&&t.prototype===e},l={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},d=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!l["$"+e]&&n.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{f(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();i=function(e){var t=null!==e&&"object"==typeof e,r="[object Function]"===o.call(e),i=a(e),s=t&&"[object String]"===o.call(e),l=[];if(!t&&!r&&!i)throw new TypeError("Object.keys called on a non-object");var p=c&&r;if(s&&e.length>0&&!n.call(e,0))for(var m=0;m<e.length;++m)l.push(String(m));if(i&&e.length>0)for(var g=0;g<e.length;++g)l.push(String(g));else for(var b in e)p&&"prototype"===b||!n.call(e,b)||l.push(String(b));if(u)for(var y=function(e){if("undefined"==typeof window||!d)return f(e);try{return f(e)}catch(e){return!1}}(e),v=0;v<h.length;++v)y&&"constructor"===h[v]||!n.call(e,h[v])||l.push(h[v]);return l}}e.exports=i},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t,r){"use strict";const i=r(294),n=r(144),o=r(295);function a(e,t){switch(n(e)){case"object":return function(e,t){if("function"==typeof t)return t(e);if(t||o(e)){const r=new e.constructor;for(let i in e)r[i]=a(e[i],t);return r}return e}(e,t);case"array":return function(e,t){const r=new e.constructor(e.length);for(let i=0;i<e.length;i++)r[i]=a(e[i],t);return r}(e,t);default:return i(e)}}e.exports=a},function(e,t,r){"use strict";(function(t){
|
|
21
21
|
/*!
|
|
22
22
|
* shallow-clone <https://github.com/jonschlinkert/shallow-clone>
|
|
23
23
|
*
|