var mcencrypt=function(t){var e={};function r(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(i,n,function(e){return t[e]}.bind(null,n));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=144)}([function(t,e){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},function(t,e){t.exports={options:{usePureJavaScript:!1}}},function(t,e,r){ /*! safe-buffer. MIT License. Feross Aboukhadijeh */ var i=r(4),n=i.Buffer;function a(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(a(i,e),e.Buffer=o),o.prototype=Object.create(n.prototype),a(n,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i.SlowBuffer(t)}},function(t,e,r){(function(e,i,n,a){var o=r(1),s=r(150),h=t.exports=o.util=o.util||{};function u(t){if(8!==t&&16!==t&&24!==t&&32!==t)throw new Error("Only 8, 16, 24, or 32 bits supported: "+t)}function f(t){if(this.data="",this.read=0,"string"==typeof t)this.data=t;else if(h.isArrayBuffer(t)||h.isArrayBufferView(t))if(void 0!==a&&t instanceof a)this.data=t.toString("binary");else{var e=new Uint8Array(t);try{this.data=String.fromCharCode.apply(null,e)}catch(t){for(var r=0;r15?(n=Date.now(),s(t)):(r.push(t),1===r.length&&o.setAttribute("a",a=!a))}}h.nextTick=h.setImmediate}(),h.isNodejs=void 0!==e&&e.versions&&e.versions.node,h.globalScope=h.isNodejs?n:"undefined"==typeof self?window:self,h.isArray=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},h.isArrayBuffer=function(t){return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer},h.isArrayBufferView=function(t){return t&&h.isArrayBuffer(t.buffer)&&void 0!==t.byteLength},h.ByteBuffer=f,h.ByteStringBuffer=f;h.ByteStringBuffer.prototype._optimizeConstructedString=function(t){this._constructedStringLength+=t,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},h.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},h.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},h.ByteStringBuffer.prototype.putByte=function(t){return this.putBytes(String.fromCharCode(t))},h.ByteStringBuffer.prototype.fillWithByte=function(t,e){t=String.fromCharCode(t);for(var r=this.data;e>0;)1&e&&(r+=t),(e>>>=1)>0&&(t+=t);return this.data=r,this._optimizeConstructedString(e),this},h.ByteStringBuffer.prototype.putBytes=function(t){return this.data+=t,this._optimizeConstructedString(t.length),this},h.ByteStringBuffer.prototype.putString=function(t){return this.putBytes(h.encodeUtf8(t))},h.ByteStringBuffer.prototype.putInt16=function(t){return this.putBytes(String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},h.ByteStringBuffer.prototype.putInt24=function(t){return this.putBytes(String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},h.ByteStringBuffer.prototype.putInt32=function(t){return this.putBytes(String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},h.ByteStringBuffer.prototype.putInt16Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255))},h.ByteStringBuffer.prototype.putInt24Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255))},h.ByteStringBuffer.prototype.putInt32Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>24&255))},h.ByteStringBuffer.prototype.putInt=function(t,e){u(e);var r="";do{e-=8,r+=String.fromCharCode(t>>e&255)}while(e>0);return this.putBytes(r)},h.ByteStringBuffer.prototype.putSignedInt=function(t,e){return t<0&&(t+=2<0);return e},h.ByteStringBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<=r&&(e-=r<<1),e},h.ByteStringBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):0===t?e="":(e=0===this.read?this.data:this.data.slice(this.read),this.clear()),e},h.ByteStringBuffer.prototype.bytes=function(t){return void 0===t?this.data.slice(this.read):this.data.slice(this.read,this.read+t)},h.ByteStringBuffer.prototype.at=function(t){return this.data.charCodeAt(this.read+t)},h.ByteStringBuffer.prototype.setAt=function(t,e){return this.data=this.data.substr(0,this.read+t)+String.fromCharCode(e)+this.data.substr(this.read+t+1),this},h.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},h.ByteStringBuffer.prototype.copy=function(){var t=h.createBuffer(this.data);return t.read=this.read,t},h.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},h.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},h.ByteStringBuffer.prototype.truncate=function(t){var e=Math.max(0,this.length()-t);return this.data=this.data.substr(this.read,e),this.read=0,this},h.ByteStringBuffer.prototype.toHex=function(){for(var t="",e=this.read;e=t)return this;e=Math.max(e||this.growSize,t);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),i=new Uint8Array(this.length()+e);return i.set(r),this.data=new DataView(i.buffer),this},h.DataBuffer.prototype.putByte=function(t){return this.accommodate(1),this.data.setUint8(this.write++,t),this},h.DataBuffer.prototype.fillWithByte=function(t,e){this.accommodate(e);for(var r=0;r>8&65535),this.data.setInt8(this.write,t>>16&255),this.write+=3,this},h.DataBuffer.prototype.putInt32=function(t){return this.accommodate(4),this.data.setInt32(this.write,t),this.write+=4,this},h.DataBuffer.prototype.putInt16Le=function(t){return this.accommodate(2),this.data.setInt16(this.write,t,!0),this.write+=2,this},h.DataBuffer.prototype.putInt24Le=function(t){return this.accommodate(3),this.data.setInt8(this.write,t>>16&255),this.data.setInt16(this.write,t>>8&65535,!0),this.write+=3,this},h.DataBuffer.prototype.putInt32Le=function(t){return this.accommodate(4),this.data.setInt32(this.write,t,!0),this.write+=4,this},h.DataBuffer.prototype.putInt=function(t,e){u(e),this.accommodate(e/8);do{e-=8,this.data.setInt8(this.write++,t>>e&255)}while(e>0);return this},h.DataBuffer.prototype.putSignedInt=function(t,e){return u(e),this.accommodate(e/8),t<0&&(t+=2<0);return e},h.DataBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<=r&&(e-=r<<1),e},h.DataBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):0===t?e="":(e=0===this.read?this.data:this.data.slice(this.read),this.clear()),e},h.DataBuffer.prototype.bytes=function(t){return void 0===t?this.data.slice(this.read):this.data.slice(this.read,this.read+t)},h.DataBuffer.prototype.at=function(t){return this.data.getUint8(this.read+t)},h.DataBuffer.prototype.setAt=function(t,e){return this.data.setUint8(t,e),this},h.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},h.DataBuffer.prototype.copy=function(){return new h.DataBuffer(this)},h.DataBuffer.prototype.compact=function(){if(this.read>0){var t=new Uint8Array(this.data.buffer,this.read),e=new Uint8Array(t.byteLength);e.set(t),this.data=new DataView(e),this.write-=this.read,this.read=0}return this},h.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},h.DataBuffer.prototype.truncate=function(t){return this.write=Math.max(0,this.length()-t),this.read=Math.min(this.read,this.write),this},h.DataBuffer.prototype.toHex=function(){for(var t="",e=this.read;e0;)1&e&&(r+=t),(e>>>=1)>0&&(t+=t);return r},h.xorBytes=function(t,e,r){for(var i="",n="",a="",o=0,s=0;r>0;--r,++o)n=t.charCodeAt(o)^e.charCodeAt(o),s>=10&&(i+=a,a="",s=0),a+=String.fromCharCode(n),++s;return i+=a},h.hexToBytes=function(t){var e="",r=0;for(!0&t.length&&(r=1,e+=String.fromCharCode(parseInt(t[0],16)));r>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t)};var l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],d="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";h.encode64=function(t,e){for(var r,i,n,a="",o="",s=0;s>2),a+=l.charAt((3&r)<<4|i>>4),isNaN(i)?a+="==":(a+=l.charAt((15&i)<<2|n>>6),a+=isNaN(n)?"=":l.charAt(63&n)),e&&a.length>e&&(o+=a.substr(0,e)+"\r\n",a=a.substr(e));return o+=a},h.decode64=function(t){t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var e,r,i,n,a="",o=0;o>4),64!==i&&(a+=String.fromCharCode((15&r)<<4|i>>2),64!==n&&(a+=String.fromCharCode((3&i)<<6|n)));return a},h.encodeUtf8=function(t){return unescape(encodeURIComponent(t))},h.decodeUtf8=function(t){return decodeURIComponent(escape(t))},h.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:s.encode,decode:s.decode}},h.binary.raw.encode=function(t){return String.fromCharCode.apply(null,t)},h.binary.raw.decode=function(t,e,r){var i=e;i||(i=new Uint8Array(t.length));for(var n=r=r||0,a=0;a>2),a+=l.charAt((3&r)<<4|i>>4),isNaN(i)?a+="==":(a+=l.charAt((15&i)<<2|n>>6),a+=isNaN(n)?"=":l.charAt(63&n)),e&&a.length>e&&(o+=a.substr(0,e)+"\r\n",a=a.substr(e));return o+=a},h.binary.base64.decode=function(t,e,r){var i,n,a,o,s=e;s||(s=new Uint8Array(3*Math.ceil(t.length/4))),t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var h=0,u=r=r||0;h>4,64!==a&&(s[u++]=(15&n)<<4|a>>2,64!==o&&(s[u++]=(3&a)<<6|o));return e?u-r:s.subarray(0,u)},h.binary.base58.encode=function(t,e){return h.binary.baseN.encode(t,d,e)},h.binary.base58.decode=function(t,e){return h.binary.baseN.decode(t,d,e)},h.text={utf8:{},utf16:{}},h.text.utf8.encode=function(t,e,r){t=h.encodeUtf8(t);var i=e;i||(i=new Uint8Array(t.length));for(var n=r=r||0,a=0;a0&&a.push(r),o=i.lastIndex;var s=e[0][1];switch(s){case"s":case"o":n");break;case"%":a.push("%");break;default:a.push("<%"+s+"?>")}}return a.push(t.substring(o)),a.join("")},h.formatNumber=function(t,e,r,i){var n=t,a=isNaN(e=Math.abs(e))?2:e,o=void 0===r?",":r,s=void 0===i?".":i,h=n<0?"-":"",u=parseInt(n=Math.abs(+n||0).toFixed(a),10)+"",f=u.length>3?u.length%3:0;return h+(f?u.substr(0,f)+s:"")+u.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+s)+(a?o+Math.abs(n-u).toFixed(a).slice(2):"")},h.formatSize=function(t){return t=t>=1073741824?h.formatNumber(t/1073741824,2,".","")+" GiB":t>=1048576?h.formatNumber(t/1048576,2,".","")+" MiB":t>=1024?h.formatNumber(t/1024,0)+" KiB":h.formatNumber(t,0)+" bytes"},h.bytesFromIP=function(t){return-1!==t.indexOf(".")?h.bytesFromIPv4(t):-1!==t.indexOf(":")?h.bytesFromIPv6(t):null},h.bytesFromIPv4=function(t){if(4!==(t=t.split(".")).length)return null;for(var e=h.createBuffer(),r=0;rr[i].end-r[i].start&&(i=r.length-1)):r.push({start:s,end:s})}e.push(a)}if(r.length>0){var u=r[i];u.end-u.start>0&&(e.splice(u.start,u.end-u.start+1,""),0===u.start&&e.unshift(""),7===u.end&&e.push(""))}return e.join(":")},h.estimateCores=function(t,e){if("function"==typeof t&&(e=t,t={}),t=t||{},"cores"in h&&!t.update)return e(null,h.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return h.cores=navigator.hardwareConcurrency,e(null,h.cores);if("undefined"==typeof Worker)return h.cores=1,e(null,h.cores);if("undefined"==typeof Blob)return h.cores=2,e(null,h.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(t){for(var e=Date.now(),r=e+4;Date.now()s.st&&n.stn.st&&s.st * @license MIT */ var i=r(147),n=r(148),a=r(149);function o(){return h.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function p(t,e){if(h.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return K(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return V(t).length;default:if(i)return K(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,r){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,r);case"utf8":case"utf-8":return A(this,e,r);case"ascii":return T(this,e,r);case"latin1":case"binary":return B(this,e,r);case"base64":return C(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function g(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function y(t,e,r,i,n){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=h.from(e,i)),h.isBuffer(e))return 0===e.length?-1:v(t,e,r,i,n);if("number"==typeof e)return e&=255,h.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,i,n){var a,o=1,s=t.length,h=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;o=2,s/=2,h/=2,r/=2}function u(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(n){var f=-1;for(a=r;as&&(r=s-h),a=r;a>=0;a--){for(var l=!0,c=0;cn&&(i=n):i=n;var a=e.length;if(a%2!=0)throw new TypeError("Invalid hex string");i>a/2&&(i=a/2);for(var o=0;o>8,n=r%256,a.push(n),a.push(i);return a}(e,t.length-r),t,r,i)}function C(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function A(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n239?4:u>223?3:u>191?2:1;if(n+l<=r)switch(l){case 1:u<128&&(f=u);break;case 2:128==(192&(a=t[n+1]))&&(h=(31&u)<<6|63&a)>127&&(f=h);break;case 3:a=t[n+1],o=t[n+2],128==(192&a)&&128==(192&o)&&(h=(15&u)<<12|(63&a)<<6|63&o)>2047&&(h<55296||h>57343)&&(f=h);break;case 4:a=t[n+1],o=t[n+2],s=t[n+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(h=(15&u)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&h<1114112&&(f=h)}null===f?(f=65533,l=1):f>65535&&(f-=65536,i.push(f>>>10&1023|55296),f=56320|1023&f),i.push(f),n+=l}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",i=0;for(;i0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},h.prototype.compare=function(t,e,r,i,n){if(!h.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;for(var a=(n>>>=0)-(i>>>=0),o=(r>>>=0)-(e>>>=0),s=Math.min(a,o),u=this.slice(i,n),f=t.slice(e,r),l=0;ln)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return w(this,t,e,r);case"ascii":return M(this,t,e,r);case"latin1":case"binary":return _(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;ni)&&(r=i);for(var n="",a=e;ar)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,i,n,a){if(!h.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}function L(t,e,r,i){e<0&&(e=65535+e+1);for(var n=0,a=Math.min(t.length-r,2);n>>8*(i?n:1-n)}function x(t,e,r,i){e<0&&(e=4294967295+e+1);for(var n=0,a=Math.min(t.length-r,4);n>>8*(i?n:3-n)&255}function P(t,e,r,i,n,a){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,r,i,a){return a||P(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function U(t,e,r,i,a){return a||P(t,0,r,8),n.write(t,e,r,i,52,8),r+8}h.prototype.slice=function(t,e){var r,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e0&&(n*=256);)i+=this[t+--e]*n;return i},h.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]},h.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8},h.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]},h.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},h.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},h.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var i=this[t],n=1,a=0;++a=(n*=128)&&(i-=Math.pow(2,8*e)),i},h.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var i=e,n=1,a=this[t+--i];i>0&&(n*=256);)a+=this[t+--i]*n;return a>=(n*=128)&&(a-=Math.pow(2,8*e)),a},h.prototype.readInt8=function(t,e){return e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},h.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt32LE=function(t,e){return e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},h.prototype.readInt32BE=function(t,e){return e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},h.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),n.read(this,t,!0,23,4)},h.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),n.read(this,t,!1,23,4)},h.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),n.read(this,t,!0,52,8)},h.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),n.read(this,t,!1,52,8)},h.prototype.writeUIntLE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||N(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,a=0;for(this[e]=255&t;++a=0&&(a*=256);)this[e+n]=t/a&255;return e+r},h.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,1,255,0),h.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},h.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):L(this,t,e,!0),e+2},h.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):L(this,t,e,!1),e+2},h.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):x(this,t,e,!0),e+4},h.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):x(this,t,e,!1),e+4},h.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}var a=0,o=1,s=0;for(this[e]=255&t;++a>0)-s&255;return e+r},h.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}var a=r-1,o=1,s=0;for(this[e+a]=255&t;--a>=0&&(o*=256);)t<0&&0===s&&0!==this[e+a+1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+r},h.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,1,127,-128),h.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},h.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):L(this,t,e,!0),e+2},h.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):L(this,t,e,!1),e+2},h.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,2147483647,-2147483648),h.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):x(this,t,e,!0),e+4},h.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):x(this,t,e,!1),e+4},h.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},h.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},h.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},h.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},h.prototype.copy=function(t,e,r,i){if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e=0;--n)t[n+e]=this[n+r];else if(a<1e3||!h.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(a=e;a55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(o+1===i){(e-=3)>-1&&a.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&a.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&a.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function V(t){return i.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(O,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function q(t,e,r,i){for(var n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}}).call(this,r(6))},function(t,e){var r,i,n=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(t){if(r===setTimeout)return setTimeout(t,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:a}catch(t){r=a}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(t){i=o}}();var h,u=[],f=!1,l=-1;function c(){f&&h&&(f=!1,h.length?u=h.concat(u):l=-1,u.length&&d())}function d(){if(!f){var t=s(c);f=!0;for(var e=u.length;e;){for(h=u,u=[];++l1)for(var r=1;r(n>>1)-1?(n>>1)-h:h,a.isubn(s)):s=0,i[o]=s,a.iushrn(1)}return i},i.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var i,n=0,a=0;t.cmpn(-n)>0||e.cmpn(-a)>0;){var o,s,h=t.andln(3)+n&3,u=e.andln(3)+a&3;3===h&&(h=-1),3===u&&(u=-1),o=0==(1&h)?0:3!==(i=t.andln(7)+n&7)&&5!==i||2!==u?h:-h,r[0].push(o),s=0==(1&u)?0:3!==(i=e.andln(7)+a&7)&&5!==i||2!==h?u:-u,r[1].push(s),2*n===o+1&&(n=1-n),2*a===s+1&&(a=1-a),t.iushrn(1),e.iushrn(1)}return r},i.cachedProperty=function(t,e,r){var i="_"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},i.parseBytes=function(t){return"string"==typeof t?i.toArray(t,"hex"):t},i.intFromLE=function(t){return new n(t,"hex","le")}},function(t,e,r){var i=r(1);r(15),r(82),r(83),r(3),i.random&&i.random.getBytes?t.exports=i.random:function(e){var r={},n=new Array(4),a=i.util.createBuffer();function o(){var t=i.prng.create(r);return t.getBytes=function(e,r){return t.generate(e,r)},t.getBytesSync=function(e){return t.generate(e)},t}r.formatKey=function(t){var e=i.util.createBuffer(t);return(t=new Array(4))[0]=e.getInt32(),t[1]=e.getInt32(),t[2]=e.getInt32(),t[3]=e.getInt32(),i.aes._expandKey(t,!1)},r.formatSeed=function(t){var e=i.util.createBuffer(t);return(t=new Array(4))[0]=e.getInt32(),t[1]=e.getInt32(),t[2]=e.getInt32(),t[3]=e.getInt32(),t},r.cipher=function(t,e){return i.aes._updateBlock(t,e,n,!1),a.putInt32(n[0]),a.putInt32(n[1]),a.putInt32(n[2]),a.putInt32(n[3]),a.getBytes()},r.increment=function(t){return++t[3],t},r.md=i.md.sha256;var s=o(),h=null,u=i.util.globalScope,f=u.crypto||u.msCrypto;if(f&&f.getRandomValues&&(h=function(t){return f.getRandomValues(t)}),i.options.usePureJavaScript||!i.util.isNodejs&&!h){if("undefined"==typeof window||window.document,s.collectInt(+new Date,32),"undefined"!=typeof navigator){var l="";for(var c in navigator)try{"string"==typeof navigator[c]&&(l+=navigator[c])}catch(t){}s.collect(l),l=null}e&&(e().mousemove((function(t){s.collectInt(t.clientX,16),s.collectInt(t.clientY,16)})),e().keypress((function(t){s.collectInt(t.charCode,8)})))}if(i.random)for(var c in s)i.random[c]=s[c];else i.random=s;i.random.createInstance=o,t.exports=i.random}("undefined"!=typeof jQuery?jQuery:null)},function(t,e,r){var i=r(1);r(3),r(16);var n=t.exports=i.asn1=i.asn1||{};function a(t,e,r){if(r>e){var i=new Error("Too few bytes to parse DER.");throw i.available=t.length(),i.remaining=e,i.requested=r,i}}n.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},n.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},n.create=function(t,e,r,a,o){if(i.util.isArray(a)){for(var s=[],h=0;hr){if(o.strict){var p=new Error("Too few bytes to read ASN.1 value.");throw p.available=e.length(),p.remaining=r,p.requested=d,p}d=r}var m=32==(32&h);if(m)if(l=[],void 0===d)for(;;){if(a(e,r,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),r-=2;break}s=e.length(),l.push(t(e,r,i+1,o)),r-=s-e.length()}else for(;d>0;)s=e.length(),l.push(t(e,d,i+1,o)),r-=s-e.length(),d-=s-e.length();void 0===l&&u===n.Class.UNIVERSAL&&f===n.Type.BITSTRING&&(c=e.bytes(d));if(void 0===l&&o.decodeBitStrings&&u===n.Class.UNIVERSAL&&f===n.Type.BITSTRING&&d>1){var g=e.read,y=r,v=0;if(f===n.Type.BITSTRING&&(a(e,r,1),v=e.getByte(),r--),0===v)try{s=e.length();var b=t(e,r,i+1,{strict:!0,decodeBitStrings:!0}),w=s-e.length();r-=w,f==n.Type.BITSTRING&&w++;var M=b.tagClass;w!==d||M!==n.Class.UNIVERSAL&&M!==n.Class.CONTEXT_SPECIFIC||(l=[b])}catch(t){}void 0===l&&(e.read=g,r=y)}if(void 0===l){if(void 0===d){if(o.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");d=r}if(f===n.Type.BMPSTRING)for(l="";d>0;d-=2)a(e,r,2),l+=String.fromCharCode(e.getInt16()),r-=2;else l=e.getBytes(d),r-=d}var _=void 0===c?null:{bitStringContents:c};return n.create(u,f,m,l,_)}(t,t.length(),0,e);if(e.parseAllBytes&&0!==t.length()){var s=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw s.byteCount=r,s.remaining=t.length(),s}return o},n.toDer=function(t){var e=i.util.createBuffer(),r=t.tagClass|t.type,a=i.util.createBuffer(),o=!1;if("bitStringContents"in t&&(o=!0,t.original&&(o=n.equals(t,t.original))),o)a.putBytes(t.bitStringContents);else if(t.composed){t.constructed?r|=32:a.putByte(0);for(var s=0;s1&&(0===t.value.charCodeAt(0)&&0==(128&t.value.charCodeAt(1))||255===t.value.charCodeAt(0)&&128==(128&t.value.charCodeAt(1)))?a.putBytes(t.value.substr(1)):a.putBytes(t.value);if(e.putByte(r),a.length()<=127)e.putByte(127&a.length());else{var h=a.length(),u="";do{u+=String.fromCharCode(255&h),h>>>=8}while(h>0);e.putByte(128|u.length);for(s=u.length-1;s>=0;--s)e.putByte(u.charCodeAt(s))}return e.putBuffer(a),e},n.oidToDer=function(t){var e,r,n,a,o=t.split("."),s=i.util.createBuffer();s.putByte(40*parseInt(o[0],10)+parseInt(o[1],10));for(var h=2;h>>=7,e||(a|=128),r.push(a),e=!1}while(n>0);for(var u=r.length-1;u>=0;--u)s.putByte(r[u])}return s},n.derToOid=function(t){var e;"string"==typeof t&&(t=i.util.createBuffer(t));var r=t.getByte();e=Math.floor(r/40)+"."+r%40;for(var n=0;t.length()>0;)n<<=7,128&(r=t.getByte())?n+=127&r:(e+="."+(n+r),n=0);return e},n.utcTimeToDate=function(t){var e=new Date,r=parseInt(t.substr(0,2),10);r=r>=50?1900+r:2e3+r;var i=parseInt(t.substr(2,2),10)-1,n=parseInt(t.substr(4,2),10),a=parseInt(t.substr(6,2),10),o=parseInt(t.substr(8,2),10),s=0;if(t.length>11){var h=t.charAt(10),u=10;"+"!==h&&"-"!==h&&(s=parseInt(t.substr(10,2),10),u+=2)}if(e.setUTCFullYear(r,i,n),e.setUTCHours(a,o,s,0),u&&("+"===(h=t.charAt(u))||"-"===h)){var f=60*parseInt(t.substr(u+1,2),10)+parseInt(t.substr(u+4,2),10);f*=6e4,"+"===h?e.setTime(+e-f):e.setTime(+e+f)}return e},n.generalizedTimeToDate=function(t){var e=new Date,r=parseInt(t.substr(0,4),10),i=parseInt(t.substr(4,2),10)-1,n=parseInt(t.substr(6,2),10),a=parseInt(t.substr(8,2),10),o=parseInt(t.substr(10,2),10),s=parseInt(t.substr(12,2),10),h=0,u=0,f=!1;"Z"===t.charAt(t.length-1)&&(f=!0);var l=t.length-5,c=t.charAt(l);"+"!==c&&"-"!==c||(u=60*parseInt(t.substr(l+1,2),10)+parseInt(t.substr(l+4,2),10),u*=6e4,"+"===c&&(u*=-1),f=!0);return"."===t.charAt(14)&&(h=1e3*parseFloat(t.substr(14),10)),f?(e.setUTCFullYear(r,i,n),e.setUTCHours(a,o,s,h),e.setTime(+e+u)):(e.setFullYear(r,i,n),e.setHours(a,o,s,h)),e},n.dateToUtcTime=function(t){if("string"==typeof t)return t;var e="",r=[];r.push((""+t.getUTCFullYear()).substr(2)),r.push(""+(t.getUTCMonth()+1)),r.push(""+t.getUTCDate()),r.push(""+t.getUTCHours()),r.push(""+t.getUTCMinutes()),r.push(""+t.getUTCSeconds());for(var i=0;i=-128&&t<128)return e.putSignedInt(t,8);if(t>=-32768&&t<32768)return e.putSignedInt(t,16);if(t>=-8388608&&t<8388608)return e.putSignedInt(t,24);if(t>=-2147483648&&t<2147483648)return e.putSignedInt(t,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=t,r},n.derToInteger=function(t){"string"==typeof t&&(t=i.util.createBuffer(t));var e=8*t.length();if(e>32)throw new Error("Integer too large; max is 32-bits.");return t.getSignedInt(e)},n.validate=function(t,e,r,a){var o=!1;if(t.tagClass!==e.tagClass&&void 0!==e.tagClass||t.type!==e.type&&void 0!==e.type)a&&(t.tagClass!==e.tagClass&&a.push("["+e.name+'] Expected tag class "'+e.tagClass+'", got "'+t.tagClass+'"'),t.type!==e.type&&a.push("["+e.name+'] Expected type "'+e.type+'", got "'+t.type+'"'));else if(t.constructed===e.constructed||void 0===e.constructed){if(o=!0,e.value&&i.util.isArray(e.value))for(var s=0,h=0;o&&h0&&(a+="\n");for(var s="",h=0;h1?a+="0x"+i.util.bytesToHex(t.value.slice(1)):a+="(none)",t.value.length>0){var c=t.value.charCodeAt(0);1==c?a+=" (1 unused bit shown)":c>1&&(a+=" ("+c+" unused bits shown)")}}else if(t.type===n.Type.OCTETSTRING)o.test(t.value)||(a+="("+t.value+") "),a+="0x"+i.util.bytesToHex(t.value);else if(t.type===n.Type.UTF8)try{a+=i.util.decodeUtf8(t.value)}catch(e){if("URI malformed"!==e.message)throw e;a+="0x"+i.util.bytesToHex(t.value)+" (malformed UTF8)"}else t.type===n.Type.PRINTABLESTRING||t.type===n.Type.IA5String?a+=t.value:o.test(t.value)?a+="0x"+i.util.bytesToHex(t.value):0===t.value.length?a+="[null]":a+=t.value}return a}},function(t,e,r){"use strict";var i=r(7),n=r(0);function a(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function o(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function s(t){return 1===t.length?"0"+t:t}function h(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=n,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n>6|192,r[i++]=63&o|128):a(t,n)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++n)),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=63&o|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=63&o|128)}else for(n=0;n>>0}return o},e.split32=function(t,e){for(var r=new Array(4*t.length),i=0,n=0;i>>24,r[n+1]=a>>>16&255,r[n+2]=a>>>8&255,r[n+3]=255&a):(r[n+3]=a>>>24,r[n+2]=a>>>16&255,r[n+1]=a>>>8&255,r[n]=255&a)}return r},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,r){return t+e+r>>>0},e.sum32_4=function(t,e,r,i){return t+e+r+i>>>0},e.sum32_5=function(t,e,r,i,n){return t+e+r+i+n>>>0},e.sum64=function(t,e,r,i){var n=t[e],a=i+t[e+1]>>>0,o=(a>>0,t[e+1]=a},e.sum64_hi=function(t,e,r,i){return(e+i>>>0>>0},e.sum64_lo=function(t,e,r,i){return e+i>>>0},e.sum64_4_hi=function(t,e,r,i,n,a,o,s){var h=0,u=e;return h+=(u=u+i>>>0)>>0)>>0)>>0},e.sum64_4_lo=function(t,e,r,i,n,a,o,s){return e+i+a+s>>>0},e.sum64_5_hi=function(t,e,r,i,n,a,o,s,h,u){var f=0,l=e;return f+=(l=l+i>>>0)>>0)>>0)>>0)>>0},e.sum64_5_lo=function(t,e,r,i,n,a,o,s,h,u){return e+i+a+s+u>>>0},e.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},e.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},e.shr64_hi=function(t,e,r){return t>>>r},e.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},function(t,e,r){var i=r(1);t.exports=i.md=i.md||{},i.md.algorithms=i.md.algorithms||{}},function(t,e,r){(function(t){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=a:e.BN=a,a.BN=a,a.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(223).Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function h(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return n}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=h(t,e,i)<=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?""};var f=["","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],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,s=67108863&o,h=o/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(o=(n=0|t.words[p])*(a=0|e.words[d])+l)/67108864|0,l=67108863&o}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?f[6-h.length]+h+r:h+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=l[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[u-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var o,s,h="le"===e,u=new t(a),f=this.clone();if(h){for(s=0;!f.isZero();s++)o=f.andln(255),f.iushrn(8),u[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,g=0|o[2],y=8191&g,v=g>>>13,b=0|o[3],w=8191&b,M=b>>>13,_=0|o[4],S=8191&_,E=_>>>13,C=0|o[5],A=8191&C,T=C>>>13,B=0|o[6],I=8191&B,k=B>>>13,R=0|o[7],N=8191&R,L=R>>>13,x=0|o[8],P=8191&x,D=x>>>13,U=0|o[9],O=8191&U,j=U>>>13,K=0|s[0],V=8191&K,q=K>>>13,F=0|s[1],H=8191&F,z=F>>>13,G=0|s[2],W=8191&G,Z=G>>>13,Y=0|s[3],Q=8191&Y,X=Y>>>13,J=0|s[4],$=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],at=8191&nt,ot=nt>>>13,st=0|s[7],ht=8191&st,ut=st>>>13,ft=0|s[8],lt=8191&ft,ct=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,q))+Math.imul(c,V)|0))<<13)|0;u=((a=Math.imul(c,q))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,V),n=(n=Math.imul(p,q))+Math.imul(m,V)|0,a=Math.imul(m,q);var yt=(u+(i=i+Math.imul(l,H)|0)|0)+((8191&(n=(n=n+Math.imul(l,z)|0)+Math.imul(c,H)|0))<<13)|0;u=((a=a+Math.imul(c,z)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,V),n=(n=Math.imul(y,q))+Math.imul(v,V)|0,a=Math.imul(v,q),i=i+Math.imul(p,H)|0,n=(n=n+Math.imul(p,z)|0)+Math.imul(m,H)|0,a=a+Math.imul(m,z)|0;var vt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,W)|0))<<13)|0;u=((a=a+Math.imul(c,Z)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(w,V),n=(n=Math.imul(w,q))+Math.imul(M,V)|0,a=Math.imul(M,q),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,z)|0)+Math.imul(v,H)|0,a=a+Math.imul(v,z)|0,i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,W)|0,a=a+Math.imul(m,Z)|0;var bt=(u+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,X)|0)+Math.imul(c,Q)|0))<<13)|0;u=((a=a+Math.imul(c,X)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(S,V),n=(n=Math.imul(S,q))+Math.imul(E,V)|0,a=Math.imul(E,q),i=i+Math.imul(w,H)|0,n=(n=n+Math.imul(w,z)|0)+Math.imul(M,H)|0,a=a+Math.imul(M,z)|0,i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(v,W)|0,a=a+Math.imul(v,Z)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,X)|0;var wt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,$)|0))<<13)|0;u=((a=a+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,V),n=(n=Math.imul(A,q))+Math.imul(T,V)|0,a=Math.imul(T,q),i=i+Math.imul(S,H)|0,n=(n=n+Math.imul(S,z)|0)+Math.imul(E,H)|0,a=a+Math.imul(E,z)|0,i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(M,W)|0,a=a+Math.imul(M,Z)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,X)|0)+Math.imul(v,Q)|0,a=a+Math.imul(v,X)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,$)|0,a=a+Math.imul(m,tt)|0;var Mt=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((a=a+Math.imul(c,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,V),n=(n=Math.imul(I,q))+Math.imul(k,V)|0,a=Math.imul(k,q),i=i+Math.imul(A,H)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(T,H)|0,a=a+Math.imul(T,z)|0,i=i+Math.imul(S,W)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(E,W)|0,a=a+Math.imul(E,Z)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,X)|0)+Math.imul(M,Q)|0,a=a+Math.imul(M,X)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,$)|0,a=a+Math.imul(v,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,it)|0;var _t=(u+(i=i+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,ot)|0)+Math.imul(c,at)|0))<<13)|0;u=((a=a+Math.imul(c,ot)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(N,V),n=(n=Math.imul(N,q))+Math.imul(L,V)|0,a=Math.imul(L,q),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,z)|0)+Math.imul(k,H)|0,a=a+Math.imul(k,z)|0,i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,Z)|0)+Math.imul(T,W)|0,a=a+Math.imul(T,Z)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(E,Q)|0,a=a+Math.imul(E,X)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(M,$)|0,a=a+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,a=a+Math.imul(v,it)|0,i=i+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var St=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((a=a+Math.imul(c,ut)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(P,V),n=(n=Math.imul(P,q))+Math.imul(D,V)|0,a=Math.imul(D,q),i=i+Math.imul(N,H)|0,n=(n=n+Math.imul(N,z)|0)+Math.imul(L,H)|0,a=a+Math.imul(L,z)|0,i=i+Math.imul(I,W)|0,n=(n=n+Math.imul(I,Z)|0)+Math.imul(k,W)|0,a=a+Math.imul(k,Z)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,X)|0)+Math.imul(T,Q)|0,a=a+Math.imul(T,X)|0,i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(E,$)|0,a=a+Math.imul(E,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(M,rt)|0,a=a+Math.imul(M,it)|0,i=i+Math.imul(y,at)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(v,at)|0,a=a+Math.imul(v,ot)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,a=a+Math.imul(m,ut)|0;var Et=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((a=a+Math.imul(c,ct)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(O,V),n=(n=Math.imul(O,q))+Math.imul(j,V)|0,a=Math.imul(j,q),i=i+Math.imul(P,H)|0,n=(n=n+Math.imul(P,z)|0)+Math.imul(D,H)|0,a=a+Math.imul(D,z)|0,i=i+Math.imul(N,W)|0,n=(n=n+Math.imul(N,Z)|0)+Math.imul(L,W)|0,a=a+Math.imul(L,Z)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,X)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,X)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(T,$)|0,a=a+Math.imul(T,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(E,rt)|0,a=a+Math.imul(E,it)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(M,at)|0,a=a+Math.imul(M,ot)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,a=a+Math.imul(v,ut)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,a=a+Math.imul(m,ct)|0;var Ct=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((a=a+Math.imul(c,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(O,H),n=(n=Math.imul(O,z))+Math.imul(j,H)|0,a=Math.imul(j,z),i=i+Math.imul(P,W)|0,n=(n=n+Math.imul(P,Z)|0)+Math.imul(D,W)|0,a=a+Math.imul(D,Z)|0,i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,X)|0)+Math.imul(L,Q)|0,a=a+Math.imul(L,X)|0,i=i+Math.imul(I,$)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(k,$)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(T,rt)|0,a=a+Math.imul(T,it)|0,i=i+Math.imul(S,at)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(E,at)|0,a=a+Math.imul(E,ot)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(M,ht)|0,a=a+Math.imul(M,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(v,lt)|0,a=a+Math.imul(v,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((a=a+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(O,W),n=(n=Math.imul(O,Z))+Math.imul(j,W)|0,a=Math.imul(j,Z),i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,X)|0)+Math.imul(D,Q)|0,a=a+Math.imul(D,X)|0,i=i+Math.imul(N,$)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(L,$)|0,a=a+Math.imul(L,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(T,at)|0,a=a+Math.imul(T,ot)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(E,ht)|0,a=a+Math.imul(E,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(M,lt)|0,a=a+Math.imul(M,ct)|0;var Tt=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;u=((a=a+Math.imul(v,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(O,Q),n=(n=Math.imul(O,X))+Math.imul(j,Q)|0,a=Math.imul(j,X),i=i+Math.imul(P,$)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(D,$)|0,a=a+Math.imul(D,tt)|0,i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(L,rt)|0,a=a+Math.imul(L,it)|0,i=i+Math.imul(I,at)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(T,ht)|0,a=a+Math.imul(T,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(E,lt)|0,a=a+Math.imul(E,ct)|0;var Bt=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;u=((a=a+Math.imul(M,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(O,$),n=(n=Math.imul(O,tt))+Math.imul(j,$)|0,a=Math.imul(j,tt),i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(D,rt)|0,a=a+Math.imul(D,it)|0,i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(L,at)|0,a=a+Math.imul(L,ot)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(k,ht)|0,a=a+Math.imul(k,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(T,lt)|0,a=a+Math.imul(T,ct)|0;var It=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((a=a+Math.imul(E,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(O,rt),n=(n=Math.imul(O,it))+Math.imul(j,rt)|0,a=Math.imul(j,it),i=i+Math.imul(P,at)|0,n=(n=n+Math.imul(P,ot)|0)+Math.imul(D,at)|0,a=a+Math.imul(D,ot)|0,i=i+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,ut)|0)+Math.imul(L,ht)|0,a=a+Math.imul(L,ut)|0,i=i+Math.imul(I,lt)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(k,lt)|0,a=a+Math.imul(k,ct)|0;var kt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(T,pt)|0))<<13)|0;u=((a=a+Math.imul(T,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(O,at),n=(n=Math.imul(O,ot))+Math.imul(j,at)|0,a=Math.imul(j,ot),i=i+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,ut)|0)+Math.imul(D,ht)|0,a=a+Math.imul(D,ut)|0,i=i+Math.imul(N,lt)|0,n=(n=n+Math.imul(N,ct)|0)+Math.imul(L,lt)|0,a=a+Math.imul(L,ct)|0;var Rt=(u+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((a=a+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(O,ht),n=(n=Math.imul(O,ut))+Math.imul(j,ht)|0,a=Math.imul(j,ut),i=i+Math.imul(P,lt)|0,n=(n=n+Math.imul(P,ct)|0)+Math.imul(D,lt)|0,a=a+Math.imul(D,ct)|0;var Nt=(u+(i=i+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((a=a+Math.imul(L,mt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(O,lt),n=(n=Math.imul(O,ct))+Math.imul(j,lt)|0,a=Math.imul(j,ct);var Lt=(u+(i=i+Math.imul(P,pt)|0)|0)+((8191&(n=(n=n+Math.imul(P,mt)|0)+Math.imul(D,pt)|0))<<13)|0;u=((a=a+Math.imul(D,mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863;var xt=(u+(i=Math.imul(O,pt))|0)+((8191&(n=(n=Math.imul(O,mt))+Math.imul(j,pt)|0))<<13)|0;return u=((a=Math.imul(j,mt))+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=bt,h[4]=wt,h[5]=Mt,h[6]=_t,h[7]=St,h[8]=Et,h[9]=Ct,h[10]=At,h[11]=Tt,h[12]=Bt,h[13]=It,h[14]=kt,h[15]=Rt,h[16]=Nt,h[17]=Lt,h[18]=xt,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,t,e):m(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,u=0;u=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-a|l>>>a,f=l&s}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(h/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,h=i.length-n.length;if("mod"!==e){(s=new a(null)).length=h+1,s.words=new Array(s.length);for(var u=0;u=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/o|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);s&&(s.words[l]=c)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},a.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),h=new a(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(l)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||h.isOdd())&&(s.iadd(f),h.isub(l)),s.iushrn(1),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(h)):(r.isub(e),s.isub(n),h.isub(o))}return{a:s,b:h,gcd:r.iushln(u)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),h=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;0==(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(h),o.iushrn(1);for(var l=0,c=1;0==(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new S(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(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 t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},n(b,v),b.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return y[t]=e,e},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),h=s.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,g=0;0!==m.cmp(s);g++)m=m.redSqr();i(g=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==o?(o<<=1,o|=l,(4===++s||0===i&&0===f)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}h=26}return n},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new E(t)},n(E,S),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(20)(t))},function(t,e,r){var i=r(2).Buffer,n=r(176).Transform,a=r(18).StringDecoder;function o(t){n.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}r(0)(o,n),o.prototype.update=function(t,e,r){"string"==typeof t&&(t=i.from(t,e));var n=this._update(t);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)},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(t,e,r){var i;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){i=t}finally{r(i)}},o.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},o.prototype._finalOrDigest=function(t){var e=this.__final()||i.alloc(0);return t&&(e=this._toString(e,t,!0)),e},o.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new a(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var i=this._decoder.write(t);return r&&(i+=this._decoder.end()),i},t.exports=o},function(t,e,r){var i=r(1);function n(t,e){i.cipher.registerAlgorithm(t,(function(){return new i.aes.Algorithm(t,e)}))}r(46),r(78),r(3),t.exports=i.aes=i.aes||{},i.aes.startEncrypting=function(t,e,r,i){var n=p({key:t,output:r,decrypt:!1,mode:i});return n.start(e),n},i.aes.createEncryptionCipher=function(t,e){return p({key:t,output:null,decrypt:!1,mode:e})},i.aes.startDecrypting=function(t,e,r,i){var n=p({key:t,output:r,decrypt:!0,mode:i});return n.start(e),n},i.aes.createDecryptionCipher=function(t,e){return p({key:t,output:null,decrypt:!0,mode:e})},i.aes.Algorithm=function(t,e){f||l();var r=this;r.name=t,r.mode=new e({blockSize:16,cipher:{encrypt:function(t,e){return d(r._w,t,e,!1)},decrypt:function(t,e){return d(r._w,t,e,!0)}}}),r._init=!1},i.aes.Algorithm.prototype.initialize=function(t){if(!this._init){var e,r=t.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(i.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){e=r,r=i.util.createBuffer();for(var n=0;n>>=2;for(n=0;n>8^255&l^99,a[m]=l,o[l]=m,d=(c=t[l])<<24^l<<16^l<<8^l^c,p=((r=t[m])^(i=t[r])^(n=t[i]))<<24^(m^n)<<16^(m^i^n)<<8^m^r^n;for(var y=0;y<4;++y)h[y][m]=d,u[y][l]=p,d=d<<24|d>>>8,p=p<<24|p>>>8;0===m?m=g=1:(m=r^t[t[t[r^n]]],g^=t[t[g]])}}function c(t,e){for(var r,i=t.slice(0),n=1,o=i.length,h=4*(o+6+1),f=o;f>>16&255]<<24^a[r>>>8&255]<<16^a[255&r]<<8^a[r>>>24]^s[n]<<24,n++):o>6&&f%o==4&&(r=a[r>>>24]<<24^a[r>>>16&255]<<16^a[r>>>8&255]<<8^a[255&r]),i[f]=i[f-o]^r;if(e){for(var l,c=u[0],d=u[1],p=u[2],m=u[3],g=i.slice(0),y=(f=0,(h=i.length)-4);f>>24]]^d[a[l>>>16&255]]^p[a[l>>>8&255]]^m[a[255&l]];i=g}return i}function d(t,e,r,i){var n,s,f,l,c,d,p,m,g,y,v,b,w=t.length/4-1;i?(n=u[0],s=u[1],f=u[2],l=u[3],c=o):(n=h[0],s=h[1],f=h[2],l=h[3],c=a),d=e[0]^t[0],p=e[i?3:1]^t[1],m=e[2]^t[2],g=e[i?1:3]^t[3];for(var M=3,_=1;_>>24]^s[p>>>16&255]^f[m>>>8&255]^l[255&g]^t[++M],v=n[p>>>24]^s[m>>>16&255]^f[g>>>8&255]^l[255&d]^t[++M],b=n[m>>>24]^s[g>>>16&255]^f[d>>>8&255]^l[255&p]^t[++M],g=n[g>>>24]^s[d>>>16&255]^f[p>>>8&255]^l[255&m]^t[++M],d=y,p=v,m=b;r[0]=c[d>>>24]<<24^c[p>>>16&255]<<16^c[m>>>8&255]<<8^c[255&g]^t[++M],r[i?3:1]=c[p>>>24]<<24^c[m>>>16&255]<<16^c[g>>>8&255]<<8^c[255&d]^t[++M],r[2]=c[m>>>24]<<24^c[g>>>16&255]<<16^c[d>>>8&255]<<8^c[255&p]^t[++M],r[i?1:3]=c[g>>>24]<<24^c[d>>>16&255]<<16^c[p>>>8&255]<<8^c[255&m]^t[++M]}function p(t){var e,r="AES-"+((t=t||{}).mode||"CBC").toUpperCase(),n=(e=t.decrypt?i.cipher.createDecipher(r,t.key):i.cipher.createCipher(r,t.key)).start;return e.start=function(t,r){var a=null;r instanceof i.util.ByteBuffer&&(a=r,r={}),(r=r||{}).output=a,r.iv=t,n.call(e,r)},e}},function(t,e,r){var i=r(1);i.pki=i.pki||{};var n=t.exports=i.pki.oids=i.oids=i.oids||{};function a(t,e){n[t]=e,n[e]=t}function o(t,e){n[t]=e}a("1.2.840.113549.1.1.1","rsaEncryption"),a("1.2.840.113549.1.1.4","md5WithRSAEncryption"),a("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),a("1.2.840.113549.1.1.7","RSAES-OAEP"),a("1.2.840.113549.1.1.8","mgf1"),a("1.2.840.113549.1.1.9","pSpecified"),a("1.2.840.113549.1.1.10","RSASSA-PSS"),a("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),a("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),a("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),a("1.3.101.112","EdDSA25519"),a("1.2.840.10040.4.3","dsa-with-sha1"),a("1.3.14.3.2.7","desCBC"),a("1.3.14.3.2.26","sha1"),a("1.3.14.3.2.29","sha1WithRSASignature"),a("2.16.840.1.101.3.4.2.1","sha256"),a("2.16.840.1.101.3.4.2.2","sha384"),a("2.16.840.1.101.3.4.2.3","sha512"),a("2.16.840.1.101.3.4.2.4","sha224"),a("2.16.840.1.101.3.4.2.5","sha512-224"),a("2.16.840.1.101.3.4.2.6","sha512-256"),a("1.2.840.113549.2.2","md2"),a("1.2.840.113549.2.5","md5"),a("1.2.840.113549.1.7.1","data"),a("1.2.840.113549.1.7.2","signedData"),a("1.2.840.113549.1.7.3","envelopedData"),a("1.2.840.113549.1.7.4","signedAndEnvelopedData"),a("1.2.840.113549.1.7.5","digestedData"),a("1.2.840.113549.1.7.6","encryptedData"),a("1.2.840.113549.1.9.1","emailAddress"),a("1.2.840.113549.1.9.2","unstructuredName"),a("1.2.840.113549.1.9.3","contentType"),a("1.2.840.113549.1.9.4","messageDigest"),a("1.2.840.113549.1.9.5","signingTime"),a("1.2.840.113549.1.9.6","counterSignature"),a("1.2.840.113549.1.9.7","challengePassword"),a("1.2.840.113549.1.9.8","unstructuredAddress"),a("1.2.840.113549.1.9.14","extensionRequest"),a("1.2.840.113549.1.9.20","friendlyName"),a("1.2.840.113549.1.9.21","localKeyId"),a("1.2.840.113549.1.9.22.1","x509Certificate"),a("1.2.840.113549.1.12.10.1.1","keyBag"),a("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),a("1.2.840.113549.1.12.10.1.3","certBag"),a("1.2.840.113549.1.12.10.1.4","crlBag"),a("1.2.840.113549.1.12.10.1.5","secretBag"),a("1.2.840.113549.1.12.10.1.6","safeContentsBag"),a("1.2.840.113549.1.5.13","pkcs5PBES2"),a("1.2.840.113549.1.5.12","pkcs5PBKDF2"),a("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),a("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),a("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),a("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),a("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),a("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),a("1.2.840.113549.2.7","hmacWithSHA1"),a("1.2.840.113549.2.8","hmacWithSHA224"),a("1.2.840.113549.2.9","hmacWithSHA256"),a("1.2.840.113549.2.10","hmacWithSHA384"),a("1.2.840.113549.2.11","hmacWithSHA512"),a("1.2.840.113549.3.7","des-EDE3-CBC"),a("2.16.840.1.101.3.4.1.2","aes128-CBC"),a("2.16.840.1.101.3.4.1.22","aes192-CBC"),a("2.16.840.1.101.3.4.1.42","aes256-CBC"),a("2.5.4.3","commonName"),a("2.5.4.4","surname"),a("2.5.4.5","serialNumber"),a("2.5.4.6","countryName"),a("2.5.4.7","localityName"),a("2.5.4.8","stateOrProvinceName"),a("2.5.4.9","streetAddress"),a("2.5.4.10","organizationName"),a("2.5.4.11","organizationalUnitName"),a("2.5.4.12","title"),a("2.5.4.13","description"),a("2.5.4.15","businessCategory"),a("2.5.4.17","postalCode"),a("2.5.4.42","givenName"),a("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),a("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),a("2.16.840.1.113730.1.1","nsCertType"),a("2.16.840.1.113730.1.13","nsComment"),o("2.5.29.1","authorityKeyIdentifier"),o("2.5.29.2","keyAttributes"),o("2.5.29.3","certificatePolicies"),o("2.5.29.4","keyUsageRestriction"),o("2.5.29.5","policyMapping"),o("2.5.29.6","subtreesConstraint"),o("2.5.29.7","subjectAltName"),o("2.5.29.8","issuerAltName"),o("2.5.29.9","subjectDirectoryAttributes"),o("2.5.29.10","basicConstraints"),o("2.5.29.11","nameConstraints"),o("2.5.29.12","policyConstraints"),o("2.5.29.13","basicConstraints"),a("2.5.29.14","subjectKeyIdentifier"),a("2.5.29.15","keyUsage"),o("2.5.29.16","privateKeyUsagePeriod"),a("2.5.29.17","subjectAltName"),a("2.5.29.18","issuerAltName"),a("2.5.29.19","basicConstraints"),o("2.5.29.20","cRLNumber"),o("2.5.29.21","cRLReason"),o("2.5.29.22","expirationDate"),o("2.5.29.23","instructionCode"),o("2.5.29.24","invalidityDate"),o("2.5.29.25","cRLDistributionPoints"),o("2.5.29.26","issuingDistributionPoint"),o("2.5.29.27","deltaCRLIndicator"),o("2.5.29.28","issuingDistributionPoint"),o("2.5.29.29","certificateIssuer"),o("2.5.29.30","nameConstraints"),a("2.5.29.31","cRLDistributionPoints"),a("2.5.29.32","certificatePolicies"),o("2.5.29.33","policyMappings"),o("2.5.29.34","policyConstraints"),a("2.5.29.35","authorityKeyIdentifier"),o("2.5.29.36","policyConstraints"),a("2.5.29.37","extKeyUsage"),o("2.5.29.46","freshestCRL"),o("2.5.29.54","inhibitAnyPolicy"),a("1.3.6.1.4.1.11129.2.4.2","timestampList"),a("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),a("1.3.6.1.5.5.7.3.1","serverAuth"),a("1.3.6.1.5.5.7.3.2","clientAuth"),a("1.3.6.1.5.5.7.3.3","codeSigning"),a("1.3.6.1.5.5.7.3.4","emailProtection"),a("1.3.6.1.5.5.7.3.8","timeStamping")},function(t,e,r){"use strict";var i,n="object"==typeof Reflect?Reflect:null,a=n&&"function"==typeof n.apply?n.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};i=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(t,e){return new Promise((function(r,i){function n(r){t.removeListener(e,a),i(r)}function a(){"function"==typeof t.removeListener&&t.removeListener("error",n),r([].slice.call(arguments))}y(t,e,a,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&y(t,"error",e,r)}(t,n,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var h=10;function u(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function f(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function l(t,e,r,i){var n,a,o,s;if(u(r),void 0===(a=t._events)?(a=t._events=Object.create(null),t._eventsCount=0):(void 0!==a.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),a=t._events),o=a[e]),void 0===o)o=a[e]=r,++t._eventsCount;else if("function"==typeof o?o=a[e]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=f(t))>0&&o.length>n&&!o.warned){o.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=t,h.type=e,h.count=o.length,s=h,console&&console.warn&&console.warn(s)}return t}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=c.bind(i);return n.listener=r,i.wrapFn=n,n}function p(t,e,r){var i=t._events;if(void 0===i)return[];var n=i[e];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(t){for(var e=new Array(t.length),r=0;r0&&(o=e[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var h=n[t];if(void 0===h)return!1;if("function"==typeof h)a(h,this,e);else{var u=h.length,f=g(h,u);for(r=0;r=0;a--)if(r[a]===e||r[a].listener===e){o=r[a].listener,n=a;break}if(n<0)return this;0===n?r.shift():function(t,e){for(;e+1=0;i--)this.removeListener(t,e[i]);return this},s.prototype.listeners=function(t){return p(this,t,!0)},s.prototype.rawListeners=function(t){return p(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):m.call(t,e)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(t,e,r){"use strict";var i=r(167).Buffer,n=i.isEncoding||function(t){switch((t=""+t)&&t.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 a(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){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 t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(i.isEncoding===n||!n(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=h,this.end=u,e=4;break;case"utf8":this.fillLast=s,e=4;break;case"base64":this.text=f,this.end=l,e=3;break;default:return this.write=c,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(e)}function o(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function h(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function u(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function f(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function c(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):""}e.StringDecoder=a,a.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return n>0&&(t.lastNeed=n-1),n;if(--i=0)return n>0&&(t.lastNeed=n-2),n;if(--i=0)return n>0&&(2===n?n=0:t.lastNeed=n-3),n;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},a.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,r){"use strict";var i=r(39),n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=l;var a=Object.create(r(31));a.inherits=r(0);var o=r(101),s=r(60);a.inherits(l,o);for(var h=n(s.prototype),u=0;u65&&-1!==o){var s=e[o];","===s?(++o,e=e.substr(0,o)+"\r\n "+e.substr(o)):e=e.substr(0,o)+"\r\n"+s+e.substr(o+1),a=n-o-1,o=-1,++n}else" "!==e[n]&&"\t"!==e[n]&&","!==e[n]||(o=n);return e}function o(t){return t.replace(/^\s+/,"")}n.encode=function(t,e){e=e||{};var r,n="-----BEGIN "+t.type+"-----\r\n";if(t.procType&&(n+=a(r={name:"Proc-Type",values:[String(t.procType.version),t.procType.type]})),t.contentDomain&&(n+=a(r={name:"Content-Domain",values:[t.contentDomain]})),t.dekInfo&&(r={name:"DEK-Info",values:[t.dekInfo.algorithm]},t.dekInfo.parameters&&r.values.push(t.dekInfo.parameters),n+=a(r)),t.headers)for(var o=0;o4294967295)throw new RangeError("requested too many random bytes");var r=n.allocUnsafe(t);if(t>0)if(t>65536)for(var o=0;o2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}n("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,n,o,s;if("string"==typeof e&&(n="not ",e.substr(!o||o<0?0:+o,n.length)===n)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))s="The ".concat(t," ").concat(i," ").concat(a(e,"type"));else{var h=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(h," ").concat(i," ").concat(a(e,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=i},function(t,e,r){"use strict";(function(e){var i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=u;var n=r(93),a=r(97);r(0)(u,n);for(var o=i(a.prototype),s=0;s=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=(4294967295&r)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var a=this._hash();return t?a.toString(t):a},n.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=n},function(t,e,r){"use strict";var i={};function n(t,e,r){r||(r=Error);var n=function(t){var r,i;function n(r,i,n){return t.call(this,function(t,r,i){return"string"==typeof e?e:e(t,r,i)}(r,i,n))||this}return i=t,(r=n).prototype=Object.create(i.prototype),r.prototype.constructor=r,r.__proto__=i,n}(r);n.prototype.name=r.name,n.prototype.code=t,i[t]=n}function a(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}n("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,n,o,s;if("string"==typeof e&&(n="not ",e.substr(!o||o<0?0:+o,n.length)===n)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))s="The ".concat(t," ").concat(i," ").concat(a(e,"type"));else{var h=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(h," ").concat(i," ").concat(a(e,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=i},function(t,e,r){"use strict";(function(e){var i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=u;var n=r(123),a=r(127);r(0)(u,n);for(var o=i(a.prototype),s=0;se.blockLength&&(e.start(),e.update(o.bytes()),o=e.digest()),r=i.util.createBuffer(),n=i.util.createBuffer(),u=o.length();for(h=0;h>>0,h>>>0];for(var u=n.fullMessageLength.length-1;u>=0;--u)n.fullMessageLength[u]+=h[1],h[1]=h[0]+(n.fullMessageLength[u]/4294967296>>>0),n.fullMessageLength[u]=n.fullMessageLength[u]>>>0,h[0]=h[1]/4294967296>>>0;return e.putBytes(a),s(t,r,e),(e.read>2048||0===e.length())&&e.compact(),n},n.digest=function(){var o=i.util.createBuffer();o.putBytes(e.bytes());var h,u=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize&n.blockLength-1;o.putBytes(a.substr(0,n.blockLength-u));for(var f=8*n.fullMessageLength[0],l=0;l>>0,o.putInt32(f>>>0),f=h>>>0;o.putInt32(f);var c={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4};s(c,r,o);var d=i.util.createBuffer();return d.putInt32(c.h0),d.putInt32(c.h1),d.putInt32(c.h2),d.putInt32(c.h3),d.putInt32(c.h4),d},n};var a=null,o=!1;function s(t,e,r){for(var i,n,a,o,s,h,u,f=r.length();f>=64;){for(n=t.h0,a=t.h1,o=t.h2,s=t.h3,h=t.h4,u=0;u<16;++u)i=r.getInt32(),e[u]=i,i=(n<<5|n>>>27)+(s^a&(o^s))+h+1518500249+i,h=s,s=o,o=(a<<30|a>>>2)>>>0,a=n,n=i;for(;u<20;++u)i=(i=e[u-3]^e[u-8]^e[u-14]^e[u-16])<<1|i>>>31,e[u]=i,i=(n<<5|n>>>27)+(s^a&(o^s))+h+1518500249+i,h=s,s=o,o=(a<<30|a>>>2)>>>0,a=n,n=i;for(;u<32;++u)i=(i=e[u-3]^e[u-8]^e[u-14]^e[u-16])<<1|i>>>31,e[u]=i,i=(n<<5|n>>>27)+(a^o^s)+h+1859775393+i,h=s,s=o,o=(a<<30|a>>>2)>>>0,a=n,n=i;for(;u<40;++u)i=(i=e[u-6]^e[u-16]^e[u-28]^e[u-32])<<2|i>>>30,e[u]=i,i=(n<<5|n>>>27)+(a^o^s)+h+1859775393+i,h=s,s=o,o=(a<<30|a>>>2)>>>0,a=n,n=i;for(;u<60;++u)i=(i=e[u-6]^e[u-16]^e[u-28]^e[u-32])<<2|i>>>30,e[u]=i,i=(n<<5|n>>>27)+(a&o|s&(a^o))+h+2400959708+i,h=s,s=o,o=(a<<30|a>>>2)>>>0,a=n,n=i;for(;u<80;++u)i=(i=e[u-6]^e[u-16]^e[u-28]^e[u-32])<<2|i>>>30,e[u]=i,i=(n<<5|n>>>27)+(a^o^s)+h+3395469782+i,h=s,s=o,o=(a<<30|a>>>2)>>>0,a=n,n=i;t.h0=t.h0+n|0,t.h1=t.h1+a|0,t.h2=t.h2+o|0,t.h3=t.h3+s|0,t.h4=t.h4+h|0,f-=64}}},function(t,e,r){"use strict";var i=r(0),n=r(53),a=r(56),o=r(57),s=r(14);function h(t){s.call(this,"digest"),this._hash=t}i(h,s),h.prototype._update=function(t){this._hash.update(t)},h.prototype._final=function(){return this._hash.digest()},t.exports=function(t){return"md5"===(t=t.toLowerCase())?new n:"rmd160"===t||"ripemd160"===t?new a:new h(o(t))}},function(t,e,r){function i(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===i(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===i(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===i(t)},e.isError=function(t){return"[object Error]"===i(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=r(4).Buffer.isBuffer},function(t,e,r){(function(e){t.exports=function(t,r){for(var i=Math.min(t.length,r.length),n=new e(i),a=0;a=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=i.join32(t,0,t.length-r,this.endian);for(var n=0;n>>24&255,i[n++]=t>>>16&255,i[n++]=t>>>8&255,i[n++]=255&t}else for(i[n++]=255&t,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n++]=t>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,a=8;a8?3:1,y=[],v=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,w=0;w>>4^_))<<4,M^=e=65535&((_^=e)>>>-16^M),M^=(e=858993459&(M>>>2^(_^=e<<-16)))<<2,M^=e=65535&((_^=e)>>>-16^M),M^=(e=1431655765&(M>>>1^(_^=e<<-16)))<<1,M^=e=16711935&((_^=e)>>>8^M),e=(M^=(e=1431655765&(M>>>1^(_^=e<<8)))<<1)<<8|(_^=e)>>>20&240,M=_<<24|_<<8&16711680|_>>>8&65280|_>>>24&240,_=e;for(var S=0;S>>26,_=_<<2|_>>>26):(M=M<<1|M>>>27,_=_<<1|_>>>27);var E=r[(M&=-15)>>>28]|i[M>>>24&15]|n[M>>>20&15]|a[M>>>16&15]|o[M>>>12&15]|s[M>>>8&15]|h[M>>>4&15],C=u[(_&=-15)>>>28]|f[_>>>24&15]|l[_>>>20&15]|c[_>>>16&15]|d[_>>>12&15]|p[_>>>8&15]|m[_>>>4&15];e=65535&(C>>>16^E),y[b++]=E^e,y[b++]=C^e<<16}}return y}(e),this._init=!0}},n("DES-ECB",i.cipher.modes.ecb),n("DES-CBC",i.cipher.modes.cbc),n("DES-CFB",i.cipher.modes.cfb),n("DES-OFB",i.cipher.modes.ofb),n("DES-CTR",i.cipher.modes.ctr),n("3DES-ECB",i.cipher.modes.ecb),n("3DES-CBC",i.cipher.modes.cbc),n("3DES-CFB",i.cipher.modes.cfb),n("3DES-OFB",i.cipher.modes.ofb),n("3DES-CTR",i.cipher.modes.ctr);var a=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],o=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],s=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],h=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],u=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],f=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],l=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],c=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function d(t,e,r,i){var n,d,p=32===t.length?3:9;n=3===p?i?[30,-2,-2]:[0,32,2]:i?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var m=e[0],g=e[1];m^=(d=252645135&(m>>>4^g))<<4,m^=(d=65535&(m>>>16^(g^=d)))<<16,m^=d=858993459&((g^=d)>>>2^m),m^=d=16711935&((g^=d<<2)>>>8^m),m=(m^=(d=1431655765&(m>>>1^(g^=d<<8)))<<1)<<1|m>>>31,g=(g^=d)<<1|g>>>31;for(var y=0;y>>4|g<<28)^t[w+1];d=m,m=g,g=d^(o[M>>>24&63]|h[M>>>16&63]|f[M>>>8&63]|c[63&M]|a[_>>>24&63]|s[_>>>16&63]|u[_>>>8&63]|l[63&_])}d=m,m=g,g=d}g=g>>>1|g<<31,g^=d=1431655765&((m=m>>>1|m<<31)>>>1^g),g^=(d=16711935&(g>>>8^(m^=d<<1)))<<8,g^=(d=858993459&(g>>>2^(m^=d)))<<2,g^=d=65535&((m^=d)>>>16^g),g^=d=252645135&((m^=d<<16)>>>4^g),m^=d<<4,r[0]=m,r[1]=g}function p(t){var e,r="DES-"+((t=t||{}).mode||"CBC").toUpperCase(),n=(e=t.decrypt?i.cipher.createDecipher(r,t.key):i.cipher.createCipher(r,t.key)).start;return e.start=function(t,r){var a=null;r instanceof i.util.ByteBuffer&&(a=r,r={}),(r=r||{}).output=a,r.iv=t,n.call(e,r)},e}},function(t,e,r){var i=r(1);if(r(10),r(37),r(16),r(85),r(86),r(9),r(3),void 0===n)var n=i.jsbn.BigInteger;var a=i.util.isNodejs?r(49):null,o=i.asn1,s=i.util;i.pki=i.pki||{},t.exports=i.pki.rsa=i.rsa=i.rsa||{};var h=i.pki,u=[6,4,2,4,2,4,6,2],f={name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},l={name:"RSAPrivateKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},c={name:"RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},d=i.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},p={name:"DigestInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:o.Class.UNIVERSAL,type:o.Type.NULL,constructed:!1}]},{name:"DigestInfo.digest",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},m=function(t){var e;if(!(t.algorithm in h.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=t.algorithm,r}e=h.oids[t.algorithm];var i=o.oidToDer(e).getBytes(),n=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]),a=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]);a.value.push(o.create(o.Class.UNIVERSAL,o.Type.OID,!1,i)),a.value.push(o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,""));var s=o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,t.digest().getBytes());return n.value.push(a),n.value.push(s),o.toDer(n).getBytes()},g=function(t,e,r){if(r)return t.modPow(e.e,e.n);if(!e.p||!e.q)return t.modPow(e.d,e.n);var a;e.dP||(e.dP=e.d.mod(e.p.subtract(n.ONE))),e.dQ||(e.dQ=e.d.mod(e.q.subtract(n.ONE))),e.qInv||(e.qInv=e.q.modInverse(e.p));do{a=new n(i.util.bytesToHex(i.random.getBytes(e.n.bitLength()/8)),16)}while(a.compareTo(e.n)>=0||!a.gcd(e.n).equals(n.ONE));for(var o=(t=t.multiply(a.modPow(e.e,e.n)).mod(e.n)).mod(e.p).modPow(e.dP,e.p),s=t.mod(e.q).modPow(e.dQ,e.q);o.compareTo(s)<0;)o=o.add(e.p);var h=o.subtract(s).multiply(e.qInv).mod(e.p).multiply(e.q).add(s);return h=h.multiply(a.modInverse(e.n)).mod(e.n)};function y(t,e,r){var n=i.util.createBuffer(),a=Math.ceil(e.n.bitLength()/8);if(t.length>a-11){var o=new Error("Message is too long for PKCS#1 v1.5 padding.");throw o.length=t.length,o.max=a-11,o}n.putByte(0),n.putByte(r);var s,h=a-3-t.length;if(0===r||1===r){s=0===r?0:255;for(var u=0;u0;){var f=0,l=i.random.getBytes(h);for(u=0;u1;){if(255!==o.getByte()){--o.read;break}++u}else if(2===h)for(u=0;o.length()>1;){if(0===o.getByte()){--o.read;break}++u}if(0!==o.getByte()||u!==a-3-o.length())throw new Error("Encryption block is invalid.");return o.getBytes()}function b(t,e,r){"function"==typeof e&&(r=e,e={});var a={algorithm:{name:(e=e||{}).algorithm||"PRIMEINC",options:{workers:e.workers||2,workLoad:e.workLoad||100,workerScript:e.workerScript}}};function o(){s(t.pBits,(function(e,i){return e?r(e):(t.p=i,null!==t.q?u(e,t.q):void s(t.qBits,u))}))}function s(t,e){i.prime.generateProbablePrime(t,a,e)}function u(e,i){if(e)return r(e);if(t.q=i,t.p.compareTo(t.q)<0){var a=t.p;t.p=t.q,t.q=a}if(0!==t.p.subtract(n.ONE).gcd(t.e).compareTo(n.ONE))return t.p=null,void o();if(0!==t.q.subtract(n.ONE).gcd(t.e).compareTo(n.ONE))return t.q=null,void s(t.qBits,u);if(t.p1=t.p.subtract(n.ONE),t.q1=t.q.subtract(n.ONE),t.phi=t.p1.multiply(t.q1),0!==t.phi.gcd(t.e).compareTo(n.ONE))return t.p=t.q=null,void o();if(t.n=t.p.multiply(t.q),t.n.bitLength()!==t.bits)return t.q=null,void s(t.qBits,u);var f=t.e.modInverse(t.phi);t.keys={privateKey:h.rsa.setPrivateKey(t.n,t.e,f,t.p,t.q,f.mod(t.p1),f.mod(t.q1),t.q.modInverse(t.p)),publicKey:h.rsa.setPublicKey(t.n,t.e)},r(null,t.keys)}"prng"in e&&(a.prng=e.prng),o()}function w(t){var e=t.toString(16);e[0]>="8"&&(e="00"+e);var r=i.util.hexToBytes(e);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function M(t){return t<=100?27:t<=150?18:t<=200?15:t<=250?12:t<=300?9:t<=350?8:t<=400?7:t<=500?6:t<=600?5:t<=800?4:t<=1250?3:2}function _(t){return i.util.isNodejs&&"function"==typeof a[t]}function S(t){return void 0!==s.globalScope&&"object"==typeof s.globalScope.crypto&&"object"==typeof s.globalScope.crypto.subtle&&"function"==typeof s.globalScope.crypto.subtle[t]}function E(t){return void 0!==s.globalScope&&"object"==typeof s.globalScope.msCrypto&&"object"==typeof s.globalScope.msCrypto.subtle&&"function"==typeof s.globalScope.msCrypto.subtle[t]}function C(t){for(var e=i.util.hexToBytes(t.toString(16)),r=new Uint8Array(e.length),n=0;n0;)f.putByte(0),--l;return f.putBytes(i.util.hexToBytes(u)),f.getBytes()},h.rsa.decrypt=function(t,e,r,a){var o=Math.ceil(e.n.bitLength()/8);if(t.length!==o){var s=new Error("Encrypted message length is invalid.");throw s.length=t.length,s.expected=o,s}var h=new n(i.util.createBuffer(t).toHex(),16);if(h.compareTo(e.n)>=0)throw new Error("Encrypted message is invalid.");for(var u=g(h,e,r).toString(16),f=i.util.createBuffer(),l=o-Math.ceil(u.length/2);l>0;)f.putByte(0),--l;return f.putBytes(i.util.hexToBytes(u)),!1!==a?v(f.getBytes(),e,r):f.getBytes()},h.rsa.createKeyPairGenerationState=function(t,e,r){"string"==typeof t&&(t=parseInt(t,10)),t=t||2048;var a,o=(r=r||{}).prng||i.random,s={nextBytes:function(t){for(var e=o.getBytesSync(t.length),r=0;r>1,pBits:t-(t>>1),pqState:0,num:null,keys:null}).e.fromInt(a.eInt),a},h.rsa.stepKeyPairGenerationState=function(t,e){"algorithm"in t||(t.algorithm="PRIMEINC");var r=new n(null);r.fromInt(30);for(var i,a=0,o=function(t,e){return t|e},s=+new Date,f=0;null===t.keys&&(e<=0||fl?t.pqState=0:t.num.isProbablePrime(M(t.num.bitLength()))?++t.pqState:t.num.dAddOffset(u[a++%8],0):2===t.pqState?t.pqState=0===t.num.subtract(n.ONE).gcd(t.e).compareTo(n.ONE)?3:0:3===t.pqState&&(t.pqState=0,null===t.p?t.p=t.num:t.q=t.num,null!==t.p&&null!==t.q&&++t.state,t.num=null)}else if(1===t.state)t.p.compareTo(t.q)<0&&(t.num=t.p,t.p=t.q,t.q=t.num),++t.state;else if(2===t.state)t.p1=t.p.subtract(n.ONE),t.q1=t.q.subtract(n.ONE),t.phi=t.p1.multiply(t.q1),++t.state;else if(3===t.state)0===t.phi.gcd(t.e).compareTo(n.ONE)?++t.state:(t.p=null,t.q=null,t.state=0);else if(4===t.state)t.n=t.p.multiply(t.q),t.n.bitLength()===t.bits?++t.state:(t.q=null,t.state=0);else if(5===t.state){var d=t.e.modInverse(t.phi);t.keys={privateKey:h.rsa.setPrivateKey(t.n,t.e,d,t.p,t.q,d.mod(t.p1),d.mod(t.q1),t.q.modInverse(t.p)),publicKey:h.rsa.setPublicKey(t.n,t.e)}}f+=(i=+new Date)-s,s=i}return null!==t.keys},h.rsa.generateKeyPair=function(t,e,r,n){if(1===arguments.length?"object"==typeof t?(r=t,t=void 0):"function"==typeof t&&(n=t,t=void 0):2===arguments.length?"number"==typeof t?"function"==typeof e?(n=e,e=void 0):"number"!=typeof e&&(r=e,e=void 0):(r=t,n=e,t=void 0,e=void 0):3===arguments.length&&("number"==typeof e?"function"==typeof r&&(n=r,r=void 0):(n=r,r=e,e=void 0)),r=r||{},void 0===t&&(t=r.bits||2048),void 0===e&&(e=r.e||65537),!i.options.usePureJavaScript&&!r.prng&&t>=256&&t<=16384&&(65537===e||3===e))if(n){if(_("generateKeyPair"))return a.generateKeyPair("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(t,e,r){if(t)return n(t);n(null,{privateKey:h.privateKeyFromPem(r),publicKey:h.publicKeyFromPem(e)})}));if(S("generateKey")&&S("exportKey"))return s.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:C(e),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(t){return s.globalScope.crypto.subtle.exportKey("pkcs8",t.privateKey)})).then(void 0,(function(t){n(t)})).then((function(t){if(t){var e=h.privateKeyFromAsn1(o.fromDer(i.util.createBuffer(t)));n(null,{privateKey:e,publicKey:h.setRsaPublicKey(e.n,e.e)})}}));if(E("generateKey")&&E("exportKey")){var u=s.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:C(e),hash:{name:"SHA-256"}},!0,["sign","verify"]);return u.oncomplete=function(t){var e=t.target.result,r=s.globalScope.msCrypto.subtle.exportKey("pkcs8",e.privateKey);r.oncomplete=function(t){var e=t.target.result,r=h.privateKeyFromAsn1(o.fromDer(i.util.createBuffer(e)));n(null,{privateKey:r,publicKey:h.setRsaPublicKey(r.n,r.e)})},r.onerror=function(t){n(t)}},void(u.onerror=function(t){n(t)})}}else if(_("generateKeyPairSync")){var f=a.generateKeyPairSync("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:h.privateKeyFromPem(f.privateKey),publicKey:h.publicKeyFromPem(f.publicKey)}}var l=h.rsa.createKeyPairGenerationState(t,e,r);if(!n)return h.rsa.stepKeyPairGenerationState(l,0),l.keys;b(l,r,n)},h.setRsaPublicKey=h.rsa.setPublicKey=function(t,e){var r={n:t,e:e,encrypt:function(t,e,n){if("string"==typeof e?e=e.toUpperCase():void 0===e&&(e="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===e)e={encode:function(t,e,r){return y(t,e,2).getBytes()}};else if("RSA-OAEP"===e||"RSAES-OAEP"===e)e={encode:function(t,e){return i.pkcs1.encode_rsa_oaep(e,t,n)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(e))e={encode:function(t){return t}};else if("string"==typeof e)throw new Error('Unsupported encryption scheme: "'+e+'".');var a=e.encode(t,r,!0);return h.rsa.encrypt(a,r,!0)},verify:function(t,e,n,a){"string"==typeof n?n=n.toUpperCase():void 0===n&&(n="RSASSA-PKCS1-V1_5"),void 0===a&&(a={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in a||(a._parseAllDigestBytes=!0),"RSASSA-PKCS1-V1_5"===n?n={verify:function(t,e){e=v(e,r,!0);var n=o.fromDer(e,{parseAllBytes:a._parseAllDigestBytes}),s={},h=[];if(!o.validate(n,p,s,h))throw(u=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.")).errors=h,u;var u,f=o.derToOid(s.algorithmIdentifier);if(f!==i.oids.md2&&f!==i.oids.md5&&f!==i.oids.sha1&&f!==i.oids.sha224&&f!==i.oids.sha256&&f!==i.oids.sha384&&f!==i.oids.sha512&&f!==i.oids["sha512-224"]&&f!==i.oids["sha512-256"])throw(u=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.")).oid=f,u;return t===s.digest}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(t,e){return t===(e=v(e,r,!0))}});var s=h.rsa.decrypt(e,r,!0,!1);return n.verify(t,s,r.n.bitLength())}};return r},h.setRsaPrivateKey=h.rsa.setPrivateKey=function(t,e,r,n,a,o,s,u){var f={n:t,e:e,d:r,p:n,q:a,dP:o,dQ:s,qInv:u,decrypt:function(t,e,r){"string"==typeof e?e=e.toUpperCase():void 0===e&&(e="RSAES-PKCS1-V1_5");var n=h.rsa.decrypt(t,f,!1,!1);if("RSAES-PKCS1-V1_5"===e)e={decode:v};else if("RSA-OAEP"===e||"RSAES-OAEP"===e)e={decode:function(t,e){return i.pkcs1.decode_rsa_oaep(e,t,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(e))throw new Error('Unsupported encryption scheme: "'+e+'".');e={decode:function(t){return t}}}return e.decode(n,f,!1)},sign:function(t,e){var r=!1;"string"==typeof e&&(e=e.toUpperCase()),void 0===e||"RSASSA-PKCS1-V1_5"===e?(e={encode:m},r=1):"NONE"!==e&&"NULL"!==e&&null!==e||(e={encode:function(){return t}},r=1);var i=e.encode(t,f.n.bitLength());return h.rsa.encrypt(i,f,r)}};return f},h.wrapRsaPrivateKey=function(t){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(h.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,o.toDer(t).getBytes())])},h.privateKeyFromAsn1=function(t){var e,r,a,s,u,c,d,p,m={},g=[];if(o.validate(t,f,m,g)&&(t=o.fromDer(i.util.createBuffer(m.privateKey))),m={},g=[],!o.validate(t,l,m,g)){var y=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw y.errors=g,y}return e=i.util.createBuffer(m.privateKeyModulus).toHex(),r=i.util.createBuffer(m.privateKeyPublicExponent).toHex(),a=i.util.createBuffer(m.privateKeyPrivateExponent).toHex(),s=i.util.createBuffer(m.privateKeyPrime1).toHex(),u=i.util.createBuffer(m.privateKeyPrime2).toHex(),c=i.util.createBuffer(m.privateKeyExponent1).toHex(),d=i.util.createBuffer(m.privateKeyExponent2).toHex(),p=i.util.createBuffer(m.privateKeyCoefficient).toHex(),h.setRsaPrivateKey(new n(e,16),new n(r,16),new n(a,16),new n(s,16),new n(u,16),new n(c,16),new n(d,16),new n(p,16))},h.privateKeyToAsn1=h.privateKeyToRSAPrivateKey=function(t){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,w(t.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,w(t.e)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,w(t.d)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,w(t.p)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,w(t.q)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,w(t.dP)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,w(t.dQ)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,w(t.qInv))])},h.publicKeyFromAsn1=function(t){var e={},r=[];if(o.validate(t,d,e,r)){var a,s=o.derToOid(e.publicKeyOid);if(s!==h.oids.rsaEncryption)throw(a=new Error("Cannot read public key. Unknown OID.")).oid=s,a;t=e.rsaPublicKey}if(r=[],!o.validate(t,c,e,r))throw(a=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,a;var u=i.util.createBuffer(e.publicKeyModulus).toHex(),f=i.util.createBuffer(e.publicKeyExponent).toHex();return h.setRsaPublicKey(new n(u,16),new n(f,16))},h.publicKeyToAsn1=h.publicKeyToSubjectPublicKeyInfo=function(t){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(h.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.BITSTRING,!1,[h.publicKeyToRSAPublicKey(t)])])},h.publicKeyToRSAPublicKey=function(t){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,w(t.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,w(t.e))])}},function(t,e,r){var i,n=r(1);t.exports=n.jsbn=n.jsbn||{};function a(t,e,r){this.data=[],null!=t&&("number"==typeof t?this.fromNumber(t,e,r):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function o(){return new a(null)}function s(t,e,r,i,n,a){for(var o=16383&e,s=e>>14;--a>=0;){var h=16383&this.data[t],u=this.data[t++]>>14,f=s*h+u*o;n=((h=o*h+((16383&f)<<14)+r.data[i]+n)>>28)+(f>>14)+s*u,r.data[i++]=268435455&h}return n}n.jsbn.BigInteger=a,"undefined"==typeof navigator?(a.prototype.am=s,i=28):"Microsoft Internet Explorer"==navigator.appName?(a.prototype.am=function(t,e,r,i,n,a){for(var o=32767&e,s=e>>15;--a>=0;){var h=32767&this.data[t],u=this.data[t++]>>15,f=s*h+u*o;n=((h=o*h+((32767&f)<<15)+r.data[i]+(1073741823&n))>>>30)+(f>>>15)+s*u+(n>>>30),r.data[i++]=1073741823&h}return n},i=30):"Netscape"!=navigator.appName?(a.prototype.am=function(t,e,r,i,n,a){for(;--a>=0;){var o=e*this.data[t++]+r.data[i]+n;n=Math.floor(o/67108864),r.data[i++]=67108863&o}return n},i=26):(a.prototype.am=s,i=28),a.prototype.DB=i,a.prototype.DM=(1<>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function m(t){this.m=t}function g(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function _(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function S(){}function E(t){return t}function C(t){this.r2=o(),this.q3=o(),a.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}m.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},m.prototype.revert=function(t){return t},m.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},m.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},m.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},g.prototype.convert=function(t){var e=o();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(a.ZERO)>0&&this.m.subTo(e,e),e},g.prototype.revert=function(t){var e=o();return t.copyTo(e),this.reduce(e),e},g.prototype.reduce=function(t){for(;t.t<=this.mt2;)t.data[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(r=e+this.m.t,t.data[r]+=this.m.am(0,i,t,e,0,this.m.t);t.data[r]>=t.DV;)t.data[r]-=t.DV,t.data[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},g.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},g.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},a.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t.data[e]=this.data[e];t.t=this.t,t.s=this.s},a.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this.data[0]=t:t<-1?this.data[0]=t+this.DV:this.t=0},a.prototype.fromString=function(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var i=t.length,n=!1,o=0;--i>=0;){var s=8==r?255&t[i]:c(t,i);s<0?"-"==t.charAt(i)&&(n=!0):(n=!1,0==o?this.data[this.t++]=s:o+r>this.DB?(this.data[this.t-1]|=(s&(1<>this.DB-o):this.data[this.t-1]|=s<=this.DB&&(o-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==t;)--this.t},a.prototype.dlShiftTo=function(t,e){var r;for(r=this.t-1;r>=0;--r)e.data[r+t]=this.data[r];for(r=t-1;r>=0;--r)e.data[r]=0;e.t=this.t+t,e.s=this.s},a.prototype.drShiftTo=function(t,e){for(var r=t;r=0;--r)e.data[r+o+1]=this.data[r]>>n|s,s=(this.data[r]&a)<=0;--r)e.data[r]=0;e.data[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()},a.prototype.rShiftTo=function(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var i=t%this.DB,n=this.DB-i,a=(1<>i;for(var o=r+1;o>i;i>0&&(e.data[this.t-r-1]|=(this.s&a)<>=this.DB;if(t.t>=this.DB;i+=this.s}else{for(i+=this.s;r>=this.DB;i-=t.s}e.s=i<0?-1:0,i<-1?e.data[r++]=this.DV+i:i>0&&(e.data[r++]=i),e.t=r,e.clamp()},a.prototype.multiplyTo=function(t,e){var r=this.abs(),i=t.abs(),n=r.t;for(e.t=n+i.t;--n>=0;)e.data[n]=0;for(n=0;n=0;)t.data[r]=0;for(r=0;r=e.DV&&(t.data[r+e.t]-=e.DV,t.data[r+e.t+1]=1)}t.t>0&&(t.data[t.t-1]+=e.am(r,e.data[r],t,2*r,0,1)),t.s=0,t.clamp()},a.prototype.divRemTo=function(t,e,r){var i=t.abs();if(!(i.t<=0)){var n=this.abs();if(n.t0?(i.lShiftTo(f,s),n.lShiftTo(f,r)):(i.copyTo(s),n.copyTo(r));var l=s.t,c=s.data[l-1];if(0!=c){var d=c*(1<1?s.data[l-2]>>this.F2:0),m=this.FV/d,g=(1<=0&&(r.data[r.t++]=1,r.subTo(w,r)),a.ONE.dlShiftTo(l,w),w.subTo(s,s);s.t=0;){var M=r.data[--v]==c?this.DM:Math.floor(r.data[v]*m+(r.data[v-1]+y)*g);if((r.data[v]+=s.am(0,M,r,b,0,l))0&&r.rShiftTo(f,r),h<0&&a.ZERO.subTo(r,r)}}},a.prototype.invDigit=function(){if(this.t<1)return 0;var t=this.data[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},a.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},a.prototype.exp=function(t,e){if(t>4294967295||t<1)return a.ONE;var r=o(),i=o(),n=e.convert(this),s=p(t)-1;for(n.copyTo(r);--s>=0;)if(e.sqrTo(r,i),(t&1<0)e.mulTo(i,n,r);else{var h=r;r=i,i=h}return e.revert(r)},a.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,i=(1<0)for(s>s)>0&&(n=!0,a=l(r));o>=0;)s>(s+=this.DB-e)):(r=this.data[o]>>(s-=e)&i,s<=0&&(s+=this.DB,--o)),r>0&&(n=!0),n&&(a+=l(r));return n?a:"0"},a.prototype.negate=function(){var t=o();return a.ZERO.subTo(this,t),t},a.prototype.abs=function(){return this.s<0?this.negate():this},a.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this.data[r]-t.data[r]))return e;return 0},a.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+p(this.data[this.t-1]^this.s&this.DM)},a.prototype.mod=function(t){var e=o();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(a.ZERO)>0&&t.subTo(e,e),e},a.prototype.modPowInt=function(t,e){var r;return r=t<256||e.isEven()?new m(e):new g(e),this.exp(t,r)},a.ZERO=d(0),a.ONE=d(1),S.prototype.convert=E,S.prototype.revert=E,S.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},S.prototype.sqrTo=function(t,e){t.squareTo(e)},C.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=o();return t.copyTo(e),this.reduce(e),e},C.prototype.revert=function(t){return t},C.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},C.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},C.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var A=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],T=(1<<26)/A[A.length-1];a.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},a.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),i=d(r),n=o(),a=o(),s="";for(this.divRemTo(i,n,a);n.signum()>0;)s=(r+a.intValue()).toString(t).substr(1)+s,n.divRemTo(i,n,a);return a.intValue().toString(t)+s},a.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),i=Math.pow(e,r),n=!1,o=0,s=0,h=0;h=r&&(this.dMultiply(i),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),n&&a.ZERO.subTo(this,this)},a.prototype.fromNumber=function(t,e,r){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(a.ONE.shiftLeft(t-1),v,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(a.ONE.shiftLeft(t-1),this);else{var i=new Array,n=7&t;i.length=1+(t>>3),e.nextBytes(i),n>0?i[0]&=(1<>=this.DB;if(t.t>=this.DB;i+=this.s}else{for(i+=this.s;r>=this.DB;i+=t.s}e.s=i<0?-1:0,i>0?e.data[r++]=i:i<-1&&(e.data[r++]=this.DV+i),e.t=r,e.clamp()},a.prototype.dMultiply=function(t){this.data[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},a.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this.data[this.t++]=0;for(this.data[e]+=t;this.data[e]>=this.DV;)this.data[e]-=this.DV,++e>=this.t&&(this.data[this.t++]=0),++this.data[e]}},a.prototype.multiplyLowerTo=function(t,e,r){var i,n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r.data[--n]=0;for(i=r.t-this.t;n=0;)r.data[i]=0;for(i=Math.max(e-this.t,0);i0)if(0==e)r=this.data[0]%t;else for(var i=this.t-1;i>=0;--i)r=(e*r+this.data[i])%t;return r},a.prototype.millerRabin=function(t){var e=this.subtract(a.ONE),r=e.getLowestSetBit();if(r<=0)return!1;for(var i,n=e.shiftRight(r),o={nextBytes:function(t){for(var e=0;e=0);var h=i.modPow(n,this);if(0!=h.compareTo(a.ONE)&&0!=h.compareTo(e)){for(var u=1;u++>24},a.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},a.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},a.prototype.toByteArray=function(){var t=this.t,e=new Array;e[0]=this.s;var r,i=this.DB-t*this.DB%8,n=0;if(t-- >0)for(i>i)!=(this.s&this.DM)>>i&&(e[n++]=r|this.s<=0;)i<8?(r=(this.data[t]&(1<>(i+=this.DB-8)):(r=this.data[t]>>(i-=8)&255,i<=0&&(i+=this.DB,--t)),0!=(128&r)&&(r|=-256),0==n&&(128&this.s)!=(128&r)&&++n,(n>0||r!=this.s)&&(e[n++]=r);return e},a.prototype.equals=function(t){return 0==this.compareTo(t)},a.prototype.min=function(t){return this.compareTo(t)<0?this:t},a.prototype.max=function(t){return this.compareTo(t)>0?this:t},a.prototype.and=function(t){var e=o();return this.bitwiseTo(t,y,e),e},a.prototype.or=function(t){var e=o();return this.bitwiseTo(t,v,e),e},a.prototype.xor=function(t){var e=o();return this.bitwiseTo(t,b,e),e},a.prototype.andNot=function(t){var e=o();return this.bitwiseTo(t,w,e),e},a.prototype.not=function(){for(var t=o(),e=0;e=this.t?0!=this.s:0!=(this.data[e]&1<1){var l=o();for(i.sqrTo(s[1],l);h<=f;)s[h]=o(),i.mulTo(l,s[h-2],s[h]),h+=2}var c,y,v=t.t-1,b=!0,w=o();for(n=p(t.data[v])-1;v>=0;){for(n>=u?c=t.data[v]>>n-u&f:(c=(t.data[v]&(1<0&&(c|=t.data[v-1]>>this.DB+n-u)),h=r;0==(1&c);)c>>=1,--h;if((n-=h)<0&&(n+=this.DB,--v),b)s[c].copyTo(a),b=!1;else{for(;h>1;)i.sqrTo(a,w),i.sqrTo(w,a),h-=2;h>0?i.sqrTo(a,w):(y=a,a=w,w=y),i.mulTo(w,s[c],a)}for(;v>=0&&0==(t.data[v]&1<=0?(r.subTo(i,r),e&&n.subTo(s,n),o.subTo(h,o)):(i.subTo(r,i),e&&s.subTo(n,s),h.subTo(o,h))}return 0!=i.compareTo(a.ONE)?a.ZERO:h.compareTo(t)>=0?h.subtract(t):h.signum()<0?(h.addTo(t,h),h.signum()<0?h.add(t):h):h},a.prototype.pow=function(t){return this.exp(t,new S)},a.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var i=e;e=r,r=i}var n=e.getLowestSetBit(),a=r.getLowestSetBit();if(a<0)return e;for(n0&&(e.rShiftTo(a,e),r.rShiftTo(a,r));e.signum()>0;)(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return a>0&&r.lShiftTo(a,r),r},a.prototype.isProbablePrime=function(t){var e,r=this.abs();if(1==r.t&&r.data[0]<=A[A.length-1]){for(e=0;e{Object.prototype.hasOwnProperty.call(a,t)||(a[t]={}),o=a,a=a[t]});const s=t.split(".").pop();"$"===s?r=e:"object"!=typeof e||e instanceof Array?o[s]=e:("object"!=typeof o[s]&&(o[s]={}),function(t,e){for(const r in e)t[r]=e[r]}(o[s],e))}return r},t.exports.deleteNode=function(t,e,r){r=r||[];let i=e;if(null!=t&&null!=e){const n=t.split("."),a=n[n.length-1];n.forEach((t,r)=>{i=e,Object.prototype.hasOwnProperty.call(e,t)&&(e=e[t])&&r===n.length-1&&delete i[a]}),function(t,e,r){1===e.length&&(r="$"===e[0]?Object.keys(t):r).forEach(e=>{delete t[e]})}(e,n,r)}},t.exports.getPrivateKey=function(t){if(t.privateKey)return function(t){const e=a.readFileSync(t,"binary");if(!e||e.length<=1)throw new Error("Private key content not valid");return n.pki.privateKeyFromAsn1(n.asn1.fromDer(e))}(t.privateKey);if(t.keyStore){if(t.keyStore.includes(".p12"))return function(t,e,r){const i=a.readFileSync(t,"binary");if(!i||i.length<=1)throw new Error("p12 keystore content is empty");if(!s(e))throw new Error("Key alias is not set");if(!s(r))throw new Error("Keystore password is not set");const o=n.asn1.fromDer(i,!1),h=n.pkcs12.pkcs12FromAsn1(o,!1,r).getBags({friendlyName:e,bagType:n.pki.oids.pkcs8ShroudedKeyBag}).friendlyName[0];if(!s(h))throw new Error("No key found for alias ["+e+"]");return h.key}(t.keyStore,t.keyStoreAlias,t.keyStorePassword);if(t.keyStore.includes(".pem"))return function(t){let e=a.readFileSync(t,"binary");if(!e||e.length<=1)throw new Error("pem keystore content is empty");return e=e.replace("\n",""),e=e.replace("\r\n",""),n.pki.privateKeyFromPem(e)}(t.keyStore);if(t.keyStore.includes(".der"))return function(t){const e=a.readFileSync(t,"binary");if(!e||e.length<=1)throw new Error("der keystore content is empty");const r=n.asn1.fromDer(e);return n.pki.privateKeyFromAsn1(r)}(t.keyStore)}return null},t.exports.readPublicCertificate=function(t){const e=a.readFileSync(t);if(!e||e.length<=1)throw new Error("Public certificate content is not valid");return n.pki.certificateFromPem(e)},t.exports.computePublicFingerprint=function(t,e,r){let i=null;if(t&&t.publicKeyFingerprintType)switch(t.publicKeyFingerprintType){case"certificate":i=function(t,e){const r=n.asn1.toDer(n.pki.certificateToAsn1(t)).getBytes(),i=u("SHA-256");return i.update(r),h(i.digest().getBytes(),e)}(e,r);break;case"publicKey":a=e,i=n.pki.getPublicKeyFingerprint(a.publicKey,{type:"SubjectPublicKeyInfo",md:u("SHA-256"),encoding:o.HEX})}var a;return i},t.exports.nodeVersionSupportsJWE=function(){return parseInt(i.version.substring(1,3))>12},t.exports.checkConfigFieldsArePopulated=function(t,e,r,i){const n=e=>e.every(e=>null!==t[e]&&void 0!==t[e]);if("object"!=typeof t||null===t)throw Error("Config not valid: config should be an object.");if(null===t.paths||void 0===t.paths||!(t.paths instanceof Array))throw Error("Config not valid: paths should be an array of path element.");if(!n(e))throw Error("Config not valid: please check that all the properties are defined.");if(r&&i&&!n(r)&&!n(i))throw Error("Config not valid: please check that all the properties are defined.");if(0===t.paths.length)throw Error("Config not valid: paths should be not empty.");return n},t.exports.validateRootMapping=function(t){function e(t){return 1!==t.length&&t.some(t=>"$"===t.obj||"$"===t.element)}t.paths.forEach(t=>{if(e(t.toEncrypt)||e(t.toDecrypt))throw Error("Config not valid: found multiple configurations encrypt/decrypt with root mapping")})},t.exports.hasConfig=function(t,e){if(t&&e){e=e.split("?").shift();const r=t.paths.find(t=>{const r=new RegExp(t.path,"g");return e.match(r)});return r||null}return null},t.exports.elemFromPath=function(t,e){try{let r=null;const i=t.split(".");return t&&i.length>0&&i.forEach(t=>{r=e,e=f(t)?e:e[t]}),{node:e,parent:r}}catch(t){return null}},t.exports.isJsonRoot=function(t){return f(t)},t.exports.computeBody=function(t,e,r){return function(t,e){return t&&1===t.length&&e&&e[0]}(t,r)?r.pop():e},t.exports.readPublicCertificateContent=function(t){if(!t.encryptionCertificate||t.encryptionCertificate.length<=1)throw new Error("Public certificate content is not valid");return n.pki.certificateFromPem(t.encryptionCertificate)},t.exports.getPrivateKeyFromContent=function(t){return t.privateKey?n.pki.privateKeyFromPem(t.privateKey):null}}).call(this,r(4).Buffer,r(5))},function(t,e,r){"use strict";(function(e){void 0===e||!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:function(t,r,i,n){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var a,o,s=arguments.length;switch(s){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick((function(){t.call(null,r)}));case 3:return e.nextTick((function(){t.call(null,r,i)}));case 4:return e.nextTick((function(){t.call(null,r,i,n)}));default:for(a=new Array(s-1),o=0;o>>24]^f[p>>>16&255]^l[m>>>8&255]^c[255&g]^e[y++],o=u[p>>>24]^f[m>>>16&255]^l[g>>>8&255]^c[255&d]^e[y++],s=u[m>>>24]^f[g>>>16&255]^l[d>>>8&255]^c[255&p]^e[y++],h=u[g>>>24]^f[d>>>16&255]^l[p>>>8&255]^c[255&m]^e[y++],d=a,p=o,m=s,g=h;return a=(i[d>>>24]<<24|i[p>>>16&255]<<16|i[m>>>8&255]<<8|i[255&g])^e[y++],o=(i[p>>>24]<<24|i[m>>>16&255]<<16|i[g>>>8&255]<<8|i[255&d])^e[y++],s=(i[m>>>24]<<24|i[g>>>16&255]<<16|i[d>>>8&255]<<8|i[255&p])^e[y++],h=(i[g>>>24]<<24|i[d>>>16&255]<<16|i[p>>>8&255]<<8|i[255&m])^e[y++],[a>>>=0,o>>>=0,s>>>=0,h>>>=0]}var s=[0,1,2,4,8,16,32,64,128,27,54],h=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],i=[],n=[[],[],[],[]],a=[[],[],[],[]],o=0,s=0,h=0;h<256;++h){var u=s^s<<1^s<<2^s<<3^s<<4;u=u>>>8^255&u^99,r[o]=u,i[u]=o;var f=t[o],l=t[f],c=t[l],d=257*t[u]^16843008*u;n[0][o]=d<<24|d>>>8,n[1][o]=d<<16|d>>>16,n[2][o]=d<<8|d>>>24,n[3][o]=d,d=16843009*c^65537*l^257*f^16843008*o,a[0][u]=d<<24|d>>>8,a[1][u]=d<<16|d>>>16,a[2][u]=d<<8|d>>>24,a[3][u]=d,0===o?o=s=1:(o=f^t[t[t[c^f]]],s^=t[t[s]])}return{SBOX:r,INV_SBOX:i,SUB_MIX:n,INV_SUB_MIX:a}}();function u(t){this._key=n(t),this._reset()}u.blockSize=16,u.keySize=32,u.prototype.blockSize=u.blockSize,u.prototype.keySize=u.keySize,u.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,i=4*(r+1),n=[],a=0;a>>24,o=h.SBOX[o>>>24]<<24|h.SBOX[o>>>16&255]<<16|h.SBOX[o>>>8&255]<<8|h.SBOX[255&o],o^=s[a/e|0]<<24):e>6&&a%e==4&&(o=h.SBOX[o>>>24]<<24|h.SBOX[o>>>16&255]<<16|h.SBOX[o>>>8&255]<<8|h.SBOX[255&o]),n[a]=n[a-e]^o}for(var u=[],f=0;f>>24]]^h.INV_SUB_MIX[1][h.SBOX[c>>>16&255]]^h.INV_SUB_MIX[2][h.SBOX[c>>>8&255]]^h.INV_SUB_MIX[3][h.SBOX[255&c]]}this._nRounds=r,this._keySchedule=n,this._invKeySchedule=u},u.prototype.encryptBlockRaw=function(t){return o(t=n(t),this._keySchedule,h.SUB_MIX,h.SBOX,this._nRounds)},u.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=i.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},u.prototype.decryptBlock=function(t){var e=(t=n(t))[1];t[1]=t[3],t[3]=e;var r=o(t,this._invKeySchedule,h.INV_SUB_MIX,h.INV_SBOX,this._nRounds),a=i.allocUnsafe(16);return a.writeUInt32BE(r[0],0),a.writeUInt32BE(r[3],4),a.writeUInt32BE(r[2],8),a.writeUInt32BE(r[1],12),a},u.prototype.scrub=function(){a(this._keySchedule),a(this._invKeySchedule),a(this._key)},t.exports.AES=u},function(t,e,r){var i=r(2).Buffer,n=r(53);t.exports=function(t,e,r,a){if(i.isBuffer(t)||(t=i.from(t,"binary")),e&&(i.isBuffer(e)||(e=i.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var o=r/8,s=i.alloc(o),h=i.alloc(a||0),u=i.alloc(0);o>0||a>0;){var f=new n;f.update(u),f.update(t),e&&f.update(e),u=f.digest();var l=0;if(o>0){var c=s.length-o;l=Math.min(o,u.length),u.copy(s,c,0,l),o-=l}if(l0){var d=h.length-a,p=Math.min(a,u.length-l);u.copy(h,d,l,l+p),a-=p}}return u.fill(0),{key:s,iv:h}}},function(t,e,r){"use strict";var i=r(13),n=r(8),a=n.getNAF,o=n.getJSF,s=n.assert;function h(t,e){this.type=t,this.p=new i(e.p,16),this.red=e.prime?i.red(e.prime):i.mont(this.p),this.zero=new i(0).toRed(this.red),this.one=new i(1).toRed(this.red),this.two=new i(2).toRed(this.red),this.n=e.n&&new i(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function u(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=h,h.prototype.point=function(){throw new Error("Not implemented")},h.prototype.validate=function(){throw new Error("Not implemented")},h.prototype._fixedNafMul=function(t,e){s(t.precomputed);var r=t._getDoubles(),i=a(e,1,this._bitLength),n=(1<=o;f--)h=(h<<1)+i[f];u.push(h)}for(var l=this.jpoint(null,null,null),c=this.jpoint(null,null,null),d=n;d>0;d--){for(o=0;o=0;u--){for(var f=0;u>=0&&0===o[u];u--)f++;if(u>=0&&f++,h=h.dblp(f),u<0)break;var l=o[u];s(0!==l),h="affine"===t.type?l>0?h.mixedAdd(n[l-1>>1]):h.mixedAdd(n[-l-1>>1].neg()):l>0?h.add(n[l-1>>1]):h.add(n[-l-1>>1].neg())}return"affine"===t.type?h.toP():h},h.prototype._wnafMulAdd=function(t,e,r,i,n){var s,h,u,f=this._wnafT1,l=this._wnafT2,c=this._wnafT3,d=0;for(s=0;s=1;s-=2){var m=s-1,g=s;if(1===f[m]&&1===f[g]){var y=[e[m],null,null,e[g]];0===e[m].y.cmp(e[g].y)?(y[1]=e[m].add(e[g]),y[2]=e[m].toJ().mixedAdd(e[g].neg())):0===e[m].y.cmp(e[g].y.redNeg())?(y[1]=e[m].toJ().mixedAdd(e[g]),y[2]=e[m].add(e[g].neg())):(y[1]=e[m].toJ().mixedAdd(e[g]),y[2]=e[m].toJ().mixedAdd(e[g].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],b=o(r[m],r[g]);for(d=Math.max(b[0].length,d),c[m]=new Array(d),c[g]=new Array(d),h=0;h=0;s--){for(var E=0;s>=0;){var C=!0;for(h=0;h=0&&E++,_=_.dblp(E),s<0)break;for(h=0;h0?u=l[h][A-1>>1]:A<0&&(u=l[h][-A-1>>1].neg()),_="affine"===u.type?_.mixedAdd(u):_.add(u))}}for(s=0;s=Math.ceil((t.bitLength()+1)/e.step)},u.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n>>0,s>>>0];for(var h=n.fullMessageLength.length-1;h>=0;--h)n.fullMessageLength[h]+=s[1],s[1]=s[0]+(n.fullMessageLength[h]/4294967296>>>0),n.fullMessageLength[h]=n.fullMessageLength[h]>>>0,s[0]=s[1]/4294967296>>>0;return e.putBytes(a),f(t,r,e),(e.read>2048||0===e.length())&&e.compact(),n},n.digest=function(){var o=i.util.createBuffer();o.putBytes(e.bytes());var s=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize&n.blockLength-1;o.putBytes(a.substr(0,n.blockLength-s));for(var h,u=0,l=n.fullMessageLength.length-1;l>=0;--l)u=(h=8*n.fullMessageLength[l]+u)/4294967296>>>0,o.putInt32Le(h>>>0);var c={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3};f(c,r,o);var d=i.util.createBuffer();return d.putInt32Le(c.h0),d.putInt32Le(c.h1),d.putInt32Le(c.h2),d.putInt32Le(c.h3),d},n};var a=null,o=null,s=null,h=null,u=!1;function f(t,e,r){for(var i,n,a,u,f,l,c,d=r.length();d>=64;){for(n=t.h0,a=t.h1,u=t.h2,f=t.h3,c=0;c<16;++c)e[c]=r.getInt32Le(),i=n+(f^a&(u^f))+h[c]+e[c],n=f,f=u,u=a,a+=i<<(l=s[c])|i>>>32-l;for(;c<32;++c)i=n+(u^f&(a^u))+h[c]+e[o[c]],n=f,f=u,u=a,a+=i<<(l=s[c])|i>>>32-l;for(;c<48;++c)i=n+(a^u^f)+h[c]+e[o[c]],n=f,f=u,u=a,a+=i<<(l=s[c])|i>>>32-l;for(;c<64;++c)i=n+(u^(a|~f))+h[c]+e[o[c]],n=f,f=u,u=a,a+=i<<(l=s[c])|i>>>32-l;t.h0=t.h0+n|0,t.h1=t.h1+a|0,t.h2=t.h2+u|0,t.h3=t.h3+f|0,d-=64}}},function(t,e,r){(function(e){var i=r(1);r(28),r(12),r(3);var n,a=i.pkcs5=i.pkcs5||{};i.util.isNodejs&&!i.options.usePureJavaScript&&(n=r(49)),t.exports=i.pbkdf2=a.pbkdf2=function(t,r,a,o,s,h){if("function"==typeof s&&(h=s,s=null),i.util.isNodejs&&!i.options.usePureJavaScript&&n.pbkdf2&&(null===s||"object"!=typeof s)&&(n.pbkdf2Sync.length>4||!s||"sha1"===s))return"string"!=typeof s&&(s="sha1"),t=e.from(t,"binary"),r=e.from(r,"binary"),h?4===n.pbkdf2Sync.length?n.pbkdf2(t,r,a,o,(function(t,e){if(t)return h(t);h(null,e.toString("binary"))})):n.pbkdf2(t,r,a,o,s,(function(t,e){if(t)return h(t);h(null,e.toString("binary"))})):4===n.pbkdf2Sync.length?n.pbkdf2Sync(t,r,a,o).toString("binary"):n.pbkdf2Sync(t,r,a,o,s).toString("binary");if(null==s&&(s="sha1"),"string"==typeof s){if(!(s in i.md.algorithms))throw new Error("Unknown hash algorithm: "+s);s=i.md[s].create()}var u=s.digestLength;if(o>4294967295*u){var f=new Error("Derived key is too long.");if(h)return h(f);throw f}var l=Math.ceil(o/u),c=o-(l-1)*u,d=i.hmac.create();d.start(s,t);var p,m,g,y="";if(!h){for(var v=1;v<=l;++v){d.start(null,null),d.update(r),d.update(i.util.int32ToBytes(v)),p=g=d.digest().getBytes();for(var b=2;b<=a;++b)d.start(null,null),d.update(g),m=d.digest().getBytes(),p=i.util.xorBytes(p,m,u),g=m;y+=vl)return h(null,y);d.start(null,null),d.update(r),d.update(i.util.int32ToBytes(v)),p=g=d.digest().getBytes(),b=2,M()}function M(){if(b<=a)return d.start(null,null),d.update(g),m=d.digest().getBytes(),p=i.util.xorBytes(p,m,u),g=m,++b,i.util.setImmediate(M);y+=v128)throw new Error('Invalid "nsComment" content.');t.value=n.create(n.Class.UNIVERSAL,n.Type.IA5STRING,!1,t.comment)}else if("subjectKeyIdentifier"===t.name&&e.cert){var d=e.cert.generateSubjectKeyIdentifier();t.subjectKeyIdentifier=d.toHex(),t.value=n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,d.getBytes())}else if("authorityKeyIdentifier"===t.name&&e.cert){t.value=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);f=t.value.value;if(t.keyIdentifier){var p=!0===t.keyIdentifier?e.cert.generateSubjectKeyIdentifier().getBytes():t.keyIdentifier;f.push(n.create(n.Class.CONTEXT_SPECIFIC,0,!1,p))}if(t.authorityCertIssuer){var m=[n.create(n.Class.CONTEXT_SPECIFIC,4,!0,[y(!0===t.authorityCertIssuer?e.cert.issuer:t.authorityCertIssuer)])];f.push(n.create(n.Class.CONTEXT_SPECIFIC,1,!0,m))}if(t.serialNumber){var g=i.util.hexToBytes(!0===t.serialNumber?e.cert.serialNumber:t.serialNumber);f.push(n.create(n.Class.CONTEXT_SPECIFIC,2,!1,g))}}else if("cRLDistributionPoints"===t.name){t.value=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);f=t.value.value;var v,b=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]),w=n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[]);for(c=0;c2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(l.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(h.validity.notBefore=l[0],h.validity.notAfter=l[1],h.tbsCertificate=r.tbsCertificate,e){h.md=m({signatureOid:h.signatureOid,type:"certificate"});var c=n.toDer(h.tbsCertificate);h.md.update(c.getBytes())}var g=i.md.sha1.create(),y=n.toDer(r.certIssuer);g.update(y.getBytes()),h.issuer.getField=function(t){return d(h.issuer,t)},h.issuer.addField=function(t){v([t]),h.issuer.attributes.push(t)},h.issuer.attributes=a.RDNAttributesAsArray(r.certIssuer),r.certIssuerUniqueId&&(h.issuer.uniqueId=r.certIssuerUniqueId),h.issuer.hash=g.digest().toHex();var b=i.md.sha1.create(),w=n.toDer(r.certSubject);return b.update(w.getBytes()),h.subject.getField=function(t){return d(h.subject,t)},h.subject.addField=function(t){v([t]),h.subject.attributes.push(t)},h.subject.attributes=a.RDNAttributesAsArray(r.certSubject),r.certSubjectUniqueId&&(h.subject.uniqueId=r.certSubjectUniqueId),h.subject.hash=b.digest().toHex(),r.certExtensions?h.extensions=a.certificateExtensionsFromAsn1(r.certExtensions):h.extensions=[],h.publicKey=a.publicKeyFromAsn1(r.subjectPublicKeyInfo),h},a.certificateExtensionsFromAsn1=function(t){for(var e=[],r=0;r1&&(r=h.value.charCodeAt(1),a=h.value.length>2?h.value.charCodeAt(2):0),e.digitalSignature=128==(128&r),e.nonRepudiation=64==(64&r),e.keyEncipherment=32==(32&r),e.dataEncipherment=16==(16&r),e.keyAgreement=8==(8&r),e.keyCertSign=4==(4&r),e.cRLSign=2==(2&r),e.encipherOnly=1==(1&r),e.decipherOnly=128==(128&a)}else if("basicConstraints"===e.name){(h=n.fromDer(e.value)).value.length>0&&h.value[0].type===n.Type.BOOLEAN?e.cA=0!==h.value[0].value.charCodeAt(0):e.cA=!1;var s=null;h.value.length>0&&h.value[0].type===n.Type.INTEGER?s=h.value[0].value:h.value.length>1&&(s=h.value[1].value),null!==s&&(e.pathLenConstraint=n.derToInteger(s))}else if("extKeyUsage"===e.name)for(var h=n.fromDer(e.value),u=0;u1&&(r=h.value.charCodeAt(1)),e.client=128==(128&r),e.server=64==(64&r),e.email=32==(32&r),e.objsign=16==(16&r),e.reserved=8==(8&r),e.sslCA=4==(4&r),e.emailCA=2==(2&r),e.objCA=1==(1&r)}else if("subjectAltName"===e.name||"issuerAltName"===e.name){var l;e.altNames=[];h=n.fromDer(e.value);for(var c=0;c=_&&t0&&o.value.push(a.certificateExtensionsToAsn1(t.extensions)),o},a.getCertificationRequestInfo=function(t){return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(t.version).getBytes()),y(t.subject),a.publicKeyToAsn1(t.publicKey),M(t)])},a.distinguishedNameToAsn1=function(t){return y(t)},a.certificateToAsn1=function(t){var e=t.tbsCertificate||a.getTBSCertificate(t);return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[e,n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(t.signatureOid).getBytes()),w(t.signatureOid,t.signatureParameters)]),n.create(n.Class.UNIVERSAL,n.Type.BITSTRING,!1,String.fromCharCode(0)+t.signature)])},a.certificateExtensionsToAsn1=function(t){var e=n.create(n.Class.CONTEXT_SPECIFIC,3,!0,[]),r=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);e.value.push(r);for(var i=0;if.validity.notAfter)&&(h={message:"Certificate is not valid yet or has expired.",error:a.certificateError.certificate_expired,notBefore:f.validity.notBefore,notAfter:f.validity.notAfter,now:o}),null===h){if(null===(l=e[0]||t.getIssuer(f))&&f.isIssuer(f)&&(c=!0,l=f),l){var d=l;i.util.isArray(d)||(d=[d]);for(var p=!1;!p&&d.length>0;){l=d.shift();try{p=l.verify(f)}catch(t){}}p||(h={message:"Certificate signature is invalid.",error:a.certificateError.bad_certificate})}null!==h||l&&!c||t.hasCertificate(f)||(h={message:"Certificate is not trusted.",error:a.certificateError.unknown_ca})}if(null===h&&l&&!f.isIssuer(l)&&(h={message:"Certificate issuer is invalid.",error:a.certificateError.bad_certificate}),null===h)for(var m={keyUsage:!0,basicConstraints:!0},g=0;null===h&&gv.pathLenConstraint&&(h={message:"Certificate basicConstraints pathLenConstraint violated.",error:a.certificateError.bad_certificate})}var w=null===h||h.error,M=r.verify?r.verify(w,u,n):w;if(!0!==M)throw!0===w&&(h={message:"The application rejected the certificate.",error:a.certificateError.bad_certificate}),(M||0===M)&&("object"!=typeof M||i.util.isArray(M)?"string"==typeof M&&(h.error=M):(M.message&&(h.message=M.message),M.error&&(h.error=M.error))),h;h=null,s=!1,++u}while(e.length>0);return!0}},function(t,e,r){var i=r(1);r(9),r(3),(t.exports=i.pss=i.pss||{}).create=function(t){3===arguments.length&&(t={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var e,r=t.md,n=t.mgf,a=r.digestLength,o=t.salt||null;if("string"==typeof o&&(o=i.util.createBuffer(o)),"saltLength"in t)e=t.saltLength;else{if(null===o)throw new Error("Salt length not specified or specific salt not given.");e=o.length()}if(null!==o&&o.length()!==e)throw new Error("Given salt length does not match length of given salt.");var s=t.prng||i.random,h={encode:function(t,h){var u,f,l=h-1,c=Math.ceil(l/8),d=t.digest().getBytes();if(c>8*c-l&255;return(w=String.fromCharCode(w.charCodeAt(0)&~M)+w.substr(1))+m+String.fromCharCode(188)},verify:function(t,o,s){var h,u=s-1,f=Math.ceil(u/8);if(o=o.substr(-f),f>8*f-u&255;if(0!=(c.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var m=n.generate(d,l),g="";for(h=0;h>>32-e}function u(t,e,r,i,n,a,o){return h(t+(e&r|~e&i)+n+a|0,o)+e|0}function f(t,e,r,i,n,a,o){return h(t+(e&i|r&~i)+n+a|0,o)+e|0}function l(t,e,r,i,n,a,o){return h(t+(e^r^i)+n+a|0,o)+e|0}function c(t,e,r,i,n,a,o){return h(t+(r^(e|~i))+n+a|0,o)+e|0}i(s,n),s.prototype._update=function(){for(var t=o,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,i=this._b,n=this._c,a=this._d;r=u(r,i,n,a,t[0],3614090360,7),a=u(a,r,i,n,t[1],3905402710,12),n=u(n,a,r,i,t[2],606105819,17),i=u(i,n,a,r,t[3],3250441966,22),r=u(r,i,n,a,t[4],4118548399,7),a=u(a,r,i,n,t[5],1200080426,12),n=u(n,a,r,i,t[6],2821735955,17),i=u(i,n,a,r,t[7],4249261313,22),r=u(r,i,n,a,t[8],1770035416,7),a=u(a,r,i,n,t[9],2336552879,12),n=u(n,a,r,i,t[10],4294925233,17),i=u(i,n,a,r,t[11],2304563134,22),r=u(r,i,n,a,t[12],1804603682,7),a=u(a,r,i,n,t[13],4254626195,12),n=u(n,a,r,i,t[14],2792965006,17),r=f(r,i=u(i,n,a,r,t[15],1236535329,22),n,a,t[1],4129170786,5),a=f(a,r,i,n,t[6],3225465664,9),n=f(n,a,r,i,t[11],643717713,14),i=f(i,n,a,r,t[0],3921069994,20),r=f(r,i,n,a,t[5],3593408605,5),a=f(a,r,i,n,t[10],38016083,9),n=f(n,a,r,i,t[15],3634488961,14),i=f(i,n,a,r,t[4],3889429448,20),r=f(r,i,n,a,t[9],568446438,5),a=f(a,r,i,n,t[14],3275163606,9),n=f(n,a,r,i,t[3],4107603335,14),i=f(i,n,a,r,t[8],1163531501,20),r=f(r,i,n,a,t[13],2850285829,5),a=f(a,r,i,n,t[2],4243563512,9),n=f(n,a,r,i,t[7],1735328473,14),r=l(r,i=f(i,n,a,r,t[12],2368359562,20),n,a,t[5],4294588738,4),a=l(a,r,i,n,t[8],2272392833,11),n=l(n,a,r,i,t[11],1839030562,16),i=l(i,n,a,r,t[14],4259657740,23),r=l(r,i,n,a,t[1],2763975236,4),a=l(a,r,i,n,t[4],1272893353,11),n=l(n,a,r,i,t[7],4139469664,16),i=l(i,n,a,r,t[10],3200236656,23),r=l(r,i,n,a,t[13],681279174,4),a=l(a,r,i,n,t[0],3936430074,11),n=l(n,a,r,i,t[3],3572445317,16),i=l(i,n,a,r,t[6],76029189,23),r=l(r,i,n,a,t[9],3654602809,4),a=l(a,r,i,n,t[12],3873151461,11),n=l(n,a,r,i,t[15],530742520,16),r=c(r,i=l(i,n,a,r,t[2],3299628645,23),n,a,t[0],4096336452,6),a=c(a,r,i,n,t[7],1126891415,10),n=c(n,a,r,i,t[14],2878612391,15),i=c(i,n,a,r,t[5],4237533241,21),r=c(r,i,n,a,t[12],1700485571,6),a=c(a,r,i,n,t[3],2399980690,10),n=c(n,a,r,i,t[10],4293915773,15),i=c(i,n,a,r,t[1],2240044497,21),r=c(r,i,n,a,t[8],1873313359,6),a=c(a,r,i,n,t[15],4264355552,10),n=c(n,a,r,i,t[6],2734768916,15),i=c(i,n,a,r,t[13],1309151649,21),r=c(r,i,n,a,t[4],4149444226,6),a=c(a,r,i,n,t[11],3174756917,10),n=c(n,a,r,i,t[2],718787259,15),i=c(i,n,a,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+i|0,this._c=this._c+n|0,this._d=this._d+a|0},s.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=a.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=s},function(t,e,r){(function(e){function r(t){try{if(!e.localStorage)return!1}catch(t){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=function(t,e){if(r("noDeprecation"))return t;var i=!1;return function(){if(!i){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),i=!0}return t.apply(this,arguments)}}}).call(this,r(6))},function(t,e,r){"use strict";var i=r(23).codes.ERR_STREAM_PREMATURE_CLOSE;function n(){}t.exports=function t(e,r,a){if("function"==typeof r)return t(e,null,r);r||(r={}),a=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n>>32-e}function m(t,e,r,i,n,a,o,s){return p(t+(e^r^i)+a+o|0,s)+n|0}function g(t,e,r,i,n,a,o,s){return p(t+(e&r|~e&i)+a+o|0,s)+n|0}function y(t,e,r,i,n,a,o,s){return p(t+((e|~r)^i)+a+o|0,s)+n|0}function v(t,e,r,i,n,a,o,s){return p(t+(e&i|r&~i)+a+o|0,s)+n|0}function b(t,e,r,i,n,a,o,s){return p(t+(e^(r|~i))+a+o|0,s)+n|0}n(d,a),d.prototype._update=function(){for(var t=o,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,i=0|this._b,n=0|this._c,a=0|this._d,d=0|this._e,w=0|this._a,M=0|this._b,_=0|this._c,S=0|this._d,E=0|this._e,C=0;C<80;C+=1){var A,T;C<16?(A=m(r,i,n,a,d,t[s[C]],l[0],u[C]),T=b(w,M,_,S,E,t[h[C]],c[0],f[C])):C<32?(A=g(r,i,n,a,d,t[s[C]],l[1],u[C]),T=v(w,M,_,S,E,t[h[C]],c[1],f[C])):C<48?(A=y(r,i,n,a,d,t[s[C]],l[2],u[C]),T=y(w,M,_,S,E,t[h[C]],c[2],f[C])):C<64?(A=v(r,i,n,a,d,t[s[C]],l[3],u[C]),T=g(w,M,_,S,E,t[h[C]],c[3],f[C])):(A=b(r,i,n,a,d,t[s[C]],l[4],u[C]),T=m(w,M,_,S,E,t[h[C]],c[4],f[C])),r=d,d=a,a=p(n,10),n=i,i=A,w=E,E=S,S=p(_,10),_=M,M=T}var B=this._b+n+S|0;this._b=this._c+a+E|0,this._c=this._d+d+w|0,this._d=this._e+r+M|0,this._e=this._a+i+_|0,this._a=B},d.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=i.alloc?i.alloc(20):new i(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},t.exports=d},function(t,e,r){(e=t.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}).sha=r(172),e.sha1=r(173),e.sha224=r(174),e.sha256=r(99),e.sha384=r(175),e.sha512=r(100)},function(t,e,r){(e=t.exports=r(101)).Stream=e,e.Readable=e,e.Writable=r(60),e.Duplex=r(19),e.Transform=r(104),e.PassThrough=r(181)},function(t,e,r){var i=r(4),n=i.Buffer;function a(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(a(i,e),e.Buffer=o),a(n,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i.SlowBuffer(t)}},function(t,e,r){"use strict";(function(e,i,n){var a=r(39);function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var i=t.entry;t.entry=null;for(;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=v;var s,h=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?i:a.nextTick;v.WritableState=y;var u=Object.create(r(31));u.inherits=r(0);var f={deprecate:r(54)},l=r(102),c=r(59).Buffer,d=n.Uint8Array||function(){};var p,m=r(103);function g(){}function y(t,e){s=s||r(19),t=t||{};var i=e instanceof s;this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var n=t.highWaterMark,u=t.writableHighWaterMark,f=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(u||0===u)?u:f,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===t.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,n){--e.pendingcb,r?(a.nextTick(n,i),a.nextTick(E,t,e),t._writableState.errorEmitted=!0,t.emit("error",i)):(n(i),t._writableState.errorEmitted=!0,t.emit("error",i),E(t,e))}(t,r,i,e,n);else{var o=_(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||M(t,r),i?h(w,t,r,o,n):w(t,r,o,n)}}(e,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 o(this)}function v(t){if(s=s||r(19),!(p.call(v,this)||this instanceof s))return new v(t);this._writableState=new y(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),l.call(this)}function b(t,e,r,i,n,a,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,r?t._writev(n,e.onwrite):t._write(n,a,e.onwrite),e.sync=!1}function w(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),E(t,e)}function M(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,n=new Array(i),a=e.corkedRequestsFree;a.entry=r;for(var s=0,h=!0;r;)n[s]=r,r.isBuf||(h=!1),r=r.next,s+=1;n.allBuffers=h,b(t,e,!0,e.length,n,"",a.finish),e.pendingcb++,e.lastBufferedRequest=null,a.next?(e.corkedRequestsFree=a.next,a.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,f=r.encoding,l=r.callback;if(b(t,e,!1,e.objectMode?1:u.length,u,f,l),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function _(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function S(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),E(t,e)}))}function E(t,e){var r=_(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,a.nextTick(S,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}u.inherits(v,l),y.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(y.prototype,"buffer",{get:f.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(v,Symbol.hasInstance,{value:function(t){return!!p.call(this,t)||this===v&&(t&&t._writableState instanceof y)}})):p=function(t){return t instanceof this},v.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},v.prototype.write=function(t,e,r){var i,n=this._writableState,o=!1,s=!n.objectMode&&(i=t,c.isBuffer(i)||i instanceof d);return s&&!c.isBuffer(t)&&(t=function(t){return c.from(t)}(t)),"function"==typeof e&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof r&&(r=g),n.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),a.nextTick(e,r)}(this,r):(s||function(t,e,r,i){var n=!0,o=!1;return null===r?o=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),a.nextTick(i,o),n=!1),n}(this,n,t,r))&&(n.pendingcb++,o=function(t,e,r,i,n,a){if(!r){var o=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=c.from(e,r));return e}(e,i,n);i!==o&&(r=!0,n="buffer",i=o)}var s=e.objectMode?1:i.length;e.length+=s;var h=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(v.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),v.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},v.prototype._writev=null,v.prototype.end=function(t,e,r){var i=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||function(t,e,r){e.ending=!0,E(t,e),r&&(e.finished?a.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r)},Object.defineProperty(v.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),v.prototype.destroy=m.destroy,v.prototype._undestroy=m.undestroy,v.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,r(5),r(77).setImmediate,r(6))},function(t,e,r){"use strict";var i=r(7);function n(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0}t.exports=n,n.prototype._init=function(){},n.prototype.update=function(t){return 0===t.length?[]:"decrypt"===this.type?this._updateDecrypt(t):this._updateEncrypt(t)},n.prototype._buffer=function(t,e){for(var r=Math.min(this.buffer.length-this.bufferOff,t.length-e),i=0;i0;i--)e+=this._buffer(t,e),r+=this._flushBuffer(n,r);return e+=this._buffer(t,e),n},n.prototype.final=function(t){var e,r;return t&&(e=this.update(t)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},n.prototype._pad=function(t,e){if(0===e)return!1;for(;e=0||!e.umod(t.prime1)||!e.umod(t.prime2));return e}function o(t,r){var n=function(t){var e=a(t);return{blinder:e.toRed(i.mont(t.modulus)).redPow(new i(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(r),o=r.modulus.byteLength(),s=new i(t).mul(n.blinder).umod(r.modulus),h=s.toRed(i.mont(r.prime1)),u=s.toRed(i.mont(r.prime2)),f=r.coefficient,l=r.prime1,c=r.prime2,d=h.redPow(r.exponent1).fromRed(),p=u.redPow(r.exponent2).fromRed(),m=d.isub(p).imul(f).umod(l).imul(c);return p.iadd(m).imul(n.unblinder).umod(r.modulus).toArrayLike(e,"be",o)}o.getr=a,t.exports=o}).call(this,r(4).Buffer)},function(t,e,r){(function(t){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=a:e.BN=a,a.BN=a,a.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(221).Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void i(!1,"Invalid character in "+t)}function h(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function u(t,e,r,n){for(var a=0,o=0,s=Math.min(t.length,r),h=e;h=49?u-49+10:u>=17?u-17+10:u,i(u>=0&&o0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this._strip()},a.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=h(t,e,i)<=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;this._strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{a.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){a.prototype.inspect=l}else a.prototype.inspect=l;function l(){return(this.red?""}var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,a=0,o=0;o>>24-n&16777215,(n+=2)>=26&&(n-=26,o--),r=0!==a||o!==this.length-1?c[6-h.length]+h+r:h+r}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=d[t],f=p[t];r="";var l=this.clone();for(l.negative=0;!l.isZero();){var m=l.modrn(f).toString(t);r=(l=l.idivn(f)).isZero()?m+r:c[u-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16,2)},o&&(a.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,s=67108863&o,h=o/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(o=(n=0|t.words[p])*(a=0|e.words[d])+l)/67108864|0,l=67108863&o}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}a.prototype.toArrayLike=function(t,e,r){this._strip();var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0");var o=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,a);return this["_toArrayLike"+("le"===e?"LE":"BE")](o,n),o},a.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,a=0;n>8&255),r>16&255),6===a?(r>24&255),i=0,a=0):(i=o>>>24,a+=2)}if(r=0&&(t[r--]=o>>8&255),r>=0&&(t[r--]=o>>16&255),6===a?(r>=0&&(t[r--]=o>>24&255),i=0,a=0):(i=o>>>24,a+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?a.prototype._countBits=function(t){return 32-Math.clz32(t)}:a.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,g=0|o[2],y=8191&g,v=g>>>13,b=0|o[3],w=8191&b,M=b>>>13,_=0|o[4],S=8191&_,E=_>>>13,C=0|o[5],A=8191&C,T=C>>>13,B=0|o[6],I=8191&B,k=B>>>13,R=0|o[7],N=8191&R,L=R>>>13,x=0|o[8],P=8191&x,D=x>>>13,U=0|o[9],O=8191&U,j=U>>>13,K=0|s[0],V=8191&K,q=K>>>13,F=0|s[1],H=8191&F,z=F>>>13,G=0|s[2],W=8191&G,Z=G>>>13,Y=0|s[3],Q=8191&Y,X=Y>>>13,J=0|s[4],$=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],at=8191&nt,ot=nt>>>13,st=0|s[7],ht=8191&st,ut=st>>>13,ft=0|s[8],lt=8191&ft,ct=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,q))+Math.imul(c,V)|0))<<13)|0;u=((a=Math.imul(c,q))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,V),n=(n=Math.imul(p,q))+Math.imul(m,V)|0,a=Math.imul(m,q);var yt=(u+(i=i+Math.imul(l,H)|0)|0)+((8191&(n=(n=n+Math.imul(l,z)|0)+Math.imul(c,H)|0))<<13)|0;u=((a=a+Math.imul(c,z)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,V),n=(n=Math.imul(y,q))+Math.imul(v,V)|0,a=Math.imul(v,q),i=i+Math.imul(p,H)|0,n=(n=n+Math.imul(p,z)|0)+Math.imul(m,H)|0,a=a+Math.imul(m,z)|0;var vt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,W)|0))<<13)|0;u=((a=a+Math.imul(c,Z)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(w,V),n=(n=Math.imul(w,q))+Math.imul(M,V)|0,a=Math.imul(M,q),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,z)|0)+Math.imul(v,H)|0,a=a+Math.imul(v,z)|0,i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,W)|0,a=a+Math.imul(m,Z)|0;var bt=(u+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,X)|0)+Math.imul(c,Q)|0))<<13)|0;u=((a=a+Math.imul(c,X)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(S,V),n=(n=Math.imul(S,q))+Math.imul(E,V)|0,a=Math.imul(E,q),i=i+Math.imul(w,H)|0,n=(n=n+Math.imul(w,z)|0)+Math.imul(M,H)|0,a=a+Math.imul(M,z)|0,i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(v,W)|0,a=a+Math.imul(v,Z)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,X)|0;var wt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,$)|0))<<13)|0;u=((a=a+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,V),n=(n=Math.imul(A,q))+Math.imul(T,V)|0,a=Math.imul(T,q),i=i+Math.imul(S,H)|0,n=(n=n+Math.imul(S,z)|0)+Math.imul(E,H)|0,a=a+Math.imul(E,z)|0,i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(M,W)|0,a=a+Math.imul(M,Z)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,X)|0)+Math.imul(v,Q)|0,a=a+Math.imul(v,X)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,$)|0,a=a+Math.imul(m,tt)|0;var Mt=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((a=a+Math.imul(c,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,V),n=(n=Math.imul(I,q))+Math.imul(k,V)|0,a=Math.imul(k,q),i=i+Math.imul(A,H)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(T,H)|0,a=a+Math.imul(T,z)|0,i=i+Math.imul(S,W)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(E,W)|0,a=a+Math.imul(E,Z)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,X)|0)+Math.imul(M,Q)|0,a=a+Math.imul(M,X)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,$)|0,a=a+Math.imul(v,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,it)|0;var _t=(u+(i=i+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,ot)|0)+Math.imul(c,at)|0))<<13)|0;u=((a=a+Math.imul(c,ot)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(N,V),n=(n=Math.imul(N,q))+Math.imul(L,V)|0,a=Math.imul(L,q),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,z)|0)+Math.imul(k,H)|0,a=a+Math.imul(k,z)|0,i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,Z)|0)+Math.imul(T,W)|0,a=a+Math.imul(T,Z)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(E,Q)|0,a=a+Math.imul(E,X)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(M,$)|0,a=a+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,a=a+Math.imul(v,it)|0,i=i+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var St=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((a=a+Math.imul(c,ut)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(P,V),n=(n=Math.imul(P,q))+Math.imul(D,V)|0,a=Math.imul(D,q),i=i+Math.imul(N,H)|0,n=(n=n+Math.imul(N,z)|0)+Math.imul(L,H)|0,a=a+Math.imul(L,z)|0,i=i+Math.imul(I,W)|0,n=(n=n+Math.imul(I,Z)|0)+Math.imul(k,W)|0,a=a+Math.imul(k,Z)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,X)|0)+Math.imul(T,Q)|0,a=a+Math.imul(T,X)|0,i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(E,$)|0,a=a+Math.imul(E,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(M,rt)|0,a=a+Math.imul(M,it)|0,i=i+Math.imul(y,at)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(v,at)|0,a=a+Math.imul(v,ot)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,a=a+Math.imul(m,ut)|0;var Et=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((a=a+Math.imul(c,ct)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(O,V),n=(n=Math.imul(O,q))+Math.imul(j,V)|0,a=Math.imul(j,q),i=i+Math.imul(P,H)|0,n=(n=n+Math.imul(P,z)|0)+Math.imul(D,H)|0,a=a+Math.imul(D,z)|0,i=i+Math.imul(N,W)|0,n=(n=n+Math.imul(N,Z)|0)+Math.imul(L,W)|0,a=a+Math.imul(L,Z)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,X)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,X)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(T,$)|0,a=a+Math.imul(T,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(E,rt)|0,a=a+Math.imul(E,it)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(M,at)|0,a=a+Math.imul(M,ot)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,a=a+Math.imul(v,ut)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,a=a+Math.imul(m,ct)|0;var Ct=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((a=a+Math.imul(c,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(O,H),n=(n=Math.imul(O,z))+Math.imul(j,H)|0,a=Math.imul(j,z),i=i+Math.imul(P,W)|0,n=(n=n+Math.imul(P,Z)|0)+Math.imul(D,W)|0,a=a+Math.imul(D,Z)|0,i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,X)|0)+Math.imul(L,Q)|0,a=a+Math.imul(L,X)|0,i=i+Math.imul(I,$)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(k,$)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(T,rt)|0,a=a+Math.imul(T,it)|0,i=i+Math.imul(S,at)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(E,at)|0,a=a+Math.imul(E,ot)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(M,ht)|0,a=a+Math.imul(M,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(v,lt)|0,a=a+Math.imul(v,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((a=a+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(O,W),n=(n=Math.imul(O,Z))+Math.imul(j,W)|0,a=Math.imul(j,Z),i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,X)|0)+Math.imul(D,Q)|0,a=a+Math.imul(D,X)|0,i=i+Math.imul(N,$)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(L,$)|0,a=a+Math.imul(L,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(T,at)|0,a=a+Math.imul(T,ot)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(E,ht)|0,a=a+Math.imul(E,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(M,lt)|0,a=a+Math.imul(M,ct)|0;var Tt=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;u=((a=a+Math.imul(v,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(O,Q),n=(n=Math.imul(O,X))+Math.imul(j,Q)|0,a=Math.imul(j,X),i=i+Math.imul(P,$)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(D,$)|0,a=a+Math.imul(D,tt)|0,i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(L,rt)|0,a=a+Math.imul(L,it)|0,i=i+Math.imul(I,at)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(T,ht)|0,a=a+Math.imul(T,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(E,lt)|0,a=a+Math.imul(E,ct)|0;var Bt=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;u=((a=a+Math.imul(M,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(O,$),n=(n=Math.imul(O,tt))+Math.imul(j,$)|0,a=Math.imul(j,tt),i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(D,rt)|0,a=a+Math.imul(D,it)|0,i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(L,at)|0,a=a+Math.imul(L,ot)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(k,ht)|0,a=a+Math.imul(k,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(T,lt)|0,a=a+Math.imul(T,ct)|0;var It=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((a=a+Math.imul(E,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(O,rt),n=(n=Math.imul(O,it))+Math.imul(j,rt)|0,a=Math.imul(j,it),i=i+Math.imul(P,at)|0,n=(n=n+Math.imul(P,ot)|0)+Math.imul(D,at)|0,a=a+Math.imul(D,ot)|0,i=i+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,ut)|0)+Math.imul(L,ht)|0,a=a+Math.imul(L,ut)|0,i=i+Math.imul(I,lt)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(k,lt)|0,a=a+Math.imul(k,ct)|0;var kt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(T,pt)|0))<<13)|0;u=((a=a+Math.imul(T,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(O,at),n=(n=Math.imul(O,ot))+Math.imul(j,at)|0,a=Math.imul(j,ot),i=i+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,ut)|0)+Math.imul(D,ht)|0,a=a+Math.imul(D,ut)|0,i=i+Math.imul(N,lt)|0,n=(n=n+Math.imul(N,ct)|0)+Math.imul(L,lt)|0,a=a+Math.imul(L,ct)|0;var Rt=(u+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((a=a+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(O,ht),n=(n=Math.imul(O,ut))+Math.imul(j,ht)|0,a=Math.imul(j,ut),i=i+Math.imul(P,lt)|0,n=(n=n+Math.imul(P,ct)|0)+Math.imul(D,lt)|0,a=a+Math.imul(D,ct)|0;var Nt=(u+(i=i+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((a=a+Math.imul(L,mt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(O,lt),n=(n=Math.imul(O,ct))+Math.imul(j,lt)|0,a=Math.imul(j,ct);var Lt=(u+(i=i+Math.imul(P,pt)|0)|0)+((8191&(n=(n=n+Math.imul(P,mt)|0)+Math.imul(D,pt)|0))<<13)|0;u=((a=a+Math.imul(D,mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863;var xt=(u+(i=Math.imul(O,pt))|0)+((8191&(n=(n=Math.imul(O,mt))+Math.imul(j,pt)|0))<<13)|0;return u=((a=Math.imul(j,mt))+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=bt,h[4]=wt,h[5]=Mt,h[6]=_t,h[7]=St,h[8]=Et,h[9]=Ct,h[10]=At,h[11]=Tt,h[12]=Bt,h[13]=It,h[14]=kt,h[15]=Rt,h[16]=Nt,h[17]=Lt,h[18]=xt,0!==u&&(h[19]=u,r.length++),r};function y(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r._strip()}function v(t,e,r){return y(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(g=m),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?m(this,t,e):r<1024?y(this,t,e):v(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},b.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,r+=a/67108864|0,r+=o>>>26,this.words[n]=67108863&o}return 0!==r&&(this.words[n]=r,this.length++),e?this.ineg():this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n&1}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,u=0;u=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-a|l>>>a,f=l&s}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},a.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(h/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===s)return this._strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this._strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,h=i.length-n.length;if("mod"!==e){(s=new a(null)).length=h+1,s.words=new Array(s.length);for(var u=0;u=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/o|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);s&&(s.words[l]=c)}return s&&s._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modrn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modrn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=(1<<26)%t,n=0,a=this.length-1;a>=0;a--)n=(r*n+(0|this.words[a]))%t;return e?-n:n},a.prototype.modn=function(t){return this.modrn(t)},a.prototype.idivn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var a=(0|this.words[n])+67108864*r;this.words[n]=a/t|0,r=a%t}return this._strip(),e?this.ineg():this},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),h=new a(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(l)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||h.isOdd())&&(s.iadd(f),h.isub(l)),s.iushrn(1),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(h)):(r.isub(e),s.isub(n),h.isub(o))}return{a:s,b:h,gcd:r.iushln(u)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),h=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;0==(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(h),o.iushrn(1);for(var l=0,c=1;0==(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new A(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function M(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function _(){M.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function S(){M.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){M.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function C(){M.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function T(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(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)}M.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},M.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},M.prototype.split=function(t,e){t.iushrn(this.n,0,e)},M.prototype.imulK=function(t){return t.imul(this.k)},n(_,M),_.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},_.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new _;else if("p224"===t)e=new S;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new C}return w[t]=e,e},A.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(f(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),h=s.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,g=0;0!==m.cmp(s);g++)m=m.redSqr();i(g=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==o?(o<<=1,o|=l,(4===++s||0===i&&0===f)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}h=26}return n},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new T(t)},n(T,A),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(20)(t))},function(t,e,r){"use strict";var i=e;i.version=r(222).version,i.utils=r(8),i.rand=r(64),i.curve=r(130),i.curves=r(69),i.ec=r(234),i.eddsa=r(238)},function(t,e,r){"use strict";var i,n=e,a=r(70),o=r(130),s=r(8).assert;function h(t){"short"===t.type?this.curve=new o.short(t):"edwards"===t.type?this.curve=new o.edwards(t):this.curve=new o.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new h(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=h,u("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:a.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("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:a.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("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:a.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("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:a.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"]}),u("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:a.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"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:a.sha256,gRed:!1,g:["9"]}),u("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:a.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{i=r(233)}catch(t){i=void 0}u("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:a.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",i]})},function(t,e,r){var i=e;i.utils=r(11),i.common=r(33),i.sha=r(227),i.ripemd=r(231),i.hmac=r(232),i.sha1=i.sha.sha1,i.sha256=i.sha.sha256,i.sha224=i.sha.sha224,i.sha384=i.sha.sha384,i.sha512=i.sha.sha512,i.ripemd160=i.ripemd.ripemd160},function(t,e,r){"use strict";(function(e){var i,n=r(4),a=n.Buffer,o={};for(i in n)n.hasOwnProperty(i)&&"SlowBuffer"!==i&&"Buffer"!==i&&(o[i]=n[i]);var s=o.Buffer={};for(i in a)a.hasOwnProperty(i)&&"allocUnsafe"!==i&&"allocUnsafeSlow"!==i&&(s[i]=a[i]);if(o.Buffer.prototype=a.prototype,s.from&&s.from!==Uint8Array.from||(s.from=function(t,e,r){if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof t);if(t&&void 0===t.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);return a(t,e,r)}),s.alloc||(s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError('The "size" argument must be of type number. Received type '+typeof t);if(t<0||t>=2*(1<<30))throw new RangeError('The value "'+t+'" is invalid for option "size"');var i=a(t);return e&&0!==e.length?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i}),!o.kStringMaxLength)try{o.kStringMaxLength=e.binding("buffer").kStringMaxLength}catch(t){}o.constants||(o.constants={MAX_LENGTH:o.kMaxLength},o.kStringMaxLength&&(o.constants.MAX_STRING_LENGTH=o.kStringMaxLength)),t.exports=o}).call(this,r(5))},function(t,e,r){"use strict";const i=r(73).Reporter,n=r(34).EncoderBuffer,a=r(34).DecoderBuffer,o=r(7),s=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],h=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(s);function u(t,e,r){const i={};this._baseState=i,i.name=r,i.enc=t,i.parent=e||null,i.children=null,i.tag=null,i.args=null,i.reverseArgs=null,i.choice=null,i.optional=!1,i.any=!1,i.obj=!1,i.use=null,i.useDecoder=null,i.key=null,i.default=null,i.explicit=null,i.implicit=null,i.contains=null,i.parent||(i.children=[],this._wrap())}t.exports=u;const f=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];u.prototype.clone=function(){const t=this._baseState,e={};f.forEach((function(r){e[r]=t[r]}));const r=new this.constructor(e.parent);return r._baseState=e,r},u.prototype._wrap=function(){const t=this._baseState;h.forEach((function(e){this[e]=function(){const r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}}),this)},u.prototype._init=function(t){const e=this._baseState;o(null===e.parent),t.call(this),e.children=e.children.filter((function(t){return t._baseState.parent===this}),this),o.equal(e.children.length,1,"Root node can have only one child")},u.prototype._useArgs=function(t){const e=this._baseState,r=t.filter((function(t){return t instanceof this.constructor}),this);t=t.filter((function(t){return!(t instanceof this.constructor)}),this),0!==r.length&&(o(null===e.children),e.children=r,r.forEach((function(t){t._baseState.parent=this}),this)),0!==t.length&&(o(null===e.args),e.args=t,e.reverseArgs=t.map((function(t){if("object"!=typeof t||t.constructor!==Object)return t;const e={};return Object.keys(t).forEach((function(r){r==(0|r)&&(r|=0);const i=t[r];e[i]=r})),e})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(t){u.prototype[t]=function(){const e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}})),s.forEach((function(t){u.prototype[t]=function(){const e=this._baseState,r=Array.prototype.slice.call(arguments);return o(null===e.tag),e.tag=t,this._useArgs(r),this}})),u.prototype.use=function(t){o(t);const e=this._baseState;return o(null===e.use),e.use=t,this},u.prototype.optional=function(){return this._baseState.optional=!0,this},u.prototype.def=function(t){const e=this._baseState;return o(null===e.default),e.default=t,e.optional=!0,this},u.prototype.explicit=function(t){const e=this._baseState;return o(null===e.explicit&&null===e.implicit),e.explicit=t,this},u.prototype.implicit=function(t){const e=this._baseState;return o(null===e.explicit&&null===e.implicit),e.implicit=t,this},u.prototype.obj=function(){const t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},u.prototype.key=function(t){const e=this._baseState;return o(null===e.key),e.key=t,this},u.prototype.any=function(){return this._baseState.any=!0,this},u.prototype.choice=function(t){const e=this._baseState;return o(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map((function(e){return t[e]}))),this},u.prototype.contains=function(t){const e=this._baseState;return o(null===e.use),e.contains=t,this},u.prototype._decode=function(t,e){const r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,e));let i,n=r.default,o=!0,s=null;if(null!==r.key&&(s=t.enterKey(r.key)),r.optional){let i=null;if(null!==r.explicit?i=r.explicit:null!==r.implicit?i=r.implicit:null!==r.tag&&(i=r.tag),null!==i||r.any){if(o=this._peekTag(t,i,r.any),t.isError(o))return o}else{const i=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),o=!0}catch(t){o=!1}t.restore(i)}}if(r.obj&&o&&(i=t.enterObject()),o){if(null!==r.explicit){const e=this._decodeTag(t,r.explicit);if(t.isError(e))return e;t=e}const i=t.offset;if(null===r.use&&null===r.choice){let e;r.any&&(e=t.save());const i=this._decodeTag(t,null!==r.implicit?r.implicit:r.tag,r.any);if(t.isError(i))return i;r.any?n=t.raw(e):t=i}if(e&&e.track&&null!==r.tag&&e.track(t.path(),i,t.length,"tagged"),e&&e.track&&null!==r.tag&&e.track(t.path(),t.offset,t.length,"content"),r.any||(n=null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e)),t.isError(n))return n;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function(r){r._decode(t,e)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){const i=new a(n);n=this._getUse(r.contains,t._reporterState.obj)._decode(i,e)}}return r.obj&&o&&(n=t.leaveObject(i)),null===r.key||null===n&&!0!==o?null!==s&&t.exitKey(s):t.leaveKey(s,r.key,n),n},u.prototype._decodeGeneric=function(t,e,r){const i=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,i.args[0],r):/str$/.test(t)?this._decodeStr(e,t,r):"objid"===t&&i.args?this._decodeObjid(e,i.args[0],i.args[1],r):"objid"===t?this._decodeObjid(e,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(e,t,r):"null_"===t?this._decodeNull(e,r):"bool"===t?this._decodeBool(e,r):"objDesc"===t?this._decodeStr(e,t,r):"int"===t||"enum"===t?this._decodeInt(e,i.args&&i.args[0],r):null!==i.use?this._getUse(i.use,e._reporterState.obj)._decode(e,r):e.error("unknown tag: "+t)},u.prototype._getUse=function(t,e){const r=this._baseState;return r.useDecoder=this._use(t,e),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},u.prototype._decodeChoice=function(t,e){const r=this._baseState;let i=null,n=!1;return Object.keys(r.choice).some((function(a){const o=t.save(),s=r.choice[a];try{const r=s._decode(t,e);if(t.isError(r))return!1;i={type:a,value:r},n=!0}catch(e){return t.restore(o),!1}return!0}),this),n?i:t.error("Choice not matched")},u.prototype._createEncoderBuffer=function(t){return new n(t,this.reporter)},u.prototype._encode=function(t,e,r){const i=this._baseState;if(null!==i.default&&i.default===t)return;const n=this._encodeValue(t,e,r);return void 0===n||this._skipDefault(n,e,r)?void 0:n},u.prototype._encodeValue=function(t,e,r){const n=this._baseState;if(null===n.parent)return n.children[0]._encode(t,e||new i);let a=null;if(this.reporter=e,n.optional&&void 0===t){if(null===n.default)return;t=n.default}let o=null,s=!1;if(n.any)a=this._createEncoderBuffer(t);else if(n.choice)a=this._encodeChoice(t,e);else if(n.contains)o=this._getUse(n.contains,r)._encode(t,e),s=!0;else if(n.children)o=n.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,e,t);if(null===r._baseState.key)return e.error("Child should have a key");const i=e.enterKey(r._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");const n=r._encode(t[r._baseState.key],e,t);return e.leaveKey(i),n}),this).filter((function(t){return t})),o=this._createEncoderBuffer(o);else if("seqof"===n.tag||"setof"===n.tag){if(!n.args||1!==n.args.length)return e.error("Too many args for : "+n.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");const r=this.clone();r._baseState.implicit=null,o=this._createEncoderBuffer(t.map((function(r){const i=this._baseState;return this._getUse(i.args[0],t)._encode(r,e)}),r))}else null!==n.use?a=this._getUse(n.use,r)._encode(t,e):(o=this._encodePrimitive(n.tag,t),s=!0);if(!n.any&&null===n.choice){const t=null!==n.implicit?n.implicit:n.tag,r=null===n.implicit?"universal":"context";null===t?null===n.use&&e.error("Tag could be omitted only for .use()"):null===n.use&&(a=this._encodeComposite(t,s,r,o))}return null!==n.explicit&&(a=this._encodeComposite(n.explicit,!1,"context",a)),a},u.prototype._encodeChoice=function(t,e){const r=this._baseState,i=r.choice[t.type];return i||o(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),i._encode(t.value,e)},u.prototype._encodePrimitive=function(t,e){const r=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&r.args)return this._encodeObjid(e,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},u.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},u.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},function(t,e,r){"use strict";const i=r(0);function n(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function a(t,e){this.path=t,this.rethrow(e)}e.Reporter=n,n.prototype.isError=function(t){return t instanceof a},n.prototype.save=function(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},n.prototype.restore=function(t){const e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},n.prototype.enterKey=function(t){return this._reporterState.path.push(t)},n.prototype.exitKey=function(t){const e=this._reporterState;e.path=e.path.slice(0,t-1)},n.prototype.leaveKey=function(t,e,r){const i=this._reporterState;this.exitKey(t),null!==i.obj&&(i.obj[e]=r)},n.prototype.path=function(){return this._reporterState.path.join("/")},n.prototype.enterObject=function(){const t=this._reporterState,e=t.obj;return t.obj={},e},n.prototype.leaveObject=function(t){const e=this._reporterState,r=e.obj;return e.obj=t,r},n.prototype.error=function(t){let e;const r=this._reporterState,i=t instanceof a;if(e=i?t:new a(r.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!r.options.partial)throw e;return i||r.errors.push(e),e},n.prototype.wrapResult=function(t){const e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},i(a,Error),a.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,a),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},function(t,e,r){"use strict";function i(t){const e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);const i=t[r];e[i]=r})),e}e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=i(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=i(e.tag)},function(t,e,r){(function(t){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=a:e.BN=a,a.BN=a,a.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(257).Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function h(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return n}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=h(t,e,i)<=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?""};var f=["","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],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,s=67108863&o,h=o/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(o=(n=0|t.words[p])*(a=0|e.words[d])+l)/67108864|0,l=67108863&o}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?f[6-h.length]+h+r:h+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=l[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[u-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var o,s,h="le"===e,u=new t(a),f=this.clone();if(h){for(s=0;!f.isZero();s++)o=f.andln(255),f.iushrn(8),u[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,g=0|o[2],y=8191&g,v=g>>>13,b=0|o[3],w=8191&b,M=b>>>13,_=0|o[4],S=8191&_,E=_>>>13,C=0|o[5],A=8191&C,T=C>>>13,B=0|o[6],I=8191&B,k=B>>>13,R=0|o[7],N=8191&R,L=R>>>13,x=0|o[8],P=8191&x,D=x>>>13,U=0|o[9],O=8191&U,j=U>>>13,K=0|s[0],V=8191&K,q=K>>>13,F=0|s[1],H=8191&F,z=F>>>13,G=0|s[2],W=8191&G,Z=G>>>13,Y=0|s[3],Q=8191&Y,X=Y>>>13,J=0|s[4],$=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],at=8191&nt,ot=nt>>>13,st=0|s[7],ht=8191&st,ut=st>>>13,ft=0|s[8],lt=8191&ft,ct=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,q))+Math.imul(c,V)|0))<<13)|0;u=((a=Math.imul(c,q))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,V),n=(n=Math.imul(p,q))+Math.imul(m,V)|0,a=Math.imul(m,q);var yt=(u+(i=i+Math.imul(l,H)|0)|0)+((8191&(n=(n=n+Math.imul(l,z)|0)+Math.imul(c,H)|0))<<13)|0;u=((a=a+Math.imul(c,z)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,V),n=(n=Math.imul(y,q))+Math.imul(v,V)|0,a=Math.imul(v,q),i=i+Math.imul(p,H)|0,n=(n=n+Math.imul(p,z)|0)+Math.imul(m,H)|0,a=a+Math.imul(m,z)|0;var vt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,W)|0))<<13)|0;u=((a=a+Math.imul(c,Z)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(w,V),n=(n=Math.imul(w,q))+Math.imul(M,V)|0,a=Math.imul(M,q),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,z)|0)+Math.imul(v,H)|0,a=a+Math.imul(v,z)|0,i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,W)|0,a=a+Math.imul(m,Z)|0;var bt=(u+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,X)|0)+Math.imul(c,Q)|0))<<13)|0;u=((a=a+Math.imul(c,X)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(S,V),n=(n=Math.imul(S,q))+Math.imul(E,V)|0,a=Math.imul(E,q),i=i+Math.imul(w,H)|0,n=(n=n+Math.imul(w,z)|0)+Math.imul(M,H)|0,a=a+Math.imul(M,z)|0,i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(v,W)|0,a=a+Math.imul(v,Z)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,X)|0;var wt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,$)|0))<<13)|0;u=((a=a+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,V),n=(n=Math.imul(A,q))+Math.imul(T,V)|0,a=Math.imul(T,q),i=i+Math.imul(S,H)|0,n=(n=n+Math.imul(S,z)|0)+Math.imul(E,H)|0,a=a+Math.imul(E,z)|0,i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(M,W)|0,a=a+Math.imul(M,Z)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,X)|0)+Math.imul(v,Q)|0,a=a+Math.imul(v,X)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,$)|0,a=a+Math.imul(m,tt)|0;var Mt=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((a=a+Math.imul(c,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,V),n=(n=Math.imul(I,q))+Math.imul(k,V)|0,a=Math.imul(k,q),i=i+Math.imul(A,H)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(T,H)|0,a=a+Math.imul(T,z)|0,i=i+Math.imul(S,W)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(E,W)|0,a=a+Math.imul(E,Z)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,X)|0)+Math.imul(M,Q)|0,a=a+Math.imul(M,X)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,$)|0,a=a+Math.imul(v,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,it)|0;var _t=(u+(i=i+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,ot)|0)+Math.imul(c,at)|0))<<13)|0;u=((a=a+Math.imul(c,ot)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(N,V),n=(n=Math.imul(N,q))+Math.imul(L,V)|0,a=Math.imul(L,q),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,z)|0)+Math.imul(k,H)|0,a=a+Math.imul(k,z)|0,i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,Z)|0)+Math.imul(T,W)|0,a=a+Math.imul(T,Z)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(E,Q)|0,a=a+Math.imul(E,X)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(M,$)|0,a=a+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,a=a+Math.imul(v,it)|0,i=i+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var St=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((a=a+Math.imul(c,ut)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(P,V),n=(n=Math.imul(P,q))+Math.imul(D,V)|0,a=Math.imul(D,q),i=i+Math.imul(N,H)|0,n=(n=n+Math.imul(N,z)|0)+Math.imul(L,H)|0,a=a+Math.imul(L,z)|0,i=i+Math.imul(I,W)|0,n=(n=n+Math.imul(I,Z)|0)+Math.imul(k,W)|0,a=a+Math.imul(k,Z)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,X)|0)+Math.imul(T,Q)|0,a=a+Math.imul(T,X)|0,i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(E,$)|0,a=a+Math.imul(E,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(M,rt)|0,a=a+Math.imul(M,it)|0,i=i+Math.imul(y,at)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(v,at)|0,a=a+Math.imul(v,ot)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,a=a+Math.imul(m,ut)|0;var Et=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((a=a+Math.imul(c,ct)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(O,V),n=(n=Math.imul(O,q))+Math.imul(j,V)|0,a=Math.imul(j,q),i=i+Math.imul(P,H)|0,n=(n=n+Math.imul(P,z)|0)+Math.imul(D,H)|0,a=a+Math.imul(D,z)|0,i=i+Math.imul(N,W)|0,n=(n=n+Math.imul(N,Z)|0)+Math.imul(L,W)|0,a=a+Math.imul(L,Z)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,X)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,X)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(T,$)|0,a=a+Math.imul(T,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(E,rt)|0,a=a+Math.imul(E,it)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(M,at)|0,a=a+Math.imul(M,ot)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,a=a+Math.imul(v,ut)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,a=a+Math.imul(m,ct)|0;var Ct=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((a=a+Math.imul(c,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(O,H),n=(n=Math.imul(O,z))+Math.imul(j,H)|0,a=Math.imul(j,z),i=i+Math.imul(P,W)|0,n=(n=n+Math.imul(P,Z)|0)+Math.imul(D,W)|0,a=a+Math.imul(D,Z)|0,i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,X)|0)+Math.imul(L,Q)|0,a=a+Math.imul(L,X)|0,i=i+Math.imul(I,$)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(k,$)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(T,rt)|0,a=a+Math.imul(T,it)|0,i=i+Math.imul(S,at)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(E,at)|0,a=a+Math.imul(E,ot)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(M,ht)|0,a=a+Math.imul(M,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(v,lt)|0,a=a+Math.imul(v,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((a=a+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(O,W),n=(n=Math.imul(O,Z))+Math.imul(j,W)|0,a=Math.imul(j,Z),i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,X)|0)+Math.imul(D,Q)|0,a=a+Math.imul(D,X)|0,i=i+Math.imul(N,$)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(L,$)|0,a=a+Math.imul(L,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(T,at)|0,a=a+Math.imul(T,ot)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(E,ht)|0,a=a+Math.imul(E,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(M,lt)|0,a=a+Math.imul(M,ct)|0;var Tt=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;u=((a=a+Math.imul(v,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(O,Q),n=(n=Math.imul(O,X))+Math.imul(j,Q)|0,a=Math.imul(j,X),i=i+Math.imul(P,$)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(D,$)|0,a=a+Math.imul(D,tt)|0,i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(L,rt)|0,a=a+Math.imul(L,it)|0,i=i+Math.imul(I,at)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(T,ht)|0,a=a+Math.imul(T,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(E,lt)|0,a=a+Math.imul(E,ct)|0;var Bt=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;u=((a=a+Math.imul(M,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(O,$),n=(n=Math.imul(O,tt))+Math.imul(j,$)|0,a=Math.imul(j,tt),i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(D,rt)|0,a=a+Math.imul(D,it)|0,i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(L,at)|0,a=a+Math.imul(L,ot)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(k,ht)|0,a=a+Math.imul(k,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(T,lt)|0,a=a+Math.imul(T,ct)|0;var It=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((a=a+Math.imul(E,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(O,rt),n=(n=Math.imul(O,it))+Math.imul(j,rt)|0,a=Math.imul(j,it),i=i+Math.imul(P,at)|0,n=(n=n+Math.imul(P,ot)|0)+Math.imul(D,at)|0,a=a+Math.imul(D,ot)|0,i=i+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,ut)|0)+Math.imul(L,ht)|0,a=a+Math.imul(L,ut)|0,i=i+Math.imul(I,lt)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(k,lt)|0,a=a+Math.imul(k,ct)|0;var kt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(T,pt)|0))<<13)|0;u=((a=a+Math.imul(T,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(O,at),n=(n=Math.imul(O,ot))+Math.imul(j,at)|0,a=Math.imul(j,ot),i=i+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,ut)|0)+Math.imul(D,ht)|0,a=a+Math.imul(D,ut)|0,i=i+Math.imul(N,lt)|0,n=(n=n+Math.imul(N,ct)|0)+Math.imul(L,lt)|0,a=a+Math.imul(L,ct)|0;var Rt=(u+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((a=a+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(O,ht),n=(n=Math.imul(O,ut))+Math.imul(j,ht)|0,a=Math.imul(j,ut),i=i+Math.imul(P,lt)|0,n=(n=n+Math.imul(P,ct)|0)+Math.imul(D,lt)|0,a=a+Math.imul(D,ct)|0;var Nt=(u+(i=i+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((a=a+Math.imul(L,mt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(O,lt),n=(n=Math.imul(O,ct))+Math.imul(j,lt)|0,a=Math.imul(j,ct);var Lt=(u+(i=i+Math.imul(P,pt)|0)|0)+((8191&(n=(n=n+Math.imul(P,mt)|0)+Math.imul(D,pt)|0))<<13)|0;u=((a=a+Math.imul(D,mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863;var xt=(u+(i=Math.imul(O,pt))|0)+((8191&(n=(n=Math.imul(O,mt))+Math.imul(j,pt)|0))<<13)|0;return u=((a=Math.imul(j,mt))+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=bt,h[4]=wt,h[5]=Mt,h[6]=_t,h[7]=St,h[8]=Et,h[9]=Ct,h[10]=At,h[11]=Tt,h[12]=Bt,h[13]=It,h[14]=kt,h[15]=Rt,h[16]=Nt,h[17]=Lt,h[18]=xt,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,t,e):m(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,u=0;u=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-a|l>>>a,f=l&s}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(h/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,h=i.length-n.length;if("mod"!==e){(s=new a(null)).length=h+1,s.words=new Array(s.length);for(var u=0;u=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/o|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);s&&(s.words[l]=c)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},a.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),h=new a(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(l)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||h.isOdd())&&(s.iadd(f),h.isub(l)),s.iushrn(1),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(h)):(r.isub(e),s.isub(n),h.isub(o))}return{a:s,b:h,gcd:r.iushln(u)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),h=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;0==(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(h),o.iushrn(1);for(var l=0,c=1;0==(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new S(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(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 t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},n(b,v),b.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return y[t]=e,e},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),h=s.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,g=0;0!==m.cmp(s);g++)m=m.redSqr();i(g=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==o?(o<<=1,o|=l,(4===++s||0===i&&0===f)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}h=26}return n},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new E(t)},n(E,S),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(20)(t))},function(t,e,r){const i=r(145),n=r(38);function a(t,e){t[this.config.encryptedKeyHeaderName]=e.encoded.encryptedKey,t[this.config.ivHeaderName]=e.encoded.iv,t[this.config.oaepHashingAlgorithmHeaderName]=e.oaepHashingAlgorithm.replace("-",""),t[this.config.publicKeyFingerprintHeaderName]=e.publicKeyFingerprint}function o(t,e,r){let i=r;const o=n.hasConfig(this.config,t);if(o)if(this.isWithHeader){const t=this.crypto.newEncryptionParams({});i=o.toEncrypt.map(e=>u.call(this,t,e,r)),a.call(this,e,t)}else i=o.toEncrypt.map(t=>h.call(this,t,r));return{header:e,body:o?n.computeBody(o.toEncrypt,r,i):r}}function s(t){const e=t.body;let r=t.body;const i=n.hasConfig(this.config,t.request.url);return i&&(r=i.toDecrypt.map(r=>this.isWithHeader?l.call(this,r,e,t):f.call(this,r,e))),i?n.computeBody(i.toDecrypt,e,r):e}function h(t,e){const r=n.elemFromPath(t.element,e);if(r&&r.node){const i=this.crypto.encryptData({data:r.node});e=n.mutateObjectProperty(t.obj,i,e),n.isJsonRoot(t.obj)||t.element===t.obj+"."+this.config.encryptedValueFieldName||n.deleteNode(t.element,e)}return e}function u(t,e,r){const i=n.elemFromPath(e.element,r).node,a=this.crypto.encryptData({data:i},t),o={[this.config.encryptedValueFieldName]:a[this.config.encryptedValueFieldName]};return n.isJsonRoot(e.obj)?o:{[e.obj]:o}}function f(t,e){const r=n.elemFromPath(t.element,e);if(r&&r.node){const i=this.crypto.decryptData(r.node[this.config.encryptedValueFieldName],r.node[this.config.ivFieldName],r.node[this.config.oaepHashingAlgorithmFieldName],r.node[this.config.encryptedKeyFieldName]);return n.mutateObjectProperty(t.obj,i,e,t.element,this.encryptionResponseProperties)}return e}function l(t,e,r){const i=n.elemFromPath(t.obj,e),a=n.isJsonRoot(t.element)?i.node:i.node[t.element];if(a){const i=a[this.config.encryptedValueFieldName];for(const t in e)delete e[t];const o=this.crypto.decryptData(i,r.header[this.config.ivHeaderName],r.header[this.config.oaepHashingAlgorithmHeaderName],r.header[this.config.encryptedKeyHeaderName]);return n.isJsonRoot(t.obj)?o:Object.assign(e,o)}}t.exports=function(t){this.encrypt=o,this.decrypt=s,this.config=t,this.crypto=new i(t),this.isWithHeader=Object.prototype.hasOwnProperty.call(t,"ivHeaderName")&&Object.prototype.hasOwnProperty.call(t,"encryptedKeyHeaderName"),this.encryptionResponseProperties=[this.config.ivFieldName,this.config.encryptedKeyFieldName,this.config.publicKeyFingerprintFieldName,this.config.oaepHashingAlgorithmFieldName]}},function(t,e,r){(function(t){var i=void 0!==t&&t||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function a(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new a(n.call(setTimeout,i,arguments),clearTimeout)},e.setInterval=function(){return new a(n.call(setInterval,i,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(i,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r(146),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,r(6))},function(t,e,r){var i=r(1);r(3),i.cipher=i.cipher||{};var n=t.exports=i.cipher.modes=i.cipher.modes||{};function a(t,e){if("string"==typeof t&&(t=i.util.createBuffer(t)),i.util.isArray(t)&&t.length>4){var r=t;t=i.util.createBuffer();for(var n=0;n0))return!0;for(var i=0;i0))return!0;for(var i=0;i0)return!1;var r=t.length(),i=t.at(r-1);return!(i>this.blockSize<<2)&&(t.truncate(i),!0)},n.cbc=function(t){t=t||{},this.name="CBC",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},n.cbc.prototype.start=function(t){if(null===t.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=a(t.iv,this.blockSize),this._prev=this._iv.slice(0)}},n.cbc.prototype.encrypt=function(t,e,r){if(t.length()0))return!0;for(var i=0;i0))return!0;for(var i=0;i0)return!1;var r=t.length(),i=t.at(r-1);return!(i>this.blockSize<<2)&&(t.truncate(i),!0)},n.cfb=function(t){t=t||{},this.name="CFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0},n.cfb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=a(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},n.cfb.prototype.encrypt=function(t,e,r){var i=t.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize)for(var n=0;n0&&(a=this.blockSize-a),this._partialOutput.clear();for(n=0;n0)t.read-=this.blockSize;else for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return e.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}},n.cfb.prototype.decrypt=function(t,e,r){var i=t.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize)for(var n=0;n0&&(a=this.blockSize-a),this._partialOutput.clear();for(n=0;n0)t.read-=this.blockSize;else for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return e.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}},n.ofb=function(t){t=t||{},this.name="OFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0},n.ofb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=a(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},n.ofb.prototype.encrypt=function(t,e,r){var i=t.length();if(0===t.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize)for(var n=0;n0&&(a=this.blockSize-a),this._partialOutput.clear();for(n=0;n0)t.read-=this.blockSize;else for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return e.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}},n.ofb.prototype.decrypt=n.ofb.prototype.encrypt,n.ctr=function(t){t=t||{},this.name="CTR",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0},n.ctr.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=a(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},n.ctr.prototype.encrypt=function(t,e,r){var i=t.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize)for(var n=0;n0&&(a=this.blockSize-a),this._partialOutput.clear();for(n=0;n0&&(t.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return e.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}o(this._inBlock)},n.ctr.prototype.decrypt=n.ctr.prototype.encrypt,n.gcm=function(t){t=t||{},this.name="GCM",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0,this._R=3774873600},n.gcm.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");var e,r=i.util.createBuffer(t.iv);if(this._cipherLength=0,e="additionalData"in t?i.util.createBuffer(t.additionalData):i.util.createBuffer(),this._tagLength="tagLength"in t?t.tagLength:128,this._tag=null,t.decrypt&&(this._tag=i.util.createBuffer(t.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=r.length();if(12===n)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(s(8*n)))}this._inBlock=this._j0.slice(0),o(this._inBlock),this._partialBytes=0,e=i.util.createBuffer(e),this._aDataLength=s(8*e.length());var a=e.length()%this.blockSize;for(a&&e.fillWithByte(0,this.blockSize-a),this._s=[0,0,0,0];e.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()])},n.gcm.prototype.encrypt=function(t,e,r){var i=t.length();if(0===i)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&i>=this.blockSize){for(var n=0;n0&&(a=this.blockSize-a),this._partialOutput.clear();for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.read-=this.blockSize,e.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),o(this._inBlock)},n.gcm.prototype.decrypt=function(t,e,r){var i=t.length();if(i0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),o(this._inBlock),this._hashBlock[0]=t.getInt32(),this._hashBlock[1]=t.getInt32(),this._hashBlock[2]=t.getInt32(),this._hashBlock[3]=t.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var n=0;n0;--i)e[i]=t[i]>>>1|(1&t[i-1])<<31;e[0]=t[0]>>>1,r&&(e[0]^=this._R)},n.gcm.prototype.tableMultiply=function(t){for(var e=[0,0,0,0],r=0;r<32;++r){var i=t[r/8|0]>>>4*(7-r%8)&15,n=this._m[r][i];e[0]^=n[0],e[1]^=n[1],e[2]^=n[2],e[3]^=n[3]}return e},n.gcm.prototype.ghash=function(t,e,r){return e[0]^=r[0],e[1]^=r[1],e[2]^=r[2],e[3]^=r[3],this.tableMultiply(e)},n.gcm.prototype.generateHashTable=function(t,e){for(var r=8/e,i=4*r,n=16*r,a=new Array(n),o=0;o>>1,n=new Array(r);n[i]=t.slice(0);for(var a=i>>>1;a>0;)this.pow(n[2*a],n[a]=[]),a>>=1;for(a=2;a>1,s=o+(1&t.length),h=t.substr(0,s),u=t.substr(o,s),f=i.util.createBuffer(),l=i.hmac.create();r=e+r;var c=Math.ceil(n/16),d=Math.ceil(n/20);l.start("MD5",h);var p=i.util.createBuffer();f.putBytes(r);for(var m=0;m0&&(u.queue(t,u.createAlert(t,{level:u.Alert.Level.warning,description:u.Alert.Description.no_renegotiation})),u.flush(t)),t.process()},u.parseHelloMessage=function(t,e,r){var n=null,a=t.entity===u.ConnectionEnd.client;if(r<38)t.error(t,{message:a?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});else{var o=e.fragment,h=o.length();if(n={version:{major:o.getByte(),minor:o.getByte()},random:i.util.createBuffer(o.getBytes(32)),session_id:s(o,1),extensions:[]},a?(n.cipher_suite=o.getBytes(2),n.compression_method=o.getByte()):(n.cipher_suites=s(o,2),n.compression_methods=s(o,1)),(h=r-(h-o.length()))>0){for(var f=s(o,2);f.length()>0;)n.extensions.push({type:[f.getByte(),f.getByte()],data:s(f,2)});if(!a)for(var l=0;l0;){if(0!==d.getByte())break;t.session.extensions.server_name.serverNameList.push(s(d,2).getBytes())}}}if(t.session.version&&(n.version.major!==t.session.version.major||n.version.minor!==t.session.version.minor))return t.error(t,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.protocol_version}});if(a)t.session.cipherSuite=u.getCipherSuite(n.cipher_suite);else for(var p=i.util.createBuffer(n.cipher_suites.bytes());p.length()>0&&(t.session.cipherSuite=u.getCipherSuite(p.getBytes(2)),null===t.session.cipherSuite););if(null===t.session.cipherSuite)return t.error(t,{message:"No cipher suites in common.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.handshake_failure},cipherSuite:i.util.bytesToHex(n.cipher_suite)});t.session.compressionMethod=a?n.compression_method:u.CompressionMethod.none}return n},u.createSecurityParameters=function(t,e){var r=t.entity===u.ConnectionEnd.client,i=e.random.bytes(),n=r?t.session.sp.client_random:i,a=r?i:u.createRandom().getBytes();t.session.sp={entity:t.entity,prf_algorithm:u.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:t.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:n,server_random:a}},u.handleServerHello=function(t,e,r){var i=u.parseHelloMessage(t,e,r);if(!t.fail){if(!(i.version.minor<=t.version.minor))return t.error(t,{message:"Incompatible TLS version.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.protocol_version}});t.version.minor=i.version.minor,t.session.version=t.version;var n=i.session_id.bytes();n.length>0&&n===t.session.id?(t.expect=p,t.session.resuming=!0,t.session.sp.server_random=i.random.bytes()):(t.expect=f,t.session.resuming=!1,u.createSecurityParameters(t,i)),t.session.id=n,t.process()}},u.handleClientHello=function(t,e,r){var n=u.parseHelloMessage(t,e,r);if(!t.fail){var a=n.session_id.bytes(),o=null;if(t.sessionCache&&(null===(o=t.sessionCache.getSession(a))?a="":(o.version.major!==n.version.major||o.version.minor>n.version.minor)&&(o=null,a="")),0===a.length&&(a=i.random.getBytes(32)),t.session.id=a,t.session.clientHelloVersion=n.version,t.session.sp={},o)t.version=t.session.version=o.version,t.session.sp=o.sp;else{for(var s,h=1;h0;)n=s(h.certificate_list,3),a=i.asn1.fromDer(n),n=i.pki.certificateFromAsn1(a,!0),f.push(n)}catch(e){return t.error(t,{message:"Could not parse certificate list.",cause:e,send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.bad_certificate}})}var c=t.entity===u.ConnectionEnd.client;!c&&!0!==t.verifyClient||0!==f.length?0===f.length?t.expect=c?l:b:(c?t.session.serverCertificate=f[0]:t.session.clientCertificate=f[0],u.verifyCertificateChain(t,f)&&(t.expect=c?l:b)):t.error(t,{message:c?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}}),t.process()},u.handleServerKeyExchange=function(t,e,r){if(r>0)return t.error(t,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.unsupported_certificate}});t.expect=c,t.process()},u.handleClientKeyExchange=function(t,e,r){if(r<48)return t.error(t,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.unsupported_certificate}});var n=e.fragment,a={enc_pre_master_secret:s(n,2).getBytes()},o=null;if(t.getPrivateKey)try{o=t.getPrivateKey(t,t.session.serverCertificate),o=i.pki.privateKeyFromPem(o)}catch(e){t.error(t,{message:"Could not get private key.",cause:e,send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}})}if(null===o)return t.error(t,{message:"No private key set.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}});try{var h=t.session.sp;h.pre_master_secret=o.decrypt(a.enc_pre_master_secret);var f=t.session.clientHelloVersion;if(f.major!==h.pre_master_secret.charCodeAt(0)||f.minor!==h.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(t){h.pre_master_secret=i.random.getBytes(48)}t.expect=M,null!==t.session.clientCertificate&&(t.expect=w),t.process()},u.handleCertificateRequest=function(t,e,r){if(r<3)return t.error(t,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});var i=e.fragment,n={certificate_types:s(i,1),certificate_authorities:s(i,2)};t.session.certificateRequest=n,t.expect=d,t.process()},u.handleCertificateVerify=function(t,e,r){if(r<2)return t.error(t,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});var n=e.fragment;n.read-=4;var a=n.bytes();n.read+=4;var o={signature:s(n,2).getBytes()},h=i.util.createBuffer();h.putBuffer(t.session.md5.digest()),h.putBuffer(t.session.sha1.digest()),h=h.getBytes();try{if(!t.session.clientCertificate.publicKey.verify(h,o.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");t.session.md5.update(a),t.session.sha1.update(a)}catch(e){return t.error(t,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.handshake_failure}})}t.expect=M,t.process()},u.handleServerHelloDone=function(t,e,r){if(r>0)return t.error(t,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.record_overflow}});if(null===t.serverCertificate){var n={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.insufficient_security}},a=t.verify(t,n.alert.description,0,[]);if(!0!==a)return(a||0===a)&&("object"!=typeof a||i.util.isArray(a)?"number"==typeof a&&(n.alert.description=a):(a.message&&(n.message=a.message),a.alert&&(n.alert.description=a.alert))),t.error(t,n)}null!==t.session.certificateRequest&&(e=u.createRecord(t,{type:u.ContentType.handshake,data:u.createCertificate(t)}),u.queue(t,e)),e=u.createRecord(t,{type:u.ContentType.handshake,data:u.createClientKeyExchange(t)}),u.queue(t,e),t.expect=y;var o=function(t,e){null!==t.session.certificateRequest&&null!==t.session.clientCertificate&&u.queue(t,u.createRecord(t,{type:u.ContentType.handshake,data:u.createCertificateVerify(t,e)})),u.queue(t,u.createRecord(t,{type:u.ContentType.change_cipher_spec,data:u.createChangeCipherSpec()})),t.state.pending=u.createConnectionState(t),t.state.current.write=t.state.pending.write,u.queue(t,u.createRecord(t,{type:u.ContentType.handshake,data:u.createFinished(t)})),t.expect=p,u.flush(t),t.process()};if(null===t.session.certificateRequest||null===t.session.clientCertificate)return o(t,null);u.getClientSignature(t,o)},u.handleChangeCipherSpec=function(t,e){if(1!==e.fragment.getByte())return t.error(t,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});var r=t.entity===u.ConnectionEnd.client;(t.session.resuming&&r||!t.session.resuming&&!r)&&(t.state.pending=u.createConnectionState(t)),t.state.current.read=t.state.pending.read,(!t.session.resuming&&r||t.session.resuming&&!r)&&(t.state.pending=null),t.expect=r?m:_,t.process()},u.handleFinished=function(t,e,r){var a=e.fragment;a.read-=4;var o=a.bytes();a.read+=4;var s=e.fragment.getBytes();(a=i.util.createBuffer()).putBuffer(t.session.md5.digest()),a.putBuffer(t.session.sha1.digest());var h=t.entity===u.ConnectionEnd.client,f=h?"server finished":"client finished",l=t.session.sp;if((a=n(l.master_secret,f,a.getBytes(),12)).getBytes()!==s)return t.error(t,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.decrypt_error}});t.session.md5.update(o),t.session.sha1.update(o),(t.session.resuming&&h||!t.session.resuming&&!h)&&(u.queue(t,u.createRecord(t,{type:u.ContentType.change_cipher_spec,data:u.createChangeCipherSpec()})),t.state.current.write=t.state.pending.write,t.state.pending=null,u.queue(t,u.createRecord(t,{type:u.ContentType.handshake,data:u.createFinished(t)}))),t.expect=h?g:S,t.handshaking=!1,++t.handshakes,t.peerCertificate=h?t.session.serverCertificate:t.session.clientCertificate,u.flush(t),t.isConnected=!0,t.connected(t),t.process()},u.handleAlert=function(t,e){var r,i=e.fragment,n={level:i.getByte(),description:i.getByte()};switch(n.description){case u.Alert.Description.close_notify:r="Connection closed.";break;case u.Alert.Description.unexpected_message:r="Unexpected message.";break;case u.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case u.Alert.Description.decryption_failed:r="Decryption failed.";break;case u.Alert.Description.record_overflow:r="Record overflow.";break;case u.Alert.Description.decompression_failure:r="Decompression failed.";break;case u.Alert.Description.handshake_failure:r="Handshake failure.";break;case u.Alert.Description.bad_certificate:r="Bad certificate.";break;case u.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case u.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case u.Alert.Description.certificate_expired:r="Certificate expired.";break;case u.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case u.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case u.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case u.Alert.Description.access_denied:r="Access denied.";break;case u.Alert.Description.decode_error:r="Decode error.";break;case u.Alert.Description.decrypt_error:r="Decrypt error.";break;case u.Alert.Description.export_restriction:r="Export restriction.";break;case u.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case u.Alert.Description.insufficient_security:r="Insufficient security.";break;case u.Alert.Description.internal_error:r="Internal error.";break;case u.Alert.Description.user_canceled:r="User canceled.";break;case u.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(n.description===u.Alert.Description.close_notify)return t.close();t.error(t,{message:r,send:!1,origin:t.entity===u.ConnectionEnd.client?"server":"client",alert:n}),t.process()},u.handleHandshake=function(t,e){var r=e.fragment,n=r.getByte(),a=r.getInt24();if(a>r.length())return t.fragmented=e,e.fragment=i.util.createBuffer(),r.read-=4,t.process();t.fragmented=null,r.read-=4;var o=r.bytes(a+4);r.read+=4,n in O[t.entity][t.expect]?(t.entity!==u.ConnectionEnd.server||t.open||t.fail||(t.handshaking=!0,t.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:i.md.md5.create(),sha1:i.md.sha1.create()}),n!==u.HandshakeType.hello_request&&n!==u.HandshakeType.certificate_verify&&n!==u.HandshakeType.finished&&(t.session.md5.update(o),t.session.sha1.update(o)),O[t.entity][t.expect][n](t,e,a)):u.handleUnexpected(t,e)},u.handleApplicationData=function(t,e){t.data.putBuffer(e.fragment),t.dataReady(t),t.process()},u.handleHeartbeat=function(t,e){var r=e.fragment,n=r.getByte(),a=r.getInt16(),o=r.getBytes(a);if(n===u.HeartbeatMessageType.heartbeat_request){if(t.handshaking||a>o.length)return t.process();u.queue(t,u.createRecord(t,{type:u.ContentType.heartbeat,data:u.createHeartbeat(u.HeartbeatMessageType.heartbeat_response,o)})),u.flush(t)}else if(n===u.HeartbeatMessageType.heartbeat_response){if(o!==t.expectedHeartbeatPayload)return t.process();t.heartbeatReceived&&t.heartbeatReceived(t,i.util.createBuffer(o))}t.process()};var f=1,l=2,c=3,d=4,p=5,m=6,g=7,y=8,v=1,b=2,w=3,M=4,_=5,S=6,E=u.handleUnexpected,C=u.handleChangeCipherSpec,A=u.handleAlert,T=u.handleHandshake,B=u.handleApplicationData,I=u.handleHeartbeat,k=[];k[u.ConnectionEnd.client]=[[E,A,T,E,I],[E,A,T,E,I],[E,A,T,E,I],[E,A,T,E,I],[E,A,T,E,I],[C,A,E,E,I],[E,A,T,E,I],[E,A,T,B,I],[E,A,T,E,I]],k[u.ConnectionEnd.server]=[[E,A,T,E,I],[E,A,T,E,I],[E,A,T,E,I],[E,A,T,E,I],[C,A,E,E,I],[E,A,T,E,I],[E,A,T,B,I],[E,A,T,E,I]];var R=u.handleHelloRequest,N=u.handleServerHello,L=u.handleCertificate,x=u.handleServerKeyExchange,P=u.handleCertificateRequest,D=u.handleServerHelloDone,U=u.handleFinished,O=[];O[u.ConnectionEnd.client]=[[E,E,N,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E],[R,E,E,E,E,E,E,E,E,E,E,L,x,P,D,E,E,E,E,E,E],[R,E,E,E,E,E,E,E,E,E,E,E,x,P,D,E,E,E,E,E,E],[R,E,E,E,E,E,E,E,E,E,E,E,E,P,D,E,E,E,E,E,E],[R,E,E,E,E,E,E,E,E,E,E,E,E,E,D,E,E,E,E,E,E],[R,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E],[R,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,U],[R,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E],[R,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E]];var j=u.handleClientHello,K=u.handleClientKeyExchange,V=u.handleCertificateVerify;O[u.ConnectionEnd.server]=[[E,j,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E],[E,E,E,E,E,E,E,E,E,E,E,L,E,E,E,E,E,E,E,E,E],[E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,K,E,E,E,E],[E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,V,E,E,E,E,E],[E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E],[E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,U],[E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E],[E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E]],u.generateKeys=function(t,e){var r=n,i=e.client_random+e.server_random;t.session.resuming||(e.master_secret=r(e.pre_master_secret,"master secret",i,48).bytes(),e.pre_master_secret=null),i=e.server_random+e.client_random;var a=2*e.mac_key_length+2*e.enc_key_length,o=t.version.major===u.Versions.TLS_1_0.major&&t.version.minor===u.Versions.TLS_1_0.minor;o&&(a+=2*e.fixed_iv_length);var s=r(e.master_secret,"key expansion",i,a),h={client_write_MAC_key:s.getBytes(e.mac_key_length),server_write_MAC_key:s.getBytes(e.mac_key_length),client_write_key:s.getBytes(e.enc_key_length),server_write_key:s.getBytes(e.enc_key_length)};return o&&(h.client_write_IV=s.getBytes(e.fixed_iv_length),h.server_write_IV=s.getBytes(e.fixed_iv_length)),h},u.createConnectionState=function(t){var e=t.entity===u.ConnectionEnd.client,r=function(){var t={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(t){return!0},compressionState:null,compressFunction:function(t){return!0},updateSequenceNumber:function(){4294967295===t.sequenceNumber[1]?(t.sequenceNumber[1]=0,++t.sequenceNumber[0]):++t.sequenceNumber[1]}};return t},i={read:r(),write:r()};if(i.read.update=function(t,e){return i.read.cipherFunction(e,i.read)?i.read.compressFunction(t,e,i.read)||t.error(t,{message:"Could not decompress record.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.decompression_failure}}):t.error(t,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.bad_record_mac}}),!t.fail},i.write.update=function(t,e){return i.write.compressFunction(t,e,i.write)?i.write.cipherFunction(e,i.write)||t.error(t,{message:"Could not encrypt record.",send:!1,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}}):t.error(t,{message:"Could not compress record.",send:!1,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}}),!t.fail},t.session){var n=t.session.sp;switch(t.session.cipherSuite.initSecurityParameters(n),n.keys=u.generateKeys(t,n),i.read.macKey=e?n.keys.server_write_MAC_key:n.keys.client_write_MAC_key,i.write.macKey=e?n.keys.client_write_MAC_key:n.keys.server_write_MAC_key,t.session.cipherSuite.initConnectionState(i,t,n),n.compression_algorithm){case u.CompressionMethod.none:break;case u.CompressionMethod.deflate:i.read.compressFunction=o,i.write.compressFunction=a;break;default:throw new Error("Unsupported compression algorithm.")}}return i},u.createRandom=function(){var t=new Date,e=+t+6e4*t.getTimezoneOffset(),r=i.util.createBuffer();return r.putInt32(e),r.putBytes(i.random.getBytes(28)),r},u.createRecord=function(t,e){return e.data?{type:e.type,version:{major:t.version.major,minor:t.version.minor},length:e.data.length(),fragment:e.data}:null},u.createAlert=function(t,e){var r=i.util.createBuffer();return r.putByte(e.level),r.putByte(e.description),u.createRecord(t,{type:u.ContentType.alert,data:r})},u.createClientHello=function(t){t.session.clientHelloVersion={major:t.version.major,minor:t.version.minor};for(var e=i.util.createBuffer(),r=0;r0&&(p+=2);var m=t.session.id,g=m.length+1+2+4+28+2+a+1+s+p,y=i.util.createBuffer();return y.putByte(u.HandshakeType.client_hello),y.putInt24(g),y.putByte(t.version.major),y.putByte(t.version.minor),y.putBytes(t.session.sp.client_random),h(y,1,i.util.createBuffer(m)),h(y,2,e),h(y,1,o),p>0&&h(y,2,f),y},u.createServerHello=function(t){var e=t.session.id,r=e.length+1+2+4+28+2+1,n=i.util.createBuffer();return n.putByte(u.HandshakeType.server_hello),n.putInt24(r),n.putByte(t.version.major),n.putByte(t.version.minor),n.putBytes(t.session.sp.server_random),h(n,1,i.util.createBuffer(e)),n.putByte(t.session.cipherSuite.id[0]),n.putByte(t.session.cipherSuite.id[1]),n.putByte(t.session.compressionMethod),n},u.createCertificate=function(t){var e,r=t.entity===u.ConnectionEnd.client,n=null;t.getCertificate&&(e=r?t.session.certificateRequest:t.session.extensions.server_name.serverNameList,n=t.getCertificate(t,e));var a=i.util.createBuffer();if(null!==n)try{i.util.isArray(n)||(n=[n]);for(var o=null,s=0;su.MaxFragment;)n.push(u.createRecord(t,{type:e.type,data:i.util.createBuffer(a.slice(0,u.MaxFragment))})),a=a.slice(u.MaxFragment);a.length>0&&n.push(u.createRecord(t,{type:e.type,data:i.util.createBuffer(a)}))}for(var o=0;o0&&(n=r.order[0]),null!==n&&n in r.cache)for(var a in e=r.cache[n],delete r.cache[n],r.order)if(r.order[a]===n){r.order.splice(a,1);break}return e},r.setSession=function(t,e){if(r.order.length===r.capacity){var n=r.order.shift();delete r.cache[n]}n=i.util.bytesToHex(t);r.order.push(n),r.cache[n]=e}}return r},u.createConnection=function(t){var e=null;e=t.caStore?i.util.isArray(t.caStore)?i.pki.createCaStore(t.caStore):t.caStore:i.pki.createCaStore();var r=t.cipherSuites||null;if(null===r)for(var n in r=[],u.CipherSuites)r.push(u.CipherSuites[n]);var a=t.server?u.ConnectionEnd.server:u.ConnectionEnd.client,o=t.sessionCache?u.createSessionCache(t.sessionCache):null,s={version:{major:u.Version.major,minor:u.Version.minor},entity:a,sessionId:t.sessionId,caStore:e,sessionCache:o,cipherSuites:r,connected:t.connected,virtualHost:t.virtualHost||null,verifyClient:t.verifyClient||!1,verify:t.verify||function(t,e,r,i){return e},verifyOptions:t.verifyOptions||{},getCertificate:t.getCertificate||null,getPrivateKey:t.getPrivateKey||null,getSignature:t.getSignature||null,input:i.util.createBuffer(),tlsData:i.util.createBuffer(),data:i.util.createBuffer(),tlsDataReady:t.tlsDataReady,dataReady:t.dataReady,heartbeatReceived:t.heartbeatReceived,closed:t.closed,error:function(e,r){r.origin=r.origin||(e.entity===u.ConnectionEnd.client?"client":"server"),r.send&&(u.queue(e,u.createAlert(e,r.alert)),u.flush(e));var i=!1!==r.fatal;i&&(e.fail=!0),t.error(e,r),i&&e.close(!1)},deflate:t.deflate||null,inflate:t.inflate||null,reset:function(t){s.version={major:u.Version.major,minor:u.Version.minor},s.record=null,s.session=null,s.peerCertificate=null,s.state={pending:null,current:null},s.expect=(s.entity,u.ConnectionEnd.client,0),s.fragmented=null,s.records=[],s.open=!1,s.handshakes=0,s.handshaking=!1,s.isConnected=!1,s.fail=!(t||void 0===t),s.input.clear(),s.tlsData.clear(),s.data.clear(),s.state.current=u.createConnectionState(s)}};s.reset();return s.handshake=function(t){if(s.entity!==u.ConnectionEnd.client)s.error(s,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(s.handshaking)s.error(s,{message:"Handshake already in progress.",fatal:!1});else{s.fail&&!s.open&&0===s.handshakes&&(s.fail=!1),s.handshaking=!0;var e=null;(t=t||"").length>0&&(s.sessionCache&&(e=s.sessionCache.getSession(t)),null===e&&(t="")),0===t.length&&s.sessionCache&&null!==(e=s.sessionCache.getSession())&&(t=e.id),s.session={id:t,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:i.md.md5.create(),sha1:i.md.sha1.create()},e&&(s.version=e.version,s.session.sp=e.sp),s.session.sp.client_random=u.createRandom().getBytes(),s.open=!0,u.queue(s,u.createRecord(s,{type:u.ContentType.handshake,data:u.createClientHello(s)})),u.flush(s)}},s.process=function(t){var e=0;return t&&s.input.putBytes(t),s.fail||(null!==s.record&&s.record.ready&&s.record.fragment.isEmpty()&&(s.record=null),null===s.record&&(e=function(t){var e=0,r=t.input,n=r.length();if(n<5)e=5-n;else{t.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:i.util.createBuffer(),ready:!1};var a=t.record.version.major===t.version.major;a&&t.session&&t.session.version&&(a=t.record.version.minor===t.version.minor),a||t.error(t,{message:"Incompatible TLS version.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.protocol_version}})}return e}(s)),s.fail||null===s.record||s.record.ready||(e=function(t){var e=0,r=t.input,i=r.length();i=0;h--)I>>=8,I+=C.at(h)+B.at(h),B.setAt(h,255&I);T.putBuffer(B)}w=T,l.putBuffer(S)}return l.truncate(l.length()-a),l},o.pbe.getCipher=function(t,e,r){switch(t){case o.oids.pkcs5PBES2:return o.pbe.getCipherForPBES2(t,e,r);case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case o.oids["pbewithSHAAnd40BitRC2-CBC"]:return o.pbe.getCipherForPKCS12PBE(t,e,r);default:var i=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw i.oid=t,i.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],i}},o.pbe.getCipherForPBES2=function(t,e,r){var n,s={},h=[];if(!a.validate(e,u,s,h))throw(n=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=h,n;if((t=a.derToOid(s.kdfOid))!==o.oids.pkcs5PBKDF2)throw(n=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=t,n.supportedOids=["pkcs5PBKDF2"],n;if((t=a.derToOid(s.encOid))!==o.oids["aes128-CBC"]&&t!==o.oids["aes192-CBC"]&&t!==o.oids["aes256-CBC"]&&t!==o.oids["des-EDE3-CBC"]&&t!==o.oids.desCBC)throw(n=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=t,n.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],n;var f,l,d=s.kdfSalt,p=i.util.createBuffer(s.kdfIterationCount);switch(p=p.getInt(p.length()<<3),o.oids[t]){case"aes128-CBC":f=16,l=i.aes.createDecryptionCipher;break;case"aes192-CBC":f=24,l=i.aes.createDecryptionCipher;break;case"aes256-CBC":f=32,l=i.aes.createDecryptionCipher;break;case"des-EDE3-CBC":f=24,l=i.des.createDecryptionCipher;break;case"desCBC":f=8,l=i.des.createDecryptionCipher}var m=c(s.prfOid),g=i.pkcs5.pbkdf2(r,d,p,f,m),y=s.encIv,v=l(g);return v.start(y),v},o.pbe.getCipherForPKCS12PBE=function(t,e,r){var n={},s=[];if(!a.validate(e,f,n,s))throw(m=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=s,m;var h,u,l,d=i.util.createBuffer(n.salt),p=i.util.createBuffer(n.iterations);switch(p=p.getInt(p.length()<<3),t){case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:h=24,u=8,l=i.des.startDecrypting;break;case o.oids["pbewithSHAAnd40BitRC2-CBC"]:h=5,u=8,l=function(t,e){var r=i.rc2.createDecryptionCipher(t,40);return r.start(e,null),r};break;default:var m;throw(m=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=t,m}var g=c(n.prfOid),y=o.pbe.generatePkcs12Key(r,d,1,p,h,g);return g.start(),l(y,o.pbe.generatePkcs12Key(r,d,2,p,u,g))},o.pbe.opensslDeriveBytes=function(t,e,r,n){if(null==n){if(!("md5"in i.md))throw new Error('"md5" hash algorithm unavailable.');n=i.md.md5.create()}null===e&&(e="");for(var a=[l(n,t+e)],o=16,s=1;o>>0,s>>>0];for(var u=n.fullMessageLength.length-1;u>=0;--u)n.fullMessageLength[u]+=s[1],s[1]=s[0]+(n.fullMessageLength[u]/4294967296>>>0),n.fullMessageLength[u]=n.fullMessageLength[u]>>>0,s[0]=s[1]/4294967296>>>0;return e.putBytes(a),h(t,r,e),(e.read>2048||0===e.length())&&e.compact(),n},n.digest=function(){var o=i.util.createBuffer();o.putBytes(e.bytes());var s,u=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize&n.blockLength-1;o.putBytes(a.substr(0,n.blockLength-u));for(var f=8*n.fullMessageLength[0],l=0;l>>0,o.putInt32(f>>>0),f=s>>>0;o.putInt32(f);var c={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4,h5:t.h5,h6:t.h6,h7:t.h7};h(c,r,o);var d=i.util.createBuffer();return d.putInt32(c.h0),d.putInt32(c.h1),d.putInt32(c.h2),d.putInt32(c.h3),d.putInt32(c.h4),d.putInt32(c.h5),d.putInt32(c.h6),d.putInt32(c.h7),d},n};var a=null,o=!1,s=null;function h(t,e,r){for(var i,n,a,o,h,u,f,l,c,d,p,m,g,y=r.length();y>=64;){for(h=0;h<16;++h)e[h]=r.getInt32();for(;h<64;++h)i=((i=e[h-2])>>>17|i<<15)^(i>>>19|i<<13)^i>>>10,n=((n=e[h-15])>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,e[h]=i+e[h-7]+n+e[h-16]|0;for(u=t.h0,f=t.h1,l=t.h2,c=t.h3,d=t.h4,p=t.h5,m=t.h6,g=t.h7,h=0;h<64;++h)a=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),o=u&f|l&(u^f),i=g+((d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7))+(m^d&(p^m))+s[h]+e[h],g=m,m=p,p=d,d=c+i>>>0,c=l,l=f,f=u,u=i+(n=a+o)>>>0;t.h0=t.h0+u|0,t.h1=t.h1+f|0,t.h2=t.h2+l|0,t.h3=t.h3+c|0,t.h4=t.h4+d|0,t.h5=t.h5+p|0,t.h6=t.h6+m|0,t.h7=t.h7+g|0,y-=64}}},function(t,e,r){(function(e){var i=r(1);r(3);var n=null;!i.util.isNodejs||i.options.usePureJavaScript||e.versions["node-webkit"]||(n=r(49)),(t.exports=i.prng=i.prng||{}).create=function(t){for(var e={plugin:t,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=t.md,a=new Array(32),o=0;o<32;++o)a[o]=r.create();function s(){if(e.pools[0].messageLength>=32)return h();var t=32-e.pools[0].messageLength<<5;e.collect(e.seedFileSync(t)),h()}function h(){e.reseeds=4294967295===e.reseeds?0:e.reseeds+1;var t=e.plugin.md.create();t.update(e.keyBytes);for(var r=1,i=0;i<32;++i)e.reseeds%r==0&&(t.update(e.pools[i].digest().getBytes()),e.pools[i].start()),r<<=1;e.keyBytes=t.digest().getBytes(),t.start(),t.update(e.keyBytes);var n=t.digest().getBytes();e.key=e.plugin.formatKey(e.keyBytes),e.seed=e.plugin.formatSeed(n),e.generated=0}function u(t){var e=null,r=i.util.globalScope,n=r.crypto||r.msCrypto;n&&n.getRandomValues&&(e=function(t){return n.getRandomValues(t)});var a=i.util.createBuffer();if(e)for(;a.length()>16)))<<16,c=4294967295&(f=(2147483647&(f+=u>>15))+(f>>31));for(h=0;h<3;++h)l=c>>>(h<<3),l^=Math.floor(256*Math.random()),a.putByte(255&l)}return a.getBytes(t)}return e.pools=a,e.pool=0,e.generate=function(t,r){if(!r)return e.generateSync(t);var n=e.plugin.cipher,a=e.plugin.increment,o=e.plugin.formatKey,s=e.plugin.formatSeed,u=i.util.createBuffer();e.key=null,function f(l){if(l)return r(l);if(u.length()>=t)return r(null,u.getBytes(t));e.generated>1048575&&(e.key=null);if(null===e.key)return i.util.nextTick((function(){!function(t){if(e.pools[0].messageLength>=32)return h(),t();var r=32-e.pools[0].messageLength<<5;e.seedFile(r,(function(r,i){if(r)return t(r);e.collect(i),h(),t()}))}(f)}));var c=n(e.key,e.seed);e.generated+=c.length,u.putBytes(c),e.key=o(n(e.key,a(e.seed))),e.seed=s(n(e.key,e.seed)),i.util.setImmediate(f)}()},e.generateSync=function(t){var r=e.plugin.cipher,n=e.plugin.increment,a=e.plugin.formatKey,o=e.plugin.formatSeed;e.key=null;for(var h=i.util.createBuffer();h.length()1048575&&(e.key=null),null===e.key&&s();var u=r(e.key,e.seed);e.generated+=u.length,h.putBytes(u),e.key=a(r(e.key,n(e.seed))),e.seed=o(r(e.key,e.seed))}return h.getBytes(t)},n?(e.seedFile=function(t,e){n.randomBytes(t,(function(t,r){if(t)return e(t);e(null,r.toString())}))},e.seedFileSync=function(t){return n.randomBytes(t).toString()}):(e.seedFile=function(t,e){try{e(null,u(t))}catch(t){e(t)}},e.seedFileSync=u),e.collect=function(t){for(var r=t.length,i=0;i>n&255);e.collect(i)},e.registerWorker=function(t){if(t===self)e.seedFile=function(t,e){self.addEventListener("message",(function t(r){var i=r.data;i.forge&&i.forge.prng&&(self.removeEventListener("message",t),e(i.forge.prng.err,i.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:t}}})};else{t.addEventListener("message",(function(r){var i=r.data;i.forge&&i.forge.prng&&e.seedFile(i.forge.prng.needed,(function(e,r){t.postMessage({forge:{prng:{err:e,bytes:r}}})}))}))}},e}}).call(this,r(5))},function(t,e,r){var i=r(1);r(3);var n=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],a=[1,2,3,5],o=function(t,e){return t<>16-e},s=function(t,e){return(65535&t)>>e|t<<16-e&65535};t.exports=i.rc2=i.rc2||{},i.rc2.expandKey=function(t,e){"string"==typeof t&&(t=i.util.createBuffer(t)),e=e||128;var r,a=t,o=t.length(),s=e,h=Math.ceil(s/8),u=255>>(7&s);for(r=o;r<128;r++)a.putByte(n[a.at(r-1)+a.at(r-o)&255]);for(a.setAt(128-h,n[a.at(128-h)&u]),r=127-h;r>=0;r--)a.setAt(r,n[a.at(r+1)^a.at(r+h)]);return a};var h=function(t,e,r){var n,h,u,f,l=!1,c=null,d=null,p=null,m=[];for(t=i.rc2.expandKey(t,e),u=0;u<64;u++)m.push(t.getInt16Le());r?(n=function(t){for(u=0;u<4;u++)t[u]+=m[f]+(t[(u+3)%4]&t[(u+2)%4])+(~t[(u+3)%4]&t[(u+1)%4]),t[u]=o(t[u],a[u]),f++},h=function(t){for(u=0;u<4;u++)t[u]+=m[63&t[(u+3)%4]]}):(n=function(t){for(u=3;u>=0;u--)t[u]=s(t[u],a[u]),t[u]-=m[f]+(t[(u+3)%4]&t[(u+2)%4])+(~t[(u+3)%4]&t[(u+1)%4]),f--},h=function(t){for(u=3;u>=0;u--)t[u]-=m[63&t[(u+3)%4]]});var g=function(t){var e=[];for(u=0;u<4;u++){var i=c.getInt16Le();null!==p&&(r?i^=p.getInt16Le():p.putInt16Le(i)),e.push(65535&i)}f=r?0:63;for(var n=0;n=8;)g([[5,n],[1,h],[6,n],[1,h],[5,n]])},finish:function(t){var e=!0;if(r)if(t)e=t(8,c,!r);else{var i=8===c.length()?8:8-c.length();c.fillWithByte(i,i)}if(e&&(l=!0,y.update()),!r&&(e=0===c.length()))if(t)e=t(8,d,!r);else{var n=d.length(),a=d.at(n-1);a>n?e=!1:d.truncate(a)}return e}}};i.rc2.startEncrypting=function(t,e,r){var n=i.rc2.createEncryptionCipher(t,128);return n.start(e,r),n},i.rc2.createEncryptionCipher=function(t,e){return h(t,e,!0)},i.rc2.startDecrypting=function(t,e,r){var n=i.rc2.createDecryptionCipher(t,128);return n.start(e,r),n},i.rc2.createDecryptionCipher=function(t,e){return h(t,e,!1)}},function(t,e,r){var i=r(1);r(3),r(9),r(29);var n=t.exports=i.pkcs1=i.pkcs1||{};function a(t,e,r){r||(r=i.md.sha1.create());for(var n="",a=Math.ceil(e/r.digestLength),o=0;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(t+s),n+=r.digest().getBytes()}return n.substring(0,e)}n.encode_rsa_oaep=function(t,e,r){var n,o,s,h;"string"==typeof r?(n=r,o=arguments[3]||void 0,s=arguments[4]||void 0):r&&(n=r.label||void 0,o=r.seed||void 0,s=r.md||void 0,r.mgf1&&r.mgf1.md&&(h=r.mgf1.md)),s?s.start():s=i.md.sha1.create(),h||(h=s);var u=Math.ceil(t.n.bitLength()/8),f=u-2*s.digestLength-2;if(e.length>f)throw(g=new Error("RSAES-OAEP input message length is too long.")).length=e.length,g.maxLength=f,g;n||(n=""),s.update(n,"raw");for(var l=s.digest(),c="",d=f-e.length,p=0;pt&&(o=h(t,e));var d=o.toString(16);n.target.postMessage({hex:d,workLoad:f}),o.dAddOffset(l,0)}}}d()}(t,e,n,a);return s(t,e,n,a)}(t,u,a.options,n);throw new Error("Invalid prime generation algorithm: "+a.name)}}function s(t,e,r,a){var o=h(t,e),s=function(t){return t<=100?27:t<=150?18:t<=200?15:t<=250?12:t<=300?9:t<=350?8:t<=400?7:t<=500?6:t<=600?5:t<=800?4:t<=1250?3:2}(o.bitLength());"millerRabinTests"in r&&(s=r.millerRabinTests);var u=10;"maxBlockTime"in r&&(u=r.maxBlockTime),function t(e,r,a,o,s,u,f){var l=+new Date;do{if(e.bitLength()>r&&(e=h(r,a)),e.isProbablePrime(s))return f(null,e);e.dAddOffset(n[o++%8],0)}while(u<0||+new Date-l=0&&n.push(s):n.push(s))}return n}function d(t){if(t.composed||t.constructed){for(var e=i.util.createBuffer(),r=0;r0&&(h=n.create(n.Class.UNIVERSAL,n.Type.SET,!0,l));var c=[],d=[];null!==e&&(d=i.util.isArray(e)?e:[e]);for(var p=[],m=0;m0){var b=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,p),w=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.data).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,n.toDer(b).getBytes())])]);c.push(w)}var M=null;if(null!==t){var _=a.wrapRsaPrivateKey(a.privateKeyToAsn1(t));M=null===r?n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.keyBag).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[_]),h]):n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.pkcs8ShroudedKeyBag).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[a.encryptPrivateKeyInfo(_,r,s)]),h]);var S=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[M]),E=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.data).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,n.toDer(S).getBytes())])]);c.push(E)}var C,A=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,c);if(s.useMac){var T=i.md.sha1.create(),B=new i.util.ByteBuffer(i.random.getBytes(s.saltSize)),I=s.count,k=(t=o.generateKey(r,B,3,I,20),i.hmac.create());k.start(T,t),k.update(n.toDer(A).getBytes());var R=k.getMac();C=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.sha1).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.NULL,!1,"")]),n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,R.getBytes())]),n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,B.getBytes()),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(I).getBytes())])}return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(3).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.oids.data).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,n.toDer(A).getBytes())])]),C])},o.generateKey=i.pbe.generatePkcs12Key},function(t,e,r){var i=r(1);r(10),r(3);var n=i.asn1,a=t.exports=i.pkcs7asn1=i.pkcs7asn1||{};i.pkcs7=i.pkcs7||{},i.pkcs7.asn1=a;var o={name:"ContentInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};a.contentInfoValidator=o;var s={name:"EncryptedContentInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:n.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};a.envelopedDataValidator={name:"EnvelopedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(s)},a.encryptedDataValidator={name:"EncryptedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"}].concat(s)};var h={name:"SignerInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:n.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};a.signedDataValidator={name:"SignedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},o,{name:"SignedData.Certificates",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,capture:"signerInfos",optional:!0,value:[h]}]},a.recipientInfoValidator={name:"RecipientInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:n.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},function(t,e,r){var i=r(1);r(3),i.mgf=i.mgf||{},(t.exports=i.mgf.mgf1=i.mgf1=i.mgf1||{}).create=function(t){return{generate:function(e,r){for(var n=new i.util.ByteBuffer,a=Math.ceil(r/t.digestLength),o=0;o>>0,o>>>0];for(var s=d.fullMessageLength.length-1;s>=0;--s)d.fullMessageLength[s]+=o[1],o[1]=o[0]+(d.fullMessageLength[s]/4294967296>>>0),d.fullMessageLength[s]=d.fullMessageLength[s]>>>0,o[0]=o[1]/4294967296>>>0;return n.putBytes(t),f(r,a,n),(n.read>2048||0===n.length())&&n.compact(),d},d.digest=function(){var e=i.util.createBuffer();e.putBytes(n.bytes());var s,h=d.fullMessageLength[d.fullMessageLength.length-1]+d.messageLengthSize&d.blockLength-1;e.putBytes(o.substr(0,d.blockLength-h));for(var u=8*d.fullMessageLength[0],l=0;l>>0,e.putInt32(u>>>0),u=s>>>0;e.putInt32(u);var c=new Array(r.length);for(l=0;l=128;){for(k=0;k<16;++k)e[k][0]=r.getInt32()>>>0,e[k][1]=r.getInt32()>>>0;for(;k<80;++k)i=(((R=(L=e[k-2])[0])>>>19|(N=L[1])<<13)^(N>>>29|R<<3)^R>>>6)>>>0,n=((R<<13|N>>>19)^(N<<3|R>>>29)^(R<<26|N>>>6))>>>0,a=(((R=(P=e[k-15])[0])>>>1|(N=P[1])<<31)^(R>>>8|N<<24)^R>>>7)>>>0,o=((R<<31|N>>>1)^(R<<24|N>>>8)^(R<<25|N>>>7))>>>0,x=e[k-7],D=e[k-16],N=n+x[1]+o+D[1],e[k][0]=i+x[0]+a+D[0]+(N/4294967296>>>0)>>>0,e[k][1]=N>>>0;for(p=t[0][0],m=t[0][1],g=t[1][0],y=t[1][1],v=t[2][0],b=t[2][1],w=t[3][0],M=t[3][1],_=t[4][0],S=t[4][1],E=t[5][0],C=t[5][1],A=t[6][0],T=t[6][1],B=t[7][0],I=t[7][1],k=0;k<80;++k)f=((_>>>14|S<<18)^(_>>>18|S<<14)^(S>>>9|_<<23))>>>0,l=(A^_&(E^A))>>>0,s=((p>>>28|m<<4)^(m>>>2|p<<30)^(m>>>7|p<<25))>>>0,u=((p<<4|m>>>28)^(m<<30|p>>>2)^(m<<25|p>>>7))>>>0,c=(p&g|v&(p^g))>>>0,d=(m&y|b&(m^y))>>>0,N=I+(((_<<18|S>>>14)^(_<<14|S>>>18)^(S<<23|_>>>9))>>>0)+((T^S&(C^T))>>>0)+h[k][1]+e[k][1],i=B+f+l+h[k][0]+e[k][0]+(N/4294967296>>>0)>>>0,n=N>>>0,a=s+c+((N=u+d)/4294967296>>>0)>>>0,o=N>>>0,B=A,I=T,A=E,T=C,E=_,C=S,_=w+i+((N=M+n)/4294967296>>>0)>>>0,S=N>>>0,w=v,M=b,v=g,b=y,g=p,y=m,p=i+a+((N=n+o)/4294967296>>>0)>>>0,m=N>>>0;N=t[0][1]+m,t[0][0]=t[0][0]+p+(N/4294967296>>>0)>>>0,t[0][1]=N>>>0,N=t[1][1]+y,t[1][0]=t[1][0]+g+(N/4294967296>>>0)>>>0,t[1][1]=N>>>0,N=t[2][1]+b,t[2][0]=t[2][0]+v+(N/4294967296>>>0)>>>0,t[2][1]=N>>>0,N=t[3][1]+M,t[3][0]=t[3][0]+w+(N/4294967296>>>0)>>>0,t[3][1]=N>>>0,N=t[4][1]+S,t[4][0]=t[4][0]+_+(N/4294967296>>>0)>>>0,t[4][1]=N>>>0,N=t[5][1]+C,t[5][0]=t[5][0]+E+(N/4294967296>>>0)>>>0,t[5][1]=N>>>0,N=t[6][1]+T,t[6][0]=t[6][0]+A+(N/4294967296>>>0)>>>0,t[6][1]=N>>>0,N=t[7][1]+I,t[7][0]=t[7][0]+B+(N/4294967296>>>0)>>>0,t[7][1]=N>>>0,U-=128}}},function(t,e,r){const i=r(161),n=r(38);function a(t,e,r){let i=r;const a=n.hasConfig(this.config,t);return a&&(i=a.toEncrypt.map(t=>s.call(this,t,r))),{header:e,body:a?n.computeBody(a.toEncrypt,r,i):r}}function o(t){const e=t.body;let r=t.body;const i=n.hasConfig(this.config,t.request.url);return i&&(r=i.toDecrypt.map(t=>h.call(this,t,e))),i?n.computeBody(i.toDecrypt,e,r):e}function s(t,e){const r=n.elemFromPath(t.element,e);if(r&&r.node){const i=this.crypto.encryptData({data:r.node});e=n.mutateObjectProperty(t.obj,i,e),n.isJsonRoot(t.obj)||t.element===t.obj+"."+this.config.encryptedValueFieldName||n.deleteNode(t.element,e)}return e}function h(t,e){const r=n.elemFromPath(t.element,e);if(r&&r.node){const i=this.crypto.decryptData(r.node[this.config.encryptedValueFieldName]);return n.mutateObjectProperty(t.obj,i,e,t.element,[])}return e}t.exports=function(t){this.encrypt=a,this.decrypt=o,this.config=t,this.crypto=new i(t)}},function(t,e,r){"use strict";var i=r(2).Buffer,n=r(163).Transform;function a(t){n.call(this),this._block=i.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(0)(a,n),a.prototype._transform=function(t,e,r){var i=null;try{this.update(t,e)}catch(t){i=t}r(i)},a.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},a.prototype.update=function(t,e){if(function(t,e){if(!i.isBuffer(t)&&"string"!=typeof t)throw new TypeError(e+" must be a string or a buffer")}(t,"Data"),this._finalized)throw new Error("Digest already called");i.isBuffer(t)||(t=i.from(t,e));for(var r=this._block,n=0;this._blockOffset+t.length-n>=this._blockSize;){for(var a=this._blockOffset;a0;++o)this._length[o]+=s,(s=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*s);return this},a.prototype._update=function(){throw new Error("_update is not implemented")},a.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},a.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=a},function(t,e,r){"use strict";(function(e,i){var n;t.exports=C,C.ReadableState=E;r(17).EventEmitter;var a=function(t,e){return t.listeners(e).length},o=r(94),s=r(4).Buffer,h=e.Uint8Array||function(){};var u,f=r(164);u=f&&f.debuglog?f.debuglog("stream"):function(){};var l,c,d,p=r(165),m=r(95),g=r(96).getHighWaterMark,y=r(23).codes,v=y.ERR_INVALID_ARG_TYPE,b=y.ERR_STREAM_PUSH_AFTER_EOF,w=y.ERR_METHOD_NOT_IMPLEMENTED,M=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(0)(C,o);var _=m.errorOrDestroy,S=["error","close","destroy","pause","resume"];function E(t,e,i){n=n||r(24),t=t||{},"boolean"!=typeof i&&(i=e instanceof n),this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=g(this,t,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==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&&(l||(l=r(18).StringDecoder),this.decoder=new l(t.encoding),this.encoding=t.encoding)}function C(t){if(n=n||r(24),!(this instanceof C))return new C(t);var e=this instanceof n;this._readableState=new E(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),o.call(this)}function A(t,e,r,i,n){u("readableAddChunk",e);var a,o=t._readableState;if(null===e)o.reading=!1,function(t,e){if(u("onEofChunk"),e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?I(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,k(t)))}(t,o);else if(n||(a=function(t,e){var r;i=e,s.isBuffer(i)||i instanceof h||"string"==typeof e||void 0===e||t.objectMode||(r=new v("chunk",["string","Buffer","Uint8Array"],e));var i;return r}(o,e)),a)_(t,a);else if(o.objectMode||e&&e.length>0)if("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===s.prototype||(e=function(t){return s.from(t)}(e)),i)o.endEmitted?_(t,new M):T(t,o,e,!0);else if(o.ended)_(t,new b);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?T(t,o,e,!1):R(t,o)):T(t,o,e,!1)}else i||(o.reading=!1,R(t,o));return!o.ended&&(o.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function I(t){var e=t._readableState;u("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(u("emitReadable",e.flowing),e.emittedReadable=!0,i.nextTick(k,t))}function k(t){var e=t._readableState;u("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,D(t)}function R(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(N,t,e))}function N(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function x(t){u("readable nexttick read 0"),t.read(0)}function P(t,e){u("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),D(t),e.flowing&&!e.reading&&t.read(0)}function D(t){var e=t._readableState;for(u("flow",e.flowing);e.flowing&&null!==t.read(););}function U(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function O(t){var e=t._readableState;u("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,i.nextTick(j,e,t))}function j(t,e){if(u("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function K(t,e){for(var r=0,i=t.length;r=e.highWaterMark:e.length>0)||e.ended))return u("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?O(this):I(this),null;if(0===(t=B(t,e))&&e.ended)return 0===e.length&&O(this),null;var i,n=e.needReadable;return u("need readable",n),(0===e.length||e.length-t0?U(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&O(this)),null!==i&&this.emit("data",i),i},C.prototype._read=function(t){_(this,new w("_read()"))},C.prototype.pipe=function(t,e){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t)}n.pipesCount+=1,u("pipe count=%d opts=%j",n.pipesCount,e);var o=(!e||!1!==e.end)&&t!==i.stdout&&t!==i.stderr?h:g;function s(e,i){u("onunpipe"),e===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,u("cleanup"),t.removeListener("close",p),t.removeListener("finish",m),t.removeListener("drain",f),t.removeListener("error",d),t.removeListener("unpipe",s),r.removeListener("end",h),r.removeListener("end",g),r.removeListener("data",c),l=!0,!n.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function h(){u("onend"),t.end()}n.endEmitted?i.nextTick(o):r.once("end",o),t.on("unpipe",s);var f=function(t){return function(){var e=t._readableState;u("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,D(t))}}(r);t.on("drain",f);var l=!1;function c(e){u("ondata");var i=t.write(e);u("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===t||n.pipesCount>1&&-1!==K(n.pipes,t))&&!l&&(u("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function d(e){u("onerror",e),g(),t.removeListener("error",d),0===a(t,"error")&&_(t,e)}function p(){t.removeListener("finish",m),g()}function m(){u("onfinish"),t.removeListener("close",p),g()}function g(){u("unpipe"),r.unpipe(t)}return r.on("data",c),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",d),t.once("close",p),t.once("finish",m),t.emit("pipe",r),n.flowing||(u("pipe resume"),r.resume()),t},C.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var a=0;a0,!1!==n.flowing&&this.resume()):"readable"===t&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,u("on readable",n.length,n.reading),n.length?I(this):n.reading||i.nextTick(x,this))),r},C.prototype.addListener=C.prototype.on,C.prototype.removeListener=function(t,e){var r=o.prototype.removeListener.call(this,t,e);return"readable"===t&&i.nextTick(L,this),r},C.prototype.removeAllListeners=function(t){var e=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||i.nextTick(L,this),e},C.prototype.resume=function(){var t=this._readableState;return t.flowing||(u("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(P,t,e))}(this,t)),t.paused=!1,this},C.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},C.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(n){(u("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(e.push(n)||(i=!0,t.pause()))})),t)void 0===this[n]&&"function"==typeof t[n]&&(this[n]=function(e){return function(){return t[e].apply(t,arguments)}}(n));for(var a=0;a-1))throw new M(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(C.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(C.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),C.prototype._write=function(t,e,r){r(new m("_write()"))},C.prototype._writev=null,C.prototype.end=function(t,e,r){var n=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,e,r){e.ending=!0,R(t,e),r&&(e.finished?i.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r),this},Object.defineProperty(C.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(C.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),C.prototype.destroy=l.destroy,C.prototype._undestroy=l.undestroy,C.prototype._destroy=function(t,e){e(t)}}).call(this,r(6),r(5))},function(t,e,r){"use strict";t.exports=f;var i=r(23).codes,n=i.ERR_METHOD_NOT_IMPLEMENTED,a=i.ERR_MULTIPLE_CALLBACK,o=i.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=i.ERR_TRANSFORM_WITH_LENGTH_0,h=r(24);function u(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new a);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function c(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function d(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}i(h,n),h.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},h.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,a=0|this._c,s=0|this._d,h=0|this._e,p=0|this._f,m=0|this._g,g=0|this._h,y=0;y<16;++y)r[y]=t.readInt32BE(4*y);for(;y<64;++y)r[y]=0|(((e=r[y-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[y-7]+d(r[y-15])+r[y-16];for(var v=0;v<64;++v){var b=g+c(h)+u(h,p,m)+o[v]+r[v]|0,w=l(i)+f(i,n,a)|0;g=m,m=p,p=h,h=s+b|0,s=a,a=n,n=i,i=b+w|0}this._a=i+this._a|0,this._b=n+this._b|0,this._c=a+this._c|0,this._d=s+this._d|0,this._e=h+this._e|0,this._f=p+this._f|0,this._g=m+this._g|0,this._h=g+this._h|0},h.prototype._hash=function(){var t=a.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=h},function(t,e,r){var i=r(0),n=r(25),a=r(2).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],s=new Array(160);function h(){this.init(),this._w=s,n.call(this,128,112)}function u(t,e,r){return r^t&(e^r)}function f(t,e,r){return t&e|r&(t|e)}function l(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function c(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function d(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function p(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function m(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function g(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function y(t,e){return t>>>0>>0?1:0}i(h,n),h.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},h.prototype._update=function(t){for(var e=this._w,r=0|this._ah,i=0|this._bh,n=0|this._ch,a=0|this._dh,s=0|this._eh,h=0|this._fh,v=0|this._gh,b=0|this._hh,w=0|this._al,M=0|this._bl,_=0|this._cl,S=0|this._dl,E=0|this._el,C=0|this._fl,A=0|this._gl,T=0|this._hl,B=0;B<32;B+=2)e[B]=t.readInt32BE(4*B),e[B+1]=t.readInt32BE(4*B+4);for(;B<160;B+=2){var I=e[B-30],k=e[B-30+1],R=d(I,k),N=p(k,I),L=m(I=e[B-4],k=e[B-4+1]),x=g(k,I),P=e[B-14],D=e[B-14+1],U=e[B-32],O=e[B-32+1],j=N+D|0,K=R+P+y(j,N)|0;K=(K=K+L+y(j=j+x|0,x)|0)+U+y(j=j+O|0,O)|0,e[B]=K,e[B+1]=j}for(var V=0;V<160;V+=2){K=e[V],j=e[V+1];var q=f(r,i,n),F=f(w,M,_),H=l(r,w),z=l(w,r),G=c(s,E),W=c(E,s),Z=o[V],Y=o[V+1],Q=u(s,h,v),X=u(E,C,A),J=T+W|0,$=b+G+y(J,T)|0;$=($=($=$+Q+y(J=J+X|0,X)|0)+Z+y(J=J+Y|0,Y)|0)+K+y(J=J+j|0,j)|0;var tt=z+F|0,et=H+q+y(tt,z)|0;b=v,T=A,v=h,A=C,h=s,C=E,s=a+$+y(E=S+J|0,S)|0,a=n,S=_,n=i,_=M,i=r,M=w,r=$+et+y(w=J+tt|0,J)|0}this._al=this._al+w|0,this._bl=this._bl+M|0,this._cl=this._cl+_|0,this._dl=this._dl+S|0,this._el=this._el+E|0,this._fl=this._fl+C|0,this._gl=this._gl+A|0,this._hl=this._hl+T|0,this._ah=this._ah+r+y(this._al,w)|0,this._bh=this._bh+i+y(this._bl,M)|0,this._ch=this._ch+n+y(this._cl,_)|0,this._dh=this._dh+a+y(this._dl,S)|0,this._eh=this._eh+s+y(this._el,E)|0,this._fh=this._fh+h+y(this._fl,C)|0,this._gh=this._gh+v+y(this._gl,A)|0,this._hh=this._hh+b+y(this._hl,T)|0},h.prototype._hash=function(){var t=a.allocUnsafe(64);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=h},function(t,e,r){"use strict";(function(e,i){var n=r(39);t.exports=b;var a,o=r(177);b.ReadableState=v;r(17).EventEmitter;var s=function(t,e){return t.listeners(e).length},h=r(102),u=r(59).Buffer,f=e.Uint8Array||function(){};var l=Object.create(r(31));l.inherits=r(0);var c=r(178),d=void 0;d=c&&c.debuglog?c.debuglog("stream"):function(){};var p,m=r(179),g=r(103);l.inherits(b,h);var y=["error","close","destroy","pause","resume"];function v(t,e){t=t||{};var i=e instanceof(a=a||r(19));this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var n=t.highWaterMark,o=t.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(o||0===o)?o:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(p||(p=r(18).StringDecoder),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function b(t){if(a=a||r(19),!(this instanceof b))return new b(t);this._readableState=new v(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),h.call(this)}function w(t,e,r,i,n){var a,o=t._readableState;null===e?(o.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,S(t)}(t,o)):(n||(a=function(t,e){var r;i=e,u.isBuffer(i)||i instanceof f||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var i;return r}(o,e)),a?t.emit("error",a):o.objectMode||e&&e.length>0?("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===u.prototype||(e=function(t){return u.from(t)}(e)),i?o.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):M(t,o,e,!0):o.ended?t.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?M(t,o,e,!1):C(t,o)):M(t,o,e,!1))):i||(o.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=8388608?t=8388608:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function S(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(d("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?n.nextTick(E,t):E(t))}function E(t){d("emit readable"),t.emit("readable"),I(t)}function C(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(A,t,e))}function A(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var i;ta.length?a.length:t;if(o===a.length?n+=a:n+=a.slice(0,t),0===(t-=o)){o===a.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=a.slice(o));break}++i}return e.length-=i,n}(t,e):function(t,e){var r=u.allocUnsafe(t),i=e.head,n=1;i.data.copy(r),t-=i.data.length;for(;i=i.next;){var a=i.data,o=t>a.length?a.length:t;if(a.copy(r,r.length-t,0,o),0===(t-=o)){o===a.length?(++n,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=a.slice(o));break}++n}return e.length-=n,r}(t,e);return i}(t,e.buffer,e.decoder),r);var r}function R(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,n.nextTick(N,e,t))}function N(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function L(t,e){for(var r=0,i=t.length;r=e.highWaterMark||e.ended))return d("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?R(this):S(this),null;if(0===(t=_(t,e))&&e.ended)return 0===e.length&&R(this),null;var i,n=e.needReadable;return d("need readable",n),(0===e.length||e.length-t0?k(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&R(this)),null!==i&&this.emit("data",i),i},b.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},b.prototype.pipe=function(t,e){var r=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,d("pipe count=%d opts=%j",a.pipesCount,e);var h=(!e||!1!==e.end)&&t!==i.stdout&&t!==i.stderr?f:b;function u(e,i){d("onunpipe"),e===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,d("cleanup"),t.removeListener("close",y),t.removeListener("finish",v),t.removeListener("drain",l),t.removeListener("error",g),t.removeListener("unpipe",u),r.removeListener("end",f),r.removeListener("end",b),r.removeListener("data",m),c=!0,!a.awaitDrain||t._writableState&&!t._writableState.needDrain||l())}function f(){d("onend"),t.end()}a.endEmitted?n.nextTick(h):r.once("end",h),t.on("unpipe",u);var l=function(t){return function(){var e=t._readableState;d("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,I(t))}}(r);t.on("drain",l);var c=!1;var p=!1;function m(e){d("ondata"),p=!1,!1!==t.write(e)||p||((1===a.pipesCount&&a.pipes===t||a.pipesCount>1&&-1!==L(a.pipes,t))&&!c&&(d("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function g(e){d("onerror",e),b(),t.removeListener("error",g),0===s(t,"error")&&t.emit("error",e)}function y(){t.removeListener("finish",v),b()}function v(){d("onfinish"),t.removeListener("close",y),b()}function b(){d("unpipe"),r.unpipe(t)}return r.on("data",m),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?o(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",g),t.once("close",y),t.once("finish",v),t.emit("pipe",r),a.flowing||(d("pipe resume"),r.resume()),t},b.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var a=0;ar)?e=("rmd160"===t?new h:u(t)).update(e).digest():e.lengthr||e!=e)throw new TypeError("Bad key length")}},function(t,e,r){(function(e,r){var i;if(e.process&&e.process.browser)i="utf-8";else if(e.process&&e.process.version){i=parseInt(r.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else i="utf-8";t.exports=i}).call(this,r(6),r(5))},function(t,e,r){var i=r(106),n=r(56),a=r(57),o=r(2).Buffer,s=r(109),h=r(110),u=r(112),f=o.alloc(128),l={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function c(t,e,r){var s=function(t){function e(e){return a(t).update(e).digest()}return"rmd160"===t||"ripemd160"===t?function(t){return(new n).update(t).digest()}:"md5"===t?i:e}(t),h="sha512"===t||"sha384"===t?128:64;e.length>h?e=s(e):e.length>>0},e.writeUInt32BE=function(t,e,r){t[0+r]=e>>>24,t[1+r]=e>>>16&255,t[2+r]=e>>>8&255,t[3+r]=255&e},e.ip=function(t,e,r,i){for(var n=0,a=0,o=6;o>=0;o-=2){for(var s=0;s<=24;s+=8)n<<=1,n|=e>>>s+o&1;for(s=0;s<=24;s+=8)n<<=1,n|=t>>>s+o&1}for(o=6;o>=0;o-=2){for(s=1;s<=25;s+=8)a<<=1,a|=e>>>s+o&1;for(s=1;s<=25;s+=8)a<<=1,a|=t>>>s+o&1}r[i+0]=n>>>0,r[i+1]=a>>>0},e.rip=function(t,e,r,i){for(var n=0,a=0,o=0;o<4;o++)for(var s=24;s>=0;s-=8)n<<=1,n|=e>>>s+o&1,n<<=1,n|=t>>>s+o&1;for(o=4;o<8;o++)for(s=24;s>=0;s-=8)a<<=1,a|=e>>>s+o&1,a<<=1,a|=t>>>s+o&1;r[i+0]=n>>>0,r[i+1]=a>>>0},e.pc1=function(t,e,r,i){for(var n=0,a=0,o=7;o>=5;o--){for(var s=0;s<=24;s+=8)n<<=1,n|=e>>s+o&1;for(s=0;s<=24;s+=8)n<<=1,n|=t>>s+o&1}for(s=0;s<=24;s+=8)n<<=1,n|=e>>s+o&1;for(o=1;o<=3;o++){for(s=0;s<=24;s+=8)a<<=1,a|=e>>s+o&1;for(s=0;s<=24;s+=8)a<<=1,a|=t>>s+o&1}for(s=0;s<=24;s+=8)a<<=1,a|=t>>s+o&1;r[i+0]=n>>>0,r[i+1]=a>>>0},e.r28shl=function(t,e){return t<>>28-e};var i=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];e.pc2=function(t,e,r,n){for(var a=0,o=0,s=i.length>>>1,h=0;h>>i[h]&1;for(h=s;h>>i[h]&1;r[n+0]=a>>>0,r[n+1]=o>>>0},e.expand=function(t,e,r){var i=0,n=0;i=(1&t)<<5|t>>>27;for(var a=23;a>=15;a-=4)i<<=6,i|=t>>>a&63;for(a=11;a>=3;a-=4)n|=t>>>a&63,n<<=6;n|=(31&t)<<1|t>>>31,e[r+0]=i>>>0,e[r+1]=n>>>0};var n=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];e.substitute=function(t,e){for(var r=0,i=0;i<4;i++){r<<=4,r|=n[64*i+(t>>>18-6*i&63)]}for(i=0;i<4;i++){r<<=4,r|=n[256+64*i+(e>>>18-6*i&63)]}return r>>>0};var a=[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];e.permute=function(t){for(var e=0,r=0;r>>a[r]&1;return e>>>0},e.padSplit=function(t,e,r){for(var i=t.toString(2);i.length>>1];r=a.r28shl(r,s),n=a.r28shl(n,s),a.pc2(r,n,t.keys,o)}},h.prototype._update=function(t,e,r,i){var n=this._desState,o=a.readUInt32BE(t,e),s=a.readUInt32BE(t,e+4);a.ip(o,s,n.tmp,0),o=n.tmp[0],s=n.tmp[1],"encrypt"===this.type?this._encrypt(n,o,s,n.tmp,0):this._decrypt(n,o,s,n.tmp,0),o=n.tmp[0],s=n.tmp[1],a.writeUInt32BE(r,o,i),a.writeUInt32BE(r,s,i+4)},h.prototype._pad=function(t,e){for(var r=t.length-e,i=e;i>>0,o=c}a.rip(s,o,i,n)},h.prototype._decrypt=function(t,e,r,i,n){for(var o=r,s=e,h=t.keys.length-2;h>=0;h-=2){var u=t.keys[h],f=t.keys[h+1];a.expand(o,t.tmp,0),u^=t.tmp[0],f^=t.tmp[1];var l=a.substitute(u,f),c=o;o=(s^a.permute(l))>>>0,s=c}a.rip(o,s,i,n)}},function(t,e,r){var i=r(32),n=r(2).Buffer,a=r(116);function o(t){var e=t._cipher.encryptBlockRaw(t._prev);return a(t._prev),e}e.encrypt=function(t,e){var r=Math.ceil(e.length/16),a=t._cache.length;t._cache=n.concat([t._cache,n.allocUnsafe(16*r)]);for(var s=0;st;)r.ishrn(1);if(r.isEven()&&r.iadd(s),r.testn(1)||r.iadd(h),e.cmp(h)){if(!e.cmp(u))for(;r.mod(f).cmp(l);)r.iadd(d)}else for(;r.mod(a).cmp(c);)r.iadd(d);if(g(p=r.shrn(1))&&g(r)&&y(p)&&y(r)&&o.test(p)&&o.test(r))return r}}},function(t,e,r){(function(t){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=a:e.BN=a,a.BN=a,a.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(205).Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function h(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return n}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=h(t,e,i)<=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?""};var f=["","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],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,s=67108863&o,h=o/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(o=(n=0|t.words[p])*(a=0|e.words[d])+l)/67108864|0,l=67108863&o}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?f[6-h.length]+h+r:h+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=l[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[u-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var o,s,h="le"===e,u=new t(a),f=this.clone();if(h){for(s=0;!f.isZero();s++)o=f.andln(255),f.iushrn(8),u[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,g=0|o[2],y=8191&g,v=g>>>13,b=0|o[3],w=8191&b,M=b>>>13,_=0|o[4],S=8191&_,E=_>>>13,C=0|o[5],A=8191&C,T=C>>>13,B=0|o[6],I=8191&B,k=B>>>13,R=0|o[7],N=8191&R,L=R>>>13,x=0|o[8],P=8191&x,D=x>>>13,U=0|o[9],O=8191&U,j=U>>>13,K=0|s[0],V=8191&K,q=K>>>13,F=0|s[1],H=8191&F,z=F>>>13,G=0|s[2],W=8191&G,Z=G>>>13,Y=0|s[3],Q=8191&Y,X=Y>>>13,J=0|s[4],$=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],at=8191&nt,ot=nt>>>13,st=0|s[7],ht=8191&st,ut=st>>>13,ft=0|s[8],lt=8191&ft,ct=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,q))+Math.imul(c,V)|0))<<13)|0;u=((a=Math.imul(c,q))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,V),n=(n=Math.imul(p,q))+Math.imul(m,V)|0,a=Math.imul(m,q);var yt=(u+(i=i+Math.imul(l,H)|0)|0)+((8191&(n=(n=n+Math.imul(l,z)|0)+Math.imul(c,H)|0))<<13)|0;u=((a=a+Math.imul(c,z)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,V),n=(n=Math.imul(y,q))+Math.imul(v,V)|0,a=Math.imul(v,q),i=i+Math.imul(p,H)|0,n=(n=n+Math.imul(p,z)|0)+Math.imul(m,H)|0,a=a+Math.imul(m,z)|0;var vt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,W)|0))<<13)|0;u=((a=a+Math.imul(c,Z)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(w,V),n=(n=Math.imul(w,q))+Math.imul(M,V)|0,a=Math.imul(M,q),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,z)|0)+Math.imul(v,H)|0,a=a+Math.imul(v,z)|0,i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,W)|0,a=a+Math.imul(m,Z)|0;var bt=(u+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,X)|0)+Math.imul(c,Q)|0))<<13)|0;u=((a=a+Math.imul(c,X)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(S,V),n=(n=Math.imul(S,q))+Math.imul(E,V)|0,a=Math.imul(E,q),i=i+Math.imul(w,H)|0,n=(n=n+Math.imul(w,z)|0)+Math.imul(M,H)|0,a=a+Math.imul(M,z)|0,i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(v,W)|0,a=a+Math.imul(v,Z)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,X)|0;var wt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,$)|0))<<13)|0;u=((a=a+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,V),n=(n=Math.imul(A,q))+Math.imul(T,V)|0,a=Math.imul(T,q),i=i+Math.imul(S,H)|0,n=(n=n+Math.imul(S,z)|0)+Math.imul(E,H)|0,a=a+Math.imul(E,z)|0,i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(M,W)|0,a=a+Math.imul(M,Z)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,X)|0)+Math.imul(v,Q)|0,a=a+Math.imul(v,X)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,$)|0,a=a+Math.imul(m,tt)|0;var Mt=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((a=a+Math.imul(c,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,V),n=(n=Math.imul(I,q))+Math.imul(k,V)|0,a=Math.imul(k,q),i=i+Math.imul(A,H)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(T,H)|0,a=a+Math.imul(T,z)|0,i=i+Math.imul(S,W)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(E,W)|0,a=a+Math.imul(E,Z)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,X)|0)+Math.imul(M,Q)|0,a=a+Math.imul(M,X)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,$)|0,a=a+Math.imul(v,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,it)|0;var _t=(u+(i=i+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,ot)|0)+Math.imul(c,at)|0))<<13)|0;u=((a=a+Math.imul(c,ot)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(N,V),n=(n=Math.imul(N,q))+Math.imul(L,V)|0,a=Math.imul(L,q),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,z)|0)+Math.imul(k,H)|0,a=a+Math.imul(k,z)|0,i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,Z)|0)+Math.imul(T,W)|0,a=a+Math.imul(T,Z)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(E,Q)|0,a=a+Math.imul(E,X)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(M,$)|0,a=a+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,a=a+Math.imul(v,it)|0,i=i+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var St=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((a=a+Math.imul(c,ut)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(P,V),n=(n=Math.imul(P,q))+Math.imul(D,V)|0,a=Math.imul(D,q),i=i+Math.imul(N,H)|0,n=(n=n+Math.imul(N,z)|0)+Math.imul(L,H)|0,a=a+Math.imul(L,z)|0,i=i+Math.imul(I,W)|0,n=(n=n+Math.imul(I,Z)|0)+Math.imul(k,W)|0,a=a+Math.imul(k,Z)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,X)|0)+Math.imul(T,Q)|0,a=a+Math.imul(T,X)|0,i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(E,$)|0,a=a+Math.imul(E,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(M,rt)|0,a=a+Math.imul(M,it)|0,i=i+Math.imul(y,at)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(v,at)|0,a=a+Math.imul(v,ot)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,a=a+Math.imul(m,ut)|0;var Et=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((a=a+Math.imul(c,ct)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(O,V),n=(n=Math.imul(O,q))+Math.imul(j,V)|0,a=Math.imul(j,q),i=i+Math.imul(P,H)|0,n=(n=n+Math.imul(P,z)|0)+Math.imul(D,H)|0,a=a+Math.imul(D,z)|0,i=i+Math.imul(N,W)|0,n=(n=n+Math.imul(N,Z)|0)+Math.imul(L,W)|0,a=a+Math.imul(L,Z)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,X)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,X)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(T,$)|0,a=a+Math.imul(T,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(E,rt)|0,a=a+Math.imul(E,it)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(M,at)|0,a=a+Math.imul(M,ot)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,a=a+Math.imul(v,ut)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,a=a+Math.imul(m,ct)|0;var Ct=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((a=a+Math.imul(c,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(O,H),n=(n=Math.imul(O,z))+Math.imul(j,H)|0,a=Math.imul(j,z),i=i+Math.imul(P,W)|0,n=(n=n+Math.imul(P,Z)|0)+Math.imul(D,W)|0,a=a+Math.imul(D,Z)|0,i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,X)|0)+Math.imul(L,Q)|0,a=a+Math.imul(L,X)|0,i=i+Math.imul(I,$)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(k,$)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(T,rt)|0,a=a+Math.imul(T,it)|0,i=i+Math.imul(S,at)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(E,at)|0,a=a+Math.imul(E,ot)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(M,ht)|0,a=a+Math.imul(M,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(v,lt)|0,a=a+Math.imul(v,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((a=a+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(O,W),n=(n=Math.imul(O,Z))+Math.imul(j,W)|0,a=Math.imul(j,Z),i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,X)|0)+Math.imul(D,Q)|0,a=a+Math.imul(D,X)|0,i=i+Math.imul(N,$)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(L,$)|0,a=a+Math.imul(L,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(T,at)|0,a=a+Math.imul(T,ot)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(E,ht)|0,a=a+Math.imul(E,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(M,lt)|0,a=a+Math.imul(M,ct)|0;var Tt=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;u=((a=a+Math.imul(v,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(O,Q),n=(n=Math.imul(O,X))+Math.imul(j,Q)|0,a=Math.imul(j,X),i=i+Math.imul(P,$)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(D,$)|0,a=a+Math.imul(D,tt)|0,i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(L,rt)|0,a=a+Math.imul(L,it)|0,i=i+Math.imul(I,at)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(T,ht)|0,a=a+Math.imul(T,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(E,lt)|0,a=a+Math.imul(E,ct)|0;var Bt=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;u=((a=a+Math.imul(M,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(O,$),n=(n=Math.imul(O,tt))+Math.imul(j,$)|0,a=Math.imul(j,tt),i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(D,rt)|0,a=a+Math.imul(D,it)|0,i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(L,at)|0,a=a+Math.imul(L,ot)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(k,ht)|0,a=a+Math.imul(k,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(T,lt)|0,a=a+Math.imul(T,ct)|0;var It=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((a=a+Math.imul(E,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(O,rt),n=(n=Math.imul(O,it))+Math.imul(j,rt)|0,a=Math.imul(j,it),i=i+Math.imul(P,at)|0,n=(n=n+Math.imul(P,ot)|0)+Math.imul(D,at)|0,a=a+Math.imul(D,ot)|0,i=i+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,ut)|0)+Math.imul(L,ht)|0,a=a+Math.imul(L,ut)|0,i=i+Math.imul(I,lt)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(k,lt)|0,a=a+Math.imul(k,ct)|0;var kt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(T,pt)|0))<<13)|0;u=((a=a+Math.imul(T,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(O,at),n=(n=Math.imul(O,ot))+Math.imul(j,at)|0,a=Math.imul(j,ot),i=i+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,ut)|0)+Math.imul(D,ht)|0,a=a+Math.imul(D,ut)|0,i=i+Math.imul(N,lt)|0,n=(n=n+Math.imul(N,ct)|0)+Math.imul(L,lt)|0,a=a+Math.imul(L,ct)|0;var Rt=(u+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((a=a+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(O,ht),n=(n=Math.imul(O,ut))+Math.imul(j,ht)|0,a=Math.imul(j,ut),i=i+Math.imul(P,lt)|0,n=(n=n+Math.imul(P,ct)|0)+Math.imul(D,lt)|0,a=a+Math.imul(D,ct)|0;var Nt=(u+(i=i+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((a=a+Math.imul(L,mt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(O,lt),n=(n=Math.imul(O,ct))+Math.imul(j,lt)|0,a=Math.imul(j,ct);var Lt=(u+(i=i+Math.imul(P,pt)|0)|0)+((8191&(n=(n=n+Math.imul(P,mt)|0)+Math.imul(D,pt)|0))<<13)|0;u=((a=a+Math.imul(D,mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863;var xt=(u+(i=Math.imul(O,pt))|0)+((8191&(n=(n=Math.imul(O,mt))+Math.imul(j,pt)|0))<<13)|0;return u=((a=Math.imul(j,mt))+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=bt,h[4]=wt,h[5]=Mt,h[6]=_t,h[7]=St,h[8]=Et,h[9]=Ct,h[10]=At,h[11]=Tt,h[12]=Bt,h[13]=It,h[14]=kt,h[15]=Rt,h[16]=Nt,h[17]=Lt,h[18]=xt,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,t,e):m(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,u=0;u=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-a|l>>>a,f=l&s}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(h/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,h=i.length-n.length;if("mod"!==e){(s=new a(null)).length=h+1,s.words=new Array(s.length);for(var u=0;u=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/o|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);s&&(s.words[l]=c)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},a.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),h=new a(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(l)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||h.isOdd())&&(s.iadd(f),h.isub(l)),s.iushrn(1),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(h)):(r.isub(e),s.isub(n),h.isub(o))}return{a:s,b:h,gcd:r.iushln(u)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),h=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;0==(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(h),o.iushrn(1);for(var l=0,c=1;0==(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new S(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(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 t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},n(b,v),b.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return y[t]=e,e},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),h=s.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,g=0;0!==m.cmp(s);g++)m=m.redSqr();i(g=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==o?(o<<=1,o|=l,(4===++s||0===i&&0===f)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}h=26}return n},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new E(t)},n(E,S),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(20)(t))},function(t,e,r){var i=r(206),n=r(64);function a(t){this.rand=t||new n.Rand}t.exports=a,a.create=function(t){return new a(t)},a.prototype._randbelow=function(t){var e=t.bitLength(),r=Math.ceil(e/8);do{var n=new i(this.rand.generate(r))}while(n.cmp(t)>=0);return n},a.prototype._randrange=function(t,e){var r=e.sub(t);return t.add(this._randbelow(r))},a.prototype.test=function(t,e,r){var n=t.bitLength(),a=i.mont(t),o=new i(1).toRed(a);e||(e=Math.max(1,n/48|0));for(var s=t.subn(1),h=0;!s.testn(h);h++);for(var u=t.shrn(h),f=s.toRed(a);e>0;e--){var l=this._randrange(new i(2),s);r&&r(l);var c=l.toRed(a).redPow(u);if(0!==c.cmp(o)&&0!==c.cmp(f)){for(var d=1;d0;e--){var f=this._randrange(new i(2),o),l=t.gcd(f);if(0!==l.cmpn(1))return l;var c=f.toRed(n).redPow(h);if(0!==c.cmp(a)&&0!==c.cmp(u)){for(var d=1;d0)if("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===s.prototype||(e=function(t){return s.from(t)}(e)),i)o.endEmitted?_(t,new M):T(t,o,e,!0);else if(o.ended)_(t,new b);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?T(t,o,e,!1):R(t,o)):T(t,o,e,!1)}else i||(o.reading=!1,R(t,o));return!o.ended&&(o.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function I(t){var e=t._readableState;u("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(u("emitReadable",e.flowing),e.emittedReadable=!0,i.nextTick(k,t))}function k(t){var e=t._readableState;u("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,D(t)}function R(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(N,t,e))}function N(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function x(t){u("readable nexttick read 0"),t.read(0)}function P(t,e){u("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),D(t),e.flowing&&!e.reading&&t.read(0)}function D(t){var e=t._readableState;for(u("flow",e.flowing);e.flowing&&null!==t.read(););}function U(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function O(t){var e=t._readableState;u("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,i.nextTick(j,e,t))}function j(t,e){if(u("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function K(t,e){for(var r=0,i=t.length;r=e.highWaterMark:e.length>0)||e.ended))return u("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?O(this):I(this),null;if(0===(t=B(t,e))&&e.ended)return 0===e.length&&O(this),null;var i,n=e.needReadable;return u("need readable",n),(0===e.length||e.length-t0?U(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&O(this)),null!==i&&this.emit("data",i),i},C.prototype._read=function(t){_(this,new w("_read()"))},C.prototype.pipe=function(t,e){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t)}n.pipesCount+=1,u("pipe count=%d opts=%j",n.pipesCount,e);var o=(!e||!1!==e.end)&&t!==i.stdout&&t!==i.stderr?h:g;function s(e,i){u("onunpipe"),e===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,u("cleanup"),t.removeListener("close",p),t.removeListener("finish",m),t.removeListener("drain",f),t.removeListener("error",d),t.removeListener("unpipe",s),r.removeListener("end",h),r.removeListener("end",g),r.removeListener("data",c),l=!0,!n.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function h(){u("onend"),t.end()}n.endEmitted?i.nextTick(o):r.once("end",o),t.on("unpipe",s);var f=function(t){return function(){var e=t._readableState;u("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,D(t))}}(r);t.on("drain",f);var l=!1;function c(e){u("ondata");var i=t.write(e);u("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===t||n.pipesCount>1&&-1!==K(n.pipes,t))&&!l&&(u("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function d(e){u("onerror",e),g(),t.removeListener("error",d),0===a(t,"error")&&_(t,e)}function p(){t.removeListener("finish",m),g()}function m(){u("onfinish"),t.removeListener("close",p),g()}function g(){u("unpipe"),r.unpipe(t)}return r.on("data",c),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",d),t.once("close",p),t.once("finish",m),t.emit("pipe",r),n.flowing||(u("pipe resume"),r.resume()),t},C.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var a=0;a0,!1!==n.flowing&&this.resume()):"readable"===t&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,u("on readable",n.length,n.reading),n.length?I(this):n.reading||i.nextTick(x,this))),r},C.prototype.addListener=C.prototype.on,C.prototype.removeListener=function(t,e){var r=o.prototype.removeListener.call(this,t,e);return"readable"===t&&i.nextTick(L,this),r},C.prototype.removeAllListeners=function(t){var e=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||i.nextTick(L,this),e},C.prototype.resume=function(){var t=this._readableState;return t.flowing||(u("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(P,t,e))}(this,t)),t.paused=!1,this},C.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},C.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",(function(){if(u("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(n){(u("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(e.push(n)||(i=!0,t.pause()))})),t)void 0===this[n]&&"function"==typeof t[n]&&(this[n]=function(e){return function(){return t[e].apply(t,arguments)}}(n));for(var a=0;a-1))throw new M(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(C.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(C.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),C.prototype._write=function(t,e,r){r(new m("_write()"))},C.prototype._writev=null,C.prototype.end=function(t,e,r){var n=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,e,r){e.ending=!0,R(t,e),r&&(e.finished?i.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r),this},Object.defineProperty(C.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(C.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),C.prototype.destroy=l.destroy,C.prototype._undestroy=l.undestroy,C.prototype._destroy=function(t,e){e(t)}}).call(this,r(6),r(5))},function(t,e,r){"use strict";t.exports=f;var i=r(26).codes,n=i.ERR_METHOD_NOT_IMPLEMENTED,a=i.ERR_MULTIPLE_CALLBACK,o=i.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=i.ERR_TRANSFORM_WITH_LENGTH_0,h=r(27);function u(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new a);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length>8,o=255&n;a?r.push(a,o):r.push(o)}return r},i.zero2=n,i.toHex=a,i.encode=function(t,e){return"hex"===e?a(t):t}},function(t,e,r){"use strict";var i=e;i.base=r(42),i.short=r(224),i.mont=r(225),i.edwards=r(226)},function(t,e,r){"use strict";var i=r(11).rotr32;function n(t,e,r){return t&e^~t&r}function a(t,e,r){return t&e^t&r^e&r}function o(t,e,r){return t^e^r}e.ft_1=function(t,e,r,i){return 0===t?n(e,r,i):1===t||3===t?o(e,r,i):2===t?a(e,r,i):void 0},e.ch32=n,e.maj32=a,e.p32=o,e.s0_256=function(t){return i(t,2)^i(t,13)^i(t,22)},e.s1_256=function(t){return i(t,6)^i(t,11)^i(t,25)},e.g0_256=function(t){return i(t,7)^i(t,18)^t>>>3},e.g1_256=function(t){return i(t,17)^i(t,19)^t>>>10}},function(t,e,r){"use strict";var i=r(11),n=r(33),a=r(131),o=r(7),s=i.sum32,h=i.sum32_4,u=i.sum32_5,f=a.ch32,l=a.maj32,c=a.s0_256,d=a.s1_256,p=a.g0_256,m=a.g1_256,g=n.BlockHash,y=[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 v(){if(!(this instanceof v))return new v;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=y,this.W=new Array(64)}i.inherits(v,g),t.exports=v,v.blockSize=512,v.outSize=256,v.hmacStrength=192,v.padLength=64,v.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function h(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return n}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=h(t,e,i)<=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?""};var f=["","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],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,s=67108863&o,h=o/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(o=(n=0|t.words[p])*(a=0|e.words[d])+l)/67108864|0,l=67108863&o}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?f[6-h.length]+h+r:h+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=l[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[u-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var o,s,h="le"===e,u=new t(a),f=this.clone();if(h){for(s=0;!f.isZero();s++)o=f.andln(255),f.iushrn(8),u[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,g=0|o[2],y=8191&g,v=g>>>13,b=0|o[3],w=8191&b,M=b>>>13,_=0|o[4],S=8191&_,E=_>>>13,C=0|o[5],A=8191&C,T=C>>>13,B=0|o[6],I=8191&B,k=B>>>13,R=0|o[7],N=8191&R,L=R>>>13,x=0|o[8],P=8191&x,D=x>>>13,U=0|o[9],O=8191&U,j=U>>>13,K=0|s[0],V=8191&K,q=K>>>13,F=0|s[1],H=8191&F,z=F>>>13,G=0|s[2],W=8191&G,Z=G>>>13,Y=0|s[3],Q=8191&Y,X=Y>>>13,J=0|s[4],$=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],at=8191&nt,ot=nt>>>13,st=0|s[7],ht=8191&st,ut=st>>>13,ft=0|s[8],lt=8191&ft,ct=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,q))+Math.imul(c,V)|0))<<13)|0;u=((a=Math.imul(c,q))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,V),n=(n=Math.imul(p,q))+Math.imul(m,V)|0,a=Math.imul(m,q);var yt=(u+(i=i+Math.imul(l,H)|0)|0)+((8191&(n=(n=n+Math.imul(l,z)|0)+Math.imul(c,H)|0))<<13)|0;u=((a=a+Math.imul(c,z)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,V),n=(n=Math.imul(y,q))+Math.imul(v,V)|0,a=Math.imul(v,q),i=i+Math.imul(p,H)|0,n=(n=n+Math.imul(p,z)|0)+Math.imul(m,H)|0,a=a+Math.imul(m,z)|0;var vt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,W)|0))<<13)|0;u=((a=a+Math.imul(c,Z)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(w,V),n=(n=Math.imul(w,q))+Math.imul(M,V)|0,a=Math.imul(M,q),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,z)|0)+Math.imul(v,H)|0,a=a+Math.imul(v,z)|0,i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,W)|0,a=a+Math.imul(m,Z)|0;var bt=(u+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,X)|0)+Math.imul(c,Q)|0))<<13)|0;u=((a=a+Math.imul(c,X)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(S,V),n=(n=Math.imul(S,q))+Math.imul(E,V)|0,a=Math.imul(E,q),i=i+Math.imul(w,H)|0,n=(n=n+Math.imul(w,z)|0)+Math.imul(M,H)|0,a=a+Math.imul(M,z)|0,i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(v,W)|0,a=a+Math.imul(v,Z)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,X)|0;var wt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,$)|0))<<13)|0;u=((a=a+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,V),n=(n=Math.imul(A,q))+Math.imul(T,V)|0,a=Math.imul(T,q),i=i+Math.imul(S,H)|0,n=(n=n+Math.imul(S,z)|0)+Math.imul(E,H)|0,a=a+Math.imul(E,z)|0,i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(M,W)|0,a=a+Math.imul(M,Z)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,X)|0)+Math.imul(v,Q)|0,a=a+Math.imul(v,X)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,$)|0,a=a+Math.imul(m,tt)|0;var Mt=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((a=a+Math.imul(c,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,V),n=(n=Math.imul(I,q))+Math.imul(k,V)|0,a=Math.imul(k,q),i=i+Math.imul(A,H)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(T,H)|0,a=a+Math.imul(T,z)|0,i=i+Math.imul(S,W)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(E,W)|0,a=a+Math.imul(E,Z)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,X)|0)+Math.imul(M,Q)|0,a=a+Math.imul(M,X)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,$)|0,a=a+Math.imul(v,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,it)|0;var _t=(u+(i=i+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,ot)|0)+Math.imul(c,at)|0))<<13)|0;u=((a=a+Math.imul(c,ot)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(N,V),n=(n=Math.imul(N,q))+Math.imul(L,V)|0,a=Math.imul(L,q),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,z)|0)+Math.imul(k,H)|0,a=a+Math.imul(k,z)|0,i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,Z)|0)+Math.imul(T,W)|0,a=a+Math.imul(T,Z)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(E,Q)|0,a=a+Math.imul(E,X)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(M,$)|0,a=a+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,a=a+Math.imul(v,it)|0,i=i+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var St=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((a=a+Math.imul(c,ut)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(P,V),n=(n=Math.imul(P,q))+Math.imul(D,V)|0,a=Math.imul(D,q),i=i+Math.imul(N,H)|0,n=(n=n+Math.imul(N,z)|0)+Math.imul(L,H)|0,a=a+Math.imul(L,z)|0,i=i+Math.imul(I,W)|0,n=(n=n+Math.imul(I,Z)|0)+Math.imul(k,W)|0,a=a+Math.imul(k,Z)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,X)|0)+Math.imul(T,Q)|0,a=a+Math.imul(T,X)|0,i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(E,$)|0,a=a+Math.imul(E,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(M,rt)|0,a=a+Math.imul(M,it)|0,i=i+Math.imul(y,at)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(v,at)|0,a=a+Math.imul(v,ot)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,a=a+Math.imul(m,ut)|0;var Et=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((a=a+Math.imul(c,ct)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(O,V),n=(n=Math.imul(O,q))+Math.imul(j,V)|0,a=Math.imul(j,q),i=i+Math.imul(P,H)|0,n=(n=n+Math.imul(P,z)|0)+Math.imul(D,H)|0,a=a+Math.imul(D,z)|0,i=i+Math.imul(N,W)|0,n=(n=n+Math.imul(N,Z)|0)+Math.imul(L,W)|0,a=a+Math.imul(L,Z)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,X)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,X)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(T,$)|0,a=a+Math.imul(T,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(E,rt)|0,a=a+Math.imul(E,it)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(M,at)|0,a=a+Math.imul(M,ot)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,a=a+Math.imul(v,ut)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,a=a+Math.imul(m,ct)|0;var Ct=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((a=a+Math.imul(c,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(O,H),n=(n=Math.imul(O,z))+Math.imul(j,H)|0,a=Math.imul(j,z),i=i+Math.imul(P,W)|0,n=(n=n+Math.imul(P,Z)|0)+Math.imul(D,W)|0,a=a+Math.imul(D,Z)|0,i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,X)|0)+Math.imul(L,Q)|0,a=a+Math.imul(L,X)|0,i=i+Math.imul(I,$)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(k,$)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(T,rt)|0,a=a+Math.imul(T,it)|0,i=i+Math.imul(S,at)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(E,at)|0,a=a+Math.imul(E,ot)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(M,ht)|0,a=a+Math.imul(M,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(v,lt)|0,a=a+Math.imul(v,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((a=a+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(O,W),n=(n=Math.imul(O,Z))+Math.imul(j,W)|0,a=Math.imul(j,Z),i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,X)|0)+Math.imul(D,Q)|0,a=a+Math.imul(D,X)|0,i=i+Math.imul(N,$)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(L,$)|0,a=a+Math.imul(L,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(T,at)|0,a=a+Math.imul(T,ot)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(E,ht)|0,a=a+Math.imul(E,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(M,lt)|0,a=a+Math.imul(M,ct)|0;var Tt=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;u=((a=a+Math.imul(v,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(O,Q),n=(n=Math.imul(O,X))+Math.imul(j,Q)|0,a=Math.imul(j,X),i=i+Math.imul(P,$)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(D,$)|0,a=a+Math.imul(D,tt)|0,i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(L,rt)|0,a=a+Math.imul(L,it)|0,i=i+Math.imul(I,at)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(T,ht)|0,a=a+Math.imul(T,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(E,lt)|0,a=a+Math.imul(E,ct)|0;var Bt=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;u=((a=a+Math.imul(M,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(O,$),n=(n=Math.imul(O,tt))+Math.imul(j,$)|0,a=Math.imul(j,tt),i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(D,rt)|0,a=a+Math.imul(D,it)|0,i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(L,at)|0,a=a+Math.imul(L,ot)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(k,ht)|0,a=a+Math.imul(k,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(T,lt)|0,a=a+Math.imul(T,ct)|0;var It=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((a=a+Math.imul(E,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(O,rt),n=(n=Math.imul(O,it))+Math.imul(j,rt)|0,a=Math.imul(j,it),i=i+Math.imul(P,at)|0,n=(n=n+Math.imul(P,ot)|0)+Math.imul(D,at)|0,a=a+Math.imul(D,ot)|0,i=i+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,ut)|0)+Math.imul(L,ht)|0,a=a+Math.imul(L,ut)|0,i=i+Math.imul(I,lt)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(k,lt)|0,a=a+Math.imul(k,ct)|0;var kt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(T,pt)|0))<<13)|0;u=((a=a+Math.imul(T,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(O,at),n=(n=Math.imul(O,ot))+Math.imul(j,at)|0,a=Math.imul(j,ot),i=i+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,ut)|0)+Math.imul(D,ht)|0,a=a+Math.imul(D,ut)|0,i=i+Math.imul(N,lt)|0,n=(n=n+Math.imul(N,ct)|0)+Math.imul(L,lt)|0,a=a+Math.imul(L,ct)|0;var Rt=(u+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((a=a+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(O,ht),n=(n=Math.imul(O,ut))+Math.imul(j,ht)|0,a=Math.imul(j,ut),i=i+Math.imul(P,lt)|0,n=(n=n+Math.imul(P,ct)|0)+Math.imul(D,lt)|0,a=a+Math.imul(D,ct)|0;var Nt=(u+(i=i+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((a=a+Math.imul(L,mt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(O,lt),n=(n=Math.imul(O,ct))+Math.imul(j,lt)|0,a=Math.imul(j,ct);var Lt=(u+(i=i+Math.imul(P,pt)|0)|0)+((8191&(n=(n=n+Math.imul(P,mt)|0)+Math.imul(D,pt)|0))<<13)|0;u=((a=a+Math.imul(D,mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863;var xt=(u+(i=Math.imul(O,pt))|0)+((8191&(n=(n=Math.imul(O,mt))+Math.imul(j,pt)|0))<<13)|0;return u=((a=Math.imul(j,mt))+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=bt,h[4]=wt,h[5]=Mt,h[6]=_t,h[7]=St,h[8]=Et,h[9]=Ct,h[10]=At,h[11]=Tt,h[12]=Bt,h[13]=It,h[14]=kt,h[15]=Rt,h[16]=Nt,h[17]=Lt,h[18]=xt,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,t,e):m(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,u=0;u=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-a|l>>>a,f=l&s}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(h/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,h=i.length-n.length;if("mod"!==e){(s=new a(null)).length=h+1,s.words=new Array(s.length);for(var u=0;u=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/o|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);s&&(s.words[l]=c)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},a.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),h=new a(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(l)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||h.isOdd())&&(s.iadd(f),h.isub(l)),s.iushrn(1),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(h)):(r.isub(e),s.isub(n),h.isub(o))}return{a:s,b:h,gcd:r.iushln(u)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),h=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;0==(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(h),o.iushrn(1);for(var l=0,c=1;0==(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new S(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(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 t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},n(b,v),b.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return y[t]=e,e},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),h=s.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,g=0;0!==m.cmp(s);g++)m=m.redSqr();i(g=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==o?(o<<=1,o|=l,(4===++s||0===i&&0===f)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}h=26}return n},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new E(t)},n(E,S),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(20)(t))},function(t,e,r){"use strict";const i=e;i.der=r(137),i.pem=r(244)},function(t,e,r){"use strict";const i=r(0),n=r(71).Buffer,a=r(72),o=r(74);function s(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new h,this.tree._init(t.body)}function h(t){a.call(this,"der",t)}function u(t){return t<10?"0"+t:t}t.exports=s,s.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},i(h,a),h.prototype._encodeComposite=function(t,e,r,i){const a=function(t,e,r,i){let n;"seqof"===t?t="seq":"setof"===t&&(t="set");if(o.tagByName.hasOwnProperty(t))n=o.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return i.error("Unknown tag: "+t);n=t}if(n>=31)return i.error("Multi-octet tag encoding unsupported");e||(n|=32);return n|=o.tagClassByName[r||"universal"]<<6,n}(t,e,r,this.reporter);if(i.length<128){const t=n.alloc(2);return t[0]=a,t[1]=i.length,this._createEncoderBuffer([t,i])}let s=1;for(let t=i.length;t>=256;t>>=8)s++;const h=n.alloc(2+s);h[0]=a,h[1]=128|s;for(let t=1+s,e=i.length;e>0;t--,e>>=8)h[t]=255&e;return this._createEncoderBuffer([h,i])},h.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){const e=n.alloc(2*t.length);for(let r=0;r=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}let i=0;for(let e=0;e=128;r>>=7)i++}const a=n.alloc(i);let o=a.length-1;for(let e=t.length-1;e>=0;e--){let r=t[e];for(a[o--]=127&r;(r>>=7)>0;)a[o--]=128|127&r}return this._createEncoderBuffer(a)},h.prototype._encodeTime=function(t,e){let r;const i=new Date(t);return"gentime"===e?r=[u(i.getUTCFullYear()),u(i.getUTCMonth()+1),u(i.getUTCDate()),u(i.getUTCHours()),u(i.getUTCMinutes()),u(i.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[u(i.getUTCFullYear()%100),u(i.getUTCMonth()+1),u(i.getUTCDate()),u(i.getUTCHours()),u(i.getUTCMinutes()),u(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},h.prototype._encodeNull=function(){return this._createEncoderBuffer("")},h.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!n.isBuffer(t)){const e=t.toArray();!t.sign&&128&e[0]&&e.unshift(0),t=n.from(e)}if(n.isBuffer(t)){let e=t.length;0===t.length&&e++;const r=n.alloc(e);return t.copy(r),0===t.length&&(r[0]=0),this._createEncoderBuffer(r)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);let r=1;for(let e=t;e>=256;e>>=8)r++;const i=new Array(r);for(let e=i.length-1;e>=0;e--)i[e]=255&t,t>>=8;return 128&i[0]&&i.unshift(0),this._createEncoderBuffer(n.from(i))},h.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},h.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},h.prototype._skipDefault=function(t,e,r){const i=this._baseState;let n;if(null===i.default)return!1;const a=t.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,e,r).join()),a.length!==i.defaultBuffer.length)return!1;for(n=0;n>6],n=0==(32&r);if(31==(31&r)){let i=r;for(r=0;128==(128&i);){if(i=t.readUInt8(e),t.isError(i))return i;r<<=7,r|=127&i}}else r&=31;return{cls:i,primitive:n,tag:r,tagStr:s.tag[r]}}function l(t,e,r){let i=t.readUInt8(r);if(t.isError(i))return i;if(!e&&128===i)return null;if(0==(128&i))return i;const n=127&i;if(n>4)return t.error("length octect is too long");i=0;for(let e=0;e0?o-4:o;for(r=0;r>16&255,h[f++]=e>>8&255,h[f++]=255&e;2===s&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,h[f++]=255&e);1===s&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,h[f++]=e>>8&255,h[f++]=255&e);return h},e.fromByteArray=function(t){for(var e,r=t.length,n=r%3,a=[],o=0,s=r-n;os?s:o+16383));1===n?(e=t[r-1],a.push(i[e>>2]+i[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],a.push(i[e>>10]+i[e>>4&63]+i[e<<2&63]+"="));return a.join("")};for(var i=[],n=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,h=o.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function f(t,e,r){for(var n,a,o=[],s=e;s>18&63]+i[a>>12&63]+i[a>>6&63]+i[63&a]);return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},function(t,e){ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ e.read=function(t,e,r,i,n){var a,o,s=8*n-i-1,h=(1<>1,f=-7,l=r?n-1:0,c=r?-1:1,d=t[e+l];for(l+=c,a=d&(1<<-f)-1,d>>=-f,f+=s;f>0;a=256*a+t[e+l],l+=c,f-=8);for(o=a&(1<<-f)-1,a>>=-f,f+=i;f>0;o=256*o+t[e+l],l+=c,f-=8);if(0===a)a=1-u;else{if(a===h)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,i),a-=u}return(d?-1:1)*o*Math.pow(2,a-i)},e.write=function(t,e,r,i,n,a){var o,s,h,u=8*a-n-1,f=(1<>1,c=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:a-1,p=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-o))<1&&(o--,h*=2),(e+=o+l>=1?c/h:c*Math.pow(2,1-l))*h>=2&&(o++,h/=2),o+l>=f?(s=0,o=f):o+l>=1?(s=(e*h-1)*Math.pow(2,n),o+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,n),o=0));n>=8;t[r+d]=255&s,d+=p,s/=256,n-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*m}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){(function(e){var r={};t.exports=r;var i={};r.encode=function(t,e,r){if("string"!=typeof e)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!=typeof r)throw new TypeError('"maxline" must be a number.');var i="";if(t instanceof Uint8Array){var n=0,a=e.length,o=e.charAt(0),s=[0];for(n=0;n0;)s.push(u%a),u=u/a|0}for(n=0;0===t[n]&&n=0;--n)i+=e[s[n]]}else i=function(t,e){var r=0,i=e.length,n=e.charAt(0),a=[0];for(r=0;r0;)a.push(s%i),s=s/i|0}var h="";for(r=0;0===t.at(r)&&r=0;--r)h+=e[a[r]];return h}(t,e);if(r){var f=new RegExp(".{1,"+r+"}","g");i=i.match(f).join("\r\n")}return i},r.decode=function(t,r){if("string"!=typeof t)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=i[r];if(!n){n=i[r]=[];for(var a=0;a>=8;for(;l>0;)h.push(255&l),l>>=8}for(var c=0;t[c]===s&&c=n.Versions.TLS_1_1.minor&&h.output.putBytes(r),h.update(t.fragment),h.finish(s)&&(t.fragment=h.output,t.length=t.fragment.length(),a=!0),a}function s(t,e,r){if(!r){var i=t-e.length()%t;e.fillWithByte(i-1,i)}return!0}function h(t,e,r){var i=!0;if(r){for(var n=e.length(),a=e.last(),o=n-1-a;o=s?(t.fragment=o.output.getBytes(f-s),u=o.output.getBytes(s)):t.fragment=o.output.getBytes(),t.fragment=i.util.createBuffer(t.fragment),t.length=t.fragment.length();var l=e.macFunction(e.macKey,e.sequenceNumber,t);return e.updateSequenceNumber(),a=function(t,e,r){var n=i.hmac.create();return n.start("SHA1",t),n.update(e),e=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),e===r}(e.macKey,u,l)&&a}n.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(t){t.bulk_cipher_algorithm=n.BulkCipherAlgorithm.aes,t.cipher_type=n.CipherType.block,t.enc_key_length=16,t.block_length=16,t.fixed_iv_length=16,t.record_iv_length=16,t.mac_algorithm=n.MACAlgorithm.hmac_sha1,t.mac_length=20,t.mac_key_length=20},initConnectionState:a},n.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(t){t.bulk_cipher_algorithm=n.BulkCipherAlgorithm.aes,t.cipher_type=n.CipherType.block,t.enc_key_length=32,t.block_length=16,t.fixed_iv_length=16,t.record_iv_length=16,t.mac_algorithm=n.MACAlgorithm.hmac_sha1,t.mac_length=20,t.mac_key_length=20},initConnectionState:a}},function(t,e,r){var i=r(1);r(89),t.exports=i.mgf=i.mgf||{},i.mgf.mgf1=i.mgf1},function(t,e,r){(function(e){var i=r(1);r(37),r(9),r(90),r(3);var n=r(154),a=n.publicKeyValidator,o=n.privateKeyValidator;if(void 0===s)var s=i.jsbn.BigInteger;var h=i.util.ByteBuffer,u=void 0===e?Uint8Array:e;i.pki=i.pki||{},t.exports=i.pki.ed25519=i.ed25519=i.ed25519||{};var f=i.ed25519;function l(t){var r=t.message;if(r instanceof Uint8Array||r instanceof u)return r;var i=t.encoding;if(void 0===r){if(!t.md)throw new TypeError('"options.message" or "options.md" not specified.');r=t.md.digest().getBytes(),i="binary"}if("string"==typeof r&&!i)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof r){if(void 0!==e)return e.from(r,i);r=new h(r,i)}else if(!(r instanceof h))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var n=new u(r.length()),a=0;a=0;--r)O(i,i),1!==r&&j(i,i,e);for(r=0;r<16;++r)t[r]=i[r]}(r,r),j(r,r,n),j(r,r,a),j(r,r,a),j(t[0],r,a),O(i,t[0]),j(i,i,a),T(i,n)&&j(t[0],t[0],b);if(O(i,t[0]),j(i,i,a),T(i,n))return-1;I(t[0])===e[31]>>7&&U(t[0],c,t[0]);return j(t[3],t[0],t[1]),0}(s,i))return-1;for(n=0;n=0};var c=P(),d=P([1]),p=P([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),m=P([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),g=P([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),y=P([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=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]),b=P([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(t,r){var n=i.md.sha512.create(),a=new h(t);n.update(a.getBytes(r),"binary");var o=n.digest().getBytes();if(void 0!==e)return e.from(o,"binary");for(var s=new u(f.constants.HASH_BYTE_LENGTH),l=0;l<64;++l)s[l]=o.charCodeAt(l);return s}function M(t,e){var r,i,n,a;for(i=63;i>=32;--i){for(r=0,n=i-32,a=i-12;n>8,e[n]-=256*r;e[n]+=r,e[i]=0}for(r=0,n=0;n<32;++n)e[n]+=r-(e[31]>>4)*v[n],r=e[n]>>8,e[n]&=255;for(n=0;n<32;++n)e[n]-=r*v[n];for(i=0;i<32;++i)e[i+1]+=e[i]>>8,t[i]=255&e[i]}function _(t){for(var e=new Float64Array(64),r=0;r<64;++r)e[r]=t[r],t[r]=0;M(t,e)}function S(t,e){var r=P(),i=P(),n=P(),a=P(),o=P(),s=P(),h=P(),u=P(),f=P();U(r,t[1],t[0]),U(f,e[1],e[0]),j(r,r,f),D(i,t[0],t[1]),D(f,e[0],e[1]),j(i,i,f),j(n,t[3],e[3]),j(n,n,m),j(a,t[2],e[2]),D(a,a,a),U(o,i,r),U(s,a,n),D(h,a,n),D(u,i,r),j(t[0],o,s),j(t[1],u,h),j(t[2],h,s),j(t[3],o,u)}function E(t,e,r){for(var i=0;i<4;++i)x(t[i],e[i],r)}function C(t,e){var r=P(),i=P(),n=P();!function(t,e){var r,i=P();for(r=0;r<16;++r)i[r]=e[r];for(r=253;r>=0;--r)O(i,i),2!==r&&4!==r&&j(i,i,e);for(r=0;r<16;++r)t[r]=i[r]}(n,e[2]),j(r,e[0],n),j(i,e[1],n),A(t,i),t[31]^=I(r)<<7}function A(t,e){var r,i,n,a=P(),o=P();for(r=0;r<16;++r)o[r]=e[r];for(L(o),L(o),L(o),i=0;i<2;++i){for(a[0]=o[0]-65517,r=1;r<15;++r)a[r]=o[r]-65535-(a[r-1]>>16&1),a[r-1]&=65535;a[15]=o[15]-32767-(a[14]>>16&1),n=a[15]>>16&1,a[14]&=65535,x(o,a,1-n)}for(r=0;r<16;r++)t[2*r]=255&o[r],t[2*r+1]=o[r]>>8}function T(t,e){var r=new u(32),i=new u(32);return A(r,t),A(i,e),B(r,0,i,0)}function B(t,e,r,i){return function(t,e,r,i,n){var a,o=0;for(a=0;a>>8)-1}(t,e,r,i,32)}function I(t){var e=new u(32);return A(e,t),1&e[0]}function k(t,e,r){var i,n;for(N(t[0],c),N(t[1],d),N(t[2],d),N(t[3],c),n=255;n>=0;--n)E(t,e,i=r[n/8|0]>>(7&n)&1),S(e,t),S(t,t),E(t,e,i)}function R(t,e){var r=[P(),P(),P(),P()];N(r[0],g),N(r[1],y),N(r[2],d),j(r[3],g,y),k(t,r,e)}function N(t,e){var r;for(r=0;r<16;r++)t[r]=0|e[r]}function L(t){var e,r,i=1;for(e=0;e<16;++e)r=t[e]+i+65535,i=Math.floor(r/65536),t[e]=r-65536*i;t[0]+=i-1+37*(i-1)}function x(t,e,r){for(var i,n=~(r-1),a=0;a<16;++a)i=n&(t[a]^e[a]),t[a]^=i,e[a]^=i}function P(t){var e,r=new Float64Array(16);if(t)for(e=0;e0&&(o=i.util.fillString(String.fromCharCode(0),h)+o),{encapsulation:e.encrypt(o,"NONE"),key:t.generate(o,a)}},decrypt:function(e,r,i){var n=e.decrypt(r,"NONE");return t.generate(n,i)}};return a},i.kem.kdf1=function(t,e){a(this,t,0,e||t.digestLength)},i.kem.kdf2=function(t,e){a(this,t,1,e||t.digestLength)}},function(t,e,r){var i=r(1);r(3),t.exports=i.log=i.log||{},i.log.levels=["none","error","warning","info","debug","verbose","max"];var n={},a=[],o=null;i.log.LEVEL_LOCKED=2,i.log.NO_LEVEL_CHECK=4,i.log.INTERPOLATE=8;for(var s=0;s0){for(var r=n.create(n.Class.CONTEXT_SPECIFIC,1,!0,[]),a=0;a=r&&o0&&o.value[0].value.push(n.create(n.Class.CONTEXT_SPECIFIC,0,!0,e)),a.length>0&&o.value[0].value.push(n.create(n.Class.CONTEXT_SPECIFIC,1,!0,a)),o.value[0].value.push(n.create(n.Class.UNIVERSAL,n.Type.SET,!0,t.signerInfos)),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(t.type).getBytes()),o])},addSigner:function(e){var r=e.issuer,n=e.serialNumber;if(e.certificate){var a=e.certificate;"string"==typeof a&&(a=i.pki.certificateFromPem(a)),r=a.issuer.attributes,n=a.serialNumber}var o=e.key;if(!o)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof o&&(o=i.pki.privateKeyFromPem(o));var s=e.digestAlgorithm||i.pki.oids.sha1;switch(s){case i.pki.oids.sha1:case i.pki.oids.sha256:case i.pki.oids.sha384:case i.pki.oids.sha512:case i.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+s)}var h=e.authenticatedAttributes||[];if(h.length>0){for(var u=!1,f=!1,l=0;l="8"&&(r="00"+r);var n=i.util.hexToBytes(r);t.putInt32(n.length),t.putBytes(n)}function o(t,e){t.putInt32(e.length),t.putString(e)}function s(){for(var t=i.md.sha1.create(),e=arguments.length,r=0;r0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return o.alloc(0);for(var e,r,i,n=o.allocUnsafe(t>>>0),a=this.head,s=0;a;)e=a.data,r=n,i=s,o.prototype.copy.call(e,r,i),s+=a.data.length,a=a.next;return n}},{key:"consume",value:function(t,e){var r;return tn.length?n.length:t;if(a===n.length?i+=n:i+=n.slice(0,t),0==(t-=a)){a===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(a));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=o.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,a=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,a),0==(t-=a)){a===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(a));break}++i}return this.length-=i,e}},{key:h,value:function(t,e){return s(this,function(t){for(var e=1;e0,(function(t){i||(i=t),t&&o.forEach(u),a||(o.forEach(u),n(i))}))}));return e.reduce(f)}},function(t,e,r){var i=r(0),n=r(25),a=r(2).Buffer,o=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function h(){this.init(),this._w=s,n.call(this,64,56)}function u(t){return t<<30|t>>>2}function f(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}i(h,n),h.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},h.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,a=0|this._c,s=0|this._d,h=0|this._e,l=0;l<16;++l)r[l]=t.readInt32BE(4*l);for(;l<80;++l)r[l]=r[l-3]^r[l-8]^r[l-14]^r[l-16];for(var c=0;c<80;++c){var d=~~(c/20),p=0|((e=i)<<5|e>>>27)+f(d,n,a,s)+h+r[c]+o[d];h=s,s=a,a=u(n),n=i,i=p}this._a=i+this._a|0,this._b=n+this._b|0,this._c=a+this._c|0,this._d=s+this._d|0,this._e=h+this._e|0},h.prototype._hash=function(){var t=a.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=h},function(t,e,r){var i=r(0),n=r(25),a=r(2).Buffer,o=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function h(){this.init(),this._w=s,n.call(this,64,56)}function u(t){return t<<5|t>>>27}function f(t){return t<<30|t>>>2}function l(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}i(h,n),h.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},h.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,a=0|this._c,s=0|this._d,h=0|this._e,c=0;c<16;++c)r[c]=t.readInt32BE(4*c);for(;c<80;++c)r[c]=(e=r[c-3]^r[c-8]^r[c-14]^r[c-16])<<1|e>>>31;for(var d=0;d<80;++d){var p=~~(d/20),m=u(i)+l(p,n,a,s)+h+r[d]+o[p]|0;h=s,s=a,a=f(n),n=i,i=m}this._a=i+this._a|0,this._b=n+this._b|0,this._c=a+this._c|0,this._d=s+this._d|0,this._e=h+this._e|0},h.prototype._hash=function(){var t=a.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=h},function(t,e,r){var i=r(0),n=r(99),a=r(25),o=r(2).Buffer,s=new Array(64);function h(){this.init(),this._w=s,a.call(this,64,56)}i(h,n),h.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},h.prototype._hash=function(){var t=o.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=h},function(t,e,r){var i=r(0),n=r(100),a=r(25),o=r(2).Buffer,s=new Array(160);function h(){this.init(),this._w=s,a.call(this,128,112)}i(h,n),h.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},h.prototype._hash=function(){var t=o.allocUnsafe(48);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},t.exports=h},function(t,e,r){t.exports=n;var i=r(17).EventEmitter;function n(){i.call(this)}r(0)(n,i),n.Readable=r(58),n.Writable=r(182),n.Duplex=r(183),n.Transform=r(184),n.PassThrough=r(185),n.Stream=n,n.prototype.pipe=function(t,e){var r=this;function n(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function a(){r.readable&&r.resume&&r.resume()}r.on("data",n),t.on("drain",a),t._isStdio||e&&!1===e.end||(r.on("end",s),r.on("close",h));var o=!1;function s(){o||(o=!0,t.end())}function h(){o||(o=!0,"function"==typeof t.destroy&&t.destroy())}function u(t){if(f(),0===i.listenerCount(this,"error"))throw t}function f(){r.removeListener("data",n),t.removeListener("drain",a),r.removeListener("end",s),r.removeListener("close",h),r.removeListener("error",u),t.removeListener("error",u),r.removeListener("end",f),r.removeListener("close",f),t.removeListener("close",f)}return r.on("error",u),t.on("error",u),r.on("end",f),r.on("close",f),t.on("close",f),t.emit("pipe",r),t}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e){},function(t,e,r){"use strict";var i=r(59).Buffer,n=r(180);t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var e,r,n,a=i.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,r=a,n=s,e.copy(r,n),s+=o.data.length,o=o.next;return a},t}(),n&&n.inspect&&n.inspect.custom&&(t.exports.prototype[n.inspect.custom]=function(){var t=n.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e){},function(t,e,r){"use strict";t.exports=a;var i=r(104),n=Object.create(r(31));function a(t){if(!(this instanceof a))return new a(t);i.call(this,t)}n.inherits=r(0),n.inherits(a,i),a.prototype._transform=function(t,e,r){r(null,t)}},function(t,e,r){t.exports=r(60)},function(t,e,r){t.exports=r(19)},function(t,e,r){t.exports=r(58).Transform},function(t,e,r){t.exports=r(58).PassThrough},function(t,e,r){"use strict";var i=r(0),n=r(2).Buffer,a=r(14),o=n.alloc(128);function s(t,e){a.call(this,"digest"),"string"==typeof e&&(e=n.from(e)),this._alg=t,this._key=e,e.length>64?e=t(e):e.length<64&&(e=n.concat([e,o],64));for(var r=this._ipad=n.allocUnsafe(64),i=this._opad=n.allocUnsafe(64),s=0;s<64;s++)r[s]=54^e[s],i[s]=92^e[s];this._hash=[r]}i(s,a),s.prototype._update=function(t){this._hash.push(t)},s.prototype._final=function(){var t=this._alg(n.concat(this._hash));return this._alg(n.concat([this._opad,t]))},t.exports=s},function(t,e,r){t.exports=r(107)},function(t,e,r){(function(e){var i,n,a=r(2).Buffer,o=r(109),s=r(110),h=r(111),u=r(112),f=e.crypto&&e.crypto.subtle,l={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"},c=[];function d(){return n||(n=e.process&&e.process.nextTick?e.process.nextTick:e.queueMicrotask?e.queueMicrotask:e.setImmediate?e.setImmediate:e.setTimeout)}function p(t,e,r,i,n){return f.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then((function(t){return f.deriveBits({name:"PBKDF2",salt:e,iterations:r,hash:{name:n}},t,i<<3)})).then((function(t){return a.from(t)}))}t.exports=function(t,r,n,m,g,y){"function"==typeof g&&(y=g,g=void 0);var v=l[(g=g||"sha1").toLowerCase()];if(v&&"function"==typeof e.Promise){if(o(n,m),t=u(t,s,"Password"),r=u(r,s,"Salt"),"function"!=typeof y)throw new Error("No callback provided to pbkdf2");!function(t,e){t.then((function(t){d()((function(){e(null,t)}))}),(function(t){d()((function(){e(t)}))}))}(function(t){if(e.process&&!e.process.browser)return Promise.resolve(!1);if(!f||!f.importKey||!f.deriveBits)return Promise.resolve(!1);if(void 0!==c[t])return c[t];var r=p(i=i||a.alloc(8),i,10,128,t).then((function(){return!0})).catch((function(){return!1}));return c[t]=r,r}(v).then((function(e){return e?p(t,r,n,m,v):h(t,r,n,m,g)})),y)}else d()((function(){var e;try{e=h(t,r,n,m,g)}catch(t){return y(t)}y(null,e)}))}}).call(this,r(6))},function(t,e,r){var i=r(190),n=r(62),a=r(63),o=r(203),s=r(41);function h(t,e,r){if(t=t.toLowerCase(),a[t])return n.createCipheriv(t,e,r);if(o[t])return new i({key:e,iv:r,mode:t});throw new TypeError("invalid suite type")}function u(t,e,r){if(t=t.toLowerCase(),a[t])return n.createDecipheriv(t,e,r);if(o[t])return new i({key:e,iv:r,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}e.createCipher=e.Cipher=function(t,e){var r,i;if(t=t.toLowerCase(),a[t])r=a[t].key,i=a[t].iv;else{if(!o[t])throw new TypeError("invalid suite type");r=8*o[t].key,i=o[t].iv}var n=s(e,!1,r,i);return h(t,n.key,n.iv)},e.createCipheriv=e.Cipheriv=h,e.createDecipher=e.Decipher=function(t,e){var r,i;if(t=t.toLowerCase(),a[t])r=a[t].key,i=a[t].iv;else{if(!o[t])throw new TypeError("invalid suite type");r=8*o[t].key,i=o[t].iv}var n=s(e,!1,r,i);return u(t,n.key,n.iv)},e.createDecipheriv=e.Decipheriv=u,e.listCiphers=e.getCiphers=function(){return Object.keys(o).concat(n.getCiphers())}},function(t,e,r){var i=r(14),n=r(191),a=r(0),o=r(2).Buffer,s={"des-ede3-cbc":n.CBC.instantiate(n.EDE),"des-ede3":n.EDE,"des-ede-cbc":n.CBC.instantiate(n.EDE),"des-ede":n.EDE,"des-cbc":n.CBC.instantiate(n.DES),"des-ecb":n.DES};function h(t){i.call(this);var e,r=t.mode.toLowerCase(),n=s[r];e=t.decrypt?"decrypt":"encrypt";var a=t.key;o.isBuffer(a)||(a=o.from(a)),"des-ede"!==r&&"des-ede-cbc"!==r||(a=o.concat([a,a.slice(0,8)]));var h=t.iv;o.isBuffer(h)||(h=o.from(h)),this._des=n.create({key:a,iv:h,type:e})}s.des=s["des-cbc"],s.des3=s["des-ede3-cbc"],t.exports=h,a(h,i),h.prototype._update=function(t){return o.from(this._des.update(t))},h.prototype._final=function(){return o.from(this._des.final())}},function(t,e,r){"use strict";e.utils=r(113),e.Cipher=r(61),e.DES=r(114),e.CBC=r(192),e.EDE=r(193)},function(t,e,r){"use strict";var i=r(7),n=r(0),a={};function o(t){i.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var e=0;e15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},c.prototype.flush=function(){for(var t=16-this.cache.length,e=a.allocUnsafe(t),r=-1;++r>o%8,t._prev=a(t._prev,r?i:n);return s}function a(t,e){var r=t.length,n=-1,a=i.allocUnsafe(t.length);for(t=i.concat([t,i.from([e])]);++n>7;return a}e.encrypt=function(t,e,r){for(var a=e.length,o=i.allocUnsafe(a),s=-1;++s>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function o(t){this.h=t,this.state=i.alloc(16,0),this.cache=i.allocUnsafe(0)}o.prototype.ghash=function(t){for(var e=-1;++e0;e--)i[e]=i[e]>>>1|(1&i[e-1])<<31;i[0]=i[0]>>>1,r&&(i[0]=i[0]^225<<24)}this.state=a(n)},o.prototype.update=function(t){var e;for(this.cache=i.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},o.prototype.final=function(t,e){return this.cache.length&&this.ghash(i.concat([this.cache,n],16)),this.ghash(a([0,t,0,e])),this.state},t.exports=o},function(t,e,r){var i=r(118),n=r(2).Buffer,a=r(63),o=r(119),s=r(14),h=r(40),u=r(41);function f(t,e,r){s.call(this),this._cache=new l,this._last=void 0,this._cipher=new h.AES(e),this._prev=n.from(r),this._mode=t,this._autopadding=!0}function l(){this.cache=n.allocUnsafe(0)}function c(t,e,r){var s=a[t.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=n.from(r)),"GCM"!==s.mode&&r.length!==s.iv)throw new TypeError("invalid iv length "+r.length);if("string"==typeof e&&(e=n.from(e)),e.length!==s.key/8)throw new TypeError("invalid key length "+e.length);return"stream"===s.type?new o(s.module,e,r,!0):"auth"===s.type?new i(s.module,e,r,!0):new f(s.module,e,r)}r(0)(f,s),f.prototype._update=function(t){var e,r;this._cache.add(t);for(var i=[];e=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,e),i.push(r);return n.concat(i)},f.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return function(t){var e=t[15];if(e<1||e>16)throw new Error("unable to decrypt data");var r=-1;for(;++r16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},l.prototype.flush=function(){if(this.cache.length)return this.cache},e.createDecipher=function(t,e){var r=a[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=u(e,!1,r.key,r.iv);return c(t,i.key,i.iv)},e.createDecipheriv=c},function(t,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}},function(t,e,r){(function(t){var i=r(120),n=r(209),a=r(210);var o={binary:!0,hex:!0,base64:!0};e.DiffieHellmanGroup=e.createDiffieHellmanGroup=e.getDiffieHellman=function(e){var r=new t(n[e].prime,"hex"),i=new t(n[e].gen,"hex");return new a(r,i)},e.createDiffieHellman=e.DiffieHellman=function e(r,n,s,h){return t.isBuffer(n)||void 0===o[n]?e(r,"binary",n,s):(n=n||"binary",h=h||"binary",s=s||new t([2]),t.isBuffer(s)||(s=new t(s,h)),"number"==typeof r?new a(i(r,s),s,!0):(t.isBuffer(r)||(r=new t(r,n)),new a(r,s,!0)))}}).call(this,r(4).Buffer)},function(t,e){},function(t,e,r){(function(t){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=a:e.BN=a,a.BN=a,a.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(207).Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function h(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return n}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=h(t,e,i)<=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?""};var f=["","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],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,s=67108863&o,h=o/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(o=(n=0|t.words[p])*(a=0|e.words[d])+l)/67108864|0,l=67108863&o}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?f[6-h.length]+h+r:h+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=l[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[u-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var o,s,h="le"===e,u=new t(a),f=this.clone();if(h){for(s=0;!f.isZero();s++)o=f.andln(255),f.iushrn(8),u[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,g=0|o[2],y=8191&g,v=g>>>13,b=0|o[3],w=8191&b,M=b>>>13,_=0|o[4],S=8191&_,E=_>>>13,C=0|o[5],A=8191&C,T=C>>>13,B=0|o[6],I=8191&B,k=B>>>13,R=0|o[7],N=8191&R,L=R>>>13,x=0|o[8],P=8191&x,D=x>>>13,U=0|o[9],O=8191&U,j=U>>>13,K=0|s[0],V=8191&K,q=K>>>13,F=0|s[1],H=8191&F,z=F>>>13,G=0|s[2],W=8191&G,Z=G>>>13,Y=0|s[3],Q=8191&Y,X=Y>>>13,J=0|s[4],$=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],at=8191&nt,ot=nt>>>13,st=0|s[7],ht=8191&st,ut=st>>>13,ft=0|s[8],lt=8191&ft,ct=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,q))+Math.imul(c,V)|0))<<13)|0;u=((a=Math.imul(c,q))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,V),n=(n=Math.imul(p,q))+Math.imul(m,V)|0,a=Math.imul(m,q);var yt=(u+(i=i+Math.imul(l,H)|0)|0)+((8191&(n=(n=n+Math.imul(l,z)|0)+Math.imul(c,H)|0))<<13)|0;u=((a=a+Math.imul(c,z)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,V),n=(n=Math.imul(y,q))+Math.imul(v,V)|0,a=Math.imul(v,q),i=i+Math.imul(p,H)|0,n=(n=n+Math.imul(p,z)|0)+Math.imul(m,H)|0,a=a+Math.imul(m,z)|0;var vt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,W)|0))<<13)|0;u=((a=a+Math.imul(c,Z)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(w,V),n=(n=Math.imul(w,q))+Math.imul(M,V)|0,a=Math.imul(M,q),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,z)|0)+Math.imul(v,H)|0,a=a+Math.imul(v,z)|0,i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,W)|0,a=a+Math.imul(m,Z)|0;var bt=(u+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,X)|0)+Math.imul(c,Q)|0))<<13)|0;u=((a=a+Math.imul(c,X)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(S,V),n=(n=Math.imul(S,q))+Math.imul(E,V)|0,a=Math.imul(E,q),i=i+Math.imul(w,H)|0,n=(n=n+Math.imul(w,z)|0)+Math.imul(M,H)|0,a=a+Math.imul(M,z)|0,i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(v,W)|0,a=a+Math.imul(v,Z)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,X)|0;var wt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,$)|0))<<13)|0;u=((a=a+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,V),n=(n=Math.imul(A,q))+Math.imul(T,V)|0,a=Math.imul(T,q),i=i+Math.imul(S,H)|0,n=(n=n+Math.imul(S,z)|0)+Math.imul(E,H)|0,a=a+Math.imul(E,z)|0,i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(M,W)|0,a=a+Math.imul(M,Z)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,X)|0)+Math.imul(v,Q)|0,a=a+Math.imul(v,X)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,$)|0,a=a+Math.imul(m,tt)|0;var Mt=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((a=a+Math.imul(c,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,V),n=(n=Math.imul(I,q))+Math.imul(k,V)|0,a=Math.imul(k,q),i=i+Math.imul(A,H)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(T,H)|0,a=a+Math.imul(T,z)|0,i=i+Math.imul(S,W)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(E,W)|0,a=a+Math.imul(E,Z)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,X)|0)+Math.imul(M,Q)|0,a=a+Math.imul(M,X)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,$)|0,a=a+Math.imul(v,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,it)|0;var _t=(u+(i=i+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,ot)|0)+Math.imul(c,at)|0))<<13)|0;u=((a=a+Math.imul(c,ot)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(N,V),n=(n=Math.imul(N,q))+Math.imul(L,V)|0,a=Math.imul(L,q),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,z)|0)+Math.imul(k,H)|0,a=a+Math.imul(k,z)|0,i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,Z)|0)+Math.imul(T,W)|0,a=a+Math.imul(T,Z)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(E,Q)|0,a=a+Math.imul(E,X)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(M,$)|0,a=a+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,a=a+Math.imul(v,it)|0,i=i+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var St=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((a=a+Math.imul(c,ut)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(P,V),n=(n=Math.imul(P,q))+Math.imul(D,V)|0,a=Math.imul(D,q),i=i+Math.imul(N,H)|0,n=(n=n+Math.imul(N,z)|0)+Math.imul(L,H)|0,a=a+Math.imul(L,z)|0,i=i+Math.imul(I,W)|0,n=(n=n+Math.imul(I,Z)|0)+Math.imul(k,W)|0,a=a+Math.imul(k,Z)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,X)|0)+Math.imul(T,Q)|0,a=a+Math.imul(T,X)|0,i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(E,$)|0,a=a+Math.imul(E,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(M,rt)|0,a=a+Math.imul(M,it)|0,i=i+Math.imul(y,at)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(v,at)|0,a=a+Math.imul(v,ot)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,a=a+Math.imul(m,ut)|0;var Et=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((a=a+Math.imul(c,ct)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(O,V),n=(n=Math.imul(O,q))+Math.imul(j,V)|0,a=Math.imul(j,q),i=i+Math.imul(P,H)|0,n=(n=n+Math.imul(P,z)|0)+Math.imul(D,H)|0,a=a+Math.imul(D,z)|0,i=i+Math.imul(N,W)|0,n=(n=n+Math.imul(N,Z)|0)+Math.imul(L,W)|0,a=a+Math.imul(L,Z)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,X)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,X)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(T,$)|0,a=a+Math.imul(T,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(E,rt)|0,a=a+Math.imul(E,it)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(M,at)|0,a=a+Math.imul(M,ot)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,a=a+Math.imul(v,ut)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,a=a+Math.imul(m,ct)|0;var Ct=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((a=a+Math.imul(c,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(O,H),n=(n=Math.imul(O,z))+Math.imul(j,H)|0,a=Math.imul(j,z),i=i+Math.imul(P,W)|0,n=(n=n+Math.imul(P,Z)|0)+Math.imul(D,W)|0,a=a+Math.imul(D,Z)|0,i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,X)|0)+Math.imul(L,Q)|0,a=a+Math.imul(L,X)|0,i=i+Math.imul(I,$)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(k,$)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(T,rt)|0,a=a+Math.imul(T,it)|0,i=i+Math.imul(S,at)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(E,at)|0,a=a+Math.imul(E,ot)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(M,ht)|0,a=a+Math.imul(M,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(v,lt)|0,a=a+Math.imul(v,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((a=a+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(O,W),n=(n=Math.imul(O,Z))+Math.imul(j,W)|0,a=Math.imul(j,Z),i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,X)|0)+Math.imul(D,Q)|0,a=a+Math.imul(D,X)|0,i=i+Math.imul(N,$)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(L,$)|0,a=a+Math.imul(L,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(T,at)|0,a=a+Math.imul(T,ot)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(E,ht)|0,a=a+Math.imul(E,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(M,lt)|0,a=a+Math.imul(M,ct)|0;var Tt=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;u=((a=a+Math.imul(v,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(O,Q),n=(n=Math.imul(O,X))+Math.imul(j,Q)|0,a=Math.imul(j,X),i=i+Math.imul(P,$)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(D,$)|0,a=a+Math.imul(D,tt)|0,i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(L,rt)|0,a=a+Math.imul(L,it)|0,i=i+Math.imul(I,at)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(T,ht)|0,a=a+Math.imul(T,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(E,lt)|0,a=a+Math.imul(E,ct)|0;var Bt=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;u=((a=a+Math.imul(M,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(O,$),n=(n=Math.imul(O,tt))+Math.imul(j,$)|0,a=Math.imul(j,tt),i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(D,rt)|0,a=a+Math.imul(D,it)|0,i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(L,at)|0,a=a+Math.imul(L,ot)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(k,ht)|0,a=a+Math.imul(k,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(T,lt)|0,a=a+Math.imul(T,ct)|0;var It=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((a=a+Math.imul(E,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(O,rt),n=(n=Math.imul(O,it))+Math.imul(j,rt)|0,a=Math.imul(j,it),i=i+Math.imul(P,at)|0,n=(n=n+Math.imul(P,ot)|0)+Math.imul(D,at)|0,a=a+Math.imul(D,ot)|0,i=i+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,ut)|0)+Math.imul(L,ht)|0,a=a+Math.imul(L,ut)|0,i=i+Math.imul(I,lt)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(k,lt)|0,a=a+Math.imul(k,ct)|0;var kt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(T,pt)|0))<<13)|0;u=((a=a+Math.imul(T,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(O,at),n=(n=Math.imul(O,ot))+Math.imul(j,at)|0,a=Math.imul(j,ot),i=i+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,ut)|0)+Math.imul(D,ht)|0,a=a+Math.imul(D,ut)|0,i=i+Math.imul(N,lt)|0,n=(n=n+Math.imul(N,ct)|0)+Math.imul(L,lt)|0,a=a+Math.imul(L,ct)|0;var Rt=(u+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((a=a+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(O,ht),n=(n=Math.imul(O,ut))+Math.imul(j,ht)|0,a=Math.imul(j,ut),i=i+Math.imul(P,lt)|0,n=(n=n+Math.imul(P,ct)|0)+Math.imul(D,lt)|0,a=a+Math.imul(D,ct)|0;var Nt=(u+(i=i+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((a=a+Math.imul(L,mt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(O,lt),n=(n=Math.imul(O,ct))+Math.imul(j,lt)|0,a=Math.imul(j,ct);var Lt=(u+(i=i+Math.imul(P,pt)|0)|0)+((8191&(n=(n=n+Math.imul(P,mt)|0)+Math.imul(D,pt)|0))<<13)|0;u=((a=a+Math.imul(D,mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863;var xt=(u+(i=Math.imul(O,pt))|0)+((8191&(n=(n=Math.imul(O,mt))+Math.imul(j,pt)|0))<<13)|0;return u=((a=Math.imul(j,mt))+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=bt,h[4]=wt,h[5]=Mt,h[6]=_t,h[7]=St,h[8]=Et,h[9]=Ct,h[10]=At,h[11]=Tt,h[12]=Bt,h[13]=It,h[14]=kt,h[15]=Rt,h[16]=Nt,h[17]=Lt,h[18]=xt,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,t,e):m(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,u=0;u=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-a|l>>>a,f=l&s}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(h/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,h=i.length-n.length;if("mod"!==e){(s=new a(null)).length=h+1,s.words=new Array(s.length);for(var u=0;u=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/o|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);s&&(s.words[l]=c)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},a.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),h=new a(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(l)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||h.isOdd())&&(s.iadd(f),h.isub(l)),s.iushrn(1),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(h)):(r.isub(e),s.isub(n),h.isub(o))}return{a:s,b:h,gcd:r.iushln(u)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),h=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;0==(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(h),o.iushrn(1);for(var l=0,c=1;0==(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new S(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(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 t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},n(b,v),b.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return y[t]=e,e},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),h=s.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,g=0;0!==m.cmp(s);g++)m=m.redSqr();i(g=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==o?(o<<=1,o|=l,(4===++s||0===i&&0===f)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}h=26}return n},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new E(t)},n(E,S),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(20)(t))},function(t,e){},function(t,e){},function(t){t.exports=JSON.parse('{"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}')},function(t,e,r){(function(e){var i=r(121),n=new(r(122)),a=new i(24),o=new i(11),s=new i(10),h=new i(3),u=new i(7),f=r(120),l=r(22);function c(t,r){return r=r||"utf8",e.isBuffer(t)||(t=new e(t,r)),this._pub=new i(t),this}function d(t,r){return r=r||"utf8",e.isBuffer(t)||(t=new e(t,r)),this._priv=new i(t),this}t.exports=m;var p={};function m(t,e,r){this.setGenerator(e),this.__prime=new i(t),this._prime=i.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=c,this.setPrivateKey=d):this._primeCode=8}function g(t,r){var i=new e(t.toArray());return r?i.toString(r):i}Object.defineProperty(m.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(t,e){var r=e.toString("hex"),i=[r,t.toString(16)].join("_");if(i in p)return p[i];var l,c=0;if(t.isEven()||!f.simpleSieve||!f.fermatTest(t)||!n.test(t))return c+=1,c+="02"===r||"05"===r?8:4,p[i]=c,c;switch(n.test(t.shrn(1))||(c+=2),r){case"02":t.mod(a).cmp(o)&&(c+=8);break;case"05":(l=t.mod(s)).cmp(h)&&l.cmp(u)&&(c+=8);break;default:c+=4}return p[i]=c,c}(this.__prime,this.__gen)),this._primeCode}}),m.prototype.generateKeys=function(){return this._priv||(this._priv=new i(l(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},m.prototype.computeSecret=function(t){var r=(t=(t=new i(t)).toRed(this._prime)).redPow(this._priv).fromRed(),n=new e(r.toArray()),a=this.getPrime();if(n.length0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return o.alloc(0);for(var e,r,i,n=o.allocUnsafe(t>>>0),a=this.head,s=0;a;)e=a.data,r=n,i=s,o.prototype.copy.call(e,r,i),s+=a.data.length,a=a.next;return n}},{key:"consume",value:function(t,e){var r;return tn.length?n.length:t;if(a===n.length?i+=n:i+=n.slice(0,t),0==(t-=a)){a===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(a));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=o.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,a=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,a),0==(t-=a)){a===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(a));break}++i}return this.length-=i,e}},{key:h,value:function(t,e){return s(this,function(t){for(var e=1;e0,(function(t){i||(i=t),t&&o.forEach(u),a||(o.forEach(u),n(i))}))}));return e.reduce(f)}},function(t,e,r){var i=r(2).Buffer,n=r(105),a=r(66),o=r(68).ec,s=r(67),h=r(43),u=r(140);function f(t,e,r,a){if((t=i.from(t.toArray())).length0&&r.ishrn(i),r}function c(t,e,r){var a,o;do{for(a=i.alloc(0);8*a.length=0&&(o=e,s=r),i.negative&&(i=i.neg(),a=a.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:i,b:a},{a:o,b:s}]},h.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],i=e[1],n=i.b.mul(t).divRound(this.n),a=r.b.neg().mul(t).divRound(this.n),o=n.mul(r.a),s=a.mul(i.a),h=n.mul(r.b),u=a.mul(i.b);return{k1:t.sub(o).sub(s),k2:h.add(u).neg()}},h.prototype.pointFromX=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var a=i.fromRed().isOdd();return(e&&!a||!e&&a)&&(i=i.redNeg()),this.point(t,i)},h.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},h.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,a=0;a":""},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),i=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},u.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),i=t.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(i),a=n.redSqr().redISub(this.x.redAdd(this.x)),o=n.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,o)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(t){return t=new n(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},u.prototype.mulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},u.prototype.jmulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},u.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},u.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,i=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},a(f,o.BasePoint),h.prototype.jpoint=function(t,e,r){return new f(this,t,e,r)},f.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),i=this.y.redMul(e).redMul(t);return this.curve.point(r,i)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(e),n=t.x.redMul(r),a=this.y.redMul(e.redMul(t.z)),o=t.y.redMul(r.redMul(this.z)),s=i.redSub(n),h=a.redSub(o);if(0===s.cmpn(0))return 0!==h.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),f=u.redMul(s),l=i.redMul(u),c=h.redSqr().redIAdd(f).redISub(l).redISub(l),d=h.redMul(l.redISub(c)).redISub(a.redMul(f)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(c,d,p)},f.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,i=t.x.redMul(e),n=this.y,a=t.y.redMul(e).redMul(this.z),o=r.redSub(i),s=n.redSub(a);if(0===o.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=o.redSqr(),u=h.redMul(o),f=r.redMul(h),l=s.redSqr().redIAdd(u).redISub(f).redISub(f),c=s.redMul(f.redISub(l)).redISub(n.redMul(u)),d=this.z.redMul(o);return this.curve.jpoint(l,c,d)},f.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},f.prototype.inspect=function(){return this.isInfinity()?"":""},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(t,e,r){"use strict";var i=r(13),n=r(0),a=r(42),o=r(8);function s(t){a.call(this,"mont",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function h(t,e,r){a.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(e,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}n(s,a),t.exports=s,s.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),i=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===i.redSqrt().redSqr().cmp(i)},n(h,a.BasePoint),s.prototype.decodePoint=function(t,e){return this.point(o.toArray(t,e),1)},s.prototype.point=function(t,e){return new h(this,t,e)},s.prototype.pointFromJSON=function(t){return h.fromJSON(this,t)},h.prototype.precompute=function(){},h.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},h.fromJSON=function(t,e){return new h(t,e[0],e[1]||t.one)},h.prototype.inspect=function(){return this.isInfinity()?"":""},h.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},h.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),i=t.redMul(e),n=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},h.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},h.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=t.x.redAdd(t.z),a=t.x.redSub(t.z).redMul(r),o=n.redMul(i),s=e.z.redMul(a.redAdd(o).redSqr()),h=e.x.redMul(a.redISub(o).redSqr());return this.curve.point(s,h)},h.prototype.mul=function(t){for(var e=t.clone(),r=this,i=this.curve.point(null,null),n=[];0!==e.cmpn(0);e.iushrn(1))n.push(e.andln(1));for(var a=n.length-1;a>=0;a--)0===n[a]?(r=r.diffAdd(i,this),i=i.dbl()):(i=r.diffAdd(i,this),r=r.dbl());return i},h.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},h.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},h.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},h.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},h.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(t,e,r){"use strict";var i=r(8),n=r(13),a=r(0),o=r(42),s=i.assert;function h(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,o.call(this,"edwards",t),this.a=new n(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new n(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new n(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),s(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function u(t,e,r,i,a){o.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new n(e,16),this.y=new n(r,16),this.z=i?new n(i,16):this.curve.one,this.t=a&&new n(a,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()))))}a(h,o),t.exports=h,h.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},h.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},h.prototype.jpoint=function(t,e,r,i){return this.point(t,e,r,i)},h.prototype.pointFromX=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=this.c2.redSub(this.a.redMul(r)),a=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=i.redMul(a.redInvm()),s=o.redSqrt();if(0!==s.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var h=s.fromRed().isOdd();return(e&&!h||!e&&h)&&(s=s.redNeg()),this.point(t,s)},h.prototype.pointFromY=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=r.redSub(this.c2),a=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(a.redInvm());if(0===o.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var s=o.redSqrt();if(0!==s.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return s.fromRed().isOdd()!==e&&(s=s.redNeg()),this.point(s,t)},h.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),i=e.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===i.cmp(n)},a(u,o.BasePoint),h.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},h.prototype.point=function(t,e,r,i){return new u(this,t,e,r,i)},u.fromJSON=function(t,e){return new u(t,e[0],e[1],e[2])},u.prototype.inspect=function(){return this.isInfinity()?"":""},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(t),n=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),a=i.redAdd(e),o=a.redSub(r),s=i.redSub(e),h=n.redMul(o),u=a.redMul(s),f=n.redMul(s),l=o.redMul(a);return this.curve.point(h,u,l,f)},u.prototype._projDbl=function(){var t,e,r,i,n,a,o=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),h=this.y.redSqr();if(this.curve.twisted){var u=(i=this.curve._mulA(s)).redAdd(h);this.zOne?(t=o.redSub(s).redSub(h).redMul(u.redSub(this.curve.two)),e=u.redMul(i.redSub(h)),r=u.redSqr().redSub(u).redSub(u)):(n=this.z.redSqr(),a=u.redSub(n).redISub(n),t=o.redSub(s).redISub(h).redMul(a),e=u.redMul(i.redSub(h)),r=u.redMul(a))}else i=s.redAdd(h),n=this.curve._mulC(this.z).redSqr(),a=i.redSub(n).redSub(n),t=this.curve._mulC(o.redISub(i)).redMul(a),e=this.curve._mulC(i).redMul(s.redISub(h)),r=i.redMul(a);return this.curve.point(t,e,r)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),n=this.z.redMul(t.z.redAdd(t.z)),a=r.redSub(e),o=n.redSub(i),s=n.redAdd(i),h=r.redAdd(e),u=a.redMul(o),f=s.redMul(h),l=a.redMul(h),c=o.redMul(s);return this.curve.point(u,f,c,l)},u.prototype._projAdd=function(t){var e,r,i=this.z.redMul(t.z),n=i.redSqr(),a=this.x.redMul(t.x),o=this.y.redMul(t.y),s=this.curve.d.redMul(a).redMul(o),h=n.redSub(s),u=n.redAdd(s),f=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(a).redISub(o),l=i.redMul(h).redMul(f);return this.curve.twisted?(e=i.redMul(u).redMul(o.redSub(this.curve._mulA(a))),r=h.redMul(u)):(e=i.redMul(u).redMul(o.redSub(a)),r=this.curve._mulC(h).redMul(u)),this.curve.point(l,e,r)},u.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},u.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},u.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},u.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},u.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},u.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(i),0===this.x.cmp(e))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add},function(t,e,r){"use strict";e.sha1=r(228),e.sha224=r(229),e.sha256=r(132),e.sha384=r(230),e.sha512=r(133)},function(t,e,r){"use strict";var i=r(11),n=r(33),a=r(131),o=i.rotl32,s=i.sum32,h=i.sum32_5,u=a.ft_1,f=n.BlockHash,l=[1518500249,1859775393,2400959708,3395469782];function c(){if(!(this instanceof c))return new c;f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}i.inherits(c,f),t.exports=c,c.blockSize=512,c.outSize=160,c.hmacStrength=80,c.padLength=64,c.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;ithis.blockSize&&(t=(new this.Hash).update(t).digest()),n(t.length<=this.blockSize);for(var e=t.length;e0))return o.iaddn(1),this.keyFromPrivate(o)}},l.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},l.prototype.sign=function(t,e,r,a){"object"==typeof r&&(a=r,r=null),a||(a={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new i(t,16));for(var o=this.n.byteLength(),s=e.getPrivate().toArray("be",o),h=t.toArray("be",o),u=new n({hash:this.hash,entropy:s,nonce:h,pers:a.pers,persEnc:a.persEnc||"utf8"}),l=this.n.sub(new i(1)),c=0;;c++){var d=a.k?a.k(c):new i(u.generate(this.n.byteLength()));if(!((d=this._truncateToN(d,!0)).cmpn(1)<=0||d.cmp(l)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var m=p.getX(),g=m.umod(this.n);if(0!==g.cmpn(0)){var y=d.invm(this.n).mul(g.mul(e.getPrivate()).iadd(t));if(0!==(y=y.umod(this.n)).cmpn(0)){var v=(p.getY().isOdd()?1:0)|(0!==m.cmp(g)?2:0);return a.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),v^=1),new f({r:g,s:y,recoveryParam:v})}}}}}},l.prototype.verify=function(t,e,r,n){t=this._truncateToN(new i(t,16)),r=this.keyFromPublic(r,n);var a=(e=new f(e,"hex")).r,o=e.s;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s,h=o.invm(this.n),u=h.mul(t).umod(this.n),l=h.mul(a).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(u,r.getPublic(),l)).isInfinity()&&s.eqXToP(a):!(s=this.g.mulAdd(u,r.getPublic(),l)).isInfinity()&&0===s.getX().umod(this.n).cmp(a)},l.prototype.recoverPubKey=function(t,e,r,n){h((3&r)===r,"The recovery param is more than two bits"),e=new f(e,n);var a=this.n,o=new i(t),s=e.r,u=e.s,l=1&r,c=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");s=c?this.curve.pointFromX(s.add(this.curve.n),l):this.curve.pointFromX(s,l);var d=e.r.invm(a),p=a.sub(o).mul(d).umod(a),m=u.mul(d).umod(a);return this.g.mulAdd(p,s,m)},l.prototype.getKeyRecoveryParam=function(t,e,r,i){if(null!==(e=new f(e,i)).recoveryParam)return e.recoveryParam;for(var n=0;n<4;n++){var a;try{a=this.recoverPubKey(t,e,n)}catch(t){continue}if(a.eq(r))return n}throw new Error("Unable to find valid recovery factor")}},function(t,e,r){"use strict";var i=r(70),n=r(129),a=r(7);function o(t){if(!(this instanceof o))return new o(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=n.toArray(t.entropy,t.entropyEnc||"hex"),r=n.toArray(t.nonce,t.nonceEnc||"hex"),i=n.toArray(t.pers,t.persEnc||"hex");a(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}t.exports=o,o.prototype._init=function(t,e,r){var i=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},o.prototype.generate=function(t,e,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(i=r,r=e,e=null),r&&(r=n.toArray(r,i||"hex"),this._update(r));for(var a=[];a.length"}},function(t,e,r){"use strict";var i=r(13),n=r(8),a=n.assert;function o(t,e){if(t instanceof o)return t;this._importDER(t,e)||(a(t.r&&t.s,"Signature without r or s"),this.r=new i(t.r,16),this.s=new i(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function s(){this.place=0}function h(t,e){var r=t[e.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;for(var n=0,a=0,o=e.place;a>>=0;return!(n<=127)&&(e.place=o,n)}function u(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}t.exports=o,o.prototype._importDER=function(t,e){t=n.toArray(t,e);var r=new s;if(48!==t[r.place++])return!1;var a=h(t,r);if(!1===a)return!1;if(a+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var o=h(t,r);if(!1===o)return!1;var u=t.slice(r.place,o+r.place);if(r.place+=o,2!==t[r.place++])return!1;var f=h(t,r);if(!1===f)return!1;if(t.length!==f+r.place)return!1;var l=t.slice(r.place,f+r.place);if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}if(0===l[0]){if(!(128&l[1]))return!1;l=l.slice(1)}return this.r=new i(u),this.s=new i(l),this.recoveryParam=null,!0},o.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=u(e),r=u(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];f(i,e.length),(i=i.concat(e)).push(2),f(i,r.length);var a=i.concat(r),o=[48];return f(o,a.length),o=o.concat(a),n.encode(o,t)}},function(t,e,r){"use strict";var i=r(70),n=r(69),a=r(8),o=a.assert,s=a.parseBytes,h=r(239),u=r(240);function f(t){if(o("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof f))return new f(t);t=n[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=i.sha512}t.exports=f,f.prototype.sign=function(t,e){t=s(t);var r=this.keyFromSecret(e),i=this.hashInt(r.messagePrefix(),t),n=this.g.mul(i),a=this.encodePoint(n),o=this.hashInt(a,r.pubBytes(),t).mul(r.priv()),h=i.add(o).umod(this.curve.n);return this.makeSignature({R:n,S:h,Rencoded:a})},f.prototype.verify=function(t,e,r){t=s(t),e=this.makeSignature(e);var i=this.keyFromPublic(r),n=this.hashInt(e.Rencoded(),i.pubBytes(),t),a=this.g.mul(e.S());return e.R().add(i.pub().mul(n)).eq(a)},f.prototype.hashInt=function(){for(var t=this.hash(),e=0;e=e)throw new Error("invalid sig")}t.exports=function(t,e,r,u,f){var l=o(r);if("ec"===l.type){if("ecdsa"!==u&&"ecdsa/rsa"!==u)throw new Error("wrong public key type");return function(t,e,r){var i=s[r.data.algorithm.curve.join(".")];if(!i)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var n=new a(i),o=r.data.subjectPrivateKey.data;return n.verify(e,t,o)}(t,e,l)}if("dsa"===l.type){if("dsa"!==u)throw new Error("wrong public key type");return function(t,e,r){var i=r.data.p,a=r.data.q,s=r.data.g,u=r.data.pub_key,f=o.signature.decode(t,"der"),l=f.s,c=f.r;h(l,a),h(c,a);var d=n.mont(i),p=l.invm(a);return 0===s.toRed(d).redPow(new n(e).mul(p).mod(a)).fromRed().mul(u.toRed(d).redPow(c.mul(p).mod(a)).fromRed()).mod(i).mod(a).cmp(c)}(t,e,l)}if("rsa"!==u&&"ecdsa/rsa"!==u)throw new Error("wrong public key type");e=i.concat([f,e]);for(var c=l.modulus.byteLength(),d=[1],p=0;e.length+d.length+2=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function h(t,e,r){var i=s(t,r);return r-1>=e&&(i|=s(t,r-1)<<4),i}function u(t,e,r,i){for(var n=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return n}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i=e;i-=2)n=h(t,e,i)<=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;else for(i=(t.length-e)%2==0?e+1:e;i=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var a=t.length-r,o=a%i,s=Math.min(a,a-o)+r,h=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?""};var f=["","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],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],a=0|e.words[0],o=n*a,s=67108863&o,h=o/67108864|0;r.words[0]=s;for(var u=1;u>>26,l=67108863&h,c=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=c;d++){var p=u-d|0;f+=(o=(n=0|t.words[p])*(a=0|e.words[d])+l)/67108864|0,l=67108863&o}r.words[u]=0|l,h=0|f}return 0!==h?r.words[u]=0|h:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,a=0,o=0;o>>24-n&16777215)||o!==this.length-1?f[6-h.length]+h+r:h+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=l[t],d=c[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:f[u-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var o,s,h="le"===e,u=new t(a),f=this.clone();if(h){for(s=0;!f.isZero();s++)o=f.andln(255),f.iushrn(8),u[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;it.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,i=t):(r=t,i=this);for(var n=0,a=0;a>>26;for(;0!==n&&a>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,g=0|o[2],y=8191&g,v=g>>>13,b=0|o[3],w=8191&b,M=b>>>13,_=0|o[4],S=8191&_,E=_>>>13,C=0|o[5],A=8191&C,T=C>>>13,B=0|o[6],I=8191&B,k=B>>>13,R=0|o[7],N=8191&R,L=R>>>13,x=0|o[8],P=8191&x,D=x>>>13,U=0|o[9],O=8191&U,j=U>>>13,K=0|s[0],V=8191&K,q=K>>>13,F=0|s[1],H=8191&F,z=F>>>13,G=0|s[2],W=8191&G,Z=G>>>13,Y=0|s[3],Q=8191&Y,X=Y>>>13,J=0|s[4],$=8191&J,tt=J>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],at=8191&nt,ot=nt>>>13,st=0|s[7],ht=8191&st,ut=st>>>13,ft=0|s[8],lt=8191&ft,ct=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(l,V))|0)+((8191&(n=(n=Math.imul(l,q))+Math.imul(c,V)|0))<<13)|0;u=((a=Math.imul(c,q))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,V),n=(n=Math.imul(p,q))+Math.imul(m,V)|0,a=Math.imul(m,q);var yt=(u+(i=i+Math.imul(l,H)|0)|0)+((8191&(n=(n=n+Math.imul(l,z)|0)+Math.imul(c,H)|0))<<13)|0;u=((a=a+Math.imul(c,z)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,V),n=(n=Math.imul(y,q))+Math.imul(v,V)|0,a=Math.imul(v,q),i=i+Math.imul(p,H)|0,n=(n=n+Math.imul(p,z)|0)+Math.imul(m,H)|0,a=a+Math.imul(m,z)|0;var vt=(u+(i=i+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,Z)|0)+Math.imul(c,W)|0))<<13)|0;u=((a=a+Math.imul(c,Z)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(w,V),n=(n=Math.imul(w,q))+Math.imul(M,V)|0,a=Math.imul(M,q),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,z)|0)+Math.imul(v,H)|0,a=a+Math.imul(v,z)|0,i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,Z)|0)+Math.imul(m,W)|0,a=a+Math.imul(m,Z)|0;var bt=(u+(i=i+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,X)|0)+Math.imul(c,Q)|0))<<13)|0;u=((a=a+Math.imul(c,X)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(S,V),n=(n=Math.imul(S,q))+Math.imul(E,V)|0,a=Math.imul(E,q),i=i+Math.imul(w,H)|0,n=(n=n+Math.imul(w,z)|0)+Math.imul(M,H)|0,a=a+Math.imul(M,z)|0,i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(v,W)|0,a=a+Math.imul(v,Z)|0,i=i+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,X)|0;var wt=(u+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(c,$)|0))<<13)|0;u=((a=a+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(A,V),n=(n=Math.imul(A,q))+Math.imul(T,V)|0,a=Math.imul(T,q),i=i+Math.imul(S,H)|0,n=(n=n+Math.imul(S,z)|0)+Math.imul(E,H)|0,a=a+Math.imul(E,z)|0,i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,Z)|0)+Math.imul(M,W)|0,a=a+Math.imul(M,Z)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,X)|0)+Math.imul(v,Q)|0,a=a+Math.imul(v,X)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,$)|0,a=a+Math.imul(m,tt)|0;var Mt=(u+(i=i+Math.imul(l,rt)|0)|0)+((8191&(n=(n=n+Math.imul(l,it)|0)+Math.imul(c,rt)|0))<<13)|0;u=((a=a+Math.imul(c,it)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(I,V),n=(n=Math.imul(I,q))+Math.imul(k,V)|0,a=Math.imul(k,q),i=i+Math.imul(A,H)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(T,H)|0,a=a+Math.imul(T,z)|0,i=i+Math.imul(S,W)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(E,W)|0,a=a+Math.imul(E,Z)|0,i=i+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,X)|0)+Math.imul(M,Q)|0,a=a+Math.imul(M,X)|0,i=i+Math.imul(y,$)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,$)|0,a=a+Math.imul(v,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,it)|0;var _t=(u+(i=i+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,ot)|0)+Math.imul(c,at)|0))<<13)|0;u=((a=a+Math.imul(c,ot)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(N,V),n=(n=Math.imul(N,q))+Math.imul(L,V)|0,a=Math.imul(L,q),i=i+Math.imul(I,H)|0,n=(n=n+Math.imul(I,z)|0)+Math.imul(k,H)|0,a=a+Math.imul(k,z)|0,i=i+Math.imul(A,W)|0,n=(n=n+Math.imul(A,Z)|0)+Math.imul(T,W)|0,a=a+Math.imul(T,Z)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(E,Q)|0,a=a+Math.imul(E,X)|0,i=i+Math.imul(w,$)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(M,$)|0,a=a+Math.imul(M,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(v,rt)|0,a=a+Math.imul(v,it)|0,i=i+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var St=(u+(i=i+Math.imul(l,ht)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(c,ht)|0))<<13)|0;u=((a=a+Math.imul(c,ut)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(P,V),n=(n=Math.imul(P,q))+Math.imul(D,V)|0,a=Math.imul(D,q),i=i+Math.imul(N,H)|0,n=(n=n+Math.imul(N,z)|0)+Math.imul(L,H)|0,a=a+Math.imul(L,z)|0,i=i+Math.imul(I,W)|0,n=(n=n+Math.imul(I,Z)|0)+Math.imul(k,W)|0,a=a+Math.imul(k,Z)|0,i=i+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,X)|0)+Math.imul(T,Q)|0,a=a+Math.imul(T,X)|0,i=i+Math.imul(S,$)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(E,$)|0,a=a+Math.imul(E,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(M,rt)|0,a=a+Math.imul(M,it)|0,i=i+Math.imul(y,at)|0,n=(n=n+Math.imul(y,ot)|0)+Math.imul(v,at)|0,a=a+Math.imul(v,ot)|0,i=i+Math.imul(p,ht)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,ht)|0,a=a+Math.imul(m,ut)|0;var Et=(u+(i=i+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,ct)|0)+Math.imul(c,lt)|0))<<13)|0;u=((a=a+Math.imul(c,ct)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(O,V),n=(n=Math.imul(O,q))+Math.imul(j,V)|0,a=Math.imul(j,q),i=i+Math.imul(P,H)|0,n=(n=n+Math.imul(P,z)|0)+Math.imul(D,H)|0,a=a+Math.imul(D,z)|0,i=i+Math.imul(N,W)|0,n=(n=n+Math.imul(N,Z)|0)+Math.imul(L,W)|0,a=a+Math.imul(L,Z)|0,i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,X)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,X)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(T,$)|0,a=a+Math.imul(T,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(E,rt)|0,a=a+Math.imul(E,it)|0,i=i+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(M,at)|0,a=a+Math.imul(M,ot)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(v,ht)|0,a=a+Math.imul(v,ut)|0,i=i+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,a=a+Math.imul(m,ct)|0;var Ct=(u+(i=i+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(c,pt)|0))<<13)|0;u=((a=a+Math.imul(c,mt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(O,H),n=(n=Math.imul(O,z))+Math.imul(j,H)|0,a=Math.imul(j,z),i=i+Math.imul(P,W)|0,n=(n=n+Math.imul(P,Z)|0)+Math.imul(D,W)|0,a=a+Math.imul(D,Z)|0,i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,X)|0)+Math.imul(L,Q)|0,a=a+Math.imul(L,X)|0,i=i+Math.imul(I,$)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(k,$)|0,a=a+Math.imul(k,tt)|0,i=i+Math.imul(A,rt)|0,n=(n=n+Math.imul(A,it)|0)+Math.imul(T,rt)|0,a=a+Math.imul(T,it)|0,i=i+Math.imul(S,at)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(E,at)|0,a=a+Math.imul(E,ot)|0,i=i+Math.imul(w,ht)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(M,ht)|0,a=a+Math.imul(M,ut)|0,i=i+Math.imul(y,lt)|0,n=(n=n+Math.imul(y,ct)|0)+Math.imul(v,lt)|0,a=a+Math.imul(v,ct)|0;var At=(u+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((a=a+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(O,W),n=(n=Math.imul(O,Z))+Math.imul(j,W)|0,a=Math.imul(j,Z),i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,X)|0)+Math.imul(D,Q)|0,a=a+Math.imul(D,X)|0,i=i+Math.imul(N,$)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(L,$)|0,a=a+Math.imul(L,tt)|0,i=i+Math.imul(I,rt)|0,n=(n=n+Math.imul(I,it)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ot)|0)+Math.imul(T,at)|0,a=a+Math.imul(T,ot)|0,i=i+Math.imul(S,ht)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(E,ht)|0,a=a+Math.imul(E,ut)|0,i=i+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(M,lt)|0,a=a+Math.imul(M,ct)|0;var Tt=(u+(i=i+Math.imul(y,pt)|0)|0)+((8191&(n=(n=n+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;u=((a=a+Math.imul(v,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(O,Q),n=(n=Math.imul(O,X))+Math.imul(j,Q)|0,a=Math.imul(j,X),i=i+Math.imul(P,$)|0,n=(n=n+Math.imul(P,tt)|0)+Math.imul(D,$)|0,a=a+Math.imul(D,tt)|0,i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(L,rt)|0,a=a+Math.imul(L,it)|0,i=i+Math.imul(I,at)|0,n=(n=n+Math.imul(I,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,i=i+Math.imul(A,ht)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(T,ht)|0,a=a+Math.imul(T,ut)|0,i=i+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(E,lt)|0,a=a+Math.imul(E,ct)|0;var Bt=(u+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;u=((a=a+Math.imul(M,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(O,$),n=(n=Math.imul(O,tt))+Math.imul(j,$)|0,a=Math.imul(j,tt),i=i+Math.imul(P,rt)|0,n=(n=n+Math.imul(P,it)|0)+Math.imul(D,rt)|0,a=a+Math.imul(D,it)|0,i=i+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ot)|0)+Math.imul(L,at)|0,a=a+Math.imul(L,ot)|0,i=i+Math.imul(I,ht)|0,n=(n=n+Math.imul(I,ut)|0)+Math.imul(k,ht)|0,a=a+Math.imul(k,ut)|0,i=i+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,ct)|0)+Math.imul(T,lt)|0,a=a+Math.imul(T,ct)|0;var It=(u+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((a=a+Math.imul(E,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(O,rt),n=(n=Math.imul(O,it))+Math.imul(j,rt)|0,a=Math.imul(j,it),i=i+Math.imul(P,at)|0,n=(n=n+Math.imul(P,ot)|0)+Math.imul(D,at)|0,a=a+Math.imul(D,ot)|0,i=i+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,ut)|0)+Math.imul(L,ht)|0,a=a+Math.imul(L,ut)|0,i=i+Math.imul(I,lt)|0,n=(n=n+Math.imul(I,ct)|0)+Math.imul(k,lt)|0,a=a+Math.imul(k,ct)|0;var kt=(u+(i=i+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(T,pt)|0))<<13)|0;u=((a=a+Math.imul(T,mt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(O,at),n=(n=Math.imul(O,ot))+Math.imul(j,at)|0,a=Math.imul(j,ot),i=i+Math.imul(P,ht)|0,n=(n=n+Math.imul(P,ut)|0)+Math.imul(D,ht)|0,a=a+Math.imul(D,ut)|0,i=i+Math.imul(N,lt)|0,n=(n=n+Math.imul(N,ct)|0)+Math.imul(L,lt)|0,a=a+Math.imul(L,ct)|0;var Rt=(u+(i=i+Math.imul(I,pt)|0)|0)+((8191&(n=(n=n+Math.imul(I,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((a=a+Math.imul(k,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(O,ht),n=(n=Math.imul(O,ut))+Math.imul(j,ht)|0,a=Math.imul(j,ut),i=i+Math.imul(P,lt)|0,n=(n=n+Math.imul(P,ct)|0)+Math.imul(D,lt)|0,a=a+Math.imul(D,ct)|0;var Nt=(u+(i=i+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((a=a+Math.imul(L,mt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(O,lt),n=(n=Math.imul(O,ct))+Math.imul(j,lt)|0,a=Math.imul(j,ct);var Lt=(u+(i=i+Math.imul(P,pt)|0)|0)+((8191&(n=(n=n+Math.imul(P,mt)|0)+Math.imul(D,pt)|0))<<13)|0;u=((a=a+Math.imul(D,mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863;var xt=(u+(i=Math.imul(O,pt))|0)+((8191&(n=(n=Math.imul(O,mt))+Math.imul(j,pt)|0))<<13)|0;return u=((a=Math.imul(j,mt))+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,h[0]=gt,h[1]=yt,h[2]=vt,h[3]=bt,h[4]=wt,h[5]=Mt,h[6]=_t,h[7]=St,h[8]=Et,h[9]=Ct,h[10]=At,h[11]=Tt,h[12]=Bt,h[13]=It,h[14]=kt,h[15]=Rt,h[16]=Nt,h[17]=Lt,h[18]=xt,0!==u&&(h[19]=u,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=d),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,t,e):m(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,i=0;i>=1;return i},g.prototype.permute=function(t,e,r,i,n,a){for(var o=0;o>>=1)n++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=n/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>n}return e}(t);if(0===e.length)return new a(1);for(var r=this,i=0;i=0);var e,r=t%26,n=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e=0),n=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,u=0;u=0&&(0!==f||u>=n);u--){var l=0|this.words[u];this.words[u]=f<<26-a|l>>>a,f=l&s}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(h/67108864|0),this.words[n+r]=67108863&a}for(;n>26,this.words[n+r]=67108863&a;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,h=i.length-n.length;if("mod"!==e){(s=new a(null)).length=h+1,s.words=new Array(s.length);for(var u=0;u=0;l--){var c=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(c=Math.min(c/o|0,67108863),i._ishlnsubmul(n,c,l);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);s&&(s.words[l]=c)}return s&&s.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(n=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},a.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new a(1),o=new a(0),s=new a(0),h=new a(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),l=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(l)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||h.isOdd())&&(s.iadd(f),h.isub(l)),s.iushrn(1),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(s),o.isub(h)):(r.isub(e),s.isub(n),h.isub(o))}return{a:s,b:h,gcd:r.iushln(u)}},a.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new a(1),s=new a(0),h=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;0==(e.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(h),o.iushrn(1);for(var l=0,c=1;0==(r.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(r.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(n=0===e.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(t),n},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var a=e;e=r,r=a}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:nt.length)return 1;if(this.length=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){in&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new S(t)},a.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(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 t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},n(b,v),b.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i>>22,n=a}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new w;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return y[t]=e,e},S.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),h=s.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,u).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(s);){for(var m=d,g=0;0!==m.cmp(s);g++)m=m.redSqr();i(g=0;i--){for(var u=e.words[i],f=h-1;f>=0;f--){var l=u>>f&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==o?(o<<=1,o|=l,(4===++s||0===i&&0===f)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}h=26}return n},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new E(t)},n(E,S),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(20)(t))},function(t,e){},function(t,e,r){e.publicEncrypt=r(256),e.privateDecrypt=r(258),e.privateEncrypt=function(t,r){return e.publicEncrypt(t,r,!0)},e.publicDecrypt=function(t,r){return e.privateDecrypt(t,r,!0)}},function(t,e,r){var i=r(43),n=r(22),a=r(30),o=r(141),s=r(142),h=r(75),u=r(143),f=r(66),l=r(2).Buffer;t.exports=function(t,e,r){var c;c=t.padding?t.padding:r?1:4;var d,p=i(t);if(4===c)d=function(t,e){var r=t.modulus.byteLength(),i=e.length,u=a("sha1").update(l.alloc(0)).digest(),f=u.length,c=2*f;if(i>r-c-2)throw new Error("message too long");var d=l.alloc(r-i-c-2),p=r-f-1,m=n(f),g=s(l.concat([u,d,l.alloc(1,1),e],p),o(m,p)),y=s(m,o(g,f));return new h(l.concat([l.alloc(1),y,g],r))}(p,e);else if(1===c)d=function(t,e,r){var i,a=e.length,o=t.modulus.byteLength();if(a>o-11)throw new Error("message too long");i=r?l.alloc(o-a-3,255):function(t){var e,r=l.allocUnsafe(t),i=0,a=n(2*t),o=0;for(;i=0)throw new Error("data too long for modulus")}return r?f(d,p):u(d,p)}},function(t,e){},function(t,e,r){var i=r(43),n=r(141),a=r(142),o=r(75),s=r(66),h=r(30),u=r(143),f=r(2).Buffer;t.exports=function(t,e,r){var l;l=t.padding?t.padding:r?1:4;var c,d=i(t),p=d.modulus.byteLength();if(e.length>p||new o(e).cmp(d.modulus)>=0)throw new Error("decryption error");c=r?u(new o(e),d):s(e,d);var m=f.alloc(p-c.length);if(c=f.concat([m,c],p),4===l)return function(t,e){var r=t.modulus.byteLength(),i=h("sha1").update(f.alloc(0)).digest(),o=i.length;if(0!==e[0])throw new Error("decryption error");var s=e.slice(1,o+1),u=e.slice(o+1),l=a(s,n(u,o)),c=a(u,n(l,r-o-1));if(function(t,e){t=f.from(t),e=f.from(e);var r=0,i=t.length;t.length!==e.length&&(r++,i=Math.min(t.length,e.length));var n=-1;for(;++n=e.length){a++;break}var o=e.slice(2,n-1);("0002"!==i.toString("hex")&&!r||"0001"!==i.toString("hex")&&r)&&a++;o.length<8&&a++;if(a)throw new Error("decryption error");return e.slice(n)}(0,c,r);if(3===l)return c;throw new Error("unknown padding")}},function(t,e,r){"use strict";(function(t,i){function n(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var a=r(2),o=r(22),s=a.Buffer,h=a.kMaxLength,u=t.crypto||t.msCrypto,f=Math.pow(2,32)-1;function l(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>f||t<0)throw new TypeError("offset must be a uint32");if(t>h||t>e)throw new RangeError("offset out of range")}function c(t,e,r){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>f||t<0)throw new TypeError("size must be a uint32");if(t+e>r||t>h)throw new RangeError("buffer too small")}function d(t,e,r,n){if(i.browser){var a=t.buffer,s=new Uint8Array(a,e,r);return u.getRandomValues(s),n?void i.nextTick((function(){n(null,t)})):t}if(!n)return o(r).copy(t,e),t;o(r,(function(r,i){if(r)return n(r);i.copy(t,e),n(null,t)}))}u&&u.getRandomValues||!i.browser?(e.randomFill=function(e,r,i,n){if(!(s.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof r)n=r,r=0,i=e.length;else if("function"==typeof i)n=i,i=e.length-r;else if("function"!=typeof n)throw new TypeError('"cb" argument must be a function');return l(r,e.length),c(i,r,e.length),d(e,r,i,n)},e.randomFillSync=function(e,r,i){void 0===r&&(r=0);if(!(s.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');l(r,e.length),void 0===i&&(i=e.length-r);return c(i,r,e.length),d(e,r,i)}):(e.randomFill=n,e.randomFillSync=n)}).call(this,r(6),r(5))}]);