@hashgraphonline/standards-sdk 0.0.27 → 0.0.29

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.
@@ -28,7 +28,7 @@ read:function(e,t,r,o,n){var i,a,s=8*n-o-1,c=(1<<s)-1,u=c>>1,l=-7,d=r?n-1:0,p=r?
28
28
  */
29
29
  !function(e){const t=base64Js$1,r=ieee754$1,o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=function(e){+e!=e&&(e=0);return u.alloc(+e)},e.INSPECT_MAX_BYTES=50;const n=2147483647;e.kMaxLength=n;const{Uint8Array:i,ArrayBuffer:a,SharedArrayBuffer:s}=globalThis;function c(e){if(e>n)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new i(e);return Object.setPrototypeOf(t,u.prototype),t}function u(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return p(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|y(e,t);let o=c(r);const n=o.write(e,t);n!==r&&(o=o.slice(0,n));return o}(e,t);if(a.isView(e))return function(e){if(Q(e,i)){const t=new i(e);return f(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Q(e,a)||e&&Q(e.buffer,a))return f(e,t,r);if(void 0!==s&&(Q(e,s)||e&&Q(e.buffer,s)))return f(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const o=e.valueOf&&e.valueOf();if(null!=o&&o!==e)return u.from(o,t,r);const n=function(e){if(u.isBuffer(e)){const t=0|m(e.length),r=c(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||Y(e.length)?c(0):h(e);if("Buffer"===e.type&&Array.isArray(e.data))return h(e.data)}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return u.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function d(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function p(e){return d(e),c(e<0?0:0|m(e))}function h(e){const t=e.length<0?0:0|m(e.length),r=c(t);for(let o=0;o<t;o+=1)r[o]=255&e[o];return r}function f(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let o;return o=void 0===t&&void 0===r?new i(e):void 0===r?new i(e,t):new i(e,t,r),Object.setPrototypeOf(o,u.prototype),o}function m(e){if(e>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return 0|e}function y(e,t){if(u.isBuffer(e))return e.length;if(a.isView(e)||Q(e,a))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,o=arguments.length>2&&!0===arguments[2];if(!o&&0===r)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return W(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(n)return o?-1:W(e).length;t=(""+t).toLowerCase(),n=!0}}function g(e,t,r){let o=!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 x(this,t,r);case"utf8":case"utf-8":return O(this,t,r);case"ascii":return S(this,t,r);case"latin1":case"binary":return R(this,t,r);case"base64":return A(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function b(e,t,r){const o=e[t];e[t]=e[r],e[r]=o}function v(e,t,r,o,n){if(0===e.length)return-1;if("string"==typeof r?(o=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Y(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=u.from(t,o)),u.isBuffer(t))return 0===t.length?-1:w(e,t,r,o,n);if("number"==typeof t)return t&=255,"function"==typeof i.prototype.indexOf?n?i.prototype.indexOf.call(e,t,r):i.prototype.lastIndexOf.call(e,t,r):w(e,[t],r,o,n);throw new TypeError("val must be string, number or Buffer")}function w(e,t,r,o,n){let i,a=1,s=e.length,c=t.length;if(void 0!==o&&("ucs2"===(o=String(o).toLowerCase())||"ucs-2"===o||"utf16le"===o||"utf-16le"===o)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(n){let o=-1;for(i=r;i<s;i++)if(u(e,i)===u(t,-1===o?0:i-o)){if(-1===o&&(o=i),i-o+1===c)return o*a}else-1!==o&&(i-=i-o),o=-1}else for(r+c>s&&(r=s-c),i=r;i>=0;i--){let r=!0;for(let o=0;o<c;o++)if(u(e,i+o)!==u(t,o)){r=!1;break}if(r)return i}return-1}function $(e,t,r,o){r=Number(r)||0;const n=e.length-r;o?(o=Number(o))>n&&(o=n):o=n;const i=t.length;let a;for(o>i/2&&(o=i/2),a=0;a<o;++a){const o=parseInt(t.substr(2*a,2),16);if(Y(o))return a;e[r+a]=o}return a}function k(e,t,r,o){return Z(W(t,e.length-r),e,r,o)}function _(e,t,r,o){return Z(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,o)}function T(e,t,r,o){return Z(z(t),e,r,o)}function I(e,t,r,o){return Z(function(e,t){let r,o,n;const i=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)r=e.charCodeAt(a),o=r>>8,n=r%256,i.push(n),i.push(o);return i}(t,e.length-r),e,r,o)}function A(e,r,o){return 0===r&&o===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,o))}function O(e,t,r){r=Math.min(e.length,r);const o=[];let n=t;for(;n<r;){const t=e[n];let i=null,a=t>239?4:t>223?3:t>191?2:1;if(n+a<=r){let r,o,s,c;switch(a){case 1:t<128&&(i=t);break;case 2:r=e[n+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(i=c));break;case 3:r=e[n+1],o=e[n+2],128==(192&r)&&128==(192&o)&&(c=(15&t)<<12|(63&r)<<6|63&o,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:r=e[n+1],o=e[n+2],s=e[n+3],128==(192&r)&&128==(192&o)&&128==(192&s)&&(c=(15&t)<<18|(63&r)<<12|(63&o)<<6|63&s,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,o.push(i>>>10&1023|55296),i=56320|1023&i),o.push(i),n+=a}return function(e){const t=e.length;if(t<=E)return String.fromCharCode.apply(String,e);let r="",o=0;for(;o<t;)r+=String.fromCharCode.apply(String,e.slice(o,o+=E));return r}(o)}u.TYPED_ARRAY_SUPPORT=function(){try{const e=new i(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,i.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(u.prototype,i.prototype),Object.setPrototypeOf(u,i),u.alloc=function(e,t,r){return function(e,t,r){return d(e),e<=0?c(e):void 0!==t?"string"==typeof r?c(e).fill(t,r):c(e).fill(t):c(e)}(e,t,r)},u.allocUnsafe=function(e){return p(e)},u.allocUnsafeSlow=function(e){return p(e)},u.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==u.prototype},u.compare=function(e,t){if(Q(e,i)&&(e=u.from(e,e.offset,e.byteLength)),Q(t,i)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,o=t.length;for(let n=0,i=Math.min(r,o);n<i;++n)if(e[n]!==t[n]){r=e[n],o=t[n];break}return r<o?-1:o<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(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const o=u.allocUnsafe(t);let n=0;for(r=0;r<e.length;++r){let t=e[r];if(Q(t,i))n+t.length>o.length?(u.isBuffer(t)||(t=u.from(t)),t.copy(o,n)):i.prototype.set.call(o,t,n);else{if(!u.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(o,n)}n+=t.length}return o},u.byteLength=y,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)b(this,t,t+1);return this},u.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)b(this,t,t+3),b(this,t+1,t+2);return this},u.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)b(this,t,t+7),b(this,t+1,t+6),b(this,t+2,t+5),b(this,t+3,t+4);return this},u.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?O(this,0,e):g.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,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(){let t="";const r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(e,t,r,o,n){if(Q(e,i)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===o&&(o=0),void 0===n&&(n=this.length),t<0||r>e.length||o<0||n>this.length)throw new RangeError("out of range index");if(o>=n&&t>=r)return 0;if(o>=n)return-1;if(t>=r)return 1;if(this===e)return 0;let a=(n>>>=0)-(o>>>=0),s=(r>>>=0)-(t>>>=0);const c=Math.min(a,s),l=this.slice(o,n),d=e.slice(t,r);for(let i=0;i<c;++i)if(l[i]!==d[i]){a=l[i],s=d[i];break}return a<s?-1:s<a?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return v(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return v(this,e,t,r,!1)},u.prototype.write=function(e,t,r,o){if(void 0===t)o="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)o=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===o&&(o="utf8")):(o=r,r=void 0)}const n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let i=!1;for(;;)switch(o){case"hex":return $(this,e,t,r);case"utf8":case"utf-8":return k(this,e,t,r);case"ascii":case"latin1":case"binary":return _(this,e,t,r);case"base64":return T(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const E=4096;function S(e,t,r){let o="";r=Math.min(e.length,r);for(let n=t;n<r;++n)o+=String.fromCharCode(127&e[n]);return o}function R(e,t,r){let o="";r=Math.min(e.length,r);for(let n=t;n<r;++n)o+=String.fromCharCode(e[n]);return o}function x(e,t,r){const o=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>o)&&(r=o);let n="";for(let i=t;i<r;++i)n+=X[e[i]];return n}function C(e,t,r){const o=e.slice(t,r);let n="";for(let i=0;i<o.length-1;i+=2)n+=String.fromCharCode(o[i]+256*o[i+1]);return n}function P(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 N(e,t,r,o,n,i){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<i)throw new RangeError('"value" argument is out of bounds');if(r+o>e.length)throw new RangeError("Index out of range")}function B(e,t,r,o,n){q(t,o,n,e,r,7);let i=Number(t&BigInt(4294967295));e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,r}function D(e,t,r,o,n){q(t,o,n,e,r,7);let i=Number(t&BigInt(4294967295));e[r+7]=i,i>>=8,e[r+6]=i,i>>=8,e[r+5]=i,i>>=8,e[r+4]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=a,a>>=8,e[r+2]=a,a>>=8,e[r+1]=a,a>>=8,e[r]=a,r+8}function M(e,t,r,o,n,i){if(r+o>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,o,n,i){return t=+t,o>>>=0,i||M(e,0,o,4),r.write(e,t,o,n,23,4),o+4}function j(e,t,o,n,i){return t=+t,o>>>=0,i||M(e,0,o,8),r.write(e,t,o,n,52,8),o+8}u.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const o=this.subarray(e,t);return Object.setPrototypeOf(o,u.prototype),o},u.prototype.readUintLE=u.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);let o=this[e],n=1,i=0;for(;++i<t&&(n*=256);)o+=this[e+i]*n;return o},u.prototype.readUintBE=u.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);let o=this[e+--t],n=1;for(;t>0&&(n*=256);)o+=this[e+--t]*n;return o},u.prototype.readUint8=u.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readBigUInt64LE=J((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const o=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,n=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(o)+(BigInt(n)<<BigInt(32))})),u.prototype.readBigUInt64BE=J((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const o=t*2**24+65536*this[++e]+256*this[++e]+this[++e],n=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(o)<<BigInt(32))+BigInt(n)})),u.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);let o=this[e],n=1,i=0;for(;++i<t&&(n*=256);)o+=this[e+i]*n;return n*=128,o>=n&&(o-=Math.pow(2,8*t)),o},u.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);let o=t,n=1,i=this[e+--o];for(;o>0&&(n*=256);)i+=this[e+--o]*n;return n*=128,i>=n&&(i-=Math.pow(2,8*t)),i},u.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(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 e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readBigInt64LE=J((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const o=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(o)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),u.prototype.readBigInt64BE=J((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const o=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(o)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),u.prototype.readFloatLE=function(e,t){return e>>>=0,t||P(e,4,this.length),r.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),r.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),r.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),r.read(this,e,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,t,r,o){if(e=+e,t>>>=0,r>>>=0,!o){N(this,e,t,r,Math.pow(2,8*r)-1,0)}let n=1,i=0;for(this[t]=255&e;++i<r&&(n*=256);)this[t+i]=e/n&255;return t+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(e,t,r,o){if(e=+e,t>>>=0,r>>>=0,!o){N(this,e,t,r,Math.pow(2,8*r)-1,0)}let n=r-1,i=1;for(this[t+n]=255&e;--n>=0&&(i*=256);)this[t+n]=e/i&255;return t+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,1,255,0),this[t]=255&e,t+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeBigUInt64LE=J((function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=J((function(e,t=0){return D(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(e,t,r,o){if(e=+e,t>>>=0,!o){const o=Math.pow(2,8*r-1);N(this,e,t,r,o-1,-o)}let n=0,i=1,a=0;for(this[t]=255&e;++n<r&&(i*=256);)e<0&&0===a&&0!==this[t+n-1]&&(a=1),this[t+n]=(e/i|0)-a&255;return t+r},u.prototype.writeIntBE=function(e,t,r,o){if(e=+e,t>>>=0,!o){const o=Math.pow(2,8*r-1);N(this,e,t,r,o-1,-o)}let n=r-1,i=1,a=0;for(this[t+n]=255&e;--n>=0&&(i*=256);)e<0&&0===a&&0!==this[t+n+1]&&(a=1),this[t+n]=(e/i|0)-a&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,1,127,-128),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||N(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeBigInt64LE=J((function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=J((function(e,t=0){return D(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return L(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,o){if(!u.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),o||0===o||(o=this.length),t>=e.length&&(t=e.length),t||(t=0),o>0&&o<r&&(o=r),o===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("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-t<o-r&&(o=e.length-t+r);const n=o-r;return this===e&&"function"==typeof i.prototype.copyWithin?this.copyWithin(t,r,o):i.prototype.set.call(e,this.subarray(r,o),t),n},u.prototype.fill=function(e,t,r,o){if("string"==typeof e){if("string"==typeof t?(o=t,t=0,r=this.length):"string"==typeof r&&(o=r,r=this.length),void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!u.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(1===e.length){const t=e.charCodeAt(0);("utf8"===o&&t<128||"latin1"===o)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let n;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(n=t;n<r;++n)this[n]=e;else{const i=u.isBuffer(e)?e:u.from(e,o),a=i.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(n=0;n<r-t;++n)this[n+t]=i[n%a]}return this};const F={};function U(e,t,r){F[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function K(e){let t="",r=e.length;const o="-"===e[0]?1:0;for(;r>=o+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function q(e,t,r,o,n,i){if(e>r||e<t){const r="bigint"==typeof t?"n":"";let o;throw o=0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`,new F.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,r){G(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||H(t,e.length-(r+1))}(o,n,i)}function G(e,t){if("number"!=typeof e)throw new F.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,r){if(Math.floor(e)!==e)throw G(e,r),new F.ERR_OUT_OF_RANGE("offset","an integer",e);if(t<0)throw new F.ERR_BUFFER_OUT_OF_BOUNDS;throw new F.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${t}`,e)}U("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),U("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),U("ERR_OUT_OF_RANGE",(function(e,t,r){let o=`The value of "${e}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=K(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=K(n)),n+="n"),o+=` It must be ${t}. Received ${n}`,o}),RangeError);const V=/[^+/0-9A-Za-z-_]/g;function W(e,t){let r;t=t||1/0;const o=e.length;let n=null;const i=[];for(let a=0;a<o;++a){if(r=e.charCodeAt(a),r>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===o){(t-=3)>-1&&i.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&i.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function z(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Z(e,t,r,o){let n;for(n=0;n<o&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function Q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!=e}const X=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const o=16*r;for(let n=0;n<16;++n)t[o+n]=e[r]+e[n]}return t}();function J(e){return"undefined"==typeof BigInt?ee:e}function ee(){throw new Error("BigInt not supported")}}(buffer$2);const Buffer=buffer$2.Buffer,Blob$2=buffer$2.Blob,BlobOptions=buffer$2.BlobOptions,Buffer$1=buffer$2.Buffer,File=buffer$2.File,FileOptions=buffer$2.FileOptions,INSPECT_MAX_BYTES=buffer$2.INSPECT_MAX_BYTES,SlowBuffer=buffer$2.SlowBuffer,TranscodeEncoding=buffer$2.TranscodeEncoding,atob$1=buffer$2.atob,btoa$1=buffer$2.btoa,constants$1=buffer$2.constants,isAscii=buffer$2.isAscii,isUtf8=buffer$2.isUtf8,kMaxLength=buffer$2.kMaxLength,kStringMaxLength=buffer$2.kStringMaxLength,resolveObjectURL=buffer$2.resolveObjectURL,transcode=buffer$2.transcode,dist=Object.freeze(Object.defineProperty({__proto__:null,Blob:Blob$2,BlobOptions:BlobOptions,Buffer:Buffer$1,File:File,FileOptions:FileOptions,INSPECT_MAX_BYTES:INSPECT_MAX_BYTES,SlowBuffer:SlowBuffer,TranscodeEncoding:TranscodeEncoding,atob:atob$1,btoa:btoa$1,constants:constants$1,default:Buffer,isAscii:isAscii,isUtf8:isUtf8,kMaxLength:kMaxLength,kStringMaxLength:kStringMaxLength,resolveObjectURL:resolveObjectURL,transcode:transcode},Symbol.toStringTag,{value:"Module"})),require$$0$2=getAugmentedNamespace(dist);
30
30
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
31
- var hasRequiredSafeBuffer$1,hasRequiredBrowser$b;function requireSafeBuffer$1(){return hasRequiredSafeBuffer$1||(hasRequiredSafeBuffer$1=1,function(e,t){var r=require$$0$2,o=r.Buffer;function n(e,t){for(var r in e)t[r]=e[r]}function i(e,t,r){return o(e,t,r)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(n(r,t),t.Buffer=i),i.prototype=Object.create(o.prototype),n(o,i),i.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,r)},i.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=o(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}}(safeBuffer$1,safeBuffer$1.exports)),safeBuffer$1.exports}function requireBrowser$b(){if(hasRequiredBrowser$b)return browser$d.exports;hasRequiredBrowser$b=1;var e=65536,t=4294967295;var r=requireSafeBuffer$1().Buffer,o=commonjsGlobal.crypto||commonjsGlobal.msCrypto;return o&&o.getRandomValues?browser$d.exports=function(n,i){if(n>t)throw new RangeError("requested too many random bytes");var a=r.allocUnsafe(n);if(n>0)if(n>e)for(var s=0;s<n;s+=e)o.getRandomValues(a.slice(s,s+e));else o.getRandomValues(a);if("function"==typeof i)return process$1$1.nextTick((function(){i(null,a)}));return a}:browser$d.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")},browser$d.exports}var inherits_browser={exports:{}},hasRequiredInherits_browser;function requireInherits_browser(){return hasRequiredInherits_browser||(hasRequiredInherits_browser=1,"function"==typeof Object.create?inherits_browser.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:inherits_browser.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}),inherits_browser.exports}var events={exports:{}},hasRequiredEvents,streamBrowser$1,hasRequiredStreamBrowser$1;function requireEvents(){if(hasRequiredEvents)return events.exports;hasRequiredEvents=1;var e,t="object"==typeof Reflect?Reflect:null,r=t&&"function"==typeof t.apply?t.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};e=t&&"function"==typeof t.ownKeys?t.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function n(){n.init.call(this)}events.exports=n,events.exports.once=function(e,t){return new Promise((function(r,o){function n(r){e.removeListener(t,i),o(r)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",n),r([].slice.call(arguments))}f(e,t,i,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&f(e,"error",t,r)}(e,n,{once:!0})}))},n.EventEmitter=n,n.prototype._events=void 0,n.prototype._eventsCount=0,n.prototype._maxListeners=void 0;var i=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function s(e){return void 0===e._maxListeners?n.defaultMaxListeners:e._maxListeners}function c(e,t,r,o){var n,i,c,u;if(a(r),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),c=i[t]),void 0===c)c=i[t]=r,++e._eventsCount;else if("function"==typeof c?c=i[t]=o?[r,c]:[c,r]:o?c.unshift(r):c.push(r),(n=s(e))>0&&c.length>n&&!c.warned){c.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=c.length,u=l,console&&console.warn&&console.warn(u)}return e}function u(){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 l(e,t,r){var o={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=u.bind(o);return n.listener=r,o.wrapFn=n,n}function d(e,t,r){var o=e._events;if(void 0===o)return[];var n=o[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):h(n,n.length)}function p(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 h(e,t){for(var r=new Array(t),o=0;o<t;++o)r[o]=e[o];return r}function f(e,t,r,o){if("function"==typeof e.on)o.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(i){o.once&&e.removeEventListener(t,n),r(i)}))}}return Object.defineProperty(n,"defaultMaxListeners",{enumerable:!0,get:function(){return i},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");i=e}}),n.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},n.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(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},n.prototype.getMaxListeners=function(){return s(this)},n.prototype.emit=function(e){for(var t=[],o=1;o<arguments.length;o++)t.push(arguments[o]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){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 c=i[e];if(void 0===c)return!1;if("function"==typeof c)r(c,this,t);else{var u=c.length,l=h(c,u);for(o=0;o<u;++o)r(l[o],this,t)}return!0},n.prototype.addListener=function(e,t){return c(this,e,t,!1)},n.prototype.on=n.prototype.addListener,n.prototype.prependListener=function(e,t){return c(this,e,t,!0)},n.prototype.once=function(e,t){return a(t),this.on(e,l(this,e,t)),this},n.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,l(this,e,t)),this},n.prototype.removeListener=function(e,t){var r,o,n,i,s;if(a(t),void 0===(o=this._events))return this;if(void 0===(r=o[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete o[e],o.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,i=r.length-1;i>=0;i--)if(r[i]===t||r[i].listener===t){s=r[i].listener,n=i;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&&(o[e]=r[0]),void 0!==o.removeListener&&this.emit("removeListener",e,s||t)}return this},n.prototype.off=n.prototype.removeListener,n.prototype.removeAllListeners=function(e){var t,r,o;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,i=Object.keys(r);for(o=0;o<i.length;++o)"removeListener"!==(n=i[o])&&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(o=t.length-1;o>=0;o--)this.removeListener(e,t[o]);return this},n.prototype.listeners=function(e){return d(this,e,!0)},n.prototype.rawListeners=function(e){return d(this,e,!1)},n.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},n.prototype.listenerCount=p,n.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]},events.exports}function requireStreamBrowser$1(){return hasRequiredStreamBrowser$1?streamBrowser$1:(hasRequiredStreamBrowser$1=1,streamBrowser$1=requireEvents().EventEmitter)}var util$3={},types={},shams$1,hasRequiredShams$1,shams,hasRequiredShams,esObjectAtoms,hasRequiredEsObjectAtoms,esErrors,hasRequiredEsErrors,_eval,hasRequired_eval,range,hasRequiredRange,ref,hasRequiredRef,syntax,hasRequiredSyntax,type,hasRequiredType,uri,hasRequiredUri,abs,hasRequiredAbs,floor,hasRequiredFloor,max,hasRequiredMax,min,hasRequiredMin,pow,hasRequiredPow,round,hasRequiredRound,_isNaN,hasRequired_isNaN,sign$2,hasRequiredSign$1,gOPD,hasRequiredGOPD,gopd,hasRequiredGopd,esDefineProperty,hasRequiredEsDefineProperty,hasSymbols,hasRequiredHasSymbols,Reflect_getPrototypeOf,hasRequiredReflect_getPrototypeOf,Object_getPrototypeOf,hasRequiredObject_getPrototypeOf,implementation,hasRequiredImplementation,functionBind,hasRequiredFunctionBind,functionCall,hasRequiredFunctionCall,functionApply,hasRequiredFunctionApply,reflectApply,hasRequiredReflectApply,actualApply,hasRequiredActualApply,callBindApplyHelpers,hasRequiredCallBindApplyHelpers,get,hasRequiredGet,getProto,hasRequiredGetProto,hasown,hasRequiredHasown,getIntrinsic,hasRequiredGetIntrinsic,callBound,hasRequiredCallBound,isArguments,hasRequiredIsArguments,isRegex,hasRequiredIsRegex,safeRegexTest,hasRequiredSafeRegexTest,isGeneratorFunction,hasRequiredIsGeneratorFunction,isCallable,hasRequiredIsCallable,forEach$2,hasRequiredForEach,possibleTypedArrayNames,hasRequiredPossibleTypedArrayNames,availableTypedArrays,hasRequiredAvailableTypedArrays;function requireShams$1(){return hasRequiredShams$1?shams$1:(hasRequiredShams$1=1,shams$1=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 o 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 i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0})}function requireShams(){if(hasRequiredShams)return shams;hasRequiredShams=1;var e=requireShams$1();return shams=function(){return e()&&!!Symbol.toStringTag}}function requireEsObjectAtoms(){return hasRequiredEsObjectAtoms?esObjectAtoms:(hasRequiredEsObjectAtoms=1,esObjectAtoms=Object)}function requireEsErrors(){return hasRequiredEsErrors?esErrors:(hasRequiredEsErrors=1,esErrors=Error)}function require_eval(){return hasRequired_eval?_eval:(hasRequired_eval=1,_eval=EvalError)}function requireRange(){return hasRequiredRange?range:(hasRequiredRange=1,range=RangeError)}function requireRef(){return hasRequiredRef?ref:(hasRequiredRef=1,ref=ReferenceError)}function requireSyntax(){return hasRequiredSyntax?syntax:(hasRequiredSyntax=1,syntax=SyntaxError)}function requireType(){return hasRequiredType?type:(hasRequiredType=1,type=TypeError)}function requireUri(){return hasRequiredUri?uri:(hasRequiredUri=1,uri=URIError)}function requireAbs(){return hasRequiredAbs?abs:(hasRequiredAbs=1,abs=Math.abs)}function requireFloor(){return hasRequiredFloor?floor:(hasRequiredFloor=1,floor=Math.floor)}function requireMax(){return hasRequiredMax?max:(hasRequiredMax=1,max=Math.max)}function requireMin(){return hasRequiredMin?min:(hasRequiredMin=1,min=Math.min)}function requirePow(){return hasRequiredPow?pow:(hasRequiredPow=1,pow=Math.pow)}function requireRound(){return hasRequiredRound?round:(hasRequiredRound=1,round=Math.round)}function require_isNaN(){return hasRequired_isNaN?_isNaN:(hasRequired_isNaN=1,_isNaN=Number.isNaN||function(e){return e!=e})}function requireSign$1(){if(hasRequiredSign$1)return sign$2;hasRequiredSign$1=1;var e=require_isNaN();return sign$2=function(t){return e(t)||0===t?t:t<0?-1:1}}function requireGOPD(){return hasRequiredGOPD?gOPD:(hasRequiredGOPD=1,gOPD=Object.getOwnPropertyDescriptor)}function requireGopd(){if(hasRequiredGopd)return gopd;hasRequiredGopd=1;var e=requireGOPD();if(e)try{e([],"length")}catch(t){e=null}return gopd=e}function requireEsDefineProperty(){if(hasRequiredEsDefineProperty)return esDefineProperty;hasRequiredEsDefineProperty=1;var e=Object.defineProperty||!1;if(e)try{e({},"a",{value:1})}catch(t){e=!1}return esDefineProperty=e}function requireHasSymbols(){if(hasRequiredHasSymbols)return hasSymbols;hasRequiredHasSymbols=1;var e="undefined"!=typeof Symbol&&Symbol,t=requireShams$1();return hasSymbols=function(){return"function"==typeof e&&("function"==typeof Symbol&&("symbol"==typeof e("foo")&&("symbol"==typeof Symbol("bar")&&t())))}}function requireReflect_getPrototypeOf(){return hasRequiredReflect_getPrototypeOf?Reflect_getPrototypeOf:(hasRequiredReflect_getPrototypeOf=1,Reflect_getPrototypeOf="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null)}function requireObject_getPrototypeOf(){if(hasRequiredObject_getPrototypeOf)return Object_getPrototypeOf;hasRequiredObject_getPrototypeOf=1;var e=requireEsObjectAtoms();return Object_getPrototypeOf=e.getPrototypeOf||null}function requireImplementation(){if(hasRequiredImplementation)return implementation;hasRequiredImplementation=1;var e=Object.prototype.toString,t=Math.max,r=function(e,t){for(var r=[],o=0;o<e.length;o+=1)r[o]=e[o];for(var n=0;n<t.length;n+=1)r[n+e.length]=t[n];return r};return implementation=function(o){var n=this;if("function"!=typeof n||"[object Function]"!==e.apply(n))throw new TypeError("Function.prototype.bind called on incompatible "+n);for(var i,a=function(e,t){for(var r=[],o=t,n=0;o<e.length;o+=1,n+=1)r[n]=e[o];return r}(arguments,1),s=t(0,n.length-a.length),c=[],u=0;u<s;u++)c[u]="$"+u;if(i=Function("binder","return function ("+function(e,t){for(var r="",o=0;o<e.length;o+=1)r+=e[o],o+1<e.length&&(r+=t);return r}(c,",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof i){var e=n.apply(this,r(a,arguments));return Object(e)===e?e:this}return n.apply(o,r(a,arguments))})),n.prototype){var l=function(){};l.prototype=n.prototype,i.prototype=new l,l.prototype=null}return i},implementation}function requireFunctionBind(){if(hasRequiredFunctionBind)return functionBind;hasRequiredFunctionBind=1;var e=requireImplementation();return functionBind=Function.prototype.bind||e}function requireFunctionCall(){return hasRequiredFunctionCall?functionCall:(hasRequiredFunctionCall=1,functionCall=Function.prototype.call)}function requireFunctionApply(){return hasRequiredFunctionApply?functionApply:(hasRequiredFunctionApply=1,functionApply=Function.prototype.apply)}function requireReflectApply(){return hasRequiredReflectApply?reflectApply:(hasRequiredReflectApply=1,reflectApply="undefined"!=typeof Reflect&&Reflect&&Reflect.apply)}function requireActualApply(){if(hasRequiredActualApply)return actualApply;hasRequiredActualApply=1;var e=requireFunctionBind(),t=requireFunctionApply(),r=requireFunctionCall(),o=requireReflectApply();return actualApply=o||e.call(r,t)}function requireCallBindApplyHelpers(){if(hasRequiredCallBindApplyHelpers)return callBindApplyHelpers;hasRequiredCallBindApplyHelpers=1;var e=requireFunctionBind(),t=requireType(),r=requireFunctionCall(),o=requireActualApply();return callBindApplyHelpers=function(n){if(n.length<1||"function"!=typeof n[0])throw new t("a function is required");return o(e,r,n)}}function requireGet(){if(hasRequiredGet)return get;hasRequiredGet=1;var e,t=requireCallBindApplyHelpers(),r=requireGopd();try{e=[].__proto__===Array.prototype}catch(a){if(!a||"object"!=typeof a||!("code"in a)||"ERR_PROTO_ACCESS"!==a.code)throw a}var o=!!e&&r&&r(Object.prototype,"__proto__"),n=Object,i=n.getPrototypeOf;return get=o&&"function"==typeof o.get?t([o.get]):"function"==typeof i&&function(e){return i(null==e?e:n(e))}}function requireGetProto(){if(hasRequiredGetProto)return getProto;hasRequiredGetProto=1;var e=requireReflect_getPrototypeOf(),t=requireObject_getPrototypeOf(),r=requireGet();return getProto=e?function(t){return e(t)}:t?function(e){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new TypeError("getProto: not an object");return t(e)}:r?function(e){return r(e)}:null}function requireHasown(){if(hasRequiredHasown)return hasown;hasRequiredHasown=1;var e=Function.prototype.call,t=Object.prototype.hasOwnProperty,r=requireFunctionBind();return hasown=r.call(e,t)}function requireGetIntrinsic(){if(hasRequiredGetIntrinsic)return getIntrinsic;var e;hasRequiredGetIntrinsic=1;var t=requireEsObjectAtoms(),r=requireEsErrors(),o=require_eval(),n=requireRange(),i=requireRef(),a=requireSyntax(),s=requireType(),c=requireUri(),u=requireAbs(),l=requireFloor(),d=requireMax(),p=requireMin(),h=requirePow(),f=requireRound(),m=requireSign$1(),y=Function,g=function(e){try{return y('"use strict"; return ('+e+").constructor;")()}catch(t){}},b=requireGopd(),v=requireEsDefineProperty(),w=function(){throw new s},$=b?function(){try{return w}catch(e){try{return b(arguments,"callee").get}catch(t){return w}}}():w,k=requireHasSymbols()(),_=requireGetProto(),T=requireObject_getPrototypeOf(),I=requireReflect_getPrototypeOf(),A=requireFunctionApply(),O=requireFunctionCall(),E={},S="undefined"!=typeof Uint8Array&&_?_(Uint8Array):e,R={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?e:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?e:ArrayBuffer,"%ArrayIteratorPrototype%":k&&_?_([][Symbol.iterator]()):e,"%AsyncFromSyncIteratorPrototype%":e,"%AsyncFunction%":E,"%AsyncGenerator%":E,"%AsyncGeneratorFunction%":E,"%AsyncIteratorPrototype%":E,"%Atomics%":"undefined"==typeof Atomics?e:Atomics,"%BigInt%":"undefined"==typeof BigInt?e:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?e:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?e:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?e:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":r,"%eval%":eval,"%EvalError%":o,"%Float16Array%":"undefined"==typeof Float16Array?e:Float16Array,"%Float32Array%":"undefined"==typeof Float32Array?e:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?e:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?e:FinalizationRegistry,"%Function%":y,"%GeneratorFunction%":E,"%Int8Array%":"undefined"==typeof Int8Array?e:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?e:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?e:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":k&&_?_(_([][Symbol.iterator]())):e,"%JSON%":"object"==typeof JSON?JSON:e,"%Map%":"undefined"==typeof Map?e:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&k&&_?_((new Map)[Symbol.iterator]()):e,"%Math%":Math,"%Number%":Number,"%Object%":t,"%Object.getOwnPropertyDescriptor%":b,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?e:Promise,"%Proxy%":"undefined"==typeof Proxy?e:Proxy,"%RangeError%":n,"%ReferenceError%":i,"%Reflect%":"undefined"==typeof Reflect?e:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?e:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&k&&_?_((new Set)[Symbol.iterator]()):e,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?e:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":k&&_?_(""[Symbol.iterator]()):e,"%Symbol%":k?Symbol:e,"%SyntaxError%":a,"%ThrowTypeError%":$,"%TypedArray%":S,"%TypeError%":s,"%Uint8Array%":"undefined"==typeof Uint8Array?e:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?e:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?e:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?e:Uint32Array,"%URIError%":c,"%WeakMap%":"undefined"==typeof WeakMap?e:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?e:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?e:WeakSet,"%Function.prototype.call%":O,"%Function.prototype.apply%":A,"%Object.defineProperty%":v,"%Object.getPrototypeOf%":T,"%Math.abs%":u,"%Math.floor%":l,"%Math.max%":d,"%Math.min%":p,"%Math.pow%":h,"%Math.round%":f,"%Math.sign%":m,"%Reflect.getPrototypeOf%":I};if(_)try{null.error}catch(G){var x=_(_(G));R["%Error.prototype%"]=x}var C=function e(t){var r;if("%AsyncFunction%"===t)r=g("async function () {}");else if("%GeneratorFunction%"===t)r=g("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=g("async function* () {}");else if("%AsyncGenerator%"===t){var o=e("%AsyncGeneratorFunction%");o&&(r=o.prototype)}else if("%AsyncIteratorPrototype%"===t){var n=e("%AsyncGenerator%");n&&_&&(r=_(n.prototype))}return R[t]=r,r},P={__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"]},N=requireFunctionBind(),B=requireHasown(),D=N.call(O,Array.prototype.concat),M=N.call(A,Array.prototype.splice),L=N.call(O,String.prototype.replace),j=N.call(O,String.prototype.slice),F=N.call(O,RegExp.prototype.exec),U=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,K=/\\(\\)?/g,q=function(e,t){var r,o=e;if(B(P,o)&&(o="%"+(r=P[o])[0]+"%"),B(R,o)){var n=R[o];if(n===E&&(n=C(o)),void 0===n&&!t)throw new s("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:o,value:n}}throw new a("intrinsic "+e+" does not exist!")};return getIntrinsic=function(e,t){if("string"!=typeof e||0===e.length)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new s('"allowMissing" argument must be a boolean');if(null===F(/^%?[^%]*%?$/,e))throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(e){var t=j(e,0,1),r=j(e,-1);if("%"===t&&"%"!==r)throw new a("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new a("invalid intrinsic syntax, expected opening `%`");var o=[];return L(e,U,(function(e,t,r,n){o[o.length]=r?L(n,K,"$1"):t||e})),o}(e),o=r.length>0?r[0]:"",n=q("%"+o+"%",t),i=n.name,c=n.value,u=!1,l=n.alias;l&&(o=l[0],M(r,D([0,1],l)));for(var d=1,p=!0;d<r.length;d+=1){var h=r[d],f=j(h,0,1),m=j(h,-1);if(('"'===f||"'"===f||"`"===f||'"'===m||"'"===m||"`"===m)&&f!==m)throw new a("property names with quotes must have matching quotes");if("constructor"!==h&&p||(u=!0),B(R,i="%"+(o+="."+h)+"%"))c=R[i];else if(null!=c){if(!(h in c)){if(!t)throw new s("base intrinsic for "+e+" exists, but the property is not available.");return}if(b&&d+1>=r.length){var y=b(c,h);c=(p=!!y)&&"get"in y&&!("originalValue"in y.get)?y.get:c[h]}else p=B(c,h),c=c[h];p&&!u&&(R[i]=c)}}return c},getIntrinsic}function requireCallBound(){if(hasRequiredCallBound)return callBound;hasRequiredCallBound=1;var e=requireGetIntrinsic(),t=requireCallBindApplyHelpers(),r=t([e("%String.prototype.indexOf%")]);return callBound=function(o,n){var i=e(o,!!n);return"function"==typeof i&&r(o,".prototype.")>-1?t([i]):i}}function requireIsArguments(){if(hasRequiredIsArguments)return isArguments;hasRequiredIsArguments=1;var e=requireShams()(),t=requireCallBound()("Object.prototype.toString"),r=function(r){return!(e&&r&&"object"==typeof r&&Symbol.toStringTag in r)&&"[object Arguments]"===t(r)},o=function(e){return!!r(e)||null!==e&&"object"==typeof e&&"length"in e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==t(e)&&"callee"in e&&"[object Function]"===t(e.callee)},n=function(){return r(arguments)}();return r.isLegacyArguments=o,isArguments=n?r:o}function requireIsRegex(){if(hasRequiredIsRegex)return isRegex;hasRequiredIsRegex=1;var e,t=requireCallBound(),r=requireShams()(),o=requireHasown(),n=requireGopd();if(r){var i=t("RegExp.prototype.exec"),a={},s=function(){throw a},c={toString:s,valueOf:s};"symbol"==typeof Symbol.toPrimitive&&(c[Symbol.toPrimitive]=s),e=function(e){if(!e||"object"!=typeof e)return!1;var t=n(e,"lastIndex");if(!(t&&o(t,"value")))return!1;try{i(e,c)}catch(r){return r===a}}}else{var u=t("Object.prototype.toString");e=function(e){return!(!e||"object"!=typeof e&&"function"!=typeof e)&&"[object RegExp]"===u(e)}}return isRegex=e}function requireSafeRegexTest(){if(hasRequiredSafeRegexTest)return safeRegexTest;hasRequiredSafeRegexTest=1;var e=requireCallBound(),t=requireIsRegex(),r=e("RegExp.prototype.exec"),o=requireType();return safeRegexTest=function(e){if(!t(e))throw new o("`regex` must be a RegExp");return function(t){return null!==r(e,t)}}}function requireIsGeneratorFunction(){if(hasRequiredIsGeneratorFunction)return isGeneratorFunction;hasRequiredIsGeneratorFunction=1;var e,t=requireCallBound(),r=requireSafeRegexTest()(/^\s*(?:function)?\*/),o=requireShams()(),n=requireGetProto(),i=t("Object.prototype.toString"),a=t("Function.prototype.toString");return isGeneratorFunction=function(t){if("function"!=typeof t)return!1;if(r(a(t)))return!0;if(!o)return"[object GeneratorFunction]"===i(t);if(!n)return!1;if(void 0===e){var s=function(){if(!o)return!1;try{return Function("return function*() {}")()}catch(e){}}();e=!!s&&n(s)}return n(t)===e}}function requireIsCallable(){if(hasRequiredIsCallable)return isCallable;hasRequiredIsCallable=1;var e,t,r=Function.prototype.toString,o="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof o&&"function"==typeof Object.defineProperty)try{e=Object.defineProperty({},"length",{get:function(){throw t}}),t={},o((function(){throw 42}),null,e)}catch(p){p!==t&&(o=null)}else o=null;var n=/^\s*class\b/,i=function(e){try{var t=r.call(e);return n.test(t)}catch(o){return!1}},a=function(e){try{return!i(e)&&(r.call(e),!0)}catch(t){return!1}},s=Object.prototype.toString,c="function"==typeof Symbol&&!!Symbol.toStringTag,u=!(0 in[,]),l=function(){return!1};if("object"==typeof document){var d=document.all;s.call(d)===s.call(document.all)&&(l=function(e){if((u||!e)&&(void 0===e||"object"==typeof e))try{var t=s.call(e);return("[object HTMLAllCollection]"===t||"[object HTML document.all class]"===t||"[object HTMLCollection]"===t||"[object Object]"===t)&&null==e("")}catch(r){}return!1})}return isCallable=o?function(r){if(l(r))return!0;if(!r)return!1;if("function"!=typeof r&&"object"!=typeof r)return!1;try{o(r,null,e)}catch(n){if(n!==t)return!1}return!i(r)&&a(r)}:function(e){if(l(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(c)return a(e);if(i(e))return!1;var t=s.call(e);return!("[object Function]"!==t&&"[object GeneratorFunction]"!==t&&!/^\[object HTML/.test(t))&&a(e)}}function requireForEach(){if(hasRequiredForEach)return forEach$2;hasRequiredForEach=1;var e=requireIsCallable(),t=Object.prototype.toString,r=Object.prototype.hasOwnProperty;return forEach$2=function(o,n,i){if(!e(n))throw new TypeError("iterator must be a function");var a,s;arguments.length>=3&&(a=i),s=o,"[object Array]"===t.call(s)?function(e,t,o){for(var n=0,i=e.length;n<i;n++)r.call(e,n)&&(null==o?t(e[n],n,e):t.call(o,e[n],n,e))}(o,n,a):"string"==typeof o?function(e,t,r){for(var o=0,n=e.length;o<n;o++)null==r?t(e.charAt(o),o,e):t.call(r,e.charAt(o),o,e)}(o,n,a):function(e,t,o){for(var n in e)r.call(e,n)&&(null==o?t(e[n],n,e):t.call(o,e[n],n,e))}(o,n,a)},forEach$2}function requirePossibleTypedArrayNames(){return hasRequiredPossibleTypedArrayNames?possibleTypedArrayNames:(hasRequiredPossibleTypedArrayNames=1,possibleTypedArrayNames=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"])}function requireAvailableTypedArrays(){if(hasRequiredAvailableTypedArrays)return availableTypedArrays;hasRequiredAvailableTypedArrays=1;var e=requirePossibleTypedArrayNames(),t="undefined"==typeof globalThis?commonjsGlobal:globalThis;return availableTypedArrays=function(){for(var r=[],o=0;o<e.length;o++)"function"==typeof t[e[o]]&&(r[r.length]=e[o]);return r}}var callBind={exports:{}},defineDataProperty,hasRequiredDefineDataProperty,hasPropertyDescriptors_1,hasRequiredHasPropertyDescriptors,setFunctionLength,hasRequiredSetFunctionLength,applyBind,hasRequiredApplyBind,hasRequiredCallBind,whichTypedArray,hasRequiredWhichTypedArray,isTypedArray$2,hasRequiredIsTypedArray,hasRequiredTypes,isBufferBrowser,hasRequiredIsBufferBrowser,hasRequiredUtil$1,buffer_list,hasRequiredBuffer_list,destroy_1$1,hasRequiredDestroy$1;function requireDefineDataProperty(){if(hasRequiredDefineDataProperty)return defineDataProperty;hasRequiredDefineDataProperty=1;var e=requireEsDefineProperty(),t=requireSyntax(),r=requireType(),o=requireGopd();return defineDataProperty=function(n,i,a){if(!n||"object"!=typeof n&&"function"!=typeof n)throw new r("`obj` must be an object or a function`");if("string"!=typeof i&&"symbol"!=typeof i)throw new r("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new r("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new r("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new r("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new r("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,u=arguments.length>5?arguments[5]:null,l=arguments.length>6&&arguments[6],d=!!o&&o(n,i);if(e)e(n,i,{configurable:null===u&&d?d.configurable:!u,enumerable:null===s&&d?d.enumerable:!s,value:a,writable:null===c&&d?d.writable:!c});else{if(!l&&(s||c||u))throw new t("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");n[i]=a}},defineDataProperty}function requireHasPropertyDescriptors(){if(hasRequiredHasPropertyDescriptors)return hasPropertyDescriptors_1;hasRequiredHasPropertyDescriptors=1;var e=requireEsDefineProperty(),t=function(){return!!e};return t.hasArrayLengthDefineBug=function(){if(!e)return null;try{return 1!==e([],"length",{value:1}).length}catch(t){return!0}},hasPropertyDescriptors_1=t}function requireSetFunctionLength(){if(hasRequiredSetFunctionLength)return setFunctionLength;hasRequiredSetFunctionLength=1;var e=requireGetIntrinsic(),t=requireDefineDataProperty(),r=requireHasPropertyDescriptors()(),o=requireGopd(),n=requireType(),i=e("%Math.floor%");return setFunctionLength=function(e,a){if("function"!=typeof e)throw new n("`fn` is not a function");if("number"!=typeof a||a<0||a>4294967295||i(a)!==a)throw new n("`length` must be a positive 32-bit integer");var s=arguments.length>2&&!!arguments[2],c=!0,u=!0;if("length"in e&&o){var l=o(e,"length");l&&!l.configurable&&(c=!1),l&&!l.writable&&(u=!1)}return(c||u||!s)&&(r?t(e,"length",a,!0,!0):t(e,"length",a)),e},setFunctionLength}function requireApplyBind(){if(hasRequiredApplyBind)return applyBind;hasRequiredApplyBind=1;var e=requireFunctionBind(),t=requireFunctionApply(),r=requireActualApply();return applyBind=function(){return r(e,t,arguments)},applyBind}function requireCallBind(){return hasRequiredCallBind||(hasRequiredCallBind=1,e=callBind,t=requireSetFunctionLength(),r=requireEsDefineProperty(),o=requireCallBindApplyHelpers(),n=requireApplyBind(),e.exports=function(e){var r=o(arguments),n=e.length-(arguments.length-1);return t(r,1+(n>0?n:0),!0)},r?r(e.exports,"apply",{value:n}):e.exports.apply=n),callBind.exports;var e,t,r,o,n}function requireWhichTypedArray(){if(hasRequiredWhichTypedArray)return whichTypedArray;hasRequiredWhichTypedArray=1;var e=requireForEach(),t=requireAvailableTypedArrays(),r=requireCallBind(),o=requireCallBound(),n=requireGopd(),i=requireGetProto(),a=o("Object.prototype.toString"),s=requireShams()(),c="undefined"==typeof globalThis?commonjsGlobal:globalThis,u=t(),l=o("String.prototype.slice"),d=o("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r<e.length;r+=1)if(e[r]===t)return r;return-1},p={__proto__:null};e(u,s&&n&&i?function(e){var t=new c[e];if(Symbol.toStringTag in t&&i){var o=i(t),a=n(o,Symbol.toStringTag);if(!a&&o){var s=i(o);a=n(s,Symbol.toStringTag)}p["$"+e]=r(a.get)}}:function(e){var t=new c[e],o=t.slice||t.set;o&&(p["$"+e]=r(o))});return whichTypedArray=function(t){if(!t||"object"!=typeof t)return!1;if(!s){var r=l(a(t),8,-1);return d(u,r)>-1?r:"Object"===r&&function(t){var r=!1;return e(p,(function(e,o){if(!r)try{e(t),r=l(o,1)}catch(n){}})),r}(t)}return n?function(t){var r=!1;return e(p,(function(e,o){if(!r)try{"$"+e(t)===o&&(r=l(o,1))}catch(n){}})),r}(t):null}}function requireIsTypedArray(){if(hasRequiredIsTypedArray)return isTypedArray$2;hasRequiredIsTypedArray=1;var e=requireWhichTypedArray();return isTypedArray$2=function(t){return!!e(t)}}function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,function(e){var t=requireIsArguments(),r=requireIsGeneratorFunction(),o=requireWhichTypedArray(),n=requireIsTypedArray();function i(e){return e.call.bind(e)}var a="undefined"!=typeof BigInt,s="undefined"!=typeof Symbol,c=i(Object.prototype.toString),u=i(Number.prototype.valueOf),l=i(String.prototype.valueOf),d=i(Boolean.prototype.valueOf);if(a)var p=i(BigInt.prototype.valueOf);if(s)var h=i(Symbol.prototype.valueOf);function f(e,t){if("object"!=typeof e)return!1;try{return t(e),!0}catch(r){return!1}}function m(e){return"[object Map]"===c(e)}function y(e){return"[object Set]"===c(e)}function g(e){return"[object WeakMap]"===c(e)}function b(e){return"[object WeakSet]"===c(e)}function v(e){return"[object ArrayBuffer]"===c(e)}function w(e){return"undefined"!=typeof ArrayBuffer&&(v.working?v(e):e instanceof ArrayBuffer)}function $(e){return"[object DataView]"===c(e)}function k(e){return"undefined"!=typeof DataView&&($.working?$(e):e instanceof DataView)}e.isArgumentsObject=t,e.isGeneratorFunction=r,e.isTypedArray=n,e.isPromise=function(e){return"undefined"!=typeof Promise&&e instanceof Promise||null!==e&&"object"==typeof e&&"function"==typeof e.then&&"function"==typeof e.catch},e.isArrayBufferView=function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):n(e)||k(e)},e.isUint8Array=function(e){return"Uint8Array"===o(e)},e.isUint8ClampedArray=function(e){return"Uint8ClampedArray"===o(e)},e.isUint16Array=function(e){return"Uint16Array"===o(e)},e.isUint32Array=function(e){return"Uint32Array"===o(e)},e.isInt8Array=function(e){return"Int8Array"===o(e)},e.isInt16Array=function(e){return"Int16Array"===o(e)},e.isInt32Array=function(e){return"Int32Array"===o(e)},e.isFloat32Array=function(e){return"Float32Array"===o(e)},e.isFloat64Array=function(e){return"Float64Array"===o(e)},e.isBigInt64Array=function(e){return"BigInt64Array"===o(e)},e.isBigUint64Array=function(e){return"BigUint64Array"===o(e)},m.working="undefined"!=typeof Map&&m(new Map),e.isMap=function(e){return"undefined"!=typeof Map&&(m.working?m(e):e instanceof Map)},y.working="undefined"!=typeof Set&&y(new Set),e.isSet=function(e){return"undefined"!=typeof Set&&(y.working?y(e):e instanceof Set)},g.working="undefined"!=typeof WeakMap&&g(new WeakMap),e.isWeakMap=function(e){return"undefined"!=typeof WeakMap&&(g.working?g(e):e instanceof WeakMap)},b.working="undefined"!=typeof WeakSet&&b(new WeakSet),e.isWeakSet=function(e){return b(e)},v.working="undefined"!=typeof ArrayBuffer&&v(new ArrayBuffer),e.isArrayBuffer=w,$.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&$(new DataView(new ArrayBuffer(1),0,1)),e.isDataView=k;var _="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function T(e){return"[object SharedArrayBuffer]"===c(e)}function I(e){return void 0!==_&&(void 0===T.working&&(T.working=T(new _)),T.working?T(e):e instanceof _)}function A(e){return f(e,u)}function O(e){return f(e,l)}function E(e){return f(e,d)}function S(e){return a&&f(e,p)}function R(e){return s&&f(e,h)}e.isSharedArrayBuffer=I,e.isAsyncFunction=function(e){return"[object AsyncFunction]"===c(e)},e.isMapIterator=function(e){return"[object Map Iterator]"===c(e)},e.isSetIterator=function(e){return"[object Set Iterator]"===c(e)},e.isGeneratorObject=function(e){return"[object Generator]"===c(e)},e.isWebAssemblyCompiledModule=function(e){return"[object WebAssembly.Module]"===c(e)},e.isNumberObject=A,e.isStringObject=O,e.isBooleanObject=E,e.isBigIntObject=S,e.isSymbolObject=R,e.isBoxedPrimitive=function(e){return A(e)||O(e)||E(e)||S(e)||R(e)},e.isAnyArrayBuffer=function(e){return"undefined"!=typeof Uint8Array&&(w(e)||I(e))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(t){Object.defineProperty(e,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})}))}(types)),types}function requireIsBufferBrowser(){return hasRequiredIsBufferBrowser?isBufferBrowser:(hasRequiredIsBufferBrowser=1,isBufferBrowser=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8})}function requireUtil$1(){return hasRequiredUtil$1||(hasRequiredUtil$1=1,function(e){var t=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},o=0;o<t.length;o++)r[t[o]]=Object.getOwnPropertyDescriptor(e,t[o]);return r},r=/%[sdj%]/g;e.format=function(e){if(!y(e)){for(var t=[],o=0;o<arguments.length;o++)t.push(a(arguments[o]));return t.join(" ")}o=1;for(var n=arguments,i=n.length,s=String(e).replace(r,(function(e){if("%%"===e)return"%";if(o>=i)return e;switch(e){case"%s":return String(n[o++]);case"%d":return Number(n[o++]);case"%j":try{return JSON.stringify(n[o++])}catch(t){return"[Circular]"}default:return e}})),c=n[o];o<i;c=n[++o])f(c)||!v(c)?s+=" "+c:s+=" "+a(c);return s},e.deprecate=function(t,r){if(void 0!==process$1$1&&!0===process$1$1.noDeprecation)return t;if(void 0===process$1$1)return function(){return e.deprecate(t,r).apply(this,arguments)};var o=!1;return function(){if(!o){if(process$1$1.throwDeprecation)throw new Error(r);process$1$1.traceDeprecation?console.trace(r):console.error(r),o=!0}return t.apply(this,arguments)}};var o={},n=/^$/;if(process$1$1.env.NODE_DEBUG){var i=process$1$1.env.NODE_DEBUG;i=i.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),n=new RegExp("^"+i+"$","i")}function a(t,r){var o={seen:[],stylize:c};return arguments.length>=3&&(o.depth=arguments[2]),arguments.length>=4&&(o.colors=arguments[3]),h(r)?o.showHidden=r:r&&e._extend(o,r),g(o.showHidden)&&(o.showHidden=!1),g(o.depth)&&(o.depth=2),g(o.colors)&&(o.colors=!1),g(o.customInspect)&&(o.customInspect=!0),o.colors&&(o.stylize=s),u(o,t,o.depth)}function s(e,t){var r=a.styles[t];return r?"["+a.colors[r][0]+"m"+e+"["+a.colors[r][1]+"m":e}function c(e,t){return e}function u(t,r,o){if(t.customInspect&&r&&k(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(o,t);return y(n)||(n=u(t,n,o)),n}var i=function(e,t){if(g(t))return e.stylize("undefined","undefined");if(y(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(m(t))return e.stylize(""+t,"number");if(h(t))return e.stylize(""+t,"boolean");if(f(t))return e.stylize("null","null")}(t,r);if(i)return i;var a=Object.keys(r),s=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(r)),$(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return l(r);if(0===a.length){if(k(r)){var c=r.name?": "+r.name:"";return t.stylize("[Function"+c+"]","special")}if(b(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(w(r))return t.stylize(Date.prototype.toString.call(r),"date");if($(r))return l(r)}var v,_="",T=!1,I=["{","}"];(p(r)&&(T=!0,I=["[","]"]),k(r))&&(_=" [Function"+(r.name?": "+r.name:"")+"]");return b(r)&&(_=" "+RegExp.prototype.toString.call(r)),w(r)&&(_=" "+Date.prototype.toUTCString.call(r)),$(r)&&(_=" "+l(r)),0!==a.length||T&&0!=r.length?o<0?b(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),v=T?function(e,t,r,o,n){for(var i=[],a=0,s=t.length;a<s;++a)A(t,String(a))?i.push(d(e,t,r,o,String(a),!0)):i.push("");return n.forEach((function(n){n.match(/^\d+$/)||i.push(d(e,t,r,o,n,!0))})),i}(t,r,o,s,a):a.map((function(e){return d(t,r,o,s,e,T)})),t.seen.pop(),function(e,t,r){var o=e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0);if(o>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(v,_,I)):I[0]+_+I[1]}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,r,o,n,i){var a,s,c;if((c=Object.getOwnPropertyDescriptor(t,n)||{value:t[n]}).get?s=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(s=e.stylize("[Setter]","special")),A(o,n)||(a="["+n+"]"),s||(e.seen.indexOf(c.value)<0?(s=f(r)?u(e,c.value,null):u(e,c.value,r-1)).indexOf("\n")>-1&&(s=i?s.split("\n").map((function(e){return" "+e})).join("\n").slice(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),g(a)){if(i&&n.match(/^\d+$/))return s;(a=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.slice(1,-1),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function p(e){return Array.isArray(e)}function h(e){return"boolean"==typeof e}function f(e){return null===e}function m(e){return"number"==typeof e}function y(e){return"string"==typeof e}function g(e){return void 0===e}function b(e){return v(e)&&"[object RegExp]"===_(e)}function v(e){return"object"==typeof e&&null!==e}function w(e){return v(e)&&"[object Date]"===_(e)}function $(e){return v(e)&&("[object Error]"===_(e)||e instanceof Error)}function k(e){return"function"==typeof e}function _(e){return Object.prototype.toString.call(e)}function T(e){return e<10?"0"+e.toString(10):e.toString(10)}e.debuglog=function(t){if(t=t.toUpperCase(),!o[t])if(n.test(t)){var r=process$1$1.pid;o[t]=function(){var o=e.format.apply(e,arguments);console.error("%s %d: %s",t,r,o)}}else o[t]=function(){};return o[t]},e.inspect=a,a.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]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.types=requireTypes(),e.isArray=p,e.isBoolean=h,e.isNull=f,e.isNullOrUndefined=function(e){return null==e},e.isNumber=m,e.isString=y,e.isSymbol=function(e){return"symbol"==typeof e},e.isUndefined=g,e.isRegExp=b,e.types.isRegExp=b,e.isObject=v,e.isDate=w,e.types.isDate=w,e.isError=$,e.types.isNativeError=$,e.isFunction=k,e.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},e.isBuffer=requireIsBufferBrowser();var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function A(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.log=function(){var t,r;console.log("%s - %s",(r=[T((t=new Date).getHours()),T(t.getMinutes()),T(t.getSeconds())].join(":"),[t.getDate(),I[t.getMonth()],r].join(" ")),e.format.apply(e,arguments))},e.inherits=requireInherits_browser(),e._extend=function(e,t){if(!t||!v(t))return e;for(var r=Object.keys(t),o=r.length;o--;)e[r[o]]=t[r[o]];return e};var O="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function E(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}e.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(O&&e[O]){var r;if("function"!=typeof(r=e[O]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(r,O,{value:r,enumerable:!1,writable:!1,configurable:!0}),r}function r(){for(var t,r,o=new Promise((function(e,o){t=e,r=o})),n=[],i=0;i<arguments.length;i++)n.push(arguments[i]);n.push((function(e,o){e?r(e):t(o)}));try{e.apply(this,n)}catch(a){r(a)}return o}return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),O&&Object.defineProperty(r,O,{value:r,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(r,t(e))},e.promisify.custom=O,e.callbackify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');function r(){for(var t=[],r=0;r<arguments.length;r++)t.push(arguments[r]);var o=t.pop();if("function"!=typeof o)throw new TypeError("The last argument must be of type Function");var n=this,i=function(){return o.apply(n,arguments)};e.apply(this,t).then((function(e){process$1$1.nextTick(i.bind(null,null,e))}),(function(e){process$1$1.nextTick(E.bind(null,e,i))}))}return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),Object.defineProperties(r,t(e)),r}}(util$3)),util$3}function requireBuffer_list(){if(hasRequiredBuffer_list)return buffer_list;function e(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function t(t){for(var o=1;o<arguments.length;o++){var n=null!=arguments[o]?arguments[o]:{};o%2?e(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,n(o.key),o)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t);if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:String(t)}hasRequiredBuffer_list=1;var i=require$$0$2.Buffer,a=requireUtil$1().inspect,s=a&&a.custom||"inspect";return buffer_list=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 o(e,[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return i.alloc(0);for(var t,r,o,n=i.allocUnsafe(e>>>0),a=this.head,s=0;a;)t=a.data,r=n,o=s,i.prototype.copy.call(t,r,o),s+=a.data.length,a=a.next;return n}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,o=t.data;for(e-=o.length;t=t.next;){var n=t.data,i=e>n.length?n.length:e;if(i===n.length?o+=n:o+=n.slice(0,e),0===(e-=i)){i===n.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=n.slice(i));break}++r}return this.length-=r,o}},{key:"_getBuffer",value:function(e){var t=i.allocUnsafe(e),r=this.head,o=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var n=r.data,a=e>n.length?n.length:e;if(n.copy(t,t.length-e,0,a),0===(e-=a)){a===n.length?(++o,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(a));break}++o}return this.length-=o,t}},{key:s,value:function(e,r){return a(this,t(t({},r),{},{depth:0,customInspect:!1}))}}]),e}()}function requireDestroy$1(){if(hasRequiredDestroy$1)return destroy_1$1;function e(e,o){r(e,o),t(e)}function t(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function r(e,t){e.emit("error",t)}return hasRequiredDestroy$1=1,destroy_1$1={destroy:function(o,n){var i=this,a=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return a||s?(n?n(o):o&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process$1$1.nextTick(r,this,o)):process$1$1.nextTick(r,this,o)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(o||null,(function(r){!n&&r?i._writableState?i._writableState.errorEmitted?process$1$1.nextTick(t,i):(i._writableState.errorEmitted=!0,process$1$1.nextTick(e,i,r)):process$1$1.nextTick(e,i,r):n?(process$1$1.nextTick(t,i),n(r)):process$1$1.nextTick(t,i)})),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)},errorOrDestroy:function(e,t){var r=e._readableState,o=e._writableState;r&&r.autoDestroy||o&&o.autoDestroy?e.destroy(t):e.emit("error",t)}}}var errorsBrowser={},hasRequiredErrorsBrowser,state,hasRequiredState,browser$c,hasRequiredBrowser$a,_stream_writable$1,hasRequired_stream_writable$1,_stream_duplex$1,hasRequired_stream_duplex$1;function requireErrorsBrowser(){if(hasRequiredErrorsBrowser)return errorsBrowser;hasRequiredErrorsBrowser=1;var e={};function t(t,r,o){o||(o=Error);var n=function(e){var t,o;function n(t,o,n){return e.call(this,function(e,t,o){return"string"==typeof r?r:r(e,t,o)}(t,o,n))||this}return o=e,(t=n).prototype=Object.create(o.prototype),t.prototype.constructor=t,t.__proto__=o,n}(o);n.prototype.name=o.name,n.prototype.code=t,e[t]=n}function r(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}return t("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),t("ERR_INVALID_ARG_TYPE",(function(e,t,o){var n,i,a;if("string"==typeof t&&(i="not ",t.substr(0,i.length)===i)?(n="must not be",t=t.replace(/^not /,"")):n="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))a="The ".concat(e," ").concat(n," ").concat(r(t,"type"));else{var s=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";a='The "'.concat(e,'" ').concat(s," ").concat(n," ").concat(r(t,"type"))}return a+=". Received type ".concat(typeof o)}),TypeError),t("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),t("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),t("ERR_STREAM_PREMATURE_CLOSE","Premature close"),t("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),t("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),t("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),t("ERR_STREAM_WRITE_AFTER_END","write after end"),t("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),t("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),t("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),errorsBrowser.codes=e,errorsBrowser}function requireState(){if(hasRequiredState)return state;hasRequiredState=1;var e=requireErrorsBrowser().codes.ERR_INVALID_OPT_VALUE;return state={getHighWaterMark:function(t,r,o,n){var i=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(r,n,o);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new e(n?o:"highWaterMark",i);return Math.floor(i)}return t.objectMode?16:16384}}}function requireBrowser$a(){if(hasRequiredBrowser$a)return browser$c;function e(e){try{if(!commonjsGlobal.localStorage)return!1}catch(r){return!1}var t=commonjsGlobal.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}return hasRequiredBrowser$a=1,browser$c=function(t,r){if(e("noDeprecation"))return t;var o=!1;return function(){if(!o){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),o=!0}return t.apply(this,arguments)}},browser$c}function require_stream_writable$1(){if(hasRequired_stream_writable$1)return _stream_writable$1;function e(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var o=e.entry;e.entry=null;for(;o;){var n=o.callback;t.pendingcb--,n(r),o=o.next}t.corkedRequestsFree.next=e}(t,e)}}var t;hasRequired_stream_writable$1=1,_stream_writable$1=$,$.WritableState=w;var r={deprecate:requireBrowser$a()},o=requireStreamBrowser$1(),n=require$$0$2.Buffer,i=(void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var a,s=requireDestroy$1(),c=requireState().getHighWaterMark,u=requireErrorsBrowser().codes,l=u.ERR_INVALID_ARG_TYPE,d=u.ERR_METHOD_NOT_IMPLEMENTED,p=u.ERR_MULTIPLE_CALLBACK,h=u.ERR_STREAM_CANNOT_PIPE,f=u.ERR_STREAM_DESTROYED,m=u.ERR_STREAM_NULL_VALUES,y=u.ERR_STREAM_WRITE_AFTER_END,g=u.ERR_UNKNOWN_ENCODING,b=s.errorOrDestroy;function v(){}function w(r,o,n){t=t||require_stream_duplex$1(),r=r||{},"boolean"!=typeof n&&(n=o instanceof t),this.objectMode=!!r.objectMode,n&&(this.objectMode=this.objectMode||!!r.writableObjectMode),this.highWaterMark=c(this,r,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var i=!1===r.decodeStrings;this.decodeStrings=!i,this.defaultEncoding=r.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,o=r.sync,n=r.writecb;if("function"!=typeof n)throw new p;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,o,n){--t.pendingcb,r?(process$1$1.nextTick(n,o),process$1$1.nextTick(O,e,t),e._writableState.errorEmitted=!0,b(e,o)):(n(o),e._writableState.errorEmitted=!0,b(e,o),O(e,t))}(e,r,o,t,n);else{var i=I(r)||e.destroyed;i||r.corked||r.bufferProcessing||!r.bufferedRequest||T(e,r),o?process$1$1.nextTick(_,e,r,i,n):_(e,r,i,n)}}(o,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==r.emitClose,this.autoDestroy=!!r.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function $(e){var r=this instanceof(t=t||require_stream_duplex$1());if(!r&&!a.call($,this))return new $(e);this._writableState=new w(e,this,r),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)),o.call(this)}function k(e,t,r,o,n,i,a){t.writelen=o,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new f("write")):r?e._writev(n,t.onwrite):e._write(n,i,t.onwrite),t.sync=!1}function _(e,t,r,o){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,o(),O(e,t)}function T(t,r){r.bufferProcessing=!0;var o=r.bufferedRequest;if(t._writev&&o&&o.next){var n=r.bufferedRequestCount,i=new Array(n),a=r.corkedRequestsFree;a.entry=o;for(var s=0,c=!0;o;)i[s]=o,o.isBuf||(c=!1),o=o.next,s+=1;i.allBuffers=c,k(t,r,!0,r.length,i,"",a.finish),r.pendingcb++,r.lastBufferedRequest=null,a.next?(r.corkedRequestsFree=a.next,a.next=null):r.corkedRequestsFree=new e(r),r.bufferedRequestCount=0}else{for(;o;){var u=o.chunk,l=o.encoding,d=o.callback;if(k(t,r,!1,r.objectMode?1:u.length,u,l,d),o=o.next,r.bufferedRequestCount--,r.writing)break}null===o&&(r.lastBufferedRequest=null)}r.bufferedRequest=o,r.bufferProcessing=!1}function I(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function A(e,t){e._final((function(r){t.pendingcb--,r&&b(e,r),t.prefinished=!0,e.emit("prefinish"),O(e,t)}))}function O(e,t){var r=I(t);if(r&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,process$1$1.nextTick(A,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var o=e._readableState;(!o||o.autoDestroy&&o.endEmitted)&&e.destroy()}return r}return requireInherits_browser()($,o),w.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(w.prototype,"buffer",{get:r.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]?(a=Function.prototype[Symbol.hasInstance],Object.defineProperty($,Symbol.hasInstance,{value:function(e){return!!a.call(this,e)||this===$&&(e&&e._writableState instanceof w)}})):a=function(e){return e instanceof this},$.prototype.pipe=function(){b(this,new h)},$.prototype.write=function(e,t,r){var o,a=this._writableState,s=!1,c=!a.objectMode&&(o=e,n.isBuffer(o)||o instanceof i);return c&&!n.isBuffer(e)&&(e=function(e){return n.from(e)}(e)),"function"==typeof t&&(r=t,t=null),c?t="buffer":t||(t=a.defaultEncoding),"function"!=typeof r&&(r=v),a.ending?function(e,t){var r=new y;b(e,r),process$1$1.nextTick(t,r)}(this,r):(c||function(e,t,r,o){var n;return null===r?n=new m:"string"==typeof r||t.objectMode||(n=new l("chunk",["string","Buffer"],r)),!n||(b(e,n),process$1$1.nextTick(o,n),!1)}(this,a,e,r))&&(a.pendingcb++,s=function(e,t,r,o,i,a){if(!r){var s=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=n.from(t,r));return t}(t,o,i);o!==s&&(r=!0,i="buffer",o=s)}var c=t.objectMode?1:o.length;t.length+=c;var u=t.length<t.highWaterMark;u||(t.needDrain=!0);if(t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:o,encoding:i,isBuf:r,callback:a,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else k(e,t,!1,c,o,i,a);return u}(this,a,c,e,t,r)),s},$.prototype.cork=function(){this._writableState.corked++},$.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||T(this,e))},$.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 g(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty($.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty($.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),$.prototype._write=function(e,t,r){r(new d("_write()"))},$.prototype._writev=null,$.prototype.end=function(e,t,r){var o=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),o.corked&&(o.corked=1,this.uncork()),o.ending||function(e,t,r){t.ending=!0,O(e,t),r&&(t.finished?process$1$1.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,o,r),this},Object.defineProperty($.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty($.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),$.prototype.destroy=s.destroy,$.prototype._undestroy=s.undestroy,$.prototype._destroy=function(e,t){t(e)},_stream_writable$1}function require_stream_duplex$1(){if(hasRequired_stream_duplex$1)return _stream_duplex$1;hasRequired_stream_duplex$1=1;var e=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};_stream_duplex$1=a;var t=require_stream_readable$1(),r=require_stream_writable$1();requireInherits_browser()(a,t);for(var o=e(r.prototype),n=0;n<o.length;n++){var i=o[n];a.prototype[i]||(a.prototype[i]=r.prototype[i])}function a(e){if(!(this instanceof a))return new a(e);t.call(this,e),r.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",s)))}function s(){this._writableState.ended||process$1$1.nextTick(c,this)}function c(e){e.end()}return Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(a.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(a.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._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)}}),_stream_duplex$1}var string_decoder={},hasRequiredString_decoder,endOfStream,hasRequiredEndOfStream,async_iterator,hasRequiredAsync_iterator,fromBrowser,hasRequiredFromBrowser,_stream_readable$1,hasRequired_stream_readable$1,_stream_transform$1,hasRequired_stream_transform$1,_stream_passthrough$1,hasRequired_stream_passthrough$1,pipeline_1,hasRequiredPipeline,streamBrowserify,hasRequiredStreamBrowserify,hashBase,hasRequiredHashBase,md5_js,hasRequiredMd5_js,ripemd160,hasRequiredRipemd160;function requireString_decoder(){if(hasRequiredString_decoder)return string_decoder;hasRequiredString_decoder=1;var e=requireSafeBuffer$1().Buffer,t=e.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 r(r){var o;switch(this.encoding=function(r){var o=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}}(r);if("string"!=typeof o&&(e.isEncoding===t||!t(r)))throw new Error("Unknown encoding: "+r);return o||r}(r),this.encoding){case"utf16le":this.text=i,this.end=a,o=4;break;case"utf8":this.fillLast=n,o=4;break;case"base64":this.text=s,this.end=c,o=3;break;default:return this.write=u,void(this.end=l)}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(o)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function n(e){var t=this.lastTotal-this.lastNeed,r=function(e,t){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 i(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var o=r.charCodeAt(r.length-1);if(o>=55296&&o<=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 a(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 s(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 c(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function u(e){return e.toString(this.encoding)}function l(e){return e&&e.length?this.write(e):""}return string_decoder.StringDecoder=r,r.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||""},r.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},r.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=o(t[n]);if(i>=0)return i>0&&(e.lastNeed=i-1),i;if(--n<r||-2===i)return 0;if(i=o(t[n]),i>=0)return i>0&&(e.lastNeed=i-2),i;if(--n<r||-2===i)return 0;if(i=o(t[n]),i>=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},r.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},string_decoder}function requireEndOfStream(){if(hasRequiredEndOfStream)return endOfStream;hasRequiredEndOfStream=1;var e=requireErrorsBrowser().codes.ERR_STREAM_PREMATURE_CLOSE;function t(){}return endOfStream=function r(o,n,i){if("function"==typeof n)return r(o,null,n);n||(n={}),i=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,o=new Array(r),n=0;n<r;n++)o[n]=arguments[n];e.apply(this,o)}}}(i||t);var a=n.readable||!1!==n.readable&&o.readable,s=n.writable||!1!==n.writable&&o.writable,c=function(){o.writable||l()},u=o._writableState&&o._writableState.finished,l=function(){s=!1,u=!0,a||i.call(o)},d=o._readableState&&o._readableState.endEmitted,p=function(){a=!1,d=!0,s||i.call(o)},h=function(e){i.call(o,e)},f=function(){var t;return a&&!d?(o._readableState&&o._readableState.ended||(t=new e),i.call(o,t)):s&&!u?(o._writableState&&o._writableState.ended||(t=new e),i.call(o,t)):void 0},m=function(){o.req.on("finish",l)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(o)?s&&!o._writableState&&(o.on("end",c),o.on("close",c)):(o.on("complete",l),o.on("abort",f),o.req?m():o.on("request",m)),o.on("end",p),o.on("finish",l),!1!==n.error&&o.on("error",h),o.on("close",f),function(){o.removeListener("complete",l),o.removeListener("abort",f),o.removeListener("request",m),o.req&&o.req.removeListener("finish",l),o.removeListener("end",c),o.removeListener("close",c),o.removeListener("finish",l),o.removeListener("end",p),o.removeListener("error",h),o.removeListener("close",f)}},endOfStream}function requireAsync_iterator(){if(hasRequiredAsync_iterator)return async_iterator;var e;function t(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t);if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}hasRequiredAsync_iterator=1;var r=requireEndOfStream(),o=Symbol("lastResolve"),n=Symbol("lastReject"),i=Symbol("error"),a=Symbol("ended"),s=Symbol("lastPromise"),c=Symbol("handlePromise"),u=Symbol("stream");function l(e,t){return{value:e,done:t}}function d(e){var t=e[o];if(null!==t){var r=e[u].read();null!==r&&(e[s]=null,e[o]=null,e[n]=null,t(l(r,!1)))}}function p(e){process$1$1.nextTick(d,e)}var h=Object.getPrototypeOf((function(){})),f=Object.setPrototypeOf((t(e={get stream(){return this[u]},next:function(){var e=this,t=this[i];if(null!==t)return Promise.reject(t);if(this[a])return Promise.resolve(l(void 0,!0));if(this[u].destroyed)return new Promise((function(t,r){process$1$1.nextTick((function(){e[i]?r(e[i]):t(l(void 0,!0))}))}));var r,o=this[s];if(o)r=new Promise(function(e,t){return function(r,o){e.then((function(){t[a]?r(l(void 0,!0)):t[c](r,o)}),o)}}(o,this));else{var n=this[u].read();if(null!==n)return Promise.resolve(l(n,!1));r=new Promise(this[c])}return this[s]=r,r}},Symbol.asyncIterator,(function(){return this})),t(e,"return",(function(){var e=this;return new Promise((function(t,r){e[u].destroy(null,(function(e){e?r(e):t(l(void 0,!0))}))}))})),e),h);return async_iterator=function(e){var d,h=Object.create(f,(t(d={},u,{value:e,writable:!0}),t(d,o,{value:null,writable:!0}),t(d,n,{value:null,writable:!0}),t(d,i,{value:null,writable:!0}),t(d,a,{value:e._readableState.endEmitted,writable:!0}),t(d,c,{value:function(e,t){var r=h[u].read();r?(h[s]=null,h[o]=null,h[n]=null,e(l(r,!1))):(h[o]=e,h[n]=t)},writable:!0}),d));return h[s]=null,r(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=h[n];return null!==t&&(h[s]=null,h[o]=null,h[n]=null,t(e)),void(h[i]=e)}var r=h[o];null!==r&&(h[s]=null,h[o]=null,h[n]=null,r(l(void 0,!0))),h[a]=!0})),e.on("readable",p.bind(null,h)),h}}function requireFromBrowser(){return hasRequiredFromBrowser?fromBrowser:(hasRequiredFromBrowser=1,fromBrowser=function(){throw new Error("Readable.from is not available in the browser")})}function require_stream_readable$1(){if(hasRequired_stream_readable$1)return _stream_readable$1;var e;hasRequired_stream_readable$1=1,_stream_readable$1=$,$.ReadableState=w,requireEvents().EventEmitter;var t=function(e,t){return e.listeners(t).length},r=requireStreamBrowser$1(),o=require$$0$2.Buffer,n=(void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var i,a=requireUtil$1();i=a&&a.debuglog?a.debuglog("stream"):function(){};var s,c,u,l=requireBuffer_list(),d=requireDestroy$1(),p=requireState().getHighWaterMark,h=requireErrorsBrowser().codes,f=h.ERR_INVALID_ARG_TYPE,m=h.ERR_STREAM_PUSH_AFTER_EOF,y=h.ERR_METHOD_NOT_IMPLEMENTED,g=h.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;requireInherits_browser()($,r);var b=d.errorOrDestroy,v=["error","close","destroy","pause","resume"];function w(t,r,o){e=e||require_stream_duplex$1(),t=t||{},"boolean"!=typeof o&&(o=r instanceof e),this.objectMode=!!t.objectMode,o&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=p(this,t,"readableHighWaterMark",o),this.buffer=new l,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(s||(s=requireString_decoder().StringDecoder),this.decoder=new s(t.encoding),this.encoding=t.encoding)}function $(t){if(e=e||require_stream_duplex$1(),!(this instanceof $))return new $(t);var o=this instanceof e;this._readableState=new w(t,this,o),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),r.call(this)}function k(e,t,r,a,s){i("readableAddChunk",t);var c,u=e._readableState;if(null===t)u.reading=!1,function(e,t){if(i("onEofChunk"),t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?A(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,O(e)))}(e,u);else if(s||(c=function(e,t){var r;i=t,o.isBuffer(i)||i instanceof n||"string"==typeof t||void 0===t||e.objectMode||(r=new f("chunk",["string","Buffer","Uint8Array"],t));var i;return r}(u,t)),c)b(e,c);else if(u.objectMode||t&&t.length>0)if("string"==typeof t||u.objectMode||Object.getPrototypeOf(t)===o.prototype||(t=function(e){return o.from(e)}(t)),a)u.endEmitted?b(e,new g):_(e,u,t,!0);else if(u.ended)b(e,new m);else{if(u.destroyed)return!1;u.reading=!1,u.decoder&&!r?(t=u.decoder.write(t),u.objectMode||0!==t.length?_(e,u,t,!1):E(e,u)):_(e,u,t,!1)}else a||(u.reading=!1,E(e,u));return!u.ended&&(u.length<u.highWaterMark||0===u.length)}function _(e,t,r,o){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,o?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&A(e)),E(e,t)}Object.defineProperty($.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),$.prototype.destroy=d.destroy,$.prototype._undestroy=d.undestroy,$.prototype._destroy=function(e,t){t(e)},$.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=o.from(e,t),t=""),r=!0),k(this,e,t,!1,r)},$.prototype.unshift=function(e){return k(this,e,null,!0,!1)},$.prototype.isPaused=function(){return!1===this._readableState.flowing},$.prototype.setEncoding=function(e){s||(s=requireString_decoder().StringDecoder);var t=new s(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,o="";null!==r;)o+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==o&&this._readableState.buffer.push(o),this._readableState.length=o.length,this};var T=1073741824;function I(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>=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function A(e){var t=e._readableState;i("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(i("emitReadable",t.flowing),t.emittedReadable=!0,process$1$1.nextTick(O,e))}function O(e){var t=e._readableState;i("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,P(e)}function E(e,t){t.readingMore||(t.readingMore=!0,process$1$1.nextTick(S,e,t))}function S(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(i("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function R(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function x(e){i("readable nexttick read 0"),e.read(0)}function C(e,t){i("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),P(e),t.flowing&&!t.reading&&e.read(0)}function P(e){var t=e._readableState;for(i("flow",t.flowing);t.flowing&&null!==e.read(););}function N(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function B(e){var t=e._readableState;i("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process$1$1.nextTick(D,t,e))}function D(e,t){if(i("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function M(e,t){for(var r=0,o=e.length;r<o;r++)if(e[r]===t)return r;return-1}return $.prototype.read=function(e){i("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return i("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?B(this):A(this),null;if(0===(e=I(e,t))&&t.ended)return 0===t.length&&B(this),null;var o,n=t.needReadable;return i("need readable",n),(0===t.length||t.length-e<t.highWaterMark)&&i("length less than watermark",n=!0),t.ended||t.reading?i("reading or ended",n=!1):n&&(i("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=I(r,t))),null===(o=e>0?N(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&B(this)),null!==o&&this.emit("data",o),o},$.prototype._read=function(e){b(this,new y("_read()"))},$.prototype.pipe=function(e,r){var o=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,i("pipe count=%d opts=%j",n.pipesCount,r);var a=(!r||!1!==r.end)&&e!==process$1$1.stdout&&e!==process$1$1.stderr?c:m;function s(t,r){i("onunpipe"),t===o&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,i("cleanup"),e.removeListener("close",h),e.removeListener("finish",f),e.removeListener("drain",u),e.removeListener("error",p),e.removeListener("unpipe",s),o.removeListener("end",c),o.removeListener("end",m),o.removeListener("data",d),l=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||u())}function c(){i("onend"),e.end()}n.endEmitted?process$1$1.nextTick(a):o.once("end",a),e.on("unpipe",s);var u=function(e){return function(){var r=e._readableState;i("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&t(e,"data")&&(r.flowing=!0,P(e))}}(o);e.on("drain",u);var l=!1;function d(t){i("ondata");var r=e.write(t);i("dest.write",r),!1===r&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==M(n.pipes,e))&&!l&&(i("false write response, pause",n.awaitDrain),n.awaitDrain++),o.pause())}function p(r){i("onerror",r),m(),e.removeListener("error",p),0===t(e,"error")&&b(e,r)}function h(){e.removeListener("finish",f),m()}function f(){i("onfinish"),e.removeListener("close",h),m()}function m(){i("unpipe"),o.unpipe(e)}return o.on("data",d),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",p),e.once("close",h),e.once("finish",f),e.emit("pipe",o),n.flowing||(i("pipe resume"),o.resume()),e},$.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 o=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<n;i++)o[i].emit("unpipe",this,{hasUnpiped:!1});return this}var a=M(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},$.prototype.on=function(e,t){var o=r.prototype.on.call(this,e,t),n=this._readableState;return"data"===e?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,i("on readable",n.length,n.reading),n.length?A(this):n.reading||process$1$1.nextTick(x,this))),o},$.prototype.addListener=$.prototype.on,$.prototype.removeListener=function(e,t){var o=r.prototype.removeListener.call(this,e,t);return"readable"===e&&process$1$1.nextTick(R,this),o},$.prototype.removeAllListeners=function(e){var t=r.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process$1$1.nextTick(R,this),t},$.prototype.resume=function(){var e=this._readableState;return e.flowing||(i("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process$1$1.nextTick(C,e,t))}(this,e)),e.paused=!1,this},$.prototype.pause=function(){return i("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(i("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},$.prototype.wrap=function(e){var t=this,r=this._readableState,o=!1;for(var n in e.on("end",(function(){if(i("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){(i("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(o=!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 a=0;a<v.length;a++)e.on(v[a],this.emit.bind(this,v[a]));return this._read=function(t){i("wrapped _read",t),o&&(o=!1,e.resume())},this},"function"==typeof Symbol&&($.prototype[Symbol.asyncIterator]=function(){return void 0===c&&(c=requireAsync_iterator()),c(this)}),Object.defineProperty($.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty($.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty($.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),$._fromList=N,Object.defineProperty($.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&($.from=function(e,t){return void 0===u&&(u=requireFromBrowser()),u($,e,t)}),_stream_readable$1}function require_stream_transform$1(){if(hasRequired_stream_transform$1)return _stream_transform$1;hasRequired_stream_transform$1=1,_stream_transform$1=s;var e=requireErrorsBrowser().codes,t=e.ERR_METHOD_NOT_IMPLEMENTED,r=e.ERR_MULTIPLE_CALLBACK,o=e.ERR_TRANSFORM_ALREADY_TRANSFORMING,n=e.ERR_TRANSFORM_WITH_LENGTH_0,i=require_stream_duplex$1();function a(e,t){var o=this._transformState;o.transforming=!1;var n=o.writecb;if(null===n)return this.emit("error",new r);o.writechunk=null,o.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function s(e){if(!(this instanceof s))return new s(e);i.call(this,e),this._transformState={afterTransform:a.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",c)}function c(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?u(this,null,null):this._flush((function(t,r){u(e,t,r)}))}function u(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new n;if(e._transformState.transforming)throw new o;return e.push(null)}return requireInherits_browser()(s,i),s.prototype.push=function(e,t){return this._transformState.needTransform=!1,i.prototype.push.call(this,e,t)},s.prototype._transform=function(e,r,o){o(new t("_transform()"))},s.prototype._write=function(e,t,r){var o=this._transformState;if(o.writecb=r,o.writechunk=e,o.writeencoding=t,!o.transforming){var n=this._readableState;(o.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},s.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},s.prototype._destroy=function(e,t){i.prototype._destroy.call(this,e,(function(e){t(e)}))},_stream_transform$1}function require_stream_passthrough$1(){if(hasRequired_stream_passthrough$1)return _stream_passthrough$1;hasRequired_stream_passthrough$1=1,_stream_passthrough$1=t;var e=require_stream_transform$1();function t(r){if(!(this instanceof t))return new t(r);e.call(this,r)}return requireInherits_browser()(t,e),t.prototype._transform=function(e,t,r){r(null,e)},_stream_passthrough$1}function requirePipeline(){if(hasRequiredPipeline)return pipeline_1;var e;hasRequiredPipeline=1;var t=requireErrorsBrowser().codes,r=t.ERR_MISSING_ARGS,o=t.ERR_STREAM_DESTROYED;function n(e){if(e)throw e}function i(e){e()}function a(e,t){return e.pipe(t)}return pipeline_1=function(){for(var t=arguments.length,s=new Array(t),c=0;c<t;c++)s[c]=arguments[c];var u,l=function(e){return e.length?"function"!=typeof e[e.length-1]?n:e.pop():n}(s);if(Array.isArray(s[0])&&(s=s[0]),s.length<2)throw new r("streams");var d=s.map((function(t,r){var n=r<s.length-1;return function(t,r,n,i){i=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(i);var a=!1;t.on("close",(function(){a=!0})),void 0===e&&(e=requireEndOfStream()),e(t,{readable:r,writable:n},(function(e){if(e)return i(e);a=!0,i()}));var s=!1;return function(e){if(!a&&!s)return s=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void i(e||new o("pipe"))}}(t,n,r>0,(function(e){u||(u=e),e&&d.forEach(i),n||(d.forEach(i),l(u))}))}));return s.reduce(a)},pipeline_1}function requireStreamBrowserify(){if(hasRequiredStreamBrowserify)return streamBrowserify;hasRequiredStreamBrowserify=1,streamBrowserify=t;var e=requireEvents().EventEmitter;function t(){e.call(this)}return requireInherits_browser()(t,e),t.Readable=require_stream_readable$1(),t.Writable=require_stream_writable$1(),t.Duplex=require_stream_duplex$1(),t.Transform=require_stream_transform$1(),t.PassThrough=require_stream_passthrough$1(),t.finished=requireEndOfStream(),t.pipeline=requirePipeline(),t.Stream=t,t.prototype.pipe=function(t,r){var o=this;function n(e){t.writable&&!1===t.write(e)&&o.pause&&o.pause()}function i(){o.readable&&o.resume&&o.resume()}o.on("data",n),t.on("drain",i),t._isStdio||r&&!1===r.end||(o.on("end",s),o.on("close",c));var a=!1;function s(){a||(a=!0,t.end())}function c(){a||(a=!0,"function"==typeof t.destroy&&t.destroy())}function u(t){if(l(),0===e.listenerCount(this,"error"))throw t}function l(){o.removeListener("data",n),t.removeListener("drain",i),o.removeListener("end",s),o.removeListener("close",c),o.removeListener("error",u),t.removeListener("error",u),o.removeListener("end",l),o.removeListener("close",l),t.removeListener("close",l)}return o.on("error",u),t.on("error",u),o.on("end",l),o.on("close",l),t.on("close",l),t.emit("pipe",o),t},streamBrowserify}function requireHashBase(){if(hasRequiredHashBase)return hashBase;hasRequiredHashBase=1;var e=requireSafeBuffer$1().Buffer,t=requireStreamBrowserify().Transform;function r(r){t.call(this),this._block=e.allocUnsafe(r),this._blockSize=r,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}requireInherits_browser()(r,t),r.prototype._transform=function(e,t,r){var o=null;try{this.update(e,t)}catch(n){o=n}r(o)},r.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(r){t=r}e(t)};var o="undefined"!=typeof Uint8Array,n="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&ArrayBuffer.isView&&(e.prototype instanceof Uint8Array||e.TYPED_ARRAY_SUPPORT);return r.prototype.update=function(t,r){if(this._finalized)throw new Error("Digest already called");t=function(t,r){if(t instanceof e)return t;if("string"==typeof t)return e.from(t,r);if(n&&ArrayBuffer.isView(t)){if(0===t.byteLength)return e.alloc(0);var i=e.from(t.buffer,t.byteOffset,t.byteLength);if(i.byteLength===t.byteLength)return i}if(o&&t instanceof Uint8Array)return e.from(t);if(e.isBuffer(t)&&t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t))return e.from(t);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}(t,r);for(var i=this._block,a=0;this._blockOffset+t.length-a>=this._blockSize;){for(var s=this._blockOffset;s<this._blockSize;)i[s++]=t[a++];this._update(),this._blockOffset=0}for(;a<t.length;)i[this._blockOffset++]=t[a++];for(var c=0,u=8*t.length;u>0;++c)this._length[c]+=u,(u=this._length[c]/4294967296|0)>0&&(this._length[c]-=4294967296*u);return this},r.prototype._update=function(){throw new Error("_update is not implemented")},r.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},r.prototype._digest=function(){throw new Error("_digest is not implemented")},hashBase=r}function requireMd5_js(){if(hasRequiredMd5_js)return md5_js;hasRequiredMd5_js=1;var e=requireInherits_browser(),t=requireHashBase(),r=requireSafeBuffer$1().Buffer,o=new Array(16);function n(){t.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function i(e,t){return e<<t|e>>>32-t}function a(e,t,r,o,n,a,s){return i(e+(t&r|~t&o)+n+a|0,s)+t|0}function s(e,t,r,o,n,a,s){return i(e+(t&o|r&~o)+n+a|0,s)+t|0}function c(e,t,r,o,n,a,s){return i(e+(t^r^o)+n+a|0,s)+t|0}function u(e,t,r,o,n,a,s){return i(e+(r^(t|~o))+n+a|0,s)+t|0}return e(n,t),n.prototype._update=function(){for(var e=o,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,l=this._d;r=a(r,n,i,l,e[0],3614090360,7),l=a(l,r,n,i,e[1],3905402710,12),i=a(i,l,r,n,e[2],606105819,17),n=a(n,i,l,r,e[3],3250441966,22),r=a(r,n,i,l,e[4],4118548399,7),l=a(l,r,n,i,e[5],1200080426,12),i=a(i,l,r,n,e[6],2821735955,17),n=a(n,i,l,r,e[7],4249261313,22),r=a(r,n,i,l,e[8],1770035416,7),l=a(l,r,n,i,e[9],2336552879,12),i=a(i,l,r,n,e[10],4294925233,17),n=a(n,i,l,r,e[11],2304563134,22),r=a(r,n,i,l,e[12],1804603682,7),l=a(l,r,n,i,e[13],4254626195,12),i=a(i,l,r,n,e[14],2792965006,17),r=s(r,n=a(n,i,l,r,e[15],1236535329,22),i,l,e[1],4129170786,5),l=s(l,r,n,i,e[6],3225465664,9),i=s(i,l,r,n,e[11],643717713,14),n=s(n,i,l,r,e[0],3921069994,20),r=s(r,n,i,l,e[5],3593408605,5),l=s(l,r,n,i,e[10],38016083,9),i=s(i,l,r,n,e[15],3634488961,14),n=s(n,i,l,r,e[4],3889429448,20),r=s(r,n,i,l,e[9],568446438,5),l=s(l,r,n,i,e[14],3275163606,9),i=s(i,l,r,n,e[3],4107603335,14),n=s(n,i,l,r,e[8],1163531501,20),r=s(r,n,i,l,e[13],2850285829,5),l=s(l,r,n,i,e[2],4243563512,9),i=s(i,l,r,n,e[7],1735328473,14),r=c(r,n=s(n,i,l,r,e[12],2368359562,20),i,l,e[5],4294588738,4),l=c(l,r,n,i,e[8],2272392833,11),i=c(i,l,r,n,e[11],1839030562,16),n=c(n,i,l,r,e[14],4259657740,23),r=c(r,n,i,l,e[1],2763975236,4),l=c(l,r,n,i,e[4],1272893353,11),i=c(i,l,r,n,e[7],4139469664,16),n=c(n,i,l,r,e[10],3200236656,23),r=c(r,n,i,l,e[13],681279174,4),l=c(l,r,n,i,e[0],3936430074,11),i=c(i,l,r,n,e[3],3572445317,16),n=c(n,i,l,r,e[6],76029189,23),r=c(r,n,i,l,e[9],3654602809,4),l=c(l,r,n,i,e[12],3873151461,11),i=c(i,l,r,n,e[15],530742520,16),r=u(r,n=c(n,i,l,r,e[2],3299628645,23),i,l,e[0],4096336452,6),l=u(l,r,n,i,e[7],1126891415,10),i=u(i,l,r,n,e[14],2878612391,15),n=u(n,i,l,r,e[5],4237533241,21),r=u(r,n,i,l,e[12],1700485571,6),l=u(l,r,n,i,e[3],2399980690,10),i=u(i,l,r,n,e[10],4293915773,15),n=u(n,i,l,r,e[1],2240044497,21),r=u(r,n,i,l,e[8],1873313359,6),l=u(l,r,n,i,e[15],4264355552,10),i=u(i,l,r,n,e[6],2734768916,15),n=u(n,i,l,r,e[13],1309151649,21),r=u(r,n,i,l,e[4],4149444226,6),l=u(l,r,n,i,e[11],3174756917,10),i=u(i,l,r,n,e[2],718787259,15),n=u(n,i,l,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+l|0},n.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=r.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},md5_js=n}function requireRipemd160(){if(hasRequiredRipemd160)return ripemd160;hasRequiredRipemd160=1;var e=require$$0$2.Buffer,t=requireInherits_browser(),r=requireHashBase(),o=new Array(16),n=[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],i=[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],a=[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],s=[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],c=[0,1518500249,1859775393,2400959708,2840853838],u=[1352829926,1548603684,1836072691,2053994217,0];function l(){r.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function d(e,t){return e<<t|e>>>32-t}function p(e,t,r,o,n,i,a,s){return d(e+(t^r^o)+i+a|0,s)+n|0}function h(e,t,r,o,n,i,a,s){return d(e+(t&r|~t&o)+i+a|0,s)+n|0}function f(e,t,r,o,n,i,a,s){return d(e+((t|~r)^o)+i+a|0,s)+n|0}function m(e,t,r,o,n,i,a,s){return d(e+(t&o|r&~o)+i+a|0,s)+n|0}function y(e,t,r,o,n,i,a,s){return d(e+(t^(r|~o))+i+a|0,s)+n|0}return t(l,r),l.prototype._update=function(){for(var e=o,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,l=0|this._b,g=0|this._c,b=0|this._d,v=0|this._e,w=0|this._a,$=0|this._b,k=0|this._c,_=0|this._d,T=0|this._e,I=0;I<80;I+=1){var A,O;I<16?(A=p(r,l,g,b,v,e[n[I]],c[0],a[I]),O=y(w,$,k,_,T,e[i[I]],u[0],s[I])):I<32?(A=h(r,l,g,b,v,e[n[I]],c[1],a[I]),O=m(w,$,k,_,T,e[i[I]],u[1],s[I])):I<48?(A=f(r,l,g,b,v,e[n[I]],c[2],a[I]),O=f(w,$,k,_,T,e[i[I]],u[2],s[I])):I<64?(A=m(r,l,g,b,v,e[n[I]],c[3],a[I]),O=h(w,$,k,_,T,e[i[I]],u[3],s[I])):(A=y(r,l,g,b,v,e[n[I]],c[4],a[I]),O=p(w,$,k,_,T,e[i[I]],u[4],s[I])),r=v,v=b,b=d(g,10),g=l,l=A,w=T,T=_,_=d(k,10),k=$,$=O}var E=this._b+g+_|0;this._b=this._c+b+T|0,this._c=this._d+v+w|0,this._d=this._e+r+$|0,this._e=this._a+l+k|0,this._a=E},l.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 t=e.alloc?e.alloc(20):new e(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},ripemd160=l}var sha_js={exports:{}},hash$4,hasRequiredHash,sha$1,hasRequiredSha,sha1,hasRequiredSha1,sha256$1,hasRequiredSha256,sha224$1,hasRequiredSha224,sha512$1,hasRequiredSha512,sha384$1,hasRequiredSha384,hasRequiredSha_js,cipherBase,hasRequiredCipherBase,browser$b,hasRequiredBrowser$9,legacy$1,hasRequiredLegacy,md5,hasRequiredMd5,browser$a,hasRequiredBrowser$8;function requireHash(){if(hasRequiredHash)return hash$4;hasRequiredHash=1;var e=requireSafeBuffer$1().Buffer;function t(t,r){this._block=e.alloc(t),this._finalSize=r,this._blockSize=t,this._len=0}return t.prototype.update=function(t,r){"string"==typeof t&&(r=r||"utf8",t=e.from(t,r));for(var o=this._block,n=this._blockSize,i=t.length,a=this._len,s=0;s<i;){for(var c=a%n,u=Math.min(i-s,n-c),l=0;l<u;l++)o[c+l]=t[s+l];s+=u,(a+=u)%n==0&&this._update(o)}return this._len+=i,this},t.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 o=(4294967295&r)>>>0,n=(r-o)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(o,this._blockSize-4)}this._update(this._block);var i=this._hash();return e?i.toString(e):i},t.prototype._update=function(){throw new Error("_update must be implemented by subclass")},hash$4=t}function requireSha(){if(hasRequiredSha)return sha$1;hasRequiredSha=1;var e=requireInherits_browser(),t=requireHash(),r=requireSafeBuffer$1().Buffer,o=[1518500249,1859775393,-1894007588,-899497514],n=new Array(80);function i(){this.init(),this._w=n,t.call(this,64,56)}function a(e){return e<<30|e>>>2}function s(e,t,r,o){return 0===e?t&r|~t&o:2===e?t&r|t&o|r&o:t^r^o}return e(i,t),i.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},i.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,c=0|this._c,u=0|this._d,l=0|this._e,d=0;d<16;++d)r[d]=e.readInt32BE(4*d);for(;d<80;++d)r[d]=r[d-3]^r[d-8]^r[d-14]^r[d-16];for(var p=0;p<80;++p){var h=~~(p/20),f=0|((t=n)<<5|t>>>27)+s(h,i,c,u)+l+r[p]+o[h];l=u,u=c,c=a(i),i=n,n=f}this._a=n+this._a|0,this._b=i+this._b|0,this._c=c+this._c|0,this._d=u+this._d|0,this._e=l+this._e|0},i.prototype._hash=function(){var e=r.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},sha$1=i}function requireSha1(){if(hasRequiredSha1)return sha1;hasRequiredSha1=1;var e=requireInherits_browser(),t=requireHash(),r=requireSafeBuffer$1().Buffer,o=[1518500249,1859775393,-1894007588,-899497514],n=new Array(80);function i(){this.init(),this._w=n,t.call(this,64,56)}function a(e){return e<<5|e>>>27}function s(e){return e<<30|e>>>2}function c(e,t,r,o){return 0===e?t&r|~t&o:2===e?t&r|t&o|r&o:t^r^o}return e(i,t),i.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},i.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,u=0|this._c,l=0|this._d,d=0|this._e,p=0;p<16;++p)r[p]=e.readInt32BE(4*p);for(;p<80;++p)r[p]=(t=r[p-3]^r[p-8]^r[p-14]^r[p-16])<<1|t>>>31;for(var h=0;h<80;++h){var f=~~(h/20),m=a(n)+c(f,i,u,l)+d+r[h]+o[f]|0;d=l,l=u,u=s(i),i=n,n=m}this._a=n+this._a|0,this._b=i+this._b|0,this._c=u+this._c|0,this._d=l+this._d|0,this._e=d+this._e|0},i.prototype._hash=function(){var e=r.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},sha1=i}function requireSha256(){if(hasRequiredSha256)return sha256$1;hasRequiredSha256=1;var e=requireInherits_browser(),t=requireHash(),r=requireSafeBuffer$1().Buffer,o=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],n=new Array(64);function i(){this.init(),this._w=n,t.call(this,64,56)}function a(e,t,r){return r^e&(t^r)}function s(e,t,r){return e&t|r&(e|t)}function c(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function u(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function l(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}return e(i,t),i.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},i.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,d=0|this._c,p=0|this._d,h=0|this._e,f=0|this._f,m=0|this._g,y=0|this._h,g=0;g<16;++g)r[g]=e.readInt32BE(4*g);for(;g<64;++g)r[g]=0|(((t=r[g-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[g-7]+l(r[g-15])+r[g-16];for(var b=0;b<64;++b){var v=y+u(h)+a(h,f,m)+o[b]+r[b]|0,w=c(n)+s(n,i,d)|0;y=m,m=f,f=h,h=p+v|0,p=d,d=i,i=n,n=v+w|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=d+this._c|0,this._d=p+this._d|0,this._e=h+this._e|0,this._f=f+this._f|0,this._g=m+this._g|0,this._h=y+this._h|0},i.prototype._hash=function(){var e=r.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},sha256$1=i}function requireSha224(){if(hasRequiredSha224)return sha224$1;hasRequiredSha224=1;var e=requireInherits_browser(),t=requireSha256(),r=requireHash(),o=requireSafeBuffer$1().Buffer,n=new Array(64);function i(){this.init(),this._w=n,r.call(this,64,56)}return e(i,t),i.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},i.prototype._hash=function(){var e=o.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},sha224$1=i}function requireSha512(){if(hasRequiredSha512)return sha512$1;hasRequiredSha512=1;var e=requireInherits_browser(),t=requireHash(),r=requireSafeBuffer$1().Buffer,o=[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],n=new Array(160);function i(){this.init(),this._w=n,t.call(this,128,112)}function a(e,t,r){return r^e&(t^r)}function s(e,t,r){return e&t|r&(e|t)}function c(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function u(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function l(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function d(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function p(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function h(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function f(e,t){return e>>>0<t>>>0?1:0}return e(i,t),i.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},i.prototype._update=function(e){for(var t=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,m=0|this._dh,y=0|this._eh,g=0|this._fh,b=0|this._gh,v=0|this._hh,w=0|this._al,$=0|this._bl,k=0|this._cl,_=0|this._dl,T=0|this._el,I=0|this._fl,A=0|this._gl,O=0|this._hl,E=0;E<32;E+=2)t[E]=e.readInt32BE(4*E),t[E+1]=e.readInt32BE(4*E+4);for(;E<160;E+=2){var S=t[E-30],R=t[E-30+1],x=l(S,R),C=d(R,S),P=p(S=t[E-4],R=t[E-4+1]),N=h(R,S),B=t[E-14],D=t[E-14+1],M=t[E-32],L=t[E-32+1],j=C+D|0,F=x+B+f(j,C)|0;F=(F=F+P+f(j=j+N|0,N)|0)+M+f(j=j+L|0,L)|0,t[E]=F,t[E+1]=j}for(var U=0;U<160;U+=2){F=t[U],j=t[U+1];var K=s(r,n,i),q=s(w,$,k),G=c(r,w),H=c(w,r),V=u(y,T),W=u(T,y),z=o[U],Z=o[U+1],Q=a(y,g,b),Y=a(T,I,A),X=O+W|0,J=v+V+f(X,O)|0;J=(J=(J=J+Q+f(X=X+Y|0,Y)|0)+z+f(X=X+Z|0,Z)|0)+F+f(X=X+j|0,j)|0;var ee=H+q|0,te=G+K+f(ee,H)|0;v=b,O=A,b=g,A=I,g=y,I=T,y=m+J+f(T=_+X|0,_)|0,m=i,_=k,i=n,k=$,n=r,$=w,r=J+te+f(w=X+ee|0,X)|0}this._al=this._al+w|0,this._bl=this._bl+$|0,this._cl=this._cl+k|0,this._dl=this._dl+_|0,this._el=this._el+T|0,this._fl=this._fl+I|0,this._gl=this._gl+A|0,this._hl=this._hl+O|0,this._ah=this._ah+r+f(this._al,w)|0,this._bh=this._bh+n+f(this._bl,$)|0,this._ch=this._ch+i+f(this._cl,k)|0,this._dh=this._dh+m+f(this._dl,_)|0,this._eh=this._eh+y+f(this._el,T)|0,this._fh=this._fh+g+f(this._fl,I)|0,this._gh=this._gh+b+f(this._gl,A)|0,this._hh=this._hh+v+f(this._hl,O)|0},i.prototype._hash=function(){var e=r.allocUnsafe(64);function t(t,r,o){e.writeInt32BE(t,o),e.writeInt32BE(r,o+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},sha512$1=i}function requireSha384(){if(hasRequiredSha384)return sha384$1;hasRequiredSha384=1;var e=requireInherits_browser(),t=requireSha512(),r=requireHash(),o=requireSafeBuffer$1().Buffer,n=new Array(160);function i(){this.init(),this._w=n,r.call(this,128,112)}return e(i,t),i.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},i.prototype._hash=function(){var e=o.allocUnsafe(48);function t(t,r,o){e.writeInt32BE(t,o),e.writeInt32BE(r,o+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},sha384$1=i}function requireSha_js(){if(hasRequiredSha_js)return sha_js.exports;hasRequiredSha_js=1;var e=sha_js.exports=function(t){t=t.toLowerCase();var r=e[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r};return e.sha=requireSha(),e.sha1=requireSha1(),e.sha224=requireSha224(),e.sha256=requireSha256(),e.sha384=requireSha384(),e.sha512=requireSha512(),sha_js.exports}function requireCipherBase(){if(hasRequiredCipherBase)return cipherBase;hasRequiredCipherBase=1;var e=requireSafeBuffer$1().Buffer,t=requireStreamBrowserify().Transform,r=requireString_decoder().StringDecoder;function o(e){t.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}requireInherits_browser()(o,t);var n="undefined"!=typeof Uint8Array,i="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&ArrayBuffer.isView&&(e.prototype instanceof Uint8Array||e.TYPED_ARRAY_SUPPORT);return o.prototype.update=function(t,r,o){var a=function(t,r){if(t instanceof e)return t;if("string"==typeof t)return e.from(t,r);if(i&&ArrayBuffer.isView(t)){if(0===t.byteLength)return e.alloc(0);var o=e.from(t.buffer,t.byteOffset,t.byteLength);if(o.byteLength===t.byteLength)return o}if(n&&t instanceof Uint8Array)return e.from(t);if(e.isBuffer(t)&&t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t))return e.from(t);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}(t,r),s=this._update(a);return this.hashMode?this:(o&&(s=this._toString(s,o)),s)},o.prototype.setAutoPadding=function(){},o.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},o.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},o.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},o.prototype._transform=function(e,t,r){var o;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(n){o=n}finally{r(o)}},o.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(r){t=r}e(t)},o.prototype._finalOrDigest=function(t){var r=this.__final()||e.alloc(0);return t&&(r=this._toString(r,t,!0)),r},o.prototype._toString=function(e,t,o){if(this._decoder||(this._decoder=new r(t),this._encoding=t),this._encoding!==t)throw new Error("can’t switch encodings");var n=this._decoder.write(e);return o&&(n+=this._decoder.end()),n},cipherBase=o}function requireBrowser$9(){if(hasRequiredBrowser$9)return browser$b;hasRequiredBrowser$9=1;var e=requireInherits_browser(),t=requireMd5_js(),r=requireRipemd160(),o=requireSha_js(),n=requireCipherBase();function i(e){n.call(this,"digest"),this._hash=e}return e(i,n),i.prototype._update=function(e){this._hash.update(e)},i.prototype._final=function(){return this._hash.digest()},browser$b=function(e){return"md5"===(e=e.toLowerCase())?new t:"rmd160"===e||"ripemd160"===e?new r:new i(o(e))}}function requireLegacy(){if(hasRequiredLegacy)return legacy$1;hasRequiredLegacy=1;var e=requireInherits_browser(),t=requireSafeBuffer$1().Buffer,r=requireCipherBase(),o=t.alloc(128),n=64;function i(e,i){r.call(this,"digest"),"string"==typeof i&&(i=t.from(i)),this._alg=e,this._key=i,i.length>n?i=e(i):i.length<n&&(i=t.concat([i,o],n));for(var a=this._ipad=t.allocUnsafe(n),s=this._opad=t.allocUnsafe(n),c=0;c<n;c++)a[c]=54^i[c],s[c]=92^i[c];this._hash=[a]}return e(i,r),i.prototype._update=function(e){this._hash.push(e)},i.prototype._final=function(){var e=this._alg(t.concat(this._hash));return this._alg(t.concat([this._opad,e]))},legacy$1=i}function requireMd5(){if(hasRequiredMd5)return md5;hasRequiredMd5=1;var e=requireMd5_js();return md5=function(t){return(new e).update(t).digest()}}function requireBrowser$8(){if(hasRequiredBrowser$8)return browser$a;hasRequiredBrowser$8=1;var e=requireInherits_browser(),t=requireLegacy(),r=requireCipherBase(),o=requireSafeBuffer$1().Buffer,n=requireMd5(),i=requireRipemd160(),a=requireSha_js(),s=o.alloc(128);function c(e,t){r.call(this,"digest"),"string"==typeof t&&(t=o.from(t));var n="sha512"===e||"sha384"===e?128:64;(this._alg=e,this._key=t,t.length>n)?t=("rmd160"===e?new i:a(e)).update(t).digest():t.length<n&&(t=o.concat([t,s],n));for(var c=this._ipad=o.allocUnsafe(n),u=this._opad=o.allocUnsafe(n),l=0;l<n;l++)c[l]=54^t[l],u[l]=92^t[l];this._hash="rmd160"===e?new i:a(e),this._hash.update(c)}return e(c,r),c.prototype._update=function(e){this._hash.update(e)},c.prototype._final=function(){var e=this._hash.digest();return("rmd160"===this._alg?new i:a(this._alg)).update(this._opad).update(e).digest()},browser$a=function(e,r){return"rmd160"===(e=e.toLowerCase())||"ripemd160"===e?new c("rmd160",r):"md5"===e?new t(n,r):new c(e,r)}}const sha224WithRSAEncryption={sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption={sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption={sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption={sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},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={sign:"dsa",hash:"sha1",id:""},ripemd160WithRSA={sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption={sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},require$$6={sha224WithRSAEncryption:sha224WithRSAEncryption,"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:sha256WithRSAEncryption,"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:sha384WithRSAEncryption,"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:sha512WithRSAEncryption,"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:sha256,sha224:sha224,sha384:sha384,sha512:sha512,"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:DSA,"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:ripemd160WithRSA,"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:md5WithRSAEncryption,"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}};var algos,hasRequiredAlgos;function requireAlgos(){return hasRequiredAlgos?algos:(hasRequiredAlgos=1,algos=require$$6)}var browser$9={},precondition,hasRequiredPrecondition,defaultEncoding_1,hasRequiredDefaultEncoding,toBuffer,hasRequiredToBuffer,syncBrowser,hasRequiredSyncBrowser,async,hasRequiredAsync,hasRequiredBrowser$7;function requirePrecondition(){if(hasRequiredPrecondition)return precondition;hasRequiredPrecondition=1;var e=Math.pow(2,30)-1;return precondition=function(t,r){if("number"!=typeof t)throw new TypeError("Iterations not a number");if(t<0)throw new TypeError("Bad iterations");if("number"!=typeof r)throw new TypeError("Key length not a number");if(r<0||r>e||r!=r)throw new TypeError("Bad key length")}}function requireDefaultEncoding(){if(hasRequiredDefaultEncoding)return defaultEncoding_1;var e;if(hasRequiredDefaultEncoding=1,commonjsGlobal.process&&commonjsGlobal.process.browser)e="utf-8";else if(commonjsGlobal.process&&commonjsGlobal.process.version){e=parseInt(process$1$1.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else e="utf-8";return defaultEncoding_1=e}function requireToBuffer(){if(hasRequiredToBuffer)return toBuffer;hasRequiredToBuffer=1;var e=requireSafeBuffer$1().Buffer;return toBuffer=function(t,r,o){if(e.isBuffer(t))return t;if("string"==typeof t)return e.from(t,r);if(ArrayBuffer.isView(t))return e.from(t.buffer);throw new TypeError(o+" must be a string, a Buffer, a typed array or a DataView")}}function requireSyncBrowser(){if(hasRequiredSyncBrowser)return syncBrowser;hasRequiredSyncBrowser=1;var e=requireMd5(),t=requireRipemd160(),r=requireSha_js(),o=requireSafeBuffer$1().Buffer,n=requirePrecondition(),i=requireDefaultEncoding(),a=requireToBuffer(),s=o.alloc(128),c={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function u(n,i,a){var u=function(o){function n(e){return r(o).update(e).digest()}function i(e){return(new t).update(e).digest()}return"rmd160"===o||"ripemd160"===o?i:"md5"===o?e:n}(n),l="sha512"===n||"sha384"===n?128:64;i.length>l?i=u(i):i.length<l&&(i=o.concat([i,s],l));for(var d=o.allocUnsafe(l+c[n]),p=o.allocUnsafe(l+c[n]),h=0;h<l;h++)d[h]=54^i[h],p[h]=92^i[h];var f=o.allocUnsafe(l+a+4);d.copy(f,0,0,l),this.ipad1=f,this.ipad2=d,this.opad=p,this.alg=n,this.blocksize=l,this.hash=u,this.size=c[n]}return u.prototype.run=function(e,t){return e.copy(t,this.blocksize),this.hash(t).copy(this.opad,this.blocksize),this.hash(this.opad)},syncBrowser=function(e,t,r,s,l){n(r,s);var d=new u(l=l||"sha1",e=a(e,i,"Password"),(t=a(t,i,"Salt")).length),p=o.allocUnsafe(s),h=o.allocUnsafe(t.length+4);t.copy(h,0,0,t.length);for(var f=0,m=c[l],y=Math.ceil(s/m),g=1;g<=y;g++){h.writeUInt32BE(g,t.length);for(var b=d.run(h,d.ipad1),v=b,w=1;w<r;w++){v=d.run(v,d.ipad2);for(var $=0;$<m;$++)b[$]^=v[$]}b.copy(p,f),f+=m}return p}}function requireAsync(){if(hasRequiredAsync)return async;hasRequiredAsync=1;var e,t,r=requireSafeBuffer$1().Buffer,o=requirePrecondition(),n=requireDefaultEncoding(),i=requireSyncBrowser(),a=requireToBuffer(),s=commonjsGlobal.crypto&&commonjsGlobal.crypto.subtle,c={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"},u=[];function l(){return t||(t=commonjsGlobal.process&&commonjsGlobal.process.nextTick?commonjsGlobal.process.nextTick:commonjsGlobal.queueMicrotask?commonjsGlobal.queueMicrotask:commonjsGlobal.setImmediate?commonjsGlobal.setImmediate:commonjsGlobal.setTimeout)}function d(e,t,o,n,i){return s.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]).then((function(e){return s.deriveBits({name:"PBKDF2",salt:t,iterations:o,hash:{name:i}},e,n<<3)})).then((function(e){return r.from(e)}))}return async=function(t,p,h,f,m,y){"function"==typeof m&&(y=m,m=void 0);var g=c[(m=m||"sha1").toLowerCase()];if(g&&"function"==typeof commonjsGlobal.Promise){if(o(h,f),t=a(t,n,"Password"),p=a(p,n,"Salt"),"function"!=typeof y)throw new Error("No callback provided to pbkdf2");!function(e,t){e.then((function(e){l()((function(){t(null,e)}))}),(function(e){l()((function(){t(e)}))}))}(function(t){if(commonjsGlobal.process&&!commonjsGlobal.process.browser)return Promise.resolve(!1);if(!s||!s.importKey||!s.deriveBits)return Promise.resolve(!1);if(void 0!==u[t])return u[t];var o=d(e=e||r.alloc(8),e,10,128,t).then((function(){return!0})).catch((function(){return!1}));return u[t]=o,o}(g).then((function(e){return e?d(t,p,h,f,g):i(t,p,h,f,m)})),y)}else l()((function(){var e;try{e=i(t,p,h,f,m)}catch(r){return y(r)}y(null,e)}))}}function requireBrowser$7(){return hasRequiredBrowser$7||(hasRequiredBrowser$7=1,browser$9.pbkdf2=requireAsync(),browser$9.pbkdf2Sync=requireSyncBrowser()),browser$9}var browser$8={},des$1={},utils$p={},hasRequiredUtils;function requireUtils(){if(hasRequiredUtils)return utils$p;hasRequiredUtils=1,utils$p.readUInt32BE=function(e,t){return(e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])>>>0},utils$p.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},utils$p.ip=function(e,t,r,o){for(var n=0,i=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)i<<=1,i|=t>>>s+a&1;for(s=1;s<=25;s+=8)i<<=1,i|=e>>>s+a&1}r[o+0]=n>>>0,r[o+1]=i>>>0},utils$p.rip=function(e,t,r,o){for(var n=0,i=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)i<<=1,i|=t>>>s+a&1,i<<=1,i|=e>>>s+a&1;r[o+0]=n>>>0,r[o+1]=i>>>0},utils$p.pc1=function(e,t,r,o){for(var n=0,i=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)i<<=1,i|=t>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1}for(s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1;r[o+0]=n>>>0,r[o+1]=i>>>0},utils$p.r28shl=function(e,t){return e<<t&268435455|e>>>28-t};var e=[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];utils$p.pc2=function(t,r,o,n){for(var i=0,a=0,s=e.length>>>1,c=0;c<s;c++)i<<=1,i|=t>>>e[c]&1;for(c=s;c<e.length;c++)a<<=1,a|=r>>>e[c]&1;o[n+0]=i>>>0,o[n+1]=a>>>0},utils$p.expand=function(e,t,r){var o=0,n=0;o=(1&e)<<5|e>>>27;for(var i=23;i>=15;i-=4)o<<=6,o|=e>>>i&63;for(i=11;i>=3;i-=4)n|=e>>>i&63,n<<=6;n|=(31&e)<<1|e>>>31,t[r+0]=o>>>0,t[r+1]=n>>>0};var t=[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];utils$p.substitute=function(e,r){for(var o=0,n=0;n<4;n++){o<<=4,o|=t[64*n+(e>>>18-6*n&63)]}for(n=0;n<4;n++){o<<=4,o|=t[256+64*n+(r>>>18-6*n&63)]}return o>>>0};var r=[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];return utils$p.permute=function(e){for(var t=0,o=0;o<r.length;o++)t<<=1,t|=e>>>r[o]&1;return t>>>0},utils$p.padSplit=function(e,t,r){for(var o=e.toString(2);o.length<t;)o="0"+o;for(var n=[],i=0;i<t;i+=r)n.push(o.slice(i,i+r));return n.join(" ")},utils$p}var minimalisticAssert=assert$f,cipher,hasRequiredCipher,des,hasRequiredDes$1;function assert$f(e,t){if(!e)throw new Error(t||"Assertion failed")}function requireCipher(){if(hasRequiredCipher)return cipher;hasRequiredCipher=1;var e=minimalisticAssert;function t(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}return cipher=t,t.prototype._init=function(){},t.prototype.update=function(e){return 0===e.length?[]:"decrypt"===this.type?this._updateDecrypt(e):this._updateEncrypt(e)},t.prototype._buffer=function(e,t){for(var r=Math.min(this.buffer.length-this.bufferOff,e.length-t),o=0;o<r;o++)this.buffer[this.bufferOff+o]=e[t+o];return this.bufferOff+=r,r},t.prototype._flushBuffer=function(e,t){return this._update(this.buffer,0,e,t),this.bufferOff=0,this.blockSize},t.prototype._updateEncrypt=function(e){var t=0,r=0,o=(this.bufferOff+e.length)/this.blockSize|0,n=new Array(o*this.blockSize);0!==this.bufferOff&&(t+=this._buffer(e,t),this.bufferOff===this.buffer.length&&(r+=this._flushBuffer(n,r)));for(var i=e.length-(e.length-t)%this.blockSize;t<i;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},t.prototype._updateDecrypt=function(e){for(var t=0,r=0,o=Math.ceil((this.bufferOff+e.length)/this.blockSize)-1,n=new Array(o*this.blockSize);o>0;o--)t+=this._buffer(e,t),r+=this._flushBuffer(n,r);return t+=this._buffer(e,t),n},t.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},t.prototype._pad=function(e,t){if(0===t)return!1;for(;t<e.length;)e[t++]=0;return!0},t.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},t.prototype._unpad=function(e){return e},t.prototype._finalDecrypt=function(){e.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var t=new Array(this.blockSize);return this._flushBuffer(t,0),this._unpad(t)},cipher}function requireDes$1(){if(hasRequiredDes$1)return des;hasRequiredDes$1=1;var e=minimalisticAssert,t=requireInherits_browser(),r=requireUtils(),o=requireCipher();function n(){this.tmp=new Array(2),this.keys=null}function i(e){o.call(this,e);var t=new n;this._desState=t,this.deriveKeys(t,e.key)}t(i,o),des=i,i.create=function(e){return new i(e)};var a=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];return i.prototype.deriveKeys=function(t,o){t.keys=new Array(32),e.equal(o.length,this.blockSize,"Invalid key length");var n=r.readUInt32BE(o,0),i=r.readUInt32BE(o,4);r.pc1(n,i,t.tmp,0),n=t.tmp[0],i=t.tmp[1];for(var s=0;s<t.keys.length;s+=2){var c=a[s>>>1];n=r.r28shl(n,c),i=r.r28shl(i,c),r.pc2(n,i,t.keys,s)}},i.prototype._update=function(e,t,o,n){var i=this._desState,a=r.readUInt32BE(e,t),s=r.readUInt32BE(e,t+4);r.ip(a,s,i.tmp,0),a=i.tmp[0],s=i.tmp[1],"encrypt"===this.type?this._encrypt(i,a,s,i.tmp,0):this._decrypt(i,a,s,i.tmp,0),a=i.tmp[0],s=i.tmp[1],r.writeUInt32BE(o,a,n),r.writeUInt32BE(o,s,n+4)},i.prototype._pad=function(e,t){if(!1===this.padding)return!1;for(var r=e.length-t,o=t;o<e.length;o++)e[o]=r;return!0},i.prototype._unpad=function(t){if(!1===this.padding)return t;for(var r=t[t.length-1],o=t.length-r;o<t.length;o++)e.equal(t[o],r);return t.slice(0,t.length-r)},i.prototype._encrypt=function(e,t,o,n,i){for(var a=t,s=o,c=0;c<e.keys.length;c+=2){var u=e.keys[c],l=e.keys[c+1];r.expand(s,e.tmp,0),u^=e.tmp[0],l^=e.tmp[1];var d=r.substitute(u,l),p=s;s=(a^r.permute(d))>>>0,a=p}r.rip(s,a,n,i)},i.prototype._decrypt=function(e,t,o,n,i){for(var a=o,s=t,c=e.keys.length-2;c>=0;c-=2){var u=e.keys[c],l=e.keys[c+1];r.expand(a,e.tmp,0),u^=e.tmp[0],l^=e.tmp[1];var d=r.substitute(u,l),p=a;a=(s^r.permute(d))>>>0,s=p}r.rip(a,s,n,i)},des}assert$f.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var cbc$1={},hasRequiredCbc$1,ede,hasRequiredEde,hasRequiredDes,browserifyDes,hasRequiredBrowserifyDes;function requireCbc$1(){if(hasRequiredCbc$1)return cbc$1;hasRequiredCbc$1=1;var e=minimalisticAssert,t=requireInherits_browser(),r={};function o(t){e.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var r=0;r<this.iv.length;r++)this.iv[r]=t[r]}return cbc$1.instantiate=function(e){function o(t){e.call(this,t),this._cbcInit()}t(o,e);for(var n=Object.keys(r),i=0;i<n.length;i++){var a=n[i];o.prototype[a]=r[a]}return o.create=function(e){return new o(e)},o},r._cbcInit=function(){var e=new o(this.options.iv);this._cbcState=e},r._update=function(e,t,r,o){var n=this._cbcState,i=this.constructor.super_.prototype,a=n.iv;if("encrypt"===this.type){for(var s=0;s<this.blockSize;s++)a[s]^=e[t+s];i._update.call(this,a,0,r,o);for(s=0;s<this.blockSize;s++)a[s]=r[o+s]}else{i._update.call(this,e,t,r,o);for(s=0;s<this.blockSize;s++)r[o+s]^=a[s];for(s=0;s<this.blockSize;s++)a[s]=e[t+s]}},cbc$1}function requireEde(){if(hasRequiredEde)return ede;hasRequiredEde=1;var e=minimalisticAssert,t=requireInherits_browser(),r=requireCipher(),o=requireDes$1();function n(t,r){e.equal(r.length,24,"Invalid key length");var n=r.slice(0,8),i=r.slice(8,16),a=r.slice(16,24);this.ciphers="encrypt"===t?[o.create({type:"encrypt",key:n}),o.create({type:"decrypt",key:i}),o.create({type:"encrypt",key:a})]:[o.create({type:"decrypt",key:a}),o.create({type:"encrypt",key:i}),o.create({type:"decrypt",key:n})]}function i(e){r.call(this,e);var t=new n(this.type,this.options.key);this._edeState=t}return t(i,r),ede=i,i.create=function(e){return new i(e)},i.prototype._update=function(e,t,r,o){var n=this._edeState;n.ciphers[0]._update(e,t,r,o),n.ciphers[1]._update(r,o,r,o),n.ciphers[2]._update(r,o,r,o)},i.prototype._pad=o.prototype._pad,i.prototype._unpad=o.prototype._unpad,ede}function requireDes(){return hasRequiredDes||(hasRequiredDes=1,des$1.utils=requireUtils(),des$1.Cipher=requireCipher(),des$1.DES=requireDes$1(),des$1.CBC=requireCbc$1(),des$1.EDE=requireEde()),des$1}function requireBrowserifyDes(){if(hasRequiredBrowserifyDes)return browserifyDes;hasRequiredBrowserifyDes=1;var e=requireCipherBase(),t=requireDes(),r=requireInherits_browser(),o=requireSafeBuffer$1().Buffer,n={"des-ede3-cbc":t.CBC.instantiate(t.EDE),"des-ede3":t.EDE,"des-ede-cbc":t.CBC.instantiate(t.EDE),"des-ede":t.EDE,"des-cbc":t.CBC.instantiate(t.DES),"des-ecb":t.DES};function i(t){e.call(this);var r,i=t.mode.toLowerCase(),a=n[i];r=t.decrypt?"decrypt":"encrypt";var s=t.key;o.isBuffer(s)||(s=o.from(s)),"des-ede"!==i&&"des-ede-cbc"!==i||(s=o.concat([s,s.slice(0,8)]));var c=t.iv;o.isBuffer(c)||(c=o.from(c)),this._des=a.create({key:s,iv:c,type:r})}return n.des=n["des-cbc"],n.des3=n["des-ede3-cbc"],browserifyDes=i,r(i,e),i.prototype._update=function(e){return o.from(this._des.update(e))},i.prototype._final=function(){return o.from(this._des.final())},browserifyDes}var browser$7={},encrypter={},ecb={},hasRequiredEcb;function requireEcb(){return hasRequiredEcb||(hasRequiredEcb=1,ecb.encrypt=function(e,t){return e._cipher.encryptBlock(t)},ecb.decrypt=function(e,t){return e._cipher.decryptBlock(t)}),ecb}var cbc={},bufferXor,hasRequiredBufferXor,hasRequiredCbc;function requireBufferXor(){return hasRequiredBufferXor?bufferXor:(hasRequiredBufferXor=1,bufferXor=function(e,t){for(var r=Math.min(e.length,t.length),o=new Buffer(r),n=0;n<r;++n)o[n]=e[n]^t[n];return o})}function requireCbc(){if(hasRequiredCbc)return cbc;hasRequiredCbc=1;var e=requireBufferXor();return cbc.encrypt=function(t,r){var o=e(r,t._prev);return t._prev=t._cipher.encryptBlock(o),t._prev},cbc.decrypt=function(t,r){var o=t._prev;t._prev=r;var n=t._cipher.decryptBlock(r);return e(n,o)},cbc}var cfb={},hasRequiredCfb;function requireCfb(){if(hasRequiredCfb)return cfb;hasRequiredCfb=1;var e=requireSafeBuffer$1().Buffer,t=requireBufferXor();function r(r,o,n){var i=o.length,a=t(o,r._cache);return r._cache=r._cache.slice(i),r._prev=e.concat([r._prev,n?o:a]),a}return cfb.encrypt=function(t,o,n){for(var i,a=e.allocUnsafe(0);o.length;){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=e.allocUnsafe(0)),!(t._cache.length<=o.length)){a=e.concat([a,r(t,o,n)]);break}i=t._cache.length,a=e.concat([a,r(t,o.slice(0,i),n)]),o=o.slice(i)}return a},cfb}var cfb8={},hasRequiredCfb8;function requireCfb8(){if(hasRequiredCfb8)return cfb8;hasRequiredCfb8=1;var e=requireSafeBuffer$1().Buffer;function t(t,r,o){var n=t._cipher.encryptBlock(t._prev)[0]^r;return t._prev=e.concat([t._prev.slice(1),e.from([o?r:n])]),n}return cfb8.encrypt=function(r,o,n){for(var i=o.length,a=e.allocUnsafe(i),s=-1;++s<i;)a[s]=t(r,o[s],n);return a},cfb8}var cfb1={},hasRequiredCfb1;function requireCfb1(){if(hasRequiredCfb1)return cfb1;hasRequiredCfb1=1;var e=requireSafeBuffer$1().Buffer;function t(e,t,o){for(var n,i,a=-1,s=0;++a<8;)n=t&1<<7-a?128:0,s+=(128&(i=e._cipher.encryptBlock(e._prev)[0]^n))>>a%8,e._prev=r(e._prev,o?n:i);return s}function r(t,r){var o=t.length,n=-1,i=e.allocUnsafe(t.length);for(t=e.concat([t,e.from([r])]);++n<o;)i[n]=t[n]<<1|t[n+1]>>7;return i}return cfb1.encrypt=function(r,o,n){for(var i=o.length,a=e.allocUnsafe(i),s=-1;++s<i;)a[s]=t(r,o[s],n);return a},cfb1}var ofb={},hasRequiredOfb;function requireOfb(){if(hasRequiredOfb)return ofb;hasRequiredOfb=1;var e=requireBufferXor();function t(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}return ofb.encrypt=function(r,o){for(;r._cache.length<o.length;)r._cache=Buffer.concat([r._cache,t(r)]);var n=r._cache.slice(0,o.length);return r._cache=r._cache.slice(o.length),e(o,n)},ofb}var ctr={},incr32_1,hasRequiredIncr32,hasRequiredCtr;function requireIncr32(){if(hasRequiredIncr32)return incr32_1;return hasRequiredIncr32=1,incr32_1=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 requireCtr(){if(hasRequiredCtr)return ctr;hasRequiredCtr=1;var e=requireBufferXor(),t=requireSafeBuffer$1().Buffer,r=requireIncr32();function o(e){var t=e._cipher.encryptBlockRaw(e._prev);return r(e._prev),t}return ctr.encrypt=function(r,n){var i=Math.ceil(n.length/16),a=r._cache.length;r._cache=t.concat([r._cache,t.allocUnsafe(16*i)]);for(var s=0;s<i;s++){var c=o(r),u=a+16*s;r._cache.writeUInt32BE(c[0],u+0),r._cache.writeUInt32BE(c[1],u+4),r._cache.writeUInt32BE(c[2],u+8),r._cache.writeUInt32BE(c[3],u+12)}var l=r._cache.slice(0,n.length);return r._cache=r._cache.slice(n.length),e(n,l)},ctr}const 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"},require$$2={"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:aes128,aes192:aes192,aes256:aes256,"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"}};var modes_1,hasRequiredModes$1;function requireModes$1(){if(hasRequiredModes$1)return modes_1;hasRequiredModes$1=1;var e={ECB:requireEcb(),CBC:requireCbc(),CFB:requireCfb(),CFB8:requireCfb8(),CFB1:requireCfb1(),OFB:requireOfb(),CTR:requireCtr(),GCM:requireCtr()},t=require$$2;for(var r in t)t[r].module=e[t[r].mode];return modes_1=t}var aes={},hasRequiredAes,ghash,hasRequiredGhash,authCipher,hasRequiredAuthCipher,streamCipher,hasRequiredStreamCipher,evp_bytestokey,hasRequiredEvp_bytestokey,hasRequiredEncrypter;function requireAes(){if(hasRequiredAes)return aes;hasRequiredAes=1;var e=requireSafeBuffer$1().Buffer;function t(t){e.isBuffer(t)||(t=e.from(t));for(var r=t.length/4|0,o=new Array(r),n=0;n<r;n++)o[n]=t.readUInt32BE(4*n);return o}function r(e){for(;0<e.length;e++)e[0]=0}function o(e,t,r,o,n){for(var i,a,s,c,u=r[0],l=r[1],d=r[2],p=r[3],h=e[0]^t[0],f=e[1]^t[1],m=e[2]^t[2],y=e[3]^t[3],g=4,b=1;b<n;b++)i=u[h>>>24]^l[f>>>16&255]^d[m>>>8&255]^p[255&y]^t[g++],a=u[f>>>24]^l[m>>>16&255]^d[y>>>8&255]^p[255&h]^t[g++],s=u[m>>>24]^l[y>>>16&255]^d[h>>>8&255]^p[255&f]^t[g++],c=u[y>>>24]^l[h>>>16&255]^d[f>>>8&255]^p[255&m]^t[g++],h=i,f=a,m=s,y=c;return i=(o[h>>>24]<<24|o[f>>>16&255]<<16|o[m>>>8&255]<<8|o[255&y])^t[g++],a=(o[f>>>24]<<24|o[m>>>16&255]<<16|o[y>>>8&255]<<8|o[255&h])^t[g++],s=(o[m>>>24]<<24|o[y>>>16&255]<<16|o[h>>>8&255]<<8|o[255&f])^t[g++],c=(o[y>>>24]<<24|o[h>>>16&255]<<16|o[f>>>8&255]<<8|o[255&m])^t[g++],[i>>>=0,a>>>=0,s>>>=0,c>>>=0]}var n=[0,1,2,4,8,16,32,64,128,27,54],i=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var r=[],o=[],n=[[],[],[],[]],i=[[],[],[],[]],a=0,s=0,c=0;c<256;++c){var u=s^s<<1^s<<2^s<<3^s<<4;u=u>>>8^255&u^99,r[a]=u,o[u]=a;var l=e[a],d=e[l],p=e[d],h=257*e[u]^16843008*u;n[0][a]=h<<24|h>>>8,n[1][a]=h<<16|h>>>16,n[2][a]=h<<8|h>>>24,n[3][a]=h,h=16843009*p^65537*d^257*l^16843008*a,i[0][u]=h<<24|h>>>8,i[1][u]=h<<16|h>>>16,i[2][u]=h<<8|h>>>24,i[3][u]=h,0===a?a=s=1:(a=l^e[e[e[p^l]]],s^=e[e[s]])}return{SBOX:r,INV_SBOX:o,SUB_MIX:n,INV_SUB_MIX:i}}();function a(e){this._key=t(e),this._reset()}return a.blockSize=16,a.keySize=32,a.prototype.blockSize=a.blockSize,a.prototype.keySize=a.keySize,a.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,o=4*(r+1),a=[],s=0;s<t;s++)a[s]=e[s];for(s=t;s<o;s++){var c=a[s-1];s%t==0?(c=c<<8|c>>>24,c=i.SBOX[c>>>24]<<24|i.SBOX[c>>>16&255]<<16|i.SBOX[c>>>8&255]<<8|i.SBOX[255&c],c^=n[s/t|0]<<24):t>6&&s%t==4&&(c=i.SBOX[c>>>24]<<24|i.SBOX[c>>>16&255]<<16|i.SBOX[c>>>8&255]<<8|i.SBOX[255&c]),a[s]=a[s-t]^c}for(var u=[],l=0;l<o;l++){var d=o-l,p=a[d-(l%4?0:4)];u[l]=l<4||d<=4?p:i.INV_SUB_MIX[0][i.SBOX[p>>>24]]^i.INV_SUB_MIX[1][i.SBOX[p>>>16&255]]^i.INV_SUB_MIX[2][i.SBOX[p>>>8&255]]^i.INV_SUB_MIX[3][i.SBOX[255&p]]}this._nRounds=r,this._keySchedule=a,this._invKeySchedule=u},a.prototype.encryptBlockRaw=function(e){return o(e=t(e),this._keySchedule,i.SUB_MIX,i.SBOX,this._nRounds)},a.prototype.encryptBlock=function(t){var r=this.encryptBlockRaw(t),o=e.allocUnsafe(16);return o.writeUInt32BE(r[0],0),o.writeUInt32BE(r[1],4),o.writeUInt32BE(r[2],8),o.writeUInt32BE(r[3],12),o},a.prototype.decryptBlock=function(r){var n=(r=t(r))[1];r[1]=r[3],r[3]=n;var a=o(r,this._invKeySchedule,i.INV_SUB_MIX,i.INV_SBOX,this._nRounds),s=e.allocUnsafe(16);return s.writeUInt32BE(a[0],0),s.writeUInt32BE(a[3],4),s.writeUInt32BE(a[2],8),s.writeUInt32BE(a[1],12),s},a.prototype.scrub=function(){r(this._keySchedule),r(this._invKeySchedule),r(this._key)},aes.AES=a,aes}function requireGhash(){if(hasRequiredGhash)return ghash;hasRequiredGhash=1;var e=requireSafeBuffer$1().Buffer,t=e.alloc(16,0);function r(t){var r=e.allocUnsafe(16);return r.writeUInt32BE(t[0]>>>0,0),r.writeUInt32BE(t[1]>>>0,4),r.writeUInt32BE(t[2]>>>0,8),r.writeUInt32BE(t[3]>>>0,12),r}function o(t){this.h=t,this.state=e.alloc(16,0),this.cache=e.allocUnsafe(0)}return o.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()},o.prototype._multiply=function(){for(var e,t,o,n=[(e=this.h).readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.readUInt32BE(12)],i=[0,0,0,0],a=-1;++a<128;){for(!!(this.state[~~(a/8)]&1<<7-a%8)&&(i[0]^=n[0],i[1]^=n[1],i[2]^=n[2],i[3]^=n[3]),o=!!(1&n[3]),t=3;t>0;t--)n[t]=n[t]>>>1|(1&n[t-1])<<31;n[0]=n[0]>>>1,o&&(n[0]=n[0]^225<<24)}this.state=r(i)},o.prototype.update=function(t){var r;for(this.cache=e.concat([this.cache,t]);this.cache.length>=16;)r=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(r)},o.prototype.final=function(o,n){return this.cache.length&&this.ghash(e.concat([this.cache,t],16)),this.ghash(r([0,o,0,n])),this.state},ghash=o}function requireAuthCipher(){if(hasRequiredAuthCipher)return authCipher;hasRequiredAuthCipher=1;var e=requireAes(),t=requireSafeBuffer$1().Buffer,r=requireCipherBase(),o=requireInherits_browser(),n=requireGhash(),i=requireBufferXor(),a=requireIncr32();function s(o,i,s,c){r.call(this);var u=t.alloc(4,0);this._cipher=new e.AES(i);var l=this._cipher.encryptBlock(u);this._ghash=new n(l),s=function(e,r,o){if(12===r.length)return e._finID=t.concat([r,t.from([0,0,0,1])]),t.concat([r,t.from([0,0,0,2])]);var i=new n(o),s=r.length,c=s%16;i.update(r),c&&(c=16-c,i.update(t.alloc(c,0))),i.update(t.alloc(8,0));var u=8*s,l=t.alloc(8);l.writeUIntBE(u,0,8),i.update(l),e._finID=i.state;var d=t.from(e._finID);return a(d),d}(this,s,l),this._prev=t.from(s),this._cache=t.allocUnsafe(0),this._secCache=t.allocUnsafe(0),this._decrypt=c,this._alen=0,this._len=0,this._mode=o,this._authTag=null,this._called=!1}return o(s,r),s.prototype._update=function(e){if(!this._called&&this._alen){var r=16-this._alen%16;r<16&&(r=t.alloc(r,0),this._ghash.update(r))}this._called=!0;var o=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(o),this._len+=e.length,o},s.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=i(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 o=Math.min(e.length,t.length),n=0;n<o;++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()},s.prototype.getAuthTag=function(){if(this._decrypt||!t.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},s.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=e},s.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},authCipher=s}function requireStreamCipher(){if(hasRequiredStreamCipher)return streamCipher;hasRequiredStreamCipher=1;var e=requireAes(),t=requireSafeBuffer$1().Buffer,r=requireCipherBase();function o(o,n,i,a){r.call(this),this._cipher=new e.AES(n),this._prev=t.from(i),this._cache=t.allocUnsafe(0),this._secCache=t.allocUnsafe(0),this._decrypt=a,this._mode=o}return requireInherits_browser()(o,r),o.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},o.prototype._final=function(){this._cipher.scrub()},streamCipher=o}function requireEvp_bytestokey(){if(hasRequiredEvp_bytestokey)return evp_bytestokey;hasRequiredEvp_bytestokey=1;var e=requireSafeBuffer$1().Buffer,t=requireMd5_js();return evp_bytestokey=function(r,o,n,i){if(e.isBuffer(r)||(r=e.from(r,"binary")),o&&(e.isBuffer(o)||(o=e.from(o,"binary")),8!==o.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var a=n/8,s=e.alloc(a),c=e.alloc(i||0),u=e.alloc(0);a>0||i>0;){var l=new t;l.update(u),l.update(r),o&&l.update(o),u=l.digest();var d=0;if(a>0){var p=s.length-a;d=Math.min(a,u.length),u.copy(s,p,0,d),a-=d}if(d<u.length&&i>0){var h=c.length-i,f=Math.min(i,u.length-d);u.copy(c,h,d,d+f),i-=f}}return u.fill(0),{key:s,iv:c}}}function requireEncrypter(){if(hasRequiredEncrypter)return encrypter;hasRequiredEncrypter=1;var e=requireModes$1(),t=requireAuthCipher(),r=requireSafeBuffer$1().Buffer,o=requireStreamCipher(),n=requireCipherBase(),i=requireAes(),a=requireEvp_bytestokey();function s(e,t,o){n.call(this),this._cache=new u,this._cipher=new i.AES(t),this._prev=r.from(o),this._mode=e,this._autopadding=!0}requireInherits_browser()(s,n),s.prototype._update=function(e){var t,o;this._cache.add(e);for(var n=[];t=this._cache.get();)o=this._mode.encrypt(this,t),n.push(o);return r.concat(n)};var c=r.alloc(16,16);function u(){this.cache=r.allocUnsafe(0)}function l(n,i,a){var c=e[n.toLowerCase()];if(!c)throw new TypeError("invalid suite type");if("string"==typeof i&&(i=r.from(i)),i.length!==c.key/8)throw new TypeError("invalid key length "+i.length);if("string"==typeof a&&(a=r.from(a)),"GCM"!==c.mode&&a.length!==c.iv)throw new TypeError("invalid iv length "+a.length);return"stream"===c.type?new o(c.module,i,a):"auth"===c.type?new t(c.module,i,a):new s(c.module,i,a)}return s.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(c))throw this._cipher.scrub(),new Error("data not multiple of block length")},s.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},u.prototype.add=function(e){this.cache=r.concat([this.cache,e])},u.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},u.prototype.flush=function(){for(var e=16-this.cache.length,t=r.allocUnsafe(e),o=-1;++o<e;)t.writeUInt8(e,o);return r.concat([this.cache,t])},encrypter.createCipheriv=l,encrypter.createCipher=function(t,r){var o=e[t.toLowerCase()];if(!o)throw new TypeError("invalid suite type");var n=a(r,!1,o.key,o.iv);return l(t,n.key,n.iv)},encrypter}var decrypter={},hasRequiredDecrypter,hasRequiredBrowser$6;function requireDecrypter(){if(hasRequiredDecrypter)return decrypter;hasRequiredDecrypter=1;var e=requireAuthCipher(),t=requireSafeBuffer$1().Buffer,r=requireModes$1(),o=requireStreamCipher(),n=requireCipherBase(),i=requireAes(),a=requireEvp_bytestokey();function s(e,r,o){n.call(this),this._cache=new c,this._last=void 0,this._cipher=new i.AES(r),this._prev=t.from(o),this._mode=e,this._autopadding=!0}function c(){this.cache=t.allocUnsafe(0)}function u(n,i,a){var c=r[n.toLowerCase()];if(!c)throw new TypeError("invalid suite type");if("string"==typeof a&&(a=t.from(a)),"GCM"!==c.mode&&a.length!==c.iv)throw new TypeError("invalid iv length "+a.length);if("string"==typeof i&&(i=t.from(i)),i.length!==c.key/8)throw new TypeError("invalid key length "+i.length);return"stream"===c.type?new o(c.module,i,a,!0):"auth"===c.type?new e(c.module,i,a,!0):new s(c.module,i,a)}return requireInherits_browser()(s,n),s.prototype._update=function(e){var r,o;this._cache.add(e);for(var n=[];r=this._cache.get(this._autopadding);)o=this._mode.decrypt(this,r),n.push(o);return t.concat(n)},s.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")},s.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},c.prototype.add=function(e){this.cache=t.concat([this.cache,e])},c.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},c.prototype.flush=function(){if(this.cache.length)return this.cache},decrypter.createDecipher=function(e,t){var o=r[e.toLowerCase()];if(!o)throw new TypeError("invalid suite type");var n=a(t,!1,o.key,o.iv);return u(e,n.key,n.iv)},decrypter.createDecipheriv=u,decrypter}function requireBrowser$6(){if(hasRequiredBrowser$6)return browser$7;hasRequiredBrowser$6=1;var e=requireEncrypter(),t=requireDecrypter(),r=require$$2;return browser$7.createCipher=browser$7.Cipher=e.createCipher,browser$7.createCipheriv=browser$7.Cipheriv=e.createCipheriv,browser$7.createDecipher=browser$7.Decipher=t.createDecipher,browser$7.createDecipheriv=browser$7.Decipheriv=t.createDecipheriv,browser$7.listCiphers=browser$7.getCiphers=function(){return Object.keys(r)},browser$7}var modes={},hasRequiredModes,hasRequiredBrowser$5;function requireModes(){return hasRequiredModes||(hasRequiredModes=1,function(e){e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}}(modes)),modes}function requireBrowser$5(){if(hasRequiredBrowser$5)return browser$8;hasRequiredBrowser$5=1;var e=requireBrowserifyDes(),t=requireBrowser$6(),r=requireModes$1(),o=requireModes(),n=requireEvp_bytestokey();function i(n,i,a){if(n=n.toLowerCase(),r[n])return t.createCipheriv(n,i,a);if(o[n])return new e({key:i,iv:a,mode:n});throw new TypeError("invalid suite type")}function a(n,i,a){if(n=n.toLowerCase(),r[n])return t.createDecipheriv(n,i,a);if(o[n])return new e({key:i,iv:a,mode:n,decrypt:!0});throw new TypeError("invalid suite type")}return browser$8.createCipher=browser$8.Cipher=function(e,t){var a,s;if(e=e.toLowerCase(),r[e])a=r[e].key,s=r[e].iv;else{if(!o[e])throw new TypeError("invalid suite type");a=8*o[e].key,s=o[e].iv}var c=n(t,!1,a,s);return i(e,c.key,c.iv)},browser$8.createCipheriv=browser$8.Cipheriv=i,browser$8.createDecipher=browser$8.Decipher=function(e,t){var i,s;if(e=e.toLowerCase(),r[e])i=r[e].key,s=r[e].iv;else{if(!o[e])throw new TypeError("invalid suite type");i=8*o[e].key,s=o[e].iv}var c=n(t,!1,i,s);return a(e,c.key,c.iv)},browser$8.createDecipheriv=browser$8.Decipheriv=a,browser$8.listCiphers=browser$8.getCiphers=function(){return Object.keys(o).concat(t.getCiphers())},browser$8}var browser$6={},bn$6={exports:{}},hasRequiredBn$4;function requireBn$4(){return hasRequiredBn$4||(hasRequiredBn$4=1,function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function o(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function n(e,t,r){if(n.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 i;"object"==typeof e?e.exports=n:t.BN=n,n.BN=n,n.wordSize=26;try{i="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require$$0$2.Buffer}catch(T){}function a(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(e,t,r){var o=a(e,r);return r-1>=t&&(o|=a(e,r-1)<<4),o}function c(e,t,r,o){for(var n=0,i=Math.min(e.length,r),a=t;a<i;a++){var s=e.charCodeAt(a)-48;n*=o,n+=s>=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(e){return e instanceof n||null!==e&&"object"==typeof e&&e.constructor.wordSize===n.wordSize&&Array.isArray(e.words)},n.max=function(e,t){return e.cmp(t)>0?e:t},n.min=function(e,t){return e.cmp(t)<0?e:t},n.prototype._init=function(e,t,o){if("number"==typeof e)return this._initNumber(e,t,o);if("object"==typeof e)return this._initArray(e,t,o);"hex"===t&&(t=16),r(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,o):(this._parseBase(e,t,n),"le"===o&&this._initArray(this.toArray(),t,o)))},n.prototype._initNumber=function(e,t,o){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):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===o&&this._initArray(this.toArray(),t,o)},n.prototype._initArray=function(e,t,o){if(r("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 i,a,s=0;if("be"===o)for(n=e.length-1,i=0;n>=0;n-=3)a=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===o)for(n=0,i=0;n<e.length;n+=3)a=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this.strip()},n.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var n,i=0,a=0;if("be"===r)for(o=e.length-1;o>=t;o-=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;else for(o=(e.length-t)%2==0?t+1:t;o<e.length;o+=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;this.strip()},n.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var o=0,n=1;n<=67108863;n*=t)o++;o--,n=n/t|0;for(var i=e.length-r,a=i%o,s=Math.min(i,i-a)+r,u=0,l=r;l<s;l+=o)u=c(e,l,l+o,t),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var d=1;for(u=c(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.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},n.prototype.clone=function(){var e=new n(null);return this.copy(e),e},n.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","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"],l=[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],d=[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 p(e,t,r){r.negative=t.negative^e.negative;var o=e.length+t.length|0;r.length=o,o=o-1|0;var n=0|e.words[0],i=0|t.words[0],a=n*i,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u<o;u++){for(var l=c>>>26,d=67108863&c,p=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=p;h++){var f=u-h|0;l+=(a=(n=0|e.words[f])*(i=0|t.words[h])+d)/67108864|0,d=67108863&a}r.words[u]=0|d,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}n.prototype.toString=function(e,t){var o;if(t=0|t||1,16===(e=e||10)||"hex"===e){o="";for(var n=0,i=0,a=0;a<this.length;a++){var s=this.words[a],c=(16777215&(s<<n|i)).toString(16);i=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),o=0!==i||a!==this.length-1?u[6-c.length]+c+o:c+o}for(0!==i&&(o=i.toString(16)+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}if(e===(0|e)&&e>=2&&e<=36){var p=l[e],h=d[e];o="";var f=this.clone();for(f.negative=0;!f.isZero();){var m=f.modn(h).toString(e);o=(f=f.idivn(h)).isZero()?m+o:u[p-m.length]+m+o}for(this.isZero()&&(o="0"+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}r(!1,"Base should be between 2 and 36")},n.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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(e,t){return r(void 0!==i),this.toArrayLike(i,e,t)},n.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},n.prototype.toArrayLike=function(e,t,o){var n=this.byteLength(),i=o||Math.max(1,n);r(n<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===t,u=new e(i),l=this.clone();if(c){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[s]=a;for(;s<i;s++)u[s]=0}else{for(s=0;s<i-n;s++)u[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[i-s-1]=a}return u},Math.clz32?n.prototype._countBits=function(e){return 32-Math.clz32(e)}:n.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},n.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},n.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},n.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},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},n.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(e){return r(!(this.negative|e.negative)),this.iuor(e)},n.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},n.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},n.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()},n.prototype.iand=function(e){return r(!(this.negative|e.negative)),this.iuand(e)},n.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},n.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},n.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var o=0;o<r.length;o++)this.words[o]=t.words[o]^r.words[o];if(this!==t)for(;o<t.length;o++)this.words[o]=t.words[o];return this.length=t.length,this.strip()},n.prototype.ixor=function(e){return r(!(this.negative|e.negative)),this.iuxor(e)},n.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},n.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},n.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),o=e%26;this._expand(t),o>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return o>0&&(this.words[n]=~this.words[n]&67108863>>26-o),this.strip()},n.prototype.notn=function(e){return this.clone().inotn(e)},n.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var o=e/26|0,n=e%26;return this._expand(o+1),this.words[o]=t?this.words[o]|1<<n:this.words[o]&~(1<<n),this.strip()},n.prototype.iadd=function(e){var t,r,o;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,o=e):(r=e,o=this);for(var n=0,i=0;i<o.length;i++)t=(0|r.words[i])+(0|o.words[i])+n,this.words[i]=67108863&t,n=t>>>26;for(;0!==n&&i<r.length;i++)t=(0|r.words[i])+n,this.words[i]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;i<r.length;i++)this.words[i]=r.words[i];return this},n.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)},n.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,o,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,o=e):(r=e,o=this);for(var i=0,a=0;a<o.length;a++)i=(t=(0|r.words[a])-(0|o.words[a])+i)>>26,this.words[a]=67108863&t;for(;0!==i&&a<r.length;a++)i=(t=(0|r.words[a])+i)>>26,this.words[a]=67108863&t;if(0===i&&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()},n.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,r){var o,n,i,a=e.words,s=t.words,c=r.words,u=0,l=0|a[0],d=8191&l,p=l>>>13,h=0|a[1],f=8191&h,m=h>>>13,y=0|a[2],g=8191&y,b=y>>>13,v=0|a[3],w=8191&v,$=v>>>13,k=0|a[4],_=8191&k,T=k>>>13,I=0|a[5],A=8191&I,O=I>>>13,E=0|a[6],S=8191&E,R=E>>>13,x=0|a[7],C=8191&x,P=x>>>13,N=0|a[8],B=8191&N,D=N>>>13,M=0|a[9],L=8191&M,j=M>>>13,F=0|s[0],U=8191&F,K=F>>>13,q=0|s[1],G=8191&q,H=q>>>13,V=0|s[2],W=8191&V,z=V>>>13,Z=0|s[3],Q=8191&Z,Y=Z>>>13,X=0|s[4],J=8191&X,ee=X>>>13,te=0|s[5],re=8191&te,oe=te>>>13,ne=0|s[6],ie=8191&ne,ae=ne>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],de=8191&le,pe=le>>>13,he=0|s[9],fe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(u+(o=Math.imul(d,U))|0)+((8191&(n=(n=Math.imul(d,K))+Math.imul(p,U)|0))<<13)|0;u=((i=Math.imul(p,K))+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,o=Math.imul(f,U),n=(n=Math.imul(f,K))+Math.imul(m,U)|0,i=Math.imul(m,K);var ge=(u+(o=o+Math.imul(d,G)|0)|0)+((8191&(n=(n=n+Math.imul(d,H)|0)+Math.imul(p,G)|0))<<13)|0;u=((i=i+Math.imul(p,H)|0)+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,o=Math.imul(g,U),n=(n=Math.imul(g,K))+Math.imul(b,U)|0,i=Math.imul(b,K),o=o+Math.imul(f,G)|0,n=(n=n+Math.imul(f,H)|0)+Math.imul(m,G)|0,i=i+Math.imul(m,H)|0;var be=(u+(o=o+Math.imul(d,W)|0)|0)+((8191&(n=(n=n+Math.imul(d,z)|0)+Math.imul(p,W)|0))<<13)|0;u=((i=i+Math.imul(p,z)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,o=Math.imul(w,U),n=(n=Math.imul(w,K))+Math.imul($,U)|0,i=Math.imul($,K),o=o+Math.imul(g,G)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(b,G)|0,i=i+Math.imul(b,H)|0,o=o+Math.imul(f,W)|0,n=(n=n+Math.imul(f,z)|0)+Math.imul(m,W)|0,i=i+Math.imul(m,z)|0;var ve=(u+(o=o+Math.imul(d,Q)|0)|0)+((8191&(n=(n=n+Math.imul(d,Y)|0)+Math.imul(p,Q)|0))<<13)|0;u=((i=i+Math.imul(p,Y)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,o=Math.imul(_,U),n=(n=Math.imul(_,K))+Math.imul(T,U)|0,i=Math.imul(T,K),o=o+Math.imul(w,G)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul($,G)|0,i=i+Math.imul($,H)|0,o=o+Math.imul(g,W)|0,n=(n=n+Math.imul(g,z)|0)+Math.imul(b,W)|0,i=i+Math.imul(b,z)|0,o=o+Math.imul(f,Q)|0,n=(n=n+Math.imul(f,Y)|0)+Math.imul(m,Q)|0,i=i+Math.imul(m,Y)|0;var we=(u+(o=o+Math.imul(d,J)|0)|0)+((8191&(n=(n=n+Math.imul(d,ee)|0)+Math.imul(p,J)|0))<<13)|0;u=((i=i+Math.imul(p,ee)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,o=Math.imul(A,U),n=(n=Math.imul(A,K))+Math.imul(O,U)|0,i=Math.imul(O,K),o=o+Math.imul(_,G)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(T,G)|0,i=i+Math.imul(T,H)|0,o=o+Math.imul(w,W)|0,n=(n=n+Math.imul(w,z)|0)+Math.imul($,W)|0,i=i+Math.imul($,z)|0,o=o+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(b,Q)|0,i=i+Math.imul(b,Y)|0,o=o+Math.imul(f,J)|0,n=(n=n+Math.imul(f,ee)|0)+Math.imul(m,J)|0,i=i+Math.imul(m,ee)|0;var $e=(u+(o=o+Math.imul(d,re)|0)|0)+((8191&(n=(n=n+Math.imul(d,oe)|0)+Math.imul(p,re)|0))<<13)|0;u=((i=i+Math.imul(p,oe)|0)+(n>>>13)|0)+($e>>>26)|0,$e&=67108863,o=Math.imul(S,U),n=(n=Math.imul(S,K))+Math.imul(R,U)|0,i=Math.imul(R,K),o=o+Math.imul(A,G)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(O,G)|0,i=i+Math.imul(O,H)|0,o=o+Math.imul(_,W)|0,n=(n=n+Math.imul(_,z)|0)+Math.imul(T,W)|0,i=i+Math.imul(T,z)|0,o=o+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul($,Q)|0,i=i+Math.imul($,Y)|0,o=o+Math.imul(g,J)|0,n=(n=n+Math.imul(g,ee)|0)+Math.imul(b,J)|0,i=i+Math.imul(b,ee)|0,o=o+Math.imul(f,re)|0,n=(n=n+Math.imul(f,oe)|0)+Math.imul(m,re)|0,i=i+Math.imul(m,oe)|0;var ke=(u+(o=o+Math.imul(d,ie)|0)|0)+((8191&(n=(n=n+Math.imul(d,ae)|0)+Math.imul(p,ie)|0))<<13)|0;u=((i=i+Math.imul(p,ae)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,o=Math.imul(C,U),n=(n=Math.imul(C,K))+Math.imul(P,U)|0,i=Math.imul(P,K),o=o+Math.imul(S,G)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,G)|0,i=i+Math.imul(R,H)|0,o=o+Math.imul(A,W)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(O,W)|0,i=i+Math.imul(O,z)|0,o=o+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(T,Q)|0,i=i+Math.imul(T,Y)|0,o=o+Math.imul(w,J)|0,n=(n=n+Math.imul(w,ee)|0)+Math.imul($,J)|0,i=i+Math.imul($,ee)|0,o=o+Math.imul(g,re)|0,n=(n=n+Math.imul(g,oe)|0)+Math.imul(b,re)|0,i=i+Math.imul(b,oe)|0,o=o+Math.imul(f,ie)|0,n=(n=n+Math.imul(f,ae)|0)+Math.imul(m,ie)|0,i=i+Math.imul(m,ae)|0;var _e=(u+(o=o+Math.imul(d,ce)|0)|0)+((8191&(n=(n=n+Math.imul(d,ue)|0)+Math.imul(p,ce)|0))<<13)|0;u=((i=i+Math.imul(p,ue)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,o=Math.imul(B,U),n=(n=Math.imul(B,K))+Math.imul(D,U)|0,i=Math.imul(D,K),o=o+Math.imul(C,G)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(P,G)|0,i=i+Math.imul(P,H)|0,o=o+Math.imul(S,W)|0,n=(n=n+Math.imul(S,z)|0)+Math.imul(R,W)|0,i=i+Math.imul(R,z)|0,o=o+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,Q)|0,i=i+Math.imul(O,Y)|0,o=o+Math.imul(_,J)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(T,J)|0,i=i+Math.imul(T,ee)|0,o=o+Math.imul(w,re)|0,n=(n=n+Math.imul(w,oe)|0)+Math.imul($,re)|0,i=i+Math.imul($,oe)|0,o=o+Math.imul(g,ie)|0,n=(n=n+Math.imul(g,ae)|0)+Math.imul(b,ie)|0,i=i+Math.imul(b,ae)|0,o=o+Math.imul(f,ce)|0,n=(n=n+Math.imul(f,ue)|0)+Math.imul(m,ce)|0,i=i+Math.imul(m,ue)|0;var Te=(u+(o=o+Math.imul(d,de)|0)|0)+((8191&(n=(n=n+Math.imul(d,pe)|0)+Math.imul(p,de)|0))<<13)|0;u=((i=i+Math.imul(p,pe)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,o=Math.imul(L,U),n=(n=Math.imul(L,K))+Math.imul(j,U)|0,i=Math.imul(j,K),o=o+Math.imul(B,G)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(D,G)|0,i=i+Math.imul(D,H)|0,o=o+Math.imul(C,W)|0,n=(n=n+Math.imul(C,z)|0)+Math.imul(P,W)|0,i=i+Math.imul(P,z)|0,o=o+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(R,Q)|0,i=i+Math.imul(R,Y)|0,o=o+Math.imul(A,J)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(O,J)|0,i=i+Math.imul(O,ee)|0,o=o+Math.imul(_,re)|0,n=(n=n+Math.imul(_,oe)|0)+Math.imul(T,re)|0,i=i+Math.imul(T,oe)|0,o=o+Math.imul(w,ie)|0,n=(n=n+Math.imul(w,ae)|0)+Math.imul($,ie)|0,i=i+Math.imul($,ae)|0,o=o+Math.imul(g,ce)|0,n=(n=n+Math.imul(g,ue)|0)+Math.imul(b,ce)|0,i=i+Math.imul(b,ue)|0,o=o+Math.imul(f,de)|0,n=(n=n+Math.imul(f,pe)|0)+Math.imul(m,de)|0,i=i+Math.imul(m,pe)|0;var Ie=(u+(o=o+Math.imul(d,fe)|0)|0)+((8191&(n=(n=n+Math.imul(d,me)|0)+Math.imul(p,fe)|0))<<13)|0;u=((i=i+Math.imul(p,me)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,o=Math.imul(L,G),n=(n=Math.imul(L,H))+Math.imul(j,G)|0,i=Math.imul(j,H),o=o+Math.imul(B,W)|0,n=(n=n+Math.imul(B,z)|0)+Math.imul(D,W)|0,i=i+Math.imul(D,z)|0,o=o+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,Y)|0,o=o+Math.imul(S,J)|0,n=(n=n+Math.imul(S,ee)|0)+Math.imul(R,J)|0,i=i+Math.imul(R,ee)|0,o=o+Math.imul(A,re)|0,n=(n=n+Math.imul(A,oe)|0)+Math.imul(O,re)|0,i=i+Math.imul(O,oe)|0,o=o+Math.imul(_,ie)|0,n=(n=n+Math.imul(_,ae)|0)+Math.imul(T,ie)|0,i=i+Math.imul(T,ae)|0,o=o+Math.imul(w,ce)|0,n=(n=n+Math.imul(w,ue)|0)+Math.imul($,ce)|0,i=i+Math.imul($,ue)|0,o=o+Math.imul(g,de)|0,n=(n=n+Math.imul(g,pe)|0)+Math.imul(b,de)|0,i=i+Math.imul(b,pe)|0;var Ae=(u+(o=o+Math.imul(f,fe)|0)|0)+((8191&(n=(n=n+Math.imul(f,me)|0)+Math.imul(m,fe)|0))<<13)|0;u=((i=i+Math.imul(m,me)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,o=Math.imul(L,W),n=(n=Math.imul(L,z))+Math.imul(j,W)|0,i=Math.imul(j,z),o=o+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(D,Q)|0,i=i+Math.imul(D,Y)|0,o=o+Math.imul(C,J)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(P,J)|0,i=i+Math.imul(P,ee)|0,o=o+Math.imul(S,re)|0,n=(n=n+Math.imul(S,oe)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,oe)|0,o=o+Math.imul(A,ie)|0,n=(n=n+Math.imul(A,ae)|0)+Math.imul(O,ie)|0,i=i+Math.imul(O,ae)|0,o=o+Math.imul(_,ce)|0,n=(n=n+Math.imul(_,ue)|0)+Math.imul(T,ce)|0,i=i+Math.imul(T,ue)|0,o=o+Math.imul(w,de)|0,n=(n=n+Math.imul(w,pe)|0)+Math.imul($,de)|0,i=i+Math.imul($,pe)|0;var Oe=(u+(o=o+Math.imul(g,fe)|0)|0)+((8191&(n=(n=n+Math.imul(g,me)|0)+Math.imul(b,fe)|0))<<13)|0;u=((i=i+Math.imul(b,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,o=Math.imul(L,Q),n=(n=Math.imul(L,Y))+Math.imul(j,Q)|0,i=Math.imul(j,Y),o=o+Math.imul(B,J)|0,n=(n=n+Math.imul(B,ee)|0)+Math.imul(D,J)|0,i=i+Math.imul(D,ee)|0,o=o+Math.imul(C,re)|0,n=(n=n+Math.imul(C,oe)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,oe)|0,o=o+Math.imul(S,ie)|0,n=(n=n+Math.imul(S,ae)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,ae)|0,o=o+Math.imul(A,ce)|0,n=(n=n+Math.imul(A,ue)|0)+Math.imul(O,ce)|0,i=i+Math.imul(O,ue)|0,o=o+Math.imul(_,de)|0,n=(n=n+Math.imul(_,pe)|0)+Math.imul(T,de)|0,i=i+Math.imul(T,pe)|0;var Ee=(u+(o=o+Math.imul(w,fe)|0)|0)+((8191&(n=(n=n+Math.imul(w,me)|0)+Math.imul($,fe)|0))<<13)|0;u=((i=i+Math.imul($,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,o=Math.imul(L,J),n=(n=Math.imul(L,ee))+Math.imul(j,J)|0,i=Math.imul(j,ee),o=o+Math.imul(B,re)|0,n=(n=n+Math.imul(B,oe)|0)+Math.imul(D,re)|0,i=i+Math.imul(D,oe)|0,o=o+Math.imul(C,ie)|0,n=(n=n+Math.imul(C,ae)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,ae)|0,o=o+Math.imul(S,ce)|0,n=(n=n+Math.imul(S,ue)|0)+Math.imul(R,ce)|0,i=i+Math.imul(R,ue)|0,o=o+Math.imul(A,de)|0,n=(n=n+Math.imul(A,pe)|0)+Math.imul(O,de)|0,i=i+Math.imul(O,pe)|0;var Se=(u+(o=o+Math.imul(_,fe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(T,fe)|0))<<13)|0;u=((i=i+Math.imul(T,me)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,o=Math.imul(L,re),n=(n=Math.imul(L,oe))+Math.imul(j,re)|0,i=Math.imul(j,oe),o=o+Math.imul(B,ie)|0,n=(n=n+Math.imul(B,ae)|0)+Math.imul(D,ie)|0,i=i+Math.imul(D,ae)|0,o=o+Math.imul(C,ce)|0,n=(n=n+Math.imul(C,ue)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,ue)|0,o=o+Math.imul(S,de)|0,n=(n=n+Math.imul(S,pe)|0)+Math.imul(R,de)|0,i=i+Math.imul(R,pe)|0;var Re=(u+(o=o+Math.imul(A,fe)|0)|0)+((8191&(n=(n=n+Math.imul(A,me)|0)+Math.imul(O,fe)|0))<<13)|0;u=((i=i+Math.imul(O,me)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,o=Math.imul(L,ie),n=(n=Math.imul(L,ae))+Math.imul(j,ie)|0,i=Math.imul(j,ae),o=o+Math.imul(B,ce)|0,n=(n=n+Math.imul(B,ue)|0)+Math.imul(D,ce)|0,i=i+Math.imul(D,ue)|0,o=o+Math.imul(C,de)|0,n=(n=n+Math.imul(C,pe)|0)+Math.imul(P,de)|0,i=i+Math.imul(P,pe)|0;var xe=(u+(o=o+Math.imul(S,fe)|0)|0)+((8191&(n=(n=n+Math.imul(S,me)|0)+Math.imul(R,fe)|0))<<13)|0;u=((i=i+Math.imul(R,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,o=Math.imul(L,ce),n=(n=Math.imul(L,ue))+Math.imul(j,ce)|0,i=Math.imul(j,ue),o=o+Math.imul(B,de)|0,n=(n=n+Math.imul(B,pe)|0)+Math.imul(D,de)|0,i=i+Math.imul(D,pe)|0;var Ce=(u+(o=o+Math.imul(C,fe)|0)|0)+((8191&(n=(n=n+Math.imul(C,me)|0)+Math.imul(P,fe)|0))<<13)|0;u=((i=i+Math.imul(P,me)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,o=Math.imul(L,de),n=(n=Math.imul(L,pe))+Math.imul(j,de)|0,i=Math.imul(j,pe);var Pe=(u+(o=o+Math.imul(B,fe)|0)|0)+((8191&(n=(n=n+Math.imul(B,me)|0)+Math.imul(D,fe)|0))<<13)|0;u=((i=i+Math.imul(D,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Ne=(u+(o=Math.imul(L,fe))|0)+((8191&(n=(n=Math.imul(L,me))+Math.imul(j,fe)|0))<<13)|0;return u=((i=Math.imul(j,me))+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=ye,c[1]=ge,c[2]=be,c[3]=ve,c[4]=we,c[5]=$e,c[6]=ke,c[7]=_e,c[8]=Te,c[9]=Ie,c[10]=Ae,c[11]=Oe,c[12]=Ee,c[13]=Se,c[14]=Re,c[15]=xe,c[16]=Ce,c[17]=Pe,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function f(e,t,r){return(new m).mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(h=p),n.prototype.mulTo=function(e,t){var r,o=this.length+e.length;return r=10===this.length&&10===e.length?h(this,e,t):o<63?p(this,e,t):o<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var o=0,n=0,i=0;i<r.length-1;i++){var a=n;n=0;for(var s=67108863&o,c=Math.min(i,t.length-1),u=Math.max(0,i-e.length+1);u<=c;u++){var l=i-u,d=(0|e.words[l])*(0|t.words[u]),p=67108863&d;s=67108863&(p=p+s|0),n+=(a=(a=a+(d/67108864|0)|0)+(p>>>26)|0)>>>26,a&=67108863}r.words[i]=s,o=a,a=n}return 0!==o?r.words[i]=o:r.length--,r.strip()}(this,e,t):f(this,e,t),r},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=n.prototype._countBits(e)-1,o=0;o<e;o++)t[o]=this.revBin(o,r,e);return t},m.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var o=0,n=0;n<t;n++)o|=(1&e)<<t-n-1,e>>=1;return o},m.prototype.permute=function(e,t,r,o,n,i){for(var a=0;a<i;a++)o[a]=t[e[a]],n[a]=r[e[a]]},m.prototype.transform=function(e,t,r,o,n,i){this.permute(i,e,t,r,o,n);for(var a=1;a<n;a<<=1)for(var s=a<<1,c=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),l=0;l<n;l+=s)for(var d=c,p=u,h=0;h<a;h++){var f=r[l+h],m=o[l+h],y=r[l+h+a],g=o[l+h+a],b=d*y-p*g;g=d*g+p*y,y=b,r[l+h]=f+y,o[l+h]=m+g,r[l+h+a]=f-y,o[l+h+a]=m-g,h!==s&&(b=c*d-u*p,p=c*p+u*d,d=b)}},m.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),o=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+o},m.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var o=0;o<r/2;o++){var n=e[o];e[o]=e[r-o-1],e[r-o-1]=n,n=t[o],t[o]=-t[r-o-1],t[r-o-1]=-n}},m.prototype.normalize13b=function(e,t){for(var r=0,o=0;o<t/2;o++){var n=8192*Math.round(e[2*o+1]/t)+Math.round(e[2*o]/t)+r;e[o]=67108863&n,r=n<67108864?0:n/67108864|0}return e},m.prototype.convert13b=function(e,t,o,n){for(var i=0,a=0;a<t;a++)i+=0|e[a],o[2*a]=8191&i,i>>>=13,o[2*a+1]=8191&i,i>>>=13;for(a=2*t;a<n;++a)o[a]=0;r(0===i),r(!(-8192&i))},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 o=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(o),i=this.stub(o),a=new Array(o),s=new Array(o),c=new Array(o),u=new Array(o),l=new Array(o),d=new Array(o),p=r.words;p.length=o,this.convert13b(e.words,e.length,a,o),this.convert13b(t.words,t.length,u,o),this.transform(a,i,s,c,o,n),this.transform(u,i,l,d,o,n);for(var h=0;h<o;h++){var f=s[h]*l[h]-c[h]*d[h];c[h]=s[h]*d[h]+c[h]*l[h],s[h]=f}return this.conjugate(s,c,o),this.transform(s,c,p,i,o,n),this.conjugate(p,i,o),this.normalize13b(p,o),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},n.prototype.mul=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},n.prototype.mulf=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),f(this,e,t)},n.prototype.imul=function(e){return this.clone().mulTo(e,this)},n.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,o=0;o<this.length;o++){var n=(0|this.words[o])*e,i=(67108863&n)+(67108863&t);t>>=26,t+=n/67108864|0,t+=i>>>26,this.words[o]=67108863&i}return 0!==t&&(this.words[o]=t,this.length++),this},n.prototype.muln=function(e){return this.clone().imuln(e)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var o=r/26|0,n=r%26;t[r]=(e.words[o]&1<<n)>>>n}return t}(e);if(0===t.length)return new n(1);for(var r=this,o=0;o<t.length&&0===t[o];o++,r=r.sqr());if(++o<t.length)for(var i=r.sqr();o<t.length;o++,i=i.sqr())0!==t[o]&&(r=r.mul(i));return r},n.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,o=e%26,n=(e-o)/26,i=67108863>>>26-o<<26-o;if(0!==o){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&i,c=(0|this.words[t])-s<<o;this.words[t]=c|a,a=s>>>26-o}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()},n.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},n.prototype.iushrn=function(e,t,o){var n;r("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var i=e%26,a=Math.min((e-i)/26,this.length),s=67108863^67108863>>>i<<i,c=o;if(n-=a,n=Math.max(0,n),c){for(var u=0;u<a;u++)c.words[u]=this.words[u];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var d=0|this.words[u];this.words[u]=l<<26-i|d>>>i,l=d&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(e,t,o){return r(0===this.negative),this.iushrn(e,t,o)},n.prototype.shln=function(e){return this.clone().ishln(e)},n.prototype.ushln=function(e){return this.clone().iushln(e)},n.prototype.shrn=function(e){return this.clone().ishrn(e)},n.prototype.ushrn=function(e){return this.clone().iushrn(e)},n.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26,n=1<<t;return!(this.length<=o||!(this.words[o]&n))},n.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=o)return this;if(0!==t&&o++,this.length=Math.min(o,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(e){return this.clone().imaskn(e)},n.prototype.iaddn=function(e){return r("number"==typeof e),r(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)},n.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},n.prototype.isubn=function(e){if(r("number"==typeof e),r(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()},n.prototype.addn=function(e){return this.clone().iaddn(e)},n.prototype.subn=function(e){return this.clone().isubn(e)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(e,t,o){var n,i,a=e.length+o;this._expand(a);var s=0;for(n=0;n<e.length;n++){i=(0|this.words[n+o])+s;var c=(0|e.words[n])*t;s=((i-=67108863&c)>>26)-(c/67108864|0),this.words[n+o]=67108863&i}for(;n<this.length-o;n++)s=(i=(0|this.words[n+o])+s)>>26,this.words[n+o]=67108863&i;if(0===s)return this.strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(i=-(0|this.words[n])+s)>>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},n.prototype._wordDiv=function(e,t){var r=(this.length,e.length),o=this.clone(),i=e,a=0|i.words[i.length-1];0!=(r=26-this._countBits(a))&&(i=i.ushln(r),o.iushln(r),a=0|i.words[i.length-1]);var s,c=o.length-i.length;if("mod"!==t){(s=new n(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=o.clone()._ishlnsubmul(i,1,c);0===l.negative&&(o=l,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var p=67108864*(0|o.words[i.length+d])+(0|o.words[i.length+d-1]);for(p=Math.min(p/a|0,67108863),o._ishlnsubmul(i,p,d);0!==o.negative;)p--,o.negative=0,o._ishlnsubmul(i,1,d),o.isZero()||(o.negative^=1);s&&(s.words[d]=p)}return s&&s.strip(),o.strip(),"div"!==t&&0!==r&&o.iushrn(r),{div:s||null,mod:o}},n.prototype.divmod=function(e,t,o){return r(!e.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new n(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new n(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new n(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},n.prototype.div=function(e){return this.divmod(e,"div",!1).div},n.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},n.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},n.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,o=e.ushrn(1),n=e.andln(1),i=r.cmp(o);return i<0||1===n&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},n.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,o=0,n=this.length-1;n>=0;n--)o=(t*o+(0|this.words[n]))%e;return o},n.prototype.idivn=function(e){r(e<=67108863);for(var t=0,o=this.length-1;o>=0;o--){var n=(0|this.words[o])+67108864*t;this.words[o]=n/e|0,t=n%e}return this.strip()},n.prototype.divn=function(e){return this.clone().idivn(e)},n.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new n(1),a=new n(0),s=new n(0),c=new n(1),u=0;t.isEven()&&o.isEven();)t.iushrn(1),o.iushrn(1),++u;for(var l=o.clone(),d=t.clone();!t.isZero();){for(var p=0,h=1;!(t.words[0]&h)&&p<26;++p,h<<=1);if(p>0)for(t.iushrn(p);p-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var f=0,m=1;!(o.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(o.iushrn(f);f-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(o)>=0?(t.isub(o),i.isub(s),a.isub(c)):(o.isub(t),s.isub(i),c.isub(a))}return{a:s,b:c,gcd:o.iushln(u)}},n.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new n(1),s=new n(0),c=o.clone();t.cmpn(1)>0&&o.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,p=1;!(o.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(o.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(o)>=0?(t.isub(o),a.isub(s)):(o.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},n.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 o=0;t.isEven()&&r.isEven();o++)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 i=t;t=r,r=i}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(o)},n.prototype.invm=function(e){return this.egcd(e).a.umod(e)},n.prototype.isEven=function(){return!(1&this.words[0])},n.prototype.isOdd=function(){return!(1&~this.words[0])},n.prototype.andln=function(e){return this.words[0]&e},n.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,o=(e-t)/26,n=1<<t;if(this.length<=o)return this._expand(o+1),this.words[o]|=n,this;for(var i=n,a=o;0!==i&&a<this.length;a++){var s=0|this.words[a];i=(s+=i)>>>26,s&=67108863,this.words[a]=s}return 0!==i&&(this.words[a]=i,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(e){var t,o=e<0;if(0!==this.negative&&!o)return-1;if(0===this.negative&&o)return 1;if(this.strip(),this.length>1)t=1;else{o&&(e=-e),r(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},n.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},n.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 o=0|this.words[r],n=0|e.words[r];if(o!==n){o<n?t=-1:o>n&&(t=1);break}}return t},n.prototype.gtn=function(e){return 1===this.cmpn(e)},n.prototype.gt=function(e){return 1===this.cmp(e)},n.prototype.gten=function(e){return this.cmpn(e)>=0},n.prototype.gte=function(e){return this.cmp(e)>=0},n.prototype.ltn=function(e){return-1===this.cmpn(e)},n.prototype.lt=function(e){return-1===this.cmp(e)},n.prototype.lten=function(e){return this.cmpn(e)<=0},n.prototype.lte=function(e){return this.cmp(e)<=0},n.prototype.eqn=function(e){return 0===this.cmpn(e)},n.prototype.eq=function(e){return 0===this.cmp(e)},n.red=function(e){return new k(e)},n.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(e){return this.red=e,this},n.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},n.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},n.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},n.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},n.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},n.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},n.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},n.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function g(e,t){this.name=e,this.p=new n(t,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function $(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(e){if("string"==typeof e){var t=n._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function _(e){k.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}g.prototype._tmp=function(){var e=new n(null);return e.words=new Array(Math.ceil(this.n/13)),e},g.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 o=t<this.n?-1:r.ucmp(this.p);return 0===o?(r.words[0]=0,r.length=1):o>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(e,t){e.iushrn(this.n,0,t)},g.prototype.imulK=function(e){return e.imul(this.k)},o(b,g),b.prototype.split=function(e,t){for(var r=4194303,o=Math.min(e.length,9),n=0;n<o;n++)t.words[n]=e.words[n];if(t.length=o,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=i&r,n=10;n<e.length;n++){var a=0|e.words[n];e.words[n-10]=(a&r)<<4|i>>>22,i=a}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},b.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 o=0|e.words[r];t+=977*o,e.words[r]=67108863&t,t=64*o+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},o(v,g),o(w,g),o($,g),$.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var o=19*(0|e.words[r])+t,n=67108863&o;o>>>=26,e.words[r]=n,t=o}return 0!==t&&(e.words[e.length++]=t),e},n._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new $}return y[e]=t,t},k.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},k.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},k.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},k.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},k.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},k.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},k.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},k.prototype.isqr=function(e){return this.imul(e,e.clone())},k.prototype.sqr=function(e){return this.mul(e,e)},k.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var o=this.m.add(new n(1)).iushrn(2);return this.pow(e,o)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new n(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),p=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),f=a;0!==h.cmp(s);){for(var m=h,y=0;0!==m.cmp(s);y++)m=m.redSqr();r(y<f);var g=this.pow(d,new n(1).iushln(f-y-1));p=p.redMul(g),d=g.redSqr(),h=h.redMul(d),f=y}return p},k.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},k.prototype.pow=function(e,t){if(t.isZero())return new n(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=e;for(var o=2;o<r.length;o++)r[o]=this.mul(r[o-1],e);var i=r[0],a=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),o=t.length-1;o>=0;o--){for(var u=t.words[o],l=c-1;l>=0;l--){var d=u>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===o&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}c=26}return i},k.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},k.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},n.mont=function(e){return new _(e)},o(_,k),_.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},_.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},_.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(o).iushrn(this.shift),i=n;return n.cmp(this.m)>=0?i=n.isub(this.m):n.cmpn(0)<0&&(i=n.iadd(this.m)),i._forceRed(this)},_.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new n(0)._forceRed(this);var r=e.mul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(o).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},_.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(bn$6,commonjsGlobal)),bn$6.exports}bn$6.exports;var bn$5={exports:{}},hasRequiredBn$3;function requireBn$3(){return hasRequiredBn$3||(hasRequiredBn$3=1,function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function o(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function n(e,t,r){if(n.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 i;"object"==typeof e?e.exports=n:t.BN=n,n.BN=n,n.wordSize=26;try{i="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require$$0$2.Buffer}catch(T){}function a(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(e,t,r){var o=a(e,r);return r-1>=t&&(o|=a(e,r-1)<<4),o}function c(e,t,r,o){for(var n=0,i=Math.min(e.length,r),a=t;a<i;a++){var s=e.charCodeAt(a)-48;n*=o,n+=s>=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(e){return e instanceof n||null!==e&&"object"==typeof e&&e.constructor.wordSize===n.wordSize&&Array.isArray(e.words)},n.max=function(e,t){return e.cmp(t)>0?e:t},n.min=function(e,t){return e.cmp(t)<0?e:t},n.prototype._init=function(e,t,o){if("number"==typeof e)return this._initNumber(e,t,o);if("object"==typeof e)return this._initArray(e,t,o);"hex"===t&&(t=16),r(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,o):(this._parseBase(e,t,n),"le"===o&&this._initArray(this.toArray(),t,o)))},n.prototype._initNumber=function(e,t,o){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):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===o&&this._initArray(this.toArray(),t,o)},n.prototype._initArray=function(e,t,o){if(r("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 i,a,s=0;if("be"===o)for(n=e.length-1,i=0;n>=0;n-=3)a=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===o)for(n=0,i=0;n<e.length;n+=3)a=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this.strip()},n.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var n,i=0,a=0;if("be"===r)for(o=e.length-1;o>=t;o-=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;else for(o=(e.length-t)%2==0?t+1:t;o<e.length;o+=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;this.strip()},n.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var o=0,n=1;n<=67108863;n*=t)o++;o--,n=n/t|0;for(var i=e.length-r,a=i%o,s=Math.min(i,i-a)+r,u=0,l=r;l<s;l+=o)u=c(e,l,l+o,t),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var d=1;for(u=c(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.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},n.prototype.clone=function(){var e=new n(null);return this.copy(e),e},n.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","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"],l=[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],d=[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 p(e,t,r){r.negative=t.negative^e.negative;var o=e.length+t.length|0;r.length=o,o=o-1|0;var n=0|e.words[0],i=0|t.words[0],a=n*i,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u<o;u++){for(var l=c>>>26,d=67108863&c,p=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=p;h++){var f=u-h|0;l+=(a=(n=0|e.words[f])*(i=0|t.words[h])+d)/67108864|0,d=67108863&a}r.words[u]=0|d,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}n.prototype.toString=function(e,t){var o;if(t=0|t||1,16===(e=e||10)||"hex"===e){o="";for(var n=0,i=0,a=0;a<this.length;a++){var s=this.words[a],c=(16777215&(s<<n|i)).toString(16);i=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),o=0!==i||a!==this.length-1?u[6-c.length]+c+o:c+o}for(0!==i&&(o=i.toString(16)+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}if(e===(0|e)&&e>=2&&e<=36){var p=l[e],h=d[e];o="";var f=this.clone();for(f.negative=0;!f.isZero();){var m=f.modn(h).toString(e);o=(f=f.idivn(h)).isZero()?m+o:u[p-m.length]+m+o}for(this.isZero()&&(o="0"+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}r(!1,"Base should be between 2 and 36")},n.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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(e,t){return r(void 0!==i),this.toArrayLike(i,e,t)},n.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},n.prototype.toArrayLike=function(e,t,o){var n=this.byteLength(),i=o||Math.max(1,n);r(n<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===t,u=new e(i),l=this.clone();if(c){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[s]=a;for(;s<i;s++)u[s]=0}else{for(s=0;s<i-n;s++)u[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[i-s-1]=a}return u},Math.clz32?n.prototype._countBits=function(e){return 32-Math.clz32(e)}:n.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},n.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},n.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},n.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},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},n.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(e){return r(!(this.negative|e.negative)),this.iuor(e)},n.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},n.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},n.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()},n.prototype.iand=function(e){return r(!(this.negative|e.negative)),this.iuand(e)},n.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},n.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},n.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var o=0;o<r.length;o++)this.words[o]=t.words[o]^r.words[o];if(this!==t)for(;o<t.length;o++)this.words[o]=t.words[o];return this.length=t.length,this.strip()},n.prototype.ixor=function(e){return r(!(this.negative|e.negative)),this.iuxor(e)},n.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},n.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},n.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),o=e%26;this._expand(t),o>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return o>0&&(this.words[n]=~this.words[n]&67108863>>26-o),this.strip()},n.prototype.notn=function(e){return this.clone().inotn(e)},n.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var o=e/26|0,n=e%26;return this._expand(o+1),this.words[o]=t?this.words[o]|1<<n:this.words[o]&~(1<<n),this.strip()},n.prototype.iadd=function(e){var t,r,o;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,o=e):(r=e,o=this);for(var n=0,i=0;i<o.length;i++)t=(0|r.words[i])+(0|o.words[i])+n,this.words[i]=67108863&t,n=t>>>26;for(;0!==n&&i<r.length;i++)t=(0|r.words[i])+n,this.words[i]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;i<r.length;i++)this.words[i]=r.words[i];return this},n.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)},n.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,o,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,o=e):(r=e,o=this);for(var i=0,a=0;a<o.length;a++)i=(t=(0|r.words[a])-(0|o.words[a])+i)>>26,this.words[a]=67108863&t;for(;0!==i&&a<r.length;a++)i=(t=(0|r.words[a])+i)>>26,this.words[a]=67108863&t;if(0===i&&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()},n.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,r){var o,n,i,a=e.words,s=t.words,c=r.words,u=0,l=0|a[0],d=8191&l,p=l>>>13,h=0|a[1],f=8191&h,m=h>>>13,y=0|a[2],g=8191&y,b=y>>>13,v=0|a[3],w=8191&v,$=v>>>13,k=0|a[4],_=8191&k,T=k>>>13,I=0|a[5],A=8191&I,O=I>>>13,E=0|a[6],S=8191&E,R=E>>>13,x=0|a[7],C=8191&x,P=x>>>13,N=0|a[8],B=8191&N,D=N>>>13,M=0|a[9],L=8191&M,j=M>>>13,F=0|s[0],U=8191&F,K=F>>>13,q=0|s[1],G=8191&q,H=q>>>13,V=0|s[2],W=8191&V,z=V>>>13,Z=0|s[3],Q=8191&Z,Y=Z>>>13,X=0|s[4],J=8191&X,ee=X>>>13,te=0|s[5],re=8191&te,oe=te>>>13,ne=0|s[6],ie=8191&ne,ae=ne>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],de=8191&le,pe=le>>>13,he=0|s[9],fe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(u+(o=Math.imul(d,U))|0)+((8191&(n=(n=Math.imul(d,K))+Math.imul(p,U)|0))<<13)|0;u=((i=Math.imul(p,K))+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,o=Math.imul(f,U),n=(n=Math.imul(f,K))+Math.imul(m,U)|0,i=Math.imul(m,K);var ge=(u+(o=o+Math.imul(d,G)|0)|0)+((8191&(n=(n=n+Math.imul(d,H)|0)+Math.imul(p,G)|0))<<13)|0;u=((i=i+Math.imul(p,H)|0)+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,o=Math.imul(g,U),n=(n=Math.imul(g,K))+Math.imul(b,U)|0,i=Math.imul(b,K),o=o+Math.imul(f,G)|0,n=(n=n+Math.imul(f,H)|0)+Math.imul(m,G)|0,i=i+Math.imul(m,H)|0;var be=(u+(o=o+Math.imul(d,W)|0)|0)+((8191&(n=(n=n+Math.imul(d,z)|0)+Math.imul(p,W)|0))<<13)|0;u=((i=i+Math.imul(p,z)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,o=Math.imul(w,U),n=(n=Math.imul(w,K))+Math.imul($,U)|0,i=Math.imul($,K),o=o+Math.imul(g,G)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(b,G)|0,i=i+Math.imul(b,H)|0,o=o+Math.imul(f,W)|0,n=(n=n+Math.imul(f,z)|0)+Math.imul(m,W)|0,i=i+Math.imul(m,z)|0;var ve=(u+(o=o+Math.imul(d,Q)|0)|0)+((8191&(n=(n=n+Math.imul(d,Y)|0)+Math.imul(p,Q)|0))<<13)|0;u=((i=i+Math.imul(p,Y)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,o=Math.imul(_,U),n=(n=Math.imul(_,K))+Math.imul(T,U)|0,i=Math.imul(T,K),o=o+Math.imul(w,G)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul($,G)|0,i=i+Math.imul($,H)|0,o=o+Math.imul(g,W)|0,n=(n=n+Math.imul(g,z)|0)+Math.imul(b,W)|0,i=i+Math.imul(b,z)|0,o=o+Math.imul(f,Q)|0,n=(n=n+Math.imul(f,Y)|0)+Math.imul(m,Q)|0,i=i+Math.imul(m,Y)|0;var we=(u+(o=o+Math.imul(d,J)|0)|0)+((8191&(n=(n=n+Math.imul(d,ee)|0)+Math.imul(p,J)|0))<<13)|0;u=((i=i+Math.imul(p,ee)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,o=Math.imul(A,U),n=(n=Math.imul(A,K))+Math.imul(O,U)|0,i=Math.imul(O,K),o=o+Math.imul(_,G)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(T,G)|0,i=i+Math.imul(T,H)|0,o=o+Math.imul(w,W)|0,n=(n=n+Math.imul(w,z)|0)+Math.imul($,W)|0,i=i+Math.imul($,z)|0,o=o+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(b,Q)|0,i=i+Math.imul(b,Y)|0,o=o+Math.imul(f,J)|0,n=(n=n+Math.imul(f,ee)|0)+Math.imul(m,J)|0,i=i+Math.imul(m,ee)|0;var $e=(u+(o=o+Math.imul(d,re)|0)|0)+((8191&(n=(n=n+Math.imul(d,oe)|0)+Math.imul(p,re)|0))<<13)|0;u=((i=i+Math.imul(p,oe)|0)+(n>>>13)|0)+($e>>>26)|0,$e&=67108863,o=Math.imul(S,U),n=(n=Math.imul(S,K))+Math.imul(R,U)|0,i=Math.imul(R,K),o=o+Math.imul(A,G)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(O,G)|0,i=i+Math.imul(O,H)|0,o=o+Math.imul(_,W)|0,n=(n=n+Math.imul(_,z)|0)+Math.imul(T,W)|0,i=i+Math.imul(T,z)|0,o=o+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul($,Q)|0,i=i+Math.imul($,Y)|0,o=o+Math.imul(g,J)|0,n=(n=n+Math.imul(g,ee)|0)+Math.imul(b,J)|0,i=i+Math.imul(b,ee)|0,o=o+Math.imul(f,re)|0,n=(n=n+Math.imul(f,oe)|0)+Math.imul(m,re)|0,i=i+Math.imul(m,oe)|0;var ke=(u+(o=o+Math.imul(d,ie)|0)|0)+((8191&(n=(n=n+Math.imul(d,ae)|0)+Math.imul(p,ie)|0))<<13)|0;u=((i=i+Math.imul(p,ae)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,o=Math.imul(C,U),n=(n=Math.imul(C,K))+Math.imul(P,U)|0,i=Math.imul(P,K),o=o+Math.imul(S,G)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,G)|0,i=i+Math.imul(R,H)|0,o=o+Math.imul(A,W)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(O,W)|0,i=i+Math.imul(O,z)|0,o=o+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(T,Q)|0,i=i+Math.imul(T,Y)|0,o=o+Math.imul(w,J)|0,n=(n=n+Math.imul(w,ee)|0)+Math.imul($,J)|0,i=i+Math.imul($,ee)|0,o=o+Math.imul(g,re)|0,n=(n=n+Math.imul(g,oe)|0)+Math.imul(b,re)|0,i=i+Math.imul(b,oe)|0,o=o+Math.imul(f,ie)|0,n=(n=n+Math.imul(f,ae)|0)+Math.imul(m,ie)|0,i=i+Math.imul(m,ae)|0;var _e=(u+(o=o+Math.imul(d,ce)|0)|0)+((8191&(n=(n=n+Math.imul(d,ue)|0)+Math.imul(p,ce)|0))<<13)|0;u=((i=i+Math.imul(p,ue)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,o=Math.imul(B,U),n=(n=Math.imul(B,K))+Math.imul(D,U)|0,i=Math.imul(D,K),o=o+Math.imul(C,G)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(P,G)|0,i=i+Math.imul(P,H)|0,o=o+Math.imul(S,W)|0,n=(n=n+Math.imul(S,z)|0)+Math.imul(R,W)|0,i=i+Math.imul(R,z)|0,o=o+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,Q)|0,i=i+Math.imul(O,Y)|0,o=o+Math.imul(_,J)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(T,J)|0,i=i+Math.imul(T,ee)|0,o=o+Math.imul(w,re)|0,n=(n=n+Math.imul(w,oe)|0)+Math.imul($,re)|0,i=i+Math.imul($,oe)|0,o=o+Math.imul(g,ie)|0,n=(n=n+Math.imul(g,ae)|0)+Math.imul(b,ie)|0,i=i+Math.imul(b,ae)|0,o=o+Math.imul(f,ce)|0,n=(n=n+Math.imul(f,ue)|0)+Math.imul(m,ce)|0,i=i+Math.imul(m,ue)|0;var Te=(u+(o=o+Math.imul(d,de)|0)|0)+((8191&(n=(n=n+Math.imul(d,pe)|0)+Math.imul(p,de)|0))<<13)|0;u=((i=i+Math.imul(p,pe)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,o=Math.imul(L,U),n=(n=Math.imul(L,K))+Math.imul(j,U)|0,i=Math.imul(j,K),o=o+Math.imul(B,G)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(D,G)|0,i=i+Math.imul(D,H)|0,o=o+Math.imul(C,W)|0,n=(n=n+Math.imul(C,z)|0)+Math.imul(P,W)|0,i=i+Math.imul(P,z)|0,o=o+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(R,Q)|0,i=i+Math.imul(R,Y)|0,o=o+Math.imul(A,J)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(O,J)|0,i=i+Math.imul(O,ee)|0,o=o+Math.imul(_,re)|0,n=(n=n+Math.imul(_,oe)|0)+Math.imul(T,re)|0,i=i+Math.imul(T,oe)|0,o=o+Math.imul(w,ie)|0,n=(n=n+Math.imul(w,ae)|0)+Math.imul($,ie)|0,i=i+Math.imul($,ae)|0,o=o+Math.imul(g,ce)|0,n=(n=n+Math.imul(g,ue)|0)+Math.imul(b,ce)|0,i=i+Math.imul(b,ue)|0,o=o+Math.imul(f,de)|0,n=(n=n+Math.imul(f,pe)|0)+Math.imul(m,de)|0,i=i+Math.imul(m,pe)|0;var Ie=(u+(o=o+Math.imul(d,fe)|0)|0)+((8191&(n=(n=n+Math.imul(d,me)|0)+Math.imul(p,fe)|0))<<13)|0;u=((i=i+Math.imul(p,me)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,o=Math.imul(L,G),n=(n=Math.imul(L,H))+Math.imul(j,G)|0,i=Math.imul(j,H),o=o+Math.imul(B,W)|0,n=(n=n+Math.imul(B,z)|0)+Math.imul(D,W)|0,i=i+Math.imul(D,z)|0,o=o+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,Y)|0,o=o+Math.imul(S,J)|0,n=(n=n+Math.imul(S,ee)|0)+Math.imul(R,J)|0,i=i+Math.imul(R,ee)|0,o=o+Math.imul(A,re)|0,n=(n=n+Math.imul(A,oe)|0)+Math.imul(O,re)|0,i=i+Math.imul(O,oe)|0,o=o+Math.imul(_,ie)|0,n=(n=n+Math.imul(_,ae)|0)+Math.imul(T,ie)|0,i=i+Math.imul(T,ae)|0,o=o+Math.imul(w,ce)|0,n=(n=n+Math.imul(w,ue)|0)+Math.imul($,ce)|0,i=i+Math.imul($,ue)|0,o=o+Math.imul(g,de)|0,n=(n=n+Math.imul(g,pe)|0)+Math.imul(b,de)|0,i=i+Math.imul(b,pe)|0;var Ae=(u+(o=o+Math.imul(f,fe)|0)|0)+((8191&(n=(n=n+Math.imul(f,me)|0)+Math.imul(m,fe)|0))<<13)|0;u=((i=i+Math.imul(m,me)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,o=Math.imul(L,W),n=(n=Math.imul(L,z))+Math.imul(j,W)|0,i=Math.imul(j,z),o=o+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(D,Q)|0,i=i+Math.imul(D,Y)|0,o=o+Math.imul(C,J)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(P,J)|0,i=i+Math.imul(P,ee)|0,o=o+Math.imul(S,re)|0,n=(n=n+Math.imul(S,oe)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,oe)|0,o=o+Math.imul(A,ie)|0,n=(n=n+Math.imul(A,ae)|0)+Math.imul(O,ie)|0,i=i+Math.imul(O,ae)|0,o=o+Math.imul(_,ce)|0,n=(n=n+Math.imul(_,ue)|0)+Math.imul(T,ce)|0,i=i+Math.imul(T,ue)|0,o=o+Math.imul(w,de)|0,n=(n=n+Math.imul(w,pe)|0)+Math.imul($,de)|0,i=i+Math.imul($,pe)|0;var Oe=(u+(o=o+Math.imul(g,fe)|0)|0)+((8191&(n=(n=n+Math.imul(g,me)|0)+Math.imul(b,fe)|0))<<13)|0;u=((i=i+Math.imul(b,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,o=Math.imul(L,Q),n=(n=Math.imul(L,Y))+Math.imul(j,Q)|0,i=Math.imul(j,Y),o=o+Math.imul(B,J)|0,n=(n=n+Math.imul(B,ee)|0)+Math.imul(D,J)|0,i=i+Math.imul(D,ee)|0,o=o+Math.imul(C,re)|0,n=(n=n+Math.imul(C,oe)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,oe)|0,o=o+Math.imul(S,ie)|0,n=(n=n+Math.imul(S,ae)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,ae)|0,o=o+Math.imul(A,ce)|0,n=(n=n+Math.imul(A,ue)|0)+Math.imul(O,ce)|0,i=i+Math.imul(O,ue)|0,o=o+Math.imul(_,de)|0,n=(n=n+Math.imul(_,pe)|0)+Math.imul(T,de)|0,i=i+Math.imul(T,pe)|0;var Ee=(u+(o=o+Math.imul(w,fe)|0)|0)+((8191&(n=(n=n+Math.imul(w,me)|0)+Math.imul($,fe)|0))<<13)|0;u=((i=i+Math.imul($,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,o=Math.imul(L,J),n=(n=Math.imul(L,ee))+Math.imul(j,J)|0,i=Math.imul(j,ee),o=o+Math.imul(B,re)|0,n=(n=n+Math.imul(B,oe)|0)+Math.imul(D,re)|0,i=i+Math.imul(D,oe)|0,o=o+Math.imul(C,ie)|0,n=(n=n+Math.imul(C,ae)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,ae)|0,o=o+Math.imul(S,ce)|0,n=(n=n+Math.imul(S,ue)|0)+Math.imul(R,ce)|0,i=i+Math.imul(R,ue)|0,o=o+Math.imul(A,de)|0,n=(n=n+Math.imul(A,pe)|0)+Math.imul(O,de)|0,i=i+Math.imul(O,pe)|0;var Se=(u+(o=o+Math.imul(_,fe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(T,fe)|0))<<13)|0;u=((i=i+Math.imul(T,me)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,o=Math.imul(L,re),n=(n=Math.imul(L,oe))+Math.imul(j,re)|0,i=Math.imul(j,oe),o=o+Math.imul(B,ie)|0,n=(n=n+Math.imul(B,ae)|0)+Math.imul(D,ie)|0,i=i+Math.imul(D,ae)|0,o=o+Math.imul(C,ce)|0,n=(n=n+Math.imul(C,ue)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,ue)|0,o=o+Math.imul(S,de)|0,n=(n=n+Math.imul(S,pe)|0)+Math.imul(R,de)|0,i=i+Math.imul(R,pe)|0;var Re=(u+(o=o+Math.imul(A,fe)|0)|0)+((8191&(n=(n=n+Math.imul(A,me)|0)+Math.imul(O,fe)|0))<<13)|0;u=((i=i+Math.imul(O,me)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,o=Math.imul(L,ie),n=(n=Math.imul(L,ae))+Math.imul(j,ie)|0,i=Math.imul(j,ae),o=o+Math.imul(B,ce)|0,n=(n=n+Math.imul(B,ue)|0)+Math.imul(D,ce)|0,i=i+Math.imul(D,ue)|0,o=o+Math.imul(C,de)|0,n=(n=n+Math.imul(C,pe)|0)+Math.imul(P,de)|0,i=i+Math.imul(P,pe)|0;var xe=(u+(o=o+Math.imul(S,fe)|0)|0)+((8191&(n=(n=n+Math.imul(S,me)|0)+Math.imul(R,fe)|0))<<13)|0;u=((i=i+Math.imul(R,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,o=Math.imul(L,ce),n=(n=Math.imul(L,ue))+Math.imul(j,ce)|0,i=Math.imul(j,ue),o=o+Math.imul(B,de)|0,n=(n=n+Math.imul(B,pe)|0)+Math.imul(D,de)|0,i=i+Math.imul(D,pe)|0;var Ce=(u+(o=o+Math.imul(C,fe)|0)|0)+((8191&(n=(n=n+Math.imul(C,me)|0)+Math.imul(P,fe)|0))<<13)|0;u=((i=i+Math.imul(P,me)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,o=Math.imul(L,de),n=(n=Math.imul(L,pe))+Math.imul(j,de)|0,i=Math.imul(j,pe);var Pe=(u+(o=o+Math.imul(B,fe)|0)|0)+((8191&(n=(n=n+Math.imul(B,me)|0)+Math.imul(D,fe)|0))<<13)|0;u=((i=i+Math.imul(D,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Ne=(u+(o=Math.imul(L,fe))|0)+((8191&(n=(n=Math.imul(L,me))+Math.imul(j,fe)|0))<<13)|0;return u=((i=Math.imul(j,me))+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=ye,c[1]=ge,c[2]=be,c[3]=ve,c[4]=we,c[5]=$e,c[6]=ke,c[7]=_e,c[8]=Te,c[9]=Ie,c[10]=Ae,c[11]=Oe,c[12]=Ee,c[13]=Se,c[14]=Re,c[15]=xe,c[16]=Ce,c[17]=Pe,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function f(e,t,r){return(new m).mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(h=p),n.prototype.mulTo=function(e,t){var r,o=this.length+e.length;return r=10===this.length&&10===e.length?h(this,e,t):o<63?p(this,e,t):o<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var o=0,n=0,i=0;i<r.length-1;i++){var a=n;n=0;for(var s=67108863&o,c=Math.min(i,t.length-1),u=Math.max(0,i-e.length+1);u<=c;u++){var l=i-u,d=(0|e.words[l])*(0|t.words[u]),p=67108863&d;s=67108863&(p=p+s|0),n+=(a=(a=a+(d/67108864|0)|0)+(p>>>26)|0)>>>26,a&=67108863}r.words[i]=s,o=a,a=n}return 0!==o?r.words[i]=o:r.length--,r.strip()}(this,e,t):f(this,e,t),r},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=n.prototype._countBits(e)-1,o=0;o<e;o++)t[o]=this.revBin(o,r,e);return t},m.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var o=0,n=0;n<t;n++)o|=(1&e)<<t-n-1,e>>=1;return o},m.prototype.permute=function(e,t,r,o,n,i){for(var a=0;a<i;a++)o[a]=t[e[a]],n[a]=r[e[a]]},m.prototype.transform=function(e,t,r,o,n,i){this.permute(i,e,t,r,o,n);for(var a=1;a<n;a<<=1)for(var s=a<<1,c=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),l=0;l<n;l+=s)for(var d=c,p=u,h=0;h<a;h++){var f=r[l+h],m=o[l+h],y=r[l+h+a],g=o[l+h+a],b=d*y-p*g;g=d*g+p*y,y=b,r[l+h]=f+y,o[l+h]=m+g,r[l+h+a]=f-y,o[l+h+a]=m-g,h!==s&&(b=c*d-u*p,p=c*p+u*d,d=b)}},m.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),o=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+o},m.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var o=0;o<r/2;o++){var n=e[o];e[o]=e[r-o-1],e[r-o-1]=n,n=t[o],t[o]=-t[r-o-1],t[r-o-1]=-n}},m.prototype.normalize13b=function(e,t){for(var r=0,o=0;o<t/2;o++){var n=8192*Math.round(e[2*o+1]/t)+Math.round(e[2*o]/t)+r;e[o]=67108863&n,r=n<67108864?0:n/67108864|0}return e},m.prototype.convert13b=function(e,t,o,n){for(var i=0,a=0;a<t;a++)i+=0|e[a],o[2*a]=8191&i,i>>>=13,o[2*a+1]=8191&i,i>>>=13;for(a=2*t;a<n;++a)o[a]=0;r(0===i),r(!(-8192&i))},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 o=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(o),i=this.stub(o),a=new Array(o),s=new Array(o),c=new Array(o),u=new Array(o),l=new Array(o),d=new Array(o),p=r.words;p.length=o,this.convert13b(e.words,e.length,a,o),this.convert13b(t.words,t.length,u,o),this.transform(a,i,s,c,o,n),this.transform(u,i,l,d,o,n);for(var h=0;h<o;h++){var f=s[h]*l[h]-c[h]*d[h];c[h]=s[h]*d[h]+c[h]*l[h],s[h]=f}return this.conjugate(s,c,o),this.transform(s,c,p,i,o,n),this.conjugate(p,i,o),this.normalize13b(p,o),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},n.prototype.mul=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},n.prototype.mulf=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),f(this,e,t)},n.prototype.imul=function(e){return this.clone().mulTo(e,this)},n.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,o=0;o<this.length;o++){var n=(0|this.words[o])*e,i=(67108863&n)+(67108863&t);t>>=26,t+=n/67108864|0,t+=i>>>26,this.words[o]=67108863&i}return 0!==t&&(this.words[o]=t,this.length++),this},n.prototype.muln=function(e){return this.clone().imuln(e)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var o=r/26|0,n=r%26;t[r]=(e.words[o]&1<<n)>>>n}return t}(e);if(0===t.length)return new n(1);for(var r=this,o=0;o<t.length&&0===t[o];o++,r=r.sqr());if(++o<t.length)for(var i=r.sqr();o<t.length;o++,i=i.sqr())0!==t[o]&&(r=r.mul(i));return r},n.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,o=e%26,n=(e-o)/26,i=67108863>>>26-o<<26-o;if(0!==o){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&i,c=(0|this.words[t])-s<<o;this.words[t]=c|a,a=s>>>26-o}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()},n.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},n.prototype.iushrn=function(e,t,o){var n;r("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var i=e%26,a=Math.min((e-i)/26,this.length),s=67108863^67108863>>>i<<i,c=o;if(n-=a,n=Math.max(0,n),c){for(var u=0;u<a;u++)c.words[u]=this.words[u];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var d=0|this.words[u];this.words[u]=l<<26-i|d>>>i,l=d&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(e,t,o){return r(0===this.negative),this.iushrn(e,t,o)},n.prototype.shln=function(e){return this.clone().ishln(e)},n.prototype.ushln=function(e){return this.clone().iushln(e)},n.prototype.shrn=function(e){return this.clone().ishrn(e)},n.prototype.ushrn=function(e){return this.clone().iushrn(e)},n.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26,n=1<<t;return!(this.length<=o||!(this.words[o]&n))},n.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=o)return this;if(0!==t&&o++,this.length=Math.min(o,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(e){return this.clone().imaskn(e)},n.prototype.iaddn=function(e){return r("number"==typeof e),r(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)},n.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},n.prototype.isubn=function(e){if(r("number"==typeof e),r(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()},n.prototype.addn=function(e){return this.clone().iaddn(e)},n.prototype.subn=function(e){return this.clone().isubn(e)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(e,t,o){var n,i,a=e.length+o;this._expand(a);var s=0;for(n=0;n<e.length;n++){i=(0|this.words[n+o])+s;var c=(0|e.words[n])*t;s=((i-=67108863&c)>>26)-(c/67108864|0),this.words[n+o]=67108863&i}for(;n<this.length-o;n++)s=(i=(0|this.words[n+o])+s)>>26,this.words[n+o]=67108863&i;if(0===s)return this.strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(i=-(0|this.words[n])+s)>>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},n.prototype._wordDiv=function(e,t){var r=(this.length,e.length),o=this.clone(),i=e,a=0|i.words[i.length-1];0!=(r=26-this._countBits(a))&&(i=i.ushln(r),o.iushln(r),a=0|i.words[i.length-1]);var s,c=o.length-i.length;if("mod"!==t){(s=new n(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=o.clone()._ishlnsubmul(i,1,c);0===l.negative&&(o=l,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var p=67108864*(0|o.words[i.length+d])+(0|o.words[i.length+d-1]);for(p=Math.min(p/a|0,67108863),o._ishlnsubmul(i,p,d);0!==o.negative;)p--,o.negative=0,o._ishlnsubmul(i,1,d),o.isZero()||(o.negative^=1);s&&(s.words[d]=p)}return s&&s.strip(),o.strip(),"div"!==t&&0!==r&&o.iushrn(r),{div:s||null,mod:o}},n.prototype.divmod=function(e,t,o){return r(!e.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new n(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new n(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new n(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},n.prototype.div=function(e){return this.divmod(e,"div",!1).div},n.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},n.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},n.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,o=e.ushrn(1),n=e.andln(1),i=r.cmp(o);return i<0||1===n&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},n.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,o=0,n=this.length-1;n>=0;n--)o=(t*o+(0|this.words[n]))%e;return o},n.prototype.idivn=function(e){r(e<=67108863);for(var t=0,o=this.length-1;o>=0;o--){var n=(0|this.words[o])+67108864*t;this.words[o]=n/e|0,t=n%e}return this.strip()},n.prototype.divn=function(e){return this.clone().idivn(e)},n.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new n(1),a=new n(0),s=new n(0),c=new n(1),u=0;t.isEven()&&o.isEven();)t.iushrn(1),o.iushrn(1),++u;for(var l=o.clone(),d=t.clone();!t.isZero();){for(var p=0,h=1;!(t.words[0]&h)&&p<26;++p,h<<=1);if(p>0)for(t.iushrn(p);p-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var f=0,m=1;!(o.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(o.iushrn(f);f-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(o)>=0?(t.isub(o),i.isub(s),a.isub(c)):(o.isub(t),s.isub(i),c.isub(a))}return{a:s,b:c,gcd:o.iushln(u)}},n.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new n(1),s=new n(0),c=o.clone();t.cmpn(1)>0&&o.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,p=1;!(o.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(o.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(o)>=0?(t.isub(o),a.isub(s)):(o.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},n.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 o=0;t.isEven()&&r.isEven();o++)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 i=t;t=r,r=i}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(o)},n.prototype.invm=function(e){return this.egcd(e).a.umod(e)},n.prototype.isEven=function(){return!(1&this.words[0])},n.prototype.isOdd=function(){return!(1&~this.words[0])},n.prototype.andln=function(e){return this.words[0]&e},n.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,o=(e-t)/26,n=1<<t;if(this.length<=o)return this._expand(o+1),this.words[o]|=n,this;for(var i=n,a=o;0!==i&&a<this.length;a++){var s=0|this.words[a];i=(s+=i)>>>26,s&=67108863,this.words[a]=s}return 0!==i&&(this.words[a]=i,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(e){var t,o=e<0;if(0!==this.negative&&!o)return-1;if(0===this.negative&&o)return 1;if(this.strip(),this.length>1)t=1;else{o&&(e=-e),r(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},n.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},n.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 o=0|this.words[r],n=0|e.words[r];if(o!==n){o<n?t=-1:o>n&&(t=1);break}}return t},n.prototype.gtn=function(e){return 1===this.cmpn(e)},n.prototype.gt=function(e){return 1===this.cmp(e)},n.prototype.gten=function(e){return this.cmpn(e)>=0},n.prototype.gte=function(e){return this.cmp(e)>=0},n.prototype.ltn=function(e){return-1===this.cmpn(e)},n.prototype.lt=function(e){return-1===this.cmp(e)},n.prototype.lten=function(e){return this.cmpn(e)<=0},n.prototype.lte=function(e){return this.cmp(e)<=0},n.prototype.eqn=function(e){return 0===this.cmpn(e)},n.prototype.eq=function(e){return 0===this.cmp(e)},n.red=function(e){return new k(e)},n.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(e){return this.red=e,this},n.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},n.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},n.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},n.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},n.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},n.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},n.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},n.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function g(e,t){this.name=e,this.p=new n(t,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function $(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(e){if("string"==typeof e){var t=n._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function _(e){k.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}g.prototype._tmp=function(){var e=new n(null);return e.words=new Array(Math.ceil(this.n/13)),e},g.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 o=t<this.n?-1:r.ucmp(this.p);return 0===o?(r.words[0]=0,r.length=1):o>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(e,t){e.iushrn(this.n,0,t)},g.prototype.imulK=function(e){return e.imul(this.k)},o(b,g),b.prototype.split=function(e,t){for(var r=4194303,o=Math.min(e.length,9),n=0;n<o;n++)t.words[n]=e.words[n];if(t.length=o,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=i&r,n=10;n<e.length;n++){var a=0|e.words[n];e.words[n-10]=(a&r)<<4|i>>>22,i=a}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},b.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 o=0|e.words[r];t+=977*o,e.words[r]=67108863&t,t=64*o+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},o(v,g),o(w,g),o($,g),$.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var o=19*(0|e.words[r])+t,n=67108863&o;o>>>=26,e.words[r]=n,t=o}return 0!==t&&(e.words[e.length++]=t),e},n._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new $}return y[e]=t,t},k.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},k.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},k.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},k.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},k.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},k.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},k.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},k.prototype.isqr=function(e){return this.imul(e,e.clone())},k.prototype.sqr=function(e){return this.mul(e,e)},k.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var o=this.m.add(new n(1)).iushrn(2);return this.pow(e,o)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new n(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),p=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),f=a;0!==h.cmp(s);){for(var m=h,y=0;0!==m.cmp(s);y++)m=m.redSqr();r(y<f);var g=this.pow(d,new n(1).iushln(f-y-1));p=p.redMul(g),d=g.redSqr(),h=h.redMul(d),f=y}return p},k.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},k.prototype.pow=function(e,t){if(t.isZero())return new n(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=e;for(var o=2;o<r.length;o++)r[o]=this.mul(r[o-1],e);var i=r[0],a=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),o=t.length-1;o>=0;o--){for(var u=t.words[o],l=c-1;l>=0;l--){var d=u>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===o&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}c=26}return i},k.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},k.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},n.mont=function(e){return new _(e)},o(_,k),_.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},_.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},_.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(o).iushrn(this.shift),i=n;return n.cmp(this.m)>=0?i=n.isub(this.m):n.cmpn(0)<0&&(i=n.iadd(this.m)),i._forceRed(this)},_.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new n(0)._forceRed(this);var r=e.mul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(o).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},_.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(bn$5,commonjsGlobal)),bn$5.exports}bn$5.exports;var brorand={exports:{}},hasRequiredBrorand,mr,hasRequiredMr,generatePrime,hasRequiredGeneratePrime;function requireBrorand(){if(hasRequiredBrorand)return brorand.exports;var e;function t(e){this.rand=e}if(hasRequiredBrorand=1,brorand.exports=function(r){return e||(e=new t(null)),e.generate(r)},brorand.exports.Rand=t,t.prototype.generate=function(e){return this._rand(e)},t.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?t.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?t.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(t.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var r=requireCryptoBrowserify();if("function"!=typeof r.randomBytes)throw new Error("Not supported");t.prototype._rand=function(e){return r.randomBytes(e)}}catch(o){}return brorand.exports}function requireMr(){if(hasRequiredMr)return mr;hasRequiredMr=1;var e=requireBn$3(),t=requireBrorand();function r(e){this.rand=e||new t.Rand}return mr=r,r.create=function(e){return new r(e)},r.prototype._randbelow=function(t){var r=t.bitLength(),o=Math.ceil(r/8);do{var n=new e(this.rand.generate(o))}while(n.cmp(t)>=0);return n},r.prototype._randrange=function(e,t){var r=t.sub(e);return e.add(this._randbelow(r))},r.prototype.test=function(t,r,o){var n=t.bitLength(),i=e.mont(t),a=new e(1).toRed(i);r||(r=Math.max(1,n/48|0));for(var s=t.subn(1),c=0;!s.testn(c);c++);for(var u=t.shrn(c),l=s.toRed(i);r>0;r--){var d=this._randrange(new e(2),s);o&&o(d);var p=d.toRed(i).redPow(u);if(0!==p.cmp(a)&&0!==p.cmp(l)){for(var h=1;h<c;h++){if(0===(p=p.redSqr()).cmp(a))return!1;if(0===p.cmp(l))break}if(h===c)return!1}}return!0},r.prototype.getDivisor=function(t,r){var o=t.bitLength(),n=e.mont(t),i=new e(1).toRed(n);r||(r=Math.max(1,o/48|0));for(var a=t.subn(1),s=0;!a.testn(s);s++);for(var c=t.shrn(s),u=a.toRed(n);r>0;r--){var l=this._randrange(new e(2),a),d=t.gcd(l);if(0!==d.cmpn(1))return d;var p=l.toRed(n).redPow(c);if(0!==p.cmp(i)&&0!==p.cmp(u)){for(var h=1;h<s;h++){if(0===(p=p.redSqr()).cmp(i))return p.fromRed().subn(1).gcd(t);if(0===p.cmp(u))break}if(h===s)return(p=p.redSqr()).fromRed().subn(1).gcd(t)}}return!1},mr}function requireGeneratePrime(){if(hasRequiredGeneratePrime)return generatePrime;hasRequiredGeneratePrime=1;var e=requireBrowser$b();generatePrime=f,f.simpleSieve=p,f.fermatTest=h;var t=requireBn$4(),r=new t(24),o=new(requireMr()),n=new t(1),i=new t(2),a=new t(5);new t(16),new t(8);var s=new t(10),c=new t(3);new t(7);var u=new t(11),l=new t(4);new t(12);var d=null;function p(e){for(var t=function(){if(null!==d)return d;var e=[];e[0]=2;for(var t=1,r=3;r<1048576;r+=2){for(var o=Math.ceil(Math.sqrt(r)),n=0;n<t&&e[n]<=o&&r%e[n]!=0;n++);t!==n&&e[n]<=o||(e[t++]=r)}return d=e,e}(),r=0;r<t.length;r++)if(0===e.modn(t[r]))return 0===e.cmpn(t[r]);return!0}function h(e){var r=t.mont(e);return 0===i.toRed(r).redPow(e.subn(1)).fromRed().cmpn(1)}function f(d,f){if(d<16)return new t(2===f||5===f?[140,123]:[140,39]);var m,y;for(f=new t(f);;){for(m=new t(e(Math.ceil(d/8)));m.bitLength()>d;)m.ishrn(1);if(m.isEven()&&m.iadd(n),m.testn(1)||m.iadd(i),f.cmp(i)){if(!f.cmp(a))for(;m.mod(s).cmp(c);)m.iadd(l)}else for(;m.mod(r).cmp(u);)m.iadd(l);if(p(y=m.shrn(1))&&p(m)&&h(y)&&h(m)&&o.test(y)&&o.test(m))return m}}return generatePrime}const 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"},require$$1$1={modp1:modp1,modp2:modp2,modp5:modp5,modp14:modp14,modp15:modp15,modp16:modp16,modp17:modp17,modp18:modp18};var dh,hasRequiredDh,hasRequiredBrowser$4;function requireDh(){if(hasRequiredDh)return dh;hasRequiredDh=1;var e=requireBn$4(),t=new(requireMr()),r=new e(24),o=new e(11),n=new e(10),i=new e(3),a=new e(7),s=requireGeneratePrime(),c=requireBrowser$b();function u(t,r){return r=r||"utf8",Buffer.isBuffer(t)||(t=new Buffer(t,r)),this._pub=new e(t),this}function l(t,r){return r=r||"utf8",Buffer.isBuffer(t)||(t=new Buffer(t,r)),this._priv=new e(t),this}dh=p;var d={};function p(t,r,o){this.setGenerator(r),this.__prime=new e(t),this._prime=e.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,o?(this.setPublicKey=u,this.setPrivateKey=l):this._primeCode=8}function h(e,t){var r=new Buffer(e.toArray());return t?r.toString(t):r}return Object.defineProperty(p.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(e,c){var u=c.toString("hex"),l=[u,e.toString(16)].join("_");if(l in d)return d[l];var p,h=0;if(e.isEven()||!s.simpleSieve||!s.fermatTest(e)||!t.test(e))return h+=1,h+="02"===u||"05"===u?8:4,d[l]=h,h;switch(t.test(e.shrn(1))||(h+=2),u){case"02":e.mod(r).cmp(o)&&(h+=8);break;case"05":(p=e.mod(n)).cmp(i)&&p.cmp(a)&&(h+=8);break;default:h+=4}return d[l]=h,h}(this.__prime,this.__gen)),this._primeCode}}),p.prototype.generateKeys=function(){return this._priv||(this._priv=new e(c(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},p.prototype.computeSecret=function(t){var r=(t=(t=new e(t)).toRed(this._prime)).redPow(this._priv).fromRed(),o=new Buffer(r.toArray()),n=this.getPrime();if(o.length<n.length){var i=new Buffer(n.length-o.length);i.fill(0),o=Buffer.concat([i,o])}return o},p.prototype.getPublicKey=function(e){return h(this._pub,e)},p.prototype.getPrivateKey=function(e){return h(this._priv,e)},p.prototype.getPrime=function(e){return h(this.__prime,e)},p.prototype.getGenerator=function(e){return h(this._gen,e)},p.prototype.setGenerator=function(t,r){return r=r||"utf8",Buffer.isBuffer(t)||(t=new Buffer(t,r)),this.__gen=t,this._gen=new e(t),this},dh}function requireBrowser$4(){if(hasRequiredBrowser$4)return browser$6;hasRequiredBrowser$4=1;var e=requireGeneratePrime(),t=require$$1$1,r=requireDh();var o={binary:!0,hex:!0,base64:!0};return browser$6.DiffieHellmanGroup=browser$6.createDiffieHellmanGroup=browser$6.getDiffieHellman=function(e){var o=new Buffer(t[e].prime,"hex"),n=new Buffer(t[e].gen,"hex");return new r(o,n)},browser$6.createDiffieHellman=browser$6.DiffieHellman=function t(n,i,a,s){return Buffer.isBuffer(i)||void 0===o[i]?t(n,"binary",i,a):(i=i||"binary",s=s||"binary",a=a||new Buffer([2]),Buffer.isBuffer(a)||(a=new Buffer(a,s)),"number"==typeof n?new r(e(n,a),a,!0):(Buffer.isBuffer(n)||(n=new Buffer(n,i)),new r(n,a,!0)))},browser$6}var readableBrowser={exports:{}},processNextickArgs={exports:{}},hasRequiredProcessNextickArgs,isarray,hasRequiredIsarray,streamBrowser,hasRequiredStreamBrowser;function requireProcessNextickArgs(){if(hasRequiredProcessNextickArgs)return processNextickArgs.exports;return hasRequiredProcessNextickArgs=1,void 0===process$1$1||!process$1$1.version||0===process$1$1.version.indexOf("v0.")||0===process$1$1.version.indexOf("v1.")&&0!==process$1$1.version.indexOf("v1.8.")?processNextickArgs.exports={nextTick:function(e,t,r,o){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var n,i,a=arguments.length;switch(a){case 0:case 1:return process$1$1.nextTick(e);case 2:return process$1$1.nextTick((function(){e.call(null,t)}));case 3:return process$1$1.nextTick((function(){e.call(null,t,r)}));case 4:return process$1$1.nextTick((function(){e.call(null,t,r,o)}));default:for(n=new Array(a-1),i=0;i<n.length;)n[i++]=arguments[i];return process$1$1.nextTick((function(){e.apply(null,n)}))}}}:processNextickArgs.exports=process$1$1,processNextickArgs.exports}function requireIsarray(){if(hasRequiredIsarray)return isarray;hasRequiredIsarray=1;var e={}.toString;return isarray=Array.isArray||function(t){return"[object Array]"==e.call(t)}}function requireStreamBrowser(){return hasRequiredStreamBrowser?streamBrowser:(hasRequiredStreamBrowser=1,streamBrowser=requireEvents().EventEmitter)}var safeBuffer={exports:{}},hasRequiredSafeBuffer;function requireSafeBuffer(){return hasRequiredSafeBuffer||(hasRequiredSafeBuffer=1,function(e,t){var r=require$$0$2,o=r.Buffer;function n(e,t){for(var r in e)t[r]=e[r]}function i(e,t,r){return o(e,t,r)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(n(r,t),t.Buffer=i),n(o,i),i.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,r)},i.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=o(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}}(safeBuffer,safeBuffer.exports)),safeBuffer.exports}var util$2={},hasRequiredUtil;function requireUtil(){if(hasRequiredUtil)return util$2;function e(e){return Object.prototype.toString.call(e)}return hasRequiredUtil=1,util$2.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===e(t)},util$2.isBoolean=function(e){return"boolean"==typeof e},util$2.isNull=function(e){return null===e},util$2.isNullOrUndefined=function(e){return null==e},util$2.isNumber=function(e){return"number"==typeof e},util$2.isString=function(e){return"string"==typeof e},util$2.isSymbol=function(e){return"symbol"==typeof e},util$2.isUndefined=function(e){return void 0===e},util$2.isRegExp=function(t){return"[object RegExp]"===e(t)},util$2.isObject=function(e){return"object"==typeof e&&null!==e},util$2.isDate=function(t){return"[object Date]"===e(t)},util$2.isError=function(t){return"[object Error]"===e(t)||t instanceof Error},util$2.isFunction=function(e){return"function"==typeof e},util$2.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},util$2.isBuffer=require$$0$2.Buffer.isBuffer,util$2}var BufferList={exports:{}},hasRequiredBufferList,destroy_1,hasRequiredDestroy,_stream_writable,hasRequired_stream_writable,_stream_duplex,hasRequired_stream_duplex,_stream_readable,hasRequired_stream_readable,_stream_transform,hasRequired_stream_transform,_stream_passthrough,hasRequired_stream_passthrough,hasRequiredReadableBrowser;function requireBufferList(){return hasRequiredBufferList||(hasRequiredBufferList=1,e=BufferList,t=requireSafeBuffer().Buffer,r=requireUtil$1(),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 t.alloc(0);for(var r,o,n,i=t.allocUnsafe(e>>>0),a=this.head,s=0;a;)r=a.data,o=i,n=s,r.copy(o,n),s+=a.data.length,a=a.next;return i},e}(),r&&r.inspect&&r.inspect.custom&&(e.exports.prototype[r.inspect.custom]=function(){var e=r.inspect({length:this.length});return this.constructor.name+" "+e})),BufferList.exports;var e,t,r}function requireDestroy(){if(hasRequiredDestroy)return destroy_1;hasRequiredDestroy=1;var e=requireProcessNextickArgs();function t(e,t){e.emit("error",t)}return destroy_1={destroy:function(r,o){var n=this,i=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return i||a?(o?o(r):r&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(t,this,r)):e.nextTick(t,this,r)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(r||null,(function(r){!o&&r?n._writableState?n._writableState.errorEmitted||(n._writableState.errorEmitted=!0,e.nextTick(t,n,r)):e.nextTick(t,n,r):o&&o(r)})),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 require_stream_writable(){if(hasRequired_stream_writable)return _stream_writable;hasRequired_stream_writable=1;var e=requireProcessNextickArgs();function t(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var o=e.entry;e.entry=null;for(;o;){var n=o.callback;t.pendingcb--,n(r),o=o.next}t.corkedRequestsFree.next=e}(t,e)}}_stream_writable=h;var r,o=!process$1$1.browser&&["v0.10","v0.9."].indexOf(process$1$1.version.slice(0,5))>-1?setImmediate:e.nextTick;h.WritableState=p;var n=Object.create(requireUtil());n.inherits=requireInherits_browser();var i={deprecate:requireBrowser$a()},a=requireStreamBrowser(),s=requireSafeBuffer().Buffer,c=(void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var u,l=requireDestroy();function d(){}function p(n,i){r=r||require_stream_duplex(),n=n||{};var a=i instanceof r;this.objectMode=!!n.objectMode,a&&(this.objectMode=this.objectMode||!!n.writableObjectMode);var s=n.highWaterMark,c=n.writableHighWaterMark,u=this.objectMode?16:16384;this.highWaterMark=s||0===s?s:a&&(c||0===c)?c:u,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 l=!1===n.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=n.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,r){var n=t._writableState,i=n.sync,a=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),r)!function(t,r,o,n,i){--r.pendingcb,o?(e.nextTick(i,n),e.nextTick(v,t,r),t._writableState.errorEmitted=!0,t.emit("error",n)):(i(n),t._writableState.errorEmitted=!0,t.emit("error",n),v(t,r))}(t,n,i,r,a);else{var s=g(n);s||n.corked||n.bufferProcessing||!n.bufferedRequest||y(t,n),i?o(m,t,n,s,a):m(t,n,s,a)}}(i,t)},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 t(this)}function h(e){if(r=r||require_stream_duplex(),!(u.call(h,this)||this instanceof r))return new h(e);this._writableState=new p(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)),a.call(this)}function f(e,t,r,o,n,i,a){t.writelen=o,t.writecb=a,t.writing=!0,t.sync=!0,r?e._writev(n,t.onwrite):e._write(n,i,t.onwrite),t.sync=!1}function m(e,t,r,o){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,o(),v(e,t)}function y(e,r){r.bufferProcessing=!0;var o=r.bufferedRequest;if(e._writev&&o&&o.next){var n=r.bufferedRequestCount,i=new Array(n),a=r.corkedRequestsFree;a.entry=o;for(var s=0,c=!0;o;)i[s]=o,o.isBuf||(c=!1),o=o.next,s+=1;i.allBuffers=c,f(e,r,!0,r.length,i,"",a.finish),r.pendingcb++,r.lastBufferedRequest=null,a.next?(r.corkedRequestsFree=a.next,a.next=null):r.corkedRequestsFree=new t(r),r.bufferedRequestCount=0}else{for(;o;){var u=o.chunk,l=o.encoding,d=o.callback;if(f(e,r,!1,r.objectMode?1:u.length,u,l,d),o=o.next,r.bufferedRequestCount--,r.writing)break}null===o&&(r.lastBufferedRequest=null)}r.bufferedRequest=o,r.bufferProcessing=!1}function g(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function b(e,t){e._final((function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),v(e,t)}))}function v(t,r){var o=g(r);return o&&(!function(t,r){r.prefinished||r.finalCalled||("function"==typeof t._final?(r.pendingcb++,r.finalCalled=!0,e.nextTick(b,t,r)):(r.prefinished=!0,t.emit("prefinish")))}(t,r),0===r.pendingcb&&(r.finished=!0,t.emit("finish"))),o}return n.inherits(h,a),p.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(p.prototype,"buffer",{get:i.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]?(u=Function.prototype[Symbol.hasInstance],Object.defineProperty(h,Symbol.hasInstance,{value:function(e){return!!u.call(this,e)||this===h&&(e&&e._writableState instanceof p)}})):u=function(e){return e instanceof this},h.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},h.prototype.write=function(t,r,o){var n,i=this._writableState,a=!1,u=!i.objectMode&&(n=t,s.isBuffer(n)||n instanceof c);return u&&!s.isBuffer(t)&&(t=function(e){return s.from(e)}(t)),"function"==typeof r&&(o=r,r=null),u?r="buffer":r||(r=i.defaultEncoding),"function"!=typeof o&&(o=d),i.ended?function(t,r){var o=new Error("write after end");t.emit("error",o),e.nextTick(r,o)}(this,o):(u||function(t,r,o,n){var i=!0,a=!1;return null===o?a=new TypeError("May not write null values to stream"):"string"==typeof o||void 0===o||r.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(t.emit("error",a),e.nextTick(n,a),i=!1),i}(this,i,t,o))&&(i.pendingcb++,a=function(e,t,r,o,n,i){if(!r){var a=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=s.from(t,r));return t}(t,o,n);o!==a&&(r=!0,n="buffer",o=a)}var c=t.objectMode?1:o.length;t.length+=c;var u=t.length<t.highWaterMark;u||(t.needDrain=!0);if(t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:o,encoding:n,isBuf:r,callback:i,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else f(e,t,!1,c,o,n,i);return u}(this,i,u,t,r,o)),a},h.prototype.cork=function(){this._writableState.corked++},h.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||y(this,e))},h.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(h.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),h.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},h.prototype._writev=null,h.prototype.end=function(t,r,o){var n=this._writableState;"function"==typeof t?(o=t,t=null,r=null):"function"==typeof r&&(o=r,r=null),null!=t&&this.write(t,r),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,r,o){r.ending=!0,v(t,r),o&&(r.finished?e.nextTick(o):t.once("finish",o));r.ended=!0,t.writable=!1}(this,n,o)},Object.defineProperty(h.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),h.prototype.destroy=l.destroy,h.prototype._undestroy=l.undestroy,h.prototype._destroy=function(e,t){this.end(),t(e)},_stream_writable}function require_stream_duplex(){if(hasRequired_stream_duplex)return _stream_duplex;hasRequired_stream_duplex=1;var e=requireProcessNextickArgs(),t=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};_stream_duplex=c;var r=Object.create(requireUtil());r.inherits=requireInherits_browser();var o=require_stream_readable(),n=require_stream_writable();r.inherits(c,o);for(var i=t(n.prototype),a=0;a<i.length;a++){var s=i[a];c.prototype[s]||(c.prototype[s]=n.prototype[s])}function c(e){if(!(this instanceof c))return new c(e);o.call(this,e),n.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",u)}function u(){this.allowHalfOpen||this._writableState.ended||e.nextTick(l,this)}function l(e){e.end()}return Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.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)}}),c.prototype._destroy=function(t,r){this.push(null),this.end(),e.nextTick(r,t)},_stream_duplex}function require_stream_readable(){if(hasRequired_stream_readable)return _stream_readable;hasRequired_stream_readable=1;var e=requireProcessNextickArgs();_stream_readable=m;var t,r=requireIsarray();m.ReadableState=f,requireEvents().EventEmitter;var o=function(e,t){return e.listeners(t).length},n=requireStreamBrowser(),i=requireSafeBuffer().Buffer,a=(void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var s=Object.create(requireUtil());s.inherits=requireInherits_browser();var c=requireUtil$1(),u=void 0;u=c&&c.debuglog?c.debuglog("stream"):function(){};var l,d=requireBufferList(),p=requireDestroy();s.inherits(m,n);var h=["error","close","destroy","pause","resume"];function f(e,r){e=e||{};var o=r instanceof(t=t||require_stream_duplex());this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,i=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:o&&(i||0===i)?i:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new d,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&&(l||(l=requireString_decoder().StringDecoder),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function m(e){if(t=t||require_stream_duplex(),!(this instanceof m))return new m(e);this._readableState=new f(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),n.call(this)}function y(e,t,r,o,n){var s,c=e._readableState;null===t?(c.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,w(e)}(e,c)):(n||(s=function(e,t){var r;o=t,i.isBuffer(o)||o instanceof a||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var o;return r}(c,t)),s?e.emit("error",s):c.objectMode||t&&t.length>0?("string"==typeof t||c.objectMode||Object.getPrototypeOf(t)===i.prototype||(t=function(e){return i.from(e)}(t)),o?c.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):g(e,c,t,!0):c.ended?e.emit("error",new Error("stream.push() after EOF")):(c.reading=!1,c.decoder&&!r?(t=c.decoder.write(t),c.objectMode||0!==t.length?g(e,c,t,!1):k(e,c)):g(e,c,t,!1))):o||(c.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(c)}function g(e,t,r,o){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,o?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&w(e)),k(e,t)}Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),m.prototype.destroy=p.destroy,m.prototype._undestroy=p.undestroy,m.prototype._destroy=function(e,t){this.push(null),t(e)},m.prototype.push=function(e,t){var r,o=this._readableState;return o.objectMode?r=!0:"string"==typeof e&&((t=t||o.defaultEncoding)!==o.encoding&&(e=i.from(e,t),t=""),r=!0),y(this,e,t,!1,r)},m.prototype.unshift=function(e){return y(this,e,null,!0,!1)},m.prototype.isPaused=function(){return!1===this._readableState.flowing},m.prototype.setEncoding=function(e){return l||(l=requireString_decoder().StringDecoder),this._readableState.decoder=new l(e),this._readableState.encoding=e,this};var b=8388608;function v(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>=b?e=b:(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 w(t){var r=t._readableState;r.needReadable=!1,r.emittedReadable||(u("emitReadable",r.flowing),r.emittedReadable=!0,r.sync?e.nextTick($,t):$(t))}function $(e){u("emit readable"),e.emit("readable"),A(e)}function k(t,r){r.readingMore||(r.readingMore=!0,e.nextTick(_,t,r))}function _(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(u("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}function T(e){u("readable nexttick read 0"),e.read(0)}function I(e,t){t.reading||(u("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),A(e),t.flowing&&!t.reading&&e.read(0)}function A(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function O(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 o;e<t.head.data.length?(o=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):o=e===t.head.data.length?t.shift():r?function(e,t){var r=t.head,o=1,n=r.data;e-=n.length;for(;r=r.next;){var i=r.data,a=e>i.length?i.length:e;if(a===i.length?n+=i:n+=i.slice(0,e),0===(e-=a)){a===i.length?(++o,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=i.slice(a));break}++o}return t.length-=o,n}(e,t):function(e,t){var r=i.allocUnsafe(e),o=t.head,n=1;o.data.copy(r),e-=o.data.length;for(;o=o.next;){var a=o.data,s=e>a.length?a.length:e;if(a.copy(r,r.length-e,0,s),0===(e-=s)){s===a.length?(++n,o.next?t.head=o.next:t.head=t.tail=null):(t.head=o,o.data=a.slice(s));break}++n}return t.length-=n,r}(e,t);return o}(e,t.buffer,t.decoder),r);var r}function E(t){var r=t._readableState;if(r.length>0)throw new Error('"endReadable()" called on non-empty stream');r.endEmitted||(r.ended=!0,e.nextTick(S,r,t))}function S(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function R(e,t){for(var r=0,o=e.length;r<o;r++)if(e[r]===t)return r;return-1}return m.prototype.read=function(e){u("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 u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?E(this):w(this),null;if(0===(e=v(e,t))&&t.ended)return 0===t.length&&E(this),null;var o,n=t.needReadable;return u("need readable",n),(0===t.length||t.length-e<t.highWaterMark)&&u("length less than watermark",n=!0),t.ended||t.reading?u("reading or ended",n=!1):n&&(u("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=v(r,t))),null===(o=e>0?O(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&E(this)),null!==o&&this.emit("data",o),o},m.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},m.prototype.pipe=function(t,n){var i=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=t;break;case 1:a.pipes=[a.pipes,t];break;default:a.pipes.push(t)}a.pipesCount+=1,u("pipe count=%d opts=%j",a.pipesCount,n);var s=(!n||!1!==n.end)&&t!==process$1$1.stdout&&t!==process$1$1.stderr?l:b;function c(e,r){u("onunpipe"),e===i&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,u("cleanup"),t.removeListener("close",y),t.removeListener("finish",g),t.removeListener("drain",d),t.removeListener("error",m),t.removeListener("unpipe",c),i.removeListener("end",l),i.removeListener("end",b),i.removeListener("data",f),p=!0,!a.awaitDrain||t._writableState&&!t._writableState.needDrain||d())}function l(){u("onend"),t.end()}a.endEmitted?e.nextTick(s):i.once("end",s),t.on("unpipe",c);var d=function(e){return function(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,A(e))}}(i);t.on("drain",d);var p=!1;var h=!1;function f(e){u("ondata"),h=!1,!1!==t.write(e)||h||((1===a.pipesCount&&a.pipes===t||a.pipesCount>1&&-1!==R(a.pipes,t))&&!p&&(u("false write response, pause",a.awaitDrain),a.awaitDrain++,h=!0),i.pause())}function m(e){u("onerror",e),b(),t.removeListener("error",m),0===o(t,"error")&&t.emit("error",e)}function y(){t.removeListener("finish",g),b()}function g(){u("onfinish"),t.removeListener("close",y),b()}function b(){u("unpipe"),i.unpipe(t)}return i.on("data",f),function(e,t,o){if("function"==typeof e.prependListener)return e.prependListener(t,o);e._events&&e._events[t]?r(e._events[t])?e._events[t].unshift(o):e._events[t]=[o,e._events[t]]:e.on(t,o)}(t,"error",m),t.once("close",y),t.once("finish",g),t.emit("pipe",i),a.flowing||(u("pipe resume"),i.resume()),t},m.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 o=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<n;i++)o[i].emit("unpipe",this,{hasUnpiped:!1});return this}var a=R(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},m.prototype.on=function(t,r){var o=n.prototype.on.call(this,t,r);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var i=this._readableState;i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.emittedReadable=!1,i.reading?i.length&&w(this):e.nextTick(T,this))}return o},m.prototype.addListener=m.prototype.on,m.prototype.resume=function(){var t=this._readableState;return t.flowing||(u("resume"),t.flowing=!0,function(t,r){r.resumeScheduled||(r.resumeScheduled=!0,e.nextTick(I,t,r))}(this,t)),this},m.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this},m.prototype.wrap=function(e){var t=this,r=this._readableState,o=!1;for(var n in e.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(n){(u("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(o=!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 i=0;i<h.length;i++)e.on(h[i],this.emit.bind(this,h[i]));return this._read=function(t){u("wrapped _read",t),o&&(o=!1,e.resume())},this},Object.defineProperty(m.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),m._fromList=O,_stream_readable}function require_stream_transform(){if(hasRequired_stream_transform)return _stream_transform;hasRequired_stream_transform=1,_stream_transform=o;var e=require_stream_duplex(),t=Object.create(requireUtil());function r(e,t){var r=this._transformState;r.transforming=!1;var o=r.writecb;if(!o)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),o(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function o(t){if(!(this instanceof o))return new o(t);e.call(this,t),this._transformState={afterTransform:r.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",n)}function n(){var e=this;"function"==typeof this._flush?this._flush((function(t,r){i(e,t,r)})):i(this,null,null)}function i(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)}return t.inherits=requireInherits_browser(),t.inherits(o,e),o.prototype.push=function(t,r){return this._transformState.needTransform=!1,e.prototype.push.call(this,t,r)},o.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")},o.prototype._write=function(e,t,r){var o=this._transformState;if(o.writecb=r,o.writechunk=e,o.writeencoding=t,!o.transforming){var n=this._readableState;(o.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},o.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},o.prototype._destroy=function(t,r){var o=this;e.prototype._destroy.call(this,t,(function(e){r(e),o.emit("close")}))},_stream_transform}function require_stream_passthrough(){if(hasRequired_stream_passthrough)return _stream_passthrough;hasRequired_stream_passthrough=1,_stream_passthrough=r;var e=require_stream_transform(),t=Object.create(requireUtil());function r(t){if(!(this instanceof r))return new r(t);e.call(this,t)}return t.inherits=requireInherits_browser(),t.inherits(r,e),r.prototype._transform=function(e,t,r){r(null,e)},_stream_passthrough}function requireReadableBrowser(){return hasRequiredReadableBrowser||(hasRequiredReadableBrowser=1,function(e,t){(t=e.exports=require_stream_readable()).Stream=t,t.Readable=t,t.Writable=require_stream_writable(),t.Duplex=require_stream_duplex(),t.Transform=require_stream_transform(),t.PassThrough=require_stream_passthrough()}(readableBrowser,readableBrowser.exports)),readableBrowser.exports}var sign$1={exports:{}},bn$4={exports:{}},module2;bn$4.exports,module2=bn$4,function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function o(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function n(e,t,r){if(n.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 i;"object"==typeof e?e.exports=n:t.BN=n,n.BN=n,n.wordSize=26;try{i="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require$$0$2.Buffer}catch(A){}function a(e,t){var o=e.charCodeAt(t);return o>=48&&o<=57?o-48:o>=65&&o<=70?o-55:o>=97&&o<=102?o-87:void r(!1,"Invalid character in "+e)}function s(e,t,r){var o=a(e,r);return r-1>=t&&(o|=a(e,r-1)<<4),o}function c(e,t,o,n){for(var i=0,a=0,s=Math.min(e.length,o),c=t;c<s;c++){var u=e.charCodeAt(c)-48;i*=n,a=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&a<n,"Invalid character"),i+=a}return i}function u(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(n.isBN=function(e){return e instanceof n||null!==e&&"object"==typeof e&&e.constructor.wordSize===n.wordSize&&Array.isArray(e.words)},n.max=function(e,t){return e.cmp(t)>0?e:t},n.min=function(e,t){return e.cmp(t)<0?e:t},n.prototype._init=function(e,t,o){if("number"==typeof e)return this._initNumber(e,t,o);if("object"==typeof e)return this._initArray(e,t,o);"hex"===t&&(t=16),r(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,o):(this._parseBase(e,t,n),"le"===o&&this._initArray(this.toArray(),t,o)))},n.prototype._initNumber=function(e,t,o){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):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===o&&this._initArray(this.toArray(),t,o)},n.prototype._initArray=function(e,t,o){if(r("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 i,a,s=0;if("be"===o)for(n=e.length-1,i=0;n>=0;n-=3)a=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===o)for(n=0,i=0;n<e.length;n+=3)a=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this._strip()},n.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var n,i=0,a=0;if("be"===r)for(o=e.length-1;o>=t;o-=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;else for(o=(e.length-t)%2==0?t+1:t;o<e.length;o+=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;this._strip()},n.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var o=0,n=1;n<=67108863;n*=t)o++;o--,n=n/t|0;for(var i=e.length-r,a=i%o,s=Math.min(i,i-a)+r,u=0,l=r;l<s;l+=o)u=c(e,l,l+o,t),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var d=1;for(u=c(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.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},n.prototype._move=function(e){u(e,this)},n.prototype.clone=function(){var e=new n(null);return this.copy(e),e},n.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(A){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","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"],p=[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],h=[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 f(e,t,r){r.negative=t.negative^e.negative;var o=e.length+t.length|0;r.length=o,o=o-1|0;var n=0|e.words[0],i=0|t.words[0],a=n*i,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u<o;u++){for(var l=c>>>26,d=67108863&c,p=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=p;h++){var f=u-h|0;l+=(a=(n=0|e.words[f])*(i=0|t.words[h])+d)/67108864|0,d=67108863&a}r.words[u]=0|d,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r._strip()}n.prototype.toString=function(e,t){var o;if(t=0|t||1,16===(e=e||10)||"hex"===e){o="";for(var n=0,i=0,a=0;a<this.length;a++){var s=this.words[a],c=(16777215&(s<<n|i)).toString(16);i=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),o=0!==i||a!==this.length-1?d[6-c.length]+c+o:c+o}for(0!==i&&(o=i.toString(16)+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}if(e===(0|e)&&e>=2&&e<=36){var u=p[e],l=h[e];o="";var f=this.clone();for(f.negative=0;!f.isZero();){var m=f.modrn(l).toString(e);o=(f=f.idivn(l)).isZero()?m+o:d[u-m.length]+m+o}for(this.isZero()&&(o="0"+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}r(!1,"Base should be between 2 and 36")},n.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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},n.prototype.toJSON=function(){return this.toString(16,2)},i&&(n.prototype.toBuffer=function(e,t){return this.toArrayLike(i,e,t)}),n.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},n.prototype.toArrayLike=function(e,t,o){this._strip();var n=this.byteLength(),i=o||Math.max(1,n);r(n<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,i);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,n),a},n.prototype._toArrayLikeLE=function(e,t){for(var r=0,o=0,n=0,i=0;n<this.length;n++){var a=this.words[n]<<i|o;e[r++]=255&a,r<e.length&&(e[r++]=a>>8&255),r<e.length&&(e[r++]=a>>16&255),6===i?(r<e.length&&(e[r++]=a>>24&255),o=0,i=0):(o=a>>>24,i+=2)}if(r<e.length)for(e[r++]=o;r<e.length;)e[r++]=0},n.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,o=0,n=0,i=0;n<this.length;n++){var a=this.words[n]<<i|o;e[r--]=255&a,r>=0&&(e[r--]=a>>8&255),r>=0&&(e[r--]=a>>16&255),6===i?(r>=0&&(e[r--]=a>>24&255),o=0,i=0):(o=a>>>24,i+=2)}if(r>=0)for(e[r--]=o;r>=0;)e[r--]=0},Math.clz32?n.prototype._countBits=function(e){return 32-Math.clz32(e)}:n.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},n.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},n.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},n.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},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},n.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(e){return r(!(this.negative|e.negative)),this.iuor(e)},n.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},n.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},n.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()},n.prototype.iand=function(e){return r(!(this.negative|e.negative)),this.iuand(e)},n.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},n.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},n.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var o=0;o<r.length;o++)this.words[o]=t.words[o]^r.words[o];if(this!==t)for(;o<t.length;o++)this.words[o]=t.words[o];return this.length=t.length,this._strip()},n.prototype.ixor=function(e){return r(!(this.negative|e.negative)),this.iuxor(e)},n.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},n.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},n.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),o=e%26;this._expand(t),o>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return o>0&&(this.words[n]=~this.words[n]&67108863>>26-o),this._strip()},n.prototype.notn=function(e){return this.clone().inotn(e)},n.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var o=e/26|0,n=e%26;return this._expand(o+1),this.words[o]=t?this.words[o]|1<<n:this.words[o]&~(1<<n),this._strip()},n.prototype.iadd=function(e){var t,r,o;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,o=e):(r=e,o=this);for(var n=0,i=0;i<o.length;i++)t=(0|r.words[i])+(0|o.words[i])+n,this.words[i]=67108863&t,n=t>>>26;for(;0!==n&&i<r.length;i++)t=(0|r.words[i])+n,this.words[i]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;i<r.length;i++)this.words[i]=r.words[i];return this},n.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)},n.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,o,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,o=e):(r=e,o=this);for(var i=0,a=0;a<o.length;a++)i=(t=(0|r.words[a])-(0|o.words[a])+i)>>26,this.words[a]=67108863&t;for(;0!==i&&a<r.length;a++)i=(t=(0|r.words[a])+i)>>26,this.words[a]=67108863&t;if(0===i&&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()},n.prototype.sub=function(e){return this.clone().isub(e)};var m=function(e,t,r){var o,n,i,a=e.words,s=t.words,c=r.words,u=0,l=0|a[0],d=8191&l,p=l>>>13,h=0|a[1],f=8191&h,m=h>>>13,y=0|a[2],g=8191&y,b=y>>>13,v=0|a[3],w=8191&v,$=v>>>13,k=0|a[4],_=8191&k,T=k>>>13,I=0|a[5],A=8191&I,O=I>>>13,E=0|a[6],S=8191&E,R=E>>>13,x=0|a[7],C=8191&x,P=x>>>13,N=0|a[8],B=8191&N,D=N>>>13,M=0|a[9],L=8191&M,j=M>>>13,F=0|s[0],U=8191&F,K=F>>>13,q=0|s[1],G=8191&q,H=q>>>13,V=0|s[2],W=8191&V,z=V>>>13,Z=0|s[3],Q=8191&Z,Y=Z>>>13,X=0|s[4],J=8191&X,ee=X>>>13,te=0|s[5],re=8191&te,oe=te>>>13,ne=0|s[6],ie=8191&ne,ae=ne>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],de=8191&le,pe=le>>>13,he=0|s[9],fe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(u+(o=Math.imul(d,U))|0)+((8191&(n=(n=Math.imul(d,K))+Math.imul(p,U)|0))<<13)|0;u=((i=Math.imul(p,K))+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,o=Math.imul(f,U),n=(n=Math.imul(f,K))+Math.imul(m,U)|0,i=Math.imul(m,K);var ge=(u+(o=o+Math.imul(d,G)|0)|0)+((8191&(n=(n=n+Math.imul(d,H)|0)+Math.imul(p,G)|0))<<13)|0;u=((i=i+Math.imul(p,H)|0)+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,o=Math.imul(g,U),n=(n=Math.imul(g,K))+Math.imul(b,U)|0,i=Math.imul(b,K),o=o+Math.imul(f,G)|0,n=(n=n+Math.imul(f,H)|0)+Math.imul(m,G)|0,i=i+Math.imul(m,H)|0;var be=(u+(o=o+Math.imul(d,W)|0)|0)+((8191&(n=(n=n+Math.imul(d,z)|0)+Math.imul(p,W)|0))<<13)|0;u=((i=i+Math.imul(p,z)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,o=Math.imul(w,U),n=(n=Math.imul(w,K))+Math.imul($,U)|0,i=Math.imul($,K),o=o+Math.imul(g,G)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(b,G)|0,i=i+Math.imul(b,H)|0,o=o+Math.imul(f,W)|0,n=(n=n+Math.imul(f,z)|0)+Math.imul(m,W)|0,i=i+Math.imul(m,z)|0;var ve=(u+(o=o+Math.imul(d,Q)|0)|0)+((8191&(n=(n=n+Math.imul(d,Y)|0)+Math.imul(p,Q)|0))<<13)|0;u=((i=i+Math.imul(p,Y)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,o=Math.imul(_,U),n=(n=Math.imul(_,K))+Math.imul(T,U)|0,i=Math.imul(T,K),o=o+Math.imul(w,G)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul($,G)|0,i=i+Math.imul($,H)|0,o=o+Math.imul(g,W)|0,n=(n=n+Math.imul(g,z)|0)+Math.imul(b,W)|0,i=i+Math.imul(b,z)|0,o=o+Math.imul(f,Q)|0,n=(n=n+Math.imul(f,Y)|0)+Math.imul(m,Q)|0,i=i+Math.imul(m,Y)|0;var we=(u+(o=o+Math.imul(d,J)|0)|0)+((8191&(n=(n=n+Math.imul(d,ee)|0)+Math.imul(p,J)|0))<<13)|0;u=((i=i+Math.imul(p,ee)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,o=Math.imul(A,U),n=(n=Math.imul(A,K))+Math.imul(O,U)|0,i=Math.imul(O,K),o=o+Math.imul(_,G)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(T,G)|0,i=i+Math.imul(T,H)|0,o=o+Math.imul(w,W)|0,n=(n=n+Math.imul(w,z)|0)+Math.imul($,W)|0,i=i+Math.imul($,z)|0,o=o+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(b,Q)|0,i=i+Math.imul(b,Y)|0,o=o+Math.imul(f,J)|0,n=(n=n+Math.imul(f,ee)|0)+Math.imul(m,J)|0,i=i+Math.imul(m,ee)|0;var $e=(u+(o=o+Math.imul(d,re)|0)|0)+((8191&(n=(n=n+Math.imul(d,oe)|0)+Math.imul(p,re)|0))<<13)|0;u=((i=i+Math.imul(p,oe)|0)+(n>>>13)|0)+($e>>>26)|0,$e&=67108863,o=Math.imul(S,U),n=(n=Math.imul(S,K))+Math.imul(R,U)|0,i=Math.imul(R,K),o=o+Math.imul(A,G)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(O,G)|0,i=i+Math.imul(O,H)|0,o=o+Math.imul(_,W)|0,n=(n=n+Math.imul(_,z)|0)+Math.imul(T,W)|0,i=i+Math.imul(T,z)|0,o=o+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul($,Q)|0,i=i+Math.imul($,Y)|0,o=o+Math.imul(g,J)|0,n=(n=n+Math.imul(g,ee)|0)+Math.imul(b,J)|0,i=i+Math.imul(b,ee)|0,o=o+Math.imul(f,re)|0,n=(n=n+Math.imul(f,oe)|0)+Math.imul(m,re)|0,i=i+Math.imul(m,oe)|0;var ke=(u+(o=o+Math.imul(d,ie)|0)|0)+((8191&(n=(n=n+Math.imul(d,ae)|0)+Math.imul(p,ie)|0))<<13)|0;u=((i=i+Math.imul(p,ae)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,o=Math.imul(C,U),n=(n=Math.imul(C,K))+Math.imul(P,U)|0,i=Math.imul(P,K),o=o+Math.imul(S,G)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,G)|0,i=i+Math.imul(R,H)|0,o=o+Math.imul(A,W)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(O,W)|0,i=i+Math.imul(O,z)|0,o=o+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(T,Q)|0,i=i+Math.imul(T,Y)|0,o=o+Math.imul(w,J)|0,n=(n=n+Math.imul(w,ee)|0)+Math.imul($,J)|0,i=i+Math.imul($,ee)|0,o=o+Math.imul(g,re)|0,n=(n=n+Math.imul(g,oe)|0)+Math.imul(b,re)|0,i=i+Math.imul(b,oe)|0,o=o+Math.imul(f,ie)|0,n=(n=n+Math.imul(f,ae)|0)+Math.imul(m,ie)|0,i=i+Math.imul(m,ae)|0;var _e=(u+(o=o+Math.imul(d,ce)|0)|0)+((8191&(n=(n=n+Math.imul(d,ue)|0)+Math.imul(p,ce)|0))<<13)|0;u=((i=i+Math.imul(p,ue)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,o=Math.imul(B,U),n=(n=Math.imul(B,K))+Math.imul(D,U)|0,i=Math.imul(D,K),o=o+Math.imul(C,G)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(P,G)|0,i=i+Math.imul(P,H)|0,o=o+Math.imul(S,W)|0,n=(n=n+Math.imul(S,z)|0)+Math.imul(R,W)|0,i=i+Math.imul(R,z)|0,o=o+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,Q)|0,i=i+Math.imul(O,Y)|0,o=o+Math.imul(_,J)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(T,J)|0,i=i+Math.imul(T,ee)|0,o=o+Math.imul(w,re)|0,n=(n=n+Math.imul(w,oe)|0)+Math.imul($,re)|0,i=i+Math.imul($,oe)|0,o=o+Math.imul(g,ie)|0,n=(n=n+Math.imul(g,ae)|0)+Math.imul(b,ie)|0,i=i+Math.imul(b,ae)|0,o=o+Math.imul(f,ce)|0,n=(n=n+Math.imul(f,ue)|0)+Math.imul(m,ce)|0,i=i+Math.imul(m,ue)|0;var Te=(u+(o=o+Math.imul(d,de)|0)|0)+((8191&(n=(n=n+Math.imul(d,pe)|0)+Math.imul(p,de)|0))<<13)|0;u=((i=i+Math.imul(p,pe)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,o=Math.imul(L,U),n=(n=Math.imul(L,K))+Math.imul(j,U)|0,i=Math.imul(j,K),o=o+Math.imul(B,G)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(D,G)|0,i=i+Math.imul(D,H)|0,o=o+Math.imul(C,W)|0,n=(n=n+Math.imul(C,z)|0)+Math.imul(P,W)|0,i=i+Math.imul(P,z)|0,o=o+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(R,Q)|0,i=i+Math.imul(R,Y)|0,o=o+Math.imul(A,J)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(O,J)|0,i=i+Math.imul(O,ee)|0,o=o+Math.imul(_,re)|0,n=(n=n+Math.imul(_,oe)|0)+Math.imul(T,re)|0,i=i+Math.imul(T,oe)|0,o=o+Math.imul(w,ie)|0,n=(n=n+Math.imul(w,ae)|0)+Math.imul($,ie)|0,i=i+Math.imul($,ae)|0,o=o+Math.imul(g,ce)|0,n=(n=n+Math.imul(g,ue)|0)+Math.imul(b,ce)|0,i=i+Math.imul(b,ue)|0,o=o+Math.imul(f,de)|0,n=(n=n+Math.imul(f,pe)|0)+Math.imul(m,de)|0,i=i+Math.imul(m,pe)|0;var Ie=(u+(o=o+Math.imul(d,fe)|0)|0)+((8191&(n=(n=n+Math.imul(d,me)|0)+Math.imul(p,fe)|0))<<13)|0;u=((i=i+Math.imul(p,me)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,o=Math.imul(L,G),n=(n=Math.imul(L,H))+Math.imul(j,G)|0,i=Math.imul(j,H),o=o+Math.imul(B,W)|0,n=(n=n+Math.imul(B,z)|0)+Math.imul(D,W)|0,i=i+Math.imul(D,z)|0,o=o+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,Y)|0,o=o+Math.imul(S,J)|0,n=(n=n+Math.imul(S,ee)|0)+Math.imul(R,J)|0,i=i+Math.imul(R,ee)|0,o=o+Math.imul(A,re)|0,n=(n=n+Math.imul(A,oe)|0)+Math.imul(O,re)|0,i=i+Math.imul(O,oe)|0,o=o+Math.imul(_,ie)|0,n=(n=n+Math.imul(_,ae)|0)+Math.imul(T,ie)|0,i=i+Math.imul(T,ae)|0,o=o+Math.imul(w,ce)|0,n=(n=n+Math.imul(w,ue)|0)+Math.imul($,ce)|0,i=i+Math.imul($,ue)|0,o=o+Math.imul(g,de)|0,n=(n=n+Math.imul(g,pe)|0)+Math.imul(b,de)|0,i=i+Math.imul(b,pe)|0;var Ae=(u+(o=o+Math.imul(f,fe)|0)|0)+((8191&(n=(n=n+Math.imul(f,me)|0)+Math.imul(m,fe)|0))<<13)|0;u=((i=i+Math.imul(m,me)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,o=Math.imul(L,W),n=(n=Math.imul(L,z))+Math.imul(j,W)|0,i=Math.imul(j,z),o=o+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(D,Q)|0,i=i+Math.imul(D,Y)|0,o=o+Math.imul(C,J)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(P,J)|0,i=i+Math.imul(P,ee)|0,o=o+Math.imul(S,re)|0,n=(n=n+Math.imul(S,oe)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,oe)|0,o=o+Math.imul(A,ie)|0,n=(n=n+Math.imul(A,ae)|0)+Math.imul(O,ie)|0,i=i+Math.imul(O,ae)|0,o=o+Math.imul(_,ce)|0,n=(n=n+Math.imul(_,ue)|0)+Math.imul(T,ce)|0,i=i+Math.imul(T,ue)|0,o=o+Math.imul(w,de)|0,n=(n=n+Math.imul(w,pe)|0)+Math.imul($,de)|0,i=i+Math.imul($,pe)|0;var Oe=(u+(o=o+Math.imul(g,fe)|0)|0)+((8191&(n=(n=n+Math.imul(g,me)|0)+Math.imul(b,fe)|0))<<13)|0;u=((i=i+Math.imul(b,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,o=Math.imul(L,Q),n=(n=Math.imul(L,Y))+Math.imul(j,Q)|0,i=Math.imul(j,Y),o=o+Math.imul(B,J)|0,n=(n=n+Math.imul(B,ee)|0)+Math.imul(D,J)|0,i=i+Math.imul(D,ee)|0,o=o+Math.imul(C,re)|0,n=(n=n+Math.imul(C,oe)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,oe)|0,o=o+Math.imul(S,ie)|0,n=(n=n+Math.imul(S,ae)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,ae)|0,o=o+Math.imul(A,ce)|0,n=(n=n+Math.imul(A,ue)|0)+Math.imul(O,ce)|0,i=i+Math.imul(O,ue)|0,o=o+Math.imul(_,de)|0,n=(n=n+Math.imul(_,pe)|0)+Math.imul(T,de)|0,i=i+Math.imul(T,pe)|0;var Ee=(u+(o=o+Math.imul(w,fe)|0)|0)+((8191&(n=(n=n+Math.imul(w,me)|0)+Math.imul($,fe)|0))<<13)|0;u=((i=i+Math.imul($,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,o=Math.imul(L,J),n=(n=Math.imul(L,ee))+Math.imul(j,J)|0,i=Math.imul(j,ee),o=o+Math.imul(B,re)|0,n=(n=n+Math.imul(B,oe)|0)+Math.imul(D,re)|0,i=i+Math.imul(D,oe)|0,o=o+Math.imul(C,ie)|0,n=(n=n+Math.imul(C,ae)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,ae)|0,o=o+Math.imul(S,ce)|0,n=(n=n+Math.imul(S,ue)|0)+Math.imul(R,ce)|0,i=i+Math.imul(R,ue)|0,o=o+Math.imul(A,de)|0,n=(n=n+Math.imul(A,pe)|0)+Math.imul(O,de)|0,i=i+Math.imul(O,pe)|0;var Se=(u+(o=o+Math.imul(_,fe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(T,fe)|0))<<13)|0;u=((i=i+Math.imul(T,me)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,o=Math.imul(L,re),n=(n=Math.imul(L,oe))+Math.imul(j,re)|0,i=Math.imul(j,oe),o=o+Math.imul(B,ie)|0,n=(n=n+Math.imul(B,ae)|0)+Math.imul(D,ie)|0,i=i+Math.imul(D,ae)|0,o=o+Math.imul(C,ce)|0,n=(n=n+Math.imul(C,ue)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,ue)|0,o=o+Math.imul(S,de)|0,n=(n=n+Math.imul(S,pe)|0)+Math.imul(R,de)|0,i=i+Math.imul(R,pe)|0;var Re=(u+(o=o+Math.imul(A,fe)|0)|0)+((8191&(n=(n=n+Math.imul(A,me)|0)+Math.imul(O,fe)|0))<<13)|0;u=((i=i+Math.imul(O,me)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,o=Math.imul(L,ie),n=(n=Math.imul(L,ae))+Math.imul(j,ie)|0,i=Math.imul(j,ae),o=o+Math.imul(B,ce)|0,n=(n=n+Math.imul(B,ue)|0)+Math.imul(D,ce)|0,i=i+Math.imul(D,ue)|0,o=o+Math.imul(C,de)|0,n=(n=n+Math.imul(C,pe)|0)+Math.imul(P,de)|0,i=i+Math.imul(P,pe)|0;var xe=(u+(o=o+Math.imul(S,fe)|0)|0)+((8191&(n=(n=n+Math.imul(S,me)|0)+Math.imul(R,fe)|0))<<13)|0;u=((i=i+Math.imul(R,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,o=Math.imul(L,ce),n=(n=Math.imul(L,ue))+Math.imul(j,ce)|0,i=Math.imul(j,ue),o=o+Math.imul(B,de)|0,n=(n=n+Math.imul(B,pe)|0)+Math.imul(D,de)|0,i=i+Math.imul(D,pe)|0;var Ce=(u+(o=o+Math.imul(C,fe)|0)|0)+((8191&(n=(n=n+Math.imul(C,me)|0)+Math.imul(P,fe)|0))<<13)|0;u=((i=i+Math.imul(P,me)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,o=Math.imul(L,de),n=(n=Math.imul(L,pe))+Math.imul(j,de)|0,i=Math.imul(j,pe);var Pe=(u+(o=o+Math.imul(B,fe)|0)|0)+((8191&(n=(n=n+Math.imul(B,me)|0)+Math.imul(D,fe)|0))<<13)|0;u=((i=i+Math.imul(D,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Ne=(u+(o=Math.imul(L,fe))|0)+((8191&(n=(n=Math.imul(L,me))+Math.imul(j,fe)|0))<<13)|0;return u=((i=Math.imul(j,me))+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=ye,c[1]=ge,c[2]=be,c[3]=ve,c[4]=we,c[5]=$e,c[6]=ke,c[7]=_e,c[8]=Te,c[9]=Ie,c[10]=Ae,c[11]=Oe,c[12]=Ee,c[13]=Se,c[14]=Re,c[15]=xe,c[16]=Ce,c[17]=Pe,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function y(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var o=0,n=0,i=0;i<r.length-1;i++){var a=n;n=0;for(var s=67108863&o,c=Math.min(i,t.length-1),u=Math.max(0,i-e.length+1);u<=c;u++){var l=i-u,d=(0|e.words[l])*(0|t.words[u]),p=67108863&d;s=67108863&(p=p+s|0),n+=(a=(a=a+(d/67108864|0)|0)+(p>>>26)|0)>>>26,a&=67108863}r.words[i]=s,o=a,a=n}return 0!==o?r.words[i]=o:r.length--,r._strip()}function g(e,t,r){return y(e,t,r)}Math.imul||(m=f),n.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):r<63?f(this,e,t):r<1024?y(this,e,t):g(this,e,t)},n.prototype.mul=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},n.prototype.mulf=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),g(this,e,t)},n.prototype.imul=function(e){return this.clone().mulTo(e,this)},n.prototype.imuln=function(e){var t=e<0;t&&(e=-e),r("number"==typeof e),r(e<67108864);for(var o=0,n=0;n<this.length;n++){var i=(0|this.words[n])*e,a=(67108863&i)+(67108863&o);o>>=26,o+=i/67108864|0,o+=a>>>26,this.words[n]=67108863&a}return 0!==o&&(this.words[n]=o,this.length++),t?this.ineg():this},n.prototype.muln=function(e){return this.clone().imuln(e)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var o=r/26|0,n=r%26;t[r]=e.words[o]>>>n&1}return t}(e);if(0===t.length)return new n(1);for(var r=this,o=0;o<t.length&&0===t[o];o++,r=r.sqr());if(++o<t.length)for(var i=r.sqr();o<t.length;o++,i=i.sqr())0!==t[o]&&(r=r.mul(i));return r},n.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,o=e%26,n=(e-o)/26,i=67108863>>>26-o<<26-o;if(0!==o){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&i,c=(0|this.words[t])-s<<o;this.words[t]=c|a,a=s>>>26-o}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()},n.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},n.prototype.iushrn=function(e,t,o){var n;r("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var i=e%26,a=Math.min((e-i)/26,this.length),s=67108863^67108863>>>i<<i,c=o;if(n-=a,n=Math.max(0,n),c){for(var u=0;u<a;u++)c.words[u]=this.words[u];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var d=0|this.words[u];this.words[u]=l<<26-i|d>>>i,l=d&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(e,t,o){return r(0===this.negative),this.iushrn(e,t,o)},n.prototype.shln=function(e){return this.clone().ishln(e)},n.prototype.ushln=function(e){return this.clone().iushln(e)},n.prototype.shrn=function(e){return this.clone().ishrn(e)},n.prototype.ushrn=function(e){return this.clone().iushrn(e)},n.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26,n=1<<t;return!(this.length<=o||!(this.words[o]&n))},n.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=o)return this;if(0!==t&&o++,this.length=Math.min(o,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(e){return this.clone().imaskn(e)},n.prototype.iaddn=function(e){return r("number"==typeof e),r(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)},n.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},n.prototype.isubn=function(e){if(r("number"==typeof e),r(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()},n.prototype.addn=function(e){return this.clone().iaddn(e)},n.prototype.subn=function(e){return this.clone().isubn(e)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(e,t,o){var n,i,a=e.length+o;this._expand(a);var s=0;for(n=0;n<e.length;n++){i=(0|this.words[n+o])+s;var c=(0|e.words[n])*t;s=((i-=67108863&c)>>26)-(c/67108864|0),this.words[n+o]=67108863&i}for(;n<this.length-o;n++)s=(i=(0|this.words[n+o])+s)>>26,this.words[n+o]=67108863&i;if(0===s)return this._strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(i=-(0|this.words[n])+s)>>26,this.words[n]=67108863&i;return this.negative=1,this._strip()},n.prototype._wordDiv=function(e,t){var r=(this.length,e.length),o=this.clone(),i=e,a=0|i.words[i.length-1];0!=(r=26-this._countBits(a))&&(i=i.ushln(r),o.iushln(r),a=0|i.words[i.length-1]);var s,c=o.length-i.length;if("mod"!==t){(s=new n(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=o.clone()._ishlnsubmul(i,1,c);0===l.negative&&(o=l,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var p=67108864*(0|o.words[i.length+d])+(0|o.words[i.length+d-1]);for(p=Math.min(p/a|0,67108863),o._ishlnsubmul(i,p,d);0!==o.negative;)p--,o.negative=0,o._ishlnsubmul(i,1,d),o.isZero()||(o.negative^=1);s&&(s.words[d]=p)}return s&&s._strip(),o._strip(),"div"!==t&&0!==r&&o.iushrn(r),{div:s||null,mod:o}},n.prototype.divmod=function(e,t,o){return r(!e.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new n(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new n(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new n(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},n.prototype.div=function(e){return this.divmod(e,"div",!1).div},n.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},n.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},n.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,o=e.ushrn(1),n=e.andln(1),i=r.cmp(o);return i<0||1===n&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},n.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var o=(1<<26)%e,n=0,i=this.length-1;i>=0;i--)n=(o*n+(0|this.words[i]))%e;return t?-n:n},n.prototype.modn=function(e){return this.modrn(e)},n.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var o=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*o;this.words[n]=i/e|0,o=i%e}return this._strip(),t?this.ineg():this},n.prototype.divn=function(e){return this.clone().idivn(e)},n.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new n(1),a=new n(0),s=new n(0),c=new n(1),u=0;t.isEven()&&o.isEven();)t.iushrn(1),o.iushrn(1),++u;for(var l=o.clone(),d=t.clone();!t.isZero();){for(var p=0,h=1;!(t.words[0]&h)&&p<26;++p,h<<=1);if(p>0)for(t.iushrn(p);p-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var f=0,m=1;!(o.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(o.iushrn(f);f-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(o)>=0?(t.isub(o),i.isub(s),a.isub(c)):(o.isub(t),s.isub(i),c.isub(a))}return{a:s,b:c,gcd:o.iushln(u)}},n.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new n(1),s=new n(0),c=o.clone();t.cmpn(1)>0&&o.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,p=1;!(o.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(o.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(o)>=0?(t.isub(o),a.isub(s)):(o.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},n.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 o=0;t.isEven()&&r.isEven();o++)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 i=t;t=r,r=i}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(o)},n.prototype.invm=function(e){return this.egcd(e).a.umod(e)},n.prototype.isEven=function(){return!(1&this.words[0])},n.prototype.isOdd=function(){return!(1&~this.words[0])},n.prototype.andln=function(e){return this.words[0]&e},n.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,o=(e-t)/26,n=1<<t;if(this.length<=o)return this._expand(o+1),this.words[o]|=n,this;for(var i=n,a=o;0!==i&&a<this.length;a++){var s=0|this.words[a];i=(s+=i)>>>26,s&=67108863,this.words[a]=s}return 0!==i&&(this.words[a]=i,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(e){var t,o=e<0;if(0!==this.negative&&!o)return-1;if(0===this.negative&&o)return 1;if(this._strip(),this.length>1)t=1;else{o&&(e=-e),r(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},n.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},n.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 o=0|this.words[r],n=0|e.words[r];if(o!==n){o<n?t=-1:o>n&&(t=1);break}}return t},n.prototype.gtn=function(e){return 1===this.cmpn(e)},n.prototype.gt=function(e){return 1===this.cmp(e)},n.prototype.gten=function(e){return this.cmpn(e)>=0},n.prototype.gte=function(e){return this.cmp(e)>=0},n.prototype.ltn=function(e){return-1===this.cmpn(e)},n.prototype.lt=function(e){return-1===this.cmp(e)},n.prototype.lten=function(e){return this.cmpn(e)<=0},n.prototype.lte=function(e){return this.cmp(e)<=0},n.prototype.eqn=function(e){return 0===this.cmpn(e)},n.prototype.eq=function(e){return 0===this.cmp(e)},n.red=function(e){return new T(e)},n.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(e){return this.red=e,this},n.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},n.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},n.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},n.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},n.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},n.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},n.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},n.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var b={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new n(t,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function $(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function T(e){if("string"==typeof e){var t=n._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function I(e){T.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var e=new n(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var o=t<this.n?-1:r.ucmp(this.p);return 0===o?(r.words[0]=0,r.length=1):o>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},o(w,v),w.prototype.split=function(e,t){for(var r=4194303,o=Math.min(e.length,9),n=0;n<o;n++)t.words[n]=e.words[n];if(t.length=o,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=i&r,n=10;n<e.length;n++){var a=0|e.words[n];e.words[n-10]=(a&r)<<4|i>>>22,i=a}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},w.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 o=0|e.words[r];t+=977*o,e.words[r]=67108863&t,t=64*o+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},o($,v),o(k,v),o(_,v),_.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var o=19*(0|e.words[r])+t,n=67108863&o;o>>>=26,e.words[r]=n,t=o}return 0!==t&&(e.words[e.length++]=t),e},n._prime=function(e){if(b[e])return b[e];var t;if("k256"===e)t=new w;else if("p224"===e)t=new $;else if("p192"===e)t=new k;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return b[e]=t,t},T.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},T.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},T.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},T.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},T.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)},T.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},T.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)},T.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},T.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},T.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},T.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},T.prototype.isqr=function(e){return this.imul(e,e.clone())},T.prototype.sqr=function(e){return this.mul(e,e)},T.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var o=this.m.add(new n(1)).iushrn(2);return this.pow(e,o)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new n(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),p=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),f=a;0!==h.cmp(s);){for(var m=h,y=0;0!==m.cmp(s);y++)m=m.redSqr();r(y<f);var g=this.pow(d,new n(1).iushln(f-y-1));p=p.redMul(g),d=g.redSqr(),h=h.redMul(d),f=y}return p},T.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},T.prototype.pow=function(e,t){if(t.isZero())return new n(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=e;for(var o=2;o<r.length;o++)r[o]=this.mul(r[o-1],e);var i=r[0],a=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),o=t.length-1;o>=0;o--){for(var u=t.words[o],l=c-1;l>=0;l--){var d=u>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===o&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}c=26}return i},T.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},T.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},n.mont=function(e){return new I(e)},o(I,T),I.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},I.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},I.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(o).iushrn(this.shift),i=n;return n.cmp(this.m)>=0?i=n.isub(this.m):n.cmpn(0)<0&&(i=n.iadd(this.m)),i._forceRed(this)},I.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new n(0)._forceRed(this);var r=e.mul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(o).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},I.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(module2,commonjsGlobal);var bnExports$1=bn$4.exports;const _BN=getDefaultExportFromCjs$2(bnExports$1);var browserifyRsa,hasRequiredBrowserifyRsa;function requireBrowserifyRsa(){if(hasRequiredBrowserifyRsa)return browserifyRsa;hasRequiredBrowserifyRsa=1;var e=bnExports$1,t=requireBrowser$b(),r=requireSafeBuffer$1().Buffer;function o(r){var o,n=r.modulus.byteLength();do{o=new e(t(n))}while(o.cmp(r.modulus)>=0||!o.umod(r.prime1)||!o.umod(r.prime2));return o}function n(t,n){var i=function(t){var r=o(t);return{blinder:r.toRed(e.mont(t.modulus)).redPow(new e(t.publicExponent)).fromRed(),unblinder:r.invm(t.modulus)}}(n),a=n.modulus.byteLength(),s=new e(t).mul(i.blinder).umod(n.modulus),c=s.toRed(e.mont(n.prime1)),u=s.toRed(e.mont(n.prime2)),l=n.coefficient,d=n.prime1,p=n.prime2,h=c.redPow(n.exponent1).fromRed(),f=u.redPow(n.exponent2).fromRed(),m=h.isub(f).imul(l).umod(d).imul(p);return f.iadd(m).imul(i.unblinder).umod(n.modulus).toArrayLike(r,"be",a)}return n.getr=o,browserifyRsa=n}var elliptic$1={};const version$7="6.6.1",require$$0$1={version:version$7};var utils$o={},bn$3={exports:{}};bn$3.exports,function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function o(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function n(e,t,r){if(n.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 i;"object"==typeof e?e.exports=n:t.BN=n,n.BN=n,n.wordSize=26;try{i="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require$$0$2.Buffer}catch(T){}function a(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(e,t,r){var o=a(e,r);return r-1>=t&&(o|=a(e,r-1)<<4),o}function c(e,t,r,o){for(var n=0,i=Math.min(e.length,r),a=t;a<i;a++){var s=e.charCodeAt(a)-48;n*=o,n+=s>=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(e){return e instanceof n||null!==e&&"object"==typeof e&&e.constructor.wordSize===n.wordSize&&Array.isArray(e.words)},n.max=function(e,t){return e.cmp(t)>0?e:t},n.min=function(e,t){return e.cmp(t)<0?e:t},n.prototype._init=function(e,t,o){if("number"==typeof e)return this._initNumber(e,t,o);if("object"==typeof e)return this._initArray(e,t,o);"hex"===t&&(t=16),r(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,o):(this._parseBase(e,t,n),"le"===o&&this._initArray(this.toArray(),t,o)))},n.prototype._initNumber=function(e,t,o){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):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===o&&this._initArray(this.toArray(),t,o)},n.prototype._initArray=function(e,t,o){if(r("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 i,a,s=0;if("be"===o)for(n=e.length-1,i=0;n>=0;n-=3)a=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===o)for(n=0,i=0;n<e.length;n+=3)a=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this.strip()},n.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var n,i=0,a=0;if("be"===r)for(o=e.length-1;o>=t;o-=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;else for(o=(e.length-t)%2==0?t+1:t;o<e.length;o+=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;this.strip()},n.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var o=0,n=1;n<=67108863;n*=t)o++;o--,n=n/t|0;for(var i=e.length-r,a=i%o,s=Math.min(i,i-a)+r,u=0,l=r;l<s;l+=o)u=c(e,l,l+o,t),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var d=1;for(u=c(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.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},n.prototype.clone=function(){var e=new n(null);return this.copy(e),e},n.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","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"],l=[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],d=[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 p(e,t,r){r.negative=t.negative^e.negative;var o=e.length+t.length|0;r.length=o,o=o-1|0;var n=0|e.words[0],i=0|t.words[0],a=n*i,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u<o;u++){for(var l=c>>>26,d=67108863&c,p=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=p;h++){var f=u-h|0;l+=(a=(n=0|e.words[f])*(i=0|t.words[h])+d)/67108864|0,d=67108863&a}r.words[u]=0|d,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}n.prototype.toString=function(e,t){var o;if(t=0|t||1,16===(e=e||10)||"hex"===e){o="";for(var n=0,i=0,a=0;a<this.length;a++){var s=this.words[a],c=(16777215&(s<<n|i)).toString(16);i=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),o=0!==i||a!==this.length-1?u[6-c.length]+c+o:c+o}for(0!==i&&(o=i.toString(16)+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}if(e===(0|e)&&e>=2&&e<=36){var p=l[e],h=d[e];o="";var f=this.clone();for(f.negative=0;!f.isZero();){var m=f.modn(h).toString(e);o=(f=f.idivn(h)).isZero()?m+o:u[p-m.length]+m+o}for(this.isZero()&&(o="0"+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}r(!1,"Base should be between 2 and 36")},n.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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(e,t){return r(void 0!==i),this.toArrayLike(i,e,t)},n.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},n.prototype.toArrayLike=function(e,t,o){var n=this.byteLength(),i=o||Math.max(1,n);r(n<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===t,u=new e(i),l=this.clone();if(c){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[s]=a;for(;s<i;s++)u[s]=0}else{for(s=0;s<i-n;s++)u[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[i-s-1]=a}return u},Math.clz32?n.prototype._countBits=function(e){return 32-Math.clz32(e)}:n.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},n.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},n.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},n.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},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},n.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(e){return r(!(this.negative|e.negative)),this.iuor(e)},n.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},n.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},n.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()},n.prototype.iand=function(e){return r(!(this.negative|e.negative)),this.iuand(e)},n.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},n.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},n.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var o=0;o<r.length;o++)this.words[o]=t.words[o]^r.words[o];if(this!==t)for(;o<t.length;o++)this.words[o]=t.words[o];return this.length=t.length,this.strip()},n.prototype.ixor=function(e){return r(!(this.negative|e.negative)),this.iuxor(e)},n.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},n.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},n.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),o=e%26;this._expand(t),o>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return o>0&&(this.words[n]=~this.words[n]&67108863>>26-o),this.strip()},n.prototype.notn=function(e){return this.clone().inotn(e)},n.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var o=e/26|0,n=e%26;return this._expand(o+1),this.words[o]=t?this.words[o]|1<<n:this.words[o]&~(1<<n),this.strip()},n.prototype.iadd=function(e){var t,r,o;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,o=e):(r=e,o=this);for(var n=0,i=0;i<o.length;i++)t=(0|r.words[i])+(0|o.words[i])+n,this.words[i]=67108863&t,n=t>>>26;for(;0!==n&&i<r.length;i++)t=(0|r.words[i])+n,this.words[i]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;i<r.length;i++)this.words[i]=r.words[i];return this},n.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)},n.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,o,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,o=e):(r=e,o=this);for(var i=0,a=0;a<o.length;a++)i=(t=(0|r.words[a])-(0|o.words[a])+i)>>26,this.words[a]=67108863&t;for(;0!==i&&a<r.length;a++)i=(t=(0|r.words[a])+i)>>26,this.words[a]=67108863&t;if(0===i&&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()},n.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,r){var o,n,i,a=e.words,s=t.words,c=r.words,u=0,l=0|a[0],d=8191&l,p=l>>>13,h=0|a[1],f=8191&h,m=h>>>13,y=0|a[2],g=8191&y,b=y>>>13,v=0|a[3],w=8191&v,$=v>>>13,k=0|a[4],_=8191&k,T=k>>>13,I=0|a[5],A=8191&I,O=I>>>13,E=0|a[6],S=8191&E,R=E>>>13,x=0|a[7],C=8191&x,P=x>>>13,N=0|a[8],B=8191&N,D=N>>>13,M=0|a[9],L=8191&M,j=M>>>13,F=0|s[0],U=8191&F,K=F>>>13,q=0|s[1],G=8191&q,H=q>>>13,V=0|s[2],W=8191&V,z=V>>>13,Z=0|s[3],Q=8191&Z,Y=Z>>>13,X=0|s[4],J=8191&X,ee=X>>>13,te=0|s[5],re=8191&te,oe=te>>>13,ne=0|s[6],ie=8191&ne,ae=ne>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],de=8191&le,pe=le>>>13,he=0|s[9],fe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(u+(o=Math.imul(d,U))|0)+((8191&(n=(n=Math.imul(d,K))+Math.imul(p,U)|0))<<13)|0;u=((i=Math.imul(p,K))+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,o=Math.imul(f,U),n=(n=Math.imul(f,K))+Math.imul(m,U)|0,i=Math.imul(m,K);var ge=(u+(o=o+Math.imul(d,G)|0)|0)+((8191&(n=(n=n+Math.imul(d,H)|0)+Math.imul(p,G)|0))<<13)|0;u=((i=i+Math.imul(p,H)|0)+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,o=Math.imul(g,U),n=(n=Math.imul(g,K))+Math.imul(b,U)|0,i=Math.imul(b,K),o=o+Math.imul(f,G)|0,n=(n=n+Math.imul(f,H)|0)+Math.imul(m,G)|0,i=i+Math.imul(m,H)|0;var be=(u+(o=o+Math.imul(d,W)|0)|0)+((8191&(n=(n=n+Math.imul(d,z)|0)+Math.imul(p,W)|0))<<13)|0;u=((i=i+Math.imul(p,z)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,o=Math.imul(w,U),n=(n=Math.imul(w,K))+Math.imul($,U)|0,i=Math.imul($,K),o=o+Math.imul(g,G)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(b,G)|0,i=i+Math.imul(b,H)|0,o=o+Math.imul(f,W)|0,n=(n=n+Math.imul(f,z)|0)+Math.imul(m,W)|0,i=i+Math.imul(m,z)|0;var ve=(u+(o=o+Math.imul(d,Q)|0)|0)+((8191&(n=(n=n+Math.imul(d,Y)|0)+Math.imul(p,Q)|0))<<13)|0;u=((i=i+Math.imul(p,Y)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,o=Math.imul(_,U),n=(n=Math.imul(_,K))+Math.imul(T,U)|0,i=Math.imul(T,K),o=o+Math.imul(w,G)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul($,G)|0,i=i+Math.imul($,H)|0,o=o+Math.imul(g,W)|0,n=(n=n+Math.imul(g,z)|0)+Math.imul(b,W)|0,i=i+Math.imul(b,z)|0,o=o+Math.imul(f,Q)|0,n=(n=n+Math.imul(f,Y)|0)+Math.imul(m,Q)|0,i=i+Math.imul(m,Y)|0;var we=(u+(o=o+Math.imul(d,J)|0)|0)+((8191&(n=(n=n+Math.imul(d,ee)|0)+Math.imul(p,J)|0))<<13)|0;u=((i=i+Math.imul(p,ee)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,o=Math.imul(A,U),n=(n=Math.imul(A,K))+Math.imul(O,U)|0,i=Math.imul(O,K),o=o+Math.imul(_,G)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(T,G)|0,i=i+Math.imul(T,H)|0,o=o+Math.imul(w,W)|0,n=(n=n+Math.imul(w,z)|0)+Math.imul($,W)|0,i=i+Math.imul($,z)|0,o=o+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(b,Q)|0,i=i+Math.imul(b,Y)|0,o=o+Math.imul(f,J)|0,n=(n=n+Math.imul(f,ee)|0)+Math.imul(m,J)|0,i=i+Math.imul(m,ee)|0;var $e=(u+(o=o+Math.imul(d,re)|0)|0)+((8191&(n=(n=n+Math.imul(d,oe)|0)+Math.imul(p,re)|0))<<13)|0;u=((i=i+Math.imul(p,oe)|0)+(n>>>13)|0)+($e>>>26)|0,$e&=67108863,o=Math.imul(S,U),n=(n=Math.imul(S,K))+Math.imul(R,U)|0,i=Math.imul(R,K),o=o+Math.imul(A,G)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(O,G)|0,i=i+Math.imul(O,H)|0,o=o+Math.imul(_,W)|0,n=(n=n+Math.imul(_,z)|0)+Math.imul(T,W)|0,i=i+Math.imul(T,z)|0,o=o+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul($,Q)|0,i=i+Math.imul($,Y)|0,o=o+Math.imul(g,J)|0,n=(n=n+Math.imul(g,ee)|0)+Math.imul(b,J)|0,i=i+Math.imul(b,ee)|0,o=o+Math.imul(f,re)|0,n=(n=n+Math.imul(f,oe)|0)+Math.imul(m,re)|0,i=i+Math.imul(m,oe)|0;var ke=(u+(o=o+Math.imul(d,ie)|0)|0)+((8191&(n=(n=n+Math.imul(d,ae)|0)+Math.imul(p,ie)|0))<<13)|0;u=((i=i+Math.imul(p,ae)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,o=Math.imul(C,U),n=(n=Math.imul(C,K))+Math.imul(P,U)|0,i=Math.imul(P,K),o=o+Math.imul(S,G)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,G)|0,i=i+Math.imul(R,H)|0,o=o+Math.imul(A,W)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(O,W)|0,i=i+Math.imul(O,z)|0,o=o+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(T,Q)|0,i=i+Math.imul(T,Y)|0,o=o+Math.imul(w,J)|0,n=(n=n+Math.imul(w,ee)|0)+Math.imul($,J)|0,i=i+Math.imul($,ee)|0,o=o+Math.imul(g,re)|0,n=(n=n+Math.imul(g,oe)|0)+Math.imul(b,re)|0,i=i+Math.imul(b,oe)|0,o=o+Math.imul(f,ie)|0,n=(n=n+Math.imul(f,ae)|0)+Math.imul(m,ie)|0,i=i+Math.imul(m,ae)|0;var _e=(u+(o=o+Math.imul(d,ce)|0)|0)+((8191&(n=(n=n+Math.imul(d,ue)|0)+Math.imul(p,ce)|0))<<13)|0;u=((i=i+Math.imul(p,ue)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,o=Math.imul(B,U),n=(n=Math.imul(B,K))+Math.imul(D,U)|0,i=Math.imul(D,K),o=o+Math.imul(C,G)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(P,G)|0,i=i+Math.imul(P,H)|0,o=o+Math.imul(S,W)|0,n=(n=n+Math.imul(S,z)|0)+Math.imul(R,W)|0,i=i+Math.imul(R,z)|0,o=o+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,Q)|0,i=i+Math.imul(O,Y)|0,o=o+Math.imul(_,J)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(T,J)|0,i=i+Math.imul(T,ee)|0,o=o+Math.imul(w,re)|0,n=(n=n+Math.imul(w,oe)|0)+Math.imul($,re)|0,i=i+Math.imul($,oe)|0,o=o+Math.imul(g,ie)|0,n=(n=n+Math.imul(g,ae)|0)+Math.imul(b,ie)|0,i=i+Math.imul(b,ae)|0,o=o+Math.imul(f,ce)|0,n=(n=n+Math.imul(f,ue)|0)+Math.imul(m,ce)|0,i=i+Math.imul(m,ue)|0;var Te=(u+(o=o+Math.imul(d,de)|0)|0)+((8191&(n=(n=n+Math.imul(d,pe)|0)+Math.imul(p,de)|0))<<13)|0;u=((i=i+Math.imul(p,pe)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,o=Math.imul(L,U),n=(n=Math.imul(L,K))+Math.imul(j,U)|0,i=Math.imul(j,K),o=o+Math.imul(B,G)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(D,G)|0,i=i+Math.imul(D,H)|0,o=o+Math.imul(C,W)|0,n=(n=n+Math.imul(C,z)|0)+Math.imul(P,W)|0,i=i+Math.imul(P,z)|0,o=o+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(R,Q)|0,i=i+Math.imul(R,Y)|0,o=o+Math.imul(A,J)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(O,J)|0,i=i+Math.imul(O,ee)|0,o=o+Math.imul(_,re)|0,n=(n=n+Math.imul(_,oe)|0)+Math.imul(T,re)|0,i=i+Math.imul(T,oe)|0,o=o+Math.imul(w,ie)|0,n=(n=n+Math.imul(w,ae)|0)+Math.imul($,ie)|0,i=i+Math.imul($,ae)|0,o=o+Math.imul(g,ce)|0,n=(n=n+Math.imul(g,ue)|0)+Math.imul(b,ce)|0,i=i+Math.imul(b,ue)|0,o=o+Math.imul(f,de)|0,n=(n=n+Math.imul(f,pe)|0)+Math.imul(m,de)|0,i=i+Math.imul(m,pe)|0;var Ie=(u+(o=o+Math.imul(d,fe)|0)|0)+((8191&(n=(n=n+Math.imul(d,me)|0)+Math.imul(p,fe)|0))<<13)|0;u=((i=i+Math.imul(p,me)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,o=Math.imul(L,G),n=(n=Math.imul(L,H))+Math.imul(j,G)|0,i=Math.imul(j,H),o=o+Math.imul(B,W)|0,n=(n=n+Math.imul(B,z)|0)+Math.imul(D,W)|0,i=i+Math.imul(D,z)|0,o=o+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,Y)|0,o=o+Math.imul(S,J)|0,n=(n=n+Math.imul(S,ee)|0)+Math.imul(R,J)|0,i=i+Math.imul(R,ee)|0,o=o+Math.imul(A,re)|0,n=(n=n+Math.imul(A,oe)|0)+Math.imul(O,re)|0,i=i+Math.imul(O,oe)|0,o=o+Math.imul(_,ie)|0,n=(n=n+Math.imul(_,ae)|0)+Math.imul(T,ie)|0,i=i+Math.imul(T,ae)|0,o=o+Math.imul(w,ce)|0,n=(n=n+Math.imul(w,ue)|0)+Math.imul($,ce)|0,i=i+Math.imul($,ue)|0,o=o+Math.imul(g,de)|0,n=(n=n+Math.imul(g,pe)|0)+Math.imul(b,de)|0,i=i+Math.imul(b,pe)|0;var Ae=(u+(o=o+Math.imul(f,fe)|0)|0)+((8191&(n=(n=n+Math.imul(f,me)|0)+Math.imul(m,fe)|0))<<13)|0;u=((i=i+Math.imul(m,me)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,o=Math.imul(L,W),n=(n=Math.imul(L,z))+Math.imul(j,W)|0,i=Math.imul(j,z),o=o+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(D,Q)|0,i=i+Math.imul(D,Y)|0,o=o+Math.imul(C,J)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(P,J)|0,i=i+Math.imul(P,ee)|0,o=o+Math.imul(S,re)|0,n=(n=n+Math.imul(S,oe)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,oe)|0,o=o+Math.imul(A,ie)|0,n=(n=n+Math.imul(A,ae)|0)+Math.imul(O,ie)|0,i=i+Math.imul(O,ae)|0,o=o+Math.imul(_,ce)|0,n=(n=n+Math.imul(_,ue)|0)+Math.imul(T,ce)|0,i=i+Math.imul(T,ue)|0,o=o+Math.imul(w,de)|0,n=(n=n+Math.imul(w,pe)|0)+Math.imul($,de)|0,i=i+Math.imul($,pe)|0;var Oe=(u+(o=o+Math.imul(g,fe)|0)|0)+((8191&(n=(n=n+Math.imul(g,me)|0)+Math.imul(b,fe)|0))<<13)|0;u=((i=i+Math.imul(b,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,o=Math.imul(L,Q),n=(n=Math.imul(L,Y))+Math.imul(j,Q)|0,i=Math.imul(j,Y),o=o+Math.imul(B,J)|0,n=(n=n+Math.imul(B,ee)|0)+Math.imul(D,J)|0,i=i+Math.imul(D,ee)|0,o=o+Math.imul(C,re)|0,n=(n=n+Math.imul(C,oe)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,oe)|0,o=o+Math.imul(S,ie)|0,n=(n=n+Math.imul(S,ae)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,ae)|0,o=o+Math.imul(A,ce)|0,n=(n=n+Math.imul(A,ue)|0)+Math.imul(O,ce)|0,i=i+Math.imul(O,ue)|0,o=o+Math.imul(_,de)|0,n=(n=n+Math.imul(_,pe)|0)+Math.imul(T,de)|0,i=i+Math.imul(T,pe)|0;var Ee=(u+(o=o+Math.imul(w,fe)|0)|0)+((8191&(n=(n=n+Math.imul(w,me)|0)+Math.imul($,fe)|0))<<13)|0;u=((i=i+Math.imul($,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,o=Math.imul(L,J),n=(n=Math.imul(L,ee))+Math.imul(j,J)|0,i=Math.imul(j,ee),o=o+Math.imul(B,re)|0,n=(n=n+Math.imul(B,oe)|0)+Math.imul(D,re)|0,i=i+Math.imul(D,oe)|0,o=o+Math.imul(C,ie)|0,n=(n=n+Math.imul(C,ae)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,ae)|0,o=o+Math.imul(S,ce)|0,n=(n=n+Math.imul(S,ue)|0)+Math.imul(R,ce)|0,i=i+Math.imul(R,ue)|0,o=o+Math.imul(A,de)|0,n=(n=n+Math.imul(A,pe)|0)+Math.imul(O,de)|0,i=i+Math.imul(O,pe)|0;var Se=(u+(o=o+Math.imul(_,fe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(T,fe)|0))<<13)|0;u=((i=i+Math.imul(T,me)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,o=Math.imul(L,re),n=(n=Math.imul(L,oe))+Math.imul(j,re)|0,i=Math.imul(j,oe),o=o+Math.imul(B,ie)|0,n=(n=n+Math.imul(B,ae)|0)+Math.imul(D,ie)|0,i=i+Math.imul(D,ae)|0,o=o+Math.imul(C,ce)|0,n=(n=n+Math.imul(C,ue)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,ue)|0,o=o+Math.imul(S,de)|0,n=(n=n+Math.imul(S,pe)|0)+Math.imul(R,de)|0,i=i+Math.imul(R,pe)|0;var Re=(u+(o=o+Math.imul(A,fe)|0)|0)+((8191&(n=(n=n+Math.imul(A,me)|0)+Math.imul(O,fe)|0))<<13)|0;u=((i=i+Math.imul(O,me)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,o=Math.imul(L,ie),n=(n=Math.imul(L,ae))+Math.imul(j,ie)|0,i=Math.imul(j,ae),o=o+Math.imul(B,ce)|0,n=(n=n+Math.imul(B,ue)|0)+Math.imul(D,ce)|0,i=i+Math.imul(D,ue)|0,o=o+Math.imul(C,de)|0,n=(n=n+Math.imul(C,pe)|0)+Math.imul(P,de)|0,i=i+Math.imul(P,pe)|0;var xe=(u+(o=o+Math.imul(S,fe)|0)|0)+((8191&(n=(n=n+Math.imul(S,me)|0)+Math.imul(R,fe)|0))<<13)|0;u=((i=i+Math.imul(R,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,o=Math.imul(L,ce),n=(n=Math.imul(L,ue))+Math.imul(j,ce)|0,i=Math.imul(j,ue),o=o+Math.imul(B,de)|0,n=(n=n+Math.imul(B,pe)|0)+Math.imul(D,de)|0,i=i+Math.imul(D,pe)|0;var Ce=(u+(o=o+Math.imul(C,fe)|0)|0)+((8191&(n=(n=n+Math.imul(C,me)|0)+Math.imul(P,fe)|0))<<13)|0;u=((i=i+Math.imul(P,me)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,o=Math.imul(L,de),n=(n=Math.imul(L,pe))+Math.imul(j,de)|0,i=Math.imul(j,pe);var Pe=(u+(o=o+Math.imul(B,fe)|0)|0)+((8191&(n=(n=n+Math.imul(B,me)|0)+Math.imul(D,fe)|0))<<13)|0;u=((i=i+Math.imul(D,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Ne=(u+(o=Math.imul(L,fe))|0)+((8191&(n=(n=Math.imul(L,me))+Math.imul(j,fe)|0))<<13)|0;return u=((i=Math.imul(j,me))+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=ye,c[1]=ge,c[2]=be,c[3]=ve,c[4]=we,c[5]=$e,c[6]=ke,c[7]=_e,c[8]=Te,c[9]=Ie,c[10]=Ae,c[11]=Oe,c[12]=Ee,c[13]=Se,c[14]=Re,c[15]=xe,c[16]=Ce,c[17]=Pe,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function f(e,t,r){return(new m).mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(h=p),n.prototype.mulTo=function(e,t){var r,o=this.length+e.length;return r=10===this.length&&10===e.length?h(this,e,t):o<63?p(this,e,t):o<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var o=0,n=0,i=0;i<r.length-1;i++){var a=n;n=0;for(var s=67108863&o,c=Math.min(i,t.length-1),u=Math.max(0,i-e.length+1);u<=c;u++){var l=i-u,d=(0|e.words[l])*(0|t.words[u]),p=67108863&d;s=67108863&(p=p+s|0),n+=(a=(a=a+(d/67108864|0)|0)+(p>>>26)|0)>>>26,a&=67108863}r.words[i]=s,o=a,a=n}return 0!==o?r.words[i]=o:r.length--,r.strip()}(this,e,t):f(this,e,t),r},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=n.prototype._countBits(e)-1,o=0;o<e;o++)t[o]=this.revBin(o,r,e);return t},m.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var o=0,n=0;n<t;n++)o|=(1&e)<<t-n-1,e>>=1;return o},m.prototype.permute=function(e,t,r,o,n,i){for(var a=0;a<i;a++)o[a]=t[e[a]],n[a]=r[e[a]]},m.prototype.transform=function(e,t,r,o,n,i){this.permute(i,e,t,r,o,n);for(var a=1;a<n;a<<=1)for(var s=a<<1,c=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),l=0;l<n;l+=s)for(var d=c,p=u,h=0;h<a;h++){var f=r[l+h],m=o[l+h],y=r[l+h+a],g=o[l+h+a],b=d*y-p*g;g=d*g+p*y,y=b,r[l+h]=f+y,o[l+h]=m+g,r[l+h+a]=f-y,o[l+h+a]=m-g,h!==s&&(b=c*d-u*p,p=c*p+u*d,d=b)}},m.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),o=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+o},m.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var o=0;o<r/2;o++){var n=e[o];e[o]=e[r-o-1],e[r-o-1]=n,n=t[o],t[o]=-t[r-o-1],t[r-o-1]=-n}},m.prototype.normalize13b=function(e,t){for(var r=0,o=0;o<t/2;o++){var n=8192*Math.round(e[2*o+1]/t)+Math.round(e[2*o]/t)+r;e[o]=67108863&n,r=n<67108864?0:n/67108864|0}return e},m.prototype.convert13b=function(e,t,o,n){for(var i=0,a=0;a<t;a++)i+=0|e[a],o[2*a]=8191&i,i>>>=13,o[2*a+1]=8191&i,i>>>=13;for(a=2*t;a<n;++a)o[a]=0;r(0===i),r(!(-8192&i))},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 o=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(o),i=this.stub(o),a=new Array(o),s=new Array(o),c=new Array(o),u=new Array(o),l=new Array(o),d=new Array(o),p=r.words;p.length=o,this.convert13b(e.words,e.length,a,o),this.convert13b(t.words,t.length,u,o),this.transform(a,i,s,c,o,n),this.transform(u,i,l,d,o,n);for(var h=0;h<o;h++){var f=s[h]*l[h]-c[h]*d[h];c[h]=s[h]*d[h]+c[h]*l[h],s[h]=f}return this.conjugate(s,c,o),this.transform(s,c,p,i,o,n),this.conjugate(p,i,o),this.normalize13b(p,o),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},n.prototype.mul=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},n.prototype.mulf=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),f(this,e,t)},n.prototype.imul=function(e){return this.clone().mulTo(e,this)},n.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,o=0;o<this.length;o++){var n=(0|this.words[o])*e,i=(67108863&n)+(67108863&t);t>>=26,t+=n/67108864|0,t+=i>>>26,this.words[o]=67108863&i}return 0!==t&&(this.words[o]=t,this.length++),this},n.prototype.muln=function(e){return this.clone().imuln(e)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var o=r/26|0,n=r%26;t[r]=(e.words[o]&1<<n)>>>n}return t}(e);if(0===t.length)return new n(1);for(var r=this,o=0;o<t.length&&0===t[o];o++,r=r.sqr());if(++o<t.length)for(var i=r.sqr();o<t.length;o++,i=i.sqr())0!==t[o]&&(r=r.mul(i));return r},n.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,o=e%26,n=(e-o)/26,i=67108863>>>26-o<<26-o;if(0!==o){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&i,c=(0|this.words[t])-s<<o;this.words[t]=c|a,a=s>>>26-o}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()},n.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},n.prototype.iushrn=function(e,t,o){var n;r("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var i=e%26,a=Math.min((e-i)/26,this.length),s=67108863^67108863>>>i<<i,c=o;if(n-=a,n=Math.max(0,n),c){for(var u=0;u<a;u++)c.words[u]=this.words[u];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var d=0|this.words[u];this.words[u]=l<<26-i|d>>>i,l=d&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(e,t,o){return r(0===this.negative),this.iushrn(e,t,o)},n.prototype.shln=function(e){return this.clone().ishln(e)},n.prototype.ushln=function(e){return this.clone().iushln(e)},n.prototype.shrn=function(e){return this.clone().ishrn(e)},n.prototype.ushrn=function(e){return this.clone().iushrn(e)},n.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26,n=1<<t;return!(this.length<=o)&&!!(this.words[o]&n)},n.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=o)return this;if(0!==t&&o++,this.length=Math.min(o,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(e){return this.clone().imaskn(e)},n.prototype.iaddn=function(e){return r("number"==typeof e),r(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)},n.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},n.prototype.isubn=function(e){if(r("number"==typeof e),r(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()},n.prototype.addn=function(e){return this.clone().iaddn(e)},n.prototype.subn=function(e){return this.clone().isubn(e)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(e,t,o){var n,i,a=e.length+o;this._expand(a);var s=0;for(n=0;n<e.length;n++){i=(0|this.words[n+o])+s;var c=(0|e.words[n])*t;s=((i-=67108863&c)>>26)-(c/67108864|0),this.words[n+o]=67108863&i}for(;n<this.length-o;n++)s=(i=(0|this.words[n+o])+s)>>26,this.words[n+o]=67108863&i;if(0===s)return this.strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(i=-(0|this.words[n])+s)>>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},n.prototype._wordDiv=function(e,t){var r=(this.length,e.length),o=this.clone(),i=e,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),o.iushln(r),a=0|i.words[i.length-1]);var s,c=o.length-i.length;if("mod"!==t){(s=new n(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=o.clone()._ishlnsubmul(i,1,c);0===l.negative&&(o=l,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var p=67108864*(0|o.words[i.length+d])+(0|o.words[i.length+d-1]);for(p=Math.min(p/a|0,67108863),o._ishlnsubmul(i,p,d);0!==o.negative;)p--,o.negative=0,o._ishlnsubmul(i,1,d),o.isZero()||(o.negative^=1);s&&(s.words[d]=p)}return s&&s.strip(),o.strip(),"div"!==t&&0!==r&&o.iushrn(r),{div:s||null,mod:o}},n.prototype.divmod=function(e,t,o){return r(!e.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new n(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new n(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new n(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},n.prototype.div=function(e){return this.divmod(e,"div",!1).div},n.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},n.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},n.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,o=e.ushrn(1),n=e.andln(1),i=r.cmp(o);return i<0||1===n&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},n.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,o=0,n=this.length-1;n>=0;n--)o=(t*o+(0|this.words[n]))%e;return o},n.prototype.idivn=function(e){r(e<=67108863);for(var t=0,o=this.length-1;o>=0;o--){var n=(0|this.words[o])+67108864*t;this.words[o]=n/e|0,t=n%e}return this.strip()},n.prototype.divn=function(e){return this.clone().idivn(e)},n.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new n(1),a=new n(0),s=new n(0),c=new n(1),u=0;t.isEven()&&o.isEven();)t.iushrn(1),o.iushrn(1),++u;for(var l=o.clone(),d=t.clone();!t.isZero();){for(var p=0,h=1;!(t.words[0]&h)&&p<26;++p,h<<=1);if(p>0)for(t.iushrn(p);p-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var f=0,m=1;!(o.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(o.iushrn(f);f-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(o)>=0?(t.isub(o),i.isub(s),a.isub(c)):(o.isub(t),s.isub(i),c.isub(a))}return{a:s,b:c,gcd:o.iushln(u)}},n.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new n(1),s=new n(0),c=o.clone();t.cmpn(1)>0&&o.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,p=1;!(o.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(o.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(o)>=0?(t.isub(o),a.isub(s)):(o.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},n.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 o=0;t.isEven()&&r.isEven();o++)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 i=t;t=r,r=i}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(o)},n.prototype.invm=function(e){return this.egcd(e).a.umod(e)},n.prototype.isEven=function(){return!(1&this.words[0])},n.prototype.isOdd=function(){return!(1&~this.words[0])},n.prototype.andln=function(e){return this.words[0]&e},n.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,o=(e-t)/26,n=1<<t;if(this.length<=o)return this._expand(o+1),this.words[o]|=n,this;for(var i=n,a=o;0!==i&&a<this.length;a++){var s=0|this.words[a];i=(s+=i)>>>26,s&=67108863,this.words[a]=s}return 0!==i&&(this.words[a]=i,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(e){var t,o=e<0;if(0!==this.negative&&!o)return-1;if(0===this.negative&&o)return 1;if(this.strip(),this.length>1)t=1;else{o&&(e=-e),r(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},n.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},n.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 o=0|this.words[r],n=0|e.words[r];if(o!==n){o<n?t=-1:o>n&&(t=1);break}}return t},n.prototype.gtn=function(e){return 1===this.cmpn(e)},n.prototype.gt=function(e){return 1===this.cmp(e)},n.prototype.gten=function(e){return this.cmpn(e)>=0},n.prototype.gte=function(e){return this.cmp(e)>=0},n.prototype.ltn=function(e){return-1===this.cmpn(e)},n.prototype.lt=function(e){return-1===this.cmp(e)},n.prototype.lten=function(e){return this.cmpn(e)<=0},n.prototype.lte=function(e){return this.cmp(e)<=0},n.prototype.eqn=function(e){return 0===this.cmpn(e)},n.prototype.eq=function(e){return 0===this.cmp(e)},n.red=function(e){return new k(e)},n.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(e){return this.red=e,this},n.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},n.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},n.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},n.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},n.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},n.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},n.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},n.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function g(e,t){this.name=e,this.p=new n(t,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function $(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(e){if("string"==typeof e){var t=n._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function _(e){k.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}g.prototype._tmp=function(){var e=new n(null);return e.words=new Array(Math.ceil(this.n/13)),e},g.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 o=t<this.n?-1:r.ucmp(this.p);return 0===o?(r.words[0]=0,r.length=1):o>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(e,t){e.iushrn(this.n,0,t)},g.prototype.imulK=function(e){return e.imul(this.k)},o(b,g),b.prototype.split=function(e,t){for(var r=4194303,o=Math.min(e.length,9),n=0;n<o;n++)t.words[n]=e.words[n];if(t.length=o,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=i&r,n=10;n<e.length;n++){var a=0|e.words[n];e.words[n-10]=(a&r)<<4|i>>>22,i=a}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},b.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 o=0|e.words[r];t+=977*o,e.words[r]=67108863&t,t=64*o+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},o(v,g),o(w,g),o($,g),$.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var o=19*(0|e.words[r])+t,n=67108863&o;o>>>=26,e.words[r]=n,t=o}return 0!==t&&(e.words[e.length++]=t),e},n._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new $}return y[e]=t,t},k.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},k.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},k.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},k.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},k.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},k.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},k.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},k.prototype.isqr=function(e){return this.imul(e,e.clone())},k.prototype.sqr=function(e){return this.mul(e,e)},k.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var o=this.m.add(new n(1)).iushrn(2);return this.pow(e,o)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new n(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),p=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),f=a;0!==h.cmp(s);){for(var m=h,y=0;0!==m.cmp(s);y++)m=m.redSqr();r(y<f);var g=this.pow(d,new n(1).iushln(f-y-1));p=p.redMul(g),d=g.redSqr(),h=h.redMul(d),f=y}return p},k.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},k.prototype.pow=function(e,t){if(t.isZero())return new n(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=e;for(var o=2;o<r.length;o++)r[o]=this.mul(r[o-1],e);var i=r[0],a=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),o=t.length-1;o>=0;o--){for(var u=t.words[o],l=c-1;l>=0;l--){var d=u>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4===++s||0===o&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}c=26}return i},k.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},k.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},n.mont=function(e){return new _(e)},o(_,k),_.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},_.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},_.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(o).iushrn(this.shift),i=n;return n.cmp(this.m)>=0?i=n.isub(this.m):n.cmpn(0)<0&&(i=n.iadd(this.m)),i._forceRed(this)},_.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new n(0)._forceRed(this);var r=e.mul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(o).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},_.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,commonjsGlobal)}(bn$3);var bnExports=bn$3.exports,utils$n={};!function(e){var t=e;function r(e){return 1===e.length?"0"+e:e}function o(e){for(var t="",o=0;o<e.length;o++)t+=r(e[o].toString(16));return t}t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var o=0;o<e.length;o++)r[o]=0|e[o];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(o=0;o<e.length;o+=2)r.push(parseInt(e[o]+e[o+1],16))}else for(o=0;o<e.length;o++){var n=e.charCodeAt(o),i=n>>8,a=255&n;i?r.push(i,a):r.push(a)}return r},t.zero2=r,t.toHex=o,t.encode=function(e,t){return"hex"===t?o(e):e}}(utils$n),function(e){var t=e,r=bnExports,o=minimalisticAssert,n=utils$n;t.assert=o,t.toArray=n.toArray,t.zero2=n.zero2,t.toHex=n.toHex,t.encode=n.encode,t.getNAF=function(e,t,r){var o,n=new Array(Math.max(e.bitLength(),r)+1);for(o=0;o<n.length;o+=1)n[o]=0;var i=1<<t+1,a=e.clone();for(o=0;o<n.length;o++){var s,c=a.andln(i-1);a.isOdd()?(s=c>(i>>1)-1?(i>>1)-c:c,a.isubn(s)):s=0,n[o]=s,a.iushrn(1)}return n},t.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var o,n=0,i=0;e.cmpn(-n)>0||t.cmpn(-i)>0;){var a,s,c=e.andln(3)+n&3,u=t.andln(3)+i&3;3===c&&(c=-1),3===u&&(u=-1),a=1&c?3!==(o=e.andln(7)+n&7)&&5!==o||2!==u?c:-c:0,r[0].push(a),s=1&u?3!==(o=t.andln(7)+i&7)&&5!==o||2!==c?u:-u:0,r[1].push(s),2*n===a+1&&(n=1-n),2*i===s+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return r},t.cachedProperty=function(e,t,r){var o="_"+t;e.prototype[t]=function(){return void 0!==this[o]?this[o]:this[o]=r.call(this)}},t.parseBytes=function(e){return"string"==typeof e?t.toArray(e,"hex"):e},t.intFromLE=function(e){return new r(e,"hex","le")}}(utils$o);var curve={},BN$7=bnExports,utils$m=utils$o,getNAF=utils$m.getNAF,getJSF=utils$m.getJSF,assert$e=utils$m.assert;function BaseCurve(e,t){this.type=e,this.p=new BN$7(t.p,16),this.red=t.prime?BN$7.red(t.prime):BN$7.mont(this.p),this.zero=new BN$7(0).toRed(this.red),this.one=new BN$7(1).toRed(this.red),this.two=new BN$7(2).toRed(this.red),this.n=t.n&&new BN$7(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))}var base$1=BaseCurve;function BasePoint(e,t){this.curve=e,this.type=t,this.precomputed=null}BaseCurve.prototype.point=function(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function(e,t){assert$e(e.precomputed);var r=e._getDoubles(),o=getNAF(t,1,this._bitLength),n=(1<<r.step+1)-(r.step%2==0?2:1);n/=3;var i,a,s=[];for(i=0;i<o.length;i+=r.step){a=0;for(var c=i+r.step-1;c>=i;c--)a=(a<<1)+o[c];s.push(a)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=n;d>0;d--){for(i=0;i<s.length;i++)(a=s[i])===d?l=l.mixedAdd(r.points[i]):a===-d&&(l=l.mixedAdd(r.points[i].neg()));u=u.add(l)}return u.toP()},BaseCurve.prototype._wnafMul=function(e,t){var r=4,o=e._getNAFPoints(r);r=o.wnd;for(var n=o.points,i=getNAF(t,r,this._bitLength),a=this.jpoint(null,null,null),s=i.length-1;s>=0;s--){for(var c=0;s>=0&&0===i[s];s--)c++;if(s>=0&&c++,a=a.dblp(c),s<0)break;var u=i[s];assert$e(0!==u),a="affine"===e.type?u>0?a.mixedAdd(n[u-1>>1]):a.mixedAdd(n[-u-1>>1].neg()):u>0?a.add(n[u-1>>1]):a.add(n[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},BaseCurve.prototype._wnafMulAdd=function(e,t,r,o,n){var i,a,s,c=this._wnafT1,u=this._wnafT2,l=this._wnafT3,d=0;for(i=0;i<o;i++){var p=(s=t[i])._getNAFPoints(e);c[i]=p.wnd,u[i]=p.points}for(i=o-1;i>=1;i-=2){var h=i-1,f=i;if(1===c[h]&&1===c[f]){var m=[t[h],null,null,t[f]];0===t[h].y.cmp(t[f].y)?(m[1]=t[h].add(t[f]),m[2]=t[h].toJ().mixedAdd(t[f].neg())):0===t[h].y.cmp(t[f].y.redNeg())?(m[1]=t[h].toJ().mixedAdd(t[f]),m[2]=t[h].add(t[f].neg())):(m[1]=t[h].toJ().mixedAdd(t[f]),m[2]=t[h].toJ().mixedAdd(t[f].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],g=getJSF(r[h],r[f]);for(d=Math.max(g[0].length,d),l[h]=new Array(d),l[f]=new Array(d),a=0;a<d;a++){var b=0|g[0][a],v=0|g[1][a];l[h][a]=y[3*(b+1)+(v+1)],l[f][a]=0,u[h]=m}}else l[h]=getNAF(r[h],c[h],this._bitLength),l[f]=getNAF(r[f],c[f],this._bitLength),d=Math.max(l[h].length,d),d=Math.max(l[f].length,d)}var w=this.jpoint(null,null,null),$=this._wnafT4;for(i=d;i>=0;i--){for(var k=0;i>=0;){var _=!0;for(a=0;a<o;a++)$[a]=0|l[a][i],0!==$[a]&&(_=!1);if(!_)break;k++,i--}if(i>=0&&k++,w=w.dblp(k),i<0)break;for(a=0;a<o;a++){var T=$[a];0!==T&&(T>0?s=u[a][T-1>>1]:T<0&&(s=u[a][-T-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(i=0;i<o;i++)u[i]=null;return n?w:w.toP()},BaseCurve.BasePoint=BasePoint,BasePoint.prototype.eq=function(){throw new Error("Not implemented")},BasePoint.prototype.validate=function(){return this.curve.validate(this)},BaseCurve.prototype.decodePoint=function(e,t){e=utils$m.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]?assert$e(e[e.length-1]%2==0):7===e[0]&&assert$e(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")},BasePoint.prototype.encodeCompressed=function(e){return this.encode(e,!0)},BasePoint.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))},BasePoint.prototype.encode=function(e,t){return utils$m.encode(this._encode(t),e)},BasePoint.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},BasePoint.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)},BasePoint.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],o=this,n=0;n<t;n+=e){for(var i=0;i<e;i++)o=o.dbl();r.push(o)}return{step:e,points:r}},BasePoint.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,o=1===r?null:this.dbl(),n=1;n<r;n++)t[n]=t[n-1].add(o);return{wnd:e,points:t}},BasePoint.prototype._getBeta=function(){return null},BasePoint.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var utils$l=utils$o,BN$6=bnExports,inherits$5=requireInherits_browser(),Base$2=base$1,assert$d=utils$l.assert;function ShortCurve(e){Base$2.call(this,"short",e),this.a=new BN$6(e.a,16).toRed(this.red),this.b=new BN$6(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)}inherits$5(ShortCurve,Base$2);var short=ShortCurve;function Point$2(e,t,r,o){Base$2.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new BN$6(t,16),this.y=new BN$6(r,16),o&&(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 JPoint(e,t,r,o){Base$2.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===o?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN$6(0)):(this.x=new BN$6(t,16),this.y=new BN$6(r,16),this.z=new BN$6(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.zOne=this.z===this.curve.one}ShortCurve.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new BN$6(e.beta,16).toRed(this.red);else{var o=this._getEndoRoots(this.p);t=(t=o[0].cmp(o[1])<0?o[0]:o[1]).toRed(this.red)}if(e.lambda)r=new BN$6(e.lambda,16);else{var n=this._getEndoRoots(this.n);0===this.g.mul(n[0]).x.cmp(this.g.x.redMul(t))?r=n[0]:(r=n[1],assert$d(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 BN$6(e.a,16),b:new BN$6(e.b,16)}})):this._getEndoBasis(r)}}},ShortCurve.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:BN$6.mont(e),r=new BN$6(2).toRed(t).redInvm(),o=r.redNeg(),n=new BN$6(3).toRed(t).redNeg().redSqrt().redMul(r);return[o.redAdd(n).fromRed(),o.redSub(n).fromRed()]},ShortCurve.prototype._getEndoBasis=function(e){for(var t,r,o,n,i,a,s,c,u,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,p=this.n.clone(),h=new BN$6(1),f=new BN$6(0),m=new BN$6(0),y=new BN$6(1),g=0;0!==d.cmpn(0);){var b=p.div(d);c=p.sub(b.mul(d)),u=m.sub(b.mul(h));var v=y.sub(b.mul(f));if(!o&&c.cmp(l)<0)t=s.neg(),r=h,o=c.neg(),n=u;else if(o&&2==++g)break;s=c,p=d,d=c,m=h,h=u,y=f,f=v}i=c.neg(),a=u;var w=o.sqr().add(n.sqr());return i.sqr().add(a.sqr()).cmp(w)>=0&&(i=t,a=r),o.negative&&(o=o.neg(),n=n.neg()),i.negative&&(i=i.neg(),a=a.neg()),[{a:o,b:n},{a:i,b:a}]},ShortCurve.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],o=t[1],n=o.b.mul(e).divRound(this.n),i=r.b.neg().mul(e).divRound(this.n),a=n.mul(r.a),s=i.mul(o.a),c=n.mul(r.b),u=i.mul(o.b);return{k1:e.sub(a).sub(s),k2:c.add(u).neg()}},ShortCurve.prototype.pointFromX=function(e,t){(e=new BN$6(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),o=r.redSqrt();if(0!==o.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var n=o.fromRed().isOdd();return(t&&!n||!t&&n)&&(o=o.redNeg()),this.point(e,o)},ShortCurve.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,o=this.a.redMul(t),n=t.redSqr().redMul(t).redIAdd(o).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},ShortCurve.prototype._endoWnafMulAdd=function(e,t,r){for(var o=this._endoWnafT1,n=this._endoWnafT2,i=0;i<e.length;i++){var a=this._endoSplit(t[i]),s=e[i],c=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),c=c.neg(!0)),o[2*i]=s,o[2*i+1]=c,n[2*i]=a.k1,n[2*i+1]=a.k2}for(var u=this._wnafMulAdd(1,o,n,2*i,r),l=0;l<2*i;l++)o[l]=null,n[l]=null;return u},inherits$5(Point$2,Base$2.BasePoint),ShortCurve.prototype.point=function(e,t,r){return new Point$2(this,e,t,r)},ShortCurve.prototype.pointFromJSON=function(e,t){return Point$2.fromJSON(this,e,t)},Point$2.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,o=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(o)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(o)}}}return t}},Point$2.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]},Point$2.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var o=e.point(t[0],t[1],r);if(!t[2])return o;function n(t){return e.point(t[0],t[1],r)}var i=t[2];return o.precomputed={beta:null,doubles:i.doubles&&{step:i.doubles.step,points:[o].concat(i.doubles.points.map(n))},naf:i.naf&&{wnd:i.naf.wnd,points:[o].concat(i.naf.points.map(n))}},o},Point$2.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)+">"},Point$2.prototype.isInfinity=function(){return this.inf},Point$2.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),o=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,o)},Point$2.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(),o=e.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(o),i=n.redSqr().redISub(this.x.redAdd(this.x)),a=n.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,a)},Point$2.prototype.getX=function(){return this.x.fromRed()},Point$2.prototype.getY=function(){return this.y.fromRed()},Point$2.prototype.mul=function(e){return e=new BN$6(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)},Point$2.prototype.mulAdd=function(e,t,r){var o=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(o,n):this.curve._wnafMulAdd(1,o,n,2)},Point$2.prototype.jmulAdd=function(e,t,r){var o=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(o,n,!0):this.curve._wnafMulAdd(1,o,n,2,!0)},Point$2.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))},Point$2.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,o=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(o)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(o)}}}return t},Point$2.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},inherits$5(JPoint,Base$2.BasePoint),ShortCurve.prototype.jpoint=function(e,t,r){return new JPoint(this,e,t,r)},JPoint.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),o=this.y.redMul(t).redMul(e);return this.curve.point(r,o)},JPoint.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},JPoint.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),o=this.x.redMul(t),n=e.x.redMul(r),i=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=o.redSub(n),c=i.redSub(a);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),d=o.redMul(u),p=c.redSqr().redIAdd(l).redISub(d).redISub(d),h=c.redMul(d.redISub(p)).redISub(i.redMul(l)),f=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(p,h,f)},JPoint.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,o=e.x.redMul(t),n=this.y,i=e.y.redMul(t).redMul(this.z),a=r.redSub(o),s=n.redSub(i);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),l=r.redMul(c),d=s.redSqr().redIAdd(u).redISub(l).redISub(l),p=s.redMul(l.redISub(d)).redISub(n.redMul(u)),h=this.z.redMul(a);return this.curve.jpoint(d,p,h)},JPoint.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 o=this.curve.a,n=this.curve.tinv,i=this.x,a=this.y,s=this.z,c=s.redSqr().redSqr(),u=a.redAdd(a);for(t=0;t<e;t++){var l=i.redSqr(),d=u.redSqr(),p=d.redSqr(),h=l.redAdd(l).redIAdd(l).redIAdd(o.redMul(c)),f=i.redMul(d),m=h.redSqr().redISub(f.redAdd(f)),y=f.redISub(m),g=h.redMul(y);g=g.redIAdd(g).redISub(p);var b=u.redMul(s);t+1<e&&(c=c.redMul(p)),i=m,s=b,u=g}return this.curve.jpoint(i,u.redMul(n),s)},JPoint.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},JPoint.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var o=this.x.redSqr(),n=this.y.redSqr(),i=n.redSqr(),a=this.x.redAdd(n).redSqr().redISub(o).redISub(i);a=a.redIAdd(a);var s=o.redAdd(o).redIAdd(o),c=s.redSqr().redISub(a).redISub(a),u=i.redIAdd(i);u=(u=u.redIAdd(u)).redIAdd(u),e=c,t=s.redMul(a.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),d=this.y.redSqr(),p=d.redSqr(),h=this.x.redAdd(d).redSqr().redISub(l).redISub(p);h=h.redIAdd(h);var f=l.redAdd(l).redIAdd(l),m=f.redSqr(),y=p.redIAdd(p);y=(y=y.redIAdd(y)).redIAdd(y),e=m.redISub(h).redISub(h),t=f.redMul(h.redISub(e)).redISub(y),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},JPoint.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var o=this.x.redSqr(),n=this.y.redSqr(),i=n.redSqr(),a=this.x.redAdd(n).redSqr().redISub(o).redISub(i);a=a.redIAdd(a);var s=o.redAdd(o).redIAdd(o).redIAdd(this.curve.a),c=s.redSqr().redISub(a).redISub(a);e=c;var u=i.redIAdd(i);u=(u=u.redIAdd(u)).redIAdd(u),t=s.redMul(a.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),d=this.y.redSqr(),p=this.x.redMul(d),h=this.x.redSub(l).redMul(this.x.redAdd(l));h=h.redAdd(h).redIAdd(h);var f=p.redIAdd(p),m=(f=f.redIAdd(f)).redAdd(f);e=h.redSqr().redISub(m),r=this.y.redAdd(this.z).redSqr().redISub(d).redISub(l);var y=d.redSqr();y=(y=(y=y.redIAdd(y)).redIAdd(y)).redIAdd(y),t=h.redMul(f.redISub(e)).redISub(y)}return this.curve.jpoint(e,t,r)},JPoint.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,o=this.z,n=o.redSqr().redSqr(),i=t.redSqr(),a=r.redSqr(),s=i.redAdd(i).redIAdd(i).redIAdd(e.redMul(n)),c=t.redAdd(t),u=(c=c.redIAdd(c)).redMul(a),l=s.redSqr().redISub(u.redAdd(u)),d=u.redISub(l),p=a.redSqr();p=(p=(p=p.redIAdd(p)).redIAdd(p)).redIAdd(p);var h=s.redMul(d).redISub(p),f=r.redAdd(r).redMul(o);return this.curve.jpoint(l,h,f)},JPoint.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(),o=t.redSqr(),n=e.redAdd(e).redIAdd(e),i=n.redSqr(),a=this.x.redAdd(t).redSqr().redISub(e).redISub(o),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(i)).redSqr(),c=o.redIAdd(o);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var u=n.redIAdd(a).redSqr().redISub(i).redISub(s).redISub(c),l=t.redMul(u);l=(l=l.redIAdd(l)).redIAdd(l);var d=this.x.redMul(s).redISub(l);d=(d=d.redIAdd(d)).redIAdd(d);var p=this.y.redMul(u.redMul(c.redISub(u)).redISub(a.redMul(s)));p=(p=(p=p.redIAdd(p)).redIAdd(p)).redIAdd(p);var h=this.z.redAdd(a).redSqr().redISub(r).redISub(s);return this.curve.jpoint(d,p,h)},JPoint.prototype.mul=function(e,t){return e=new BN$6(e,t),this.curve._wnafMul(this,e)},JPoint.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 o=t.redMul(this.z),n=r.redMul(e.z);return 0===this.y.redMul(n).redISub(e.y.redMul(o)).cmpn(0)},JPoint.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 o=e.clone(),n=this.curve.redN.redMul(t);;){if(o.iadd(this.curve.n),o.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},JPoint.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)+">"},JPoint.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var BN$5=bnExports,inherits$4=requireInherits_browser(),Base$1=base$1,utils$k=utils$o;function MontCurve(e){Base$1.call(this,"mont",e),this.a=new BN$5(e.a,16).toRed(this.red),this.b=new BN$5(e.b,16).toRed(this.red),this.i4=new BN$5(4).toRed(this.red).redInvm(),this.two=new BN$5(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}inherits$4(MontCurve,Base$1);var mont=MontCurve;function Point$1(e,t,r){Base$1.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new BN$5(t,16),this.z=new BN$5(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}MontCurve.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),o=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===o.redSqrt().redSqr().cmp(o)},inherits$4(Point$1,Base$1.BasePoint),MontCurve.prototype.decodePoint=function(e,t){return this.point(utils$k.toArray(e,t),1)},MontCurve.prototype.point=function(e,t){return new Point$1(this,e,t)},MontCurve.prototype.pointFromJSON=function(e){return Point$1.fromJSON(this,e)},Point$1.prototype.precompute=function(){},Point$1.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Point$1.fromJSON=function(e,t){return new Point$1(e,t[0],t[1]||e.one)},Point$1.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)+">"},Point$1.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},Point$1.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),o=e.redMul(t),n=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(o,n)},Point$1.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Point$1.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),o=this.x.redSub(this.z),n=e.x.redAdd(e.z),i=e.x.redSub(e.z).redMul(r),a=n.redMul(o),s=t.z.redMul(i.redAdd(a).redSqr()),c=t.x.redMul(i.redISub(a).redSqr());return this.curve.point(s,c)},Point$1.prototype.mul=function(e){for(var t=e.clone(),r=this,o=this.curve.point(null,null),n=[];0!==t.cmpn(0);t.iushrn(1))n.push(t.andln(1));for(var i=n.length-1;i>=0;i--)0===n[i]?(r=r.diffAdd(o,this),o=o.dbl()):(o=r.diffAdd(o,this),r=r.dbl());return o},Point$1.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Point$1.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Point$1.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},Point$1.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Point$1.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var utils$j=utils$o,BN$4=bnExports,inherits$3=requireInherits_browser(),Base=base$1,assert$c=utils$j.assert;function EdwardsCurve(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,Base.call(this,"edwards",e),this.a=new BN$4(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new BN$4(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new BN$4(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),assert$c(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}inherits$3(EdwardsCurve,Base);var edwards=EdwardsCurve;function Point(e,t,r,o,n){Base.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===o?(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 BN$4(t,16),this.y=new BN$4(r,16),this.z=o?new BN$4(o,16):this.curve.one,this.t=n&&new BN$4(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.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()))))}EdwardsCurve.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},EdwardsCurve.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},EdwardsCurve.prototype.jpoint=function(e,t,r,o){return this.point(e,t,r,o)},EdwardsCurve.prototype.pointFromX=function(e,t){(e=new BN$4(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),o=this.c2.redSub(this.a.redMul(r)),n=this.one.redSub(this.c2.redMul(this.d).redMul(r)),i=o.redMul(n.redInvm()),a=i.redSqrt();if(0!==a.redSqr().redSub(i).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(t&&!s||!t&&s)&&(a=a.redNeg()),this.point(e,a)},EdwardsCurve.prototype.pointFromY=function(e,t){(e=new BN$4(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),o=r.redSub(this.c2),n=r.redMul(this.d).redMul(this.c2).redSub(this.a),i=o.redMul(n.redInvm());if(0===i.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=i.redSqrt();if(0!==a.redSqr().redSub(i).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},EdwardsCurve.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),o=t.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===o.cmp(n)},inherits$3(Point,Base.BasePoint),EdwardsCurve.prototype.pointFromJSON=function(e){return Point.fromJSON(this,e)},EdwardsCurve.prototype.point=function(e,t,r,o){return new Point(this,e,t,r,o)},Point.fromJSON=function(e,t){return new Point(e,t[0],t[1],t[2])},Point.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)+">"},Point.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},Point.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var o=this.curve._mulA(e),n=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),i=o.redAdd(t),a=i.redSub(r),s=o.redSub(t),c=n.redMul(a),u=i.redMul(s),l=n.redMul(s),d=a.redMul(i);return this.curve.point(c,u,d,l)},Point.prototype._projDbl=function(){var e,t,r,o,n,i,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(o=this.curve._mulA(s)).redAdd(c);this.zOne?(e=a.redSub(s).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(o.redSub(c)),r=u.redSqr().redSub(u).redSub(u)):(n=this.z.redSqr(),i=u.redSub(n).redISub(n),e=a.redSub(s).redISub(c).redMul(i),t=u.redMul(o.redSub(c)),r=u.redMul(i))}else o=s.redAdd(c),n=this.curve._mulC(this.z).redSqr(),i=o.redSub(n).redSub(n),e=this.curve._mulC(a.redISub(o)).redMul(i),t=this.curve._mulC(o).redMul(s.redISub(c)),r=o.redMul(i);return this.curve.point(e,t,r)},Point.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Point.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)),o=this.t.redMul(this.curve.dd).redMul(e.t),n=this.z.redMul(e.z.redAdd(e.z)),i=r.redSub(t),a=n.redSub(o),s=n.redAdd(o),c=r.redAdd(t),u=i.redMul(a),l=s.redMul(c),d=i.redMul(c),p=a.redMul(s);return this.curve.point(u,l,p,d)},Point.prototype._projAdd=function(e){var t,r,o=this.z.redMul(e.z),n=o.redSqr(),i=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(i).redMul(a),c=n.redSub(s),u=n.redAdd(s),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(a),d=o.redMul(c).redMul(l);return this.curve.twisted?(t=o.redMul(u).redMul(a.redSub(this.curve._mulA(i))),r=c.redMul(u)):(t=o.redMul(u).redMul(a.redSub(i)),r=this.curve._mulC(c).redMul(u)),this.curve.point(d,t,r)},Point.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Point.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Point.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},Point.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},Point.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},Point.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Point.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Point.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Point.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},Point.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(),o=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(o),0===this.x.cmp(t))return!0}},Point.prototype.toP=Point.prototype.normalize,Point.prototype.mixedAdd=Point.prototype.add,function(e){var t=e;t.base=base$1,t.short=short,t.mont=mont,t.edwards=edwards}(curve);var curves$1={},hash$3={},utils$i={},assert$b=minimalisticAssert,inherits$2=requireInherits_browser();function isSurrogatePair(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function toArray$2(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 o=0,n=0;n<e.length;n++){var i=e.charCodeAt(n);i<128?r[o++]=i:i<2048?(r[o++]=i>>6|192,r[o++]=63&i|128):isSurrogatePair(e,n)?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n)),r[o++]=i>>18|240,r[o++]=i>>12&63|128,r[o++]=i>>6&63|128,r[o++]=63&i|128):(r[o++]=i>>12|224,r[o++]=i>>6&63|128,r[o++]=63&i|128)}else for(n=0;n<e.length;n++)r[n]=0|e[n];return r}function toHex$1(e){for(var t="",r=0;r<e.length;r++)t+=zero2(e[r].toString(16));return t}function htonl(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function toHex32(e,t){for(var r="",o=0;o<e.length;o++){var n=e[o];"little"===t&&(n=htonl(n)),r+=zero8(n.toString(16))}return r}function zero2(e){return 1===e.length?"0"+e:e}function zero8(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}function join32(e,t,r,o){var n=r-t;assert$b(n%4==0);for(var i=new Array(n/4),a=0,s=t;a<i.length;a++,s+=4){var c;c="big"===o?e[s]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3]:e[s+3]<<24|e[s+2]<<16|e[s+1]<<8|e[s],i[a]=c>>>0}return i}function split32(e,t){for(var r=new Array(4*e.length),o=0,n=0;o<e.length;o++,n+=4){var i=e[o];"big"===t?(r[n]=i>>>24,r[n+1]=i>>>16&255,r[n+2]=i>>>8&255,r[n+3]=255&i):(r[n+3]=i>>>24,r[n+2]=i>>>16&255,r[n+1]=i>>>8&255,r[n]=255&i)}return r}function rotr32$1(e,t){return e>>>t|e<<32-t}function rotl32$2(e,t){return e<<t|e>>>32-t}function sum32$3(e,t){return e+t>>>0}function sum32_3$1(e,t,r){return e+t+r>>>0}function sum32_4$2(e,t,r,o){return e+t+r+o>>>0}function sum32_5$2(e,t,r,o,n){return e+t+r+o+n>>>0}function sum64$1(e,t,r,o){var n=e[t],i=o+e[t+1]>>>0,a=(i<o?1:0)+r+n;e[t]=a>>>0,e[t+1]=i}function sum64_hi$1(e,t,r,o){return(t+o>>>0<t?1:0)+e+r>>>0}function sum64_lo$1(e,t,r,o){return t+o>>>0}function sum64_4_hi$1(e,t,r,o,n,i,a,s){var c=0,u=t;return c+=(u=u+o>>>0)<t?1:0,c+=(u=u+i>>>0)<i?1:0,e+r+n+a+(c+=(u=u+s>>>0)<s?1:0)>>>0}function sum64_4_lo$1(e,t,r,o,n,i,a,s){return t+o+i+s>>>0}function sum64_5_hi$1(e,t,r,o,n,i,a,s,c,u){var l=0,d=t;return l+=(d=d+o>>>0)<t?1:0,l+=(d=d+i>>>0)<i?1:0,l+=(d=d+s>>>0)<s?1:0,e+r+n+a+c+(l+=(d=d+u>>>0)<u?1:0)>>>0}function sum64_5_lo$1(e,t,r,o,n,i,a,s,c,u){return t+o+i+s+u>>>0}function rotr64_hi$1(e,t,r){return(t<<32-r|e>>>r)>>>0}function rotr64_lo$1(e,t,r){return(e<<32-r|t>>>r)>>>0}function shr64_hi$1(e,t,r){return e>>>r}function shr64_lo$1(e,t,r){return(e<<32-r|t>>>r)>>>0}utils$i.inherits=inherits$2,utils$i.toArray=toArray$2,utils$i.toHex=toHex$1,utils$i.htonl=htonl,utils$i.toHex32=toHex32,utils$i.zero2=zero2,utils$i.zero8=zero8,utils$i.join32=join32,utils$i.split32=split32,utils$i.rotr32=rotr32$1,utils$i.rotl32=rotl32$2,utils$i.sum32=sum32$3,utils$i.sum32_3=sum32_3$1,utils$i.sum32_4=sum32_4$2,utils$i.sum32_5=sum32_5$2,utils$i.sum64=sum64$1,utils$i.sum64_hi=sum64_hi$1,utils$i.sum64_lo=sum64_lo$1,utils$i.sum64_4_hi=sum64_4_hi$1,utils$i.sum64_4_lo=sum64_4_lo$1,utils$i.sum64_5_hi=sum64_5_hi$1,utils$i.sum64_5_lo=sum64_5_lo$1,utils$i.rotr64_hi=rotr64_hi$1,utils$i.rotr64_lo=rotr64_lo$1,utils$i.shr64_hi=shr64_hi$1,utils$i.shr64_lo=shr64_lo$1;var common$5={},utils$h=utils$i,assert$a=minimalisticAssert;function BlockHash$4(){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}common$5.BlockHash=BlockHash$4,BlockHash$4.prototype.update=function(e,t){if(e=utils$h.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=utils$h.join32(e,0,e.length-r,this.endian);for(var o=0;o<e.length;o+=this._delta32)this._update(e,o,o+this._delta32)}return this},BlockHash$4.prototype.digest=function(e){return this.update(this._pad()),assert$a(null===this.pending),this._digest(e)},BlockHash$4.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,o=new Array(r+this.padLength);o[0]=128;for(var n=1;n<r;n++)o[n]=0;if(e<<=3,"big"===this.endian){for(var i=8;i<this.padLength;i++)o[n++]=0;o[n++]=0,o[n++]=0,o[n++]=0,o[n++]=0,o[n++]=e>>>24&255,o[n++]=e>>>16&255,o[n++]=e>>>8&255,o[n++]=255&e}else for(o[n++]=255&e,o[n++]=e>>>8&255,o[n++]=e>>>16&255,o[n++]=e>>>24&255,o[n++]=0,o[n++]=0,o[n++]=0,o[n++]=0,i=8;i<this.padLength;i++)o[n++]=0;return o};var sha={},common$4={},utils$g=utils$i,rotr32=utils$g.rotr32;function ft_1$1(e,t,r,o){return 0===e?ch32$1(t,r,o):1===e||3===e?p32(t,r,o):2===e?maj32$1(t,r,o):void 0}function ch32$1(e,t,r){return e&t^~e&r}function maj32$1(e,t,r){return e&t^e&r^t&r}function p32(e,t,r){return e^t^r}function s0_256$1(e){return rotr32(e,2)^rotr32(e,13)^rotr32(e,22)}function s1_256$1(e){return rotr32(e,6)^rotr32(e,11)^rotr32(e,25)}function g0_256$1(e){return rotr32(e,7)^rotr32(e,18)^e>>>3}function g1_256$1(e){return rotr32(e,17)^rotr32(e,19)^e>>>10}common$4.ft_1=ft_1$1,common$4.ch32=ch32$1,common$4.maj32=maj32$1,common$4.p32=p32,common$4.s0_256=s0_256$1,common$4.s1_256=s1_256$1,common$4.g0_256=g0_256$1,common$4.g1_256=g1_256$1;var utils$f=utils$i,common$3=common$5,shaCommon$1=common$4,rotl32$1=utils$f.rotl32,sum32$2=utils$f.sum32,sum32_5$1=utils$f.sum32_5,ft_1=shaCommon$1.ft_1,BlockHash$3=common$3.BlockHash,sha1_K=[1518500249,1859775393,2400959708,3395469782];function SHA1(){if(!(this instanceof SHA1))return new SHA1;BlockHash$3.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}utils$f.inherits(SHA1,BlockHash$3);var _1=SHA1;SHA1.blockSize=512,SHA1.outSize=160,SHA1.hmacStrength=80,SHA1.padLength=64,SHA1.prototype._update=function(e,t){for(var r=this.W,o=0;o<16;o++)r[o]=e[t+o];for(;o<r.length;o++)r[o]=rotl32$1(r[o-3]^r[o-8]^r[o-14]^r[o-16],1);var n=this.h[0],i=this.h[1],a=this.h[2],s=this.h[3],c=this.h[4];for(o=0;o<r.length;o++){var u=~~(o/20),l=sum32_5$1(rotl32$1(n,5),ft_1(u,i,a,s),c,r[o],sha1_K[u]);c=s,s=a,a=rotl32$1(i,30),i=n,n=l}this.h[0]=sum32$2(this.h[0],n),this.h[1]=sum32$2(this.h[1],i),this.h[2]=sum32$2(this.h[2],a),this.h[3]=sum32$2(this.h[3],s),this.h[4]=sum32$2(this.h[4],c)},SHA1.prototype._digest=function(e){return"hex"===e?utils$f.toHex32(this.h,"big"):utils$f.split32(this.h,"big")};var utils$e=utils$i,common$2=common$5,shaCommon=common$4,assert$9=minimalisticAssert,sum32$1=utils$e.sum32,sum32_4$1=utils$e.sum32_4,sum32_5=utils$e.sum32_5,ch32=shaCommon.ch32,maj32=shaCommon.maj32,s0_256=shaCommon.s0_256,s1_256=shaCommon.s1_256,g0_256=shaCommon.g0_256,g1_256=shaCommon.g1_256,BlockHash$2=common$2.BlockHash,sha256_K=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function SHA256$1(){if(!(this instanceof SHA256$1))return new SHA256$1;BlockHash$2.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=sha256_K,this.W=new Array(64)}utils$e.inherits(SHA256$1,BlockHash$2);var _256=SHA256$1;SHA256$1.blockSize=512,SHA256$1.outSize=256,SHA256$1.hmacStrength=192,SHA256$1.padLength=64,SHA256$1.prototype._update=function(e,t){for(var r=this.W,o=0;o<16;o++)r[o]=e[t+o];for(;o<r.length;o++)r[o]=sum32_4$1(g1_256(r[o-2]),r[o-7],g0_256(r[o-15]),r[o-16]);var n=this.h[0],i=this.h[1],a=this.h[2],s=this.h[3],c=this.h[4],u=this.h[5],l=this.h[6],d=this.h[7];for(assert$9(this.k.length===r.length),o=0;o<r.length;o++){var p=sum32_5(d,s1_256(c),ch32(c,u,l),this.k[o],r[o]),h=sum32$1(s0_256(n),maj32(n,i,a));d=l,l=u,u=c,c=sum32$1(s,p),s=a,a=i,i=n,n=sum32$1(p,h)}this.h[0]=sum32$1(this.h[0],n),this.h[1]=sum32$1(this.h[1],i),this.h[2]=sum32$1(this.h[2],a),this.h[3]=sum32$1(this.h[3],s),this.h[4]=sum32$1(this.h[4],c),this.h[5]=sum32$1(this.h[5],u),this.h[6]=sum32$1(this.h[6],l),this.h[7]=sum32$1(this.h[7],d)},SHA256$1.prototype._digest=function(e){return"hex"===e?utils$e.toHex32(this.h,"big"):utils$e.split32(this.h,"big")};var utils$d=utils$i,SHA256=_256;function SHA224(){if(!(this instanceof SHA224))return new SHA224;SHA256.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}utils$d.inherits(SHA224,SHA256);var _224=SHA224;SHA224.blockSize=512,SHA224.outSize=224,SHA224.hmacStrength=192,SHA224.padLength=64,SHA224.prototype._digest=function(e){return"hex"===e?utils$d.toHex32(this.h.slice(0,7),"big"):utils$d.split32(this.h.slice(0,7),"big")};var utils$c=utils$i,common$1=common$5,assert$8=minimalisticAssert,rotr64_hi=utils$c.rotr64_hi,rotr64_lo=utils$c.rotr64_lo,shr64_hi=utils$c.shr64_hi,shr64_lo=utils$c.shr64_lo,sum64=utils$c.sum64,sum64_hi=utils$c.sum64_hi,sum64_lo=utils$c.sum64_lo,sum64_4_hi=utils$c.sum64_4_hi,sum64_4_lo=utils$c.sum64_4_lo,sum64_5_hi=utils$c.sum64_5_hi,sum64_5_lo=utils$c.sum64_5_lo,BlockHash$1=common$1.BlockHash,sha512_K=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function SHA512$1(){if(!(this instanceof SHA512$1))return new SHA512$1;BlockHash$1.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=sha512_K,this.W=new Array(160)}utils$c.inherits(SHA512$1,BlockHash$1);var _512=SHA512$1;function ch64_hi(e,t,r,o,n){var i=e&r^~e&n;return i<0&&(i+=4294967296),i}function ch64_lo(e,t,r,o,n,i){var a=t&o^~t&i;return a<0&&(a+=4294967296),a}function maj64_hi(e,t,r,o,n){var i=e&r^e&n^r&n;return i<0&&(i+=4294967296),i}function maj64_lo(e,t,r,o,n,i){var a=t&o^t&i^o&i;return a<0&&(a+=4294967296),a}function s0_512_hi(e,t){var r=rotr64_hi(e,t,28)^rotr64_hi(t,e,2)^rotr64_hi(t,e,7);return r<0&&(r+=4294967296),r}function s0_512_lo(e,t){var r=rotr64_lo(e,t,28)^rotr64_lo(t,e,2)^rotr64_lo(t,e,7);return r<0&&(r+=4294967296),r}function s1_512_hi(e,t){var r=rotr64_hi(e,t,14)^rotr64_hi(e,t,18)^rotr64_hi(t,e,9);return r<0&&(r+=4294967296),r}function s1_512_lo(e,t){var r=rotr64_lo(e,t,14)^rotr64_lo(e,t,18)^rotr64_lo(t,e,9);return r<0&&(r+=4294967296),r}function g0_512_hi(e,t){var r=rotr64_hi(e,t,1)^rotr64_hi(e,t,8)^shr64_hi(e,t,7);return r<0&&(r+=4294967296),r}function g0_512_lo(e,t){var r=rotr64_lo(e,t,1)^rotr64_lo(e,t,8)^shr64_lo(e,t,7);return r<0&&(r+=4294967296),r}function g1_512_hi(e,t){var r=rotr64_hi(e,t,19)^rotr64_hi(t,e,29)^shr64_hi(e,t,6);return r<0&&(r+=4294967296),r}function g1_512_lo(e,t){var r=rotr64_lo(e,t,19)^rotr64_lo(t,e,29)^shr64_lo(e,t,6);return r<0&&(r+=4294967296),r}SHA512$1.blockSize=1024,SHA512$1.outSize=512,SHA512$1.hmacStrength=192,SHA512$1.padLength=128,SHA512$1.prototype._prepareBlock=function(e,t){for(var r=this.W,o=0;o<32;o++)r[o]=e[t+o];for(;o<r.length;o+=2){var n=g1_512_hi(r[o-4],r[o-3]),i=g1_512_lo(r[o-4],r[o-3]),a=r[o-14],s=r[o-13],c=g0_512_hi(r[o-30],r[o-29]),u=g0_512_lo(r[o-30],r[o-29]),l=r[o-32],d=r[o-31];r[o]=sum64_4_hi(n,i,a,s,c,u,l,d),r[o+1]=sum64_4_lo(n,i,a,s,c,u,l,d)}},SHA512$1.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,o=this.h[0],n=this.h[1],i=this.h[2],a=this.h[3],s=this.h[4],c=this.h[5],u=this.h[6],l=this.h[7],d=this.h[8],p=this.h[9],h=this.h[10],f=this.h[11],m=this.h[12],y=this.h[13],g=this.h[14],b=this.h[15];assert$8(this.k.length===r.length);for(var v=0;v<r.length;v+=2){var w=g,$=b,k=s1_512_hi(d,p),_=s1_512_lo(d,p),T=ch64_hi(d,p,h,f,m),I=ch64_lo(d,p,h,f,m,y),A=this.k[v],O=this.k[v+1],E=r[v],S=r[v+1],R=sum64_5_hi(w,$,k,_,T,I,A,O,E,S),x=sum64_5_lo(w,$,k,_,T,I,A,O,E,S);w=s0_512_hi(o,n),$=s0_512_lo(o,n),k=maj64_hi(o,n,i,a,s),_=maj64_lo(o,n,i,a,s,c);var C=sum64_hi(w,$,k,_),P=sum64_lo(w,$,k,_);g=m,b=y,m=h,y=f,h=d,f=p,d=sum64_hi(u,l,R,x),p=sum64_lo(l,l,R,x),u=s,l=c,s=i,c=a,i=o,a=n,o=sum64_hi(R,x,C,P),n=sum64_lo(R,x,C,P)}sum64(this.h,0,o,n),sum64(this.h,2,i,a),sum64(this.h,4,s,c),sum64(this.h,6,u,l),sum64(this.h,8,d,p),sum64(this.h,10,h,f),sum64(this.h,12,m,y),sum64(this.h,14,g,b)},SHA512$1.prototype._digest=function(e){return"hex"===e?utils$c.toHex32(this.h,"big"):utils$c.split32(this.h,"big")};var utils$b=utils$i,SHA512=_512;function SHA384(){if(!(this instanceof SHA384))return new SHA384;SHA512.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}utils$b.inherits(SHA384,SHA512);var _384=SHA384;SHA384.blockSize=1024,SHA384.outSize=384,SHA384.hmacStrength=192,SHA384.padLength=128,SHA384.prototype._digest=function(e){return"hex"===e?utils$b.toHex32(this.h.slice(0,12),"big"):utils$b.split32(this.h.slice(0,12),"big")},sha.sha1=_1,sha.sha224=_224,sha.sha256=_256,sha.sha384=_384,sha.sha512=_512;var ripemd={},utils$a=utils$i,common=common$5,rotl32=utils$a.rotl32,sum32=utils$a.sum32,sum32_3=utils$a.sum32_3,sum32_4=utils$a.sum32_4,BlockHash=common.BlockHash;function RIPEMD160(){if(!(this instanceof RIPEMD160))return new RIPEMD160;BlockHash.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function f$4(e,t,r,o){return e<=15?t^r^o:e<=31?t&r|~t&o:e<=47?(t|~r)^o:e<=63?t&o|r&~o:t^(r|~o)}function K(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function Kh(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}utils$a.inherits(RIPEMD160,BlockHash),ripemd.ripemd160=RIPEMD160,RIPEMD160.blockSize=512,RIPEMD160.outSize=160,RIPEMD160.hmacStrength=192,RIPEMD160.padLength=64,RIPEMD160.prototype._update=function(e,t){for(var r=this.h[0],o=this.h[1],n=this.h[2],i=this.h[3],a=this.h[4],s=r,c=o,u=n,l=i,d=a,p=0;p<80;p++){var h=sum32(rotl32(sum32_4(r,f$4(p,o,n,i),e[r$b[p]+t],K(p)),s$a[p]),a);r=a,a=i,i=rotl32(n,10),n=o,o=h,h=sum32(rotl32(sum32_4(s,f$4(79-p,c,u,l),e[rh[p]+t],Kh(p)),sh[p]),d),s=d,d=l,l=rotl32(u,10),u=c,c=h}h=sum32_3(this.h[1],n,l),this.h[1]=sum32_3(this.h[2],i,d),this.h[2]=sum32_3(this.h[3],a,s),this.h[3]=sum32_3(this.h[4],r,c),this.h[4]=sum32_3(this.h[0],o,u),this.h[0]=h},RIPEMD160.prototype._digest=function(e){return"hex"===e?utils$a.toHex32(this.h,"little"):utils$a.split32(this.h,"little")};var r$b=[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],rh=[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],s$a=[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],sh=[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],utils$9=utils$i,assert$7=minimalisticAssert;function Hmac(e,t,r){if(!(this instanceof Hmac))return new Hmac(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(utils$9.toArray(t,r))}var hmac=Hmac,secp256k1$2,hasRequiredSecp256k1;function requireSecp256k1(){return hasRequiredSecp256k1?secp256k1$2:(hasRequiredSecp256k1=1,secp256k1$2={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"]]}})}Hmac.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),assert$7(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)},Hmac.prototype.update=function(e,t){return this.inner.update(e,t),this},Hmac.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(e){var t=e;t.utils=utils$i,t.common=common$5,t.sha=sha,t.ripemd=ripemd,t.hmac=hmac,t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160}(hash$3),function(e){var t,r=e,o=hash$3,n=curve,i=utils$o.assert;function a(e){"short"===e.type?this.curve=new n.short(e):"edwards"===e.type?this.curve=new n.edwards(e):this.curve=new n.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(e,t){Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:function(){var o=new a(t);return Object.defineProperty(r,e,{configurable:!0,enumerable:!0,value:o}),o}})}r.PresetCurve=a,s("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"]}),s("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"]}),s("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"]}),s("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"]}),s("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"]}),s("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"]}),s("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{t=requireSecp256k1()}catch(c){t=void 0}s("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",t]})}(curves$1);var hash$2=hash$3,utils$8=utils$n,assert$6=minimalisticAssert;function HmacDRBG(e){if(!(this instanceof HmacDRBG))return new HmacDRBG(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=utils$8.toArray(e.entropy,e.entropyEnc||"hex"),r=utils$8.toArray(e.nonce,e.nonceEnc||"hex"),o=utils$8.toArray(e.pers,e.persEnc||"hex");assert$6(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,o)}var hmacDrbg=HmacDRBG;HmacDRBG.prototype._init=function(e,t,r){var o=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(o),this._reseed=1,this.reseedInterval=281474976710656},HmacDRBG.prototype._hmac=function(){return new hash$2.hmac(this.hash,this.K)},HmacDRBG.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())},HmacDRBG.prototype.reseed=function(e,t,r,o){"string"!=typeof t&&(o=r,r=t,t=null),e=utils$8.toArray(e,t),r=utils$8.toArray(r,o),assert$6(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},HmacDRBG.prototype.generate=function(e,t,r,o){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(o=r,r=t,t=null),r&&(r=utils$8.toArray(r,o||"hex"),this._update(r));for(var n=[];n.length<e;)this.V=this._hmac().update(this.V).digest(),n=n.concat(this.V);var i=n.slice(0,e);return this._update(r),this._reseed++,utils$8.encode(i,t)};var BN$3=bnExports,utils$7=utils$o,assert$5=utils$7.assert;function KeyPair$2(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)}var key$1=KeyPair$2;KeyPair$2.fromPublic=function(e,t,r){return t instanceof KeyPair$2?t:new KeyPair$2(e,{pub:t,pubEnc:r})},KeyPair$2.fromPrivate=function(e,t,r){return t instanceof KeyPair$2?t:new KeyPair$2(e,{priv:t,privEnc:r})},KeyPair$2.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"}},KeyPair$2.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},KeyPair$2.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},KeyPair$2.prototype._importPrivate=function(e,t){this.priv=new BN$3(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},KeyPair$2.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?assert$5(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||assert$5(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)},KeyPair$2.prototype.derive=function(e){return e.validate()||assert$5(e.validate(),"public point not validated"),e.mul(this.priv).getX()},KeyPair$2.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},KeyPair$2.prototype.verify=function(e,t,r){return this.ec.verify(e,t,this,void 0,r)},KeyPair$2.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var BN$2=bnExports,utils$6=utils$o,assert$4=utils$6.assert;function Signature$2(e,t){if(e instanceof Signature$2)return e;this._importDER(e,t)||(assert$4(e.r&&e.s,"Signature without r or s"),this.r=new BN$2(e.r,16),this.s=new BN$2(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var signature$1=Signature$2,ec$1,hasRequiredEc;function Position(){this.place=0}function getLength(e,t){var r=e[t.place++];if(!(128&r))return r;var o=15&r;if(0===o||o>4)return!1;if(0===e[t.place])return!1;for(var n=0,i=0,a=t.place;i<o;i++,a++)n<<=8,n|=e[a],n>>>=0;return!(n<=127)&&(t.place=a,n)}function rmPadding(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 constructLength(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)}}function requireEc(){if(hasRequiredEc)return ec$1;hasRequiredEc=1;var e=bnExports,t=hmacDrbg,r=utils$o,o=curves$1,n=requireBrorand(),i=r.assert,a=key$1,s=signature$1;function c(e){if(!(this instanceof c))return new c(e);"string"==typeof e&&(i(Object.prototype.hasOwnProperty.call(o,e),"Unknown curve "+e),e=o[e]),e instanceof o.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}return ec$1=c,c.prototype.keyPair=function(e){return new a(this,e)},c.prototype.keyFromPrivate=function(e,t){return a.fromPrivate(this,e,t)},c.prototype.keyFromPublic=function(e,t){return a.fromPublic(this,e,t)},c.prototype.genKeyPair=function(r){r||(r={});for(var o=new t({hash:this.hash,pers:r.pers,persEnc:r.persEnc||"utf8",entropy:r.entropy||n(this.hash.hmacStrength),entropyEnc:r.entropy&&r.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),a=this.n.sub(new e(2));;){var s=new e(o.generate(i));if(!(s.cmp(a)>0))return s.iaddn(1),this.keyFromPrivate(s)}},c.prototype._truncateToN=function(t,r,o){var n;if(e.isBN(t)||"number"==typeof t)n=(t=new e(t,16)).byteLength();else if("object"==typeof t)n=t.length,t=new e(t,16);else{var i=t.toString();n=i.length+1>>>1,t=new e(i,16)}"number"!=typeof o&&(o=8*n);var a=o-this.n.bitLength();return a>0&&(t=t.ushrn(a)),!r&&t.cmp(this.n)>=0?t.sub(this.n):t},c.prototype.sign=function(r,o,n,a){if("object"==typeof n&&(a=n,n=null),a||(a={}),"string"!=typeof r&&"number"!=typeof r&&!e.isBN(r)){i("object"==typeof r&&r&&"number"==typeof r.length,"Expected message to be an array-like, a hex string, or a BN instance"),i(r.length>>>0===r.length);for(var c=0;c<r.length;c++)i((255&r[c])===r[c])}o=this.keyFromPrivate(o,n),r=this._truncateToN(r,!1,a.msgBitLength),i(!r.isNeg(),"Can not sign a negative message");var u=this.n.byteLength(),l=o.getPrivate().toArray("be",u),d=r.toArray("be",u);i(new e(d).eq(r),"Can not sign message");for(var p=new t({hash:this.hash,entropy:l,nonce:d,pers:a.pers,persEnc:a.persEnc||"utf8"}),h=this.n.sub(new e(1)),f=0;;f++){var m=a.k?a.k(f):new e(p.generate(this.n.byteLength()));if(!((m=this._truncateToN(m,!0)).cmpn(1)<=0||m.cmp(h)>=0)){var y=this.g.mul(m);if(!y.isInfinity()){var g=y.getX(),b=g.umod(this.n);if(0!==b.cmpn(0)){var v=m.invm(this.n).mul(b.mul(o.getPrivate()).iadd(r));if(0!==(v=v.umod(this.n)).cmpn(0)){var w=(y.getY().isOdd()?1:0)|(0!==g.cmp(b)?2:0);return a.canonical&&v.cmp(this.nh)>0&&(v=this.n.sub(v),w^=1),new s({r:b,s:v,recoveryParam:w})}}}}}},c.prototype.verify=function(e,t,r,o,n){n||(n={}),e=this._truncateToN(e,!1,n.msgBitLength),r=this.keyFromPublic(r,o);var i=(t=new s(t,"hex")).r,a=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var c,u=a.invm(this.n),l=u.mul(e).umod(this.n),d=u.mul(i).umod(this.n);return this.curve._maxwellTrick?!(c=this.g.jmulAdd(l,r.getPublic(),d)).isInfinity()&&c.eqXToP(i):!(c=this.g.mulAdd(l,r.getPublic(),d)).isInfinity()&&0===c.getX().umod(this.n).cmp(i)},c.prototype.recoverPubKey=function(t,r,o,n){i((3&o)===o,"The recovery param is more than two bits"),r=new s(r,n);var a=this.n,c=new e(t),u=r.r,l=r.s,d=1&o,p=o>>1;if(u.cmp(this.curve.p.umod(this.curve.n))>=0&&p)throw new Error("Unable to find sencond key candinate");u=p?this.curve.pointFromX(u.add(this.curve.n),d):this.curve.pointFromX(u,d);var h=r.r.invm(a),f=a.sub(c).mul(h).umod(a),m=l.mul(h).umod(a);return this.g.mulAdd(f,u,m)},c.prototype.getKeyRecoveryParam=function(e,t,r,o){if(null!==(t=new s(t,o)).recoveryParam)return t.recoveryParam;for(var n=0;n<4;n++){var i;try{i=this.recoverPubKey(e,t,n)}catch(a){continue}if(i.eq(r))return n}throw new Error("Unable to find valid recovery factor")},ec$1}Signature$2.prototype._importDER=function(e,t){e=utils$6.toArray(e,t);var r=new Position;if(48!==e[r.place++])return!1;var o=getLength(e,r);if(!1===o)return!1;if(o+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var n=getLength(e,r);if(!1===n)return!1;if(128&e[r.place])return!1;var i=e.slice(r.place,n+r.place);if(r.place+=n,2!==e[r.place++])return!1;var a=getLength(e,r);if(!1===a)return!1;if(e.length!==a+r.place)return!1;if(128&e[r.place])return!1;var s=e.slice(r.place,a+r.place);if(0===i[0]){if(!(128&i[1]))return!1;i=i.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new BN$2(i),this.s=new BN$2(s),this.recoveryParam=null,!0},Signature$2.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=rmPadding(t),r=rmPadding(r);!(r[0]||128&r[1]);)r=r.slice(1);var o=[2];constructLength(o,t.length),(o=o.concat(t)).push(2),constructLength(o,r.length);var n=o.concat(r),i=[48];return constructLength(i,n.length),i=i.concat(n),utils$6.encode(i,e)};var utils$5=utils$o,assert$3=utils$5.assert,parseBytes$2=utils$5.parseBytes,cachedProperty$1=utils$5.cachedProperty;function KeyPair$1(e,t){this.eddsa=e,this._secret=parseBytes$2(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=parseBytes$2(t.pub)}KeyPair$1.fromPublic=function(e,t){return t instanceof KeyPair$1?t:new KeyPair$1(e,{pub:t})},KeyPair$1.fromSecret=function(e,t){return t instanceof KeyPair$1?t:new KeyPair$1(e,{secret:t})},KeyPair$1.prototype.secret=function(){return this._secret},cachedProperty$1(KeyPair$1,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),cachedProperty$1(KeyPair$1,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),cachedProperty$1(KeyPair$1,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,o=t.slice(0,e.encodingLength);return o[0]&=248,o[r]&=127,o[r]|=64,o})),cachedProperty$1(KeyPair$1,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),cachedProperty$1(KeyPair$1,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),cachedProperty$1(KeyPair$1,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),KeyPair$1.prototype.sign=function(e){return assert$3(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},KeyPair$1.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},KeyPair$1.prototype.getSecret=function(e){return assert$3(this._secret,"KeyPair is public only"),utils$5.encode(this.secret(),e)},KeyPair$1.prototype.getPublic=function(e){return utils$5.encode(this.pubBytes(),e)};var key=KeyPair$1,BN$1=bnExports,utils$4=utils$o,assert$2=utils$4.assert,cachedProperty=utils$4.cachedProperty,parseBytes$1=utils$4.parseBytes;function Signature$1(e,t){this.eddsa=e,"object"!=typeof t&&(t=parseBytes$1(t)),Array.isArray(t)&&(assert$2(t.length===2*e.encodingLength,"Signature has invalid size"),t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),assert$2(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof BN$1&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}cachedProperty(Signature$1,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),cachedProperty(Signature$1,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),cachedProperty(Signature$1,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),cachedProperty(Signature$1,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),Signature$1.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Signature$1.prototype.toHex=function(){return utils$4.encode(this.toBytes(),"hex").toUpperCase()};var signature=Signature$1,hash$1=hash$3,curves=curves$1,utils$3=utils$o,assert$1=utils$3.assert,parseBytes=utils$3.parseBytes,KeyPair=key,Signature=signature;function EDDSA(e){if(assert$1("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof EDDSA))return new EDDSA(e);e=curves[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=hash$1.sha512}var eddsa=EDDSA,hasRequiredElliptic;function requireElliptic(){return hasRequiredElliptic||(hasRequiredElliptic=1,function(e){var t=e;t.version=require$$0$1.version,t.utils=utils$o,t.rand=requireBrorand(),t.curve=curve,t.curves=curves$1,t.ec=requireEc(),t.eddsa=eddsa}(elliptic$1)),elliptic$1}EDDSA.prototype.sign=function(e,t){e=parseBytes(e);var r=this.keyFromSecret(t),o=this.hashInt(r.messagePrefix(),e),n=this.g.mul(o),i=this.encodePoint(n),a=this.hashInt(i,r.pubBytes(),e).mul(r.priv()),s=o.add(a).umod(this.curve.n);return this.makeSignature({R:n,S:s,Rencoded:i})},EDDSA.prototype.verify=function(e,t,r){if(e=parseBytes(e),(t=this.makeSignature(t)).S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var o=this.keyFromPublic(r),n=this.hashInt(t.Rencoded(),o.pubBytes(),e),i=this.g.mul(t.S());return t.R().add(o.pub().mul(n)).eq(i)},EDDSA.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return utils$3.intFromLE(e.digest()).umod(this.curve.n)},EDDSA.prototype.keyFromPublic=function(e){return KeyPair.fromPublic(this,e)},EDDSA.prototype.keyFromSecret=function(e){return KeyPair.fromSecret(this,e)},EDDSA.prototype.makeSignature=function(e){return e instanceof Signature?e:new Signature(this,e)},EDDSA.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},EDDSA.prototype.decodePoint=function(e){var t=(e=utils$3.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),o=!!(128&e[t]),n=utils$3.intFromLE(r);return this.curve.pointFromY(n,o)},EDDSA.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},EDDSA.prototype.decodeInt=function(e){return utils$3.intFromLE(e)},EDDSA.prototype.isPoint=function(e){return e instanceof this.pointClass};var asn1$1={},asn1={},bn$2={exports:{}},hasRequiredBn$2;function requireBn$2(){return hasRequiredBn$2||(hasRequiredBn$2=1,function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function o(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function n(e,t,r){if(n.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 i;"object"==typeof e?e.exports=n:t.BN=n,n.BN=n,n.wordSize=26;try{i="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require$$0$2.Buffer}catch(T){}function a(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(e,t,r){var o=a(e,r);return r-1>=t&&(o|=a(e,r-1)<<4),o}function c(e,t,r,o){for(var n=0,i=Math.min(e.length,r),a=t;a<i;a++){var s=e.charCodeAt(a)-48;n*=o,n+=s>=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(e){return e instanceof n||null!==e&&"object"==typeof e&&e.constructor.wordSize===n.wordSize&&Array.isArray(e.words)},n.max=function(e,t){return e.cmp(t)>0?e:t},n.min=function(e,t){return e.cmp(t)<0?e:t},n.prototype._init=function(e,t,o){if("number"==typeof e)return this._initNumber(e,t,o);if("object"==typeof e)return this._initArray(e,t,o);"hex"===t&&(t=16),r(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,o):(this._parseBase(e,t,n),"le"===o&&this._initArray(this.toArray(),t,o)))},n.prototype._initNumber=function(e,t,o){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):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===o&&this._initArray(this.toArray(),t,o)},n.prototype._initArray=function(e,t,o){if(r("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 i,a,s=0;if("be"===o)for(n=e.length-1,i=0;n>=0;n-=3)a=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===o)for(n=0,i=0;n<e.length;n+=3)a=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this.strip()},n.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var n,i=0,a=0;if("be"===r)for(o=e.length-1;o>=t;o-=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;else for(o=(e.length-t)%2==0?t+1:t;o<e.length;o+=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;this.strip()},n.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var o=0,n=1;n<=67108863;n*=t)o++;o--,n=n/t|0;for(var i=e.length-r,a=i%o,s=Math.min(i,i-a)+r,u=0,l=r;l<s;l+=o)u=c(e,l,l+o,t),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var d=1;for(u=c(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.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},n.prototype.clone=function(){var e=new n(null);return this.copy(e),e},n.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","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"],l=[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],d=[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 p(e,t,r){r.negative=t.negative^e.negative;var o=e.length+t.length|0;r.length=o,o=o-1|0;var n=0|e.words[0],i=0|t.words[0],a=n*i,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u<o;u++){for(var l=c>>>26,d=67108863&c,p=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=p;h++){var f=u-h|0;l+=(a=(n=0|e.words[f])*(i=0|t.words[h])+d)/67108864|0,d=67108863&a}r.words[u]=0|d,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}n.prototype.toString=function(e,t){var o;if(t=0|t||1,16===(e=e||10)||"hex"===e){o="";for(var n=0,i=0,a=0;a<this.length;a++){var s=this.words[a],c=(16777215&(s<<n|i)).toString(16);i=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),o=0!==i||a!==this.length-1?u[6-c.length]+c+o:c+o}for(0!==i&&(o=i.toString(16)+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}if(e===(0|e)&&e>=2&&e<=36){var p=l[e],h=d[e];o="";var f=this.clone();for(f.negative=0;!f.isZero();){var m=f.modn(h).toString(e);o=(f=f.idivn(h)).isZero()?m+o:u[p-m.length]+m+o}for(this.isZero()&&(o="0"+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}r(!1,"Base should be between 2 and 36")},n.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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(e,t){return r(void 0!==i),this.toArrayLike(i,e,t)},n.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},n.prototype.toArrayLike=function(e,t,o){var n=this.byteLength(),i=o||Math.max(1,n);r(n<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===t,u=new e(i),l=this.clone();if(c){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[s]=a;for(;s<i;s++)u[s]=0}else{for(s=0;s<i-n;s++)u[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[i-s-1]=a}return u},Math.clz32?n.prototype._countBits=function(e){return 32-Math.clz32(e)}:n.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},n.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},n.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},n.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},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},n.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(e){return r(!(this.negative|e.negative)),this.iuor(e)},n.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},n.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},n.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()},n.prototype.iand=function(e){return r(!(this.negative|e.negative)),this.iuand(e)},n.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},n.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},n.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var o=0;o<r.length;o++)this.words[o]=t.words[o]^r.words[o];if(this!==t)for(;o<t.length;o++)this.words[o]=t.words[o];return this.length=t.length,this.strip()},n.prototype.ixor=function(e){return r(!(this.negative|e.negative)),this.iuxor(e)},n.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},n.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},n.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),o=e%26;this._expand(t),o>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return o>0&&(this.words[n]=~this.words[n]&67108863>>26-o),this.strip()},n.prototype.notn=function(e){return this.clone().inotn(e)},n.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var o=e/26|0,n=e%26;return this._expand(o+1),this.words[o]=t?this.words[o]|1<<n:this.words[o]&~(1<<n),this.strip()},n.prototype.iadd=function(e){var t,r,o;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,o=e):(r=e,o=this);for(var n=0,i=0;i<o.length;i++)t=(0|r.words[i])+(0|o.words[i])+n,this.words[i]=67108863&t,n=t>>>26;for(;0!==n&&i<r.length;i++)t=(0|r.words[i])+n,this.words[i]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;i<r.length;i++)this.words[i]=r.words[i];return this},n.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)},n.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,o,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,o=e):(r=e,o=this);for(var i=0,a=0;a<o.length;a++)i=(t=(0|r.words[a])-(0|o.words[a])+i)>>26,this.words[a]=67108863&t;for(;0!==i&&a<r.length;a++)i=(t=(0|r.words[a])+i)>>26,this.words[a]=67108863&t;if(0===i&&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()},n.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,r){var o,n,i,a=e.words,s=t.words,c=r.words,u=0,l=0|a[0],d=8191&l,p=l>>>13,h=0|a[1],f=8191&h,m=h>>>13,y=0|a[2],g=8191&y,b=y>>>13,v=0|a[3],w=8191&v,$=v>>>13,k=0|a[4],_=8191&k,T=k>>>13,I=0|a[5],A=8191&I,O=I>>>13,E=0|a[6],S=8191&E,R=E>>>13,x=0|a[7],C=8191&x,P=x>>>13,N=0|a[8],B=8191&N,D=N>>>13,M=0|a[9],L=8191&M,j=M>>>13,F=0|s[0],U=8191&F,K=F>>>13,q=0|s[1],G=8191&q,H=q>>>13,V=0|s[2],W=8191&V,z=V>>>13,Z=0|s[3],Q=8191&Z,Y=Z>>>13,X=0|s[4],J=8191&X,ee=X>>>13,te=0|s[5],re=8191&te,oe=te>>>13,ne=0|s[6],ie=8191&ne,ae=ne>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],de=8191&le,pe=le>>>13,he=0|s[9],fe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(u+(o=Math.imul(d,U))|0)+((8191&(n=(n=Math.imul(d,K))+Math.imul(p,U)|0))<<13)|0;u=((i=Math.imul(p,K))+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,o=Math.imul(f,U),n=(n=Math.imul(f,K))+Math.imul(m,U)|0,i=Math.imul(m,K);var ge=(u+(o=o+Math.imul(d,G)|0)|0)+((8191&(n=(n=n+Math.imul(d,H)|0)+Math.imul(p,G)|0))<<13)|0;u=((i=i+Math.imul(p,H)|0)+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,o=Math.imul(g,U),n=(n=Math.imul(g,K))+Math.imul(b,U)|0,i=Math.imul(b,K),o=o+Math.imul(f,G)|0,n=(n=n+Math.imul(f,H)|0)+Math.imul(m,G)|0,i=i+Math.imul(m,H)|0;var be=(u+(o=o+Math.imul(d,W)|0)|0)+((8191&(n=(n=n+Math.imul(d,z)|0)+Math.imul(p,W)|0))<<13)|0;u=((i=i+Math.imul(p,z)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,o=Math.imul(w,U),n=(n=Math.imul(w,K))+Math.imul($,U)|0,i=Math.imul($,K),o=o+Math.imul(g,G)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(b,G)|0,i=i+Math.imul(b,H)|0,o=o+Math.imul(f,W)|0,n=(n=n+Math.imul(f,z)|0)+Math.imul(m,W)|0,i=i+Math.imul(m,z)|0;var ve=(u+(o=o+Math.imul(d,Q)|0)|0)+((8191&(n=(n=n+Math.imul(d,Y)|0)+Math.imul(p,Q)|0))<<13)|0;u=((i=i+Math.imul(p,Y)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,o=Math.imul(_,U),n=(n=Math.imul(_,K))+Math.imul(T,U)|0,i=Math.imul(T,K),o=o+Math.imul(w,G)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul($,G)|0,i=i+Math.imul($,H)|0,o=o+Math.imul(g,W)|0,n=(n=n+Math.imul(g,z)|0)+Math.imul(b,W)|0,i=i+Math.imul(b,z)|0,o=o+Math.imul(f,Q)|0,n=(n=n+Math.imul(f,Y)|0)+Math.imul(m,Q)|0,i=i+Math.imul(m,Y)|0;var we=(u+(o=o+Math.imul(d,J)|0)|0)+((8191&(n=(n=n+Math.imul(d,ee)|0)+Math.imul(p,J)|0))<<13)|0;u=((i=i+Math.imul(p,ee)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,o=Math.imul(A,U),n=(n=Math.imul(A,K))+Math.imul(O,U)|0,i=Math.imul(O,K),o=o+Math.imul(_,G)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(T,G)|0,i=i+Math.imul(T,H)|0,o=o+Math.imul(w,W)|0,n=(n=n+Math.imul(w,z)|0)+Math.imul($,W)|0,i=i+Math.imul($,z)|0,o=o+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(b,Q)|0,i=i+Math.imul(b,Y)|0,o=o+Math.imul(f,J)|0,n=(n=n+Math.imul(f,ee)|0)+Math.imul(m,J)|0,i=i+Math.imul(m,ee)|0;var $e=(u+(o=o+Math.imul(d,re)|0)|0)+((8191&(n=(n=n+Math.imul(d,oe)|0)+Math.imul(p,re)|0))<<13)|0;u=((i=i+Math.imul(p,oe)|0)+(n>>>13)|0)+($e>>>26)|0,$e&=67108863,o=Math.imul(S,U),n=(n=Math.imul(S,K))+Math.imul(R,U)|0,i=Math.imul(R,K),o=o+Math.imul(A,G)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(O,G)|0,i=i+Math.imul(O,H)|0,o=o+Math.imul(_,W)|0,n=(n=n+Math.imul(_,z)|0)+Math.imul(T,W)|0,i=i+Math.imul(T,z)|0,o=o+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul($,Q)|0,i=i+Math.imul($,Y)|0,o=o+Math.imul(g,J)|0,n=(n=n+Math.imul(g,ee)|0)+Math.imul(b,J)|0,i=i+Math.imul(b,ee)|0,o=o+Math.imul(f,re)|0,n=(n=n+Math.imul(f,oe)|0)+Math.imul(m,re)|0,i=i+Math.imul(m,oe)|0;var ke=(u+(o=o+Math.imul(d,ie)|0)|0)+((8191&(n=(n=n+Math.imul(d,ae)|0)+Math.imul(p,ie)|0))<<13)|0;u=((i=i+Math.imul(p,ae)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,o=Math.imul(C,U),n=(n=Math.imul(C,K))+Math.imul(P,U)|0,i=Math.imul(P,K),o=o+Math.imul(S,G)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,G)|0,i=i+Math.imul(R,H)|0,o=o+Math.imul(A,W)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(O,W)|0,i=i+Math.imul(O,z)|0,o=o+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(T,Q)|0,i=i+Math.imul(T,Y)|0,o=o+Math.imul(w,J)|0,n=(n=n+Math.imul(w,ee)|0)+Math.imul($,J)|0,i=i+Math.imul($,ee)|0,o=o+Math.imul(g,re)|0,n=(n=n+Math.imul(g,oe)|0)+Math.imul(b,re)|0,i=i+Math.imul(b,oe)|0,o=o+Math.imul(f,ie)|0,n=(n=n+Math.imul(f,ae)|0)+Math.imul(m,ie)|0,i=i+Math.imul(m,ae)|0;var _e=(u+(o=o+Math.imul(d,ce)|0)|0)+((8191&(n=(n=n+Math.imul(d,ue)|0)+Math.imul(p,ce)|0))<<13)|0;u=((i=i+Math.imul(p,ue)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,o=Math.imul(B,U),n=(n=Math.imul(B,K))+Math.imul(D,U)|0,i=Math.imul(D,K),o=o+Math.imul(C,G)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(P,G)|0,i=i+Math.imul(P,H)|0,o=o+Math.imul(S,W)|0,n=(n=n+Math.imul(S,z)|0)+Math.imul(R,W)|0,i=i+Math.imul(R,z)|0,o=o+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,Q)|0,i=i+Math.imul(O,Y)|0,o=o+Math.imul(_,J)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(T,J)|0,i=i+Math.imul(T,ee)|0,o=o+Math.imul(w,re)|0,n=(n=n+Math.imul(w,oe)|0)+Math.imul($,re)|0,i=i+Math.imul($,oe)|0,o=o+Math.imul(g,ie)|0,n=(n=n+Math.imul(g,ae)|0)+Math.imul(b,ie)|0,i=i+Math.imul(b,ae)|0,o=o+Math.imul(f,ce)|0,n=(n=n+Math.imul(f,ue)|0)+Math.imul(m,ce)|0,i=i+Math.imul(m,ue)|0;var Te=(u+(o=o+Math.imul(d,de)|0)|0)+((8191&(n=(n=n+Math.imul(d,pe)|0)+Math.imul(p,de)|0))<<13)|0;u=((i=i+Math.imul(p,pe)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,o=Math.imul(L,U),n=(n=Math.imul(L,K))+Math.imul(j,U)|0,i=Math.imul(j,K),o=o+Math.imul(B,G)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(D,G)|0,i=i+Math.imul(D,H)|0,o=o+Math.imul(C,W)|0,n=(n=n+Math.imul(C,z)|0)+Math.imul(P,W)|0,i=i+Math.imul(P,z)|0,o=o+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(R,Q)|0,i=i+Math.imul(R,Y)|0,o=o+Math.imul(A,J)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(O,J)|0,i=i+Math.imul(O,ee)|0,o=o+Math.imul(_,re)|0,n=(n=n+Math.imul(_,oe)|0)+Math.imul(T,re)|0,i=i+Math.imul(T,oe)|0,o=o+Math.imul(w,ie)|0,n=(n=n+Math.imul(w,ae)|0)+Math.imul($,ie)|0,i=i+Math.imul($,ae)|0,o=o+Math.imul(g,ce)|0,n=(n=n+Math.imul(g,ue)|0)+Math.imul(b,ce)|0,i=i+Math.imul(b,ue)|0,o=o+Math.imul(f,de)|0,n=(n=n+Math.imul(f,pe)|0)+Math.imul(m,de)|0,i=i+Math.imul(m,pe)|0;var Ie=(u+(o=o+Math.imul(d,fe)|0)|0)+((8191&(n=(n=n+Math.imul(d,me)|0)+Math.imul(p,fe)|0))<<13)|0;u=((i=i+Math.imul(p,me)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,o=Math.imul(L,G),n=(n=Math.imul(L,H))+Math.imul(j,G)|0,i=Math.imul(j,H),o=o+Math.imul(B,W)|0,n=(n=n+Math.imul(B,z)|0)+Math.imul(D,W)|0,i=i+Math.imul(D,z)|0,o=o+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,Y)|0,o=o+Math.imul(S,J)|0,n=(n=n+Math.imul(S,ee)|0)+Math.imul(R,J)|0,i=i+Math.imul(R,ee)|0,o=o+Math.imul(A,re)|0,n=(n=n+Math.imul(A,oe)|0)+Math.imul(O,re)|0,i=i+Math.imul(O,oe)|0,o=o+Math.imul(_,ie)|0,n=(n=n+Math.imul(_,ae)|0)+Math.imul(T,ie)|0,i=i+Math.imul(T,ae)|0,o=o+Math.imul(w,ce)|0,n=(n=n+Math.imul(w,ue)|0)+Math.imul($,ce)|0,i=i+Math.imul($,ue)|0,o=o+Math.imul(g,de)|0,n=(n=n+Math.imul(g,pe)|0)+Math.imul(b,de)|0,i=i+Math.imul(b,pe)|0;var Ae=(u+(o=o+Math.imul(f,fe)|0)|0)+((8191&(n=(n=n+Math.imul(f,me)|0)+Math.imul(m,fe)|0))<<13)|0;u=((i=i+Math.imul(m,me)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,o=Math.imul(L,W),n=(n=Math.imul(L,z))+Math.imul(j,W)|0,i=Math.imul(j,z),o=o+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(D,Q)|0,i=i+Math.imul(D,Y)|0,o=o+Math.imul(C,J)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(P,J)|0,i=i+Math.imul(P,ee)|0,o=o+Math.imul(S,re)|0,n=(n=n+Math.imul(S,oe)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,oe)|0,o=o+Math.imul(A,ie)|0,n=(n=n+Math.imul(A,ae)|0)+Math.imul(O,ie)|0,i=i+Math.imul(O,ae)|0,o=o+Math.imul(_,ce)|0,n=(n=n+Math.imul(_,ue)|0)+Math.imul(T,ce)|0,i=i+Math.imul(T,ue)|0,o=o+Math.imul(w,de)|0,n=(n=n+Math.imul(w,pe)|0)+Math.imul($,de)|0,i=i+Math.imul($,pe)|0;var Oe=(u+(o=o+Math.imul(g,fe)|0)|0)+((8191&(n=(n=n+Math.imul(g,me)|0)+Math.imul(b,fe)|0))<<13)|0;u=((i=i+Math.imul(b,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,o=Math.imul(L,Q),n=(n=Math.imul(L,Y))+Math.imul(j,Q)|0,i=Math.imul(j,Y),o=o+Math.imul(B,J)|0,n=(n=n+Math.imul(B,ee)|0)+Math.imul(D,J)|0,i=i+Math.imul(D,ee)|0,o=o+Math.imul(C,re)|0,n=(n=n+Math.imul(C,oe)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,oe)|0,o=o+Math.imul(S,ie)|0,n=(n=n+Math.imul(S,ae)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,ae)|0,o=o+Math.imul(A,ce)|0,n=(n=n+Math.imul(A,ue)|0)+Math.imul(O,ce)|0,i=i+Math.imul(O,ue)|0,o=o+Math.imul(_,de)|0,n=(n=n+Math.imul(_,pe)|0)+Math.imul(T,de)|0,i=i+Math.imul(T,pe)|0;var Ee=(u+(o=o+Math.imul(w,fe)|0)|0)+((8191&(n=(n=n+Math.imul(w,me)|0)+Math.imul($,fe)|0))<<13)|0;u=((i=i+Math.imul($,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,o=Math.imul(L,J),n=(n=Math.imul(L,ee))+Math.imul(j,J)|0,i=Math.imul(j,ee),o=o+Math.imul(B,re)|0,n=(n=n+Math.imul(B,oe)|0)+Math.imul(D,re)|0,i=i+Math.imul(D,oe)|0,o=o+Math.imul(C,ie)|0,n=(n=n+Math.imul(C,ae)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,ae)|0,o=o+Math.imul(S,ce)|0,n=(n=n+Math.imul(S,ue)|0)+Math.imul(R,ce)|0,i=i+Math.imul(R,ue)|0,o=o+Math.imul(A,de)|0,n=(n=n+Math.imul(A,pe)|0)+Math.imul(O,de)|0,i=i+Math.imul(O,pe)|0;var Se=(u+(o=o+Math.imul(_,fe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(T,fe)|0))<<13)|0;u=((i=i+Math.imul(T,me)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,o=Math.imul(L,re),n=(n=Math.imul(L,oe))+Math.imul(j,re)|0,i=Math.imul(j,oe),o=o+Math.imul(B,ie)|0,n=(n=n+Math.imul(B,ae)|0)+Math.imul(D,ie)|0,i=i+Math.imul(D,ae)|0,o=o+Math.imul(C,ce)|0,n=(n=n+Math.imul(C,ue)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,ue)|0,o=o+Math.imul(S,de)|0,n=(n=n+Math.imul(S,pe)|0)+Math.imul(R,de)|0,i=i+Math.imul(R,pe)|0;var Re=(u+(o=o+Math.imul(A,fe)|0)|0)+((8191&(n=(n=n+Math.imul(A,me)|0)+Math.imul(O,fe)|0))<<13)|0;u=((i=i+Math.imul(O,me)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,o=Math.imul(L,ie),n=(n=Math.imul(L,ae))+Math.imul(j,ie)|0,i=Math.imul(j,ae),o=o+Math.imul(B,ce)|0,n=(n=n+Math.imul(B,ue)|0)+Math.imul(D,ce)|0,i=i+Math.imul(D,ue)|0,o=o+Math.imul(C,de)|0,n=(n=n+Math.imul(C,pe)|0)+Math.imul(P,de)|0,i=i+Math.imul(P,pe)|0;var xe=(u+(o=o+Math.imul(S,fe)|0)|0)+((8191&(n=(n=n+Math.imul(S,me)|0)+Math.imul(R,fe)|0))<<13)|0;u=((i=i+Math.imul(R,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,o=Math.imul(L,ce),n=(n=Math.imul(L,ue))+Math.imul(j,ce)|0,i=Math.imul(j,ue),o=o+Math.imul(B,de)|0,n=(n=n+Math.imul(B,pe)|0)+Math.imul(D,de)|0,i=i+Math.imul(D,pe)|0;var Ce=(u+(o=o+Math.imul(C,fe)|0)|0)+((8191&(n=(n=n+Math.imul(C,me)|0)+Math.imul(P,fe)|0))<<13)|0;u=((i=i+Math.imul(P,me)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,o=Math.imul(L,de),n=(n=Math.imul(L,pe))+Math.imul(j,de)|0,i=Math.imul(j,pe);var Pe=(u+(o=o+Math.imul(B,fe)|0)|0)+((8191&(n=(n=n+Math.imul(B,me)|0)+Math.imul(D,fe)|0))<<13)|0;u=((i=i+Math.imul(D,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Ne=(u+(o=Math.imul(L,fe))|0)+((8191&(n=(n=Math.imul(L,me))+Math.imul(j,fe)|0))<<13)|0;return u=((i=Math.imul(j,me))+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=ye,c[1]=ge,c[2]=be,c[3]=ve,c[4]=we,c[5]=$e,c[6]=ke,c[7]=_e,c[8]=Te,c[9]=Ie,c[10]=Ae,c[11]=Oe,c[12]=Ee,c[13]=Se,c[14]=Re,c[15]=xe,c[16]=Ce,c[17]=Pe,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function f(e,t,r){return(new m).mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(h=p),n.prototype.mulTo=function(e,t){var r,o=this.length+e.length;return r=10===this.length&&10===e.length?h(this,e,t):o<63?p(this,e,t):o<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var o=0,n=0,i=0;i<r.length-1;i++){var a=n;n=0;for(var s=67108863&o,c=Math.min(i,t.length-1),u=Math.max(0,i-e.length+1);u<=c;u++){var l=i-u,d=(0|e.words[l])*(0|t.words[u]),p=67108863&d;s=67108863&(p=p+s|0),n+=(a=(a=a+(d/67108864|0)|0)+(p>>>26)|0)>>>26,a&=67108863}r.words[i]=s,o=a,a=n}return 0!==o?r.words[i]=o:r.length--,r.strip()}(this,e,t):f(this,e,t),r},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=n.prototype._countBits(e)-1,o=0;o<e;o++)t[o]=this.revBin(o,r,e);return t},m.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var o=0,n=0;n<t;n++)o|=(1&e)<<t-n-1,e>>=1;return o},m.prototype.permute=function(e,t,r,o,n,i){for(var a=0;a<i;a++)o[a]=t[e[a]],n[a]=r[e[a]]},m.prototype.transform=function(e,t,r,o,n,i){this.permute(i,e,t,r,o,n);for(var a=1;a<n;a<<=1)for(var s=a<<1,c=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),l=0;l<n;l+=s)for(var d=c,p=u,h=0;h<a;h++){var f=r[l+h],m=o[l+h],y=r[l+h+a],g=o[l+h+a],b=d*y-p*g;g=d*g+p*y,y=b,r[l+h]=f+y,o[l+h]=m+g,r[l+h+a]=f-y,o[l+h+a]=m-g,h!==s&&(b=c*d-u*p,p=c*p+u*d,d=b)}},m.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),o=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+o},m.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var o=0;o<r/2;o++){var n=e[o];e[o]=e[r-o-1],e[r-o-1]=n,n=t[o],t[o]=-t[r-o-1],t[r-o-1]=-n}},m.prototype.normalize13b=function(e,t){for(var r=0,o=0;o<t/2;o++){var n=8192*Math.round(e[2*o+1]/t)+Math.round(e[2*o]/t)+r;e[o]=67108863&n,r=n<67108864?0:n/67108864|0}return e},m.prototype.convert13b=function(e,t,o,n){for(var i=0,a=0;a<t;a++)i+=0|e[a],o[2*a]=8191&i,i>>>=13,o[2*a+1]=8191&i,i>>>=13;for(a=2*t;a<n;++a)o[a]=0;r(0===i),r(!(-8192&i))},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 o=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(o),i=this.stub(o),a=new Array(o),s=new Array(o),c=new Array(o),u=new Array(o),l=new Array(o),d=new Array(o),p=r.words;p.length=o,this.convert13b(e.words,e.length,a,o),this.convert13b(t.words,t.length,u,o),this.transform(a,i,s,c,o,n),this.transform(u,i,l,d,o,n);for(var h=0;h<o;h++){var f=s[h]*l[h]-c[h]*d[h];c[h]=s[h]*d[h]+c[h]*l[h],s[h]=f}return this.conjugate(s,c,o),this.transform(s,c,p,i,o,n),this.conjugate(p,i,o),this.normalize13b(p,o),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},n.prototype.mul=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},n.prototype.mulf=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),f(this,e,t)},n.prototype.imul=function(e){return this.clone().mulTo(e,this)},n.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,o=0;o<this.length;o++){var n=(0|this.words[o])*e,i=(67108863&n)+(67108863&t);t>>=26,t+=n/67108864|0,t+=i>>>26,this.words[o]=67108863&i}return 0!==t&&(this.words[o]=t,this.length++),this},n.prototype.muln=function(e){return this.clone().imuln(e)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var o=r/26|0,n=r%26;t[r]=(e.words[o]&1<<n)>>>n}return t}(e);if(0===t.length)return new n(1);for(var r=this,o=0;o<t.length&&0===t[o];o++,r=r.sqr());if(++o<t.length)for(var i=r.sqr();o<t.length;o++,i=i.sqr())0!==t[o]&&(r=r.mul(i));return r},n.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,o=e%26,n=(e-o)/26,i=67108863>>>26-o<<26-o;if(0!==o){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&i,c=(0|this.words[t])-s<<o;this.words[t]=c|a,a=s>>>26-o}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()},n.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},n.prototype.iushrn=function(e,t,o){var n;r("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var i=e%26,a=Math.min((e-i)/26,this.length),s=67108863^67108863>>>i<<i,c=o;if(n-=a,n=Math.max(0,n),c){for(var u=0;u<a;u++)c.words[u]=this.words[u];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var d=0|this.words[u];this.words[u]=l<<26-i|d>>>i,l=d&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(e,t,o){return r(0===this.negative),this.iushrn(e,t,o)},n.prototype.shln=function(e){return this.clone().ishln(e)},n.prototype.ushln=function(e){return this.clone().iushln(e)},n.prototype.shrn=function(e){return this.clone().ishrn(e)},n.prototype.ushrn=function(e){return this.clone().iushrn(e)},n.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26,n=1<<t;return!(this.length<=o)&&!!(this.words[o]&n)},n.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=o)return this;if(0!==t&&o++,this.length=Math.min(o,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(e){return this.clone().imaskn(e)},n.prototype.iaddn=function(e){return r("number"==typeof e),r(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)},n.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},n.prototype.isubn=function(e){if(r("number"==typeof e),r(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()},n.prototype.addn=function(e){return this.clone().iaddn(e)},n.prototype.subn=function(e){return this.clone().isubn(e)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(e,t,o){var n,i,a=e.length+o;this._expand(a);var s=0;for(n=0;n<e.length;n++){i=(0|this.words[n+o])+s;var c=(0|e.words[n])*t;s=((i-=67108863&c)>>26)-(c/67108864|0),this.words[n+o]=67108863&i}for(;n<this.length-o;n++)s=(i=(0|this.words[n+o])+s)>>26,this.words[n+o]=67108863&i;if(0===s)return this.strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(i=-(0|this.words[n])+s)>>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},n.prototype._wordDiv=function(e,t){var r=(this.length,e.length),o=this.clone(),i=e,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),o.iushln(r),a=0|i.words[i.length-1]);var s,c=o.length-i.length;if("mod"!==t){(s=new n(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=o.clone()._ishlnsubmul(i,1,c);0===l.negative&&(o=l,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var p=67108864*(0|o.words[i.length+d])+(0|o.words[i.length+d-1]);for(p=Math.min(p/a|0,67108863),o._ishlnsubmul(i,p,d);0!==o.negative;)p--,o.negative=0,o._ishlnsubmul(i,1,d),o.isZero()||(o.negative^=1);s&&(s.words[d]=p)}return s&&s.strip(),o.strip(),"div"!==t&&0!==r&&o.iushrn(r),{div:s||null,mod:o}},n.prototype.divmod=function(e,t,o){return r(!e.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new n(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new n(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new n(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},n.prototype.div=function(e){return this.divmod(e,"div",!1).div},n.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},n.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},n.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,o=e.ushrn(1),n=e.andln(1),i=r.cmp(o);return i<0||1===n&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},n.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,o=0,n=this.length-1;n>=0;n--)o=(t*o+(0|this.words[n]))%e;return o},n.prototype.idivn=function(e){r(e<=67108863);for(var t=0,o=this.length-1;o>=0;o--){var n=(0|this.words[o])+67108864*t;this.words[o]=n/e|0,t=n%e}return this.strip()},n.prototype.divn=function(e){return this.clone().idivn(e)},n.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new n(1),a=new n(0),s=new n(0),c=new n(1),u=0;t.isEven()&&o.isEven();)t.iushrn(1),o.iushrn(1),++u;for(var l=o.clone(),d=t.clone();!t.isZero();){for(var p=0,h=1;!(t.words[0]&h)&&p<26;++p,h<<=1);if(p>0)for(t.iushrn(p);p-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var f=0,m=1;!(o.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(o.iushrn(f);f-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(o)>=0?(t.isub(o),i.isub(s),a.isub(c)):(o.isub(t),s.isub(i),c.isub(a))}return{a:s,b:c,gcd:o.iushln(u)}},n.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new n(1),s=new n(0),c=o.clone();t.cmpn(1)>0&&o.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,p=1;!(o.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(o.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(o)>=0?(t.isub(o),a.isub(s)):(o.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},n.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 o=0;t.isEven()&&r.isEven();o++)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 i=t;t=r,r=i}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(o)},n.prototype.invm=function(e){return this.egcd(e).a.umod(e)},n.prototype.isEven=function(){return!(1&this.words[0])},n.prototype.isOdd=function(){return!(1&~this.words[0])},n.prototype.andln=function(e){return this.words[0]&e},n.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,o=(e-t)/26,n=1<<t;if(this.length<=o)return this._expand(o+1),this.words[o]|=n,this;for(var i=n,a=o;0!==i&&a<this.length;a++){var s=0|this.words[a];i=(s+=i)>>>26,s&=67108863,this.words[a]=s}return 0!==i&&(this.words[a]=i,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(e){var t,o=e<0;if(0!==this.negative&&!o)return-1;if(0===this.negative&&o)return 1;if(this.strip(),this.length>1)t=1;else{o&&(e=-e),r(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},n.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},n.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 o=0|this.words[r],n=0|e.words[r];if(o!==n){o<n?t=-1:o>n&&(t=1);break}}return t},n.prototype.gtn=function(e){return 1===this.cmpn(e)},n.prototype.gt=function(e){return 1===this.cmp(e)},n.prototype.gten=function(e){return this.cmpn(e)>=0},n.prototype.gte=function(e){return this.cmp(e)>=0},n.prototype.ltn=function(e){return-1===this.cmpn(e)},n.prototype.lt=function(e){return-1===this.cmp(e)},n.prototype.lten=function(e){return this.cmpn(e)<=0},n.prototype.lte=function(e){return this.cmp(e)<=0},n.prototype.eqn=function(e){return 0===this.cmpn(e)},n.prototype.eq=function(e){return 0===this.cmp(e)},n.red=function(e){return new k(e)},n.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(e){return this.red=e,this},n.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},n.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},n.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},n.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},n.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},n.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},n.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},n.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function g(e,t){this.name=e,this.p=new n(t,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function $(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(e){if("string"==typeof e){var t=n._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function _(e){k.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}g.prototype._tmp=function(){var e=new n(null);return e.words=new Array(Math.ceil(this.n/13)),e},g.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 o=t<this.n?-1:r.ucmp(this.p);return 0===o?(r.words[0]=0,r.length=1):o>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(e,t){e.iushrn(this.n,0,t)},g.prototype.imulK=function(e){return e.imul(this.k)},o(b,g),b.prototype.split=function(e,t){for(var r=4194303,o=Math.min(e.length,9),n=0;n<o;n++)t.words[n]=e.words[n];if(t.length=o,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=i&r,n=10;n<e.length;n++){var a=0|e.words[n];e.words[n-10]=(a&r)<<4|i>>>22,i=a}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},b.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 o=0|e.words[r];t+=977*o,e.words[r]=67108863&t,t=64*o+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},o(v,g),o(w,g),o($,g),$.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var o=19*(0|e.words[r])+t,n=67108863&o;o>>>=26,e.words[r]=n,t=o}return 0!==t&&(e.words[e.length++]=t),e},n._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new $}return y[e]=t,t},k.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},k.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},k.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},k.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},k.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},k.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},k.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},k.prototype.isqr=function(e){return this.imul(e,e.clone())},k.prototype.sqr=function(e){return this.mul(e,e)},k.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var o=this.m.add(new n(1)).iushrn(2);return this.pow(e,o)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new n(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),p=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),f=a;0!==h.cmp(s);){for(var m=h,y=0;0!==m.cmp(s);y++)m=m.redSqr();r(y<f);var g=this.pow(d,new n(1).iushln(f-y-1));p=p.redMul(g),d=g.redSqr(),h=h.redMul(d),f=y}return p},k.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},k.prototype.pow=function(e,t){if(t.isZero())return new n(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=e;for(var o=2;o<r.length;o++)r[o]=this.mul(r[o-1],e);var i=r[0],a=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),o=t.length-1;o>=0;o--){for(var u=t.words[o],l=c-1;l>=0;l--){var d=u>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4===++s||0===o&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}c=26}return i},k.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},k.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},n.mont=function(e){return new _(e)},o(_,k),_.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},_.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},_.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(o).iushrn(this.shift),i=n;return n.cmp(this.m)>=0?i=n.isub(this.m):n.cmpn(0)<0&&(i=n.iadd(this.m)),i._forceRed(this)},_.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new n(0)._forceRed(this);var r=e.mul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(o).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},_.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,commonjsGlobal)}(bn$2)),bn$2.exports}bn$2.exports;var api$1={},vmBrowserify={},hasRequiredVmBrowserify,hasRequiredApi;function requireVmBrowserify(){return hasRequiredVmBrowserify||(hasRequiredVmBrowserify=1,function(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,o=r.eval,n=r.execScript;!o&&n&&(n.call(r,"null"),o=r.eval),forEach(Object_keys(e),(function(t){r[t]=e[t]})),forEach(globals,(function(t){e[t]&&(r[t]=e[t])}));var i=Object_keys(r),a=o.call(r,this.code);return forEach(Object_keys(r),(function(t){(t in e||-1===indexOf(i,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}}(vmBrowserify)),vmBrowserify}function requireApi(){return hasRequiredApi||(hasRequiredApi=1,function(e){var t=requireAsn1$1(),r=requireInherits_browser();function o(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}e.define=function(e,t){return new o(e,t)},o.prototype._createNamed=function(e){var t;try{t=requireVmBrowserify().runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(o){t=function(e){this._initNamed(e)}}return r(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(t.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(t.encoders[e])),this.encoders[e]},o.prototype.encode=function(e,t,r){return this._getEncoder(t).encode(e,r)}}(api$1)),api$1}var base={},reporter={},hasRequiredReporter;function requireReporter(){if(hasRequiredReporter)return reporter;hasRequiredReporter=1;var e=requireInherits_browser();function t(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function r(e,t){this.path=e,this.rethrow(t)}return reporter.Reporter=t,t.prototype.isError=function(e){return e instanceof r},t.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},t.prototype.restore=function(e){var t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},t.prototype.enterKey=function(e){return this._reporterState.path.push(e)},t.prototype.exitKey=function(e){var t=this._reporterState;t.path=t.path.slice(0,e-1)},t.prototype.leaveKey=function(e,t,r){var o=this._reporterState;this.exitKey(e),null!==o.obj&&(o.obj[t]=r)},t.prototype.path=function(){return this._reporterState.path.join("/")},t.prototype.enterObject=function(){var e=this._reporterState,t=e.obj;return e.obj={},t},t.prototype.leaveObject=function(e){var t=this._reporterState,r=t.obj;return t.obj=e,r},t.prototype.error=function(e){var t,o=this._reporterState,n=e instanceof r;if(t=n?e:new r(o.path.map((function(e){return"["+JSON.stringify(e)+"]"})).join(""),e.message||e,e.stack),!o.options.partial)throw t;return n||o.errors.push(t),t},t.prototype.wrapResult=function(e){var t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},e(r,Error),r.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,r),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this},reporter}var buffer$1={},hasRequiredBuffer,node,hasRequiredNode,hasRequiredBase;function requireBuffer(){if(hasRequiredBuffer)return buffer$1;hasRequiredBuffer=1;var e=requireInherits_browser(),t=requireBase().Reporter,r=require$$0$2.Buffer;function o(e,o){t.call(this,o),r.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function n(e,t){if(Array.isArray(e))this.length=0,this.value=e.map((function(e){return e instanceof n||(e=new n(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=r.byteLength(e);else{if(!r.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}return e(o,t),buffer$1.DecoderBuffer=o,o.prototype.save=function(){return{offset:this.offset,reporter:t.prototype.save.call(this)}},o.prototype.restore=function(e){var r=new o(this.base);return r.offset=e.offset,r.length=this.offset,this.offset=e.offset,t.prototype.restore.call(this,e.reporter),r},o.prototype.isEmpty=function(){return this.offset===this.length},o.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},o.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");var r=new o(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},o.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},buffer$1.EncoderBuffer=n,n.prototype.join=function(e,t){return e||(e=new r(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):r.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length)),e},buffer$1}function requireNode(){if(hasRequiredNode)return node;hasRequiredNode=1;var e=requireBase().Reporter,t=requireBase().EncoderBuffer,r=requireBase().DecoderBuffer,o=minimalisticAssert,n=["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"],i=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(n);function a(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())}node=a;var s=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];return a.prototype.clone=function(){var e=this._baseState,t={};s.forEach((function(r){t[r]=e[r]}));var r=new this.constructor(t.parent);return r._baseState=t,r},a.prototype._wrap=function(){var e=this._baseState;i.forEach((function(t){this[t]=function(){var r=new this.constructor(this);return e.children.push(r),r[t].apply(r,arguments)}}),this)},a.prototype._init=function(e){var t=this._baseState;o(null===t.parent),e.call(this),t.children=t.children.filter((function(e){return e._baseState.parent===this}),this),o.equal(t.children.length,1,"Root node can have only one child")},a.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&&(o(null===t.children),t.children=r,r.forEach((function(e){e._baseState.parent=this}),this)),0!==e.length&&(o(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 o=e[r];t[o]=r})),t})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(e){a.prototype[e]=function(){var t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}})),n.forEach((function(e){a.prototype[e]=function(){var t=this._baseState,r=Array.prototype.slice.call(arguments);return o(null===t.tag),t.tag=e,this._useArgs(r),this}})),a.prototype.use=function(e){o(e);var t=this._baseState;return o(null===t.use),t.use=e,this},a.prototype.optional=function(){return this._baseState.optional=!0,this},a.prototype.def=function(e){var t=this._baseState;return o(null===t.default),t.default=e,t.optional=!0,this},a.prototype.explicit=function(e){var t=this._baseState;return o(null===t.explicit&&null===t.implicit),t.explicit=e,this},a.prototype.implicit=function(e){var t=this._baseState;return o(null===t.explicit&&null===t.implicit),t.implicit=e,this},a.prototype.obj=function(){var e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},a.prototype.key=function(e){var t=this._baseState;return o(null===t.key),t.key=e,this},a.prototype.any=function(){return this._baseState.any=!0,this},a.prototype.choice=function(e){var t=this._baseState;return o(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map((function(t){return e[t]}))),this},a.prototype.contains=function(e){var t=this._baseState;return o(null===t.use),t.contains=e,this},a.prototype._decode=function(e,t){var o=this._baseState;if(null===o.parent)return e.wrapResult(o.children[0]._decode(e,t));var n,i=o.default,a=!0,s=null;if(null!==o.key&&(s=e.enterKey(o.key)),o.optional){var c=null;if(null!==o.explicit?c=o.explicit:null!==o.implicit?c=o.implicit:null!==o.tag&&(c=o.tag),null!==c||o.any){if(a=this._peekTag(e,c,o.any),e.isError(a))return a}else{var u=e.save();try{null===o.choice?this._decodeGeneric(o.tag,e,t):this._decodeChoice(e,t),a=!0}catch(f){a=!1}e.restore(u)}}if(o.obj&&a&&(n=e.enterObject()),a){if(null!==o.explicit){var l=this._decodeTag(e,o.explicit);if(e.isError(l))return l;e=l}var d=e.offset;if(null===o.use&&null===o.choice){if(o.any)u=e.save();var p=this._decodeTag(e,null!==o.implicit?o.implicit:o.tag,o.any);if(e.isError(p))return p;o.any?i=e.raw(u):e=p}if(t&&t.track&&null!==o.tag&&t.track(e.path(),d,e.length,"tagged"),t&&t.track&&null!==o.tag&&t.track(e.path(),e.offset,e.length,"content"),o.any||(i=null===o.choice?this._decodeGeneric(o.tag,e,t):this._decodeChoice(e,t)),e.isError(i))return i;if(o.any||null!==o.choice||null===o.children||o.children.forEach((function(r){r._decode(e,t)})),o.contains&&("octstr"===o.tag||"bitstr"===o.tag)){var h=new r(i);i=this._getUse(o.contains,e._reporterState.obj)._decode(h,t)}}return o.obj&&a&&(i=e.leaveObject(n)),null===o.key||null===i&&!0!==a?null!==s&&e.exitKey(s):e.leaveKey(s,o.key,i),i},a.prototype._decodeGeneric=function(e,t,r){var o=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,o.args[0],r):/str$/.test(e)?this._decodeStr(t,e,r):"objid"===e&&o.args?this._decodeObjid(t,o.args[0],o.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,o.args&&o.args[0],r):null!==o.use?this._getUse(o.use,t._reporterState.obj)._decode(t,r):t.error("unknown tag: "+e)},a.prototype._getUse=function(e,t){var r=this._baseState;return r.useDecoder=this._use(e,t),o(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},a.prototype._decodeChoice=function(e,t){var r=this._baseState,o=null,n=!1;return Object.keys(r.choice).some((function(i){var a=e.save(),s=r.choice[i];try{var c=s._decode(e,t);if(e.isError(c))return!1;o={type:i,value:c},n=!0}catch(u){return e.restore(a),!1}return!0}),this),n?o:e.error("Choice not matched")},a.prototype._createEncoderBuffer=function(e){return new t(e,this.reporter)},a.prototype._encode=function(e,t,r){var o=this._baseState;if(null===o.default||o.default!==e){var n=this._encodeValue(e,t,r);if(void 0!==n&&!this._skipDefault(n,t,r))return n}},a.prototype._encodeValue=function(t,r,o){var n=this._baseState;if(null===n.parent)return n.children[0]._encode(t,r||new e);var i=null;if(this.reporter=r,n.optional&&void 0===t){if(null===n.default)return;t=n.default}var a=null,s=!1;if(n.any)i=this._createEncoderBuffer(t);else if(n.choice)i=this._encodeChoice(t,r);else if(n.contains)a=this._getUse(n.contains,o)._encode(t,r),s=!0;else if(n.children)a=n.children.map((function(e){if("null_"===e._baseState.tag)return e._encode(null,r,t);if(null===e._baseState.key)return r.error("Child should have a key");var o=r.enterKey(e._baseState.key);if("object"!=typeof t)return r.error("Child expected, but input is not object");var n=e._encode(t[e._baseState.key],r,t);return r.leaveKey(o),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 r.error("Too many args for : "+n.tag);if(!Array.isArray(t))return r.error("seqof/setof, but data is not Array");var c=this.clone();c._baseState.implicit=null,a=this._createEncoderBuffer(t.map((function(e){var o=this._baseState;return this._getUse(o.args[0],t)._encode(e,r)}),c))}else null!==n.use?i=this._getUse(n.use,o)._encode(t,r):(a=this._encodePrimitive(n.tag,t),s=!0);if(!n.any&&null===n.choice){var u=null!==n.implicit?n.implicit:n.tag,l=null===n.implicit?"universal":"context";null===u?null===n.use&&r.error("Tag could be omitted only for .use()"):null===n.use&&(i=this._encodeComposite(u,s,l,a))}return null!==n.explicit&&(i=this._encodeComposite(n.explicit,!1,"context",i)),i},a.prototype._encodeChoice=function(e,t){var r=this._baseState,n=r.choice[e.type];return n||o(!1,e.type+" not found in "+JSON.stringify(Object.keys(r.choice))),n._encode(e.value,t)},a.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)},a.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},a.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e)},node}function requireBase(){return hasRequiredBase||(hasRequiredBase=1,function(e){var t=e;t.Reporter=requireReporter().Reporter,t.DecoderBuffer=requireBuffer().DecoderBuffer,t.EncoderBuffer=requireBuffer().EncoderBuffer,t.Node=requireNode()}(base)),base}var constants={},der={},hasRequiredDer$2,hasRequiredConstants;function requireDer$2(){return hasRequiredDer$2||(hasRequiredDer$2=1,function(e){var t=requireConstants();e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=t._reverse(e.tagClass),e.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"},e.tagByName=t._reverse(e.tag)}(der)),der}function requireConstants(){return hasRequiredConstants||(hasRequiredConstants=1,function(e){var t=e;t._reverse=function(e){var t={};return Object.keys(e).forEach((function(r){(0|r)==r&&(r|=0);var o=e[r];t[o]=r})),t},t.der=requireDer$2()}(constants)),constants}var decoders={},der_1$1,hasRequiredDer$1,pem$3,hasRequiredPem$1,hasRequiredDecoders;function requireDer$1(){if(hasRequiredDer$1)return der_1$1;hasRequiredDer$1=1;var e=requireInherits_browser(),t=requireAsn1$1(),r=t.base,o=t.bignum,n=t.constants.der;function i(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new a,this.tree._init(e.body)}function a(e){r.Node.call(this,"der",e)}function s(e,t){var r=e.readUInt8(t);if(e.isError(r))return r;var o=n.tagClass[r>>6],i=!(32&r);if(31&~r)r&=31;else{var a=r;for(r=0;!(128&~a);){if(a=e.readUInt8(t),e.isError(a))return a;r<<=7,r|=127&a}}return{cls:o,primitive:i,tag:r,tagStr:n.tag[r]}}function c(e,t,r){var o=e.readUInt8(r);if(e.isError(o))return o;if(!t&&128===o)return null;if(!(128&o))return o;var n=127&o;if(n>4)return e.error("length octect is too long");o=0;for(var i=0;i<n;i++){o<<=8;var a=e.readUInt8(r);if(e.isError(a))return a;o|=a}return o}return der_1$1=i,i.prototype.decode=function(e,t){return e instanceof r.DecoderBuffer||(e=new r.DecoderBuffer(e,t)),this.tree._decode(e,t)},e(a,r.Node),a.prototype._peekTag=function(e,t,r){if(e.isEmpty())return!1;var o=e.save(),n=s(e,'Failed to peek tag: "'+t+'"');return e.isError(n)?n:(e.restore(o),n.tag===t||n.tagStr===t||n.tagStr+"of"===t||r)},a.prototype._decodeTag=function(e,t,r){var o=s(e,'Failed to decode tag of "'+t+'"');if(e.isError(o))return o;var n=c(e,o.primitive,'Failed to get length of "'+t+'"');if(e.isError(n))return n;if(!r&&o.tag!==t&&o.tagStr!==t&&o.tagStr+"of"!==t)return e.error('Failed to match tag: "'+t+'"');if(o.primitive||null!==n)return e.skip(n,'Failed to match body of: "'+t+'"');var i=e.save(),a=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(a)?a:(n=e.offset-i.offset,e.restore(i),e.skip(n,'Failed to match body of: "'+t+'"'))},a.prototype._skipUntilEnd=function(e,t){for(;;){var r=s(e,t);if(e.isError(r))return r;var o,n=c(e,r.primitive,t);if(e.isError(n))return n;if(o=r.primitive||null!==n?e.skip(n):this._skipUntilEnd(e,t),e.isError(o))return o;if("end"===r.tagStr)break}},a.prototype._decodeList=function(e,t,r,o){for(var n=[];!e.isEmpty();){var i=this._peekTag(e,"end");if(e.isError(i))return i;var a=r.decode(e,"der",o);if(e.isError(a)&&i)break;n.push(a)}return n},a.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 o=e.raw();if(o.length%2==1)return e.error("Decoding of string type: bmpstr length mismatch");for(var n="",i=0;i<o.length/2;i++)n+=String.fromCharCode(o.readUInt16BE(2*i));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")},a.prototype._decodeObjid=function(e,t,r){for(var o,n=[],i=0;!e.isEmpty();){var a=e.readUInt8();i<<=7,i|=127&a,128&a||(n.push(i),i=0)}128&a&&n.push(i);var s=n[0]/40|0,c=n[0]%40;if(o=r?n:[s,c].concat(n.slice(1)),t){var u=t[o.join(" ")];void 0===u&&(u=t[o.join(".")]),void 0!==u&&(o=u)}return o},a.prototype._decodeTime=function(e,t){var r=e.raw().toString();if("gentime"===t)var o=0|r.slice(0,4),n=0|r.slice(4,6),i=0|r.slice(6,8),a=0|r.slice(8,10),s=0|r.slice(10,12),c=0|r.slice(12,14);else{if("utctime"!==t)return e.error("Decoding "+t+" time is not supported yet");o=0|r.slice(0,2),n=0|r.slice(2,4),i=0|r.slice(4,6),a=0|r.slice(6,8),s=0|r.slice(8,10),c=0|r.slice(10,12);o=o<70?2e3+o:1900+o}return Date.UTC(o,n-1,i,a,s,c,0)},a.prototype._decodeNull=function(e){return null},a.prototype._decodeBool=function(e){var t=e.readUInt8();return e.isError(t)?t:0!==t},a.prototype._decodeInt=function(e,t){var r=e.raw(),n=new o(r);return t&&(n=t[n.toString(10)]||n),n},a.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree},der_1$1}function requirePem$1(){if(hasRequiredPem$1)return pem$3;hasRequiredPem$1=1;var e=requireInherits_browser(),t=require$$0$2.Buffer,r=requireDer$1();function o(e){r.call(this,e),this.enc="pem"}return e(o,r),pem$3=o,o.prototype.decode=function(e,o){for(var n=e.toString().split(/[\r\n]+/g),i=o.label.toUpperCase(),a=/^-----(BEGIN|END) ([^-]+)-----$/,s=-1,c=-1,u=0;u<n.length;u++){var l=n[u].match(a);if(null!==l&&l[2]===i){if(-1!==s){if("END"!==l[1])break;c=u;break}if("BEGIN"!==l[1])break;s=u}}if(-1===s||-1===c)throw new Error("PEM section not found for: "+i);var d=n.slice(s+1,c).join("");d.replace(/[^a-z0-9\+\/=]+/gi,"");var p=new t(d,"base64");return r.prototype.decode.call(this,p,o)},pem$3}function requireDecoders(){return hasRequiredDecoders||(hasRequiredDecoders=1,function(e){var t=e;t.der=requireDer$1(),t.pem=requirePem$1()}(decoders)),decoders}var encoders={},der_1,hasRequiredDer,pem$2,hasRequiredPem,hasRequiredEncoders,hasRequiredAsn1$1,certificate,hasRequiredCertificate,hasRequiredAsn1;function requireDer(){if(hasRequiredDer)return der_1;hasRequiredDer=1;var e=requireInherits_browser(),t=require$$0$2.Buffer,r=requireAsn1$1(),o=r.base,n=r.constants.der;function i(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new a,this.tree._init(e.body)}function a(e){o.Node.call(this,"der",e)}function s(e){return e<10?"0"+e:e}return der_1=i,i.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},e(a,o.Node),a.prototype._encodeComposite=function(e,r,o,i){var a,s=function(e,t,r,o){var i;"seqof"===e?e="seq":"setof"===e&&(e="set");if(n.tagByName.hasOwnProperty(e))i=n.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return o.error("Unknown tag: "+e);i=e}if(i>=31)return o.error("Multi-octet tag encoding unsupported");t||(i|=32);return i|=n.tagClassByName[r||"universal"]<<6,i}(e,r,o,this.reporter);if(i.length<128)return(a=new t(2))[0]=s,a[1]=i.length,this._createEncoderBuffer([a,i]);for(var c=1,u=i.length;u>=256;u>>=8)c++;(a=new t(2+c))[0]=s,a[1]=128|c;u=1+c;for(var l=i.length;l>0;u--,l>>=8)a[u]=255&l;return this._createEncoderBuffer([a,i])},a.prototype._encodeStr=function(e,r){if("bitstr"===r)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===r){for(var o=new t(2*e.length),n=0;n<e.length;n++)o.writeUInt16BE(e.charCodeAt(n),2*n);return this._createEncoderBuffer(o)}return"numstr"===r?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===r?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(r)||"objDesc"===r?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+r+" unsupported")},a.prototype._encodeObjid=function(e,r,o){if("string"==typeof e){if(!r)return this.reporter.error("string objid given, but no values map found");if(!r.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=r[e].split(/[\s\.]+/g);for(var n=0;n<e.length;n++)e[n]|=0}else if(Array.isArray(e)){e=e.slice();for(n=0;n<e.length;n++)e[n]|=0}if(!Array.isArray(e))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(e));if(!o){if(e[1]>=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}var i=0;for(n=0;n<e.length;n++){var a=e[n];for(i++;a>=128;a>>=7)i++}var s=new t(i),c=s.length-1;for(n=e.length-1;n>=0;n--){a=e[n];for(s[c--]=127&a;(a>>=7)>0;)s[c--]=128|127&a}return this._createEncoderBuffer(s)},a.prototype._encodeTime=function(e,t){var r,o=new Date(e);return"gentime"===t?r=[s(o.getFullYear()),s(o.getUTCMonth()+1),s(o.getUTCDate()),s(o.getUTCHours()),s(o.getUTCMinutes()),s(o.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[s(o.getFullYear()%100),s(o.getUTCMonth()+1),s(o.getUTCDate()),s(o.getUTCHours()),s(o.getUTCMinutes()),s(o.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},a.prototype._encodeNull=function(){return this._createEncoderBuffer("")},a.prototype._encodeInt=function(e,r){if("string"==typeof e){if(!r)return this.reporter.error("String int or enum given, but no values map");if(!r.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=r[e]}if("number"!=typeof e&&!t.isBuffer(e)){var o=e.toArray();!e.sign&&128&o[0]&&o.unshift(0),e=new t(o)}if(t.isBuffer(e)){var n=e.length;0===e.length&&n++;var i=new t(n);return e.copy(i),0===e.length&&(i[0]=0),this._createEncoderBuffer(i)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);n=1;for(var a=e;a>=256;a>>=8)n++;for(a=(i=new Array(n)).length-1;a>=0;a--)i[a]=255&e,e>>=8;return 128&i[0]&&i.unshift(0),this._createEncoderBuffer(new t(i))},a.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},a.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},a.prototype._skipDefault=function(e,t,r){var o,n=this._baseState;if(null===n.default)return!1;var i=e.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,t,r).join()),i.length!==n.defaultBuffer.length)return!1;for(o=0;o<i.length;o++)if(i[o]!==n.defaultBuffer[o])return!1;return!0},der_1}function requirePem(){if(hasRequiredPem)return pem$2;hasRequiredPem=1;var e=requireInherits_browser(),t=requireDer();function r(e){t.call(this,e),this.enc="pem"}return e(r,t),pem$2=r,r.prototype.encode=function(e,r){for(var o=t.prototype.encode.call(this,e).toString("base64"),n=["-----BEGIN "+r.label+"-----"],i=0;i<o.length;i+=64)n.push(o.slice(i,i+64));return n.push("-----END "+r.label+"-----"),n.join("\n")},pem$2}function requireEncoders(){return hasRequiredEncoders||(hasRequiredEncoders=1,function(e){var t=e;t.der=requireDer(),t.pem=requirePem()}(encoders)),encoders}function requireAsn1$1(){return hasRequiredAsn1$1||(hasRequiredAsn1$1=1,function(e){var t=e;t.bignum=requireBn$2(),t.define=requireApi().define,t.base=requireBase(),t.constants=requireConstants(),t.decoders=requireDecoders(),t.encoders=requireEncoders()}(asn1)),asn1}function requireCertificate(){if(hasRequiredCertificate)return certificate;hasRequiredCertificate=1;var e=requireAsn1$1(),t=e.define("Time",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),r=e.define("AttributeTypeValue",(function(){this.seq().obj(this.key("type").objid(),this.key("value").any())})),o=e.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())})),n=e.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(o),this.key("subjectPublicKey").bitstr())})),i=e.define("RelativeDistinguishedName",(function(){this.setof(r)})),a=e.define("RDNSequence",(function(){this.seqof(i)})),s=e.define("Name",(function(){this.choice({rdnSequence:this.use(a)})})),c=e.define("Validity",(function(){this.seq().obj(this.key("notBefore").use(t),this.key("notAfter").use(t))})),u=e.define("Extension",(function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())})),l=e.define("TBSCertificate",(function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(o),this.key("issuer").use(s),this.key("validity").use(c),this.key("subject").use(s),this.key("subjectPublicKeyInfo").use(n),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(u).optional())})),d=e.define("X509Certificate",(function(){this.seq().obj(this.key("tbsCertificate").use(l),this.key("signatureAlgorithm").use(o),this.key("signatureValue").bitstr())}));return certificate=d}function requireAsn1(){if(hasRequiredAsn1)return asn1$1;hasRequiredAsn1=1;var e=requireAsn1$1();asn1$1.certificate=requireCertificate();var t=e.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())}));asn1$1.RSAPrivateKey=t;var r=e.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));asn1$1.RSAPublicKey=r;var o=e.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())})),n=e.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(o),this.key("subjectPublicKey").bitstr())}));asn1$1.PublicKey=n;var i=e.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(o),this.key("subjectPrivateKey").octstr())}));asn1$1.PrivateKey=i;var a=e.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())}));asn1$1.EncryptedPrivateKey=a;var s=e.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())}));asn1$1.DSAPrivateKey=s,asn1$1.DSAparam=e.define("DSAparam",(function(){this.int()}));var c=e.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})})),u=e.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(c),this.key("publicKey").optional().explicit(1).bitstr())}));return asn1$1.ECPrivateKey=u,asn1$1.signature=e.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())})),asn1$1}const require$$1={"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"};var fixProc,hasRequiredFixProc,parseAsn1,hasRequiredParseAsn1;function requireFixProc(){if(hasRequiredFixProc)return fixProc;hasRequiredFixProc=1;var e=/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,t=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,r=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,o=requireEvp_bytestokey(),n=requireBrowser$6(),i=requireSafeBuffer$1().Buffer;return fixProc=function(a,s){var c,u=a.toString(),l=u.match(e);if(l){var d="aes"+l[1],p=i.from(l[2],"hex"),h=i.from(l[3].replace(/[\r\n]/g,""),"base64"),f=o(s,p.slice(0,8),parseInt(l[1],10)).key,m=[],y=n.createDecipheriv(d,f,p);m.push(y.update(h)),m.push(y.final()),c=i.concat(m)}else{var g=u.match(r);c=i.from(g[2].replace(/[\r\n]/g,""),"base64")}return{tag:u.match(t)[1],data:c}}}function requireParseAsn1(){if(hasRequiredParseAsn1)return parseAsn1;hasRequiredParseAsn1=1;var e=requireAsn1(),t=require$$1,r=requireFixProc(),o=requireBrowser$6(),n=requireBrowser$7(),i=requireSafeBuffer$1().Buffer;function a(a){var s;"object"!=typeof a||i.isBuffer(a)||(s=a.passphrase,a=a.key),"string"==typeof a&&(a=i.from(a));var c,u,l=r(a,s),d=l.tag,p=l.data;switch(d){case"CERTIFICATE":u=e.certificate.decode(p,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(u||(u=e.PublicKey.decode(p,"der")),c=u.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return e.RSAPublicKey.decode(u.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return u.subjectPrivateKey=u.subjectPublicKey,{type:"ec",data:u};case"1.2.840.10040.4.1":return u.algorithm.params.pub_key=e.DSAparam.decode(u.subjectPublicKey.data,"der"),{type:"dsa",data:u.algorithm.params};default:throw new Error("unknown key id "+c)}case"ENCRYPTED PRIVATE KEY":p=function(e,r){var a=e.algorithm.decrypt.kde.kdeparams.salt,s=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),c=t[e.algorithm.decrypt.cipher.algo.join(".")],u=e.algorithm.decrypt.cipher.iv,l=e.subjectPrivateKey,d=parseInt(c.split("-")[1],10)/8,p=n.pbkdf2Sync(r,a,s,d,"sha1"),h=o.createDecipheriv(c,p,u),f=[];return f.push(h.update(l)),f.push(h.final()),i.concat(f)}(p=e.EncryptedPrivateKey.decode(p,"der"),s);case"PRIVATE KEY":switch(c=(u=e.PrivateKey.decode(p,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return e.RSAPrivateKey.decode(u.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:u.algorithm.curve,privateKey:e.ECPrivateKey.decode(u.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return u.algorithm.params.priv_key=e.DSAparam.decode(u.subjectPrivateKey,"der"),{type:"dsa",params:u.algorithm.params};default:throw new Error("unknown key id "+c)}case"RSA PUBLIC KEY":return e.RSAPublicKey.decode(p,"der");case"RSA PRIVATE KEY":return e.RSAPrivateKey.decode(p,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:e.DSAPrivateKey.decode(p,"der")};case"EC PRIVATE KEY":return{curve:(p=e.ECPrivateKey.decode(p,"der")).parameters.value,privateKey:p.privateKey};default:throw new Error("unknown key type "+d)}}return a.signature=e.signature,parseAsn1=a}const require$$4={"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"};var hasRequiredSign,verify_1,hasRequiredVerify,browser$5,hasRequiredBrowser$3;function requireSign(){if(hasRequiredSign)return sign$1.exports;hasRequiredSign=1;var e=requireSafeBuffer$1().Buffer,t=requireBrowser$8(),r=requireBrowserifyRsa(),o=requireElliptic().ec,n=bnExports$1,i=requireParseAsn1(),a=require$$4;function s(r,o,n,i){if((r=e.from(r.toArray())).length<o.byteLength()){var a=e.alloc(o.byteLength()-r.length);r=e.concat([a,r])}var s=n.length,u=function(t,r){t=c(t,r),t=t.mod(r);var o=e.from(t.toArray());if(o.length<r.byteLength()){var n=e.alloc(r.byteLength()-o.length);o=e.concat([n,o])}return o}(n,o),l=e.alloc(s);l.fill(1);var d=e.alloc(s);return d=t(i,d).update(l).update(e.from([0])).update(r).update(u).digest(),l=t(i,d).update(l).digest(),{k:d=t(i,d).update(l).update(e.from([1])).update(r).update(u).digest(),v:l=t(i,d).update(l).digest()}}function c(e,t){var r=new n(e),o=(e.length<<3)-t.bitLength();return o>0&&r.ishrn(o),r}function u(r,o,n){var i,a;do{for(i=e.alloc(0);8*i.length<r.bitLength();)o.v=t(n,o.k).update(o.v).digest(),i=e.concat([i,o.v]);a=c(i,r),o.k=t(n,o.k).update(o.v).update(e.from([0])).digest(),o.v=t(n,o.k).update(o.v).digest()}while(-1!==a.cmp(r));return a}function l(e,t,r,o){return e.toRed(n.mont(r)).redPow(t).fromRed().mod(o)}return sign$1.exports=function(t,d,p,h,f){var m=i(d);if(m.curve){if("ecdsa"!==h&&"ecdsa/rsa"!==h)throw new Error("wrong private key type");return function(t,r){var n=a[r.curve.join(".")];if(!n)throw new Error("unknown curve "+r.curve.join("."));var i=new o(n).keyFromPrivate(r.privateKey),s=i.sign(t);return e.from(s.toDER())}(t,m)}if("dsa"===m.type){if("dsa"!==h)throw new Error("wrong private key type");return function(t,r,o){var i,a=r.params.priv_key,d=r.params.p,p=r.params.q,h=r.params.g,f=new n(0),m=c(t,p).mod(p),y=!1,g=s(a,p,t,o);for(;!1===y;)f=l(h,i=u(p,g,o),d,p),0===(y=i.invm(p).imul(m.add(a.mul(f))).mod(p)).cmpn(0)&&(y=!1,f=new n(0));return function(t,r){t=t.toArray(),r=r.toArray(),128&t[0]&&(t=[0].concat(t));128&r[0]&&(r=[0].concat(r));var o=t.length+r.length+4,n=[48,o,2,t.length];return n=n.concat(t,[2,r.length],r),e.from(n)}(f,y)}(t,m,p)}if("rsa"!==h&&"ecdsa/rsa"!==h)throw new Error("wrong private key type");if(void 0!==d.padding&&1!==d.padding)throw new Error("illegal or unsupported padding mode");t=e.concat([f,t]);for(var y=m.modulus.byteLength(),g=[0,1];t.length+g.length+1<y;)g.push(255);g.push(0);for(var b=-1;++b<t.length;)g.push(t[b]);return r(g,m)},sign$1.exports.getKey=s,sign$1.exports.makeKey=u,sign$1.exports}function requireVerify(){if(hasRequiredVerify)return verify_1;hasRequiredVerify=1;var e=requireSafeBuffer$1().Buffer,t=bnExports$1,r=requireElliptic().ec,o=requireParseAsn1(),n=require$$4;function i(e,t){if(e.cmpn(0)<=0)throw new Error("invalid sig");if(e.cmp(t)>=0)throw new Error("invalid sig")}return verify_1=function(a,s,c,u,l){var d=o(c);if("ec"===d.type){if("ecdsa"!==u&&"ecdsa/rsa"!==u)throw new Error("wrong public key type");return function(e,t,o){var i=n[o.data.algorithm.curve.join(".")];if(!i)throw new Error("unknown curve "+o.data.algorithm.curve.join("."));var a=new r(i),s=o.data.subjectPrivateKey.data;return a.verify(t,e,s)}(a,s,d)}if("dsa"===d.type){if("dsa"!==u)throw new Error("wrong public key type");return function(e,r,n){var a=n.data.p,s=n.data.q,c=n.data.g,u=n.data.pub_key,l=o.signature.decode(e,"der"),d=l.s,p=l.r;i(d,s),i(p,s);var h=t.mont(a),f=d.invm(s),m=c.toRed(h).redPow(new t(r).mul(f).mod(s)).fromRed().mul(u.toRed(h).redPow(p.mul(f).mod(s)).fromRed()).mod(a).mod(s);return 0===m.cmp(p)}(a,s,d)}if("rsa"!==u&&"ecdsa/rsa"!==u)throw new Error("wrong public key type");s=e.concat([l,s]);for(var p=d.modulus.byteLength(),h=[1],f=0;s.length+h.length+2<p;)h.push(255),f+=1;h.push(0);for(var m=-1;++m<s.length;)h.push(s[m]);h=e.from(h);var y=t.mont(d.modulus);a=(a=new t(a).toRed(y)).redPow(new t(d.publicExponent)),a=e.from(a.fromRed().toArray());var g=f<8?1:0;for(p=Math.min(a.length,h.length),a.length!==h.length&&(g=1),m=-1;++m<p;)g|=a[m]^h[m];return 0===g}}function requireBrowser$3(){if(hasRequiredBrowser$3)return browser$5;hasRequiredBrowser$3=1;var e=requireSafeBuffer$1().Buffer,t=requireBrowser$9(),r=requireReadableBrowser(),o=requireInherits_browser(),n=requireSign(),i=requireVerify(),a=require$$6;function s(e){r.Writable.call(this);var o=a[e];if(!o)throw new Error("Unknown message digest");this._hashType=o.hash,this._hash=t(o.hash),this._tag=o.id,this._signType=o.sign}function c(e){r.Writable.call(this);var o=a[e];if(!o)throw new Error("Unknown message digest");this._hash=t(o.hash),this._tag=o.id,this._signType=o.sign}function u(e){return new s(e)}function l(e){return new c(e)}return Object.keys(a).forEach((function(t){a[t].id=e.from(a[t].id,"hex"),a[t.toLowerCase()]=a[t]})),o(s,r.Writable),s.prototype._write=function(e,t,r){this._hash.update(e),r()},s.prototype.update=function(t,r){return this._hash.update("string"==typeof t?e.from(t,r):t),this},s.prototype.sign=function(e,t){this.end();var r=this._hash.digest(),o=n(r,e,this._hashType,this._signType,this._tag);return t?o.toString(t):o},o(c,r.Writable),c.prototype._write=function(e,t,r){this._hash.update(e),r()},c.prototype.update=function(t,r){return this._hash.update("string"==typeof t?e.from(t,r):t),this},c.prototype.verify=function(t,r,o){var n="string"==typeof r?e.from(r,o):r;this.end();var a=this._hash.digest();return i(n,a,t,this._signType,this._tag)},browser$5={Sign:u,Verify:l,createSign:u,createVerify:l}}var bn$1={exports:{}},hasRequiredBn$1,browser$4,hasRequiredBrowser$2;function requireBn$1(){return hasRequiredBn$1||(hasRequiredBn$1=1,function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function o(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function n(e,t,r){if(n.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 i;"object"==typeof e?e.exports=n:t.BN=n,n.BN=n,n.wordSize=26;try{i="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require$$0$2.Buffer}catch(T){}function a(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(e,t,r){var o=a(e,r);return r-1>=t&&(o|=a(e,r-1)<<4),o}function c(e,t,r,o){for(var n=0,i=Math.min(e.length,r),a=t;a<i;a++){var s=e.charCodeAt(a)-48;n*=o,n+=s>=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(e){return e instanceof n||null!==e&&"object"==typeof e&&e.constructor.wordSize===n.wordSize&&Array.isArray(e.words)},n.max=function(e,t){return e.cmp(t)>0?e:t},n.min=function(e,t){return e.cmp(t)<0?e:t},n.prototype._init=function(e,t,o){if("number"==typeof e)return this._initNumber(e,t,o);if("object"==typeof e)return this._initArray(e,t,o);"hex"===t&&(t=16),r(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,o):(this._parseBase(e,t,n),"le"===o&&this._initArray(this.toArray(),t,o)))},n.prototype._initNumber=function(e,t,o){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):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===o&&this._initArray(this.toArray(),t,o)},n.prototype._initArray=function(e,t,o){if(r("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 i,a,s=0;if("be"===o)for(n=e.length-1,i=0;n>=0;n-=3)a=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===o)for(n=0,i=0;n<e.length;n+=3)a=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this.strip()},n.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var n,i=0,a=0;if("be"===r)for(o=e.length-1;o>=t;o-=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;else for(o=(e.length-t)%2==0?t+1:t;o<e.length;o+=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;this.strip()},n.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var o=0,n=1;n<=67108863;n*=t)o++;o--,n=n/t|0;for(var i=e.length-r,a=i%o,s=Math.min(i,i-a)+r,u=0,l=r;l<s;l+=o)u=c(e,l,l+o,t),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var d=1;for(u=c(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.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},n.prototype.clone=function(){var e=new n(null);return this.copy(e),e},n.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","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"],l=[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],d=[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 p(e,t,r){r.negative=t.negative^e.negative;var o=e.length+t.length|0;r.length=o,o=o-1|0;var n=0|e.words[0],i=0|t.words[0],a=n*i,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u<o;u++){for(var l=c>>>26,d=67108863&c,p=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=p;h++){var f=u-h|0;l+=(a=(n=0|e.words[f])*(i=0|t.words[h])+d)/67108864|0,d=67108863&a}r.words[u]=0|d,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}n.prototype.toString=function(e,t){var o;if(t=0|t||1,16===(e=e||10)||"hex"===e){o="";for(var n=0,i=0,a=0;a<this.length;a++){var s=this.words[a],c=(16777215&(s<<n|i)).toString(16);i=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),o=0!==i||a!==this.length-1?u[6-c.length]+c+o:c+o}for(0!==i&&(o=i.toString(16)+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}if(e===(0|e)&&e>=2&&e<=36){var p=l[e],h=d[e];o="";var f=this.clone();for(f.negative=0;!f.isZero();){var m=f.modn(h).toString(e);o=(f=f.idivn(h)).isZero()?m+o:u[p-m.length]+m+o}for(this.isZero()&&(o="0"+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}r(!1,"Base should be between 2 and 36")},n.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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(e,t){return r(void 0!==i),this.toArrayLike(i,e,t)},n.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},n.prototype.toArrayLike=function(e,t,o){var n=this.byteLength(),i=o||Math.max(1,n);r(n<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===t,u=new e(i),l=this.clone();if(c){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[s]=a;for(;s<i;s++)u[s]=0}else{for(s=0;s<i-n;s++)u[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[i-s-1]=a}return u},Math.clz32?n.prototype._countBits=function(e){return 32-Math.clz32(e)}:n.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},n.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},n.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},n.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},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},n.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(e){return r(!(this.negative|e.negative)),this.iuor(e)},n.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},n.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},n.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()},n.prototype.iand=function(e){return r(!(this.negative|e.negative)),this.iuand(e)},n.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},n.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},n.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var o=0;o<r.length;o++)this.words[o]=t.words[o]^r.words[o];if(this!==t)for(;o<t.length;o++)this.words[o]=t.words[o];return this.length=t.length,this.strip()},n.prototype.ixor=function(e){return r(!(this.negative|e.negative)),this.iuxor(e)},n.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},n.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},n.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),o=e%26;this._expand(t),o>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return o>0&&(this.words[n]=~this.words[n]&67108863>>26-o),this.strip()},n.prototype.notn=function(e){return this.clone().inotn(e)},n.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var o=e/26|0,n=e%26;return this._expand(o+1),this.words[o]=t?this.words[o]|1<<n:this.words[o]&~(1<<n),this.strip()},n.prototype.iadd=function(e){var t,r,o;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,o=e):(r=e,o=this);for(var n=0,i=0;i<o.length;i++)t=(0|r.words[i])+(0|o.words[i])+n,this.words[i]=67108863&t,n=t>>>26;for(;0!==n&&i<r.length;i++)t=(0|r.words[i])+n,this.words[i]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;i<r.length;i++)this.words[i]=r.words[i];return this},n.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)},n.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,o,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,o=e):(r=e,o=this);for(var i=0,a=0;a<o.length;a++)i=(t=(0|r.words[a])-(0|o.words[a])+i)>>26,this.words[a]=67108863&t;for(;0!==i&&a<r.length;a++)i=(t=(0|r.words[a])+i)>>26,this.words[a]=67108863&t;if(0===i&&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()},n.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,r){var o,n,i,a=e.words,s=t.words,c=r.words,u=0,l=0|a[0],d=8191&l,p=l>>>13,h=0|a[1],f=8191&h,m=h>>>13,y=0|a[2],g=8191&y,b=y>>>13,v=0|a[3],w=8191&v,$=v>>>13,k=0|a[4],_=8191&k,T=k>>>13,I=0|a[5],A=8191&I,O=I>>>13,E=0|a[6],S=8191&E,R=E>>>13,x=0|a[7],C=8191&x,P=x>>>13,N=0|a[8],B=8191&N,D=N>>>13,M=0|a[9],L=8191&M,j=M>>>13,F=0|s[0],U=8191&F,K=F>>>13,q=0|s[1],G=8191&q,H=q>>>13,V=0|s[2],W=8191&V,z=V>>>13,Z=0|s[3],Q=8191&Z,Y=Z>>>13,X=0|s[4],J=8191&X,ee=X>>>13,te=0|s[5],re=8191&te,oe=te>>>13,ne=0|s[6],ie=8191&ne,ae=ne>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],de=8191&le,pe=le>>>13,he=0|s[9],fe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(u+(o=Math.imul(d,U))|0)+((8191&(n=(n=Math.imul(d,K))+Math.imul(p,U)|0))<<13)|0;u=((i=Math.imul(p,K))+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,o=Math.imul(f,U),n=(n=Math.imul(f,K))+Math.imul(m,U)|0,i=Math.imul(m,K);var ge=(u+(o=o+Math.imul(d,G)|0)|0)+((8191&(n=(n=n+Math.imul(d,H)|0)+Math.imul(p,G)|0))<<13)|0;u=((i=i+Math.imul(p,H)|0)+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,o=Math.imul(g,U),n=(n=Math.imul(g,K))+Math.imul(b,U)|0,i=Math.imul(b,K),o=o+Math.imul(f,G)|0,n=(n=n+Math.imul(f,H)|0)+Math.imul(m,G)|0,i=i+Math.imul(m,H)|0;var be=(u+(o=o+Math.imul(d,W)|0)|0)+((8191&(n=(n=n+Math.imul(d,z)|0)+Math.imul(p,W)|0))<<13)|0;u=((i=i+Math.imul(p,z)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,o=Math.imul(w,U),n=(n=Math.imul(w,K))+Math.imul($,U)|0,i=Math.imul($,K),o=o+Math.imul(g,G)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(b,G)|0,i=i+Math.imul(b,H)|0,o=o+Math.imul(f,W)|0,n=(n=n+Math.imul(f,z)|0)+Math.imul(m,W)|0,i=i+Math.imul(m,z)|0;var ve=(u+(o=o+Math.imul(d,Q)|0)|0)+((8191&(n=(n=n+Math.imul(d,Y)|0)+Math.imul(p,Q)|0))<<13)|0;u=((i=i+Math.imul(p,Y)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,o=Math.imul(_,U),n=(n=Math.imul(_,K))+Math.imul(T,U)|0,i=Math.imul(T,K),o=o+Math.imul(w,G)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul($,G)|0,i=i+Math.imul($,H)|0,o=o+Math.imul(g,W)|0,n=(n=n+Math.imul(g,z)|0)+Math.imul(b,W)|0,i=i+Math.imul(b,z)|0,o=o+Math.imul(f,Q)|0,n=(n=n+Math.imul(f,Y)|0)+Math.imul(m,Q)|0,i=i+Math.imul(m,Y)|0;var we=(u+(o=o+Math.imul(d,J)|0)|0)+((8191&(n=(n=n+Math.imul(d,ee)|0)+Math.imul(p,J)|0))<<13)|0;u=((i=i+Math.imul(p,ee)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,o=Math.imul(A,U),n=(n=Math.imul(A,K))+Math.imul(O,U)|0,i=Math.imul(O,K),o=o+Math.imul(_,G)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(T,G)|0,i=i+Math.imul(T,H)|0,o=o+Math.imul(w,W)|0,n=(n=n+Math.imul(w,z)|0)+Math.imul($,W)|0,i=i+Math.imul($,z)|0,o=o+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(b,Q)|0,i=i+Math.imul(b,Y)|0,o=o+Math.imul(f,J)|0,n=(n=n+Math.imul(f,ee)|0)+Math.imul(m,J)|0,i=i+Math.imul(m,ee)|0;var $e=(u+(o=o+Math.imul(d,re)|0)|0)+((8191&(n=(n=n+Math.imul(d,oe)|0)+Math.imul(p,re)|0))<<13)|0;u=((i=i+Math.imul(p,oe)|0)+(n>>>13)|0)+($e>>>26)|0,$e&=67108863,o=Math.imul(S,U),n=(n=Math.imul(S,K))+Math.imul(R,U)|0,i=Math.imul(R,K),o=o+Math.imul(A,G)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(O,G)|0,i=i+Math.imul(O,H)|0,o=o+Math.imul(_,W)|0,n=(n=n+Math.imul(_,z)|0)+Math.imul(T,W)|0,i=i+Math.imul(T,z)|0,o=o+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul($,Q)|0,i=i+Math.imul($,Y)|0,o=o+Math.imul(g,J)|0,n=(n=n+Math.imul(g,ee)|0)+Math.imul(b,J)|0,i=i+Math.imul(b,ee)|0,o=o+Math.imul(f,re)|0,n=(n=n+Math.imul(f,oe)|0)+Math.imul(m,re)|0,i=i+Math.imul(m,oe)|0;var ke=(u+(o=o+Math.imul(d,ie)|0)|0)+((8191&(n=(n=n+Math.imul(d,ae)|0)+Math.imul(p,ie)|0))<<13)|0;u=((i=i+Math.imul(p,ae)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,o=Math.imul(C,U),n=(n=Math.imul(C,K))+Math.imul(P,U)|0,i=Math.imul(P,K),o=o+Math.imul(S,G)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,G)|0,i=i+Math.imul(R,H)|0,o=o+Math.imul(A,W)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(O,W)|0,i=i+Math.imul(O,z)|0,o=o+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(T,Q)|0,i=i+Math.imul(T,Y)|0,o=o+Math.imul(w,J)|0,n=(n=n+Math.imul(w,ee)|0)+Math.imul($,J)|0,i=i+Math.imul($,ee)|0,o=o+Math.imul(g,re)|0,n=(n=n+Math.imul(g,oe)|0)+Math.imul(b,re)|0,i=i+Math.imul(b,oe)|0,o=o+Math.imul(f,ie)|0,n=(n=n+Math.imul(f,ae)|0)+Math.imul(m,ie)|0,i=i+Math.imul(m,ae)|0;var _e=(u+(o=o+Math.imul(d,ce)|0)|0)+((8191&(n=(n=n+Math.imul(d,ue)|0)+Math.imul(p,ce)|0))<<13)|0;u=((i=i+Math.imul(p,ue)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,o=Math.imul(B,U),n=(n=Math.imul(B,K))+Math.imul(D,U)|0,i=Math.imul(D,K),o=o+Math.imul(C,G)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(P,G)|0,i=i+Math.imul(P,H)|0,o=o+Math.imul(S,W)|0,n=(n=n+Math.imul(S,z)|0)+Math.imul(R,W)|0,i=i+Math.imul(R,z)|0,o=o+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,Q)|0,i=i+Math.imul(O,Y)|0,o=o+Math.imul(_,J)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(T,J)|0,i=i+Math.imul(T,ee)|0,o=o+Math.imul(w,re)|0,n=(n=n+Math.imul(w,oe)|0)+Math.imul($,re)|0,i=i+Math.imul($,oe)|0,o=o+Math.imul(g,ie)|0,n=(n=n+Math.imul(g,ae)|0)+Math.imul(b,ie)|0,i=i+Math.imul(b,ae)|0,o=o+Math.imul(f,ce)|0,n=(n=n+Math.imul(f,ue)|0)+Math.imul(m,ce)|0,i=i+Math.imul(m,ue)|0;var Te=(u+(o=o+Math.imul(d,de)|0)|0)+((8191&(n=(n=n+Math.imul(d,pe)|0)+Math.imul(p,de)|0))<<13)|0;u=((i=i+Math.imul(p,pe)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,o=Math.imul(L,U),n=(n=Math.imul(L,K))+Math.imul(j,U)|0,i=Math.imul(j,K),o=o+Math.imul(B,G)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(D,G)|0,i=i+Math.imul(D,H)|0,o=o+Math.imul(C,W)|0,n=(n=n+Math.imul(C,z)|0)+Math.imul(P,W)|0,i=i+Math.imul(P,z)|0,o=o+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(R,Q)|0,i=i+Math.imul(R,Y)|0,o=o+Math.imul(A,J)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(O,J)|0,i=i+Math.imul(O,ee)|0,o=o+Math.imul(_,re)|0,n=(n=n+Math.imul(_,oe)|0)+Math.imul(T,re)|0,i=i+Math.imul(T,oe)|0,o=o+Math.imul(w,ie)|0,n=(n=n+Math.imul(w,ae)|0)+Math.imul($,ie)|0,i=i+Math.imul($,ae)|0,o=o+Math.imul(g,ce)|0,n=(n=n+Math.imul(g,ue)|0)+Math.imul(b,ce)|0,i=i+Math.imul(b,ue)|0,o=o+Math.imul(f,de)|0,n=(n=n+Math.imul(f,pe)|0)+Math.imul(m,de)|0,i=i+Math.imul(m,pe)|0;var Ie=(u+(o=o+Math.imul(d,fe)|0)|0)+((8191&(n=(n=n+Math.imul(d,me)|0)+Math.imul(p,fe)|0))<<13)|0;u=((i=i+Math.imul(p,me)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,o=Math.imul(L,G),n=(n=Math.imul(L,H))+Math.imul(j,G)|0,i=Math.imul(j,H),o=o+Math.imul(B,W)|0,n=(n=n+Math.imul(B,z)|0)+Math.imul(D,W)|0,i=i+Math.imul(D,z)|0,o=o+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,Y)|0,o=o+Math.imul(S,J)|0,n=(n=n+Math.imul(S,ee)|0)+Math.imul(R,J)|0,i=i+Math.imul(R,ee)|0,o=o+Math.imul(A,re)|0,n=(n=n+Math.imul(A,oe)|0)+Math.imul(O,re)|0,i=i+Math.imul(O,oe)|0,o=o+Math.imul(_,ie)|0,n=(n=n+Math.imul(_,ae)|0)+Math.imul(T,ie)|0,i=i+Math.imul(T,ae)|0,o=o+Math.imul(w,ce)|0,n=(n=n+Math.imul(w,ue)|0)+Math.imul($,ce)|0,i=i+Math.imul($,ue)|0,o=o+Math.imul(g,de)|0,n=(n=n+Math.imul(g,pe)|0)+Math.imul(b,de)|0,i=i+Math.imul(b,pe)|0;var Ae=(u+(o=o+Math.imul(f,fe)|0)|0)+((8191&(n=(n=n+Math.imul(f,me)|0)+Math.imul(m,fe)|0))<<13)|0;u=((i=i+Math.imul(m,me)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,o=Math.imul(L,W),n=(n=Math.imul(L,z))+Math.imul(j,W)|0,i=Math.imul(j,z),o=o+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(D,Q)|0,i=i+Math.imul(D,Y)|0,o=o+Math.imul(C,J)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(P,J)|0,i=i+Math.imul(P,ee)|0,o=o+Math.imul(S,re)|0,n=(n=n+Math.imul(S,oe)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,oe)|0,o=o+Math.imul(A,ie)|0,n=(n=n+Math.imul(A,ae)|0)+Math.imul(O,ie)|0,i=i+Math.imul(O,ae)|0,o=o+Math.imul(_,ce)|0,n=(n=n+Math.imul(_,ue)|0)+Math.imul(T,ce)|0,i=i+Math.imul(T,ue)|0,o=o+Math.imul(w,de)|0,n=(n=n+Math.imul(w,pe)|0)+Math.imul($,de)|0,i=i+Math.imul($,pe)|0;var Oe=(u+(o=o+Math.imul(g,fe)|0)|0)+((8191&(n=(n=n+Math.imul(g,me)|0)+Math.imul(b,fe)|0))<<13)|0;u=((i=i+Math.imul(b,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,o=Math.imul(L,Q),n=(n=Math.imul(L,Y))+Math.imul(j,Q)|0,i=Math.imul(j,Y),o=o+Math.imul(B,J)|0,n=(n=n+Math.imul(B,ee)|0)+Math.imul(D,J)|0,i=i+Math.imul(D,ee)|0,o=o+Math.imul(C,re)|0,n=(n=n+Math.imul(C,oe)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,oe)|0,o=o+Math.imul(S,ie)|0,n=(n=n+Math.imul(S,ae)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,ae)|0,o=o+Math.imul(A,ce)|0,n=(n=n+Math.imul(A,ue)|0)+Math.imul(O,ce)|0,i=i+Math.imul(O,ue)|0,o=o+Math.imul(_,de)|0,n=(n=n+Math.imul(_,pe)|0)+Math.imul(T,de)|0,i=i+Math.imul(T,pe)|0;var Ee=(u+(o=o+Math.imul(w,fe)|0)|0)+((8191&(n=(n=n+Math.imul(w,me)|0)+Math.imul($,fe)|0))<<13)|0;u=((i=i+Math.imul($,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,o=Math.imul(L,J),n=(n=Math.imul(L,ee))+Math.imul(j,J)|0,i=Math.imul(j,ee),o=o+Math.imul(B,re)|0,n=(n=n+Math.imul(B,oe)|0)+Math.imul(D,re)|0,i=i+Math.imul(D,oe)|0,o=o+Math.imul(C,ie)|0,n=(n=n+Math.imul(C,ae)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,ae)|0,o=o+Math.imul(S,ce)|0,n=(n=n+Math.imul(S,ue)|0)+Math.imul(R,ce)|0,i=i+Math.imul(R,ue)|0,o=o+Math.imul(A,de)|0,n=(n=n+Math.imul(A,pe)|0)+Math.imul(O,de)|0,i=i+Math.imul(O,pe)|0;var Se=(u+(o=o+Math.imul(_,fe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(T,fe)|0))<<13)|0;u=((i=i+Math.imul(T,me)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,o=Math.imul(L,re),n=(n=Math.imul(L,oe))+Math.imul(j,re)|0,i=Math.imul(j,oe),o=o+Math.imul(B,ie)|0,n=(n=n+Math.imul(B,ae)|0)+Math.imul(D,ie)|0,i=i+Math.imul(D,ae)|0,o=o+Math.imul(C,ce)|0,n=(n=n+Math.imul(C,ue)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,ue)|0,o=o+Math.imul(S,de)|0,n=(n=n+Math.imul(S,pe)|0)+Math.imul(R,de)|0,i=i+Math.imul(R,pe)|0;var Re=(u+(o=o+Math.imul(A,fe)|0)|0)+((8191&(n=(n=n+Math.imul(A,me)|0)+Math.imul(O,fe)|0))<<13)|0;u=((i=i+Math.imul(O,me)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,o=Math.imul(L,ie),n=(n=Math.imul(L,ae))+Math.imul(j,ie)|0,i=Math.imul(j,ae),o=o+Math.imul(B,ce)|0,n=(n=n+Math.imul(B,ue)|0)+Math.imul(D,ce)|0,i=i+Math.imul(D,ue)|0,o=o+Math.imul(C,de)|0,n=(n=n+Math.imul(C,pe)|0)+Math.imul(P,de)|0,i=i+Math.imul(P,pe)|0;var xe=(u+(o=o+Math.imul(S,fe)|0)|0)+((8191&(n=(n=n+Math.imul(S,me)|0)+Math.imul(R,fe)|0))<<13)|0;u=((i=i+Math.imul(R,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,o=Math.imul(L,ce),n=(n=Math.imul(L,ue))+Math.imul(j,ce)|0,i=Math.imul(j,ue),o=o+Math.imul(B,de)|0,n=(n=n+Math.imul(B,pe)|0)+Math.imul(D,de)|0,i=i+Math.imul(D,pe)|0;var Ce=(u+(o=o+Math.imul(C,fe)|0)|0)+((8191&(n=(n=n+Math.imul(C,me)|0)+Math.imul(P,fe)|0))<<13)|0;u=((i=i+Math.imul(P,me)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,o=Math.imul(L,de),n=(n=Math.imul(L,pe))+Math.imul(j,de)|0,i=Math.imul(j,pe);var Pe=(u+(o=o+Math.imul(B,fe)|0)|0)+((8191&(n=(n=n+Math.imul(B,me)|0)+Math.imul(D,fe)|0))<<13)|0;u=((i=i+Math.imul(D,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Ne=(u+(o=Math.imul(L,fe))|0)+((8191&(n=(n=Math.imul(L,me))+Math.imul(j,fe)|0))<<13)|0;return u=((i=Math.imul(j,me))+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=ye,c[1]=ge,c[2]=be,c[3]=ve,c[4]=we,c[5]=$e,c[6]=ke,c[7]=_e,c[8]=Te,c[9]=Ie,c[10]=Ae,c[11]=Oe,c[12]=Ee,c[13]=Se,c[14]=Re,c[15]=xe,c[16]=Ce,c[17]=Pe,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function f(e,t,r){return(new m).mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(h=p),n.prototype.mulTo=function(e,t){var r,o=this.length+e.length;return r=10===this.length&&10===e.length?h(this,e,t):o<63?p(this,e,t):o<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var o=0,n=0,i=0;i<r.length-1;i++){var a=n;n=0;for(var s=67108863&o,c=Math.min(i,t.length-1),u=Math.max(0,i-e.length+1);u<=c;u++){var l=i-u,d=(0|e.words[l])*(0|t.words[u]),p=67108863&d;s=67108863&(p=p+s|0),n+=(a=(a=a+(d/67108864|0)|0)+(p>>>26)|0)>>>26,a&=67108863}r.words[i]=s,o=a,a=n}return 0!==o?r.words[i]=o:r.length--,r.strip()}(this,e,t):f(this,e,t),r},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=n.prototype._countBits(e)-1,o=0;o<e;o++)t[o]=this.revBin(o,r,e);return t},m.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var o=0,n=0;n<t;n++)o|=(1&e)<<t-n-1,e>>=1;return o},m.prototype.permute=function(e,t,r,o,n,i){for(var a=0;a<i;a++)o[a]=t[e[a]],n[a]=r[e[a]]},m.prototype.transform=function(e,t,r,o,n,i){this.permute(i,e,t,r,o,n);for(var a=1;a<n;a<<=1)for(var s=a<<1,c=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),l=0;l<n;l+=s)for(var d=c,p=u,h=0;h<a;h++){var f=r[l+h],m=o[l+h],y=r[l+h+a],g=o[l+h+a],b=d*y-p*g;g=d*g+p*y,y=b,r[l+h]=f+y,o[l+h]=m+g,r[l+h+a]=f-y,o[l+h+a]=m-g,h!==s&&(b=c*d-u*p,p=c*p+u*d,d=b)}},m.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),o=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+o},m.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var o=0;o<r/2;o++){var n=e[o];e[o]=e[r-o-1],e[r-o-1]=n,n=t[o],t[o]=-t[r-o-1],t[r-o-1]=-n}},m.prototype.normalize13b=function(e,t){for(var r=0,o=0;o<t/2;o++){var n=8192*Math.round(e[2*o+1]/t)+Math.round(e[2*o]/t)+r;e[o]=67108863&n,r=n<67108864?0:n/67108864|0}return e},m.prototype.convert13b=function(e,t,o,n){for(var i=0,a=0;a<t;a++)i+=0|e[a],o[2*a]=8191&i,i>>>=13,o[2*a+1]=8191&i,i>>>=13;for(a=2*t;a<n;++a)o[a]=0;r(0===i),r(!(-8192&i))},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 o=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(o),i=this.stub(o),a=new Array(o),s=new Array(o),c=new Array(o),u=new Array(o),l=new Array(o),d=new Array(o),p=r.words;p.length=o,this.convert13b(e.words,e.length,a,o),this.convert13b(t.words,t.length,u,o),this.transform(a,i,s,c,o,n),this.transform(u,i,l,d,o,n);for(var h=0;h<o;h++){var f=s[h]*l[h]-c[h]*d[h];c[h]=s[h]*d[h]+c[h]*l[h],s[h]=f}return this.conjugate(s,c,o),this.transform(s,c,p,i,o,n),this.conjugate(p,i,o),this.normalize13b(p,o),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},n.prototype.mul=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},n.prototype.mulf=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),f(this,e,t)},n.prototype.imul=function(e){return this.clone().mulTo(e,this)},n.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,o=0;o<this.length;o++){var n=(0|this.words[o])*e,i=(67108863&n)+(67108863&t);t>>=26,t+=n/67108864|0,t+=i>>>26,this.words[o]=67108863&i}return 0!==t&&(this.words[o]=t,this.length++),this},n.prototype.muln=function(e){return this.clone().imuln(e)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var o=r/26|0,n=r%26;t[r]=(e.words[o]&1<<n)>>>n}return t}(e);if(0===t.length)return new n(1);for(var r=this,o=0;o<t.length&&0===t[o];o++,r=r.sqr());if(++o<t.length)for(var i=r.sqr();o<t.length;o++,i=i.sqr())0!==t[o]&&(r=r.mul(i));return r},n.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,o=e%26,n=(e-o)/26,i=67108863>>>26-o<<26-o;if(0!==o){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&i,c=(0|this.words[t])-s<<o;this.words[t]=c|a,a=s>>>26-o}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()},n.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},n.prototype.iushrn=function(e,t,o){var n;r("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var i=e%26,a=Math.min((e-i)/26,this.length),s=67108863^67108863>>>i<<i,c=o;if(n-=a,n=Math.max(0,n),c){for(var u=0;u<a;u++)c.words[u]=this.words[u];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var d=0|this.words[u];this.words[u]=l<<26-i|d>>>i,l=d&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(e,t,o){return r(0===this.negative),this.iushrn(e,t,o)},n.prototype.shln=function(e){return this.clone().ishln(e)},n.prototype.ushln=function(e){return this.clone().iushln(e)},n.prototype.shrn=function(e){return this.clone().ishrn(e)},n.prototype.ushrn=function(e){return this.clone().iushrn(e)},n.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26,n=1<<t;return!(this.length<=o)&&!!(this.words[o]&n)},n.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=o)return this;if(0!==t&&o++,this.length=Math.min(o,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(e){return this.clone().imaskn(e)},n.prototype.iaddn=function(e){return r("number"==typeof e),r(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)},n.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},n.prototype.isubn=function(e){if(r("number"==typeof e),r(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()},n.prototype.addn=function(e){return this.clone().iaddn(e)},n.prototype.subn=function(e){return this.clone().isubn(e)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(e,t,o){var n,i,a=e.length+o;this._expand(a);var s=0;for(n=0;n<e.length;n++){i=(0|this.words[n+o])+s;var c=(0|e.words[n])*t;s=((i-=67108863&c)>>26)-(c/67108864|0),this.words[n+o]=67108863&i}for(;n<this.length-o;n++)s=(i=(0|this.words[n+o])+s)>>26,this.words[n+o]=67108863&i;if(0===s)return this.strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(i=-(0|this.words[n])+s)>>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},n.prototype._wordDiv=function(e,t){var r=(this.length,e.length),o=this.clone(),i=e,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),o.iushln(r),a=0|i.words[i.length-1]);var s,c=o.length-i.length;if("mod"!==t){(s=new n(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=o.clone()._ishlnsubmul(i,1,c);0===l.negative&&(o=l,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var p=67108864*(0|o.words[i.length+d])+(0|o.words[i.length+d-1]);for(p=Math.min(p/a|0,67108863),o._ishlnsubmul(i,p,d);0!==o.negative;)p--,o.negative=0,o._ishlnsubmul(i,1,d),o.isZero()||(o.negative^=1);s&&(s.words[d]=p)}return s&&s.strip(),o.strip(),"div"!==t&&0!==r&&o.iushrn(r),{div:s||null,mod:o}},n.prototype.divmod=function(e,t,o){return r(!e.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new n(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new n(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new n(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},n.prototype.div=function(e){return this.divmod(e,"div",!1).div},n.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},n.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},n.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,o=e.ushrn(1),n=e.andln(1),i=r.cmp(o);return i<0||1===n&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},n.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,o=0,n=this.length-1;n>=0;n--)o=(t*o+(0|this.words[n]))%e;return o},n.prototype.idivn=function(e){r(e<=67108863);for(var t=0,o=this.length-1;o>=0;o--){var n=(0|this.words[o])+67108864*t;this.words[o]=n/e|0,t=n%e}return this.strip()},n.prototype.divn=function(e){return this.clone().idivn(e)},n.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new n(1),a=new n(0),s=new n(0),c=new n(1),u=0;t.isEven()&&o.isEven();)t.iushrn(1),o.iushrn(1),++u;for(var l=o.clone(),d=t.clone();!t.isZero();){for(var p=0,h=1;!(t.words[0]&h)&&p<26;++p,h<<=1);if(p>0)for(t.iushrn(p);p-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var f=0,m=1;!(o.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(o.iushrn(f);f-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(o)>=0?(t.isub(o),i.isub(s),a.isub(c)):(o.isub(t),s.isub(i),c.isub(a))}return{a:s,b:c,gcd:o.iushln(u)}},n.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new n(1),s=new n(0),c=o.clone();t.cmpn(1)>0&&o.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,p=1;!(o.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(o.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(o)>=0?(t.isub(o),a.isub(s)):(o.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},n.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 o=0;t.isEven()&&r.isEven();o++)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 i=t;t=r,r=i}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(o)},n.prototype.invm=function(e){return this.egcd(e).a.umod(e)},n.prototype.isEven=function(){return!(1&this.words[0])},n.prototype.isOdd=function(){return!(1&~this.words[0])},n.prototype.andln=function(e){return this.words[0]&e},n.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,o=(e-t)/26,n=1<<t;if(this.length<=o)return this._expand(o+1),this.words[o]|=n,this;for(var i=n,a=o;0!==i&&a<this.length;a++){var s=0|this.words[a];i=(s+=i)>>>26,s&=67108863,this.words[a]=s}return 0!==i&&(this.words[a]=i,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(e){var t,o=e<0;if(0!==this.negative&&!o)return-1;if(0===this.negative&&o)return 1;if(this.strip(),this.length>1)t=1;else{o&&(e=-e),r(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},n.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},n.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 o=0|this.words[r],n=0|e.words[r];if(o!==n){o<n?t=-1:o>n&&(t=1);break}}return t},n.prototype.gtn=function(e){return 1===this.cmpn(e)},n.prototype.gt=function(e){return 1===this.cmp(e)},n.prototype.gten=function(e){return this.cmpn(e)>=0},n.prototype.gte=function(e){return this.cmp(e)>=0},n.prototype.ltn=function(e){return-1===this.cmpn(e)},n.prototype.lt=function(e){return-1===this.cmp(e)},n.prototype.lten=function(e){return this.cmpn(e)<=0},n.prototype.lte=function(e){return this.cmp(e)<=0},n.prototype.eqn=function(e){return 0===this.cmpn(e)},n.prototype.eq=function(e){return 0===this.cmp(e)},n.red=function(e){return new k(e)},n.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(e){return this.red=e,this},n.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},n.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},n.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},n.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},n.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},n.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},n.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},n.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function g(e,t){this.name=e,this.p=new n(t,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function $(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(e){if("string"==typeof e){var t=n._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function _(e){k.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}g.prototype._tmp=function(){var e=new n(null);return e.words=new Array(Math.ceil(this.n/13)),e},g.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 o=t<this.n?-1:r.ucmp(this.p);return 0===o?(r.words[0]=0,r.length=1):o>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(e,t){e.iushrn(this.n,0,t)},g.prototype.imulK=function(e){return e.imul(this.k)},o(b,g),b.prototype.split=function(e,t){for(var r=4194303,o=Math.min(e.length,9),n=0;n<o;n++)t.words[n]=e.words[n];if(t.length=o,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=i&r,n=10;n<e.length;n++){var a=0|e.words[n];e.words[n-10]=(a&r)<<4|i>>>22,i=a}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},b.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 o=0|e.words[r];t+=977*o,e.words[r]=67108863&t,t=64*o+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},o(v,g),o(w,g),o($,g),$.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var o=19*(0|e.words[r])+t,n=67108863&o;o>>>=26,e.words[r]=n,t=o}return 0!==t&&(e.words[e.length++]=t),e},n._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new $}return y[e]=t,t},k.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},k.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},k.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},k.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},k.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},k.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},k.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},k.prototype.isqr=function(e){return this.imul(e,e.clone())},k.prototype.sqr=function(e){return this.mul(e,e)},k.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var o=this.m.add(new n(1)).iushrn(2);return this.pow(e,o)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new n(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),p=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),f=a;0!==h.cmp(s);){for(var m=h,y=0;0!==m.cmp(s);y++)m=m.redSqr();r(y<f);var g=this.pow(d,new n(1).iushln(f-y-1));p=p.redMul(g),d=g.redSqr(),h=h.redMul(d),f=y}return p},k.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},k.prototype.pow=function(e,t){if(t.isZero())return new n(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=e;for(var o=2;o<r.length;o++)r[o]=this.mul(r[o-1],e);var i=r[0],a=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),o=t.length-1;o>=0;o--){for(var u=t.words[o],l=c-1;l>=0;l--){var d=u>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4===++s||0===o&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}c=26}return i},k.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},k.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},n.mont=function(e){return new _(e)},o(_,k),_.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},_.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},_.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(o).iushrn(this.shift),i=n;return n.cmp(this.m)>=0?i=n.isub(this.m):n.cmpn(0)<0&&(i=n.iadd(this.m)),i._forceRed(this)},_.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new n(0)._forceRed(this);var r=e.mul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(o).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},_.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,commonjsGlobal)}(bn$1)),bn$1.exports}function requireBrowser$2(){if(hasRequiredBrowser$2)return browser$4;hasRequiredBrowser$2=1;var e=requireElliptic(),t=requireBn$1();browser$4=function(e){return new o(e)};var r={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 o(t){this.curveType=r[t],this.curveType||(this.curveType={name:t}),this.curve=new e.ec(this.curveType.name),this.keys=void 0}function n(e,t,r){Array.isArray(e)||(e=e.toArray());var o=new Buffer(e);if(r&&o.length<r){var n=new Buffer(r-o.length);n.fill(0),o=Buffer.concat([n,o])}return t?o.toString(t):o}return r.p224=r.secp224r1,r.p256=r.secp256r1=r.prime256v1,r.p192=r.secp192r1=r.prime192v1,r.p384=r.secp384r1,r.p521=r.secp521r1,o.prototype.generateKeys=function(e,t){return this.keys=this.curve.genKeyPair(),this.getPublicKey(e,t)},o.prototype.computeSecret=function(e,t,r){return t=t||"utf8",Buffer.isBuffer(e)||(e=new Buffer(e,t)),n(this.curve.keyFromPublic(e).getPublic().mul(this.keys.getPrivate()).getX(),r,this.curveType.byteLength)},o.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),n(r,e)},o.prototype.getPrivateKey=function(e){return n(this.keys.getPrivate(),e)},o.prototype.setPublicKey=function(e,t){return t=t||"utf8",Buffer.isBuffer(e)||(e=new Buffer(e,t)),this.keys._importPublic(e),this},o.prototype.setPrivateKey=function(e,r){r=r||"utf8",Buffer.isBuffer(e)||(e=new Buffer(e,r));var o=new t(e);return o=o.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(o),this},browser$4}bn$1.exports;var browser$3={},mgf,hasRequiredMgf,xor,hasRequiredXor;function requireMgf(){if(hasRequiredMgf)return mgf;hasRequiredMgf=1;var e=requireBrowser$9(),t=requireSafeBuffer$1().Buffer;function r(e){var r=t.allocUnsafe(4);return r.writeUInt32BE(e,0),r}return mgf=function(o,n){for(var i,a=t.alloc(0),s=0;a.length<n;)i=r(s++),a=t.concat([a,e("sha1").update(o).update(i).digest()]);return a.slice(0,n)}}function requireXor(){return hasRequiredXor?xor:(hasRequiredXor=1,xor=function(e,t){for(var r=e.length,o=-1;++o<r;)e[o]^=t[o];return e})}var bn={exports:{}},hasRequiredBn,withPublic_1,hasRequiredWithPublic,publicEncrypt,hasRequiredPublicEncrypt,privateDecrypt,hasRequiredPrivateDecrypt,hasRequiredBrowser$1;function requireBn(){return hasRequiredBn||(hasRequiredBn=1,function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function o(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function n(e,t,r){if(n.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 i;"object"==typeof e?e.exports=n:t.BN=n,n.BN=n,n.wordSize=26;try{i="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require$$0$2.Buffer}catch(T){}function a(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(e,t,r){var o=a(e,r);return r-1>=t&&(o|=a(e,r-1)<<4),o}function c(e,t,r,o){for(var n=0,i=Math.min(e.length,r),a=t;a<i;a++){var s=e.charCodeAt(a)-48;n*=o,n+=s>=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(e){return e instanceof n||null!==e&&"object"==typeof e&&e.constructor.wordSize===n.wordSize&&Array.isArray(e.words)},n.max=function(e,t){return e.cmp(t)>0?e:t},n.min=function(e,t){return e.cmp(t)<0?e:t},n.prototype._init=function(e,t,o){if("number"==typeof e)return this._initNumber(e,t,o);if("object"==typeof e)return this._initArray(e,t,o);"hex"===t&&(t=16),r(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,o):(this._parseBase(e,t,n),"le"===o&&this._initArray(this.toArray(),t,o)))},n.prototype._initNumber=function(e,t,o){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):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===o&&this._initArray(this.toArray(),t,o)},n.prototype._initArray=function(e,t,o){if(r("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 i,a,s=0;if("be"===o)for(n=e.length-1,i=0;n>=0;n-=3)a=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===o)for(n=0,i=0;n<e.length;n+=3)a=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this.strip()},n.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var n,i=0,a=0;if("be"===r)for(o=e.length-1;o>=t;o-=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;else for(o=(e.length-t)%2==0?t+1:t;o<e.length;o+=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;this.strip()},n.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var o=0,n=1;n<=67108863;n*=t)o++;o--,n=n/t|0;for(var i=e.length-r,a=i%o,s=Math.min(i,i-a)+r,u=0,l=r;l<s;l+=o)u=c(e,l,l+o,t),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var d=1;for(u=c(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.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},n.prototype.clone=function(){var e=new n(null);return this.copy(e),e},n.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","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"],l=[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],d=[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 p(e,t,r){r.negative=t.negative^e.negative;var o=e.length+t.length|0;r.length=o,o=o-1|0;var n=0|e.words[0],i=0|t.words[0],a=n*i,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u<o;u++){for(var l=c>>>26,d=67108863&c,p=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=p;h++){var f=u-h|0;l+=(a=(n=0|e.words[f])*(i=0|t.words[h])+d)/67108864|0,d=67108863&a}r.words[u]=0|d,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}n.prototype.toString=function(e,t){var o;if(t=0|t||1,16===(e=e||10)||"hex"===e){o="";for(var n=0,i=0,a=0;a<this.length;a++){var s=this.words[a],c=(16777215&(s<<n|i)).toString(16);i=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),o=0!==i||a!==this.length-1?u[6-c.length]+c+o:c+o}for(0!==i&&(o=i.toString(16)+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}if(e===(0|e)&&e>=2&&e<=36){var p=l[e],h=d[e];o="";var f=this.clone();for(f.negative=0;!f.isZero();){var m=f.modn(h).toString(e);o=(f=f.idivn(h)).isZero()?m+o:u[p-m.length]+m+o}for(this.isZero()&&(o="0"+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}r(!1,"Base should be between 2 and 36")},n.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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(e,t){return r(void 0!==i),this.toArrayLike(i,e,t)},n.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},n.prototype.toArrayLike=function(e,t,o){var n=this.byteLength(),i=o||Math.max(1,n);r(n<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===t,u=new e(i),l=this.clone();if(c){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[s]=a;for(;s<i;s++)u[s]=0}else{for(s=0;s<i-n;s++)u[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[i-s-1]=a}return u},Math.clz32?n.prototype._countBits=function(e){return 32-Math.clz32(e)}:n.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},n.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},n.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},n.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},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},n.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(e){return r(!(this.negative|e.negative)),this.iuor(e)},n.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},n.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},n.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()},n.prototype.iand=function(e){return r(!(this.negative|e.negative)),this.iuand(e)},n.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},n.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},n.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var o=0;o<r.length;o++)this.words[o]=t.words[o]^r.words[o];if(this!==t)for(;o<t.length;o++)this.words[o]=t.words[o];return this.length=t.length,this.strip()},n.prototype.ixor=function(e){return r(!(this.negative|e.negative)),this.iuxor(e)},n.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},n.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},n.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),o=e%26;this._expand(t),o>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return o>0&&(this.words[n]=~this.words[n]&67108863>>26-o),this.strip()},n.prototype.notn=function(e){return this.clone().inotn(e)},n.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var o=e/26|0,n=e%26;return this._expand(o+1),this.words[o]=t?this.words[o]|1<<n:this.words[o]&~(1<<n),this.strip()},n.prototype.iadd=function(e){var t,r,o;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,o=e):(r=e,o=this);for(var n=0,i=0;i<o.length;i++)t=(0|r.words[i])+(0|o.words[i])+n,this.words[i]=67108863&t,n=t>>>26;for(;0!==n&&i<r.length;i++)t=(0|r.words[i])+n,this.words[i]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;i<r.length;i++)this.words[i]=r.words[i];return this},n.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)},n.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,o,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,o=e):(r=e,o=this);for(var i=0,a=0;a<o.length;a++)i=(t=(0|r.words[a])-(0|o.words[a])+i)>>26,this.words[a]=67108863&t;for(;0!==i&&a<r.length;a++)i=(t=(0|r.words[a])+i)>>26,this.words[a]=67108863&t;if(0===i&&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()},n.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,r){var o,n,i,a=e.words,s=t.words,c=r.words,u=0,l=0|a[0],d=8191&l,p=l>>>13,h=0|a[1],f=8191&h,m=h>>>13,y=0|a[2],g=8191&y,b=y>>>13,v=0|a[3],w=8191&v,$=v>>>13,k=0|a[4],_=8191&k,T=k>>>13,I=0|a[5],A=8191&I,O=I>>>13,E=0|a[6],S=8191&E,R=E>>>13,x=0|a[7],C=8191&x,P=x>>>13,N=0|a[8],B=8191&N,D=N>>>13,M=0|a[9],L=8191&M,j=M>>>13,F=0|s[0],U=8191&F,K=F>>>13,q=0|s[1],G=8191&q,H=q>>>13,V=0|s[2],W=8191&V,z=V>>>13,Z=0|s[3],Q=8191&Z,Y=Z>>>13,X=0|s[4],J=8191&X,ee=X>>>13,te=0|s[5],re=8191&te,oe=te>>>13,ne=0|s[6],ie=8191&ne,ae=ne>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],de=8191&le,pe=le>>>13,he=0|s[9],fe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(u+(o=Math.imul(d,U))|0)+((8191&(n=(n=Math.imul(d,K))+Math.imul(p,U)|0))<<13)|0;u=((i=Math.imul(p,K))+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,o=Math.imul(f,U),n=(n=Math.imul(f,K))+Math.imul(m,U)|0,i=Math.imul(m,K);var ge=(u+(o=o+Math.imul(d,G)|0)|0)+((8191&(n=(n=n+Math.imul(d,H)|0)+Math.imul(p,G)|0))<<13)|0;u=((i=i+Math.imul(p,H)|0)+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,o=Math.imul(g,U),n=(n=Math.imul(g,K))+Math.imul(b,U)|0,i=Math.imul(b,K),o=o+Math.imul(f,G)|0,n=(n=n+Math.imul(f,H)|0)+Math.imul(m,G)|0,i=i+Math.imul(m,H)|0;var be=(u+(o=o+Math.imul(d,W)|0)|0)+((8191&(n=(n=n+Math.imul(d,z)|0)+Math.imul(p,W)|0))<<13)|0;u=((i=i+Math.imul(p,z)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,o=Math.imul(w,U),n=(n=Math.imul(w,K))+Math.imul($,U)|0,i=Math.imul($,K),o=o+Math.imul(g,G)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(b,G)|0,i=i+Math.imul(b,H)|0,o=o+Math.imul(f,W)|0,n=(n=n+Math.imul(f,z)|0)+Math.imul(m,W)|0,i=i+Math.imul(m,z)|0;var ve=(u+(o=o+Math.imul(d,Q)|0)|0)+((8191&(n=(n=n+Math.imul(d,Y)|0)+Math.imul(p,Q)|0))<<13)|0;u=((i=i+Math.imul(p,Y)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,o=Math.imul(_,U),n=(n=Math.imul(_,K))+Math.imul(T,U)|0,i=Math.imul(T,K),o=o+Math.imul(w,G)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul($,G)|0,i=i+Math.imul($,H)|0,o=o+Math.imul(g,W)|0,n=(n=n+Math.imul(g,z)|0)+Math.imul(b,W)|0,i=i+Math.imul(b,z)|0,o=o+Math.imul(f,Q)|0,n=(n=n+Math.imul(f,Y)|0)+Math.imul(m,Q)|0,i=i+Math.imul(m,Y)|0;var we=(u+(o=o+Math.imul(d,J)|0)|0)+((8191&(n=(n=n+Math.imul(d,ee)|0)+Math.imul(p,J)|0))<<13)|0;u=((i=i+Math.imul(p,ee)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,o=Math.imul(A,U),n=(n=Math.imul(A,K))+Math.imul(O,U)|0,i=Math.imul(O,K),o=o+Math.imul(_,G)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(T,G)|0,i=i+Math.imul(T,H)|0,o=o+Math.imul(w,W)|0,n=(n=n+Math.imul(w,z)|0)+Math.imul($,W)|0,i=i+Math.imul($,z)|0,o=o+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(b,Q)|0,i=i+Math.imul(b,Y)|0,o=o+Math.imul(f,J)|0,n=(n=n+Math.imul(f,ee)|0)+Math.imul(m,J)|0,i=i+Math.imul(m,ee)|0;var $e=(u+(o=o+Math.imul(d,re)|0)|0)+((8191&(n=(n=n+Math.imul(d,oe)|0)+Math.imul(p,re)|0))<<13)|0;u=((i=i+Math.imul(p,oe)|0)+(n>>>13)|0)+($e>>>26)|0,$e&=67108863,o=Math.imul(S,U),n=(n=Math.imul(S,K))+Math.imul(R,U)|0,i=Math.imul(R,K),o=o+Math.imul(A,G)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(O,G)|0,i=i+Math.imul(O,H)|0,o=o+Math.imul(_,W)|0,n=(n=n+Math.imul(_,z)|0)+Math.imul(T,W)|0,i=i+Math.imul(T,z)|0,o=o+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul($,Q)|0,i=i+Math.imul($,Y)|0,o=o+Math.imul(g,J)|0,n=(n=n+Math.imul(g,ee)|0)+Math.imul(b,J)|0,i=i+Math.imul(b,ee)|0,o=o+Math.imul(f,re)|0,n=(n=n+Math.imul(f,oe)|0)+Math.imul(m,re)|0,i=i+Math.imul(m,oe)|0;var ke=(u+(o=o+Math.imul(d,ie)|0)|0)+((8191&(n=(n=n+Math.imul(d,ae)|0)+Math.imul(p,ie)|0))<<13)|0;u=((i=i+Math.imul(p,ae)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,o=Math.imul(C,U),n=(n=Math.imul(C,K))+Math.imul(P,U)|0,i=Math.imul(P,K),o=o+Math.imul(S,G)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,G)|0,i=i+Math.imul(R,H)|0,o=o+Math.imul(A,W)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(O,W)|0,i=i+Math.imul(O,z)|0,o=o+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(T,Q)|0,i=i+Math.imul(T,Y)|0,o=o+Math.imul(w,J)|0,n=(n=n+Math.imul(w,ee)|0)+Math.imul($,J)|0,i=i+Math.imul($,ee)|0,o=o+Math.imul(g,re)|0,n=(n=n+Math.imul(g,oe)|0)+Math.imul(b,re)|0,i=i+Math.imul(b,oe)|0,o=o+Math.imul(f,ie)|0,n=(n=n+Math.imul(f,ae)|0)+Math.imul(m,ie)|0,i=i+Math.imul(m,ae)|0;var _e=(u+(o=o+Math.imul(d,ce)|0)|0)+((8191&(n=(n=n+Math.imul(d,ue)|0)+Math.imul(p,ce)|0))<<13)|0;u=((i=i+Math.imul(p,ue)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,o=Math.imul(B,U),n=(n=Math.imul(B,K))+Math.imul(D,U)|0,i=Math.imul(D,K),o=o+Math.imul(C,G)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(P,G)|0,i=i+Math.imul(P,H)|0,o=o+Math.imul(S,W)|0,n=(n=n+Math.imul(S,z)|0)+Math.imul(R,W)|0,i=i+Math.imul(R,z)|0,o=o+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,Q)|0,i=i+Math.imul(O,Y)|0,o=o+Math.imul(_,J)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(T,J)|0,i=i+Math.imul(T,ee)|0,o=o+Math.imul(w,re)|0,n=(n=n+Math.imul(w,oe)|0)+Math.imul($,re)|0,i=i+Math.imul($,oe)|0,o=o+Math.imul(g,ie)|0,n=(n=n+Math.imul(g,ae)|0)+Math.imul(b,ie)|0,i=i+Math.imul(b,ae)|0,o=o+Math.imul(f,ce)|0,n=(n=n+Math.imul(f,ue)|0)+Math.imul(m,ce)|0,i=i+Math.imul(m,ue)|0;var Te=(u+(o=o+Math.imul(d,de)|0)|0)+((8191&(n=(n=n+Math.imul(d,pe)|0)+Math.imul(p,de)|0))<<13)|0;u=((i=i+Math.imul(p,pe)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,o=Math.imul(L,U),n=(n=Math.imul(L,K))+Math.imul(j,U)|0,i=Math.imul(j,K),o=o+Math.imul(B,G)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(D,G)|0,i=i+Math.imul(D,H)|0,o=o+Math.imul(C,W)|0,n=(n=n+Math.imul(C,z)|0)+Math.imul(P,W)|0,i=i+Math.imul(P,z)|0,o=o+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(R,Q)|0,i=i+Math.imul(R,Y)|0,o=o+Math.imul(A,J)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(O,J)|0,i=i+Math.imul(O,ee)|0,o=o+Math.imul(_,re)|0,n=(n=n+Math.imul(_,oe)|0)+Math.imul(T,re)|0,i=i+Math.imul(T,oe)|0,o=o+Math.imul(w,ie)|0,n=(n=n+Math.imul(w,ae)|0)+Math.imul($,ie)|0,i=i+Math.imul($,ae)|0,o=o+Math.imul(g,ce)|0,n=(n=n+Math.imul(g,ue)|0)+Math.imul(b,ce)|0,i=i+Math.imul(b,ue)|0,o=o+Math.imul(f,de)|0,n=(n=n+Math.imul(f,pe)|0)+Math.imul(m,de)|0,i=i+Math.imul(m,pe)|0;var Ie=(u+(o=o+Math.imul(d,fe)|0)|0)+((8191&(n=(n=n+Math.imul(d,me)|0)+Math.imul(p,fe)|0))<<13)|0;u=((i=i+Math.imul(p,me)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,o=Math.imul(L,G),n=(n=Math.imul(L,H))+Math.imul(j,G)|0,i=Math.imul(j,H),o=o+Math.imul(B,W)|0,n=(n=n+Math.imul(B,z)|0)+Math.imul(D,W)|0,i=i+Math.imul(D,z)|0,o=o+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,Y)|0,o=o+Math.imul(S,J)|0,n=(n=n+Math.imul(S,ee)|0)+Math.imul(R,J)|0,i=i+Math.imul(R,ee)|0,o=o+Math.imul(A,re)|0,n=(n=n+Math.imul(A,oe)|0)+Math.imul(O,re)|0,i=i+Math.imul(O,oe)|0,o=o+Math.imul(_,ie)|0,n=(n=n+Math.imul(_,ae)|0)+Math.imul(T,ie)|0,i=i+Math.imul(T,ae)|0,o=o+Math.imul(w,ce)|0,n=(n=n+Math.imul(w,ue)|0)+Math.imul($,ce)|0,i=i+Math.imul($,ue)|0,o=o+Math.imul(g,de)|0,n=(n=n+Math.imul(g,pe)|0)+Math.imul(b,de)|0,i=i+Math.imul(b,pe)|0;var Ae=(u+(o=o+Math.imul(f,fe)|0)|0)+((8191&(n=(n=n+Math.imul(f,me)|0)+Math.imul(m,fe)|0))<<13)|0;u=((i=i+Math.imul(m,me)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,o=Math.imul(L,W),n=(n=Math.imul(L,z))+Math.imul(j,W)|0,i=Math.imul(j,z),o=o+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(D,Q)|0,i=i+Math.imul(D,Y)|0,o=o+Math.imul(C,J)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(P,J)|0,i=i+Math.imul(P,ee)|0,o=o+Math.imul(S,re)|0,n=(n=n+Math.imul(S,oe)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,oe)|0,o=o+Math.imul(A,ie)|0,n=(n=n+Math.imul(A,ae)|0)+Math.imul(O,ie)|0,i=i+Math.imul(O,ae)|0,o=o+Math.imul(_,ce)|0,n=(n=n+Math.imul(_,ue)|0)+Math.imul(T,ce)|0,i=i+Math.imul(T,ue)|0,o=o+Math.imul(w,de)|0,n=(n=n+Math.imul(w,pe)|0)+Math.imul($,de)|0,i=i+Math.imul($,pe)|0;var Oe=(u+(o=o+Math.imul(g,fe)|0)|0)+((8191&(n=(n=n+Math.imul(g,me)|0)+Math.imul(b,fe)|0))<<13)|0;u=((i=i+Math.imul(b,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,o=Math.imul(L,Q),n=(n=Math.imul(L,Y))+Math.imul(j,Q)|0,i=Math.imul(j,Y),o=o+Math.imul(B,J)|0,n=(n=n+Math.imul(B,ee)|0)+Math.imul(D,J)|0,i=i+Math.imul(D,ee)|0,o=o+Math.imul(C,re)|0,n=(n=n+Math.imul(C,oe)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,oe)|0,o=o+Math.imul(S,ie)|0,n=(n=n+Math.imul(S,ae)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,ae)|0,o=o+Math.imul(A,ce)|0,n=(n=n+Math.imul(A,ue)|0)+Math.imul(O,ce)|0,i=i+Math.imul(O,ue)|0,o=o+Math.imul(_,de)|0,n=(n=n+Math.imul(_,pe)|0)+Math.imul(T,de)|0,i=i+Math.imul(T,pe)|0;var Ee=(u+(o=o+Math.imul(w,fe)|0)|0)+((8191&(n=(n=n+Math.imul(w,me)|0)+Math.imul($,fe)|0))<<13)|0;u=((i=i+Math.imul($,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,o=Math.imul(L,J),n=(n=Math.imul(L,ee))+Math.imul(j,J)|0,i=Math.imul(j,ee),o=o+Math.imul(B,re)|0,n=(n=n+Math.imul(B,oe)|0)+Math.imul(D,re)|0,i=i+Math.imul(D,oe)|0,o=o+Math.imul(C,ie)|0,n=(n=n+Math.imul(C,ae)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,ae)|0,o=o+Math.imul(S,ce)|0,n=(n=n+Math.imul(S,ue)|0)+Math.imul(R,ce)|0,i=i+Math.imul(R,ue)|0,o=o+Math.imul(A,de)|0,n=(n=n+Math.imul(A,pe)|0)+Math.imul(O,de)|0,i=i+Math.imul(O,pe)|0;var Se=(u+(o=o+Math.imul(_,fe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(T,fe)|0))<<13)|0;u=((i=i+Math.imul(T,me)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,o=Math.imul(L,re),n=(n=Math.imul(L,oe))+Math.imul(j,re)|0,i=Math.imul(j,oe),o=o+Math.imul(B,ie)|0,n=(n=n+Math.imul(B,ae)|0)+Math.imul(D,ie)|0,i=i+Math.imul(D,ae)|0,o=o+Math.imul(C,ce)|0,n=(n=n+Math.imul(C,ue)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,ue)|0,o=o+Math.imul(S,de)|0,n=(n=n+Math.imul(S,pe)|0)+Math.imul(R,de)|0,i=i+Math.imul(R,pe)|0;var Re=(u+(o=o+Math.imul(A,fe)|0)|0)+((8191&(n=(n=n+Math.imul(A,me)|0)+Math.imul(O,fe)|0))<<13)|0;u=((i=i+Math.imul(O,me)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,o=Math.imul(L,ie),n=(n=Math.imul(L,ae))+Math.imul(j,ie)|0,i=Math.imul(j,ae),o=o+Math.imul(B,ce)|0,n=(n=n+Math.imul(B,ue)|0)+Math.imul(D,ce)|0,i=i+Math.imul(D,ue)|0,o=o+Math.imul(C,de)|0,n=(n=n+Math.imul(C,pe)|0)+Math.imul(P,de)|0,i=i+Math.imul(P,pe)|0;var xe=(u+(o=o+Math.imul(S,fe)|0)|0)+((8191&(n=(n=n+Math.imul(S,me)|0)+Math.imul(R,fe)|0))<<13)|0;u=((i=i+Math.imul(R,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,o=Math.imul(L,ce),n=(n=Math.imul(L,ue))+Math.imul(j,ce)|0,i=Math.imul(j,ue),o=o+Math.imul(B,de)|0,n=(n=n+Math.imul(B,pe)|0)+Math.imul(D,de)|0,i=i+Math.imul(D,pe)|0;var Ce=(u+(o=o+Math.imul(C,fe)|0)|0)+((8191&(n=(n=n+Math.imul(C,me)|0)+Math.imul(P,fe)|0))<<13)|0;u=((i=i+Math.imul(P,me)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,o=Math.imul(L,de),n=(n=Math.imul(L,pe))+Math.imul(j,de)|0,i=Math.imul(j,pe);var Pe=(u+(o=o+Math.imul(B,fe)|0)|0)+((8191&(n=(n=n+Math.imul(B,me)|0)+Math.imul(D,fe)|0))<<13)|0;u=((i=i+Math.imul(D,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Ne=(u+(o=Math.imul(L,fe))|0)+((8191&(n=(n=Math.imul(L,me))+Math.imul(j,fe)|0))<<13)|0;return u=((i=Math.imul(j,me))+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=ye,c[1]=ge,c[2]=be,c[3]=ve,c[4]=we,c[5]=$e,c[6]=ke,c[7]=_e,c[8]=Te,c[9]=Ie,c[10]=Ae,c[11]=Oe,c[12]=Ee,c[13]=Se,c[14]=Re,c[15]=xe,c[16]=Ce,c[17]=Pe,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function f(e,t,r){return(new m).mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(h=p),n.prototype.mulTo=function(e,t){var r,o=this.length+e.length;return r=10===this.length&&10===e.length?h(this,e,t):o<63?p(this,e,t):o<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var o=0,n=0,i=0;i<r.length-1;i++){var a=n;n=0;for(var s=67108863&o,c=Math.min(i,t.length-1),u=Math.max(0,i-e.length+1);u<=c;u++){var l=i-u,d=(0|e.words[l])*(0|t.words[u]),p=67108863&d;s=67108863&(p=p+s|0),n+=(a=(a=a+(d/67108864|0)|0)+(p>>>26)|0)>>>26,a&=67108863}r.words[i]=s,o=a,a=n}return 0!==o?r.words[i]=o:r.length--,r.strip()}(this,e,t):f(this,e,t),r},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=n.prototype._countBits(e)-1,o=0;o<e;o++)t[o]=this.revBin(o,r,e);return t},m.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var o=0,n=0;n<t;n++)o|=(1&e)<<t-n-1,e>>=1;return o},m.prototype.permute=function(e,t,r,o,n,i){for(var a=0;a<i;a++)o[a]=t[e[a]],n[a]=r[e[a]]},m.prototype.transform=function(e,t,r,o,n,i){this.permute(i,e,t,r,o,n);for(var a=1;a<n;a<<=1)for(var s=a<<1,c=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),l=0;l<n;l+=s)for(var d=c,p=u,h=0;h<a;h++){var f=r[l+h],m=o[l+h],y=r[l+h+a],g=o[l+h+a],b=d*y-p*g;g=d*g+p*y,y=b,r[l+h]=f+y,o[l+h]=m+g,r[l+h+a]=f-y,o[l+h+a]=m-g,h!==s&&(b=c*d-u*p,p=c*p+u*d,d=b)}},m.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),o=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+o},m.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var o=0;o<r/2;o++){var n=e[o];e[o]=e[r-o-1],e[r-o-1]=n,n=t[o],t[o]=-t[r-o-1],t[r-o-1]=-n}},m.prototype.normalize13b=function(e,t){for(var r=0,o=0;o<t/2;o++){var n=8192*Math.round(e[2*o+1]/t)+Math.round(e[2*o]/t)+r;e[o]=67108863&n,r=n<67108864?0:n/67108864|0}return e},m.prototype.convert13b=function(e,t,o,n){for(var i=0,a=0;a<t;a++)i+=0|e[a],o[2*a]=8191&i,i>>>=13,o[2*a+1]=8191&i,i>>>=13;for(a=2*t;a<n;++a)o[a]=0;r(0===i),r(!(-8192&i))},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 o=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(o),i=this.stub(o),a=new Array(o),s=new Array(o),c=new Array(o),u=new Array(o),l=new Array(o),d=new Array(o),p=r.words;p.length=o,this.convert13b(e.words,e.length,a,o),this.convert13b(t.words,t.length,u,o),this.transform(a,i,s,c,o,n),this.transform(u,i,l,d,o,n);for(var h=0;h<o;h++){var f=s[h]*l[h]-c[h]*d[h];c[h]=s[h]*d[h]+c[h]*l[h],s[h]=f}return this.conjugate(s,c,o),this.transform(s,c,p,i,o,n),this.conjugate(p,i,o),this.normalize13b(p,o),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},n.prototype.mul=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},n.prototype.mulf=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),f(this,e,t)},n.prototype.imul=function(e){return this.clone().mulTo(e,this)},n.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,o=0;o<this.length;o++){var n=(0|this.words[o])*e,i=(67108863&n)+(67108863&t);t>>=26,t+=n/67108864|0,t+=i>>>26,this.words[o]=67108863&i}return 0!==t&&(this.words[o]=t,this.length++),this},n.prototype.muln=function(e){return this.clone().imuln(e)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var o=r/26|0,n=r%26;t[r]=(e.words[o]&1<<n)>>>n}return t}(e);if(0===t.length)return new n(1);for(var r=this,o=0;o<t.length&&0===t[o];o++,r=r.sqr());if(++o<t.length)for(var i=r.sqr();o<t.length;o++,i=i.sqr())0!==t[o]&&(r=r.mul(i));return r},n.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,o=e%26,n=(e-o)/26,i=67108863>>>26-o<<26-o;if(0!==o){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&i,c=(0|this.words[t])-s<<o;this.words[t]=c|a,a=s>>>26-o}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()},n.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},n.prototype.iushrn=function(e,t,o){var n;r("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var i=e%26,a=Math.min((e-i)/26,this.length),s=67108863^67108863>>>i<<i,c=o;if(n-=a,n=Math.max(0,n),c){for(var u=0;u<a;u++)c.words[u]=this.words[u];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var d=0|this.words[u];this.words[u]=l<<26-i|d>>>i,l=d&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(e,t,o){return r(0===this.negative),this.iushrn(e,t,o)},n.prototype.shln=function(e){return this.clone().ishln(e)},n.prototype.ushln=function(e){return this.clone().iushln(e)},n.prototype.shrn=function(e){return this.clone().ishrn(e)},n.prototype.ushrn=function(e){return this.clone().iushrn(e)},n.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26,n=1<<t;return!(this.length<=o)&&!!(this.words[o]&n)},n.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=o)return this;if(0!==t&&o++,this.length=Math.min(o,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(e){return this.clone().imaskn(e)},n.prototype.iaddn=function(e){return r("number"==typeof e),r(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)},n.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},n.prototype.isubn=function(e){if(r("number"==typeof e),r(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()},n.prototype.addn=function(e){return this.clone().iaddn(e)},n.prototype.subn=function(e){return this.clone().isubn(e)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(e,t,o){var n,i,a=e.length+o;this._expand(a);var s=0;for(n=0;n<e.length;n++){i=(0|this.words[n+o])+s;var c=(0|e.words[n])*t;s=((i-=67108863&c)>>26)-(c/67108864|0),this.words[n+o]=67108863&i}for(;n<this.length-o;n++)s=(i=(0|this.words[n+o])+s)>>26,this.words[n+o]=67108863&i;if(0===s)return this.strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(i=-(0|this.words[n])+s)>>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},n.prototype._wordDiv=function(e,t){var r=(this.length,e.length),o=this.clone(),i=e,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),o.iushln(r),a=0|i.words[i.length-1]);var s,c=o.length-i.length;if("mod"!==t){(s=new n(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=o.clone()._ishlnsubmul(i,1,c);0===l.negative&&(o=l,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var p=67108864*(0|o.words[i.length+d])+(0|o.words[i.length+d-1]);for(p=Math.min(p/a|0,67108863),o._ishlnsubmul(i,p,d);0!==o.negative;)p--,o.negative=0,o._ishlnsubmul(i,1,d),o.isZero()||(o.negative^=1);s&&(s.words[d]=p)}return s&&s.strip(),o.strip(),"div"!==t&&0!==r&&o.iushrn(r),{div:s||null,mod:o}},n.prototype.divmod=function(e,t,o){return r(!e.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new n(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new n(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new n(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},n.prototype.div=function(e){return this.divmod(e,"div",!1).div},n.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},n.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},n.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,o=e.ushrn(1),n=e.andln(1),i=r.cmp(o);return i<0||1===n&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},n.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,o=0,n=this.length-1;n>=0;n--)o=(t*o+(0|this.words[n]))%e;return o},n.prototype.idivn=function(e){r(e<=67108863);for(var t=0,o=this.length-1;o>=0;o--){var n=(0|this.words[o])+67108864*t;this.words[o]=n/e|0,t=n%e}return this.strip()},n.prototype.divn=function(e){return this.clone().idivn(e)},n.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new n(1),a=new n(0),s=new n(0),c=new n(1),u=0;t.isEven()&&o.isEven();)t.iushrn(1),o.iushrn(1),++u;for(var l=o.clone(),d=t.clone();!t.isZero();){for(var p=0,h=1;!(t.words[0]&h)&&p<26;++p,h<<=1);if(p>0)for(t.iushrn(p);p-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var f=0,m=1;!(o.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(o.iushrn(f);f-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(o)>=0?(t.isub(o),i.isub(s),a.isub(c)):(o.isub(t),s.isub(i),c.isub(a))}return{a:s,b:c,gcd:o.iushln(u)}},n.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new n(1),s=new n(0),c=o.clone();t.cmpn(1)>0&&o.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,p=1;!(o.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(o.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(o)>=0?(t.isub(o),a.isub(s)):(o.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},n.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 o=0;t.isEven()&&r.isEven();o++)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 i=t;t=r,r=i}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(o)},n.prototype.invm=function(e){return this.egcd(e).a.umod(e)},n.prototype.isEven=function(){return!(1&this.words[0])},n.prototype.isOdd=function(){return!(1&~this.words[0])},n.prototype.andln=function(e){return this.words[0]&e},n.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,o=(e-t)/26,n=1<<t;if(this.length<=o)return this._expand(o+1),this.words[o]|=n,this;for(var i=n,a=o;0!==i&&a<this.length;a++){var s=0|this.words[a];i=(s+=i)>>>26,s&=67108863,this.words[a]=s}return 0!==i&&(this.words[a]=i,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(e){var t,o=e<0;if(0!==this.negative&&!o)return-1;if(0===this.negative&&o)return 1;if(this.strip(),this.length>1)t=1;else{o&&(e=-e),r(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},n.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},n.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 o=0|this.words[r],n=0|e.words[r];if(o!==n){o<n?t=-1:o>n&&(t=1);break}}return t},n.prototype.gtn=function(e){return 1===this.cmpn(e)},n.prototype.gt=function(e){return 1===this.cmp(e)},n.prototype.gten=function(e){return this.cmpn(e)>=0},n.prototype.gte=function(e){return this.cmp(e)>=0},n.prototype.ltn=function(e){return-1===this.cmpn(e)},n.prototype.lt=function(e){return-1===this.cmp(e)},n.prototype.lten=function(e){return this.cmpn(e)<=0},n.prototype.lte=function(e){return this.cmp(e)<=0},n.prototype.eqn=function(e){return 0===this.cmpn(e)},n.prototype.eq=function(e){return 0===this.cmp(e)},n.red=function(e){return new k(e)},n.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(e){return this.red=e,this},n.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},n.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},n.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},n.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},n.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},n.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},n.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},n.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function g(e,t){this.name=e,this.p=new n(t,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function $(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(e){if("string"==typeof e){var t=n._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function _(e){k.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}g.prototype._tmp=function(){var e=new n(null);return e.words=new Array(Math.ceil(this.n/13)),e},g.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 o=t<this.n?-1:r.ucmp(this.p);return 0===o?(r.words[0]=0,r.length=1):o>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(e,t){e.iushrn(this.n,0,t)},g.prototype.imulK=function(e){return e.imul(this.k)},o(b,g),b.prototype.split=function(e,t){for(var r=4194303,o=Math.min(e.length,9),n=0;n<o;n++)t.words[n]=e.words[n];if(t.length=o,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=i&r,n=10;n<e.length;n++){var a=0|e.words[n];e.words[n-10]=(a&r)<<4|i>>>22,i=a}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},b.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 o=0|e.words[r];t+=977*o,e.words[r]=67108863&t,t=64*o+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},o(v,g),o(w,g),o($,g),$.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var o=19*(0|e.words[r])+t,n=67108863&o;o>>>=26,e.words[r]=n,t=o}return 0!==t&&(e.words[e.length++]=t),e},n._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new $}return y[e]=t,t},k.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},k.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},k.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},k.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},k.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},k.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},k.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},k.prototype.isqr=function(e){return this.imul(e,e.clone())},k.prototype.sqr=function(e){return this.mul(e,e)},k.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var o=this.m.add(new n(1)).iushrn(2);return this.pow(e,o)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new n(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),p=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),f=a;0!==h.cmp(s);){for(var m=h,y=0;0!==m.cmp(s);y++)m=m.redSqr();r(y<f);var g=this.pow(d,new n(1).iushln(f-y-1));p=p.redMul(g),d=g.redSqr(),h=h.redMul(d),f=y}return p},k.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},k.prototype.pow=function(e,t){if(t.isZero())return new n(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=e;for(var o=2;o<r.length;o++)r[o]=this.mul(r[o-1],e);var i=r[0],a=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),o=t.length-1;o>=0;o--){for(var u=t.words[o],l=c-1;l>=0;l--){var d=u>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4===++s||0===o&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}c=26}return i},k.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},k.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},n.mont=function(e){return new _(e)},o(_,k),_.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},_.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},_.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(o).iushrn(this.shift),i=n;return n.cmp(this.m)>=0?i=n.isub(this.m):n.cmpn(0)<0&&(i=n.iadd(this.m)),i._forceRed(this)},_.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new n(0)._forceRed(this);var r=e.mul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(o).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},_.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,commonjsGlobal)}(bn)),bn.exports}function requireWithPublic(){if(hasRequiredWithPublic)return withPublic_1;hasRequiredWithPublic=1;var e=requireBn(),t=requireSafeBuffer$1().Buffer;return withPublic_1=function(r,o){return t.from(r.toRed(e.mont(o.modulus)).redPow(new e(o.publicExponent)).fromRed().toArray())}}function requirePublicEncrypt(){if(hasRequiredPublicEncrypt)return publicEncrypt;hasRequiredPublicEncrypt=1;var e=requireParseAsn1(),t=requireBrowser$b(),r=requireBrowser$9(),o=requireMgf(),n=requireXor(),i=requireBn(),a=requireWithPublic(),s=requireBrowserifyRsa(),c=requireSafeBuffer$1().Buffer;return publicEncrypt=function(u,l,d){var p;p=u.padding?u.padding:d?1:4;var h,f=e(u);if(4===p)h=function(e,a){var s=e.modulus.byteLength(),u=a.length,l=r("sha1").update(c.alloc(0)).digest(),d=l.length,p=2*d;if(u>s-p-2)throw new Error("message too long");var h=c.alloc(s-u-p-2),f=s-d-1,m=t(d),y=n(c.concat([l,h,c.alloc(1,1),a],f),o(m,f)),g=n(m,o(y,d));return new i(c.concat([c.alloc(1),g,y],s))}(f,l);else if(1===p)h=function(e,r,o){var n,a=r.length,s=e.modulus.byteLength();if(a>s-11)throw new Error("message too long");n=o?c.alloc(s-a-3,255):function(e){var r,o=c.allocUnsafe(e),n=0,i=t(2*e),a=0;for(;n<e;)a===i.length&&(i=t(2*e),a=0),(r=i[a++])&&(o[n++]=r);return o}(s-a-3);return new i(c.concat([c.from([0,o?1:2]),n,c.alloc(1),r],s))}(f,l,d);else{if(3!==p)throw new Error("unknown padding");if((h=new i(l)).cmp(f.modulus)>=0)throw new Error("data too long for modulus")}return d?s(h,f):a(h,f)}}function requirePrivateDecrypt(){if(hasRequiredPrivateDecrypt)return privateDecrypt;hasRequiredPrivateDecrypt=1;var e=requireParseAsn1(),t=requireMgf(),r=requireXor(),o=requireBn(),n=requireBrowserifyRsa(),i=requireBrowser$9(),a=requireWithPublic(),s=requireSafeBuffer$1().Buffer;return privateDecrypt=function(c,u,l){var d;d=c.padding?c.padding:l?1:4;var p,h=e(c),f=h.modulus.byteLength();if(u.length>f||new o(u).cmp(h.modulus)>=0)throw new Error("decryption error");p=l?a(new o(u),h):n(u,h);var m=s.alloc(f-p.length);if(p=s.concat([m,p],f),4===d)return function(e,o){var n=e.modulus.byteLength(),a=i("sha1").update(s.alloc(0)).digest(),c=a.length;if(0!==o[0])throw new Error("decryption error");var u=o.slice(1,c+1),l=o.slice(c+1),d=r(u,t(l,c)),p=r(l,t(d,n-c-1));if(function(e,t){e=s.from(e),t=s.from(t);var r=0,o=e.length;e.length!==t.length&&(r++,o=Math.min(e.length,t.length));var n=-1;for(;++n<o;)r+=e[n]^t[n];return r}(a,p.slice(0,c)))throw new Error("decryption error");var h=c;for(;0===p[h];)h++;if(1!==p[h++])throw new Error("decryption error");return p.slice(h)}(h,p);if(1===d)return function(e,t,r){var o=t.slice(0,2),n=2,i=0;for(;0!==t[n++];)if(n>=t.length){i++;break}var a=t.slice(2,n-1);("0002"!==o.toString("hex")&&!r||"0001"!==o.toString("hex")&&r)&&i++;a.length<8&&i++;if(i)throw new Error("decryption error");return t.slice(n)}(0,p,l);if(3===d)return p;throw new Error("unknown padding")}}function requireBrowser$1(){return hasRequiredBrowser$1||(hasRequiredBrowser$1=1,function(e){e.publicEncrypt=requirePublicEncrypt(),e.privateDecrypt=requirePrivateDecrypt(),e.privateEncrypt=function(t,r){return e.publicEncrypt(t,r,!0)},e.publicDecrypt=function(t,r){return e.privateDecrypt(t,r,!0)}}(browser$3)),browser$3}bn.exports;var browser$2={},hasRequiredBrowser,hasRequiredCryptoBrowserify;function requireBrowser(){if(hasRequiredBrowser)return browser$2;function e(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}hasRequiredBrowser=1;var t=requireSafeBuffer$1(),r=requireBrowser$b(),o=t.Buffer,n=t.kMaxLength,i=commonjsGlobal.crypto||commonjsGlobal.msCrypto,a=Math.pow(2,32)-1;function s(e,t){if("number"!=typeof e||e!=e)throw new TypeError("offset must be a number");if(e>a||e<0)throw new TypeError("offset must be a uint32");if(e>n||e>t)throw new RangeError("offset out of range")}function c(e,t,r){if("number"!=typeof e||e!=e)throw new TypeError("size must be a number");if(e>a||e<0)throw new TypeError("size must be a uint32");if(e+t>r||e>n)throw new RangeError("buffer too small")}function u(e,t,o,n){if(process$1$1.browser){var a=e.buffer,s=new Uint8Array(a,t,o);return i.getRandomValues(s),n?void process$1$1.nextTick((function(){n(null,e)})):e}if(!n)return r(o).copy(e,t),e;r(o,(function(r,o){if(r)return n(r);o.copy(e,t),n(null,e)}))}return i&&i.getRandomValues||!process$1$1.browser?(browser$2.randomFill=function(e,t,r,n){if(!(o.isBuffer(e)||e instanceof commonjsGlobal.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof t)n=t,t=0,r=e.length;else if("function"==typeof r)n=r,r=e.length-t;else if("function"!=typeof n)throw new TypeError('"cb" argument must be a function');return s(t,e.length),c(r,t,e.length),u(e,t,r,n)},browser$2.randomFillSync=function(e,t,r){void 0===t&&(t=0);if(!(o.isBuffer(e)||e instanceof commonjsGlobal.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');s(t,e.length),void 0===r&&(r=e.length-t);return c(r,t,e.length),u(e,t,r)}):(browser$2.randomFill=e,browser$2.randomFillSync=e),browser$2}function requireCryptoBrowserify(){if(hasRequiredCryptoBrowserify)return cryptoBrowserify;hasRequiredCryptoBrowserify=1,cryptoBrowserify.randomBytes=cryptoBrowserify.rng=cryptoBrowserify.pseudoRandomBytes=cryptoBrowserify.prng=requireBrowser$b(),cryptoBrowserify.createHash=cryptoBrowserify.Hash=requireBrowser$9(),cryptoBrowserify.createHmac=cryptoBrowserify.Hmac=requireBrowser$8();var e=requireAlgos(),t=Object.keys(e),r=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(t);cryptoBrowserify.getHashes=function(){return r};var o=requireBrowser$7();cryptoBrowserify.pbkdf2=o.pbkdf2,cryptoBrowserify.pbkdf2Sync=o.pbkdf2Sync;var n=requireBrowser$5();cryptoBrowserify.Cipher=n.Cipher,cryptoBrowserify.createCipher=n.createCipher,cryptoBrowserify.Cipheriv=n.Cipheriv,cryptoBrowserify.createCipheriv=n.createCipheriv,cryptoBrowserify.Decipher=n.Decipher,cryptoBrowserify.createDecipher=n.createDecipher,cryptoBrowserify.Decipheriv=n.Decipheriv,cryptoBrowserify.createDecipheriv=n.createDecipheriv,cryptoBrowserify.getCiphers=n.getCiphers,cryptoBrowserify.listCiphers=n.listCiphers;var i=requireBrowser$4();cryptoBrowserify.DiffieHellmanGroup=i.DiffieHellmanGroup,cryptoBrowserify.createDiffieHellmanGroup=i.createDiffieHellmanGroup,cryptoBrowserify.getDiffieHellman=i.getDiffieHellman,cryptoBrowserify.createDiffieHellman=i.createDiffieHellman,cryptoBrowserify.DiffieHellman=i.DiffieHellman;var a=requireBrowser$3();cryptoBrowserify.createSign=a.createSign,cryptoBrowserify.Sign=a.Sign,cryptoBrowserify.createVerify=a.createVerify,cryptoBrowserify.Verify=a.Verify,cryptoBrowserify.createECDH=requireBrowser$2();var s=requireBrowser$1();cryptoBrowserify.publicEncrypt=s.publicEncrypt,cryptoBrowserify.privateEncrypt=s.privateEncrypt,cryptoBrowserify.publicDecrypt=s.publicDecrypt,cryptoBrowserify.privateDecrypt=s.privateDecrypt;var c=requireBrowser();return cryptoBrowserify.randomFill=c.randomFill,cryptoBrowserify.randomFillSync=c.randomFillSync,cryptoBrowserify.createCredentials=function(){throw new Error("sorry, createCredentials is not implemented yet\nwe accept pull requests\nhttps://github.com/browserify/crypto-browserify")},cryptoBrowserify.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},cryptoBrowserify}!function(e){!function(e){var t=function(e){var t,r=new Float64Array(16);if(e)for(t=0;t<e.length;t++)r[t]=e[t];return r},r=function(){throw new Error("no PRNG")},o=new Uint8Array(16),n=new Uint8Array(32);n[0]=9;var i=t(),a=t([1]),s=t([56129,1]),c=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),u=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),l=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),d=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),p=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function h(e,t,r,o){e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r,e[t+4]=o>>24&255,e[t+5]=o>>16&255,e[t+6]=o>>8&255,e[t+7]=255&o}function f(e,t,r,o,n){var i,a=0;for(i=0;i<n;i++)a|=e[t+i]^r[o+i];return(1&a-1>>>8)-1}function m(e,t,r,o){return f(e,t,r,o,16)}function y(e,t,r,o){return f(e,t,r,o,32)}function g(e,t,r,o){!function(e,t,r,o){for(var n,i=255&o[0]|(255&o[1])<<8|(255&o[2])<<16|(255&o[3])<<24,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&o[4]|(255&o[5])<<8|(255&o[6])<<16|(255&o[7])<<24,d=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,p=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,f=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,m=255&o[8]|(255&o[9])<<8|(255&o[10])<<16|(255&o[11])<<24,y=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,g=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,b=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&o[12]|(255&o[13])<<8|(255&o[14])<<16|(255&o[15])<<24,$=i,k=a,_=s,T=c,I=u,A=l,O=d,E=p,S=h,R=f,x=m,C=y,P=g,N=b,B=v,D=w,M=0;M<20;M+=2)$^=(n=(P^=(n=(S^=(n=(I^=(n=$+P|0)<<7|n>>>25)+$|0)<<9|n>>>23)+I|0)<<13|n>>>19)+S|0)<<18|n>>>14,A^=(n=(k^=(n=(N^=(n=(R^=(n=A+k|0)<<7|n>>>25)+A|0)<<9|n>>>23)+R|0)<<13|n>>>19)+N|0)<<18|n>>>14,x^=(n=(O^=(n=(_^=(n=(B^=(n=x+O|0)<<7|n>>>25)+x|0)<<9|n>>>23)+B|0)<<13|n>>>19)+_|0)<<18|n>>>14,D^=(n=(C^=(n=(E^=(n=(T^=(n=D+C|0)<<7|n>>>25)+D|0)<<9|n>>>23)+T|0)<<13|n>>>19)+E|0)<<18|n>>>14,$^=(n=(T^=(n=(_^=(n=(k^=(n=$+T|0)<<7|n>>>25)+$|0)<<9|n>>>23)+k|0)<<13|n>>>19)+_|0)<<18|n>>>14,A^=(n=(I^=(n=(E^=(n=(O^=(n=A+I|0)<<7|n>>>25)+A|0)<<9|n>>>23)+O|0)<<13|n>>>19)+E|0)<<18|n>>>14,x^=(n=(R^=(n=(S^=(n=(C^=(n=x+R|0)<<7|n>>>25)+x|0)<<9|n>>>23)+C|0)<<13|n>>>19)+S|0)<<18|n>>>14,D^=(n=(B^=(n=(N^=(n=(P^=(n=D+B|0)<<7|n>>>25)+D|0)<<9|n>>>23)+P|0)<<13|n>>>19)+N|0)<<18|n>>>14;$=$+i|0,k=k+a|0,_=_+s|0,T=T+c|0,I=I+u|0,A=A+l|0,O=O+d|0,E=E+p|0,S=S+h|0,R=R+f|0,x=x+m|0,C=C+y|0,P=P+g|0,N=N+b|0,B=B+v|0,D=D+w|0,e[0]=$>>>0&255,e[1]=$>>>8&255,e[2]=$>>>16&255,e[3]=$>>>24&255,e[4]=k>>>0&255,e[5]=k>>>8&255,e[6]=k>>>16&255,e[7]=k>>>24&255,e[8]=_>>>0&255,e[9]=_>>>8&255,e[10]=_>>>16&255,e[11]=_>>>24&255,e[12]=T>>>0&255,e[13]=T>>>8&255,e[14]=T>>>16&255,e[15]=T>>>24&255,e[16]=I>>>0&255,e[17]=I>>>8&255,e[18]=I>>>16&255,e[19]=I>>>24&255,e[20]=A>>>0&255,e[21]=A>>>8&255,e[22]=A>>>16&255,e[23]=A>>>24&255,e[24]=O>>>0&255,e[25]=O>>>8&255,e[26]=O>>>16&255,e[27]=O>>>24&255,e[28]=E>>>0&255,e[29]=E>>>8&255,e[30]=E>>>16&255,e[31]=E>>>24&255,e[32]=S>>>0&255,e[33]=S>>>8&255,e[34]=S>>>16&255,e[35]=S>>>24&255,e[36]=R>>>0&255,e[37]=R>>>8&255,e[38]=R>>>16&255,e[39]=R>>>24&255,e[40]=x>>>0&255,e[41]=x>>>8&255,e[42]=x>>>16&255,e[43]=x>>>24&255,e[44]=C>>>0&255,e[45]=C>>>8&255,e[46]=C>>>16&255,e[47]=C>>>24&255,e[48]=P>>>0&255,e[49]=P>>>8&255,e[50]=P>>>16&255,e[51]=P>>>24&255,e[52]=N>>>0&255,e[53]=N>>>8&255,e[54]=N>>>16&255,e[55]=N>>>24&255,e[56]=B>>>0&255,e[57]=B>>>8&255,e[58]=B>>>16&255,e[59]=B>>>24&255,e[60]=D>>>0&255,e[61]=D>>>8&255,e[62]=D>>>16&255,e[63]=D>>>24&255}(e,t,r,o)}function b(e,t,r,o){!function(e,t,r,o){for(var n,i=255&o[0]|(255&o[1])<<8|(255&o[2])<<16|(255&o[3])<<24,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&o[4]|(255&o[5])<<8|(255&o[6])<<16|(255&o[7])<<24,d=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,p=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,f=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,m=255&o[8]|(255&o[9])<<8|(255&o[10])<<16|(255&o[11])<<24,y=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,g=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,b=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&o[12]|(255&o[13])<<8|(255&o[14])<<16|(255&o[15])<<24,$=0;$<20;$+=2)i^=(n=(g^=(n=(h^=(n=(u^=(n=i+g|0)<<7|n>>>25)+i|0)<<9|n>>>23)+u|0)<<13|n>>>19)+h|0)<<18|n>>>14,l^=(n=(a^=(n=(b^=(n=(f^=(n=l+a|0)<<7|n>>>25)+l|0)<<9|n>>>23)+f|0)<<13|n>>>19)+b|0)<<18|n>>>14,m^=(n=(d^=(n=(s^=(n=(v^=(n=m+d|0)<<7|n>>>25)+m|0)<<9|n>>>23)+v|0)<<13|n>>>19)+s|0)<<18|n>>>14,w^=(n=(y^=(n=(p^=(n=(c^=(n=w+y|0)<<7|n>>>25)+w|0)<<9|n>>>23)+c|0)<<13|n>>>19)+p|0)<<18|n>>>14,i^=(n=(c^=(n=(s^=(n=(a^=(n=i+c|0)<<7|n>>>25)+i|0)<<9|n>>>23)+a|0)<<13|n>>>19)+s|0)<<18|n>>>14,l^=(n=(u^=(n=(p^=(n=(d^=(n=l+u|0)<<7|n>>>25)+l|0)<<9|n>>>23)+d|0)<<13|n>>>19)+p|0)<<18|n>>>14,m^=(n=(f^=(n=(h^=(n=(y^=(n=m+f|0)<<7|n>>>25)+m|0)<<9|n>>>23)+y|0)<<13|n>>>19)+h|0)<<18|n>>>14,w^=(n=(v^=(n=(b^=(n=(g^=(n=w+v|0)<<7|n>>>25)+w|0)<<9|n>>>23)+g|0)<<13|n>>>19)+b|0)<<18|n>>>14;e[0]=i>>>0&255,e[1]=i>>>8&255,e[2]=i>>>16&255,e[3]=i>>>24&255,e[4]=l>>>0&255,e[5]=l>>>8&255,e[6]=l>>>16&255,e[7]=l>>>24&255,e[8]=m>>>0&255,e[9]=m>>>8&255,e[10]=m>>>16&255,e[11]=m>>>24&255,e[12]=w>>>0&255,e[13]=w>>>8&255,e[14]=w>>>16&255,e[15]=w>>>24&255,e[16]=d>>>0&255,e[17]=d>>>8&255,e[18]=d>>>16&255,e[19]=d>>>24&255,e[20]=p>>>0&255,e[21]=p>>>8&255,e[22]=p>>>16&255,e[23]=p>>>24&255,e[24]=h>>>0&255,e[25]=h>>>8&255,e[26]=h>>>16&255,e[27]=h>>>24&255,e[28]=f>>>0&255,e[29]=f>>>8&255,e[30]=f>>>16&255,e[31]=f>>>24&255}(e,t,r,o)}var v=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function w(e,t,r,o,n,i,a){var s,c,u=new Uint8Array(16),l=new Uint8Array(64);for(c=0;c<16;c++)u[c]=0;for(c=0;c<8;c++)u[c]=i[c];for(;n>=64;){for(g(l,u,a,v),c=0;c<64;c++)e[t+c]=r[o+c]^l[c];for(s=1,c=8;c<16;c++)s=s+(255&u[c])|0,u[c]=255&s,s>>>=8;n-=64,t+=64,o+=64}if(n>0)for(g(l,u,a,v),c=0;c<n;c++)e[t+c]=r[o+c]^l[c];return 0}function $(e,t,r,o,n){var i,a,s=new Uint8Array(16),c=new Uint8Array(64);for(a=0;a<16;a++)s[a]=0;for(a=0;a<8;a++)s[a]=o[a];for(;r>=64;){for(g(c,s,n,v),a=0;a<64;a++)e[t+a]=c[a];for(i=1,a=8;a<16;a++)i=i+(255&s[a])|0,s[a]=255&i,i>>>=8;r-=64,t+=64}if(r>0)for(g(c,s,n,v),a=0;a<r;a++)e[t+a]=c[a];return 0}function k(e,t,r,o,n){var i=new Uint8Array(32);b(i,o,n,v);for(var a=new Uint8Array(8),s=0;s<8;s++)a[s]=o[s+16];return $(e,t,r,a,i)}function _(e,t,r,o,n,i,a){var s=new Uint8Array(32);b(s,i,a,v);for(var c=new Uint8Array(8),u=0;u<8;u++)c[u]=i[u+16];return w(e,t,r,o,n,c,s)}var T=function(e){var t,r,o,n,i,a,s,c;this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0,t=255&e[0]|(255&e[1])<<8,this.r[0]=8191&t,r=255&e[2]|(255&e[3])<<8,this.r[1]=8191&(t>>>13|r<<3),o=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(r>>>10|o<<6),n=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(o>>>7|n<<9),i=255&e[8]|(255&e[9])<<8,this.r[4]=255&(n>>>4|i<<12),this.r[5]=i>>>1&8190,a=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(i>>>14|a<<2),s=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(a>>>11|s<<5),c=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(s>>>8|c<<8),this.r[9]=c>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function I(e,t,r,o,n,i){var a=new T(i);return a.update(r,o,n),a.finish(e,t),0}function A(e,t,r,o,n,i){var a=new Uint8Array(16);return I(a,0,r,o,n,i),m(e,t,a,0)}function O(e,t,r,o,n){var i;if(r<32)return-1;for(_(e,0,t,0,r,o,n),I(e,16,e,32,r-32,e),i=0;i<16;i++)e[i]=0;return 0}function E(e,t,r,o,n){var i,a=new Uint8Array(32);if(r<32)return-1;if(k(a,0,32,o,n),0!==A(t,16,t,32,r-32,a))return-1;for(_(e,0,t,0,r,o,n),i=0;i<32;i++)e[i]=0;return 0}function S(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function R(e){var t,r,o=1;for(t=0;t<16;t++)r=e[t]+o+65535,o=Math.floor(r/65536),e[t]=r-65536*o;e[0]+=o-1+37*(o-1)}function x(e,t,r){for(var o,n=~(r-1),i=0;i<16;i++)o=n&(e[i]^t[i]),e[i]^=o,t[i]^=o}function C(e,r){var o,n,i,a=t(),s=t();for(o=0;o<16;o++)s[o]=r[o];for(R(s),R(s),R(s),n=0;n<2;n++){for(a[0]=s[0]-65517,o=1;o<15;o++)a[o]=s[o]-65535-(a[o-1]>>16&1),a[o-1]&=65535;a[15]=s[15]-32767-(a[14]>>16&1),i=a[15]>>16&1,a[14]&=65535,x(s,a,1-i)}for(o=0;o<16;o++)e[2*o]=255&s[o],e[2*o+1]=s[o]>>8}function P(e,t){var r=new Uint8Array(32),o=new Uint8Array(32);return C(r,e),C(o,t),y(r,0,o,0)}function N(e){var t=new Uint8Array(32);return C(t,e),1&t[0]}function B(e,t){var r;for(r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function D(e,t,r){for(var o=0;o<16;o++)e[o]=t[o]+r[o]}function M(e,t,r){for(var o=0;o<16;o++)e[o]=t[o]-r[o]}function L(e,t,r){var o,n,i=0,a=0,s=0,c=0,u=0,l=0,d=0,p=0,h=0,f=0,m=0,y=0,g=0,b=0,v=0,w=0,$=0,k=0,_=0,T=0,I=0,A=0,O=0,E=0,S=0,R=0,x=0,C=0,P=0,N=0,B=0,D=r[0],M=r[1],L=r[2],j=r[3],F=r[4],U=r[5],K=r[6],q=r[7],G=r[8],H=r[9],V=r[10],W=r[11],z=r[12],Z=r[13],Q=r[14],Y=r[15];i+=(o=t[0])*D,a+=o*M,s+=o*L,c+=o*j,u+=o*F,l+=o*U,d+=o*K,p+=o*q,h+=o*G,f+=o*H,m+=o*V,y+=o*W,g+=o*z,b+=o*Z,v+=o*Q,w+=o*Y,a+=(o=t[1])*D,s+=o*M,c+=o*L,u+=o*j,l+=o*F,d+=o*U,p+=o*K,h+=o*q,f+=o*G,m+=o*H,y+=o*V,g+=o*W,b+=o*z,v+=o*Z,w+=o*Q,$+=o*Y,s+=(o=t[2])*D,c+=o*M,u+=o*L,l+=o*j,d+=o*F,p+=o*U,h+=o*K,f+=o*q,m+=o*G,y+=o*H,g+=o*V,b+=o*W,v+=o*z,w+=o*Z,$+=o*Q,k+=o*Y,c+=(o=t[3])*D,u+=o*M,l+=o*L,d+=o*j,p+=o*F,h+=o*U,f+=o*K,m+=o*q,y+=o*G,g+=o*H,b+=o*V,v+=o*W,w+=o*z,$+=o*Z,k+=o*Q,_+=o*Y,u+=(o=t[4])*D,l+=o*M,d+=o*L,p+=o*j,h+=o*F,f+=o*U,m+=o*K,y+=o*q,g+=o*G,b+=o*H,v+=o*V,w+=o*W,$+=o*z,k+=o*Z,_+=o*Q,T+=o*Y,l+=(o=t[5])*D,d+=o*M,p+=o*L,h+=o*j,f+=o*F,m+=o*U,y+=o*K,g+=o*q,b+=o*G,v+=o*H,w+=o*V,$+=o*W,k+=o*z,_+=o*Z,T+=o*Q,I+=o*Y,d+=(o=t[6])*D,p+=o*M,h+=o*L,f+=o*j,m+=o*F,y+=o*U,g+=o*K,b+=o*q,v+=o*G,w+=o*H,$+=o*V,k+=o*W,_+=o*z,T+=o*Z,I+=o*Q,A+=o*Y,p+=(o=t[7])*D,h+=o*M,f+=o*L,m+=o*j,y+=o*F,g+=o*U,b+=o*K,v+=o*q,w+=o*G,$+=o*H,k+=o*V,_+=o*W,T+=o*z,I+=o*Z,A+=o*Q,O+=o*Y,h+=(o=t[8])*D,f+=o*M,m+=o*L,y+=o*j,g+=o*F,b+=o*U,v+=o*K,w+=o*q,$+=o*G,k+=o*H,_+=o*V,T+=o*W,I+=o*z,A+=o*Z,O+=o*Q,E+=o*Y,f+=(o=t[9])*D,m+=o*M,y+=o*L,g+=o*j,b+=o*F,v+=o*U,w+=o*K,$+=o*q,k+=o*G,_+=o*H,T+=o*V,I+=o*W,A+=o*z,O+=o*Z,E+=o*Q,S+=o*Y,m+=(o=t[10])*D,y+=o*M,g+=o*L,b+=o*j,v+=o*F,w+=o*U,$+=o*K,k+=o*q,_+=o*G,T+=o*H,I+=o*V,A+=o*W,O+=o*z,E+=o*Z,S+=o*Q,R+=o*Y,y+=(o=t[11])*D,g+=o*M,b+=o*L,v+=o*j,w+=o*F,$+=o*U,k+=o*K,_+=o*q,T+=o*G,I+=o*H,A+=o*V,O+=o*W,E+=o*z,S+=o*Z,R+=o*Q,x+=o*Y,g+=(o=t[12])*D,b+=o*M,v+=o*L,w+=o*j,$+=o*F,k+=o*U,_+=o*K,T+=o*q,I+=o*G,A+=o*H,O+=o*V,E+=o*W,S+=o*z,R+=o*Z,x+=o*Q,C+=o*Y,b+=(o=t[13])*D,v+=o*M,w+=o*L,$+=o*j,k+=o*F,_+=o*U,T+=o*K,I+=o*q,A+=o*G,O+=o*H,E+=o*V,S+=o*W,R+=o*z,x+=o*Z,C+=o*Q,P+=o*Y,v+=(o=t[14])*D,w+=o*M,$+=o*L,k+=o*j,_+=o*F,T+=o*U,I+=o*K,A+=o*q,O+=o*G,E+=o*H,S+=o*V,R+=o*W,x+=o*z,C+=o*Z,P+=o*Q,N+=o*Y,w+=(o=t[15])*D,a+=38*(k+=o*L),s+=38*(_+=o*j),c+=38*(T+=o*F),u+=38*(I+=o*U),l+=38*(A+=o*K),d+=38*(O+=o*q),p+=38*(E+=o*G),h+=38*(S+=o*H),f+=38*(R+=o*V),m+=38*(x+=o*W),y+=38*(C+=o*z),g+=38*(P+=o*Z),b+=38*(N+=o*Q),v+=38*(B+=o*Y),i=(o=(i+=38*($+=o*M))+(n=1)+65535)-65536*(n=Math.floor(o/65536)),a=(o=a+n+65535)-65536*(n=Math.floor(o/65536)),s=(o=s+n+65535)-65536*(n=Math.floor(o/65536)),c=(o=c+n+65535)-65536*(n=Math.floor(o/65536)),u=(o=u+n+65535)-65536*(n=Math.floor(o/65536)),l=(o=l+n+65535)-65536*(n=Math.floor(o/65536)),d=(o=d+n+65535)-65536*(n=Math.floor(o/65536)),p=(o=p+n+65535)-65536*(n=Math.floor(o/65536)),h=(o=h+n+65535)-65536*(n=Math.floor(o/65536)),f=(o=f+n+65535)-65536*(n=Math.floor(o/65536)),m=(o=m+n+65535)-65536*(n=Math.floor(o/65536)),y=(o=y+n+65535)-65536*(n=Math.floor(o/65536)),g=(o=g+n+65535)-65536*(n=Math.floor(o/65536)),b=(o=b+n+65535)-65536*(n=Math.floor(o/65536)),v=(o=v+n+65535)-65536*(n=Math.floor(o/65536)),w=(o=w+n+65535)-65536*(n=Math.floor(o/65536)),i=(o=(i+=n-1+37*(n-1))+(n=1)+65535)-65536*(n=Math.floor(o/65536)),a=(o=a+n+65535)-65536*(n=Math.floor(o/65536)),s=(o=s+n+65535)-65536*(n=Math.floor(o/65536)),c=(o=c+n+65535)-65536*(n=Math.floor(o/65536)),u=(o=u+n+65535)-65536*(n=Math.floor(o/65536)),l=(o=l+n+65535)-65536*(n=Math.floor(o/65536)),d=(o=d+n+65535)-65536*(n=Math.floor(o/65536)),p=(o=p+n+65535)-65536*(n=Math.floor(o/65536)),h=(o=h+n+65535)-65536*(n=Math.floor(o/65536)),f=(o=f+n+65535)-65536*(n=Math.floor(o/65536)),m=(o=m+n+65535)-65536*(n=Math.floor(o/65536)),y=(o=y+n+65535)-65536*(n=Math.floor(o/65536)),g=(o=g+n+65535)-65536*(n=Math.floor(o/65536)),b=(o=b+n+65535)-65536*(n=Math.floor(o/65536)),v=(o=v+n+65535)-65536*(n=Math.floor(o/65536)),w=(o=w+n+65535)-65536*(n=Math.floor(o/65536)),i+=n-1+37*(n-1),e[0]=i,e[1]=a,e[2]=s,e[3]=c,e[4]=u,e[5]=l,e[6]=d,e[7]=p,e[8]=h,e[9]=f,e[10]=m,e[11]=y,e[12]=g,e[13]=b,e[14]=v,e[15]=w}function j(e,t){L(e,t,t)}function F(e,r){var o,n=t();for(o=0;o<16;o++)n[o]=r[o];for(o=253;o>=0;o--)j(n,n),2!==o&&4!==o&&L(n,n,r);for(o=0;o<16;o++)e[o]=n[o]}function U(e,r){var o,n=t();for(o=0;o<16;o++)n[o]=r[o];for(o=250;o>=0;o--)j(n,n),1!==o&&L(n,n,r);for(o=0;o<16;o++)e[o]=n[o]}function K(e,r,o){var n,i,a=new Uint8Array(32),c=new Float64Array(80),u=t(),l=t(),d=t(),p=t(),h=t(),f=t();for(i=0;i<31;i++)a[i]=r[i];for(a[31]=127&r[31]|64,a[0]&=248,B(c,o),i=0;i<16;i++)l[i]=c[i],p[i]=u[i]=d[i]=0;for(u[0]=p[0]=1,i=254;i>=0;--i)x(u,l,n=a[i>>>3]>>>(7&i)&1),x(d,p,n),D(h,u,d),M(u,u,d),D(d,l,p),M(l,l,p),j(p,h),j(f,u),L(u,d,u),L(d,l,h),D(h,u,d),M(u,u,d),j(l,u),M(d,p,f),L(u,d,s),D(u,u,p),L(d,d,u),L(u,p,f),L(p,l,c),j(l,h),x(u,l,n),x(d,p,n);for(i=0;i<16;i++)c[i+16]=u[i],c[i+32]=d[i],c[i+48]=l[i],c[i+64]=p[i];var m=c.subarray(32),y=c.subarray(16);return F(m,m),L(y,y,m),C(e,y),0}function q(e,t){return K(e,t,n)}function G(e,t){return r(t,32),q(e,t)}function H(e,t,r){var n=new Uint8Array(32);return K(n,r,t),b(e,o,n,v)}T.prototype.blocks=function(e,t,r){for(var o,n,i,a,s,c,u,l,d,p,h,f,m,y,g,b,v,w,$,k=this.fin?0:2048,_=this.h[0],T=this.h[1],I=this.h[2],A=this.h[3],O=this.h[4],E=this.h[5],S=this.h[6],R=this.h[7],x=this.h[8],C=this.h[9],P=this.r[0],N=this.r[1],B=this.r[2],D=this.r[3],M=this.r[4],L=this.r[5],j=this.r[6],F=this.r[7],U=this.r[8],K=this.r[9];r>=16;)p=d=0,p+=(_+=8191&(o=255&e[t+0]|(255&e[t+1])<<8))*P,p+=(T+=8191&(o>>>13|(n=255&e[t+2]|(255&e[t+3])<<8)<<3))*(5*K),p+=(I+=8191&(n>>>10|(i=255&e[t+4]|(255&e[t+5])<<8)<<6))*(5*U),p+=(A+=8191&(i>>>7|(a=255&e[t+6]|(255&e[t+7])<<8)<<9))*(5*F),d=(p+=(O+=8191&(a>>>4|(s=255&e[t+8]|(255&e[t+9])<<8)<<12))*(5*j))>>>13,p&=8191,p+=(E+=s>>>1&8191)*(5*L),p+=(S+=8191&(s>>>14|(c=255&e[t+10]|(255&e[t+11])<<8)<<2))*(5*M),p+=(R+=8191&(c>>>11|(u=255&e[t+12]|(255&e[t+13])<<8)<<5))*(5*D),p+=(x+=8191&(u>>>8|(l=255&e[t+14]|(255&e[t+15])<<8)<<8))*(5*B),h=d+=(p+=(C+=l>>>5|k)*(5*N))>>>13,h+=_*N,h+=T*P,h+=I*(5*K),h+=A*(5*U),d=(h+=O*(5*F))>>>13,h&=8191,h+=E*(5*j),h+=S*(5*L),h+=R*(5*M),h+=x*(5*D),d+=(h+=C*(5*B))>>>13,h&=8191,f=d,f+=_*B,f+=T*N,f+=I*P,f+=A*(5*K),d=(f+=O*(5*U))>>>13,f&=8191,f+=E*(5*F),f+=S*(5*j),f+=R*(5*L),f+=x*(5*M),m=d+=(f+=C*(5*D))>>>13,m+=_*D,m+=T*B,m+=I*N,m+=A*P,d=(m+=O*(5*K))>>>13,m&=8191,m+=E*(5*U),m+=S*(5*F),m+=R*(5*j),m+=x*(5*L),y=d+=(m+=C*(5*M))>>>13,y+=_*M,y+=T*D,y+=I*B,y+=A*N,d=(y+=O*P)>>>13,y&=8191,y+=E*(5*K),y+=S*(5*U),y+=R*(5*F),y+=x*(5*j),g=d+=(y+=C*(5*L))>>>13,g+=_*L,g+=T*M,g+=I*D,g+=A*B,d=(g+=O*N)>>>13,g&=8191,g+=E*P,g+=S*(5*K),g+=R*(5*U),g+=x*(5*F),b=d+=(g+=C*(5*j))>>>13,b+=_*j,b+=T*L,b+=I*M,b+=A*D,d=(b+=O*B)>>>13,b&=8191,b+=E*N,b+=S*P,b+=R*(5*K),b+=x*(5*U),v=d+=(b+=C*(5*F))>>>13,v+=_*F,v+=T*j,v+=I*L,v+=A*M,d=(v+=O*D)>>>13,v&=8191,v+=E*B,v+=S*N,v+=R*P,v+=x*(5*K),w=d+=(v+=C*(5*U))>>>13,w+=_*U,w+=T*F,w+=I*j,w+=A*L,d=(w+=O*M)>>>13,w&=8191,w+=E*D,w+=S*B,w+=R*N,w+=x*P,$=d+=(w+=C*(5*K))>>>13,$+=_*K,$+=T*U,$+=I*F,$+=A*j,d=($+=O*L)>>>13,$&=8191,$+=E*M,$+=S*D,$+=R*B,$+=x*N,_=p=8191&(d=(d=((d+=($+=C*P)>>>13)<<2)+d|0)+(p&=8191)|0),T=h+=d>>>=13,I=f&=8191,A=m&=8191,O=y&=8191,E=g&=8191,S=b&=8191,R=v&=8191,x=w&=8191,C=$&=8191,t+=16,r-=16;this.h[0]=_,this.h[1]=T,this.h[2]=I,this.h[3]=A,this.h[4]=O,this.h[5]=E,this.h[6]=S,this.h[7]=R,this.h[8]=x,this.h[9]=C},T.prototype.finish=function(e,t){var r,o,n,i,a=new Uint16Array(10);if(this.leftover){for(i=this.leftover,this.buffer[i++]=1;i<16;i++)this.buffer[i]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,i=2;i<10;i++)this.h[i]+=r,r=this.h[i]>>>13,this.h[i]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,a[0]=this.h[0]+5,r=a[0]>>>13,a[0]&=8191,i=1;i<10;i++)a[i]=this.h[i]+r,r=a[i]>>>13,a[i]&=8191;for(a[9]-=8192,o=(1^r)-1,i=0;i<10;i++)a[i]&=o;for(o=~o,i=0;i<10;i++)this.h[i]=this.h[i]&o|a[i];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),n=this.h[0]+this.pad[0],this.h[0]=65535&n,i=1;i<8;i++)n=(this.h[i]+this.pad[i]|0)+(n>>>16)|0,this.h[i]=65535&n;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},T.prototype.update=function(e,t,r){var o,n;if(this.leftover){for((n=16-this.leftover)>r&&(n=r),o=0;o<n;o++)this.buffer[this.leftover+o]=e[t+o];if(r-=n,t+=n,this.leftover+=n,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(r>=16&&(n=r-r%16,this.blocks(e,t,n),t+=n,r-=n),r){for(o=0;o<r;o++)this.buffer[this.leftover+o]=e[t+o];this.leftover+=r}};var V=O,W=E;var z=[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 Z(e,t,r,o){for(var n,i,a,s,c,u,l,d,p,h,f,m,y,g,b,v,w,$,k,_,T,I,A,O,E,S,R=new Int32Array(16),x=new Int32Array(16),C=e[0],P=e[1],N=e[2],B=e[3],D=e[4],M=e[5],L=e[6],j=e[7],F=t[0],U=t[1],K=t[2],q=t[3],G=t[4],H=t[5],V=t[6],W=t[7],Z=0;o>=128;){for(k=0;k<16;k++)_=8*k+Z,R[k]=r[_+0]<<24|r[_+1]<<16|r[_+2]<<8|r[_+3],x[k]=r[_+4]<<24|r[_+5]<<16|r[_+6]<<8|r[_+7];for(k=0;k<80;k++)if(n=C,i=P,a=N,s=B,c=D,u=M,l=L,j,p=F,h=U,f=K,m=q,y=G,g=H,b=V,W,A=65535&(I=W),O=I>>>16,E=65535&(T=j),S=T>>>16,A+=65535&(I=(G>>>14|D<<18)^(G>>>18|D<<14)^(D>>>9|G<<23)),O+=I>>>16,E+=65535&(T=(D>>>14|G<<18)^(D>>>18|G<<14)^(G>>>9|D<<23)),S+=T>>>16,A+=65535&(I=G&H^~G&V),O+=I>>>16,E+=65535&(T=D&M^~D&L),S+=T>>>16,A+=65535&(I=z[2*k+1]),O+=I>>>16,E+=65535&(T=z[2*k]),S+=T>>>16,T=R[k%16],O+=(I=x[k%16])>>>16,E+=65535&T,S+=T>>>16,E+=(O+=(A+=65535&I)>>>16)>>>16,A=65535&(I=$=65535&A|O<<16),O=I>>>16,E=65535&(T=w=65535&E|(S+=E>>>16)<<16),S=T>>>16,A+=65535&(I=(F>>>28|C<<4)^(C>>>2|F<<30)^(C>>>7|F<<25)),O+=I>>>16,E+=65535&(T=(C>>>28|F<<4)^(F>>>2|C<<30)^(F>>>7|C<<25)),S+=T>>>16,O+=(I=F&U^F&K^U&K)>>>16,E+=65535&(T=C&P^C&N^P&N),S+=T>>>16,d=65535&(E+=(O+=(A+=65535&I)>>>16)>>>16)|(S+=E>>>16)<<16,v=65535&A|O<<16,A=65535&(I=m),O=I>>>16,E=65535&(T=s),S=T>>>16,O+=(I=$)>>>16,E+=65535&(T=w),S+=T>>>16,P=n,N=i,B=a,D=s=65535&(E+=(O+=(A+=65535&I)>>>16)>>>16)|(S+=E>>>16)<<16,M=c,L=u,j=l,C=d,U=p,K=h,q=f,G=m=65535&A|O<<16,H=y,V=g,W=b,F=v,k%16==15)for(_=0;_<16;_++)T=R[_],A=65535&(I=x[_]),O=I>>>16,E=65535&T,S=T>>>16,T=R[(_+9)%16],A+=65535&(I=x[(_+9)%16]),O+=I>>>16,E+=65535&T,S+=T>>>16,w=R[(_+1)%16],A+=65535&(I=(($=x[(_+1)%16])>>>1|w<<31)^($>>>8|w<<24)^($>>>7|w<<25)),O+=I>>>16,E+=65535&(T=(w>>>1|$<<31)^(w>>>8|$<<24)^w>>>7),S+=T>>>16,w=R[(_+14)%16],O+=(I=(($=x[(_+14)%16])>>>19|w<<13)^(w>>>29|$<<3)^($>>>6|w<<26))>>>16,E+=65535&(T=(w>>>19|$<<13)^($>>>29|w<<3)^w>>>6),S+=T>>>16,S+=(E+=(O+=(A+=65535&I)>>>16)>>>16)>>>16,R[_]=65535&E|S<<16,x[_]=65535&A|O<<16;A=65535&(I=F),O=I>>>16,E=65535&(T=C),S=T>>>16,T=e[0],O+=(I=t[0])>>>16,E+=65535&T,S+=T>>>16,S+=(E+=(O+=(A+=65535&I)>>>16)>>>16)>>>16,e[0]=C=65535&E|S<<16,t[0]=F=65535&A|O<<16,A=65535&(I=U),O=I>>>16,E=65535&(T=P),S=T>>>16,T=e[1],O+=(I=t[1])>>>16,E+=65535&T,S+=T>>>16,S+=(E+=(O+=(A+=65535&I)>>>16)>>>16)>>>16,e[1]=P=65535&E|S<<16,t[1]=U=65535&A|O<<16,A=65535&(I=K),O=I>>>16,E=65535&(T=N),S=T>>>16,T=e[2],O+=(I=t[2])>>>16,E+=65535&T,S+=T>>>16,S+=(E+=(O+=(A+=65535&I)>>>16)>>>16)>>>16,e[2]=N=65535&E|S<<16,t[2]=K=65535&A|O<<16,A=65535&(I=q),O=I>>>16,E=65535&(T=B),S=T>>>16,T=e[3],O+=(I=t[3])>>>16,E+=65535&T,S+=T>>>16,S+=(E+=(O+=(A+=65535&I)>>>16)>>>16)>>>16,e[3]=B=65535&E|S<<16,t[3]=q=65535&A|O<<16,A=65535&(I=G),O=I>>>16,E=65535&(T=D),S=T>>>16,T=e[4],O+=(I=t[4])>>>16,E+=65535&T,S+=T>>>16,S+=(E+=(O+=(A+=65535&I)>>>16)>>>16)>>>16,e[4]=D=65535&E|S<<16,t[4]=G=65535&A|O<<16,A=65535&(I=H),O=I>>>16,E=65535&(T=M),S=T>>>16,T=e[5],O+=(I=t[5])>>>16,E+=65535&T,S+=T>>>16,S+=(E+=(O+=(A+=65535&I)>>>16)>>>16)>>>16,e[5]=M=65535&E|S<<16,t[5]=H=65535&A|O<<16,A=65535&(I=V),O=I>>>16,E=65535&(T=L),S=T>>>16,T=e[6],O+=(I=t[6])>>>16,E+=65535&T,S+=T>>>16,S+=(E+=(O+=(A+=65535&I)>>>16)>>>16)>>>16,e[6]=L=65535&E|S<<16,t[6]=V=65535&A|O<<16,A=65535&(I=W),O=I>>>16,E=65535&(T=j),S=T>>>16,T=e[7],O+=(I=t[7])>>>16,E+=65535&T,S+=T>>>16,S+=(E+=(O+=(A+=65535&I)>>>16)>>>16)>>>16,e[7]=j=65535&E|S<<16,t[7]=W=65535&A|O<<16,Z+=128,o-=128}return o}function Q(e,t,r){var o,n=new Int32Array(8),i=new Int32Array(8),a=new Uint8Array(256),s=r;for(n[0]=1779033703,n[1]=3144134277,n[2]=1013904242,n[3]=2773480762,n[4]=1359893119,n[5]=2600822924,n[6]=528734635,n[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,Z(n,i,t,r),r%=128,o=0;o<r;o++)a[o]=t[s-r+o];for(a[r]=128,a[(r=256-128*(r<112?1:0))-9]=0,h(a,r-8,s/536870912|0,s<<3),Z(n,i,a,r),o=0;o<8;o++)h(e,8*o,n[o],i[o]);return 0}function Y(e,r){var o=t(),n=t(),i=t(),a=t(),s=t(),c=t(),l=t(),d=t(),p=t();M(o,e[1],e[0]),M(p,r[1],r[0]),L(o,o,p),D(n,e[0],e[1]),D(p,r[0],r[1]),L(n,n,p),L(i,e[3],r[3]),L(i,i,u),L(a,e[2],r[2]),D(a,a,a),M(s,n,o),M(c,a,i),D(l,a,i),D(d,n,o),L(e[0],s,c),L(e[1],d,l),L(e[2],l,c),L(e[3],s,d)}function X(e,t,r){var o;for(o=0;o<4;o++)x(e[o],t[o],r)}function J(e,r){var o=t(),n=t(),i=t();F(i,r[2]),L(o,r[0],i),L(n,r[1],i),C(e,n),e[31]^=N(o)<<7}function ee(e,t,r){var o,n;for(S(e[0],i),S(e[1],a),S(e[2],a),S(e[3],i),n=255;n>=0;--n)X(e,t,o=r[n/8|0]>>(7&n)&1),Y(t,e),Y(e,e),X(e,t,o)}function te(e,r){var o=[t(),t(),t(),t()];S(o[0],l),S(o[1],d),S(o[2],a),L(o[3],l,d),ee(e,o,r)}function re(e,o,n){var i,a=new Uint8Array(64),s=[t(),t(),t(),t()];for(n||r(o,32),Q(a,o,32),a[0]&=248,a[31]&=127,a[31]|=64,te(s,a),J(e,s),i=0;i<32;i++)o[i+32]=e[i];return 0}var oe=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ne(e,t){var r,o,n,i;for(o=63;o>=32;--o){for(r=0,n=o-32,i=o-12;n<i;++n)t[n]+=r-16*t[o]*oe[n-(o-32)],r=Math.floor((t[n]+128)/256),t[n]-=256*r;t[n]+=r,t[o]=0}for(r=0,n=0;n<32;n++)t[n]+=r-(t[31]>>4)*oe[n],r=t[n]>>8,t[n]&=255;for(n=0;n<32;n++)t[n]-=r*oe[n];for(o=0;o<32;o++)t[o+1]+=t[o]>>8,e[o]=255&t[o]}function ie(e){var t,r=new Float64Array(64);for(t=0;t<64;t++)r[t]=e[t];for(t=0;t<64;t++)e[t]=0;ne(e,r)}function ae(e,r,o,n){var i,a,s=new Uint8Array(64),c=new Uint8Array(64),u=new Uint8Array(64),l=new Float64Array(64),d=[t(),t(),t(),t()];Q(s,n,32),s[0]&=248,s[31]&=127,s[31]|=64;var p=o+64;for(i=0;i<o;i++)e[64+i]=r[i];for(i=0;i<32;i++)e[32+i]=s[32+i];for(Q(u,e.subarray(32),o+32),ie(u),te(d,u),J(e,d),i=32;i<64;i++)e[i]=n[i];for(Q(c,e,o+64),ie(c),i=0;i<64;i++)l[i]=0;for(i=0;i<32;i++)l[i]=u[i];for(i=0;i<32;i++)for(a=0;a<32;a++)l[i+a]+=c[i]*s[a];return ne(e.subarray(32),l),p}function se(e,r,o,n){var s,u=new Uint8Array(32),l=new Uint8Array(64),d=[t(),t(),t(),t()],h=[t(),t(),t(),t()];if(o<64)return-1;if(function(e,r){var o=t(),n=t(),s=t(),u=t(),l=t(),d=t(),h=t();return S(e[2],a),B(e[1],r),j(s,e[1]),L(u,s,c),M(s,s,e[2]),D(u,e[2],u),j(l,u),j(d,l),L(h,d,l),L(o,h,s),L(o,o,u),U(o,o),L(o,o,s),L(o,o,u),L(o,o,u),L(e[0],o,u),j(n,e[0]),L(n,n,u),P(n,s)&&L(e[0],e[0],p),j(n,e[0]),L(n,n,u),P(n,s)?-1:(N(e[0])===r[31]>>7&&M(e[0],i,e[0]),L(e[3],e[0],e[1]),0)}(h,n))return-1;for(s=0;s<o;s++)e[s]=r[s];for(s=0;s<32;s++)e[s+32]=n[s];if(Q(l,e,o),ie(l),ee(d,h,l),te(h,r.subarray(32)),Y(d,h),J(u,d),o-=64,y(r,0,u,0)){for(s=0;s<o;s++)e[s]=0;return-1}for(s=0;s<o;s++)e[s]=r[s+64];return o}var ce=16,ue=64,le=32,de=64;function pe(e,t){if(32!==e.length)throw new Error("bad key size");if(24!==t.length)throw new Error("bad nonce size")}function he(){for(var e=0;e<arguments.length;e++)if(!(arguments[e]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function fe(e){for(var t=0;t<e.length;t++)e[t]=0}e.lowlevel={crypto_core_hsalsa20:b,crypto_stream_xor:_,crypto_stream:k,crypto_stream_salsa20_xor:w,crypto_stream_salsa20:$,crypto_onetimeauth:I,crypto_onetimeauth_verify:A,crypto_verify_16:m,crypto_verify_32:y,crypto_secretbox:O,crypto_secretbox_open:E,crypto_scalarmult:K,crypto_scalarmult_base:q,crypto_box_beforenm:H,crypto_box_afternm:V,crypto_box:function(e,t,r,o,n,i){var a=new Uint8Array(32);return H(a,n,i),V(e,t,r,o,a)},crypto_box_open:function(e,t,r,o,n,i){var a=new Uint8Array(32);return H(a,n,i),W(e,t,r,o,a)},crypto_box_keypair:G,crypto_hash:Q,crypto_sign:ae,crypto_sign_keypair:re,crypto_sign_open:se,crypto_secretbox_KEYBYTES:32,crypto_secretbox_NONCEBYTES:24,crypto_secretbox_ZEROBYTES:32,crypto_secretbox_BOXZEROBYTES:ce,crypto_scalarmult_BYTES:32,crypto_scalarmult_SCALARBYTES:32,crypto_box_PUBLICKEYBYTES:32,crypto_box_SECRETKEYBYTES:32,crypto_box_BEFORENMBYTES:32,crypto_box_NONCEBYTES:24,crypto_box_ZEROBYTES:32,crypto_box_BOXZEROBYTES:16,crypto_sign_BYTES:ue,crypto_sign_PUBLICKEYBYTES:le,crypto_sign_SECRETKEYBYTES:de,crypto_sign_SEEDBYTES:32,crypto_hash_BYTES:64,gf:t,D:c,L:oe,pack25519:C,unpack25519:B,M:L,A:D,S:j,Z:M,pow2523:U,add:Y,set25519:S,modL:ne,scalarmult:ee,scalarbase:te},e.randomBytes=function(e){var t=new Uint8Array(e);return r(t,e),t},e.secretbox=function(e,t,r){he(e,t,r),pe(r,t);for(var o=new Uint8Array(32+e.length),n=new Uint8Array(o.length),i=0;i<e.length;i++)o[i+32]=e[i];return O(n,o,o.length,t,r),n.subarray(ce)},e.secretbox.open=function(e,t,r){he(e,t,r),pe(r,t);for(var o=new Uint8Array(ce+e.length),n=new Uint8Array(o.length),i=0;i<e.length;i++)o[i+ce]=e[i];return o.length<32||0!==E(n,o,o.length,t,r)?null:n.subarray(32)},e.secretbox.keyLength=32,e.secretbox.nonceLength=24,e.secretbox.overheadLength=ce,e.scalarMult=function(e,t){if(he(e,t),32!==e.length)throw new Error("bad n size");if(32!==t.length)throw new Error("bad p size");var r=new Uint8Array(32);return K(r,e,t),r},e.scalarMult.base=function(e){if(he(e),32!==e.length)throw new Error("bad n size");var t=new Uint8Array(32);return q(t,e),t},e.scalarMult.scalarLength=32,e.scalarMult.groupElementLength=32,e.box=function(t,r,o,n){var i=e.box.before(o,n);return e.secretbox(t,r,i)},e.box.before=function(e,t){he(e,t),function(e,t){if(32!==e.length)throw new Error("bad public key size");if(32!==t.length)throw new Error("bad secret key size")}(e,t);var r=new Uint8Array(32);return H(r,e,t),r},e.box.after=e.secretbox,e.box.open=function(t,r,o,n){var i=e.box.before(o,n);return e.secretbox.open(t,r,i)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var e=new Uint8Array(32),t=new Uint8Array(32);return G(e,t),{publicKey:e,secretKey:t}},e.box.keyPair.fromSecretKey=function(e){if(he(e),32!==e.length)throw new Error("bad secret key size");var t=new Uint8Array(32);return q(t,e),{publicKey:t,secretKey:new Uint8Array(e)}},e.box.publicKeyLength=32,e.box.secretKeyLength=32,e.box.sharedKeyLength=32,e.box.nonceLength=24,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(e,t){if(he(e,t),t.length!==de)throw new Error("bad secret key size");var r=new Uint8Array(ue+e.length);return ae(r,e,e.length,t),r},e.sign.open=function(e,t){if(he(e,t),t.length!==le)throw new Error("bad public key size");var r=new Uint8Array(e.length),o=se(r,e,e.length,t);if(o<0)return null;for(var n=new Uint8Array(o),i=0;i<n.length;i++)n[i]=r[i];return n},e.sign.detached=function(t,r){for(var o=e.sign(t,r),n=new Uint8Array(ue),i=0;i<n.length;i++)n[i]=o[i];return n},e.sign.detached.verify=function(e,t,r){if(he(e,t,r),t.length!==ue)throw new Error("bad signature size");if(r.length!==le)throw new Error("bad public key size");var o,n=new Uint8Array(ue+e.length),i=new Uint8Array(ue+e.length);for(o=0;o<ue;o++)n[o]=t[o];for(o=0;o<e.length;o++)n[o+ue]=e[o];return se(i,n,n.length,r)>=0},e.sign.keyPair=function(){var e=new Uint8Array(le),t=new Uint8Array(de);return re(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(he(e),e.length!==de)throw new Error("bad secret key size");for(var t=new Uint8Array(le),r=0;r<t.length;r++)t[r]=e[32+r];return{publicKey:t,secretKey:new Uint8Array(e)}},e.sign.keyPair.fromSeed=function(e){if(he(e),32!==e.length)throw new Error("bad seed size");for(var t=new Uint8Array(le),r=new Uint8Array(de),o=0;o<32;o++)r[o]=e[o];return re(t,r,!0),{publicKey:t,secretKey:r}},e.sign.publicKeyLength=le,e.sign.secretKeyLength=de,e.sign.seedLength=32,e.sign.signatureLength=ue,e.hash=function(e){he(e);var t=new Uint8Array(64);return Q(t,e,e.length),t},e.hash.hashLength=64,e.verify=function(e,t){return he(e,t),0!==e.length&&0!==t.length&&(e.length===t.length&&0===f(e,0,t,0,e.length))},e.setPRNG=function(e){r=e},function(){var t="undefined"!=typeof self?self.crypto||self.msCrypto:null;if(t&&t.getRandomValues){e.setPRNG((function(e,r){var o,n=new Uint8Array(r);for(o=0;o<r;o+=65536)t.getRandomValues(n.subarray(o,o+Math.min(r-o,65536)));for(o=0;o<r;o++)e[o]=n[o];fe(n)}))}else void 0!==commonjsRequire&&(t=requireCryptoBrowserify())&&t.randomBytes&&e.setPRNG((function(e,r){var o,n=t.randomBytes(r);for(o=0;o<r;o++)e[o]=n[o];fe(n)}))}()}(e.exports?e.exports:self.nacl=self.nacl||{})}(naclFast);var naclFastExports=naclFast.exports;const nacl=getDefaultExportFromCjs$2(naclFastExports);function arrayEqual(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;const r=new DataView(e.buffer,e.byteOffset,e.byteLength),o=new DataView(t.buffer,t.byteOffset,t.byteLength);let n=e.byteLength;for(;n--;)if(r.getUint8(n)!==o.getUint8(n))return!1;return!0}function arrayStartsWith(e,t){if(e.byteLength<t.byteLength)return!1;let r=t.byteLength;for(;r--;)if(e[r]!==t[r])return!1;return!0}const byteToHex=[];for(let $=0;$<=255;$+=1)byteToHex.push($.toString(16).padStart(2,"0"));function encode$4(e){let t="";for(const r of e)t+=byteToHex[r];return t}function decode$3(e){const t=(e.startsWith("0x")?e.substring(2):e).match(/.{1,2}/gu);return new Uint8Array((null==t?[]:t).map((e=>parseInt(e,16))))}function hexZeroPadded(e,t){const r="0123456789abcdef";let o="0x";for(let n=0;n<e.length;n++){let t=e[n];o+=r[(240&t)>>4]+r[15&t]}for(o.length>2*t+2&&console.log("result out of range","result");o.length<2*t+2;)o="0x0"+o.substring(2);return o.substring(2)}const derPrefix$3="302a300506032b6570032100",derPrefixBytes$3=decode$3(derPrefix$3);class Ed25519PublicKey extends Key{constructor(e){super(),this._keyData=e}get _type(){return"ED25519"}static fromBytes(e){switch(e.length){case 32:return Ed25519PublicKey.fromBytesRaw(e);case 44:return Ed25519PublicKey.fromBytesDer(e);default:throw new BadKeyError(`invalid public key length: ${e.length} bytes`)}}static fromBytesDer(e){try{if(44!==e.length)throw new Error(`invalid length: ${e.length} bytes`);if(!e.subarray(0,12).every(((e,t)=>e===derPrefixBytes$3[t])))throw new Error("invalid DER prefix");const t=e.subarray(12);return new Ed25519PublicKey(t)}catch(t){throw new BadKeyError(`cannot decode ED25519 public key data from DER format: ${t instanceof Error?t.message:"unknown error"}`)}}static fromBytesRaw(e){if(32!=e.length)throw new BadKeyError(`invalid public key length: ${e.length} bytes`);return new Ed25519PublicKey(e)}static fromString(e){return Ed25519PublicKey.fromBytes(decode$3(e))}verify(e,t){return nacl.sign.detached.verify(e,t,this._keyData)}toBytesDer(){const e=new Uint8Array(derPrefixBytes$3.length+32);return e.set(derPrefixBytes$3,0),e.set(this._keyData.subarray(0,32),derPrefixBytes$3.length),e}toBytesRaw(){return this._keyData.slice()}equals(e){return arrayEqual(this._keyData,e._keyData)}}function bytes$1(e){return nacl.randomBytes(e)}function bytesAsync(e){return Promise.resolve(nacl.randomBytes(e))}function decode$2(e){return(new TextDecoder).decode(e)}function encode$3(e){return(new TextEncoder).encode(e)}const HashAlgorithm={Sha256:"SHA-256",Sha384:"SHA-384",Sha512:"SHA-512"};async function hash(e,t,r){const o="string"==typeof t?encode$3(t):t,n="string"==typeof r?encode$3(r):r;try{const t=await window.crypto.subtle.importKey("raw",o,{name:"HMAC",hash:e},!1,["sign"]);return new Uint8Array(await window.crypto.subtle.sign("HMAC",t,n))}catch{throw new Error("Fallback if SubtleCrypto fails is not implemented")}}var ellipticExports=requireElliptic();const elliptic=getDefaultExportFromCjs$2(ellipticExports),secp256k1$1=new elliptic.ec("secp256k1"),N=new _BN("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141","hex"),HARDENED_BIT=2147483648;async function derive$1(e,t,r){const o=isHardenedIndex(r),n=new Uint8Array(37),i=decode$3(secp256k1$1.keyFromPrivate(e).getPublic(!0,"hex"));o?(n[0]=0,n.set(e,1)):n.set(i,0),new DataView(n.buffer,n.byteOffset,n.byteLength).setUint32(33,r,!1);const a=await hash(HashAlgorithm.Sha512,t,n),s=a.subarray(0,32),c=a.subarray(32);try{const o=secp256k1$1.keyFromPrivate(e).getPrivate().add(secp256k1$1.keyFromPrivate(s).getPrivate()).mod(N),n=hexZeroPadded(Uint8Array.from(o.toArray()),32);return o.eqn(0)?derive$1(e,t,r+1):{keyData:decode$3(n),chainCode:c}}catch{return derive$1(e,t,r+1)}}async function fromSeed$1(e){if(e.length<16)throw new TypeError("Seed should be at least 128 bits");if(e.length>64)throw new TypeError("Seed should be at most 512 bits");const t=await hash(HashAlgorithm.Sha512,"Bitcoin seed",e);return{keyData:t.subarray(0,32),chainCode:t.subarray(32)}}function toHardenedIndex(e){return e|HARDENED_BIT}function isHardenedIndex(e){return!!(e&HARDENED_BIT)}async function derive(e,t,r){if(isHardenedIndex(r))throw new Error("the index should not be pre-hardened");const o=new Uint8Array(37);o[0]=0,o.set(e,1),new DataView(o.buffer,o.byteOffset,o.byteLength).setUint32(33,r,!1),o[33]|=128;const n=await hash(HashAlgorithm.Sha512,t,o);return{keyData:n.subarray(0,32),chainCode:n.subarray(32)}}async function fromSeed(e){const t=await hash(HashAlgorithm.Sha512,"ed25519 seed",e);return{keyData:t.subarray(0,32),chainCode:t.subarray(32)}}const derPrefix$2="302e020100300506032b657004220420",derPrefixBytes$2=decode$3(derPrefix$2);class Ed25519PrivateKey{constructor(e,t){this._keyPair=e instanceof Uint8Array?nacl.sign.keyPair.fromSeed(e):e,this._chainCode=null!=t?t:null}get _type(){return"ED25519"}static generate(){const e=bytes$1(64);return new Ed25519PrivateKey(nacl.sign.keyPair.fromSeed(e.subarray(0,32)),e.subarray(32))}static async generateAsync(){const e=await bytesAsync(64);return new Ed25519PrivateKey(nacl.sign.keyPair.fromSeed(e.subarray(0,32)),e.subarray(32))}static fromBytes(e){switch(e.length){case 48:return Ed25519PrivateKey.fromBytesDer(e);case 32:case 64:return Ed25519PrivateKey.fromBytesRaw(e);default:throw new BadKeyError(`invalid private key length: ${e.length} bytes`)}}static fromBytesDer(e){let t;try{const r=new Uint8Array(e),o=r.subarray(0,e.length-32);if(!o.every(((e,t)=>derPrefixBytes$2[t]===e)))throw new BadKeyError("invalid DER prefix for ED25519 private key");t=r.slice(e.length-32)}catch(o){const e=null!=o&&null!=o.message?o.message:"";throw new BadKeyError(`cannot decode ED25519 private key data from DER format: ${e}`)}const r=nacl.sign.keyPair.fromSeed(t);return new Ed25519PrivateKey(r)}static fromBytesRaw(e){switch(e.length){case 32:return new Ed25519PrivateKey(nacl.sign.keyPair.fromSeed(e));case 64:return new Ed25519PrivateKey(nacl.sign.keyPair.fromSecretKey(e))}throw new BadKeyError(`invalid private key length: ${e.length} bytes`)}static fromString(e){return Ed25519PrivateKey.fromBytes(decode$3(e))}static fromStringDer(e){return Ed25519PrivateKey.fromBytesDer(decode$3(e))}static fromStringRaw(e){return Ed25519PrivateKey.fromBytesRaw(decode$3(e))}static async fromSeed(e){const{keyData:t,chainCode:r}=await fromSeed(e);return new Ed25519PrivateKey(t,r)}get publicKey(){return new Ed25519PublicKey(this._keyPair.publicKey)}sign(e){return nacl.sign.detached(e,this._keyPair.secretKey)}toBytesDer(){const e=new Uint8Array(derPrefixBytes$2.length+32),t=this._keyPair.secretKey.subarray(0,32),r=32-t.length,o=derPrefixBytes$2.length+r;return e.set(derPrefixBytes$2,0),e.set(t,o),e}toBytesRaw(){return this._keyPair.secretKey.slice(0,32)}}const HEX_CHARS="0123456789abcdef".split(""),KECCAK_PADDING=[1,256,65536,16777216],SHIFT=[0,8,16,24],RC=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],Keccak$1=e=>{return{blocks:[],reset:!0,block:0,start:0,blockCount:1600-(e<<1)>>5,outputBlocks:e>>5,s:(t=[0,0,0,0,0,0,0,0,0,0],[].concat(t,t,t,t,t))};var t},update=(e,t)=>{for(var r,o,n=t.length,i=e.blocks,a=e.blockCount<<2,s=e.blockCount,c=e.outputBlocks,u=e.s,l=0;l<n;){if(e.reset)for(e.reset=!1,i[0]=e.block,r=1;r<s+1;++r)i[r]=0;if("string"!=typeof t)for(r=e.start;l<n&&r<a;++l)i[r>>2]|=t[l]<<SHIFT[3&r++];else for(r=e.start;l<n&&r<a;++l)(o=t.charCodeAt(l))<128?i[r>>2]|=o<<SHIFT[3&r++]:o<2048?(i[r>>2]|=(192|o>>6)<<SHIFT[3&r++],i[r>>2]|=(128|63&o)<<SHIFT[3&r++]):o<55296||o>=57344?(i[r>>2]|=(224|o>>12)<<SHIFT[3&r++],i[r>>2]|=(128|o>>6&63)<<SHIFT[3&r++],i[r>>2]|=(128|63&o)<<SHIFT[3&r++]):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++l)),i[r>>2]|=(240|o>>18)<<SHIFT[3&r++],i[r>>2]|=(128|o>>12&63)<<SHIFT[3&r++],i[r>>2]|=(128|o>>6&63)<<SHIFT[3&r++],i[r>>2]|=(128|63&o)<<SHIFT[3&r++]);if(e.lastByteIndex=r,r>=a){for(e.start=r-a,e.block=i[s],r=0;r<s;++r)u[r]^=i[r];f$3(u),e.reset=!0}else e.start=r}if(i[(r=e.lastByteIndex)>>2]|=KECCAK_PADDING[3&r],e.lastByteIndex===a)for(i[0]=i[s],r=1;r<s+1;++r)i[r]=0;for(i[s-1]|=2147483648,r=0;r<s;++r)u[r]^=i[r];f$3(u);var d,p="",h=0;for(r=0;h<c;){for(r=0;r<s&&h<c;++r,++h)d=u[r],p+=HEX_CHARS[d>>4&15]+HEX_CHARS[15&d]+HEX_CHARS[d>>12&15]+HEX_CHARS[d>>8&15]+HEX_CHARS[d>>20&15]+HEX_CHARS[d>>16&15]+HEX_CHARS[d>>28&15]+HEX_CHARS[d>>24&15];h%s==0&&(f$3(u),r=0)}return"0x"+p},f$3=e=>{var t,r,o,n,i,a,s,c,u,l,d,p,h,f,m,y,g,b,v,w,$,k,_,T,I,A,O,E,S,R,x,C,P,N,B,D,M,L,j,F,U,K,q,G,H,V,W,z,Z,Q,Y,X,J,ee,te,re,oe,ne,ie,ae,se,ce,ue;for(o=0;o<48;o+=2)n=e[0]^e[10]^e[20]^e[30]^e[40],i=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],l=e[6]^e[16]^e[26]^e[36]^e[46],d=e[7]^e[17]^e[27]^e[37]^e[47],t=(p=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),r=(h=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=n^(c<<1|u>>>31),r=i^(u<<1|c>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=a^(l<<1|d>>>31),r=s^(d<<1|l>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=c^(p<<1|h>>>31),r=u^(h<<1|p>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=l^(n<<1|i>>>31),r=d^(i<<1|n>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,f=e[0],m=e[1],V=e[11]<<4|e[10]>>>28,W=e[10]<<4|e[11]>>>28,E=e[20]<<3|e[21]>>>29,S=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,se=e[30]<<9|e[31]>>>23,K=e[40]<<18|e[41]>>>14,q=e[41]<<18|e[40]>>>14,N=e[2]<<1|e[3]>>>31,B=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,g=e[12]<<12|e[13]>>>20,z=e[22]<<10|e[23]>>>22,Z=e[23]<<10|e[22]>>>22,R=e[33]<<13|e[32]>>>19,x=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,ue=e[43]<<2|e[42]>>>30,ee=e[5]<<30|e[4]>>>2,te=e[4]<<30|e[5]>>>2,D=e[14]<<6|e[15]>>>26,M=e[15]<<6|e[14]>>>26,b=e[25]<<11|e[24]>>>21,v=e[24]<<11|e[25]>>>21,Q=e[34]<<15|e[35]>>>17,Y=e[35]<<15|e[34]>>>17,C=e[45]<<29|e[44]>>>3,P=e[44]<<29|e[45]>>>3,T=e[6]<<28|e[7]>>>4,I=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,oe=e[16]<<23|e[17]>>>9,L=e[26]<<25|e[27]>>>7,j=e[27]<<25|e[26]>>>7,w=e[36]<<21|e[37]>>>11,$=e[37]<<21|e[36]>>>11,X=e[47]<<24|e[46]>>>8,J=e[46]<<24|e[47]>>>8,G=e[8]<<27|e[9]>>>5,H=e[9]<<27|e[8]>>>5,A=e[18]<<20|e[19]>>>12,O=e[19]<<20|e[18]>>>12,ne=e[29]<<7|e[28]>>>25,ie=e[28]<<7|e[29]>>>25,F=e[38]<<8|e[39]>>>24,U=e[39]<<8|e[38]>>>24,k=e[48]<<14|e[49]>>>18,_=e[49]<<14|e[48]>>>18,e[0]=f^~y&b,e[1]=m^~g&v,e[10]=T^~A&E,e[11]=I^~O&S,e[20]=N^~D&L,e[21]=B^~M&j,e[30]=G^~V&z,e[31]=H^~W&Z,e[40]=ee^~re&ne,e[41]=te^~oe&ie,e[2]=y^~b&w,e[3]=g^~v&$,e[12]=A^~E&R,e[13]=O^~S&x,e[22]=D^~L&F,e[23]=M^~j&U,e[32]=V^~z&Q,e[33]=W^~Z&Y,e[42]=re^~ne&ae,e[43]=oe^~ie&se,e[4]=b^~w&k,e[5]=v^~$&_,e[14]=E^~R&C,e[15]=S^~x&P,e[24]=L^~F&K,e[25]=j^~U&q,e[34]=z^~Q&X,e[35]=Z^~Y&J,e[44]=ne^~ae&ce,e[45]=ie^~se&ue,e[6]=w^~k&f,e[7]=$^~_&m,e[16]=R^~C&T,e[17]=x^~P&I,e[26]=F^~K&N,e[27]=U^~q&B,e[36]=Q^~X&G,e[37]=Y^~J&H,e[46]=ae^~ce&ee,e[47]=se^~ue&te,e[8]=k^~f&y,e[9]=_^~m&g,e[18]=C^~T&A,e[19]=P^~I&O,e[28]=K^~N&D,e[29]=q^~B&M,e[38]=X^~G&V,e[39]=J^~H&W,e[48]=ce^~ee&re,e[49]=ue^~te&oe,e[0]^=RC[o],e[1]^=RC[o+1]},keccak=e=>t=>{var r;if("0x"===t.slice(0,2)){r=[];for(var o=2,n=t.length;o<n;o+=2)r.push(parseInt(t.slice(o,o+2),16))}else r=t;return update(Keccak$1(e),r)},keccak256$2=keccak(256),secp256k1=new elliptic.ec("secp256k1");function generate(){const e=secp256k1.genKeyPair();return{privateKey:decode$3(e.getPrivate("hex")),publicKey:decode$3(e.getPublic(!0,"hex"))}}async function generateAsync(){return Promise.resolve(generate())}function fromBytes(e){const t=secp256k1.keyFromPrivate(e);return{privateKey:decode$3(t.getPrivate("hex")),publicKey:decode$3(t.getPublic(!0,"hex"))}}function getFullPublicKey(e){return decode$3(secp256k1.keyFromPublic(e).getPublic(!1,"hex"))}function sign(e,t){const r=encode$4(t),o=decode$3(keccak256$2(`0x${r}`)),n=secp256k1.keyFromPrivate(e).sign(o),i=n.r.toArray("be",32),a=n.s.toArray("be",32),s=new Uint8Array(64);return s.set(i,0),s.set(a,32),s}function verify(e,t,r){const o=encode$4(t),n=decode$3(keccak256$2(`0x${o}`));return secp256k1.keyFromPublic(e).verify(n,{r:r.subarray(0,32),s:r.subarray(32,64)})}const ec=new elliptic.ec("secp256k1"),legacyDerPrefix="302d300706052b8104000a032200",legacyDerPrefixBytes=decode$3(legacyDerPrefix),derPrefix$1="3036301006072a8648ce3d020106052b8104000a032200",derPrefixBytes$1=decode$3(derPrefix$1);class EcdsaPublicKey extends Key{constructor(e){super(),this._keyData=e}get _type(){return"secp256k1"}static fromBytes(e){return 33===e.length?EcdsaPublicKey.fromBytesRaw(e):EcdsaPublicKey.fromBytesDer(e)}static fromBytesDer(e){let t=new Uint8Array;switch(e.length){case 47:t=e.subarray(legacyDerPrefixBytes.length);break;case 56:t=e.subarray(derPrefixBytes$1.length,derPrefixBytes$1.length+33);break;default:t=decode$3(ec.keyFromPublic(e.subarray(derPrefixBytes$1.length),"der").getPublic().encodeCompressed("hex"))}if(0==t.length)throw new BadKeyError("cannot decode ECDSA private key data from DER format");return new EcdsaPublicKey(t)}static fromBytesRaw(e){if(33!=e.length)throw new BadKeyError(`invalid public key length: ${e.length} bytes`);return new EcdsaPublicKey(e)}static fromString(e){return EcdsaPublicKey.fromBytes(decode$3(e))}verify(e,t){return verify(this._keyData,e,t)}toBytesDer(){const e=new Uint8Array(legacyDerPrefixBytes.length+this._keyData.length);return e.set(legacyDerPrefixBytes,0),e.set(this._keyData,legacyDerPrefixBytes.length),e}toBytesRaw(){return new Uint8Array(this._keyData.subarray())}toEthereumAddress(){const e=decode$3(keccak256$2(`0x${encode$4(getFullPublicKey(this.toBytesRaw()).subarray(1))}`));return encode$4(e.subarray(12))}equals(e){return arrayEqual(this._keyData,e._keyData)}}const derPrefix="3030020100300706052b8104000a04220420",derPrefixBytes=decode$3(derPrefix),derPrefix2="30540201010420",derPrefixBytes2=decode$3(derPrefix2);class EcdsaPrivateKey{constructor(e,t){this._keyPair=e,this._chainCode=null!=t?t:null}get _type(){return"secp256k1"}static generate(){return new EcdsaPrivateKey(generate())}static async generateAsync(){return new EcdsaPrivateKey(await generateAsync())}static fromBytes(e){return 32===e.length?EcdsaPrivateKey.fromBytesRaw(e):EcdsaPrivateKey.fromBytesDer(e)}static fromBytesDer(e){let t=new Uint8Array;return t=arrayStartsWith(e,derPrefixBytes)?e.subarray(derPrefixBytes.length):e.subarray(derPrefixBytes2.length,derPrefixBytes2.length+32),new EcdsaPrivateKey(fromBytes(t))}static fromBytesRaw(e){return new EcdsaPrivateKey(fromBytes(e))}static fromString(e){return EcdsaPrivateKey.fromBytes(decode$3(e))}static fromStringDer(e){return EcdsaPrivateKey.fromBytesDer(decode$3(e))}static fromStringRaw(e){return EcdsaPrivateKey.fromBytesRaw(decode$3(e))}static async fromSeed(e){const{keyData:t,chainCode:r}=await fromSeed$1(e);return new EcdsaPrivateKey(fromBytes(t),r)}get publicKey(){return new EcdsaPublicKey(this._keyPair.publicKey)}sign(e){return sign(this._keyPair.privateKey,e)}toBytesDer(){const e=new Uint8Array(derPrefixBytes.length+32),t=this._keyPair.privateKey.subarray(0,32),r=32-t.length,o=derPrefixBytes.length+r;return e.set(derPrefixBytes,0),e.set(t,o),e}toBytesRaw(){const e=this._keyPair.privateKey.subarray(-32),t=32-e.length,r=new Uint8Array(32);return r.set(e,t),r}}class PublicKey extends Key{constructor(e){super(),this._key=e}get _type(){return this._key._type}static fromBytes(e){let t;try{return new PublicKey(Ed25519PublicKey.fromBytes(e))}catch(r){t=null!=r&&null!=r.message?r.message:""}try{return new PublicKey(EcdsaPublicKey.fromBytes(e))}catch(r){t=null!=r&&null!=r.message?r.message:""}throw new BadKeyError(`public key cannot be decoded from bytes: ${t}`)}static fromBytesED25519(e){return new PublicKey(Ed25519PublicKey.fromBytes(e))}static fromBytesECDSA(e){return new PublicKey(EcdsaPublicKey.fromBytes(e))}static fromString(e){return PublicKey.fromBytes(decode$3(e))}static fromStringED25519(e){return PublicKey.fromBytesED25519(decode$3(e))}static fromStringECDSA(e){return PublicKey.fromBytesECDSA(decode$3(e))}verify(e,t){return this._key.verify(e,t)}verifyTransaction(e){console.log("Deprecated: use `@hashgraph/sdk`.PublicKey instead"),e._requireFrozen(),e.isFrozen()||e.freeze();for(const t of e._signedTransactions)if(null!=t.sigMap&&null!=t.sigMap.sigPair){let e=!1;for(const r of t.sigMap.sigPair){if(arrayEqual(r.pubKeyPrefix,this.toBytesRaw())){e=!0;const o=t.bodyBytes,n=null!=r.ed25519?r.ed25519:r.ECDSASecp256k1;if(!this.verify(o,n))return!1}}if(!e)return!1}return!0}toBytes(){return this._key instanceof Ed25519PublicKey?this.toBytesRaw():this.toBytesDer()}toBytesDer(){return this._key.toBytesDer()}toBytesRaw(){return this._key.toBytesRaw()}toString(){return this.toStringDer()}toStringDer(){return encode$4(this.toBytesDer())}toStringRaw(){return encode$4(this.toBytesRaw())}toEthereumAddress(){if(this._key instanceof EcdsaPublicKey)return this._key.toEthereumAddress();throw new Error("unsupported operation on Ed25519PublicKey")}equals(e){return(this._key instanceof Ed25519PublicKey&&e._key instanceof Ed25519PublicKey||this._key instanceof EcdsaPublicKey&&e._key instanceof EcdsaPublicKey)&&this._key.equals(e._key)}}var sparkMd5={exports:{}};!function(e,t){e.exports=function(e){var t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function r(e,t){var r=e[0],o=e[1],n=e[2],i=e[3];o=((o+=((n=((n+=((i=((i+=((r=((r+=(o&n|~o&i)+t[0]-680876936|0)<<7|r>>>25)+o|0)&o|~r&n)+t[1]-389564586|0)<<12|i>>>20)+r|0)&r|~i&o)+t[2]+606105819|0)<<17|n>>>15)+i|0)&i|~n&r)+t[3]-1044525330|0)<<22|o>>>10)+n|0,o=((o+=((n=((n+=((i=((i+=((r=((r+=(o&n|~o&i)+t[4]-176418897|0)<<7|r>>>25)+o|0)&o|~r&n)+t[5]+1200080426|0)<<12|i>>>20)+r|0)&r|~i&o)+t[6]-1473231341|0)<<17|n>>>15)+i|0)&i|~n&r)+t[7]-45705983|0)<<22|o>>>10)+n|0,o=((o+=((n=((n+=((i=((i+=((r=((r+=(o&n|~o&i)+t[8]+1770035416|0)<<7|r>>>25)+o|0)&o|~r&n)+t[9]-1958414417|0)<<12|i>>>20)+r|0)&r|~i&o)+t[10]-42063|0)<<17|n>>>15)+i|0)&i|~n&r)+t[11]-1990404162|0)<<22|o>>>10)+n|0,o=((o+=((n=((n+=((i=((i+=((r=((r+=(o&n|~o&i)+t[12]+1804603682|0)<<7|r>>>25)+o|0)&o|~r&n)+t[13]-40341101|0)<<12|i>>>20)+r|0)&r|~i&o)+t[14]-1502002290|0)<<17|n>>>15)+i|0)&i|~n&r)+t[15]+1236535329|0)<<22|o>>>10)+n|0,o=((o+=((n=((n+=((i=((i+=((r=((r+=(o&i|n&~i)+t[1]-165796510|0)<<5|r>>>27)+o|0)&n|o&~n)+t[6]-1069501632|0)<<9|i>>>23)+r|0)&o|r&~o)+t[11]+643717713|0)<<14|n>>>18)+i|0)&r|i&~r)+t[0]-373897302|0)<<20|o>>>12)+n|0,o=((o+=((n=((n+=((i=((i+=((r=((r+=(o&i|n&~i)+t[5]-701558691|0)<<5|r>>>27)+o|0)&n|o&~n)+t[10]+38016083|0)<<9|i>>>23)+r|0)&o|r&~o)+t[15]-660478335|0)<<14|n>>>18)+i|0)&r|i&~r)+t[4]-405537848|0)<<20|o>>>12)+n|0,o=((o+=((n=((n+=((i=((i+=((r=((r+=(o&i|n&~i)+t[9]+568446438|0)<<5|r>>>27)+o|0)&n|o&~n)+t[14]-1019803690|0)<<9|i>>>23)+r|0)&o|r&~o)+t[3]-187363961|0)<<14|n>>>18)+i|0)&r|i&~r)+t[8]+1163531501|0)<<20|o>>>12)+n|0,o=((o+=((n=((n+=((i=((i+=((r=((r+=(o&i|n&~i)+t[13]-1444681467|0)<<5|r>>>27)+o|0)&n|o&~n)+t[2]-51403784|0)<<9|i>>>23)+r|0)&o|r&~o)+t[7]+1735328473|0)<<14|n>>>18)+i|0)&r|i&~r)+t[12]-1926607734|0)<<20|o>>>12)+n|0,o=((o+=((n=((n+=((i=((i+=((r=((r+=(o^n^i)+t[5]-378558|0)<<4|r>>>28)+o|0)^o^n)+t[8]-2022574463|0)<<11|i>>>21)+r|0)^r^o)+t[11]+1839030562|0)<<16|n>>>16)+i|0)^i^r)+t[14]-35309556|0)<<23|o>>>9)+n|0,o=((o+=((n=((n+=((i=((i+=((r=((r+=(o^n^i)+t[1]-1530992060|0)<<4|r>>>28)+o|0)^o^n)+t[4]+1272893353|0)<<11|i>>>21)+r|0)^r^o)+t[7]-155497632|0)<<16|n>>>16)+i|0)^i^r)+t[10]-1094730640|0)<<23|o>>>9)+n|0,o=((o+=((n=((n+=((i=((i+=((r=((r+=(o^n^i)+t[13]+681279174|0)<<4|r>>>28)+o|0)^o^n)+t[0]-358537222|0)<<11|i>>>21)+r|0)^r^o)+t[3]-722521979|0)<<16|n>>>16)+i|0)^i^r)+t[6]+76029189|0)<<23|o>>>9)+n|0,o=((o+=((n=((n+=((i=((i+=((r=((r+=(o^n^i)+t[9]-640364487|0)<<4|r>>>28)+o|0)^o^n)+t[12]-421815835|0)<<11|i>>>21)+r|0)^r^o)+t[15]+530742520|0)<<16|n>>>16)+i|0)^i^r)+t[2]-995338651|0)<<23|o>>>9)+n|0,o=((o+=((i=((i+=(o^((r=((r+=(n^(o|~i))+t[0]-198630844|0)<<6|r>>>26)+o|0)|~n))+t[7]+1126891415|0)<<10|i>>>22)+r|0)^((n=((n+=(r^(i|~o))+t[14]-1416354905|0)<<15|n>>>17)+i|0)|~r))+t[5]-57434055|0)<<21|o>>>11)+n|0,o=((o+=((i=((i+=(o^((r=((r+=(n^(o|~i))+t[12]+1700485571|0)<<6|r>>>26)+o|0)|~n))+t[3]-1894986606|0)<<10|i>>>22)+r|0)^((n=((n+=(r^(i|~o))+t[10]-1051523|0)<<15|n>>>17)+i|0)|~r))+t[1]-2054922799|0)<<21|o>>>11)+n|0,o=((o+=((i=((i+=(o^((r=((r+=(n^(o|~i))+t[8]+1873313359|0)<<6|r>>>26)+o|0)|~n))+t[15]-30611744|0)<<10|i>>>22)+r|0)^((n=((n+=(r^(i|~o))+t[6]-1560198380|0)<<15|n>>>17)+i|0)|~r))+t[13]+1309151649|0)<<21|o>>>11)+n|0,o=((o+=((i=((i+=(o^((r=((r+=(n^(o|~i))+t[4]-145523070|0)<<6|r>>>26)+o|0)|~n))+t[11]-1120210379|0)<<10|i>>>22)+r|0)^((n=((n+=(r^(i|~o))+t[2]+718787259|0)<<15|n>>>17)+i|0)|~r))+t[9]-343485551|0)<<21|o>>>11)+n|0,e[0]=r+e[0]|0,e[1]=o+e[1]|0,e[2]=n+e[2]|0,e[3]=i+e[3]|0}function o(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return r}function n(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return r}function i(e){var t,n,i,a,s,c,u=e.length,l=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=u;t+=64)r(l,o(e.substring(t-64,t)));for(n=(e=e.substring(t-64)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<n;t+=1)i[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(r(l,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),c=parseInt(a[1],16)||0,i[14]=s,i[15]=c,r(l,i),l}function a(e){var t,o,i,a,s,c,u=e.length,l=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=u;t+=64)r(l,n(e.subarray(t-64,t)));for(o=(e=t-64<u?e.subarray(t-64):new Uint8Array(0)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<o;t+=1)i[t>>2]|=e[t]<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(r(l,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),c=parseInt(a[1],16)||0,i[14]=s,i[15]=c,r(l,i),l}function s(e){var r,o="";for(r=0;r<4;r+=1)o+=t[e>>8*r+4&15]+t[e>>8*r&15];return o}function c(e){var t;for(t=0;t<e.length;t+=1)e[t]=s(e[t]);return e.join("")}function u(e){return/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e))),e}function l(e,t){var r,o=e.length,n=new ArrayBuffer(o),i=new Uint8Array(n);for(r=0;r<o;r+=1)i[r]=e.charCodeAt(r);return t?i:n}function d(e){return String.fromCharCode.apply(null,new Uint8Array(e))}function p(e,t,r){var o=new Uint8Array(e.byteLength+t.byteLength);return o.set(new Uint8Array(e)),o.set(new Uint8Array(t),e.byteLength),o}function h(e){var t,r=[],o=e.length;for(t=0;t<o-1;t+=2)r.push(parseInt(e.substr(t,2),16));return String.fromCharCode.apply(String,r)}function f(){this.reset()}return c(i("hello")),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function t(e,t){return(e=0|e||0)<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(r,o){var n,i,a,s,c=this.byteLength,u=t(r,c),l=c;return o!==e&&(l=t(o,c)),u>l?new ArrayBuffer(0):(n=l-u,i=new ArrayBuffer(n),a=new Uint8Array(i),s=new Uint8Array(this,u,n),a.set(s),i)}}(),f.prototype.append=function(e){return this.appendBinary(u(e)),this},f.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,n=this._buff.length;for(t=64;t<=n;t+=64)r(this._hash,o(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},f.prototype.end=function(e){var t,r,o=this._buff,n=o.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<n;t+=1)i[t>>2]|=o.charCodeAt(t)<<(t%4<<3);return this._finish(i,n),r=c(this._hash),e&&(r=h(r)),this.reset(),r},f.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},f.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},f.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},f.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},f.prototype._finish=function(e,t){var o,n,i,a=t;if(e[a>>2]|=128<<(a%4<<3),a>55)for(r(this._hash,e),a=0;a<16;a+=1)e[a]=0;o=(o=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),n=parseInt(o[2],16),i=parseInt(o[1],16)||0,e[14]=n,e[15]=i,r(this._hash,e)},f.hash=function(e,t){return f.hashBinary(u(e),t)},f.hashBinary=function(e,t){var r=c(i(e));return t?h(r):r},f.ArrayBuffer=function(){this.reset()},f.ArrayBuffer.prototype.append=function(e){var t,o=p(this._buff.buffer,e),i=o.length;for(this._length+=e.byteLength,t=64;t<=i;t+=64)r(this._hash,n(o.subarray(t-64,t)));return this._buff=t-64<i?new Uint8Array(o.buffer.slice(t-64)):new Uint8Array(0),this},f.ArrayBuffer.prototype.end=function(e){var t,r,o=this._buff,n=o.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<n;t+=1)i[t>>2]|=o[t]<<(t%4<<3);return this._finish(i,n),r=c(this._hash),e&&(r=h(r)),this.reset(),r},f.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},f.ArrayBuffer.prototype.getState=function(){var e=f.prototype.getState.call(this);return e.buff=d(e.buff),e},f.ArrayBuffer.prototype.setState=function(e){return e.buff=l(e.buff,!0),f.prototype.setState.call(this,e)},f.ArrayBuffer.prototype.destroy=f.prototype.destroy,f.ArrayBuffer.prototype._finish=f.prototype._finish,f.ArrayBuffer.hash=function(e,t){var r=c(a(new Uint8Array(e)));return t?h(r):r},f}()}(sparkMd5);var sparkMd5Exports=sparkMd5.exports;const SparkMD5=getDefaultExportFromCjs$2(sparkMd5Exports),CipherAlgorithm={Aes128Ctr:"AES-128-CTR",Aes128Cbc:"AES-128-CBC"};async function createCipheriv(e,t,r,o){let n;switch(e.toUpperCase()){case CipherAlgorithm.Aes128Ctr:n={name:"AES-CTR",counter:r,length:128};break;case CipherAlgorithm.Aes128Cbc:n={name:"AES-CBC",iv:r};break;default:throw new Error("(BUG) non-exhaustive switch statement for CipherAlgorithm")}const i=await window.crypto.subtle.importKey("raw",t,n.name,!1,["encrypt"]);return new Uint8Array(await window.crypto.subtle.encrypt(n,i,o))}async function createDecipheriv(e,t,r,o){let n;switch(e.toUpperCase()){case CipherAlgorithm.Aes128Ctr:n={name:"AES-CTR",counter:r,length:128};break;case CipherAlgorithm.Aes128Cbc:n={name:"AES-CBC",iv:r};break;default:throw new Error("(BUG) non-exhaustive switch statement for CipherAlgorithm")}const i=await window.crypto.subtle.importKey("raw",t,n.name,!1,["decrypt"]);let a;try{a=await window.crypto.subtle.decrypt(n,i,o)}catch(s){const e=null!=s&&null!=s.message?s.message:"";throw new Error(`Unable to decrypt: ${e}`)}return new Uint8Array(a)}async function messageDigest(e,t){const r=encode$3(e),o=decode$3(t).slice(0,8),n=SparkMD5.ArrayBuffer.hash(Buffer$1.concat([Buffer$1.from(r),Buffer$1.from(o)]));return Promise.resolve(decode$3(n))}async function deriveKey(e,t,r,o,n){const i="string"==typeof t?encode$3(t):t,a="string"==typeof r?encode$3(r):r;try{const t=await window.crypto.subtle.importKey("raw",i,{name:"PBKDF2",hash:e},!1,["deriveBits"]);return new Uint8Array(await window.crypto.subtle.deriveBits({name:"PBKDF2",hash:e,salt:a,iterations:o},t,n<<3))}catch{throw new Error("(BUG) Non-Exhaustive switch statement for algorithms")}}const HMAC_SHA256="hmac-sha256";async function createKeystore(e,t){const r=262144,o=await bytesAsync(32),n=await deriveKey(HashAlgorithm.Sha256,t,o,r,32),i=await bytesAsync(16),a=await createCipheriv(CipherAlgorithm.Aes128Ctr,n.slice(0,16),i,e),s=await hash(HashAlgorithm.Sha384,n.slice(16),a),c={version:1,crypto:{ciphertext:encode$4(a),cipherparams:{iv:encode$4(i)},cipher:CipherAlgorithm.Aes128Ctr,kdf:"pbkdf2",kdfparams:{dkLen:32,salt:encode$4(o),c:r,prf:HMAC_SHA256},mac:encode$4(s)}};return encode$3(JSON.stringify(c))}async function loadKeystore(e,t){const r=JSON.parse(decode$2(e));if(1!==r.version)throw new BadKeyError(`unsupported keystore version: ${r.version}`);const{ciphertext:o,cipherparams:{iv:n},cipher:i,kdf:a,kdfparams:{dkLen:s,salt:c,c:u,prf:l},mac:d}=r.crypto;if("pbkdf2"!==a)throw new BadKeyError(`unsupported key derivation function:" + ${a}`);if(l!==HMAC_SHA256)throw new BadKeyError(`unsupported key derivation hash function: ${l}`);const p=decode$3(c),h=decode$3(n),f=decode$3(o),m=await deriveKey(HashAlgorithm.Sha256,t,p,u,s),y=decode$3(d),g=await hash(HashAlgorithm.Sha384,m.slice(16),f);if(!y.every(((e,t)=>e===g[t])))throw new BadKeyError("HMAC mismatch; passphrase is incorrect");return createDecipheriv(i,m.slice(0,16),h,f)}function decode$1(e){return decodeIncremental(e)[0]}function decodeIncremental(e){const[t,r]=decodeLength(e.subarray(1)),o=r.subarray(0,t),n=r.subarray(t);switch(e[0]){case 2:return[{int:decodeInt(o)},n];case 4:return[{bytes:o},n];case 5:return[{},n];case 6:return[{ident:decodeObjectIdent(o)},n];case 48:return[{seq:decodeSeq(o)},n];default:throw new Error(`unsupported DER type tag: ${e[0]}`)}}function decodeSeq(e){let t=e;const r=[];for(;0!==t.length;){const[e,o]=decodeIncremental(t);r.push(e),t=o}return r}function decodeObjectIdent(e){const t=[Math.floor(e[0]/40),e[0]%40];let r=0;for(const o of e.subarray(1))r*=128,o<128?(r+=o,t.push(r),r=0):r+=127&o;return t.join(".")}function decodeLength(e){if(e[0]<128)return[e[0],e.subarray(1)];const t=e[0]-128,r=e.subarray(1,t+1),o=e.subarray(t+1);return[decodeInt(r),o]}function decodeInt(e){const t=e.length;if(1===t)return e[0];let r=new DataView(e.buffer,e.byteOffset,e.byteLength);if(2===t)return r.getUint16(0,!1);if(3===t){const t=Uint8Array.of(0,...e);r=new DataView(t.buffer,t.byteOffset,t.byteLength)}if(t>4)throw new Error(`unsupported DER integer length of ${t} bytes`);return r.getUint32(0,!1)}class AlgorithmIdentifier{constructor(e){if(!("seq"in e&&e.seq.length>=1&&"ident"in e.seq[0]))throw new Error(`error parsing AlgorithmIdentifier from ${JSON.stringify(e)}`);this.algIdent=e.seq[0].ident,this.parameters=e.seq[1]}toString(){return JSON.stringify(this)}}class PBES2Params{constructor(e){if(!("seq"in e)||2!==e.seq.length)throw new Error(`error parsing PBES2Params from ${JSON.stringify(e)}`);this.kdf=new AlgorithmIdentifier(e.seq[0]),this.encScheme=new AlgorithmIdentifier(e.seq[1])}}class PBKDF2Params{constructor(e){if("seq"in e&&e.seq.length>=2&&"bytes"in e.seq[0]&&"int"in e.seq[1]&&(this.salt=e.seq[0].bytes,this.iterCount=e.seq[1].int,e.seq.length>2))return"seq"in e.seq[2]?void(this.prf=new AlgorithmIdentifier(e.seq[2])):("int"in e.seq[2]&&(this.keyLength=e.seq[2].int),void(4===e.seq.length&&(this.prf=new AlgorithmIdentifier(e.seq[3]))));throw new Error(`error parsing PBKDF2Params from ${JSON.stringify(e)}`)}}class PrivateKeyInfo{constructor(e){if(!("seq"in e)||3!==e.seq.length)throw new Error(`error parsing PrivateKeyInfo from ${JSON.stringify(e)}`);if(!("int"in e.seq[0])||0!==e.seq[0].int)throw new Error(`expected version = 0, got ${JSON.stringify(e.seq[0])}`);if(this.version=0,this.algId=new AlgorithmIdentifier(e.seq[1]),!("bytes"in e.seq[2]))throw new Error(`expected octet string as 3rd element, got ${JSON.stringify(e.seq[2])}`);this.privateKey=e.seq[2].bytes}static parse(e){return new PrivateKeyInfo(decode$1(e))}}class EncryptedPrivateKeyInfo{constructor(e){if("seq"in e&&2===e.seq.length&&"bytes"in e.seq[1])return this.algId=new AlgorithmIdentifier(e.seq[0]),void(this.data=e.seq[1].bytes);throw new Error(`error parsing EncryptedPrivateKeyInfo from ${JSON.stringify(e)}`)}static parse(e){return new EncryptedPrivateKeyInfo(decode$1(e))}async decrypt(e){if("1.2.840.113549.1.5.13"!==this.algId.algIdent||!this.algId.parameters)throw new Error(`unsupported key encryption algorithm: ${this.algId.toString()}`);const t=new PBES2Params(this.algId.parameters);if("1.2.840.113549.1.5.12"!==t.kdf.algIdent||!t.kdf.parameters)throw new Error(`unsupported key derivation function: ${t.kdf.toString()}`);const r=new PBKDF2Params(t.kdf.parameters);if(!r.prf)throw new Error("unsupported PRF HMAC-SHA-1");if("1.2.840.113549.2.9"!==r.prf.algIdent)throw new Error(`unsupported PRF ${r.prf.toString()}`);if("2.16.840.1.101.3.4.1.2"!==t.encScheme.algIdent)throw new Error(`unsupported encryption scheme: ${t.encScheme.toString()}`);if(!t.encScheme.parameters||!("bytes"in t.encScheme.parameters))throw new Error(`expected IV as bytes for AES-128-CBC, got: ${JSON.stringify(t.encScheme.parameters)}`);const o=r.keyLength||16,n=t.encScheme.parameters.bytes,i=await deriveKey(HashAlgorithm.Sha256,e,r.salt,r.iterCount,o),a=await createDecipheriv(CipherAlgorithm.Aes128Cbc,i,n,this.data);return PrivateKeyInfo.parse(a)}}function decode(e){return Uint8Array.from(Buffer$1.from(e,"base64"))}
31
+ var hasRequiredSafeBuffer$1,hasRequiredBrowser$b;function requireSafeBuffer$1(){return hasRequiredSafeBuffer$1||(hasRequiredSafeBuffer$1=1,function(e,t){var r=require$$0$2,o=r.Buffer;function n(e,t){for(var r in e)t[r]=e[r]}function i(e,t,r){return o(e,t,r)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(n(r,t),t.Buffer=i),i.prototype=Object.create(o.prototype),n(o,i),i.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,r)},i.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=o(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}}(safeBuffer$1,safeBuffer$1.exports)),safeBuffer$1.exports}function requireBrowser$b(){if(hasRequiredBrowser$b)return browser$d.exports;hasRequiredBrowser$b=1;var e=65536,t=4294967295;var r=requireSafeBuffer$1().Buffer,o=commonjsGlobal.crypto||commonjsGlobal.msCrypto;return o&&o.getRandomValues?browser$d.exports=function(n,i){if(n>t)throw new RangeError("requested too many random bytes");var a=r.allocUnsafe(n);if(n>0)if(n>e)for(var s=0;s<n;s+=e)o.getRandomValues(a.slice(s,s+e));else o.getRandomValues(a);if("function"==typeof i)return process$1$1.nextTick((function(){i(null,a)}));return a}:browser$d.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")},browser$d.exports}var inherits_browser={exports:{}};"function"==typeof Object.create?inherits_browser.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:inherits_browser.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}};var inherits_browserExports=inherits_browser.exports,events={exports:{}},hasRequiredEvents,streamBrowser$1,hasRequiredStreamBrowser$1;function requireEvents(){if(hasRequiredEvents)return events.exports;hasRequiredEvents=1;var e,t="object"==typeof Reflect?Reflect:null,r=t&&"function"==typeof t.apply?t.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};e=t&&"function"==typeof t.ownKeys?t.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function n(){n.init.call(this)}events.exports=n,events.exports.once=function(e,t){return new Promise((function(r,o){function n(r){e.removeListener(t,i),o(r)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",n),r([].slice.call(arguments))}f(e,t,i,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&f(e,"error",t,r)}(e,n,{once:!0})}))},n.EventEmitter=n,n.prototype._events=void 0,n.prototype._eventsCount=0,n.prototype._maxListeners=void 0;var i=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function s(e){return void 0===e._maxListeners?n.defaultMaxListeners:e._maxListeners}function c(e,t,r,o){var n,i,c,u;if(a(r),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),c=i[t]),void 0===c)c=i[t]=r,++e._eventsCount;else if("function"==typeof c?c=i[t]=o?[r,c]:[c,r]:o?c.unshift(r):c.push(r),(n=s(e))>0&&c.length>n&&!c.warned){c.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=c.length,u=l,console&&console.warn&&console.warn(u)}return e}function u(){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 l(e,t,r){var o={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=u.bind(o);return n.listener=r,o.wrapFn=n,n}function d(e,t,r){var o=e._events;if(void 0===o)return[];var n=o[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):h(n,n.length)}function p(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 h(e,t){for(var r=new Array(t),o=0;o<t;++o)r[o]=e[o];return r}function f(e,t,r,o){if("function"==typeof e.on)o.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(i){o.once&&e.removeEventListener(t,n),r(i)}))}}return Object.defineProperty(n,"defaultMaxListeners",{enumerable:!0,get:function(){return i},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");i=e}}),n.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},n.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(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},n.prototype.getMaxListeners=function(){return s(this)},n.prototype.emit=function(e){for(var t=[],o=1;o<arguments.length;o++)t.push(arguments[o]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){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 c=i[e];if(void 0===c)return!1;if("function"==typeof c)r(c,this,t);else{var u=c.length,l=h(c,u);for(o=0;o<u;++o)r(l[o],this,t)}return!0},n.prototype.addListener=function(e,t){return c(this,e,t,!1)},n.prototype.on=n.prototype.addListener,n.prototype.prependListener=function(e,t){return c(this,e,t,!0)},n.prototype.once=function(e,t){return a(t),this.on(e,l(this,e,t)),this},n.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,l(this,e,t)),this},n.prototype.removeListener=function(e,t){var r,o,n,i,s;if(a(t),void 0===(o=this._events))return this;if(void 0===(r=o[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete o[e],o.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,i=r.length-1;i>=0;i--)if(r[i]===t||r[i].listener===t){s=r[i].listener,n=i;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&&(o[e]=r[0]),void 0!==o.removeListener&&this.emit("removeListener",e,s||t)}return this},n.prototype.off=n.prototype.removeListener,n.prototype.removeAllListeners=function(e){var t,r,o;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,i=Object.keys(r);for(o=0;o<i.length;++o)"removeListener"!==(n=i[o])&&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(o=t.length-1;o>=0;o--)this.removeListener(e,t[o]);return this},n.prototype.listeners=function(e){return d(this,e,!0)},n.prototype.rawListeners=function(e){return d(this,e,!1)},n.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},n.prototype.listenerCount=p,n.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]},events.exports}function requireStreamBrowser$1(){return hasRequiredStreamBrowser$1?streamBrowser$1:(hasRequiredStreamBrowser$1=1,streamBrowser$1=requireEvents().EventEmitter)}var util$3={},types={},shams$1,hasRequiredShams$1,shams,hasRequiredShams,esObjectAtoms,hasRequiredEsObjectAtoms,esErrors,hasRequiredEsErrors,_eval,hasRequired_eval,range,hasRequiredRange,ref,hasRequiredRef,syntax,hasRequiredSyntax,type,hasRequiredType,uri,hasRequiredUri,abs,hasRequiredAbs,floor,hasRequiredFloor,max,hasRequiredMax,min,hasRequiredMin,pow,hasRequiredPow,round,hasRequiredRound,_isNaN,hasRequired_isNaN,sign$2,hasRequiredSign$1,gOPD,hasRequiredGOPD,gopd,hasRequiredGopd,esDefineProperty,hasRequiredEsDefineProperty,hasSymbols,hasRequiredHasSymbols,Reflect_getPrototypeOf,hasRequiredReflect_getPrototypeOf,Object_getPrototypeOf,hasRequiredObject_getPrototypeOf,implementation,hasRequiredImplementation,functionBind,hasRequiredFunctionBind,functionCall,hasRequiredFunctionCall,functionApply,hasRequiredFunctionApply,reflectApply,hasRequiredReflectApply,actualApply,hasRequiredActualApply,callBindApplyHelpers,hasRequiredCallBindApplyHelpers,get,hasRequiredGet,getProto,hasRequiredGetProto,hasown,hasRequiredHasown,getIntrinsic,hasRequiredGetIntrinsic,callBound,hasRequiredCallBound,isArguments,hasRequiredIsArguments,isRegex,hasRequiredIsRegex,safeRegexTest,hasRequiredSafeRegexTest,isGeneratorFunction,hasRequiredIsGeneratorFunction,isCallable,hasRequiredIsCallable,forEach$2,hasRequiredForEach,possibleTypedArrayNames,hasRequiredPossibleTypedArrayNames,availableTypedArrays,hasRequiredAvailableTypedArrays;function requireShams$1(){return hasRequiredShams$1?shams$1:(hasRequiredShams$1=1,shams$1=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 o 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 i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0})}function requireShams(){if(hasRequiredShams)return shams;hasRequiredShams=1;var e=requireShams$1();return shams=function(){return e()&&!!Symbol.toStringTag}}function requireEsObjectAtoms(){return hasRequiredEsObjectAtoms?esObjectAtoms:(hasRequiredEsObjectAtoms=1,esObjectAtoms=Object)}function requireEsErrors(){return hasRequiredEsErrors?esErrors:(hasRequiredEsErrors=1,esErrors=Error)}function require_eval(){return hasRequired_eval?_eval:(hasRequired_eval=1,_eval=EvalError)}function requireRange(){return hasRequiredRange?range:(hasRequiredRange=1,range=RangeError)}function requireRef(){return hasRequiredRef?ref:(hasRequiredRef=1,ref=ReferenceError)}function requireSyntax(){return hasRequiredSyntax?syntax:(hasRequiredSyntax=1,syntax=SyntaxError)}function requireType(){return hasRequiredType?type:(hasRequiredType=1,type=TypeError)}function requireUri(){return hasRequiredUri?uri:(hasRequiredUri=1,uri=URIError)}function requireAbs(){return hasRequiredAbs?abs:(hasRequiredAbs=1,abs=Math.abs)}function requireFloor(){return hasRequiredFloor?floor:(hasRequiredFloor=1,floor=Math.floor)}function requireMax(){return hasRequiredMax?max:(hasRequiredMax=1,max=Math.max)}function requireMin(){return hasRequiredMin?min:(hasRequiredMin=1,min=Math.min)}function requirePow(){return hasRequiredPow?pow:(hasRequiredPow=1,pow=Math.pow)}function requireRound(){return hasRequiredRound?round:(hasRequiredRound=1,round=Math.round)}function require_isNaN(){return hasRequired_isNaN?_isNaN:(hasRequired_isNaN=1,_isNaN=Number.isNaN||function(e){return e!=e})}function requireSign$1(){if(hasRequiredSign$1)return sign$2;hasRequiredSign$1=1;var e=require_isNaN();return sign$2=function(t){return e(t)||0===t?t:t<0?-1:1}}function requireGOPD(){return hasRequiredGOPD?gOPD:(hasRequiredGOPD=1,gOPD=Object.getOwnPropertyDescriptor)}function requireGopd(){if(hasRequiredGopd)return gopd;hasRequiredGopd=1;var e=requireGOPD();if(e)try{e([],"length")}catch(t){e=null}return gopd=e}function requireEsDefineProperty(){if(hasRequiredEsDefineProperty)return esDefineProperty;hasRequiredEsDefineProperty=1;var e=Object.defineProperty||!1;if(e)try{e({},"a",{value:1})}catch(t){e=!1}return esDefineProperty=e}function requireHasSymbols(){if(hasRequiredHasSymbols)return hasSymbols;hasRequiredHasSymbols=1;var e="undefined"!=typeof Symbol&&Symbol,t=requireShams$1();return hasSymbols=function(){return"function"==typeof e&&("function"==typeof Symbol&&("symbol"==typeof e("foo")&&("symbol"==typeof Symbol("bar")&&t())))}}function requireReflect_getPrototypeOf(){return hasRequiredReflect_getPrototypeOf?Reflect_getPrototypeOf:(hasRequiredReflect_getPrototypeOf=1,Reflect_getPrototypeOf="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null)}function requireObject_getPrototypeOf(){if(hasRequiredObject_getPrototypeOf)return Object_getPrototypeOf;hasRequiredObject_getPrototypeOf=1;var e=requireEsObjectAtoms();return Object_getPrototypeOf=e.getPrototypeOf||null}function requireImplementation(){if(hasRequiredImplementation)return implementation;hasRequiredImplementation=1;var e=Object.prototype.toString,t=Math.max,r=function(e,t){for(var r=[],o=0;o<e.length;o+=1)r[o]=e[o];for(var n=0;n<t.length;n+=1)r[n+e.length]=t[n];return r};return implementation=function(o){var n=this;if("function"!=typeof n||"[object Function]"!==e.apply(n))throw new TypeError("Function.prototype.bind called on incompatible "+n);for(var i,a=function(e,t){for(var r=[],o=t,n=0;o<e.length;o+=1,n+=1)r[n]=e[o];return r}(arguments,1),s=t(0,n.length-a.length),c=[],u=0;u<s;u++)c[u]="$"+u;if(i=Function("binder","return function ("+function(e,t){for(var r="",o=0;o<e.length;o+=1)r+=e[o],o+1<e.length&&(r+=t);return r}(c,",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof i){var e=n.apply(this,r(a,arguments));return Object(e)===e?e:this}return n.apply(o,r(a,arguments))})),n.prototype){var l=function(){};l.prototype=n.prototype,i.prototype=new l,l.prototype=null}return i},implementation}function requireFunctionBind(){if(hasRequiredFunctionBind)return functionBind;hasRequiredFunctionBind=1;var e=requireImplementation();return functionBind=Function.prototype.bind||e}function requireFunctionCall(){return hasRequiredFunctionCall?functionCall:(hasRequiredFunctionCall=1,functionCall=Function.prototype.call)}function requireFunctionApply(){return hasRequiredFunctionApply?functionApply:(hasRequiredFunctionApply=1,functionApply=Function.prototype.apply)}function requireReflectApply(){return hasRequiredReflectApply?reflectApply:(hasRequiredReflectApply=1,reflectApply="undefined"!=typeof Reflect&&Reflect&&Reflect.apply)}function requireActualApply(){if(hasRequiredActualApply)return actualApply;hasRequiredActualApply=1;var e=requireFunctionBind(),t=requireFunctionApply(),r=requireFunctionCall(),o=requireReflectApply();return actualApply=o||e.call(r,t)}function requireCallBindApplyHelpers(){if(hasRequiredCallBindApplyHelpers)return callBindApplyHelpers;hasRequiredCallBindApplyHelpers=1;var e=requireFunctionBind(),t=requireType(),r=requireFunctionCall(),o=requireActualApply();return callBindApplyHelpers=function(n){if(n.length<1||"function"!=typeof n[0])throw new t("a function is required");return o(e,r,n)}}function requireGet(){if(hasRequiredGet)return get;hasRequiredGet=1;var e,t=requireCallBindApplyHelpers(),r=requireGopd();try{e=[].__proto__===Array.prototype}catch(a){if(!a||"object"!=typeof a||!("code"in a)||"ERR_PROTO_ACCESS"!==a.code)throw a}var o=!!e&&r&&r(Object.prototype,"__proto__"),n=Object,i=n.getPrototypeOf;return get=o&&"function"==typeof o.get?t([o.get]):"function"==typeof i&&function(e){return i(null==e?e:n(e))}}function requireGetProto(){if(hasRequiredGetProto)return getProto;hasRequiredGetProto=1;var e=requireReflect_getPrototypeOf(),t=requireObject_getPrototypeOf(),r=requireGet();return getProto=e?function(t){return e(t)}:t?function(e){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new TypeError("getProto: not an object");return t(e)}:r?function(e){return r(e)}:null}function requireHasown(){if(hasRequiredHasown)return hasown;hasRequiredHasown=1;var e=Function.prototype.call,t=Object.prototype.hasOwnProperty,r=requireFunctionBind();return hasown=r.call(e,t)}function requireGetIntrinsic(){if(hasRequiredGetIntrinsic)return getIntrinsic;var e;hasRequiredGetIntrinsic=1;var t=requireEsObjectAtoms(),r=requireEsErrors(),o=require_eval(),n=requireRange(),i=requireRef(),a=requireSyntax(),s=requireType(),c=requireUri(),u=requireAbs(),l=requireFloor(),d=requireMax(),p=requireMin(),h=requirePow(),f=requireRound(),m=requireSign$1(),y=Function,g=function(e){try{return y('"use strict"; return ('+e+").constructor;")()}catch(t){}},b=requireGopd(),v=requireEsDefineProperty(),w=function(){throw new s},$=b?function(){try{return w}catch(e){try{return b(arguments,"callee").get}catch(t){return w}}}():w,k=requireHasSymbols()(),_=requireGetProto(),T=requireObject_getPrototypeOf(),I=requireReflect_getPrototypeOf(),A=requireFunctionApply(),O=requireFunctionCall(),E={},S="undefined"!=typeof Uint8Array&&_?_(Uint8Array):e,R={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?e:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?e:ArrayBuffer,"%ArrayIteratorPrototype%":k&&_?_([][Symbol.iterator]()):e,"%AsyncFromSyncIteratorPrototype%":e,"%AsyncFunction%":E,"%AsyncGenerator%":E,"%AsyncGeneratorFunction%":E,"%AsyncIteratorPrototype%":E,"%Atomics%":"undefined"==typeof Atomics?e:Atomics,"%BigInt%":"undefined"==typeof BigInt?e:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?e:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?e:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?e:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":r,"%eval%":eval,"%EvalError%":o,"%Float16Array%":"undefined"==typeof Float16Array?e:Float16Array,"%Float32Array%":"undefined"==typeof Float32Array?e:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?e:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?e:FinalizationRegistry,"%Function%":y,"%GeneratorFunction%":E,"%Int8Array%":"undefined"==typeof Int8Array?e:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?e:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?e:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":k&&_?_(_([][Symbol.iterator]())):e,"%JSON%":"object"==typeof JSON?JSON:e,"%Map%":"undefined"==typeof Map?e:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&k&&_?_((new Map)[Symbol.iterator]()):e,"%Math%":Math,"%Number%":Number,"%Object%":t,"%Object.getOwnPropertyDescriptor%":b,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?e:Promise,"%Proxy%":"undefined"==typeof Proxy?e:Proxy,"%RangeError%":n,"%ReferenceError%":i,"%Reflect%":"undefined"==typeof Reflect?e:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?e:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&k&&_?_((new Set)[Symbol.iterator]()):e,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?e:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":k&&_?_(""[Symbol.iterator]()):e,"%Symbol%":k?Symbol:e,"%SyntaxError%":a,"%ThrowTypeError%":$,"%TypedArray%":S,"%TypeError%":s,"%Uint8Array%":"undefined"==typeof Uint8Array?e:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?e:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?e:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?e:Uint32Array,"%URIError%":c,"%WeakMap%":"undefined"==typeof WeakMap?e:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?e:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?e:WeakSet,"%Function.prototype.call%":O,"%Function.prototype.apply%":A,"%Object.defineProperty%":v,"%Object.getPrototypeOf%":T,"%Math.abs%":u,"%Math.floor%":l,"%Math.max%":d,"%Math.min%":p,"%Math.pow%":h,"%Math.round%":f,"%Math.sign%":m,"%Reflect.getPrototypeOf%":I};if(_)try{null.error}catch(G){var x=_(_(G));R["%Error.prototype%"]=x}var C=function e(t){var r;if("%AsyncFunction%"===t)r=g("async function () {}");else if("%GeneratorFunction%"===t)r=g("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=g("async function* () {}");else if("%AsyncGenerator%"===t){var o=e("%AsyncGeneratorFunction%");o&&(r=o.prototype)}else if("%AsyncIteratorPrototype%"===t){var n=e("%AsyncGenerator%");n&&_&&(r=_(n.prototype))}return R[t]=r,r},P={__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"]},N=requireFunctionBind(),B=requireHasown(),D=N.call(O,Array.prototype.concat),M=N.call(A,Array.prototype.splice),L=N.call(O,String.prototype.replace),j=N.call(O,String.prototype.slice),F=N.call(O,RegExp.prototype.exec),U=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,K=/\\(\\)?/g,q=function(e,t){var r,o=e;if(B(P,o)&&(o="%"+(r=P[o])[0]+"%"),B(R,o)){var n=R[o];if(n===E&&(n=C(o)),void 0===n&&!t)throw new s("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:o,value:n}}throw new a("intrinsic "+e+" does not exist!")};return getIntrinsic=function(e,t){if("string"!=typeof e||0===e.length)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new s('"allowMissing" argument must be a boolean');if(null===F(/^%?[^%]*%?$/,e))throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(e){var t=j(e,0,1),r=j(e,-1);if("%"===t&&"%"!==r)throw new a("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new a("invalid intrinsic syntax, expected opening `%`");var o=[];return L(e,U,(function(e,t,r,n){o[o.length]=r?L(n,K,"$1"):t||e})),o}(e),o=r.length>0?r[0]:"",n=q("%"+o+"%",t),i=n.name,c=n.value,u=!1,l=n.alias;l&&(o=l[0],M(r,D([0,1],l)));for(var d=1,p=!0;d<r.length;d+=1){var h=r[d],f=j(h,0,1),m=j(h,-1);if(('"'===f||"'"===f||"`"===f||'"'===m||"'"===m||"`"===m)&&f!==m)throw new a("property names with quotes must have matching quotes");if("constructor"!==h&&p||(u=!0),B(R,i="%"+(o+="."+h)+"%"))c=R[i];else if(null!=c){if(!(h in c)){if(!t)throw new s("base intrinsic for "+e+" exists, but the property is not available.");return}if(b&&d+1>=r.length){var y=b(c,h);c=(p=!!y)&&"get"in y&&!("originalValue"in y.get)?y.get:c[h]}else p=B(c,h),c=c[h];p&&!u&&(R[i]=c)}}return c},getIntrinsic}function requireCallBound(){if(hasRequiredCallBound)return callBound;hasRequiredCallBound=1;var e=requireGetIntrinsic(),t=requireCallBindApplyHelpers(),r=t([e("%String.prototype.indexOf%")]);return callBound=function(o,n){var i=e(o,!!n);return"function"==typeof i&&r(o,".prototype.")>-1?t([i]):i}}function requireIsArguments(){if(hasRequiredIsArguments)return isArguments;hasRequiredIsArguments=1;var e=requireShams()(),t=requireCallBound()("Object.prototype.toString"),r=function(r){return!(e&&r&&"object"==typeof r&&Symbol.toStringTag in r)&&"[object Arguments]"===t(r)},o=function(e){return!!r(e)||null!==e&&"object"==typeof e&&"length"in e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==t(e)&&"callee"in e&&"[object Function]"===t(e.callee)},n=function(){return r(arguments)}();return r.isLegacyArguments=o,isArguments=n?r:o}function requireIsRegex(){if(hasRequiredIsRegex)return isRegex;hasRequiredIsRegex=1;var e,t=requireCallBound(),r=requireShams()(),o=requireHasown(),n=requireGopd();if(r){var i=t("RegExp.prototype.exec"),a={},s=function(){throw a},c={toString:s,valueOf:s};"symbol"==typeof Symbol.toPrimitive&&(c[Symbol.toPrimitive]=s),e=function(e){if(!e||"object"!=typeof e)return!1;var t=n(e,"lastIndex");if(!(t&&o(t,"value")))return!1;try{i(e,c)}catch(r){return r===a}}}else{var u=t("Object.prototype.toString");e=function(e){return!(!e||"object"!=typeof e&&"function"!=typeof e)&&"[object RegExp]"===u(e)}}return isRegex=e}function requireSafeRegexTest(){if(hasRequiredSafeRegexTest)return safeRegexTest;hasRequiredSafeRegexTest=1;var e=requireCallBound(),t=requireIsRegex(),r=e("RegExp.prototype.exec"),o=requireType();return safeRegexTest=function(e){if(!t(e))throw new o("`regex` must be a RegExp");return function(t){return null!==r(e,t)}}}function requireIsGeneratorFunction(){if(hasRequiredIsGeneratorFunction)return isGeneratorFunction;hasRequiredIsGeneratorFunction=1;var e,t=requireCallBound(),r=requireSafeRegexTest()(/^\s*(?:function)?\*/),o=requireShams()(),n=requireGetProto(),i=t("Object.prototype.toString"),a=t("Function.prototype.toString");return isGeneratorFunction=function(t){if("function"!=typeof t)return!1;if(r(a(t)))return!0;if(!o)return"[object GeneratorFunction]"===i(t);if(!n)return!1;if(void 0===e){var s=function(){if(!o)return!1;try{return Function("return function*() {}")()}catch(e){}}();e=!!s&&n(s)}return n(t)===e}}function requireIsCallable(){if(hasRequiredIsCallable)return isCallable;hasRequiredIsCallable=1;var e,t,r=Function.prototype.toString,o="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof o&&"function"==typeof Object.defineProperty)try{e=Object.defineProperty({},"length",{get:function(){throw t}}),t={},o((function(){throw 42}),null,e)}catch(p){p!==t&&(o=null)}else o=null;var n=/^\s*class\b/,i=function(e){try{var t=r.call(e);return n.test(t)}catch(o){return!1}},a=function(e){try{return!i(e)&&(r.call(e),!0)}catch(t){return!1}},s=Object.prototype.toString,c="function"==typeof Symbol&&!!Symbol.toStringTag,u=!(0 in[,]),l=function(){return!1};if("object"==typeof document){var d=document.all;s.call(d)===s.call(document.all)&&(l=function(e){if((u||!e)&&(void 0===e||"object"==typeof e))try{var t=s.call(e);return("[object HTMLAllCollection]"===t||"[object HTML document.all class]"===t||"[object HTMLCollection]"===t||"[object Object]"===t)&&null==e("")}catch(r){}return!1})}return isCallable=o?function(r){if(l(r))return!0;if(!r)return!1;if("function"!=typeof r&&"object"!=typeof r)return!1;try{o(r,null,e)}catch(n){if(n!==t)return!1}return!i(r)&&a(r)}:function(e){if(l(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(c)return a(e);if(i(e))return!1;var t=s.call(e);return!("[object Function]"!==t&&"[object GeneratorFunction]"!==t&&!/^\[object HTML/.test(t))&&a(e)}}function requireForEach(){if(hasRequiredForEach)return forEach$2;hasRequiredForEach=1;var e=requireIsCallable(),t=Object.prototype.toString,r=Object.prototype.hasOwnProperty;return forEach$2=function(o,n,i){if(!e(n))throw new TypeError("iterator must be a function");var a,s;arguments.length>=3&&(a=i),s=o,"[object Array]"===t.call(s)?function(e,t,o){for(var n=0,i=e.length;n<i;n++)r.call(e,n)&&(null==o?t(e[n],n,e):t.call(o,e[n],n,e))}(o,n,a):"string"==typeof o?function(e,t,r){for(var o=0,n=e.length;o<n;o++)null==r?t(e.charAt(o),o,e):t.call(r,e.charAt(o),o,e)}(o,n,a):function(e,t,o){for(var n in e)r.call(e,n)&&(null==o?t(e[n],n,e):t.call(o,e[n],n,e))}(o,n,a)},forEach$2}function requirePossibleTypedArrayNames(){return hasRequiredPossibleTypedArrayNames?possibleTypedArrayNames:(hasRequiredPossibleTypedArrayNames=1,possibleTypedArrayNames=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"])}function requireAvailableTypedArrays(){if(hasRequiredAvailableTypedArrays)return availableTypedArrays;hasRequiredAvailableTypedArrays=1;var e=requirePossibleTypedArrayNames(),t="undefined"==typeof globalThis?commonjsGlobal:globalThis;return availableTypedArrays=function(){for(var r=[],o=0;o<e.length;o++)"function"==typeof t[e[o]]&&(r[r.length]=e[o]);return r}}var callBind={exports:{}},defineDataProperty,hasRequiredDefineDataProperty,hasPropertyDescriptors_1,hasRequiredHasPropertyDescriptors,setFunctionLength,hasRequiredSetFunctionLength,applyBind,hasRequiredApplyBind,hasRequiredCallBind,whichTypedArray,hasRequiredWhichTypedArray,isTypedArray$2,hasRequiredIsTypedArray,hasRequiredTypes,isBufferBrowser,hasRequiredIsBufferBrowser,hasRequiredUtil$1,buffer_list,hasRequiredBuffer_list,destroy_1$1,hasRequiredDestroy$1;function requireDefineDataProperty(){if(hasRequiredDefineDataProperty)return defineDataProperty;hasRequiredDefineDataProperty=1;var e=requireEsDefineProperty(),t=requireSyntax(),r=requireType(),o=requireGopd();return defineDataProperty=function(n,i,a){if(!n||"object"!=typeof n&&"function"!=typeof n)throw new r("`obj` must be an object or a function`");if("string"!=typeof i&&"symbol"!=typeof i)throw new r("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new r("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new r("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new r("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new r("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,u=arguments.length>5?arguments[5]:null,l=arguments.length>6&&arguments[6],d=!!o&&o(n,i);if(e)e(n,i,{configurable:null===u&&d?d.configurable:!u,enumerable:null===s&&d?d.enumerable:!s,value:a,writable:null===c&&d?d.writable:!c});else{if(!l&&(s||c||u))throw new t("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");n[i]=a}},defineDataProperty}function requireHasPropertyDescriptors(){if(hasRequiredHasPropertyDescriptors)return hasPropertyDescriptors_1;hasRequiredHasPropertyDescriptors=1;var e=requireEsDefineProperty(),t=function(){return!!e};return t.hasArrayLengthDefineBug=function(){if(!e)return null;try{return 1!==e([],"length",{value:1}).length}catch(t){return!0}},hasPropertyDescriptors_1=t}function requireSetFunctionLength(){if(hasRequiredSetFunctionLength)return setFunctionLength;hasRequiredSetFunctionLength=1;var e=requireGetIntrinsic(),t=requireDefineDataProperty(),r=requireHasPropertyDescriptors()(),o=requireGopd(),n=requireType(),i=e("%Math.floor%");return setFunctionLength=function(e,a){if("function"!=typeof e)throw new n("`fn` is not a function");if("number"!=typeof a||a<0||a>4294967295||i(a)!==a)throw new n("`length` must be a positive 32-bit integer");var s=arguments.length>2&&!!arguments[2],c=!0,u=!0;if("length"in e&&o){var l=o(e,"length");l&&!l.configurable&&(c=!1),l&&!l.writable&&(u=!1)}return(c||u||!s)&&(r?t(e,"length",a,!0,!0):t(e,"length",a)),e},setFunctionLength}function requireApplyBind(){if(hasRequiredApplyBind)return applyBind;hasRequiredApplyBind=1;var e=requireFunctionBind(),t=requireFunctionApply(),r=requireActualApply();return applyBind=function(){return r(e,t,arguments)},applyBind}function requireCallBind(){return hasRequiredCallBind||(hasRequiredCallBind=1,e=callBind,t=requireSetFunctionLength(),r=requireEsDefineProperty(),o=requireCallBindApplyHelpers(),n=requireApplyBind(),e.exports=function(e){var r=o(arguments),n=e.length-(arguments.length-1);return t(r,1+(n>0?n:0),!0)},r?r(e.exports,"apply",{value:n}):e.exports.apply=n),callBind.exports;var e,t,r,o,n}function requireWhichTypedArray(){if(hasRequiredWhichTypedArray)return whichTypedArray;hasRequiredWhichTypedArray=1;var e=requireForEach(),t=requireAvailableTypedArrays(),r=requireCallBind(),o=requireCallBound(),n=requireGopd(),i=requireGetProto(),a=o("Object.prototype.toString"),s=requireShams()(),c="undefined"==typeof globalThis?commonjsGlobal:globalThis,u=t(),l=o("String.prototype.slice"),d=o("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r<e.length;r+=1)if(e[r]===t)return r;return-1},p={__proto__:null};e(u,s&&n&&i?function(e){var t=new c[e];if(Symbol.toStringTag in t&&i){var o=i(t),a=n(o,Symbol.toStringTag);if(!a&&o){var s=i(o);a=n(s,Symbol.toStringTag)}p["$"+e]=r(a.get)}}:function(e){var t=new c[e],o=t.slice||t.set;o&&(p["$"+e]=r(o))});return whichTypedArray=function(t){if(!t||"object"!=typeof t)return!1;if(!s){var r=l(a(t),8,-1);return d(u,r)>-1?r:"Object"===r&&function(t){var r=!1;return e(p,(function(e,o){if(!r)try{e(t),r=l(o,1)}catch(n){}})),r}(t)}return n?function(t){var r=!1;return e(p,(function(e,o){if(!r)try{"$"+e(t)===o&&(r=l(o,1))}catch(n){}})),r}(t):null}}function requireIsTypedArray(){if(hasRequiredIsTypedArray)return isTypedArray$2;hasRequiredIsTypedArray=1;var e=requireWhichTypedArray();return isTypedArray$2=function(t){return!!e(t)}}function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,function(e){var t=requireIsArguments(),r=requireIsGeneratorFunction(),o=requireWhichTypedArray(),n=requireIsTypedArray();function i(e){return e.call.bind(e)}var a="undefined"!=typeof BigInt,s="undefined"!=typeof Symbol,c=i(Object.prototype.toString),u=i(Number.prototype.valueOf),l=i(String.prototype.valueOf),d=i(Boolean.prototype.valueOf);if(a)var p=i(BigInt.prototype.valueOf);if(s)var h=i(Symbol.prototype.valueOf);function f(e,t){if("object"!=typeof e)return!1;try{return t(e),!0}catch(r){return!1}}function m(e){return"[object Map]"===c(e)}function y(e){return"[object Set]"===c(e)}function g(e){return"[object WeakMap]"===c(e)}function b(e){return"[object WeakSet]"===c(e)}function v(e){return"[object ArrayBuffer]"===c(e)}function w(e){return"undefined"!=typeof ArrayBuffer&&(v.working?v(e):e instanceof ArrayBuffer)}function $(e){return"[object DataView]"===c(e)}function k(e){return"undefined"!=typeof DataView&&($.working?$(e):e instanceof DataView)}e.isArgumentsObject=t,e.isGeneratorFunction=r,e.isTypedArray=n,e.isPromise=function(e){return"undefined"!=typeof Promise&&e instanceof Promise||null!==e&&"object"==typeof e&&"function"==typeof e.then&&"function"==typeof e.catch},e.isArrayBufferView=function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):n(e)||k(e)},e.isUint8Array=function(e){return"Uint8Array"===o(e)},e.isUint8ClampedArray=function(e){return"Uint8ClampedArray"===o(e)},e.isUint16Array=function(e){return"Uint16Array"===o(e)},e.isUint32Array=function(e){return"Uint32Array"===o(e)},e.isInt8Array=function(e){return"Int8Array"===o(e)},e.isInt16Array=function(e){return"Int16Array"===o(e)},e.isInt32Array=function(e){return"Int32Array"===o(e)},e.isFloat32Array=function(e){return"Float32Array"===o(e)},e.isFloat64Array=function(e){return"Float64Array"===o(e)},e.isBigInt64Array=function(e){return"BigInt64Array"===o(e)},e.isBigUint64Array=function(e){return"BigUint64Array"===o(e)},m.working="undefined"!=typeof Map&&m(new Map),e.isMap=function(e){return"undefined"!=typeof Map&&(m.working?m(e):e instanceof Map)},y.working="undefined"!=typeof Set&&y(new Set),e.isSet=function(e){return"undefined"!=typeof Set&&(y.working?y(e):e instanceof Set)},g.working="undefined"!=typeof WeakMap&&g(new WeakMap),e.isWeakMap=function(e){return"undefined"!=typeof WeakMap&&(g.working?g(e):e instanceof WeakMap)},b.working="undefined"!=typeof WeakSet&&b(new WeakSet),e.isWeakSet=function(e){return b(e)},v.working="undefined"!=typeof ArrayBuffer&&v(new ArrayBuffer),e.isArrayBuffer=w,$.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&$(new DataView(new ArrayBuffer(1),0,1)),e.isDataView=k;var _="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function T(e){return"[object SharedArrayBuffer]"===c(e)}function I(e){return void 0!==_&&(void 0===T.working&&(T.working=T(new _)),T.working?T(e):e instanceof _)}function A(e){return f(e,u)}function O(e){return f(e,l)}function E(e){return f(e,d)}function S(e){return a&&f(e,p)}function R(e){return s&&f(e,h)}e.isSharedArrayBuffer=I,e.isAsyncFunction=function(e){return"[object AsyncFunction]"===c(e)},e.isMapIterator=function(e){return"[object Map Iterator]"===c(e)},e.isSetIterator=function(e){return"[object Set Iterator]"===c(e)},e.isGeneratorObject=function(e){return"[object Generator]"===c(e)},e.isWebAssemblyCompiledModule=function(e){return"[object WebAssembly.Module]"===c(e)},e.isNumberObject=A,e.isStringObject=O,e.isBooleanObject=E,e.isBigIntObject=S,e.isSymbolObject=R,e.isBoxedPrimitive=function(e){return A(e)||O(e)||E(e)||S(e)||R(e)},e.isAnyArrayBuffer=function(e){return"undefined"!=typeof Uint8Array&&(w(e)||I(e))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(t){Object.defineProperty(e,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})}))}(types)),types}function requireIsBufferBrowser(){return hasRequiredIsBufferBrowser?isBufferBrowser:(hasRequiredIsBufferBrowser=1,isBufferBrowser=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8})}function requireUtil$1(){return hasRequiredUtil$1||(hasRequiredUtil$1=1,function(e){var t=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},o=0;o<t.length;o++)r[t[o]]=Object.getOwnPropertyDescriptor(e,t[o]);return r},r=/%[sdj%]/g;e.format=function(e){if(!y(e)){for(var t=[],o=0;o<arguments.length;o++)t.push(a(arguments[o]));return t.join(" ")}o=1;for(var n=arguments,i=n.length,s=String(e).replace(r,(function(e){if("%%"===e)return"%";if(o>=i)return e;switch(e){case"%s":return String(n[o++]);case"%d":return Number(n[o++]);case"%j":try{return JSON.stringify(n[o++])}catch(t){return"[Circular]"}default:return e}})),c=n[o];o<i;c=n[++o])f(c)||!v(c)?s+=" "+c:s+=" "+a(c);return s},e.deprecate=function(t,r){if(void 0!==process$1$1&&!0===process$1$1.noDeprecation)return t;if(void 0===process$1$1)return function(){return e.deprecate(t,r).apply(this,arguments)};var o=!1;return function(){if(!o){if(process$1$1.throwDeprecation)throw new Error(r);process$1$1.traceDeprecation?console.trace(r):console.error(r),o=!0}return t.apply(this,arguments)}};var o={},n=/^$/;if(process$1$1.env.NODE_DEBUG){var i=process$1$1.env.NODE_DEBUG;i=i.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),n=new RegExp("^"+i+"$","i")}function a(t,r){var o={seen:[],stylize:c};return arguments.length>=3&&(o.depth=arguments[2]),arguments.length>=4&&(o.colors=arguments[3]),h(r)?o.showHidden=r:r&&e._extend(o,r),g(o.showHidden)&&(o.showHidden=!1),g(o.depth)&&(o.depth=2),g(o.colors)&&(o.colors=!1),g(o.customInspect)&&(o.customInspect=!0),o.colors&&(o.stylize=s),u(o,t,o.depth)}function s(e,t){var r=a.styles[t];return r?"["+a.colors[r][0]+"m"+e+"["+a.colors[r][1]+"m":e}function c(e,t){return e}function u(t,r,o){if(t.customInspect&&r&&k(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(o,t);return y(n)||(n=u(t,n,o)),n}var i=function(e,t){if(g(t))return e.stylize("undefined","undefined");if(y(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(m(t))return e.stylize(""+t,"number");if(h(t))return e.stylize(""+t,"boolean");if(f(t))return e.stylize("null","null")}(t,r);if(i)return i;var a=Object.keys(r),s=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(r)),$(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return l(r);if(0===a.length){if(k(r)){var c=r.name?": "+r.name:"";return t.stylize("[Function"+c+"]","special")}if(b(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(w(r))return t.stylize(Date.prototype.toString.call(r),"date");if($(r))return l(r)}var v,_="",T=!1,I=["{","}"];(p(r)&&(T=!0,I=["[","]"]),k(r))&&(_=" [Function"+(r.name?": "+r.name:"")+"]");return b(r)&&(_=" "+RegExp.prototype.toString.call(r)),w(r)&&(_=" "+Date.prototype.toUTCString.call(r)),$(r)&&(_=" "+l(r)),0!==a.length||T&&0!=r.length?o<0?b(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),v=T?function(e,t,r,o,n){for(var i=[],a=0,s=t.length;a<s;++a)A(t,String(a))?i.push(d(e,t,r,o,String(a),!0)):i.push("");return n.forEach((function(n){n.match(/^\d+$/)||i.push(d(e,t,r,o,n,!0))})),i}(t,r,o,s,a):a.map((function(e){return d(t,r,o,s,e,T)})),t.seen.pop(),function(e,t,r){var o=e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0);if(o>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(v,_,I)):I[0]+_+I[1]}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,r,o,n,i){var a,s,c;if((c=Object.getOwnPropertyDescriptor(t,n)||{value:t[n]}).get?s=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(s=e.stylize("[Setter]","special")),A(o,n)||(a="["+n+"]"),s||(e.seen.indexOf(c.value)<0?(s=f(r)?u(e,c.value,null):u(e,c.value,r-1)).indexOf("\n")>-1&&(s=i?s.split("\n").map((function(e){return" "+e})).join("\n").slice(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),g(a)){if(i&&n.match(/^\d+$/))return s;(a=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.slice(1,-1),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function p(e){return Array.isArray(e)}function h(e){return"boolean"==typeof e}function f(e){return null===e}function m(e){return"number"==typeof e}function y(e){return"string"==typeof e}function g(e){return void 0===e}function b(e){return v(e)&&"[object RegExp]"===_(e)}function v(e){return"object"==typeof e&&null!==e}function w(e){return v(e)&&"[object Date]"===_(e)}function $(e){return v(e)&&("[object Error]"===_(e)||e instanceof Error)}function k(e){return"function"==typeof e}function _(e){return Object.prototype.toString.call(e)}function T(e){return e<10?"0"+e.toString(10):e.toString(10)}e.debuglog=function(t){if(t=t.toUpperCase(),!o[t])if(n.test(t)){var r=process$1$1.pid;o[t]=function(){var o=e.format.apply(e,arguments);console.error("%s %d: %s",t,r,o)}}else o[t]=function(){};return o[t]},e.inspect=a,a.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]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.types=requireTypes(),e.isArray=p,e.isBoolean=h,e.isNull=f,e.isNullOrUndefined=function(e){return null==e},e.isNumber=m,e.isString=y,e.isSymbol=function(e){return"symbol"==typeof e},e.isUndefined=g,e.isRegExp=b,e.types.isRegExp=b,e.isObject=v,e.isDate=w,e.types.isDate=w,e.isError=$,e.types.isNativeError=$,e.isFunction=k,e.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},e.isBuffer=requireIsBufferBrowser();var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function A(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.log=function(){var t,r;console.log("%s - %s",(r=[T((t=new Date).getHours()),T(t.getMinutes()),T(t.getSeconds())].join(":"),[t.getDate(),I[t.getMonth()],r].join(" ")),e.format.apply(e,arguments))},e.inherits=inherits_browserExports,e._extend=function(e,t){if(!t||!v(t))return e;for(var r=Object.keys(t),o=r.length;o--;)e[r[o]]=t[r[o]];return e};var O="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function E(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}e.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(O&&e[O]){var r;if("function"!=typeof(r=e[O]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(r,O,{value:r,enumerable:!1,writable:!1,configurable:!0}),r}function r(){for(var t,r,o=new Promise((function(e,o){t=e,r=o})),n=[],i=0;i<arguments.length;i++)n.push(arguments[i]);n.push((function(e,o){e?r(e):t(o)}));try{e.apply(this,n)}catch(a){r(a)}return o}return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),O&&Object.defineProperty(r,O,{value:r,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(r,t(e))},e.promisify.custom=O,e.callbackify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');function r(){for(var t=[],r=0;r<arguments.length;r++)t.push(arguments[r]);var o=t.pop();if("function"!=typeof o)throw new TypeError("The last argument must be of type Function");var n=this,i=function(){return o.apply(n,arguments)};e.apply(this,t).then((function(e){process$1$1.nextTick(i.bind(null,null,e))}),(function(e){process$1$1.nextTick(E.bind(null,e,i))}))}return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),Object.defineProperties(r,t(e)),r}}(util$3)),util$3}function requireBuffer_list(){if(hasRequiredBuffer_list)return buffer_list;function e(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function t(t){for(var o=1;o<arguments.length;o++){var n=null!=arguments[o]?arguments[o]:{};o%2?e(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,n(o.key),o)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t);if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:String(t)}hasRequiredBuffer_list=1;var i=require$$0$2.Buffer,a=requireUtil$1().inspect,s=a&&a.custom||"inspect";return buffer_list=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 o(e,[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return i.alloc(0);for(var t,r,o,n=i.allocUnsafe(e>>>0),a=this.head,s=0;a;)t=a.data,r=n,o=s,i.prototype.copy.call(t,r,o),s+=a.data.length,a=a.next;return n}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,o=t.data;for(e-=o.length;t=t.next;){var n=t.data,i=e>n.length?n.length:e;if(i===n.length?o+=n:o+=n.slice(0,e),0===(e-=i)){i===n.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=n.slice(i));break}++r}return this.length-=r,o}},{key:"_getBuffer",value:function(e){var t=i.allocUnsafe(e),r=this.head,o=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var n=r.data,a=e>n.length?n.length:e;if(n.copy(t,t.length-e,0,a),0===(e-=a)){a===n.length?(++o,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(a));break}++o}return this.length-=o,t}},{key:s,value:function(e,r){return a(this,t(t({},r),{},{depth:0,customInspect:!1}))}}]),e}()}function requireDestroy$1(){if(hasRequiredDestroy$1)return destroy_1$1;function e(e,o){r(e,o),t(e)}function t(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function r(e,t){e.emit("error",t)}return hasRequiredDestroy$1=1,destroy_1$1={destroy:function(o,n){var i=this,a=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return a||s?(n?n(o):o&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process$1$1.nextTick(r,this,o)):process$1$1.nextTick(r,this,o)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(o||null,(function(r){!n&&r?i._writableState?i._writableState.errorEmitted?process$1$1.nextTick(t,i):(i._writableState.errorEmitted=!0,process$1$1.nextTick(e,i,r)):process$1$1.nextTick(e,i,r):n?(process$1$1.nextTick(t,i),n(r)):process$1$1.nextTick(t,i)})),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)},errorOrDestroy:function(e,t){var r=e._readableState,o=e._writableState;r&&r.autoDestroy||o&&o.autoDestroy?e.destroy(t):e.emit("error",t)}}}var errorsBrowser={},hasRequiredErrorsBrowser,state,hasRequiredState,browser$c,hasRequiredBrowser$a,_stream_writable$1,hasRequired_stream_writable$1,_stream_duplex$1,hasRequired_stream_duplex$1;function requireErrorsBrowser(){if(hasRequiredErrorsBrowser)return errorsBrowser;hasRequiredErrorsBrowser=1;var e={};function t(t,r,o){o||(o=Error);var n=function(e){var t,o;function n(t,o,n){return e.call(this,function(e,t,o){return"string"==typeof r?r:r(e,t,o)}(t,o,n))||this}return o=e,(t=n).prototype=Object.create(o.prototype),t.prototype.constructor=t,t.__proto__=o,n}(o);n.prototype.name=o.name,n.prototype.code=t,e[t]=n}function r(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}return t("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),t("ERR_INVALID_ARG_TYPE",(function(e,t,o){var n,i,a;if("string"==typeof t&&(i="not ",t.substr(0,i.length)===i)?(n="must not be",t=t.replace(/^not /,"")):n="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))a="The ".concat(e," ").concat(n," ").concat(r(t,"type"));else{var s=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";a='The "'.concat(e,'" ').concat(s," ").concat(n," ").concat(r(t,"type"))}return a+=". Received type ".concat(typeof o)}),TypeError),t("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),t("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),t("ERR_STREAM_PREMATURE_CLOSE","Premature close"),t("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),t("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),t("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),t("ERR_STREAM_WRITE_AFTER_END","write after end"),t("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),t("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),t("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),errorsBrowser.codes=e,errorsBrowser}function requireState(){if(hasRequiredState)return state;hasRequiredState=1;var e=requireErrorsBrowser().codes.ERR_INVALID_OPT_VALUE;return state={getHighWaterMark:function(t,r,o,n){var i=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(r,n,o);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new e(n?o:"highWaterMark",i);return Math.floor(i)}return t.objectMode?16:16384}}}function requireBrowser$a(){if(hasRequiredBrowser$a)return browser$c;function e(e){try{if(!commonjsGlobal.localStorage)return!1}catch(r){return!1}var t=commonjsGlobal.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}return hasRequiredBrowser$a=1,browser$c=function(t,r){if(e("noDeprecation"))return t;var o=!1;return function(){if(!o){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),o=!0}return t.apply(this,arguments)}},browser$c}function require_stream_writable$1(){if(hasRequired_stream_writable$1)return _stream_writable$1;function e(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var o=e.entry;e.entry=null;for(;o;){var n=o.callback;t.pendingcb--,n(r),o=o.next}t.corkedRequestsFree.next=e}(t,e)}}var t;hasRequired_stream_writable$1=1,_stream_writable$1=$,$.WritableState=w;var r={deprecate:requireBrowser$a()},o=requireStreamBrowser$1(),n=require$$0$2.Buffer,i=(void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var a,s=requireDestroy$1(),c=requireState().getHighWaterMark,u=requireErrorsBrowser().codes,l=u.ERR_INVALID_ARG_TYPE,d=u.ERR_METHOD_NOT_IMPLEMENTED,p=u.ERR_MULTIPLE_CALLBACK,h=u.ERR_STREAM_CANNOT_PIPE,f=u.ERR_STREAM_DESTROYED,m=u.ERR_STREAM_NULL_VALUES,y=u.ERR_STREAM_WRITE_AFTER_END,g=u.ERR_UNKNOWN_ENCODING,b=s.errorOrDestroy;function v(){}function w(r,o,n){t=t||require_stream_duplex$1(),r=r||{},"boolean"!=typeof n&&(n=o instanceof t),this.objectMode=!!r.objectMode,n&&(this.objectMode=this.objectMode||!!r.writableObjectMode),this.highWaterMark=c(this,r,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var i=!1===r.decodeStrings;this.decodeStrings=!i,this.defaultEncoding=r.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,o=r.sync,n=r.writecb;if("function"!=typeof n)throw new p;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,o,n){--t.pendingcb,r?(process$1$1.nextTick(n,o),process$1$1.nextTick(O,e,t),e._writableState.errorEmitted=!0,b(e,o)):(n(o),e._writableState.errorEmitted=!0,b(e,o),O(e,t))}(e,r,o,t,n);else{var i=I(r)||e.destroyed;i||r.corked||r.bufferProcessing||!r.bufferedRequest||T(e,r),o?process$1$1.nextTick(_,e,r,i,n):_(e,r,i,n)}}(o,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==r.emitClose,this.autoDestroy=!!r.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function $(e){var r=this instanceof(t=t||require_stream_duplex$1());if(!r&&!a.call($,this))return new $(e);this._writableState=new w(e,this,r),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)),o.call(this)}function k(e,t,r,o,n,i,a){t.writelen=o,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new f("write")):r?e._writev(n,t.onwrite):e._write(n,i,t.onwrite),t.sync=!1}function _(e,t,r,o){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,o(),O(e,t)}function T(t,r){r.bufferProcessing=!0;var o=r.bufferedRequest;if(t._writev&&o&&o.next){var n=r.bufferedRequestCount,i=new Array(n),a=r.corkedRequestsFree;a.entry=o;for(var s=0,c=!0;o;)i[s]=o,o.isBuf||(c=!1),o=o.next,s+=1;i.allBuffers=c,k(t,r,!0,r.length,i,"",a.finish),r.pendingcb++,r.lastBufferedRequest=null,a.next?(r.corkedRequestsFree=a.next,a.next=null):r.corkedRequestsFree=new e(r),r.bufferedRequestCount=0}else{for(;o;){var u=o.chunk,l=o.encoding,d=o.callback;if(k(t,r,!1,r.objectMode?1:u.length,u,l,d),o=o.next,r.bufferedRequestCount--,r.writing)break}null===o&&(r.lastBufferedRequest=null)}r.bufferedRequest=o,r.bufferProcessing=!1}function I(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function A(e,t){e._final((function(r){t.pendingcb--,r&&b(e,r),t.prefinished=!0,e.emit("prefinish"),O(e,t)}))}function O(e,t){var r=I(t);if(r&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,process$1$1.nextTick(A,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var o=e._readableState;(!o||o.autoDestroy&&o.endEmitted)&&e.destroy()}return r}return inherits_browserExports($,o),w.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(w.prototype,"buffer",{get:r.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]?(a=Function.prototype[Symbol.hasInstance],Object.defineProperty($,Symbol.hasInstance,{value:function(e){return!!a.call(this,e)||this===$&&(e&&e._writableState instanceof w)}})):a=function(e){return e instanceof this},$.prototype.pipe=function(){b(this,new h)},$.prototype.write=function(e,t,r){var o,a=this._writableState,s=!1,c=!a.objectMode&&(o=e,n.isBuffer(o)||o instanceof i);return c&&!n.isBuffer(e)&&(e=function(e){return n.from(e)}(e)),"function"==typeof t&&(r=t,t=null),c?t="buffer":t||(t=a.defaultEncoding),"function"!=typeof r&&(r=v),a.ending?function(e,t){var r=new y;b(e,r),process$1$1.nextTick(t,r)}(this,r):(c||function(e,t,r,o){var n;return null===r?n=new m:"string"==typeof r||t.objectMode||(n=new l("chunk",["string","Buffer"],r)),!n||(b(e,n),process$1$1.nextTick(o,n),!1)}(this,a,e,r))&&(a.pendingcb++,s=function(e,t,r,o,i,a){if(!r){var s=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=n.from(t,r));return t}(t,o,i);o!==s&&(r=!0,i="buffer",o=s)}var c=t.objectMode?1:o.length;t.length+=c;var u=t.length<t.highWaterMark;u||(t.needDrain=!0);if(t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:o,encoding:i,isBuf:r,callback:a,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else k(e,t,!1,c,o,i,a);return u}(this,a,c,e,t,r)),s},$.prototype.cork=function(){this._writableState.corked++},$.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||T(this,e))},$.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 g(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty($.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty($.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),$.prototype._write=function(e,t,r){r(new d("_write()"))},$.prototype._writev=null,$.prototype.end=function(e,t,r){var o=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),o.corked&&(o.corked=1,this.uncork()),o.ending||function(e,t,r){t.ending=!0,O(e,t),r&&(t.finished?process$1$1.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,o,r),this},Object.defineProperty($.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty($.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),$.prototype.destroy=s.destroy,$.prototype._undestroy=s.undestroy,$.prototype._destroy=function(e,t){t(e)},_stream_writable$1}function require_stream_duplex$1(){if(hasRequired_stream_duplex$1)return _stream_duplex$1;hasRequired_stream_duplex$1=1;var e=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};_stream_duplex$1=a;var t=require_stream_readable$1(),r=require_stream_writable$1();inherits_browserExports(a,t);for(var o=e(r.prototype),n=0;n<o.length;n++){var i=o[n];a.prototype[i]||(a.prototype[i]=r.prototype[i])}function a(e){if(!(this instanceof a))return new a(e);t.call(this,e),r.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",s)))}function s(){this._writableState.ended||process$1$1.nextTick(c,this)}function c(e){e.end()}return Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(a.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(a.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._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)}}),_stream_duplex$1}var string_decoder={},hasRequiredString_decoder,endOfStream,hasRequiredEndOfStream,async_iterator,hasRequiredAsync_iterator,fromBrowser,hasRequiredFromBrowser,_stream_readable$1,hasRequired_stream_readable$1,_stream_transform$1,hasRequired_stream_transform$1,_stream_passthrough$1,hasRequired_stream_passthrough$1,pipeline_1,hasRequiredPipeline,streamBrowserify,hasRequiredStreamBrowserify,hashBase,hasRequiredHashBase,md5_js,hasRequiredMd5_js,ripemd160,hasRequiredRipemd160;function requireString_decoder(){if(hasRequiredString_decoder)return string_decoder;hasRequiredString_decoder=1;var e=requireSafeBuffer$1().Buffer,t=e.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 r(r){var o;switch(this.encoding=function(r){var o=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}}(r);if("string"!=typeof o&&(e.isEncoding===t||!t(r)))throw new Error("Unknown encoding: "+r);return o||r}(r),this.encoding){case"utf16le":this.text=i,this.end=a,o=4;break;case"utf8":this.fillLast=n,o=4;break;case"base64":this.text=s,this.end=c,o=3;break;default:return this.write=u,void(this.end=l)}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(o)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function n(e){var t=this.lastTotal-this.lastNeed,r=function(e,t){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 i(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var o=r.charCodeAt(r.length-1);if(o>=55296&&o<=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 a(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 s(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 c(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function u(e){return e.toString(this.encoding)}function l(e){return e&&e.length?this.write(e):""}return string_decoder.StringDecoder=r,r.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||""},r.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},r.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=o(t[n]);if(i>=0)return i>0&&(e.lastNeed=i-1),i;if(--n<r||-2===i)return 0;if(i=o(t[n]),i>=0)return i>0&&(e.lastNeed=i-2),i;if(--n<r||-2===i)return 0;if(i=o(t[n]),i>=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},r.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},string_decoder}function requireEndOfStream(){if(hasRequiredEndOfStream)return endOfStream;hasRequiredEndOfStream=1;var e=requireErrorsBrowser().codes.ERR_STREAM_PREMATURE_CLOSE;function t(){}return endOfStream=function r(o,n,i){if("function"==typeof n)return r(o,null,n);n||(n={}),i=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,o=new Array(r),n=0;n<r;n++)o[n]=arguments[n];e.apply(this,o)}}}(i||t);var a=n.readable||!1!==n.readable&&o.readable,s=n.writable||!1!==n.writable&&o.writable,c=function(){o.writable||l()},u=o._writableState&&o._writableState.finished,l=function(){s=!1,u=!0,a||i.call(o)},d=o._readableState&&o._readableState.endEmitted,p=function(){a=!1,d=!0,s||i.call(o)},h=function(e){i.call(o,e)},f=function(){var t;return a&&!d?(o._readableState&&o._readableState.ended||(t=new e),i.call(o,t)):s&&!u?(o._writableState&&o._writableState.ended||(t=new e),i.call(o,t)):void 0},m=function(){o.req.on("finish",l)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(o)?s&&!o._writableState&&(o.on("end",c),o.on("close",c)):(o.on("complete",l),o.on("abort",f),o.req?m():o.on("request",m)),o.on("end",p),o.on("finish",l),!1!==n.error&&o.on("error",h),o.on("close",f),function(){o.removeListener("complete",l),o.removeListener("abort",f),o.removeListener("request",m),o.req&&o.req.removeListener("finish",l),o.removeListener("end",c),o.removeListener("close",c),o.removeListener("finish",l),o.removeListener("end",p),o.removeListener("error",h),o.removeListener("close",f)}},endOfStream}function requireAsync_iterator(){if(hasRequiredAsync_iterator)return async_iterator;var e;function t(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t);if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}hasRequiredAsync_iterator=1;var r=requireEndOfStream(),o=Symbol("lastResolve"),n=Symbol("lastReject"),i=Symbol("error"),a=Symbol("ended"),s=Symbol("lastPromise"),c=Symbol("handlePromise"),u=Symbol("stream");function l(e,t){return{value:e,done:t}}function d(e){var t=e[o];if(null!==t){var r=e[u].read();null!==r&&(e[s]=null,e[o]=null,e[n]=null,t(l(r,!1)))}}function p(e){process$1$1.nextTick(d,e)}var h=Object.getPrototypeOf((function(){})),f=Object.setPrototypeOf((t(e={get stream(){return this[u]},next:function(){var e=this,t=this[i];if(null!==t)return Promise.reject(t);if(this[a])return Promise.resolve(l(void 0,!0));if(this[u].destroyed)return new Promise((function(t,r){process$1$1.nextTick((function(){e[i]?r(e[i]):t(l(void 0,!0))}))}));var r,o=this[s];if(o)r=new Promise(function(e,t){return function(r,o){e.then((function(){t[a]?r(l(void 0,!0)):t[c](r,o)}),o)}}(o,this));else{var n=this[u].read();if(null!==n)return Promise.resolve(l(n,!1));r=new Promise(this[c])}return this[s]=r,r}},Symbol.asyncIterator,(function(){return this})),t(e,"return",(function(){var e=this;return new Promise((function(t,r){e[u].destroy(null,(function(e){e?r(e):t(l(void 0,!0))}))}))})),e),h);return async_iterator=function(e){var d,h=Object.create(f,(t(d={},u,{value:e,writable:!0}),t(d,o,{value:null,writable:!0}),t(d,n,{value:null,writable:!0}),t(d,i,{value:null,writable:!0}),t(d,a,{value:e._readableState.endEmitted,writable:!0}),t(d,c,{value:function(e,t){var r=h[u].read();r?(h[s]=null,h[o]=null,h[n]=null,e(l(r,!1))):(h[o]=e,h[n]=t)},writable:!0}),d));return h[s]=null,r(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=h[n];return null!==t&&(h[s]=null,h[o]=null,h[n]=null,t(e)),void(h[i]=e)}var r=h[o];null!==r&&(h[s]=null,h[o]=null,h[n]=null,r(l(void 0,!0))),h[a]=!0})),e.on("readable",p.bind(null,h)),h}}function requireFromBrowser(){return hasRequiredFromBrowser?fromBrowser:(hasRequiredFromBrowser=1,fromBrowser=function(){throw new Error("Readable.from is not available in the browser")})}function require_stream_readable$1(){if(hasRequired_stream_readable$1)return _stream_readable$1;var e;hasRequired_stream_readable$1=1,_stream_readable$1=$,$.ReadableState=w,requireEvents().EventEmitter;var t=function(e,t){return e.listeners(t).length},r=requireStreamBrowser$1(),o=require$$0$2.Buffer,n=(void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var i,a=requireUtil$1();i=a&&a.debuglog?a.debuglog("stream"):function(){};var s,c,u,l=requireBuffer_list(),d=requireDestroy$1(),p=requireState().getHighWaterMark,h=requireErrorsBrowser().codes,f=h.ERR_INVALID_ARG_TYPE,m=h.ERR_STREAM_PUSH_AFTER_EOF,y=h.ERR_METHOD_NOT_IMPLEMENTED,g=h.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;inherits_browserExports($,r);var b=d.errorOrDestroy,v=["error","close","destroy","pause","resume"];function w(t,r,o){e=e||require_stream_duplex$1(),t=t||{},"boolean"!=typeof o&&(o=r instanceof e),this.objectMode=!!t.objectMode,o&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=p(this,t,"readableHighWaterMark",o),this.buffer=new l,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(s||(s=requireString_decoder().StringDecoder),this.decoder=new s(t.encoding),this.encoding=t.encoding)}function $(t){if(e=e||require_stream_duplex$1(),!(this instanceof $))return new $(t);var o=this instanceof e;this._readableState=new w(t,this,o),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),r.call(this)}function k(e,t,r,a,s){i("readableAddChunk",t);var c,u=e._readableState;if(null===t)u.reading=!1,function(e,t){if(i("onEofChunk"),t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?A(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,O(e)))}(e,u);else if(s||(c=function(e,t){var r;i=t,o.isBuffer(i)||i instanceof n||"string"==typeof t||void 0===t||e.objectMode||(r=new f("chunk",["string","Buffer","Uint8Array"],t));var i;return r}(u,t)),c)b(e,c);else if(u.objectMode||t&&t.length>0)if("string"==typeof t||u.objectMode||Object.getPrototypeOf(t)===o.prototype||(t=function(e){return o.from(e)}(t)),a)u.endEmitted?b(e,new g):_(e,u,t,!0);else if(u.ended)b(e,new m);else{if(u.destroyed)return!1;u.reading=!1,u.decoder&&!r?(t=u.decoder.write(t),u.objectMode||0!==t.length?_(e,u,t,!1):E(e,u)):_(e,u,t,!1)}else a||(u.reading=!1,E(e,u));return!u.ended&&(u.length<u.highWaterMark||0===u.length)}function _(e,t,r,o){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,o?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&A(e)),E(e,t)}Object.defineProperty($.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),$.prototype.destroy=d.destroy,$.prototype._undestroy=d.undestroy,$.prototype._destroy=function(e,t){t(e)},$.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=o.from(e,t),t=""),r=!0),k(this,e,t,!1,r)},$.prototype.unshift=function(e){return k(this,e,null,!0,!1)},$.prototype.isPaused=function(){return!1===this._readableState.flowing},$.prototype.setEncoding=function(e){s||(s=requireString_decoder().StringDecoder);var t=new s(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,o="";null!==r;)o+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==o&&this._readableState.buffer.push(o),this._readableState.length=o.length,this};var T=1073741824;function I(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>=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function A(e){var t=e._readableState;i("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(i("emitReadable",t.flowing),t.emittedReadable=!0,process$1$1.nextTick(O,e))}function O(e){var t=e._readableState;i("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,P(e)}function E(e,t){t.readingMore||(t.readingMore=!0,process$1$1.nextTick(S,e,t))}function S(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(i("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function R(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function x(e){i("readable nexttick read 0"),e.read(0)}function C(e,t){i("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),P(e),t.flowing&&!t.reading&&e.read(0)}function P(e){var t=e._readableState;for(i("flow",t.flowing);t.flowing&&null!==e.read(););}function N(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function B(e){var t=e._readableState;i("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process$1$1.nextTick(D,t,e))}function D(e,t){if(i("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function M(e,t){for(var r=0,o=e.length;r<o;r++)if(e[r]===t)return r;return-1}return $.prototype.read=function(e){i("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return i("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?B(this):A(this),null;if(0===(e=I(e,t))&&t.ended)return 0===t.length&&B(this),null;var o,n=t.needReadable;return i("need readable",n),(0===t.length||t.length-e<t.highWaterMark)&&i("length less than watermark",n=!0),t.ended||t.reading?i("reading or ended",n=!1):n&&(i("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=I(r,t))),null===(o=e>0?N(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&B(this)),null!==o&&this.emit("data",o),o},$.prototype._read=function(e){b(this,new y("_read()"))},$.prototype.pipe=function(e,r){var o=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,i("pipe count=%d opts=%j",n.pipesCount,r);var a=(!r||!1!==r.end)&&e!==process$1$1.stdout&&e!==process$1$1.stderr?c:m;function s(t,r){i("onunpipe"),t===o&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,i("cleanup"),e.removeListener("close",h),e.removeListener("finish",f),e.removeListener("drain",u),e.removeListener("error",p),e.removeListener("unpipe",s),o.removeListener("end",c),o.removeListener("end",m),o.removeListener("data",d),l=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||u())}function c(){i("onend"),e.end()}n.endEmitted?process$1$1.nextTick(a):o.once("end",a),e.on("unpipe",s);var u=function(e){return function(){var r=e._readableState;i("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&t(e,"data")&&(r.flowing=!0,P(e))}}(o);e.on("drain",u);var l=!1;function d(t){i("ondata");var r=e.write(t);i("dest.write",r),!1===r&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==M(n.pipes,e))&&!l&&(i("false write response, pause",n.awaitDrain),n.awaitDrain++),o.pause())}function p(r){i("onerror",r),m(),e.removeListener("error",p),0===t(e,"error")&&b(e,r)}function h(){e.removeListener("finish",f),m()}function f(){i("onfinish"),e.removeListener("close",h),m()}function m(){i("unpipe"),o.unpipe(e)}return o.on("data",d),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",p),e.once("close",h),e.once("finish",f),e.emit("pipe",o),n.flowing||(i("pipe resume"),o.resume()),e},$.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 o=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<n;i++)o[i].emit("unpipe",this,{hasUnpiped:!1});return this}var a=M(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},$.prototype.on=function(e,t){var o=r.prototype.on.call(this,e,t),n=this._readableState;return"data"===e?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,i("on readable",n.length,n.reading),n.length?A(this):n.reading||process$1$1.nextTick(x,this))),o},$.prototype.addListener=$.prototype.on,$.prototype.removeListener=function(e,t){var o=r.prototype.removeListener.call(this,e,t);return"readable"===e&&process$1$1.nextTick(R,this),o},$.prototype.removeAllListeners=function(e){var t=r.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process$1$1.nextTick(R,this),t},$.prototype.resume=function(){var e=this._readableState;return e.flowing||(i("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process$1$1.nextTick(C,e,t))}(this,e)),e.paused=!1,this},$.prototype.pause=function(){return i("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(i("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},$.prototype.wrap=function(e){var t=this,r=this._readableState,o=!1;for(var n in e.on("end",(function(){if(i("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){(i("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(o=!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 a=0;a<v.length;a++)e.on(v[a],this.emit.bind(this,v[a]));return this._read=function(t){i("wrapped _read",t),o&&(o=!1,e.resume())},this},"function"==typeof Symbol&&($.prototype[Symbol.asyncIterator]=function(){return void 0===c&&(c=requireAsync_iterator()),c(this)}),Object.defineProperty($.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty($.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty($.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),$._fromList=N,Object.defineProperty($.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&($.from=function(e,t){return void 0===u&&(u=requireFromBrowser()),u($,e,t)}),_stream_readable$1}function require_stream_transform$1(){if(hasRequired_stream_transform$1)return _stream_transform$1;hasRequired_stream_transform$1=1,_stream_transform$1=s;var e=requireErrorsBrowser().codes,t=e.ERR_METHOD_NOT_IMPLEMENTED,r=e.ERR_MULTIPLE_CALLBACK,o=e.ERR_TRANSFORM_ALREADY_TRANSFORMING,n=e.ERR_TRANSFORM_WITH_LENGTH_0,i=require_stream_duplex$1();function a(e,t){var o=this._transformState;o.transforming=!1;var n=o.writecb;if(null===n)return this.emit("error",new r);o.writechunk=null,o.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function s(e){if(!(this instanceof s))return new s(e);i.call(this,e),this._transformState={afterTransform:a.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",c)}function c(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?u(this,null,null):this._flush((function(t,r){u(e,t,r)}))}function u(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new n;if(e._transformState.transforming)throw new o;return e.push(null)}return inherits_browserExports(s,i),s.prototype.push=function(e,t){return this._transformState.needTransform=!1,i.prototype.push.call(this,e,t)},s.prototype._transform=function(e,r,o){o(new t("_transform()"))},s.prototype._write=function(e,t,r){var o=this._transformState;if(o.writecb=r,o.writechunk=e,o.writeencoding=t,!o.transforming){var n=this._readableState;(o.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},s.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},s.prototype._destroy=function(e,t){i.prototype._destroy.call(this,e,(function(e){t(e)}))},_stream_transform$1}function require_stream_passthrough$1(){if(hasRequired_stream_passthrough$1)return _stream_passthrough$1;hasRequired_stream_passthrough$1=1,_stream_passthrough$1=t;var e=require_stream_transform$1();function t(r){if(!(this instanceof t))return new t(r);e.call(this,r)}return inherits_browserExports(t,e),t.prototype._transform=function(e,t,r){r(null,e)},_stream_passthrough$1}function requirePipeline(){if(hasRequiredPipeline)return pipeline_1;var e;hasRequiredPipeline=1;var t=requireErrorsBrowser().codes,r=t.ERR_MISSING_ARGS,o=t.ERR_STREAM_DESTROYED;function n(e){if(e)throw e}function i(e){e()}function a(e,t){return e.pipe(t)}return pipeline_1=function(){for(var t=arguments.length,s=new Array(t),c=0;c<t;c++)s[c]=arguments[c];var u,l=function(e){return e.length?"function"!=typeof e[e.length-1]?n:e.pop():n}(s);if(Array.isArray(s[0])&&(s=s[0]),s.length<2)throw new r("streams");var d=s.map((function(t,r){var n=r<s.length-1;return function(t,r,n,i){i=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(i);var a=!1;t.on("close",(function(){a=!0})),void 0===e&&(e=requireEndOfStream()),e(t,{readable:r,writable:n},(function(e){if(e)return i(e);a=!0,i()}));var s=!1;return function(e){if(!a&&!s)return s=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void i(e||new o("pipe"))}}(t,n,r>0,(function(e){u||(u=e),e&&d.forEach(i),n||(d.forEach(i),l(u))}))}));return s.reduce(a)},pipeline_1}function requireStreamBrowserify(){if(hasRequiredStreamBrowserify)return streamBrowserify;hasRequiredStreamBrowserify=1,streamBrowserify=t;var e=requireEvents().EventEmitter;function t(){e.call(this)}return inherits_browserExports(t,e),t.Readable=require_stream_readable$1(),t.Writable=require_stream_writable$1(),t.Duplex=require_stream_duplex$1(),t.Transform=require_stream_transform$1(),t.PassThrough=require_stream_passthrough$1(),t.finished=requireEndOfStream(),t.pipeline=requirePipeline(),t.Stream=t,t.prototype.pipe=function(t,r){var o=this;function n(e){t.writable&&!1===t.write(e)&&o.pause&&o.pause()}function i(){o.readable&&o.resume&&o.resume()}o.on("data",n),t.on("drain",i),t._isStdio||r&&!1===r.end||(o.on("end",s),o.on("close",c));var a=!1;function s(){a||(a=!0,t.end())}function c(){a||(a=!0,"function"==typeof t.destroy&&t.destroy())}function u(t){if(l(),0===e.listenerCount(this,"error"))throw t}function l(){o.removeListener("data",n),t.removeListener("drain",i),o.removeListener("end",s),o.removeListener("close",c),o.removeListener("error",u),t.removeListener("error",u),o.removeListener("end",l),o.removeListener("close",l),t.removeListener("close",l)}return o.on("error",u),t.on("error",u),o.on("end",l),o.on("close",l),t.on("close",l),t.emit("pipe",o),t},streamBrowserify}function requireHashBase(){if(hasRequiredHashBase)return hashBase;hasRequiredHashBase=1;var e=requireSafeBuffer$1().Buffer,t=requireStreamBrowserify().Transform;function r(r){t.call(this),this._block=e.allocUnsafe(r),this._blockSize=r,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}inherits_browserExports(r,t),r.prototype._transform=function(e,t,r){var o=null;try{this.update(e,t)}catch(n){o=n}r(o)},r.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(r){t=r}e(t)};var o="undefined"!=typeof Uint8Array,n="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&ArrayBuffer.isView&&(e.prototype instanceof Uint8Array||e.TYPED_ARRAY_SUPPORT);return r.prototype.update=function(t,r){if(this._finalized)throw new Error("Digest already called");t=function(t,r){if(t instanceof e)return t;if("string"==typeof t)return e.from(t,r);if(n&&ArrayBuffer.isView(t)){if(0===t.byteLength)return e.alloc(0);var i=e.from(t.buffer,t.byteOffset,t.byteLength);if(i.byteLength===t.byteLength)return i}if(o&&t instanceof Uint8Array)return e.from(t);if(e.isBuffer(t)&&t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t))return e.from(t);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}(t,r);for(var i=this._block,a=0;this._blockOffset+t.length-a>=this._blockSize;){for(var s=this._blockOffset;s<this._blockSize;)i[s++]=t[a++];this._update(),this._blockOffset=0}for(;a<t.length;)i[this._blockOffset++]=t[a++];for(var c=0,u=8*t.length;u>0;++c)this._length[c]+=u,(u=this._length[c]/4294967296|0)>0&&(this._length[c]-=4294967296*u);return this},r.prototype._update=function(){throw new Error("_update is not implemented")},r.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},r.prototype._digest=function(){throw new Error("_digest is not implemented")},hashBase=r}function requireMd5_js(){if(hasRequiredMd5_js)return md5_js;hasRequiredMd5_js=1;var e=inherits_browserExports,t=requireHashBase(),r=requireSafeBuffer$1().Buffer,o=new Array(16);function n(){t.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function i(e,t){return e<<t|e>>>32-t}function a(e,t,r,o,n,a,s){return i(e+(t&r|~t&o)+n+a|0,s)+t|0}function s(e,t,r,o,n,a,s){return i(e+(t&o|r&~o)+n+a|0,s)+t|0}function c(e,t,r,o,n,a,s){return i(e+(t^r^o)+n+a|0,s)+t|0}function u(e,t,r,o,n,a,s){return i(e+(r^(t|~o))+n+a|0,s)+t|0}return e(n,t),n.prototype._update=function(){for(var e=o,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,l=this._d;r=a(r,n,i,l,e[0],3614090360,7),l=a(l,r,n,i,e[1],3905402710,12),i=a(i,l,r,n,e[2],606105819,17),n=a(n,i,l,r,e[3],3250441966,22),r=a(r,n,i,l,e[4],4118548399,7),l=a(l,r,n,i,e[5],1200080426,12),i=a(i,l,r,n,e[6],2821735955,17),n=a(n,i,l,r,e[7],4249261313,22),r=a(r,n,i,l,e[8],1770035416,7),l=a(l,r,n,i,e[9],2336552879,12),i=a(i,l,r,n,e[10],4294925233,17),n=a(n,i,l,r,e[11],2304563134,22),r=a(r,n,i,l,e[12],1804603682,7),l=a(l,r,n,i,e[13],4254626195,12),i=a(i,l,r,n,e[14],2792965006,17),r=s(r,n=a(n,i,l,r,e[15],1236535329,22),i,l,e[1],4129170786,5),l=s(l,r,n,i,e[6],3225465664,9),i=s(i,l,r,n,e[11],643717713,14),n=s(n,i,l,r,e[0],3921069994,20),r=s(r,n,i,l,e[5],3593408605,5),l=s(l,r,n,i,e[10],38016083,9),i=s(i,l,r,n,e[15],3634488961,14),n=s(n,i,l,r,e[4],3889429448,20),r=s(r,n,i,l,e[9],568446438,5),l=s(l,r,n,i,e[14],3275163606,9),i=s(i,l,r,n,e[3],4107603335,14),n=s(n,i,l,r,e[8],1163531501,20),r=s(r,n,i,l,e[13],2850285829,5),l=s(l,r,n,i,e[2],4243563512,9),i=s(i,l,r,n,e[7],1735328473,14),r=c(r,n=s(n,i,l,r,e[12],2368359562,20),i,l,e[5],4294588738,4),l=c(l,r,n,i,e[8],2272392833,11),i=c(i,l,r,n,e[11],1839030562,16),n=c(n,i,l,r,e[14],4259657740,23),r=c(r,n,i,l,e[1],2763975236,4),l=c(l,r,n,i,e[4],1272893353,11),i=c(i,l,r,n,e[7],4139469664,16),n=c(n,i,l,r,e[10],3200236656,23),r=c(r,n,i,l,e[13],681279174,4),l=c(l,r,n,i,e[0],3936430074,11),i=c(i,l,r,n,e[3],3572445317,16),n=c(n,i,l,r,e[6],76029189,23),r=c(r,n,i,l,e[9],3654602809,4),l=c(l,r,n,i,e[12],3873151461,11),i=c(i,l,r,n,e[15],530742520,16),r=u(r,n=c(n,i,l,r,e[2],3299628645,23),i,l,e[0],4096336452,6),l=u(l,r,n,i,e[7],1126891415,10),i=u(i,l,r,n,e[14],2878612391,15),n=u(n,i,l,r,e[5],4237533241,21),r=u(r,n,i,l,e[12],1700485571,6),l=u(l,r,n,i,e[3],2399980690,10),i=u(i,l,r,n,e[10],4293915773,15),n=u(n,i,l,r,e[1],2240044497,21),r=u(r,n,i,l,e[8],1873313359,6),l=u(l,r,n,i,e[15],4264355552,10),i=u(i,l,r,n,e[6],2734768916,15),n=u(n,i,l,r,e[13],1309151649,21),r=u(r,n,i,l,e[4],4149444226,6),l=u(l,r,n,i,e[11],3174756917,10),i=u(i,l,r,n,e[2],718787259,15),n=u(n,i,l,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+l|0},n.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=r.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},md5_js=n}function requireRipemd160(){if(hasRequiredRipemd160)return ripemd160;hasRequiredRipemd160=1;var e=require$$0$2.Buffer,t=inherits_browserExports,r=requireHashBase(),o=new Array(16),n=[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],i=[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],a=[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],s=[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],c=[0,1518500249,1859775393,2400959708,2840853838],u=[1352829926,1548603684,1836072691,2053994217,0];function l(){r.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function d(e,t){return e<<t|e>>>32-t}function p(e,t,r,o,n,i,a,s){return d(e+(t^r^o)+i+a|0,s)+n|0}function h(e,t,r,o,n,i,a,s){return d(e+(t&r|~t&o)+i+a|0,s)+n|0}function f(e,t,r,o,n,i,a,s){return d(e+((t|~r)^o)+i+a|0,s)+n|0}function m(e,t,r,o,n,i,a,s){return d(e+(t&o|r&~o)+i+a|0,s)+n|0}function y(e,t,r,o,n,i,a,s){return d(e+(t^(r|~o))+i+a|0,s)+n|0}return t(l,r),l.prototype._update=function(){for(var e=o,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,l=0|this._b,g=0|this._c,b=0|this._d,v=0|this._e,w=0|this._a,$=0|this._b,k=0|this._c,_=0|this._d,T=0|this._e,I=0;I<80;I+=1){var A,O;I<16?(A=p(r,l,g,b,v,e[n[I]],c[0],a[I]),O=y(w,$,k,_,T,e[i[I]],u[0],s[I])):I<32?(A=h(r,l,g,b,v,e[n[I]],c[1],a[I]),O=m(w,$,k,_,T,e[i[I]],u[1],s[I])):I<48?(A=f(r,l,g,b,v,e[n[I]],c[2],a[I]),O=f(w,$,k,_,T,e[i[I]],u[2],s[I])):I<64?(A=m(r,l,g,b,v,e[n[I]],c[3],a[I]),O=h(w,$,k,_,T,e[i[I]],u[3],s[I])):(A=y(r,l,g,b,v,e[n[I]],c[4],a[I]),O=p(w,$,k,_,T,e[i[I]],u[4],s[I])),r=v,v=b,b=d(g,10),g=l,l=A,w=T,T=_,_=d(k,10),k=$,$=O}var E=this._b+g+_|0;this._b=this._c+b+T|0,this._c=this._d+v+w|0,this._d=this._e+r+$|0,this._e=this._a+l+k|0,this._a=E},l.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 t=e.alloc?e.alloc(20):new e(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},ripemd160=l}var sha_js={exports:{}},hash$4,hasRequiredHash,sha$1,hasRequiredSha,sha1,hasRequiredSha1,sha256$1,hasRequiredSha256,sha224$1,hasRequiredSha224,sha512$1,hasRequiredSha512,sha384$1,hasRequiredSha384,hasRequiredSha_js,cipherBase,hasRequiredCipherBase,browser$b,hasRequiredBrowser$9,legacy$1,hasRequiredLegacy,md5,hasRequiredMd5,browser$a,hasRequiredBrowser$8;function requireHash(){if(hasRequiredHash)return hash$4;hasRequiredHash=1;var e=requireSafeBuffer$1().Buffer;function t(t,r){this._block=e.alloc(t),this._finalSize=r,this._blockSize=t,this._len=0}return t.prototype.update=function(t,r){"string"==typeof t&&(r=r||"utf8",t=e.from(t,r));for(var o=this._block,n=this._blockSize,i=t.length,a=this._len,s=0;s<i;){for(var c=a%n,u=Math.min(i-s,n-c),l=0;l<u;l++)o[c+l]=t[s+l];s+=u,(a+=u)%n==0&&this._update(o)}return this._len+=i,this},t.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 o=(4294967295&r)>>>0,n=(r-o)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(o,this._blockSize-4)}this._update(this._block);var i=this._hash();return e?i.toString(e):i},t.prototype._update=function(){throw new Error("_update must be implemented by subclass")},hash$4=t}function requireSha(){if(hasRequiredSha)return sha$1;hasRequiredSha=1;var e=inherits_browserExports,t=requireHash(),r=requireSafeBuffer$1().Buffer,o=[1518500249,1859775393,-1894007588,-899497514],n=new Array(80);function i(){this.init(),this._w=n,t.call(this,64,56)}function a(e){return e<<30|e>>>2}function s(e,t,r,o){return 0===e?t&r|~t&o:2===e?t&r|t&o|r&o:t^r^o}return e(i,t),i.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},i.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,c=0|this._c,u=0|this._d,l=0|this._e,d=0;d<16;++d)r[d]=e.readInt32BE(4*d);for(;d<80;++d)r[d]=r[d-3]^r[d-8]^r[d-14]^r[d-16];for(var p=0;p<80;++p){var h=~~(p/20),f=0|((t=n)<<5|t>>>27)+s(h,i,c,u)+l+r[p]+o[h];l=u,u=c,c=a(i),i=n,n=f}this._a=n+this._a|0,this._b=i+this._b|0,this._c=c+this._c|0,this._d=u+this._d|0,this._e=l+this._e|0},i.prototype._hash=function(){var e=r.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},sha$1=i}function requireSha1(){if(hasRequiredSha1)return sha1;hasRequiredSha1=1;var e=inherits_browserExports,t=requireHash(),r=requireSafeBuffer$1().Buffer,o=[1518500249,1859775393,-1894007588,-899497514],n=new Array(80);function i(){this.init(),this._w=n,t.call(this,64,56)}function a(e){return e<<5|e>>>27}function s(e){return e<<30|e>>>2}function c(e,t,r,o){return 0===e?t&r|~t&o:2===e?t&r|t&o|r&o:t^r^o}return e(i,t),i.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},i.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,u=0|this._c,l=0|this._d,d=0|this._e,p=0;p<16;++p)r[p]=e.readInt32BE(4*p);for(;p<80;++p)r[p]=(t=r[p-3]^r[p-8]^r[p-14]^r[p-16])<<1|t>>>31;for(var h=0;h<80;++h){var f=~~(h/20),m=a(n)+c(f,i,u,l)+d+r[h]+o[f]|0;d=l,l=u,u=s(i),i=n,n=m}this._a=n+this._a|0,this._b=i+this._b|0,this._c=u+this._c|0,this._d=l+this._d|0,this._e=d+this._e|0},i.prototype._hash=function(){var e=r.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},sha1=i}function requireSha256(){if(hasRequiredSha256)return sha256$1;hasRequiredSha256=1;var e=inherits_browserExports,t=requireHash(),r=requireSafeBuffer$1().Buffer,o=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],n=new Array(64);function i(){this.init(),this._w=n,t.call(this,64,56)}function a(e,t,r){return r^e&(t^r)}function s(e,t,r){return e&t|r&(e|t)}function c(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function u(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function l(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}return e(i,t),i.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},i.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,d=0|this._c,p=0|this._d,h=0|this._e,f=0|this._f,m=0|this._g,y=0|this._h,g=0;g<16;++g)r[g]=e.readInt32BE(4*g);for(;g<64;++g)r[g]=0|(((t=r[g-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[g-7]+l(r[g-15])+r[g-16];for(var b=0;b<64;++b){var v=y+u(h)+a(h,f,m)+o[b]+r[b]|0,w=c(n)+s(n,i,d)|0;y=m,m=f,f=h,h=p+v|0,p=d,d=i,i=n,n=v+w|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=d+this._c|0,this._d=p+this._d|0,this._e=h+this._e|0,this._f=f+this._f|0,this._g=m+this._g|0,this._h=y+this._h|0},i.prototype._hash=function(){var e=r.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},sha256$1=i}function requireSha224(){if(hasRequiredSha224)return sha224$1;hasRequiredSha224=1;var e=inherits_browserExports,t=requireSha256(),r=requireHash(),o=requireSafeBuffer$1().Buffer,n=new Array(64);function i(){this.init(),this._w=n,r.call(this,64,56)}return e(i,t),i.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},i.prototype._hash=function(){var e=o.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},sha224$1=i}function requireSha512(){if(hasRequiredSha512)return sha512$1;hasRequiredSha512=1;var e=inherits_browserExports,t=requireHash(),r=requireSafeBuffer$1().Buffer,o=[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],n=new Array(160);function i(){this.init(),this._w=n,t.call(this,128,112)}function a(e,t,r){return r^e&(t^r)}function s(e,t,r){return e&t|r&(e|t)}function c(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function u(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function l(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function d(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function p(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function h(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function f(e,t){return e>>>0<t>>>0?1:0}return e(i,t),i.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},i.prototype._update=function(e){for(var t=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,m=0|this._dh,y=0|this._eh,g=0|this._fh,b=0|this._gh,v=0|this._hh,w=0|this._al,$=0|this._bl,k=0|this._cl,_=0|this._dl,T=0|this._el,I=0|this._fl,A=0|this._gl,O=0|this._hl,E=0;E<32;E+=2)t[E]=e.readInt32BE(4*E),t[E+1]=e.readInt32BE(4*E+4);for(;E<160;E+=2){var S=t[E-30],R=t[E-30+1],x=l(S,R),C=d(R,S),P=p(S=t[E-4],R=t[E-4+1]),N=h(R,S),B=t[E-14],D=t[E-14+1],M=t[E-32],L=t[E-32+1],j=C+D|0,F=x+B+f(j,C)|0;F=(F=F+P+f(j=j+N|0,N)|0)+M+f(j=j+L|0,L)|0,t[E]=F,t[E+1]=j}for(var U=0;U<160;U+=2){F=t[U],j=t[U+1];var K=s(r,n,i),q=s(w,$,k),G=c(r,w),H=c(w,r),V=u(y,T),W=u(T,y),z=o[U],Z=o[U+1],Q=a(y,g,b),Y=a(T,I,A),X=O+W|0,J=v+V+f(X,O)|0;J=(J=(J=J+Q+f(X=X+Y|0,Y)|0)+z+f(X=X+Z|0,Z)|0)+F+f(X=X+j|0,j)|0;var ee=H+q|0,te=G+K+f(ee,H)|0;v=b,O=A,b=g,A=I,g=y,I=T,y=m+J+f(T=_+X|0,_)|0,m=i,_=k,i=n,k=$,n=r,$=w,r=J+te+f(w=X+ee|0,X)|0}this._al=this._al+w|0,this._bl=this._bl+$|0,this._cl=this._cl+k|0,this._dl=this._dl+_|0,this._el=this._el+T|0,this._fl=this._fl+I|0,this._gl=this._gl+A|0,this._hl=this._hl+O|0,this._ah=this._ah+r+f(this._al,w)|0,this._bh=this._bh+n+f(this._bl,$)|0,this._ch=this._ch+i+f(this._cl,k)|0,this._dh=this._dh+m+f(this._dl,_)|0,this._eh=this._eh+y+f(this._el,T)|0,this._fh=this._fh+g+f(this._fl,I)|0,this._gh=this._gh+b+f(this._gl,A)|0,this._hh=this._hh+v+f(this._hl,O)|0},i.prototype._hash=function(){var e=r.allocUnsafe(64);function t(t,r,o){e.writeInt32BE(t,o),e.writeInt32BE(r,o+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},sha512$1=i}function requireSha384(){if(hasRequiredSha384)return sha384$1;hasRequiredSha384=1;var e=inherits_browserExports,t=requireSha512(),r=requireHash(),o=requireSafeBuffer$1().Buffer,n=new Array(160);function i(){this.init(),this._w=n,r.call(this,128,112)}return e(i,t),i.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},i.prototype._hash=function(){var e=o.allocUnsafe(48);function t(t,r,o){e.writeInt32BE(t,o),e.writeInt32BE(r,o+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},sha384$1=i}function requireSha_js(){if(hasRequiredSha_js)return sha_js.exports;hasRequiredSha_js=1;var e=sha_js.exports=function(t){t=t.toLowerCase();var r=e[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r};return e.sha=requireSha(),e.sha1=requireSha1(),e.sha224=requireSha224(),e.sha256=requireSha256(),e.sha384=requireSha384(),e.sha512=requireSha512(),sha_js.exports}function requireCipherBase(){if(hasRequiredCipherBase)return cipherBase;hasRequiredCipherBase=1;var e=requireSafeBuffer$1().Buffer,t=requireStreamBrowserify().Transform,r=requireString_decoder().StringDecoder;function o(e){t.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}inherits_browserExports(o,t);var n="undefined"!=typeof Uint8Array,i="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&ArrayBuffer.isView&&(e.prototype instanceof Uint8Array||e.TYPED_ARRAY_SUPPORT);return o.prototype.update=function(t,r,o){var a=function(t,r){if(t instanceof e)return t;if("string"==typeof t)return e.from(t,r);if(i&&ArrayBuffer.isView(t)){if(0===t.byteLength)return e.alloc(0);var o=e.from(t.buffer,t.byteOffset,t.byteLength);if(o.byteLength===t.byteLength)return o}if(n&&t instanceof Uint8Array)return e.from(t);if(e.isBuffer(t)&&t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t))return e.from(t);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}(t,r),s=this._update(a);return this.hashMode?this:(o&&(s=this._toString(s,o)),s)},o.prototype.setAutoPadding=function(){},o.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},o.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},o.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},o.prototype._transform=function(e,t,r){var o;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(n){o=n}finally{r(o)}},o.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(r){t=r}e(t)},o.prototype._finalOrDigest=function(t){var r=this.__final()||e.alloc(0);return t&&(r=this._toString(r,t,!0)),r},o.prototype._toString=function(e,t,o){if(this._decoder||(this._decoder=new r(t),this._encoding=t),this._encoding!==t)throw new Error("can’t switch encodings");var n=this._decoder.write(e);return o&&(n+=this._decoder.end()),n},cipherBase=o}function requireBrowser$9(){if(hasRequiredBrowser$9)return browser$b;hasRequiredBrowser$9=1;var e=inherits_browserExports,t=requireMd5_js(),r=requireRipemd160(),o=requireSha_js(),n=requireCipherBase();function i(e){n.call(this,"digest"),this._hash=e}return e(i,n),i.prototype._update=function(e){this._hash.update(e)},i.prototype._final=function(){return this._hash.digest()},browser$b=function(e){return"md5"===(e=e.toLowerCase())?new t:"rmd160"===e||"ripemd160"===e?new r:new i(o(e))}}function requireLegacy(){if(hasRequiredLegacy)return legacy$1;hasRequiredLegacy=1;var e=inherits_browserExports,t=requireSafeBuffer$1().Buffer,r=requireCipherBase(),o=t.alloc(128),n=64;function i(e,i){r.call(this,"digest"),"string"==typeof i&&(i=t.from(i)),this._alg=e,this._key=i,i.length>n?i=e(i):i.length<n&&(i=t.concat([i,o],n));for(var a=this._ipad=t.allocUnsafe(n),s=this._opad=t.allocUnsafe(n),c=0;c<n;c++)a[c]=54^i[c],s[c]=92^i[c];this._hash=[a]}return e(i,r),i.prototype._update=function(e){this._hash.push(e)},i.prototype._final=function(){var e=this._alg(t.concat(this._hash));return this._alg(t.concat([this._opad,e]))},legacy$1=i}function requireMd5(){if(hasRequiredMd5)return md5;hasRequiredMd5=1;var e=requireMd5_js();return md5=function(t){return(new e).update(t).digest()}}function requireBrowser$8(){if(hasRequiredBrowser$8)return browser$a;hasRequiredBrowser$8=1;var e=inherits_browserExports,t=requireLegacy(),r=requireCipherBase(),o=requireSafeBuffer$1().Buffer,n=requireMd5(),i=requireRipemd160(),a=requireSha_js(),s=o.alloc(128);function c(e,t){r.call(this,"digest"),"string"==typeof t&&(t=o.from(t));var n="sha512"===e||"sha384"===e?128:64;(this._alg=e,this._key=t,t.length>n)?t=("rmd160"===e?new i:a(e)).update(t).digest():t.length<n&&(t=o.concat([t,s],n));for(var c=this._ipad=o.allocUnsafe(n),u=this._opad=o.allocUnsafe(n),l=0;l<n;l++)c[l]=54^t[l],u[l]=92^t[l];this._hash="rmd160"===e?new i:a(e),this._hash.update(c)}return e(c,r),c.prototype._update=function(e){this._hash.update(e)},c.prototype._final=function(){var e=this._hash.digest();return("rmd160"===this._alg?new i:a(this._alg)).update(this._opad).update(e).digest()},browser$a=function(e,r){return"rmd160"===(e=e.toLowerCase())||"ripemd160"===e?new c("rmd160",r):"md5"===e?new t(n,r):new c(e,r)}}const sha224WithRSAEncryption={sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption={sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption={sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption={sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},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={sign:"dsa",hash:"sha1",id:""},ripemd160WithRSA={sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption={sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},require$$6={sha224WithRSAEncryption:sha224WithRSAEncryption,"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:sha256WithRSAEncryption,"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:sha384WithRSAEncryption,"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:sha512WithRSAEncryption,"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:sha256,sha224:sha224,sha384:sha384,sha512:sha512,"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:DSA,"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:ripemd160WithRSA,"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:md5WithRSAEncryption,"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}};var algos,hasRequiredAlgos;function requireAlgos(){return hasRequiredAlgos?algos:(hasRequiredAlgos=1,algos=require$$6)}var browser$9={},precondition,hasRequiredPrecondition,defaultEncoding_1,hasRequiredDefaultEncoding,toBuffer,hasRequiredToBuffer,syncBrowser,hasRequiredSyncBrowser,async,hasRequiredAsync,hasRequiredBrowser$7;function requirePrecondition(){if(hasRequiredPrecondition)return precondition;hasRequiredPrecondition=1;var e=Math.pow(2,30)-1;return precondition=function(t,r){if("number"!=typeof t)throw new TypeError("Iterations not a number");if(t<0)throw new TypeError("Bad iterations");if("number"!=typeof r)throw new TypeError("Key length not a number");if(r<0||r>e||r!=r)throw new TypeError("Bad key length")}}function requireDefaultEncoding(){if(hasRequiredDefaultEncoding)return defaultEncoding_1;var e;if(hasRequiredDefaultEncoding=1,commonjsGlobal.process&&commonjsGlobal.process.browser)e="utf-8";else if(commonjsGlobal.process&&commonjsGlobal.process.version){e=parseInt(process$1$1.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else e="utf-8";return defaultEncoding_1=e}function requireToBuffer(){if(hasRequiredToBuffer)return toBuffer;hasRequiredToBuffer=1;var e=requireSafeBuffer$1().Buffer;return toBuffer=function(t,r,o){if(e.isBuffer(t))return t;if("string"==typeof t)return e.from(t,r);if(ArrayBuffer.isView(t))return e.from(t.buffer);throw new TypeError(o+" must be a string, a Buffer, a typed array or a DataView")}}function requireSyncBrowser(){if(hasRequiredSyncBrowser)return syncBrowser;hasRequiredSyncBrowser=1;var e=requireMd5(),t=requireRipemd160(),r=requireSha_js(),o=requireSafeBuffer$1().Buffer,n=requirePrecondition(),i=requireDefaultEncoding(),a=requireToBuffer(),s=o.alloc(128),c={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function u(n,i,a){var u=function(o){function n(e){return r(o).update(e).digest()}function i(e){return(new t).update(e).digest()}return"rmd160"===o||"ripemd160"===o?i:"md5"===o?e:n}(n),l="sha512"===n||"sha384"===n?128:64;i.length>l?i=u(i):i.length<l&&(i=o.concat([i,s],l));for(var d=o.allocUnsafe(l+c[n]),p=o.allocUnsafe(l+c[n]),h=0;h<l;h++)d[h]=54^i[h],p[h]=92^i[h];var f=o.allocUnsafe(l+a+4);d.copy(f,0,0,l),this.ipad1=f,this.ipad2=d,this.opad=p,this.alg=n,this.blocksize=l,this.hash=u,this.size=c[n]}return u.prototype.run=function(e,t){return e.copy(t,this.blocksize),this.hash(t).copy(this.opad,this.blocksize),this.hash(this.opad)},syncBrowser=function(e,t,r,s,l){n(r,s);var d=new u(l=l||"sha1",e=a(e,i,"Password"),(t=a(t,i,"Salt")).length),p=o.allocUnsafe(s),h=o.allocUnsafe(t.length+4);t.copy(h,0,0,t.length);for(var f=0,m=c[l],y=Math.ceil(s/m),g=1;g<=y;g++){h.writeUInt32BE(g,t.length);for(var b=d.run(h,d.ipad1),v=b,w=1;w<r;w++){v=d.run(v,d.ipad2);for(var $=0;$<m;$++)b[$]^=v[$]}b.copy(p,f),f+=m}return p}}function requireAsync(){if(hasRequiredAsync)return async;hasRequiredAsync=1;var e,t,r=requireSafeBuffer$1().Buffer,o=requirePrecondition(),n=requireDefaultEncoding(),i=requireSyncBrowser(),a=requireToBuffer(),s=commonjsGlobal.crypto&&commonjsGlobal.crypto.subtle,c={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"},u=[];function l(){return t||(t=commonjsGlobal.process&&commonjsGlobal.process.nextTick?commonjsGlobal.process.nextTick:commonjsGlobal.queueMicrotask?commonjsGlobal.queueMicrotask:commonjsGlobal.setImmediate?commonjsGlobal.setImmediate:commonjsGlobal.setTimeout)}function d(e,t,o,n,i){return s.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]).then((function(e){return s.deriveBits({name:"PBKDF2",salt:t,iterations:o,hash:{name:i}},e,n<<3)})).then((function(e){return r.from(e)}))}return async=function(t,p,h,f,m,y){"function"==typeof m&&(y=m,m=void 0);var g=c[(m=m||"sha1").toLowerCase()];if(g&&"function"==typeof commonjsGlobal.Promise){if(o(h,f),t=a(t,n,"Password"),p=a(p,n,"Salt"),"function"!=typeof y)throw new Error("No callback provided to pbkdf2");!function(e,t){e.then((function(e){l()((function(){t(null,e)}))}),(function(e){l()((function(){t(e)}))}))}(function(t){if(commonjsGlobal.process&&!commonjsGlobal.process.browser)return Promise.resolve(!1);if(!s||!s.importKey||!s.deriveBits)return Promise.resolve(!1);if(void 0!==u[t])return u[t];var o=d(e=e||r.alloc(8),e,10,128,t).then((function(){return!0})).catch((function(){return!1}));return u[t]=o,o}(g).then((function(e){return e?d(t,p,h,f,g):i(t,p,h,f,m)})),y)}else l()((function(){var e;try{e=i(t,p,h,f,m)}catch(r){return y(r)}y(null,e)}))}}function requireBrowser$7(){return hasRequiredBrowser$7||(hasRequiredBrowser$7=1,browser$9.pbkdf2=requireAsync(),browser$9.pbkdf2Sync=requireSyncBrowser()),browser$9}var browser$8={},des$1={},utils$p={},hasRequiredUtils;function requireUtils(){if(hasRequiredUtils)return utils$p;hasRequiredUtils=1,utils$p.readUInt32BE=function(e,t){return(e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])>>>0},utils$p.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},utils$p.ip=function(e,t,r,o){for(var n=0,i=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)i<<=1,i|=t>>>s+a&1;for(s=1;s<=25;s+=8)i<<=1,i|=e>>>s+a&1}r[o+0]=n>>>0,r[o+1]=i>>>0},utils$p.rip=function(e,t,r,o){for(var n=0,i=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)i<<=1,i|=t>>>s+a&1,i<<=1,i|=e>>>s+a&1;r[o+0]=n>>>0,r[o+1]=i>>>0},utils$p.pc1=function(e,t,r,o){for(var n=0,i=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)i<<=1,i|=t>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1}for(s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1;r[o+0]=n>>>0,r[o+1]=i>>>0},utils$p.r28shl=function(e,t){return e<<t&268435455|e>>>28-t};var e=[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];utils$p.pc2=function(t,r,o,n){for(var i=0,a=0,s=e.length>>>1,c=0;c<s;c++)i<<=1,i|=t>>>e[c]&1;for(c=s;c<e.length;c++)a<<=1,a|=r>>>e[c]&1;o[n+0]=i>>>0,o[n+1]=a>>>0},utils$p.expand=function(e,t,r){var o=0,n=0;o=(1&e)<<5|e>>>27;for(var i=23;i>=15;i-=4)o<<=6,o|=e>>>i&63;for(i=11;i>=3;i-=4)n|=e>>>i&63,n<<=6;n|=(31&e)<<1|e>>>31,t[r+0]=o>>>0,t[r+1]=n>>>0};var t=[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];utils$p.substitute=function(e,r){for(var o=0,n=0;n<4;n++){o<<=4,o|=t[64*n+(e>>>18-6*n&63)]}for(n=0;n<4;n++){o<<=4,o|=t[256+64*n+(r>>>18-6*n&63)]}return o>>>0};var r=[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];return utils$p.permute=function(e){for(var t=0,o=0;o<r.length;o++)t<<=1,t|=e>>>r[o]&1;return t>>>0},utils$p.padSplit=function(e,t,r){for(var o=e.toString(2);o.length<t;)o="0"+o;for(var n=[],i=0;i<t;i+=r)n.push(o.slice(i,i+r));return n.join(" ")},utils$p}var minimalisticAssert=assert$f,cipher,hasRequiredCipher,des,hasRequiredDes$1;function assert$f(e,t){if(!e)throw new Error(t||"Assertion failed")}function requireCipher(){if(hasRequiredCipher)return cipher;hasRequiredCipher=1;var e=minimalisticAssert;function t(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}return cipher=t,t.prototype._init=function(){},t.prototype.update=function(e){return 0===e.length?[]:"decrypt"===this.type?this._updateDecrypt(e):this._updateEncrypt(e)},t.prototype._buffer=function(e,t){for(var r=Math.min(this.buffer.length-this.bufferOff,e.length-t),o=0;o<r;o++)this.buffer[this.bufferOff+o]=e[t+o];return this.bufferOff+=r,r},t.prototype._flushBuffer=function(e,t){return this._update(this.buffer,0,e,t),this.bufferOff=0,this.blockSize},t.prototype._updateEncrypt=function(e){var t=0,r=0,o=(this.bufferOff+e.length)/this.blockSize|0,n=new Array(o*this.blockSize);0!==this.bufferOff&&(t+=this._buffer(e,t),this.bufferOff===this.buffer.length&&(r+=this._flushBuffer(n,r)));for(var i=e.length-(e.length-t)%this.blockSize;t<i;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},t.prototype._updateDecrypt=function(e){for(var t=0,r=0,o=Math.ceil((this.bufferOff+e.length)/this.blockSize)-1,n=new Array(o*this.blockSize);o>0;o--)t+=this._buffer(e,t),r+=this._flushBuffer(n,r);return t+=this._buffer(e,t),n},t.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},t.prototype._pad=function(e,t){if(0===t)return!1;for(;t<e.length;)e[t++]=0;return!0},t.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},t.prototype._unpad=function(e){return e},t.prototype._finalDecrypt=function(){e.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var t=new Array(this.blockSize);return this._flushBuffer(t,0),this._unpad(t)},cipher}function requireDes$1(){if(hasRequiredDes$1)return des;hasRequiredDes$1=1;var e=minimalisticAssert,t=inherits_browserExports,r=requireUtils(),o=requireCipher();function n(){this.tmp=new Array(2),this.keys=null}function i(e){o.call(this,e);var t=new n;this._desState=t,this.deriveKeys(t,e.key)}t(i,o),des=i,i.create=function(e){return new i(e)};var a=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];return i.prototype.deriveKeys=function(t,o){t.keys=new Array(32),e.equal(o.length,this.blockSize,"Invalid key length");var n=r.readUInt32BE(o,0),i=r.readUInt32BE(o,4);r.pc1(n,i,t.tmp,0),n=t.tmp[0],i=t.tmp[1];for(var s=0;s<t.keys.length;s+=2){var c=a[s>>>1];n=r.r28shl(n,c),i=r.r28shl(i,c),r.pc2(n,i,t.keys,s)}},i.prototype._update=function(e,t,o,n){var i=this._desState,a=r.readUInt32BE(e,t),s=r.readUInt32BE(e,t+4);r.ip(a,s,i.tmp,0),a=i.tmp[0],s=i.tmp[1],"encrypt"===this.type?this._encrypt(i,a,s,i.tmp,0):this._decrypt(i,a,s,i.tmp,0),a=i.tmp[0],s=i.tmp[1],r.writeUInt32BE(o,a,n),r.writeUInt32BE(o,s,n+4)},i.prototype._pad=function(e,t){if(!1===this.padding)return!1;for(var r=e.length-t,o=t;o<e.length;o++)e[o]=r;return!0},i.prototype._unpad=function(t){if(!1===this.padding)return t;for(var r=t[t.length-1],o=t.length-r;o<t.length;o++)e.equal(t[o],r);return t.slice(0,t.length-r)},i.prototype._encrypt=function(e,t,o,n,i){for(var a=t,s=o,c=0;c<e.keys.length;c+=2){var u=e.keys[c],l=e.keys[c+1];r.expand(s,e.tmp,0),u^=e.tmp[0],l^=e.tmp[1];var d=r.substitute(u,l),p=s;s=(a^r.permute(d))>>>0,a=p}r.rip(s,a,n,i)},i.prototype._decrypt=function(e,t,o,n,i){for(var a=o,s=t,c=e.keys.length-2;c>=0;c-=2){var u=e.keys[c],l=e.keys[c+1];r.expand(a,e.tmp,0),u^=e.tmp[0],l^=e.tmp[1];var d=r.substitute(u,l),p=a;a=(s^r.permute(d))>>>0,s=p}r.rip(a,s,n,i)},des}assert$f.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var cbc$1={},hasRequiredCbc$1,ede,hasRequiredEde,hasRequiredDes,browserifyDes,hasRequiredBrowserifyDes;function requireCbc$1(){if(hasRequiredCbc$1)return cbc$1;hasRequiredCbc$1=1;var e=minimalisticAssert,t=inherits_browserExports,r={};function o(t){e.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var r=0;r<this.iv.length;r++)this.iv[r]=t[r]}return cbc$1.instantiate=function(e){function o(t){e.call(this,t),this._cbcInit()}t(o,e);for(var n=Object.keys(r),i=0;i<n.length;i++){var a=n[i];o.prototype[a]=r[a]}return o.create=function(e){return new o(e)},o},r._cbcInit=function(){var e=new o(this.options.iv);this._cbcState=e},r._update=function(e,t,r,o){var n=this._cbcState,i=this.constructor.super_.prototype,a=n.iv;if("encrypt"===this.type){for(var s=0;s<this.blockSize;s++)a[s]^=e[t+s];i._update.call(this,a,0,r,o);for(s=0;s<this.blockSize;s++)a[s]=r[o+s]}else{i._update.call(this,e,t,r,o);for(s=0;s<this.blockSize;s++)r[o+s]^=a[s];for(s=0;s<this.blockSize;s++)a[s]=e[t+s]}},cbc$1}function requireEde(){if(hasRequiredEde)return ede;hasRequiredEde=1;var e=minimalisticAssert,t=inherits_browserExports,r=requireCipher(),o=requireDes$1();function n(t,r){e.equal(r.length,24,"Invalid key length");var n=r.slice(0,8),i=r.slice(8,16),a=r.slice(16,24);this.ciphers="encrypt"===t?[o.create({type:"encrypt",key:n}),o.create({type:"decrypt",key:i}),o.create({type:"encrypt",key:a})]:[o.create({type:"decrypt",key:a}),o.create({type:"encrypt",key:i}),o.create({type:"decrypt",key:n})]}function i(e){r.call(this,e);var t=new n(this.type,this.options.key);this._edeState=t}return t(i,r),ede=i,i.create=function(e){return new i(e)},i.prototype._update=function(e,t,r,o){var n=this._edeState;n.ciphers[0]._update(e,t,r,o),n.ciphers[1]._update(r,o,r,o),n.ciphers[2]._update(r,o,r,o)},i.prototype._pad=o.prototype._pad,i.prototype._unpad=o.prototype._unpad,ede}function requireDes(){return hasRequiredDes||(hasRequiredDes=1,des$1.utils=requireUtils(),des$1.Cipher=requireCipher(),des$1.DES=requireDes$1(),des$1.CBC=requireCbc$1(),des$1.EDE=requireEde()),des$1}function requireBrowserifyDes(){if(hasRequiredBrowserifyDes)return browserifyDes;hasRequiredBrowserifyDes=1;var e=requireCipherBase(),t=requireDes(),r=inherits_browserExports,o=requireSafeBuffer$1().Buffer,n={"des-ede3-cbc":t.CBC.instantiate(t.EDE),"des-ede3":t.EDE,"des-ede-cbc":t.CBC.instantiate(t.EDE),"des-ede":t.EDE,"des-cbc":t.CBC.instantiate(t.DES),"des-ecb":t.DES};function i(t){e.call(this);var r,i=t.mode.toLowerCase(),a=n[i];r=t.decrypt?"decrypt":"encrypt";var s=t.key;o.isBuffer(s)||(s=o.from(s)),"des-ede"!==i&&"des-ede-cbc"!==i||(s=o.concat([s,s.slice(0,8)]));var c=t.iv;o.isBuffer(c)||(c=o.from(c)),this._des=a.create({key:s,iv:c,type:r})}return n.des=n["des-cbc"],n.des3=n["des-ede3-cbc"],browserifyDes=i,r(i,e),i.prototype._update=function(e){return o.from(this._des.update(e))},i.prototype._final=function(){return o.from(this._des.final())},browserifyDes}var browser$7={},encrypter={},ecb={},hasRequiredEcb;function requireEcb(){return hasRequiredEcb||(hasRequiredEcb=1,ecb.encrypt=function(e,t){return e._cipher.encryptBlock(t)},ecb.decrypt=function(e,t){return e._cipher.decryptBlock(t)}),ecb}var cbc={},bufferXor,hasRequiredBufferXor,hasRequiredCbc;function requireBufferXor(){return hasRequiredBufferXor?bufferXor:(hasRequiredBufferXor=1,bufferXor=function(e,t){for(var r=Math.min(e.length,t.length),o=new Buffer(r),n=0;n<r;++n)o[n]=e[n]^t[n];return o})}function requireCbc(){if(hasRequiredCbc)return cbc;hasRequiredCbc=1;var e=requireBufferXor();return cbc.encrypt=function(t,r){var o=e(r,t._prev);return t._prev=t._cipher.encryptBlock(o),t._prev},cbc.decrypt=function(t,r){var o=t._prev;t._prev=r;var n=t._cipher.decryptBlock(r);return e(n,o)},cbc}var cfb={},hasRequiredCfb;function requireCfb(){if(hasRequiredCfb)return cfb;hasRequiredCfb=1;var e=requireSafeBuffer$1().Buffer,t=requireBufferXor();function r(r,o,n){var i=o.length,a=t(o,r._cache);return r._cache=r._cache.slice(i),r._prev=e.concat([r._prev,n?o:a]),a}return cfb.encrypt=function(t,o,n){for(var i,a=e.allocUnsafe(0);o.length;){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=e.allocUnsafe(0)),!(t._cache.length<=o.length)){a=e.concat([a,r(t,o,n)]);break}i=t._cache.length,a=e.concat([a,r(t,o.slice(0,i),n)]),o=o.slice(i)}return a},cfb}var cfb8={},hasRequiredCfb8;function requireCfb8(){if(hasRequiredCfb8)return cfb8;hasRequiredCfb8=1;var e=requireSafeBuffer$1().Buffer;function t(t,r,o){var n=t._cipher.encryptBlock(t._prev)[0]^r;return t._prev=e.concat([t._prev.slice(1),e.from([o?r:n])]),n}return cfb8.encrypt=function(r,o,n){for(var i=o.length,a=e.allocUnsafe(i),s=-1;++s<i;)a[s]=t(r,o[s],n);return a},cfb8}var cfb1={},hasRequiredCfb1;function requireCfb1(){if(hasRequiredCfb1)return cfb1;hasRequiredCfb1=1;var e=requireSafeBuffer$1().Buffer;function t(e,t,o){for(var n,i,a=-1,s=0;++a<8;)n=t&1<<7-a?128:0,s+=(128&(i=e._cipher.encryptBlock(e._prev)[0]^n))>>a%8,e._prev=r(e._prev,o?n:i);return s}function r(t,r){var o=t.length,n=-1,i=e.allocUnsafe(t.length);for(t=e.concat([t,e.from([r])]);++n<o;)i[n]=t[n]<<1|t[n+1]>>7;return i}return cfb1.encrypt=function(r,o,n){for(var i=o.length,a=e.allocUnsafe(i),s=-1;++s<i;)a[s]=t(r,o[s],n);return a},cfb1}var ofb={},hasRequiredOfb;function requireOfb(){if(hasRequiredOfb)return ofb;hasRequiredOfb=1;var e=requireBufferXor();function t(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}return ofb.encrypt=function(r,o){for(;r._cache.length<o.length;)r._cache=Buffer.concat([r._cache,t(r)]);var n=r._cache.slice(0,o.length);return r._cache=r._cache.slice(o.length),e(o,n)},ofb}var ctr={},incr32_1,hasRequiredIncr32,hasRequiredCtr;function requireIncr32(){if(hasRequiredIncr32)return incr32_1;return hasRequiredIncr32=1,incr32_1=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 requireCtr(){if(hasRequiredCtr)return ctr;hasRequiredCtr=1;var e=requireBufferXor(),t=requireSafeBuffer$1().Buffer,r=requireIncr32();function o(e){var t=e._cipher.encryptBlockRaw(e._prev);return r(e._prev),t}return ctr.encrypt=function(r,n){var i=Math.ceil(n.length/16),a=r._cache.length;r._cache=t.concat([r._cache,t.allocUnsafe(16*i)]);for(var s=0;s<i;s++){var c=o(r),u=a+16*s;r._cache.writeUInt32BE(c[0],u+0),r._cache.writeUInt32BE(c[1],u+4),r._cache.writeUInt32BE(c[2],u+8),r._cache.writeUInt32BE(c[3],u+12)}var l=r._cache.slice(0,n.length);return r._cache=r._cache.slice(n.length),e(n,l)},ctr}const 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"},require$$2={"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:aes128,aes192:aes192,aes256:aes256,"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"}};var modes_1,hasRequiredModes$1;function requireModes$1(){if(hasRequiredModes$1)return modes_1;hasRequiredModes$1=1;var e={ECB:requireEcb(),CBC:requireCbc(),CFB:requireCfb(),CFB8:requireCfb8(),CFB1:requireCfb1(),OFB:requireOfb(),CTR:requireCtr(),GCM:requireCtr()},t=require$$2;for(var r in t)t[r].module=e[t[r].mode];return modes_1=t}var aes={},hasRequiredAes,ghash,hasRequiredGhash,authCipher,hasRequiredAuthCipher,streamCipher,hasRequiredStreamCipher,evp_bytestokey,hasRequiredEvp_bytestokey,hasRequiredEncrypter;function requireAes(){if(hasRequiredAes)return aes;hasRequiredAes=1;var e=requireSafeBuffer$1().Buffer;function t(t){e.isBuffer(t)||(t=e.from(t));for(var r=t.length/4|0,o=new Array(r),n=0;n<r;n++)o[n]=t.readUInt32BE(4*n);return o}function r(e){for(;0<e.length;e++)e[0]=0}function o(e,t,r,o,n){for(var i,a,s,c,u=r[0],l=r[1],d=r[2],p=r[3],h=e[0]^t[0],f=e[1]^t[1],m=e[2]^t[2],y=e[3]^t[3],g=4,b=1;b<n;b++)i=u[h>>>24]^l[f>>>16&255]^d[m>>>8&255]^p[255&y]^t[g++],a=u[f>>>24]^l[m>>>16&255]^d[y>>>8&255]^p[255&h]^t[g++],s=u[m>>>24]^l[y>>>16&255]^d[h>>>8&255]^p[255&f]^t[g++],c=u[y>>>24]^l[h>>>16&255]^d[f>>>8&255]^p[255&m]^t[g++],h=i,f=a,m=s,y=c;return i=(o[h>>>24]<<24|o[f>>>16&255]<<16|o[m>>>8&255]<<8|o[255&y])^t[g++],a=(o[f>>>24]<<24|o[m>>>16&255]<<16|o[y>>>8&255]<<8|o[255&h])^t[g++],s=(o[m>>>24]<<24|o[y>>>16&255]<<16|o[h>>>8&255]<<8|o[255&f])^t[g++],c=(o[y>>>24]<<24|o[h>>>16&255]<<16|o[f>>>8&255]<<8|o[255&m])^t[g++],[i>>>=0,a>>>=0,s>>>=0,c>>>=0]}var n=[0,1,2,4,8,16,32,64,128,27,54],i=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var r=[],o=[],n=[[],[],[],[]],i=[[],[],[],[]],a=0,s=0,c=0;c<256;++c){var u=s^s<<1^s<<2^s<<3^s<<4;u=u>>>8^255&u^99,r[a]=u,o[u]=a;var l=e[a],d=e[l],p=e[d],h=257*e[u]^16843008*u;n[0][a]=h<<24|h>>>8,n[1][a]=h<<16|h>>>16,n[2][a]=h<<8|h>>>24,n[3][a]=h,h=16843009*p^65537*d^257*l^16843008*a,i[0][u]=h<<24|h>>>8,i[1][u]=h<<16|h>>>16,i[2][u]=h<<8|h>>>24,i[3][u]=h,0===a?a=s=1:(a=l^e[e[e[p^l]]],s^=e[e[s]])}return{SBOX:r,INV_SBOX:o,SUB_MIX:n,INV_SUB_MIX:i}}();function a(e){this._key=t(e),this._reset()}return a.blockSize=16,a.keySize=32,a.prototype.blockSize=a.blockSize,a.prototype.keySize=a.keySize,a.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,o=4*(r+1),a=[],s=0;s<t;s++)a[s]=e[s];for(s=t;s<o;s++){var c=a[s-1];s%t==0?(c=c<<8|c>>>24,c=i.SBOX[c>>>24]<<24|i.SBOX[c>>>16&255]<<16|i.SBOX[c>>>8&255]<<8|i.SBOX[255&c],c^=n[s/t|0]<<24):t>6&&s%t==4&&(c=i.SBOX[c>>>24]<<24|i.SBOX[c>>>16&255]<<16|i.SBOX[c>>>8&255]<<8|i.SBOX[255&c]),a[s]=a[s-t]^c}for(var u=[],l=0;l<o;l++){var d=o-l,p=a[d-(l%4?0:4)];u[l]=l<4||d<=4?p:i.INV_SUB_MIX[0][i.SBOX[p>>>24]]^i.INV_SUB_MIX[1][i.SBOX[p>>>16&255]]^i.INV_SUB_MIX[2][i.SBOX[p>>>8&255]]^i.INV_SUB_MIX[3][i.SBOX[255&p]]}this._nRounds=r,this._keySchedule=a,this._invKeySchedule=u},a.prototype.encryptBlockRaw=function(e){return o(e=t(e),this._keySchedule,i.SUB_MIX,i.SBOX,this._nRounds)},a.prototype.encryptBlock=function(t){var r=this.encryptBlockRaw(t),o=e.allocUnsafe(16);return o.writeUInt32BE(r[0],0),o.writeUInt32BE(r[1],4),o.writeUInt32BE(r[2],8),o.writeUInt32BE(r[3],12),o},a.prototype.decryptBlock=function(r){var n=(r=t(r))[1];r[1]=r[3],r[3]=n;var a=o(r,this._invKeySchedule,i.INV_SUB_MIX,i.INV_SBOX,this._nRounds),s=e.allocUnsafe(16);return s.writeUInt32BE(a[0],0),s.writeUInt32BE(a[3],4),s.writeUInt32BE(a[2],8),s.writeUInt32BE(a[1],12),s},a.prototype.scrub=function(){r(this._keySchedule),r(this._invKeySchedule),r(this._key)},aes.AES=a,aes}function requireGhash(){if(hasRequiredGhash)return ghash;hasRequiredGhash=1;var e=requireSafeBuffer$1().Buffer,t=e.alloc(16,0);function r(t){var r=e.allocUnsafe(16);return r.writeUInt32BE(t[0]>>>0,0),r.writeUInt32BE(t[1]>>>0,4),r.writeUInt32BE(t[2]>>>0,8),r.writeUInt32BE(t[3]>>>0,12),r}function o(t){this.h=t,this.state=e.alloc(16,0),this.cache=e.allocUnsafe(0)}return o.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()},o.prototype._multiply=function(){for(var e,t,o,n=[(e=this.h).readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.readUInt32BE(12)],i=[0,0,0,0],a=-1;++a<128;){for(!!(this.state[~~(a/8)]&1<<7-a%8)&&(i[0]^=n[0],i[1]^=n[1],i[2]^=n[2],i[3]^=n[3]),o=!!(1&n[3]),t=3;t>0;t--)n[t]=n[t]>>>1|(1&n[t-1])<<31;n[0]=n[0]>>>1,o&&(n[0]=n[0]^225<<24)}this.state=r(i)},o.prototype.update=function(t){var r;for(this.cache=e.concat([this.cache,t]);this.cache.length>=16;)r=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(r)},o.prototype.final=function(o,n){return this.cache.length&&this.ghash(e.concat([this.cache,t],16)),this.ghash(r([0,o,0,n])),this.state},ghash=o}function requireAuthCipher(){if(hasRequiredAuthCipher)return authCipher;hasRequiredAuthCipher=1;var e=requireAes(),t=requireSafeBuffer$1().Buffer,r=requireCipherBase(),o=inherits_browserExports,n=requireGhash(),i=requireBufferXor(),a=requireIncr32();function s(o,i,s,c){r.call(this);var u=t.alloc(4,0);this._cipher=new e.AES(i);var l=this._cipher.encryptBlock(u);this._ghash=new n(l),s=function(e,r,o){if(12===r.length)return e._finID=t.concat([r,t.from([0,0,0,1])]),t.concat([r,t.from([0,0,0,2])]);var i=new n(o),s=r.length,c=s%16;i.update(r),c&&(c=16-c,i.update(t.alloc(c,0))),i.update(t.alloc(8,0));var u=8*s,l=t.alloc(8);l.writeUIntBE(u,0,8),i.update(l),e._finID=i.state;var d=t.from(e._finID);return a(d),d}(this,s,l),this._prev=t.from(s),this._cache=t.allocUnsafe(0),this._secCache=t.allocUnsafe(0),this._decrypt=c,this._alen=0,this._len=0,this._mode=o,this._authTag=null,this._called=!1}return o(s,r),s.prototype._update=function(e){if(!this._called&&this._alen){var r=16-this._alen%16;r<16&&(r=t.alloc(r,0),this._ghash.update(r))}this._called=!0;var o=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(o),this._len+=e.length,o},s.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=i(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 o=Math.min(e.length,t.length),n=0;n<o;++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()},s.prototype.getAuthTag=function(){if(this._decrypt||!t.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},s.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=e},s.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},authCipher=s}function requireStreamCipher(){if(hasRequiredStreamCipher)return streamCipher;hasRequiredStreamCipher=1;var e=requireAes(),t=requireSafeBuffer$1().Buffer,r=requireCipherBase();function o(o,n,i,a){r.call(this),this._cipher=new e.AES(n),this._prev=t.from(i),this._cache=t.allocUnsafe(0),this._secCache=t.allocUnsafe(0),this._decrypt=a,this._mode=o}return inherits_browserExports(o,r),o.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},o.prototype._final=function(){this._cipher.scrub()},streamCipher=o}function requireEvp_bytestokey(){if(hasRequiredEvp_bytestokey)return evp_bytestokey;hasRequiredEvp_bytestokey=1;var e=requireSafeBuffer$1().Buffer,t=requireMd5_js();return evp_bytestokey=function(r,o,n,i){if(e.isBuffer(r)||(r=e.from(r,"binary")),o&&(e.isBuffer(o)||(o=e.from(o,"binary")),8!==o.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var a=n/8,s=e.alloc(a),c=e.alloc(i||0),u=e.alloc(0);a>0||i>0;){var l=new t;l.update(u),l.update(r),o&&l.update(o),u=l.digest();var d=0;if(a>0){var p=s.length-a;d=Math.min(a,u.length),u.copy(s,p,0,d),a-=d}if(d<u.length&&i>0){var h=c.length-i,f=Math.min(i,u.length-d);u.copy(c,h,d,d+f),i-=f}}return u.fill(0),{key:s,iv:c}}}function requireEncrypter(){if(hasRequiredEncrypter)return encrypter;hasRequiredEncrypter=1;var e=requireModes$1(),t=requireAuthCipher(),r=requireSafeBuffer$1().Buffer,o=requireStreamCipher(),n=requireCipherBase(),i=requireAes(),a=requireEvp_bytestokey();function s(e,t,o){n.call(this),this._cache=new u,this._cipher=new i.AES(t),this._prev=r.from(o),this._mode=e,this._autopadding=!0}inherits_browserExports(s,n),s.prototype._update=function(e){var t,o;this._cache.add(e);for(var n=[];t=this._cache.get();)o=this._mode.encrypt(this,t),n.push(o);return r.concat(n)};var c=r.alloc(16,16);function u(){this.cache=r.allocUnsafe(0)}function l(n,i,a){var c=e[n.toLowerCase()];if(!c)throw new TypeError("invalid suite type");if("string"==typeof i&&(i=r.from(i)),i.length!==c.key/8)throw new TypeError("invalid key length "+i.length);if("string"==typeof a&&(a=r.from(a)),"GCM"!==c.mode&&a.length!==c.iv)throw new TypeError("invalid iv length "+a.length);return"stream"===c.type?new o(c.module,i,a):"auth"===c.type?new t(c.module,i,a):new s(c.module,i,a)}return s.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(c))throw this._cipher.scrub(),new Error("data not multiple of block length")},s.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},u.prototype.add=function(e){this.cache=r.concat([this.cache,e])},u.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},u.prototype.flush=function(){for(var e=16-this.cache.length,t=r.allocUnsafe(e),o=-1;++o<e;)t.writeUInt8(e,o);return r.concat([this.cache,t])},encrypter.createCipheriv=l,encrypter.createCipher=function(t,r){var o=e[t.toLowerCase()];if(!o)throw new TypeError("invalid suite type");var n=a(r,!1,o.key,o.iv);return l(t,n.key,n.iv)},encrypter}var decrypter={},hasRequiredDecrypter,hasRequiredBrowser$6;function requireDecrypter(){if(hasRequiredDecrypter)return decrypter;hasRequiredDecrypter=1;var e=requireAuthCipher(),t=requireSafeBuffer$1().Buffer,r=requireModes$1(),o=requireStreamCipher(),n=requireCipherBase(),i=requireAes(),a=requireEvp_bytestokey();function s(e,r,o){n.call(this),this._cache=new c,this._last=void 0,this._cipher=new i.AES(r),this._prev=t.from(o),this._mode=e,this._autopadding=!0}function c(){this.cache=t.allocUnsafe(0)}function u(n,i,a){var c=r[n.toLowerCase()];if(!c)throw new TypeError("invalid suite type");if("string"==typeof a&&(a=t.from(a)),"GCM"!==c.mode&&a.length!==c.iv)throw new TypeError("invalid iv length "+a.length);if("string"==typeof i&&(i=t.from(i)),i.length!==c.key/8)throw new TypeError("invalid key length "+i.length);return"stream"===c.type?new o(c.module,i,a,!0):"auth"===c.type?new e(c.module,i,a,!0):new s(c.module,i,a)}return inherits_browserExports(s,n),s.prototype._update=function(e){var r,o;this._cache.add(e);for(var n=[];r=this._cache.get(this._autopadding);)o=this._mode.decrypt(this,r),n.push(o);return t.concat(n)},s.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")},s.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},c.prototype.add=function(e){this.cache=t.concat([this.cache,e])},c.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},c.prototype.flush=function(){if(this.cache.length)return this.cache},decrypter.createDecipher=function(e,t){var o=r[e.toLowerCase()];if(!o)throw new TypeError("invalid suite type");var n=a(t,!1,o.key,o.iv);return u(e,n.key,n.iv)},decrypter.createDecipheriv=u,decrypter}function requireBrowser$6(){if(hasRequiredBrowser$6)return browser$7;hasRequiredBrowser$6=1;var e=requireEncrypter(),t=requireDecrypter(),r=require$$2;return browser$7.createCipher=browser$7.Cipher=e.createCipher,browser$7.createCipheriv=browser$7.Cipheriv=e.createCipheriv,browser$7.createDecipher=browser$7.Decipher=t.createDecipher,browser$7.createDecipheriv=browser$7.Decipheriv=t.createDecipheriv,browser$7.listCiphers=browser$7.getCiphers=function(){return Object.keys(r)},browser$7}var modes={},hasRequiredModes,hasRequiredBrowser$5;function requireModes(){return hasRequiredModes||(hasRequiredModes=1,function(e){e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}}(modes)),modes}function requireBrowser$5(){if(hasRequiredBrowser$5)return browser$8;hasRequiredBrowser$5=1;var e=requireBrowserifyDes(),t=requireBrowser$6(),r=requireModes$1(),o=requireModes(),n=requireEvp_bytestokey();function i(n,i,a){if(n=n.toLowerCase(),r[n])return t.createCipheriv(n,i,a);if(o[n])return new e({key:i,iv:a,mode:n});throw new TypeError("invalid suite type")}function a(n,i,a){if(n=n.toLowerCase(),r[n])return t.createDecipheriv(n,i,a);if(o[n])return new e({key:i,iv:a,mode:n,decrypt:!0});throw new TypeError("invalid suite type")}return browser$8.createCipher=browser$8.Cipher=function(e,t){var a,s;if(e=e.toLowerCase(),r[e])a=r[e].key,s=r[e].iv;else{if(!o[e])throw new TypeError("invalid suite type");a=8*o[e].key,s=o[e].iv}var c=n(t,!1,a,s);return i(e,c.key,c.iv)},browser$8.createCipheriv=browser$8.Cipheriv=i,browser$8.createDecipher=browser$8.Decipher=function(e,t){var i,s;if(e=e.toLowerCase(),r[e])i=r[e].key,s=r[e].iv;else{if(!o[e])throw new TypeError("invalid suite type");i=8*o[e].key,s=o[e].iv}var c=n(t,!1,i,s);return a(e,c.key,c.iv)},browser$8.createDecipheriv=browser$8.Decipheriv=a,browser$8.listCiphers=browser$8.getCiphers=function(){return Object.keys(o).concat(t.getCiphers())},browser$8}var browser$6={},bn$6={exports:{}},hasRequiredBn$4;function requireBn$4(){return hasRequiredBn$4||(hasRequiredBn$4=1,function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function o(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function n(e,t,r){if(n.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 i;"object"==typeof e?e.exports=n:t.BN=n,n.BN=n,n.wordSize=26;try{i="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require$$0$2.Buffer}catch(T){}function a(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(e,t,r){var o=a(e,r);return r-1>=t&&(o|=a(e,r-1)<<4),o}function c(e,t,r,o){for(var n=0,i=Math.min(e.length,r),a=t;a<i;a++){var s=e.charCodeAt(a)-48;n*=o,n+=s>=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(e){return e instanceof n||null!==e&&"object"==typeof e&&e.constructor.wordSize===n.wordSize&&Array.isArray(e.words)},n.max=function(e,t){return e.cmp(t)>0?e:t},n.min=function(e,t){return e.cmp(t)<0?e:t},n.prototype._init=function(e,t,o){if("number"==typeof e)return this._initNumber(e,t,o);if("object"==typeof e)return this._initArray(e,t,o);"hex"===t&&(t=16),r(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,o):(this._parseBase(e,t,n),"le"===o&&this._initArray(this.toArray(),t,o)))},n.prototype._initNumber=function(e,t,o){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):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===o&&this._initArray(this.toArray(),t,o)},n.prototype._initArray=function(e,t,o){if(r("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 i,a,s=0;if("be"===o)for(n=e.length-1,i=0;n>=0;n-=3)a=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===o)for(n=0,i=0;n<e.length;n+=3)a=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this.strip()},n.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var n,i=0,a=0;if("be"===r)for(o=e.length-1;o>=t;o-=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;else for(o=(e.length-t)%2==0?t+1:t;o<e.length;o+=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;this.strip()},n.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var o=0,n=1;n<=67108863;n*=t)o++;o--,n=n/t|0;for(var i=e.length-r,a=i%o,s=Math.min(i,i-a)+r,u=0,l=r;l<s;l+=o)u=c(e,l,l+o,t),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var d=1;for(u=c(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.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},n.prototype.clone=function(){var e=new n(null);return this.copy(e),e},n.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","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"],l=[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],d=[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 p(e,t,r){r.negative=t.negative^e.negative;var o=e.length+t.length|0;r.length=o,o=o-1|0;var n=0|e.words[0],i=0|t.words[0],a=n*i,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u<o;u++){for(var l=c>>>26,d=67108863&c,p=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=p;h++){var f=u-h|0;l+=(a=(n=0|e.words[f])*(i=0|t.words[h])+d)/67108864|0,d=67108863&a}r.words[u]=0|d,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}n.prototype.toString=function(e,t){var o;if(t=0|t||1,16===(e=e||10)||"hex"===e){o="";for(var n=0,i=0,a=0;a<this.length;a++){var s=this.words[a],c=(16777215&(s<<n|i)).toString(16);i=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),o=0!==i||a!==this.length-1?u[6-c.length]+c+o:c+o}for(0!==i&&(o=i.toString(16)+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}if(e===(0|e)&&e>=2&&e<=36){var p=l[e],h=d[e];o="";var f=this.clone();for(f.negative=0;!f.isZero();){var m=f.modn(h).toString(e);o=(f=f.idivn(h)).isZero()?m+o:u[p-m.length]+m+o}for(this.isZero()&&(o="0"+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}r(!1,"Base should be between 2 and 36")},n.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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(e,t){return r(void 0!==i),this.toArrayLike(i,e,t)},n.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},n.prototype.toArrayLike=function(e,t,o){var n=this.byteLength(),i=o||Math.max(1,n);r(n<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===t,u=new e(i),l=this.clone();if(c){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[s]=a;for(;s<i;s++)u[s]=0}else{for(s=0;s<i-n;s++)u[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[i-s-1]=a}return u},Math.clz32?n.prototype._countBits=function(e){return 32-Math.clz32(e)}:n.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},n.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},n.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},n.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},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},n.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(e){return r(!(this.negative|e.negative)),this.iuor(e)},n.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},n.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},n.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()},n.prototype.iand=function(e){return r(!(this.negative|e.negative)),this.iuand(e)},n.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},n.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},n.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var o=0;o<r.length;o++)this.words[o]=t.words[o]^r.words[o];if(this!==t)for(;o<t.length;o++)this.words[o]=t.words[o];return this.length=t.length,this.strip()},n.prototype.ixor=function(e){return r(!(this.negative|e.negative)),this.iuxor(e)},n.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},n.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},n.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),o=e%26;this._expand(t),o>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return o>0&&(this.words[n]=~this.words[n]&67108863>>26-o),this.strip()},n.prototype.notn=function(e){return this.clone().inotn(e)},n.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var o=e/26|0,n=e%26;return this._expand(o+1),this.words[o]=t?this.words[o]|1<<n:this.words[o]&~(1<<n),this.strip()},n.prototype.iadd=function(e){var t,r,o;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,o=e):(r=e,o=this);for(var n=0,i=0;i<o.length;i++)t=(0|r.words[i])+(0|o.words[i])+n,this.words[i]=67108863&t,n=t>>>26;for(;0!==n&&i<r.length;i++)t=(0|r.words[i])+n,this.words[i]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;i<r.length;i++)this.words[i]=r.words[i];return this},n.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)},n.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,o,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,o=e):(r=e,o=this);for(var i=0,a=0;a<o.length;a++)i=(t=(0|r.words[a])-(0|o.words[a])+i)>>26,this.words[a]=67108863&t;for(;0!==i&&a<r.length;a++)i=(t=(0|r.words[a])+i)>>26,this.words[a]=67108863&t;if(0===i&&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()},n.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,r){var o,n,i,a=e.words,s=t.words,c=r.words,u=0,l=0|a[0],d=8191&l,p=l>>>13,h=0|a[1],f=8191&h,m=h>>>13,y=0|a[2],g=8191&y,b=y>>>13,v=0|a[3],w=8191&v,$=v>>>13,k=0|a[4],_=8191&k,T=k>>>13,I=0|a[5],A=8191&I,O=I>>>13,E=0|a[6],S=8191&E,R=E>>>13,x=0|a[7],C=8191&x,P=x>>>13,N=0|a[8],B=8191&N,D=N>>>13,M=0|a[9],L=8191&M,j=M>>>13,F=0|s[0],U=8191&F,K=F>>>13,q=0|s[1],G=8191&q,H=q>>>13,V=0|s[2],W=8191&V,z=V>>>13,Z=0|s[3],Q=8191&Z,Y=Z>>>13,X=0|s[4],J=8191&X,ee=X>>>13,te=0|s[5],re=8191&te,oe=te>>>13,ne=0|s[6],ie=8191&ne,ae=ne>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],de=8191&le,pe=le>>>13,he=0|s[9],fe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(u+(o=Math.imul(d,U))|0)+((8191&(n=(n=Math.imul(d,K))+Math.imul(p,U)|0))<<13)|0;u=((i=Math.imul(p,K))+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,o=Math.imul(f,U),n=(n=Math.imul(f,K))+Math.imul(m,U)|0,i=Math.imul(m,K);var ge=(u+(o=o+Math.imul(d,G)|0)|0)+((8191&(n=(n=n+Math.imul(d,H)|0)+Math.imul(p,G)|0))<<13)|0;u=((i=i+Math.imul(p,H)|0)+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,o=Math.imul(g,U),n=(n=Math.imul(g,K))+Math.imul(b,U)|0,i=Math.imul(b,K),o=o+Math.imul(f,G)|0,n=(n=n+Math.imul(f,H)|0)+Math.imul(m,G)|0,i=i+Math.imul(m,H)|0;var be=(u+(o=o+Math.imul(d,W)|0)|0)+((8191&(n=(n=n+Math.imul(d,z)|0)+Math.imul(p,W)|0))<<13)|0;u=((i=i+Math.imul(p,z)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,o=Math.imul(w,U),n=(n=Math.imul(w,K))+Math.imul($,U)|0,i=Math.imul($,K),o=o+Math.imul(g,G)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(b,G)|0,i=i+Math.imul(b,H)|0,o=o+Math.imul(f,W)|0,n=(n=n+Math.imul(f,z)|0)+Math.imul(m,W)|0,i=i+Math.imul(m,z)|0;var ve=(u+(o=o+Math.imul(d,Q)|0)|0)+((8191&(n=(n=n+Math.imul(d,Y)|0)+Math.imul(p,Q)|0))<<13)|0;u=((i=i+Math.imul(p,Y)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,o=Math.imul(_,U),n=(n=Math.imul(_,K))+Math.imul(T,U)|0,i=Math.imul(T,K),o=o+Math.imul(w,G)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul($,G)|0,i=i+Math.imul($,H)|0,o=o+Math.imul(g,W)|0,n=(n=n+Math.imul(g,z)|0)+Math.imul(b,W)|0,i=i+Math.imul(b,z)|0,o=o+Math.imul(f,Q)|0,n=(n=n+Math.imul(f,Y)|0)+Math.imul(m,Q)|0,i=i+Math.imul(m,Y)|0;var we=(u+(o=o+Math.imul(d,J)|0)|0)+((8191&(n=(n=n+Math.imul(d,ee)|0)+Math.imul(p,J)|0))<<13)|0;u=((i=i+Math.imul(p,ee)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,o=Math.imul(A,U),n=(n=Math.imul(A,K))+Math.imul(O,U)|0,i=Math.imul(O,K),o=o+Math.imul(_,G)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(T,G)|0,i=i+Math.imul(T,H)|0,o=o+Math.imul(w,W)|0,n=(n=n+Math.imul(w,z)|0)+Math.imul($,W)|0,i=i+Math.imul($,z)|0,o=o+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(b,Q)|0,i=i+Math.imul(b,Y)|0,o=o+Math.imul(f,J)|0,n=(n=n+Math.imul(f,ee)|0)+Math.imul(m,J)|0,i=i+Math.imul(m,ee)|0;var $e=(u+(o=o+Math.imul(d,re)|0)|0)+((8191&(n=(n=n+Math.imul(d,oe)|0)+Math.imul(p,re)|0))<<13)|0;u=((i=i+Math.imul(p,oe)|0)+(n>>>13)|0)+($e>>>26)|0,$e&=67108863,o=Math.imul(S,U),n=(n=Math.imul(S,K))+Math.imul(R,U)|0,i=Math.imul(R,K),o=o+Math.imul(A,G)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(O,G)|0,i=i+Math.imul(O,H)|0,o=o+Math.imul(_,W)|0,n=(n=n+Math.imul(_,z)|0)+Math.imul(T,W)|0,i=i+Math.imul(T,z)|0,o=o+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul($,Q)|0,i=i+Math.imul($,Y)|0,o=o+Math.imul(g,J)|0,n=(n=n+Math.imul(g,ee)|0)+Math.imul(b,J)|0,i=i+Math.imul(b,ee)|0,o=o+Math.imul(f,re)|0,n=(n=n+Math.imul(f,oe)|0)+Math.imul(m,re)|0,i=i+Math.imul(m,oe)|0;var ke=(u+(o=o+Math.imul(d,ie)|0)|0)+((8191&(n=(n=n+Math.imul(d,ae)|0)+Math.imul(p,ie)|0))<<13)|0;u=((i=i+Math.imul(p,ae)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,o=Math.imul(C,U),n=(n=Math.imul(C,K))+Math.imul(P,U)|0,i=Math.imul(P,K),o=o+Math.imul(S,G)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,G)|0,i=i+Math.imul(R,H)|0,o=o+Math.imul(A,W)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(O,W)|0,i=i+Math.imul(O,z)|0,o=o+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(T,Q)|0,i=i+Math.imul(T,Y)|0,o=o+Math.imul(w,J)|0,n=(n=n+Math.imul(w,ee)|0)+Math.imul($,J)|0,i=i+Math.imul($,ee)|0,o=o+Math.imul(g,re)|0,n=(n=n+Math.imul(g,oe)|0)+Math.imul(b,re)|0,i=i+Math.imul(b,oe)|0,o=o+Math.imul(f,ie)|0,n=(n=n+Math.imul(f,ae)|0)+Math.imul(m,ie)|0,i=i+Math.imul(m,ae)|0;var _e=(u+(o=o+Math.imul(d,ce)|0)|0)+((8191&(n=(n=n+Math.imul(d,ue)|0)+Math.imul(p,ce)|0))<<13)|0;u=((i=i+Math.imul(p,ue)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,o=Math.imul(B,U),n=(n=Math.imul(B,K))+Math.imul(D,U)|0,i=Math.imul(D,K),o=o+Math.imul(C,G)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(P,G)|0,i=i+Math.imul(P,H)|0,o=o+Math.imul(S,W)|0,n=(n=n+Math.imul(S,z)|0)+Math.imul(R,W)|0,i=i+Math.imul(R,z)|0,o=o+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,Q)|0,i=i+Math.imul(O,Y)|0,o=o+Math.imul(_,J)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(T,J)|0,i=i+Math.imul(T,ee)|0,o=o+Math.imul(w,re)|0,n=(n=n+Math.imul(w,oe)|0)+Math.imul($,re)|0,i=i+Math.imul($,oe)|0,o=o+Math.imul(g,ie)|0,n=(n=n+Math.imul(g,ae)|0)+Math.imul(b,ie)|0,i=i+Math.imul(b,ae)|0,o=o+Math.imul(f,ce)|0,n=(n=n+Math.imul(f,ue)|0)+Math.imul(m,ce)|0,i=i+Math.imul(m,ue)|0;var Te=(u+(o=o+Math.imul(d,de)|0)|0)+((8191&(n=(n=n+Math.imul(d,pe)|0)+Math.imul(p,de)|0))<<13)|0;u=((i=i+Math.imul(p,pe)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,o=Math.imul(L,U),n=(n=Math.imul(L,K))+Math.imul(j,U)|0,i=Math.imul(j,K),o=o+Math.imul(B,G)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(D,G)|0,i=i+Math.imul(D,H)|0,o=o+Math.imul(C,W)|0,n=(n=n+Math.imul(C,z)|0)+Math.imul(P,W)|0,i=i+Math.imul(P,z)|0,o=o+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(R,Q)|0,i=i+Math.imul(R,Y)|0,o=o+Math.imul(A,J)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(O,J)|0,i=i+Math.imul(O,ee)|0,o=o+Math.imul(_,re)|0,n=(n=n+Math.imul(_,oe)|0)+Math.imul(T,re)|0,i=i+Math.imul(T,oe)|0,o=o+Math.imul(w,ie)|0,n=(n=n+Math.imul(w,ae)|0)+Math.imul($,ie)|0,i=i+Math.imul($,ae)|0,o=o+Math.imul(g,ce)|0,n=(n=n+Math.imul(g,ue)|0)+Math.imul(b,ce)|0,i=i+Math.imul(b,ue)|0,o=o+Math.imul(f,de)|0,n=(n=n+Math.imul(f,pe)|0)+Math.imul(m,de)|0,i=i+Math.imul(m,pe)|0;var Ie=(u+(o=o+Math.imul(d,fe)|0)|0)+((8191&(n=(n=n+Math.imul(d,me)|0)+Math.imul(p,fe)|0))<<13)|0;u=((i=i+Math.imul(p,me)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,o=Math.imul(L,G),n=(n=Math.imul(L,H))+Math.imul(j,G)|0,i=Math.imul(j,H),o=o+Math.imul(B,W)|0,n=(n=n+Math.imul(B,z)|0)+Math.imul(D,W)|0,i=i+Math.imul(D,z)|0,o=o+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,Y)|0,o=o+Math.imul(S,J)|0,n=(n=n+Math.imul(S,ee)|0)+Math.imul(R,J)|0,i=i+Math.imul(R,ee)|0,o=o+Math.imul(A,re)|0,n=(n=n+Math.imul(A,oe)|0)+Math.imul(O,re)|0,i=i+Math.imul(O,oe)|0,o=o+Math.imul(_,ie)|0,n=(n=n+Math.imul(_,ae)|0)+Math.imul(T,ie)|0,i=i+Math.imul(T,ae)|0,o=o+Math.imul(w,ce)|0,n=(n=n+Math.imul(w,ue)|0)+Math.imul($,ce)|0,i=i+Math.imul($,ue)|0,o=o+Math.imul(g,de)|0,n=(n=n+Math.imul(g,pe)|0)+Math.imul(b,de)|0,i=i+Math.imul(b,pe)|0;var Ae=(u+(o=o+Math.imul(f,fe)|0)|0)+((8191&(n=(n=n+Math.imul(f,me)|0)+Math.imul(m,fe)|0))<<13)|0;u=((i=i+Math.imul(m,me)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,o=Math.imul(L,W),n=(n=Math.imul(L,z))+Math.imul(j,W)|0,i=Math.imul(j,z),o=o+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(D,Q)|0,i=i+Math.imul(D,Y)|0,o=o+Math.imul(C,J)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(P,J)|0,i=i+Math.imul(P,ee)|0,o=o+Math.imul(S,re)|0,n=(n=n+Math.imul(S,oe)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,oe)|0,o=o+Math.imul(A,ie)|0,n=(n=n+Math.imul(A,ae)|0)+Math.imul(O,ie)|0,i=i+Math.imul(O,ae)|0,o=o+Math.imul(_,ce)|0,n=(n=n+Math.imul(_,ue)|0)+Math.imul(T,ce)|0,i=i+Math.imul(T,ue)|0,o=o+Math.imul(w,de)|0,n=(n=n+Math.imul(w,pe)|0)+Math.imul($,de)|0,i=i+Math.imul($,pe)|0;var Oe=(u+(o=o+Math.imul(g,fe)|0)|0)+((8191&(n=(n=n+Math.imul(g,me)|0)+Math.imul(b,fe)|0))<<13)|0;u=((i=i+Math.imul(b,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,o=Math.imul(L,Q),n=(n=Math.imul(L,Y))+Math.imul(j,Q)|0,i=Math.imul(j,Y),o=o+Math.imul(B,J)|0,n=(n=n+Math.imul(B,ee)|0)+Math.imul(D,J)|0,i=i+Math.imul(D,ee)|0,o=o+Math.imul(C,re)|0,n=(n=n+Math.imul(C,oe)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,oe)|0,o=o+Math.imul(S,ie)|0,n=(n=n+Math.imul(S,ae)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,ae)|0,o=o+Math.imul(A,ce)|0,n=(n=n+Math.imul(A,ue)|0)+Math.imul(O,ce)|0,i=i+Math.imul(O,ue)|0,o=o+Math.imul(_,de)|0,n=(n=n+Math.imul(_,pe)|0)+Math.imul(T,de)|0,i=i+Math.imul(T,pe)|0;var Ee=(u+(o=o+Math.imul(w,fe)|0)|0)+((8191&(n=(n=n+Math.imul(w,me)|0)+Math.imul($,fe)|0))<<13)|0;u=((i=i+Math.imul($,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,o=Math.imul(L,J),n=(n=Math.imul(L,ee))+Math.imul(j,J)|0,i=Math.imul(j,ee),o=o+Math.imul(B,re)|0,n=(n=n+Math.imul(B,oe)|0)+Math.imul(D,re)|0,i=i+Math.imul(D,oe)|0,o=o+Math.imul(C,ie)|0,n=(n=n+Math.imul(C,ae)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,ae)|0,o=o+Math.imul(S,ce)|0,n=(n=n+Math.imul(S,ue)|0)+Math.imul(R,ce)|0,i=i+Math.imul(R,ue)|0,o=o+Math.imul(A,de)|0,n=(n=n+Math.imul(A,pe)|0)+Math.imul(O,de)|0,i=i+Math.imul(O,pe)|0;var Se=(u+(o=o+Math.imul(_,fe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(T,fe)|0))<<13)|0;u=((i=i+Math.imul(T,me)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,o=Math.imul(L,re),n=(n=Math.imul(L,oe))+Math.imul(j,re)|0,i=Math.imul(j,oe),o=o+Math.imul(B,ie)|0,n=(n=n+Math.imul(B,ae)|0)+Math.imul(D,ie)|0,i=i+Math.imul(D,ae)|0,o=o+Math.imul(C,ce)|0,n=(n=n+Math.imul(C,ue)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,ue)|0,o=o+Math.imul(S,de)|0,n=(n=n+Math.imul(S,pe)|0)+Math.imul(R,de)|0,i=i+Math.imul(R,pe)|0;var Re=(u+(o=o+Math.imul(A,fe)|0)|0)+((8191&(n=(n=n+Math.imul(A,me)|0)+Math.imul(O,fe)|0))<<13)|0;u=((i=i+Math.imul(O,me)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,o=Math.imul(L,ie),n=(n=Math.imul(L,ae))+Math.imul(j,ie)|0,i=Math.imul(j,ae),o=o+Math.imul(B,ce)|0,n=(n=n+Math.imul(B,ue)|0)+Math.imul(D,ce)|0,i=i+Math.imul(D,ue)|0,o=o+Math.imul(C,de)|0,n=(n=n+Math.imul(C,pe)|0)+Math.imul(P,de)|0,i=i+Math.imul(P,pe)|0;var xe=(u+(o=o+Math.imul(S,fe)|0)|0)+((8191&(n=(n=n+Math.imul(S,me)|0)+Math.imul(R,fe)|0))<<13)|0;u=((i=i+Math.imul(R,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,o=Math.imul(L,ce),n=(n=Math.imul(L,ue))+Math.imul(j,ce)|0,i=Math.imul(j,ue),o=o+Math.imul(B,de)|0,n=(n=n+Math.imul(B,pe)|0)+Math.imul(D,de)|0,i=i+Math.imul(D,pe)|0;var Ce=(u+(o=o+Math.imul(C,fe)|0)|0)+((8191&(n=(n=n+Math.imul(C,me)|0)+Math.imul(P,fe)|0))<<13)|0;u=((i=i+Math.imul(P,me)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,o=Math.imul(L,de),n=(n=Math.imul(L,pe))+Math.imul(j,de)|0,i=Math.imul(j,pe);var Pe=(u+(o=o+Math.imul(B,fe)|0)|0)+((8191&(n=(n=n+Math.imul(B,me)|0)+Math.imul(D,fe)|0))<<13)|0;u=((i=i+Math.imul(D,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Ne=(u+(o=Math.imul(L,fe))|0)+((8191&(n=(n=Math.imul(L,me))+Math.imul(j,fe)|0))<<13)|0;return u=((i=Math.imul(j,me))+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=ye,c[1]=ge,c[2]=be,c[3]=ve,c[4]=we,c[5]=$e,c[6]=ke,c[7]=_e,c[8]=Te,c[9]=Ie,c[10]=Ae,c[11]=Oe,c[12]=Ee,c[13]=Se,c[14]=Re,c[15]=xe,c[16]=Ce,c[17]=Pe,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function f(e,t,r){return(new m).mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(h=p),n.prototype.mulTo=function(e,t){var r,o=this.length+e.length;return r=10===this.length&&10===e.length?h(this,e,t):o<63?p(this,e,t):o<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var o=0,n=0,i=0;i<r.length-1;i++){var a=n;n=0;for(var s=67108863&o,c=Math.min(i,t.length-1),u=Math.max(0,i-e.length+1);u<=c;u++){var l=i-u,d=(0|e.words[l])*(0|t.words[u]),p=67108863&d;s=67108863&(p=p+s|0),n+=(a=(a=a+(d/67108864|0)|0)+(p>>>26)|0)>>>26,a&=67108863}r.words[i]=s,o=a,a=n}return 0!==o?r.words[i]=o:r.length--,r.strip()}(this,e,t):f(this,e,t),r},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=n.prototype._countBits(e)-1,o=0;o<e;o++)t[o]=this.revBin(o,r,e);return t},m.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var o=0,n=0;n<t;n++)o|=(1&e)<<t-n-1,e>>=1;return o},m.prototype.permute=function(e,t,r,o,n,i){for(var a=0;a<i;a++)o[a]=t[e[a]],n[a]=r[e[a]]},m.prototype.transform=function(e,t,r,o,n,i){this.permute(i,e,t,r,o,n);for(var a=1;a<n;a<<=1)for(var s=a<<1,c=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),l=0;l<n;l+=s)for(var d=c,p=u,h=0;h<a;h++){var f=r[l+h],m=o[l+h],y=r[l+h+a],g=o[l+h+a],b=d*y-p*g;g=d*g+p*y,y=b,r[l+h]=f+y,o[l+h]=m+g,r[l+h+a]=f-y,o[l+h+a]=m-g,h!==s&&(b=c*d-u*p,p=c*p+u*d,d=b)}},m.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),o=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+o},m.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var o=0;o<r/2;o++){var n=e[o];e[o]=e[r-o-1],e[r-o-1]=n,n=t[o],t[o]=-t[r-o-1],t[r-o-1]=-n}},m.prototype.normalize13b=function(e,t){for(var r=0,o=0;o<t/2;o++){var n=8192*Math.round(e[2*o+1]/t)+Math.round(e[2*o]/t)+r;e[o]=67108863&n,r=n<67108864?0:n/67108864|0}return e},m.prototype.convert13b=function(e,t,o,n){for(var i=0,a=0;a<t;a++)i+=0|e[a],o[2*a]=8191&i,i>>>=13,o[2*a+1]=8191&i,i>>>=13;for(a=2*t;a<n;++a)o[a]=0;r(0===i),r(!(-8192&i))},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 o=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(o),i=this.stub(o),a=new Array(o),s=new Array(o),c=new Array(o),u=new Array(o),l=new Array(o),d=new Array(o),p=r.words;p.length=o,this.convert13b(e.words,e.length,a,o),this.convert13b(t.words,t.length,u,o),this.transform(a,i,s,c,o,n),this.transform(u,i,l,d,o,n);for(var h=0;h<o;h++){var f=s[h]*l[h]-c[h]*d[h];c[h]=s[h]*d[h]+c[h]*l[h],s[h]=f}return this.conjugate(s,c,o),this.transform(s,c,p,i,o,n),this.conjugate(p,i,o),this.normalize13b(p,o),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},n.prototype.mul=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},n.prototype.mulf=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),f(this,e,t)},n.prototype.imul=function(e){return this.clone().mulTo(e,this)},n.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,o=0;o<this.length;o++){var n=(0|this.words[o])*e,i=(67108863&n)+(67108863&t);t>>=26,t+=n/67108864|0,t+=i>>>26,this.words[o]=67108863&i}return 0!==t&&(this.words[o]=t,this.length++),this},n.prototype.muln=function(e){return this.clone().imuln(e)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var o=r/26|0,n=r%26;t[r]=(e.words[o]&1<<n)>>>n}return t}(e);if(0===t.length)return new n(1);for(var r=this,o=0;o<t.length&&0===t[o];o++,r=r.sqr());if(++o<t.length)for(var i=r.sqr();o<t.length;o++,i=i.sqr())0!==t[o]&&(r=r.mul(i));return r},n.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,o=e%26,n=(e-o)/26,i=67108863>>>26-o<<26-o;if(0!==o){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&i,c=(0|this.words[t])-s<<o;this.words[t]=c|a,a=s>>>26-o}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()},n.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},n.prototype.iushrn=function(e,t,o){var n;r("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var i=e%26,a=Math.min((e-i)/26,this.length),s=67108863^67108863>>>i<<i,c=o;if(n-=a,n=Math.max(0,n),c){for(var u=0;u<a;u++)c.words[u]=this.words[u];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var d=0|this.words[u];this.words[u]=l<<26-i|d>>>i,l=d&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(e,t,o){return r(0===this.negative),this.iushrn(e,t,o)},n.prototype.shln=function(e){return this.clone().ishln(e)},n.prototype.ushln=function(e){return this.clone().iushln(e)},n.prototype.shrn=function(e){return this.clone().ishrn(e)},n.prototype.ushrn=function(e){return this.clone().iushrn(e)},n.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26,n=1<<t;return!(this.length<=o||!(this.words[o]&n))},n.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=o)return this;if(0!==t&&o++,this.length=Math.min(o,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(e){return this.clone().imaskn(e)},n.prototype.iaddn=function(e){return r("number"==typeof e),r(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)},n.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},n.prototype.isubn=function(e){if(r("number"==typeof e),r(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()},n.prototype.addn=function(e){return this.clone().iaddn(e)},n.prototype.subn=function(e){return this.clone().isubn(e)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(e,t,o){var n,i,a=e.length+o;this._expand(a);var s=0;for(n=0;n<e.length;n++){i=(0|this.words[n+o])+s;var c=(0|e.words[n])*t;s=((i-=67108863&c)>>26)-(c/67108864|0),this.words[n+o]=67108863&i}for(;n<this.length-o;n++)s=(i=(0|this.words[n+o])+s)>>26,this.words[n+o]=67108863&i;if(0===s)return this.strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(i=-(0|this.words[n])+s)>>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},n.prototype._wordDiv=function(e,t){var r=(this.length,e.length),o=this.clone(),i=e,a=0|i.words[i.length-1];0!=(r=26-this._countBits(a))&&(i=i.ushln(r),o.iushln(r),a=0|i.words[i.length-1]);var s,c=o.length-i.length;if("mod"!==t){(s=new n(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=o.clone()._ishlnsubmul(i,1,c);0===l.negative&&(o=l,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var p=67108864*(0|o.words[i.length+d])+(0|o.words[i.length+d-1]);for(p=Math.min(p/a|0,67108863),o._ishlnsubmul(i,p,d);0!==o.negative;)p--,o.negative=0,o._ishlnsubmul(i,1,d),o.isZero()||(o.negative^=1);s&&(s.words[d]=p)}return s&&s.strip(),o.strip(),"div"!==t&&0!==r&&o.iushrn(r),{div:s||null,mod:o}},n.prototype.divmod=function(e,t,o){return r(!e.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new n(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new n(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new n(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},n.prototype.div=function(e){return this.divmod(e,"div",!1).div},n.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},n.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},n.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,o=e.ushrn(1),n=e.andln(1),i=r.cmp(o);return i<0||1===n&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},n.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,o=0,n=this.length-1;n>=0;n--)o=(t*o+(0|this.words[n]))%e;return o},n.prototype.idivn=function(e){r(e<=67108863);for(var t=0,o=this.length-1;o>=0;o--){var n=(0|this.words[o])+67108864*t;this.words[o]=n/e|0,t=n%e}return this.strip()},n.prototype.divn=function(e){return this.clone().idivn(e)},n.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new n(1),a=new n(0),s=new n(0),c=new n(1),u=0;t.isEven()&&o.isEven();)t.iushrn(1),o.iushrn(1),++u;for(var l=o.clone(),d=t.clone();!t.isZero();){for(var p=0,h=1;!(t.words[0]&h)&&p<26;++p,h<<=1);if(p>0)for(t.iushrn(p);p-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var f=0,m=1;!(o.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(o.iushrn(f);f-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(o)>=0?(t.isub(o),i.isub(s),a.isub(c)):(o.isub(t),s.isub(i),c.isub(a))}return{a:s,b:c,gcd:o.iushln(u)}},n.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new n(1),s=new n(0),c=o.clone();t.cmpn(1)>0&&o.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,p=1;!(o.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(o.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(o)>=0?(t.isub(o),a.isub(s)):(o.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},n.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 o=0;t.isEven()&&r.isEven();o++)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 i=t;t=r,r=i}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(o)},n.prototype.invm=function(e){return this.egcd(e).a.umod(e)},n.prototype.isEven=function(){return!(1&this.words[0])},n.prototype.isOdd=function(){return!(1&~this.words[0])},n.prototype.andln=function(e){return this.words[0]&e},n.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,o=(e-t)/26,n=1<<t;if(this.length<=o)return this._expand(o+1),this.words[o]|=n,this;for(var i=n,a=o;0!==i&&a<this.length;a++){var s=0|this.words[a];i=(s+=i)>>>26,s&=67108863,this.words[a]=s}return 0!==i&&(this.words[a]=i,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(e){var t,o=e<0;if(0!==this.negative&&!o)return-1;if(0===this.negative&&o)return 1;if(this.strip(),this.length>1)t=1;else{o&&(e=-e),r(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},n.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},n.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 o=0|this.words[r],n=0|e.words[r];if(o!==n){o<n?t=-1:o>n&&(t=1);break}}return t},n.prototype.gtn=function(e){return 1===this.cmpn(e)},n.prototype.gt=function(e){return 1===this.cmp(e)},n.prototype.gten=function(e){return this.cmpn(e)>=0},n.prototype.gte=function(e){return this.cmp(e)>=0},n.prototype.ltn=function(e){return-1===this.cmpn(e)},n.prototype.lt=function(e){return-1===this.cmp(e)},n.prototype.lten=function(e){return this.cmpn(e)<=0},n.prototype.lte=function(e){return this.cmp(e)<=0},n.prototype.eqn=function(e){return 0===this.cmpn(e)},n.prototype.eq=function(e){return 0===this.cmp(e)},n.red=function(e){return new k(e)},n.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(e){return this.red=e,this},n.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},n.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},n.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},n.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},n.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},n.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},n.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},n.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function g(e,t){this.name=e,this.p=new n(t,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function $(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(e){if("string"==typeof e){var t=n._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function _(e){k.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}g.prototype._tmp=function(){var e=new n(null);return e.words=new Array(Math.ceil(this.n/13)),e},g.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 o=t<this.n?-1:r.ucmp(this.p);return 0===o?(r.words[0]=0,r.length=1):o>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(e,t){e.iushrn(this.n,0,t)},g.prototype.imulK=function(e){return e.imul(this.k)},o(b,g),b.prototype.split=function(e,t){for(var r=4194303,o=Math.min(e.length,9),n=0;n<o;n++)t.words[n]=e.words[n];if(t.length=o,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=i&r,n=10;n<e.length;n++){var a=0|e.words[n];e.words[n-10]=(a&r)<<4|i>>>22,i=a}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},b.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 o=0|e.words[r];t+=977*o,e.words[r]=67108863&t,t=64*o+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},o(v,g),o(w,g),o($,g),$.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var o=19*(0|e.words[r])+t,n=67108863&o;o>>>=26,e.words[r]=n,t=o}return 0!==t&&(e.words[e.length++]=t),e},n._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new $}return y[e]=t,t},k.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},k.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},k.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},k.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},k.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},k.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},k.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},k.prototype.isqr=function(e){return this.imul(e,e.clone())},k.prototype.sqr=function(e){return this.mul(e,e)},k.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var o=this.m.add(new n(1)).iushrn(2);return this.pow(e,o)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new n(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),p=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),f=a;0!==h.cmp(s);){for(var m=h,y=0;0!==m.cmp(s);y++)m=m.redSqr();r(y<f);var g=this.pow(d,new n(1).iushln(f-y-1));p=p.redMul(g),d=g.redSqr(),h=h.redMul(d),f=y}return p},k.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},k.prototype.pow=function(e,t){if(t.isZero())return new n(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=e;for(var o=2;o<r.length;o++)r[o]=this.mul(r[o-1],e);var i=r[0],a=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),o=t.length-1;o>=0;o--){for(var u=t.words[o],l=c-1;l>=0;l--){var d=u>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===o&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}c=26}return i},k.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},k.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},n.mont=function(e){return new _(e)},o(_,k),_.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},_.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},_.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(o).iushrn(this.shift),i=n;return n.cmp(this.m)>=0?i=n.isub(this.m):n.cmpn(0)<0&&(i=n.iadd(this.m)),i._forceRed(this)},_.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new n(0)._forceRed(this);var r=e.mul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(o).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},_.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(bn$6,commonjsGlobal)),bn$6.exports}bn$6.exports;var bn$5={exports:{}},hasRequiredBn$3;function requireBn$3(){return hasRequiredBn$3||(hasRequiredBn$3=1,function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function o(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function n(e,t,r){if(n.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 i;"object"==typeof e?e.exports=n:t.BN=n,n.BN=n,n.wordSize=26;try{i="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require$$0$2.Buffer}catch(T){}function a(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(e,t,r){var o=a(e,r);return r-1>=t&&(o|=a(e,r-1)<<4),o}function c(e,t,r,o){for(var n=0,i=Math.min(e.length,r),a=t;a<i;a++){var s=e.charCodeAt(a)-48;n*=o,n+=s>=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(e){return e instanceof n||null!==e&&"object"==typeof e&&e.constructor.wordSize===n.wordSize&&Array.isArray(e.words)},n.max=function(e,t){return e.cmp(t)>0?e:t},n.min=function(e,t){return e.cmp(t)<0?e:t},n.prototype._init=function(e,t,o){if("number"==typeof e)return this._initNumber(e,t,o);if("object"==typeof e)return this._initArray(e,t,o);"hex"===t&&(t=16),r(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,o):(this._parseBase(e,t,n),"le"===o&&this._initArray(this.toArray(),t,o)))},n.prototype._initNumber=function(e,t,o){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):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===o&&this._initArray(this.toArray(),t,o)},n.prototype._initArray=function(e,t,o){if(r("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 i,a,s=0;if("be"===o)for(n=e.length-1,i=0;n>=0;n-=3)a=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===o)for(n=0,i=0;n<e.length;n+=3)a=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this.strip()},n.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var n,i=0,a=0;if("be"===r)for(o=e.length-1;o>=t;o-=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;else for(o=(e.length-t)%2==0?t+1:t;o<e.length;o+=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;this.strip()},n.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var o=0,n=1;n<=67108863;n*=t)o++;o--,n=n/t|0;for(var i=e.length-r,a=i%o,s=Math.min(i,i-a)+r,u=0,l=r;l<s;l+=o)u=c(e,l,l+o,t),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var d=1;for(u=c(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.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},n.prototype.clone=function(){var e=new n(null);return this.copy(e),e},n.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","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"],l=[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],d=[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 p(e,t,r){r.negative=t.negative^e.negative;var o=e.length+t.length|0;r.length=o,o=o-1|0;var n=0|e.words[0],i=0|t.words[0],a=n*i,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u<o;u++){for(var l=c>>>26,d=67108863&c,p=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=p;h++){var f=u-h|0;l+=(a=(n=0|e.words[f])*(i=0|t.words[h])+d)/67108864|0,d=67108863&a}r.words[u]=0|d,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}n.prototype.toString=function(e,t){var o;if(t=0|t||1,16===(e=e||10)||"hex"===e){o="";for(var n=0,i=0,a=0;a<this.length;a++){var s=this.words[a],c=(16777215&(s<<n|i)).toString(16);i=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),o=0!==i||a!==this.length-1?u[6-c.length]+c+o:c+o}for(0!==i&&(o=i.toString(16)+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}if(e===(0|e)&&e>=2&&e<=36){var p=l[e],h=d[e];o="";var f=this.clone();for(f.negative=0;!f.isZero();){var m=f.modn(h).toString(e);o=(f=f.idivn(h)).isZero()?m+o:u[p-m.length]+m+o}for(this.isZero()&&(o="0"+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}r(!1,"Base should be between 2 and 36")},n.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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(e,t){return r(void 0!==i),this.toArrayLike(i,e,t)},n.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},n.prototype.toArrayLike=function(e,t,o){var n=this.byteLength(),i=o||Math.max(1,n);r(n<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===t,u=new e(i),l=this.clone();if(c){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[s]=a;for(;s<i;s++)u[s]=0}else{for(s=0;s<i-n;s++)u[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[i-s-1]=a}return u},Math.clz32?n.prototype._countBits=function(e){return 32-Math.clz32(e)}:n.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},n.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},n.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},n.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},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},n.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(e){return r(!(this.negative|e.negative)),this.iuor(e)},n.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},n.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},n.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()},n.prototype.iand=function(e){return r(!(this.negative|e.negative)),this.iuand(e)},n.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},n.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},n.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var o=0;o<r.length;o++)this.words[o]=t.words[o]^r.words[o];if(this!==t)for(;o<t.length;o++)this.words[o]=t.words[o];return this.length=t.length,this.strip()},n.prototype.ixor=function(e){return r(!(this.negative|e.negative)),this.iuxor(e)},n.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},n.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},n.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),o=e%26;this._expand(t),o>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return o>0&&(this.words[n]=~this.words[n]&67108863>>26-o),this.strip()},n.prototype.notn=function(e){return this.clone().inotn(e)},n.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var o=e/26|0,n=e%26;return this._expand(o+1),this.words[o]=t?this.words[o]|1<<n:this.words[o]&~(1<<n),this.strip()},n.prototype.iadd=function(e){var t,r,o;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,o=e):(r=e,o=this);for(var n=0,i=0;i<o.length;i++)t=(0|r.words[i])+(0|o.words[i])+n,this.words[i]=67108863&t,n=t>>>26;for(;0!==n&&i<r.length;i++)t=(0|r.words[i])+n,this.words[i]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;i<r.length;i++)this.words[i]=r.words[i];return this},n.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)},n.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,o,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,o=e):(r=e,o=this);for(var i=0,a=0;a<o.length;a++)i=(t=(0|r.words[a])-(0|o.words[a])+i)>>26,this.words[a]=67108863&t;for(;0!==i&&a<r.length;a++)i=(t=(0|r.words[a])+i)>>26,this.words[a]=67108863&t;if(0===i&&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()},n.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,r){var o,n,i,a=e.words,s=t.words,c=r.words,u=0,l=0|a[0],d=8191&l,p=l>>>13,h=0|a[1],f=8191&h,m=h>>>13,y=0|a[2],g=8191&y,b=y>>>13,v=0|a[3],w=8191&v,$=v>>>13,k=0|a[4],_=8191&k,T=k>>>13,I=0|a[5],A=8191&I,O=I>>>13,E=0|a[6],S=8191&E,R=E>>>13,x=0|a[7],C=8191&x,P=x>>>13,N=0|a[8],B=8191&N,D=N>>>13,M=0|a[9],L=8191&M,j=M>>>13,F=0|s[0],U=8191&F,K=F>>>13,q=0|s[1],G=8191&q,H=q>>>13,V=0|s[2],W=8191&V,z=V>>>13,Z=0|s[3],Q=8191&Z,Y=Z>>>13,X=0|s[4],J=8191&X,ee=X>>>13,te=0|s[5],re=8191&te,oe=te>>>13,ne=0|s[6],ie=8191&ne,ae=ne>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],de=8191&le,pe=le>>>13,he=0|s[9],fe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(u+(o=Math.imul(d,U))|0)+((8191&(n=(n=Math.imul(d,K))+Math.imul(p,U)|0))<<13)|0;u=((i=Math.imul(p,K))+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,o=Math.imul(f,U),n=(n=Math.imul(f,K))+Math.imul(m,U)|0,i=Math.imul(m,K);var ge=(u+(o=o+Math.imul(d,G)|0)|0)+((8191&(n=(n=n+Math.imul(d,H)|0)+Math.imul(p,G)|0))<<13)|0;u=((i=i+Math.imul(p,H)|0)+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,o=Math.imul(g,U),n=(n=Math.imul(g,K))+Math.imul(b,U)|0,i=Math.imul(b,K),o=o+Math.imul(f,G)|0,n=(n=n+Math.imul(f,H)|0)+Math.imul(m,G)|0,i=i+Math.imul(m,H)|0;var be=(u+(o=o+Math.imul(d,W)|0)|0)+((8191&(n=(n=n+Math.imul(d,z)|0)+Math.imul(p,W)|0))<<13)|0;u=((i=i+Math.imul(p,z)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,o=Math.imul(w,U),n=(n=Math.imul(w,K))+Math.imul($,U)|0,i=Math.imul($,K),o=o+Math.imul(g,G)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(b,G)|0,i=i+Math.imul(b,H)|0,o=o+Math.imul(f,W)|0,n=(n=n+Math.imul(f,z)|0)+Math.imul(m,W)|0,i=i+Math.imul(m,z)|0;var ve=(u+(o=o+Math.imul(d,Q)|0)|0)+((8191&(n=(n=n+Math.imul(d,Y)|0)+Math.imul(p,Q)|0))<<13)|0;u=((i=i+Math.imul(p,Y)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,o=Math.imul(_,U),n=(n=Math.imul(_,K))+Math.imul(T,U)|0,i=Math.imul(T,K),o=o+Math.imul(w,G)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul($,G)|0,i=i+Math.imul($,H)|0,o=o+Math.imul(g,W)|0,n=(n=n+Math.imul(g,z)|0)+Math.imul(b,W)|0,i=i+Math.imul(b,z)|0,o=o+Math.imul(f,Q)|0,n=(n=n+Math.imul(f,Y)|0)+Math.imul(m,Q)|0,i=i+Math.imul(m,Y)|0;var we=(u+(o=o+Math.imul(d,J)|0)|0)+((8191&(n=(n=n+Math.imul(d,ee)|0)+Math.imul(p,J)|0))<<13)|0;u=((i=i+Math.imul(p,ee)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,o=Math.imul(A,U),n=(n=Math.imul(A,K))+Math.imul(O,U)|0,i=Math.imul(O,K),o=o+Math.imul(_,G)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(T,G)|0,i=i+Math.imul(T,H)|0,o=o+Math.imul(w,W)|0,n=(n=n+Math.imul(w,z)|0)+Math.imul($,W)|0,i=i+Math.imul($,z)|0,o=o+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(b,Q)|0,i=i+Math.imul(b,Y)|0,o=o+Math.imul(f,J)|0,n=(n=n+Math.imul(f,ee)|0)+Math.imul(m,J)|0,i=i+Math.imul(m,ee)|0;var $e=(u+(o=o+Math.imul(d,re)|0)|0)+((8191&(n=(n=n+Math.imul(d,oe)|0)+Math.imul(p,re)|0))<<13)|0;u=((i=i+Math.imul(p,oe)|0)+(n>>>13)|0)+($e>>>26)|0,$e&=67108863,o=Math.imul(S,U),n=(n=Math.imul(S,K))+Math.imul(R,U)|0,i=Math.imul(R,K),o=o+Math.imul(A,G)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(O,G)|0,i=i+Math.imul(O,H)|0,o=o+Math.imul(_,W)|0,n=(n=n+Math.imul(_,z)|0)+Math.imul(T,W)|0,i=i+Math.imul(T,z)|0,o=o+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul($,Q)|0,i=i+Math.imul($,Y)|0,o=o+Math.imul(g,J)|0,n=(n=n+Math.imul(g,ee)|0)+Math.imul(b,J)|0,i=i+Math.imul(b,ee)|0,o=o+Math.imul(f,re)|0,n=(n=n+Math.imul(f,oe)|0)+Math.imul(m,re)|0,i=i+Math.imul(m,oe)|0;var ke=(u+(o=o+Math.imul(d,ie)|0)|0)+((8191&(n=(n=n+Math.imul(d,ae)|0)+Math.imul(p,ie)|0))<<13)|0;u=((i=i+Math.imul(p,ae)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,o=Math.imul(C,U),n=(n=Math.imul(C,K))+Math.imul(P,U)|0,i=Math.imul(P,K),o=o+Math.imul(S,G)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,G)|0,i=i+Math.imul(R,H)|0,o=o+Math.imul(A,W)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(O,W)|0,i=i+Math.imul(O,z)|0,o=o+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(T,Q)|0,i=i+Math.imul(T,Y)|0,o=o+Math.imul(w,J)|0,n=(n=n+Math.imul(w,ee)|0)+Math.imul($,J)|0,i=i+Math.imul($,ee)|0,o=o+Math.imul(g,re)|0,n=(n=n+Math.imul(g,oe)|0)+Math.imul(b,re)|0,i=i+Math.imul(b,oe)|0,o=o+Math.imul(f,ie)|0,n=(n=n+Math.imul(f,ae)|0)+Math.imul(m,ie)|0,i=i+Math.imul(m,ae)|0;var _e=(u+(o=o+Math.imul(d,ce)|0)|0)+((8191&(n=(n=n+Math.imul(d,ue)|0)+Math.imul(p,ce)|0))<<13)|0;u=((i=i+Math.imul(p,ue)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,o=Math.imul(B,U),n=(n=Math.imul(B,K))+Math.imul(D,U)|0,i=Math.imul(D,K),o=o+Math.imul(C,G)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(P,G)|0,i=i+Math.imul(P,H)|0,o=o+Math.imul(S,W)|0,n=(n=n+Math.imul(S,z)|0)+Math.imul(R,W)|0,i=i+Math.imul(R,z)|0,o=o+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,Q)|0,i=i+Math.imul(O,Y)|0,o=o+Math.imul(_,J)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(T,J)|0,i=i+Math.imul(T,ee)|0,o=o+Math.imul(w,re)|0,n=(n=n+Math.imul(w,oe)|0)+Math.imul($,re)|0,i=i+Math.imul($,oe)|0,o=o+Math.imul(g,ie)|0,n=(n=n+Math.imul(g,ae)|0)+Math.imul(b,ie)|0,i=i+Math.imul(b,ae)|0,o=o+Math.imul(f,ce)|0,n=(n=n+Math.imul(f,ue)|0)+Math.imul(m,ce)|0,i=i+Math.imul(m,ue)|0;var Te=(u+(o=o+Math.imul(d,de)|0)|0)+((8191&(n=(n=n+Math.imul(d,pe)|0)+Math.imul(p,de)|0))<<13)|0;u=((i=i+Math.imul(p,pe)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,o=Math.imul(L,U),n=(n=Math.imul(L,K))+Math.imul(j,U)|0,i=Math.imul(j,K),o=o+Math.imul(B,G)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(D,G)|0,i=i+Math.imul(D,H)|0,o=o+Math.imul(C,W)|0,n=(n=n+Math.imul(C,z)|0)+Math.imul(P,W)|0,i=i+Math.imul(P,z)|0,o=o+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(R,Q)|0,i=i+Math.imul(R,Y)|0,o=o+Math.imul(A,J)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(O,J)|0,i=i+Math.imul(O,ee)|0,o=o+Math.imul(_,re)|0,n=(n=n+Math.imul(_,oe)|0)+Math.imul(T,re)|0,i=i+Math.imul(T,oe)|0,o=o+Math.imul(w,ie)|0,n=(n=n+Math.imul(w,ae)|0)+Math.imul($,ie)|0,i=i+Math.imul($,ae)|0,o=o+Math.imul(g,ce)|0,n=(n=n+Math.imul(g,ue)|0)+Math.imul(b,ce)|0,i=i+Math.imul(b,ue)|0,o=o+Math.imul(f,de)|0,n=(n=n+Math.imul(f,pe)|0)+Math.imul(m,de)|0,i=i+Math.imul(m,pe)|0;var Ie=(u+(o=o+Math.imul(d,fe)|0)|0)+((8191&(n=(n=n+Math.imul(d,me)|0)+Math.imul(p,fe)|0))<<13)|0;u=((i=i+Math.imul(p,me)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,o=Math.imul(L,G),n=(n=Math.imul(L,H))+Math.imul(j,G)|0,i=Math.imul(j,H),o=o+Math.imul(B,W)|0,n=(n=n+Math.imul(B,z)|0)+Math.imul(D,W)|0,i=i+Math.imul(D,z)|0,o=o+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,Y)|0,o=o+Math.imul(S,J)|0,n=(n=n+Math.imul(S,ee)|0)+Math.imul(R,J)|0,i=i+Math.imul(R,ee)|0,o=o+Math.imul(A,re)|0,n=(n=n+Math.imul(A,oe)|0)+Math.imul(O,re)|0,i=i+Math.imul(O,oe)|0,o=o+Math.imul(_,ie)|0,n=(n=n+Math.imul(_,ae)|0)+Math.imul(T,ie)|0,i=i+Math.imul(T,ae)|0,o=o+Math.imul(w,ce)|0,n=(n=n+Math.imul(w,ue)|0)+Math.imul($,ce)|0,i=i+Math.imul($,ue)|0,o=o+Math.imul(g,de)|0,n=(n=n+Math.imul(g,pe)|0)+Math.imul(b,de)|0,i=i+Math.imul(b,pe)|0;var Ae=(u+(o=o+Math.imul(f,fe)|0)|0)+((8191&(n=(n=n+Math.imul(f,me)|0)+Math.imul(m,fe)|0))<<13)|0;u=((i=i+Math.imul(m,me)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,o=Math.imul(L,W),n=(n=Math.imul(L,z))+Math.imul(j,W)|0,i=Math.imul(j,z),o=o+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(D,Q)|0,i=i+Math.imul(D,Y)|0,o=o+Math.imul(C,J)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(P,J)|0,i=i+Math.imul(P,ee)|0,o=o+Math.imul(S,re)|0,n=(n=n+Math.imul(S,oe)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,oe)|0,o=o+Math.imul(A,ie)|0,n=(n=n+Math.imul(A,ae)|0)+Math.imul(O,ie)|0,i=i+Math.imul(O,ae)|0,o=o+Math.imul(_,ce)|0,n=(n=n+Math.imul(_,ue)|0)+Math.imul(T,ce)|0,i=i+Math.imul(T,ue)|0,o=o+Math.imul(w,de)|0,n=(n=n+Math.imul(w,pe)|0)+Math.imul($,de)|0,i=i+Math.imul($,pe)|0;var Oe=(u+(o=o+Math.imul(g,fe)|0)|0)+((8191&(n=(n=n+Math.imul(g,me)|0)+Math.imul(b,fe)|0))<<13)|0;u=((i=i+Math.imul(b,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,o=Math.imul(L,Q),n=(n=Math.imul(L,Y))+Math.imul(j,Q)|0,i=Math.imul(j,Y),o=o+Math.imul(B,J)|0,n=(n=n+Math.imul(B,ee)|0)+Math.imul(D,J)|0,i=i+Math.imul(D,ee)|0,o=o+Math.imul(C,re)|0,n=(n=n+Math.imul(C,oe)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,oe)|0,o=o+Math.imul(S,ie)|0,n=(n=n+Math.imul(S,ae)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,ae)|0,o=o+Math.imul(A,ce)|0,n=(n=n+Math.imul(A,ue)|0)+Math.imul(O,ce)|0,i=i+Math.imul(O,ue)|0,o=o+Math.imul(_,de)|0,n=(n=n+Math.imul(_,pe)|0)+Math.imul(T,de)|0,i=i+Math.imul(T,pe)|0;var Ee=(u+(o=o+Math.imul(w,fe)|0)|0)+((8191&(n=(n=n+Math.imul(w,me)|0)+Math.imul($,fe)|0))<<13)|0;u=((i=i+Math.imul($,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,o=Math.imul(L,J),n=(n=Math.imul(L,ee))+Math.imul(j,J)|0,i=Math.imul(j,ee),o=o+Math.imul(B,re)|0,n=(n=n+Math.imul(B,oe)|0)+Math.imul(D,re)|0,i=i+Math.imul(D,oe)|0,o=o+Math.imul(C,ie)|0,n=(n=n+Math.imul(C,ae)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,ae)|0,o=o+Math.imul(S,ce)|0,n=(n=n+Math.imul(S,ue)|0)+Math.imul(R,ce)|0,i=i+Math.imul(R,ue)|0,o=o+Math.imul(A,de)|0,n=(n=n+Math.imul(A,pe)|0)+Math.imul(O,de)|0,i=i+Math.imul(O,pe)|0;var Se=(u+(o=o+Math.imul(_,fe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(T,fe)|0))<<13)|0;u=((i=i+Math.imul(T,me)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,o=Math.imul(L,re),n=(n=Math.imul(L,oe))+Math.imul(j,re)|0,i=Math.imul(j,oe),o=o+Math.imul(B,ie)|0,n=(n=n+Math.imul(B,ae)|0)+Math.imul(D,ie)|0,i=i+Math.imul(D,ae)|0,o=o+Math.imul(C,ce)|0,n=(n=n+Math.imul(C,ue)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,ue)|0,o=o+Math.imul(S,de)|0,n=(n=n+Math.imul(S,pe)|0)+Math.imul(R,de)|0,i=i+Math.imul(R,pe)|0;var Re=(u+(o=o+Math.imul(A,fe)|0)|0)+((8191&(n=(n=n+Math.imul(A,me)|0)+Math.imul(O,fe)|0))<<13)|0;u=((i=i+Math.imul(O,me)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,o=Math.imul(L,ie),n=(n=Math.imul(L,ae))+Math.imul(j,ie)|0,i=Math.imul(j,ae),o=o+Math.imul(B,ce)|0,n=(n=n+Math.imul(B,ue)|0)+Math.imul(D,ce)|0,i=i+Math.imul(D,ue)|0,o=o+Math.imul(C,de)|0,n=(n=n+Math.imul(C,pe)|0)+Math.imul(P,de)|0,i=i+Math.imul(P,pe)|0;var xe=(u+(o=o+Math.imul(S,fe)|0)|0)+((8191&(n=(n=n+Math.imul(S,me)|0)+Math.imul(R,fe)|0))<<13)|0;u=((i=i+Math.imul(R,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,o=Math.imul(L,ce),n=(n=Math.imul(L,ue))+Math.imul(j,ce)|0,i=Math.imul(j,ue),o=o+Math.imul(B,de)|0,n=(n=n+Math.imul(B,pe)|0)+Math.imul(D,de)|0,i=i+Math.imul(D,pe)|0;var Ce=(u+(o=o+Math.imul(C,fe)|0)|0)+((8191&(n=(n=n+Math.imul(C,me)|0)+Math.imul(P,fe)|0))<<13)|0;u=((i=i+Math.imul(P,me)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,o=Math.imul(L,de),n=(n=Math.imul(L,pe))+Math.imul(j,de)|0,i=Math.imul(j,pe);var Pe=(u+(o=o+Math.imul(B,fe)|0)|0)+((8191&(n=(n=n+Math.imul(B,me)|0)+Math.imul(D,fe)|0))<<13)|0;u=((i=i+Math.imul(D,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Ne=(u+(o=Math.imul(L,fe))|0)+((8191&(n=(n=Math.imul(L,me))+Math.imul(j,fe)|0))<<13)|0;return u=((i=Math.imul(j,me))+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=ye,c[1]=ge,c[2]=be,c[3]=ve,c[4]=we,c[5]=$e,c[6]=ke,c[7]=_e,c[8]=Te,c[9]=Ie,c[10]=Ae,c[11]=Oe,c[12]=Ee,c[13]=Se,c[14]=Re,c[15]=xe,c[16]=Ce,c[17]=Pe,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function f(e,t,r){return(new m).mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(h=p),n.prototype.mulTo=function(e,t){var r,o=this.length+e.length;return r=10===this.length&&10===e.length?h(this,e,t):o<63?p(this,e,t):o<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var o=0,n=0,i=0;i<r.length-1;i++){var a=n;n=0;for(var s=67108863&o,c=Math.min(i,t.length-1),u=Math.max(0,i-e.length+1);u<=c;u++){var l=i-u,d=(0|e.words[l])*(0|t.words[u]),p=67108863&d;s=67108863&(p=p+s|0),n+=(a=(a=a+(d/67108864|0)|0)+(p>>>26)|0)>>>26,a&=67108863}r.words[i]=s,o=a,a=n}return 0!==o?r.words[i]=o:r.length--,r.strip()}(this,e,t):f(this,e,t),r},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=n.prototype._countBits(e)-1,o=0;o<e;o++)t[o]=this.revBin(o,r,e);return t},m.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var o=0,n=0;n<t;n++)o|=(1&e)<<t-n-1,e>>=1;return o},m.prototype.permute=function(e,t,r,o,n,i){for(var a=0;a<i;a++)o[a]=t[e[a]],n[a]=r[e[a]]},m.prototype.transform=function(e,t,r,o,n,i){this.permute(i,e,t,r,o,n);for(var a=1;a<n;a<<=1)for(var s=a<<1,c=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),l=0;l<n;l+=s)for(var d=c,p=u,h=0;h<a;h++){var f=r[l+h],m=o[l+h],y=r[l+h+a],g=o[l+h+a],b=d*y-p*g;g=d*g+p*y,y=b,r[l+h]=f+y,o[l+h]=m+g,r[l+h+a]=f-y,o[l+h+a]=m-g,h!==s&&(b=c*d-u*p,p=c*p+u*d,d=b)}},m.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),o=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+o},m.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var o=0;o<r/2;o++){var n=e[o];e[o]=e[r-o-1],e[r-o-1]=n,n=t[o],t[o]=-t[r-o-1],t[r-o-1]=-n}},m.prototype.normalize13b=function(e,t){for(var r=0,o=0;o<t/2;o++){var n=8192*Math.round(e[2*o+1]/t)+Math.round(e[2*o]/t)+r;e[o]=67108863&n,r=n<67108864?0:n/67108864|0}return e},m.prototype.convert13b=function(e,t,o,n){for(var i=0,a=0;a<t;a++)i+=0|e[a],o[2*a]=8191&i,i>>>=13,o[2*a+1]=8191&i,i>>>=13;for(a=2*t;a<n;++a)o[a]=0;r(0===i),r(!(-8192&i))},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 o=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(o),i=this.stub(o),a=new Array(o),s=new Array(o),c=new Array(o),u=new Array(o),l=new Array(o),d=new Array(o),p=r.words;p.length=o,this.convert13b(e.words,e.length,a,o),this.convert13b(t.words,t.length,u,o),this.transform(a,i,s,c,o,n),this.transform(u,i,l,d,o,n);for(var h=0;h<o;h++){var f=s[h]*l[h]-c[h]*d[h];c[h]=s[h]*d[h]+c[h]*l[h],s[h]=f}return this.conjugate(s,c,o),this.transform(s,c,p,i,o,n),this.conjugate(p,i,o),this.normalize13b(p,o),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},n.prototype.mul=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},n.prototype.mulf=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),f(this,e,t)},n.prototype.imul=function(e){return this.clone().mulTo(e,this)},n.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,o=0;o<this.length;o++){var n=(0|this.words[o])*e,i=(67108863&n)+(67108863&t);t>>=26,t+=n/67108864|0,t+=i>>>26,this.words[o]=67108863&i}return 0!==t&&(this.words[o]=t,this.length++),this},n.prototype.muln=function(e){return this.clone().imuln(e)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var o=r/26|0,n=r%26;t[r]=(e.words[o]&1<<n)>>>n}return t}(e);if(0===t.length)return new n(1);for(var r=this,o=0;o<t.length&&0===t[o];o++,r=r.sqr());if(++o<t.length)for(var i=r.sqr();o<t.length;o++,i=i.sqr())0!==t[o]&&(r=r.mul(i));return r},n.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,o=e%26,n=(e-o)/26,i=67108863>>>26-o<<26-o;if(0!==o){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&i,c=(0|this.words[t])-s<<o;this.words[t]=c|a,a=s>>>26-o}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()},n.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},n.prototype.iushrn=function(e,t,o){var n;r("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var i=e%26,a=Math.min((e-i)/26,this.length),s=67108863^67108863>>>i<<i,c=o;if(n-=a,n=Math.max(0,n),c){for(var u=0;u<a;u++)c.words[u]=this.words[u];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var d=0|this.words[u];this.words[u]=l<<26-i|d>>>i,l=d&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(e,t,o){return r(0===this.negative),this.iushrn(e,t,o)},n.prototype.shln=function(e){return this.clone().ishln(e)},n.prototype.ushln=function(e){return this.clone().iushln(e)},n.prototype.shrn=function(e){return this.clone().ishrn(e)},n.prototype.ushrn=function(e){return this.clone().iushrn(e)},n.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26,n=1<<t;return!(this.length<=o||!(this.words[o]&n))},n.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=o)return this;if(0!==t&&o++,this.length=Math.min(o,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(e){return this.clone().imaskn(e)},n.prototype.iaddn=function(e){return r("number"==typeof e),r(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)},n.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},n.prototype.isubn=function(e){if(r("number"==typeof e),r(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()},n.prototype.addn=function(e){return this.clone().iaddn(e)},n.prototype.subn=function(e){return this.clone().isubn(e)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(e,t,o){var n,i,a=e.length+o;this._expand(a);var s=0;for(n=0;n<e.length;n++){i=(0|this.words[n+o])+s;var c=(0|e.words[n])*t;s=((i-=67108863&c)>>26)-(c/67108864|0),this.words[n+o]=67108863&i}for(;n<this.length-o;n++)s=(i=(0|this.words[n+o])+s)>>26,this.words[n+o]=67108863&i;if(0===s)return this.strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(i=-(0|this.words[n])+s)>>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},n.prototype._wordDiv=function(e,t){var r=(this.length,e.length),o=this.clone(),i=e,a=0|i.words[i.length-1];0!=(r=26-this._countBits(a))&&(i=i.ushln(r),o.iushln(r),a=0|i.words[i.length-1]);var s,c=o.length-i.length;if("mod"!==t){(s=new n(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=o.clone()._ishlnsubmul(i,1,c);0===l.negative&&(o=l,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var p=67108864*(0|o.words[i.length+d])+(0|o.words[i.length+d-1]);for(p=Math.min(p/a|0,67108863),o._ishlnsubmul(i,p,d);0!==o.negative;)p--,o.negative=0,o._ishlnsubmul(i,1,d),o.isZero()||(o.negative^=1);s&&(s.words[d]=p)}return s&&s.strip(),o.strip(),"div"!==t&&0!==r&&o.iushrn(r),{div:s||null,mod:o}},n.prototype.divmod=function(e,t,o){return r(!e.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new n(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new n(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new n(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},n.prototype.div=function(e){return this.divmod(e,"div",!1).div},n.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},n.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},n.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,o=e.ushrn(1),n=e.andln(1),i=r.cmp(o);return i<0||1===n&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},n.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,o=0,n=this.length-1;n>=0;n--)o=(t*o+(0|this.words[n]))%e;return o},n.prototype.idivn=function(e){r(e<=67108863);for(var t=0,o=this.length-1;o>=0;o--){var n=(0|this.words[o])+67108864*t;this.words[o]=n/e|0,t=n%e}return this.strip()},n.prototype.divn=function(e){return this.clone().idivn(e)},n.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new n(1),a=new n(0),s=new n(0),c=new n(1),u=0;t.isEven()&&o.isEven();)t.iushrn(1),o.iushrn(1),++u;for(var l=o.clone(),d=t.clone();!t.isZero();){for(var p=0,h=1;!(t.words[0]&h)&&p<26;++p,h<<=1);if(p>0)for(t.iushrn(p);p-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var f=0,m=1;!(o.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(o.iushrn(f);f-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(o)>=0?(t.isub(o),i.isub(s),a.isub(c)):(o.isub(t),s.isub(i),c.isub(a))}return{a:s,b:c,gcd:o.iushln(u)}},n.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new n(1),s=new n(0),c=o.clone();t.cmpn(1)>0&&o.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,p=1;!(o.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(o.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(o)>=0?(t.isub(o),a.isub(s)):(o.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},n.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 o=0;t.isEven()&&r.isEven();o++)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 i=t;t=r,r=i}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(o)},n.prototype.invm=function(e){return this.egcd(e).a.umod(e)},n.prototype.isEven=function(){return!(1&this.words[0])},n.prototype.isOdd=function(){return!(1&~this.words[0])},n.prototype.andln=function(e){return this.words[0]&e},n.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,o=(e-t)/26,n=1<<t;if(this.length<=o)return this._expand(o+1),this.words[o]|=n,this;for(var i=n,a=o;0!==i&&a<this.length;a++){var s=0|this.words[a];i=(s+=i)>>>26,s&=67108863,this.words[a]=s}return 0!==i&&(this.words[a]=i,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(e){var t,o=e<0;if(0!==this.negative&&!o)return-1;if(0===this.negative&&o)return 1;if(this.strip(),this.length>1)t=1;else{o&&(e=-e),r(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},n.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},n.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 o=0|this.words[r],n=0|e.words[r];if(o!==n){o<n?t=-1:o>n&&(t=1);break}}return t},n.prototype.gtn=function(e){return 1===this.cmpn(e)},n.prototype.gt=function(e){return 1===this.cmp(e)},n.prototype.gten=function(e){return this.cmpn(e)>=0},n.prototype.gte=function(e){return this.cmp(e)>=0},n.prototype.ltn=function(e){return-1===this.cmpn(e)},n.prototype.lt=function(e){return-1===this.cmp(e)},n.prototype.lten=function(e){return this.cmpn(e)<=0},n.prototype.lte=function(e){return this.cmp(e)<=0},n.prototype.eqn=function(e){return 0===this.cmpn(e)},n.prototype.eq=function(e){return 0===this.cmp(e)},n.red=function(e){return new k(e)},n.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(e){return this.red=e,this},n.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},n.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},n.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},n.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},n.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},n.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},n.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},n.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function g(e,t){this.name=e,this.p=new n(t,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function $(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(e){if("string"==typeof e){var t=n._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function _(e){k.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}g.prototype._tmp=function(){var e=new n(null);return e.words=new Array(Math.ceil(this.n/13)),e},g.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 o=t<this.n?-1:r.ucmp(this.p);return 0===o?(r.words[0]=0,r.length=1):o>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(e,t){e.iushrn(this.n,0,t)},g.prototype.imulK=function(e){return e.imul(this.k)},o(b,g),b.prototype.split=function(e,t){for(var r=4194303,o=Math.min(e.length,9),n=0;n<o;n++)t.words[n]=e.words[n];if(t.length=o,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=i&r,n=10;n<e.length;n++){var a=0|e.words[n];e.words[n-10]=(a&r)<<4|i>>>22,i=a}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},b.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 o=0|e.words[r];t+=977*o,e.words[r]=67108863&t,t=64*o+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},o(v,g),o(w,g),o($,g),$.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var o=19*(0|e.words[r])+t,n=67108863&o;o>>>=26,e.words[r]=n,t=o}return 0!==t&&(e.words[e.length++]=t),e},n._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new $}return y[e]=t,t},k.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},k.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},k.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},k.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},k.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},k.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},k.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},k.prototype.isqr=function(e){return this.imul(e,e.clone())},k.prototype.sqr=function(e){return this.mul(e,e)},k.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var o=this.m.add(new n(1)).iushrn(2);return this.pow(e,o)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new n(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),p=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),f=a;0!==h.cmp(s);){for(var m=h,y=0;0!==m.cmp(s);y++)m=m.redSqr();r(y<f);var g=this.pow(d,new n(1).iushln(f-y-1));p=p.redMul(g),d=g.redSqr(),h=h.redMul(d),f=y}return p},k.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},k.prototype.pow=function(e,t){if(t.isZero())return new n(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=e;for(var o=2;o<r.length;o++)r[o]=this.mul(r[o-1],e);var i=r[0],a=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),o=t.length-1;o>=0;o--){for(var u=t.words[o],l=c-1;l>=0;l--){var d=u>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===o&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}c=26}return i},k.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},k.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},n.mont=function(e){return new _(e)},o(_,k),_.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},_.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},_.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(o).iushrn(this.shift),i=n;return n.cmp(this.m)>=0?i=n.isub(this.m):n.cmpn(0)<0&&(i=n.iadd(this.m)),i._forceRed(this)},_.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new n(0)._forceRed(this);var r=e.mul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(o).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},_.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(bn$5,commonjsGlobal)),bn$5.exports}bn$5.exports;var brorand={exports:{}},hasRequiredBrorand,mr,hasRequiredMr,generatePrime,hasRequiredGeneratePrime;function requireBrorand(){if(hasRequiredBrorand)return brorand.exports;var e;function t(e){this.rand=e}if(hasRequiredBrorand=1,brorand.exports=function(r){return e||(e=new t(null)),e.generate(r)},brorand.exports.Rand=t,t.prototype.generate=function(e){return this._rand(e)},t.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?t.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?t.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(t.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var r=requireCryptoBrowserify();if("function"!=typeof r.randomBytes)throw new Error("Not supported");t.prototype._rand=function(e){return r.randomBytes(e)}}catch(o){}return brorand.exports}function requireMr(){if(hasRequiredMr)return mr;hasRequiredMr=1;var e=requireBn$3(),t=requireBrorand();function r(e){this.rand=e||new t.Rand}return mr=r,r.create=function(e){return new r(e)},r.prototype._randbelow=function(t){var r=t.bitLength(),o=Math.ceil(r/8);do{var n=new e(this.rand.generate(o))}while(n.cmp(t)>=0);return n},r.prototype._randrange=function(e,t){var r=t.sub(e);return e.add(this._randbelow(r))},r.prototype.test=function(t,r,o){var n=t.bitLength(),i=e.mont(t),a=new e(1).toRed(i);r||(r=Math.max(1,n/48|0));for(var s=t.subn(1),c=0;!s.testn(c);c++);for(var u=t.shrn(c),l=s.toRed(i);r>0;r--){var d=this._randrange(new e(2),s);o&&o(d);var p=d.toRed(i).redPow(u);if(0!==p.cmp(a)&&0!==p.cmp(l)){for(var h=1;h<c;h++){if(0===(p=p.redSqr()).cmp(a))return!1;if(0===p.cmp(l))break}if(h===c)return!1}}return!0},r.prototype.getDivisor=function(t,r){var o=t.bitLength(),n=e.mont(t),i=new e(1).toRed(n);r||(r=Math.max(1,o/48|0));for(var a=t.subn(1),s=0;!a.testn(s);s++);for(var c=t.shrn(s),u=a.toRed(n);r>0;r--){var l=this._randrange(new e(2),a),d=t.gcd(l);if(0!==d.cmpn(1))return d;var p=l.toRed(n).redPow(c);if(0!==p.cmp(i)&&0!==p.cmp(u)){for(var h=1;h<s;h++){if(0===(p=p.redSqr()).cmp(i))return p.fromRed().subn(1).gcd(t);if(0===p.cmp(u))break}if(h===s)return(p=p.redSqr()).fromRed().subn(1).gcd(t)}}return!1},mr}function requireGeneratePrime(){if(hasRequiredGeneratePrime)return generatePrime;hasRequiredGeneratePrime=1;var e=requireBrowser$b();generatePrime=f,f.simpleSieve=p,f.fermatTest=h;var t=requireBn$4(),r=new t(24),o=new(requireMr()),n=new t(1),i=new t(2),a=new t(5);new t(16),new t(8);var s=new t(10),c=new t(3);new t(7);var u=new t(11),l=new t(4);new t(12);var d=null;function p(e){for(var t=function(){if(null!==d)return d;var e=[];e[0]=2;for(var t=1,r=3;r<1048576;r+=2){for(var o=Math.ceil(Math.sqrt(r)),n=0;n<t&&e[n]<=o&&r%e[n]!=0;n++);t!==n&&e[n]<=o||(e[t++]=r)}return d=e,e}(),r=0;r<t.length;r++)if(0===e.modn(t[r]))return 0===e.cmpn(t[r]);return!0}function h(e){var r=t.mont(e);return 0===i.toRed(r).redPow(e.subn(1)).fromRed().cmpn(1)}function f(d,f){if(d<16)return new t(2===f||5===f?[140,123]:[140,39]);var m,y;for(f=new t(f);;){for(m=new t(e(Math.ceil(d/8)));m.bitLength()>d;)m.ishrn(1);if(m.isEven()&&m.iadd(n),m.testn(1)||m.iadd(i),f.cmp(i)){if(!f.cmp(a))for(;m.mod(s).cmp(c);)m.iadd(l)}else for(;m.mod(r).cmp(u);)m.iadd(l);if(p(y=m.shrn(1))&&p(m)&&h(y)&&h(m)&&o.test(y)&&o.test(m))return m}}return generatePrime}const 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"},require$$1$1={modp1:modp1,modp2:modp2,modp5:modp5,modp14:modp14,modp15:modp15,modp16:modp16,modp17:modp17,modp18:modp18};var dh,hasRequiredDh,hasRequiredBrowser$4;function requireDh(){if(hasRequiredDh)return dh;hasRequiredDh=1;var e=requireBn$4(),t=new(requireMr()),r=new e(24),o=new e(11),n=new e(10),i=new e(3),a=new e(7),s=requireGeneratePrime(),c=requireBrowser$b();function u(t,r){return r=r||"utf8",Buffer.isBuffer(t)||(t=new Buffer(t,r)),this._pub=new e(t),this}function l(t,r){return r=r||"utf8",Buffer.isBuffer(t)||(t=new Buffer(t,r)),this._priv=new e(t),this}dh=p;var d={};function p(t,r,o){this.setGenerator(r),this.__prime=new e(t),this._prime=e.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,o?(this.setPublicKey=u,this.setPrivateKey=l):this._primeCode=8}function h(e,t){var r=new Buffer(e.toArray());return t?r.toString(t):r}return Object.defineProperty(p.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(e,c){var u=c.toString("hex"),l=[u,e.toString(16)].join("_");if(l in d)return d[l];var p,h=0;if(e.isEven()||!s.simpleSieve||!s.fermatTest(e)||!t.test(e))return h+=1,h+="02"===u||"05"===u?8:4,d[l]=h,h;switch(t.test(e.shrn(1))||(h+=2),u){case"02":e.mod(r).cmp(o)&&(h+=8);break;case"05":(p=e.mod(n)).cmp(i)&&p.cmp(a)&&(h+=8);break;default:h+=4}return d[l]=h,h}(this.__prime,this.__gen)),this._primeCode}}),p.prototype.generateKeys=function(){return this._priv||(this._priv=new e(c(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},p.prototype.computeSecret=function(t){var r=(t=(t=new e(t)).toRed(this._prime)).redPow(this._priv).fromRed(),o=new Buffer(r.toArray()),n=this.getPrime();if(o.length<n.length){var i=new Buffer(n.length-o.length);i.fill(0),o=Buffer.concat([i,o])}return o},p.prototype.getPublicKey=function(e){return h(this._pub,e)},p.prototype.getPrivateKey=function(e){return h(this._priv,e)},p.prototype.getPrime=function(e){return h(this.__prime,e)},p.prototype.getGenerator=function(e){return h(this._gen,e)},p.prototype.setGenerator=function(t,r){return r=r||"utf8",Buffer.isBuffer(t)||(t=new Buffer(t,r)),this.__gen=t,this._gen=new e(t),this},dh}function requireBrowser$4(){if(hasRequiredBrowser$4)return browser$6;hasRequiredBrowser$4=1;var e=requireGeneratePrime(),t=require$$1$1,r=requireDh();var o={binary:!0,hex:!0,base64:!0};return browser$6.DiffieHellmanGroup=browser$6.createDiffieHellmanGroup=browser$6.getDiffieHellman=function(e){var o=new Buffer(t[e].prime,"hex"),n=new Buffer(t[e].gen,"hex");return new r(o,n)},browser$6.createDiffieHellman=browser$6.DiffieHellman=function t(n,i,a,s){return Buffer.isBuffer(i)||void 0===o[i]?t(n,"binary",i,a):(i=i||"binary",s=s||"binary",a=a||new Buffer([2]),Buffer.isBuffer(a)||(a=new Buffer(a,s)),"number"==typeof n?new r(e(n,a),a,!0):(Buffer.isBuffer(n)||(n=new Buffer(n,i)),new r(n,a,!0)))},browser$6}var readableBrowser={exports:{}},processNextickArgs={exports:{}},hasRequiredProcessNextickArgs,isarray,hasRequiredIsarray,streamBrowser,hasRequiredStreamBrowser;function requireProcessNextickArgs(){if(hasRequiredProcessNextickArgs)return processNextickArgs.exports;return hasRequiredProcessNextickArgs=1,void 0===process$1$1||!process$1$1.version||0===process$1$1.version.indexOf("v0.")||0===process$1$1.version.indexOf("v1.")&&0!==process$1$1.version.indexOf("v1.8.")?processNextickArgs.exports={nextTick:function(e,t,r,o){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var n,i,a=arguments.length;switch(a){case 0:case 1:return process$1$1.nextTick(e);case 2:return process$1$1.nextTick((function(){e.call(null,t)}));case 3:return process$1$1.nextTick((function(){e.call(null,t,r)}));case 4:return process$1$1.nextTick((function(){e.call(null,t,r,o)}));default:for(n=new Array(a-1),i=0;i<n.length;)n[i++]=arguments[i];return process$1$1.nextTick((function(){e.apply(null,n)}))}}}:processNextickArgs.exports=process$1$1,processNextickArgs.exports}function requireIsarray(){if(hasRequiredIsarray)return isarray;hasRequiredIsarray=1;var e={}.toString;return isarray=Array.isArray||function(t){return"[object Array]"==e.call(t)}}function requireStreamBrowser(){return hasRequiredStreamBrowser?streamBrowser:(hasRequiredStreamBrowser=1,streamBrowser=requireEvents().EventEmitter)}var safeBuffer={exports:{}},hasRequiredSafeBuffer;function requireSafeBuffer(){return hasRequiredSafeBuffer||(hasRequiredSafeBuffer=1,function(e,t){var r=require$$0$2,o=r.Buffer;function n(e,t){for(var r in e)t[r]=e[r]}function i(e,t,r){return o(e,t,r)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(n(r,t),t.Buffer=i),n(o,i),i.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,r)},i.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=o(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}}(safeBuffer,safeBuffer.exports)),safeBuffer.exports}var util$2={},hasRequiredUtil;function requireUtil(){if(hasRequiredUtil)return util$2;function e(e){return Object.prototype.toString.call(e)}return hasRequiredUtil=1,util$2.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===e(t)},util$2.isBoolean=function(e){return"boolean"==typeof e},util$2.isNull=function(e){return null===e},util$2.isNullOrUndefined=function(e){return null==e},util$2.isNumber=function(e){return"number"==typeof e},util$2.isString=function(e){return"string"==typeof e},util$2.isSymbol=function(e){return"symbol"==typeof e},util$2.isUndefined=function(e){return void 0===e},util$2.isRegExp=function(t){return"[object RegExp]"===e(t)},util$2.isObject=function(e){return"object"==typeof e&&null!==e},util$2.isDate=function(t){return"[object Date]"===e(t)},util$2.isError=function(t){return"[object Error]"===e(t)||t instanceof Error},util$2.isFunction=function(e){return"function"==typeof e},util$2.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},util$2.isBuffer=require$$0$2.Buffer.isBuffer,util$2}var BufferList={exports:{}},hasRequiredBufferList,destroy_1,hasRequiredDestroy,_stream_writable,hasRequired_stream_writable,_stream_duplex,hasRequired_stream_duplex,_stream_readable,hasRequired_stream_readable,_stream_transform,hasRequired_stream_transform,_stream_passthrough,hasRequired_stream_passthrough,hasRequiredReadableBrowser;function requireBufferList(){return hasRequiredBufferList||(hasRequiredBufferList=1,e=BufferList,t=requireSafeBuffer().Buffer,r=requireUtil$1(),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 t.alloc(0);for(var r,o,n,i=t.allocUnsafe(e>>>0),a=this.head,s=0;a;)r=a.data,o=i,n=s,r.copy(o,n),s+=a.data.length,a=a.next;return i},e}(),r&&r.inspect&&r.inspect.custom&&(e.exports.prototype[r.inspect.custom]=function(){var e=r.inspect({length:this.length});return this.constructor.name+" "+e})),BufferList.exports;var e,t,r}function requireDestroy(){if(hasRequiredDestroy)return destroy_1;hasRequiredDestroy=1;var e=requireProcessNextickArgs();function t(e,t){e.emit("error",t)}return destroy_1={destroy:function(r,o){var n=this,i=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return i||a?(o?o(r):r&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(t,this,r)):e.nextTick(t,this,r)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(r||null,(function(r){!o&&r?n._writableState?n._writableState.errorEmitted||(n._writableState.errorEmitted=!0,e.nextTick(t,n,r)):e.nextTick(t,n,r):o&&o(r)})),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 require_stream_writable(){if(hasRequired_stream_writable)return _stream_writable;hasRequired_stream_writable=1;var e=requireProcessNextickArgs();function t(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var o=e.entry;e.entry=null;for(;o;){var n=o.callback;t.pendingcb--,n(r),o=o.next}t.corkedRequestsFree.next=e}(t,e)}}_stream_writable=h;var r,o=!process$1$1.browser&&["v0.10","v0.9."].indexOf(process$1$1.version.slice(0,5))>-1?setImmediate:e.nextTick;h.WritableState=p;var n=Object.create(requireUtil());n.inherits=inherits_browserExports;var i={deprecate:requireBrowser$a()},a=requireStreamBrowser(),s=requireSafeBuffer().Buffer,c=(void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var u,l=requireDestroy();function d(){}function p(n,i){r=r||require_stream_duplex(),n=n||{};var a=i instanceof r;this.objectMode=!!n.objectMode,a&&(this.objectMode=this.objectMode||!!n.writableObjectMode);var s=n.highWaterMark,c=n.writableHighWaterMark,u=this.objectMode?16:16384;this.highWaterMark=s||0===s?s:a&&(c||0===c)?c:u,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 l=!1===n.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=n.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,r){var n=t._writableState,i=n.sync,a=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),r)!function(t,r,o,n,i){--r.pendingcb,o?(e.nextTick(i,n),e.nextTick(v,t,r),t._writableState.errorEmitted=!0,t.emit("error",n)):(i(n),t._writableState.errorEmitted=!0,t.emit("error",n),v(t,r))}(t,n,i,r,a);else{var s=g(n);s||n.corked||n.bufferProcessing||!n.bufferedRequest||y(t,n),i?o(m,t,n,s,a):m(t,n,s,a)}}(i,t)},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 t(this)}function h(e){if(r=r||require_stream_duplex(),!(u.call(h,this)||this instanceof r))return new h(e);this._writableState=new p(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)),a.call(this)}function f(e,t,r,o,n,i,a){t.writelen=o,t.writecb=a,t.writing=!0,t.sync=!0,r?e._writev(n,t.onwrite):e._write(n,i,t.onwrite),t.sync=!1}function m(e,t,r,o){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,o(),v(e,t)}function y(e,r){r.bufferProcessing=!0;var o=r.bufferedRequest;if(e._writev&&o&&o.next){var n=r.bufferedRequestCount,i=new Array(n),a=r.corkedRequestsFree;a.entry=o;for(var s=0,c=!0;o;)i[s]=o,o.isBuf||(c=!1),o=o.next,s+=1;i.allBuffers=c,f(e,r,!0,r.length,i,"",a.finish),r.pendingcb++,r.lastBufferedRequest=null,a.next?(r.corkedRequestsFree=a.next,a.next=null):r.corkedRequestsFree=new t(r),r.bufferedRequestCount=0}else{for(;o;){var u=o.chunk,l=o.encoding,d=o.callback;if(f(e,r,!1,r.objectMode?1:u.length,u,l,d),o=o.next,r.bufferedRequestCount--,r.writing)break}null===o&&(r.lastBufferedRequest=null)}r.bufferedRequest=o,r.bufferProcessing=!1}function g(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function b(e,t){e._final((function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),v(e,t)}))}function v(t,r){var o=g(r);return o&&(!function(t,r){r.prefinished||r.finalCalled||("function"==typeof t._final?(r.pendingcb++,r.finalCalled=!0,e.nextTick(b,t,r)):(r.prefinished=!0,t.emit("prefinish")))}(t,r),0===r.pendingcb&&(r.finished=!0,t.emit("finish"))),o}return n.inherits(h,a),p.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(p.prototype,"buffer",{get:i.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]?(u=Function.prototype[Symbol.hasInstance],Object.defineProperty(h,Symbol.hasInstance,{value:function(e){return!!u.call(this,e)||this===h&&(e&&e._writableState instanceof p)}})):u=function(e){return e instanceof this},h.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},h.prototype.write=function(t,r,o){var n,i=this._writableState,a=!1,u=!i.objectMode&&(n=t,s.isBuffer(n)||n instanceof c);return u&&!s.isBuffer(t)&&(t=function(e){return s.from(e)}(t)),"function"==typeof r&&(o=r,r=null),u?r="buffer":r||(r=i.defaultEncoding),"function"!=typeof o&&(o=d),i.ended?function(t,r){var o=new Error("write after end");t.emit("error",o),e.nextTick(r,o)}(this,o):(u||function(t,r,o,n){var i=!0,a=!1;return null===o?a=new TypeError("May not write null values to stream"):"string"==typeof o||void 0===o||r.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(t.emit("error",a),e.nextTick(n,a),i=!1),i}(this,i,t,o))&&(i.pendingcb++,a=function(e,t,r,o,n,i){if(!r){var a=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=s.from(t,r));return t}(t,o,n);o!==a&&(r=!0,n="buffer",o=a)}var c=t.objectMode?1:o.length;t.length+=c;var u=t.length<t.highWaterMark;u||(t.needDrain=!0);if(t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:o,encoding:n,isBuf:r,callback:i,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else f(e,t,!1,c,o,n,i);return u}(this,i,u,t,r,o)),a},h.prototype.cork=function(){this._writableState.corked++},h.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||y(this,e))},h.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(h.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),h.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},h.prototype._writev=null,h.prototype.end=function(t,r,o){var n=this._writableState;"function"==typeof t?(o=t,t=null,r=null):"function"==typeof r&&(o=r,r=null),null!=t&&this.write(t,r),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,r,o){r.ending=!0,v(t,r),o&&(r.finished?e.nextTick(o):t.once("finish",o));r.ended=!0,t.writable=!1}(this,n,o)},Object.defineProperty(h.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),h.prototype.destroy=l.destroy,h.prototype._undestroy=l.undestroy,h.prototype._destroy=function(e,t){this.end(),t(e)},_stream_writable}function require_stream_duplex(){if(hasRequired_stream_duplex)return _stream_duplex;hasRequired_stream_duplex=1;var e=requireProcessNextickArgs(),t=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};_stream_duplex=c;var r=Object.create(requireUtil());r.inherits=inherits_browserExports;var o=require_stream_readable(),n=require_stream_writable();r.inherits(c,o);for(var i=t(n.prototype),a=0;a<i.length;a++){var s=i[a];c.prototype[s]||(c.prototype[s]=n.prototype[s])}function c(e){if(!(this instanceof c))return new c(e);o.call(this,e),n.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",u)}function u(){this.allowHalfOpen||this._writableState.ended||e.nextTick(l,this)}function l(e){e.end()}return Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.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)}}),c.prototype._destroy=function(t,r){this.push(null),this.end(),e.nextTick(r,t)},_stream_duplex}function require_stream_readable(){if(hasRequired_stream_readable)return _stream_readable;hasRequired_stream_readable=1;var e=requireProcessNextickArgs();_stream_readable=m;var t,r=requireIsarray();m.ReadableState=f,requireEvents().EventEmitter;var o=function(e,t){return e.listeners(t).length},n=requireStreamBrowser(),i=requireSafeBuffer().Buffer,a=(void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var s=Object.create(requireUtil());s.inherits=inherits_browserExports;var c=requireUtil$1(),u=void 0;u=c&&c.debuglog?c.debuglog("stream"):function(){};var l,d=requireBufferList(),p=requireDestroy();s.inherits(m,n);var h=["error","close","destroy","pause","resume"];function f(e,r){e=e||{};var o=r instanceof(t=t||require_stream_duplex());this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,i=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:o&&(i||0===i)?i:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new d,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&&(l||(l=requireString_decoder().StringDecoder),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function m(e){if(t=t||require_stream_duplex(),!(this instanceof m))return new m(e);this._readableState=new f(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),n.call(this)}function y(e,t,r,o,n){var s,c=e._readableState;null===t?(c.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,w(e)}(e,c)):(n||(s=function(e,t){var r;o=t,i.isBuffer(o)||o instanceof a||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var o;return r}(c,t)),s?e.emit("error",s):c.objectMode||t&&t.length>0?("string"==typeof t||c.objectMode||Object.getPrototypeOf(t)===i.prototype||(t=function(e){return i.from(e)}(t)),o?c.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):g(e,c,t,!0):c.ended?e.emit("error",new Error("stream.push() after EOF")):(c.reading=!1,c.decoder&&!r?(t=c.decoder.write(t),c.objectMode||0!==t.length?g(e,c,t,!1):k(e,c)):g(e,c,t,!1))):o||(c.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(c)}function g(e,t,r,o){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,o?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&w(e)),k(e,t)}Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),m.prototype.destroy=p.destroy,m.prototype._undestroy=p.undestroy,m.prototype._destroy=function(e,t){this.push(null),t(e)},m.prototype.push=function(e,t){var r,o=this._readableState;return o.objectMode?r=!0:"string"==typeof e&&((t=t||o.defaultEncoding)!==o.encoding&&(e=i.from(e,t),t=""),r=!0),y(this,e,t,!1,r)},m.prototype.unshift=function(e){return y(this,e,null,!0,!1)},m.prototype.isPaused=function(){return!1===this._readableState.flowing},m.prototype.setEncoding=function(e){return l||(l=requireString_decoder().StringDecoder),this._readableState.decoder=new l(e),this._readableState.encoding=e,this};var b=8388608;function v(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>=b?e=b:(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 w(t){var r=t._readableState;r.needReadable=!1,r.emittedReadable||(u("emitReadable",r.flowing),r.emittedReadable=!0,r.sync?e.nextTick($,t):$(t))}function $(e){u("emit readable"),e.emit("readable"),A(e)}function k(t,r){r.readingMore||(r.readingMore=!0,e.nextTick(_,t,r))}function _(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(u("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}function T(e){u("readable nexttick read 0"),e.read(0)}function I(e,t){t.reading||(u("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),A(e),t.flowing&&!t.reading&&e.read(0)}function A(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function O(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 o;e<t.head.data.length?(o=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):o=e===t.head.data.length?t.shift():r?function(e,t){var r=t.head,o=1,n=r.data;e-=n.length;for(;r=r.next;){var i=r.data,a=e>i.length?i.length:e;if(a===i.length?n+=i:n+=i.slice(0,e),0===(e-=a)){a===i.length?(++o,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=i.slice(a));break}++o}return t.length-=o,n}(e,t):function(e,t){var r=i.allocUnsafe(e),o=t.head,n=1;o.data.copy(r),e-=o.data.length;for(;o=o.next;){var a=o.data,s=e>a.length?a.length:e;if(a.copy(r,r.length-e,0,s),0===(e-=s)){s===a.length?(++n,o.next?t.head=o.next:t.head=t.tail=null):(t.head=o,o.data=a.slice(s));break}++n}return t.length-=n,r}(e,t);return o}(e,t.buffer,t.decoder),r);var r}function E(t){var r=t._readableState;if(r.length>0)throw new Error('"endReadable()" called on non-empty stream');r.endEmitted||(r.ended=!0,e.nextTick(S,r,t))}function S(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function R(e,t){for(var r=0,o=e.length;r<o;r++)if(e[r]===t)return r;return-1}return m.prototype.read=function(e){u("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 u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?E(this):w(this),null;if(0===(e=v(e,t))&&t.ended)return 0===t.length&&E(this),null;var o,n=t.needReadable;return u("need readable",n),(0===t.length||t.length-e<t.highWaterMark)&&u("length less than watermark",n=!0),t.ended||t.reading?u("reading or ended",n=!1):n&&(u("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=v(r,t))),null===(o=e>0?O(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&E(this)),null!==o&&this.emit("data",o),o},m.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},m.prototype.pipe=function(t,n){var i=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=t;break;case 1:a.pipes=[a.pipes,t];break;default:a.pipes.push(t)}a.pipesCount+=1,u("pipe count=%d opts=%j",a.pipesCount,n);var s=(!n||!1!==n.end)&&t!==process$1$1.stdout&&t!==process$1$1.stderr?l:b;function c(e,r){u("onunpipe"),e===i&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,u("cleanup"),t.removeListener("close",y),t.removeListener("finish",g),t.removeListener("drain",d),t.removeListener("error",m),t.removeListener("unpipe",c),i.removeListener("end",l),i.removeListener("end",b),i.removeListener("data",f),p=!0,!a.awaitDrain||t._writableState&&!t._writableState.needDrain||d())}function l(){u("onend"),t.end()}a.endEmitted?e.nextTick(s):i.once("end",s),t.on("unpipe",c);var d=function(e){return function(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,A(e))}}(i);t.on("drain",d);var p=!1;var h=!1;function f(e){u("ondata"),h=!1,!1!==t.write(e)||h||((1===a.pipesCount&&a.pipes===t||a.pipesCount>1&&-1!==R(a.pipes,t))&&!p&&(u("false write response, pause",a.awaitDrain),a.awaitDrain++,h=!0),i.pause())}function m(e){u("onerror",e),b(),t.removeListener("error",m),0===o(t,"error")&&t.emit("error",e)}function y(){t.removeListener("finish",g),b()}function g(){u("onfinish"),t.removeListener("close",y),b()}function b(){u("unpipe"),i.unpipe(t)}return i.on("data",f),function(e,t,o){if("function"==typeof e.prependListener)return e.prependListener(t,o);e._events&&e._events[t]?r(e._events[t])?e._events[t].unshift(o):e._events[t]=[o,e._events[t]]:e.on(t,o)}(t,"error",m),t.once("close",y),t.once("finish",g),t.emit("pipe",i),a.flowing||(u("pipe resume"),i.resume()),t},m.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 o=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<n;i++)o[i].emit("unpipe",this,{hasUnpiped:!1});return this}var a=R(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},m.prototype.on=function(t,r){var o=n.prototype.on.call(this,t,r);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var i=this._readableState;i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.emittedReadable=!1,i.reading?i.length&&w(this):e.nextTick(T,this))}return o},m.prototype.addListener=m.prototype.on,m.prototype.resume=function(){var t=this._readableState;return t.flowing||(u("resume"),t.flowing=!0,function(t,r){r.resumeScheduled||(r.resumeScheduled=!0,e.nextTick(I,t,r))}(this,t)),this},m.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this},m.prototype.wrap=function(e){var t=this,r=this._readableState,o=!1;for(var n in e.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(n){(u("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(o=!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 i=0;i<h.length;i++)e.on(h[i],this.emit.bind(this,h[i]));return this._read=function(t){u("wrapped _read",t),o&&(o=!1,e.resume())},this},Object.defineProperty(m.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),m._fromList=O,_stream_readable}function require_stream_transform(){if(hasRequired_stream_transform)return _stream_transform;hasRequired_stream_transform=1,_stream_transform=o;var e=require_stream_duplex(),t=Object.create(requireUtil());function r(e,t){var r=this._transformState;r.transforming=!1;var o=r.writecb;if(!o)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),o(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function o(t){if(!(this instanceof o))return new o(t);e.call(this,t),this._transformState={afterTransform:r.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",n)}function n(){var e=this;"function"==typeof this._flush?this._flush((function(t,r){i(e,t,r)})):i(this,null,null)}function i(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)}return t.inherits=inherits_browserExports,t.inherits(o,e),o.prototype.push=function(t,r){return this._transformState.needTransform=!1,e.prototype.push.call(this,t,r)},o.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")},o.prototype._write=function(e,t,r){var o=this._transformState;if(o.writecb=r,o.writechunk=e,o.writeencoding=t,!o.transforming){var n=this._readableState;(o.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},o.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},o.prototype._destroy=function(t,r){var o=this;e.prototype._destroy.call(this,t,(function(e){r(e),o.emit("close")}))},_stream_transform}function require_stream_passthrough(){if(hasRequired_stream_passthrough)return _stream_passthrough;hasRequired_stream_passthrough=1,_stream_passthrough=r;var e=require_stream_transform(),t=Object.create(requireUtil());function r(t){if(!(this instanceof r))return new r(t);e.call(this,t)}return t.inherits=inherits_browserExports,t.inherits(r,e),r.prototype._transform=function(e,t,r){r(null,e)},_stream_passthrough}function requireReadableBrowser(){return hasRequiredReadableBrowser||(hasRequiredReadableBrowser=1,function(e,t){(t=e.exports=require_stream_readable()).Stream=t,t.Readable=t,t.Writable=require_stream_writable(),t.Duplex=require_stream_duplex(),t.Transform=require_stream_transform(),t.PassThrough=require_stream_passthrough()}(readableBrowser,readableBrowser.exports)),readableBrowser.exports}var sign$1={exports:{}},bn$4={exports:{}},module2;bn$4.exports,module2=bn$4,function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function o(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function n(e,t,r){if(n.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 i;"object"==typeof e?e.exports=n:t.BN=n,n.BN=n,n.wordSize=26;try{i="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require$$0$2.Buffer}catch(A){}function a(e,t){var o=e.charCodeAt(t);return o>=48&&o<=57?o-48:o>=65&&o<=70?o-55:o>=97&&o<=102?o-87:void r(!1,"Invalid character in "+e)}function s(e,t,r){var o=a(e,r);return r-1>=t&&(o|=a(e,r-1)<<4),o}function c(e,t,o,n){for(var i=0,a=0,s=Math.min(e.length,o),c=t;c<s;c++){var u=e.charCodeAt(c)-48;i*=n,a=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&a<n,"Invalid character"),i+=a}return i}function u(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(n.isBN=function(e){return e instanceof n||null!==e&&"object"==typeof e&&e.constructor.wordSize===n.wordSize&&Array.isArray(e.words)},n.max=function(e,t){return e.cmp(t)>0?e:t},n.min=function(e,t){return e.cmp(t)<0?e:t},n.prototype._init=function(e,t,o){if("number"==typeof e)return this._initNumber(e,t,o);if("object"==typeof e)return this._initArray(e,t,o);"hex"===t&&(t=16),r(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,o):(this._parseBase(e,t,n),"le"===o&&this._initArray(this.toArray(),t,o)))},n.prototype._initNumber=function(e,t,o){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):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===o&&this._initArray(this.toArray(),t,o)},n.prototype._initArray=function(e,t,o){if(r("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 i,a,s=0;if("be"===o)for(n=e.length-1,i=0;n>=0;n-=3)a=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===o)for(n=0,i=0;n<e.length;n+=3)a=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this._strip()},n.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var n,i=0,a=0;if("be"===r)for(o=e.length-1;o>=t;o-=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;else for(o=(e.length-t)%2==0?t+1:t;o<e.length;o+=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;this._strip()},n.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var o=0,n=1;n<=67108863;n*=t)o++;o--,n=n/t|0;for(var i=e.length-r,a=i%o,s=Math.min(i,i-a)+r,u=0,l=r;l<s;l+=o)u=c(e,l,l+o,t),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var d=1;for(u=c(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.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},n.prototype._move=function(e){u(e,this)},n.prototype.clone=function(){var e=new n(null);return this.copy(e),e},n.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(A){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","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"],p=[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],h=[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 f(e,t,r){r.negative=t.negative^e.negative;var o=e.length+t.length|0;r.length=o,o=o-1|0;var n=0|e.words[0],i=0|t.words[0],a=n*i,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u<o;u++){for(var l=c>>>26,d=67108863&c,p=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=p;h++){var f=u-h|0;l+=(a=(n=0|e.words[f])*(i=0|t.words[h])+d)/67108864|0,d=67108863&a}r.words[u]=0|d,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r._strip()}n.prototype.toString=function(e,t){var o;if(t=0|t||1,16===(e=e||10)||"hex"===e){o="";for(var n=0,i=0,a=0;a<this.length;a++){var s=this.words[a],c=(16777215&(s<<n|i)).toString(16);i=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),o=0!==i||a!==this.length-1?d[6-c.length]+c+o:c+o}for(0!==i&&(o=i.toString(16)+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}if(e===(0|e)&&e>=2&&e<=36){var u=p[e],l=h[e];o="";var f=this.clone();for(f.negative=0;!f.isZero();){var m=f.modrn(l).toString(e);o=(f=f.idivn(l)).isZero()?m+o:d[u-m.length]+m+o}for(this.isZero()&&(o="0"+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}r(!1,"Base should be between 2 and 36")},n.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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},n.prototype.toJSON=function(){return this.toString(16,2)},i&&(n.prototype.toBuffer=function(e,t){return this.toArrayLike(i,e,t)}),n.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},n.prototype.toArrayLike=function(e,t,o){this._strip();var n=this.byteLength(),i=o||Math.max(1,n);r(n<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,i);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,n),a},n.prototype._toArrayLikeLE=function(e,t){for(var r=0,o=0,n=0,i=0;n<this.length;n++){var a=this.words[n]<<i|o;e[r++]=255&a,r<e.length&&(e[r++]=a>>8&255),r<e.length&&(e[r++]=a>>16&255),6===i?(r<e.length&&(e[r++]=a>>24&255),o=0,i=0):(o=a>>>24,i+=2)}if(r<e.length)for(e[r++]=o;r<e.length;)e[r++]=0},n.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,o=0,n=0,i=0;n<this.length;n++){var a=this.words[n]<<i|o;e[r--]=255&a,r>=0&&(e[r--]=a>>8&255),r>=0&&(e[r--]=a>>16&255),6===i?(r>=0&&(e[r--]=a>>24&255),o=0,i=0):(o=a>>>24,i+=2)}if(r>=0)for(e[r--]=o;r>=0;)e[r--]=0},Math.clz32?n.prototype._countBits=function(e){return 32-Math.clz32(e)}:n.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},n.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},n.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},n.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},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},n.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(e){return r(!(this.negative|e.negative)),this.iuor(e)},n.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},n.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},n.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()},n.prototype.iand=function(e){return r(!(this.negative|e.negative)),this.iuand(e)},n.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},n.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},n.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var o=0;o<r.length;o++)this.words[o]=t.words[o]^r.words[o];if(this!==t)for(;o<t.length;o++)this.words[o]=t.words[o];return this.length=t.length,this._strip()},n.prototype.ixor=function(e){return r(!(this.negative|e.negative)),this.iuxor(e)},n.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},n.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},n.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),o=e%26;this._expand(t),o>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return o>0&&(this.words[n]=~this.words[n]&67108863>>26-o),this._strip()},n.prototype.notn=function(e){return this.clone().inotn(e)},n.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var o=e/26|0,n=e%26;return this._expand(o+1),this.words[o]=t?this.words[o]|1<<n:this.words[o]&~(1<<n),this._strip()},n.prototype.iadd=function(e){var t,r,o;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,o=e):(r=e,o=this);for(var n=0,i=0;i<o.length;i++)t=(0|r.words[i])+(0|o.words[i])+n,this.words[i]=67108863&t,n=t>>>26;for(;0!==n&&i<r.length;i++)t=(0|r.words[i])+n,this.words[i]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;i<r.length;i++)this.words[i]=r.words[i];return this},n.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)},n.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,o,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,o=e):(r=e,o=this);for(var i=0,a=0;a<o.length;a++)i=(t=(0|r.words[a])-(0|o.words[a])+i)>>26,this.words[a]=67108863&t;for(;0!==i&&a<r.length;a++)i=(t=(0|r.words[a])+i)>>26,this.words[a]=67108863&t;if(0===i&&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()},n.prototype.sub=function(e){return this.clone().isub(e)};var m=function(e,t,r){var o,n,i,a=e.words,s=t.words,c=r.words,u=0,l=0|a[0],d=8191&l,p=l>>>13,h=0|a[1],f=8191&h,m=h>>>13,y=0|a[2],g=8191&y,b=y>>>13,v=0|a[3],w=8191&v,$=v>>>13,k=0|a[4],_=8191&k,T=k>>>13,I=0|a[5],A=8191&I,O=I>>>13,E=0|a[6],S=8191&E,R=E>>>13,x=0|a[7],C=8191&x,P=x>>>13,N=0|a[8],B=8191&N,D=N>>>13,M=0|a[9],L=8191&M,j=M>>>13,F=0|s[0],U=8191&F,K=F>>>13,q=0|s[1],G=8191&q,H=q>>>13,V=0|s[2],W=8191&V,z=V>>>13,Z=0|s[3],Q=8191&Z,Y=Z>>>13,X=0|s[4],J=8191&X,ee=X>>>13,te=0|s[5],re=8191&te,oe=te>>>13,ne=0|s[6],ie=8191&ne,ae=ne>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],de=8191&le,pe=le>>>13,he=0|s[9],fe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(u+(o=Math.imul(d,U))|0)+((8191&(n=(n=Math.imul(d,K))+Math.imul(p,U)|0))<<13)|0;u=((i=Math.imul(p,K))+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,o=Math.imul(f,U),n=(n=Math.imul(f,K))+Math.imul(m,U)|0,i=Math.imul(m,K);var ge=(u+(o=o+Math.imul(d,G)|0)|0)+((8191&(n=(n=n+Math.imul(d,H)|0)+Math.imul(p,G)|0))<<13)|0;u=((i=i+Math.imul(p,H)|0)+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,o=Math.imul(g,U),n=(n=Math.imul(g,K))+Math.imul(b,U)|0,i=Math.imul(b,K),o=o+Math.imul(f,G)|0,n=(n=n+Math.imul(f,H)|0)+Math.imul(m,G)|0,i=i+Math.imul(m,H)|0;var be=(u+(o=o+Math.imul(d,W)|0)|0)+((8191&(n=(n=n+Math.imul(d,z)|0)+Math.imul(p,W)|0))<<13)|0;u=((i=i+Math.imul(p,z)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,o=Math.imul(w,U),n=(n=Math.imul(w,K))+Math.imul($,U)|0,i=Math.imul($,K),o=o+Math.imul(g,G)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(b,G)|0,i=i+Math.imul(b,H)|0,o=o+Math.imul(f,W)|0,n=(n=n+Math.imul(f,z)|0)+Math.imul(m,W)|0,i=i+Math.imul(m,z)|0;var ve=(u+(o=o+Math.imul(d,Q)|0)|0)+((8191&(n=(n=n+Math.imul(d,Y)|0)+Math.imul(p,Q)|0))<<13)|0;u=((i=i+Math.imul(p,Y)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,o=Math.imul(_,U),n=(n=Math.imul(_,K))+Math.imul(T,U)|0,i=Math.imul(T,K),o=o+Math.imul(w,G)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul($,G)|0,i=i+Math.imul($,H)|0,o=o+Math.imul(g,W)|0,n=(n=n+Math.imul(g,z)|0)+Math.imul(b,W)|0,i=i+Math.imul(b,z)|0,o=o+Math.imul(f,Q)|0,n=(n=n+Math.imul(f,Y)|0)+Math.imul(m,Q)|0,i=i+Math.imul(m,Y)|0;var we=(u+(o=o+Math.imul(d,J)|0)|0)+((8191&(n=(n=n+Math.imul(d,ee)|0)+Math.imul(p,J)|0))<<13)|0;u=((i=i+Math.imul(p,ee)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,o=Math.imul(A,U),n=(n=Math.imul(A,K))+Math.imul(O,U)|0,i=Math.imul(O,K),o=o+Math.imul(_,G)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(T,G)|0,i=i+Math.imul(T,H)|0,o=o+Math.imul(w,W)|0,n=(n=n+Math.imul(w,z)|0)+Math.imul($,W)|0,i=i+Math.imul($,z)|0,o=o+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(b,Q)|0,i=i+Math.imul(b,Y)|0,o=o+Math.imul(f,J)|0,n=(n=n+Math.imul(f,ee)|0)+Math.imul(m,J)|0,i=i+Math.imul(m,ee)|0;var $e=(u+(o=o+Math.imul(d,re)|0)|0)+((8191&(n=(n=n+Math.imul(d,oe)|0)+Math.imul(p,re)|0))<<13)|0;u=((i=i+Math.imul(p,oe)|0)+(n>>>13)|0)+($e>>>26)|0,$e&=67108863,o=Math.imul(S,U),n=(n=Math.imul(S,K))+Math.imul(R,U)|0,i=Math.imul(R,K),o=o+Math.imul(A,G)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(O,G)|0,i=i+Math.imul(O,H)|0,o=o+Math.imul(_,W)|0,n=(n=n+Math.imul(_,z)|0)+Math.imul(T,W)|0,i=i+Math.imul(T,z)|0,o=o+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul($,Q)|0,i=i+Math.imul($,Y)|0,o=o+Math.imul(g,J)|0,n=(n=n+Math.imul(g,ee)|0)+Math.imul(b,J)|0,i=i+Math.imul(b,ee)|0,o=o+Math.imul(f,re)|0,n=(n=n+Math.imul(f,oe)|0)+Math.imul(m,re)|0,i=i+Math.imul(m,oe)|0;var ke=(u+(o=o+Math.imul(d,ie)|0)|0)+((8191&(n=(n=n+Math.imul(d,ae)|0)+Math.imul(p,ie)|0))<<13)|0;u=((i=i+Math.imul(p,ae)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,o=Math.imul(C,U),n=(n=Math.imul(C,K))+Math.imul(P,U)|0,i=Math.imul(P,K),o=o+Math.imul(S,G)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,G)|0,i=i+Math.imul(R,H)|0,o=o+Math.imul(A,W)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(O,W)|0,i=i+Math.imul(O,z)|0,o=o+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(T,Q)|0,i=i+Math.imul(T,Y)|0,o=o+Math.imul(w,J)|0,n=(n=n+Math.imul(w,ee)|0)+Math.imul($,J)|0,i=i+Math.imul($,ee)|0,o=o+Math.imul(g,re)|0,n=(n=n+Math.imul(g,oe)|0)+Math.imul(b,re)|0,i=i+Math.imul(b,oe)|0,o=o+Math.imul(f,ie)|0,n=(n=n+Math.imul(f,ae)|0)+Math.imul(m,ie)|0,i=i+Math.imul(m,ae)|0;var _e=(u+(o=o+Math.imul(d,ce)|0)|0)+((8191&(n=(n=n+Math.imul(d,ue)|0)+Math.imul(p,ce)|0))<<13)|0;u=((i=i+Math.imul(p,ue)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,o=Math.imul(B,U),n=(n=Math.imul(B,K))+Math.imul(D,U)|0,i=Math.imul(D,K),o=o+Math.imul(C,G)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(P,G)|0,i=i+Math.imul(P,H)|0,o=o+Math.imul(S,W)|0,n=(n=n+Math.imul(S,z)|0)+Math.imul(R,W)|0,i=i+Math.imul(R,z)|0,o=o+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,Q)|0,i=i+Math.imul(O,Y)|0,o=o+Math.imul(_,J)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(T,J)|0,i=i+Math.imul(T,ee)|0,o=o+Math.imul(w,re)|0,n=(n=n+Math.imul(w,oe)|0)+Math.imul($,re)|0,i=i+Math.imul($,oe)|0,o=o+Math.imul(g,ie)|0,n=(n=n+Math.imul(g,ae)|0)+Math.imul(b,ie)|0,i=i+Math.imul(b,ae)|0,o=o+Math.imul(f,ce)|0,n=(n=n+Math.imul(f,ue)|0)+Math.imul(m,ce)|0,i=i+Math.imul(m,ue)|0;var Te=(u+(o=o+Math.imul(d,de)|0)|0)+((8191&(n=(n=n+Math.imul(d,pe)|0)+Math.imul(p,de)|0))<<13)|0;u=((i=i+Math.imul(p,pe)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,o=Math.imul(L,U),n=(n=Math.imul(L,K))+Math.imul(j,U)|0,i=Math.imul(j,K),o=o+Math.imul(B,G)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(D,G)|0,i=i+Math.imul(D,H)|0,o=o+Math.imul(C,W)|0,n=(n=n+Math.imul(C,z)|0)+Math.imul(P,W)|0,i=i+Math.imul(P,z)|0,o=o+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(R,Q)|0,i=i+Math.imul(R,Y)|0,o=o+Math.imul(A,J)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(O,J)|0,i=i+Math.imul(O,ee)|0,o=o+Math.imul(_,re)|0,n=(n=n+Math.imul(_,oe)|0)+Math.imul(T,re)|0,i=i+Math.imul(T,oe)|0,o=o+Math.imul(w,ie)|0,n=(n=n+Math.imul(w,ae)|0)+Math.imul($,ie)|0,i=i+Math.imul($,ae)|0,o=o+Math.imul(g,ce)|0,n=(n=n+Math.imul(g,ue)|0)+Math.imul(b,ce)|0,i=i+Math.imul(b,ue)|0,o=o+Math.imul(f,de)|0,n=(n=n+Math.imul(f,pe)|0)+Math.imul(m,de)|0,i=i+Math.imul(m,pe)|0;var Ie=(u+(o=o+Math.imul(d,fe)|0)|0)+((8191&(n=(n=n+Math.imul(d,me)|0)+Math.imul(p,fe)|0))<<13)|0;u=((i=i+Math.imul(p,me)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,o=Math.imul(L,G),n=(n=Math.imul(L,H))+Math.imul(j,G)|0,i=Math.imul(j,H),o=o+Math.imul(B,W)|0,n=(n=n+Math.imul(B,z)|0)+Math.imul(D,W)|0,i=i+Math.imul(D,z)|0,o=o+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,Y)|0,o=o+Math.imul(S,J)|0,n=(n=n+Math.imul(S,ee)|0)+Math.imul(R,J)|0,i=i+Math.imul(R,ee)|0,o=o+Math.imul(A,re)|0,n=(n=n+Math.imul(A,oe)|0)+Math.imul(O,re)|0,i=i+Math.imul(O,oe)|0,o=o+Math.imul(_,ie)|0,n=(n=n+Math.imul(_,ae)|0)+Math.imul(T,ie)|0,i=i+Math.imul(T,ae)|0,o=o+Math.imul(w,ce)|0,n=(n=n+Math.imul(w,ue)|0)+Math.imul($,ce)|0,i=i+Math.imul($,ue)|0,o=o+Math.imul(g,de)|0,n=(n=n+Math.imul(g,pe)|0)+Math.imul(b,de)|0,i=i+Math.imul(b,pe)|0;var Ae=(u+(o=o+Math.imul(f,fe)|0)|0)+((8191&(n=(n=n+Math.imul(f,me)|0)+Math.imul(m,fe)|0))<<13)|0;u=((i=i+Math.imul(m,me)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,o=Math.imul(L,W),n=(n=Math.imul(L,z))+Math.imul(j,W)|0,i=Math.imul(j,z),o=o+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(D,Q)|0,i=i+Math.imul(D,Y)|0,o=o+Math.imul(C,J)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(P,J)|0,i=i+Math.imul(P,ee)|0,o=o+Math.imul(S,re)|0,n=(n=n+Math.imul(S,oe)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,oe)|0,o=o+Math.imul(A,ie)|0,n=(n=n+Math.imul(A,ae)|0)+Math.imul(O,ie)|0,i=i+Math.imul(O,ae)|0,o=o+Math.imul(_,ce)|0,n=(n=n+Math.imul(_,ue)|0)+Math.imul(T,ce)|0,i=i+Math.imul(T,ue)|0,o=o+Math.imul(w,de)|0,n=(n=n+Math.imul(w,pe)|0)+Math.imul($,de)|0,i=i+Math.imul($,pe)|0;var Oe=(u+(o=o+Math.imul(g,fe)|0)|0)+((8191&(n=(n=n+Math.imul(g,me)|0)+Math.imul(b,fe)|0))<<13)|0;u=((i=i+Math.imul(b,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,o=Math.imul(L,Q),n=(n=Math.imul(L,Y))+Math.imul(j,Q)|0,i=Math.imul(j,Y),o=o+Math.imul(B,J)|0,n=(n=n+Math.imul(B,ee)|0)+Math.imul(D,J)|0,i=i+Math.imul(D,ee)|0,o=o+Math.imul(C,re)|0,n=(n=n+Math.imul(C,oe)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,oe)|0,o=o+Math.imul(S,ie)|0,n=(n=n+Math.imul(S,ae)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,ae)|0,o=o+Math.imul(A,ce)|0,n=(n=n+Math.imul(A,ue)|0)+Math.imul(O,ce)|0,i=i+Math.imul(O,ue)|0,o=o+Math.imul(_,de)|0,n=(n=n+Math.imul(_,pe)|0)+Math.imul(T,de)|0,i=i+Math.imul(T,pe)|0;var Ee=(u+(o=o+Math.imul(w,fe)|0)|0)+((8191&(n=(n=n+Math.imul(w,me)|0)+Math.imul($,fe)|0))<<13)|0;u=((i=i+Math.imul($,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,o=Math.imul(L,J),n=(n=Math.imul(L,ee))+Math.imul(j,J)|0,i=Math.imul(j,ee),o=o+Math.imul(B,re)|0,n=(n=n+Math.imul(B,oe)|0)+Math.imul(D,re)|0,i=i+Math.imul(D,oe)|0,o=o+Math.imul(C,ie)|0,n=(n=n+Math.imul(C,ae)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,ae)|0,o=o+Math.imul(S,ce)|0,n=(n=n+Math.imul(S,ue)|0)+Math.imul(R,ce)|0,i=i+Math.imul(R,ue)|0,o=o+Math.imul(A,de)|0,n=(n=n+Math.imul(A,pe)|0)+Math.imul(O,de)|0,i=i+Math.imul(O,pe)|0;var Se=(u+(o=o+Math.imul(_,fe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(T,fe)|0))<<13)|0;u=((i=i+Math.imul(T,me)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,o=Math.imul(L,re),n=(n=Math.imul(L,oe))+Math.imul(j,re)|0,i=Math.imul(j,oe),o=o+Math.imul(B,ie)|0,n=(n=n+Math.imul(B,ae)|0)+Math.imul(D,ie)|0,i=i+Math.imul(D,ae)|0,o=o+Math.imul(C,ce)|0,n=(n=n+Math.imul(C,ue)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,ue)|0,o=o+Math.imul(S,de)|0,n=(n=n+Math.imul(S,pe)|0)+Math.imul(R,de)|0,i=i+Math.imul(R,pe)|0;var Re=(u+(o=o+Math.imul(A,fe)|0)|0)+((8191&(n=(n=n+Math.imul(A,me)|0)+Math.imul(O,fe)|0))<<13)|0;u=((i=i+Math.imul(O,me)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,o=Math.imul(L,ie),n=(n=Math.imul(L,ae))+Math.imul(j,ie)|0,i=Math.imul(j,ae),o=o+Math.imul(B,ce)|0,n=(n=n+Math.imul(B,ue)|0)+Math.imul(D,ce)|0,i=i+Math.imul(D,ue)|0,o=o+Math.imul(C,de)|0,n=(n=n+Math.imul(C,pe)|0)+Math.imul(P,de)|0,i=i+Math.imul(P,pe)|0;var xe=(u+(o=o+Math.imul(S,fe)|0)|0)+((8191&(n=(n=n+Math.imul(S,me)|0)+Math.imul(R,fe)|0))<<13)|0;u=((i=i+Math.imul(R,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,o=Math.imul(L,ce),n=(n=Math.imul(L,ue))+Math.imul(j,ce)|0,i=Math.imul(j,ue),o=o+Math.imul(B,de)|0,n=(n=n+Math.imul(B,pe)|0)+Math.imul(D,de)|0,i=i+Math.imul(D,pe)|0;var Ce=(u+(o=o+Math.imul(C,fe)|0)|0)+((8191&(n=(n=n+Math.imul(C,me)|0)+Math.imul(P,fe)|0))<<13)|0;u=((i=i+Math.imul(P,me)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,o=Math.imul(L,de),n=(n=Math.imul(L,pe))+Math.imul(j,de)|0,i=Math.imul(j,pe);var Pe=(u+(o=o+Math.imul(B,fe)|0)|0)+((8191&(n=(n=n+Math.imul(B,me)|0)+Math.imul(D,fe)|0))<<13)|0;u=((i=i+Math.imul(D,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Ne=(u+(o=Math.imul(L,fe))|0)+((8191&(n=(n=Math.imul(L,me))+Math.imul(j,fe)|0))<<13)|0;return u=((i=Math.imul(j,me))+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=ye,c[1]=ge,c[2]=be,c[3]=ve,c[4]=we,c[5]=$e,c[6]=ke,c[7]=_e,c[8]=Te,c[9]=Ie,c[10]=Ae,c[11]=Oe,c[12]=Ee,c[13]=Se,c[14]=Re,c[15]=xe,c[16]=Ce,c[17]=Pe,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function y(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var o=0,n=0,i=0;i<r.length-1;i++){var a=n;n=0;for(var s=67108863&o,c=Math.min(i,t.length-1),u=Math.max(0,i-e.length+1);u<=c;u++){var l=i-u,d=(0|e.words[l])*(0|t.words[u]),p=67108863&d;s=67108863&(p=p+s|0),n+=(a=(a=a+(d/67108864|0)|0)+(p>>>26)|0)>>>26,a&=67108863}r.words[i]=s,o=a,a=n}return 0!==o?r.words[i]=o:r.length--,r._strip()}function g(e,t,r){return y(e,t,r)}Math.imul||(m=f),n.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):r<63?f(this,e,t):r<1024?y(this,e,t):g(this,e,t)},n.prototype.mul=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},n.prototype.mulf=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),g(this,e,t)},n.prototype.imul=function(e){return this.clone().mulTo(e,this)},n.prototype.imuln=function(e){var t=e<0;t&&(e=-e),r("number"==typeof e),r(e<67108864);for(var o=0,n=0;n<this.length;n++){var i=(0|this.words[n])*e,a=(67108863&i)+(67108863&o);o>>=26,o+=i/67108864|0,o+=a>>>26,this.words[n]=67108863&a}return 0!==o&&(this.words[n]=o,this.length++),t?this.ineg():this},n.prototype.muln=function(e){return this.clone().imuln(e)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var o=r/26|0,n=r%26;t[r]=e.words[o]>>>n&1}return t}(e);if(0===t.length)return new n(1);for(var r=this,o=0;o<t.length&&0===t[o];o++,r=r.sqr());if(++o<t.length)for(var i=r.sqr();o<t.length;o++,i=i.sqr())0!==t[o]&&(r=r.mul(i));return r},n.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,o=e%26,n=(e-o)/26,i=67108863>>>26-o<<26-o;if(0!==o){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&i,c=(0|this.words[t])-s<<o;this.words[t]=c|a,a=s>>>26-o}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()},n.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},n.prototype.iushrn=function(e,t,o){var n;r("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var i=e%26,a=Math.min((e-i)/26,this.length),s=67108863^67108863>>>i<<i,c=o;if(n-=a,n=Math.max(0,n),c){for(var u=0;u<a;u++)c.words[u]=this.words[u];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var d=0|this.words[u];this.words[u]=l<<26-i|d>>>i,l=d&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(e,t,o){return r(0===this.negative),this.iushrn(e,t,o)},n.prototype.shln=function(e){return this.clone().ishln(e)},n.prototype.ushln=function(e){return this.clone().iushln(e)},n.prototype.shrn=function(e){return this.clone().ishrn(e)},n.prototype.ushrn=function(e){return this.clone().iushrn(e)},n.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26,n=1<<t;return!(this.length<=o||!(this.words[o]&n))},n.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=o)return this;if(0!==t&&o++,this.length=Math.min(o,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(e){return this.clone().imaskn(e)},n.prototype.iaddn=function(e){return r("number"==typeof e),r(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)},n.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},n.prototype.isubn=function(e){if(r("number"==typeof e),r(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()},n.prototype.addn=function(e){return this.clone().iaddn(e)},n.prototype.subn=function(e){return this.clone().isubn(e)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(e,t,o){var n,i,a=e.length+o;this._expand(a);var s=0;for(n=0;n<e.length;n++){i=(0|this.words[n+o])+s;var c=(0|e.words[n])*t;s=((i-=67108863&c)>>26)-(c/67108864|0),this.words[n+o]=67108863&i}for(;n<this.length-o;n++)s=(i=(0|this.words[n+o])+s)>>26,this.words[n+o]=67108863&i;if(0===s)return this._strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(i=-(0|this.words[n])+s)>>26,this.words[n]=67108863&i;return this.negative=1,this._strip()},n.prototype._wordDiv=function(e,t){var r=(this.length,e.length),o=this.clone(),i=e,a=0|i.words[i.length-1];0!=(r=26-this._countBits(a))&&(i=i.ushln(r),o.iushln(r),a=0|i.words[i.length-1]);var s,c=o.length-i.length;if("mod"!==t){(s=new n(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=o.clone()._ishlnsubmul(i,1,c);0===l.negative&&(o=l,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var p=67108864*(0|o.words[i.length+d])+(0|o.words[i.length+d-1]);for(p=Math.min(p/a|0,67108863),o._ishlnsubmul(i,p,d);0!==o.negative;)p--,o.negative=0,o._ishlnsubmul(i,1,d),o.isZero()||(o.negative^=1);s&&(s.words[d]=p)}return s&&s._strip(),o._strip(),"div"!==t&&0!==r&&o.iushrn(r),{div:s||null,mod:o}},n.prototype.divmod=function(e,t,o){return r(!e.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new n(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new n(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new n(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},n.prototype.div=function(e){return this.divmod(e,"div",!1).div},n.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},n.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},n.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,o=e.ushrn(1),n=e.andln(1),i=r.cmp(o);return i<0||1===n&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},n.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var o=(1<<26)%e,n=0,i=this.length-1;i>=0;i--)n=(o*n+(0|this.words[i]))%e;return t?-n:n},n.prototype.modn=function(e){return this.modrn(e)},n.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var o=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*o;this.words[n]=i/e|0,o=i%e}return this._strip(),t?this.ineg():this},n.prototype.divn=function(e){return this.clone().idivn(e)},n.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new n(1),a=new n(0),s=new n(0),c=new n(1),u=0;t.isEven()&&o.isEven();)t.iushrn(1),o.iushrn(1),++u;for(var l=o.clone(),d=t.clone();!t.isZero();){for(var p=0,h=1;!(t.words[0]&h)&&p<26;++p,h<<=1);if(p>0)for(t.iushrn(p);p-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var f=0,m=1;!(o.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(o.iushrn(f);f-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(o)>=0?(t.isub(o),i.isub(s),a.isub(c)):(o.isub(t),s.isub(i),c.isub(a))}return{a:s,b:c,gcd:o.iushln(u)}},n.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new n(1),s=new n(0),c=o.clone();t.cmpn(1)>0&&o.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,p=1;!(o.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(o.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(o)>=0?(t.isub(o),a.isub(s)):(o.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},n.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 o=0;t.isEven()&&r.isEven();o++)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 i=t;t=r,r=i}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(o)},n.prototype.invm=function(e){return this.egcd(e).a.umod(e)},n.prototype.isEven=function(){return!(1&this.words[0])},n.prototype.isOdd=function(){return!(1&~this.words[0])},n.prototype.andln=function(e){return this.words[0]&e},n.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,o=(e-t)/26,n=1<<t;if(this.length<=o)return this._expand(o+1),this.words[o]|=n,this;for(var i=n,a=o;0!==i&&a<this.length;a++){var s=0|this.words[a];i=(s+=i)>>>26,s&=67108863,this.words[a]=s}return 0!==i&&(this.words[a]=i,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(e){var t,o=e<0;if(0!==this.negative&&!o)return-1;if(0===this.negative&&o)return 1;if(this._strip(),this.length>1)t=1;else{o&&(e=-e),r(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},n.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},n.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 o=0|this.words[r],n=0|e.words[r];if(o!==n){o<n?t=-1:o>n&&(t=1);break}}return t},n.prototype.gtn=function(e){return 1===this.cmpn(e)},n.prototype.gt=function(e){return 1===this.cmp(e)},n.prototype.gten=function(e){return this.cmpn(e)>=0},n.prototype.gte=function(e){return this.cmp(e)>=0},n.prototype.ltn=function(e){return-1===this.cmpn(e)},n.prototype.lt=function(e){return-1===this.cmp(e)},n.prototype.lten=function(e){return this.cmpn(e)<=0},n.prototype.lte=function(e){return this.cmp(e)<=0},n.prototype.eqn=function(e){return 0===this.cmpn(e)},n.prototype.eq=function(e){return 0===this.cmp(e)},n.red=function(e){return new T(e)},n.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(e){return this.red=e,this},n.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},n.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},n.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},n.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},n.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},n.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},n.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},n.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var b={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new n(t,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function $(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function T(e){if("string"==typeof e){var t=n._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function I(e){T.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var e=new n(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var o=t<this.n?-1:r.ucmp(this.p);return 0===o?(r.words[0]=0,r.length=1):o>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},o(w,v),w.prototype.split=function(e,t){for(var r=4194303,o=Math.min(e.length,9),n=0;n<o;n++)t.words[n]=e.words[n];if(t.length=o,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=i&r,n=10;n<e.length;n++){var a=0|e.words[n];e.words[n-10]=(a&r)<<4|i>>>22,i=a}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},w.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 o=0|e.words[r];t+=977*o,e.words[r]=67108863&t,t=64*o+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},o($,v),o(k,v),o(_,v),_.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var o=19*(0|e.words[r])+t,n=67108863&o;o>>>=26,e.words[r]=n,t=o}return 0!==t&&(e.words[e.length++]=t),e},n._prime=function(e){if(b[e])return b[e];var t;if("k256"===e)t=new w;else if("p224"===e)t=new $;else if("p192"===e)t=new k;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return b[e]=t,t},T.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},T.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},T.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},T.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},T.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)},T.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},T.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)},T.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},T.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},T.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},T.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},T.prototype.isqr=function(e){return this.imul(e,e.clone())},T.prototype.sqr=function(e){return this.mul(e,e)},T.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var o=this.m.add(new n(1)).iushrn(2);return this.pow(e,o)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new n(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),p=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),f=a;0!==h.cmp(s);){for(var m=h,y=0;0!==m.cmp(s);y++)m=m.redSqr();r(y<f);var g=this.pow(d,new n(1).iushln(f-y-1));p=p.redMul(g),d=g.redSqr(),h=h.redMul(d),f=y}return p},T.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},T.prototype.pow=function(e,t){if(t.isZero())return new n(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=e;for(var o=2;o<r.length;o++)r[o]=this.mul(r[o-1],e);var i=r[0],a=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),o=t.length-1;o>=0;o--){for(var u=t.words[o],l=c-1;l>=0;l--){var d=u>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===o&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}c=26}return i},T.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},T.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},n.mont=function(e){return new I(e)},o(I,T),I.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},I.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},I.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(o).iushrn(this.shift),i=n;return n.cmp(this.m)>=0?i=n.isub(this.m):n.cmpn(0)<0&&(i=n.iadd(this.m)),i._forceRed(this)},I.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new n(0)._forceRed(this);var r=e.mul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(o).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},I.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(module2,commonjsGlobal);var bnExports$1=bn$4.exports;const _BN=getDefaultExportFromCjs$2(bnExports$1);var browserifyRsa,hasRequiredBrowserifyRsa;function requireBrowserifyRsa(){if(hasRequiredBrowserifyRsa)return browserifyRsa;hasRequiredBrowserifyRsa=1;var e=bnExports$1,t=requireBrowser$b(),r=requireSafeBuffer$1().Buffer;function o(r){var o,n=r.modulus.byteLength();do{o=new e(t(n))}while(o.cmp(r.modulus)>=0||!o.umod(r.prime1)||!o.umod(r.prime2));return o}function n(t,n){var i=function(t){var r=o(t);return{blinder:r.toRed(e.mont(t.modulus)).redPow(new e(t.publicExponent)).fromRed(),unblinder:r.invm(t.modulus)}}(n),a=n.modulus.byteLength(),s=new e(t).mul(i.blinder).umod(n.modulus),c=s.toRed(e.mont(n.prime1)),u=s.toRed(e.mont(n.prime2)),l=n.coefficient,d=n.prime1,p=n.prime2,h=c.redPow(n.exponent1).fromRed(),f=u.redPow(n.exponent2).fromRed(),m=h.isub(f).imul(l).umod(d).imul(p);return f.iadd(m).imul(i.unblinder).umod(n.modulus).toArrayLike(r,"be",a)}return n.getr=o,browserifyRsa=n}var elliptic$1={};const version$7="6.6.1",require$$0$1={version:version$7};var utils$o={},bn$3={exports:{}};bn$3.exports,function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function o(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function n(e,t,r){if(n.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 i;"object"==typeof e?e.exports=n:t.BN=n,n.BN=n,n.wordSize=26;try{i="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require$$0$2.Buffer}catch(T){}function a(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(e,t,r){var o=a(e,r);return r-1>=t&&(o|=a(e,r-1)<<4),o}function c(e,t,r,o){for(var n=0,i=Math.min(e.length,r),a=t;a<i;a++){var s=e.charCodeAt(a)-48;n*=o,n+=s>=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(e){return e instanceof n||null!==e&&"object"==typeof e&&e.constructor.wordSize===n.wordSize&&Array.isArray(e.words)},n.max=function(e,t){return e.cmp(t)>0?e:t},n.min=function(e,t){return e.cmp(t)<0?e:t},n.prototype._init=function(e,t,o){if("number"==typeof e)return this._initNumber(e,t,o);if("object"==typeof e)return this._initArray(e,t,o);"hex"===t&&(t=16),r(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,o):(this._parseBase(e,t,n),"le"===o&&this._initArray(this.toArray(),t,o)))},n.prototype._initNumber=function(e,t,o){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):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===o&&this._initArray(this.toArray(),t,o)},n.prototype._initArray=function(e,t,o){if(r("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 i,a,s=0;if("be"===o)for(n=e.length-1,i=0;n>=0;n-=3)a=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===o)for(n=0,i=0;n<e.length;n+=3)a=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this.strip()},n.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var n,i=0,a=0;if("be"===r)for(o=e.length-1;o>=t;o-=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;else for(o=(e.length-t)%2==0?t+1:t;o<e.length;o+=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;this.strip()},n.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var o=0,n=1;n<=67108863;n*=t)o++;o--,n=n/t|0;for(var i=e.length-r,a=i%o,s=Math.min(i,i-a)+r,u=0,l=r;l<s;l+=o)u=c(e,l,l+o,t),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var d=1;for(u=c(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.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},n.prototype.clone=function(){var e=new n(null);return this.copy(e),e},n.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","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"],l=[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],d=[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 p(e,t,r){r.negative=t.negative^e.negative;var o=e.length+t.length|0;r.length=o,o=o-1|0;var n=0|e.words[0],i=0|t.words[0],a=n*i,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u<o;u++){for(var l=c>>>26,d=67108863&c,p=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=p;h++){var f=u-h|0;l+=(a=(n=0|e.words[f])*(i=0|t.words[h])+d)/67108864|0,d=67108863&a}r.words[u]=0|d,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}n.prototype.toString=function(e,t){var o;if(t=0|t||1,16===(e=e||10)||"hex"===e){o="";for(var n=0,i=0,a=0;a<this.length;a++){var s=this.words[a],c=(16777215&(s<<n|i)).toString(16);i=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),o=0!==i||a!==this.length-1?u[6-c.length]+c+o:c+o}for(0!==i&&(o=i.toString(16)+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}if(e===(0|e)&&e>=2&&e<=36){var p=l[e],h=d[e];o="";var f=this.clone();for(f.negative=0;!f.isZero();){var m=f.modn(h).toString(e);o=(f=f.idivn(h)).isZero()?m+o:u[p-m.length]+m+o}for(this.isZero()&&(o="0"+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}r(!1,"Base should be between 2 and 36")},n.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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(e,t){return r(void 0!==i),this.toArrayLike(i,e,t)},n.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},n.prototype.toArrayLike=function(e,t,o){var n=this.byteLength(),i=o||Math.max(1,n);r(n<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===t,u=new e(i),l=this.clone();if(c){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[s]=a;for(;s<i;s++)u[s]=0}else{for(s=0;s<i-n;s++)u[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[i-s-1]=a}return u},Math.clz32?n.prototype._countBits=function(e){return 32-Math.clz32(e)}:n.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},n.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},n.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},n.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},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},n.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(e){return r(!(this.negative|e.negative)),this.iuor(e)},n.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},n.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},n.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()},n.prototype.iand=function(e){return r(!(this.negative|e.negative)),this.iuand(e)},n.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},n.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},n.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var o=0;o<r.length;o++)this.words[o]=t.words[o]^r.words[o];if(this!==t)for(;o<t.length;o++)this.words[o]=t.words[o];return this.length=t.length,this.strip()},n.prototype.ixor=function(e){return r(!(this.negative|e.negative)),this.iuxor(e)},n.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},n.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},n.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),o=e%26;this._expand(t),o>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return o>0&&(this.words[n]=~this.words[n]&67108863>>26-o),this.strip()},n.prototype.notn=function(e){return this.clone().inotn(e)},n.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var o=e/26|0,n=e%26;return this._expand(o+1),this.words[o]=t?this.words[o]|1<<n:this.words[o]&~(1<<n),this.strip()},n.prototype.iadd=function(e){var t,r,o;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,o=e):(r=e,o=this);for(var n=0,i=0;i<o.length;i++)t=(0|r.words[i])+(0|o.words[i])+n,this.words[i]=67108863&t,n=t>>>26;for(;0!==n&&i<r.length;i++)t=(0|r.words[i])+n,this.words[i]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;i<r.length;i++)this.words[i]=r.words[i];return this},n.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)},n.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,o,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,o=e):(r=e,o=this);for(var i=0,a=0;a<o.length;a++)i=(t=(0|r.words[a])-(0|o.words[a])+i)>>26,this.words[a]=67108863&t;for(;0!==i&&a<r.length;a++)i=(t=(0|r.words[a])+i)>>26,this.words[a]=67108863&t;if(0===i&&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()},n.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,r){var o,n,i,a=e.words,s=t.words,c=r.words,u=0,l=0|a[0],d=8191&l,p=l>>>13,h=0|a[1],f=8191&h,m=h>>>13,y=0|a[2],g=8191&y,b=y>>>13,v=0|a[3],w=8191&v,$=v>>>13,k=0|a[4],_=8191&k,T=k>>>13,I=0|a[5],A=8191&I,O=I>>>13,E=0|a[6],S=8191&E,R=E>>>13,x=0|a[7],C=8191&x,P=x>>>13,N=0|a[8],B=8191&N,D=N>>>13,M=0|a[9],L=8191&M,j=M>>>13,F=0|s[0],U=8191&F,K=F>>>13,q=0|s[1],G=8191&q,H=q>>>13,V=0|s[2],W=8191&V,z=V>>>13,Z=0|s[3],Q=8191&Z,Y=Z>>>13,X=0|s[4],J=8191&X,ee=X>>>13,te=0|s[5],re=8191&te,oe=te>>>13,ne=0|s[6],ie=8191&ne,ae=ne>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],de=8191&le,pe=le>>>13,he=0|s[9],fe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(u+(o=Math.imul(d,U))|0)+((8191&(n=(n=Math.imul(d,K))+Math.imul(p,U)|0))<<13)|0;u=((i=Math.imul(p,K))+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,o=Math.imul(f,U),n=(n=Math.imul(f,K))+Math.imul(m,U)|0,i=Math.imul(m,K);var ge=(u+(o=o+Math.imul(d,G)|0)|0)+((8191&(n=(n=n+Math.imul(d,H)|0)+Math.imul(p,G)|0))<<13)|0;u=((i=i+Math.imul(p,H)|0)+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,o=Math.imul(g,U),n=(n=Math.imul(g,K))+Math.imul(b,U)|0,i=Math.imul(b,K),o=o+Math.imul(f,G)|0,n=(n=n+Math.imul(f,H)|0)+Math.imul(m,G)|0,i=i+Math.imul(m,H)|0;var be=(u+(o=o+Math.imul(d,W)|0)|0)+((8191&(n=(n=n+Math.imul(d,z)|0)+Math.imul(p,W)|0))<<13)|0;u=((i=i+Math.imul(p,z)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,o=Math.imul(w,U),n=(n=Math.imul(w,K))+Math.imul($,U)|0,i=Math.imul($,K),o=o+Math.imul(g,G)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(b,G)|0,i=i+Math.imul(b,H)|0,o=o+Math.imul(f,W)|0,n=(n=n+Math.imul(f,z)|0)+Math.imul(m,W)|0,i=i+Math.imul(m,z)|0;var ve=(u+(o=o+Math.imul(d,Q)|0)|0)+((8191&(n=(n=n+Math.imul(d,Y)|0)+Math.imul(p,Q)|0))<<13)|0;u=((i=i+Math.imul(p,Y)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,o=Math.imul(_,U),n=(n=Math.imul(_,K))+Math.imul(T,U)|0,i=Math.imul(T,K),o=o+Math.imul(w,G)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul($,G)|0,i=i+Math.imul($,H)|0,o=o+Math.imul(g,W)|0,n=(n=n+Math.imul(g,z)|0)+Math.imul(b,W)|0,i=i+Math.imul(b,z)|0,o=o+Math.imul(f,Q)|0,n=(n=n+Math.imul(f,Y)|0)+Math.imul(m,Q)|0,i=i+Math.imul(m,Y)|0;var we=(u+(o=o+Math.imul(d,J)|0)|0)+((8191&(n=(n=n+Math.imul(d,ee)|0)+Math.imul(p,J)|0))<<13)|0;u=((i=i+Math.imul(p,ee)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,o=Math.imul(A,U),n=(n=Math.imul(A,K))+Math.imul(O,U)|0,i=Math.imul(O,K),o=o+Math.imul(_,G)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(T,G)|0,i=i+Math.imul(T,H)|0,o=o+Math.imul(w,W)|0,n=(n=n+Math.imul(w,z)|0)+Math.imul($,W)|0,i=i+Math.imul($,z)|0,o=o+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(b,Q)|0,i=i+Math.imul(b,Y)|0,o=o+Math.imul(f,J)|0,n=(n=n+Math.imul(f,ee)|0)+Math.imul(m,J)|0,i=i+Math.imul(m,ee)|0;var $e=(u+(o=o+Math.imul(d,re)|0)|0)+((8191&(n=(n=n+Math.imul(d,oe)|0)+Math.imul(p,re)|0))<<13)|0;u=((i=i+Math.imul(p,oe)|0)+(n>>>13)|0)+($e>>>26)|0,$e&=67108863,o=Math.imul(S,U),n=(n=Math.imul(S,K))+Math.imul(R,U)|0,i=Math.imul(R,K),o=o+Math.imul(A,G)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(O,G)|0,i=i+Math.imul(O,H)|0,o=o+Math.imul(_,W)|0,n=(n=n+Math.imul(_,z)|0)+Math.imul(T,W)|0,i=i+Math.imul(T,z)|0,o=o+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul($,Q)|0,i=i+Math.imul($,Y)|0,o=o+Math.imul(g,J)|0,n=(n=n+Math.imul(g,ee)|0)+Math.imul(b,J)|0,i=i+Math.imul(b,ee)|0,o=o+Math.imul(f,re)|0,n=(n=n+Math.imul(f,oe)|0)+Math.imul(m,re)|0,i=i+Math.imul(m,oe)|0;var ke=(u+(o=o+Math.imul(d,ie)|0)|0)+((8191&(n=(n=n+Math.imul(d,ae)|0)+Math.imul(p,ie)|0))<<13)|0;u=((i=i+Math.imul(p,ae)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,o=Math.imul(C,U),n=(n=Math.imul(C,K))+Math.imul(P,U)|0,i=Math.imul(P,K),o=o+Math.imul(S,G)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,G)|0,i=i+Math.imul(R,H)|0,o=o+Math.imul(A,W)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(O,W)|0,i=i+Math.imul(O,z)|0,o=o+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(T,Q)|0,i=i+Math.imul(T,Y)|0,o=o+Math.imul(w,J)|0,n=(n=n+Math.imul(w,ee)|0)+Math.imul($,J)|0,i=i+Math.imul($,ee)|0,o=o+Math.imul(g,re)|0,n=(n=n+Math.imul(g,oe)|0)+Math.imul(b,re)|0,i=i+Math.imul(b,oe)|0,o=o+Math.imul(f,ie)|0,n=(n=n+Math.imul(f,ae)|0)+Math.imul(m,ie)|0,i=i+Math.imul(m,ae)|0;var _e=(u+(o=o+Math.imul(d,ce)|0)|0)+((8191&(n=(n=n+Math.imul(d,ue)|0)+Math.imul(p,ce)|0))<<13)|0;u=((i=i+Math.imul(p,ue)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,o=Math.imul(B,U),n=(n=Math.imul(B,K))+Math.imul(D,U)|0,i=Math.imul(D,K),o=o+Math.imul(C,G)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(P,G)|0,i=i+Math.imul(P,H)|0,o=o+Math.imul(S,W)|0,n=(n=n+Math.imul(S,z)|0)+Math.imul(R,W)|0,i=i+Math.imul(R,z)|0,o=o+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,Q)|0,i=i+Math.imul(O,Y)|0,o=o+Math.imul(_,J)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(T,J)|0,i=i+Math.imul(T,ee)|0,o=o+Math.imul(w,re)|0,n=(n=n+Math.imul(w,oe)|0)+Math.imul($,re)|0,i=i+Math.imul($,oe)|0,o=o+Math.imul(g,ie)|0,n=(n=n+Math.imul(g,ae)|0)+Math.imul(b,ie)|0,i=i+Math.imul(b,ae)|0,o=o+Math.imul(f,ce)|0,n=(n=n+Math.imul(f,ue)|0)+Math.imul(m,ce)|0,i=i+Math.imul(m,ue)|0;var Te=(u+(o=o+Math.imul(d,de)|0)|0)+((8191&(n=(n=n+Math.imul(d,pe)|0)+Math.imul(p,de)|0))<<13)|0;u=((i=i+Math.imul(p,pe)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,o=Math.imul(L,U),n=(n=Math.imul(L,K))+Math.imul(j,U)|0,i=Math.imul(j,K),o=o+Math.imul(B,G)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(D,G)|0,i=i+Math.imul(D,H)|0,o=o+Math.imul(C,W)|0,n=(n=n+Math.imul(C,z)|0)+Math.imul(P,W)|0,i=i+Math.imul(P,z)|0,o=o+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(R,Q)|0,i=i+Math.imul(R,Y)|0,o=o+Math.imul(A,J)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(O,J)|0,i=i+Math.imul(O,ee)|0,o=o+Math.imul(_,re)|0,n=(n=n+Math.imul(_,oe)|0)+Math.imul(T,re)|0,i=i+Math.imul(T,oe)|0,o=o+Math.imul(w,ie)|0,n=(n=n+Math.imul(w,ae)|0)+Math.imul($,ie)|0,i=i+Math.imul($,ae)|0,o=o+Math.imul(g,ce)|0,n=(n=n+Math.imul(g,ue)|0)+Math.imul(b,ce)|0,i=i+Math.imul(b,ue)|0,o=o+Math.imul(f,de)|0,n=(n=n+Math.imul(f,pe)|0)+Math.imul(m,de)|0,i=i+Math.imul(m,pe)|0;var Ie=(u+(o=o+Math.imul(d,fe)|0)|0)+((8191&(n=(n=n+Math.imul(d,me)|0)+Math.imul(p,fe)|0))<<13)|0;u=((i=i+Math.imul(p,me)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,o=Math.imul(L,G),n=(n=Math.imul(L,H))+Math.imul(j,G)|0,i=Math.imul(j,H),o=o+Math.imul(B,W)|0,n=(n=n+Math.imul(B,z)|0)+Math.imul(D,W)|0,i=i+Math.imul(D,z)|0,o=o+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,Y)|0,o=o+Math.imul(S,J)|0,n=(n=n+Math.imul(S,ee)|0)+Math.imul(R,J)|0,i=i+Math.imul(R,ee)|0,o=o+Math.imul(A,re)|0,n=(n=n+Math.imul(A,oe)|0)+Math.imul(O,re)|0,i=i+Math.imul(O,oe)|0,o=o+Math.imul(_,ie)|0,n=(n=n+Math.imul(_,ae)|0)+Math.imul(T,ie)|0,i=i+Math.imul(T,ae)|0,o=o+Math.imul(w,ce)|0,n=(n=n+Math.imul(w,ue)|0)+Math.imul($,ce)|0,i=i+Math.imul($,ue)|0,o=o+Math.imul(g,de)|0,n=(n=n+Math.imul(g,pe)|0)+Math.imul(b,de)|0,i=i+Math.imul(b,pe)|0;var Ae=(u+(o=o+Math.imul(f,fe)|0)|0)+((8191&(n=(n=n+Math.imul(f,me)|0)+Math.imul(m,fe)|0))<<13)|0;u=((i=i+Math.imul(m,me)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,o=Math.imul(L,W),n=(n=Math.imul(L,z))+Math.imul(j,W)|0,i=Math.imul(j,z),o=o+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(D,Q)|0,i=i+Math.imul(D,Y)|0,o=o+Math.imul(C,J)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(P,J)|0,i=i+Math.imul(P,ee)|0,o=o+Math.imul(S,re)|0,n=(n=n+Math.imul(S,oe)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,oe)|0,o=o+Math.imul(A,ie)|0,n=(n=n+Math.imul(A,ae)|0)+Math.imul(O,ie)|0,i=i+Math.imul(O,ae)|0,o=o+Math.imul(_,ce)|0,n=(n=n+Math.imul(_,ue)|0)+Math.imul(T,ce)|0,i=i+Math.imul(T,ue)|0,o=o+Math.imul(w,de)|0,n=(n=n+Math.imul(w,pe)|0)+Math.imul($,de)|0,i=i+Math.imul($,pe)|0;var Oe=(u+(o=o+Math.imul(g,fe)|0)|0)+((8191&(n=(n=n+Math.imul(g,me)|0)+Math.imul(b,fe)|0))<<13)|0;u=((i=i+Math.imul(b,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,o=Math.imul(L,Q),n=(n=Math.imul(L,Y))+Math.imul(j,Q)|0,i=Math.imul(j,Y),o=o+Math.imul(B,J)|0,n=(n=n+Math.imul(B,ee)|0)+Math.imul(D,J)|0,i=i+Math.imul(D,ee)|0,o=o+Math.imul(C,re)|0,n=(n=n+Math.imul(C,oe)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,oe)|0,o=o+Math.imul(S,ie)|0,n=(n=n+Math.imul(S,ae)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,ae)|0,o=o+Math.imul(A,ce)|0,n=(n=n+Math.imul(A,ue)|0)+Math.imul(O,ce)|0,i=i+Math.imul(O,ue)|0,o=o+Math.imul(_,de)|0,n=(n=n+Math.imul(_,pe)|0)+Math.imul(T,de)|0,i=i+Math.imul(T,pe)|0;var Ee=(u+(o=o+Math.imul(w,fe)|0)|0)+((8191&(n=(n=n+Math.imul(w,me)|0)+Math.imul($,fe)|0))<<13)|0;u=((i=i+Math.imul($,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,o=Math.imul(L,J),n=(n=Math.imul(L,ee))+Math.imul(j,J)|0,i=Math.imul(j,ee),o=o+Math.imul(B,re)|0,n=(n=n+Math.imul(B,oe)|0)+Math.imul(D,re)|0,i=i+Math.imul(D,oe)|0,o=o+Math.imul(C,ie)|0,n=(n=n+Math.imul(C,ae)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,ae)|0,o=o+Math.imul(S,ce)|0,n=(n=n+Math.imul(S,ue)|0)+Math.imul(R,ce)|0,i=i+Math.imul(R,ue)|0,o=o+Math.imul(A,de)|0,n=(n=n+Math.imul(A,pe)|0)+Math.imul(O,de)|0,i=i+Math.imul(O,pe)|0;var Se=(u+(o=o+Math.imul(_,fe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(T,fe)|0))<<13)|0;u=((i=i+Math.imul(T,me)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,o=Math.imul(L,re),n=(n=Math.imul(L,oe))+Math.imul(j,re)|0,i=Math.imul(j,oe),o=o+Math.imul(B,ie)|0,n=(n=n+Math.imul(B,ae)|0)+Math.imul(D,ie)|0,i=i+Math.imul(D,ae)|0,o=o+Math.imul(C,ce)|0,n=(n=n+Math.imul(C,ue)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,ue)|0,o=o+Math.imul(S,de)|0,n=(n=n+Math.imul(S,pe)|0)+Math.imul(R,de)|0,i=i+Math.imul(R,pe)|0;var Re=(u+(o=o+Math.imul(A,fe)|0)|0)+((8191&(n=(n=n+Math.imul(A,me)|0)+Math.imul(O,fe)|0))<<13)|0;u=((i=i+Math.imul(O,me)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,o=Math.imul(L,ie),n=(n=Math.imul(L,ae))+Math.imul(j,ie)|0,i=Math.imul(j,ae),o=o+Math.imul(B,ce)|0,n=(n=n+Math.imul(B,ue)|0)+Math.imul(D,ce)|0,i=i+Math.imul(D,ue)|0,o=o+Math.imul(C,de)|0,n=(n=n+Math.imul(C,pe)|0)+Math.imul(P,de)|0,i=i+Math.imul(P,pe)|0;var xe=(u+(o=o+Math.imul(S,fe)|0)|0)+((8191&(n=(n=n+Math.imul(S,me)|0)+Math.imul(R,fe)|0))<<13)|0;u=((i=i+Math.imul(R,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,o=Math.imul(L,ce),n=(n=Math.imul(L,ue))+Math.imul(j,ce)|0,i=Math.imul(j,ue),o=o+Math.imul(B,de)|0,n=(n=n+Math.imul(B,pe)|0)+Math.imul(D,de)|0,i=i+Math.imul(D,pe)|0;var Ce=(u+(o=o+Math.imul(C,fe)|0)|0)+((8191&(n=(n=n+Math.imul(C,me)|0)+Math.imul(P,fe)|0))<<13)|0;u=((i=i+Math.imul(P,me)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,o=Math.imul(L,de),n=(n=Math.imul(L,pe))+Math.imul(j,de)|0,i=Math.imul(j,pe);var Pe=(u+(o=o+Math.imul(B,fe)|0)|0)+((8191&(n=(n=n+Math.imul(B,me)|0)+Math.imul(D,fe)|0))<<13)|0;u=((i=i+Math.imul(D,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Ne=(u+(o=Math.imul(L,fe))|0)+((8191&(n=(n=Math.imul(L,me))+Math.imul(j,fe)|0))<<13)|0;return u=((i=Math.imul(j,me))+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=ye,c[1]=ge,c[2]=be,c[3]=ve,c[4]=we,c[5]=$e,c[6]=ke,c[7]=_e,c[8]=Te,c[9]=Ie,c[10]=Ae,c[11]=Oe,c[12]=Ee,c[13]=Se,c[14]=Re,c[15]=xe,c[16]=Ce,c[17]=Pe,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function f(e,t,r){return(new m).mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(h=p),n.prototype.mulTo=function(e,t){var r,o=this.length+e.length;return r=10===this.length&&10===e.length?h(this,e,t):o<63?p(this,e,t):o<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var o=0,n=0,i=0;i<r.length-1;i++){var a=n;n=0;for(var s=67108863&o,c=Math.min(i,t.length-1),u=Math.max(0,i-e.length+1);u<=c;u++){var l=i-u,d=(0|e.words[l])*(0|t.words[u]),p=67108863&d;s=67108863&(p=p+s|0),n+=(a=(a=a+(d/67108864|0)|0)+(p>>>26)|0)>>>26,a&=67108863}r.words[i]=s,o=a,a=n}return 0!==o?r.words[i]=o:r.length--,r.strip()}(this,e,t):f(this,e,t),r},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=n.prototype._countBits(e)-1,o=0;o<e;o++)t[o]=this.revBin(o,r,e);return t},m.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var o=0,n=0;n<t;n++)o|=(1&e)<<t-n-1,e>>=1;return o},m.prototype.permute=function(e,t,r,o,n,i){for(var a=0;a<i;a++)o[a]=t[e[a]],n[a]=r[e[a]]},m.prototype.transform=function(e,t,r,o,n,i){this.permute(i,e,t,r,o,n);for(var a=1;a<n;a<<=1)for(var s=a<<1,c=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),l=0;l<n;l+=s)for(var d=c,p=u,h=0;h<a;h++){var f=r[l+h],m=o[l+h],y=r[l+h+a],g=o[l+h+a],b=d*y-p*g;g=d*g+p*y,y=b,r[l+h]=f+y,o[l+h]=m+g,r[l+h+a]=f-y,o[l+h+a]=m-g,h!==s&&(b=c*d-u*p,p=c*p+u*d,d=b)}},m.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),o=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+o},m.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var o=0;o<r/2;o++){var n=e[o];e[o]=e[r-o-1],e[r-o-1]=n,n=t[o],t[o]=-t[r-o-1],t[r-o-1]=-n}},m.prototype.normalize13b=function(e,t){for(var r=0,o=0;o<t/2;o++){var n=8192*Math.round(e[2*o+1]/t)+Math.round(e[2*o]/t)+r;e[o]=67108863&n,r=n<67108864?0:n/67108864|0}return e},m.prototype.convert13b=function(e,t,o,n){for(var i=0,a=0;a<t;a++)i+=0|e[a],o[2*a]=8191&i,i>>>=13,o[2*a+1]=8191&i,i>>>=13;for(a=2*t;a<n;++a)o[a]=0;r(0===i),r(!(-8192&i))},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 o=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(o),i=this.stub(o),a=new Array(o),s=new Array(o),c=new Array(o),u=new Array(o),l=new Array(o),d=new Array(o),p=r.words;p.length=o,this.convert13b(e.words,e.length,a,o),this.convert13b(t.words,t.length,u,o),this.transform(a,i,s,c,o,n),this.transform(u,i,l,d,o,n);for(var h=0;h<o;h++){var f=s[h]*l[h]-c[h]*d[h];c[h]=s[h]*d[h]+c[h]*l[h],s[h]=f}return this.conjugate(s,c,o),this.transform(s,c,p,i,o,n),this.conjugate(p,i,o),this.normalize13b(p,o),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},n.prototype.mul=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},n.prototype.mulf=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),f(this,e,t)},n.prototype.imul=function(e){return this.clone().mulTo(e,this)},n.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,o=0;o<this.length;o++){var n=(0|this.words[o])*e,i=(67108863&n)+(67108863&t);t>>=26,t+=n/67108864|0,t+=i>>>26,this.words[o]=67108863&i}return 0!==t&&(this.words[o]=t,this.length++),this},n.prototype.muln=function(e){return this.clone().imuln(e)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var o=r/26|0,n=r%26;t[r]=(e.words[o]&1<<n)>>>n}return t}(e);if(0===t.length)return new n(1);for(var r=this,o=0;o<t.length&&0===t[o];o++,r=r.sqr());if(++o<t.length)for(var i=r.sqr();o<t.length;o++,i=i.sqr())0!==t[o]&&(r=r.mul(i));return r},n.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,o=e%26,n=(e-o)/26,i=67108863>>>26-o<<26-o;if(0!==o){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&i,c=(0|this.words[t])-s<<o;this.words[t]=c|a,a=s>>>26-o}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()},n.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},n.prototype.iushrn=function(e,t,o){var n;r("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var i=e%26,a=Math.min((e-i)/26,this.length),s=67108863^67108863>>>i<<i,c=o;if(n-=a,n=Math.max(0,n),c){for(var u=0;u<a;u++)c.words[u]=this.words[u];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var d=0|this.words[u];this.words[u]=l<<26-i|d>>>i,l=d&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(e,t,o){return r(0===this.negative),this.iushrn(e,t,o)},n.prototype.shln=function(e){return this.clone().ishln(e)},n.prototype.ushln=function(e){return this.clone().iushln(e)},n.prototype.shrn=function(e){return this.clone().ishrn(e)},n.prototype.ushrn=function(e){return this.clone().iushrn(e)},n.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26,n=1<<t;return!(this.length<=o)&&!!(this.words[o]&n)},n.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=o)return this;if(0!==t&&o++,this.length=Math.min(o,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(e){return this.clone().imaskn(e)},n.prototype.iaddn=function(e){return r("number"==typeof e),r(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)},n.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},n.prototype.isubn=function(e){if(r("number"==typeof e),r(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()},n.prototype.addn=function(e){return this.clone().iaddn(e)},n.prototype.subn=function(e){return this.clone().isubn(e)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(e,t,o){var n,i,a=e.length+o;this._expand(a);var s=0;for(n=0;n<e.length;n++){i=(0|this.words[n+o])+s;var c=(0|e.words[n])*t;s=((i-=67108863&c)>>26)-(c/67108864|0),this.words[n+o]=67108863&i}for(;n<this.length-o;n++)s=(i=(0|this.words[n+o])+s)>>26,this.words[n+o]=67108863&i;if(0===s)return this.strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(i=-(0|this.words[n])+s)>>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},n.prototype._wordDiv=function(e,t){var r=(this.length,e.length),o=this.clone(),i=e,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),o.iushln(r),a=0|i.words[i.length-1]);var s,c=o.length-i.length;if("mod"!==t){(s=new n(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=o.clone()._ishlnsubmul(i,1,c);0===l.negative&&(o=l,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var p=67108864*(0|o.words[i.length+d])+(0|o.words[i.length+d-1]);for(p=Math.min(p/a|0,67108863),o._ishlnsubmul(i,p,d);0!==o.negative;)p--,o.negative=0,o._ishlnsubmul(i,1,d),o.isZero()||(o.negative^=1);s&&(s.words[d]=p)}return s&&s.strip(),o.strip(),"div"!==t&&0!==r&&o.iushrn(r),{div:s||null,mod:o}},n.prototype.divmod=function(e,t,o){return r(!e.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new n(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new n(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new n(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},n.prototype.div=function(e){return this.divmod(e,"div",!1).div},n.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},n.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},n.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,o=e.ushrn(1),n=e.andln(1),i=r.cmp(o);return i<0||1===n&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},n.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,o=0,n=this.length-1;n>=0;n--)o=(t*o+(0|this.words[n]))%e;return o},n.prototype.idivn=function(e){r(e<=67108863);for(var t=0,o=this.length-1;o>=0;o--){var n=(0|this.words[o])+67108864*t;this.words[o]=n/e|0,t=n%e}return this.strip()},n.prototype.divn=function(e){return this.clone().idivn(e)},n.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new n(1),a=new n(0),s=new n(0),c=new n(1),u=0;t.isEven()&&o.isEven();)t.iushrn(1),o.iushrn(1),++u;for(var l=o.clone(),d=t.clone();!t.isZero();){for(var p=0,h=1;!(t.words[0]&h)&&p<26;++p,h<<=1);if(p>0)for(t.iushrn(p);p-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var f=0,m=1;!(o.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(o.iushrn(f);f-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(o)>=0?(t.isub(o),i.isub(s),a.isub(c)):(o.isub(t),s.isub(i),c.isub(a))}return{a:s,b:c,gcd:o.iushln(u)}},n.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new n(1),s=new n(0),c=o.clone();t.cmpn(1)>0&&o.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,p=1;!(o.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(o.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(o)>=0?(t.isub(o),a.isub(s)):(o.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},n.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 o=0;t.isEven()&&r.isEven();o++)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 i=t;t=r,r=i}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(o)},n.prototype.invm=function(e){return this.egcd(e).a.umod(e)},n.prototype.isEven=function(){return!(1&this.words[0])},n.prototype.isOdd=function(){return!(1&~this.words[0])},n.prototype.andln=function(e){return this.words[0]&e},n.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,o=(e-t)/26,n=1<<t;if(this.length<=o)return this._expand(o+1),this.words[o]|=n,this;for(var i=n,a=o;0!==i&&a<this.length;a++){var s=0|this.words[a];i=(s+=i)>>>26,s&=67108863,this.words[a]=s}return 0!==i&&(this.words[a]=i,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(e){var t,o=e<0;if(0!==this.negative&&!o)return-1;if(0===this.negative&&o)return 1;if(this.strip(),this.length>1)t=1;else{o&&(e=-e),r(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},n.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},n.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 o=0|this.words[r],n=0|e.words[r];if(o!==n){o<n?t=-1:o>n&&(t=1);break}}return t},n.prototype.gtn=function(e){return 1===this.cmpn(e)},n.prototype.gt=function(e){return 1===this.cmp(e)},n.prototype.gten=function(e){return this.cmpn(e)>=0},n.prototype.gte=function(e){return this.cmp(e)>=0},n.prototype.ltn=function(e){return-1===this.cmpn(e)},n.prototype.lt=function(e){return-1===this.cmp(e)},n.prototype.lten=function(e){return this.cmpn(e)<=0},n.prototype.lte=function(e){return this.cmp(e)<=0},n.prototype.eqn=function(e){return 0===this.cmpn(e)},n.prototype.eq=function(e){return 0===this.cmp(e)},n.red=function(e){return new k(e)},n.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(e){return this.red=e,this},n.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},n.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},n.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},n.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},n.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},n.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},n.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},n.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function g(e,t){this.name=e,this.p=new n(t,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function $(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(e){if("string"==typeof e){var t=n._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function _(e){k.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}g.prototype._tmp=function(){var e=new n(null);return e.words=new Array(Math.ceil(this.n/13)),e},g.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 o=t<this.n?-1:r.ucmp(this.p);return 0===o?(r.words[0]=0,r.length=1):o>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(e,t){e.iushrn(this.n,0,t)},g.prototype.imulK=function(e){return e.imul(this.k)},o(b,g),b.prototype.split=function(e,t){for(var r=4194303,o=Math.min(e.length,9),n=0;n<o;n++)t.words[n]=e.words[n];if(t.length=o,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=i&r,n=10;n<e.length;n++){var a=0|e.words[n];e.words[n-10]=(a&r)<<4|i>>>22,i=a}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},b.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 o=0|e.words[r];t+=977*o,e.words[r]=67108863&t,t=64*o+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},o(v,g),o(w,g),o($,g),$.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var o=19*(0|e.words[r])+t,n=67108863&o;o>>>=26,e.words[r]=n,t=o}return 0!==t&&(e.words[e.length++]=t),e},n._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new $}return y[e]=t,t},k.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},k.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},k.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},k.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},k.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},k.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},k.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},k.prototype.isqr=function(e){return this.imul(e,e.clone())},k.prototype.sqr=function(e){return this.mul(e,e)},k.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var o=this.m.add(new n(1)).iushrn(2);return this.pow(e,o)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new n(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),p=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),f=a;0!==h.cmp(s);){for(var m=h,y=0;0!==m.cmp(s);y++)m=m.redSqr();r(y<f);var g=this.pow(d,new n(1).iushln(f-y-1));p=p.redMul(g),d=g.redSqr(),h=h.redMul(d),f=y}return p},k.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},k.prototype.pow=function(e,t){if(t.isZero())return new n(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=e;for(var o=2;o<r.length;o++)r[o]=this.mul(r[o-1],e);var i=r[0],a=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),o=t.length-1;o>=0;o--){for(var u=t.words[o],l=c-1;l>=0;l--){var d=u>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4===++s||0===o&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}c=26}return i},k.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},k.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},n.mont=function(e){return new _(e)},o(_,k),_.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},_.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},_.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(o).iushrn(this.shift),i=n;return n.cmp(this.m)>=0?i=n.isub(this.m):n.cmpn(0)<0&&(i=n.iadd(this.m)),i._forceRed(this)},_.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new n(0)._forceRed(this);var r=e.mul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(o).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},_.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,commonjsGlobal)}(bn$3);var bnExports=bn$3.exports,utils$n={};!function(e){var t=e;function r(e){return 1===e.length?"0"+e:e}function o(e){for(var t="",o=0;o<e.length;o++)t+=r(e[o].toString(16));return t}t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var o=0;o<e.length;o++)r[o]=0|e[o];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(o=0;o<e.length;o+=2)r.push(parseInt(e[o]+e[o+1],16))}else for(o=0;o<e.length;o++){var n=e.charCodeAt(o),i=n>>8,a=255&n;i?r.push(i,a):r.push(a)}return r},t.zero2=r,t.toHex=o,t.encode=function(e,t){return"hex"===t?o(e):e}}(utils$n),function(e){var t=e,r=bnExports,o=minimalisticAssert,n=utils$n;t.assert=o,t.toArray=n.toArray,t.zero2=n.zero2,t.toHex=n.toHex,t.encode=n.encode,t.getNAF=function(e,t,r){var o,n=new Array(Math.max(e.bitLength(),r)+1);for(o=0;o<n.length;o+=1)n[o]=0;var i=1<<t+1,a=e.clone();for(o=0;o<n.length;o++){var s,c=a.andln(i-1);a.isOdd()?(s=c>(i>>1)-1?(i>>1)-c:c,a.isubn(s)):s=0,n[o]=s,a.iushrn(1)}return n},t.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var o,n=0,i=0;e.cmpn(-n)>0||t.cmpn(-i)>0;){var a,s,c=e.andln(3)+n&3,u=t.andln(3)+i&3;3===c&&(c=-1),3===u&&(u=-1),a=1&c?3!==(o=e.andln(7)+n&7)&&5!==o||2!==u?c:-c:0,r[0].push(a),s=1&u?3!==(o=t.andln(7)+i&7)&&5!==o||2!==c?u:-u:0,r[1].push(s),2*n===a+1&&(n=1-n),2*i===s+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return r},t.cachedProperty=function(e,t,r){var o="_"+t;e.prototype[t]=function(){return void 0!==this[o]?this[o]:this[o]=r.call(this)}},t.parseBytes=function(e){return"string"==typeof e?t.toArray(e,"hex"):e},t.intFromLE=function(e){return new r(e,"hex","le")}}(utils$o);var curve={},BN$7=bnExports,utils$m=utils$o,getNAF=utils$m.getNAF,getJSF=utils$m.getJSF,assert$e=utils$m.assert;function BaseCurve(e,t){this.type=e,this.p=new BN$7(t.p,16),this.red=t.prime?BN$7.red(t.prime):BN$7.mont(this.p),this.zero=new BN$7(0).toRed(this.red),this.one=new BN$7(1).toRed(this.red),this.two=new BN$7(2).toRed(this.red),this.n=t.n&&new BN$7(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))}var base$1=BaseCurve;function BasePoint(e,t){this.curve=e,this.type=t,this.precomputed=null}BaseCurve.prototype.point=function(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function(e,t){assert$e(e.precomputed);var r=e._getDoubles(),o=getNAF(t,1,this._bitLength),n=(1<<r.step+1)-(r.step%2==0?2:1);n/=3;var i,a,s=[];for(i=0;i<o.length;i+=r.step){a=0;for(var c=i+r.step-1;c>=i;c--)a=(a<<1)+o[c];s.push(a)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=n;d>0;d--){for(i=0;i<s.length;i++)(a=s[i])===d?l=l.mixedAdd(r.points[i]):a===-d&&(l=l.mixedAdd(r.points[i].neg()));u=u.add(l)}return u.toP()},BaseCurve.prototype._wnafMul=function(e,t){var r=4,o=e._getNAFPoints(r);r=o.wnd;for(var n=o.points,i=getNAF(t,r,this._bitLength),a=this.jpoint(null,null,null),s=i.length-1;s>=0;s--){for(var c=0;s>=0&&0===i[s];s--)c++;if(s>=0&&c++,a=a.dblp(c),s<0)break;var u=i[s];assert$e(0!==u),a="affine"===e.type?u>0?a.mixedAdd(n[u-1>>1]):a.mixedAdd(n[-u-1>>1].neg()):u>0?a.add(n[u-1>>1]):a.add(n[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},BaseCurve.prototype._wnafMulAdd=function(e,t,r,o,n){var i,a,s,c=this._wnafT1,u=this._wnafT2,l=this._wnafT3,d=0;for(i=0;i<o;i++){var p=(s=t[i])._getNAFPoints(e);c[i]=p.wnd,u[i]=p.points}for(i=o-1;i>=1;i-=2){var h=i-1,f=i;if(1===c[h]&&1===c[f]){var m=[t[h],null,null,t[f]];0===t[h].y.cmp(t[f].y)?(m[1]=t[h].add(t[f]),m[2]=t[h].toJ().mixedAdd(t[f].neg())):0===t[h].y.cmp(t[f].y.redNeg())?(m[1]=t[h].toJ().mixedAdd(t[f]),m[2]=t[h].add(t[f].neg())):(m[1]=t[h].toJ().mixedAdd(t[f]),m[2]=t[h].toJ().mixedAdd(t[f].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],g=getJSF(r[h],r[f]);for(d=Math.max(g[0].length,d),l[h]=new Array(d),l[f]=new Array(d),a=0;a<d;a++){var b=0|g[0][a],v=0|g[1][a];l[h][a]=y[3*(b+1)+(v+1)],l[f][a]=0,u[h]=m}}else l[h]=getNAF(r[h],c[h],this._bitLength),l[f]=getNAF(r[f],c[f],this._bitLength),d=Math.max(l[h].length,d),d=Math.max(l[f].length,d)}var w=this.jpoint(null,null,null),$=this._wnafT4;for(i=d;i>=0;i--){for(var k=0;i>=0;){var _=!0;for(a=0;a<o;a++)$[a]=0|l[a][i],0!==$[a]&&(_=!1);if(!_)break;k++,i--}if(i>=0&&k++,w=w.dblp(k),i<0)break;for(a=0;a<o;a++){var T=$[a];0!==T&&(T>0?s=u[a][T-1>>1]:T<0&&(s=u[a][-T-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(i=0;i<o;i++)u[i]=null;return n?w:w.toP()},BaseCurve.BasePoint=BasePoint,BasePoint.prototype.eq=function(){throw new Error("Not implemented")},BasePoint.prototype.validate=function(){return this.curve.validate(this)},BaseCurve.prototype.decodePoint=function(e,t){e=utils$m.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]?assert$e(e[e.length-1]%2==0):7===e[0]&&assert$e(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")},BasePoint.prototype.encodeCompressed=function(e){return this.encode(e,!0)},BasePoint.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))},BasePoint.prototype.encode=function(e,t){return utils$m.encode(this._encode(t),e)},BasePoint.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},BasePoint.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)},BasePoint.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],o=this,n=0;n<t;n+=e){for(var i=0;i<e;i++)o=o.dbl();r.push(o)}return{step:e,points:r}},BasePoint.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,o=1===r?null:this.dbl(),n=1;n<r;n++)t[n]=t[n-1].add(o);return{wnd:e,points:t}},BasePoint.prototype._getBeta=function(){return null},BasePoint.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var utils$l=utils$o,BN$6=bnExports,inherits$5=inherits_browserExports,Base$2=base$1,assert$d=utils$l.assert;function ShortCurve(e){Base$2.call(this,"short",e),this.a=new BN$6(e.a,16).toRed(this.red),this.b=new BN$6(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)}inherits$5(ShortCurve,Base$2);var short=ShortCurve;function Point$2(e,t,r,o){Base$2.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new BN$6(t,16),this.y=new BN$6(r,16),o&&(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 JPoint(e,t,r,o){Base$2.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===o?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN$6(0)):(this.x=new BN$6(t,16),this.y=new BN$6(r,16),this.z=new BN$6(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.zOne=this.z===this.curve.one}ShortCurve.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new BN$6(e.beta,16).toRed(this.red);else{var o=this._getEndoRoots(this.p);t=(t=o[0].cmp(o[1])<0?o[0]:o[1]).toRed(this.red)}if(e.lambda)r=new BN$6(e.lambda,16);else{var n=this._getEndoRoots(this.n);0===this.g.mul(n[0]).x.cmp(this.g.x.redMul(t))?r=n[0]:(r=n[1],assert$d(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 BN$6(e.a,16),b:new BN$6(e.b,16)}})):this._getEndoBasis(r)}}},ShortCurve.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:BN$6.mont(e),r=new BN$6(2).toRed(t).redInvm(),o=r.redNeg(),n=new BN$6(3).toRed(t).redNeg().redSqrt().redMul(r);return[o.redAdd(n).fromRed(),o.redSub(n).fromRed()]},ShortCurve.prototype._getEndoBasis=function(e){for(var t,r,o,n,i,a,s,c,u,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,p=this.n.clone(),h=new BN$6(1),f=new BN$6(0),m=new BN$6(0),y=new BN$6(1),g=0;0!==d.cmpn(0);){var b=p.div(d);c=p.sub(b.mul(d)),u=m.sub(b.mul(h));var v=y.sub(b.mul(f));if(!o&&c.cmp(l)<0)t=s.neg(),r=h,o=c.neg(),n=u;else if(o&&2==++g)break;s=c,p=d,d=c,m=h,h=u,y=f,f=v}i=c.neg(),a=u;var w=o.sqr().add(n.sqr());return i.sqr().add(a.sqr()).cmp(w)>=0&&(i=t,a=r),o.negative&&(o=o.neg(),n=n.neg()),i.negative&&(i=i.neg(),a=a.neg()),[{a:o,b:n},{a:i,b:a}]},ShortCurve.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],o=t[1],n=o.b.mul(e).divRound(this.n),i=r.b.neg().mul(e).divRound(this.n),a=n.mul(r.a),s=i.mul(o.a),c=n.mul(r.b),u=i.mul(o.b);return{k1:e.sub(a).sub(s),k2:c.add(u).neg()}},ShortCurve.prototype.pointFromX=function(e,t){(e=new BN$6(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),o=r.redSqrt();if(0!==o.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var n=o.fromRed().isOdd();return(t&&!n||!t&&n)&&(o=o.redNeg()),this.point(e,o)},ShortCurve.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,o=this.a.redMul(t),n=t.redSqr().redMul(t).redIAdd(o).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},ShortCurve.prototype._endoWnafMulAdd=function(e,t,r){for(var o=this._endoWnafT1,n=this._endoWnafT2,i=0;i<e.length;i++){var a=this._endoSplit(t[i]),s=e[i],c=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),c=c.neg(!0)),o[2*i]=s,o[2*i+1]=c,n[2*i]=a.k1,n[2*i+1]=a.k2}for(var u=this._wnafMulAdd(1,o,n,2*i,r),l=0;l<2*i;l++)o[l]=null,n[l]=null;return u},inherits$5(Point$2,Base$2.BasePoint),ShortCurve.prototype.point=function(e,t,r){return new Point$2(this,e,t,r)},ShortCurve.prototype.pointFromJSON=function(e,t){return Point$2.fromJSON(this,e,t)},Point$2.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,o=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(o)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(o)}}}return t}},Point$2.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]},Point$2.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var o=e.point(t[0],t[1],r);if(!t[2])return o;function n(t){return e.point(t[0],t[1],r)}var i=t[2];return o.precomputed={beta:null,doubles:i.doubles&&{step:i.doubles.step,points:[o].concat(i.doubles.points.map(n))},naf:i.naf&&{wnd:i.naf.wnd,points:[o].concat(i.naf.points.map(n))}},o},Point$2.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)+">"},Point$2.prototype.isInfinity=function(){return this.inf},Point$2.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),o=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,o)},Point$2.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(),o=e.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(o),i=n.redSqr().redISub(this.x.redAdd(this.x)),a=n.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,a)},Point$2.prototype.getX=function(){return this.x.fromRed()},Point$2.prototype.getY=function(){return this.y.fromRed()},Point$2.prototype.mul=function(e){return e=new BN$6(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)},Point$2.prototype.mulAdd=function(e,t,r){var o=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(o,n):this.curve._wnafMulAdd(1,o,n,2)},Point$2.prototype.jmulAdd=function(e,t,r){var o=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(o,n,!0):this.curve._wnafMulAdd(1,o,n,2,!0)},Point$2.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))},Point$2.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,o=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(o)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(o)}}}return t},Point$2.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},inherits$5(JPoint,Base$2.BasePoint),ShortCurve.prototype.jpoint=function(e,t,r){return new JPoint(this,e,t,r)},JPoint.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),o=this.y.redMul(t).redMul(e);return this.curve.point(r,o)},JPoint.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},JPoint.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),o=this.x.redMul(t),n=e.x.redMul(r),i=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=o.redSub(n),c=i.redSub(a);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),d=o.redMul(u),p=c.redSqr().redIAdd(l).redISub(d).redISub(d),h=c.redMul(d.redISub(p)).redISub(i.redMul(l)),f=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(p,h,f)},JPoint.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,o=e.x.redMul(t),n=this.y,i=e.y.redMul(t).redMul(this.z),a=r.redSub(o),s=n.redSub(i);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),l=r.redMul(c),d=s.redSqr().redIAdd(u).redISub(l).redISub(l),p=s.redMul(l.redISub(d)).redISub(n.redMul(u)),h=this.z.redMul(a);return this.curve.jpoint(d,p,h)},JPoint.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 o=this.curve.a,n=this.curve.tinv,i=this.x,a=this.y,s=this.z,c=s.redSqr().redSqr(),u=a.redAdd(a);for(t=0;t<e;t++){var l=i.redSqr(),d=u.redSqr(),p=d.redSqr(),h=l.redAdd(l).redIAdd(l).redIAdd(o.redMul(c)),f=i.redMul(d),m=h.redSqr().redISub(f.redAdd(f)),y=f.redISub(m),g=h.redMul(y);g=g.redIAdd(g).redISub(p);var b=u.redMul(s);t+1<e&&(c=c.redMul(p)),i=m,s=b,u=g}return this.curve.jpoint(i,u.redMul(n),s)},JPoint.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},JPoint.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var o=this.x.redSqr(),n=this.y.redSqr(),i=n.redSqr(),a=this.x.redAdd(n).redSqr().redISub(o).redISub(i);a=a.redIAdd(a);var s=o.redAdd(o).redIAdd(o),c=s.redSqr().redISub(a).redISub(a),u=i.redIAdd(i);u=(u=u.redIAdd(u)).redIAdd(u),e=c,t=s.redMul(a.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),d=this.y.redSqr(),p=d.redSqr(),h=this.x.redAdd(d).redSqr().redISub(l).redISub(p);h=h.redIAdd(h);var f=l.redAdd(l).redIAdd(l),m=f.redSqr(),y=p.redIAdd(p);y=(y=y.redIAdd(y)).redIAdd(y),e=m.redISub(h).redISub(h),t=f.redMul(h.redISub(e)).redISub(y),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},JPoint.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var o=this.x.redSqr(),n=this.y.redSqr(),i=n.redSqr(),a=this.x.redAdd(n).redSqr().redISub(o).redISub(i);a=a.redIAdd(a);var s=o.redAdd(o).redIAdd(o).redIAdd(this.curve.a),c=s.redSqr().redISub(a).redISub(a);e=c;var u=i.redIAdd(i);u=(u=u.redIAdd(u)).redIAdd(u),t=s.redMul(a.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),d=this.y.redSqr(),p=this.x.redMul(d),h=this.x.redSub(l).redMul(this.x.redAdd(l));h=h.redAdd(h).redIAdd(h);var f=p.redIAdd(p),m=(f=f.redIAdd(f)).redAdd(f);e=h.redSqr().redISub(m),r=this.y.redAdd(this.z).redSqr().redISub(d).redISub(l);var y=d.redSqr();y=(y=(y=y.redIAdd(y)).redIAdd(y)).redIAdd(y),t=h.redMul(f.redISub(e)).redISub(y)}return this.curve.jpoint(e,t,r)},JPoint.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,o=this.z,n=o.redSqr().redSqr(),i=t.redSqr(),a=r.redSqr(),s=i.redAdd(i).redIAdd(i).redIAdd(e.redMul(n)),c=t.redAdd(t),u=(c=c.redIAdd(c)).redMul(a),l=s.redSqr().redISub(u.redAdd(u)),d=u.redISub(l),p=a.redSqr();p=(p=(p=p.redIAdd(p)).redIAdd(p)).redIAdd(p);var h=s.redMul(d).redISub(p),f=r.redAdd(r).redMul(o);return this.curve.jpoint(l,h,f)},JPoint.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(),o=t.redSqr(),n=e.redAdd(e).redIAdd(e),i=n.redSqr(),a=this.x.redAdd(t).redSqr().redISub(e).redISub(o),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(i)).redSqr(),c=o.redIAdd(o);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var u=n.redIAdd(a).redSqr().redISub(i).redISub(s).redISub(c),l=t.redMul(u);l=(l=l.redIAdd(l)).redIAdd(l);var d=this.x.redMul(s).redISub(l);d=(d=d.redIAdd(d)).redIAdd(d);var p=this.y.redMul(u.redMul(c.redISub(u)).redISub(a.redMul(s)));p=(p=(p=p.redIAdd(p)).redIAdd(p)).redIAdd(p);var h=this.z.redAdd(a).redSqr().redISub(r).redISub(s);return this.curve.jpoint(d,p,h)},JPoint.prototype.mul=function(e,t){return e=new BN$6(e,t),this.curve._wnafMul(this,e)},JPoint.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 o=t.redMul(this.z),n=r.redMul(e.z);return 0===this.y.redMul(n).redISub(e.y.redMul(o)).cmpn(0)},JPoint.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 o=e.clone(),n=this.curve.redN.redMul(t);;){if(o.iadd(this.curve.n),o.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},JPoint.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)+">"},JPoint.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var BN$5=bnExports,inherits$4=inherits_browserExports,Base$1=base$1,utils$k=utils$o;function MontCurve(e){Base$1.call(this,"mont",e),this.a=new BN$5(e.a,16).toRed(this.red),this.b=new BN$5(e.b,16).toRed(this.red),this.i4=new BN$5(4).toRed(this.red).redInvm(),this.two=new BN$5(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}inherits$4(MontCurve,Base$1);var mont=MontCurve;function Point$1(e,t,r){Base$1.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new BN$5(t,16),this.z=new BN$5(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}MontCurve.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),o=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===o.redSqrt().redSqr().cmp(o)},inherits$4(Point$1,Base$1.BasePoint),MontCurve.prototype.decodePoint=function(e,t){return this.point(utils$k.toArray(e,t),1)},MontCurve.prototype.point=function(e,t){return new Point$1(this,e,t)},MontCurve.prototype.pointFromJSON=function(e){return Point$1.fromJSON(this,e)},Point$1.prototype.precompute=function(){},Point$1.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Point$1.fromJSON=function(e,t){return new Point$1(e,t[0],t[1]||e.one)},Point$1.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)+">"},Point$1.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},Point$1.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),o=e.redMul(t),n=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(o,n)},Point$1.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Point$1.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),o=this.x.redSub(this.z),n=e.x.redAdd(e.z),i=e.x.redSub(e.z).redMul(r),a=n.redMul(o),s=t.z.redMul(i.redAdd(a).redSqr()),c=t.x.redMul(i.redISub(a).redSqr());return this.curve.point(s,c)},Point$1.prototype.mul=function(e){for(var t=e.clone(),r=this,o=this.curve.point(null,null),n=[];0!==t.cmpn(0);t.iushrn(1))n.push(t.andln(1));for(var i=n.length-1;i>=0;i--)0===n[i]?(r=r.diffAdd(o,this),o=o.dbl()):(o=r.diffAdd(o,this),r=r.dbl());return o},Point$1.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Point$1.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Point$1.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},Point$1.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Point$1.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var utils$j=utils$o,BN$4=bnExports,inherits$3=inherits_browserExports,Base=base$1,assert$c=utils$j.assert;function EdwardsCurve(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,Base.call(this,"edwards",e),this.a=new BN$4(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new BN$4(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new BN$4(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),assert$c(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}inherits$3(EdwardsCurve,Base);var edwards=EdwardsCurve;function Point(e,t,r,o,n){Base.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===o?(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 BN$4(t,16),this.y=new BN$4(r,16),this.z=o?new BN$4(o,16):this.curve.one,this.t=n&&new BN$4(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.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()))))}EdwardsCurve.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},EdwardsCurve.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},EdwardsCurve.prototype.jpoint=function(e,t,r,o){return this.point(e,t,r,o)},EdwardsCurve.prototype.pointFromX=function(e,t){(e=new BN$4(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),o=this.c2.redSub(this.a.redMul(r)),n=this.one.redSub(this.c2.redMul(this.d).redMul(r)),i=o.redMul(n.redInvm()),a=i.redSqrt();if(0!==a.redSqr().redSub(i).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(t&&!s||!t&&s)&&(a=a.redNeg()),this.point(e,a)},EdwardsCurve.prototype.pointFromY=function(e,t){(e=new BN$4(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),o=r.redSub(this.c2),n=r.redMul(this.d).redMul(this.c2).redSub(this.a),i=o.redMul(n.redInvm());if(0===i.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=i.redSqrt();if(0!==a.redSqr().redSub(i).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},EdwardsCurve.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),o=t.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===o.cmp(n)},inherits$3(Point,Base.BasePoint),EdwardsCurve.prototype.pointFromJSON=function(e){return Point.fromJSON(this,e)},EdwardsCurve.prototype.point=function(e,t,r,o){return new Point(this,e,t,r,o)},Point.fromJSON=function(e,t){return new Point(e,t[0],t[1],t[2])},Point.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)+">"},Point.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},Point.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var o=this.curve._mulA(e),n=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),i=o.redAdd(t),a=i.redSub(r),s=o.redSub(t),c=n.redMul(a),u=i.redMul(s),l=n.redMul(s),d=a.redMul(i);return this.curve.point(c,u,d,l)},Point.prototype._projDbl=function(){var e,t,r,o,n,i,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(o=this.curve._mulA(s)).redAdd(c);this.zOne?(e=a.redSub(s).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(o.redSub(c)),r=u.redSqr().redSub(u).redSub(u)):(n=this.z.redSqr(),i=u.redSub(n).redISub(n),e=a.redSub(s).redISub(c).redMul(i),t=u.redMul(o.redSub(c)),r=u.redMul(i))}else o=s.redAdd(c),n=this.curve._mulC(this.z).redSqr(),i=o.redSub(n).redSub(n),e=this.curve._mulC(a.redISub(o)).redMul(i),t=this.curve._mulC(o).redMul(s.redISub(c)),r=o.redMul(i);return this.curve.point(e,t,r)},Point.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Point.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)),o=this.t.redMul(this.curve.dd).redMul(e.t),n=this.z.redMul(e.z.redAdd(e.z)),i=r.redSub(t),a=n.redSub(o),s=n.redAdd(o),c=r.redAdd(t),u=i.redMul(a),l=s.redMul(c),d=i.redMul(c),p=a.redMul(s);return this.curve.point(u,l,p,d)},Point.prototype._projAdd=function(e){var t,r,o=this.z.redMul(e.z),n=o.redSqr(),i=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(i).redMul(a),c=n.redSub(s),u=n.redAdd(s),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(a),d=o.redMul(c).redMul(l);return this.curve.twisted?(t=o.redMul(u).redMul(a.redSub(this.curve._mulA(i))),r=c.redMul(u)):(t=o.redMul(u).redMul(a.redSub(i)),r=this.curve._mulC(c).redMul(u)),this.curve.point(d,t,r)},Point.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Point.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Point.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},Point.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},Point.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},Point.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Point.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Point.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Point.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},Point.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(),o=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(o),0===this.x.cmp(t))return!0}},Point.prototype.toP=Point.prototype.normalize,Point.prototype.mixedAdd=Point.prototype.add,function(e){var t=e;t.base=base$1,t.short=short,t.mont=mont,t.edwards=edwards}(curve);var curves$1={},hash$3={},utils$i={},assert$b=minimalisticAssert,inherits$2=inherits_browserExports;function isSurrogatePair(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function toArray$2(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 o=0,n=0;n<e.length;n++){var i=e.charCodeAt(n);i<128?r[o++]=i:i<2048?(r[o++]=i>>6|192,r[o++]=63&i|128):isSurrogatePair(e,n)?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n)),r[o++]=i>>18|240,r[o++]=i>>12&63|128,r[o++]=i>>6&63|128,r[o++]=63&i|128):(r[o++]=i>>12|224,r[o++]=i>>6&63|128,r[o++]=63&i|128)}else for(n=0;n<e.length;n++)r[n]=0|e[n];return r}function toHex$1(e){for(var t="",r=0;r<e.length;r++)t+=zero2(e[r].toString(16));return t}function htonl(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function toHex32(e,t){for(var r="",o=0;o<e.length;o++){var n=e[o];"little"===t&&(n=htonl(n)),r+=zero8(n.toString(16))}return r}function zero2(e){return 1===e.length?"0"+e:e}function zero8(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}function join32(e,t,r,o){var n=r-t;assert$b(n%4==0);for(var i=new Array(n/4),a=0,s=t;a<i.length;a++,s+=4){var c;c="big"===o?e[s]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3]:e[s+3]<<24|e[s+2]<<16|e[s+1]<<8|e[s],i[a]=c>>>0}return i}function split32(e,t){for(var r=new Array(4*e.length),o=0,n=0;o<e.length;o++,n+=4){var i=e[o];"big"===t?(r[n]=i>>>24,r[n+1]=i>>>16&255,r[n+2]=i>>>8&255,r[n+3]=255&i):(r[n+3]=i>>>24,r[n+2]=i>>>16&255,r[n+1]=i>>>8&255,r[n]=255&i)}return r}function rotr32$1(e,t){return e>>>t|e<<32-t}function rotl32$2(e,t){return e<<t|e>>>32-t}function sum32$3(e,t){return e+t>>>0}function sum32_3$1(e,t,r){return e+t+r>>>0}function sum32_4$2(e,t,r,o){return e+t+r+o>>>0}function sum32_5$2(e,t,r,o,n){return e+t+r+o+n>>>0}function sum64$1(e,t,r,o){var n=e[t],i=o+e[t+1]>>>0,a=(i<o?1:0)+r+n;e[t]=a>>>0,e[t+1]=i}function sum64_hi$1(e,t,r,o){return(t+o>>>0<t?1:0)+e+r>>>0}function sum64_lo$1(e,t,r,o){return t+o>>>0}function sum64_4_hi$1(e,t,r,o,n,i,a,s){var c=0,u=t;return c+=(u=u+o>>>0)<t?1:0,c+=(u=u+i>>>0)<i?1:0,e+r+n+a+(c+=(u=u+s>>>0)<s?1:0)>>>0}function sum64_4_lo$1(e,t,r,o,n,i,a,s){return t+o+i+s>>>0}function sum64_5_hi$1(e,t,r,o,n,i,a,s,c,u){var l=0,d=t;return l+=(d=d+o>>>0)<t?1:0,l+=(d=d+i>>>0)<i?1:0,l+=(d=d+s>>>0)<s?1:0,e+r+n+a+c+(l+=(d=d+u>>>0)<u?1:0)>>>0}function sum64_5_lo$1(e,t,r,o,n,i,a,s,c,u){return t+o+i+s+u>>>0}function rotr64_hi$1(e,t,r){return(t<<32-r|e>>>r)>>>0}function rotr64_lo$1(e,t,r){return(e<<32-r|t>>>r)>>>0}function shr64_hi$1(e,t,r){return e>>>r}function shr64_lo$1(e,t,r){return(e<<32-r|t>>>r)>>>0}utils$i.inherits=inherits$2,utils$i.toArray=toArray$2,utils$i.toHex=toHex$1,utils$i.htonl=htonl,utils$i.toHex32=toHex32,utils$i.zero2=zero2,utils$i.zero8=zero8,utils$i.join32=join32,utils$i.split32=split32,utils$i.rotr32=rotr32$1,utils$i.rotl32=rotl32$2,utils$i.sum32=sum32$3,utils$i.sum32_3=sum32_3$1,utils$i.sum32_4=sum32_4$2,utils$i.sum32_5=sum32_5$2,utils$i.sum64=sum64$1,utils$i.sum64_hi=sum64_hi$1,utils$i.sum64_lo=sum64_lo$1,utils$i.sum64_4_hi=sum64_4_hi$1,utils$i.sum64_4_lo=sum64_4_lo$1,utils$i.sum64_5_hi=sum64_5_hi$1,utils$i.sum64_5_lo=sum64_5_lo$1,utils$i.rotr64_hi=rotr64_hi$1,utils$i.rotr64_lo=rotr64_lo$1,utils$i.shr64_hi=shr64_hi$1,utils$i.shr64_lo=shr64_lo$1;var common$5={},utils$h=utils$i,assert$a=minimalisticAssert;function BlockHash$4(){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}common$5.BlockHash=BlockHash$4,BlockHash$4.prototype.update=function(e,t){if(e=utils$h.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=utils$h.join32(e,0,e.length-r,this.endian);for(var o=0;o<e.length;o+=this._delta32)this._update(e,o,o+this._delta32)}return this},BlockHash$4.prototype.digest=function(e){return this.update(this._pad()),assert$a(null===this.pending),this._digest(e)},BlockHash$4.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,o=new Array(r+this.padLength);o[0]=128;for(var n=1;n<r;n++)o[n]=0;if(e<<=3,"big"===this.endian){for(var i=8;i<this.padLength;i++)o[n++]=0;o[n++]=0,o[n++]=0,o[n++]=0,o[n++]=0,o[n++]=e>>>24&255,o[n++]=e>>>16&255,o[n++]=e>>>8&255,o[n++]=255&e}else for(o[n++]=255&e,o[n++]=e>>>8&255,o[n++]=e>>>16&255,o[n++]=e>>>24&255,o[n++]=0,o[n++]=0,o[n++]=0,o[n++]=0,i=8;i<this.padLength;i++)o[n++]=0;return o};var sha={},common$4={},utils$g=utils$i,rotr32=utils$g.rotr32;function ft_1$1(e,t,r,o){return 0===e?ch32$1(t,r,o):1===e||3===e?p32(t,r,o):2===e?maj32$1(t,r,o):void 0}function ch32$1(e,t,r){return e&t^~e&r}function maj32$1(e,t,r){return e&t^e&r^t&r}function p32(e,t,r){return e^t^r}function s0_256$1(e){return rotr32(e,2)^rotr32(e,13)^rotr32(e,22)}function s1_256$1(e){return rotr32(e,6)^rotr32(e,11)^rotr32(e,25)}function g0_256$1(e){return rotr32(e,7)^rotr32(e,18)^e>>>3}function g1_256$1(e){return rotr32(e,17)^rotr32(e,19)^e>>>10}common$4.ft_1=ft_1$1,common$4.ch32=ch32$1,common$4.maj32=maj32$1,common$4.p32=p32,common$4.s0_256=s0_256$1,common$4.s1_256=s1_256$1,common$4.g0_256=g0_256$1,common$4.g1_256=g1_256$1;var utils$f=utils$i,common$3=common$5,shaCommon$1=common$4,rotl32$1=utils$f.rotl32,sum32$2=utils$f.sum32,sum32_5$1=utils$f.sum32_5,ft_1=shaCommon$1.ft_1,BlockHash$3=common$3.BlockHash,sha1_K=[1518500249,1859775393,2400959708,3395469782];function SHA1(){if(!(this instanceof SHA1))return new SHA1;BlockHash$3.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}utils$f.inherits(SHA1,BlockHash$3);var _1=SHA1;SHA1.blockSize=512,SHA1.outSize=160,SHA1.hmacStrength=80,SHA1.padLength=64,SHA1.prototype._update=function(e,t){for(var r=this.W,o=0;o<16;o++)r[o]=e[t+o];for(;o<r.length;o++)r[o]=rotl32$1(r[o-3]^r[o-8]^r[o-14]^r[o-16],1);var n=this.h[0],i=this.h[1],a=this.h[2],s=this.h[3],c=this.h[4];for(o=0;o<r.length;o++){var u=~~(o/20),l=sum32_5$1(rotl32$1(n,5),ft_1(u,i,a,s),c,r[o],sha1_K[u]);c=s,s=a,a=rotl32$1(i,30),i=n,n=l}this.h[0]=sum32$2(this.h[0],n),this.h[1]=sum32$2(this.h[1],i),this.h[2]=sum32$2(this.h[2],a),this.h[3]=sum32$2(this.h[3],s),this.h[4]=sum32$2(this.h[4],c)},SHA1.prototype._digest=function(e){return"hex"===e?utils$f.toHex32(this.h,"big"):utils$f.split32(this.h,"big")};var utils$e=utils$i,common$2=common$5,shaCommon=common$4,assert$9=minimalisticAssert,sum32$1=utils$e.sum32,sum32_4$1=utils$e.sum32_4,sum32_5=utils$e.sum32_5,ch32=shaCommon.ch32,maj32=shaCommon.maj32,s0_256=shaCommon.s0_256,s1_256=shaCommon.s1_256,g0_256=shaCommon.g0_256,g1_256=shaCommon.g1_256,BlockHash$2=common$2.BlockHash,sha256_K=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function SHA256$1(){if(!(this instanceof SHA256$1))return new SHA256$1;BlockHash$2.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=sha256_K,this.W=new Array(64)}utils$e.inherits(SHA256$1,BlockHash$2);var _256=SHA256$1;SHA256$1.blockSize=512,SHA256$1.outSize=256,SHA256$1.hmacStrength=192,SHA256$1.padLength=64,SHA256$1.prototype._update=function(e,t){for(var r=this.W,o=0;o<16;o++)r[o]=e[t+o];for(;o<r.length;o++)r[o]=sum32_4$1(g1_256(r[o-2]),r[o-7],g0_256(r[o-15]),r[o-16]);var n=this.h[0],i=this.h[1],a=this.h[2],s=this.h[3],c=this.h[4],u=this.h[5],l=this.h[6],d=this.h[7];for(assert$9(this.k.length===r.length),o=0;o<r.length;o++){var p=sum32_5(d,s1_256(c),ch32(c,u,l),this.k[o],r[o]),h=sum32$1(s0_256(n),maj32(n,i,a));d=l,l=u,u=c,c=sum32$1(s,p),s=a,a=i,i=n,n=sum32$1(p,h)}this.h[0]=sum32$1(this.h[0],n),this.h[1]=sum32$1(this.h[1],i),this.h[2]=sum32$1(this.h[2],a),this.h[3]=sum32$1(this.h[3],s),this.h[4]=sum32$1(this.h[4],c),this.h[5]=sum32$1(this.h[5],u),this.h[6]=sum32$1(this.h[6],l),this.h[7]=sum32$1(this.h[7],d)},SHA256$1.prototype._digest=function(e){return"hex"===e?utils$e.toHex32(this.h,"big"):utils$e.split32(this.h,"big")};var utils$d=utils$i,SHA256=_256;function SHA224(){if(!(this instanceof SHA224))return new SHA224;SHA256.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}utils$d.inherits(SHA224,SHA256);var _224=SHA224;SHA224.blockSize=512,SHA224.outSize=224,SHA224.hmacStrength=192,SHA224.padLength=64,SHA224.prototype._digest=function(e){return"hex"===e?utils$d.toHex32(this.h.slice(0,7),"big"):utils$d.split32(this.h.slice(0,7),"big")};var utils$c=utils$i,common$1=common$5,assert$8=minimalisticAssert,rotr64_hi=utils$c.rotr64_hi,rotr64_lo=utils$c.rotr64_lo,shr64_hi=utils$c.shr64_hi,shr64_lo=utils$c.shr64_lo,sum64=utils$c.sum64,sum64_hi=utils$c.sum64_hi,sum64_lo=utils$c.sum64_lo,sum64_4_hi=utils$c.sum64_4_hi,sum64_4_lo=utils$c.sum64_4_lo,sum64_5_hi=utils$c.sum64_5_hi,sum64_5_lo=utils$c.sum64_5_lo,BlockHash$1=common$1.BlockHash,sha512_K=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function SHA512$1(){if(!(this instanceof SHA512$1))return new SHA512$1;BlockHash$1.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=sha512_K,this.W=new Array(160)}utils$c.inherits(SHA512$1,BlockHash$1);var _512=SHA512$1;function ch64_hi(e,t,r,o,n){var i=e&r^~e&n;return i<0&&(i+=4294967296),i}function ch64_lo(e,t,r,o,n,i){var a=t&o^~t&i;return a<0&&(a+=4294967296),a}function maj64_hi(e,t,r,o,n){var i=e&r^e&n^r&n;return i<0&&(i+=4294967296),i}function maj64_lo(e,t,r,o,n,i){var a=t&o^t&i^o&i;return a<0&&(a+=4294967296),a}function s0_512_hi(e,t){var r=rotr64_hi(e,t,28)^rotr64_hi(t,e,2)^rotr64_hi(t,e,7);return r<0&&(r+=4294967296),r}function s0_512_lo(e,t){var r=rotr64_lo(e,t,28)^rotr64_lo(t,e,2)^rotr64_lo(t,e,7);return r<0&&(r+=4294967296),r}function s1_512_hi(e,t){var r=rotr64_hi(e,t,14)^rotr64_hi(e,t,18)^rotr64_hi(t,e,9);return r<0&&(r+=4294967296),r}function s1_512_lo(e,t){var r=rotr64_lo(e,t,14)^rotr64_lo(e,t,18)^rotr64_lo(t,e,9);return r<0&&(r+=4294967296),r}function g0_512_hi(e,t){var r=rotr64_hi(e,t,1)^rotr64_hi(e,t,8)^shr64_hi(e,t,7);return r<0&&(r+=4294967296),r}function g0_512_lo(e,t){var r=rotr64_lo(e,t,1)^rotr64_lo(e,t,8)^shr64_lo(e,t,7);return r<0&&(r+=4294967296),r}function g1_512_hi(e,t){var r=rotr64_hi(e,t,19)^rotr64_hi(t,e,29)^shr64_hi(e,t,6);return r<0&&(r+=4294967296),r}function g1_512_lo(e,t){var r=rotr64_lo(e,t,19)^rotr64_lo(t,e,29)^shr64_lo(e,t,6);return r<0&&(r+=4294967296),r}SHA512$1.blockSize=1024,SHA512$1.outSize=512,SHA512$1.hmacStrength=192,SHA512$1.padLength=128,SHA512$1.prototype._prepareBlock=function(e,t){for(var r=this.W,o=0;o<32;o++)r[o]=e[t+o];for(;o<r.length;o+=2){var n=g1_512_hi(r[o-4],r[o-3]),i=g1_512_lo(r[o-4],r[o-3]),a=r[o-14],s=r[o-13],c=g0_512_hi(r[o-30],r[o-29]),u=g0_512_lo(r[o-30],r[o-29]),l=r[o-32],d=r[o-31];r[o]=sum64_4_hi(n,i,a,s,c,u,l,d),r[o+1]=sum64_4_lo(n,i,a,s,c,u,l,d)}},SHA512$1.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,o=this.h[0],n=this.h[1],i=this.h[2],a=this.h[3],s=this.h[4],c=this.h[5],u=this.h[6],l=this.h[7],d=this.h[8],p=this.h[9],h=this.h[10],f=this.h[11],m=this.h[12],y=this.h[13],g=this.h[14],b=this.h[15];assert$8(this.k.length===r.length);for(var v=0;v<r.length;v+=2){var w=g,$=b,k=s1_512_hi(d,p),_=s1_512_lo(d,p),T=ch64_hi(d,p,h,f,m),I=ch64_lo(d,p,h,f,m,y),A=this.k[v],O=this.k[v+1],E=r[v],S=r[v+1],R=sum64_5_hi(w,$,k,_,T,I,A,O,E,S),x=sum64_5_lo(w,$,k,_,T,I,A,O,E,S);w=s0_512_hi(o,n),$=s0_512_lo(o,n),k=maj64_hi(o,n,i,a,s),_=maj64_lo(o,n,i,a,s,c);var C=sum64_hi(w,$,k,_),P=sum64_lo(w,$,k,_);g=m,b=y,m=h,y=f,h=d,f=p,d=sum64_hi(u,l,R,x),p=sum64_lo(l,l,R,x),u=s,l=c,s=i,c=a,i=o,a=n,o=sum64_hi(R,x,C,P),n=sum64_lo(R,x,C,P)}sum64(this.h,0,o,n),sum64(this.h,2,i,a),sum64(this.h,4,s,c),sum64(this.h,6,u,l),sum64(this.h,8,d,p),sum64(this.h,10,h,f),sum64(this.h,12,m,y),sum64(this.h,14,g,b)},SHA512$1.prototype._digest=function(e){return"hex"===e?utils$c.toHex32(this.h,"big"):utils$c.split32(this.h,"big")};var utils$b=utils$i,SHA512=_512;function SHA384(){if(!(this instanceof SHA384))return new SHA384;SHA512.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}utils$b.inherits(SHA384,SHA512);var _384=SHA384;SHA384.blockSize=1024,SHA384.outSize=384,SHA384.hmacStrength=192,SHA384.padLength=128,SHA384.prototype._digest=function(e){return"hex"===e?utils$b.toHex32(this.h.slice(0,12),"big"):utils$b.split32(this.h.slice(0,12),"big")},sha.sha1=_1,sha.sha224=_224,sha.sha256=_256,sha.sha384=_384,sha.sha512=_512;var ripemd={},utils$a=utils$i,common=common$5,rotl32=utils$a.rotl32,sum32=utils$a.sum32,sum32_3=utils$a.sum32_3,sum32_4=utils$a.sum32_4,BlockHash=common.BlockHash;function RIPEMD160(){if(!(this instanceof RIPEMD160))return new RIPEMD160;BlockHash.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function f$4(e,t,r,o){return e<=15?t^r^o:e<=31?t&r|~t&o:e<=47?(t|~r)^o:e<=63?t&o|r&~o:t^(r|~o)}function K(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function Kh(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}utils$a.inherits(RIPEMD160,BlockHash),ripemd.ripemd160=RIPEMD160,RIPEMD160.blockSize=512,RIPEMD160.outSize=160,RIPEMD160.hmacStrength=192,RIPEMD160.padLength=64,RIPEMD160.prototype._update=function(e,t){for(var r=this.h[0],o=this.h[1],n=this.h[2],i=this.h[3],a=this.h[4],s=r,c=o,u=n,l=i,d=a,p=0;p<80;p++){var h=sum32(rotl32(sum32_4(r,f$4(p,o,n,i),e[r$b[p]+t],K(p)),s$a[p]),a);r=a,a=i,i=rotl32(n,10),n=o,o=h,h=sum32(rotl32(sum32_4(s,f$4(79-p,c,u,l),e[rh[p]+t],Kh(p)),sh[p]),d),s=d,d=l,l=rotl32(u,10),u=c,c=h}h=sum32_3(this.h[1],n,l),this.h[1]=sum32_3(this.h[2],i,d),this.h[2]=sum32_3(this.h[3],a,s),this.h[3]=sum32_3(this.h[4],r,c),this.h[4]=sum32_3(this.h[0],o,u),this.h[0]=h},RIPEMD160.prototype._digest=function(e){return"hex"===e?utils$a.toHex32(this.h,"little"):utils$a.split32(this.h,"little")};var r$b=[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],rh=[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],s$a=[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],sh=[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],utils$9=utils$i,assert$7=minimalisticAssert;function Hmac(e,t,r){if(!(this instanceof Hmac))return new Hmac(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(utils$9.toArray(t,r))}var hmac=Hmac,secp256k1$2,hasRequiredSecp256k1;function requireSecp256k1(){return hasRequiredSecp256k1?secp256k1$2:(hasRequiredSecp256k1=1,secp256k1$2={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"]]}})}Hmac.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),assert$7(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)},Hmac.prototype.update=function(e,t){return this.inner.update(e,t),this},Hmac.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(e){var t=e;t.utils=utils$i,t.common=common$5,t.sha=sha,t.ripemd=ripemd,t.hmac=hmac,t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160}(hash$3),function(e){var t,r=e,o=hash$3,n=curve,i=utils$o.assert;function a(e){"short"===e.type?this.curve=new n.short(e):"edwards"===e.type?this.curve=new n.edwards(e):this.curve=new n.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(e,t){Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:function(){var o=new a(t);return Object.defineProperty(r,e,{configurable:!0,enumerable:!0,value:o}),o}})}r.PresetCurve=a,s("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"]}),s("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"]}),s("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"]}),s("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"]}),s("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"]}),s("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"]}),s("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{t=requireSecp256k1()}catch(c){t=void 0}s("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",t]})}(curves$1);var hash$2=hash$3,utils$8=utils$n,assert$6=minimalisticAssert;function HmacDRBG(e){if(!(this instanceof HmacDRBG))return new HmacDRBG(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=utils$8.toArray(e.entropy,e.entropyEnc||"hex"),r=utils$8.toArray(e.nonce,e.nonceEnc||"hex"),o=utils$8.toArray(e.pers,e.persEnc||"hex");assert$6(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,o)}var hmacDrbg=HmacDRBG;HmacDRBG.prototype._init=function(e,t,r){var o=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(o),this._reseed=1,this.reseedInterval=281474976710656},HmacDRBG.prototype._hmac=function(){return new hash$2.hmac(this.hash,this.K)},HmacDRBG.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())},HmacDRBG.prototype.reseed=function(e,t,r,o){"string"!=typeof t&&(o=r,r=t,t=null),e=utils$8.toArray(e,t),r=utils$8.toArray(r,o),assert$6(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},HmacDRBG.prototype.generate=function(e,t,r,o){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(o=r,r=t,t=null),r&&(r=utils$8.toArray(r,o||"hex"),this._update(r));for(var n=[];n.length<e;)this.V=this._hmac().update(this.V).digest(),n=n.concat(this.V);var i=n.slice(0,e);return this._update(r),this._reseed++,utils$8.encode(i,t)};var BN$3=bnExports,utils$7=utils$o,assert$5=utils$7.assert;function KeyPair$2(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)}var key$1=KeyPair$2;KeyPair$2.fromPublic=function(e,t,r){return t instanceof KeyPair$2?t:new KeyPair$2(e,{pub:t,pubEnc:r})},KeyPair$2.fromPrivate=function(e,t,r){return t instanceof KeyPair$2?t:new KeyPair$2(e,{priv:t,privEnc:r})},KeyPair$2.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"}},KeyPair$2.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},KeyPair$2.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},KeyPair$2.prototype._importPrivate=function(e,t){this.priv=new BN$3(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},KeyPair$2.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?assert$5(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||assert$5(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)},KeyPair$2.prototype.derive=function(e){return e.validate()||assert$5(e.validate(),"public point not validated"),e.mul(this.priv).getX()},KeyPair$2.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},KeyPair$2.prototype.verify=function(e,t,r){return this.ec.verify(e,t,this,void 0,r)},KeyPair$2.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var BN$2=bnExports,utils$6=utils$o,assert$4=utils$6.assert;function Signature$2(e,t){if(e instanceof Signature$2)return e;this._importDER(e,t)||(assert$4(e.r&&e.s,"Signature without r or s"),this.r=new BN$2(e.r,16),this.s=new BN$2(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var signature$1=Signature$2,ec$1,hasRequiredEc;function Position(){this.place=0}function getLength(e,t){var r=e[t.place++];if(!(128&r))return r;var o=15&r;if(0===o||o>4)return!1;if(0===e[t.place])return!1;for(var n=0,i=0,a=t.place;i<o;i++,a++)n<<=8,n|=e[a],n>>>=0;return!(n<=127)&&(t.place=a,n)}function rmPadding(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 constructLength(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)}}function requireEc(){if(hasRequiredEc)return ec$1;hasRequiredEc=1;var e=bnExports,t=hmacDrbg,r=utils$o,o=curves$1,n=requireBrorand(),i=r.assert,a=key$1,s=signature$1;function c(e){if(!(this instanceof c))return new c(e);"string"==typeof e&&(i(Object.prototype.hasOwnProperty.call(o,e),"Unknown curve "+e),e=o[e]),e instanceof o.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}return ec$1=c,c.prototype.keyPair=function(e){return new a(this,e)},c.prototype.keyFromPrivate=function(e,t){return a.fromPrivate(this,e,t)},c.prototype.keyFromPublic=function(e,t){return a.fromPublic(this,e,t)},c.prototype.genKeyPair=function(r){r||(r={});for(var o=new t({hash:this.hash,pers:r.pers,persEnc:r.persEnc||"utf8",entropy:r.entropy||n(this.hash.hmacStrength),entropyEnc:r.entropy&&r.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),a=this.n.sub(new e(2));;){var s=new e(o.generate(i));if(!(s.cmp(a)>0))return s.iaddn(1),this.keyFromPrivate(s)}},c.prototype._truncateToN=function(t,r,o){var n;if(e.isBN(t)||"number"==typeof t)n=(t=new e(t,16)).byteLength();else if("object"==typeof t)n=t.length,t=new e(t,16);else{var i=t.toString();n=i.length+1>>>1,t=new e(i,16)}"number"!=typeof o&&(o=8*n);var a=o-this.n.bitLength();return a>0&&(t=t.ushrn(a)),!r&&t.cmp(this.n)>=0?t.sub(this.n):t},c.prototype.sign=function(r,o,n,a){if("object"==typeof n&&(a=n,n=null),a||(a={}),"string"!=typeof r&&"number"!=typeof r&&!e.isBN(r)){i("object"==typeof r&&r&&"number"==typeof r.length,"Expected message to be an array-like, a hex string, or a BN instance"),i(r.length>>>0===r.length);for(var c=0;c<r.length;c++)i((255&r[c])===r[c])}o=this.keyFromPrivate(o,n),r=this._truncateToN(r,!1,a.msgBitLength),i(!r.isNeg(),"Can not sign a negative message");var u=this.n.byteLength(),l=o.getPrivate().toArray("be",u),d=r.toArray("be",u);i(new e(d).eq(r),"Can not sign message");for(var p=new t({hash:this.hash,entropy:l,nonce:d,pers:a.pers,persEnc:a.persEnc||"utf8"}),h=this.n.sub(new e(1)),f=0;;f++){var m=a.k?a.k(f):new e(p.generate(this.n.byteLength()));if(!((m=this._truncateToN(m,!0)).cmpn(1)<=0||m.cmp(h)>=0)){var y=this.g.mul(m);if(!y.isInfinity()){var g=y.getX(),b=g.umod(this.n);if(0!==b.cmpn(0)){var v=m.invm(this.n).mul(b.mul(o.getPrivate()).iadd(r));if(0!==(v=v.umod(this.n)).cmpn(0)){var w=(y.getY().isOdd()?1:0)|(0!==g.cmp(b)?2:0);return a.canonical&&v.cmp(this.nh)>0&&(v=this.n.sub(v),w^=1),new s({r:b,s:v,recoveryParam:w})}}}}}},c.prototype.verify=function(e,t,r,o,n){n||(n={}),e=this._truncateToN(e,!1,n.msgBitLength),r=this.keyFromPublic(r,o);var i=(t=new s(t,"hex")).r,a=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var c,u=a.invm(this.n),l=u.mul(e).umod(this.n),d=u.mul(i).umod(this.n);return this.curve._maxwellTrick?!(c=this.g.jmulAdd(l,r.getPublic(),d)).isInfinity()&&c.eqXToP(i):!(c=this.g.mulAdd(l,r.getPublic(),d)).isInfinity()&&0===c.getX().umod(this.n).cmp(i)},c.prototype.recoverPubKey=function(t,r,o,n){i((3&o)===o,"The recovery param is more than two bits"),r=new s(r,n);var a=this.n,c=new e(t),u=r.r,l=r.s,d=1&o,p=o>>1;if(u.cmp(this.curve.p.umod(this.curve.n))>=0&&p)throw new Error("Unable to find sencond key candinate");u=p?this.curve.pointFromX(u.add(this.curve.n),d):this.curve.pointFromX(u,d);var h=r.r.invm(a),f=a.sub(c).mul(h).umod(a),m=l.mul(h).umod(a);return this.g.mulAdd(f,u,m)},c.prototype.getKeyRecoveryParam=function(e,t,r,o){if(null!==(t=new s(t,o)).recoveryParam)return t.recoveryParam;for(var n=0;n<4;n++){var i;try{i=this.recoverPubKey(e,t,n)}catch(a){continue}if(i.eq(r))return n}throw new Error("Unable to find valid recovery factor")},ec$1}Signature$2.prototype._importDER=function(e,t){e=utils$6.toArray(e,t);var r=new Position;if(48!==e[r.place++])return!1;var o=getLength(e,r);if(!1===o)return!1;if(o+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var n=getLength(e,r);if(!1===n)return!1;if(128&e[r.place])return!1;var i=e.slice(r.place,n+r.place);if(r.place+=n,2!==e[r.place++])return!1;var a=getLength(e,r);if(!1===a)return!1;if(e.length!==a+r.place)return!1;if(128&e[r.place])return!1;var s=e.slice(r.place,a+r.place);if(0===i[0]){if(!(128&i[1]))return!1;i=i.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new BN$2(i),this.s=new BN$2(s),this.recoveryParam=null,!0},Signature$2.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=rmPadding(t),r=rmPadding(r);!(r[0]||128&r[1]);)r=r.slice(1);var o=[2];constructLength(o,t.length),(o=o.concat(t)).push(2),constructLength(o,r.length);var n=o.concat(r),i=[48];return constructLength(i,n.length),i=i.concat(n),utils$6.encode(i,e)};var utils$5=utils$o,assert$3=utils$5.assert,parseBytes$2=utils$5.parseBytes,cachedProperty$1=utils$5.cachedProperty;function KeyPair$1(e,t){this.eddsa=e,this._secret=parseBytes$2(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=parseBytes$2(t.pub)}KeyPair$1.fromPublic=function(e,t){return t instanceof KeyPair$1?t:new KeyPair$1(e,{pub:t})},KeyPair$1.fromSecret=function(e,t){return t instanceof KeyPair$1?t:new KeyPair$1(e,{secret:t})},KeyPair$1.prototype.secret=function(){return this._secret},cachedProperty$1(KeyPair$1,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),cachedProperty$1(KeyPair$1,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),cachedProperty$1(KeyPair$1,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,o=t.slice(0,e.encodingLength);return o[0]&=248,o[r]&=127,o[r]|=64,o})),cachedProperty$1(KeyPair$1,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),cachedProperty$1(KeyPair$1,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),cachedProperty$1(KeyPair$1,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),KeyPair$1.prototype.sign=function(e){return assert$3(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},KeyPair$1.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},KeyPair$1.prototype.getSecret=function(e){return assert$3(this._secret,"KeyPair is public only"),utils$5.encode(this.secret(),e)},KeyPair$1.prototype.getPublic=function(e){return utils$5.encode(this.pubBytes(),e)};var key=KeyPair$1,BN$1=bnExports,utils$4=utils$o,assert$2=utils$4.assert,cachedProperty=utils$4.cachedProperty,parseBytes$1=utils$4.parseBytes;function Signature$1(e,t){this.eddsa=e,"object"!=typeof t&&(t=parseBytes$1(t)),Array.isArray(t)&&(assert$2(t.length===2*e.encodingLength,"Signature has invalid size"),t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),assert$2(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof BN$1&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}cachedProperty(Signature$1,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),cachedProperty(Signature$1,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),cachedProperty(Signature$1,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),cachedProperty(Signature$1,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),Signature$1.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Signature$1.prototype.toHex=function(){return utils$4.encode(this.toBytes(),"hex").toUpperCase()};var signature=Signature$1,hash$1=hash$3,curves=curves$1,utils$3=utils$o,assert$1=utils$3.assert,parseBytes=utils$3.parseBytes,KeyPair=key,Signature=signature;function EDDSA(e){if(assert$1("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof EDDSA))return new EDDSA(e);e=curves[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=hash$1.sha512}var eddsa=EDDSA,hasRequiredElliptic;function requireElliptic(){return hasRequiredElliptic||(hasRequiredElliptic=1,function(e){var t=e;t.version=require$$0$1.version,t.utils=utils$o,t.rand=requireBrorand(),t.curve=curve,t.curves=curves$1,t.ec=requireEc(),t.eddsa=eddsa}(elliptic$1)),elliptic$1}EDDSA.prototype.sign=function(e,t){e=parseBytes(e);var r=this.keyFromSecret(t),o=this.hashInt(r.messagePrefix(),e),n=this.g.mul(o),i=this.encodePoint(n),a=this.hashInt(i,r.pubBytes(),e).mul(r.priv()),s=o.add(a).umod(this.curve.n);return this.makeSignature({R:n,S:s,Rencoded:i})},EDDSA.prototype.verify=function(e,t,r){if(e=parseBytes(e),(t=this.makeSignature(t)).S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var o=this.keyFromPublic(r),n=this.hashInt(t.Rencoded(),o.pubBytes(),e),i=this.g.mul(t.S());return t.R().add(o.pub().mul(n)).eq(i)},EDDSA.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return utils$3.intFromLE(e.digest()).umod(this.curve.n)},EDDSA.prototype.keyFromPublic=function(e){return KeyPair.fromPublic(this,e)},EDDSA.prototype.keyFromSecret=function(e){return KeyPair.fromSecret(this,e)},EDDSA.prototype.makeSignature=function(e){return e instanceof Signature?e:new Signature(this,e)},EDDSA.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},EDDSA.prototype.decodePoint=function(e){var t=(e=utils$3.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),o=!!(128&e[t]),n=utils$3.intFromLE(r);return this.curve.pointFromY(n,o)},EDDSA.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},EDDSA.prototype.decodeInt=function(e){return utils$3.intFromLE(e)},EDDSA.prototype.isPoint=function(e){return e instanceof this.pointClass};var asn1$1={},asn1={},bn$2={exports:{}},hasRequiredBn$2;function requireBn$2(){return hasRequiredBn$2||(hasRequiredBn$2=1,function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function o(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function n(e,t,r){if(n.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 i;"object"==typeof e?e.exports=n:t.BN=n,n.BN=n,n.wordSize=26;try{i="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require$$0$2.Buffer}catch(T){}function a(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(e,t,r){var o=a(e,r);return r-1>=t&&(o|=a(e,r-1)<<4),o}function c(e,t,r,o){for(var n=0,i=Math.min(e.length,r),a=t;a<i;a++){var s=e.charCodeAt(a)-48;n*=o,n+=s>=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(e){return e instanceof n||null!==e&&"object"==typeof e&&e.constructor.wordSize===n.wordSize&&Array.isArray(e.words)},n.max=function(e,t){return e.cmp(t)>0?e:t},n.min=function(e,t){return e.cmp(t)<0?e:t},n.prototype._init=function(e,t,o){if("number"==typeof e)return this._initNumber(e,t,o);if("object"==typeof e)return this._initArray(e,t,o);"hex"===t&&(t=16),r(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,o):(this._parseBase(e,t,n),"le"===o&&this._initArray(this.toArray(),t,o)))},n.prototype._initNumber=function(e,t,o){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):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===o&&this._initArray(this.toArray(),t,o)},n.prototype._initArray=function(e,t,o){if(r("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 i,a,s=0;if("be"===o)for(n=e.length-1,i=0;n>=0;n-=3)a=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===o)for(n=0,i=0;n<e.length;n+=3)a=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this.strip()},n.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var n,i=0,a=0;if("be"===r)for(o=e.length-1;o>=t;o-=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;else for(o=(e.length-t)%2==0?t+1:t;o<e.length;o+=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;this.strip()},n.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var o=0,n=1;n<=67108863;n*=t)o++;o--,n=n/t|0;for(var i=e.length-r,a=i%o,s=Math.min(i,i-a)+r,u=0,l=r;l<s;l+=o)u=c(e,l,l+o,t),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var d=1;for(u=c(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.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},n.prototype.clone=function(){var e=new n(null);return this.copy(e),e},n.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","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"],l=[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],d=[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 p(e,t,r){r.negative=t.negative^e.negative;var o=e.length+t.length|0;r.length=o,o=o-1|0;var n=0|e.words[0],i=0|t.words[0],a=n*i,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u<o;u++){for(var l=c>>>26,d=67108863&c,p=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=p;h++){var f=u-h|0;l+=(a=(n=0|e.words[f])*(i=0|t.words[h])+d)/67108864|0,d=67108863&a}r.words[u]=0|d,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}n.prototype.toString=function(e,t){var o;if(t=0|t||1,16===(e=e||10)||"hex"===e){o="";for(var n=0,i=0,a=0;a<this.length;a++){var s=this.words[a],c=(16777215&(s<<n|i)).toString(16);i=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),o=0!==i||a!==this.length-1?u[6-c.length]+c+o:c+o}for(0!==i&&(o=i.toString(16)+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}if(e===(0|e)&&e>=2&&e<=36){var p=l[e],h=d[e];o="";var f=this.clone();for(f.negative=0;!f.isZero();){var m=f.modn(h).toString(e);o=(f=f.idivn(h)).isZero()?m+o:u[p-m.length]+m+o}for(this.isZero()&&(o="0"+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}r(!1,"Base should be between 2 and 36")},n.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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(e,t){return r(void 0!==i),this.toArrayLike(i,e,t)},n.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},n.prototype.toArrayLike=function(e,t,o){var n=this.byteLength(),i=o||Math.max(1,n);r(n<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===t,u=new e(i),l=this.clone();if(c){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[s]=a;for(;s<i;s++)u[s]=0}else{for(s=0;s<i-n;s++)u[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[i-s-1]=a}return u},Math.clz32?n.prototype._countBits=function(e){return 32-Math.clz32(e)}:n.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},n.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},n.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},n.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},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},n.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(e){return r(!(this.negative|e.negative)),this.iuor(e)},n.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},n.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},n.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()},n.prototype.iand=function(e){return r(!(this.negative|e.negative)),this.iuand(e)},n.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},n.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},n.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var o=0;o<r.length;o++)this.words[o]=t.words[o]^r.words[o];if(this!==t)for(;o<t.length;o++)this.words[o]=t.words[o];return this.length=t.length,this.strip()},n.prototype.ixor=function(e){return r(!(this.negative|e.negative)),this.iuxor(e)},n.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},n.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},n.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),o=e%26;this._expand(t),o>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return o>0&&(this.words[n]=~this.words[n]&67108863>>26-o),this.strip()},n.prototype.notn=function(e){return this.clone().inotn(e)},n.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var o=e/26|0,n=e%26;return this._expand(o+1),this.words[o]=t?this.words[o]|1<<n:this.words[o]&~(1<<n),this.strip()},n.prototype.iadd=function(e){var t,r,o;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,o=e):(r=e,o=this);for(var n=0,i=0;i<o.length;i++)t=(0|r.words[i])+(0|o.words[i])+n,this.words[i]=67108863&t,n=t>>>26;for(;0!==n&&i<r.length;i++)t=(0|r.words[i])+n,this.words[i]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;i<r.length;i++)this.words[i]=r.words[i];return this},n.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)},n.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,o,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,o=e):(r=e,o=this);for(var i=0,a=0;a<o.length;a++)i=(t=(0|r.words[a])-(0|o.words[a])+i)>>26,this.words[a]=67108863&t;for(;0!==i&&a<r.length;a++)i=(t=(0|r.words[a])+i)>>26,this.words[a]=67108863&t;if(0===i&&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()},n.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,r){var o,n,i,a=e.words,s=t.words,c=r.words,u=0,l=0|a[0],d=8191&l,p=l>>>13,h=0|a[1],f=8191&h,m=h>>>13,y=0|a[2],g=8191&y,b=y>>>13,v=0|a[3],w=8191&v,$=v>>>13,k=0|a[4],_=8191&k,T=k>>>13,I=0|a[5],A=8191&I,O=I>>>13,E=0|a[6],S=8191&E,R=E>>>13,x=0|a[7],C=8191&x,P=x>>>13,N=0|a[8],B=8191&N,D=N>>>13,M=0|a[9],L=8191&M,j=M>>>13,F=0|s[0],U=8191&F,K=F>>>13,q=0|s[1],G=8191&q,H=q>>>13,V=0|s[2],W=8191&V,z=V>>>13,Z=0|s[3],Q=8191&Z,Y=Z>>>13,X=0|s[4],J=8191&X,ee=X>>>13,te=0|s[5],re=8191&te,oe=te>>>13,ne=0|s[6],ie=8191&ne,ae=ne>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],de=8191&le,pe=le>>>13,he=0|s[9],fe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(u+(o=Math.imul(d,U))|0)+((8191&(n=(n=Math.imul(d,K))+Math.imul(p,U)|0))<<13)|0;u=((i=Math.imul(p,K))+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,o=Math.imul(f,U),n=(n=Math.imul(f,K))+Math.imul(m,U)|0,i=Math.imul(m,K);var ge=(u+(o=o+Math.imul(d,G)|0)|0)+((8191&(n=(n=n+Math.imul(d,H)|0)+Math.imul(p,G)|0))<<13)|0;u=((i=i+Math.imul(p,H)|0)+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,o=Math.imul(g,U),n=(n=Math.imul(g,K))+Math.imul(b,U)|0,i=Math.imul(b,K),o=o+Math.imul(f,G)|0,n=(n=n+Math.imul(f,H)|0)+Math.imul(m,G)|0,i=i+Math.imul(m,H)|0;var be=(u+(o=o+Math.imul(d,W)|0)|0)+((8191&(n=(n=n+Math.imul(d,z)|0)+Math.imul(p,W)|0))<<13)|0;u=((i=i+Math.imul(p,z)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,o=Math.imul(w,U),n=(n=Math.imul(w,K))+Math.imul($,U)|0,i=Math.imul($,K),o=o+Math.imul(g,G)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(b,G)|0,i=i+Math.imul(b,H)|0,o=o+Math.imul(f,W)|0,n=(n=n+Math.imul(f,z)|0)+Math.imul(m,W)|0,i=i+Math.imul(m,z)|0;var ve=(u+(o=o+Math.imul(d,Q)|0)|0)+((8191&(n=(n=n+Math.imul(d,Y)|0)+Math.imul(p,Q)|0))<<13)|0;u=((i=i+Math.imul(p,Y)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,o=Math.imul(_,U),n=(n=Math.imul(_,K))+Math.imul(T,U)|0,i=Math.imul(T,K),o=o+Math.imul(w,G)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul($,G)|0,i=i+Math.imul($,H)|0,o=o+Math.imul(g,W)|0,n=(n=n+Math.imul(g,z)|0)+Math.imul(b,W)|0,i=i+Math.imul(b,z)|0,o=o+Math.imul(f,Q)|0,n=(n=n+Math.imul(f,Y)|0)+Math.imul(m,Q)|0,i=i+Math.imul(m,Y)|0;var we=(u+(o=o+Math.imul(d,J)|0)|0)+((8191&(n=(n=n+Math.imul(d,ee)|0)+Math.imul(p,J)|0))<<13)|0;u=((i=i+Math.imul(p,ee)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,o=Math.imul(A,U),n=(n=Math.imul(A,K))+Math.imul(O,U)|0,i=Math.imul(O,K),o=o+Math.imul(_,G)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(T,G)|0,i=i+Math.imul(T,H)|0,o=o+Math.imul(w,W)|0,n=(n=n+Math.imul(w,z)|0)+Math.imul($,W)|0,i=i+Math.imul($,z)|0,o=o+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(b,Q)|0,i=i+Math.imul(b,Y)|0,o=o+Math.imul(f,J)|0,n=(n=n+Math.imul(f,ee)|0)+Math.imul(m,J)|0,i=i+Math.imul(m,ee)|0;var $e=(u+(o=o+Math.imul(d,re)|0)|0)+((8191&(n=(n=n+Math.imul(d,oe)|0)+Math.imul(p,re)|0))<<13)|0;u=((i=i+Math.imul(p,oe)|0)+(n>>>13)|0)+($e>>>26)|0,$e&=67108863,o=Math.imul(S,U),n=(n=Math.imul(S,K))+Math.imul(R,U)|0,i=Math.imul(R,K),o=o+Math.imul(A,G)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(O,G)|0,i=i+Math.imul(O,H)|0,o=o+Math.imul(_,W)|0,n=(n=n+Math.imul(_,z)|0)+Math.imul(T,W)|0,i=i+Math.imul(T,z)|0,o=o+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul($,Q)|0,i=i+Math.imul($,Y)|0,o=o+Math.imul(g,J)|0,n=(n=n+Math.imul(g,ee)|0)+Math.imul(b,J)|0,i=i+Math.imul(b,ee)|0,o=o+Math.imul(f,re)|0,n=(n=n+Math.imul(f,oe)|0)+Math.imul(m,re)|0,i=i+Math.imul(m,oe)|0;var ke=(u+(o=o+Math.imul(d,ie)|0)|0)+((8191&(n=(n=n+Math.imul(d,ae)|0)+Math.imul(p,ie)|0))<<13)|0;u=((i=i+Math.imul(p,ae)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,o=Math.imul(C,U),n=(n=Math.imul(C,K))+Math.imul(P,U)|0,i=Math.imul(P,K),o=o+Math.imul(S,G)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,G)|0,i=i+Math.imul(R,H)|0,o=o+Math.imul(A,W)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(O,W)|0,i=i+Math.imul(O,z)|0,o=o+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(T,Q)|0,i=i+Math.imul(T,Y)|0,o=o+Math.imul(w,J)|0,n=(n=n+Math.imul(w,ee)|0)+Math.imul($,J)|0,i=i+Math.imul($,ee)|0,o=o+Math.imul(g,re)|0,n=(n=n+Math.imul(g,oe)|0)+Math.imul(b,re)|0,i=i+Math.imul(b,oe)|0,o=o+Math.imul(f,ie)|0,n=(n=n+Math.imul(f,ae)|0)+Math.imul(m,ie)|0,i=i+Math.imul(m,ae)|0;var _e=(u+(o=o+Math.imul(d,ce)|0)|0)+((8191&(n=(n=n+Math.imul(d,ue)|0)+Math.imul(p,ce)|0))<<13)|0;u=((i=i+Math.imul(p,ue)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,o=Math.imul(B,U),n=(n=Math.imul(B,K))+Math.imul(D,U)|0,i=Math.imul(D,K),o=o+Math.imul(C,G)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(P,G)|0,i=i+Math.imul(P,H)|0,o=o+Math.imul(S,W)|0,n=(n=n+Math.imul(S,z)|0)+Math.imul(R,W)|0,i=i+Math.imul(R,z)|0,o=o+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,Q)|0,i=i+Math.imul(O,Y)|0,o=o+Math.imul(_,J)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(T,J)|0,i=i+Math.imul(T,ee)|0,o=o+Math.imul(w,re)|0,n=(n=n+Math.imul(w,oe)|0)+Math.imul($,re)|0,i=i+Math.imul($,oe)|0,o=o+Math.imul(g,ie)|0,n=(n=n+Math.imul(g,ae)|0)+Math.imul(b,ie)|0,i=i+Math.imul(b,ae)|0,o=o+Math.imul(f,ce)|0,n=(n=n+Math.imul(f,ue)|0)+Math.imul(m,ce)|0,i=i+Math.imul(m,ue)|0;var Te=(u+(o=o+Math.imul(d,de)|0)|0)+((8191&(n=(n=n+Math.imul(d,pe)|0)+Math.imul(p,de)|0))<<13)|0;u=((i=i+Math.imul(p,pe)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,o=Math.imul(L,U),n=(n=Math.imul(L,K))+Math.imul(j,U)|0,i=Math.imul(j,K),o=o+Math.imul(B,G)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(D,G)|0,i=i+Math.imul(D,H)|0,o=o+Math.imul(C,W)|0,n=(n=n+Math.imul(C,z)|0)+Math.imul(P,W)|0,i=i+Math.imul(P,z)|0,o=o+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(R,Q)|0,i=i+Math.imul(R,Y)|0,o=o+Math.imul(A,J)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(O,J)|0,i=i+Math.imul(O,ee)|0,o=o+Math.imul(_,re)|0,n=(n=n+Math.imul(_,oe)|0)+Math.imul(T,re)|0,i=i+Math.imul(T,oe)|0,o=o+Math.imul(w,ie)|0,n=(n=n+Math.imul(w,ae)|0)+Math.imul($,ie)|0,i=i+Math.imul($,ae)|0,o=o+Math.imul(g,ce)|0,n=(n=n+Math.imul(g,ue)|0)+Math.imul(b,ce)|0,i=i+Math.imul(b,ue)|0,o=o+Math.imul(f,de)|0,n=(n=n+Math.imul(f,pe)|0)+Math.imul(m,de)|0,i=i+Math.imul(m,pe)|0;var Ie=(u+(o=o+Math.imul(d,fe)|0)|0)+((8191&(n=(n=n+Math.imul(d,me)|0)+Math.imul(p,fe)|0))<<13)|0;u=((i=i+Math.imul(p,me)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,o=Math.imul(L,G),n=(n=Math.imul(L,H))+Math.imul(j,G)|0,i=Math.imul(j,H),o=o+Math.imul(B,W)|0,n=(n=n+Math.imul(B,z)|0)+Math.imul(D,W)|0,i=i+Math.imul(D,z)|0,o=o+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,Y)|0,o=o+Math.imul(S,J)|0,n=(n=n+Math.imul(S,ee)|0)+Math.imul(R,J)|0,i=i+Math.imul(R,ee)|0,o=o+Math.imul(A,re)|0,n=(n=n+Math.imul(A,oe)|0)+Math.imul(O,re)|0,i=i+Math.imul(O,oe)|0,o=o+Math.imul(_,ie)|0,n=(n=n+Math.imul(_,ae)|0)+Math.imul(T,ie)|0,i=i+Math.imul(T,ae)|0,o=o+Math.imul(w,ce)|0,n=(n=n+Math.imul(w,ue)|0)+Math.imul($,ce)|0,i=i+Math.imul($,ue)|0,o=o+Math.imul(g,de)|0,n=(n=n+Math.imul(g,pe)|0)+Math.imul(b,de)|0,i=i+Math.imul(b,pe)|0;var Ae=(u+(o=o+Math.imul(f,fe)|0)|0)+((8191&(n=(n=n+Math.imul(f,me)|0)+Math.imul(m,fe)|0))<<13)|0;u=((i=i+Math.imul(m,me)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,o=Math.imul(L,W),n=(n=Math.imul(L,z))+Math.imul(j,W)|0,i=Math.imul(j,z),o=o+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(D,Q)|0,i=i+Math.imul(D,Y)|0,o=o+Math.imul(C,J)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(P,J)|0,i=i+Math.imul(P,ee)|0,o=o+Math.imul(S,re)|0,n=(n=n+Math.imul(S,oe)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,oe)|0,o=o+Math.imul(A,ie)|0,n=(n=n+Math.imul(A,ae)|0)+Math.imul(O,ie)|0,i=i+Math.imul(O,ae)|0,o=o+Math.imul(_,ce)|0,n=(n=n+Math.imul(_,ue)|0)+Math.imul(T,ce)|0,i=i+Math.imul(T,ue)|0,o=o+Math.imul(w,de)|0,n=(n=n+Math.imul(w,pe)|0)+Math.imul($,de)|0,i=i+Math.imul($,pe)|0;var Oe=(u+(o=o+Math.imul(g,fe)|0)|0)+((8191&(n=(n=n+Math.imul(g,me)|0)+Math.imul(b,fe)|0))<<13)|0;u=((i=i+Math.imul(b,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,o=Math.imul(L,Q),n=(n=Math.imul(L,Y))+Math.imul(j,Q)|0,i=Math.imul(j,Y),o=o+Math.imul(B,J)|0,n=(n=n+Math.imul(B,ee)|0)+Math.imul(D,J)|0,i=i+Math.imul(D,ee)|0,o=o+Math.imul(C,re)|0,n=(n=n+Math.imul(C,oe)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,oe)|0,o=o+Math.imul(S,ie)|0,n=(n=n+Math.imul(S,ae)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,ae)|0,o=o+Math.imul(A,ce)|0,n=(n=n+Math.imul(A,ue)|0)+Math.imul(O,ce)|0,i=i+Math.imul(O,ue)|0,o=o+Math.imul(_,de)|0,n=(n=n+Math.imul(_,pe)|0)+Math.imul(T,de)|0,i=i+Math.imul(T,pe)|0;var Ee=(u+(o=o+Math.imul(w,fe)|0)|0)+((8191&(n=(n=n+Math.imul(w,me)|0)+Math.imul($,fe)|0))<<13)|0;u=((i=i+Math.imul($,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,o=Math.imul(L,J),n=(n=Math.imul(L,ee))+Math.imul(j,J)|0,i=Math.imul(j,ee),o=o+Math.imul(B,re)|0,n=(n=n+Math.imul(B,oe)|0)+Math.imul(D,re)|0,i=i+Math.imul(D,oe)|0,o=o+Math.imul(C,ie)|0,n=(n=n+Math.imul(C,ae)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,ae)|0,o=o+Math.imul(S,ce)|0,n=(n=n+Math.imul(S,ue)|0)+Math.imul(R,ce)|0,i=i+Math.imul(R,ue)|0,o=o+Math.imul(A,de)|0,n=(n=n+Math.imul(A,pe)|0)+Math.imul(O,de)|0,i=i+Math.imul(O,pe)|0;var Se=(u+(o=o+Math.imul(_,fe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(T,fe)|0))<<13)|0;u=((i=i+Math.imul(T,me)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,o=Math.imul(L,re),n=(n=Math.imul(L,oe))+Math.imul(j,re)|0,i=Math.imul(j,oe),o=o+Math.imul(B,ie)|0,n=(n=n+Math.imul(B,ae)|0)+Math.imul(D,ie)|0,i=i+Math.imul(D,ae)|0,o=o+Math.imul(C,ce)|0,n=(n=n+Math.imul(C,ue)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,ue)|0,o=o+Math.imul(S,de)|0,n=(n=n+Math.imul(S,pe)|0)+Math.imul(R,de)|0,i=i+Math.imul(R,pe)|0;var Re=(u+(o=o+Math.imul(A,fe)|0)|0)+((8191&(n=(n=n+Math.imul(A,me)|0)+Math.imul(O,fe)|0))<<13)|0;u=((i=i+Math.imul(O,me)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,o=Math.imul(L,ie),n=(n=Math.imul(L,ae))+Math.imul(j,ie)|0,i=Math.imul(j,ae),o=o+Math.imul(B,ce)|0,n=(n=n+Math.imul(B,ue)|0)+Math.imul(D,ce)|0,i=i+Math.imul(D,ue)|0,o=o+Math.imul(C,de)|0,n=(n=n+Math.imul(C,pe)|0)+Math.imul(P,de)|0,i=i+Math.imul(P,pe)|0;var xe=(u+(o=o+Math.imul(S,fe)|0)|0)+((8191&(n=(n=n+Math.imul(S,me)|0)+Math.imul(R,fe)|0))<<13)|0;u=((i=i+Math.imul(R,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,o=Math.imul(L,ce),n=(n=Math.imul(L,ue))+Math.imul(j,ce)|0,i=Math.imul(j,ue),o=o+Math.imul(B,de)|0,n=(n=n+Math.imul(B,pe)|0)+Math.imul(D,de)|0,i=i+Math.imul(D,pe)|0;var Ce=(u+(o=o+Math.imul(C,fe)|0)|0)+((8191&(n=(n=n+Math.imul(C,me)|0)+Math.imul(P,fe)|0))<<13)|0;u=((i=i+Math.imul(P,me)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,o=Math.imul(L,de),n=(n=Math.imul(L,pe))+Math.imul(j,de)|0,i=Math.imul(j,pe);var Pe=(u+(o=o+Math.imul(B,fe)|0)|0)+((8191&(n=(n=n+Math.imul(B,me)|0)+Math.imul(D,fe)|0))<<13)|0;u=((i=i+Math.imul(D,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Ne=(u+(o=Math.imul(L,fe))|0)+((8191&(n=(n=Math.imul(L,me))+Math.imul(j,fe)|0))<<13)|0;return u=((i=Math.imul(j,me))+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=ye,c[1]=ge,c[2]=be,c[3]=ve,c[4]=we,c[5]=$e,c[6]=ke,c[7]=_e,c[8]=Te,c[9]=Ie,c[10]=Ae,c[11]=Oe,c[12]=Ee,c[13]=Se,c[14]=Re,c[15]=xe,c[16]=Ce,c[17]=Pe,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function f(e,t,r){return(new m).mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(h=p),n.prototype.mulTo=function(e,t){var r,o=this.length+e.length;return r=10===this.length&&10===e.length?h(this,e,t):o<63?p(this,e,t):o<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var o=0,n=0,i=0;i<r.length-1;i++){var a=n;n=0;for(var s=67108863&o,c=Math.min(i,t.length-1),u=Math.max(0,i-e.length+1);u<=c;u++){var l=i-u,d=(0|e.words[l])*(0|t.words[u]),p=67108863&d;s=67108863&(p=p+s|0),n+=(a=(a=a+(d/67108864|0)|0)+(p>>>26)|0)>>>26,a&=67108863}r.words[i]=s,o=a,a=n}return 0!==o?r.words[i]=o:r.length--,r.strip()}(this,e,t):f(this,e,t),r},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=n.prototype._countBits(e)-1,o=0;o<e;o++)t[o]=this.revBin(o,r,e);return t},m.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var o=0,n=0;n<t;n++)o|=(1&e)<<t-n-1,e>>=1;return o},m.prototype.permute=function(e,t,r,o,n,i){for(var a=0;a<i;a++)o[a]=t[e[a]],n[a]=r[e[a]]},m.prototype.transform=function(e,t,r,o,n,i){this.permute(i,e,t,r,o,n);for(var a=1;a<n;a<<=1)for(var s=a<<1,c=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),l=0;l<n;l+=s)for(var d=c,p=u,h=0;h<a;h++){var f=r[l+h],m=o[l+h],y=r[l+h+a],g=o[l+h+a],b=d*y-p*g;g=d*g+p*y,y=b,r[l+h]=f+y,o[l+h]=m+g,r[l+h+a]=f-y,o[l+h+a]=m-g,h!==s&&(b=c*d-u*p,p=c*p+u*d,d=b)}},m.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),o=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+o},m.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var o=0;o<r/2;o++){var n=e[o];e[o]=e[r-o-1],e[r-o-1]=n,n=t[o],t[o]=-t[r-o-1],t[r-o-1]=-n}},m.prototype.normalize13b=function(e,t){for(var r=0,o=0;o<t/2;o++){var n=8192*Math.round(e[2*o+1]/t)+Math.round(e[2*o]/t)+r;e[o]=67108863&n,r=n<67108864?0:n/67108864|0}return e},m.prototype.convert13b=function(e,t,o,n){for(var i=0,a=0;a<t;a++)i+=0|e[a],o[2*a]=8191&i,i>>>=13,o[2*a+1]=8191&i,i>>>=13;for(a=2*t;a<n;++a)o[a]=0;r(0===i),r(!(-8192&i))},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 o=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(o),i=this.stub(o),a=new Array(o),s=new Array(o),c=new Array(o),u=new Array(o),l=new Array(o),d=new Array(o),p=r.words;p.length=o,this.convert13b(e.words,e.length,a,o),this.convert13b(t.words,t.length,u,o),this.transform(a,i,s,c,o,n),this.transform(u,i,l,d,o,n);for(var h=0;h<o;h++){var f=s[h]*l[h]-c[h]*d[h];c[h]=s[h]*d[h]+c[h]*l[h],s[h]=f}return this.conjugate(s,c,o),this.transform(s,c,p,i,o,n),this.conjugate(p,i,o),this.normalize13b(p,o),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},n.prototype.mul=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},n.prototype.mulf=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),f(this,e,t)},n.prototype.imul=function(e){return this.clone().mulTo(e,this)},n.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,o=0;o<this.length;o++){var n=(0|this.words[o])*e,i=(67108863&n)+(67108863&t);t>>=26,t+=n/67108864|0,t+=i>>>26,this.words[o]=67108863&i}return 0!==t&&(this.words[o]=t,this.length++),this},n.prototype.muln=function(e){return this.clone().imuln(e)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var o=r/26|0,n=r%26;t[r]=(e.words[o]&1<<n)>>>n}return t}(e);if(0===t.length)return new n(1);for(var r=this,o=0;o<t.length&&0===t[o];o++,r=r.sqr());if(++o<t.length)for(var i=r.sqr();o<t.length;o++,i=i.sqr())0!==t[o]&&(r=r.mul(i));return r},n.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,o=e%26,n=(e-o)/26,i=67108863>>>26-o<<26-o;if(0!==o){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&i,c=(0|this.words[t])-s<<o;this.words[t]=c|a,a=s>>>26-o}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()},n.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},n.prototype.iushrn=function(e,t,o){var n;r("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var i=e%26,a=Math.min((e-i)/26,this.length),s=67108863^67108863>>>i<<i,c=o;if(n-=a,n=Math.max(0,n),c){for(var u=0;u<a;u++)c.words[u]=this.words[u];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var d=0|this.words[u];this.words[u]=l<<26-i|d>>>i,l=d&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(e,t,o){return r(0===this.negative),this.iushrn(e,t,o)},n.prototype.shln=function(e){return this.clone().ishln(e)},n.prototype.ushln=function(e){return this.clone().iushln(e)},n.prototype.shrn=function(e){return this.clone().ishrn(e)},n.prototype.ushrn=function(e){return this.clone().iushrn(e)},n.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26,n=1<<t;return!(this.length<=o)&&!!(this.words[o]&n)},n.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=o)return this;if(0!==t&&o++,this.length=Math.min(o,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(e){return this.clone().imaskn(e)},n.prototype.iaddn=function(e){return r("number"==typeof e),r(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)},n.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},n.prototype.isubn=function(e){if(r("number"==typeof e),r(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()},n.prototype.addn=function(e){return this.clone().iaddn(e)},n.prototype.subn=function(e){return this.clone().isubn(e)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(e,t,o){var n,i,a=e.length+o;this._expand(a);var s=0;for(n=0;n<e.length;n++){i=(0|this.words[n+o])+s;var c=(0|e.words[n])*t;s=((i-=67108863&c)>>26)-(c/67108864|0),this.words[n+o]=67108863&i}for(;n<this.length-o;n++)s=(i=(0|this.words[n+o])+s)>>26,this.words[n+o]=67108863&i;if(0===s)return this.strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(i=-(0|this.words[n])+s)>>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},n.prototype._wordDiv=function(e,t){var r=(this.length,e.length),o=this.clone(),i=e,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),o.iushln(r),a=0|i.words[i.length-1]);var s,c=o.length-i.length;if("mod"!==t){(s=new n(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=o.clone()._ishlnsubmul(i,1,c);0===l.negative&&(o=l,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var p=67108864*(0|o.words[i.length+d])+(0|o.words[i.length+d-1]);for(p=Math.min(p/a|0,67108863),o._ishlnsubmul(i,p,d);0!==o.negative;)p--,o.negative=0,o._ishlnsubmul(i,1,d),o.isZero()||(o.negative^=1);s&&(s.words[d]=p)}return s&&s.strip(),o.strip(),"div"!==t&&0!==r&&o.iushrn(r),{div:s||null,mod:o}},n.prototype.divmod=function(e,t,o){return r(!e.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new n(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new n(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new n(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},n.prototype.div=function(e){return this.divmod(e,"div",!1).div},n.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},n.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},n.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,o=e.ushrn(1),n=e.andln(1),i=r.cmp(o);return i<0||1===n&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},n.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,o=0,n=this.length-1;n>=0;n--)o=(t*o+(0|this.words[n]))%e;return o},n.prototype.idivn=function(e){r(e<=67108863);for(var t=0,o=this.length-1;o>=0;o--){var n=(0|this.words[o])+67108864*t;this.words[o]=n/e|0,t=n%e}return this.strip()},n.prototype.divn=function(e){return this.clone().idivn(e)},n.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new n(1),a=new n(0),s=new n(0),c=new n(1),u=0;t.isEven()&&o.isEven();)t.iushrn(1),o.iushrn(1),++u;for(var l=o.clone(),d=t.clone();!t.isZero();){for(var p=0,h=1;!(t.words[0]&h)&&p<26;++p,h<<=1);if(p>0)for(t.iushrn(p);p-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var f=0,m=1;!(o.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(o.iushrn(f);f-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(o)>=0?(t.isub(o),i.isub(s),a.isub(c)):(o.isub(t),s.isub(i),c.isub(a))}return{a:s,b:c,gcd:o.iushln(u)}},n.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new n(1),s=new n(0),c=o.clone();t.cmpn(1)>0&&o.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,p=1;!(o.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(o.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(o)>=0?(t.isub(o),a.isub(s)):(o.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},n.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 o=0;t.isEven()&&r.isEven();o++)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 i=t;t=r,r=i}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(o)},n.prototype.invm=function(e){return this.egcd(e).a.umod(e)},n.prototype.isEven=function(){return!(1&this.words[0])},n.prototype.isOdd=function(){return!(1&~this.words[0])},n.prototype.andln=function(e){return this.words[0]&e},n.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,o=(e-t)/26,n=1<<t;if(this.length<=o)return this._expand(o+1),this.words[o]|=n,this;for(var i=n,a=o;0!==i&&a<this.length;a++){var s=0|this.words[a];i=(s+=i)>>>26,s&=67108863,this.words[a]=s}return 0!==i&&(this.words[a]=i,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(e){var t,o=e<0;if(0!==this.negative&&!o)return-1;if(0===this.negative&&o)return 1;if(this.strip(),this.length>1)t=1;else{o&&(e=-e),r(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},n.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},n.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 o=0|this.words[r],n=0|e.words[r];if(o!==n){o<n?t=-1:o>n&&(t=1);break}}return t},n.prototype.gtn=function(e){return 1===this.cmpn(e)},n.prototype.gt=function(e){return 1===this.cmp(e)},n.prototype.gten=function(e){return this.cmpn(e)>=0},n.prototype.gte=function(e){return this.cmp(e)>=0},n.prototype.ltn=function(e){return-1===this.cmpn(e)},n.prototype.lt=function(e){return-1===this.cmp(e)},n.prototype.lten=function(e){return this.cmpn(e)<=0},n.prototype.lte=function(e){return this.cmp(e)<=0},n.prototype.eqn=function(e){return 0===this.cmpn(e)},n.prototype.eq=function(e){return 0===this.cmp(e)},n.red=function(e){return new k(e)},n.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(e){return this.red=e,this},n.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},n.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},n.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},n.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},n.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},n.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},n.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},n.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function g(e,t){this.name=e,this.p=new n(t,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function $(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(e){if("string"==typeof e){var t=n._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function _(e){k.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}g.prototype._tmp=function(){var e=new n(null);return e.words=new Array(Math.ceil(this.n/13)),e},g.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 o=t<this.n?-1:r.ucmp(this.p);return 0===o?(r.words[0]=0,r.length=1):o>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(e,t){e.iushrn(this.n,0,t)},g.prototype.imulK=function(e){return e.imul(this.k)},o(b,g),b.prototype.split=function(e,t){for(var r=4194303,o=Math.min(e.length,9),n=0;n<o;n++)t.words[n]=e.words[n];if(t.length=o,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=i&r,n=10;n<e.length;n++){var a=0|e.words[n];e.words[n-10]=(a&r)<<4|i>>>22,i=a}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},b.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 o=0|e.words[r];t+=977*o,e.words[r]=67108863&t,t=64*o+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},o(v,g),o(w,g),o($,g),$.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var o=19*(0|e.words[r])+t,n=67108863&o;o>>>=26,e.words[r]=n,t=o}return 0!==t&&(e.words[e.length++]=t),e},n._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new $}return y[e]=t,t},k.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},k.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},k.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},k.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},k.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},k.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},k.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},k.prototype.isqr=function(e){return this.imul(e,e.clone())},k.prototype.sqr=function(e){return this.mul(e,e)},k.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var o=this.m.add(new n(1)).iushrn(2);return this.pow(e,o)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new n(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),p=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),f=a;0!==h.cmp(s);){for(var m=h,y=0;0!==m.cmp(s);y++)m=m.redSqr();r(y<f);var g=this.pow(d,new n(1).iushln(f-y-1));p=p.redMul(g),d=g.redSqr(),h=h.redMul(d),f=y}return p},k.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},k.prototype.pow=function(e,t){if(t.isZero())return new n(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=e;for(var o=2;o<r.length;o++)r[o]=this.mul(r[o-1],e);var i=r[0],a=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),o=t.length-1;o>=0;o--){for(var u=t.words[o],l=c-1;l>=0;l--){var d=u>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4===++s||0===o&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}c=26}return i},k.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},k.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},n.mont=function(e){return new _(e)},o(_,k),_.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},_.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},_.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(o).iushrn(this.shift),i=n;return n.cmp(this.m)>=0?i=n.isub(this.m):n.cmpn(0)<0&&(i=n.iadd(this.m)),i._forceRed(this)},_.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new n(0)._forceRed(this);var r=e.mul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(o).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},_.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,commonjsGlobal)}(bn$2)),bn$2.exports}bn$2.exports;var api$1={},vmBrowserify={},hasRequiredVmBrowserify,hasRequiredApi;function requireVmBrowserify(){return hasRequiredVmBrowserify||(hasRequiredVmBrowserify=1,function(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,o=r.eval,n=r.execScript;!o&&n&&(n.call(r,"null"),o=r.eval),forEach(Object_keys(e),(function(t){r[t]=e[t]})),forEach(globals,(function(t){e[t]&&(r[t]=e[t])}));var i=Object_keys(r),a=o.call(r,this.code);return forEach(Object_keys(r),(function(t){(t in e||-1===indexOf(i,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}}(vmBrowserify)),vmBrowserify}function requireApi(){return hasRequiredApi||(hasRequiredApi=1,function(e){var t=requireAsn1$1(),r=inherits_browserExports;function o(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}e.define=function(e,t){return new o(e,t)},o.prototype._createNamed=function(e){var t;try{t=requireVmBrowserify().runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(o){t=function(e){this._initNamed(e)}}return r(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(t.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(t.encoders[e])),this.encoders[e]},o.prototype.encode=function(e,t,r){return this._getEncoder(t).encode(e,r)}}(api$1)),api$1}var base={},reporter={},hasRequiredReporter;function requireReporter(){if(hasRequiredReporter)return reporter;hasRequiredReporter=1;var e=inherits_browserExports;function t(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function r(e,t){this.path=e,this.rethrow(t)}return reporter.Reporter=t,t.prototype.isError=function(e){return e instanceof r},t.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},t.prototype.restore=function(e){var t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},t.prototype.enterKey=function(e){return this._reporterState.path.push(e)},t.prototype.exitKey=function(e){var t=this._reporterState;t.path=t.path.slice(0,e-1)},t.prototype.leaveKey=function(e,t,r){var o=this._reporterState;this.exitKey(e),null!==o.obj&&(o.obj[t]=r)},t.prototype.path=function(){return this._reporterState.path.join("/")},t.prototype.enterObject=function(){var e=this._reporterState,t=e.obj;return e.obj={},t},t.prototype.leaveObject=function(e){var t=this._reporterState,r=t.obj;return t.obj=e,r},t.prototype.error=function(e){var t,o=this._reporterState,n=e instanceof r;if(t=n?e:new r(o.path.map((function(e){return"["+JSON.stringify(e)+"]"})).join(""),e.message||e,e.stack),!o.options.partial)throw t;return n||o.errors.push(t),t},t.prototype.wrapResult=function(e){var t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},e(r,Error),r.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,r),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this},reporter}var buffer$1={},hasRequiredBuffer,node,hasRequiredNode,hasRequiredBase;function requireBuffer(){if(hasRequiredBuffer)return buffer$1;hasRequiredBuffer=1;var e=inherits_browserExports,t=requireBase().Reporter,r=require$$0$2.Buffer;function o(e,o){t.call(this,o),r.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function n(e,t){if(Array.isArray(e))this.length=0,this.value=e.map((function(e){return e instanceof n||(e=new n(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=r.byteLength(e);else{if(!r.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}return e(o,t),buffer$1.DecoderBuffer=o,o.prototype.save=function(){return{offset:this.offset,reporter:t.prototype.save.call(this)}},o.prototype.restore=function(e){var r=new o(this.base);return r.offset=e.offset,r.length=this.offset,this.offset=e.offset,t.prototype.restore.call(this,e.reporter),r},o.prototype.isEmpty=function(){return this.offset===this.length},o.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},o.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");var r=new o(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},o.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},buffer$1.EncoderBuffer=n,n.prototype.join=function(e,t){return e||(e=new r(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):r.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length)),e},buffer$1}function requireNode(){if(hasRequiredNode)return node;hasRequiredNode=1;var e=requireBase().Reporter,t=requireBase().EncoderBuffer,r=requireBase().DecoderBuffer,o=minimalisticAssert,n=["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"],i=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(n);function a(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())}node=a;var s=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];return a.prototype.clone=function(){var e=this._baseState,t={};s.forEach((function(r){t[r]=e[r]}));var r=new this.constructor(t.parent);return r._baseState=t,r},a.prototype._wrap=function(){var e=this._baseState;i.forEach((function(t){this[t]=function(){var r=new this.constructor(this);return e.children.push(r),r[t].apply(r,arguments)}}),this)},a.prototype._init=function(e){var t=this._baseState;o(null===t.parent),e.call(this),t.children=t.children.filter((function(e){return e._baseState.parent===this}),this),o.equal(t.children.length,1,"Root node can have only one child")},a.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&&(o(null===t.children),t.children=r,r.forEach((function(e){e._baseState.parent=this}),this)),0!==e.length&&(o(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 o=e[r];t[o]=r})),t})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(e){a.prototype[e]=function(){var t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}})),n.forEach((function(e){a.prototype[e]=function(){var t=this._baseState,r=Array.prototype.slice.call(arguments);return o(null===t.tag),t.tag=e,this._useArgs(r),this}})),a.prototype.use=function(e){o(e);var t=this._baseState;return o(null===t.use),t.use=e,this},a.prototype.optional=function(){return this._baseState.optional=!0,this},a.prototype.def=function(e){var t=this._baseState;return o(null===t.default),t.default=e,t.optional=!0,this},a.prototype.explicit=function(e){var t=this._baseState;return o(null===t.explicit&&null===t.implicit),t.explicit=e,this},a.prototype.implicit=function(e){var t=this._baseState;return o(null===t.explicit&&null===t.implicit),t.implicit=e,this},a.prototype.obj=function(){var e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},a.prototype.key=function(e){var t=this._baseState;return o(null===t.key),t.key=e,this},a.prototype.any=function(){return this._baseState.any=!0,this},a.prototype.choice=function(e){var t=this._baseState;return o(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map((function(t){return e[t]}))),this},a.prototype.contains=function(e){var t=this._baseState;return o(null===t.use),t.contains=e,this},a.prototype._decode=function(e,t){var o=this._baseState;if(null===o.parent)return e.wrapResult(o.children[0]._decode(e,t));var n,i=o.default,a=!0,s=null;if(null!==o.key&&(s=e.enterKey(o.key)),o.optional){var c=null;if(null!==o.explicit?c=o.explicit:null!==o.implicit?c=o.implicit:null!==o.tag&&(c=o.tag),null!==c||o.any){if(a=this._peekTag(e,c,o.any),e.isError(a))return a}else{var u=e.save();try{null===o.choice?this._decodeGeneric(o.tag,e,t):this._decodeChoice(e,t),a=!0}catch(f){a=!1}e.restore(u)}}if(o.obj&&a&&(n=e.enterObject()),a){if(null!==o.explicit){var l=this._decodeTag(e,o.explicit);if(e.isError(l))return l;e=l}var d=e.offset;if(null===o.use&&null===o.choice){if(o.any)u=e.save();var p=this._decodeTag(e,null!==o.implicit?o.implicit:o.tag,o.any);if(e.isError(p))return p;o.any?i=e.raw(u):e=p}if(t&&t.track&&null!==o.tag&&t.track(e.path(),d,e.length,"tagged"),t&&t.track&&null!==o.tag&&t.track(e.path(),e.offset,e.length,"content"),o.any||(i=null===o.choice?this._decodeGeneric(o.tag,e,t):this._decodeChoice(e,t)),e.isError(i))return i;if(o.any||null!==o.choice||null===o.children||o.children.forEach((function(r){r._decode(e,t)})),o.contains&&("octstr"===o.tag||"bitstr"===o.tag)){var h=new r(i);i=this._getUse(o.contains,e._reporterState.obj)._decode(h,t)}}return o.obj&&a&&(i=e.leaveObject(n)),null===o.key||null===i&&!0!==a?null!==s&&e.exitKey(s):e.leaveKey(s,o.key,i),i},a.prototype._decodeGeneric=function(e,t,r){var o=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,o.args[0],r):/str$/.test(e)?this._decodeStr(t,e,r):"objid"===e&&o.args?this._decodeObjid(t,o.args[0],o.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,o.args&&o.args[0],r):null!==o.use?this._getUse(o.use,t._reporterState.obj)._decode(t,r):t.error("unknown tag: "+e)},a.prototype._getUse=function(e,t){var r=this._baseState;return r.useDecoder=this._use(e,t),o(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},a.prototype._decodeChoice=function(e,t){var r=this._baseState,o=null,n=!1;return Object.keys(r.choice).some((function(i){var a=e.save(),s=r.choice[i];try{var c=s._decode(e,t);if(e.isError(c))return!1;o={type:i,value:c},n=!0}catch(u){return e.restore(a),!1}return!0}),this),n?o:e.error("Choice not matched")},a.prototype._createEncoderBuffer=function(e){return new t(e,this.reporter)},a.prototype._encode=function(e,t,r){var o=this._baseState;if(null===o.default||o.default!==e){var n=this._encodeValue(e,t,r);if(void 0!==n&&!this._skipDefault(n,t,r))return n}},a.prototype._encodeValue=function(t,r,o){var n=this._baseState;if(null===n.parent)return n.children[0]._encode(t,r||new e);var i=null;if(this.reporter=r,n.optional&&void 0===t){if(null===n.default)return;t=n.default}var a=null,s=!1;if(n.any)i=this._createEncoderBuffer(t);else if(n.choice)i=this._encodeChoice(t,r);else if(n.contains)a=this._getUse(n.contains,o)._encode(t,r),s=!0;else if(n.children)a=n.children.map((function(e){if("null_"===e._baseState.tag)return e._encode(null,r,t);if(null===e._baseState.key)return r.error("Child should have a key");var o=r.enterKey(e._baseState.key);if("object"!=typeof t)return r.error("Child expected, but input is not object");var n=e._encode(t[e._baseState.key],r,t);return r.leaveKey(o),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 r.error("Too many args for : "+n.tag);if(!Array.isArray(t))return r.error("seqof/setof, but data is not Array");var c=this.clone();c._baseState.implicit=null,a=this._createEncoderBuffer(t.map((function(e){var o=this._baseState;return this._getUse(o.args[0],t)._encode(e,r)}),c))}else null!==n.use?i=this._getUse(n.use,o)._encode(t,r):(a=this._encodePrimitive(n.tag,t),s=!0);if(!n.any&&null===n.choice){var u=null!==n.implicit?n.implicit:n.tag,l=null===n.implicit?"universal":"context";null===u?null===n.use&&r.error("Tag could be omitted only for .use()"):null===n.use&&(i=this._encodeComposite(u,s,l,a))}return null!==n.explicit&&(i=this._encodeComposite(n.explicit,!1,"context",i)),i},a.prototype._encodeChoice=function(e,t){var r=this._baseState,n=r.choice[e.type];return n||o(!1,e.type+" not found in "+JSON.stringify(Object.keys(r.choice))),n._encode(e.value,t)},a.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)},a.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},a.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e)},node}function requireBase(){return hasRequiredBase||(hasRequiredBase=1,function(e){var t=e;t.Reporter=requireReporter().Reporter,t.DecoderBuffer=requireBuffer().DecoderBuffer,t.EncoderBuffer=requireBuffer().EncoderBuffer,t.Node=requireNode()}(base)),base}var constants={},der={},hasRequiredDer$2,hasRequiredConstants;function requireDer$2(){return hasRequiredDer$2||(hasRequiredDer$2=1,function(e){var t=requireConstants();e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=t._reverse(e.tagClass),e.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"},e.tagByName=t._reverse(e.tag)}(der)),der}function requireConstants(){return hasRequiredConstants||(hasRequiredConstants=1,function(e){var t=e;t._reverse=function(e){var t={};return Object.keys(e).forEach((function(r){(0|r)==r&&(r|=0);var o=e[r];t[o]=r})),t},t.der=requireDer$2()}(constants)),constants}var decoders={},der_1$1,hasRequiredDer$1,pem$3,hasRequiredPem$1,hasRequiredDecoders;function requireDer$1(){if(hasRequiredDer$1)return der_1$1;hasRequiredDer$1=1;var e=inherits_browserExports,t=requireAsn1$1(),r=t.base,o=t.bignum,n=t.constants.der;function i(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new a,this.tree._init(e.body)}function a(e){r.Node.call(this,"der",e)}function s(e,t){var r=e.readUInt8(t);if(e.isError(r))return r;var o=n.tagClass[r>>6],i=!(32&r);if(31&~r)r&=31;else{var a=r;for(r=0;!(128&~a);){if(a=e.readUInt8(t),e.isError(a))return a;r<<=7,r|=127&a}}return{cls:o,primitive:i,tag:r,tagStr:n.tag[r]}}function c(e,t,r){var o=e.readUInt8(r);if(e.isError(o))return o;if(!t&&128===o)return null;if(!(128&o))return o;var n=127&o;if(n>4)return e.error("length octect is too long");o=0;for(var i=0;i<n;i++){o<<=8;var a=e.readUInt8(r);if(e.isError(a))return a;o|=a}return o}return der_1$1=i,i.prototype.decode=function(e,t){return e instanceof r.DecoderBuffer||(e=new r.DecoderBuffer(e,t)),this.tree._decode(e,t)},e(a,r.Node),a.prototype._peekTag=function(e,t,r){if(e.isEmpty())return!1;var o=e.save(),n=s(e,'Failed to peek tag: "'+t+'"');return e.isError(n)?n:(e.restore(o),n.tag===t||n.tagStr===t||n.tagStr+"of"===t||r)},a.prototype._decodeTag=function(e,t,r){var o=s(e,'Failed to decode tag of "'+t+'"');if(e.isError(o))return o;var n=c(e,o.primitive,'Failed to get length of "'+t+'"');if(e.isError(n))return n;if(!r&&o.tag!==t&&o.tagStr!==t&&o.tagStr+"of"!==t)return e.error('Failed to match tag: "'+t+'"');if(o.primitive||null!==n)return e.skip(n,'Failed to match body of: "'+t+'"');var i=e.save(),a=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(a)?a:(n=e.offset-i.offset,e.restore(i),e.skip(n,'Failed to match body of: "'+t+'"'))},a.prototype._skipUntilEnd=function(e,t){for(;;){var r=s(e,t);if(e.isError(r))return r;var o,n=c(e,r.primitive,t);if(e.isError(n))return n;if(o=r.primitive||null!==n?e.skip(n):this._skipUntilEnd(e,t),e.isError(o))return o;if("end"===r.tagStr)break}},a.prototype._decodeList=function(e,t,r,o){for(var n=[];!e.isEmpty();){var i=this._peekTag(e,"end");if(e.isError(i))return i;var a=r.decode(e,"der",o);if(e.isError(a)&&i)break;n.push(a)}return n},a.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 o=e.raw();if(o.length%2==1)return e.error("Decoding of string type: bmpstr length mismatch");for(var n="",i=0;i<o.length/2;i++)n+=String.fromCharCode(o.readUInt16BE(2*i));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")},a.prototype._decodeObjid=function(e,t,r){for(var o,n=[],i=0;!e.isEmpty();){var a=e.readUInt8();i<<=7,i|=127&a,128&a||(n.push(i),i=0)}128&a&&n.push(i);var s=n[0]/40|0,c=n[0]%40;if(o=r?n:[s,c].concat(n.slice(1)),t){var u=t[o.join(" ")];void 0===u&&(u=t[o.join(".")]),void 0!==u&&(o=u)}return o},a.prototype._decodeTime=function(e,t){var r=e.raw().toString();if("gentime"===t)var o=0|r.slice(0,4),n=0|r.slice(4,6),i=0|r.slice(6,8),a=0|r.slice(8,10),s=0|r.slice(10,12),c=0|r.slice(12,14);else{if("utctime"!==t)return e.error("Decoding "+t+" time is not supported yet");o=0|r.slice(0,2),n=0|r.slice(2,4),i=0|r.slice(4,6),a=0|r.slice(6,8),s=0|r.slice(8,10),c=0|r.slice(10,12);o=o<70?2e3+o:1900+o}return Date.UTC(o,n-1,i,a,s,c,0)},a.prototype._decodeNull=function(e){return null},a.prototype._decodeBool=function(e){var t=e.readUInt8();return e.isError(t)?t:0!==t},a.prototype._decodeInt=function(e,t){var r=e.raw(),n=new o(r);return t&&(n=t[n.toString(10)]||n),n},a.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree},der_1$1}function requirePem$1(){if(hasRequiredPem$1)return pem$3;hasRequiredPem$1=1;var e=inherits_browserExports,t=require$$0$2.Buffer,r=requireDer$1();function o(e){r.call(this,e),this.enc="pem"}return e(o,r),pem$3=o,o.prototype.decode=function(e,o){for(var n=e.toString().split(/[\r\n]+/g),i=o.label.toUpperCase(),a=/^-----(BEGIN|END) ([^-]+)-----$/,s=-1,c=-1,u=0;u<n.length;u++){var l=n[u].match(a);if(null!==l&&l[2]===i){if(-1!==s){if("END"!==l[1])break;c=u;break}if("BEGIN"!==l[1])break;s=u}}if(-1===s||-1===c)throw new Error("PEM section not found for: "+i);var d=n.slice(s+1,c).join("");d.replace(/[^a-z0-9\+\/=]+/gi,"");var p=new t(d,"base64");return r.prototype.decode.call(this,p,o)},pem$3}function requireDecoders(){return hasRequiredDecoders||(hasRequiredDecoders=1,function(e){var t=e;t.der=requireDer$1(),t.pem=requirePem$1()}(decoders)),decoders}var encoders={},der_1,hasRequiredDer,pem$2,hasRequiredPem,hasRequiredEncoders,hasRequiredAsn1$1,certificate,hasRequiredCertificate,hasRequiredAsn1;function requireDer(){if(hasRequiredDer)return der_1;hasRequiredDer=1;var e=inherits_browserExports,t=require$$0$2.Buffer,r=requireAsn1$1(),o=r.base,n=r.constants.der;function i(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new a,this.tree._init(e.body)}function a(e){o.Node.call(this,"der",e)}function s(e){return e<10?"0"+e:e}return der_1=i,i.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},e(a,o.Node),a.prototype._encodeComposite=function(e,r,o,i){var a,s=function(e,t,r,o){var i;"seqof"===e?e="seq":"setof"===e&&(e="set");if(n.tagByName.hasOwnProperty(e))i=n.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return o.error("Unknown tag: "+e);i=e}if(i>=31)return o.error("Multi-octet tag encoding unsupported");t||(i|=32);return i|=n.tagClassByName[r||"universal"]<<6,i}(e,r,o,this.reporter);if(i.length<128)return(a=new t(2))[0]=s,a[1]=i.length,this._createEncoderBuffer([a,i]);for(var c=1,u=i.length;u>=256;u>>=8)c++;(a=new t(2+c))[0]=s,a[1]=128|c;u=1+c;for(var l=i.length;l>0;u--,l>>=8)a[u]=255&l;return this._createEncoderBuffer([a,i])},a.prototype._encodeStr=function(e,r){if("bitstr"===r)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===r){for(var o=new t(2*e.length),n=0;n<e.length;n++)o.writeUInt16BE(e.charCodeAt(n),2*n);return this._createEncoderBuffer(o)}return"numstr"===r?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===r?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(r)||"objDesc"===r?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+r+" unsupported")},a.prototype._encodeObjid=function(e,r,o){if("string"==typeof e){if(!r)return this.reporter.error("string objid given, but no values map found");if(!r.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=r[e].split(/[\s\.]+/g);for(var n=0;n<e.length;n++)e[n]|=0}else if(Array.isArray(e)){e=e.slice();for(n=0;n<e.length;n++)e[n]|=0}if(!Array.isArray(e))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(e));if(!o){if(e[1]>=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}var i=0;for(n=0;n<e.length;n++){var a=e[n];for(i++;a>=128;a>>=7)i++}var s=new t(i),c=s.length-1;for(n=e.length-1;n>=0;n--){a=e[n];for(s[c--]=127&a;(a>>=7)>0;)s[c--]=128|127&a}return this._createEncoderBuffer(s)},a.prototype._encodeTime=function(e,t){var r,o=new Date(e);return"gentime"===t?r=[s(o.getFullYear()),s(o.getUTCMonth()+1),s(o.getUTCDate()),s(o.getUTCHours()),s(o.getUTCMinutes()),s(o.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[s(o.getFullYear()%100),s(o.getUTCMonth()+1),s(o.getUTCDate()),s(o.getUTCHours()),s(o.getUTCMinutes()),s(o.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},a.prototype._encodeNull=function(){return this._createEncoderBuffer("")},a.prototype._encodeInt=function(e,r){if("string"==typeof e){if(!r)return this.reporter.error("String int or enum given, but no values map");if(!r.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=r[e]}if("number"!=typeof e&&!t.isBuffer(e)){var o=e.toArray();!e.sign&&128&o[0]&&o.unshift(0),e=new t(o)}if(t.isBuffer(e)){var n=e.length;0===e.length&&n++;var i=new t(n);return e.copy(i),0===e.length&&(i[0]=0),this._createEncoderBuffer(i)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);n=1;for(var a=e;a>=256;a>>=8)n++;for(a=(i=new Array(n)).length-1;a>=0;a--)i[a]=255&e,e>>=8;return 128&i[0]&&i.unshift(0),this._createEncoderBuffer(new t(i))},a.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},a.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},a.prototype._skipDefault=function(e,t,r){var o,n=this._baseState;if(null===n.default)return!1;var i=e.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,t,r).join()),i.length!==n.defaultBuffer.length)return!1;for(o=0;o<i.length;o++)if(i[o]!==n.defaultBuffer[o])return!1;return!0},der_1}function requirePem(){if(hasRequiredPem)return pem$2;hasRequiredPem=1;var e=inherits_browserExports,t=requireDer();function r(e){t.call(this,e),this.enc="pem"}return e(r,t),pem$2=r,r.prototype.encode=function(e,r){for(var o=t.prototype.encode.call(this,e).toString("base64"),n=["-----BEGIN "+r.label+"-----"],i=0;i<o.length;i+=64)n.push(o.slice(i,i+64));return n.push("-----END "+r.label+"-----"),n.join("\n")},pem$2}function requireEncoders(){return hasRequiredEncoders||(hasRequiredEncoders=1,function(e){var t=e;t.der=requireDer(),t.pem=requirePem()}(encoders)),encoders}function requireAsn1$1(){return hasRequiredAsn1$1||(hasRequiredAsn1$1=1,function(e){var t=e;t.bignum=requireBn$2(),t.define=requireApi().define,t.base=requireBase(),t.constants=requireConstants(),t.decoders=requireDecoders(),t.encoders=requireEncoders()}(asn1)),asn1}function requireCertificate(){if(hasRequiredCertificate)return certificate;hasRequiredCertificate=1;var e=requireAsn1$1(),t=e.define("Time",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),r=e.define("AttributeTypeValue",(function(){this.seq().obj(this.key("type").objid(),this.key("value").any())})),o=e.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())})),n=e.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(o),this.key("subjectPublicKey").bitstr())})),i=e.define("RelativeDistinguishedName",(function(){this.setof(r)})),a=e.define("RDNSequence",(function(){this.seqof(i)})),s=e.define("Name",(function(){this.choice({rdnSequence:this.use(a)})})),c=e.define("Validity",(function(){this.seq().obj(this.key("notBefore").use(t),this.key("notAfter").use(t))})),u=e.define("Extension",(function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())})),l=e.define("TBSCertificate",(function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(o),this.key("issuer").use(s),this.key("validity").use(c),this.key("subject").use(s),this.key("subjectPublicKeyInfo").use(n),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(u).optional())})),d=e.define("X509Certificate",(function(){this.seq().obj(this.key("tbsCertificate").use(l),this.key("signatureAlgorithm").use(o),this.key("signatureValue").bitstr())}));return certificate=d}function requireAsn1(){if(hasRequiredAsn1)return asn1$1;hasRequiredAsn1=1;var e=requireAsn1$1();asn1$1.certificate=requireCertificate();var t=e.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())}));asn1$1.RSAPrivateKey=t;var r=e.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));asn1$1.RSAPublicKey=r;var o=e.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())})),n=e.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(o),this.key("subjectPublicKey").bitstr())}));asn1$1.PublicKey=n;var i=e.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(o),this.key("subjectPrivateKey").octstr())}));asn1$1.PrivateKey=i;var a=e.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())}));asn1$1.EncryptedPrivateKey=a;var s=e.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())}));asn1$1.DSAPrivateKey=s,asn1$1.DSAparam=e.define("DSAparam",(function(){this.int()}));var c=e.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})})),u=e.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(c),this.key("publicKey").optional().explicit(1).bitstr())}));return asn1$1.ECPrivateKey=u,asn1$1.signature=e.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())})),asn1$1}const require$$1={"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"};var fixProc,hasRequiredFixProc,parseAsn1,hasRequiredParseAsn1;function requireFixProc(){if(hasRequiredFixProc)return fixProc;hasRequiredFixProc=1;var e=/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,t=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,r=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,o=requireEvp_bytestokey(),n=requireBrowser$6(),i=requireSafeBuffer$1().Buffer;return fixProc=function(a,s){var c,u=a.toString(),l=u.match(e);if(l){var d="aes"+l[1],p=i.from(l[2],"hex"),h=i.from(l[3].replace(/[\r\n]/g,""),"base64"),f=o(s,p.slice(0,8),parseInt(l[1],10)).key,m=[],y=n.createDecipheriv(d,f,p);m.push(y.update(h)),m.push(y.final()),c=i.concat(m)}else{var g=u.match(r);c=i.from(g[2].replace(/[\r\n]/g,""),"base64")}return{tag:u.match(t)[1],data:c}}}function requireParseAsn1(){if(hasRequiredParseAsn1)return parseAsn1;hasRequiredParseAsn1=1;var e=requireAsn1(),t=require$$1,r=requireFixProc(),o=requireBrowser$6(),n=requireBrowser$7(),i=requireSafeBuffer$1().Buffer;function a(a){var s;"object"!=typeof a||i.isBuffer(a)||(s=a.passphrase,a=a.key),"string"==typeof a&&(a=i.from(a));var c,u,l=r(a,s),d=l.tag,p=l.data;switch(d){case"CERTIFICATE":u=e.certificate.decode(p,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(u||(u=e.PublicKey.decode(p,"der")),c=u.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return e.RSAPublicKey.decode(u.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return u.subjectPrivateKey=u.subjectPublicKey,{type:"ec",data:u};case"1.2.840.10040.4.1":return u.algorithm.params.pub_key=e.DSAparam.decode(u.subjectPublicKey.data,"der"),{type:"dsa",data:u.algorithm.params};default:throw new Error("unknown key id "+c)}case"ENCRYPTED PRIVATE KEY":p=function(e,r){var a=e.algorithm.decrypt.kde.kdeparams.salt,s=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),c=t[e.algorithm.decrypt.cipher.algo.join(".")],u=e.algorithm.decrypt.cipher.iv,l=e.subjectPrivateKey,d=parseInt(c.split("-")[1],10)/8,p=n.pbkdf2Sync(r,a,s,d,"sha1"),h=o.createDecipheriv(c,p,u),f=[];return f.push(h.update(l)),f.push(h.final()),i.concat(f)}(p=e.EncryptedPrivateKey.decode(p,"der"),s);case"PRIVATE KEY":switch(c=(u=e.PrivateKey.decode(p,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return e.RSAPrivateKey.decode(u.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:u.algorithm.curve,privateKey:e.ECPrivateKey.decode(u.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return u.algorithm.params.priv_key=e.DSAparam.decode(u.subjectPrivateKey,"der"),{type:"dsa",params:u.algorithm.params};default:throw new Error("unknown key id "+c)}case"RSA PUBLIC KEY":return e.RSAPublicKey.decode(p,"der");case"RSA PRIVATE KEY":return e.RSAPrivateKey.decode(p,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:e.DSAPrivateKey.decode(p,"der")};case"EC PRIVATE KEY":return{curve:(p=e.ECPrivateKey.decode(p,"der")).parameters.value,privateKey:p.privateKey};default:throw new Error("unknown key type "+d)}}return a.signature=e.signature,parseAsn1=a}const require$$4={"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"};var hasRequiredSign,verify_1,hasRequiredVerify,browser$5,hasRequiredBrowser$3;function requireSign(){if(hasRequiredSign)return sign$1.exports;hasRequiredSign=1;var e=requireSafeBuffer$1().Buffer,t=requireBrowser$8(),r=requireBrowserifyRsa(),o=requireElliptic().ec,n=bnExports$1,i=requireParseAsn1(),a=require$$4;function s(r,o,n,i){if((r=e.from(r.toArray())).length<o.byteLength()){var a=e.alloc(o.byteLength()-r.length);r=e.concat([a,r])}var s=n.length,u=function(t,r){t=c(t,r),t=t.mod(r);var o=e.from(t.toArray());if(o.length<r.byteLength()){var n=e.alloc(r.byteLength()-o.length);o=e.concat([n,o])}return o}(n,o),l=e.alloc(s);l.fill(1);var d=e.alloc(s);return d=t(i,d).update(l).update(e.from([0])).update(r).update(u).digest(),l=t(i,d).update(l).digest(),{k:d=t(i,d).update(l).update(e.from([1])).update(r).update(u).digest(),v:l=t(i,d).update(l).digest()}}function c(e,t){var r=new n(e),o=(e.length<<3)-t.bitLength();return o>0&&r.ishrn(o),r}function u(r,o,n){var i,a;do{for(i=e.alloc(0);8*i.length<r.bitLength();)o.v=t(n,o.k).update(o.v).digest(),i=e.concat([i,o.v]);a=c(i,r),o.k=t(n,o.k).update(o.v).update(e.from([0])).digest(),o.v=t(n,o.k).update(o.v).digest()}while(-1!==a.cmp(r));return a}function l(e,t,r,o){return e.toRed(n.mont(r)).redPow(t).fromRed().mod(o)}return sign$1.exports=function(t,d,p,h,f){var m=i(d);if(m.curve){if("ecdsa"!==h&&"ecdsa/rsa"!==h)throw new Error("wrong private key type");return function(t,r){var n=a[r.curve.join(".")];if(!n)throw new Error("unknown curve "+r.curve.join("."));var i=new o(n).keyFromPrivate(r.privateKey),s=i.sign(t);return e.from(s.toDER())}(t,m)}if("dsa"===m.type){if("dsa"!==h)throw new Error("wrong private key type");return function(t,r,o){var i,a=r.params.priv_key,d=r.params.p,p=r.params.q,h=r.params.g,f=new n(0),m=c(t,p).mod(p),y=!1,g=s(a,p,t,o);for(;!1===y;)f=l(h,i=u(p,g,o),d,p),0===(y=i.invm(p).imul(m.add(a.mul(f))).mod(p)).cmpn(0)&&(y=!1,f=new n(0));return function(t,r){t=t.toArray(),r=r.toArray(),128&t[0]&&(t=[0].concat(t));128&r[0]&&(r=[0].concat(r));var o=t.length+r.length+4,n=[48,o,2,t.length];return n=n.concat(t,[2,r.length],r),e.from(n)}(f,y)}(t,m,p)}if("rsa"!==h&&"ecdsa/rsa"!==h)throw new Error("wrong private key type");if(void 0!==d.padding&&1!==d.padding)throw new Error("illegal or unsupported padding mode");t=e.concat([f,t]);for(var y=m.modulus.byteLength(),g=[0,1];t.length+g.length+1<y;)g.push(255);g.push(0);for(var b=-1;++b<t.length;)g.push(t[b]);return r(g,m)},sign$1.exports.getKey=s,sign$1.exports.makeKey=u,sign$1.exports}function requireVerify(){if(hasRequiredVerify)return verify_1;hasRequiredVerify=1;var e=requireSafeBuffer$1().Buffer,t=bnExports$1,r=requireElliptic().ec,o=requireParseAsn1(),n=require$$4;function i(e,t){if(e.cmpn(0)<=0)throw new Error("invalid sig");if(e.cmp(t)>=0)throw new Error("invalid sig")}return verify_1=function(a,s,c,u,l){var d=o(c);if("ec"===d.type){if("ecdsa"!==u&&"ecdsa/rsa"!==u)throw new Error("wrong public key type");return function(e,t,o){var i=n[o.data.algorithm.curve.join(".")];if(!i)throw new Error("unknown curve "+o.data.algorithm.curve.join("."));var a=new r(i),s=o.data.subjectPrivateKey.data;return a.verify(t,e,s)}(a,s,d)}if("dsa"===d.type){if("dsa"!==u)throw new Error("wrong public key type");return function(e,r,n){var a=n.data.p,s=n.data.q,c=n.data.g,u=n.data.pub_key,l=o.signature.decode(e,"der"),d=l.s,p=l.r;i(d,s),i(p,s);var h=t.mont(a),f=d.invm(s),m=c.toRed(h).redPow(new t(r).mul(f).mod(s)).fromRed().mul(u.toRed(h).redPow(p.mul(f).mod(s)).fromRed()).mod(a).mod(s);return 0===m.cmp(p)}(a,s,d)}if("rsa"!==u&&"ecdsa/rsa"!==u)throw new Error("wrong public key type");s=e.concat([l,s]);for(var p=d.modulus.byteLength(),h=[1],f=0;s.length+h.length+2<p;)h.push(255),f+=1;h.push(0);for(var m=-1;++m<s.length;)h.push(s[m]);h=e.from(h);var y=t.mont(d.modulus);a=(a=new t(a).toRed(y)).redPow(new t(d.publicExponent)),a=e.from(a.fromRed().toArray());var g=f<8?1:0;for(p=Math.min(a.length,h.length),a.length!==h.length&&(g=1),m=-1;++m<p;)g|=a[m]^h[m];return 0===g}}function requireBrowser$3(){if(hasRequiredBrowser$3)return browser$5;hasRequiredBrowser$3=1;var e=requireSafeBuffer$1().Buffer,t=requireBrowser$9(),r=requireReadableBrowser(),o=inherits_browserExports,n=requireSign(),i=requireVerify(),a=require$$6;function s(e){r.Writable.call(this);var o=a[e];if(!o)throw new Error("Unknown message digest");this._hashType=o.hash,this._hash=t(o.hash),this._tag=o.id,this._signType=o.sign}function c(e){r.Writable.call(this);var o=a[e];if(!o)throw new Error("Unknown message digest");this._hash=t(o.hash),this._tag=o.id,this._signType=o.sign}function u(e){return new s(e)}function l(e){return new c(e)}return Object.keys(a).forEach((function(t){a[t].id=e.from(a[t].id,"hex"),a[t.toLowerCase()]=a[t]})),o(s,r.Writable),s.prototype._write=function(e,t,r){this._hash.update(e),r()},s.prototype.update=function(t,r){return this._hash.update("string"==typeof t?e.from(t,r):t),this},s.prototype.sign=function(e,t){this.end();var r=this._hash.digest(),o=n(r,e,this._hashType,this._signType,this._tag);return t?o.toString(t):o},o(c,r.Writable),c.prototype._write=function(e,t,r){this._hash.update(e),r()},c.prototype.update=function(t,r){return this._hash.update("string"==typeof t?e.from(t,r):t),this},c.prototype.verify=function(t,r,o){var n="string"==typeof r?e.from(r,o):r;this.end();var a=this._hash.digest();return i(n,a,t,this._signType,this._tag)},browser$5={Sign:u,Verify:l,createSign:u,createVerify:l}}var bn$1={exports:{}},hasRequiredBn$1,browser$4,hasRequiredBrowser$2;function requireBn$1(){return hasRequiredBn$1||(hasRequiredBn$1=1,function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function o(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function n(e,t,r){if(n.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 i;"object"==typeof e?e.exports=n:t.BN=n,n.BN=n,n.wordSize=26;try{i="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require$$0$2.Buffer}catch(T){}function a(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(e,t,r){var o=a(e,r);return r-1>=t&&(o|=a(e,r-1)<<4),o}function c(e,t,r,o){for(var n=0,i=Math.min(e.length,r),a=t;a<i;a++){var s=e.charCodeAt(a)-48;n*=o,n+=s>=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(e){return e instanceof n||null!==e&&"object"==typeof e&&e.constructor.wordSize===n.wordSize&&Array.isArray(e.words)},n.max=function(e,t){return e.cmp(t)>0?e:t},n.min=function(e,t){return e.cmp(t)<0?e:t},n.prototype._init=function(e,t,o){if("number"==typeof e)return this._initNumber(e,t,o);if("object"==typeof e)return this._initArray(e,t,o);"hex"===t&&(t=16),r(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,o):(this._parseBase(e,t,n),"le"===o&&this._initArray(this.toArray(),t,o)))},n.prototype._initNumber=function(e,t,o){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):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===o&&this._initArray(this.toArray(),t,o)},n.prototype._initArray=function(e,t,o){if(r("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 i,a,s=0;if("be"===o)for(n=e.length-1,i=0;n>=0;n-=3)a=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===o)for(n=0,i=0;n<e.length;n+=3)a=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this.strip()},n.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var n,i=0,a=0;if("be"===r)for(o=e.length-1;o>=t;o-=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;else for(o=(e.length-t)%2==0?t+1:t;o<e.length;o+=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;this.strip()},n.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var o=0,n=1;n<=67108863;n*=t)o++;o--,n=n/t|0;for(var i=e.length-r,a=i%o,s=Math.min(i,i-a)+r,u=0,l=r;l<s;l+=o)u=c(e,l,l+o,t),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var d=1;for(u=c(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.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},n.prototype.clone=function(){var e=new n(null);return this.copy(e),e},n.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","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"],l=[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],d=[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 p(e,t,r){r.negative=t.negative^e.negative;var o=e.length+t.length|0;r.length=o,o=o-1|0;var n=0|e.words[0],i=0|t.words[0],a=n*i,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u<o;u++){for(var l=c>>>26,d=67108863&c,p=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=p;h++){var f=u-h|0;l+=(a=(n=0|e.words[f])*(i=0|t.words[h])+d)/67108864|0,d=67108863&a}r.words[u]=0|d,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}n.prototype.toString=function(e,t){var o;if(t=0|t||1,16===(e=e||10)||"hex"===e){o="";for(var n=0,i=0,a=0;a<this.length;a++){var s=this.words[a],c=(16777215&(s<<n|i)).toString(16);i=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),o=0!==i||a!==this.length-1?u[6-c.length]+c+o:c+o}for(0!==i&&(o=i.toString(16)+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}if(e===(0|e)&&e>=2&&e<=36){var p=l[e],h=d[e];o="";var f=this.clone();for(f.negative=0;!f.isZero();){var m=f.modn(h).toString(e);o=(f=f.idivn(h)).isZero()?m+o:u[p-m.length]+m+o}for(this.isZero()&&(o="0"+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}r(!1,"Base should be between 2 and 36")},n.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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(e,t){return r(void 0!==i),this.toArrayLike(i,e,t)},n.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},n.prototype.toArrayLike=function(e,t,o){var n=this.byteLength(),i=o||Math.max(1,n);r(n<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===t,u=new e(i),l=this.clone();if(c){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[s]=a;for(;s<i;s++)u[s]=0}else{for(s=0;s<i-n;s++)u[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[i-s-1]=a}return u},Math.clz32?n.prototype._countBits=function(e){return 32-Math.clz32(e)}:n.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},n.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},n.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},n.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},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},n.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(e){return r(!(this.negative|e.negative)),this.iuor(e)},n.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},n.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},n.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()},n.prototype.iand=function(e){return r(!(this.negative|e.negative)),this.iuand(e)},n.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},n.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},n.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var o=0;o<r.length;o++)this.words[o]=t.words[o]^r.words[o];if(this!==t)for(;o<t.length;o++)this.words[o]=t.words[o];return this.length=t.length,this.strip()},n.prototype.ixor=function(e){return r(!(this.negative|e.negative)),this.iuxor(e)},n.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},n.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},n.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),o=e%26;this._expand(t),o>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return o>0&&(this.words[n]=~this.words[n]&67108863>>26-o),this.strip()},n.prototype.notn=function(e){return this.clone().inotn(e)},n.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var o=e/26|0,n=e%26;return this._expand(o+1),this.words[o]=t?this.words[o]|1<<n:this.words[o]&~(1<<n),this.strip()},n.prototype.iadd=function(e){var t,r,o;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,o=e):(r=e,o=this);for(var n=0,i=0;i<o.length;i++)t=(0|r.words[i])+(0|o.words[i])+n,this.words[i]=67108863&t,n=t>>>26;for(;0!==n&&i<r.length;i++)t=(0|r.words[i])+n,this.words[i]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;i<r.length;i++)this.words[i]=r.words[i];return this},n.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)},n.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,o,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,o=e):(r=e,o=this);for(var i=0,a=0;a<o.length;a++)i=(t=(0|r.words[a])-(0|o.words[a])+i)>>26,this.words[a]=67108863&t;for(;0!==i&&a<r.length;a++)i=(t=(0|r.words[a])+i)>>26,this.words[a]=67108863&t;if(0===i&&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()},n.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,r){var o,n,i,a=e.words,s=t.words,c=r.words,u=0,l=0|a[0],d=8191&l,p=l>>>13,h=0|a[1],f=8191&h,m=h>>>13,y=0|a[2],g=8191&y,b=y>>>13,v=0|a[3],w=8191&v,$=v>>>13,k=0|a[4],_=8191&k,T=k>>>13,I=0|a[5],A=8191&I,O=I>>>13,E=0|a[6],S=8191&E,R=E>>>13,x=0|a[7],C=8191&x,P=x>>>13,N=0|a[8],B=8191&N,D=N>>>13,M=0|a[9],L=8191&M,j=M>>>13,F=0|s[0],U=8191&F,K=F>>>13,q=0|s[1],G=8191&q,H=q>>>13,V=0|s[2],W=8191&V,z=V>>>13,Z=0|s[3],Q=8191&Z,Y=Z>>>13,X=0|s[4],J=8191&X,ee=X>>>13,te=0|s[5],re=8191&te,oe=te>>>13,ne=0|s[6],ie=8191&ne,ae=ne>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],de=8191&le,pe=le>>>13,he=0|s[9],fe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(u+(o=Math.imul(d,U))|0)+((8191&(n=(n=Math.imul(d,K))+Math.imul(p,U)|0))<<13)|0;u=((i=Math.imul(p,K))+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,o=Math.imul(f,U),n=(n=Math.imul(f,K))+Math.imul(m,U)|0,i=Math.imul(m,K);var ge=(u+(o=o+Math.imul(d,G)|0)|0)+((8191&(n=(n=n+Math.imul(d,H)|0)+Math.imul(p,G)|0))<<13)|0;u=((i=i+Math.imul(p,H)|0)+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,o=Math.imul(g,U),n=(n=Math.imul(g,K))+Math.imul(b,U)|0,i=Math.imul(b,K),o=o+Math.imul(f,G)|0,n=(n=n+Math.imul(f,H)|0)+Math.imul(m,G)|0,i=i+Math.imul(m,H)|0;var be=(u+(o=o+Math.imul(d,W)|0)|0)+((8191&(n=(n=n+Math.imul(d,z)|0)+Math.imul(p,W)|0))<<13)|0;u=((i=i+Math.imul(p,z)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,o=Math.imul(w,U),n=(n=Math.imul(w,K))+Math.imul($,U)|0,i=Math.imul($,K),o=o+Math.imul(g,G)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(b,G)|0,i=i+Math.imul(b,H)|0,o=o+Math.imul(f,W)|0,n=(n=n+Math.imul(f,z)|0)+Math.imul(m,W)|0,i=i+Math.imul(m,z)|0;var ve=(u+(o=o+Math.imul(d,Q)|0)|0)+((8191&(n=(n=n+Math.imul(d,Y)|0)+Math.imul(p,Q)|0))<<13)|0;u=((i=i+Math.imul(p,Y)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,o=Math.imul(_,U),n=(n=Math.imul(_,K))+Math.imul(T,U)|0,i=Math.imul(T,K),o=o+Math.imul(w,G)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul($,G)|0,i=i+Math.imul($,H)|0,o=o+Math.imul(g,W)|0,n=(n=n+Math.imul(g,z)|0)+Math.imul(b,W)|0,i=i+Math.imul(b,z)|0,o=o+Math.imul(f,Q)|0,n=(n=n+Math.imul(f,Y)|0)+Math.imul(m,Q)|0,i=i+Math.imul(m,Y)|0;var we=(u+(o=o+Math.imul(d,J)|0)|0)+((8191&(n=(n=n+Math.imul(d,ee)|0)+Math.imul(p,J)|0))<<13)|0;u=((i=i+Math.imul(p,ee)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,o=Math.imul(A,U),n=(n=Math.imul(A,K))+Math.imul(O,U)|0,i=Math.imul(O,K),o=o+Math.imul(_,G)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(T,G)|0,i=i+Math.imul(T,H)|0,o=o+Math.imul(w,W)|0,n=(n=n+Math.imul(w,z)|0)+Math.imul($,W)|0,i=i+Math.imul($,z)|0,o=o+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(b,Q)|0,i=i+Math.imul(b,Y)|0,o=o+Math.imul(f,J)|0,n=(n=n+Math.imul(f,ee)|0)+Math.imul(m,J)|0,i=i+Math.imul(m,ee)|0;var $e=(u+(o=o+Math.imul(d,re)|0)|0)+((8191&(n=(n=n+Math.imul(d,oe)|0)+Math.imul(p,re)|0))<<13)|0;u=((i=i+Math.imul(p,oe)|0)+(n>>>13)|0)+($e>>>26)|0,$e&=67108863,o=Math.imul(S,U),n=(n=Math.imul(S,K))+Math.imul(R,U)|0,i=Math.imul(R,K),o=o+Math.imul(A,G)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(O,G)|0,i=i+Math.imul(O,H)|0,o=o+Math.imul(_,W)|0,n=(n=n+Math.imul(_,z)|0)+Math.imul(T,W)|0,i=i+Math.imul(T,z)|0,o=o+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul($,Q)|0,i=i+Math.imul($,Y)|0,o=o+Math.imul(g,J)|0,n=(n=n+Math.imul(g,ee)|0)+Math.imul(b,J)|0,i=i+Math.imul(b,ee)|0,o=o+Math.imul(f,re)|0,n=(n=n+Math.imul(f,oe)|0)+Math.imul(m,re)|0,i=i+Math.imul(m,oe)|0;var ke=(u+(o=o+Math.imul(d,ie)|0)|0)+((8191&(n=(n=n+Math.imul(d,ae)|0)+Math.imul(p,ie)|0))<<13)|0;u=((i=i+Math.imul(p,ae)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,o=Math.imul(C,U),n=(n=Math.imul(C,K))+Math.imul(P,U)|0,i=Math.imul(P,K),o=o+Math.imul(S,G)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,G)|0,i=i+Math.imul(R,H)|0,o=o+Math.imul(A,W)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(O,W)|0,i=i+Math.imul(O,z)|0,o=o+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(T,Q)|0,i=i+Math.imul(T,Y)|0,o=o+Math.imul(w,J)|0,n=(n=n+Math.imul(w,ee)|0)+Math.imul($,J)|0,i=i+Math.imul($,ee)|0,o=o+Math.imul(g,re)|0,n=(n=n+Math.imul(g,oe)|0)+Math.imul(b,re)|0,i=i+Math.imul(b,oe)|0,o=o+Math.imul(f,ie)|0,n=(n=n+Math.imul(f,ae)|0)+Math.imul(m,ie)|0,i=i+Math.imul(m,ae)|0;var _e=(u+(o=o+Math.imul(d,ce)|0)|0)+((8191&(n=(n=n+Math.imul(d,ue)|0)+Math.imul(p,ce)|0))<<13)|0;u=((i=i+Math.imul(p,ue)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,o=Math.imul(B,U),n=(n=Math.imul(B,K))+Math.imul(D,U)|0,i=Math.imul(D,K),o=o+Math.imul(C,G)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(P,G)|0,i=i+Math.imul(P,H)|0,o=o+Math.imul(S,W)|0,n=(n=n+Math.imul(S,z)|0)+Math.imul(R,W)|0,i=i+Math.imul(R,z)|0,o=o+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,Q)|0,i=i+Math.imul(O,Y)|0,o=o+Math.imul(_,J)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(T,J)|0,i=i+Math.imul(T,ee)|0,o=o+Math.imul(w,re)|0,n=(n=n+Math.imul(w,oe)|0)+Math.imul($,re)|0,i=i+Math.imul($,oe)|0,o=o+Math.imul(g,ie)|0,n=(n=n+Math.imul(g,ae)|0)+Math.imul(b,ie)|0,i=i+Math.imul(b,ae)|0,o=o+Math.imul(f,ce)|0,n=(n=n+Math.imul(f,ue)|0)+Math.imul(m,ce)|0,i=i+Math.imul(m,ue)|0;var Te=(u+(o=o+Math.imul(d,de)|0)|0)+((8191&(n=(n=n+Math.imul(d,pe)|0)+Math.imul(p,de)|0))<<13)|0;u=((i=i+Math.imul(p,pe)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,o=Math.imul(L,U),n=(n=Math.imul(L,K))+Math.imul(j,U)|0,i=Math.imul(j,K),o=o+Math.imul(B,G)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(D,G)|0,i=i+Math.imul(D,H)|0,o=o+Math.imul(C,W)|0,n=(n=n+Math.imul(C,z)|0)+Math.imul(P,W)|0,i=i+Math.imul(P,z)|0,o=o+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(R,Q)|0,i=i+Math.imul(R,Y)|0,o=o+Math.imul(A,J)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(O,J)|0,i=i+Math.imul(O,ee)|0,o=o+Math.imul(_,re)|0,n=(n=n+Math.imul(_,oe)|0)+Math.imul(T,re)|0,i=i+Math.imul(T,oe)|0,o=o+Math.imul(w,ie)|0,n=(n=n+Math.imul(w,ae)|0)+Math.imul($,ie)|0,i=i+Math.imul($,ae)|0,o=o+Math.imul(g,ce)|0,n=(n=n+Math.imul(g,ue)|0)+Math.imul(b,ce)|0,i=i+Math.imul(b,ue)|0,o=o+Math.imul(f,de)|0,n=(n=n+Math.imul(f,pe)|0)+Math.imul(m,de)|0,i=i+Math.imul(m,pe)|0;var Ie=(u+(o=o+Math.imul(d,fe)|0)|0)+((8191&(n=(n=n+Math.imul(d,me)|0)+Math.imul(p,fe)|0))<<13)|0;u=((i=i+Math.imul(p,me)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,o=Math.imul(L,G),n=(n=Math.imul(L,H))+Math.imul(j,G)|0,i=Math.imul(j,H),o=o+Math.imul(B,W)|0,n=(n=n+Math.imul(B,z)|0)+Math.imul(D,W)|0,i=i+Math.imul(D,z)|0,o=o+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,Y)|0,o=o+Math.imul(S,J)|0,n=(n=n+Math.imul(S,ee)|0)+Math.imul(R,J)|0,i=i+Math.imul(R,ee)|0,o=o+Math.imul(A,re)|0,n=(n=n+Math.imul(A,oe)|0)+Math.imul(O,re)|0,i=i+Math.imul(O,oe)|0,o=o+Math.imul(_,ie)|0,n=(n=n+Math.imul(_,ae)|0)+Math.imul(T,ie)|0,i=i+Math.imul(T,ae)|0,o=o+Math.imul(w,ce)|0,n=(n=n+Math.imul(w,ue)|0)+Math.imul($,ce)|0,i=i+Math.imul($,ue)|0,o=o+Math.imul(g,de)|0,n=(n=n+Math.imul(g,pe)|0)+Math.imul(b,de)|0,i=i+Math.imul(b,pe)|0;var Ae=(u+(o=o+Math.imul(f,fe)|0)|0)+((8191&(n=(n=n+Math.imul(f,me)|0)+Math.imul(m,fe)|0))<<13)|0;u=((i=i+Math.imul(m,me)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,o=Math.imul(L,W),n=(n=Math.imul(L,z))+Math.imul(j,W)|0,i=Math.imul(j,z),o=o+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(D,Q)|0,i=i+Math.imul(D,Y)|0,o=o+Math.imul(C,J)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(P,J)|0,i=i+Math.imul(P,ee)|0,o=o+Math.imul(S,re)|0,n=(n=n+Math.imul(S,oe)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,oe)|0,o=o+Math.imul(A,ie)|0,n=(n=n+Math.imul(A,ae)|0)+Math.imul(O,ie)|0,i=i+Math.imul(O,ae)|0,o=o+Math.imul(_,ce)|0,n=(n=n+Math.imul(_,ue)|0)+Math.imul(T,ce)|0,i=i+Math.imul(T,ue)|0,o=o+Math.imul(w,de)|0,n=(n=n+Math.imul(w,pe)|0)+Math.imul($,de)|0,i=i+Math.imul($,pe)|0;var Oe=(u+(o=o+Math.imul(g,fe)|0)|0)+((8191&(n=(n=n+Math.imul(g,me)|0)+Math.imul(b,fe)|0))<<13)|0;u=((i=i+Math.imul(b,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,o=Math.imul(L,Q),n=(n=Math.imul(L,Y))+Math.imul(j,Q)|0,i=Math.imul(j,Y),o=o+Math.imul(B,J)|0,n=(n=n+Math.imul(B,ee)|0)+Math.imul(D,J)|0,i=i+Math.imul(D,ee)|0,o=o+Math.imul(C,re)|0,n=(n=n+Math.imul(C,oe)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,oe)|0,o=o+Math.imul(S,ie)|0,n=(n=n+Math.imul(S,ae)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,ae)|0,o=o+Math.imul(A,ce)|0,n=(n=n+Math.imul(A,ue)|0)+Math.imul(O,ce)|0,i=i+Math.imul(O,ue)|0,o=o+Math.imul(_,de)|0,n=(n=n+Math.imul(_,pe)|0)+Math.imul(T,de)|0,i=i+Math.imul(T,pe)|0;var Ee=(u+(o=o+Math.imul(w,fe)|0)|0)+((8191&(n=(n=n+Math.imul(w,me)|0)+Math.imul($,fe)|0))<<13)|0;u=((i=i+Math.imul($,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,o=Math.imul(L,J),n=(n=Math.imul(L,ee))+Math.imul(j,J)|0,i=Math.imul(j,ee),o=o+Math.imul(B,re)|0,n=(n=n+Math.imul(B,oe)|0)+Math.imul(D,re)|0,i=i+Math.imul(D,oe)|0,o=o+Math.imul(C,ie)|0,n=(n=n+Math.imul(C,ae)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,ae)|0,o=o+Math.imul(S,ce)|0,n=(n=n+Math.imul(S,ue)|0)+Math.imul(R,ce)|0,i=i+Math.imul(R,ue)|0,o=o+Math.imul(A,de)|0,n=(n=n+Math.imul(A,pe)|0)+Math.imul(O,de)|0,i=i+Math.imul(O,pe)|0;var Se=(u+(o=o+Math.imul(_,fe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(T,fe)|0))<<13)|0;u=((i=i+Math.imul(T,me)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,o=Math.imul(L,re),n=(n=Math.imul(L,oe))+Math.imul(j,re)|0,i=Math.imul(j,oe),o=o+Math.imul(B,ie)|0,n=(n=n+Math.imul(B,ae)|0)+Math.imul(D,ie)|0,i=i+Math.imul(D,ae)|0,o=o+Math.imul(C,ce)|0,n=(n=n+Math.imul(C,ue)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,ue)|0,o=o+Math.imul(S,de)|0,n=(n=n+Math.imul(S,pe)|0)+Math.imul(R,de)|0,i=i+Math.imul(R,pe)|0;var Re=(u+(o=o+Math.imul(A,fe)|0)|0)+((8191&(n=(n=n+Math.imul(A,me)|0)+Math.imul(O,fe)|0))<<13)|0;u=((i=i+Math.imul(O,me)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,o=Math.imul(L,ie),n=(n=Math.imul(L,ae))+Math.imul(j,ie)|0,i=Math.imul(j,ae),o=o+Math.imul(B,ce)|0,n=(n=n+Math.imul(B,ue)|0)+Math.imul(D,ce)|0,i=i+Math.imul(D,ue)|0,o=o+Math.imul(C,de)|0,n=(n=n+Math.imul(C,pe)|0)+Math.imul(P,de)|0,i=i+Math.imul(P,pe)|0;var xe=(u+(o=o+Math.imul(S,fe)|0)|0)+((8191&(n=(n=n+Math.imul(S,me)|0)+Math.imul(R,fe)|0))<<13)|0;u=((i=i+Math.imul(R,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,o=Math.imul(L,ce),n=(n=Math.imul(L,ue))+Math.imul(j,ce)|0,i=Math.imul(j,ue),o=o+Math.imul(B,de)|0,n=(n=n+Math.imul(B,pe)|0)+Math.imul(D,de)|0,i=i+Math.imul(D,pe)|0;var Ce=(u+(o=o+Math.imul(C,fe)|0)|0)+((8191&(n=(n=n+Math.imul(C,me)|0)+Math.imul(P,fe)|0))<<13)|0;u=((i=i+Math.imul(P,me)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,o=Math.imul(L,de),n=(n=Math.imul(L,pe))+Math.imul(j,de)|0,i=Math.imul(j,pe);var Pe=(u+(o=o+Math.imul(B,fe)|0)|0)+((8191&(n=(n=n+Math.imul(B,me)|0)+Math.imul(D,fe)|0))<<13)|0;u=((i=i+Math.imul(D,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Ne=(u+(o=Math.imul(L,fe))|0)+((8191&(n=(n=Math.imul(L,me))+Math.imul(j,fe)|0))<<13)|0;return u=((i=Math.imul(j,me))+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=ye,c[1]=ge,c[2]=be,c[3]=ve,c[4]=we,c[5]=$e,c[6]=ke,c[7]=_e,c[8]=Te,c[9]=Ie,c[10]=Ae,c[11]=Oe,c[12]=Ee,c[13]=Se,c[14]=Re,c[15]=xe,c[16]=Ce,c[17]=Pe,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function f(e,t,r){return(new m).mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(h=p),n.prototype.mulTo=function(e,t){var r,o=this.length+e.length;return r=10===this.length&&10===e.length?h(this,e,t):o<63?p(this,e,t):o<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var o=0,n=0,i=0;i<r.length-1;i++){var a=n;n=0;for(var s=67108863&o,c=Math.min(i,t.length-1),u=Math.max(0,i-e.length+1);u<=c;u++){var l=i-u,d=(0|e.words[l])*(0|t.words[u]),p=67108863&d;s=67108863&(p=p+s|0),n+=(a=(a=a+(d/67108864|0)|0)+(p>>>26)|0)>>>26,a&=67108863}r.words[i]=s,o=a,a=n}return 0!==o?r.words[i]=o:r.length--,r.strip()}(this,e,t):f(this,e,t),r},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=n.prototype._countBits(e)-1,o=0;o<e;o++)t[o]=this.revBin(o,r,e);return t},m.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var o=0,n=0;n<t;n++)o|=(1&e)<<t-n-1,e>>=1;return o},m.prototype.permute=function(e,t,r,o,n,i){for(var a=0;a<i;a++)o[a]=t[e[a]],n[a]=r[e[a]]},m.prototype.transform=function(e,t,r,o,n,i){this.permute(i,e,t,r,o,n);for(var a=1;a<n;a<<=1)for(var s=a<<1,c=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),l=0;l<n;l+=s)for(var d=c,p=u,h=0;h<a;h++){var f=r[l+h],m=o[l+h],y=r[l+h+a],g=o[l+h+a],b=d*y-p*g;g=d*g+p*y,y=b,r[l+h]=f+y,o[l+h]=m+g,r[l+h+a]=f-y,o[l+h+a]=m-g,h!==s&&(b=c*d-u*p,p=c*p+u*d,d=b)}},m.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),o=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+o},m.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var o=0;o<r/2;o++){var n=e[o];e[o]=e[r-o-1],e[r-o-1]=n,n=t[o],t[o]=-t[r-o-1],t[r-o-1]=-n}},m.prototype.normalize13b=function(e,t){for(var r=0,o=0;o<t/2;o++){var n=8192*Math.round(e[2*o+1]/t)+Math.round(e[2*o]/t)+r;e[o]=67108863&n,r=n<67108864?0:n/67108864|0}return e},m.prototype.convert13b=function(e,t,o,n){for(var i=0,a=0;a<t;a++)i+=0|e[a],o[2*a]=8191&i,i>>>=13,o[2*a+1]=8191&i,i>>>=13;for(a=2*t;a<n;++a)o[a]=0;r(0===i),r(!(-8192&i))},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 o=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(o),i=this.stub(o),a=new Array(o),s=new Array(o),c=new Array(o),u=new Array(o),l=new Array(o),d=new Array(o),p=r.words;p.length=o,this.convert13b(e.words,e.length,a,o),this.convert13b(t.words,t.length,u,o),this.transform(a,i,s,c,o,n),this.transform(u,i,l,d,o,n);for(var h=0;h<o;h++){var f=s[h]*l[h]-c[h]*d[h];c[h]=s[h]*d[h]+c[h]*l[h],s[h]=f}return this.conjugate(s,c,o),this.transform(s,c,p,i,o,n),this.conjugate(p,i,o),this.normalize13b(p,o),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},n.prototype.mul=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},n.prototype.mulf=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),f(this,e,t)},n.prototype.imul=function(e){return this.clone().mulTo(e,this)},n.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,o=0;o<this.length;o++){var n=(0|this.words[o])*e,i=(67108863&n)+(67108863&t);t>>=26,t+=n/67108864|0,t+=i>>>26,this.words[o]=67108863&i}return 0!==t&&(this.words[o]=t,this.length++),this},n.prototype.muln=function(e){return this.clone().imuln(e)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var o=r/26|0,n=r%26;t[r]=(e.words[o]&1<<n)>>>n}return t}(e);if(0===t.length)return new n(1);for(var r=this,o=0;o<t.length&&0===t[o];o++,r=r.sqr());if(++o<t.length)for(var i=r.sqr();o<t.length;o++,i=i.sqr())0!==t[o]&&(r=r.mul(i));return r},n.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,o=e%26,n=(e-o)/26,i=67108863>>>26-o<<26-o;if(0!==o){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&i,c=(0|this.words[t])-s<<o;this.words[t]=c|a,a=s>>>26-o}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()},n.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},n.prototype.iushrn=function(e,t,o){var n;r("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var i=e%26,a=Math.min((e-i)/26,this.length),s=67108863^67108863>>>i<<i,c=o;if(n-=a,n=Math.max(0,n),c){for(var u=0;u<a;u++)c.words[u]=this.words[u];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var d=0|this.words[u];this.words[u]=l<<26-i|d>>>i,l=d&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(e,t,o){return r(0===this.negative),this.iushrn(e,t,o)},n.prototype.shln=function(e){return this.clone().ishln(e)},n.prototype.ushln=function(e){return this.clone().iushln(e)},n.prototype.shrn=function(e){return this.clone().ishrn(e)},n.prototype.ushrn=function(e){return this.clone().iushrn(e)},n.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26,n=1<<t;return!(this.length<=o)&&!!(this.words[o]&n)},n.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=o)return this;if(0!==t&&o++,this.length=Math.min(o,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(e){return this.clone().imaskn(e)},n.prototype.iaddn=function(e){return r("number"==typeof e),r(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)},n.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},n.prototype.isubn=function(e){if(r("number"==typeof e),r(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()},n.prototype.addn=function(e){return this.clone().iaddn(e)},n.prototype.subn=function(e){return this.clone().isubn(e)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(e,t,o){var n,i,a=e.length+o;this._expand(a);var s=0;for(n=0;n<e.length;n++){i=(0|this.words[n+o])+s;var c=(0|e.words[n])*t;s=((i-=67108863&c)>>26)-(c/67108864|0),this.words[n+o]=67108863&i}for(;n<this.length-o;n++)s=(i=(0|this.words[n+o])+s)>>26,this.words[n+o]=67108863&i;if(0===s)return this.strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(i=-(0|this.words[n])+s)>>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},n.prototype._wordDiv=function(e,t){var r=(this.length,e.length),o=this.clone(),i=e,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),o.iushln(r),a=0|i.words[i.length-1]);var s,c=o.length-i.length;if("mod"!==t){(s=new n(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=o.clone()._ishlnsubmul(i,1,c);0===l.negative&&(o=l,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var p=67108864*(0|o.words[i.length+d])+(0|o.words[i.length+d-1]);for(p=Math.min(p/a|0,67108863),o._ishlnsubmul(i,p,d);0!==o.negative;)p--,o.negative=0,o._ishlnsubmul(i,1,d),o.isZero()||(o.negative^=1);s&&(s.words[d]=p)}return s&&s.strip(),o.strip(),"div"!==t&&0!==r&&o.iushrn(r),{div:s||null,mod:o}},n.prototype.divmod=function(e,t,o){return r(!e.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new n(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new n(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new n(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},n.prototype.div=function(e){return this.divmod(e,"div",!1).div},n.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},n.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},n.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,o=e.ushrn(1),n=e.andln(1),i=r.cmp(o);return i<0||1===n&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},n.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,o=0,n=this.length-1;n>=0;n--)o=(t*o+(0|this.words[n]))%e;return o},n.prototype.idivn=function(e){r(e<=67108863);for(var t=0,o=this.length-1;o>=0;o--){var n=(0|this.words[o])+67108864*t;this.words[o]=n/e|0,t=n%e}return this.strip()},n.prototype.divn=function(e){return this.clone().idivn(e)},n.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new n(1),a=new n(0),s=new n(0),c=new n(1),u=0;t.isEven()&&o.isEven();)t.iushrn(1),o.iushrn(1),++u;for(var l=o.clone(),d=t.clone();!t.isZero();){for(var p=0,h=1;!(t.words[0]&h)&&p<26;++p,h<<=1);if(p>0)for(t.iushrn(p);p-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var f=0,m=1;!(o.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(o.iushrn(f);f-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(o)>=0?(t.isub(o),i.isub(s),a.isub(c)):(o.isub(t),s.isub(i),c.isub(a))}return{a:s,b:c,gcd:o.iushln(u)}},n.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new n(1),s=new n(0),c=o.clone();t.cmpn(1)>0&&o.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,p=1;!(o.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(o.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(o)>=0?(t.isub(o),a.isub(s)):(o.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},n.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 o=0;t.isEven()&&r.isEven();o++)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 i=t;t=r,r=i}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(o)},n.prototype.invm=function(e){return this.egcd(e).a.umod(e)},n.prototype.isEven=function(){return!(1&this.words[0])},n.prototype.isOdd=function(){return!(1&~this.words[0])},n.prototype.andln=function(e){return this.words[0]&e},n.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,o=(e-t)/26,n=1<<t;if(this.length<=o)return this._expand(o+1),this.words[o]|=n,this;for(var i=n,a=o;0!==i&&a<this.length;a++){var s=0|this.words[a];i=(s+=i)>>>26,s&=67108863,this.words[a]=s}return 0!==i&&(this.words[a]=i,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(e){var t,o=e<0;if(0!==this.negative&&!o)return-1;if(0===this.negative&&o)return 1;if(this.strip(),this.length>1)t=1;else{o&&(e=-e),r(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},n.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},n.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 o=0|this.words[r],n=0|e.words[r];if(o!==n){o<n?t=-1:o>n&&(t=1);break}}return t},n.prototype.gtn=function(e){return 1===this.cmpn(e)},n.prototype.gt=function(e){return 1===this.cmp(e)},n.prototype.gten=function(e){return this.cmpn(e)>=0},n.prototype.gte=function(e){return this.cmp(e)>=0},n.prototype.ltn=function(e){return-1===this.cmpn(e)},n.prototype.lt=function(e){return-1===this.cmp(e)},n.prototype.lten=function(e){return this.cmpn(e)<=0},n.prototype.lte=function(e){return this.cmp(e)<=0},n.prototype.eqn=function(e){return 0===this.cmpn(e)},n.prototype.eq=function(e){return 0===this.cmp(e)},n.red=function(e){return new k(e)},n.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(e){return this.red=e,this},n.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},n.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},n.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},n.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},n.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},n.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},n.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},n.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function g(e,t){this.name=e,this.p=new n(t,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function $(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(e){if("string"==typeof e){var t=n._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function _(e){k.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}g.prototype._tmp=function(){var e=new n(null);return e.words=new Array(Math.ceil(this.n/13)),e},g.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 o=t<this.n?-1:r.ucmp(this.p);return 0===o?(r.words[0]=0,r.length=1):o>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(e,t){e.iushrn(this.n,0,t)},g.prototype.imulK=function(e){return e.imul(this.k)},o(b,g),b.prototype.split=function(e,t){for(var r=4194303,o=Math.min(e.length,9),n=0;n<o;n++)t.words[n]=e.words[n];if(t.length=o,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=i&r,n=10;n<e.length;n++){var a=0|e.words[n];e.words[n-10]=(a&r)<<4|i>>>22,i=a}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},b.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 o=0|e.words[r];t+=977*o,e.words[r]=67108863&t,t=64*o+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},o(v,g),o(w,g),o($,g),$.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var o=19*(0|e.words[r])+t,n=67108863&o;o>>>=26,e.words[r]=n,t=o}return 0!==t&&(e.words[e.length++]=t),e},n._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new $}return y[e]=t,t},k.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},k.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},k.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},k.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},k.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},k.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},k.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},k.prototype.isqr=function(e){return this.imul(e,e.clone())},k.prototype.sqr=function(e){return this.mul(e,e)},k.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var o=this.m.add(new n(1)).iushrn(2);return this.pow(e,o)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new n(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),p=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),f=a;0!==h.cmp(s);){for(var m=h,y=0;0!==m.cmp(s);y++)m=m.redSqr();r(y<f);var g=this.pow(d,new n(1).iushln(f-y-1));p=p.redMul(g),d=g.redSqr(),h=h.redMul(d),f=y}return p},k.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},k.prototype.pow=function(e,t){if(t.isZero())return new n(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=e;for(var o=2;o<r.length;o++)r[o]=this.mul(r[o-1],e);var i=r[0],a=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),o=t.length-1;o>=0;o--){for(var u=t.words[o],l=c-1;l>=0;l--){var d=u>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4===++s||0===o&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}c=26}return i},k.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},k.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},n.mont=function(e){return new _(e)},o(_,k),_.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},_.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},_.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(o).iushrn(this.shift),i=n;return n.cmp(this.m)>=0?i=n.isub(this.m):n.cmpn(0)<0&&(i=n.iadd(this.m)),i._forceRed(this)},_.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new n(0)._forceRed(this);var r=e.mul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(o).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},_.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,commonjsGlobal)}(bn$1)),bn$1.exports}function requireBrowser$2(){if(hasRequiredBrowser$2)return browser$4;hasRequiredBrowser$2=1;var e=requireElliptic(),t=requireBn$1();browser$4=function(e){return new o(e)};var r={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 o(t){this.curveType=r[t],this.curveType||(this.curveType={name:t}),this.curve=new e.ec(this.curveType.name),this.keys=void 0}function n(e,t,r){Array.isArray(e)||(e=e.toArray());var o=new Buffer(e);if(r&&o.length<r){var n=new Buffer(r-o.length);n.fill(0),o=Buffer.concat([n,o])}return t?o.toString(t):o}return r.p224=r.secp224r1,r.p256=r.secp256r1=r.prime256v1,r.p192=r.secp192r1=r.prime192v1,r.p384=r.secp384r1,r.p521=r.secp521r1,o.prototype.generateKeys=function(e,t){return this.keys=this.curve.genKeyPair(),this.getPublicKey(e,t)},o.prototype.computeSecret=function(e,t,r){return t=t||"utf8",Buffer.isBuffer(e)||(e=new Buffer(e,t)),n(this.curve.keyFromPublic(e).getPublic().mul(this.keys.getPrivate()).getX(),r,this.curveType.byteLength)},o.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),n(r,e)},o.prototype.getPrivateKey=function(e){return n(this.keys.getPrivate(),e)},o.prototype.setPublicKey=function(e,t){return t=t||"utf8",Buffer.isBuffer(e)||(e=new Buffer(e,t)),this.keys._importPublic(e),this},o.prototype.setPrivateKey=function(e,r){r=r||"utf8",Buffer.isBuffer(e)||(e=new Buffer(e,r));var o=new t(e);return o=o.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(o),this},browser$4}bn$1.exports;var browser$3={},mgf,hasRequiredMgf,xor,hasRequiredXor;function requireMgf(){if(hasRequiredMgf)return mgf;hasRequiredMgf=1;var e=requireBrowser$9(),t=requireSafeBuffer$1().Buffer;function r(e){var r=t.allocUnsafe(4);return r.writeUInt32BE(e,0),r}return mgf=function(o,n){for(var i,a=t.alloc(0),s=0;a.length<n;)i=r(s++),a=t.concat([a,e("sha1").update(o).update(i).digest()]);return a.slice(0,n)}}function requireXor(){return hasRequiredXor?xor:(hasRequiredXor=1,xor=function(e,t){for(var r=e.length,o=-1;++o<r;)e[o]^=t[o];return e})}var bn={exports:{}},hasRequiredBn,withPublic_1,hasRequiredWithPublic,publicEncrypt,hasRequiredPublicEncrypt,privateDecrypt,hasRequiredPrivateDecrypt,hasRequiredBrowser$1;function requireBn(){return hasRequiredBn||(hasRequiredBn=1,function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function o(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function n(e,t,r){if(n.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 i;"object"==typeof e?e.exports=n:t.BN=n,n.BN=n,n.wordSize=26;try{i="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require$$0$2.Buffer}catch(T){}function a(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(e,t,r){var o=a(e,r);return r-1>=t&&(o|=a(e,r-1)<<4),o}function c(e,t,r,o){for(var n=0,i=Math.min(e.length,r),a=t;a<i;a++){var s=e.charCodeAt(a)-48;n*=o,n+=s>=49?s-49+10:s>=17?s-17+10:s}return n}n.isBN=function(e){return e instanceof n||null!==e&&"object"==typeof e&&e.constructor.wordSize===n.wordSize&&Array.isArray(e.words)},n.max=function(e,t){return e.cmp(t)>0?e:t},n.min=function(e,t){return e.cmp(t)<0?e:t},n.prototype._init=function(e,t,o){if("number"==typeof e)return this._initNumber(e,t,o);if("object"==typeof e)return this._initArray(e,t,o);"hex"===t&&(t=16),r(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,o):(this._parseBase(e,t,n),"le"===o&&this._initArray(this.toArray(),t,o)))},n.prototype._initNumber=function(e,t,o){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):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===o&&this._initArray(this.toArray(),t,o)},n.prototype._initArray=function(e,t,o){if(r("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 i,a,s=0;if("be"===o)for(n=e.length-1,i=0;n>=0;n-=3)a=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===o)for(n=0,i=0;n<e.length;n+=3)a=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[i]|=a<<s&67108863,this.words[i+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this.strip()},n.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var n,i=0,a=0;if("be"===r)for(o=e.length-1;o>=t;o-=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;else for(o=(e.length-t)%2==0?t+1:t;o<e.length;o+=2)n=s(e,t,o)<<i,this.words[a]|=67108863&n,i>=18?(i-=18,a+=1,this.words[a]|=n>>>26):i+=8;this.strip()},n.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var o=0,n=1;n<=67108863;n*=t)o++;o--,n=n/t|0;for(var i=e.length-r,a=i%o,s=Math.min(i,i-a)+r,u=0,l=r;l<s;l+=o)u=c(e,l,l+o,t),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var d=1;for(u=c(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},n.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},n.prototype.clone=function(){var e=new n(null);return this.copy(e),e},n.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","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"],l=[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],d=[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 p(e,t,r){r.negative=t.negative^e.negative;var o=e.length+t.length|0;r.length=o,o=o-1|0;var n=0|e.words[0],i=0|t.words[0],a=n*i,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u<o;u++){for(var l=c>>>26,d=67108863&c,p=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=p;h++){var f=u-h|0;l+=(a=(n=0|e.words[f])*(i=0|t.words[h])+d)/67108864|0,d=67108863&a}r.words[u]=0|d,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}n.prototype.toString=function(e,t){var o;if(t=0|t||1,16===(e=e||10)||"hex"===e){o="";for(var n=0,i=0,a=0;a<this.length;a++){var s=this.words[a],c=(16777215&(s<<n|i)).toString(16);i=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),o=0!==i||a!==this.length-1?u[6-c.length]+c+o:c+o}for(0!==i&&(o=i.toString(16)+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}if(e===(0|e)&&e>=2&&e<=36){var p=l[e],h=d[e];o="";var f=this.clone();for(f.negative=0;!f.isZero();){var m=f.modn(h).toString(e);o=(f=f.idivn(h)).isZero()?m+o:u[p-m.length]+m+o}for(this.isZero()&&(o="0"+o);o.length%t!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}r(!1,"Base should be between 2 and 36")},n.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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(e,t){return r(void 0!==i),this.toArrayLike(i,e,t)},n.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},n.prototype.toArrayLike=function(e,t,o){var n=this.byteLength(),i=o||Math.max(1,n);r(n<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===t,u=new e(i),l=this.clone();if(c){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[s]=a;for(;s<i;s++)u[s]=0}else{for(s=0;s<i-n;s++)u[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[i-s-1]=a}return u},Math.clz32?n.prototype._countBits=function(e){return 32-Math.clz32(e)}:n.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},n.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},n.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},n.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},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},n.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.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()},n.prototype.ior=function(e){return r(!(this.negative|e.negative)),this.iuor(e)},n.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},n.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},n.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()},n.prototype.iand=function(e){return r(!(this.negative|e.negative)),this.iuand(e)},n.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},n.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},n.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var o=0;o<r.length;o++)this.words[o]=t.words[o]^r.words[o];if(this!==t)for(;o<t.length;o++)this.words[o]=t.words[o];return this.length=t.length,this.strip()},n.prototype.ixor=function(e){return r(!(this.negative|e.negative)),this.iuxor(e)},n.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},n.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},n.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),o=e%26;this._expand(t),o>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return o>0&&(this.words[n]=~this.words[n]&67108863>>26-o),this.strip()},n.prototype.notn=function(e){return this.clone().inotn(e)},n.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var o=e/26|0,n=e%26;return this._expand(o+1),this.words[o]=t?this.words[o]|1<<n:this.words[o]&~(1<<n),this.strip()},n.prototype.iadd=function(e){var t,r,o;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,o=e):(r=e,o=this);for(var n=0,i=0;i<o.length;i++)t=(0|r.words[i])+(0|o.words[i])+n,this.words[i]=67108863&t,n=t>>>26;for(;0!==n&&i<r.length;i++)t=(0|r.words[i])+n,this.words[i]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;i<r.length;i++)this.words[i]=r.words[i];return this},n.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)},n.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,o,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,o=e):(r=e,o=this);for(var i=0,a=0;a<o.length;a++)i=(t=(0|r.words[a])-(0|o.words[a])+i)>>26,this.words[a]=67108863&t;for(;0!==i&&a<r.length;a++)i=(t=(0|r.words[a])+i)>>26,this.words[a]=67108863&t;if(0===i&&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()},n.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,r){var o,n,i,a=e.words,s=t.words,c=r.words,u=0,l=0|a[0],d=8191&l,p=l>>>13,h=0|a[1],f=8191&h,m=h>>>13,y=0|a[2],g=8191&y,b=y>>>13,v=0|a[3],w=8191&v,$=v>>>13,k=0|a[4],_=8191&k,T=k>>>13,I=0|a[5],A=8191&I,O=I>>>13,E=0|a[6],S=8191&E,R=E>>>13,x=0|a[7],C=8191&x,P=x>>>13,N=0|a[8],B=8191&N,D=N>>>13,M=0|a[9],L=8191&M,j=M>>>13,F=0|s[0],U=8191&F,K=F>>>13,q=0|s[1],G=8191&q,H=q>>>13,V=0|s[2],W=8191&V,z=V>>>13,Z=0|s[3],Q=8191&Z,Y=Z>>>13,X=0|s[4],J=8191&X,ee=X>>>13,te=0|s[5],re=8191&te,oe=te>>>13,ne=0|s[6],ie=8191&ne,ae=ne>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],de=8191&le,pe=le>>>13,he=0|s[9],fe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(u+(o=Math.imul(d,U))|0)+((8191&(n=(n=Math.imul(d,K))+Math.imul(p,U)|0))<<13)|0;u=((i=Math.imul(p,K))+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,o=Math.imul(f,U),n=(n=Math.imul(f,K))+Math.imul(m,U)|0,i=Math.imul(m,K);var ge=(u+(o=o+Math.imul(d,G)|0)|0)+((8191&(n=(n=n+Math.imul(d,H)|0)+Math.imul(p,G)|0))<<13)|0;u=((i=i+Math.imul(p,H)|0)+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,o=Math.imul(g,U),n=(n=Math.imul(g,K))+Math.imul(b,U)|0,i=Math.imul(b,K),o=o+Math.imul(f,G)|0,n=(n=n+Math.imul(f,H)|0)+Math.imul(m,G)|0,i=i+Math.imul(m,H)|0;var be=(u+(o=o+Math.imul(d,W)|0)|0)+((8191&(n=(n=n+Math.imul(d,z)|0)+Math.imul(p,W)|0))<<13)|0;u=((i=i+Math.imul(p,z)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,o=Math.imul(w,U),n=(n=Math.imul(w,K))+Math.imul($,U)|0,i=Math.imul($,K),o=o+Math.imul(g,G)|0,n=(n=n+Math.imul(g,H)|0)+Math.imul(b,G)|0,i=i+Math.imul(b,H)|0,o=o+Math.imul(f,W)|0,n=(n=n+Math.imul(f,z)|0)+Math.imul(m,W)|0,i=i+Math.imul(m,z)|0;var ve=(u+(o=o+Math.imul(d,Q)|0)|0)+((8191&(n=(n=n+Math.imul(d,Y)|0)+Math.imul(p,Q)|0))<<13)|0;u=((i=i+Math.imul(p,Y)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,o=Math.imul(_,U),n=(n=Math.imul(_,K))+Math.imul(T,U)|0,i=Math.imul(T,K),o=o+Math.imul(w,G)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul($,G)|0,i=i+Math.imul($,H)|0,o=o+Math.imul(g,W)|0,n=(n=n+Math.imul(g,z)|0)+Math.imul(b,W)|0,i=i+Math.imul(b,z)|0,o=o+Math.imul(f,Q)|0,n=(n=n+Math.imul(f,Y)|0)+Math.imul(m,Q)|0,i=i+Math.imul(m,Y)|0;var we=(u+(o=o+Math.imul(d,J)|0)|0)+((8191&(n=(n=n+Math.imul(d,ee)|0)+Math.imul(p,J)|0))<<13)|0;u=((i=i+Math.imul(p,ee)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,o=Math.imul(A,U),n=(n=Math.imul(A,K))+Math.imul(O,U)|0,i=Math.imul(O,K),o=o+Math.imul(_,G)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(T,G)|0,i=i+Math.imul(T,H)|0,o=o+Math.imul(w,W)|0,n=(n=n+Math.imul(w,z)|0)+Math.imul($,W)|0,i=i+Math.imul($,z)|0,o=o+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(b,Q)|0,i=i+Math.imul(b,Y)|0,o=o+Math.imul(f,J)|0,n=(n=n+Math.imul(f,ee)|0)+Math.imul(m,J)|0,i=i+Math.imul(m,ee)|0;var $e=(u+(o=o+Math.imul(d,re)|0)|0)+((8191&(n=(n=n+Math.imul(d,oe)|0)+Math.imul(p,re)|0))<<13)|0;u=((i=i+Math.imul(p,oe)|0)+(n>>>13)|0)+($e>>>26)|0,$e&=67108863,o=Math.imul(S,U),n=(n=Math.imul(S,K))+Math.imul(R,U)|0,i=Math.imul(R,K),o=o+Math.imul(A,G)|0,n=(n=n+Math.imul(A,H)|0)+Math.imul(O,G)|0,i=i+Math.imul(O,H)|0,o=o+Math.imul(_,W)|0,n=(n=n+Math.imul(_,z)|0)+Math.imul(T,W)|0,i=i+Math.imul(T,z)|0,o=o+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul($,Q)|0,i=i+Math.imul($,Y)|0,o=o+Math.imul(g,J)|0,n=(n=n+Math.imul(g,ee)|0)+Math.imul(b,J)|0,i=i+Math.imul(b,ee)|0,o=o+Math.imul(f,re)|0,n=(n=n+Math.imul(f,oe)|0)+Math.imul(m,re)|0,i=i+Math.imul(m,oe)|0;var ke=(u+(o=o+Math.imul(d,ie)|0)|0)+((8191&(n=(n=n+Math.imul(d,ae)|0)+Math.imul(p,ie)|0))<<13)|0;u=((i=i+Math.imul(p,ae)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,o=Math.imul(C,U),n=(n=Math.imul(C,K))+Math.imul(P,U)|0,i=Math.imul(P,K),o=o+Math.imul(S,G)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(R,G)|0,i=i+Math.imul(R,H)|0,o=o+Math.imul(A,W)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(O,W)|0,i=i+Math.imul(O,z)|0,o=o+Math.imul(_,Q)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(T,Q)|0,i=i+Math.imul(T,Y)|0,o=o+Math.imul(w,J)|0,n=(n=n+Math.imul(w,ee)|0)+Math.imul($,J)|0,i=i+Math.imul($,ee)|0,o=o+Math.imul(g,re)|0,n=(n=n+Math.imul(g,oe)|0)+Math.imul(b,re)|0,i=i+Math.imul(b,oe)|0,o=o+Math.imul(f,ie)|0,n=(n=n+Math.imul(f,ae)|0)+Math.imul(m,ie)|0,i=i+Math.imul(m,ae)|0;var _e=(u+(o=o+Math.imul(d,ce)|0)|0)+((8191&(n=(n=n+Math.imul(d,ue)|0)+Math.imul(p,ce)|0))<<13)|0;u=((i=i+Math.imul(p,ue)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,o=Math.imul(B,U),n=(n=Math.imul(B,K))+Math.imul(D,U)|0,i=Math.imul(D,K),o=o+Math.imul(C,G)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(P,G)|0,i=i+Math.imul(P,H)|0,o=o+Math.imul(S,W)|0,n=(n=n+Math.imul(S,z)|0)+Math.imul(R,W)|0,i=i+Math.imul(R,z)|0,o=o+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(O,Q)|0,i=i+Math.imul(O,Y)|0,o=o+Math.imul(_,J)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(T,J)|0,i=i+Math.imul(T,ee)|0,o=o+Math.imul(w,re)|0,n=(n=n+Math.imul(w,oe)|0)+Math.imul($,re)|0,i=i+Math.imul($,oe)|0,o=o+Math.imul(g,ie)|0,n=(n=n+Math.imul(g,ae)|0)+Math.imul(b,ie)|0,i=i+Math.imul(b,ae)|0,o=o+Math.imul(f,ce)|0,n=(n=n+Math.imul(f,ue)|0)+Math.imul(m,ce)|0,i=i+Math.imul(m,ue)|0;var Te=(u+(o=o+Math.imul(d,de)|0)|0)+((8191&(n=(n=n+Math.imul(d,pe)|0)+Math.imul(p,de)|0))<<13)|0;u=((i=i+Math.imul(p,pe)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,o=Math.imul(L,U),n=(n=Math.imul(L,K))+Math.imul(j,U)|0,i=Math.imul(j,K),o=o+Math.imul(B,G)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(D,G)|0,i=i+Math.imul(D,H)|0,o=o+Math.imul(C,W)|0,n=(n=n+Math.imul(C,z)|0)+Math.imul(P,W)|0,i=i+Math.imul(P,z)|0,o=o+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(R,Q)|0,i=i+Math.imul(R,Y)|0,o=o+Math.imul(A,J)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(O,J)|0,i=i+Math.imul(O,ee)|0,o=o+Math.imul(_,re)|0,n=(n=n+Math.imul(_,oe)|0)+Math.imul(T,re)|0,i=i+Math.imul(T,oe)|0,o=o+Math.imul(w,ie)|0,n=(n=n+Math.imul(w,ae)|0)+Math.imul($,ie)|0,i=i+Math.imul($,ae)|0,o=o+Math.imul(g,ce)|0,n=(n=n+Math.imul(g,ue)|0)+Math.imul(b,ce)|0,i=i+Math.imul(b,ue)|0,o=o+Math.imul(f,de)|0,n=(n=n+Math.imul(f,pe)|0)+Math.imul(m,de)|0,i=i+Math.imul(m,pe)|0;var Ie=(u+(o=o+Math.imul(d,fe)|0)|0)+((8191&(n=(n=n+Math.imul(d,me)|0)+Math.imul(p,fe)|0))<<13)|0;u=((i=i+Math.imul(p,me)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,o=Math.imul(L,G),n=(n=Math.imul(L,H))+Math.imul(j,G)|0,i=Math.imul(j,H),o=o+Math.imul(B,W)|0,n=(n=n+Math.imul(B,z)|0)+Math.imul(D,W)|0,i=i+Math.imul(D,z)|0,o=o+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,Y)|0,o=o+Math.imul(S,J)|0,n=(n=n+Math.imul(S,ee)|0)+Math.imul(R,J)|0,i=i+Math.imul(R,ee)|0,o=o+Math.imul(A,re)|0,n=(n=n+Math.imul(A,oe)|0)+Math.imul(O,re)|0,i=i+Math.imul(O,oe)|0,o=o+Math.imul(_,ie)|0,n=(n=n+Math.imul(_,ae)|0)+Math.imul(T,ie)|0,i=i+Math.imul(T,ae)|0,o=o+Math.imul(w,ce)|0,n=(n=n+Math.imul(w,ue)|0)+Math.imul($,ce)|0,i=i+Math.imul($,ue)|0,o=o+Math.imul(g,de)|0,n=(n=n+Math.imul(g,pe)|0)+Math.imul(b,de)|0,i=i+Math.imul(b,pe)|0;var Ae=(u+(o=o+Math.imul(f,fe)|0)|0)+((8191&(n=(n=n+Math.imul(f,me)|0)+Math.imul(m,fe)|0))<<13)|0;u=((i=i+Math.imul(m,me)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,o=Math.imul(L,W),n=(n=Math.imul(L,z))+Math.imul(j,W)|0,i=Math.imul(j,z),o=o+Math.imul(B,Q)|0,n=(n=n+Math.imul(B,Y)|0)+Math.imul(D,Q)|0,i=i+Math.imul(D,Y)|0,o=o+Math.imul(C,J)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(P,J)|0,i=i+Math.imul(P,ee)|0,o=o+Math.imul(S,re)|0,n=(n=n+Math.imul(S,oe)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,oe)|0,o=o+Math.imul(A,ie)|0,n=(n=n+Math.imul(A,ae)|0)+Math.imul(O,ie)|0,i=i+Math.imul(O,ae)|0,o=o+Math.imul(_,ce)|0,n=(n=n+Math.imul(_,ue)|0)+Math.imul(T,ce)|0,i=i+Math.imul(T,ue)|0,o=o+Math.imul(w,de)|0,n=(n=n+Math.imul(w,pe)|0)+Math.imul($,de)|0,i=i+Math.imul($,pe)|0;var Oe=(u+(o=o+Math.imul(g,fe)|0)|0)+((8191&(n=(n=n+Math.imul(g,me)|0)+Math.imul(b,fe)|0))<<13)|0;u=((i=i+Math.imul(b,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,o=Math.imul(L,Q),n=(n=Math.imul(L,Y))+Math.imul(j,Q)|0,i=Math.imul(j,Y),o=o+Math.imul(B,J)|0,n=(n=n+Math.imul(B,ee)|0)+Math.imul(D,J)|0,i=i+Math.imul(D,ee)|0,o=o+Math.imul(C,re)|0,n=(n=n+Math.imul(C,oe)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,oe)|0,o=o+Math.imul(S,ie)|0,n=(n=n+Math.imul(S,ae)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,ae)|0,o=o+Math.imul(A,ce)|0,n=(n=n+Math.imul(A,ue)|0)+Math.imul(O,ce)|0,i=i+Math.imul(O,ue)|0,o=o+Math.imul(_,de)|0,n=(n=n+Math.imul(_,pe)|0)+Math.imul(T,de)|0,i=i+Math.imul(T,pe)|0;var Ee=(u+(o=o+Math.imul(w,fe)|0)|0)+((8191&(n=(n=n+Math.imul(w,me)|0)+Math.imul($,fe)|0))<<13)|0;u=((i=i+Math.imul($,me)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,o=Math.imul(L,J),n=(n=Math.imul(L,ee))+Math.imul(j,J)|0,i=Math.imul(j,ee),o=o+Math.imul(B,re)|0,n=(n=n+Math.imul(B,oe)|0)+Math.imul(D,re)|0,i=i+Math.imul(D,oe)|0,o=o+Math.imul(C,ie)|0,n=(n=n+Math.imul(C,ae)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,ae)|0,o=o+Math.imul(S,ce)|0,n=(n=n+Math.imul(S,ue)|0)+Math.imul(R,ce)|0,i=i+Math.imul(R,ue)|0,o=o+Math.imul(A,de)|0,n=(n=n+Math.imul(A,pe)|0)+Math.imul(O,de)|0,i=i+Math.imul(O,pe)|0;var Se=(u+(o=o+Math.imul(_,fe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(T,fe)|0))<<13)|0;u=((i=i+Math.imul(T,me)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,o=Math.imul(L,re),n=(n=Math.imul(L,oe))+Math.imul(j,re)|0,i=Math.imul(j,oe),o=o+Math.imul(B,ie)|0,n=(n=n+Math.imul(B,ae)|0)+Math.imul(D,ie)|0,i=i+Math.imul(D,ae)|0,o=o+Math.imul(C,ce)|0,n=(n=n+Math.imul(C,ue)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,ue)|0,o=o+Math.imul(S,de)|0,n=(n=n+Math.imul(S,pe)|0)+Math.imul(R,de)|0,i=i+Math.imul(R,pe)|0;var Re=(u+(o=o+Math.imul(A,fe)|0)|0)+((8191&(n=(n=n+Math.imul(A,me)|0)+Math.imul(O,fe)|0))<<13)|0;u=((i=i+Math.imul(O,me)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,o=Math.imul(L,ie),n=(n=Math.imul(L,ae))+Math.imul(j,ie)|0,i=Math.imul(j,ae),o=o+Math.imul(B,ce)|0,n=(n=n+Math.imul(B,ue)|0)+Math.imul(D,ce)|0,i=i+Math.imul(D,ue)|0,o=o+Math.imul(C,de)|0,n=(n=n+Math.imul(C,pe)|0)+Math.imul(P,de)|0,i=i+Math.imul(P,pe)|0;var xe=(u+(o=o+Math.imul(S,fe)|0)|0)+((8191&(n=(n=n+Math.imul(S,me)|0)+Math.imul(R,fe)|0))<<13)|0;u=((i=i+Math.imul(R,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,o=Math.imul(L,ce),n=(n=Math.imul(L,ue))+Math.imul(j,ce)|0,i=Math.imul(j,ue),o=o+Math.imul(B,de)|0,n=(n=n+Math.imul(B,pe)|0)+Math.imul(D,de)|0,i=i+Math.imul(D,pe)|0;var Ce=(u+(o=o+Math.imul(C,fe)|0)|0)+((8191&(n=(n=n+Math.imul(C,me)|0)+Math.imul(P,fe)|0))<<13)|0;u=((i=i+Math.imul(P,me)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,o=Math.imul(L,de),n=(n=Math.imul(L,pe))+Math.imul(j,de)|0,i=Math.imul(j,pe);var Pe=(u+(o=o+Math.imul(B,fe)|0)|0)+((8191&(n=(n=n+Math.imul(B,me)|0)+Math.imul(D,fe)|0))<<13)|0;u=((i=i+Math.imul(D,me)|0)+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Ne=(u+(o=Math.imul(L,fe))|0)+((8191&(n=(n=Math.imul(L,me))+Math.imul(j,fe)|0))<<13)|0;return u=((i=Math.imul(j,me))+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=ye,c[1]=ge,c[2]=be,c[3]=ve,c[4]=we,c[5]=$e,c[6]=ke,c[7]=_e,c[8]=Te,c[9]=Ie,c[10]=Ae,c[11]=Oe,c[12]=Ee,c[13]=Se,c[14]=Re,c[15]=xe,c[16]=Ce,c[17]=Pe,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function f(e,t,r){return(new m).mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(h=p),n.prototype.mulTo=function(e,t){var r,o=this.length+e.length;return r=10===this.length&&10===e.length?h(this,e,t):o<63?p(this,e,t):o<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var o=0,n=0,i=0;i<r.length-1;i++){var a=n;n=0;for(var s=67108863&o,c=Math.min(i,t.length-1),u=Math.max(0,i-e.length+1);u<=c;u++){var l=i-u,d=(0|e.words[l])*(0|t.words[u]),p=67108863&d;s=67108863&(p=p+s|0),n+=(a=(a=a+(d/67108864|0)|0)+(p>>>26)|0)>>>26,a&=67108863}r.words[i]=s,o=a,a=n}return 0!==o?r.words[i]=o:r.length--,r.strip()}(this,e,t):f(this,e,t),r},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=n.prototype._countBits(e)-1,o=0;o<e;o++)t[o]=this.revBin(o,r,e);return t},m.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var o=0,n=0;n<t;n++)o|=(1&e)<<t-n-1,e>>=1;return o},m.prototype.permute=function(e,t,r,o,n,i){for(var a=0;a<i;a++)o[a]=t[e[a]],n[a]=r[e[a]]},m.prototype.transform=function(e,t,r,o,n,i){this.permute(i,e,t,r,o,n);for(var a=1;a<n;a<<=1)for(var s=a<<1,c=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),l=0;l<n;l+=s)for(var d=c,p=u,h=0;h<a;h++){var f=r[l+h],m=o[l+h],y=r[l+h+a],g=o[l+h+a],b=d*y-p*g;g=d*g+p*y,y=b,r[l+h]=f+y,o[l+h]=m+g,r[l+h+a]=f-y,o[l+h+a]=m-g,h!==s&&(b=c*d-u*p,p=c*p+u*d,d=b)}},m.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),o=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+o},m.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var o=0;o<r/2;o++){var n=e[o];e[o]=e[r-o-1],e[r-o-1]=n,n=t[o],t[o]=-t[r-o-1],t[r-o-1]=-n}},m.prototype.normalize13b=function(e,t){for(var r=0,o=0;o<t/2;o++){var n=8192*Math.round(e[2*o+1]/t)+Math.round(e[2*o]/t)+r;e[o]=67108863&n,r=n<67108864?0:n/67108864|0}return e},m.prototype.convert13b=function(e,t,o,n){for(var i=0,a=0;a<t;a++)i+=0|e[a],o[2*a]=8191&i,i>>>=13,o[2*a+1]=8191&i,i>>>=13;for(a=2*t;a<n;++a)o[a]=0;r(0===i),r(!(-8192&i))},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 o=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(o),i=this.stub(o),a=new Array(o),s=new Array(o),c=new Array(o),u=new Array(o),l=new Array(o),d=new Array(o),p=r.words;p.length=o,this.convert13b(e.words,e.length,a,o),this.convert13b(t.words,t.length,u,o),this.transform(a,i,s,c,o,n),this.transform(u,i,l,d,o,n);for(var h=0;h<o;h++){var f=s[h]*l[h]-c[h]*d[h];c[h]=s[h]*d[h]+c[h]*l[h],s[h]=f}return this.conjugate(s,c,o),this.transform(s,c,p,i,o,n),this.conjugate(p,i,o),this.normalize13b(p,o),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},n.prototype.mul=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},n.prototype.mulf=function(e){var t=new n(null);return t.words=new Array(this.length+e.length),f(this,e,t)},n.prototype.imul=function(e){return this.clone().mulTo(e,this)},n.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,o=0;o<this.length;o++){var n=(0|this.words[o])*e,i=(67108863&n)+(67108863&t);t>>=26,t+=n/67108864|0,t+=i>>>26,this.words[o]=67108863&i}return 0!==t&&(this.words[o]=t,this.length++),this},n.prototype.muln=function(e){return this.clone().imuln(e)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var o=r/26|0,n=r%26;t[r]=(e.words[o]&1<<n)>>>n}return t}(e);if(0===t.length)return new n(1);for(var r=this,o=0;o<t.length&&0===t[o];o++,r=r.sqr());if(++o<t.length)for(var i=r.sqr();o<t.length;o++,i=i.sqr())0!==t[o]&&(r=r.mul(i));return r},n.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,o=e%26,n=(e-o)/26,i=67108863>>>26-o<<26-o;if(0!==o){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&i,c=(0|this.words[t])-s<<o;this.words[t]=c|a,a=s>>>26-o}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()},n.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},n.prototype.iushrn=function(e,t,o){var n;r("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var i=e%26,a=Math.min((e-i)/26,this.length),s=67108863^67108863>>>i<<i,c=o;if(n-=a,n=Math.max(0,n),c){for(var u=0;u<a;u++)c.words[u]=this.words[u];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var d=0|this.words[u];this.words[u]=l<<26-i|d>>>i,l=d&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(e,t,o){return r(0===this.negative),this.iushrn(e,t,o)},n.prototype.shln=function(e){return this.clone().ishln(e)},n.prototype.ushln=function(e){return this.clone().iushln(e)},n.prototype.shrn=function(e){return this.clone().ishrn(e)},n.prototype.ushrn=function(e){return this.clone().iushrn(e)},n.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26,n=1<<t;return!(this.length<=o)&&!!(this.words[o]&n)},n.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,o=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=o)return this;if(0!==t&&o++,this.length=Math.min(o,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this.strip()},n.prototype.maskn=function(e){return this.clone().imaskn(e)},n.prototype.iaddn=function(e){return r("number"==typeof e),r(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)},n.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},n.prototype.isubn=function(e){if(r("number"==typeof e),r(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()},n.prototype.addn=function(e){return this.clone().iaddn(e)},n.prototype.subn=function(e){return this.clone().isubn(e)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(e,t,o){var n,i,a=e.length+o;this._expand(a);var s=0;for(n=0;n<e.length;n++){i=(0|this.words[n+o])+s;var c=(0|e.words[n])*t;s=((i-=67108863&c)>>26)-(c/67108864|0),this.words[n+o]=67108863&i}for(;n<this.length-o;n++)s=(i=(0|this.words[n+o])+s)>>26,this.words[n+o]=67108863&i;if(0===s)return this.strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(i=-(0|this.words[n])+s)>>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},n.prototype._wordDiv=function(e,t){var r=(this.length,e.length),o=this.clone(),i=e,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),o.iushln(r),a=0|i.words[i.length-1]);var s,c=o.length-i.length;if("mod"!==t){(s=new n(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=o.clone()._ishlnsubmul(i,1,c);0===l.negative&&(o=l,s&&(s.words[c]=1));for(var d=c-1;d>=0;d--){var p=67108864*(0|o.words[i.length+d])+(0|o.words[i.length+d-1]);for(p=Math.min(p/a|0,67108863),o._ishlnsubmul(i,p,d);0!==o.negative;)p--,o.negative=0,o._ishlnsubmul(i,1,d),o.isZero()||(o.negative^=1);s&&(s.words[d]=p)}return s&&s.strip(),o.strip(),"div"!==t&&0!==r&&o.iushrn(r),{div:s||null,mod:o}},n.prototype.divmod=function(e,t,o){return r(!e.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),o&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new n(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new n(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new n(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},n.prototype.div=function(e){return this.divmod(e,"div",!1).div},n.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},n.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},n.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,o=e.ushrn(1),n=e.andln(1),i=r.cmp(o);return i<0||1===n&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},n.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,o=0,n=this.length-1;n>=0;n--)o=(t*o+(0|this.words[n]))%e;return o},n.prototype.idivn=function(e){r(e<=67108863);for(var t=0,o=this.length-1;o>=0;o--){var n=(0|this.words[o])+67108864*t;this.words[o]=n/e|0,t=n%e}return this.strip()},n.prototype.divn=function(e){return this.clone().idivn(e)},n.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new n(1),a=new n(0),s=new n(0),c=new n(1),u=0;t.isEven()&&o.isEven();)t.iushrn(1),o.iushrn(1),++u;for(var l=o.clone(),d=t.clone();!t.isZero();){for(var p=0,h=1;!(t.words[0]&h)&&p<26;++p,h<<=1);if(p>0)for(t.iushrn(p);p-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var f=0,m=1;!(o.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(o.iushrn(f);f-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(o)>=0?(t.isub(o),i.isub(s),a.isub(c)):(o.isub(t),s.isub(i),c.isub(a))}return{a:s,b:c,gcd:o.iushln(u)}},n.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,o=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new n(1),s=new n(0),c=o.clone();t.cmpn(1)>0&&o.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var d=0,p=1;!(o.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(o.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(o)>=0?(t.isub(o),a.isub(s)):(o.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},n.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 o=0;t.isEven()&&r.isEven();o++)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 i=t;t=r,r=i}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(o)},n.prototype.invm=function(e){return this.egcd(e).a.umod(e)},n.prototype.isEven=function(){return!(1&this.words[0])},n.prototype.isOdd=function(){return!(1&~this.words[0])},n.prototype.andln=function(e){return this.words[0]&e},n.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,o=(e-t)/26,n=1<<t;if(this.length<=o)return this._expand(o+1),this.words[o]|=n,this;for(var i=n,a=o;0!==i&&a<this.length;a++){var s=0|this.words[a];i=(s+=i)>>>26,s&=67108863,this.words[a]=s}return 0!==i&&(this.words[a]=i,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(e){var t,o=e<0;if(0!==this.negative&&!o)return-1;if(0===this.negative&&o)return 1;if(this.strip(),this.length>1)t=1;else{o&&(e=-e),r(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},n.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},n.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 o=0|this.words[r],n=0|e.words[r];if(o!==n){o<n?t=-1:o>n&&(t=1);break}}return t},n.prototype.gtn=function(e){return 1===this.cmpn(e)},n.prototype.gt=function(e){return 1===this.cmp(e)},n.prototype.gten=function(e){return this.cmpn(e)>=0},n.prototype.gte=function(e){return this.cmp(e)>=0},n.prototype.ltn=function(e){return-1===this.cmpn(e)},n.prototype.lt=function(e){return-1===this.cmp(e)},n.prototype.lten=function(e){return this.cmpn(e)<=0},n.prototype.lte=function(e){return this.cmp(e)<=0},n.prototype.eqn=function(e){return 0===this.cmpn(e)},n.prototype.eq=function(e){return 0===this.cmp(e)},n.red=function(e){return new k(e)},n.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(e){return this.red=e,this},n.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},n.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},n.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},n.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},n.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},n.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},n.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},n.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function g(e,t){this.name=e,this.p=new n(t,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function $(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(e){if("string"==typeof e){var t=n._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function _(e){k.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}g.prototype._tmp=function(){var e=new n(null);return e.words=new Array(Math.ceil(this.n/13)),e},g.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 o=t<this.n?-1:r.ucmp(this.p);return 0===o?(r.words[0]=0,r.length=1):o>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(e,t){e.iushrn(this.n,0,t)},g.prototype.imulK=function(e){return e.imul(this.k)},o(b,g),b.prototype.split=function(e,t){for(var r=4194303,o=Math.min(e.length,9),n=0;n<o;n++)t.words[n]=e.words[n];if(t.length=o,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=i&r,n=10;n<e.length;n++){var a=0|e.words[n];e.words[n-10]=(a&r)<<4|i>>>22,i=a}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},b.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 o=0|e.words[r];t+=977*o,e.words[r]=67108863&t,t=64*o+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},o(v,g),o(w,g),o($,g),$.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var o=19*(0|e.words[r])+t,n=67108863&o;o>>>=26,e.words[r]=n,t=o}return 0!==t&&(e.words[e.length++]=t),e},n._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new $}return y[e]=t,t},k.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},k.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},k.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},k.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},k.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},k.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},k.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},k.prototype.isqr=function(e){return this.imul(e,e.clone())},k.prototype.sqr=function(e){return this.mul(e,e)},k.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var o=this.m.add(new n(1)).iushrn(2);return this.pow(e,o)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new n(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),p=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),f=a;0!==h.cmp(s);){for(var m=h,y=0;0!==m.cmp(s);y++)m=m.redSqr();r(y<f);var g=this.pow(d,new n(1).iushln(f-y-1));p=p.redMul(g),d=g.redSqr(),h=h.redMul(d),f=y}return p},k.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},k.prototype.pow=function(e,t){if(t.isZero())return new n(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=e;for(var o=2;o<r.length;o++)r[o]=this.mul(r[o-1],e);var i=r[0],a=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),o=t.length-1;o>=0;o--){for(var u=t.words[o],l=c-1;l>=0;l--){var d=u>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4===++s||0===o&&0===l)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}c=26}return i},k.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},k.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},n.mont=function(e){return new _(e)},o(_,k),_.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},_.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},_.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(o).iushrn(this.shift),i=n;return n.cmp(this.m)>=0?i=n.isub(this.m):n.cmpn(0)<0&&(i=n.iadd(this.m)),i._forceRed(this)},_.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new n(0)._forceRed(this);var r=e.mul(t),o=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(o).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},_.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,commonjsGlobal)}(bn)),bn.exports}function requireWithPublic(){if(hasRequiredWithPublic)return withPublic_1;hasRequiredWithPublic=1;var e=requireBn(),t=requireSafeBuffer$1().Buffer;return withPublic_1=function(r,o){return t.from(r.toRed(e.mont(o.modulus)).redPow(new e(o.publicExponent)).fromRed().toArray())}}function requirePublicEncrypt(){if(hasRequiredPublicEncrypt)return publicEncrypt;hasRequiredPublicEncrypt=1;var e=requireParseAsn1(),t=requireBrowser$b(),r=requireBrowser$9(),o=requireMgf(),n=requireXor(),i=requireBn(),a=requireWithPublic(),s=requireBrowserifyRsa(),c=requireSafeBuffer$1().Buffer;return publicEncrypt=function(u,l,d){var p;p=u.padding?u.padding:d?1:4;var h,f=e(u);if(4===p)h=function(e,a){var s=e.modulus.byteLength(),u=a.length,l=r("sha1").update(c.alloc(0)).digest(),d=l.length,p=2*d;if(u>s-p-2)throw new Error("message too long");var h=c.alloc(s-u-p-2),f=s-d-1,m=t(d),y=n(c.concat([l,h,c.alloc(1,1),a],f),o(m,f)),g=n(m,o(y,d));return new i(c.concat([c.alloc(1),g,y],s))}(f,l);else if(1===p)h=function(e,r,o){var n,a=r.length,s=e.modulus.byteLength();if(a>s-11)throw new Error("message too long");n=o?c.alloc(s-a-3,255):function(e){var r,o=c.allocUnsafe(e),n=0,i=t(2*e),a=0;for(;n<e;)a===i.length&&(i=t(2*e),a=0),(r=i[a++])&&(o[n++]=r);return o}(s-a-3);return new i(c.concat([c.from([0,o?1:2]),n,c.alloc(1),r],s))}(f,l,d);else{if(3!==p)throw new Error("unknown padding");if((h=new i(l)).cmp(f.modulus)>=0)throw new Error("data too long for modulus")}return d?s(h,f):a(h,f)}}function requirePrivateDecrypt(){if(hasRequiredPrivateDecrypt)return privateDecrypt;hasRequiredPrivateDecrypt=1;var e=requireParseAsn1(),t=requireMgf(),r=requireXor(),o=requireBn(),n=requireBrowserifyRsa(),i=requireBrowser$9(),a=requireWithPublic(),s=requireSafeBuffer$1().Buffer;return privateDecrypt=function(c,u,l){var d;d=c.padding?c.padding:l?1:4;var p,h=e(c),f=h.modulus.byteLength();if(u.length>f||new o(u).cmp(h.modulus)>=0)throw new Error("decryption error");p=l?a(new o(u),h):n(u,h);var m=s.alloc(f-p.length);if(p=s.concat([m,p],f),4===d)return function(e,o){var n=e.modulus.byteLength(),a=i("sha1").update(s.alloc(0)).digest(),c=a.length;if(0!==o[0])throw new Error("decryption error");var u=o.slice(1,c+1),l=o.slice(c+1),d=r(u,t(l,c)),p=r(l,t(d,n-c-1));if(function(e,t){e=s.from(e),t=s.from(t);var r=0,o=e.length;e.length!==t.length&&(r++,o=Math.min(e.length,t.length));var n=-1;for(;++n<o;)r+=e[n]^t[n];return r}(a,p.slice(0,c)))throw new Error("decryption error");var h=c;for(;0===p[h];)h++;if(1!==p[h++])throw new Error("decryption error");return p.slice(h)}(h,p);if(1===d)return function(e,t,r){var o=t.slice(0,2),n=2,i=0;for(;0!==t[n++];)if(n>=t.length){i++;break}var a=t.slice(2,n-1);("0002"!==o.toString("hex")&&!r||"0001"!==o.toString("hex")&&r)&&i++;a.length<8&&i++;if(i)throw new Error("decryption error");return t.slice(n)}(0,p,l);if(3===d)return p;throw new Error("unknown padding")}}function requireBrowser$1(){return hasRequiredBrowser$1||(hasRequiredBrowser$1=1,function(e){e.publicEncrypt=requirePublicEncrypt(),e.privateDecrypt=requirePrivateDecrypt(),e.privateEncrypt=function(t,r){return e.publicEncrypt(t,r,!0)},e.publicDecrypt=function(t,r){return e.privateDecrypt(t,r,!0)}}(browser$3)),browser$3}bn.exports;var browser$2={},hasRequiredBrowser,hasRequiredCryptoBrowserify;function requireBrowser(){if(hasRequiredBrowser)return browser$2;function e(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}hasRequiredBrowser=1;var t=requireSafeBuffer$1(),r=requireBrowser$b(),o=t.Buffer,n=t.kMaxLength,i=commonjsGlobal.crypto||commonjsGlobal.msCrypto,a=Math.pow(2,32)-1;function s(e,t){if("number"!=typeof e||e!=e)throw new TypeError("offset must be a number");if(e>a||e<0)throw new TypeError("offset must be a uint32");if(e>n||e>t)throw new RangeError("offset out of range")}function c(e,t,r){if("number"!=typeof e||e!=e)throw new TypeError("size must be a number");if(e>a||e<0)throw new TypeError("size must be a uint32");if(e+t>r||e>n)throw new RangeError("buffer too small")}function u(e,t,o,n){if(process$1$1.browser){var a=e.buffer,s=new Uint8Array(a,t,o);return i.getRandomValues(s),n?void process$1$1.nextTick((function(){n(null,e)})):e}if(!n)return r(o).copy(e,t),e;r(o,(function(r,o){if(r)return n(r);o.copy(e,t),n(null,e)}))}return i&&i.getRandomValues||!process$1$1.browser?(browser$2.randomFill=function(e,t,r,n){if(!(o.isBuffer(e)||e instanceof commonjsGlobal.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof t)n=t,t=0,r=e.length;else if("function"==typeof r)n=r,r=e.length-t;else if("function"!=typeof n)throw new TypeError('"cb" argument must be a function');return s(t,e.length),c(r,t,e.length),u(e,t,r,n)},browser$2.randomFillSync=function(e,t,r){void 0===t&&(t=0);if(!(o.isBuffer(e)||e instanceof commonjsGlobal.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');s(t,e.length),void 0===r&&(r=e.length-t);return c(r,t,e.length),u(e,t,r)}):(browser$2.randomFill=e,browser$2.randomFillSync=e),browser$2}function requireCryptoBrowserify(){if(hasRequiredCryptoBrowserify)return cryptoBrowserify;hasRequiredCryptoBrowserify=1,cryptoBrowserify.randomBytes=cryptoBrowserify.rng=cryptoBrowserify.pseudoRandomBytes=cryptoBrowserify.prng=requireBrowser$b(),cryptoBrowserify.createHash=cryptoBrowserify.Hash=requireBrowser$9(),cryptoBrowserify.createHmac=cryptoBrowserify.Hmac=requireBrowser$8();var e=requireAlgos(),t=Object.keys(e),r=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(t);cryptoBrowserify.getHashes=function(){return r};var o=requireBrowser$7();cryptoBrowserify.pbkdf2=o.pbkdf2,cryptoBrowserify.pbkdf2Sync=o.pbkdf2Sync;var n=requireBrowser$5();cryptoBrowserify.Cipher=n.Cipher,cryptoBrowserify.createCipher=n.createCipher,cryptoBrowserify.Cipheriv=n.Cipheriv,cryptoBrowserify.createCipheriv=n.createCipheriv,cryptoBrowserify.Decipher=n.Decipher,cryptoBrowserify.createDecipher=n.createDecipher,cryptoBrowserify.Decipheriv=n.Decipheriv,cryptoBrowserify.createDecipheriv=n.createDecipheriv,cryptoBrowserify.getCiphers=n.getCiphers,cryptoBrowserify.listCiphers=n.listCiphers;var i=requireBrowser$4();cryptoBrowserify.DiffieHellmanGroup=i.DiffieHellmanGroup,cryptoBrowserify.createDiffieHellmanGroup=i.createDiffieHellmanGroup,cryptoBrowserify.getDiffieHellman=i.getDiffieHellman,cryptoBrowserify.createDiffieHellman=i.createDiffieHellman,cryptoBrowserify.DiffieHellman=i.DiffieHellman;var a=requireBrowser$3();cryptoBrowserify.createSign=a.createSign,cryptoBrowserify.Sign=a.Sign,cryptoBrowserify.createVerify=a.createVerify,cryptoBrowserify.Verify=a.Verify,cryptoBrowserify.createECDH=requireBrowser$2();var s=requireBrowser$1();cryptoBrowserify.publicEncrypt=s.publicEncrypt,cryptoBrowserify.privateEncrypt=s.privateEncrypt,cryptoBrowserify.publicDecrypt=s.publicDecrypt,cryptoBrowserify.privateDecrypt=s.privateDecrypt;var c=requireBrowser();return cryptoBrowserify.randomFill=c.randomFill,cryptoBrowserify.randomFillSync=c.randomFillSync,cryptoBrowserify.createCredentials=function(){throw new Error("sorry, createCredentials is not implemented yet\nwe accept pull requests\nhttps://github.com/browserify/crypto-browserify")},cryptoBrowserify.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},cryptoBrowserify}!function(e){!function(e){var t=function(e){var t,r=new Float64Array(16);if(e)for(t=0;t<e.length;t++)r[t]=e[t];return r},r=function(){throw new Error("no PRNG")},o=new Uint8Array(16),n=new Uint8Array(32);n[0]=9;var i=t(),a=t([1]),s=t([56129,1]),c=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),u=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),l=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),d=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),p=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function h(e,t,r,o){e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r,e[t+4]=o>>24&255,e[t+5]=o>>16&255,e[t+6]=o>>8&255,e[t+7]=255&o}function f(e,t,r,o,n){var i,a=0;for(i=0;i<n;i++)a|=e[t+i]^r[o+i];return(1&a-1>>>8)-1}function m(e,t,r,o){return f(e,t,r,o,16)}function y(e,t,r,o){return f(e,t,r,o,32)}function g(e,t,r,o){!function(e,t,r,o){for(var n,i=255&o[0]|(255&o[1])<<8|(255&o[2])<<16|(255&o[3])<<24,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&o[4]|(255&o[5])<<8|(255&o[6])<<16|(255&o[7])<<24,d=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,p=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,f=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,m=255&o[8]|(255&o[9])<<8|(255&o[10])<<16|(255&o[11])<<24,y=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,g=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,b=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&o[12]|(255&o[13])<<8|(255&o[14])<<16|(255&o[15])<<24,$=i,k=a,_=s,T=c,I=u,A=l,O=d,E=p,S=h,R=f,x=m,C=y,P=g,N=b,B=v,D=w,M=0;M<20;M+=2)$^=(n=(P^=(n=(S^=(n=(I^=(n=$+P|0)<<7|n>>>25)+$|0)<<9|n>>>23)+I|0)<<13|n>>>19)+S|0)<<18|n>>>14,A^=(n=(k^=(n=(N^=(n=(R^=(n=A+k|0)<<7|n>>>25)+A|0)<<9|n>>>23)+R|0)<<13|n>>>19)+N|0)<<18|n>>>14,x^=(n=(O^=(n=(_^=(n=(B^=(n=x+O|0)<<7|n>>>25)+x|0)<<9|n>>>23)+B|0)<<13|n>>>19)+_|0)<<18|n>>>14,D^=(n=(C^=(n=(E^=(n=(T^=(n=D+C|0)<<7|n>>>25)+D|0)<<9|n>>>23)+T|0)<<13|n>>>19)+E|0)<<18|n>>>14,$^=(n=(T^=(n=(_^=(n=(k^=(n=$+T|0)<<7|n>>>25)+$|0)<<9|n>>>23)+k|0)<<13|n>>>19)+_|0)<<18|n>>>14,A^=(n=(I^=(n=(E^=(n=(O^=(n=A+I|0)<<7|n>>>25)+A|0)<<9|n>>>23)+O|0)<<13|n>>>19)+E|0)<<18|n>>>14,x^=(n=(R^=(n=(S^=(n=(C^=(n=x+R|0)<<7|n>>>25)+x|0)<<9|n>>>23)+C|0)<<13|n>>>19)+S|0)<<18|n>>>14,D^=(n=(B^=(n=(N^=(n=(P^=(n=D+B|0)<<7|n>>>25)+D|0)<<9|n>>>23)+P|0)<<13|n>>>19)+N|0)<<18|n>>>14;$=$+i|0,k=k+a|0,_=_+s|0,T=T+c|0,I=I+u|0,A=A+l|0,O=O+d|0,E=E+p|0,S=S+h|0,R=R+f|0,x=x+m|0,C=C+y|0,P=P+g|0,N=N+b|0,B=B+v|0,D=D+w|0,e[0]=$>>>0&255,e[1]=$>>>8&255,e[2]=$>>>16&255,e[3]=$>>>24&255,e[4]=k>>>0&255,e[5]=k>>>8&255,e[6]=k>>>16&255,e[7]=k>>>24&255,e[8]=_>>>0&255,e[9]=_>>>8&255,e[10]=_>>>16&255,e[11]=_>>>24&255,e[12]=T>>>0&255,e[13]=T>>>8&255,e[14]=T>>>16&255,e[15]=T>>>24&255,e[16]=I>>>0&255,e[17]=I>>>8&255,e[18]=I>>>16&255,e[19]=I>>>24&255,e[20]=A>>>0&255,e[21]=A>>>8&255,e[22]=A>>>16&255,e[23]=A>>>24&255,e[24]=O>>>0&255,e[25]=O>>>8&255,e[26]=O>>>16&255,e[27]=O>>>24&255,e[28]=E>>>0&255,e[29]=E>>>8&255,e[30]=E>>>16&255,e[31]=E>>>24&255,e[32]=S>>>0&255,e[33]=S>>>8&255,e[34]=S>>>16&255,e[35]=S>>>24&255,e[36]=R>>>0&255,e[37]=R>>>8&255,e[38]=R>>>16&255,e[39]=R>>>24&255,e[40]=x>>>0&255,e[41]=x>>>8&255,e[42]=x>>>16&255,e[43]=x>>>24&255,e[44]=C>>>0&255,e[45]=C>>>8&255,e[46]=C>>>16&255,e[47]=C>>>24&255,e[48]=P>>>0&255,e[49]=P>>>8&255,e[50]=P>>>16&255,e[51]=P>>>24&255,e[52]=N>>>0&255,e[53]=N>>>8&255,e[54]=N>>>16&255,e[55]=N>>>24&255,e[56]=B>>>0&255,e[57]=B>>>8&255,e[58]=B>>>16&255,e[59]=B>>>24&255,e[60]=D>>>0&255,e[61]=D>>>8&255,e[62]=D>>>16&255,e[63]=D>>>24&255}(e,t,r,o)}function b(e,t,r,o){!function(e,t,r,o){for(var n,i=255&o[0]|(255&o[1])<<8|(255&o[2])<<16|(255&o[3])<<24,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&o[4]|(255&o[5])<<8|(255&o[6])<<16|(255&o[7])<<24,d=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,p=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,f=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,m=255&o[8]|(255&o[9])<<8|(255&o[10])<<16|(255&o[11])<<24,y=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,g=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,b=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&o[12]|(255&o[13])<<8|(255&o[14])<<16|(255&o[15])<<24,$=0;$<20;$+=2)i^=(n=(g^=(n=(h^=(n=(u^=(n=i+g|0)<<7|n>>>25)+i|0)<<9|n>>>23)+u|0)<<13|n>>>19)+h|0)<<18|n>>>14,l^=(n=(a^=(n=(b^=(n=(f^=(n=l+a|0)<<7|n>>>25)+l|0)<<9|n>>>23)+f|0)<<13|n>>>19)+b|0)<<18|n>>>14,m^=(n=(d^=(n=(s^=(n=(v^=(n=m+d|0)<<7|n>>>25)+m|0)<<9|n>>>23)+v|0)<<13|n>>>19)+s|0)<<18|n>>>14,w^=(n=(y^=(n=(p^=(n=(c^=(n=w+y|0)<<7|n>>>25)+w|0)<<9|n>>>23)+c|0)<<13|n>>>19)+p|0)<<18|n>>>14,i^=(n=(c^=(n=(s^=(n=(a^=(n=i+c|0)<<7|n>>>25)+i|0)<<9|n>>>23)+a|0)<<13|n>>>19)+s|0)<<18|n>>>14,l^=(n=(u^=(n=(p^=(n=(d^=(n=l+u|0)<<7|n>>>25)+l|0)<<9|n>>>23)+d|0)<<13|n>>>19)+p|0)<<18|n>>>14,m^=(n=(f^=(n=(h^=(n=(y^=(n=m+f|0)<<7|n>>>25)+m|0)<<9|n>>>23)+y|0)<<13|n>>>19)+h|0)<<18|n>>>14,w^=(n=(v^=(n=(b^=(n=(g^=(n=w+v|0)<<7|n>>>25)+w|0)<<9|n>>>23)+g|0)<<13|n>>>19)+b|0)<<18|n>>>14;e[0]=i>>>0&255,e[1]=i>>>8&255,e[2]=i>>>16&255,e[3]=i>>>24&255,e[4]=l>>>0&255,e[5]=l>>>8&255,e[6]=l>>>16&255,e[7]=l>>>24&255,e[8]=m>>>0&255,e[9]=m>>>8&255,e[10]=m>>>16&255,e[11]=m>>>24&255,e[12]=w>>>0&255,e[13]=w>>>8&255,e[14]=w>>>16&255,e[15]=w>>>24&255,e[16]=d>>>0&255,e[17]=d>>>8&255,e[18]=d>>>16&255,e[19]=d>>>24&255,e[20]=p>>>0&255,e[21]=p>>>8&255,e[22]=p>>>16&255,e[23]=p>>>24&255,e[24]=h>>>0&255,e[25]=h>>>8&255,e[26]=h>>>16&255,e[27]=h>>>24&255,e[28]=f>>>0&255,e[29]=f>>>8&255,e[30]=f>>>16&255,e[31]=f>>>24&255}(e,t,r,o)}var v=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function w(e,t,r,o,n,i,a){var s,c,u=new Uint8Array(16),l=new Uint8Array(64);for(c=0;c<16;c++)u[c]=0;for(c=0;c<8;c++)u[c]=i[c];for(;n>=64;){for(g(l,u,a,v),c=0;c<64;c++)e[t+c]=r[o+c]^l[c];for(s=1,c=8;c<16;c++)s=s+(255&u[c])|0,u[c]=255&s,s>>>=8;n-=64,t+=64,o+=64}if(n>0)for(g(l,u,a,v),c=0;c<n;c++)e[t+c]=r[o+c]^l[c];return 0}function $(e,t,r,o,n){var i,a,s=new Uint8Array(16),c=new Uint8Array(64);for(a=0;a<16;a++)s[a]=0;for(a=0;a<8;a++)s[a]=o[a];for(;r>=64;){for(g(c,s,n,v),a=0;a<64;a++)e[t+a]=c[a];for(i=1,a=8;a<16;a++)i=i+(255&s[a])|0,s[a]=255&i,i>>>=8;r-=64,t+=64}if(r>0)for(g(c,s,n,v),a=0;a<r;a++)e[t+a]=c[a];return 0}function k(e,t,r,o,n){var i=new Uint8Array(32);b(i,o,n,v);for(var a=new Uint8Array(8),s=0;s<8;s++)a[s]=o[s+16];return $(e,t,r,a,i)}function _(e,t,r,o,n,i,a){var s=new Uint8Array(32);b(s,i,a,v);for(var c=new Uint8Array(8),u=0;u<8;u++)c[u]=i[u+16];return w(e,t,r,o,n,c,s)}var T=function(e){var t,r,o,n,i,a,s,c;this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0,t=255&e[0]|(255&e[1])<<8,this.r[0]=8191&t,r=255&e[2]|(255&e[3])<<8,this.r[1]=8191&(t>>>13|r<<3),o=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(r>>>10|o<<6),n=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(o>>>7|n<<9),i=255&e[8]|(255&e[9])<<8,this.r[4]=255&(n>>>4|i<<12),this.r[5]=i>>>1&8190,a=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(i>>>14|a<<2),s=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(a>>>11|s<<5),c=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(s>>>8|c<<8),this.r[9]=c>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function I(e,t,r,o,n,i){var a=new T(i);return a.update(r,o,n),a.finish(e,t),0}function A(e,t,r,o,n,i){var a=new Uint8Array(16);return I(a,0,r,o,n,i),m(e,t,a,0)}function O(e,t,r,o,n){var i;if(r<32)return-1;for(_(e,0,t,0,r,o,n),I(e,16,e,32,r-32,e),i=0;i<16;i++)e[i]=0;return 0}function E(e,t,r,o,n){var i,a=new Uint8Array(32);if(r<32)return-1;if(k(a,0,32,o,n),0!==A(t,16,t,32,r-32,a))return-1;for(_(e,0,t,0,r,o,n),i=0;i<32;i++)e[i]=0;return 0}function S(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function R(e){var t,r,o=1;for(t=0;t<16;t++)r=e[t]+o+65535,o=Math.floor(r/65536),e[t]=r-65536*o;e[0]+=o-1+37*(o-1)}function x(e,t,r){for(var o,n=~(r-1),i=0;i<16;i++)o=n&(e[i]^t[i]),e[i]^=o,t[i]^=o}function C(e,r){var o,n,i,a=t(),s=t();for(o=0;o<16;o++)s[o]=r[o];for(R(s),R(s),R(s),n=0;n<2;n++){for(a[0]=s[0]-65517,o=1;o<15;o++)a[o]=s[o]-65535-(a[o-1]>>16&1),a[o-1]&=65535;a[15]=s[15]-32767-(a[14]>>16&1),i=a[15]>>16&1,a[14]&=65535,x(s,a,1-i)}for(o=0;o<16;o++)e[2*o]=255&s[o],e[2*o+1]=s[o]>>8}function P(e,t){var r=new Uint8Array(32),o=new Uint8Array(32);return C(r,e),C(o,t),y(r,0,o,0)}function N(e){var t=new Uint8Array(32);return C(t,e),1&t[0]}function B(e,t){var r;for(r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function D(e,t,r){for(var o=0;o<16;o++)e[o]=t[o]+r[o]}function M(e,t,r){for(var o=0;o<16;o++)e[o]=t[o]-r[o]}function L(e,t,r){var o,n,i=0,a=0,s=0,c=0,u=0,l=0,d=0,p=0,h=0,f=0,m=0,y=0,g=0,b=0,v=0,w=0,$=0,k=0,_=0,T=0,I=0,A=0,O=0,E=0,S=0,R=0,x=0,C=0,P=0,N=0,B=0,D=r[0],M=r[1],L=r[2],j=r[3],F=r[4],U=r[5],K=r[6],q=r[7],G=r[8],H=r[9],V=r[10],W=r[11],z=r[12],Z=r[13],Q=r[14],Y=r[15];i+=(o=t[0])*D,a+=o*M,s+=o*L,c+=o*j,u+=o*F,l+=o*U,d+=o*K,p+=o*q,h+=o*G,f+=o*H,m+=o*V,y+=o*W,g+=o*z,b+=o*Z,v+=o*Q,w+=o*Y,a+=(o=t[1])*D,s+=o*M,c+=o*L,u+=o*j,l+=o*F,d+=o*U,p+=o*K,h+=o*q,f+=o*G,m+=o*H,y+=o*V,g+=o*W,b+=o*z,v+=o*Z,w+=o*Q,$+=o*Y,s+=(o=t[2])*D,c+=o*M,u+=o*L,l+=o*j,d+=o*F,p+=o*U,h+=o*K,f+=o*q,m+=o*G,y+=o*H,g+=o*V,b+=o*W,v+=o*z,w+=o*Z,$+=o*Q,k+=o*Y,c+=(o=t[3])*D,u+=o*M,l+=o*L,d+=o*j,p+=o*F,h+=o*U,f+=o*K,m+=o*q,y+=o*G,g+=o*H,b+=o*V,v+=o*W,w+=o*z,$+=o*Z,k+=o*Q,_+=o*Y,u+=(o=t[4])*D,l+=o*M,d+=o*L,p+=o*j,h+=o*F,f+=o*U,m+=o*K,y+=o*q,g+=o*G,b+=o*H,v+=o*V,w+=o*W,$+=o*z,k+=o*Z,_+=o*Q,T+=o*Y,l+=(o=t[5])*D,d+=o*M,p+=o*L,h+=o*j,f+=o*F,m+=o*U,y+=o*K,g+=o*q,b+=o*G,v+=o*H,w+=o*V,$+=o*W,k+=o*z,_+=o*Z,T+=o*Q,I+=o*Y,d+=(o=t[6])*D,p+=o*M,h+=o*L,f+=o*j,m+=o*F,y+=o*U,g+=o*K,b+=o*q,v+=o*G,w+=o*H,$+=o*V,k+=o*W,_+=o*z,T+=o*Z,I+=o*Q,A+=o*Y,p+=(o=t[7])*D,h+=o*M,f+=o*L,m+=o*j,y+=o*F,g+=o*U,b+=o*K,v+=o*q,w+=o*G,$+=o*H,k+=o*V,_+=o*W,T+=o*z,I+=o*Z,A+=o*Q,O+=o*Y,h+=(o=t[8])*D,f+=o*M,m+=o*L,y+=o*j,g+=o*F,b+=o*U,v+=o*K,w+=o*q,$+=o*G,k+=o*H,_+=o*V,T+=o*W,I+=o*z,A+=o*Z,O+=o*Q,E+=o*Y,f+=(o=t[9])*D,m+=o*M,y+=o*L,g+=o*j,b+=o*F,v+=o*U,w+=o*K,$+=o*q,k+=o*G,_+=o*H,T+=o*V,I+=o*W,A+=o*z,O+=o*Z,E+=o*Q,S+=o*Y,m+=(o=t[10])*D,y+=o*M,g+=o*L,b+=o*j,v+=o*F,w+=o*U,$+=o*K,k+=o*q,_+=o*G,T+=o*H,I+=o*V,A+=o*W,O+=o*z,E+=o*Z,S+=o*Q,R+=o*Y,y+=(o=t[11])*D,g+=o*M,b+=o*L,v+=o*j,w+=o*F,$+=o*U,k+=o*K,_+=o*q,T+=o*G,I+=o*H,A+=o*V,O+=o*W,E+=o*z,S+=o*Z,R+=o*Q,x+=o*Y,g+=(o=t[12])*D,b+=o*M,v+=o*L,w+=o*j,$+=o*F,k+=o*U,_+=o*K,T+=o*q,I+=o*G,A+=o*H,O+=o*V,E+=o*W,S+=o*z,R+=o*Z,x+=o*Q,C+=o*Y,b+=(o=t[13])*D,v+=o*M,w+=o*L,$+=o*j,k+=o*F,_+=o*U,T+=o*K,I+=o*q,A+=o*G,O+=o*H,E+=o*V,S+=o*W,R+=o*z,x+=o*Z,C+=o*Q,P+=o*Y,v+=(o=t[14])*D,w+=o*M,$+=o*L,k+=o*j,_+=o*F,T+=o*U,I+=o*K,A+=o*q,O+=o*G,E+=o*H,S+=o*V,R+=o*W,x+=o*z,C+=o*Z,P+=o*Q,N+=o*Y,w+=(o=t[15])*D,a+=38*(k+=o*L),s+=38*(_+=o*j),c+=38*(T+=o*F),u+=38*(I+=o*U),l+=38*(A+=o*K),d+=38*(O+=o*q),p+=38*(E+=o*G),h+=38*(S+=o*H),f+=38*(R+=o*V),m+=38*(x+=o*W),y+=38*(C+=o*z),g+=38*(P+=o*Z),b+=38*(N+=o*Q),v+=38*(B+=o*Y),i=(o=(i+=38*($+=o*M))+(n=1)+65535)-65536*(n=Math.floor(o/65536)),a=(o=a+n+65535)-65536*(n=Math.floor(o/65536)),s=(o=s+n+65535)-65536*(n=Math.floor(o/65536)),c=(o=c+n+65535)-65536*(n=Math.floor(o/65536)),u=(o=u+n+65535)-65536*(n=Math.floor(o/65536)),l=(o=l+n+65535)-65536*(n=Math.floor(o/65536)),d=(o=d+n+65535)-65536*(n=Math.floor(o/65536)),p=(o=p+n+65535)-65536*(n=Math.floor(o/65536)),h=(o=h+n+65535)-65536*(n=Math.floor(o/65536)),f=(o=f+n+65535)-65536*(n=Math.floor(o/65536)),m=(o=m+n+65535)-65536*(n=Math.floor(o/65536)),y=(o=y+n+65535)-65536*(n=Math.floor(o/65536)),g=(o=g+n+65535)-65536*(n=Math.floor(o/65536)),b=(o=b+n+65535)-65536*(n=Math.floor(o/65536)),v=(o=v+n+65535)-65536*(n=Math.floor(o/65536)),w=(o=w+n+65535)-65536*(n=Math.floor(o/65536)),i=(o=(i+=n-1+37*(n-1))+(n=1)+65535)-65536*(n=Math.floor(o/65536)),a=(o=a+n+65535)-65536*(n=Math.floor(o/65536)),s=(o=s+n+65535)-65536*(n=Math.floor(o/65536)),c=(o=c+n+65535)-65536*(n=Math.floor(o/65536)),u=(o=u+n+65535)-65536*(n=Math.floor(o/65536)),l=(o=l+n+65535)-65536*(n=Math.floor(o/65536)),d=(o=d+n+65535)-65536*(n=Math.floor(o/65536)),p=(o=p+n+65535)-65536*(n=Math.floor(o/65536)),h=(o=h+n+65535)-65536*(n=Math.floor(o/65536)),f=(o=f+n+65535)-65536*(n=Math.floor(o/65536)),m=(o=m+n+65535)-65536*(n=Math.floor(o/65536)),y=(o=y+n+65535)-65536*(n=Math.floor(o/65536)),g=(o=g+n+65535)-65536*(n=Math.floor(o/65536)),b=(o=b+n+65535)-65536*(n=Math.floor(o/65536)),v=(o=v+n+65535)-65536*(n=Math.floor(o/65536)),w=(o=w+n+65535)-65536*(n=Math.floor(o/65536)),i+=n-1+37*(n-1),e[0]=i,e[1]=a,e[2]=s,e[3]=c,e[4]=u,e[5]=l,e[6]=d,e[7]=p,e[8]=h,e[9]=f,e[10]=m,e[11]=y,e[12]=g,e[13]=b,e[14]=v,e[15]=w}function j(e,t){L(e,t,t)}function F(e,r){var o,n=t();for(o=0;o<16;o++)n[o]=r[o];for(o=253;o>=0;o--)j(n,n),2!==o&&4!==o&&L(n,n,r);for(o=0;o<16;o++)e[o]=n[o]}function U(e,r){var o,n=t();for(o=0;o<16;o++)n[o]=r[o];for(o=250;o>=0;o--)j(n,n),1!==o&&L(n,n,r);for(o=0;o<16;o++)e[o]=n[o]}function K(e,r,o){var n,i,a=new Uint8Array(32),c=new Float64Array(80),u=t(),l=t(),d=t(),p=t(),h=t(),f=t();for(i=0;i<31;i++)a[i]=r[i];for(a[31]=127&r[31]|64,a[0]&=248,B(c,o),i=0;i<16;i++)l[i]=c[i],p[i]=u[i]=d[i]=0;for(u[0]=p[0]=1,i=254;i>=0;--i)x(u,l,n=a[i>>>3]>>>(7&i)&1),x(d,p,n),D(h,u,d),M(u,u,d),D(d,l,p),M(l,l,p),j(p,h),j(f,u),L(u,d,u),L(d,l,h),D(h,u,d),M(u,u,d),j(l,u),M(d,p,f),L(u,d,s),D(u,u,p),L(d,d,u),L(u,p,f),L(p,l,c),j(l,h),x(u,l,n),x(d,p,n);for(i=0;i<16;i++)c[i+16]=u[i],c[i+32]=d[i],c[i+48]=l[i],c[i+64]=p[i];var m=c.subarray(32),y=c.subarray(16);return F(m,m),L(y,y,m),C(e,y),0}function q(e,t){return K(e,t,n)}function G(e,t){return r(t,32),q(e,t)}function H(e,t,r){var n=new Uint8Array(32);return K(n,r,t),b(e,o,n,v)}T.prototype.blocks=function(e,t,r){for(var o,n,i,a,s,c,u,l,d,p,h,f,m,y,g,b,v,w,$,k=this.fin?0:2048,_=this.h[0],T=this.h[1],I=this.h[2],A=this.h[3],O=this.h[4],E=this.h[5],S=this.h[6],R=this.h[7],x=this.h[8],C=this.h[9],P=this.r[0],N=this.r[1],B=this.r[2],D=this.r[3],M=this.r[4],L=this.r[5],j=this.r[6],F=this.r[7],U=this.r[8],K=this.r[9];r>=16;)p=d=0,p+=(_+=8191&(o=255&e[t+0]|(255&e[t+1])<<8))*P,p+=(T+=8191&(o>>>13|(n=255&e[t+2]|(255&e[t+3])<<8)<<3))*(5*K),p+=(I+=8191&(n>>>10|(i=255&e[t+4]|(255&e[t+5])<<8)<<6))*(5*U),p+=(A+=8191&(i>>>7|(a=255&e[t+6]|(255&e[t+7])<<8)<<9))*(5*F),d=(p+=(O+=8191&(a>>>4|(s=255&e[t+8]|(255&e[t+9])<<8)<<12))*(5*j))>>>13,p&=8191,p+=(E+=s>>>1&8191)*(5*L),p+=(S+=8191&(s>>>14|(c=255&e[t+10]|(255&e[t+11])<<8)<<2))*(5*M),p+=(R+=8191&(c>>>11|(u=255&e[t+12]|(255&e[t+13])<<8)<<5))*(5*D),p+=(x+=8191&(u>>>8|(l=255&e[t+14]|(255&e[t+15])<<8)<<8))*(5*B),h=d+=(p+=(C+=l>>>5|k)*(5*N))>>>13,h+=_*N,h+=T*P,h+=I*(5*K),h+=A*(5*U),d=(h+=O*(5*F))>>>13,h&=8191,h+=E*(5*j),h+=S*(5*L),h+=R*(5*M),h+=x*(5*D),d+=(h+=C*(5*B))>>>13,h&=8191,f=d,f+=_*B,f+=T*N,f+=I*P,f+=A*(5*K),d=(f+=O*(5*U))>>>13,f&=8191,f+=E*(5*F),f+=S*(5*j),f+=R*(5*L),f+=x*(5*M),m=d+=(f+=C*(5*D))>>>13,m+=_*D,m+=T*B,m+=I*N,m+=A*P,d=(m+=O*(5*K))>>>13,m&=8191,m+=E*(5*U),m+=S*(5*F),m+=R*(5*j),m+=x*(5*L),y=d+=(m+=C*(5*M))>>>13,y+=_*M,y+=T*D,y+=I*B,y+=A*N,d=(y+=O*P)>>>13,y&=8191,y+=E*(5*K),y+=S*(5*U),y+=R*(5*F),y+=x*(5*j),g=d+=(y+=C*(5*L))>>>13,g+=_*L,g+=T*M,g+=I*D,g+=A*B,d=(g+=O*N)>>>13,g&=8191,g+=E*P,g+=S*(5*K),g+=R*(5*U),g+=x*(5*F),b=d+=(g+=C*(5*j))>>>13,b+=_*j,b+=T*L,b+=I*M,b+=A*D,d=(b+=O*B)>>>13,b&=8191,b+=E*N,b+=S*P,b+=R*(5*K),b+=x*(5*U),v=d+=(b+=C*(5*F))>>>13,v+=_*F,v+=T*j,v+=I*L,v+=A*M,d=(v+=O*D)>>>13,v&=8191,v+=E*B,v+=S*N,v+=R*P,v+=x*(5*K),w=d+=(v+=C*(5*U))>>>13,w+=_*U,w+=T*F,w+=I*j,w+=A*L,d=(w+=O*M)>>>13,w&=8191,w+=E*D,w+=S*B,w+=R*N,w+=x*P,$=d+=(w+=C*(5*K))>>>13,$+=_*K,$+=T*U,$+=I*F,$+=A*j,d=($+=O*L)>>>13,$&=8191,$+=E*M,$+=S*D,$+=R*B,$+=x*N,_=p=8191&(d=(d=((d+=($+=C*P)>>>13)<<2)+d|0)+(p&=8191)|0),T=h+=d>>>=13,I=f&=8191,A=m&=8191,O=y&=8191,E=g&=8191,S=b&=8191,R=v&=8191,x=w&=8191,C=$&=8191,t+=16,r-=16;this.h[0]=_,this.h[1]=T,this.h[2]=I,this.h[3]=A,this.h[4]=O,this.h[5]=E,this.h[6]=S,this.h[7]=R,this.h[8]=x,this.h[9]=C},T.prototype.finish=function(e,t){var r,o,n,i,a=new Uint16Array(10);if(this.leftover){for(i=this.leftover,this.buffer[i++]=1;i<16;i++)this.buffer[i]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,i=2;i<10;i++)this.h[i]+=r,r=this.h[i]>>>13,this.h[i]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,a[0]=this.h[0]+5,r=a[0]>>>13,a[0]&=8191,i=1;i<10;i++)a[i]=this.h[i]+r,r=a[i]>>>13,a[i]&=8191;for(a[9]-=8192,o=(1^r)-1,i=0;i<10;i++)a[i]&=o;for(o=~o,i=0;i<10;i++)this.h[i]=this.h[i]&o|a[i];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),n=this.h[0]+this.pad[0],this.h[0]=65535&n,i=1;i<8;i++)n=(this.h[i]+this.pad[i]|0)+(n>>>16)|0,this.h[i]=65535&n;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},T.prototype.update=function(e,t,r){var o,n;if(this.leftover){for((n=16-this.leftover)>r&&(n=r),o=0;o<n;o++)this.buffer[this.leftover+o]=e[t+o];if(r-=n,t+=n,this.leftover+=n,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(r>=16&&(n=r-r%16,this.blocks(e,t,n),t+=n,r-=n),r){for(o=0;o<r;o++)this.buffer[this.leftover+o]=e[t+o];this.leftover+=r}};var V=O,W=E;var z=[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 Z(e,t,r,o){for(var n,i,a,s,c,u,l,d,p,h,f,m,y,g,b,v,w,$,k,_,T,I,A,O,E,S,R=new Int32Array(16),x=new Int32Array(16),C=e[0],P=e[1],N=e[2],B=e[3],D=e[4],M=e[5],L=e[6],j=e[7],F=t[0],U=t[1],K=t[2],q=t[3],G=t[4],H=t[5],V=t[6],W=t[7],Z=0;o>=128;){for(k=0;k<16;k++)_=8*k+Z,R[k]=r[_+0]<<24|r[_+1]<<16|r[_+2]<<8|r[_+3],x[k]=r[_+4]<<24|r[_+5]<<16|r[_+6]<<8|r[_+7];for(k=0;k<80;k++)if(n=C,i=P,a=N,s=B,c=D,u=M,l=L,j,p=F,h=U,f=K,m=q,y=G,g=H,b=V,W,A=65535&(I=W),O=I>>>16,E=65535&(T=j),S=T>>>16,A+=65535&(I=(G>>>14|D<<18)^(G>>>18|D<<14)^(D>>>9|G<<23)),O+=I>>>16,E+=65535&(T=(D>>>14|G<<18)^(D>>>18|G<<14)^(G>>>9|D<<23)),S+=T>>>16,A+=65535&(I=G&H^~G&V),O+=I>>>16,E+=65535&(T=D&M^~D&L),S+=T>>>16,A+=65535&(I=z[2*k+1]),O+=I>>>16,E+=65535&(T=z[2*k]),S+=T>>>16,T=R[k%16],O+=(I=x[k%16])>>>16,E+=65535&T,S+=T>>>16,E+=(O+=(A+=65535&I)>>>16)>>>16,A=65535&(I=$=65535&A|O<<16),O=I>>>16,E=65535&(T=w=65535&E|(S+=E>>>16)<<16),S=T>>>16,A+=65535&(I=(F>>>28|C<<4)^(C>>>2|F<<30)^(C>>>7|F<<25)),O+=I>>>16,E+=65535&(T=(C>>>28|F<<4)^(F>>>2|C<<30)^(F>>>7|C<<25)),S+=T>>>16,O+=(I=F&U^F&K^U&K)>>>16,E+=65535&(T=C&P^C&N^P&N),S+=T>>>16,d=65535&(E+=(O+=(A+=65535&I)>>>16)>>>16)|(S+=E>>>16)<<16,v=65535&A|O<<16,A=65535&(I=m),O=I>>>16,E=65535&(T=s),S=T>>>16,O+=(I=$)>>>16,E+=65535&(T=w),S+=T>>>16,P=n,N=i,B=a,D=s=65535&(E+=(O+=(A+=65535&I)>>>16)>>>16)|(S+=E>>>16)<<16,M=c,L=u,j=l,C=d,U=p,K=h,q=f,G=m=65535&A|O<<16,H=y,V=g,W=b,F=v,k%16==15)for(_=0;_<16;_++)T=R[_],A=65535&(I=x[_]),O=I>>>16,E=65535&T,S=T>>>16,T=R[(_+9)%16],A+=65535&(I=x[(_+9)%16]),O+=I>>>16,E+=65535&T,S+=T>>>16,w=R[(_+1)%16],A+=65535&(I=(($=x[(_+1)%16])>>>1|w<<31)^($>>>8|w<<24)^($>>>7|w<<25)),O+=I>>>16,E+=65535&(T=(w>>>1|$<<31)^(w>>>8|$<<24)^w>>>7),S+=T>>>16,w=R[(_+14)%16],O+=(I=(($=x[(_+14)%16])>>>19|w<<13)^(w>>>29|$<<3)^($>>>6|w<<26))>>>16,E+=65535&(T=(w>>>19|$<<13)^($>>>29|w<<3)^w>>>6),S+=T>>>16,S+=(E+=(O+=(A+=65535&I)>>>16)>>>16)>>>16,R[_]=65535&E|S<<16,x[_]=65535&A|O<<16;A=65535&(I=F),O=I>>>16,E=65535&(T=C),S=T>>>16,T=e[0],O+=(I=t[0])>>>16,E+=65535&T,S+=T>>>16,S+=(E+=(O+=(A+=65535&I)>>>16)>>>16)>>>16,e[0]=C=65535&E|S<<16,t[0]=F=65535&A|O<<16,A=65535&(I=U),O=I>>>16,E=65535&(T=P),S=T>>>16,T=e[1],O+=(I=t[1])>>>16,E+=65535&T,S+=T>>>16,S+=(E+=(O+=(A+=65535&I)>>>16)>>>16)>>>16,e[1]=P=65535&E|S<<16,t[1]=U=65535&A|O<<16,A=65535&(I=K),O=I>>>16,E=65535&(T=N),S=T>>>16,T=e[2],O+=(I=t[2])>>>16,E+=65535&T,S+=T>>>16,S+=(E+=(O+=(A+=65535&I)>>>16)>>>16)>>>16,e[2]=N=65535&E|S<<16,t[2]=K=65535&A|O<<16,A=65535&(I=q),O=I>>>16,E=65535&(T=B),S=T>>>16,T=e[3],O+=(I=t[3])>>>16,E+=65535&T,S+=T>>>16,S+=(E+=(O+=(A+=65535&I)>>>16)>>>16)>>>16,e[3]=B=65535&E|S<<16,t[3]=q=65535&A|O<<16,A=65535&(I=G),O=I>>>16,E=65535&(T=D),S=T>>>16,T=e[4],O+=(I=t[4])>>>16,E+=65535&T,S+=T>>>16,S+=(E+=(O+=(A+=65535&I)>>>16)>>>16)>>>16,e[4]=D=65535&E|S<<16,t[4]=G=65535&A|O<<16,A=65535&(I=H),O=I>>>16,E=65535&(T=M),S=T>>>16,T=e[5],O+=(I=t[5])>>>16,E+=65535&T,S+=T>>>16,S+=(E+=(O+=(A+=65535&I)>>>16)>>>16)>>>16,e[5]=M=65535&E|S<<16,t[5]=H=65535&A|O<<16,A=65535&(I=V),O=I>>>16,E=65535&(T=L),S=T>>>16,T=e[6],O+=(I=t[6])>>>16,E+=65535&T,S+=T>>>16,S+=(E+=(O+=(A+=65535&I)>>>16)>>>16)>>>16,e[6]=L=65535&E|S<<16,t[6]=V=65535&A|O<<16,A=65535&(I=W),O=I>>>16,E=65535&(T=j),S=T>>>16,T=e[7],O+=(I=t[7])>>>16,E+=65535&T,S+=T>>>16,S+=(E+=(O+=(A+=65535&I)>>>16)>>>16)>>>16,e[7]=j=65535&E|S<<16,t[7]=W=65535&A|O<<16,Z+=128,o-=128}return o}function Q(e,t,r){var o,n=new Int32Array(8),i=new Int32Array(8),a=new Uint8Array(256),s=r;for(n[0]=1779033703,n[1]=3144134277,n[2]=1013904242,n[3]=2773480762,n[4]=1359893119,n[5]=2600822924,n[6]=528734635,n[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,Z(n,i,t,r),r%=128,o=0;o<r;o++)a[o]=t[s-r+o];for(a[r]=128,a[(r=256-128*(r<112?1:0))-9]=0,h(a,r-8,s/536870912|0,s<<3),Z(n,i,a,r),o=0;o<8;o++)h(e,8*o,n[o],i[o]);return 0}function Y(e,r){var o=t(),n=t(),i=t(),a=t(),s=t(),c=t(),l=t(),d=t(),p=t();M(o,e[1],e[0]),M(p,r[1],r[0]),L(o,o,p),D(n,e[0],e[1]),D(p,r[0],r[1]),L(n,n,p),L(i,e[3],r[3]),L(i,i,u),L(a,e[2],r[2]),D(a,a,a),M(s,n,o),M(c,a,i),D(l,a,i),D(d,n,o),L(e[0],s,c),L(e[1],d,l),L(e[2],l,c),L(e[3],s,d)}function X(e,t,r){var o;for(o=0;o<4;o++)x(e[o],t[o],r)}function J(e,r){var o=t(),n=t(),i=t();F(i,r[2]),L(o,r[0],i),L(n,r[1],i),C(e,n),e[31]^=N(o)<<7}function ee(e,t,r){var o,n;for(S(e[0],i),S(e[1],a),S(e[2],a),S(e[3],i),n=255;n>=0;--n)X(e,t,o=r[n/8|0]>>(7&n)&1),Y(t,e),Y(e,e),X(e,t,o)}function te(e,r){var o=[t(),t(),t(),t()];S(o[0],l),S(o[1],d),S(o[2],a),L(o[3],l,d),ee(e,o,r)}function re(e,o,n){var i,a=new Uint8Array(64),s=[t(),t(),t(),t()];for(n||r(o,32),Q(a,o,32),a[0]&=248,a[31]&=127,a[31]|=64,te(s,a),J(e,s),i=0;i<32;i++)o[i+32]=e[i];return 0}var oe=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ne(e,t){var r,o,n,i;for(o=63;o>=32;--o){for(r=0,n=o-32,i=o-12;n<i;++n)t[n]+=r-16*t[o]*oe[n-(o-32)],r=Math.floor((t[n]+128)/256),t[n]-=256*r;t[n]+=r,t[o]=0}for(r=0,n=0;n<32;n++)t[n]+=r-(t[31]>>4)*oe[n],r=t[n]>>8,t[n]&=255;for(n=0;n<32;n++)t[n]-=r*oe[n];for(o=0;o<32;o++)t[o+1]+=t[o]>>8,e[o]=255&t[o]}function ie(e){var t,r=new Float64Array(64);for(t=0;t<64;t++)r[t]=e[t];for(t=0;t<64;t++)e[t]=0;ne(e,r)}function ae(e,r,o,n){var i,a,s=new Uint8Array(64),c=new Uint8Array(64),u=new Uint8Array(64),l=new Float64Array(64),d=[t(),t(),t(),t()];Q(s,n,32),s[0]&=248,s[31]&=127,s[31]|=64;var p=o+64;for(i=0;i<o;i++)e[64+i]=r[i];for(i=0;i<32;i++)e[32+i]=s[32+i];for(Q(u,e.subarray(32),o+32),ie(u),te(d,u),J(e,d),i=32;i<64;i++)e[i]=n[i];for(Q(c,e,o+64),ie(c),i=0;i<64;i++)l[i]=0;for(i=0;i<32;i++)l[i]=u[i];for(i=0;i<32;i++)for(a=0;a<32;a++)l[i+a]+=c[i]*s[a];return ne(e.subarray(32),l),p}function se(e,r,o,n){var s,u=new Uint8Array(32),l=new Uint8Array(64),d=[t(),t(),t(),t()],h=[t(),t(),t(),t()];if(o<64)return-1;if(function(e,r){var o=t(),n=t(),s=t(),u=t(),l=t(),d=t(),h=t();return S(e[2],a),B(e[1],r),j(s,e[1]),L(u,s,c),M(s,s,e[2]),D(u,e[2],u),j(l,u),j(d,l),L(h,d,l),L(o,h,s),L(o,o,u),U(o,o),L(o,o,s),L(o,o,u),L(o,o,u),L(e[0],o,u),j(n,e[0]),L(n,n,u),P(n,s)&&L(e[0],e[0],p),j(n,e[0]),L(n,n,u),P(n,s)?-1:(N(e[0])===r[31]>>7&&M(e[0],i,e[0]),L(e[3],e[0],e[1]),0)}(h,n))return-1;for(s=0;s<o;s++)e[s]=r[s];for(s=0;s<32;s++)e[s+32]=n[s];if(Q(l,e,o),ie(l),ee(d,h,l),te(h,r.subarray(32)),Y(d,h),J(u,d),o-=64,y(r,0,u,0)){for(s=0;s<o;s++)e[s]=0;return-1}for(s=0;s<o;s++)e[s]=r[s+64];return o}var ce=16,ue=64,le=32,de=64;function pe(e,t){if(32!==e.length)throw new Error("bad key size");if(24!==t.length)throw new Error("bad nonce size")}function he(){for(var e=0;e<arguments.length;e++)if(!(arguments[e]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function fe(e){for(var t=0;t<e.length;t++)e[t]=0}e.lowlevel={crypto_core_hsalsa20:b,crypto_stream_xor:_,crypto_stream:k,crypto_stream_salsa20_xor:w,crypto_stream_salsa20:$,crypto_onetimeauth:I,crypto_onetimeauth_verify:A,crypto_verify_16:m,crypto_verify_32:y,crypto_secretbox:O,crypto_secretbox_open:E,crypto_scalarmult:K,crypto_scalarmult_base:q,crypto_box_beforenm:H,crypto_box_afternm:V,crypto_box:function(e,t,r,o,n,i){var a=new Uint8Array(32);return H(a,n,i),V(e,t,r,o,a)},crypto_box_open:function(e,t,r,o,n,i){var a=new Uint8Array(32);return H(a,n,i),W(e,t,r,o,a)},crypto_box_keypair:G,crypto_hash:Q,crypto_sign:ae,crypto_sign_keypair:re,crypto_sign_open:se,crypto_secretbox_KEYBYTES:32,crypto_secretbox_NONCEBYTES:24,crypto_secretbox_ZEROBYTES:32,crypto_secretbox_BOXZEROBYTES:ce,crypto_scalarmult_BYTES:32,crypto_scalarmult_SCALARBYTES:32,crypto_box_PUBLICKEYBYTES:32,crypto_box_SECRETKEYBYTES:32,crypto_box_BEFORENMBYTES:32,crypto_box_NONCEBYTES:24,crypto_box_ZEROBYTES:32,crypto_box_BOXZEROBYTES:16,crypto_sign_BYTES:ue,crypto_sign_PUBLICKEYBYTES:le,crypto_sign_SECRETKEYBYTES:de,crypto_sign_SEEDBYTES:32,crypto_hash_BYTES:64,gf:t,D:c,L:oe,pack25519:C,unpack25519:B,M:L,A:D,S:j,Z:M,pow2523:U,add:Y,set25519:S,modL:ne,scalarmult:ee,scalarbase:te},e.randomBytes=function(e){var t=new Uint8Array(e);return r(t,e),t},e.secretbox=function(e,t,r){he(e,t,r),pe(r,t);for(var o=new Uint8Array(32+e.length),n=new Uint8Array(o.length),i=0;i<e.length;i++)o[i+32]=e[i];return O(n,o,o.length,t,r),n.subarray(ce)},e.secretbox.open=function(e,t,r){he(e,t,r),pe(r,t);for(var o=new Uint8Array(ce+e.length),n=new Uint8Array(o.length),i=0;i<e.length;i++)o[i+ce]=e[i];return o.length<32||0!==E(n,o,o.length,t,r)?null:n.subarray(32)},e.secretbox.keyLength=32,e.secretbox.nonceLength=24,e.secretbox.overheadLength=ce,e.scalarMult=function(e,t){if(he(e,t),32!==e.length)throw new Error("bad n size");if(32!==t.length)throw new Error("bad p size");var r=new Uint8Array(32);return K(r,e,t),r},e.scalarMult.base=function(e){if(he(e),32!==e.length)throw new Error("bad n size");var t=new Uint8Array(32);return q(t,e),t},e.scalarMult.scalarLength=32,e.scalarMult.groupElementLength=32,e.box=function(t,r,o,n){var i=e.box.before(o,n);return e.secretbox(t,r,i)},e.box.before=function(e,t){he(e,t),function(e,t){if(32!==e.length)throw new Error("bad public key size");if(32!==t.length)throw new Error("bad secret key size")}(e,t);var r=new Uint8Array(32);return H(r,e,t),r},e.box.after=e.secretbox,e.box.open=function(t,r,o,n){var i=e.box.before(o,n);return e.secretbox.open(t,r,i)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var e=new Uint8Array(32),t=new Uint8Array(32);return G(e,t),{publicKey:e,secretKey:t}},e.box.keyPair.fromSecretKey=function(e){if(he(e),32!==e.length)throw new Error("bad secret key size");var t=new Uint8Array(32);return q(t,e),{publicKey:t,secretKey:new Uint8Array(e)}},e.box.publicKeyLength=32,e.box.secretKeyLength=32,e.box.sharedKeyLength=32,e.box.nonceLength=24,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(e,t){if(he(e,t),t.length!==de)throw new Error("bad secret key size");var r=new Uint8Array(ue+e.length);return ae(r,e,e.length,t),r},e.sign.open=function(e,t){if(he(e,t),t.length!==le)throw new Error("bad public key size");var r=new Uint8Array(e.length),o=se(r,e,e.length,t);if(o<0)return null;for(var n=new Uint8Array(o),i=0;i<n.length;i++)n[i]=r[i];return n},e.sign.detached=function(t,r){for(var o=e.sign(t,r),n=new Uint8Array(ue),i=0;i<n.length;i++)n[i]=o[i];return n},e.sign.detached.verify=function(e,t,r){if(he(e,t,r),t.length!==ue)throw new Error("bad signature size");if(r.length!==le)throw new Error("bad public key size");var o,n=new Uint8Array(ue+e.length),i=new Uint8Array(ue+e.length);for(o=0;o<ue;o++)n[o]=t[o];for(o=0;o<e.length;o++)n[o+ue]=e[o];return se(i,n,n.length,r)>=0},e.sign.keyPair=function(){var e=new Uint8Array(le),t=new Uint8Array(de);return re(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(he(e),e.length!==de)throw new Error("bad secret key size");for(var t=new Uint8Array(le),r=0;r<t.length;r++)t[r]=e[32+r];return{publicKey:t,secretKey:new Uint8Array(e)}},e.sign.keyPair.fromSeed=function(e){if(he(e),32!==e.length)throw new Error("bad seed size");for(var t=new Uint8Array(le),r=new Uint8Array(de),o=0;o<32;o++)r[o]=e[o];return re(t,r,!0),{publicKey:t,secretKey:r}},e.sign.publicKeyLength=le,e.sign.secretKeyLength=de,e.sign.seedLength=32,e.sign.signatureLength=ue,e.hash=function(e){he(e);var t=new Uint8Array(64);return Q(t,e,e.length),t},e.hash.hashLength=64,e.verify=function(e,t){return he(e,t),0!==e.length&&0!==t.length&&(e.length===t.length&&0===f(e,0,t,0,e.length))},e.setPRNG=function(e){r=e},function(){var t="undefined"!=typeof self?self.crypto||self.msCrypto:null;if(t&&t.getRandomValues){e.setPRNG((function(e,r){var o,n=new Uint8Array(r);for(o=0;o<r;o+=65536)t.getRandomValues(n.subarray(o,o+Math.min(r-o,65536)));for(o=0;o<r;o++)e[o]=n[o];fe(n)}))}else void 0!==commonjsRequire&&(t=requireCryptoBrowserify())&&t.randomBytes&&e.setPRNG((function(e,r){var o,n=t.randomBytes(r);for(o=0;o<r;o++)e[o]=n[o];fe(n)}))}()}(e.exports?e.exports:self.nacl=self.nacl||{})}(naclFast);var naclFastExports=naclFast.exports;const nacl=getDefaultExportFromCjs$2(naclFastExports);function arrayEqual(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;const r=new DataView(e.buffer,e.byteOffset,e.byteLength),o=new DataView(t.buffer,t.byteOffset,t.byteLength);let n=e.byteLength;for(;n--;)if(r.getUint8(n)!==o.getUint8(n))return!1;return!0}function arrayStartsWith(e,t){if(e.byteLength<t.byteLength)return!1;let r=t.byteLength;for(;r--;)if(e[r]!==t[r])return!1;return!0}const byteToHex=[];for(let $=0;$<=255;$+=1)byteToHex.push($.toString(16).padStart(2,"0"));function encode$4(e){let t="";for(const r of e)t+=byteToHex[r];return t}function decode$3(e){const t=(e.startsWith("0x")?e.substring(2):e).match(/.{1,2}/gu);return new Uint8Array((null==t?[]:t).map((e=>parseInt(e,16))))}function hexZeroPadded(e,t){const r="0123456789abcdef";let o="0x";for(let n=0;n<e.length;n++){let t=e[n];o+=r[(240&t)>>4]+r[15&t]}for(o.length>2*t+2&&console.log("result out of range","result");o.length<2*t+2;)o="0x0"+o.substring(2);return o.substring(2)}const derPrefix$3="302a300506032b6570032100",derPrefixBytes$3=decode$3(derPrefix$3);class Ed25519PublicKey extends Key{constructor(e){super(),this._keyData=e}get _type(){return"ED25519"}static fromBytes(e){switch(e.length){case 32:return Ed25519PublicKey.fromBytesRaw(e);case 44:return Ed25519PublicKey.fromBytesDer(e);default:throw new BadKeyError(`invalid public key length: ${e.length} bytes`)}}static fromBytesDer(e){try{if(44!==e.length)throw new Error(`invalid length: ${e.length} bytes`);if(!e.subarray(0,12).every(((e,t)=>e===derPrefixBytes$3[t])))throw new Error("invalid DER prefix");const t=e.subarray(12);return new Ed25519PublicKey(t)}catch(t){throw new BadKeyError(`cannot decode ED25519 public key data from DER format: ${t instanceof Error?t.message:"unknown error"}`)}}static fromBytesRaw(e){if(32!=e.length)throw new BadKeyError(`invalid public key length: ${e.length} bytes`);return new Ed25519PublicKey(e)}static fromString(e){return Ed25519PublicKey.fromBytes(decode$3(e))}verify(e,t){return nacl.sign.detached.verify(e,t,this._keyData)}toBytesDer(){const e=new Uint8Array(derPrefixBytes$3.length+32);return e.set(derPrefixBytes$3,0),e.set(this._keyData.subarray(0,32),derPrefixBytes$3.length),e}toBytesRaw(){return this._keyData.slice()}equals(e){return arrayEqual(this._keyData,e._keyData)}}function bytes$1(e){return nacl.randomBytes(e)}function bytesAsync(e){return Promise.resolve(nacl.randomBytes(e))}function decode$2(e){return(new TextDecoder).decode(e)}function encode$3(e){return(new TextEncoder).encode(e)}const HashAlgorithm={Sha256:"SHA-256",Sha384:"SHA-384",Sha512:"SHA-512"};async function hash(e,t,r){const o="string"==typeof t?encode$3(t):t,n="string"==typeof r?encode$3(r):r;try{const t=await window.crypto.subtle.importKey("raw",o,{name:"HMAC",hash:e},!1,["sign"]);return new Uint8Array(await window.crypto.subtle.sign("HMAC",t,n))}catch{throw new Error("Fallback if SubtleCrypto fails is not implemented")}}var ellipticExports=requireElliptic();const elliptic=getDefaultExportFromCjs$2(ellipticExports),secp256k1$1=new elliptic.ec("secp256k1"),N=new _BN("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141","hex"),HARDENED_BIT=2147483648;async function derive$1(e,t,r){const o=isHardenedIndex(r),n=new Uint8Array(37),i=decode$3(secp256k1$1.keyFromPrivate(e).getPublic(!0,"hex"));o?(n[0]=0,n.set(e,1)):n.set(i,0),new DataView(n.buffer,n.byteOffset,n.byteLength).setUint32(33,r,!1);const a=await hash(HashAlgorithm.Sha512,t,n),s=a.subarray(0,32),c=a.subarray(32);try{const o=secp256k1$1.keyFromPrivate(e).getPrivate().add(secp256k1$1.keyFromPrivate(s).getPrivate()).mod(N),n=hexZeroPadded(Uint8Array.from(o.toArray()),32);return o.eqn(0)?derive$1(e,t,r+1):{keyData:decode$3(n),chainCode:c}}catch{return derive$1(e,t,r+1)}}async function fromSeed$1(e){if(e.length<16)throw new TypeError("Seed should be at least 128 bits");if(e.length>64)throw new TypeError("Seed should be at most 512 bits");const t=await hash(HashAlgorithm.Sha512,"Bitcoin seed",e);return{keyData:t.subarray(0,32),chainCode:t.subarray(32)}}function toHardenedIndex(e){return e|HARDENED_BIT}function isHardenedIndex(e){return!!(e&HARDENED_BIT)}async function derive(e,t,r){if(isHardenedIndex(r))throw new Error("the index should not be pre-hardened");const o=new Uint8Array(37);o[0]=0,o.set(e,1),new DataView(o.buffer,o.byteOffset,o.byteLength).setUint32(33,r,!1),o[33]|=128;const n=await hash(HashAlgorithm.Sha512,t,o);return{keyData:n.subarray(0,32),chainCode:n.subarray(32)}}async function fromSeed(e){const t=await hash(HashAlgorithm.Sha512,"ed25519 seed",e);return{keyData:t.subarray(0,32),chainCode:t.subarray(32)}}const derPrefix$2="302e020100300506032b657004220420",derPrefixBytes$2=decode$3(derPrefix$2);class Ed25519PrivateKey{constructor(e,t){this._keyPair=e instanceof Uint8Array?nacl.sign.keyPair.fromSeed(e):e,this._chainCode=null!=t?t:null}get _type(){return"ED25519"}static generate(){const e=bytes$1(64);return new Ed25519PrivateKey(nacl.sign.keyPair.fromSeed(e.subarray(0,32)),e.subarray(32))}static async generateAsync(){const e=await bytesAsync(64);return new Ed25519PrivateKey(nacl.sign.keyPair.fromSeed(e.subarray(0,32)),e.subarray(32))}static fromBytes(e){switch(e.length){case 48:return Ed25519PrivateKey.fromBytesDer(e);case 32:case 64:return Ed25519PrivateKey.fromBytesRaw(e);default:throw new BadKeyError(`invalid private key length: ${e.length} bytes`)}}static fromBytesDer(e){let t;try{const r=new Uint8Array(e),o=r.subarray(0,e.length-32);if(!o.every(((e,t)=>derPrefixBytes$2[t]===e)))throw new BadKeyError("invalid DER prefix for ED25519 private key");t=r.slice(e.length-32)}catch(o){const e=null!=o&&null!=o.message?o.message:"";throw new BadKeyError(`cannot decode ED25519 private key data from DER format: ${e}`)}const r=nacl.sign.keyPair.fromSeed(t);return new Ed25519PrivateKey(r)}static fromBytesRaw(e){switch(e.length){case 32:return new Ed25519PrivateKey(nacl.sign.keyPair.fromSeed(e));case 64:return new Ed25519PrivateKey(nacl.sign.keyPair.fromSecretKey(e))}throw new BadKeyError(`invalid private key length: ${e.length} bytes`)}static fromString(e){return Ed25519PrivateKey.fromBytes(decode$3(e))}static fromStringDer(e){return Ed25519PrivateKey.fromBytesDer(decode$3(e))}static fromStringRaw(e){return Ed25519PrivateKey.fromBytesRaw(decode$3(e))}static async fromSeed(e){const{keyData:t,chainCode:r}=await fromSeed(e);return new Ed25519PrivateKey(t,r)}get publicKey(){return new Ed25519PublicKey(this._keyPair.publicKey)}sign(e){return nacl.sign.detached(e,this._keyPair.secretKey)}toBytesDer(){const e=new Uint8Array(derPrefixBytes$2.length+32),t=this._keyPair.secretKey.subarray(0,32),r=32-t.length,o=derPrefixBytes$2.length+r;return e.set(derPrefixBytes$2,0),e.set(t,o),e}toBytesRaw(){return this._keyPair.secretKey.slice(0,32)}}const HEX_CHARS="0123456789abcdef".split(""),KECCAK_PADDING=[1,256,65536,16777216],SHIFT=[0,8,16,24],RC=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],Keccak$1=e=>{return{blocks:[],reset:!0,block:0,start:0,blockCount:1600-(e<<1)>>5,outputBlocks:e>>5,s:(t=[0,0,0,0,0,0,0,0,0,0],[].concat(t,t,t,t,t))};var t},update=(e,t)=>{for(var r,o,n=t.length,i=e.blocks,a=e.blockCount<<2,s=e.blockCount,c=e.outputBlocks,u=e.s,l=0;l<n;){if(e.reset)for(e.reset=!1,i[0]=e.block,r=1;r<s+1;++r)i[r]=0;if("string"!=typeof t)for(r=e.start;l<n&&r<a;++l)i[r>>2]|=t[l]<<SHIFT[3&r++];else for(r=e.start;l<n&&r<a;++l)(o=t.charCodeAt(l))<128?i[r>>2]|=o<<SHIFT[3&r++]:o<2048?(i[r>>2]|=(192|o>>6)<<SHIFT[3&r++],i[r>>2]|=(128|63&o)<<SHIFT[3&r++]):o<55296||o>=57344?(i[r>>2]|=(224|o>>12)<<SHIFT[3&r++],i[r>>2]|=(128|o>>6&63)<<SHIFT[3&r++],i[r>>2]|=(128|63&o)<<SHIFT[3&r++]):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++l)),i[r>>2]|=(240|o>>18)<<SHIFT[3&r++],i[r>>2]|=(128|o>>12&63)<<SHIFT[3&r++],i[r>>2]|=(128|o>>6&63)<<SHIFT[3&r++],i[r>>2]|=(128|63&o)<<SHIFT[3&r++]);if(e.lastByteIndex=r,r>=a){for(e.start=r-a,e.block=i[s],r=0;r<s;++r)u[r]^=i[r];f$3(u),e.reset=!0}else e.start=r}if(i[(r=e.lastByteIndex)>>2]|=KECCAK_PADDING[3&r],e.lastByteIndex===a)for(i[0]=i[s],r=1;r<s+1;++r)i[r]=0;for(i[s-1]|=2147483648,r=0;r<s;++r)u[r]^=i[r];f$3(u);var d,p="",h=0;for(r=0;h<c;){for(r=0;r<s&&h<c;++r,++h)d=u[r],p+=HEX_CHARS[d>>4&15]+HEX_CHARS[15&d]+HEX_CHARS[d>>12&15]+HEX_CHARS[d>>8&15]+HEX_CHARS[d>>20&15]+HEX_CHARS[d>>16&15]+HEX_CHARS[d>>28&15]+HEX_CHARS[d>>24&15];h%s==0&&(f$3(u),r=0)}return"0x"+p},f$3=e=>{var t,r,o,n,i,a,s,c,u,l,d,p,h,f,m,y,g,b,v,w,$,k,_,T,I,A,O,E,S,R,x,C,P,N,B,D,M,L,j,F,U,K,q,G,H,V,W,z,Z,Q,Y,X,J,ee,te,re,oe,ne,ie,ae,se,ce,ue;for(o=0;o<48;o+=2)n=e[0]^e[10]^e[20]^e[30]^e[40],i=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],l=e[6]^e[16]^e[26]^e[36]^e[46],d=e[7]^e[17]^e[27]^e[37]^e[47],t=(p=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),r=(h=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=n^(c<<1|u>>>31),r=i^(u<<1|c>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=a^(l<<1|d>>>31),r=s^(d<<1|l>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=c^(p<<1|h>>>31),r=u^(h<<1|p>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=l^(n<<1|i>>>31),r=d^(i<<1|n>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,f=e[0],m=e[1],V=e[11]<<4|e[10]>>>28,W=e[10]<<4|e[11]>>>28,E=e[20]<<3|e[21]>>>29,S=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,se=e[30]<<9|e[31]>>>23,K=e[40]<<18|e[41]>>>14,q=e[41]<<18|e[40]>>>14,N=e[2]<<1|e[3]>>>31,B=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,g=e[12]<<12|e[13]>>>20,z=e[22]<<10|e[23]>>>22,Z=e[23]<<10|e[22]>>>22,R=e[33]<<13|e[32]>>>19,x=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,ue=e[43]<<2|e[42]>>>30,ee=e[5]<<30|e[4]>>>2,te=e[4]<<30|e[5]>>>2,D=e[14]<<6|e[15]>>>26,M=e[15]<<6|e[14]>>>26,b=e[25]<<11|e[24]>>>21,v=e[24]<<11|e[25]>>>21,Q=e[34]<<15|e[35]>>>17,Y=e[35]<<15|e[34]>>>17,C=e[45]<<29|e[44]>>>3,P=e[44]<<29|e[45]>>>3,T=e[6]<<28|e[7]>>>4,I=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,oe=e[16]<<23|e[17]>>>9,L=e[26]<<25|e[27]>>>7,j=e[27]<<25|e[26]>>>7,w=e[36]<<21|e[37]>>>11,$=e[37]<<21|e[36]>>>11,X=e[47]<<24|e[46]>>>8,J=e[46]<<24|e[47]>>>8,G=e[8]<<27|e[9]>>>5,H=e[9]<<27|e[8]>>>5,A=e[18]<<20|e[19]>>>12,O=e[19]<<20|e[18]>>>12,ne=e[29]<<7|e[28]>>>25,ie=e[28]<<7|e[29]>>>25,F=e[38]<<8|e[39]>>>24,U=e[39]<<8|e[38]>>>24,k=e[48]<<14|e[49]>>>18,_=e[49]<<14|e[48]>>>18,e[0]=f^~y&b,e[1]=m^~g&v,e[10]=T^~A&E,e[11]=I^~O&S,e[20]=N^~D&L,e[21]=B^~M&j,e[30]=G^~V&z,e[31]=H^~W&Z,e[40]=ee^~re&ne,e[41]=te^~oe&ie,e[2]=y^~b&w,e[3]=g^~v&$,e[12]=A^~E&R,e[13]=O^~S&x,e[22]=D^~L&F,e[23]=M^~j&U,e[32]=V^~z&Q,e[33]=W^~Z&Y,e[42]=re^~ne&ae,e[43]=oe^~ie&se,e[4]=b^~w&k,e[5]=v^~$&_,e[14]=E^~R&C,e[15]=S^~x&P,e[24]=L^~F&K,e[25]=j^~U&q,e[34]=z^~Q&X,e[35]=Z^~Y&J,e[44]=ne^~ae&ce,e[45]=ie^~se&ue,e[6]=w^~k&f,e[7]=$^~_&m,e[16]=R^~C&T,e[17]=x^~P&I,e[26]=F^~K&N,e[27]=U^~q&B,e[36]=Q^~X&G,e[37]=Y^~J&H,e[46]=ae^~ce&ee,e[47]=se^~ue&te,e[8]=k^~f&y,e[9]=_^~m&g,e[18]=C^~T&A,e[19]=P^~I&O,e[28]=K^~N&D,e[29]=q^~B&M,e[38]=X^~G&V,e[39]=J^~H&W,e[48]=ce^~ee&re,e[49]=ue^~te&oe,e[0]^=RC[o],e[1]^=RC[o+1]},keccak=e=>t=>{var r;if("0x"===t.slice(0,2)){r=[];for(var o=2,n=t.length;o<n;o+=2)r.push(parseInt(t.slice(o,o+2),16))}else r=t;return update(Keccak$1(e),r)},keccak256$2=keccak(256),secp256k1=new elliptic.ec("secp256k1");function generate(){const e=secp256k1.genKeyPair();return{privateKey:decode$3(e.getPrivate("hex")),publicKey:decode$3(e.getPublic(!0,"hex"))}}async function generateAsync(){return Promise.resolve(generate())}function fromBytes(e){const t=secp256k1.keyFromPrivate(e);return{privateKey:decode$3(t.getPrivate("hex")),publicKey:decode$3(t.getPublic(!0,"hex"))}}function getFullPublicKey(e){return decode$3(secp256k1.keyFromPublic(e).getPublic(!1,"hex"))}function sign(e,t){const r=encode$4(t),o=decode$3(keccak256$2(`0x${r}`)),n=secp256k1.keyFromPrivate(e).sign(o),i=n.r.toArray("be",32),a=n.s.toArray("be",32),s=new Uint8Array(64);return s.set(i,0),s.set(a,32),s}function verify(e,t,r){const o=encode$4(t),n=decode$3(keccak256$2(`0x${o}`));return secp256k1.keyFromPublic(e).verify(n,{r:r.subarray(0,32),s:r.subarray(32,64)})}const ec=new elliptic.ec("secp256k1"),legacyDerPrefix="302d300706052b8104000a032200",legacyDerPrefixBytes=decode$3(legacyDerPrefix),derPrefix$1="3036301006072a8648ce3d020106052b8104000a032200",derPrefixBytes$1=decode$3(derPrefix$1);class EcdsaPublicKey extends Key{constructor(e){super(),this._keyData=e}get _type(){return"secp256k1"}static fromBytes(e){return 33===e.length?EcdsaPublicKey.fromBytesRaw(e):EcdsaPublicKey.fromBytesDer(e)}static fromBytesDer(e){let t=new Uint8Array;switch(e.length){case 47:t=e.subarray(legacyDerPrefixBytes.length);break;case 56:t=e.subarray(derPrefixBytes$1.length,derPrefixBytes$1.length+33);break;default:t=decode$3(ec.keyFromPublic(e.subarray(derPrefixBytes$1.length),"der").getPublic().encodeCompressed("hex"))}if(0==t.length)throw new BadKeyError("cannot decode ECDSA private key data from DER format");return new EcdsaPublicKey(t)}static fromBytesRaw(e){if(33!=e.length)throw new BadKeyError(`invalid public key length: ${e.length} bytes`);return new EcdsaPublicKey(e)}static fromString(e){return EcdsaPublicKey.fromBytes(decode$3(e))}verify(e,t){return verify(this._keyData,e,t)}toBytesDer(){const e=new Uint8Array(legacyDerPrefixBytes.length+this._keyData.length);return e.set(legacyDerPrefixBytes,0),e.set(this._keyData,legacyDerPrefixBytes.length),e}toBytesRaw(){return new Uint8Array(this._keyData.subarray())}toEthereumAddress(){const e=decode$3(keccak256$2(`0x${encode$4(getFullPublicKey(this.toBytesRaw()).subarray(1))}`));return encode$4(e.subarray(12))}equals(e){return arrayEqual(this._keyData,e._keyData)}}const derPrefix="3030020100300706052b8104000a04220420",derPrefixBytes=decode$3(derPrefix),derPrefix2="30540201010420",derPrefixBytes2=decode$3(derPrefix2);class EcdsaPrivateKey{constructor(e,t){this._keyPair=e,this._chainCode=null!=t?t:null}get _type(){return"secp256k1"}static generate(){return new EcdsaPrivateKey(generate())}static async generateAsync(){return new EcdsaPrivateKey(await generateAsync())}static fromBytes(e){return 32===e.length?EcdsaPrivateKey.fromBytesRaw(e):EcdsaPrivateKey.fromBytesDer(e)}static fromBytesDer(e){let t=new Uint8Array;return t=arrayStartsWith(e,derPrefixBytes)?e.subarray(derPrefixBytes.length):e.subarray(derPrefixBytes2.length,derPrefixBytes2.length+32),new EcdsaPrivateKey(fromBytes(t))}static fromBytesRaw(e){return new EcdsaPrivateKey(fromBytes(e))}static fromString(e){return EcdsaPrivateKey.fromBytes(decode$3(e))}static fromStringDer(e){return EcdsaPrivateKey.fromBytesDer(decode$3(e))}static fromStringRaw(e){return EcdsaPrivateKey.fromBytesRaw(decode$3(e))}static async fromSeed(e){const{keyData:t,chainCode:r}=await fromSeed$1(e);return new EcdsaPrivateKey(fromBytes(t),r)}get publicKey(){return new EcdsaPublicKey(this._keyPair.publicKey)}sign(e){return sign(this._keyPair.privateKey,e)}toBytesDer(){const e=new Uint8Array(derPrefixBytes.length+32),t=this._keyPair.privateKey.subarray(0,32),r=32-t.length,o=derPrefixBytes.length+r;return e.set(derPrefixBytes,0),e.set(t,o),e}toBytesRaw(){const e=this._keyPair.privateKey.subarray(-32),t=32-e.length,r=new Uint8Array(32);return r.set(e,t),r}}class PublicKey extends Key{constructor(e){super(),this._key=e}get _type(){return this._key._type}static fromBytes(e){let t;try{return new PublicKey(Ed25519PublicKey.fromBytes(e))}catch(r){t=null!=r&&null!=r.message?r.message:""}try{return new PublicKey(EcdsaPublicKey.fromBytes(e))}catch(r){t=null!=r&&null!=r.message?r.message:""}throw new BadKeyError(`public key cannot be decoded from bytes: ${t}`)}static fromBytesED25519(e){return new PublicKey(Ed25519PublicKey.fromBytes(e))}static fromBytesECDSA(e){return new PublicKey(EcdsaPublicKey.fromBytes(e))}static fromString(e){return PublicKey.fromBytes(decode$3(e))}static fromStringED25519(e){return PublicKey.fromBytesED25519(decode$3(e))}static fromStringECDSA(e){return PublicKey.fromBytesECDSA(decode$3(e))}verify(e,t){return this._key.verify(e,t)}verifyTransaction(e){console.log("Deprecated: use `@hashgraph/sdk`.PublicKey instead"),e._requireFrozen(),e.isFrozen()||e.freeze();for(const t of e._signedTransactions)if(null!=t.sigMap&&null!=t.sigMap.sigPair){let e=!1;for(const r of t.sigMap.sigPair){if(arrayEqual(r.pubKeyPrefix,this.toBytesRaw())){e=!0;const o=t.bodyBytes,n=null!=r.ed25519?r.ed25519:r.ECDSASecp256k1;if(!this.verify(o,n))return!1}}if(!e)return!1}return!0}toBytes(){return this._key instanceof Ed25519PublicKey?this.toBytesRaw():this.toBytesDer()}toBytesDer(){return this._key.toBytesDer()}toBytesRaw(){return this._key.toBytesRaw()}toString(){return this.toStringDer()}toStringDer(){return encode$4(this.toBytesDer())}toStringRaw(){return encode$4(this.toBytesRaw())}toEthereumAddress(){if(this._key instanceof EcdsaPublicKey)return this._key.toEthereumAddress();throw new Error("unsupported operation on Ed25519PublicKey")}equals(e){return(this._key instanceof Ed25519PublicKey&&e._key instanceof Ed25519PublicKey||this._key instanceof EcdsaPublicKey&&e._key instanceof EcdsaPublicKey)&&this._key.equals(e._key)}}var sparkMd5={exports:{}};!function(e,t){e.exports=function(e){var t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function r(e,t){var r=e[0],o=e[1],n=e[2],i=e[3];o=((o+=((n=((n+=((i=((i+=((r=((r+=(o&n|~o&i)+t[0]-680876936|0)<<7|r>>>25)+o|0)&o|~r&n)+t[1]-389564586|0)<<12|i>>>20)+r|0)&r|~i&o)+t[2]+606105819|0)<<17|n>>>15)+i|0)&i|~n&r)+t[3]-1044525330|0)<<22|o>>>10)+n|0,o=((o+=((n=((n+=((i=((i+=((r=((r+=(o&n|~o&i)+t[4]-176418897|0)<<7|r>>>25)+o|0)&o|~r&n)+t[5]+1200080426|0)<<12|i>>>20)+r|0)&r|~i&o)+t[6]-1473231341|0)<<17|n>>>15)+i|0)&i|~n&r)+t[7]-45705983|0)<<22|o>>>10)+n|0,o=((o+=((n=((n+=((i=((i+=((r=((r+=(o&n|~o&i)+t[8]+1770035416|0)<<7|r>>>25)+o|0)&o|~r&n)+t[9]-1958414417|0)<<12|i>>>20)+r|0)&r|~i&o)+t[10]-42063|0)<<17|n>>>15)+i|0)&i|~n&r)+t[11]-1990404162|0)<<22|o>>>10)+n|0,o=((o+=((n=((n+=((i=((i+=((r=((r+=(o&n|~o&i)+t[12]+1804603682|0)<<7|r>>>25)+o|0)&o|~r&n)+t[13]-40341101|0)<<12|i>>>20)+r|0)&r|~i&o)+t[14]-1502002290|0)<<17|n>>>15)+i|0)&i|~n&r)+t[15]+1236535329|0)<<22|o>>>10)+n|0,o=((o+=((n=((n+=((i=((i+=((r=((r+=(o&i|n&~i)+t[1]-165796510|0)<<5|r>>>27)+o|0)&n|o&~n)+t[6]-1069501632|0)<<9|i>>>23)+r|0)&o|r&~o)+t[11]+643717713|0)<<14|n>>>18)+i|0)&r|i&~r)+t[0]-373897302|0)<<20|o>>>12)+n|0,o=((o+=((n=((n+=((i=((i+=((r=((r+=(o&i|n&~i)+t[5]-701558691|0)<<5|r>>>27)+o|0)&n|o&~n)+t[10]+38016083|0)<<9|i>>>23)+r|0)&o|r&~o)+t[15]-660478335|0)<<14|n>>>18)+i|0)&r|i&~r)+t[4]-405537848|0)<<20|o>>>12)+n|0,o=((o+=((n=((n+=((i=((i+=((r=((r+=(o&i|n&~i)+t[9]+568446438|0)<<5|r>>>27)+o|0)&n|o&~n)+t[14]-1019803690|0)<<9|i>>>23)+r|0)&o|r&~o)+t[3]-187363961|0)<<14|n>>>18)+i|0)&r|i&~r)+t[8]+1163531501|0)<<20|o>>>12)+n|0,o=((o+=((n=((n+=((i=((i+=((r=((r+=(o&i|n&~i)+t[13]-1444681467|0)<<5|r>>>27)+o|0)&n|o&~n)+t[2]-51403784|0)<<9|i>>>23)+r|0)&o|r&~o)+t[7]+1735328473|0)<<14|n>>>18)+i|0)&r|i&~r)+t[12]-1926607734|0)<<20|o>>>12)+n|0,o=((o+=((n=((n+=((i=((i+=((r=((r+=(o^n^i)+t[5]-378558|0)<<4|r>>>28)+o|0)^o^n)+t[8]-2022574463|0)<<11|i>>>21)+r|0)^r^o)+t[11]+1839030562|0)<<16|n>>>16)+i|0)^i^r)+t[14]-35309556|0)<<23|o>>>9)+n|0,o=((o+=((n=((n+=((i=((i+=((r=((r+=(o^n^i)+t[1]-1530992060|0)<<4|r>>>28)+o|0)^o^n)+t[4]+1272893353|0)<<11|i>>>21)+r|0)^r^o)+t[7]-155497632|0)<<16|n>>>16)+i|0)^i^r)+t[10]-1094730640|0)<<23|o>>>9)+n|0,o=((o+=((n=((n+=((i=((i+=((r=((r+=(o^n^i)+t[13]+681279174|0)<<4|r>>>28)+o|0)^o^n)+t[0]-358537222|0)<<11|i>>>21)+r|0)^r^o)+t[3]-722521979|0)<<16|n>>>16)+i|0)^i^r)+t[6]+76029189|0)<<23|o>>>9)+n|0,o=((o+=((n=((n+=((i=((i+=((r=((r+=(o^n^i)+t[9]-640364487|0)<<4|r>>>28)+o|0)^o^n)+t[12]-421815835|0)<<11|i>>>21)+r|0)^r^o)+t[15]+530742520|0)<<16|n>>>16)+i|0)^i^r)+t[2]-995338651|0)<<23|o>>>9)+n|0,o=((o+=((i=((i+=(o^((r=((r+=(n^(o|~i))+t[0]-198630844|0)<<6|r>>>26)+o|0)|~n))+t[7]+1126891415|0)<<10|i>>>22)+r|0)^((n=((n+=(r^(i|~o))+t[14]-1416354905|0)<<15|n>>>17)+i|0)|~r))+t[5]-57434055|0)<<21|o>>>11)+n|0,o=((o+=((i=((i+=(o^((r=((r+=(n^(o|~i))+t[12]+1700485571|0)<<6|r>>>26)+o|0)|~n))+t[3]-1894986606|0)<<10|i>>>22)+r|0)^((n=((n+=(r^(i|~o))+t[10]-1051523|0)<<15|n>>>17)+i|0)|~r))+t[1]-2054922799|0)<<21|o>>>11)+n|0,o=((o+=((i=((i+=(o^((r=((r+=(n^(o|~i))+t[8]+1873313359|0)<<6|r>>>26)+o|0)|~n))+t[15]-30611744|0)<<10|i>>>22)+r|0)^((n=((n+=(r^(i|~o))+t[6]-1560198380|0)<<15|n>>>17)+i|0)|~r))+t[13]+1309151649|0)<<21|o>>>11)+n|0,o=((o+=((i=((i+=(o^((r=((r+=(n^(o|~i))+t[4]-145523070|0)<<6|r>>>26)+o|0)|~n))+t[11]-1120210379|0)<<10|i>>>22)+r|0)^((n=((n+=(r^(i|~o))+t[2]+718787259|0)<<15|n>>>17)+i|0)|~r))+t[9]-343485551|0)<<21|o>>>11)+n|0,e[0]=r+e[0]|0,e[1]=o+e[1]|0,e[2]=n+e[2]|0,e[3]=i+e[3]|0}function o(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return r}function n(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return r}function i(e){var t,n,i,a,s,c,u=e.length,l=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=u;t+=64)r(l,o(e.substring(t-64,t)));for(n=(e=e.substring(t-64)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<n;t+=1)i[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(r(l,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),c=parseInt(a[1],16)||0,i[14]=s,i[15]=c,r(l,i),l}function a(e){var t,o,i,a,s,c,u=e.length,l=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=u;t+=64)r(l,n(e.subarray(t-64,t)));for(o=(e=t-64<u?e.subarray(t-64):new Uint8Array(0)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<o;t+=1)i[t>>2]|=e[t]<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(r(l,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*u).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),c=parseInt(a[1],16)||0,i[14]=s,i[15]=c,r(l,i),l}function s(e){var r,o="";for(r=0;r<4;r+=1)o+=t[e>>8*r+4&15]+t[e>>8*r&15];return o}function c(e){var t;for(t=0;t<e.length;t+=1)e[t]=s(e[t]);return e.join("")}function u(e){return/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e))),e}function l(e,t){var r,o=e.length,n=new ArrayBuffer(o),i=new Uint8Array(n);for(r=0;r<o;r+=1)i[r]=e.charCodeAt(r);return t?i:n}function d(e){return String.fromCharCode.apply(null,new Uint8Array(e))}function p(e,t,r){var o=new Uint8Array(e.byteLength+t.byteLength);return o.set(new Uint8Array(e)),o.set(new Uint8Array(t),e.byteLength),o}function h(e){var t,r=[],o=e.length;for(t=0;t<o-1;t+=2)r.push(parseInt(e.substr(t,2),16));return String.fromCharCode.apply(String,r)}function f(){this.reset()}return c(i("hello")),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function t(e,t){return(e=0|e||0)<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(r,o){var n,i,a,s,c=this.byteLength,u=t(r,c),l=c;return o!==e&&(l=t(o,c)),u>l?new ArrayBuffer(0):(n=l-u,i=new ArrayBuffer(n),a=new Uint8Array(i),s=new Uint8Array(this,u,n),a.set(s),i)}}(),f.prototype.append=function(e){return this.appendBinary(u(e)),this},f.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,n=this._buff.length;for(t=64;t<=n;t+=64)r(this._hash,o(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},f.prototype.end=function(e){var t,r,o=this._buff,n=o.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<n;t+=1)i[t>>2]|=o.charCodeAt(t)<<(t%4<<3);return this._finish(i,n),r=c(this._hash),e&&(r=h(r)),this.reset(),r},f.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},f.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},f.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},f.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},f.prototype._finish=function(e,t){var o,n,i,a=t;if(e[a>>2]|=128<<(a%4<<3),a>55)for(r(this._hash,e),a=0;a<16;a+=1)e[a]=0;o=(o=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),n=parseInt(o[2],16),i=parseInt(o[1],16)||0,e[14]=n,e[15]=i,r(this._hash,e)},f.hash=function(e,t){return f.hashBinary(u(e),t)},f.hashBinary=function(e,t){var r=c(i(e));return t?h(r):r},f.ArrayBuffer=function(){this.reset()},f.ArrayBuffer.prototype.append=function(e){var t,o=p(this._buff.buffer,e),i=o.length;for(this._length+=e.byteLength,t=64;t<=i;t+=64)r(this._hash,n(o.subarray(t-64,t)));return this._buff=t-64<i?new Uint8Array(o.buffer.slice(t-64)):new Uint8Array(0),this},f.ArrayBuffer.prototype.end=function(e){var t,r,o=this._buff,n=o.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<n;t+=1)i[t>>2]|=o[t]<<(t%4<<3);return this._finish(i,n),r=c(this._hash),e&&(r=h(r)),this.reset(),r},f.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},f.ArrayBuffer.prototype.getState=function(){var e=f.prototype.getState.call(this);return e.buff=d(e.buff),e},f.ArrayBuffer.prototype.setState=function(e){return e.buff=l(e.buff,!0),f.prototype.setState.call(this,e)},f.ArrayBuffer.prototype.destroy=f.prototype.destroy,f.ArrayBuffer.prototype._finish=f.prototype._finish,f.ArrayBuffer.hash=function(e,t){var r=c(a(new Uint8Array(e)));return t?h(r):r},f}()}(sparkMd5);var sparkMd5Exports=sparkMd5.exports;const SparkMD5=getDefaultExportFromCjs$2(sparkMd5Exports),CipherAlgorithm={Aes128Ctr:"AES-128-CTR",Aes128Cbc:"AES-128-CBC"};async function createCipheriv(e,t,r,o){let n;switch(e.toUpperCase()){case CipherAlgorithm.Aes128Ctr:n={name:"AES-CTR",counter:r,length:128};break;case CipherAlgorithm.Aes128Cbc:n={name:"AES-CBC",iv:r};break;default:throw new Error("(BUG) non-exhaustive switch statement for CipherAlgorithm")}const i=await window.crypto.subtle.importKey("raw",t,n.name,!1,["encrypt"]);return new Uint8Array(await window.crypto.subtle.encrypt(n,i,o))}async function createDecipheriv(e,t,r,o){let n;switch(e.toUpperCase()){case CipherAlgorithm.Aes128Ctr:n={name:"AES-CTR",counter:r,length:128};break;case CipherAlgorithm.Aes128Cbc:n={name:"AES-CBC",iv:r};break;default:throw new Error("(BUG) non-exhaustive switch statement for CipherAlgorithm")}const i=await window.crypto.subtle.importKey("raw",t,n.name,!1,["decrypt"]);let a;try{a=await window.crypto.subtle.decrypt(n,i,o)}catch(s){const e=null!=s&&null!=s.message?s.message:"";throw new Error(`Unable to decrypt: ${e}`)}return new Uint8Array(a)}async function messageDigest(e,t){const r=encode$3(e),o=decode$3(t).slice(0,8),n=SparkMD5.ArrayBuffer.hash(Buffer$1.concat([Buffer$1.from(r),Buffer$1.from(o)]));return Promise.resolve(decode$3(n))}async function deriveKey(e,t,r,o,n){const i="string"==typeof t?encode$3(t):t,a="string"==typeof r?encode$3(r):r;try{const t=await window.crypto.subtle.importKey("raw",i,{name:"PBKDF2",hash:e},!1,["deriveBits"]);return new Uint8Array(await window.crypto.subtle.deriveBits({name:"PBKDF2",hash:e,salt:a,iterations:o},t,n<<3))}catch{throw new Error("(BUG) Non-Exhaustive switch statement for algorithms")}}const HMAC_SHA256="hmac-sha256";async function createKeystore(e,t){const r=262144,o=await bytesAsync(32),n=await deriveKey(HashAlgorithm.Sha256,t,o,r,32),i=await bytesAsync(16),a=await createCipheriv(CipherAlgorithm.Aes128Ctr,n.slice(0,16),i,e),s=await hash(HashAlgorithm.Sha384,n.slice(16),a),c={version:1,crypto:{ciphertext:encode$4(a),cipherparams:{iv:encode$4(i)},cipher:CipherAlgorithm.Aes128Ctr,kdf:"pbkdf2",kdfparams:{dkLen:32,salt:encode$4(o),c:r,prf:HMAC_SHA256},mac:encode$4(s)}};return encode$3(JSON.stringify(c))}async function loadKeystore(e,t){const r=JSON.parse(decode$2(e));if(1!==r.version)throw new BadKeyError(`unsupported keystore version: ${r.version}`);const{ciphertext:o,cipherparams:{iv:n},cipher:i,kdf:a,kdfparams:{dkLen:s,salt:c,c:u,prf:l},mac:d}=r.crypto;if("pbkdf2"!==a)throw new BadKeyError(`unsupported key derivation function:" + ${a}`);if(l!==HMAC_SHA256)throw new BadKeyError(`unsupported key derivation hash function: ${l}`);const p=decode$3(c),h=decode$3(n),f=decode$3(o),m=await deriveKey(HashAlgorithm.Sha256,t,p,u,s),y=decode$3(d),g=await hash(HashAlgorithm.Sha384,m.slice(16),f);if(!y.every(((e,t)=>e===g[t])))throw new BadKeyError("HMAC mismatch; passphrase is incorrect");return createDecipheriv(i,m.slice(0,16),h,f)}function decode$1(e){return decodeIncremental(e)[0]}function decodeIncremental(e){const[t,r]=decodeLength(e.subarray(1)),o=r.subarray(0,t),n=r.subarray(t);switch(e[0]){case 2:return[{int:decodeInt(o)},n];case 4:return[{bytes:o},n];case 5:return[{},n];case 6:return[{ident:decodeObjectIdent(o)},n];case 48:return[{seq:decodeSeq(o)},n];default:throw new Error(`unsupported DER type tag: ${e[0]}`)}}function decodeSeq(e){let t=e;const r=[];for(;0!==t.length;){const[e,o]=decodeIncremental(t);r.push(e),t=o}return r}function decodeObjectIdent(e){const t=[Math.floor(e[0]/40),e[0]%40];let r=0;for(const o of e.subarray(1))r*=128,o<128?(r+=o,t.push(r),r=0):r+=127&o;return t.join(".")}function decodeLength(e){if(e[0]<128)return[e[0],e.subarray(1)];const t=e[0]-128,r=e.subarray(1,t+1),o=e.subarray(t+1);return[decodeInt(r),o]}function decodeInt(e){const t=e.length;if(1===t)return e[0];let r=new DataView(e.buffer,e.byteOffset,e.byteLength);if(2===t)return r.getUint16(0,!1);if(3===t){const t=Uint8Array.of(0,...e);r=new DataView(t.buffer,t.byteOffset,t.byteLength)}if(t>4)throw new Error(`unsupported DER integer length of ${t} bytes`);return r.getUint32(0,!1)}class AlgorithmIdentifier{constructor(e){if(!("seq"in e&&e.seq.length>=1&&"ident"in e.seq[0]))throw new Error(`error parsing AlgorithmIdentifier from ${JSON.stringify(e)}`);this.algIdent=e.seq[0].ident,this.parameters=e.seq[1]}toString(){return JSON.stringify(this)}}class PBES2Params{constructor(e){if(!("seq"in e)||2!==e.seq.length)throw new Error(`error parsing PBES2Params from ${JSON.stringify(e)}`);this.kdf=new AlgorithmIdentifier(e.seq[0]),this.encScheme=new AlgorithmIdentifier(e.seq[1])}}class PBKDF2Params{constructor(e){if("seq"in e&&e.seq.length>=2&&"bytes"in e.seq[0]&&"int"in e.seq[1]&&(this.salt=e.seq[0].bytes,this.iterCount=e.seq[1].int,e.seq.length>2))return"seq"in e.seq[2]?void(this.prf=new AlgorithmIdentifier(e.seq[2])):("int"in e.seq[2]&&(this.keyLength=e.seq[2].int),void(4===e.seq.length&&(this.prf=new AlgorithmIdentifier(e.seq[3]))));throw new Error(`error parsing PBKDF2Params from ${JSON.stringify(e)}`)}}class PrivateKeyInfo{constructor(e){if(!("seq"in e)||3!==e.seq.length)throw new Error(`error parsing PrivateKeyInfo from ${JSON.stringify(e)}`);if(!("int"in e.seq[0])||0!==e.seq[0].int)throw new Error(`expected version = 0, got ${JSON.stringify(e.seq[0])}`);if(this.version=0,this.algId=new AlgorithmIdentifier(e.seq[1]),!("bytes"in e.seq[2]))throw new Error(`expected octet string as 3rd element, got ${JSON.stringify(e.seq[2])}`);this.privateKey=e.seq[2].bytes}static parse(e){return new PrivateKeyInfo(decode$1(e))}}class EncryptedPrivateKeyInfo{constructor(e){if("seq"in e&&2===e.seq.length&&"bytes"in e.seq[1])return this.algId=new AlgorithmIdentifier(e.seq[0]),void(this.data=e.seq[1].bytes);throw new Error(`error parsing EncryptedPrivateKeyInfo from ${JSON.stringify(e)}`)}static parse(e){return new EncryptedPrivateKeyInfo(decode$1(e))}async decrypt(e){if("1.2.840.113549.1.5.13"!==this.algId.algIdent||!this.algId.parameters)throw new Error(`unsupported key encryption algorithm: ${this.algId.toString()}`);const t=new PBES2Params(this.algId.parameters);if("1.2.840.113549.1.5.12"!==t.kdf.algIdent||!t.kdf.parameters)throw new Error(`unsupported key derivation function: ${t.kdf.toString()}`);const r=new PBKDF2Params(t.kdf.parameters);if(!r.prf)throw new Error("unsupported PRF HMAC-SHA-1");if("1.2.840.113549.2.9"!==r.prf.algIdent)throw new Error(`unsupported PRF ${r.prf.toString()}`);if("2.16.840.1.101.3.4.1.2"!==t.encScheme.algIdent)throw new Error(`unsupported encryption scheme: ${t.encScheme.toString()}`);if(!t.encScheme.parameters||!("bytes"in t.encScheme.parameters))throw new Error(`expected IV as bytes for AES-128-CBC, got: ${JSON.stringify(t.encScheme.parameters)}`);const o=r.keyLength||16,n=t.encScheme.parameters.bytes,i=await deriveKey(HashAlgorithm.Sha256,e,r.salt,r.iterCount,o),a=await createDecipheriv(CipherAlgorithm.Aes128Cbc,i,n,this.data);return PrivateKeyInfo.parse(a)}}function decode(e){return Uint8Array.from(Buffer$1.from(e,"base64"))}
32
32
  /*!
33
33
  * MIT License
34
34
  *
@@ -111,5 +111,5 @@ read:function(e,t,r,o,n){var i,a,s=8*n-o-1,c=(1<<s)-1,u=c>>1,l=-7,d=r?n-1:0,p=r?
111
111
  * Copyright(c) 2014 Jonathan Ong
112
112
  * Copyright(c) 2015 Douglas Christopher Wilson
113
113
  * MIT Licensed
114
- */!function(e){var t,r,o,n=mimeDb,i=pathBrowserify.extname,a=/^\s*([^;\s]*)(?:;|\s|$)/,s=/^text\//i;function c(e){if(!e||"string"!=typeof e)return!1;var t=a.exec(e),r=t&&n[t[1].toLowerCase()];return r&&r.charset?r.charset:!(!t||!s.test(t[1]))&&"UTF-8"}e.charset=c,e.charsets={lookup:c},e.contentType=function(t){if(!t||"string"!=typeof t)return!1;var r=-1===t.indexOf("/")?e.lookup(t):t;if(!r)return!1;if(-1===r.indexOf("charset")){var o=e.charset(r);o&&(r+="; charset="+o.toLowerCase())}return r},e.extension=function(t){if(!t||"string"!=typeof t)return!1;var r=a.exec(t),o=r&&e.extensions[r[1].toLowerCase()];if(!o||!o.length)return!1;return o[0]},e.extensions=Object.create(null),e.lookup=function(t){if(!t||"string"!=typeof t)return!1;var r=i("x."+t).toLowerCase().substr(1);if(!r)return!1;return e.types[r]||!1},e.types=Object.create(null),t=e.extensions,r=e.types,o=["nginx","apache",void 0,"iana"],Object.keys(n).forEach((function(e){var i=n[e],a=i.extensions;if(a&&a.length){t[e]=a;for(var s=0;s<a.length;s++){var c=a[s];if(r[c]){var u=o.indexOf(n[r[c]].source),l=o.indexOf(i.source);if("application/octet-stream"!==r[c]&&(u>l||u===l&&"application/"===r[c].substr(0,12)))continue}r[c]=e}}}))}(mimeTypes);var InboundTopicType=(e=>(e.PUBLIC="PUBLIC",e.CONTROLLED="CONTROLLED",e.FEE_BASED="FEE_BASED",e))(InboundTopicType||{}),util,util2,objectUtil,objectUtil2;async function inscribe(e,t,r,o){var n,i;const a=Logger$2.getInstance({module:"Inscriber",...r.logging});a.info("Starting inscription process",{type:e.type,mode:r.mode||"file",..."url"===e.type?{url:e.url}:{},..."file"===e.type?{path:e.path}:{},..."buffer"===e.type?{fileName:e.fileName,bufferSize:e.buffer.byteLength}:{}});try{let s;"hashinal"===r.mode&&r.metadata&&validateHashinalMetadata(r.metadata,a),o?(a.debug("Using existing InscriptionSDK instance"),s=o):r.apiKey?(a.debug("Initializing InscriptionSDK with API key"),s=new InscriptionSDK({apiKey:r.apiKey,network:t.network||"mainnet"})):(a.debug("Initializing InscriptionSDK with server auth"),s=await InscriptionSDK.createWithAuth({type:"server",accountId:t.accountId,privateKey:t.privateKey,network:t.network||"mainnet"}));const c={holderId:t.accountId,metadata:r.metadata||{},tags:r.tags||[],mode:r.mode||"file",chunkSize:r.chunkSize};let u;switch(e.type){case"url":u={...c,file:{type:"url",url:e.url}};break;case"file":u={...c,file:{type:"path",path:e.path}};break;case"buffer":u={...c,file:{type:"base64",base64:Buffer.from(e.buffer).toString("base64"),fileName:e.fileName,mimeType:e.mimeType}}}"hashinal"===r.mode&&(u.metadataObject=r.metadata,u.creator=(null==(n=r.metadata)?void 0:n.creator)||t.accountId,u.description=null==(i=r.metadata)?void 0:i.description,r.jsonFileURL&&(u.jsonFileURL=r.jsonFileURL)),a.debug("Preparing to inscribe content",{type:e.type,mode:r.mode||"file",holderId:t.accountId});const l=await s.inscribeAndExecute(u,t);if(a.info("Starting to inscribe.",{type:e.type,mode:r.mode||"file",transactionId:l.jobId}),r.waitForConfirmation){a.debug("Waiting for inscription confirmation",{transactionId:l.jobId,maxAttempts:r.waitMaxAttempts,intervalMs:r.waitIntervalMs});const e=await waitForInscriptionConfirmation(s,l.jobId,r.waitMaxAttempts,r.waitIntervalMs);return a.info("Inscription confirmation received",{transactionId:l.jobId}),{confirmed:!0,result:l,inscription:e,sdk:s}}return{confirmed:!1,result:l,sdk:s}}catch(s){throw a.error("Error during inscription process",s),s}}async function inscribeWithSigner(e,t,r,o){var n,i;const a=Logger$2.getInstance({module:"Inscriber",...r.logging});a.info("Starting inscription process with signer",{type:e.type,mode:r.mode||"file",..."url"===e.type?{url:e.url}:{},..."file"===e.type?{path:e.path}:{},..."buffer"===e.type?{fileName:e.fileName,bufferSize:e.buffer.byteLength}:{}});try{"hashinal"===r.mode&&r.metadata&&validateHashinalMetadata(r.metadata,a);const s=t.getAccountId().toString();let c;a.debug("Using account ID from signer",{accountId:s}),o?(a.debug("Using existing InscriptionSDK instance"),c=o):r.apiKey?(a.debug("Initializing InscriptionSDK with API key"),c=new InscriptionSDK({apiKey:r.apiKey,network:r.network||"mainnet"})):(a.debug("Initializing InscriptionSDK with client auth"),c=await InscriptionSDK.createWithAuth({type:"client",accountId:s,signer:t,network:r.network||"mainnet"}));const u={holderId:s,metadata:r.metadata||{},tags:r.tags||[],mode:r.mode||"file",chunkSize:r.chunkSize};let l;switch(e.type){case"url":l={...u,file:{type:"url",url:e.url}};break;case"file":l={...u,file:{type:"path",path:e.path}};break;case"buffer":l={...u,file:{type:"base64",base64:Buffer.from(e.buffer).toString("base64"),fileName:e.fileName,mimeType:e.mimeType}}}"hashinal"===r.mode&&(l.metadataObject=r.metadata,l.creator=(null==(n=r.metadata)?void 0:n.creator)||s,l.description=null==(i=r.metadata)?void 0:i.description,r.jsonFileURL&&(l.jsonFileURL=r.jsonFileURL)),a.debug("Preparing to inscribe content with signer",{type:e.type,mode:r.mode||"file",holderId:s});const d=await c.inscribe({...l,holderId:s},t);if(a.info("Inscription started",{type:e.type,mode:r.mode||"file",transactionId:d.jobId}),r.waitForConfirmation){a.debug("Waiting for inscription confirmation",{transactionId:d.jobId,maxAttempts:r.waitMaxAttempts,intervalMs:r.waitIntervalMs});const e=await waitForInscriptionConfirmation(c,d.jobId,r.waitMaxAttempts,r.waitIntervalMs);return a.info("Inscription confirmation received",{transactionId:d.jobId}),{confirmed:!0,result:d,inscription:e,sdk:c}}return{confirmed:!1,result:d,sdk:c}}catch(s){throw a.error("Error during inscription process",s),s}}async function retrieveInscription(e,t){const r=Logger$2.getInstance({module:"Inscriber",...t.logging}),o=e.includes("@")?`${e.split("@")[0]}-${e.split("@")[1].replace(/\./g,"-")}`:e;r.info("Retrieving inscription",{originalTransactionId:e,formattedTransactionId:o});try{let e;if(t.apiKey)r.debug("Initializing InscriptionSDK with API key"),e=new InscriptionSDK({apiKey:t.apiKey,network:t.network||"mainnet"});else{if(!t.accountId||!t.privateKey){const e=new Error("Either API key or account ID and private key are required for retrieving inscriptions");throw r.error("Missing authentication credentials",{hasApiKey:!!t.apiKey,hasAccountId:!!t.accountId,hasPrivateKey:!!t.privateKey}),e}r.debug("Initializing InscriptionSDK with server auth"),e=await InscriptionSDK.createWithAuth({type:"server",accountId:t.accountId,privateKey:t.privateKey,network:t.network||"mainnet"})}r.debug("Initialized SDK for inscription retrieval",{formattedTransactionId:o,network:t.network||"mainnet"});const n=await e.retrieveInscription(o);return r.info("Successfully retrieved inscription",{formattedTransactionId:o}),n}catch(n){throw r.error("Error retrieving inscription",{formattedTransactionId:o,error:n}),n}}function validateHashinalMetadata(e,t){const r=["name","creator","description","type"].filter((t=>!e[t]));if(r.length>0){const e=new Error(`Missing required Hashinal metadata fields: ${r.join(", ")}`);throw t.error("Hashinal metadata validation failed",{missingFields:r}),e}t.debug("Hashinal metadata validation passed",{name:e.name,creator:e.creator,description:e.description,type:e.type,hasAttributes:!!e.attributes,hasProperties:!!e.properties})}async function waitForInscriptionConfirmation(e,t,r=30,o=4e3){const n=Logger$2.getInstance({module:"Inscriber"});try{n.debug("Waiting for inscription confirmation",{transactionId:t,maxAttempts:r,intervalMs:o});const i=await e.waitForInscription(t,r,o,!0);return n.debug("Inscription confirmation received",{transactionId:t}),i}catch(i){throw n.error("Error waiting for inscription confirmation",{transactionId:t,maxAttempts:r,intervalMs:o,error:i}),i}}util2=util||(util={}),util2.assertEqual=e=>e,util2.assertIs=function(e){},util2.assertNever=function(e){throw new Error},util2.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},util2.getValidEnumValues=e=>{const t=util2.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),r={};for(const o of t)r[o]=e[o];return util2.objectValues(r)},util2.objectValues=e=>util2.objectKeys(e).map((function(t){return e[t]})),util2.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},util2.find=(e,t)=>{for(const r of e)if(t(r))return r},util2.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,util2.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},util2.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,objectUtil2=objectUtil||(objectUtil={}),objectUtil2.mergeShapes=(e,t)=>({...e,...t});const ZodParsedType=util.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=e=>{switch(typeof e){case"undefined":return ZodParsedType.undefined;case"string":return ZodParsedType.string;case"number":return isNaN(e)?ZodParsedType.nan:ZodParsedType.number;case"boolean":return ZodParsedType.boolean;case"function":return ZodParsedType.function;case"bigint":return ZodParsedType.bigint;case"symbol":return ZodParsedType.symbol;case"object":return Array.isArray(e)?ZodParsedType.array:null===e?ZodParsedType.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?ZodParsedType.promise:"undefined"!=typeof Map&&e instanceof Map?ZodParsedType.map:"undefined"!=typeof Set&&e instanceof Set?ZodParsedType.set:"undefined"!=typeof Date&&e instanceof Date?ZodParsedType.date:ZodParsedType.object;default:return ZodParsedType.unknown}},ZodIssueCode=util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),quotelessJson=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class ZodError extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},r={_errors:[]},o=e=>{for(const n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(o);else if("invalid_return_type"===n.code)o(n.returnTypeError);else if("invalid_arguments"===n.code)o(n.argumentsError);else if(0===n.path.length)r._errors.push(t(n));else{let e=r,o=0;for(;o<n.path.length;){const r=n.path[o];o===n.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(n))):e[r]=e[r]||{_errors:[]},e=e[r],o++}}};return o(this),r}static assert(e){if(!(e instanceof ZodError))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,util.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];for(const o of this.issues)o.path.length>0?(t[o.path[0]]=t[o.path[0]]||[],t[o.path[0]].push(e(o))):r.push(e(o));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}ZodError.create=e=>new ZodError(e);const errorMap=(e,t)=>{let r;switch(e.code){case ZodIssueCode.invalid_type:r=e.received===ZodParsedType.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,util.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${util.joinValues(e.keys,", ")}`;break;case ZodIssueCode.invalid_union:r="Invalid input";break;case ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${util.joinValues(e.options)}`;break;case ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${util.joinValues(e.options)}, received '${e.received}'`;break;case ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case ZodIssueCode.invalid_date:r="Invalid date";break;case ZodIssueCode.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:util.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ZodIssueCode.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ZodIssueCode.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ZodIssueCode.custom:r="Invalid input";break;case ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ZodIssueCode.not_finite:r="Number must be finite";break;default:r=t.defaultError,util.assertNever(e)}return{message:r}};let overrideErrorMap=errorMap;function setErrorMap(e){overrideErrorMap=e}function getErrorMap(){return overrideErrorMap}const makeIssue=e=>{const{data:t,path:r,errorMaps:o,issueData:n}=e,i=[...r,...n.path||[]],a={...n,path:i};if(void 0!==n.message)return{...n,path:i,message:n.message};let s="";const c=o.filter((e=>!!e)).slice().reverse();for(const u of c)s=u(a,{data:t,defaultError:s}).message;return{...n,path:i,message:s}},EMPTY_PATH=[];function addIssueToContext(e,t){const r=getErrorMap(),o=makeIssue({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===errorMap?void 0:errorMap].filter((e=>!!e))});e.common.issues.push(o)}class ParseStatus{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const o of t){if("aborted"===o.status)return INVALID;"dirty"===o.status&&e.dirty(),r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const o of t){const e=await o.key,t=await o.value;r.push({key:e,value:t})}return ParseStatus.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const o of t){const{key:t,value:n}=o;if("aborted"===t.status)return INVALID;if("aborted"===n.status)return INVALID;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"===t.value||void 0===n.value&&!o.alwaysSet||(r[t.value]=n.value)}return{status:e.value,value:r}}}const INVALID=Object.freeze({status:"aborted"}),DIRTY=e=>({status:"dirty",value:e}),OK=e=>({status:"valid",value:e}),isAborted=e=>"aborted"===e.status,isDirty=e=>"dirty"===e.status,isValid=e=>"valid"===e.status,isAsync=e=>"undefined"!=typeof Promise&&e instanceof Promise;function __classPrivateFieldGet(e,t,r,o){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function __classPrivateFieldSet(e,t,r,o,n){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,r),r}var errorUtil,errorUtil2,_ZodEnum_cache,_ZodNativeEnum_cache;"function"==typeof SuppressedError&&SuppressedError,errorUtil2=errorUtil||(errorUtil={}),errorUtil2.errToObj=e=>"string"==typeof e?{message:e}:e||{},errorUtil2.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class ParseInputLazyPath{constructor(e,t,r,o){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(e,t)=>{if(isValid(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new ZodError(e.common.issues);return this._error=t,this._error}}};function processCreateParams(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:o,description:n}=e;if(t&&(r||o))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:n};return{errorMap:(t,n)=>{var i,a;const{message:s}=e;return"invalid_enum_value"===t.code?{message:null!=s?s:n.defaultError}:void 0===n.data?{message:null!==(i=null!=s?s:o)&&void 0!==i?i:n.defaultError}:"invalid_type"!==t.code?{message:n.defaultError}:{message:null!==(a=null!=s?s:r)&&void 0!==a?a:n.defaultError}},description:n}}class ZodType{get description(){return this._def.description}_getType(e){return getParsedType(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(isAsync(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const o={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},n=this._parseSync({data:e,path:o.path,parent:o});return handleResult(o,n)}"~validate"(e){var t,r;const o={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:o});return isValid(t)?{value:t.value}:{issues:o.common.issues}}catch(n){(null===(r=null===(t=null==n?void 0:n.message)||void 0===t?void 0:t.toLowerCase())||void 0===r?void 0:r.includes("encountered"))&&(this["~standard"].async=!0),o.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:o}).then((e=>isValid(e)?{value:e.value}:{issues:o.common.issues}))}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},o=this._parse({data:e,path:r.path,parent:r}),n=await(isAsync(o)?o:Promise.resolve(o));return handleResult(r,n)}refine(e,t){const r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,o)=>{const n=e(t),i=()=>o.addIssue({code:ZodIssueCode.custom,...r(t)});return"undefined"!=typeof Promise&&n instanceof Promise?n.then((e=>!!e||(i(),!1))):!!n||(i(),!1)}))}refinement(e,t){return this._refinement(((r,o)=>!!e(r)||(o.addIssue("function"==typeof t?t(r,o):t),!1)))}_refinement(e){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this)}promise(){return ZodPromise.create(this,this._def)}or(e){return ZodUnion.create([this,e],this._def)}and(e){return ZodIntersection.create(this,e,this._def)}transform(e){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:t,typeName:ZodFirstPartyTypeKind.ZodDefault})}brand(){return new ZodBranded({typeName:ZodFirstPartyTypeKind.ZodBranded,type:this,...processCreateParams(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:t,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ZodPipeline.create(this,e)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cuidRegex=/^c[^\s-]{8,}$/i,cuid2Regex=/^[0-9a-z]+$/,ulidRegex=/^[0-9A-HJKMNP-TV-Z]{26}$/i,uuidRegex=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nanoidRegex=/^[a-z0-9_-]{21}$/i,jwtRegex=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,durationRegex=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,emailRegex=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_emojiRegex="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let emojiRegex;const ipv4Regex=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4CidrRegex=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6Regex=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ipv6CidrRegex=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64Regex=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64urlRegex=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,dateRegexSource="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",dateRegex=new RegExp(`^${dateRegexSource}$`);function timeRegexSource(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function timeRegex(e){return new RegExp(`^${timeRegexSource(e)}$`)}function datetimeRegex(e){let t=`${dateRegexSource}T${timeRegexSource(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function isValidIP(e,t){return!("v4"!==t&&t||!ipv4Regex.test(e))||!("v6"!==t&&t||!ipv6Regex.test(e))}function isValidJWT(e,t){if(!jwtRegex.test(e))return!1;try{const[r]=e.split("."),o=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(o));return"object"==typeof n&&null!==n&&(!(!n.typ||!n.alg)&&(!t||n.alg===t))}catch(r){return!1}}function isValidCidr(e,t){return!("v4"!==t&&t||!ipv4CidrRegex.test(e))||!("v6"!==t&&t||!ipv6CidrRegex.test(e))}class ZodString extends ZodType{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==ZodParsedType.string){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:t.parsedType}),INVALID}const t=new ParseStatus;let r;for(const n of this._def.checks)if("min"===n.kind)e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("max"===n.kind)e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("length"===n.kind){const o=e.data.length>n.value,i=e.data.length<n.value;(o||i)&&(r=this._getOrReturnCtx(e,r),o?addIssueToContext(r,{code:ZodIssueCode.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&addIssueToContext(r,{code:ZodIssueCode.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if("email"===n.kind)emailRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"email",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty());else if("emoji"===n.kind)emojiRegex||(emojiRegex=new RegExp(_emojiRegex,"u")),emojiRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"emoji",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty());else if("uuid"===n.kind)uuidRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"uuid",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty());else if("nanoid"===n.kind)nanoidRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"nanoid",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty());else if("cuid"===n.kind)cuidRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"cuid",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty());else if("cuid2"===n.kind)cuid2Regex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"cuid2",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty());else if("ulid"===n.kind)ulidRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"ulid",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty());else if("url"===n.kind)try{new URL(e.data)}catch(o){r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"url",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty()}else if("regex"===n.kind){n.regex.lastIndex=0;n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"regex",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty())}else if("trim"===n.kind)e.data=e.data.trim();else if("includes"===n.kind)e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty());else if("toLowerCase"===n.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===n.kind)e.data=e.data.toUpperCase();else if("startsWith"===n.kind)e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty());else if("endsWith"===n.kind)e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty());else if("datetime"===n.kind){datetimeRegex(n).test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:"datetime",message:n.message}),t.dirty())}else if("date"===n.kind){dateRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:"date",message:n.message}),t.dirty())}else if("time"===n.kind){timeRegex(n).test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:"time",message:n.message}),t.dirty())}else"duration"===n.kind?durationRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"duration",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty()):"ip"===n.kind?isValidIP(e.data,n.version)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"ip",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty()):"jwt"===n.kind?isValidJWT(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"jwt",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty()):"cidr"===n.kind?isValidCidr(e.data,n.version)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"cidr",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty()):"base64"===n.kind?base64Regex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"base64",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty()):"base64url"===n.kind?base64urlRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"base64url",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty()):util.assertNever(n);return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement((t=>e.test(t)),{validation:t,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(r)})}_addCheck(e){return new ZodString({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...errorUtil.errToObj(e)})}datetime(e){var t,r;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(r=null==e?void 0:e.local)&&void 0!==r&&r,...errorUtil.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...errorUtil.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...errorUtil.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...errorUtil.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...errorUtil.errToObj(t)})}nonempty(e){return this.min(1,errorUtil.errToObj(e))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function floatSafeRemainder(e,t){const r=(e.toString().split(".")[1]||"").length,o=(t.toString().split(".")[1]||"").length,n=r>o?r:o;return parseInt(e.toFixed(n).replace(".",""))%parseInt(t.toFixed(n).replace(".",""))/Math.pow(10,n)}ZodString.create=e=>{var t;return new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==ZodParsedType.number){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.number,received:t.parsedType}),INVALID}let t;const r=new ParseStatus;for(const o of this._def.checks)if("int"===o.kind)util.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:"integer",received:"float",message:o.message}),r.dirty());else if("min"===o.kind){(o.inclusive?e.data<o.value:e.data<=o.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty())}else if("max"===o.kind){(o.inclusive?e.data>o.value:e.data>=o.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty())}else"multipleOf"===o.kind?0!==floatSafeRemainder(e.data,o.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.not_multiple_of,multipleOf:o.value,message:o.message}),r.dirty()):"finite"===o.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.not_finite,message:o.message}),r.dirty()):util.assertNever(o);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,errorUtil.toString(t))}setLimit(e,t,r,o){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:errorUtil.toString(o)}]})}_addCheck(e){return new ZodNumber({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&util.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ZodNumber.create=e=>new ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(o){return this._getInvalidInput(e)}if(this._getType(e)!==ZodParsedType.bigint)return this._getInvalidInput(e);let t;const r=new ParseStatus;for(const n of this._def.checks)if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty())}else"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):util.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.bigint,received:t.parsedType}),INVALID}gte(e,t){return this.setLimit("min",e,!0,errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,errorUtil.toString(t))}setLimit(e,t,r,o){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:errorUtil.toString(o)}]})}_addCheck(e){return new ZodBigInt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:errorUtil.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ZodBigInt.create=e=>{var t;return new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodBoolean extends ZodType{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==ZodParsedType.boolean){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:t.parsedType}),INVALID}return OK(e.data)}}ZodBoolean.create=e=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodDate extends ZodType{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==ZodParsedType.date){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:t.parsedType}),INVALID}if(isNaN(e.data.getTime())){return addIssueToContext(this._getOrReturnCtx(e),{code:ZodIssueCode.invalid_date}),INVALID}const t=new ParseStatus;let r;for(const o of this._def.checks)"min"===o.kind?e.data.getTime()<o.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),t.dirty()):"max"===o.kind?e.data.getTime()>o.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),t.dirty()):util.assertNever(o);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ZodDate({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:errorUtil.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ZodDate.create=e=>new ZodDate({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(e)});class ZodSymbol extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.symbol){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:t.parsedType}),INVALID}return OK(e.data)}}ZodSymbol.create=e=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(e)});class ZodUndefined extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:t.parsedType}),INVALID}return OK(e.data)}}ZodUndefined.create=e=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(e)});class ZodNull extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.null){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:t.parsedType}),INVALID}return OK(e.data)}}ZodNull.create=e=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(e)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(e){return OK(e.data)}}ZodAny.create=e=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(e)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(e){return OK(e.data)}}ZodUnknown.create=e=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(e)});class ZodNever extends ZodType{_parse(e){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:t.parsedType}),INVALID}}ZodNever.create=e=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(e)});class ZodVoid extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:t.parsedType}),INVALID}return OK(e.data)}}ZodVoid.create=e=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(e)});class ZodArray extends ZodType{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),o=this._def;if(t.parsedType!==ZodParsedType.array)return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:t.parsedType}),INVALID;if(null!==o.exactLength){const e=t.data.length>o.exactLength.value,n=t.data.length<o.exactLength.value;(e||n)&&(addIssueToContext(t,{code:e?ZodIssueCode.too_big:ZodIssueCode.too_small,minimum:n?o.exactLength.value:void 0,maximum:e?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(null!==o.minLength&&t.data.length<o.minLength.value&&(addIssueToContext(t,{code:ZodIssueCode.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),null!==o.maxLength&&t.data.length>o.maxLength.value&&(addIssueToContext(t,{code:ZodIssueCode.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map(((e,r)=>o.type._parseAsync(new ParseInputLazyPath(t,e,t.path,r))))).then((e=>ParseStatus.mergeArray(r,e)));const n=[...t.data].map(((e,r)=>o.type._parseSync(new ParseInputLazyPath(t,e,t.path,r))));return ParseStatus.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new ZodArray({...this._def,minLength:{value:e,message:errorUtil.toString(t)}})}max(e,t){return new ZodArray({...this._def,maxLength:{value:e,message:errorUtil.toString(t)}})}length(e,t){return new ZodArray({...this._def,exactLength:{value:e,message:errorUtil.toString(t)}})}nonempty(e){return this.min(1,e)}}function deepPartialify(e){if(e instanceof ZodObject){const t={};for(const r in e.shape){const o=e.shape[r];t[r]=ZodOptional.create(deepPartialify(o))}return new ZodObject({...e._def,shape:()=>t})}return e instanceof ZodArray?new ZodArray({...e._def,type:deepPartialify(e.element)}):e instanceof ZodOptional?ZodOptional.create(deepPartialify(e.unwrap())):e instanceof ZodNullable?ZodNullable.create(deepPartialify(e.unwrap())):e instanceof ZodTuple?ZodTuple.create(e.items.map((e=>deepPartialify(e)))):e}ZodArray.create=(e,t)=>new ZodArray({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(t)});class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=util.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==ZodParsedType.object){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:t.parsedType}),INVALID}const{status:t,ctx:r}=this._processInputParams(e),{shape:o,keys:n}=this._getCached(),i=[];if(!(this._def.catchall instanceof ZodNever&&"strip"===this._def.unknownKeys))for(const s in r.data)n.includes(s)||i.push(s);const a=[];for(const s of n){const e=o[s],t=r.data[s];a.push({key:{status:"valid",value:s},value:e._parse(new ParseInputLazyPath(r,t,r.path,s)),alwaysSet:s in r.data})}if(this._def.catchall instanceof ZodNever){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of i)a.push({key:{status:"valid",value:t},value:{status:"valid",value:r.data[t]}});else if("strict"===e)i.length>0&&(addIssueToContext(r,{code:ZodIssueCode.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const o=r.data[t];a.push({key:{status:"valid",value:t},value:e._parse(new ParseInputLazyPath(r,o,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of a){const r=await t.key,o=await t.value;e.push({key:r,value:o,alwaysSet:t.alwaysSet})}return e})).then((e=>ParseStatus.mergeObjectSync(t,e))):ParseStatus.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return errorUtil.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var o,n,i,a;const s=null!==(i=null===(n=(o=this._def).errorMap)||void 0===n?void 0:n.call(o,t,r).message)&&void 0!==i?i:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(a=errorUtil.errToObj(e).message)&&void 0!==a?a:s}:{message:s}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(e){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ZodObject({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ZodObject({...this._def,catchall:e})}pick(e){const t={};return util.objectKeys(e).forEach((r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])})),new ZodObject({...this._def,shape:()=>t})}omit(e){const t={};return util.objectKeys(this.shape).forEach((r=>{e[r]||(t[r]=this.shape[r])})),new ZodObject({...this._def,shape:()=>t})}deepPartial(){return deepPartialify(this)}partial(e){const t={};return util.objectKeys(this.shape).forEach((r=>{const o=this.shape[r];e&&!e[r]?t[r]=o:t[r]=o.optional()})),new ZodObject({...this._def,shape:()=>t})}required(e){const t={};return util.objectKeys(this.shape).forEach((r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof ZodOptional;)e=e._def.innerType;t[r]=e}})),new ZodObject({...this._def,shape:()=>t})}keyof(){return createZodEnum(util.objectKeys(this.shape))}}ZodObject.create=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(t)}),ZodObject.strictCreate=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strict",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(t)}),ZodObject.lazycreate=(e,t)=>new ZodObject({shape:e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(t)});class ZodUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map((async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const o of e)if("dirty"===o.result.status)return t.common.issues.push(...o.ctx.common.issues),o.result;const r=e.map((e=>new ZodError(e.ctx.common.issues)));return addIssueToContext(t,{code:ZodIssueCode.invalid_union,unionErrors:r}),INVALID}));{let e;const o=[];for(const i of r){const r={...t,common:{...t.common,issues:[]},parent:null},n=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===n.status)return n;"dirty"!==n.status||e||(e={result:n,ctx:r}),r.common.issues.length&&o.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const n=o.map((e=>new ZodError(e)));return addIssueToContext(t,{code:ZodIssueCode.invalid_union,unionErrors:n}),INVALID}}get options(){return this._def.options}}ZodUnion.create=(e,t)=>new ZodUnion({options:e,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(t)});const getDiscriminator=e=>e instanceof ZodLazy?getDiscriminator(e.schema):e instanceof ZodEffects?getDiscriminator(e.innerType()):e instanceof ZodLiteral?[e.value]:e instanceof ZodEnum?e.options:e instanceof ZodNativeEnum?util.objectValues(e.enum):e instanceof ZodDefault?getDiscriminator(e._def.innerType):e instanceof ZodUndefined?[void 0]:e instanceof ZodNull?[null]:e instanceof ZodOptional?[void 0,...getDiscriminator(e.unwrap())]:e instanceof ZodNullable?[null,...getDiscriminator(e.unwrap())]:e instanceof ZodBranded||e instanceof ZodReadonly?getDiscriminator(e.unwrap()):e instanceof ZodCatch?getDiscriminator(e._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ZodParsedType.object)return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:t.parsedType}),INVALID;const r=this.discriminator,o=t.data[r],n=this.optionsMap.get(o);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(addIssueToContext(t,{code:ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const o=new Map;for(const n of t){const t=getDiscriminator(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const r of t){if(o.has(r))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(r)}`);o.set(r,n)}}return new ZodDiscriminatedUnion({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:o,...processCreateParams(r)})}}function mergeValues(e,t){const r=getParsedType(e),o=getParsedType(t);if(e===t)return{valid:!0,data:e};if(r===ZodParsedType.object&&o===ZodParsedType.object){const r=util.objectKeys(t),o=util.objectKeys(e).filter((e=>-1!==r.indexOf(e))),n={...e,...t};for(const i of o){const r=mergeValues(e[i],t[i]);if(!r.valid)return{valid:!1};n[i]=r.data}return{valid:!0,data:n}}if(r===ZodParsedType.array&&o===ZodParsedType.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let o=0;o<e.length;o++){const n=mergeValues(e[o],t[o]);if(!n.valid)return{valid:!1};r.push(n.data)}return{valid:!0,data:r}}return r===ZodParsedType.date&&o===ZodParsedType.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class ZodIntersection extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),o=(e,o)=>{if(isAborted(e)||isAborted(o))return INVALID;const n=mergeValues(e.value,o.value);return n.valid?((isDirty(e)||isDirty(o))&&t.dirty(),{status:t.value,value:n.data}):(addIssueToContext(r,{code:ZodIssueCode.invalid_intersection_types}),INVALID)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>o(e,t))):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ZodIntersection.create=(e,t,r)=>new ZodIntersection({left:e,right:t,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams(r)});class ZodTuple extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ZodParsedType.array)return addIssueToContext(r,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:r.parsedType}),INVALID;if(r.data.length<this._def.items.length)return addIssueToContext(r,{code:ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),INVALID;!this._def.rest&&r.data.length>this._def.items.length&&(addIssueToContext(r,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const o=[...r.data].map(((e,t)=>{const o=this._def.items[t]||this._def.rest;return o?o._parse(new ParseInputLazyPath(r,e,r.path,t)):null})).filter((e=>!!e));return r.common.async?Promise.all(o).then((e=>ParseStatus.mergeArray(t,e))):ParseStatus.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new ZodTuple({...this._def,rest:e})}}ZodTuple.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:e,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(t)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ZodParsedType.object)return addIssueToContext(r,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:r.parsedType}),INVALID;const o=[],n=this._def.keyType,i=this._def.valueType;for(const a in r.data)o.push({key:n._parse(new ParseInputLazyPath(r,a,r.path,a)),value:i._parse(new ParseInputLazyPath(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?ParseStatus.mergeObjectAsync(t,o):ParseStatus.mergeObjectSync(t,o)}get element(){return this._def.valueType}static create(e,t,r){return new ZodRecord(t instanceof ZodType?{keyType:e,valueType:t,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(r)}:{keyType:ZodString.create(),valueType:e,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(t)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ZodParsedType.map)return addIssueToContext(r,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:r.parsedType}),INVALID;const o=this._def.keyType,n=this._def.valueType,i=[...r.data.entries()].map((([e,t],i)=>({key:o._parse(new ParseInputLazyPath(r,e,r.path,[i,"key"])),value:n._parse(new ParseInputLazyPath(r,t,r.path,[i,"value"]))})));if(r.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const r of i){const o=await r.key,n=await r.value;if("aborted"===o.status||"aborted"===n.status)return INVALID;"dirty"!==o.status&&"dirty"!==n.status||t.dirty(),e.set(o.value,n.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const r of i){const o=r.key,n=r.value;if("aborted"===o.status||"aborted"===n.status)return INVALID;"dirty"!==o.status&&"dirty"!==n.status||t.dirty(),e.set(o.value,n.value)}return{status:t.value,value:e}}}}ZodMap.create=(e,t,r)=>new ZodMap({valueType:t,keyType:e,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams(r)});class ZodSet extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ZodParsedType.set)return addIssueToContext(r,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:r.parsedType}),INVALID;const o=this._def;null!==o.minSize&&r.data.size<o.minSize.value&&(addIssueToContext(r,{code:ZodIssueCode.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),t.dirty()),null!==o.maxSize&&r.data.size>o.maxSize.value&&(addIssueToContext(r,{code:ZodIssueCode.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),t.dirty());const n=this._def.valueType;function i(e){const r=new Set;for(const o of e){if("aborted"===o.status)return INVALID;"dirty"===o.status&&t.dirty(),r.add(o.value)}return{status:t.value,value:r}}const a=[...r.data.values()].map(((e,t)=>n._parse(new ParseInputLazyPath(r,e,r.path,t))));return r.common.async?Promise.all(a).then((e=>i(e))):i(a)}min(e,t){return new ZodSet({...this._def,minSize:{value:e,message:errorUtil.toString(t)}})}max(e,t){return new ZodSet({...this._def,maxSize:{value:e,message:errorUtil.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ZodSet.create=(e,t)=>new ZodSet({valueType:e,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(t)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ZodParsedType.function)return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.function,received:t.parsedType}),INVALID;function r(e,r){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:ZodIssueCode.invalid_arguments,argumentsError:r}})}function o(e,r){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:ZodIssueCode.invalid_return_type,returnTypeError:r}})}const n={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof ZodPromise){const e=this;return OK((async function(...t){const a=new ZodError([]),s=await e._def.args.parseAsync(t,n).catch((e=>{throw a.addIssue(r(t,e)),a})),c=await Reflect.apply(i,this,s);return await e._def.returns._def.type.parseAsync(c,n).catch((e=>{throw a.addIssue(o(c,e)),a}))}))}{const e=this;return OK((function(...t){const a=e._def.args.safeParse(t,n);if(!a.success)throw new ZodError([r(t,a.error)]);const s=Reflect.apply(i,this,a.data),c=e._def.returns.safeParse(s,n);if(!c.success)throw new ZodError([o(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ZodFunction({...this._def,args:ZodTuple.create(e).rest(ZodUnknown.create())})}returns(e){return new ZodFunction({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new ZodFunction({args:e||ZodTuple.create([]).rest(ZodUnknown.create()),returns:t||ZodUnknown.create(),typeName:ZodFirstPartyTypeKind.ZodFunction,...processCreateParams(r)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ZodLazy.create=(e,t)=>new ZodLazy({getter:e,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(t)});class ZodLiteral extends ZodType{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{received:t.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}}function createZodEnum(e,t){return new ZodEnum({values:e,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(t)})}ZodLiteral.create=(e,t)=>new ZodLiteral({value:e,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(t)});class ZodEnum extends ZodType{constructor(){super(...arguments),_ZodEnum_cache.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return addIssueToContext(t,{expected:util.joinValues(r),received:t.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(__classPrivateFieldGet(this,_ZodEnum_cache)||__classPrivateFieldSet(this,_ZodEnum_cache,new Set(this._def.values)),!__classPrivateFieldGet(this,_ZodEnum_cache).has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return addIssueToContext(t,{received:t.data,code:ZodIssueCode.invalid_enum_value,options:r}),INVALID}return OK(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ZodEnum.create(e,{...this._def,...t})}exclude(e,t=this._def){return ZodEnum.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}_ZodEnum_cache=new WeakMap,ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),_ZodNativeEnum_cache.set(this,void 0)}_parse(e){const t=util.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==ZodParsedType.string&&r.parsedType!==ZodParsedType.number){const e=util.objectValues(t);return addIssueToContext(r,{expected:util.joinValues(e),received:r.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(__classPrivateFieldGet(this,_ZodNativeEnum_cache)||__classPrivateFieldSet(this,_ZodNativeEnum_cache,new Set(util.getValidEnumValues(this._def.values))),!__classPrivateFieldGet(this,_ZodNativeEnum_cache).has(e.data)){const e=util.objectValues(t);return addIssueToContext(r,{received:r.data,code:ZodIssueCode.invalid_enum_value,options:e}),INVALID}return OK(e.data)}get enum(){return this._def.values}}_ZodNativeEnum_cache=new WeakMap,ZodNativeEnum.create=(e,t)=>new ZodNativeEnum({values:e,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(t)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ZodParsedType.promise&&!1===t.common.async)return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.promise,received:t.parsedType}),INVALID;const r=t.parsedType===ZodParsedType.promise?t.data:Promise.resolve(t.data);return OK(r.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}ZodPromise.create=(e,t)=>new ZodPromise({type:e,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(t)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ZodFirstPartyTypeKind.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),o=this._def.effect||null,n={addIssue:e=>{addIssueToContext(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),"preprocess"===o.type){const e=o.transform(r.data,n);if(r.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return INVALID;const o=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===o.status?INVALID:"dirty"===o.status||"dirty"===t.value?DIRTY(o.value):o}));{if("aborted"===t.value)return INVALID;const o=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===o.status?INVALID:"dirty"===o.status||"dirty"===t.value?DIRTY(o.value):o}}if("refinement"===o.type){const e=e=>{const t=o.refinement(e,n);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===o.status?INVALID:("dirty"===o.status&&t.dirty(),e(o.value),{status:t.value,value:o.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((r=>"aborted"===r.status?INVALID:("dirty"===r.status&&t.dirty(),e(r.value).then((()=>({status:t.value,value:r.value}))))))}if("transform"===o.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!isValid(e))return e;const i=o.transform(e.value,n);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>isValid(e)?Promise.resolve(o.transform(e.value,n)).then((e=>({status:t.value,value:e}))):e))}util.assertNever(o)}}ZodEffects.create=(e,t,r)=>new ZodEffects({schema:e,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:t,...processCreateParams(r)}),ZodEffects.createWithPreprocess=(e,t,r)=>new ZodEffects({schema:t,effect:{type:"preprocess",transform:e},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams(r)});class ZodOptional extends ZodType{_parse(e){return this._getType(e)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodOptional.create=(e,t)=>new ZodOptional({innerType:e,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(t)});class ZodNullable extends ZodType{_parse(e){return this._getType(e)===ZodParsedType.null?OK(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodNullable.create=(e,t)=>new ZodNullable({innerType:e,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(t)});class ZodDefault extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===ZodParsedType.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ZodDefault.create=(e,t)=>new ZodDefault({innerType:e,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...processCreateParams(t)});class ZodCatch extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return isAsync(o)?o.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new ZodError(r.common.issues)},input:r.data})}))):{status:"valid",value:"valid"===o.status?o.value:this._def.catchValue({get error(){return new ZodError(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(e,t)=>new ZodCatch({innerType:e,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...processCreateParams(t)});class ZodNaN extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.nan){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:t.parsedType}),INVALID}return{status:"valid",value:e.data}}}ZodNaN.create=e=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(e)});const BRAND=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?INVALID:"dirty"===e.status?(t.dirty(),DIRTY(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})()}{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?INVALID:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new ZodPipeline({in:e,out:t,typeName:ZodFirstPartyTypeKind.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(e){const t=this._def.innerType._parse(e),r=e=>(isValid(e)&&(e.value=Object.freeze(e.value)),e);return isAsync(t)?t.then((e=>r(e))):r(t)}unwrap(){return this._def.innerType}}function cleanParams(e,t){const r="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof r?{message:r}:r}function custom(e,t={},r){return e?ZodAny.create().superRefine(((o,n)=>{var i,a;const s=e(o);if(s instanceof Promise)return s.then((e=>{var i,a;if(!e){const e=cleanParams(t,o),s=null===(a=null!==(i=e.fatal)&&void 0!==i?i:r)||void 0===a||a;n.addIssue({code:"custom",...e,fatal:s})}}));if(!s){const e=cleanParams(t,o),s=null===(a=null!==(i=e.fatal)&&void 0!==i?i:r)||void 0===a||a;n.addIssue({code:"custom",...e,fatal:s})}})):ZodAny.create()}ZodReadonly.create=(e,t)=>new ZodReadonly({innerType:e,typeName:ZodFirstPartyTypeKind.ZodReadonly,...processCreateParams(t)});const late={object:ZodObject.lazycreate};var ZodFirstPartyTypeKind,ZodFirstPartyTypeKind2;ZodFirstPartyTypeKind2=ZodFirstPartyTypeKind||(ZodFirstPartyTypeKind={}),ZodFirstPartyTypeKind2.ZodString="ZodString",ZodFirstPartyTypeKind2.ZodNumber="ZodNumber",ZodFirstPartyTypeKind2.ZodNaN="ZodNaN",ZodFirstPartyTypeKind2.ZodBigInt="ZodBigInt",ZodFirstPartyTypeKind2.ZodBoolean="ZodBoolean",ZodFirstPartyTypeKind2.ZodDate="ZodDate",ZodFirstPartyTypeKind2.ZodSymbol="ZodSymbol",ZodFirstPartyTypeKind2.ZodUndefined="ZodUndefined",ZodFirstPartyTypeKind2.ZodNull="ZodNull",ZodFirstPartyTypeKind2.ZodAny="ZodAny",ZodFirstPartyTypeKind2.ZodUnknown="ZodUnknown",ZodFirstPartyTypeKind2.ZodNever="ZodNever",ZodFirstPartyTypeKind2.ZodVoid="ZodVoid",ZodFirstPartyTypeKind2.ZodArray="ZodArray",ZodFirstPartyTypeKind2.ZodObject="ZodObject",ZodFirstPartyTypeKind2.ZodUnion="ZodUnion",ZodFirstPartyTypeKind2.ZodDiscriminatedUnion="ZodDiscriminatedUnion",ZodFirstPartyTypeKind2.ZodIntersection="ZodIntersection",ZodFirstPartyTypeKind2.ZodTuple="ZodTuple",ZodFirstPartyTypeKind2.ZodRecord="ZodRecord",ZodFirstPartyTypeKind2.ZodMap="ZodMap",ZodFirstPartyTypeKind2.ZodSet="ZodSet",ZodFirstPartyTypeKind2.ZodFunction="ZodFunction",ZodFirstPartyTypeKind2.ZodLazy="ZodLazy",ZodFirstPartyTypeKind2.ZodLiteral="ZodLiteral",ZodFirstPartyTypeKind2.ZodEnum="ZodEnum",ZodFirstPartyTypeKind2.ZodEffects="ZodEffects",ZodFirstPartyTypeKind2.ZodNativeEnum="ZodNativeEnum",ZodFirstPartyTypeKind2.ZodOptional="ZodOptional",ZodFirstPartyTypeKind2.ZodNullable="ZodNullable",ZodFirstPartyTypeKind2.ZodDefault="ZodDefault",ZodFirstPartyTypeKind2.ZodCatch="ZodCatch",ZodFirstPartyTypeKind2.ZodPromise="ZodPromise",ZodFirstPartyTypeKind2.ZodBranded="ZodBranded",ZodFirstPartyTypeKind2.ZodPipeline="ZodPipeline",ZodFirstPartyTypeKind2.ZodReadonly="ZodReadonly";const instanceOfType=(e,t={message:`Input not instance of ${e.name}`})=>custom((t=>t instanceof e),t),stringType=ZodString.create,numberType=ZodNumber.create,nanType=ZodNaN.create,bigIntType=ZodBigInt.create,booleanType=ZodBoolean.create,dateType=ZodDate.create,symbolType=ZodSymbol.create,undefinedType=ZodUndefined.create,nullType=ZodNull.create,anyType=ZodAny.create,unknownType=ZodUnknown.create,neverType=ZodNever.create,voidType=ZodVoid.create,arrayType=ZodArray.create,objectType=ZodObject.create,strictObjectType=ZodObject.strictCreate,unionType=ZodUnion.create,discriminatedUnionType=ZodDiscriminatedUnion.create,intersectionType=ZodIntersection.create,tupleType=ZodTuple.create,recordType=ZodRecord.create,mapType=ZodMap.create,setType=ZodSet.create,functionType=ZodFunction.create,lazyType=ZodLazy.create,literalType=ZodLiteral.create,enumType=ZodEnum.create,nativeEnumType=ZodNativeEnum.create,promiseType=ZodPromise.create,effectsType=ZodEffects.create,optionalType=ZodOptional.create,nullableType=ZodNullable.create,preprocessType=ZodEffects.createWithPreprocess,pipelineType=ZodPipeline.create,ostring=()=>stringType().optional(),onumber=()=>numberType().optional(),oboolean=()=>booleanType().optional(),coerce={string:e=>ZodString.create({...e,coerce:!0}),number:e=>ZodNumber.create({...e,coerce:!0}),boolean:e=>ZodBoolean.create({...e,coerce:!0}),bigint:e=>ZodBigInt.create({...e,coerce:!0}),date:e=>ZodDate.create({...e,coerce:!0})},NEVER=INVALID;var z=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap:setErrorMap,getErrorMap:getErrorMap,makeIssue:makeIssue,EMPTY_PATH:EMPTY_PATH,addIssueToContext:addIssueToContext,ParseStatus:ParseStatus,INVALID:INVALID,DIRTY:DIRTY,OK:OK,isAborted:isAborted,isDirty:isDirty,isValid:isValid,isAsync:isAsync,get util(){return util},get objectUtil(){return objectUtil},ZodParsedType:ZodParsedType,getParsedType:getParsedType,ZodType:ZodType,datetimeRegex:datetimeRegex,ZodString:ZodString,ZodNumber:ZodNumber,ZodBigInt:ZodBigInt,ZodBoolean:ZodBoolean,ZodDate:ZodDate,ZodSymbol:ZodSymbol,ZodUndefined:ZodUndefined,ZodNull:ZodNull,ZodAny:ZodAny,ZodUnknown:ZodUnknown,ZodNever:ZodNever,ZodVoid:ZodVoid,ZodArray:ZodArray,ZodObject:ZodObject,ZodUnion:ZodUnion,ZodDiscriminatedUnion:ZodDiscriminatedUnion,ZodIntersection:ZodIntersection,ZodTuple:ZodTuple,ZodRecord:ZodRecord,ZodMap:ZodMap,ZodSet:ZodSet,ZodFunction:ZodFunction,ZodLazy:ZodLazy,ZodLiteral:ZodLiteral,ZodEnum:ZodEnum,ZodNativeEnum:ZodNativeEnum,ZodPromise:ZodPromise,ZodEffects:ZodEffects,ZodTransformer:ZodEffects,ZodOptional:ZodOptional,ZodNullable:ZodNullable,ZodDefault:ZodDefault,ZodCatch:ZodCatch,ZodNaN:ZodNaN,BRAND:BRAND,ZodBranded:ZodBranded,ZodPipeline:ZodPipeline,ZodReadonly:ZodReadonly,custom:custom,Schema:ZodType,ZodSchema:ZodType,late:late,get ZodFirstPartyTypeKind(){return ZodFirstPartyTypeKind},coerce:coerce,any:anyType,array:arrayType,bigint:bigIntType,boolean:booleanType,date:dateType,discriminatedUnion:discriminatedUnionType,effect:effectsType,enum:enumType,function:functionType,instanceof:instanceOfType,intersection:intersectionType,lazy:lazyType,literal:literalType,map:mapType,nan:nanType,nativeEnum:nativeEnumType,never:neverType,null:nullType,nullable:nullableType,number:numberType,object:objectType,oboolean:oboolean,onumber:onumber,optional:optionalType,ostring:ostring,pipeline:pipelineType,preprocess:preprocessType,promise:promiseType,record:recordType,set:setType,strictObject:strictObjectType,string:stringType,symbol:symbolType,transformer:effectsType,tuple:tupleType,undefined:undefinedType,union:unionType,unknown:unknownType,void:voidType,NEVER:NEVER,ZodIssueCode:ZodIssueCode,quotelessJson:quotelessJson,ZodError:ZodError}),ProfileType=(e=>(e[e.PERSONAL=0]="PERSONAL",e[e.AI_AGENT=1]="AI_AGENT",e))(ProfileType||{}),AIAgentType=(e=>(e[e.MANUAL=0]="MANUAL",e[e.AUTONOMOUS=1]="AUTONOMOUS",e))(AIAgentType||{}),EndpointType=(e=>(e[e.REST=0]="REST",e[e.WEBSOCKET=1]="WEBSOCKET",e[e.GRPC=2]="GRPC",e))(EndpointType||{}),AIAgentCapability=(e=>(e[e.TEXT_GENERATION=0]="TEXT_GENERATION",e[e.IMAGE_GENERATION=1]="IMAGE_GENERATION",e[e.AUDIO_GENERATION=2]="AUDIO_GENERATION",e[e.VIDEO_GENERATION=3]="VIDEO_GENERATION",e[e.CODE_GENERATION=4]="CODE_GENERATION",e[e.LANGUAGE_TRANSLATION=5]="LANGUAGE_TRANSLATION",e[e.SUMMARIZATION_EXTRACTION=6]="SUMMARIZATION_EXTRACTION",e[e.KNOWLEDGE_RETRIEVAL=7]="KNOWLEDGE_RETRIEVAL",e[e.DATA_INTEGRATION=8]="DATA_INTEGRATION",e[e.MARKET_INTELLIGENCE=9]="MARKET_INTELLIGENCE",e[e.TRANSACTION_ANALYTICS=10]="TRANSACTION_ANALYTICS",e[e.SMART_CONTRACT_AUDIT=11]="SMART_CONTRACT_AUDIT",e[e.GOVERNANCE_FACILITATION=12]="GOVERNANCE_FACILITATION",e[e.SECURITY_MONITORING=13]="SECURITY_MONITORING",e[e.COMPLIANCE_ANALYSIS=14]="COMPLIANCE_ANALYSIS",e[e.FRAUD_DETECTION=15]="FRAUD_DETECTION",e[e.MULTI_AGENT_COORDINATION=16]="MULTI_AGENT_COORDINATION",e[e.API_INTEGRATION=17]="API_INTEGRATION",e[e.WORKFLOW_AUTOMATION=18]="WORKFLOW_AUTOMATION",e))(AIAgentCapability||{});const SUPPORTED_SOCIAL_PLATFORMS=["twitter","github","discord","telegram","linkedin","youtube"],SocialLinkSchema=z.object({platform:z.string().min(1),handle:z.string().min(1)}),AIAgentDetailsSchema=z.object({type:z.nativeEnum(AIAgentType),capabilities:z.array(z.nativeEnum(AIAgentCapability)).min(1),model:z.string().min(1),creator:z.string().optional()}),BaseProfileSchema=z.object({version:z.string().min(1),type:z.nativeEnum(ProfileType),display_name:z.string().min(1),alias:z.string().optional(),bio:z.string().optional(),socials:z.array(SocialLinkSchema).optional(),profileImage:z.string().optional(),properties:z.record(z.any()).optional(),inboundTopicId:z.string().optional(),outboundTopicId:z.string().optional()}),PersonalProfileSchema=BaseProfileSchema.extend({type:z.literal(0),language:z.string().optional(),timezone:z.string().optional()}),AIAgentProfileSchema=BaseProfileSchema.extend({type:z.literal(1),aiAgent:AIAgentDetailsSchema}),HCS11ProfileSchema=z.union([PersonalProfileSchema,AIAgentProfileSchema]),capabilityNameToCapabilityMap={text_generation:0,image_generation:1,audio_generation:2,video_generation:3,code_generation:4,language_translation:5,summarization:6,extraction:6,knowledge_retrieval:7,data_integration:8,data_visualization:8,market_intelligence:9,transaction_analytics:10,smart_contract_audit:11,governance:12,security_monitoring:13,compliance_analysis:14,fraud_detection:15,multi_agent:16,api_integration:17,workflow_automation:18};class HCS11Client{constructor(e){if(this.client="mainnet"===e.network?i$1.forMainnet():i$1.forTestnet(),this.auth=e.auth,this.network=e.network,this.auth.privateKey){const e=y$2.fromString(this.auth.privateKey);this.client.setOperator(this.auth.operatorId,e)}this.logger=Logger$2.getInstance({level:e.logLevel||"info",module:"HCS-11"})}getClient(){return this.client}getOperatorId(){return this.auth.operatorId}createPersonalProfile(e,t){return{version:"1.0",type:0,display_name:e,alias:null==t?void 0:t.alias,bio:null==t?void 0:t.bio,socials:null==t?void 0:t.socials,profileImage:null==t?void 0:t.profileImage,language:null==t?void 0:t.language,timezone:null==t?void 0:t.timezone,properties:null==t?void 0:t.properties,inboundTopicId:null==t?void 0:t.inboundTopicId,outboundTopicId:null==t?void 0:t.outboundTopicId}}createAIAgentProfile(e,t,r,o,n){const i=this.validateProfile({version:"1.0",type:1,display_name:e,alias:null==n?void 0:n.alias,bio:null==n?void 0:n.bio,socials:null==n?void 0:n.socials,profileImage:null==n?void 0:n.profileImage,properties:null==n?void 0:n.properties,inboundTopicId:null==n?void 0:n.inboundTopicId,outboundTopicId:null==n?void 0:n.outboundTopicId,aiAgent:{type:t,capabilities:r,model:o,creator:null==n?void 0:n.creator}});if(!i.valid)throw new Error(`Invalid AI Agent Profile: ${i.errors.join(", ")}`);return{version:"1.0",type:1,display_name:e,alias:null==n?void 0:n.alias,bio:null==n?void 0:n.bio,socials:null==n?void 0:n.socials,profileImage:null==n?void 0:n.profileImage,properties:null==n?void 0:n.properties,inboundTopicId:null==n?void 0:n.inboundTopicId,outboundTopicId:null==n?void 0:n.outboundTopicId,aiAgent:{type:t,capabilities:r,model:o,creator:null==n?void 0:n.creator}}}validateProfile(e){const t=HCS11ProfileSchema.safeParse(e);if(t.success)return{valid:!0,errors:[]};return{valid:!1,errors:t.error.errors.map((e=>{var t;const r=e.path.join(".");let o=e.message;if("invalid_type"===e.code)o=`Expected ${e.expected}, got ${e.received}`;else if("invalid_enum_value"===e.code){o=`Invalid value. Valid options are: ${null==(t=e.options)?void 0:t.join(", ")}`}else"too_small"===e.code&&"string"===e.type&&(o="Cannot be empty");return`${r}: ${o}`}))}}profileToJSONString(e){return JSON.stringify(e)}parseProfileFromString(e){try{const t=JSON.parse(e),r=this.validateProfile(t);return r.valid?t:(this.logger.error("Invalid profile format:",r.errors),null)}catch(t){return this.logger.error("Error parsing profile:",t),null}}setProfileForAccountMemo(e,t=1){return`hcs-11:hcs://${t}/${e}`}async executeTransaction(e){try{if(this.auth.privateKey){const t=await e.signWithOperator(this.client),r=await t.execute(this.client),o=await r.getReceipt(this.client);return o.status!==e$6.Success?{success:!1,error:`Transaction failed: ${o.status.toString()}`}:{success:!0,result:o}}if(!this.auth.signer)throw new Error("No valid authentication method provided");const t=this.auth.signer,r=await e.signWithSigner(t),o=await r.freezeWithSigner(t),n=await o.executeWithSigner(t),i=await n.getReceiptWithSigner(t);return i.status!==e$6.Success?{success:!1,error:`Transaction failed: ${i.status.toString()}`}:{success:!0,result:i}}catch(t){return{success:!1,error:t instanceof Error?t.message:"Unknown error during transaction execution"}}}async inscribeContent(e,t,r,o=!1){try{const n="string"==typeof e?Buffer.from(e,"utf-8"):e,i={type:"buffer",buffer:n,fileName:t,mimeType:r||mimeTypes.lookup(t)||"application/octet-stream"},a={waitForConfirmation:!0,mode:"file",network:this.network,maxRetries:100,waitMaxAttempts:100},s=this.auth.privateKey?await inscribe(i,{accountId:this.auth.operatorId,privateKey:this.auth.privateKey,network:this.network},a):await inscribeWithSigner(i,this.auth.signer,a);if(!s.confirmed||!s.inscription.topic_id)return{profileTopicId:"",transactionId:"",success:!1,error:"Failed to inscribe content",...o?{imageTopicId:""}:{}};const c=s.inscription.topic_id;return{...o?{imageTopicId:c}:{profileTopicId:c},transactionId:s.result.transactionId,success:!0}}catch(n){return{profileTopicId:"",transactionId:"",success:!1,error:n instanceof Error?n.message:"Unknown error during inscription",...o?{imageTopicId:""}:{}}}}async inscribeImage(e,t){return this.logger.info("Inscribing image"),this.inscribeContent(e,t,void 0,!0)}async inscribeProfile(e){this.logger.info("Inscribing HCS-11 profile");const t=this.validateProfile(e);if(!t.valid)return{profileTopicId:"",transactionId:"",success:!1,error:`Invalid profile: ${t.errors.join(", ")}`};const r=this.profileToJSONString(e),o=`profile-${e.display_name.toLowerCase().replace(/\s+/g,"-")}.json`;return this.inscribeContent(r,o,"application/json",!1)}async updateAccountMemoWithProfile(e,t){try{this.logger.info(`Updating account memo for ${e} with profile ${t}`);const r=this.setProfileForAccountMemo(t),o=(new s$4).setAccountMemo(r).setAccountId(e);return this.executeTransaction(o)}catch(r){return this.logger.error(`Error updating account memo: ${r instanceof Error?r.message:"Unknown error"}`),{success:!1,error:r instanceof Error?r.message:"Unknown error updating account memo"}}}async createAndInscribeProfile(e,t=!0){const r=await this.inscribeProfile(e);if(!r.success)return r;if(t){const e=await this.updateAccountMemoWithProfile(this.auth.operatorId,r.profileTopicId);if(!e.success)return{...r,success:!1,error:e.error}}return r}async getCapabilitiesFromTags(e){const t=[];if(0===e.length)return[0];for(const r of e){const e=capabilityNameToCapabilityMap[r.toLowerCase()];void 0===e||t.includes(e)||t.push(e)}return 0===t.length&&t.push(0),t}getAgentTypeFromMetadata(e){return"autonomous"===e.type?1:0}}async function accountIdsToExemptKeys(e,t,r){const o=new HederaMirrorNode(t,r),n=[];for(const a of e)try{const e=await o.getPublicKey(a);n.push(e)}catch(i){r&&r.warn(`Could not get public key for account ${a}: ${i}`)}return n}class FeeConfigBuilder{constructor(){this.feeAmount=0,this.decimals=0,this.feeCollectorAccountId="",this.exemptAccountIds=[]}static forHbar(e,t,r=[]){return(new FeeConfigBuilder).setHbarAmount(e).setFeeCollector(t).addExemptAccounts(r)}setHbarAmount(e){if(e<=0)throw new Error("HBAR amount must be greater than zero");return this.feeAmount=1e8*e,this.decimals=0,this}setFeeAmount(e,t=0){return this.feeAmount=e,this.decimals=t,this}setFeeCollector(e){return this.feeCollectorAccountId=e,this}addExemptAccount(e){return this.exemptAccountIds.includes(e)||this.exemptAccountIds.push(e),this}addExemptAccounts(e){for(const t of e)this.addExemptAccount(t);return this}build(){if(!this.feeCollectorAccountId)throw new Error("Fee collector account ID is required");if(this.feeAmount<=0)throw new Error("Fee amount must be greater than zero");return{feeAmount:{amount:this.feeAmount,decimals:this.decimals},feeCollectorAccountId:this.feeCollectorAccountId,exemptAccounts:this.exemptAccountIds}}}class HCS10Client extends HCS10BaseClient{constructor(e){super({network:e.network,logLevel:e.logLevel}),this.client="mainnet"===e.network?i$1.forMainnet():i$1.forTestnet(),this.operatorPrivateKey=y$2.fromString(e.operatorPrivateKey),this.network=e.network,this.client.setOperator(e.operatorId,this.operatorPrivateKey.toString()),this.logger=Logger$2.getInstance({level:e.logLevel||"info",module:"HCS-SDK"}),this.guardedRegistryBaseUrl=e.guardedRegistryBaseUrl||"https://hcs-10.hashgraphonline.com",this.feeAmount=e.feeAmount||5,this.hcs11Client=new HCS11Client({network:e.network,auth:{operatorId:e.operatorId,privateKey:e.operatorPrivateKey},logLevel:e.logLevel})}getClient(){return this.client}async createAccount(){this.logger.info("Creating new account");const e=y$2.generate(),t=(new l).setKey(e.publicKey).setInitialBalance(new e$7(10));this.logger.debug("Executing account creation transaction");const r=await t.execute(this.client),o=(await r.getReceipt(this.client)).accountId;if(!o)throw this.logger.error("Account creation failed: accountId is null"),new AccountCreationError("Failed to create account: accountId is null");return this.logger.info(`Account created successfully: ${o.toString()}`),{accountId:o.toString(),privateKey:e.toString()}}async createInboundTopic(e,t,r){this.logger.info(`Creating ${t} inbound topic`);const o=`hcs-10:0:60:0:${e}`;switch(t){case InboundTopicType.PUBLIC:return this.createTopic(o,!0,!1);case InboundTopicType.CONTROLLED:return this.createTopic(o,!0,!0);case InboundTopicType.FEE_BASED:if(!r)throw new Error("Fee configuration is required for fee-based topics");return this.createTopic(o,!0,!0,r.build());default:throw new Error(`Unsupported inbound topic type: ${t}`)}}async createAgent(e){var t;const r=e.build(),o=await this.createTopic("hcs-10:0:60:1",!0,!0);this.logger.info(`Created new outbound topic ID: ${o}`);const n=null==(t=this.client.operatorAccountId)?void 0:t.toString();if(!n)throw new Error("Failed to retrieve operator account ID");const i=await this.createInboundTopic(n,r.inboundTopicType,r.inboundTopicType===InboundTopicType.FEE_BASED?r.feeConfig:void 0);this.logger.info(`Created new inbound topic ID: ${i}`);const a=(await this.inscribePfp(r.pfpBuffer,r.pfpFileName)).pfpTopicId;this.logger.info(`Profile picture inscribed with topic ID: ${a}`);const s=(await this.storeHCS11Profile(r.name,r.description,i,o,r.capabilities,r.metadata,r.pfpBuffer,r.pfpFileName)).profileTopicId;return this.logger.info(`Profile stored with topic ID: ${s}`),{outboundTopicId:o,inboundTopicId:i,pfpTopicId:a,profileTopicId:s}}async inscribePfp(e,t){try{this.logger.info("Inscribing profile picture using HCS-11 client");const r=await this.hcs11Client.inscribeImage(e,t);if(!r.success)throw this.logger.error(`Failed to inscribe profile picture: ${r.error}`),new Error(r.error||"Failed to inscribe profile picture");return this.logger.info(`Successfully inscribed profile picture with topic ID: ${r.imageTopicId}`),{pfpTopicId:r.imageTopicId,transactionId:r.transactionId,success:!0}}catch(r){return this.logger.error(`Error inscribing profile picture: ${r.message}`),{pfpTopicId:"",transactionId:"",success:!1,error:r.message}}}async storeHCS11Profile(e,t,r,o,n=[],i,a,s){try{let c;if(a&&s){const e=await this.inscribePfp(a,s);e.success?c=e.pfpTopicId:this.logger.error("Failed to inscribe profile picture, continuing without PFP")}const u=this.hcs11Client.getAgentTypeFromMetadata({type:i.type}),l=i.socials?Object.entries(i.socials).filter((([e,t])=>t)).map((([e,t])=>({platform:"x"===e?"twitter":e,handle:t}))):void 0,d=this.hcs11Client.createAIAgentProfile(e,u,n,i.model||"unknown",{alias:e.toLowerCase().replace(/\s+/g,"_"),bio:t,profileImage:c?`hcs://1/${c}`:void 0,socials:l,properties:i.properties,inboundTopicId:r,outboundTopicId:o,creator:i.creator}),p=await this.hcs11Client.createAndInscribeProfile(d,!0);if(!p.success)throw this.logger.error(`Failed to inscribe profile: ${p.error}`),new Error(p.error||"Failed to inscribe profile");return this.logger.info(`Profile inscribed with topic ID: ${p.profileTopicId}, transaction ID: ${p.transactionId}`),{profileTopicId:p.profileTopicId,pfpTopicId:c,transactionId:p.transactionId,success:!0}}catch(c){return this.logger.error(`Error storing HCS-11 profile: ${c.message}`),{profileTopicId:"",pfpTopicId:"",transactionId:"",success:!1,error:c.message}}}async setupFees(e,t,r=[]){if(!this.client.operatorPublicKey)return;this.logger.info("Setting up topic with custom fees");const o=(new l$1).setAmount(Number(t.feeAmount.amount)).setFeeCollectorAccountId(f.fromString(t.feeCollectorAccountId));let n=[...t.exemptAccounts||[],...r];if(console.log("exemptAccountIds",n),n.length>0){const t=Array.from(new Set(n)).filter((e=>{var t;return e!==(null==(t=this.client.operatorAccountId)?void 0:t.toString())}));let r=[];if(t.length>0)try{r=await accountIdsToExemptKeys(t,this.network,this.logger)}catch(i){this.logger.warn(`Error getting exempt keys: ${i}, continuing without exempt keys`)}r.length>0&&e.setFeeExemptKeys(r)}e.setFeeScheduleKey(this.client.operatorPublicKey).setCustomFees([o])}async handleConnectionRequest(e,t,r,o){var n;const i=`hcs-10:${e}:${r}`;this.logger.info(`Handling connection request ${r} from ${t}`);const a=null==(n=this.getClient().operatorAccountId)?void 0:n.toString();if(!a)throw new Error("Failed to retrieve operator account ID");let s=await this.mirrorNode.getPublicKey(t);const c=await this.mirrorNode.getPublicKey(a);if(!c)throw new Error("Failed to retrieve public key");const u=new s$7([c,s],1);let l;try{if(o){const e=o.build(),t={...e,exemptAccounts:[...e.exemptAccounts||[]]};l=await this.createTopic(i,u,u,t)}else l=await this.createTopic(i,u,u);this.logger.info(`Created new connection topic ID: ${l}`)}catch(p){throw this.logger.error(`Failed to create connection topic: ${p}`),new TopicCreationError(`Failed to create connection topic: ${p}`)}const d=`${e}@${a}`;return{connectionTopicId:l,confirmedConnectionSequenceNumber:await this.confirmConnection(e,l,t,r,d,"Connection accepted. Looking forward to collaborating!"),operatorId:d}}async confirmConnection(e,t,r,o,n,i,a){var s;this.logger.info(`Confirming connection with ID ${o}`);const c={p:"hcs-10",op:"connection_created",connection_topic_id:t,connected_account_id:r,operator_id:n,connection_id:o,m:i},u=null==(s=(await this.submitPayload(e,c,a)).topicSequenceNumber)?void 0:s.toNumber();if(!u)throw new ConnectionConfirmationError("Failed to confirm connection: sequence number is null");return u}async sendMessage(e,t,r,o,n){var i;const a=await this.canSubmitToInboundTopic(e,(null==(i=this.client.operatorAccountId)?void 0:i.toString())||""),s={p:"hcs-10",op:"message",operator_id:t,data:r,m:o};await this.submitPayload(e,s,n,a.requiresFee)}async createTopic(e,t,r,o){this.logger.info("Creating topic");const n=(new m$1).setTopicMemo(e);t&&("boolean"==typeof t&&t&&this.client.operatorPublicKey?(n.setAdminKey(this.client.operatorPublicKey),n.setAutoRenewAccountId(this.client.operatorAccountId)):(t instanceof i$7||t instanceof s$7)&&(n.setAdminKey(t),this.client.operatorAccountId&&n.setAutoRenewAccountId(this.client.operatorAccountId))),r&&("boolean"==typeof r&&r&&this.client.operatorPublicKey?n.setSubmitKey(this.client.operatorPublicKey):(r instanceof i$7||r instanceof s$7)&&n.setSubmitKey(r)),o&&await this.setupFees(n,o),this.logger.debug("Executing topic creation transaction");const i=await n.execute(this.client),a=await i.getReceipt(this.client);if(!a.topicId)throw this.logger.error("Failed to create topic: topicId is null"),new Error("Failed to create topic: topicId is null");return a.topicId.toString()}async submitMessage(e,t,r){var o;const n=await this.canSubmitToInboundTopic(e,(null==(o=this.client.operatorAccountId)?void 0:o.toString())||"");return this.submitPayload(e,t,r,n.requiresFee)}async submitPayload(e,t,r,o=!1){const n="string"==typeof t?t:JSON.stringify(t),i=Buffer.byteLength(n,"utf8");if(i>1024)throw new PayloadSizeError("Payload size exceeds 1 KB limit",i);const a=(new u).setTopicId(m$2.fromString(e)).setMessage(n);let s;if(o&&(this.logger.info("Topic requires fee payment, setting max transaction fee"),a.setMaxTransactionFee(new e$7(this.feeAmount)),a.setTransactionMemo("HIP-991 Fee Payment")),r){a.freezeWith(this.client);const e=await a.sign(r);s=await e.execute(this.client)}else s=await a.execute(this.client);const c=await s.getReceipt(this.client);if(!c)throw this.logger.error("Failed to submit message: receipt is null"),new Error("Failed to submit message: receipt is null");return this.logger.info("Message submitted successfully"),c}async submitConnectionRequest(e,t,r,o){var n;const i=await this.canSubmitToInboundTopic(e,t);if(!i.canSubmit)throw new Error(`Cannot submit to topic: ${i.reason}`);const a={p:"hcs-10",op:"connection_request",operator_id:r,memo:o},s=i.requiresFee,c=await this.submitPayload(e,a,void 0,s);this.logger.info(`Submitted connection request to topic ID: ${e}`);const u=await this.retrieveOutboundConnectTopic(t),l=null==(n=c.topicSequenceNumber)?void 0:n.toNumber();if(!l)throw new Error("Failed to get response sequence number");return await this.submitPayload(u.outboundTopic,{...a,outbound_topic_id:u.outboundTopic,connection_request_id:l},this.operatorPrivateKey),c}async recordOutboundConnectionConfirmation({outboundTopicId:e,connectionRequestId:t,confirmedRequestId:r,connectionTopicId:o,operatorId:n,memo:i}){const a={p:"hcs-10",op:"connection_created",connection_topic_id:o,outbound_topic_id:e,confirmed_request_id:r,connection_request_id:t,operator_id:n,m:i};return await this.submitPayload(e,a)}async inscribeFile(e,t){if(this.logger.info("Inscribing file"),!this.client.operatorAccountId)throw this.logger.error("Operator account ID is not set"),new Error("Operator account ID is not set");if(!this.operatorPrivateKey)throw this.logger.error("Operator private key is not set"),new Error("Operator private key is not set");const r=mimeTypes.lookup(t)||"application/octet-stream",o=await InscriptionSDK.createWithAuth({type:"server",accountId:this.client.operatorAccountId.toString(),privateKey:this.operatorPrivateKey.toString(),network:this.network}),n=await o.inscribeAndExecute({file:{type:"base64",base64:e.toString("base64"),fileName:t,mimeType:r},holderId:this.client.operatorAccountId.toString(),mode:"file",network:this.network},{accountId:this.client.operatorAccountId.toString(),privateKey:this.operatorPrivateKey.toString(),network:this.network});if(!n.transactionId||!n.jobId)throw this.logger.error("Failed to inscribe, no transaction ID or job ID."),new Error("Failed to inscribe, no transaction ID or job ID.");n.transactionId&&n.jobId&&this.logger.info(`Transaction ID: ${n.transactionId}, Job ID: ${n.jobId}`);return await o.waitForInscription(n.jobId,30,4e3,!0)}async waitForConnectionConfirmation(e,t,r=60,o=2e3){this.logger.info(`Waiting for connection confirmation on inbound topic ${e} for request ID ${t}`);for(let n=0;n<r;n++){this.logger.info(`Attempt ${n+1}/${r} to find connection confirmation`);const i=(await this.mirrorNode.getTopicMessages(e)).filter((e=>"connection_created"===e.op));if(this.logger.info(`Found ${i.length} connection_created messages`),i.length>0)for(const e of i)if(Number(e.connection_id)===Number(t))return this.logger.info("Connection confirmation found"),{connectionTopicId:e.connection_topic_id,sequence_number:Number(e.sequence_number),confirmedBy:e.operator_id,memo:e.m};n<r-1&&(this.logger.info(`No matching confirmation found, waiting ${o}ms before retrying...`),await new Promise((e=>setTimeout(e,o))))}throw new Error(`Connection confirmation not found after ${r} attempts for request ID ${t}`)}getAccountAndSigner(){return{accountId:this.client.operatorAccountId.toString(),signer:this.operatorPrivateKey}}async canSubmitToInboundTopic(e,t){var r,o,n,i;try{const s=await this.mirrorNode.getTopicInfo(e);if(!s)return{canSubmit:!1,requiresFee:!1,reason:"Topic does not exist"};if(!(null==(r=s.submit_key)?void 0:r.key))return{canSubmit:!0,requiresFee:!1};try{const e=await this.mirrorNode.getPublicKey(t);if("ProtobufEncoded"===s.submit_key._type){const t=Buffer.from(s.submit_key.key,"hex");if(await this.mirrorNode.checkKeyListAccess(t,e))return{canSubmit:!0,requiresFee:!1}}else{const t=i$7.fromString(s.submit_key.key);if(e.toString()===t.toString())return{canSubmit:!0,requiresFee:!1}}}catch(a){this.logger.error(`Key validation error: ${a instanceof Error?a.message:String(a)}`)}return(null==(o=s.fee_schedule_key)?void 0:o.key)&&(null==(i=null==(n=s.custom_fees)?void 0:n.fixed_fees)?void 0:i.length)>0?{canSubmit:!0,requiresFee:!0,reason:"Requires fee payment via HIP-991"}:{canSubmit:!1,requiresFee:!1,reason:"User does not have submit permission for this topic"}}catch(a){const e=a instanceof Error?a.message:String(a);return this.logger.error(`Topic submission validation error: ${e}`),{canSubmit:!1,requiresFee:!1,reason:`Error: ${e}`}}}async createAndRegisterAgent(e){const t=e.build(),r=t.existingAccount||await this.createAccount(),o=new HCS10Client({network:t.network,operatorId:r.accountId,operatorPrivateKey:r.privateKey,operatorPublicKey:y$2.fromString(r.privateKey).publicKey.toString(),logLevel:"info"}),{outboundTopicId:n,inboundTopicId:i,pfpTopicId:a,profileTopicId:s}=await o.createAgent(e),c=`${i}@${r.accountId}`;return await o.registerAgentWithGuardedRegistry(r.accountId,i,t.network),{accountId:r.accountId,privateKey:r.privateKey,operatorId:c,inboundTopicId:i,outboundTopicId:n,profileTopicId:s,pfpTopicId:a,client:o}}async registerAgentWithGuardedRegistry(e,t,r=this.network,o){try{this.logger.info("Registering agent with guarded registry");const n=(null==o?void 0:o.maxAttempts)??60,i=(null==o?void 0:o.delayMs)??2e3,a=null==o?void 0:o.progressCallback;a&&a({stage:"preparing",message:"Preparing agent registration",progressPercent:10});const s=await this.executeRegistration(e,t,r,this.guardedRegistryBaseUrl,this.logger);if(!s.success)return s;if(a&&a({stage:"submitting",message:"Submitting registration to registry",progressPercent:30,details:{transactionId:s.transactionId}}),s.transaction){const e=S.fromBytes(Buffer.from(s.transaction,"base64"));this.logger.info("Processing registration transaction"),await e.execute(this.client),this.logger.info("Successfully processed registration transaction")}a&&a({stage:"confirming",message:"Confirming registration transaction",progressPercent:60,details:{accountId:e,inboundTopicId:t,transactionId:s.transactionId}});const c=await this.waitForRegistrationConfirmation(s.transactionId,r,this.guardedRegistryBaseUrl,n,i,this.logger);return a&&a({stage:"completed",message:"Agent registration complete",progressPercent:100,details:{confirmed:c,transactionId:s.transactionId}}),{...s,confirmed:c}}catch(n){return this.logger.error(`Failed to register agent: ${n.message}`),{error:n.message,success:!1}}}async registerAgent(e,t,r,o,n){this.logger.info("Registering agent");const i={p:"hcs-10",op:"register",account_id:t,inbound_topic_id:r,m:o};await this.submitPayload(e,i,n)}async getInboundTopicType(e){try{const t=await this.mirrorNode.getTopicInfo(e);if(!t)throw new Error("Topic does not exist");if(!(t.submit_key&&t.submit_key.key))return InboundTopicType.PUBLIC;if(t.fee_schedule_key&&t.fee_schedule_key.key&&t.custom_fees){const r=t.custom_fees;if(r&&r.fixed_fees&&r.fixed_fees.length>0)return this.logger.info(`Topic ${e} is fee-based with ${r.fixed_fees.length} custom fees`),InboundTopicType.FEE_BASED}return InboundTopicType.CONTROLLED}catch(t){throw this.logger.error(`Error determining topic type: ${t.message}`),new Error(`Failed to determine topic type: ${t.message}`)}}getNetwork(){return this.network}getLogger(){return this.logger}}class AgentBuilder{constructor(){this.config={}}setName(e){return this.config.name=e,this}setDescription(e){return this.config.description=e,this}setCapabilities(e){return this.config.capabilities=e,this}setAgentType(e){return this.config.metadata?this.config.metadata.type=e:this.config.metadata={type:e},this}setModel(e){return this.config.metadata?this.config.metadata.model=e:this.config.metadata={type:"autonomous",model:e},this}setCreator(e){return this.config.metadata?this.config.metadata.creator=e:this.config.metadata={type:"autonomous",creator:e},this}addSocial(e,t){return this.config.metadata?this.config.metadata.socials||(this.config.metadata.socials={}):this.config.metadata={type:"autonomous",socials:{}},this.config.metadata.socials[e]=t,this}addProperty(e,t){return this.config.metadata?this.config.metadata.properties||(this.config.metadata.properties={}):this.config.metadata={type:"autonomous",properties:{}},this.config.metadata.properties[e]=t,this}setMetadata(e){return this.config.metadata=e,this}setProfilePicture(e,t){return this.config.pfpBuffer=e,this.config.pfpFileName=t,this}setNetwork(e){return this.config.network=e,this}setInboundTopicType(e){return this.config.inboundTopicType=e,this}setFeeConfig(e){return this.config.feeConfig=e,this}setConnectionFeeConfig(e){return this.config.connectionFeeConfig=e,this}setExistingAccount(e,t){return this.config.existingAccount={accountId:e,privateKey:t},this}build(){if(!this.config.name)throw new Error("Agent name is required");if(!this.config.description)throw new Error("Agent description is required");if(!this.config.pfpBuffer||!this.config.pfpFileName)throw new Error("Profile picture is required");if(!this.config.network)throw new Error("Network is required");if(this.config.inboundTopicType||(this.config.inboundTopicType=InboundTopicType.PUBLIC),this.config.capabilities||(this.config.capabilities=[]),this.config.metadata||(this.config.metadata={type:"autonomous"}),this.config.inboundTopicType===InboundTopicType.FEE_BASED&&!this.config.feeConfig)throw new Error("Fee configuration is required for fee-based topics");return this.config}}class BrowserHCSClient extends HCS10BaseClient{constructor(e){super({network:e.network,logLevel:e.logLevel}),this.guardedRegistryBaseUrl=e.guardedRegistryBaseUrl||"https://moonscape.tech",this.hwc=e.hwc,this.logger=Logger$2.getInstance({level:e.logLevel||"info",module:"HCS-Browser"});const{accountId:t,signer:r}=this.getAccountAndSigner();this.hcs11Client=new HCS11Client({network:e.network,auth:{operatorId:t,signer:r},logLevel:e.logLevel})}async sendMessage(e,t,r,o){this.logger.info("Sending message");const n={p:"hcs-10",op:"message",operator_id:t,data:r,m:o};await this.submitPayload(e,n)}async submitConnectionRequest(e,t,r,o){var n,i;this.logger.info("Submitting connection request");const a={p:"hcs-10",op:"connection_request",requesting_account_id:t,operator_id:r,m:o},s=await this.submitPayload(e,a);this.logger.info(`Submitted connection request to topic ID: ${e}`);const c=await this.retrieveOutboundConnectTopic(t);if(!(null==c?void 0:c.outboundTopic))throw this.logger.error(`Failed to retrieve outbound topic for account ID: ${t}`),new Error(`Failed to retrieve outbound topic for account ID: ${t}`);this.logger.info(`Retrieved outbound topic ID: ${c.outboundTopic} for account ID: ${t}`);const u=null==(i=null==(n=null==s?void 0:s.result)?void 0:n.topicSequenceNumber)?void 0:i.toNumber();if(!u)throw new Error("Failed to get response sequence number");return await this.submitPayload(c.outboundTopic,{...a,outbound_topic_id:e,connection_request_id:u}),s.result}async recordOutboundConnectionConfirmation({outboundTopicId:e,connectionRequestId:t,confirmedRequestId:r,connectionTopicId:o,operatorId:n,memo:i}){const a={p:"hcs-10",op:"connection_created",connection_topic_id:o,outbound_topic_id:e,confirmed_request_id:r,connection_request_id:t,operator_id:n,m:i};return await this.submitPayload(e,a)}async getPublicKey(e){return await this.mirrorNode.getPublicKey(e)}async handleConnectionRequest(e,t,r,o="Connection accepted. Looking forward to collaborating!"){this.logger.info("Handling connection request");const n=this.hwc.getAccountInfo().accountId;if(!n)throw new Error("Failed to retrieve user account ID");const i=await this.mirrorNode.getPublicKey(t),a=await this.mirrorNode.getPublicKey(n);if(!a)throw new Error("Failed to retrieve public key");const s=new s$7([a,i],1),c=`hcs-10:${e}:${r}`,u=(new m$1).setTopicMemo(c).setAdminKey(s).setSubmitKey(s);this.logger.debug("Executing topic creation transaction");const l=await this.hwc.executeTransactionWithErrorHandling(u,!1);if(l.error)throw this.logger.error(l.error),new Error(l.error);const d=l.result;if(!(null==d?void 0:d.topicId))throw this.logger.error("Failed to create topic: topicId is null"),new Error("Failed to create topic: topicId is null");const p=d.topicId.toString(),h=`${e}@${n}`;return{connectionTopicId:p,confirmedConnectionSequenceNumber:await this.confirmConnection(e,p,t,r,h,o),operatorId:h}}async confirmConnection(e,t,r,o,n,i){var a;this.logger.info("Confirming connection");const s={p:"hcs-10",op:"connection_created",connection_topic_id:t,connected_account_id:r,operator_id:n,connection_id:o,m:i},c=await this.submitPayload(e,s);if(!(null==(a=null==c?void 0:c.result)?void 0:a.topicSequenceNumber))throw this.logger.error("Failed to confirm connection: sequence number is null"),new Error("Failed to confirm connection: sequence number is null");return c.result.topicSequenceNumber.toNumber()}async submitMessage(e,t,r={},o=""){this.logger.info("Submitting message");const n={p:"hcs-10",op:"message",data:{content:t,metadata:r},m:o};return await this.submitPayload(e,n)}async createAgent(e,t,r,o,n,i,a){try{const s=await this.createTopic("hcs-10:0:60:1",!0,!0);if(!s.success||!s.topicId)return{outboundTopicId:"",inboundTopicId:"",pfpTopicId:"",profileTopicId:"",error:s.error||"Failed to create outbound topic",success:!1};const c=await this.createTopic(`hcs-10:0:60:0:${s.topicId}`);if(!c.success||!c.topicId)return{outboundTopicId:s.topicId,inboundTopicId:"",pfpTopicId:"",profileTopicId:"",error:c.error||"Failed to create inbound topic",success:!1};let u=a;if(!u){const r=await this.inscribePfp(e,t);if(!r.success)return{outboundTopicId:s.topicId,inboundTopicId:c.topicId,pfpTopicId:"",profileTopicId:"",error:r.error||"Failed to inscribe profile picture",success:!1};u=r.pfpTopicId}const l=await this.storeHCS11Profile(r,o,c.topicId,s.topicId,n,i,e,t,u);return l.success?{outboundTopicId:s.topicId,inboundTopicId:c.topicId,pfpTopicId:u||"",profileTopicId:l.profileTopicId,success:!0}:{outboundTopicId:s.topicId,inboundTopicId:c.topicId,pfpTopicId:u||"",profileTopicId:"",error:l.error||"Failed to store profile",success:!1}}catch(s){return{outboundTopicId:"",inboundTopicId:"",pfpTopicId:"",profileTopicId:"",error:s.message,success:!1}}}async createAndRegisterAgent(e,t,r,o,n,i,a,s){try{const c=await this.createAgent(n,i,e,t,r,o,s);if(!c.success)throw new Error(c.error||"Failed to create agent");const{accountId:u}=this.getAccountAndSigner(),l=await this.registerAgentWithGuardedRegistry(u,c.inboundTopicId,a);if(!l.success)throw new Error(l.error||"Failed to register agent with registry");return{accountId:u,operatorId:`${c.outboundTopicId}@${u}`,inboundTopicId:c.inboundTopicId,outboundTopicId:c.outboundTopicId,profileTopicId:c.profileTopicId,pfpTopicId:c.pfpTopicId,client:this}}catch(c){throw new Error(`Failed to create and register agent: ${c.message}`)}}async registerAgentWithGuardedRegistry(e,t,r=this.network,o){try{this.logger.info("Registering agent with guarded registry");const n=(null==o?void 0:o.maxAttempts)??60,i=(null==o?void 0:o.delayMs)??2e3,a=null==o?void 0:o.progressCallback;this.logger.debug(`Progress callback provided: ${!!a}`);const s=e=>{try{a&&(this.logger.debug(`Reporting progress: ${e.stage} - ${e.message} (${e.progressPercent}%)`),a(e))}catch(t){this.logger.error(`Error in progress callback: ${t}`)}};s({stage:"preparing",message:"Preparing agent registration",progressPercent:10});const c=await this.executeRegistration(e,t,r,this.guardedRegistryBaseUrl,this.logger);if(!c.success)return c;if(s({stage:"submitting",message:"Submitting registration to registry",progressPercent:30,details:{transactionId:c.transactionId}}),c.transaction){const e=S.fromBytes(Buffer.from(c.transaction,"base64"));this.logger.info("Processing registration transaction");const t=await this.hwc.executeTransactionWithErrorHandling(e,!1);if(t.error)return{...c,error:t.error,success:!1};this.logger.info("Successfully processed registration transaction")}s({stage:"confirming",message:"Confirming registration transaction",progressPercent:60,details:{accountId:e,inboundTopicId:t,transactionId:c.transactionId}});const u=await this.waitForRegistrationConfirmation(c.transactionId,r,this.guardedRegistryBaseUrl,n,i);return s({stage:"completed",message:"Agent registration complete",progressPercent:100,details:{confirmed:u,transactionId:c.transactionId}}),{...c,confirmed:u}}catch(n){return this.logger.error(`Registration error: ${n.message}`),{error:`Error during registration: ${n.message}`,success:!1}}}async storeHCS11Profile(e,t,r,o,n=[],i={},a,s,c){try{let u=c;if(!u&&a&&s){const e=await this.inscribePfp(a,s);e.success?u=e.pfpTopicId:this.logger.error("Failed to inscribe profile picture, continuing without PFP")}const l=this.hcs11Client.getAgentTypeFromMetadata({type:i.type||"autonomous"}),d=[];i.socials&&(i.socials.twitter&&d.push({platform:"twitter",handle:i.socials.twitter}),i.socials.discord&&d.push({platform:"discord",handle:i.socials.discord}),i.socials.github&&d.push({platform:"github",handle:i.socials.github}),i.socials.website&&d.push({platform:"website",handle:i.socials.website}),i.socials.x&&d.push({platform:"twitter",handle:i.socials.x}),i.socials.linkedin&&d.push({platform:"linkedin",handle:i.socials.linkedin}),i.socials.youtube&&d.push({platform:"youtube",handle:i.socials.youtube}),i.socials.telegram&&d.push({platform:"telegram",handle:i.socials.telegram}));const p=this.hcs11Client.createAIAgentProfile(e,l,n,i.model||"unknown",{alias:e.toLowerCase().replace(/\s+/g,"_"),bio:t,profileImage:u?`hcs://1/${u}`:void 0,socials:d.length>0?d:void 0,properties:{description:t,version:i.version||"1.0.0",creator:i.creator||"Unknown",supported_languages:i.supported_languages||["en"],permissions:i.permissions||[],model_details:i.model_details,training:i.training,capabilities_description:i.capabilities_description,...i},inboundTopicId:r,outboundTopicId:o,creator:i.creator}),h=await this.hcs11Client.createAndInscribeProfile(p,!0);return h.success?{profileTopicId:h.profileTopicId,pfpTopicId:u,success:!0}:{profileTopicId:"",success:!1,error:h.error||"Failed to inscribe profile"}}catch(u){return{profileTopicId:"",success:!1,error:u.message}}}async createTopic(e,t,r){this.logger.info("Creating topic");const{accountId:o,signer:n}=this.getAccountAndSigner(),i=(new m$1).setTopicMemo(e),a=await this.mirrorNode.getPublicKey(o);t&&a&&(i.setAdminKey(a),i.setAutoRenewAccountId(o)),r&&a&&i.setSubmitKey(a);const s=await this.hwc.executeTransactionWithErrorHandling(i,!1),c=s.error;if(c)return this.logger.error(c),{success:!1,error:c};const u=s.result;return(null==u?void 0:u.topicId)?{success:!0,topicId:u.topicId.toString()}:(this.logger.error("Failed to create topic: topicId is null"),{success:!1,error:"Failed to create topic: topicId is null"})}async submitPayload(e,t){this.logger.debug("Submitting payload");const r=(new u).setTopicId(e).setMessage(JSON.stringify(t));return await this.hwc.executeTransactionWithErrorHandling(r,!1)}async inscribeFile(e,t){const{accountId:r,signer:o}=this.getAccountAndSigner(),n=mimeTypes.lookup(t)||"application/octet-stream",i=await InscriptionSDK.createWithAuth({type:"client",accountId:r,signer:o,network:this.network}),a=await i.inscribe({file:{type:"base64",base64:e.toString("base64"),fileName:t,mimeType:n},holderId:r.toString(),mode:"file",network:this.network},o);if(!a.transactionId||!a.jobId)throw this.logger.error("Failed to inscribe, no transaction ID or job ID."),new Error("Failed to inscribe, no transaction ID or job ID.");a.transactionId&&a.jobId&&this.logger.info(`Transaction ID: ${a.transactionId}, Job ID: ${a.jobId}`);return await i.waitForInscription(a.jobId,30,4e3,!0)}getAccountAndSigner(){const e=this.hwc.getAccountInfo().accountId.toString(),t=this.hwc.dAppConnector.signers.find((t=>t.getAccountId().toString()===e));if(!t)throw this.logger.error("Failed to find signer"),new Error("Failed to find signer");return{accountId:e,signer:t}}async inscribePfp(e,t){try{this.logger.info("Inscribing profile picture using HCS-11 client");const r=await this.hcs11Client.inscribeImage(e,t);return r.success?(this.logger.info(`Successfully inscribed profile picture with topic ID: ${r.imageTopicId}`),{pfpTopicId:r.imageTopicId,success:!0}):(this.logger.error(`Failed to inscribe profile picture: ${r.error}`),{pfpTopicId:"",success:!1,error:r.error||"Failed to inscribe profile picture"})}catch(r){return this.logger.error(`Error inscribing profile picture: ${r.message}`),{pfpTopicId:"",success:!1,error:r.message}}}}exports.AIAgentCapability=AIAgentCapability,exports.AIAgentType=AIAgentType,exports.AccountCreationError=AccountCreationError,exports.AgentBuilder=AgentBuilder,exports.BrowserHCSClient=BrowserHCSClient,exports.ConnectionConfirmationError=ConnectionConfirmationError,exports.EVMBridge=EVMBridge,exports.EndpointType=EndpointType,exports.FeeConfigBuilder=FeeConfigBuilder,exports.HCS=HCS,exports.HCS10BaseClient=HCS10BaseClient,exports.HCS10Cache=HCS10Cache,exports.HCS10Client=HCS10Client,exports.HCS11Client=HCS11Client,exports.HederaMirrorNode=HederaMirrorNode,exports.InboundTopicType=InboundTopicType,exports.Logger=Logger$2,exports.PayloadSizeError=PayloadSizeError,exports.ProfileType=ProfileType,exports.Registration=Registration,exports.SUPPORTED_SOCIAL_PLATFORMS=SUPPORTED_SOCIAL_PLATFORMS,exports.TopicCreationError=TopicCreationError,exports.WasmBridge=WasmBridge,exports.accountIdsToExemptKeys=accountIdsToExemptKeys,exports.inscribe=inscribe,exports.inscribeWithSigner=inscribeWithSigner,exports.retrieveInscription=retrieveInscription,exports.sleep=sleep,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})}));
114
+ */!function(e){var t,r,o,n=mimeDb,i=pathBrowserify.extname,a=/^\s*([^;\s]*)(?:;|\s|$)/,s=/^text\//i;function c(e){if(!e||"string"!=typeof e)return!1;var t=a.exec(e),r=t&&n[t[1].toLowerCase()];return r&&r.charset?r.charset:!(!t||!s.test(t[1]))&&"UTF-8"}e.charset=c,e.charsets={lookup:c},e.contentType=function(t){if(!t||"string"!=typeof t)return!1;var r=-1===t.indexOf("/")?e.lookup(t):t;if(!r)return!1;if(-1===r.indexOf("charset")){var o=e.charset(r);o&&(r+="; charset="+o.toLowerCase())}return r},e.extension=function(t){if(!t||"string"!=typeof t)return!1;var r=a.exec(t),o=r&&e.extensions[r[1].toLowerCase()];if(!o||!o.length)return!1;return o[0]},e.extensions=Object.create(null),e.lookup=function(t){if(!t||"string"!=typeof t)return!1;var r=i("x."+t).toLowerCase().substr(1);if(!r)return!1;return e.types[r]||!1},e.types=Object.create(null),t=e.extensions,r=e.types,o=["nginx","apache",void 0,"iana"],Object.keys(n).forEach((function(e){var i=n[e],a=i.extensions;if(a&&a.length){t[e]=a;for(var s=0;s<a.length;s++){var c=a[s];if(r[c]){var u=o.indexOf(n[r[c]].source),l=o.indexOf(i.source);if("application/octet-stream"!==r[c]&&(u>l||u===l&&"application/"===r[c].substr(0,12)))continue}r[c]=e}}}))}(mimeTypes);var InboundTopicType=(e=>(e.PUBLIC="PUBLIC",e.CONTROLLED="CONTROLLED",e.FEE_BASED="FEE_BASED",e))(InboundTopicType||{}),util,util2,objectUtil,objectUtil2;async function inscribe(e,t,r,o){var n,i;const a=Logger$2.getInstance({module:"Inscriber",...r.logging});a.info("Starting inscription process",{type:e.type,mode:r.mode||"file",..."url"===e.type?{url:e.url}:{},..."file"===e.type?{path:e.path}:{},..."buffer"===e.type?{fileName:e.fileName,bufferSize:e.buffer.byteLength}:{}});try{let s;"hashinal"===r.mode&&r.metadata&&validateHashinalMetadata(r.metadata,a),o?(a.debug("Using existing InscriptionSDK instance"),s=o):r.apiKey?(a.debug("Initializing InscriptionSDK with API key"),s=new InscriptionSDK({apiKey:r.apiKey,network:t.network||"mainnet"})):(a.debug("Initializing InscriptionSDK with server auth"),s=await InscriptionSDK.createWithAuth({type:"server",accountId:t.accountId,privateKey:t.privateKey,network:t.network||"mainnet"}));const c={holderId:t.accountId,metadata:r.metadata||{},tags:r.tags||[],mode:r.mode||"file",chunkSize:r.chunkSize};let u;switch(e.type){case"url":u={...c,file:{type:"url",url:e.url}};break;case"file":u={...c,file:{type:"path",path:e.path}};break;case"buffer":u={...c,file:{type:"base64",base64:Buffer.from(e.buffer).toString("base64"),fileName:e.fileName,mimeType:e.mimeType}}}"hashinal"===r.mode&&(u.metadataObject=r.metadata,u.creator=(null==(n=r.metadata)?void 0:n.creator)||t.accountId,u.description=null==(i=r.metadata)?void 0:i.description,r.jsonFileURL&&(u.jsonFileURL=r.jsonFileURL)),a.debug("Preparing to inscribe content",{type:e.type,mode:r.mode||"file",holderId:t.accountId});const l=await s.inscribeAndExecute(u,t);if(a.info("Starting to inscribe.",{type:e.type,mode:r.mode||"file",transactionId:l.jobId}),r.waitForConfirmation){a.debug("Waiting for inscription confirmation",{transactionId:l.jobId,maxAttempts:r.waitMaxAttempts,intervalMs:r.waitIntervalMs});const e=await waitForInscriptionConfirmation(s,l.jobId,r.waitMaxAttempts,r.waitIntervalMs);return a.info("Inscription confirmation received",{transactionId:l.jobId}),{confirmed:!0,result:l,inscription:e,sdk:s}}return{confirmed:!1,result:l,sdk:s}}catch(s){throw a.error("Error during inscription process",s),s}}async function inscribeWithSigner(e,t,r,o){var n,i;const a=Logger$2.getInstance({module:"Inscriber",...r.logging});a.info("Starting inscription process with signer",{type:e.type,mode:r.mode||"file",..."url"===e.type?{url:e.url}:{},..."file"===e.type?{path:e.path}:{},..."buffer"===e.type?{fileName:e.fileName,bufferSize:e.buffer.byteLength}:{}});try{"hashinal"===r.mode&&r.metadata&&validateHashinalMetadata(r.metadata,a);const s=t.getAccountId().toString();let c;a.debug("Using account ID from signer",{accountId:s}),o?(a.debug("Using existing InscriptionSDK instance"),c=o):r.apiKey?(a.debug("Initializing InscriptionSDK with API key"),c=new InscriptionSDK({apiKey:r.apiKey,network:r.network||"mainnet"})):(a.debug("Initializing InscriptionSDK with client auth"),c=await InscriptionSDK.createWithAuth({type:"client",accountId:s,signer:t,network:r.network||"mainnet"}));const u={holderId:s,metadata:r.metadata||{},tags:r.tags||[],mode:r.mode||"file",chunkSize:r.chunkSize};let l;switch(e.type){case"url":l={...u,file:{type:"url",url:e.url}};break;case"file":l={...u,file:{type:"path",path:e.path}};break;case"buffer":l={...u,file:{type:"base64",base64:Buffer.from(e.buffer).toString("base64"),fileName:e.fileName,mimeType:e.mimeType}}}"hashinal"===r.mode&&(l.metadataObject=r.metadata,l.creator=(null==(n=r.metadata)?void 0:n.creator)||s,l.description=null==(i=r.metadata)?void 0:i.description,r.jsonFileURL&&(l.jsonFileURL=r.jsonFileURL)),a.debug("Preparing to inscribe content with signer",{type:e.type,mode:r.mode||"file",holderId:s});const d=await c.inscribe({...l,holderId:s},t);if(a.info("Inscription started",{type:e.type,mode:r.mode||"file",transactionId:d.jobId}),r.waitForConfirmation){a.debug("Waiting for inscription confirmation",{transactionId:d.jobId,maxAttempts:r.waitMaxAttempts,intervalMs:r.waitIntervalMs});const e=await waitForInscriptionConfirmation(c,d.jobId,r.waitMaxAttempts,r.waitIntervalMs);return a.info("Inscription confirmation received",{transactionId:d.jobId}),{confirmed:!0,result:d,inscription:e,sdk:c}}return{confirmed:!1,result:d,sdk:c}}catch(s){throw a.error("Error during inscription process",s),s}}async function retrieveInscription(e,t){const r=Logger$2.getInstance({module:"Inscriber",...t.logging}),o=e.includes("@")?`${e.split("@")[0]}-${e.split("@")[1].replace(/\./g,"-")}`:e;r.info("Retrieving inscription",{originalTransactionId:e,formattedTransactionId:o});try{let e;if(t.apiKey)r.debug("Initializing InscriptionSDK with API key"),e=new InscriptionSDK({apiKey:t.apiKey,network:t.network||"mainnet"});else{if(!t.accountId||!t.privateKey){const e=new Error("Either API key or account ID and private key are required for retrieving inscriptions");throw r.error("Missing authentication credentials",{hasApiKey:!!t.apiKey,hasAccountId:!!t.accountId,hasPrivateKey:!!t.privateKey}),e}r.debug("Initializing InscriptionSDK with server auth"),e=await InscriptionSDK.createWithAuth({type:"server",accountId:t.accountId,privateKey:t.privateKey,network:t.network||"mainnet"})}r.debug("Initialized SDK for inscription retrieval",{formattedTransactionId:o,network:t.network||"mainnet"});const n=await e.retrieveInscription(o);return r.info("Successfully retrieved inscription",{formattedTransactionId:o}),n}catch(n){throw r.error("Error retrieving inscription",{formattedTransactionId:o,error:n}),n}}function validateHashinalMetadata(e,t){const r=["name","creator","description","type"].filter((t=>!e[t]));if(r.length>0){const e=new Error(`Missing required Hashinal metadata fields: ${r.join(", ")}`);throw t.error("Hashinal metadata validation failed",{missingFields:r}),e}t.debug("Hashinal metadata validation passed",{name:e.name,creator:e.creator,description:e.description,type:e.type,hasAttributes:!!e.attributes,hasProperties:!!e.properties})}async function waitForInscriptionConfirmation(e,t,r=30,o=4e3){const n=Logger$2.getInstance({module:"Inscriber"});try{n.debug("Waiting for inscription confirmation",{transactionId:t,maxAttempts:r,intervalMs:o});const i=await e.waitForInscription(t,r,o,!0);return n.debug("Inscription confirmation received",{transactionId:t}),i}catch(i){throw n.error("Error waiting for inscription confirmation",{transactionId:t,maxAttempts:r,intervalMs:o,error:i}),i}}util2=util||(util={}),util2.assertEqual=e=>e,util2.assertIs=function(e){},util2.assertNever=function(e){throw new Error},util2.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},util2.getValidEnumValues=e=>{const t=util2.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),r={};for(const o of t)r[o]=e[o];return util2.objectValues(r)},util2.objectValues=e=>util2.objectKeys(e).map((function(t){return e[t]})),util2.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},util2.find=(e,t)=>{for(const r of e)if(t(r))return r},util2.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,util2.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},util2.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,objectUtil2=objectUtil||(objectUtil={}),objectUtil2.mergeShapes=(e,t)=>({...e,...t});const ZodParsedType=util.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=e=>{switch(typeof e){case"undefined":return ZodParsedType.undefined;case"string":return ZodParsedType.string;case"number":return isNaN(e)?ZodParsedType.nan:ZodParsedType.number;case"boolean":return ZodParsedType.boolean;case"function":return ZodParsedType.function;case"bigint":return ZodParsedType.bigint;case"symbol":return ZodParsedType.symbol;case"object":return Array.isArray(e)?ZodParsedType.array:null===e?ZodParsedType.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?ZodParsedType.promise:"undefined"!=typeof Map&&e instanceof Map?ZodParsedType.map:"undefined"!=typeof Set&&e instanceof Set?ZodParsedType.set:"undefined"!=typeof Date&&e instanceof Date?ZodParsedType.date:ZodParsedType.object;default:return ZodParsedType.unknown}},ZodIssueCode=util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),quotelessJson=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class ZodError extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},r={_errors:[]},o=e=>{for(const n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(o);else if("invalid_return_type"===n.code)o(n.returnTypeError);else if("invalid_arguments"===n.code)o(n.argumentsError);else if(0===n.path.length)r._errors.push(t(n));else{let e=r,o=0;for(;o<n.path.length;){const r=n.path[o];o===n.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(n))):e[r]=e[r]||{_errors:[]},e=e[r],o++}}};return o(this),r}static assert(e){if(!(e instanceof ZodError))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,util.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];for(const o of this.issues)o.path.length>0?(t[o.path[0]]=t[o.path[0]]||[],t[o.path[0]].push(e(o))):r.push(e(o));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}ZodError.create=e=>new ZodError(e);const errorMap=(e,t)=>{let r;switch(e.code){case ZodIssueCode.invalid_type:r=e.received===ZodParsedType.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,util.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${util.joinValues(e.keys,", ")}`;break;case ZodIssueCode.invalid_union:r="Invalid input";break;case ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${util.joinValues(e.options)}`;break;case ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${util.joinValues(e.options)}, received '${e.received}'`;break;case ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case ZodIssueCode.invalid_date:r="Invalid date";break;case ZodIssueCode.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:util.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ZodIssueCode.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ZodIssueCode.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ZodIssueCode.custom:r="Invalid input";break;case ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ZodIssueCode.not_finite:r="Number must be finite";break;default:r=t.defaultError,util.assertNever(e)}return{message:r}};let overrideErrorMap=errorMap;function setErrorMap(e){overrideErrorMap=e}function getErrorMap(){return overrideErrorMap}const makeIssue=e=>{const{data:t,path:r,errorMaps:o,issueData:n}=e,i=[...r,...n.path||[]],a={...n,path:i};if(void 0!==n.message)return{...n,path:i,message:n.message};let s="";const c=o.filter((e=>!!e)).slice().reverse();for(const u of c)s=u(a,{data:t,defaultError:s}).message;return{...n,path:i,message:s}},EMPTY_PATH=[];function addIssueToContext(e,t){const r=getErrorMap(),o=makeIssue({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===errorMap?void 0:errorMap].filter((e=>!!e))});e.common.issues.push(o)}class ParseStatus{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const o of t){if("aborted"===o.status)return INVALID;"dirty"===o.status&&e.dirty(),r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const o of t){const e=await o.key,t=await o.value;r.push({key:e,value:t})}return ParseStatus.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const o of t){const{key:t,value:n}=o;if("aborted"===t.status)return INVALID;if("aborted"===n.status)return INVALID;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"===t.value||void 0===n.value&&!o.alwaysSet||(r[t.value]=n.value)}return{status:e.value,value:r}}}const INVALID=Object.freeze({status:"aborted"}),DIRTY=e=>({status:"dirty",value:e}),OK=e=>({status:"valid",value:e}),isAborted=e=>"aborted"===e.status,isDirty=e=>"dirty"===e.status,isValid=e=>"valid"===e.status,isAsync=e=>"undefined"!=typeof Promise&&e instanceof Promise;function __classPrivateFieldGet(e,t,r,o){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function __classPrivateFieldSet(e,t,r,o,n){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,r),r}var errorUtil,errorUtil2,_ZodEnum_cache,_ZodNativeEnum_cache;"function"==typeof SuppressedError&&SuppressedError,errorUtil2=errorUtil||(errorUtil={}),errorUtil2.errToObj=e=>"string"==typeof e?{message:e}:e||{},errorUtil2.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class ParseInputLazyPath{constructor(e,t,r,o){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(e,t)=>{if(isValid(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new ZodError(e.common.issues);return this._error=t,this._error}}};function processCreateParams(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:o,description:n}=e;if(t&&(r||o))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:n};return{errorMap:(t,n)=>{var i,a;const{message:s}=e;return"invalid_enum_value"===t.code?{message:null!=s?s:n.defaultError}:void 0===n.data?{message:null!==(i=null!=s?s:o)&&void 0!==i?i:n.defaultError}:"invalid_type"!==t.code?{message:n.defaultError}:{message:null!==(a=null!=s?s:r)&&void 0!==a?a:n.defaultError}},description:n}}class ZodType{get description(){return this._def.description}_getType(e){return getParsedType(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(isAsync(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const o={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},n=this._parseSync({data:e,path:o.path,parent:o});return handleResult(o,n)}"~validate"(e){var t,r;const o={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:o});return isValid(t)?{value:t.value}:{issues:o.common.issues}}catch(n){(null===(r=null===(t=null==n?void 0:n.message)||void 0===t?void 0:t.toLowerCase())||void 0===r?void 0:r.includes("encountered"))&&(this["~standard"].async=!0),o.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:o}).then((e=>isValid(e)?{value:e.value}:{issues:o.common.issues}))}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},o=this._parse({data:e,path:r.path,parent:r}),n=await(isAsync(o)?o:Promise.resolve(o));return handleResult(r,n)}refine(e,t){const r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,o)=>{const n=e(t),i=()=>o.addIssue({code:ZodIssueCode.custom,...r(t)});return"undefined"!=typeof Promise&&n instanceof Promise?n.then((e=>!!e||(i(),!1))):!!n||(i(),!1)}))}refinement(e,t){return this._refinement(((r,o)=>!!e(r)||(o.addIssue("function"==typeof t?t(r,o):t),!1)))}_refinement(e){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this)}promise(){return ZodPromise.create(this,this._def)}or(e){return ZodUnion.create([this,e],this._def)}and(e){return ZodIntersection.create(this,e,this._def)}transform(e){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:t,typeName:ZodFirstPartyTypeKind.ZodDefault})}brand(){return new ZodBranded({typeName:ZodFirstPartyTypeKind.ZodBranded,type:this,...processCreateParams(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:t,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ZodPipeline.create(this,e)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cuidRegex=/^c[^\s-]{8,}$/i,cuid2Regex=/^[0-9a-z]+$/,ulidRegex=/^[0-9A-HJKMNP-TV-Z]{26}$/i,uuidRegex=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nanoidRegex=/^[a-z0-9_-]{21}$/i,jwtRegex=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,durationRegex=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,emailRegex=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_emojiRegex="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let emojiRegex;const ipv4Regex=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4CidrRegex=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6Regex=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ipv6CidrRegex=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64Regex=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64urlRegex=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,dateRegexSource="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",dateRegex=new RegExp(`^${dateRegexSource}$`);function timeRegexSource(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function timeRegex(e){return new RegExp(`^${timeRegexSource(e)}$`)}function datetimeRegex(e){let t=`${dateRegexSource}T${timeRegexSource(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function isValidIP(e,t){return!("v4"!==t&&t||!ipv4Regex.test(e))||!("v6"!==t&&t||!ipv6Regex.test(e))}function isValidJWT(e,t){if(!jwtRegex.test(e))return!1;try{const[r]=e.split("."),o=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(o));return"object"==typeof n&&null!==n&&(!(!n.typ||!n.alg)&&(!t||n.alg===t))}catch(r){return!1}}function isValidCidr(e,t){return!("v4"!==t&&t||!ipv4CidrRegex.test(e))||!("v6"!==t&&t||!ipv6CidrRegex.test(e))}class ZodString extends ZodType{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==ZodParsedType.string){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:t.parsedType}),INVALID}const t=new ParseStatus;let r;for(const n of this._def.checks)if("min"===n.kind)e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("max"===n.kind)e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("length"===n.kind){const o=e.data.length>n.value,i=e.data.length<n.value;(o||i)&&(r=this._getOrReturnCtx(e,r),o?addIssueToContext(r,{code:ZodIssueCode.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&addIssueToContext(r,{code:ZodIssueCode.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if("email"===n.kind)emailRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"email",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty());else if("emoji"===n.kind)emojiRegex||(emojiRegex=new RegExp(_emojiRegex,"u")),emojiRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"emoji",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty());else if("uuid"===n.kind)uuidRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"uuid",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty());else if("nanoid"===n.kind)nanoidRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"nanoid",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty());else if("cuid"===n.kind)cuidRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"cuid",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty());else if("cuid2"===n.kind)cuid2Regex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"cuid2",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty());else if("ulid"===n.kind)ulidRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"ulid",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty());else if("url"===n.kind)try{new URL(e.data)}catch(o){r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"url",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty()}else if("regex"===n.kind){n.regex.lastIndex=0;n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"regex",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty())}else if("trim"===n.kind)e.data=e.data.trim();else if("includes"===n.kind)e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty());else if("toLowerCase"===n.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===n.kind)e.data=e.data.toUpperCase();else if("startsWith"===n.kind)e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty());else if("endsWith"===n.kind)e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty());else if("datetime"===n.kind){datetimeRegex(n).test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:"datetime",message:n.message}),t.dirty())}else if("date"===n.kind){dateRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:"date",message:n.message}),t.dirty())}else if("time"===n.kind){timeRegex(n).test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:"time",message:n.message}),t.dirty())}else"duration"===n.kind?durationRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"duration",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty()):"ip"===n.kind?isValidIP(e.data,n.version)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"ip",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty()):"jwt"===n.kind?isValidJWT(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"jwt",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty()):"cidr"===n.kind?isValidCidr(e.data,n.version)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"cidr",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty()):"base64"===n.kind?base64Regex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"base64",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty()):"base64url"===n.kind?base64urlRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"base64url",code:ZodIssueCode.invalid_string,message:n.message}),t.dirty()):util.assertNever(n);return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement((t=>e.test(t)),{validation:t,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(r)})}_addCheck(e){return new ZodString({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...errorUtil.errToObj(e)})}datetime(e){var t,r;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(r=null==e?void 0:e.local)&&void 0!==r&&r,...errorUtil.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...errorUtil.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...errorUtil.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...errorUtil.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...errorUtil.errToObj(t)})}nonempty(e){return this.min(1,errorUtil.errToObj(e))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function floatSafeRemainder(e,t){const r=(e.toString().split(".")[1]||"").length,o=(t.toString().split(".")[1]||"").length,n=r>o?r:o;return parseInt(e.toFixed(n).replace(".",""))%parseInt(t.toFixed(n).replace(".",""))/Math.pow(10,n)}ZodString.create=e=>{var t;return new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==ZodParsedType.number){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.number,received:t.parsedType}),INVALID}let t;const r=new ParseStatus;for(const o of this._def.checks)if("int"===o.kind)util.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:"integer",received:"float",message:o.message}),r.dirty());else if("min"===o.kind){(o.inclusive?e.data<o.value:e.data<=o.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty())}else if("max"===o.kind){(o.inclusive?e.data>o.value:e.data>=o.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty())}else"multipleOf"===o.kind?0!==floatSafeRemainder(e.data,o.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.not_multiple_of,multipleOf:o.value,message:o.message}),r.dirty()):"finite"===o.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.not_finite,message:o.message}),r.dirty()):util.assertNever(o);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,errorUtil.toString(t))}setLimit(e,t,r,o){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:errorUtil.toString(o)}]})}_addCheck(e){return new ZodNumber({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&util.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ZodNumber.create=e=>new ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(o){return this._getInvalidInput(e)}if(this._getType(e)!==ZodParsedType.bigint)return this._getInvalidInput(e);let t;const r=new ParseStatus;for(const n of this._def.checks)if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty())}else"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):util.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.bigint,received:t.parsedType}),INVALID}gte(e,t){return this.setLimit("min",e,!0,errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,errorUtil.toString(t))}setLimit(e,t,r,o){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:errorUtil.toString(o)}]})}_addCheck(e){return new ZodBigInt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:errorUtil.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ZodBigInt.create=e=>{var t;return new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodBoolean extends ZodType{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==ZodParsedType.boolean){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:t.parsedType}),INVALID}return OK(e.data)}}ZodBoolean.create=e=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodDate extends ZodType{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==ZodParsedType.date){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:t.parsedType}),INVALID}if(isNaN(e.data.getTime())){return addIssueToContext(this._getOrReturnCtx(e),{code:ZodIssueCode.invalid_date}),INVALID}const t=new ParseStatus;let r;for(const o of this._def.checks)"min"===o.kind?e.data.getTime()<o.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),t.dirty()):"max"===o.kind?e.data.getTime()>o.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),t.dirty()):util.assertNever(o);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ZodDate({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:errorUtil.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ZodDate.create=e=>new ZodDate({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(e)});class ZodSymbol extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.symbol){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:t.parsedType}),INVALID}return OK(e.data)}}ZodSymbol.create=e=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(e)});class ZodUndefined extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:t.parsedType}),INVALID}return OK(e.data)}}ZodUndefined.create=e=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(e)});class ZodNull extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.null){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:t.parsedType}),INVALID}return OK(e.data)}}ZodNull.create=e=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(e)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(e){return OK(e.data)}}ZodAny.create=e=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(e)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(e){return OK(e.data)}}ZodUnknown.create=e=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(e)});class ZodNever extends ZodType{_parse(e){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:t.parsedType}),INVALID}}ZodNever.create=e=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(e)});class ZodVoid extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:t.parsedType}),INVALID}return OK(e.data)}}ZodVoid.create=e=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(e)});class ZodArray extends ZodType{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),o=this._def;if(t.parsedType!==ZodParsedType.array)return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:t.parsedType}),INVALID;if(null!==o.exactLength){const e=t.data.length>o.exactLength.value,n=t.data.length<o.exactLength.value;(e||n)&&(addIssueToContext(t,{code:e?ZodIssueCode.too_big:ZodIssueCode.too_small,minimum:n?o.exactLength.value:void 0,maximum:e?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(null!==o.minLength&&t.data.length<o.minLength.value&&(addIssueToContext(t,{code:ZodIssueCode.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),null!==o.maxLength&&t.data.length>o.maxLength.value&&(addIssueToContext(t,{code:ZodIssueCode.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map(((e,r)=>o.type._parseAsync(new ParseInputLazyPath(t,e,t.path,r))))).then((e=>ParseStatus.mergeArray(r,e)));const n=[...t.data].map(((e,r)=>o.type._parseSync(new ParseInputLazyPath(t,e,t.path,r))));return ParseStatus.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new ZodArray({...this._def,minLength:{value:e,message:errorUtil.toString(t)}})}max(e,t){return new ZodArray({...this._def,maxLength:{value:e,message:errorUtil.toString(t)}})}length(e,t){return new ZodArray({...this._def,exactLength:{value:e,message:errorUtil.toString(t)}})}nonempty(e){return this.min(1,e)}}function deepPartialify(e){if(e instanceof ZodObject){const t={};for(const r in e.shape){const o=e.shape[r];t[r]=ZodOptional.create(deepPartialify(o))}return new ZodObject({...e._def,shape:()=>t})}return e instanceof ZodArray?new ZodArray({...e._def,type:deepPartialify(e.element)}):e instanceof ZodOptional?ZodOptional.create(deepPartialify(e.unwrap())):e instanceof ZodNullable?ZodNullable.create(deepPartialify(e.unwrap())):e instanceof ZodTuple?ZodTuple.create(e.items.map((e=>deepPartialify(e)))):e}ZodArray.create=(e,t)=>new ZodArray({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(t)});class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=util.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==ZodParsedType.object){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:t.parsedType}),INVALID}const{status:t,ctx:r}=this._processInputParams(e),{shape:o,keys:n}=this._getCached(),i=[];if(!(this._def.catchall instanceof ZodNever&&"strip"===this._def.unknownKeys))for(const s in r.data)n.includes(s)||i.push(s);const a=[];for(const s of n){const e=o[s],t=r.data[s];a.push({key:{status:"valid",value:s},value:e._parse(new ParseInputLazyPath(r,t,r.path,s)),alwaysSet:s in r.data})}if(this._def.catchall instanceof ZodNever){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of i)a.push({key:{status:"valid",value:t},value:{status:"valid",value:r.data[t]}});else if("strict"===e)i.length>0&&(addIssueToContext(r,{code:ZodIssueCode.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const o=r.data[t];a.push({key:{status:"valid",value:t},value:e._parse(new ParseInputLazyPath(r,o,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of a){const r=await t.key,o=await t.value;e.push({key:r,value:o,alwaysSet:t.alwaysSet})}return e})).then((e=>ParseStatus.mergeObjectSync(t,e))):ParseStatus.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return errorUtil.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var o,n,i,a;const s=null!==(i=null===(n=(o=this._def).errorMap)||void 0===n?void 0:n.call(o,t,r).message)&&void 0!==i?i:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(a=errorUtil.errToObj(e).message)&&void 0!==a?a:s}:{message:s}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(e){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ZodObject({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ZodObject({...this._def,catchall:e})}pick(e){const t={};return util.objectKeys(e).forEach((r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])})),new ZodObject({...this._def,shape:()=>t})}omit(e){const t={};return util.objectKeys(this.shape).forEach((r=>{e[r]||(t[r]=this.shape[r])})),new ZodObject({...this._def,shape:()=>t})}deepPartial(){return deepPartialify(this)}partial(e){const t={};return util.objectKeys(this.shape).forEach((r=>{const o=this.shape[r];e&&!e[r]?t[r]=o:t[r]=o.optional()})),new ZodObject({...this._def,shape:()=>t})}required(e){const t={};return util.objectKeys(this.shape).forEach((r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof ZodOptional;)e=e._def.innerType;t[r]=e}})),new ZodObject({...this._def,shape:()=>t})}keyof(){return createZodEnum(util.objectKeys(this.shape))}}ZodObject.create=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(t)}),ZodObject.strictCreate=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strict",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(t)}),ZodObject.lazycreate=(e,t)=>new ZodObject({shape:e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(t)});class ZodUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map((async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const o of e)if("dirty"===o.result.status)return t.common.issues.push(...o.ctx.common.issues),o.result;const r=e.map((e=>new ZodError(e.ctx.common.issues)));return addIssueToContext(t,{code:ZodIssueCode.invalid_union,unionErrors:r}),INVALID}));{let e;const o=[];for(const i of r){const r={...t,common:{...t.common,issues:[]},parent:null},n=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===n.status)return n;"dirty"!==n.status||e||(e={result:n,ctx:r}),r.common.issues.length&&o.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const n=o.map((e=>new ZodError(e)));return addIssueToContext(t,{code:ZodIssueCode.invalid_union,unionErrors:n}),INVALID}}get options(){return this._def.options}}ZodUnion.create=(e,t)=>new ZodUnion({options:e,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(t)});const getDiscriminator=e=>e instanceof ZodLazy?getDiscriminator(e.schema):e instanceof ZodEffects?getDiscriminator(e.innerType()):e instanceof ZodLiteral?[e.value]:e instanceof ZodEnum?e.options:e instanceof ZodNativeEnum?util.objectValues(e.enum):e instanceof ZodDefault?getDiscriminator(e._def.innerType):e instanceof ZodUndefined?[void 0]:e instanceof ZodNull?[null]:e instanceof ZodOptional?[void 0,...getDiscriminator(e.unwrap())]:e instanceof ZodNullable?[null,...getDiscriminator(e.unwrap())]:e instanceof ZodBranded||e instanceof ZodReadonly?getDiscriminator(e.unwrap()):e instanceof ZodCatch?getDiscriminator(e._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ZodParsedType.object)return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:t.parsedType}),INVALID;const r=this.discriminator,o=t.data[r],n=this.optionsMap.get(o);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(addIssueToContext(t,{code:ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const o=new Map;for(const n of t){const t=getDiscriminator(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const r of t){if(o.has(r))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(r)}`);o.set(r,n)}}return new ZodDiscriminatedUnion({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:o,...processCreateParams(r)})}}function mergeValues(e,t){const r=getParsedType(e),o=getParsedType(t);if(e===t)return{valid:!0,data:e};if(r===ZodParsedType.object&&o===ZodParsedType.object){const r=util.objectKeys(t),o=util.objectKeys(e).filter((e=>-1!==r.indexOf(e))),n={...e,...t};for(const i of o){const r=mergeValues(e[i],t[i]);if(!r.valid)return{valid:!1};n[i]=r.data}return{valid:!0,data:n}}if(r===ZodParsedType.array&&o===ZodParsedType.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let o=0;o<e.length;o++){const n=mergeValues(e[o],t[o]);if(!n.valid)return{valid:!1};r.push(n.data)}return{valid:!0,data:r}}return r===ZodParsedType.date&&o===ZodParsedType.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class ZodIntersection extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),o=(e,o)=>{if(isAborted(e)||isAborted(o))return INVALID;const n=mergeValues(e.value,o.value);return n.valid?((isDirty(e)||isDirty(o))&&t.dirty(),{status:t.value,value:n.data}):(addIssueToContext(r,{code:ZodIssueCode.invalid_intersection_types}),INVALID)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>o(e,t))):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ZodIntersection.create=(e,t,r)=>new ZodIntersection({left:e,right:t,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams(r)});class ZodTuple extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ZodParsedType.array)return addIssueToContext(r,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:r.parsedType}),INVALID;if(r.data.length<this._def.items.length)return addIssueToContext(r,{code:ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),INVALID;!this._def.rest&&r.data.length>this._def.items.length&&(addIssueToContext(r,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const o=[...r.data].map(((e,t)=>{const o=this._def.items[t]||this._def.rest;return o?o._parse(new ParseInputLazyPath(r,e,r.path,t)):null})).filter((e=>!!e));return r.common.async?Promise.all(o).then((e=>ParseStatus.mergeArray(t,e))):ParseStatus.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new ZodTuple({...this._def,rest:e})}}ZodTuple.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:e,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(t)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ZodParsedType.object)return addIssueToContext(r,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:r.parsedType}),INVALID;const o=[],n=this._def.keyType,i=this._def.valueType;for(const a in r.data)o.push({key:n._parse(new ParseInputLazyPath(r,a,r.path,a)),value:i._parse(new ParseInputLazyPath(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?ParseStatus.mergeObjectAsync(t,o):ParseStatus.mergeObjectSync(t,o)}get element(){return this._def.valueType}static create(e,t,r){return new ZodRecord(t instanceof ZodType?{keyType:e,valueType:t,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(r)}:{keyType:ZodString.create(),valueType:e,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(t)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ZodParsedType.map)return addIssueToContext(r,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:r.parsedType}),INVALID;const o=this._def.keyType,n=this._def.valueType,i=[...r.data.entries()].map((([e,t],i)=>({key:o._parse(new ParseInputLazyPath(r,e,r.path,[i,"key"])),value:n._parse(new ParseInputLazyPath(r,t,r.path,[i,"value"]))})));if(r.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const r of i){const o=await r.key,n=await r.value;if("aborted"===o.status||"aborted"===n.status)return INVALID;"dirty"!==o.status&&"dirty"!==n.status||t.dirty(),e.set(o.value,n.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const r of i){const o=r.key,n=r.value;if("aborted"===o.status||"aborted"===n.status)return INVALID;"dirty"!==o.status&&"dirty"!==n.status||t.dirty(),e.set(o.value,n.value)}return{status:t.value,value:e}}}}ZodMap.create=(e,t,r)=>new ZodMap({valueType:t,keyType:e,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams(r)});class ZodSet extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ZodParsedType.set)return addIssueToContext(r,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:r.parsedType}),INVALID;const o=this._def;null!==o.minSize&&r.data.size<o.minSize.value&&(addIssueToContext(r,{code:ZodIssueCode.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),t.dirty()),null!==o.maxSize&&r.data.size>o.maxSize.value&&(addIssueToContext(r,{code:ZodIssueCode.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),t.dirty());const n=this._def.valueType;function i(e){const r=new Set;for(const o of e){if("aborted"===o.status)return INVALID;"dirty"===o.status&&t.dirty(),r.add(o.value)}return{status:t.value,value:r}}const a=[...r.data.values()].map(((e,t)=>n._parse(new ParseInputLazyPath(r,e,r.path,t))));return r.common.async?Promise.all(a).then((e=>i(e))):i(a)}min(e,t){return new ZodSet({...this._def,minSize:{value:e,message:errorUtil.toString(t)}})}max(e,t){return new ZodSet({...this._def,maxSize:{value:e,message:errorUtil.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ZodSet.create=(e,t)=>new ZodSet({valueType:e,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(t)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ZodParsedType.function)return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.function,received:t.parsedType}),INVALID;function r(e,r){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:ZodIssueCode.invalid_arguments,argumentsError:r}})}function o(e,r){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:ZodIssueCode.invalid_return_type,returnTypeError:r}})}const n={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof ZodPromise){const e=this;return OK((async function(...t){const a=new ZodError([]),s=await e._def.args.parseAsync(t,n).catch((e=>{throw a.addIssue(r(t,e)),a})),c=await Reflect.apply(i,this,s);return await e._def.returns._def.type.parseAsync(c,n).catch((e=>{throw a.addIssue(o(c,e)),a}))}))}{const e=this;return OK((function(...t){const a=e._def.args.safeParse(t,n);if(!a.success)throw new ZodError([r(t,a.error)]);const s=Reflect.apply(i,this,a.data),c=e._def.returns.safeParse(s,n);if(!c.success)throw new ZodError([o(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ZodFunction({...this._def,args:ZodTuple.create(e).rest(ZodUnknown.create())})}returns(e){return new ZodFunction({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new ZodFunction({args:e||ZodTuple.create([]).rest(ZodUnknown.create()),returns:t||ZodUnknown.create(),typeName:ZodFirstPartyTypeKind.ZodFunction,...processCreateParams(r)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ZodLazy.create=(e,t)=>new ZodLazy({getter:e,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(t)});class ZodLiteral extends ZodType{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{received:t.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}}function createZodEnum(e,t){return new ZodEnum({values:e,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(t)})}ZodLiteral.create=(e,t)=>new ZodLiteral({value:e,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(t)});class ZodEnum extends ZodType{constructor(){super(...arguments),_ZodEnum_cache.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return addIssueToContext(t,{expected:util.joinValues(r),received:t.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(__classPrivateFieldGet(this,_ZodEnum_cache)||__classPrivateFieldSet(this,_ZodEnum_cache,new Set(this._def.values)),!__classPrivateFieldGet(this,_ZodEnum_cache).has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return addIssueToContext(t,{received:t.data,code:ZodIssueCode.invalid_enum_value,options:r}),INVALID}return OK(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ZodEnum.create(e,{...this._def,...t})}exclude(e,t=this._def){return ZodEnum.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}_ZodEnum_cache=new WeakMap,ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),_ZodNativeEnum_cache.set(this,void 0)}_parse(e){const t=util.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==ZodParsedType.string&&r.parsedType!==ZodParsedType.number){const e=util.objectValues(t);return addIssueToContext(r,{expected:util.joinValues(e),received:r.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(__classPrivateFieldGet(this,_ZodNativeEnum_cache)||__classPrivateFieldSet(this,_ZodNativeEnum_cache,new Set(util.getValidEnumValues(this._def.values))),!__classPrivateFieldGet(this,_ZodNativeEnum_cache).has(e.data)){const e=util.objectValues(t);return addIssueToContext(r,{received:r.data,code:ZodIssueCode.invalid_enum_value,options:e}),INVALID}return OK(e.data)}get enum(){return this._def.values}}_ZodNativeEnum_cache=new WeakMap,ZodNativeEnum.create=(e,t)=>new ZodNativeEnum({values:e,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(t)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ZodParsedType.promise&&!1===t.common.async)return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.promise,received:t.parsedType}),INVALID;const r=t.parsedType===ZodParsedType.promise?t.data:Promise.resolve(t.data);return OK(r.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}ZodPromise.create=(e,t)=>new ZodPromise({type:e,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(t)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ZodFirstPartyTypeKind.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),o=this._def.effect||null,n={addIssue:e=>{addIssueToContext(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),"preprocess"===o.type){const e=o.transform(r.data,n);if(r.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return INVALID;const o=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===o.status?INVALID:"dirty"===o.status||"dirty"===t.value?DIRTY(o.value):o}));{if("aborted"===t.value)return INVALID;const o=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===o.status?INVALID:"dirty"===o.status||"dirty"===t.value?DIRTY(o.value):o}}if("refinement"===o.type){const e=e=>{const t=o.refinement(e,n);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===o.status?INVALID:("dirty"===o.status&&t.dirty(),e(o.value),{status:t.value,value:o.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((r=>"aborted"===r.status?INVALID:("dirty"===r.status&&t.dirty(),e(r.value).then((()=>({status:t.value,value:r.value}))))))}if("transform"===o.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!isValid(e))return e;const i=o.transform(e.value,n);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>isValid(e)?Promise.resolve(o.transform(e.value,n)).then((e=>({status:t.value,value:e}))):e))}util.assertNever(o)}}ZodEffects.create=(e,t,r)=>new ZodEffects({schema:e,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:t,...processCreateParams(r)}),ZodEffects.createWithPreprocess=(e,t,r)=>new ZodEffects({schema:t,effect:{type:"preprocess",transform:e},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams(r)});class ZodOptional extends ZodType{_parse(e){return this._getType(e)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodOptional.create=(e,t)=>new ZodOptional({innerType:e,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(t)});class ZodNullable extends ZodType{_parse(e){return this._getType(e)===ZodParsedType.null?OK(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodNullable.create=(e,t)=>new ZodNullable({innerType:e,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(t)});class ZodDefault extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===ZodParsedType.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ZodDefault.create=(e,t)=>new ZodDefault({innerType:e,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...processCreateParams(t)});class ZodCatch extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return isAsync(o)?o.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new ZodError(r.common.issues)},input:r.data})}))):{status:"valid",value:"valid"===o.status?o.value:this._def.catchValue({get error(){return new ZodError(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(e,t)=>new ZodCatch({innerType:e,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...processCreateParams(t)});class ZodNaN extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.nan){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:t.parsedType}),INVALID}return{status:"valid",value:e.data}}}ZodNaN.create=e=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(e)});const BRAND=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?INVALID:"dirty"===e.status?(t.dirty(),DIRTY(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})()}{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?INVALID:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new ZodPipeline({in:e,out:t,typeName:ZodFirstPartyTypeKind.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(e){const t=this._def.innerType._parse(e),r=e=>(isValid(e)&&(e.value=Object.freeze(e.value)),e);return isAsync(t)?t.then((e=>r(e))):r(t)}unwrap(){return this._def.innerType}}function cleanParams(e,t){const r="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof r?{message:r}:r}function custom(e,t={},r){return e?ZodAny.create().superRefine(((o,n)=>{var i,a;const s=e(o);if(s instanceof Promise)return s.then((e=>{var i,a;if(!e){const e=cleanParams(t,o),s=null===(a=null!==(i=e.fatal)&&void 0!==i?i:r)||void 0===a||a;n.addIssue({code:"custom",...e,fatal:s})}}));if(!s){const e=cleanParams(t,o),s=null===(a=null!==(i=e.fatal)&&void 0!==i?i:r)||void 0===a||a;n.addIssue({code:"custom",...e,fatal:s})}})):ZodAny.create()}ZodReadonly.create=(e,t)=>new ZodReadonly({innerType:e,typeName:ZodFirstPartyTypeKind.ZodReadonly,...processCreateParams(t)});const late={object:ZodObject.lazycreate};var ZodFirstPartyTypeKind,ZodFirstPartyTypeKind2;ZodFirstPartyTypeKind2=ZodFirstPartyTypeKind||(ZodFirstPartyTypeKind={}),ZodFirstPartyTypeKind2.ZodString="ZodString",ZodFirstPartyTypeKind2.ZodNumber="ZodNumber",ZodFirstPartyTypeKind2.ZodNaN="ZodNaN",ZodFirstPartyTypeKind2.ZodBigInt="ZodBigInt",ZodFirstPartyTypeKind2.ZodBoolean="ZodBoolean",ZodFirstPartyTypeKind2.ZodDate="ZodDate",ZodFirstPartyTypeKind2.ZodSymbol="ZodSymbol",ZodFirstPartyTypeKind2.ZodUndefined="ZodUndefined",ZodFirstPartyTypeKind2.ZodNull="ZodNull",ZodFirstPartyTypeKind2.ZodAny="ZodAny",ZodFirstPartyTypeKind2.ZodUnknown="ZodUnknown",ZodFirstPartyTypeKind2.ZodNever="ZodNever",ZodFirstPartyTypeKind2.ZodVoid="ZodVoid",ZodFirstPartyTypeKind2.ZodArray="ZodArray",ZodFirstPartyTypeKind2.ZodObject="ZodObject",ZodFirstPartyTypeKind2.ZodUnion="ZodUnion",ZodFirstPartyTypeKind2.ZodDiscriminatedUnion="ZodDiscriminatedUnion",ZodFirstPartyTypeKind2.ZodIntersection="ZodIntersection",ZodFirstPartyTypeKind2.ZodTuple="ZodTuple",ZodFirstPartyTypeKind2.ZodRecord="ZodRecord",ZodFirstPartyTypeKind2.ZodMap="ZodMap",ZodFirstPartyTypeKind2.ZodSet="ZodSet",ZodFirstPartyTypeKind2.ZodFunction="ZodFunction",ZodFirstPartyTypeKind2.ZodLazy="ZodLazy",ZodFirstPartyTypeKind2.ZodLiteral="ZodLiteral",ZodFirstPartyTypeKind2.ZodEnum="ZodEnum",ZodFirstPartyTypeKind2.ZodEffects="ZodEffects",ZodFirstPartyTypeKind2.ZodNativeEnum="ZodNativeEnum",ZodFirstPartyTypeKind2.ZodOptional="ZodOptional",ZodFirstPartyTypeKind2.ZodNullable="ZodNullable",ZodFirstPartyTypeKind2.ZodDefault="ZodDefault",ZodFirstPartyTypeKind2.ZodCatch="ZodCatch",ZodFirstPartyTypeKind2.ZodPromise="ZodPromise",ZodFirstPartyTypeKind2.ZodBranded="ZodBranded",ZodFirstPartyTypeKind2.ZodPipeline="ZodPipeline",ZodFirstPartyTypeKind2.ZodReadonly="ZodReadonly";const instanceOfType=(e,t={message:`Input not instance of ${e.name}`})=>custom((t=>t instanceof e),t),stringType=ZodString.create,numberType=ZodNumber.create,nanType=ZodNaN.create,bigIntType=ZodBigInt.create,booleanType=ZodBoolean.create,dateType=ZodDate.create,symbolType=ZodSymbol.create,undefinedType=ZodUndefined.create,nullType=ZodNull.create,anyType=ZodAny.create,unknownType=ZodUnknown.create,neverType=ZodNever.create,voidType=ZodVoid.create,arrayType=ZodArray.create,objectType=ZodObject.create,strictObjectType=ZodObject.strictCreate,unionType=ZodUnion.create,discriminatedUnionType=ZodDiscriminatedUnion.create,intersectionType=ZodIntersection.create,tupleType=ZodTuple.create,recordType=ZodRecord.create,mapType=ZodMap.create,setType=ZodSet.create,functionType=ZodFunction.create,lazyType=ZodLazy.create,literalType=ZodLiteral.create,enumType=ZodEnum.create,nativeEnumType=ZodNativeEnum.create,promiseType=ZodPromise.create,effectsType=ZodEffects.create,optionalType=ZodOptional.create,nullableType=ZodNullable.create,preprocessType=ZodEffects.createWithPreprocess,pipelineType=ZodPipeline.create,ostring=()=>stringType().optional(),onumber=()=>numberType().optional(),oboolean=()=>booleanType().optional(),coerce={string:e=>ZodString.create({...e,coerce:!0}),number:e=>ZodNumber.create({...e,coerce:!0}),boolean:e=>ZodBoolean.create({...e,coerce:!0}),bigint:e=>ZodBigInt.create({...e,coerce:!0}),date:e=>ZodDate.create({...e,coerce:!0})},NEVER=INVALID;var z=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap:setErrorMap,getErrorMap:getErrorMap,makeIssue:makeIssue,EMPTY_PATH:EMPTY_PATH,addIssueToContext:addIssueToContext,ParseStatus:ParseStatus,INVALID:INVALID,DIRTY:DIRTY,OK:OK,isAborted:isAborted,isDirty:isDirty,isValid:isValid,isAsync:isAsync,get util(){return util},get objectUtil(){return objectUtil},ZodParsedType:ZodParsedType,getParsedType:getParsedType,ZodType:ZodType,datetimeRegex:datetimeRegex,ZodString:ZodString,ZodNumber:ZodNumber,ZodBigInt:ZodBigInt,ZodBoolean:ZodBoolean,ZodDate:ZodDate,ZodSymbol:ZodSymbol,ZodUndefined:ZodUndefined,ZodNull:ZodNull,ZodAny:ZodAny,ZodUnknown:ZodUnknown,ZodNever:ZodNever,ZodVoid:ZodVoid,ZodArray:ZodArray,ZodObject:ZodObject,ZodUnion:ZodUnion,ZodDiscriminatedUnion:ZodDiscriminatedUnion,ZodIntersection:ZodIntersection,ZodTuple:ZodTuple,ZodRecord:ZodRecord,ZodMap:ZodMap,ZodSet:ZodSet,ZodFunction:ZodFunction,ZodLazy:ZodLazy,ZodLiteral:ZodLiteral,ZodEnum:ZodEnum,ZodNativeEnum:ZodNativeEnum,ZodPromise:ZodPromise,ZodEffects:ZodEffects,ZodTransformer:ZodEffects,ZodOptional:ZodOptional,ZodNullable:ZodNullable,ZodDefault:ZodDefault,ZodCatch:ZodCatch,ZodNaN:ZodNaN,BRAND:BRAND,ZodBranded:ZodBranded,ZodPipeline:ZodPipeline,ZodReadonly:ZodReadonly,custom:custom,Schema:ZodType,ZodSchema:ZodType,late:late,get ZodFirstPartyTypeKind(){return ZodFirstPartyTypeKind},coerce:coerce,any:anyType,array:arrayType,bigint:bigIntType,boolean:booleanType,date:dateType,discriminatedUnion:discriminatedUnionType,effect:effectsType,enum:enumType,function:functionType,instanceof:instanceOfType,intersection:intersectionType,lazy:lazyType,literal:literalType,map:mapType,nan:nanType,nativeEnum:nativeEnumType,never:neverType,null:nullType,nullable:nullableType,number:numberType,object:objectType,oboolean:oboolean,onumber:onumber,optional:optionalType,ostring:ostring,pipeline:pipelineType,preprocess:preprocessType,promise:promiseType,record:recordType,set:setType,strictObject:strictObjectType,string:stringType,symbol:symbolType,transformer:effectsType,tuple:tupleType,undefined:undefinedType,union:unionType,unknown:unknownType,void:voidType,NEVER:NEVER,ZodIssueCode:ZodIssueCode,quotelessJson:quotelessJson,ZodError:ZodError}),ProfileType=(e=>(e[e.PERSONAL=0]="PERSONAL",e[e.AI_AGENT=1]="AI_AGENT",e))(ProfileType||{}),AIAgentType=(e=>(e[e.MANUAL=0]="MANUAL",e[e.AUTONOMOUS=1]="AUTONOMOUS",e))(AIAgentType||{}),EndpointType=(e=>(e[e.REST=0]="REST",e[e.WEBSOCKET=1]="WEBSOCKET",e[e.GRPC=2]="GRPC",e))(EndpointType||{}),AIAgentCapability=(e=>(e[e.TEXT_GENERATION=0]="TEXT_GENERATION",e[e.IMAGE_GENERATION=1]="IMAGE_GENERATION",e[e.AUDIO_GENERATION=2]="AUDIO_GENERATION",e[e.VIDEO_GENERATION=3]="VIDEO_GENERATION",e[e.CODE_GENERATION=4]="CODE_GENERATION",e[e.LANGUAGE_TRANSLATION=5]="LANGUAGE_TRANSLATION",e[e.SUMMARIZATION_EXTRACTION=6]="SUMMARIZATION_EXTRACTION",e[e.KNOWLEDGE_RETRIEVAL=7]="KNOWLEDGE_RETRIEVAL",e[e.DATA_INTEGRATION=8]="DATA_INTEGRATION",e[e.MARKET_INTELLIGENCE=9]="MARKET_INTELLIGENCE",e[e.TRANSACTION_ANALYTICS=10]="TRANSACTION_ANALYTICS",e[e.SMART_CONTRACT_AUDIT=11]="SMART_CONTRACT_AUDIT",e[e.GOVERNANCE_FACILITATION=12]="GOVERNANCE_FACILITATION",e[e.SECURITY_MONITORING=13]="SECURITY_MONITORING",e[e.COMPLIANCE_ANALYSIS=14]="COMPLIANCE_ANALYSIS",e[e.FRAUD_DETECTION=15]="FRAUD_DETECTION",e[e.MULTI_AGENT_COORDINATION=16]="MULTI_AGENT_COORDINATION",e[e.API_INTEGRATION=17]="API_INTEGRATION",e[e.WORKFLOW_AUTOMATION=18]="WORKFLOW_AUTOMATION",e))(AIAgentCapability||{});const SUPPORTED_SOCIAL_PLATFORMS=["twitter","github","discord","telegram","linkedin","youtube"],SocialLinkSchema=z.object({platform:z.string().min(1),handle:z.string().min(1)}),AIAgentDetailsSchema=z.object({type:z.nativeEnum(AIAgentType),capabilities:z.array(z.nativeEnum(AIAgentCapability)).min(1),model:z.string().min(1),creator:z.string().optional()}),BaseProfileSchema=z.object({version:z.string().min(1),type:z.nativeEnum(ProfileType),display_name:z.string().min(1),alias:z.string().optional(),bio:z.string().optional(),socials:z.array(SocialLinkSchema).optional(),profileImage:z.string().optional(),properties:z.record(z.any()).optional(),inboundTopicId:z.string().optional(),outboundTopicId:z.string().optional()}),PersonalProfileSchema=BaseProfileSchema.extend({type:z.literal(0),language:z.string().optional(),timezone:z.string().optional()}),AIAgentProfileSchema=BaseProfileSchema.extend({type:z.literal(1),aiAgent:AIAgentDetailsSchema}),HCS11ProfileSchema=z.union([PersonalProfileSchema,AIAgentProfileSchema]),capabilityNameToCapabilityMap={text_generation:0,image_generation:1,audio_generation:2,video_generation:3,code_generation:4,language_translation:5,summarization:6,extraction:6,knowledge_retrieval:7,data_integration:8,data_visualization:8,market_intelligence:9,transaction_analytics:10,smart_contract_audit:11,governance:12,security_monitoring:13,compliance_analysis:14,fraud_detection:15,multi_agent:16,api_integration:17,workflow_automation:18};class HCS11Client{constructor(e){if(this.client="mainnet"===e.network?i$1.forMainnet():i$1.forTestnet(),this.auth=e.auth,this.network=e.network,this.auth.privateKey){const e=y$2.fromString(this.auth.privateKey);this.client.setOperator(this.auth.operatorId,e)}this.logger=Logger$2.getInstance({level:e.logLevel||"info",module:"HCS-11"})}getClient(){return this.client}getOperatorId(){return this.auth.operatorId}createPersonalProfile(e,t){return{version:"1.0",type:0,display_name:e,alias:null==t?void 0:t.alias,bio:null==t?void 0:t.bio,socials:null==t?void 0:t.socials,profileImage:null==t?void 0:t.profileImage,language:null==t?void 0:t.language,timezone:null==t?void 0:t.timezone,properties:null==t?void 0:t.properties,inboundTopicId:null==t?void 0:t.inboundTopicId,outboundTopicId:null==t?void 0:t.outboundTopicId}}createAIAgentProfile(e,t,r,o,n){const i=this.validateProfile({version:"1.0",type:1,display_name:e,alias:null==n?void 0:n.alias,bio:null==n?void 0:n.bio,socials:null==n?void 0:n.socials,profileImage:null==n?void 0:n.profileImage,properties:null==n?void 0:n.properties,inboundTopicId:null==n?void 0:n.inboundTopicId,outboundTopicId:null==n?void 0:n.outboundTopicId,aiAgent:{type:t,capabilities:r,model:o,creator:null==n?void 0:n.creator}});if(!i.valid)throw new Error(`Invalid AI Agent Profile: ${i.errors.join(", ")}`);return{version:"1.0",type:1,display_name:e,alias:null==n?void 0:n.alias,bio:null==n?void 0:n.bio,socials:null==n?void 0:n.socials,profileImage:null==n?void 0:n.profileImage,properties:null==n?void 0:n.properties,inboundTopicId:null==n?void 0:n.inboundTopicId,outboundTopicId:null==n?void 0:n.outboundTopicId,aiAgent:{type:t,capabilities:r,model:o,creator:null==n?void 0:n.creator}}}validateProfile(e){const t=HCS11ProfileSchema.safeParse(e);if(t.success)return{valid:!0,errors:[]};return{valid:!1,errors:t.error.errors.map((e=>{var t;const r=e.path.join(".");let o=e.message;if("invalid_type"===e.code)o=`Expected ${e.expected}, got ${e.received}`;else if("invalid_enum_value"===e.code){o=`Invalid value. Valid options are: ${null==(t=e.options)?void 0:t.join(", ")}`}else"too_small"===e.code&&"string"===e.type&&(o="Cannot be empty");return`${r}: ${o}`}))}}profileToJSONString(e){return JSON.stringify(e)}parseProfileFromString(e){try{const t=JSON.parse(e),r=this.validateProfile(t);return r.valid?t:(this.logger.error("Invalid profile format:",r.errors),null)}catch(t){return this.logger.error("Error parsing profile:",t),null}}setProfileForAccountMemo(e,t=1){return`hcs-11:hcs://${t}/${e}`}async executeTransaction(e){try{if(this.auth.privateKey){const t=await e.signWithOperator(this.client),r=await t.execute(this.client),o=await r.getReceipt(this.client);return o.status!==e$6.Success?{success:!1,error:`Transaction failed: ${o.status.toString()}`}:{success:!0,result:o}}if(!this.auth.signer)throw new Error("No valid authentication method provided");const t=this.auth.signer,r=await e.freezeWithSigner(t),o=await r.executeWithSigner(t),n=await o.getReceiptWithSigner(t);return n.status!==e$6.Success?{success:!1,error:`Transaction failed: ${n.status.toString()}`}:{success:!0,result:n}}catch(t){return{success:!1,error:t instanceof Error?t.message:"Unknown error during transaction execution"}}}async inscribeContent(e,t,r,o=!1){try{const n="string"==typeof e?Buffer.from(e,"utf-8"):e,i={type:"buffer",buffer:n,fileName:t,mimeType:r||mimeTypes.lookup(t)||"application/octet-stream"},a={waitForConfirmation:!0,mode:"file",network:this.network,maxRetries:100,waitMaxAttempts:100},s=this.auth.privateKey?await inscribe(i,{accountId:this.auth.operatorId,privateKey:this.auth.privateKey,network:this.network},a):await inscribeWithSigner(i,this.auth.signer,a);if(!s.confirmed||!s.inscription.topic_id)return{profileTopicId:"",transactionId:"",success:!1,error:"Failed to inscribe content",...o?{imageTopicId:""}:{}};const c=s.inscription.topic_id;return{...o?{imageTopicId:c}:{profileTopicId:c},transactionId:s.result.transactionId,success:!0}}catch(n){return{profileTopicId:"",transactionId:"",success:!1,error:n instanceof Error?n.message:"Unknown error during inscription",...o?{imageTopicId:""}:{}}}}async inscribeImage(e,t){return this.logger.info("Inscribing image"),this.inscribeContent(e,t,void 0,!0)}async inscribeProfile(e){this.logger.info("Inscribing HCS-11 profile");const t=this.validateProfile(e);if(!t.valid)return{profileTopicId:"",transactionId:"",success:!1,error:`Invalid profile: ${t.errors.join(", ")}`};const r=this.profileToJSONString(e),o=`profile-${e.display_name.toLowerCase().replace(/\s+/g,"-")}.json`;return this.inscribeContent(r,o,"application/json",!1)}async updateAccountMemoWithProfile(e,t){try{this.logger.info(`Updating account memo for ${e} with profile ${t}`);const r=this.setProfileForAccountMemo(t),o=(new s$4).setAccountMemo(r).setAccountId(e);return this.executeTransaction(o)}catch(r){return this.logger.error(`Error updating account memo: ${r instanceof Error?r.message:"Unknown error"}`),{success:!1,error:r instanceof Error?r.message:"Unknown error updating account memo"}}}async createAndInscribeProfile(e,t=!0){const r=await this.inscribeProfile(e);if(!r.success)return r;if(t){const e=await this.updateAccountMemoWithProfile(this.auth.operatorId,r.profileTopicId);if(!e.success)return{...r,success:!1,error:e.error}}return r}async getCapabilitiesFromTags(e){const t=[];if(0===e.length)return[0];for(const r of e){const e=capabilityNameToCapabilityMap[r.toLowerCase()];void 0===e||t.includes(e)||t.push(e)}return 0===t.length&&t.push(0),t}getAgentTypeFromMetadata(e){return"autonomous"===e.type?1:0}}async function accountIdsToExemptKeys(e,t,r){const o=new HederaMirrorNode(t,r),n=[];for(const a of e)try{const e=await o.getPublicKey(a);n.push(e)}catch(i){r&&r.warn(`Could not get public key for account ${a}: ${i}`)}return n}class FeeConfigBuilder{constructor(){this.feeAmount=0,this.decimals=0,this.feeCollectorAccountId="",this.exemptAccountIds=[]}static forHbar(e,t,r=[]){return(new FeeConfigBuilder).setHbarAmount(e).setFeeCollector(t).addExemptAccounts(r)}setHbarAmount(e){if(e<=0)throw new Error("HBAR amount must be greater than zero");return this.feeAmount=1e8*e,this.decimals=0,this}setFeeAmount(e,t=0){return this.feeAmount=e,this.decimals=t,this}setFeeCollector(e){return this.feeCollectorAccountId=e,this}addExemptAccount(e){return this.exemptAccountIds.includes(e)||this.exemptAccountIds.push(e),this}addExemptAccounts(e){for(const t of e)this.addExemptAccount(t);return this}build(){if(!this.feeCollectorAccountId)throw new Error("Fee collector account ID is required");if(this.feeAmount<=0)throw new Error("Fee amount must be greater than zero");return{feeAmount:{amount:this.feeAmount,decimals:this.decimals},feeCollectorAccountId:this.feeCollectorAccountId,exemptAccounts:this.exemptAccountIds}}}class HCS10Client extends HCS10BaseClient{constructor(e){super({network:e.network,logLevel:e.logLevel}),this.client="mainnet"===e.network?i$1.forMainnet():i$1.forTestnet(),this.operatorPrivateKey=y$2.fromString(e.operatorPrivateKey),this.network=e.network,this.client.setOperator(e.operatorId,this.operatorPrivateKey.toString()),this.logger=Logger$2.getInstance({level:e.logLevel||"info",module:"HCS-SDK"}),this.guardedRegistryBaseUrl=e.guardedRegistryBaseUrl||"https://hcs-10.hashgraphonline.com",this.feeAmount=e.feeAmount||5,this.hcs11Client=new HCS11Client({network:e.network,auth:{operatorId:e.operatorId,privateKey:e.operatorPrivateKey},logLevel:e.logLevel})}getClient(){return this.client}async createAccount(){this.logger.info("Creating new account");const e=y$2.generate(),t=(new l).setKey(e.publicKey).setInitialBalance(new e$7(10));this.logger.debug("Executing account creation transaction");const r=await t.execute(this.client),o=(await r.getReceipt(this.client)).accountId;if(!o)throw this.logger.error("Account creation failed: accountId is null"),new AccountCreationError("Failed to create account: accountId is null");return this.logger.info(`Account created successfully: ${o.toString()}`),{accountId:o.toString(),privateKey:e.toString()}}async createInboundTopic(e,t,r){this.logger.info(`Creating ${t} inbound topic`);const o=`hcs-10:0:60:0:${e}`;switch(t){case InboundTopicType.PUBLIC:return this.createTopic(o,!0,!1);case InboundTopicType.CONTROLLED:return this.createTopic(o,!0,!0);case InboundTopicType.FEE_BASED:if(!r)throw new Error("Fee configuration is required for fee-based topics");return this.createTopic(o,!0,!0,r.build());default:throw new Error(`Unsupported inbound topic type: ${t}`)}}async createAgent(e){var t;const r=e.build(),o=await this.createTopic("hcs-10:0:60:1",!0,!0);this.logger.info(`Created new outbound topic ID: ${o}`);const n=null==(t=this.client.operatorAccountId)?void 0:t.toString();if(!n)throw new Error("Failed to retrieve operator account ID");const i=await this.createInboundTopic(n,r.inboundTopicType,r.inboundTopicType===InboundTopicType.FEE_BASED?r.feeConfig:void 0);this.logger.info(`Created new inbound topic ID: ${i}`);const a=(await this.inscribePfp(r.pfpBuffer,r.pfpFileName)).pfpTopicId;this.logger.info(`Profile picture inscribed with topic ID: ${a}`);const s=(await this.storeHCS11Profile(r.name,r.description,i,o,r.capabilities,r.metadata,r.pfpBuffer,r.pfpFileName)).profileTopicId;return this.logger.info(`Profile stored with topic ID: ${s}`),{outboundTopicId:o,inboundTopicId:i,pfpTopicId:a,profileTopicId:s}}async inscribePfp(e,t){try{this.logger.info("Inscribing profile picture using HCS-11 client");const r=await this.hcs11Client.inscribeImage(e,t);if(!r.success)throw this.logger.error(`Failed to inscribe profile picture: ${r.error}`),new Error(r.error||"Failed to inscribe profile picture");return this.logger.info(`Successfully inscribed profile picture with topic ID: ${r.imageTopicId}`),{pfpTopicId:r.imageTopicId,transactionId:r.transactionId,success:!0}}catch(r){return this.logger.error(`Error inscribing profile picture: ${r.message}`),{pfpTopicId:"",transactionId:"",success:!1,error:r.message}}}async storeHCS11Profile(e,t,r,o,n=[],i,a,s){try{let c;if(a&&s){const e=await this.inscribePfp(a,s);e.success?c=e.pfpTopicId:this.logger.error("Failed to inscribe profile picture, continuing without PFP")}const u=this.hcs11Client.getAgentTypeFromMetadata({type:i.type}),l=i.socials?Object.entries(i.socials).filter((([e,t])=>t)).map((([e,t])=>({platform:"x"===e?"twitter":e,handle:t}))):void 0,d=this.hcs11Client.createAIAgentProfile(e,u,n,i.model||"unknown",{alias:e.toLowerCase().replace(/\s+/g,"_"),bio:t,profileImage:c?`hcs://1/${c}`:void 0,socials:l,properties:i.properties,inboundTopicId:r,outboundTopicId:o,creator:i.creator}),p=await this.hcs11Client.createAndInscribeProfile(d,!0);if(!p.success)throw this.logger.error(`Failed to inscribe profile: ${p.error}`),new Error(p.error||"Failed to inscribe profile");return this.logger.info(`Profile inscribed with topic ID: ${p.profileTopicId}, transaction ID: ${p.transactionId}`),{profileTopicId:p.profileTopicId,pfpTopicId:c,transactionId:p.transactionId,success:!0}}catch(c){return this.logger.error(`Error storing HCS-11 profile: ${c.message}`),{profileTopicId:"",pfpTopicId:"",transactionId:"",success:!1,error:c.message}}}async setupFees(e,t,r=[]){if(!this.client.operatorPublicKey)return;this.logger.info("Setting up topic with custom fees");const o=(new l$1).setAmount(Number(t.feeAmount.amount)).setFeeCollectorAccountId(f.fromString(t.feeCollectorAccountId));let n=[...t.exemptAccounts||[],...r];if(console.log("exemptAccountIds",n),n.length>0){const t=Array.from(new Set(n)).filter((e=>{var t;return e!==(null==(t=this.client.operatorAccountId)?void 0:t.toString())}));let r=[];if(t.length>0)try{r=await accountIdsToExemptKeys(t,this.network,this.logger)}catch(i){this.logger.warn(`Error getting exempt keys: ${i}, continuing without exempt keys`)}r.length>0&&e.setFeeExemptKeys(r)}e.setFeeScheduleKey(this.client.operatorPublicKey).setCustomFees([o])}async handleConnectionRequest(e,t,r,o){var n;const i=`hcs-10:${e}:${r}`;this.logger.info(`Handling connection request ${r} from ${t}`);const a=null==(n=this.getClient().operatorAccountId)?void 0:n.toString();if(!a)throw new Error("Failed to retrieve operator account ID");let s=await this.mirrorNode.getPublicKey(t);const c=await this.mirrorNode.getPublicKey(a);if(!c)throw new Error("Failed to retrieve public key");const u=new s$7([c,s],1);let l;try{if(o){const e=o.build(),t={...e,exemptAccounts:[...e.exemptAccounts||[]]};l=await this.createTopic(i,u,u,t)}else l=await this.createTopic(i,u,u);this.logger.info(`Created new connection topic ID: ${l}`)}catch(p){throw this.logger.error(`Failed to create connection topic: ${p}`),new TopicCreationError(`Failed to create connection topic: ${p}`)}const d=`${e}@${a}`;return{connectionTopicId:l,confirmedConnectionSequenceNumber:await this.confirmConnection(e,l,t,r,d,"Connection accepted. Looking forward to collaborating!"),operatorId:d}}async confirmConnection(e,t,r,o,n,i,a){var s;this.logger.info(`Confirming connection with ID ${o}`);const c={p:"hcs-10",op:"connection_created",connection_topic_id:t,connected_account_id:r,operator_id:n,connection_id:o,m:i},u=null==(s=(await this.submitPayload(e,c,a)).topicSequenceNumber)?void 0:s.toNumber();if(!u)throw new ConnectionConfirmationError("Failed to confirm connection: sequence number is null");return u}async sendMessage(e,t,r,o,n){var i;const a=await this.canSubmitToInboundTopic(e,(null==(i=this.client.operatorAccountId)?void 0:i.toString())||""),s={p:"hcs-10",op:"message",operator_id:t,data:r,m:o};await this.submitPayload(e,s,n,a.requiresFee)}async createTopic(e,t,r,o){this.logger.info("Creating topic");const n=(new m$1).setTopicMemo(e);t&&("boolean"==typeof t&&t&&this.client.operatorPublicKey?(n.setAdminKey(this.client.operatorPublicKey),n.setAutoRenewAccountId(this.client.operatorAccountId)):(t instanceof i$7||t instanceof s$7)&&(n.setAdminKey(t),this.client.operatorAccountId&&n.setAutoRenewAccountId(this.client.operatorAccountId))),r&&("boolean"==typeof r&&r&&this.client.operatorPublicKey?n.setSubmitKey(this.client.operatorPublicKey):(r instanceof i$7||r instanceof s$7)&&n.setSubmitKey(r)),o&&await this.setupFees(n,o),this.logger.debug("Executing topic creation transaction");const i=await n.execute(this.client),a=await i.getReceipt(this.client);if(!a.topicId)throw this.logger.error("Failed to create topic: topicId is null"),new Error("Failed to create topic: topicId is null");return a.topicId.toString()}async submitMessage(e,t,r){var o;const n=await this.canSubmitToInboundTopic(e,(null==(o=this.client.operatorAccountId)?void 0:o.toString())||"");return this.submitPayload(e,t,r,n.requiresFee)}async submitPayload(e,t,r,o=!1){const n="string"==typeof t?t:JSON.stringify(t),i=Buffer.byteLength(n,"utf8");if(i>1024)throw new PayloadSizeError("Payload size exceeds 1 KB limit",i);const a=(new u).setTopicId(m$2.fromString(e)).setMessage(n);let s;if(o&&(this.logger.info("Topic requires fee payment, setting max transaction fee"),a.setMaxTransactionFee(new e$7(this.feeAmount)),a.setTransactionMemo("HIP-991 Fee Payment")),r){a.freezeWith(this.client);const e=await a.sign(r);s=await e.execute(this.client)}else s=await a.execute(this.client);const c=await s.getReceipt(this.client);if(!c)throw this.logger.error("Failed to submit message: receipt is null"),new Error("Failed to submit message: receipt is null");return this.logger.info("Message submitted successfully"),c}async submitConnectionRequest(e,t,r,o){var n;const i=await this.canSubmitToInboundTopic(e,t);if(!i.canSubmit)throw new Error(`Cannot submit to topic: ${i.reason}`);const a={p:"hcs-10",op:"connection_request",operator_id:r,memo:o},s=i.requiresFee,c=await this.submitPayload(e,a,void 0,s);this.logger.info(`Submitted connection request to topic ID: ${e}`);const u=await this.retrieveOutboundConnectTopic(t),l=null==(n=c.topicSequenceNumber)?void 0:n.toNumber();if(!l)throw new Error("Failed to get response sequence number");return await this.submitPayload(u.outboundTopic,{...a,outbound_topic_id:u.outboundTopic,connection_request_id:l},this.operatorPrivateKey),c}async recordOutboundConnectionConfirmation({outboundTopicId:e,connectionRequestId:t,confirmedRequestId:r,connectionTopicId:o,operatorId:n,memo:i}){const a={p:"hcs-10",op:"connection_created",connection_topic_id:o,outbound_topic_id:e,confirmed_request_id:r,connection_request_id:t,operator_id:n,m:i};return await this.submitPayload(e,a)}async inscribeFile(e,t){if(this.logger.info("Inscribing file"),!this.client.operatorAccountId)throw this.logger.error("Operator account ID is not set"),new Error("Operator account ID is not set");if(!this.operatorPrivateKey)throw this.logger.error("Operator private key is not set"),new Error("Operator private key is not set");const r=mimeTypes.lookup(t)||"application/octet-stream",o=await InscriptionSDK.createWithAuth({type:"server",accountId:this.client.operatorAccountId.toString(),privateKey:this.operatorPrivateKey.toString(),network:this.network}),n=await o.inscribeAndExecute({file:{type:"base64",base64:e.toString("base64"),fileName:t,mimeType:r},holderId:this.client.operatorAccountId.toString(),mode:"file",network:this.network},{accountId:this.client.operatorAccountId.toString(),privateKey:this.operatorPrivateKey.toString(),network:this.network});if(!n.transactionId||!n.jobId)throw this.logger.error("Failed to inscribe, no transaction ID or job ID."),new Error("Failed to inscribe, no transaction ID or job ID.");n.transactionId&&n.jobId&&this.logger.info(`Transaction ID: ${n.transactionId}, Job ID: ${n.jobId}`);return await o.waitForInscription(n.jobId,30,4e3,!0)}async waitForConnectionConfirmation(e,t,r=60,o=2e3){this.logger.info(`Waiting for connection confirmation on inbound topic ${e} for request ID ${t}`);for(let n=0;n<r;n++){this.logger.info(`Attempt ${n+1}/${r} to find connection confirmation`);const i=(await this.mirrorNode.getTopicMessages(e)).filter((e=>"connection_created"===e.op));if(this.logger.info(`Found ${i.length} connection_created messages`),i.length>0)for(const e of i)if(Number(e.connection_id)===Number(t))return this.logger.info("Connection confirmation found"),{connectionTopicId:e.connection_topic_id,sequence_number:Number(e.sequence_number),confirmedBy:e.operator_id,memo:e.m};n<r-1&&(this.logger.info(`No matching confirmation found, waiting ${o}ms before retrying...`),await new Promise((e=>setTimeout(e,o))))}throw new Error(`Connection confirmation not found after ${r} attempts for request ID ${t}`)}getAccountAndSigner(){return{accountId:this.client.operatorAccountId.toString(),signer:this.operatorPrivateKey}}async canSubmitToInboundTopic(e,t){var r,o,n,i;try{const s=await this.mirrorNode.getTopicInfo(e);if(!s)return{canSubmit:!1,requiresFee:!1,reason:"Topic does not exist"};if(!(null==(r=s.submit_key)?void 0:r.key))return{canSubmit:!0,requiresFee:!1};try{const e=await this.mirrorNode.getPublicKey(t);if("ProtobufEncoded"===s.submit_key._type){const t=Buffer.from(s.submit_key.key,"hex");if(await this.mirrorNode.checkKeyListAccess(t,e))return{canSubmit:!0,requiresFee:!1}}else{const t=i$7.fromString(s.submit_key.key);if(e.toString()===t.toString())return{canSubmit:!0,requiresFee:!1}}}catch(a){this.logger.error(`Key validation error: ${a instanceof Error?a.message:String(a)}`)}return(null==(o=s.fee_schedule_key)?void 0:o.key)&&(null==(i=null==(n=s.custom_fees)?void 0:n.fixed_fees)?void 0:i.length)>0?{canSubmit:!0,requiresFee:!0,reason:"Requires fee payment via HIP-991"}:{canSubmit:!1,requiresFee:!1,reason:"User does not have submit permission for this topic"}}catch(a){const e=a instanceof Error?a.message:String(a);return this.logger.error(`Topic submission validation error: ${e}`),{canSubmit:!1,requiresFee:!1,reason:`Error: ${e}`}}}async createAndRegisterAgent(e){const t=e.build(),r=t.existingAccount||await this.createAccount(),o=new HCS10Client({network:t.network,operatorId:r.accountId,operatorPrivateKey:r.privateKey,operatorPublicKey:y$2.fromString(r.privateKey).publicKey.toString(),logLevel:"info"}),{outboundTopicId:n,inboundTopicId:i,pfpTopicId:a,profileTopicId:s}=await o.createAgent(e),c=`${i}@${r.accountId}`;return await o.registerAgentWithGuardedRegistry(r.accountId,i,t.network),{accountId:r.accountId,privateKey:r.privateKey,operatorId:c,inboundTopicId:i,outboundTopicId:n,profileTopicId:s,pfpTopicId:a,client:o}}async registerAgentWithGuardedRegistry(e,t,r=this.network,o){try{this.logger.info("Registering agent with guarded registry");const n=(null==o?void 0:o.maxAttempts)??60,i=(null==o?void 0:o.delayMs)??2e3,a=null==o?void 0:o.progressCallback;a&&a({stage:"preparing",message:"Preparing agent registration",progressPercent:10});const s=await this.executeRegistration(e,t,r,this.guardedRegistryBaseUrl,this.logger);if(!s.success)return s;if(a&&a({stage:"submitting",message:"Submitting registration to registry",progressPercent:30,details:{transactionId:s.transactionId}}),s.transaction){const e=S.fromBytes(Buffer.from(s.transaction,"base64"));this.logger.info("Processing registration transaction"),await e.execute(this.client),this.logger.info("Successfully processed registration transaction")}a&&a({stage:"confirming",message:"Confirming registration transaction",progressPercent:60,details:{accountId:e,inboundTopicId:t,transactionId:s.transactionId}});const c=await this.waitForRegistrationConfirmation(s.transactionId,r,this.guardedRegistryBaseUrl,n,i,this.logger);return a&&a({stage:"completed",message:"Agent registration complete",progressPercent:100,details:{confirmed:c,transactionId:s.transactionId}}),{...s,confirmed:c}}catch(n){return this.logger.error(`Failed to register agent: ${n.message}`),{error:n.message,success:!1}}}async registerAgent(e,t,r,o,n){this.logger.info("Registering agent");const i={p:"hcs-10",op:"register",account_id:t,inbound_topic_id:r,m:o};await this.submitPayload(e,i,n)}async getInboundTopicType(e){try{const t=await this.mirrorNode.getTopicInfo(e);if(!t)throw new Error("Topic does not exist");if(!(t.submit_key&&t.submit_key.key))return InboundTopicType.PUBLIC;if(t.fee_schedule_key&&t.fee_schedule_key.key&&t.custom_fees){const r=t.custom_fees;if(r&&r.fixed_fees&&r.fixed_fees.length>0)return this.logger.info(`Topic ${e} is fee-based with ${r.fixed_fees.length} custom fees`),InboundTopicType.FEE_BASED}return InboundTopicType.CONTROLLED}catch(t){throw this.logger.error(`Error determining topic type: ${t.message}`),new Error(`Failed to determine topic type: ${t.message}`)}}getNetwork(){return this.network}getLogger(){return this.logger}}class AgentBuilder{constructor(){this.config={}}setName(e){return this.config.name=e,this}setDescription(e){return this.config.description=e,this}setCapabilities(e){return this.config.capabilities=e,this}setAgentType(e){return this.config.metadata?this.config.metadata.type=e:this.config.metadata={type:e},this}setModel(e){return this.config.metadata?this.config.metadata.model=e:this.config.metadata={type:"autonomous",model:e},this}setCreator(e){return this.config.metadata?this.config.metadata.creator=e:this.config.metadata={type:"autonomous",creator:e},this}addSocial(e,t){return this.config.metadata?this.config.metadata.socials||(this.config.metadata.socials={}):this.config.metadata={type:"autonomous",socials:{}},this.config.metadata.socials[e]=t,this}addProperty(e,t){return this.config.metadata?this.config.metadata.properties||(this.config.metadata.properties={}):this.config.metadata={type:"autonomous",properties:{}},this.config.metadata.properties[e]=t,this}setMetadata(e){return this.config.metadata=e,this}setProfilePicture(e,t){return this.config.pfpBuffer=e,this.config.pfpFileName=t,this}setNetwork(e){return this.config.network=e,this}setInboundTopicType(e){return this.config.inboundTopicType=e,this}setFeeConfig(e){return this.config.feeConfig=e,this}setConnectionFeeConfig(e){return this.config.connectionFeeConfig=e,this}setExistingAccount(e,t){return this.config.existingAccount={accountId:e,privateKey:t},this}build(){if(!this.config.name)throw new Error("Agent name is required");if(!this.config.description)throw new Error("Agent description is required");if(!this.config.pfpBuffer||!this.config.pfpFileName)throw new Error("Profile picture is required");if(!this.config.network)throw new Error("Network is required");if(this.config.inboundTopicType||(this.config.inboundTopicType=InboundTopicType.PUBLIC),this.config.capabilities||(this.config.capabilities=[]),this.config.metadata||(this.config.metadata={type:"autonomous"}),this.config.inboundTopicType===InboundTopicType.FEE_BASED&&!this.config.feeConfig)throw new Error("Fee configuration is required for fee-based topics");return this.config}}class BrowserHCSClient extends HCS10BaseClient{constructor(e){super({network:e.network,logLevel:e.logLevel}),this.guardedRegistryBaseUrl=e.guardedRegistryBaseUrl||"https://moonscape.tech",this.hwc=e.hwc,this.logger=Logger$2.getInstance({level:e.logLevel||"info",module:"HCS-Browser"});const{accountId:t,signer:r}=this.getAccountAndSigner();this.hcs11Client=new HCS11Client({network:e.network,auth:{operatorId:t,signer:r},logLevel:e.logLevel})}async sendMessage(e,t,r,o){this.logger.info("Sending message");const n={p:"hcs-10",op:"message",operator_id:t,data:r,m:o};await this.submitPayload(e,n)}async submitConnectionRequest(e,t,r,o){var n,i;this.logger.info("Submitting connection request");const a={p:"hcs-10",op:"connection_request",requesting_account_id:t,operator_id:r,m:o},s=await this.submitPayload(e,a);this.logger.info(`Submitted connection request to topic ID: ${e}`);const c=await this.retrieveOutboundConnectTopic(t);if(!(null==c?void 0:c.outboundTopic))throw this.logger.error(`Failed to retrieve outbound topic for account ID: ${t}`),new Error(`Failed to retrieve outbound topic for account ID: ${t}`);this.logger.info(`Retrieved outbound topic ID: ${c.outboundTopic} for account ID: ${t}`);const u=null==(i=null==(n=null==s?void 0:s.result)?void 0:n.topicSequenceNumber)?void 0:i.toNumber();if(!u)throw new Error("Failed to get response sequence number");return await this.submitPayload(c.outboundTopic,{...a,outbound_topic_id:e,connection_request_id:u}),s.result}async recordOutboundConnectionConfirmation({outboundTopicId:e,connectionRequestId:t,confirmedRequestId:r,connectionTopicId:o,operatorId:n,memo:i}){const a={p:"hcs-10",op:"connection_created",connection_topic_id:o,outbound_topic_id:e,confirmed_request_id:r,connection_request_id:t,operator_id:n,m:i};return await this.submitPayload(e,a)}async getPublicKey(e){return await this.mirrorNode.getPublicKey(e)}async handleConnectionRequest(e,t,r,o="Connection accepted. Looking forward to collaborating!"){this.logger.info("Handling connection request");const n=this.hwc.getAccountInfo().accountId;if(!n)throw new Error("Failed to retrieve user account ID");const i=await this.mirrorNode.getPublicKey(t),a=await this.mirrorNode.getPublicKey(n);if(!a)throw new Error("Failed to retrieve public key");const s=new s$7([a,i],1),c=`hcs-10:${e}:${r}`,u=(new m$1).setTopicMemo(c).setAdminKey(s).setSubmitKey(s);this.logger.debug("Executing topic creation transaction");const l=await this.hwc.executeTransactionWithErrorHandling(u,!1);if(l.error)throw this.logger.error(l.error),new Error(l.error);const d=l.result;if(!(null==d?void 0:d.topicId))throw this.logger.error("Failed to create topic: topicId is null"),new Error("Failed to create topic: topicId is null");const p=d.topicId.toString(),h=`${e}@${n}`;return{connectionTopicId:p,confirmedConnectionSequenceNumber:await this.confirmConnection(e,p,t,r,h,o),operatorId:h}}async confirmConnection(e,t,r,o,n,i){var a;this.logger.info("Confirming connection");const s={p:"hcs-10",op:"connection_created",connection_topic_id:t,connected_account_id:r,operator_id:n,connection_id:o,m:i},c=await this.submitPayload(e,s);if(!(null==(a=null==c?void 0:c.result)?void 0:a.topicSequenceNumber))throw this.logger.error("Failed to confirm connection: sequence number is null"),new Error("Failed to confirm connection: sequence number is null");return c.result.topicSequenceNumber.toNumber()}async submitMessage(e,t,r={},o=""){this.logger.info("Submitting message");const n={p:"hcs-10",op:"message",data:{content:t,metadata:r},m:o};return await this.submitPayload(e,n)}async createAgent(e,t,r,o,n,i,a){try{const s=await this.createTopic("hcs-10:0:60:1",!0,!0);if(!s.success||!s.topicId)return{outboundTopicId:"",inboundTopicId:"",pfpTopicId:"",profileTopicId:"",error:s.error||"Failed to create outbound topic",success:!1};const c=await this.createTopic(`hcs-10:0:60:0:${s.topicId}`);if(!c.success||!c.topicId)return{outboundTopicId:s.topicId,inboundTopicId:"",pfpTopicId:"",profileTopicId:"",error:c.error||"Failed to create inbound topic",success:!1};let u=a;if(!u){const r=await this.inscribePfp(e,t);if(!r.success)return{outboundTopicId:s.topicId,inboundTopicId:c.topicId,pfpTopicId:"",profileTopicId:"",error:r.error||"Failed to inscribe profile picture",success:!1};u=r.pfpTopicId}const l=await this.storeHCS11Profile(r,o,c.topicId,s.topicId,n,i,e,t,u);return l.success?{outboundTopicId:s.topicId,inboundTopicId:c.topicId,pfpTopicId:u||"",profileTopicId:l.profileTopicId,success:!0}:{outboundTopicId:s.topicId,inboundTopicId:c.topicId,pfpTopicId:u||"",profileTopicId:"",error:l.error||"Failed to store profile",success:!1}}catch(s){return{outboundTopicId:"",inboundTopicId:"",pfpTopicId:"",profileTopicId:"",error:s.message,success:!1}}}async createAndRegisterAgent(e,t,r,o,n,i,a,s,c){try{const u=null==c?void 0:c.progressCallback,l=(e,t,r,o)=>{if(u)try{u({stage:e,message:t,progressPercent:r,details:o})}catch(n){this.logger.warn(`Error in progress callback: ${n}`)}};l("preparing","Creating agent topics and profile",10);const d=await this.createAgent(n,i,e,t,r,o,s);if(!d.success)throw new Error(d.error||"Failed to create agent");l("preparing","Agent topics created, preparing registration",30);const{accountId:p}=this.getAccountAndSigner();l("submitting","Registering with Hedera registry",40);const h=await this.registerAgentWithGuardedRegistry(p,d.inboundTopicId,a,{progressCallback:e=>{const t=40+.6*(e.progressPercent||0);l(e.stage,e.message,t,e.details)},maxAttempts:null==c?void 0:c.maxAttempts,delayMs:null==c?void 0:c.delayMs});if(!h.success)throw new Error(h.error||"Failed to register agent with registry");return l("completed","Agent creation and registration complete",100),{accountId:p,operatorId:`${d.outboundTopicId}@${p}`,inboundTopicId:d.inboundTopicId,outboundTopicId:d.outboundTopicId,profileTopicId:d.profileTopicId,pfpTopicId:d.pfpTopicId,client:this}}catch(u){throw new Error(`Failed to create and register agent: ${u.message}`)}}async registerAgentWithGuardedRegistry(e,t,r=this.network,o){try{this.logger.info("Registering agent with guarded registry");const n=(null==o?void 0:o.maxAttempts)??60,i=(null==o?void 0:o.delayMs)??2e3,a=null==o?void 0:o.progressCallback,s=(e,t,r,o)=>{if(a)try{a({stage:e,message:t,progressPercent:r,details:o})}catch(n){this.logger.warn(`Error in progress callback: ${n}`)}};s("preparing","Preparing agent registration",10);const c=await this.executeRegistration(e,t,r,this.guardedRegistryBaseUrl,this.logger);if(!c.success)return c;if(s("submitting","Submitting registration to registry",30,{transactionId:c.transactionId}),c.transaction){const e=S.fromBytes(Buffer.from(c.transaction,"base64"));this.logger.info("Processing registration transaction");const t=await this.hwc.executeTransactionWithErrorHandling(e,!1);if(t.error)return{...c,error:t.error,success:!1};this.logger.info("Successfully processed registration transaction")}s("confirming","Confirming registration transaction",60,{accountId:e,inboundTopicId:t,transactionId:c.transactionId});const u=await this.waitForRegistrationConfirmation(c.transactionId,r,this.guardedRegistryBaseUrl,n,i);return s("completed","Agent registration complete",100,{confirmed:u,transactionId:c.transactionId}),{...c,confirmed:u}}catch(n){return this.logger.error(`Registration error: ${n.message}`),{error:`Error during registration: ${n.message}`,success:!1}}}async storeHCS11Profile(e,t,r,o,n=[],i={},a,s,c){try{let u=c;if(!u&&a&&s){const e=await this.inscribePfp(a,s);e.success?u=e.pfpTopicId:this.logger.error("Failed to inscribe profile picture, continuing without PFP")}const l=this.hcs11Client.getAgentTypeFromMetadata({type:i.type||"autonomous"}),d=[];i.socials&&(i.socials.twitter&&d.push({platform:"twitter",handle:i.socials.twitter}),i.socials.discord&&d.push({platform:"discord",handle:i.socials.discord}),i.socials.github&&d.push({platform:"github",handle:i.socials.github}),i.socials.website&&d.push({platform:"website",handle:i.socials.website}),i.socials.x&&d.push({platform:"twitter",handle:i.socials.x}),i.socials.linkedin&&d.push({platform:"linkedin",handle:i.socials.linkedin}),i.socials.youtube&&d.push({platform:"youtube",handle:i.socials.youtube}),i.socials.telegram&&d.push({platform:"telegram",handle:i.socials.telegram}));const p=this.hcs11Client.createAIAgentProfile(e,l,n,i.model||"unknown",{alias:e.toLowerCase().replace(/\s+/g,"_"),bio:t,profileImage:u?`hcs://1/${u}`:void 0,socials:d.length>0?d:void 0,properties:{description:t,version:i.version||"1.0.0",creator:i.creator||"Unknown",supported_languages:i.supported_languages||["en"],permissions:i.permissions||[],model_details:i.model_details,training:i.training,capabilities_description:i.capabilities_description,...i},inboundTopicId:r,outboundTopicId:o,creator:i.creator}),h=await this.hcs11Client.createAndInscribeProfile(p,!0);return h.success?{profileTopicId:h.profileTopicId,pfpTopicId:u,success:!0}:{profileTopicId:"",success:!1,error:h.error||"Failed to inscribe profile"}}catch(u){return{profileTopicId:"",success:!1,error:u.message}}}async createTopic(e,t,r){this.logger.info("Creating topic");const{accountId:o,signer:n}=this.getAccountAndSigner(),i=(new m$1).setTopicMemo(e),a=await this.mirrorNode.getPublicKey(o);t&&a&&(i.setAdminKey(a),i.setAutoRenewAccountId(o)),r&&a&&i.setSubmitKey(a);const s=await this.hwc.executeTransactionWithErrorHandling(i,!1),c=s.error;if(c)return this.logger.error(c),{success:!1,error:c};const u=s.result;return(null==u?void 0:u.topicId)?{success:!0,topicId:u.topicId.toString()}:(this.logger.error("Failed to create topic: topicId is null"),{success:!1,error:"Failed to create topic: topicId is null"})}async submitPayload(e,t){this.logger.debug("Submitting payload");const r=(new u).setTopicId(e).setMessage(JSON.stringify(t));return await this.hwc.executeTransactionWithErrorHandling(r,!1)}async inscribeFile(e,t){const{accountId:r,signer:o}=this.getAccountAndSigner(),n=mimeTypes.lookup(t)||"application/octet-stream",i=await InscriptionSDK.createWithAuth({type:"client",accountId:r,signer:o,network:this.network}),a=await i.inscribe({file:{type:"base64",base64:e.toString("base64"),fileName:t,mimeType:n},holderId:r.toString(),mode:"file",network:this.network},o);if(!a.transactionId||!a.jobId)throw this.logger.error("Failed to inscribe, no transaction ID or job ID."),new Error("Failed to inscribe, no transaction ID or job ID.");a.transactionId&&a.jobId&&this.logger.info(`Transaction ID: ${a.transactionId}, Job ID: ${a.jobId}`);return await i.waitForInscription(a.jobId,30,4e3,!0)}getAccountAndSigner(){const e=this.hwc.getAccountInfo().accountId.toString(),t=this.hwc.dAppConnector.signers.find((t=>t.getAccountId().toString()===e));if(!t)throw this.logger.error("Failed to find signer"),new Error("Failed to find signer");return{accountId:e,signer:t}}async inscribePfp(e,t){try{this.logger.info("Inscribing profile picture using HCS-11 client");const r=await this.hcs11Client.inscribeImage(e,t);return r.success?(this.logger.info(`Successfully inscribed profile picture with topic ID: ${r.imageTopicId}`),{pfpTopicId:r.imageTopicId,success:!0}):(this.logger.error(`Failed to inscribe profile picture: ${r.error}`),{pfpTopicId:"",success:!1,error:r.error||"Failed to inscribe profile picture"})}catch(r){return this.logger.error(`Error inscribing profile picture: ${r.message}`),{pfpTopicId:"",success:!1,error:r.message}}}}exports.AIAgentCapability=AIAgentCapability,exports.AIAgentType=AIAgentType,exports.AccountCreationError=AccountCreationError,exports.AgentBuilder=AgentBuilder,exports.BrowserHCSClient=BrowserHCSClient,exports.ConnectionConfirmationError=ConnectionConfirmationError,exports.EVMBridge=EVMBridge,exports.EndpointType=EndpointType,exports.FeeConfigBuilder=FeeConfigBuilder,exports.HCS=HCS,exports.HCS10BaseClient=HCS10BaseClient,exports.HCS10Cache=HCS10Cache,exports.HCS10Client=HCS10Client,exports.HCS11Client=HCS11Client,exports.HederaMirrorNode=HederaMirrorNode,exports.InboundTopicType=InboundTopicType,exports.Logger=Logger$2,exports.PayloadSizeError=PayloadSizeError,exports.ProfileType=ProfileType,exports.Registration=Registration,exports.SUPPORTED_SOCIAL_PLATFORMS=SUPPORTED_SOCIAL_PLATFORMS,exports.TopicCreationError=TopicCreationError,exports.WasmBridge=WasmBridge,exports.accountIdsToExemptKeys=accountIdsToExemptKeys,exports.inscribe=inscribe,exports.inscribeWithSigner=inscribeWithSigner,exports.retrieveInscription=retrieveInscription,exports.sleep=sleep,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})}));
115
115
  //# sourceMappingURL=standards-sdk.umd.js.map