@comate/zulu 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ import{o as e,g as t}from"./user-vP8ulngb.js";import r from"crypto";import n from"https";import a from"tls";import i from"fs";import s from"os";import o from"path";var c,u;function l(){return u?c:(u=1,c={options:{usePureJavaScript:!1}})}var p,f,h,d,y,g={exports:{}};function v(){if(f)return p;f=1;var e={};p=e;var t={};return e.encode=function(e,t,r){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!=typeof r)throw new TypeError('"maxline" must be a number.');var n="";if(e instanceof Uint8Array){var a=0,i=t.length,s=t.charAt(0),o=[0];for(a=0;a<e.length;++a){for(var c=0,u=e[a];c<o.length;++c)u+=o[c]<<8,o[c]=u%i,u=u/i|0;for(;u>0;)o.push(u%i),u=u/i|0}for(a=0;0===e[a]&&a<e.length-1;++a)n+=s;for(a=o.length-1;a>=0;--a)n+=t[o[a]]}else n=function(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r<e.length();++r){for(var s=0,o=e.at(r);s<i.length;++s)o+=i[s]<<8,i[s]=o%n,o=o/n|0;for(;o>0;)i.push(o%n),o=o/n|0}var c="";for(r=0;0===e.at(r)&&r<e.length()-1;++r)c+=a;for(r=i.length-1;r>=0;--r)c+=t[i[r]];return c}(e,t);if(r){var l=new RegExp(".{1,"+r+"}","g");n=n.match(l).join("\r\n")}return n},e.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var n=t[r];if(!n){n=t[r]=[];for(var a=0;a<r.length;++a)n[r.charCodeAt(a)]=a}e=e.replace(/\s/g,"");var i=r.length,s=r.charAt(0),o=[0];for(a=0;a<e.length;a++){var c=n[e.charCodeAt(a)];if(void 0===c)return;for(var u=0,l=c;u<o.length;++u)l+=o[u]*i,o[u]=255&l,l>>=8;for(;l>0;)o.push(255&l),l>>=8}for(var p=0;e[p]===s&&p<e.length-1;++p)o.push(0);return"undefined"!=typeof Buffer?Buffer.from(o.reverse()):new Uint8Array(o.reverse())},p}function m(){if(h)return g.exports;h=1;var t=l(),r=v(),n=g.exports=t.util=t.util||{};function a(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function i(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(n.isArrayBuffer(e)||n.isArrayBufferView(e))if("undefined"!=typeof Buffer&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r<t.length;++r)this.putByte(t[r])}}else(e instanceof i||"object"==typeof e&&"string"==typeof e.data&&"number"==typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}!function(){if("undefined"!=typeof process&&process.nextTick&&!process.browser)return n.nextTick=process.nextTick,void("function"==typeof setImmediate?n.setImmediate=setImmediate:n.setImmediate=n.nextTick);if("function"==typeof setImmediate)return n.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(n.nextTick=function(e){return setImmediate(e)});if(n.setImmediate=function(e){setTimeout(e,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){var e="forge.setImmediate",t=[];function o(r){if(r.source===window&&r.data===e){r.stopPropagation();var n=t.slice();t.length=0,n.forEach((function(e){e()}))}}n.setImmediate=function(r){t.push(r),1===t.length&&window.postMessage(e,"*")},window.addEventListener("message",o,!0)}if("undefined"!=typeof MutationObserver){var r=Date.now(),a=!0,i=document.createElement("div");t=[];new MutationObserver((function(){var e=t.slice();t.length=0,e.forEach((function(e){e()}))})).observe(i,{attributes:!0});var s=n.setImmediate;n.setImmediate=function(e){Date.now()-r>15?(r=Date.now(),s(e)):(t.push(e),1===t.length&&i.setAttribute("a",a=!a))}}n.nextTick=n.setImmediate}(),n.isNodejs="undefined"!=typeof process&&process.versions&&process.versions.node,n.globalScope=n.isNodejs?e:"undefined"==typeof self?window:self,n.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},n.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},n.isArrayBufferView=function(e){return e&&n.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},n.ByteBuffer=i,n.ByteStringBuffer=i;n.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},n.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},n.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},n.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},n.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},n.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},n.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(n.encodeUtf8(e))},n.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},n.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},n.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},n.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},n.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},n.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},n.ByteStringBuffer.prototype.putInt=function(e,t){a(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},n.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},n.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},n.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},n.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},n.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},n.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},n.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},n.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},n.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e},n.ByteStringBuffer.prototype.getInt=function(e){a(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},n.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},n.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},n.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},n.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},n.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},n.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},n.ByteStringBuffer.prototype.copy=function(){var e=n.createBuffer(this.data);return e.read=this.read,e},n.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},n.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},n.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},n.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);r<16&&(e+="0"),e+=r.toString(16)}return e},n.ByteStringBuffer.prototype.toString=function(){return n.decodeUtf8(this.bytes())},n.DataBuffer=function(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=n.isArrayBuffer(e),a=n.isArrayBufferView(e);if(r||a)return this.data=r?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!=e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)},n.DataBuffer.prototype.length=function(){return this.write-this.read},n.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},n.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},n.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},n.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this},n.DataBuffer.prototype.putBytes=function(e,t){if(n.isArrayBufferView(e)){var r=(a=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).byteLength-a.byteOffset;return this.accommodate(r),new Uint8Array(this.data.buffer,this.write).set(a),this.write+=r,this}if(n.isArrayBuffer(e)){var a=new Uint8Array(e);return this.accommodate(a.byteLength),new Uint8Array(this.data.buffer).set(a,this.write),this.write+=a.byteLength,this}if(e instanceof n.DataBuffer||"object"==typeof e&&"number"==typeof e.read&&"number"==typeof e.write&&n.isArrayBufferView(e.data)){a=new Uint8Array(e.data.byteLength,e.read,e.length());return this.accommodate(a.byteLength),new Uint8Array(e.data.byteLength,this.write).set(a),this.write+=a.byteLength,this}if(e instanceof n.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary","string"==typeof e){var i;if("hex"===t)return this.accommodate(Math.ceil(e.length/2)),i=new Uint8Array(this.data.buffer,this.write),this.write+=n.binary.hex.decode(e,i,this.write),this;if("base64"===t)return this.accommodate(3*Math.ceil(e.length/4)),i=new Uint8Array(this.data.buffer,this.write),this.write+=n.binary.base64.decode(e,i,this.write),this;if("utf8"===t&&(e=n.encodeUtf8(e),t="binary"),"binary"===t||"raw"===t)return this.accommodate(e.length),i=new Uint8Array(this.data.buffer,this.write),this.write+=n.binary.raw.decode(i),this;if("utf16"===t)return this.accommodate(2*e.length),i=new Uint16Array(this.data.buffer,this.write),this.write+=n.text.utf16.encode(i),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)},n.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},n.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},n.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},n.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},n.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},n.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},n.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},n.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},n.DataBuffer.prototype.putInt=function(e,t){a(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},n.DataBuffer.prototype.putSignedInt=function(e,t){return a(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},n.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},n.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},n.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},n.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},n.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},n.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},n.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},n.DataBuffer.prototype.getInt=function(e){a(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},n.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},n.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},n.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},n.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},n.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},n.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},n.DataBuffer.prototype.copy=function(){return new n.DataBuffer(this)},n.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},n.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},n.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},n.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);r<16&&(e+="0"),e+=r.toString(16)}return e},n.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return n.binary.raw.encode(t);if("hex"===e)return n.binary.hex.encode(t);if("base64"===e)return n.binary.base64.encode(t);if("utf8"===e)return n.text.utf8.decode(t);if("utf16"===e)return n.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)},n.createBuffer=function(e,t){return t=t||"raw",void 0!==e&&"utf8"===t&&(e=n.encodeUtf8(e)),new n.ByteBuffer(e)},n.fillString=function(e,t){for(var r="";t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},n.xorBytes=function(e,t,r){for(var n="",a="",i="",s=0,o=0;r>0;--r,++s)a=e.charCodeAt(s)^t.charCodeAt(s),o>=10&&(n+=i,i="",o=0),i+=String.fromCharCode(a),++o;return n+=i},n.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},n.bytesToHex=function(e){return n.createBuffer(e).toHex()},n.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=[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],c="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";n.encode64=function(e,t){for(var r,n,a,i="",o="",c=0;c<e.length;)r=e.charCodeAt(c++),n=e.charCodeAt(c++),a=e.charCodeAt(c++),i+=s.charAt(r>>2),i+=s.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=s.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":s.charAt(63&a)),t&&i.length>t&&(o+=i.substr(0,t)+"\r\n",i=i.substr(t));return o+=i},n.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,a,i="",s=0;s<e.length;)t=o[e.charCodeAt(s++)-43],r=o[e.charCodeAt(s++)-43],n=o[e.charCodeAt(s++)-43],a=o[e.charCodeAt(s++)-43],i+=String.fromCharCode(t<<2|r>>4),64!==n&&(i+=String.fromCharCode((15&r)<<4|n>>2),64!==a&&(i+=String.fromCharCode((3&n)<<6|a)));return i},n.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},n.decodeUtf8=function(e){return decodeURIComponent(escape(e))},n.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:r.encode,decode:r.decode}},n.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},n.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length));for(var a=r=r||0,i=0;i<e.length;++i)n[a++]=e.charCodeAt(i);return t?a-r:n},n.binary.hex.encode=n.bytesToHex,n.binary.hex.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(Math.ceil(e.length/2)));var a=0,i=r=r||0;for(1&e.length&&(a=1,n[i++]=parseInt(e[0],16));a<e.length;a+=2)n[i++]=parseInt(e.substr(a,2),16);return t?i-r:n},n.binary.base64.encode=function(e,t){for(var r,n,a,i="",o="",c=0;c<e.byteLength;)r=e[c++],n=e[c++],a=e[c++],i+=s.charAt(r>>2),i+=s.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=s.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":s.charAt(63&a)),t&&i.length>t&&(o+=i.substr(0,t)+"\r\n",i=i.substr(t));return o+=i},n.binary.base64.decode=function(e,t,r){var n,a,i,s,c=t;c||(c=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var u=0,l=r=r||0;u<e.length;)n=o[e.charCodeAt(u++)-43],a=o[e.charCodeAt(u++)-43],i=o[e.charCodeAt(u++)-43],s=o[e.charCodeAt(u++)-43],c[l++]=n<<2|a>>4,64!==i&&(c[l++]=(15&a)<<4|i>>2,64!==s&&(c[l++]=(3&i)<<6|s));return t?l-r:c.subarray(0,l)},n.binary.base58.encode=function(e,t){return n.binary.baseN.encode(e,c,t)},n.binary.base58.decode=function(e,t){return n.binary.baseN.decode(e,c,t)},n.text={utf8:{},utf16:{}},n.text.utf8.encode=function(e,t,r){e=n.encodeUtf8(e);var a=t;a||(a=new Uint8Array(e.length));for(var i=r=r||0,s=0;s<e.length;++s)a[i++]=e.charCodeAt(s);return t?i-r:a},n.text.utf8.decode=function(e){return n.decodeUtf8(String.fromCharCode.apply(null,e))},n.text.utf16.encode=function(e,t,r){var n=t;n||(n=new Uint8Array(2*e.length));for(var a=new Uint16Array(n.buffer),i=r=r||0,s=r,o=0;o<e.length;++o)a[s++]=e.charCodeAt(o),i+=2;return t?i-r:n},n.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},n.deflate=function(e,t,r){if(t=n.decode64(e.deflate(n.encode64(t)).rval),r){var a=2;32&t.charCodeAt(1)&&(a=6),t=t.substring(a,t.length-4)}return t},n.inflate=function(e,t,r){var a=e.inflate(n.encode64(t)).rval;return null===a?null:n.decode64(a)};var u=function(e,t,r){if(!e)throw new Error("WebStorage not available.");var a;if(null===r?a=e.removeItem(t):(r=n.encode64(JSON.stringify(r)),a=e.setItem(t,r)),void 0!==a&&!0!==a.rval){var i=new Error(a.error.message);throw i.id=a.error.id,i.name=a.error.name,i}},p=function(e,t){if(!e)throw new Error("WebStorage not available.");var r=e.getItem(t);if(e.init)if(null===r.rval){if(r.error){var a=new Error(r.error.message);throw a.id=r.error.id,a.name=r.error.name,a}r=null}else r=r.rval;return null!==r&&(r=JSON.parse(n.decode64(r))),r},f=function(e,t,r,n){var a=p(e,t);null===a&&(a={}),a[r]=n,u(e,t,a)},d=function(e,t,r){var n=p(e,t);return null!==n&&(n=r in n?n[r]:null),n},y=function(e,t,r){var n=p(e,t);if(null!==n&&r in n){delete n[r];var a=!0;for(var i in n){a=!1;break}a&&(n=null),u(e,t,n)}},m=function(e,t){u(e,t,null)},C=function(e,t,r){var n,a=null;void 0===r&&(r=["web","flash"]);var i=!1,s=null;for(var o in r){n=r[o];try{if("flash"===n||"both"===n){if(null===t[0])throw new Error("Flash local storage not available.");a=e.apply(this,t),i="flash"===n}"web"!==n&&"both"!==n||(t[0]=localStorage,a=e.apply(this,t),i=!0)}catch(e){s=e}if(i)break}if(!i)throw s;return a};return n.setItem=function(e,t,r,n,a){C(f,arguments,a)},n.getItem=function(e,t,r,n){return C(d,arguments,n)},n.removeItem=function(e,t,r,n){C(y,arguments,n)},n.clearItems=function(e,t,r){C(m,arguments,r)},n.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},n.format=function(e){for(var t,r,n=/%./g,a=0,i=[],s=0;t=n.exec(e);){(r=e.substring(s,n.lastIndex-2)).length>0&&i.push(r),s=n.lastIndex;var o=t[0][1];switch(o){case"s":case"o":a<arguments.length?i.push(arguments[1+a++]):i.push("<?>");break;case"%":i.push("%");break;default:i.push("<%"+o+"?>")}}return i.push(e.substring(s)),i.join("")},n.formatNumber=function(e,t,r,n){var a=e,i=isNaN(t=Math.abs(t))?2:t,s=void 0===r?",":r,o=void 0===n?".":n,c=a<0?"-":"",u=parseInt(a=Math.abs(+a||0).toFixed(i),10)+"",l=u.length>3?u.length%3:0;return c+(l?u.substr(0,l)+o:"")+u.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+o)+(i?s+Math.abs(a-u).toFixed(i).slice(2):"")},n.formatSize=function(e){return e=e>=1073741824?n.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?n.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?n.formatNumber(e/1024,0)+" KiB":n.formatNumber(e,0)+" bytes"},n.bytesFromIP=function(e){return-1!==e.indexOf(".")?n.bytesFromIPv4(e):-1!==e.indexOf(":")?n.bytesFromIPv6(e):null},n.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=n.createBuffer(),r=0;r<e.length;++r){var a=parseInt(e[r],10);if(isNaN(a))return null;t.putByte(a)}return t.getBytes()},n.bytesFromIPv6=function(e){for(var t=0,r=2*(8-(e=e.split(":").filter((function(e){return 0===e.length&&++t,!0}))).length+t),a=n.createBuffer(),i=0;i<8;++i)if(e[i]&&0!==e[i].length){var s=n.hexToBytes(e[i]);s.length<2&&a.putByte(0),a.putBytes(s)}else a.fillWithByte(0,r),r=0;return a.getBytes()},n.bytesToIP=function(e){return 4===e.length?n.bytesToIPv4(e):16===e.length?n.bytesToIPv6(e):null},n.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".")},n.bytesToIPv6=function(e){if(16!==e.length)return null;for(var t=[],r=[],a=0,i=0;i<e.length;i+=2){for(var s=n.bytesToHex(e[i]+e[i+1]);"0"===s[0]&&"0"!==s;)s=s.substr(1);if("0"===s){var o=r[r.length-1],c=t.length;o&&c===o.end+1?(o.end=c,o.end-o.start>r[a].end-r[a].start&&(a=r.length-1)):r.push({start:c,end:c})}t.push(s)}if(r.length>0){var u=r[a];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),0===u.start&&t.unshift(""),7===u.end&&t.push(""))}return t.join(":")},n.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in n&&!e.update)return t(null,n.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return n.cores=navigator.hardwareConcurrency,t(null,n.cores);if("undefined"==typeof Worker)return n.cores=1,t(null,n.cores);if("undefined"==typeof Blob)return n.cores=2,t(null,n.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){var t=Date.now(),r=t+4;self.postMessage({st:t,et:r})}))}.toString(),")()"],{type:"application/javascript"}));!function e(a,i,s){if(0===i){var o=Math.floor(a.reduce((function(e,t){return e+t}),0)/a.length);return n.cores=Math.max(1,o),URL.revokeObjectURL(r),t(null,n.cores)}!function(e,t){for(var n=[],a=[],i=0;i<e;++i){var s=new Worker(r);s.addEventListener("message",(function(r){if(a.push(r.data),a.length===e){for(var i=0;i<e;++i)n[i].terminate();t(null,a)}})),n.push(s)}for(i=0;i<e;++i)n[i].postMessage(i)}(s,(function(t,r){a.push(function(e,t){for(var r=[],n=0;n<e;++n)for(var a=t[n],i=r[n]=[],s=0;s<e;++s)if(n!==s){var o=t[s];(a.st>o.st&&a.st<o.et||o.st>a.st&&o.st<a.et)&&i.push(s)}return r.reduce((function(e,t){return Math.max(e,t.length)}),0)}(s,r)),e(a,i-1,s)}))}([],5,16)},g.exports}function C(){if(y)return d;y=1;var e=l();m(),d=e.cipher=e.cipher||{},e.cipher.algorithms=e.cipher.algorithms||{},e.cipher.createCipher=function(t,r){var n=t;if("string"==typeof n&&(n=e.cipher.getAlgorithm(n))&&(n=n()),!n)throw new Error("Unsupported algorithm: "+t);return new e.cipher.BlockCipher({algorithm:n,key:r,decrypt:!1})},e.cipher.createDecipher=function(t,r){var n=t;if("string"==typeof n&&(n=e.cipher.getAlgorithm(n))&&(n=n()),!n)throw new Error("Unsupported algorithm: "+t);return new e.cipher.BlockCipher({algorithm:n,key:r,decrypt:!0})},e.cipher.registerAlgorithm=function(t,r){t=t.toUpperCase(),e.cipher.algorithms[t]=r},e.cipher.getAlgorithm=function(t){return(t=t.toUpperCase())in e.cipher.algorithms?e.cipher.algorithms[t]:null};var t=e.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};return t.prototype.start=function(t){t=t||{};var r={};for(var n in t)r[n]=t[n];r.decrypt=this._decrypt,this._finish=!1,this._input=e.util.createBuffer(),this.output=t.output||e.util.createBuffer(),this.mode.start(r)},t.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},t.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))},d}var E,S,T,I={exports:{}};function A(){if(E)return I.exports;E=1;var e=l();m(),e.cipher=e.cipher||{};var t=I.exports=e.cipher.modes=e.cipher.modes||{};function r(t,r){if("string"==typeof t&&(t=e.util.createBuffer(t)),e.util.isArray(t)&&t.length>4){var n=t;t=e.util.createBuffer();for(var a=0;a<n.length;++a)t.putByte(n[a])}if(t.length()<r)throw new Error("Invalid IV length; got "+t.length()+" bytes and expected "+r+" bytes.");if(!e.util.isArray(t)){var i=[],s=r/4;for(a=0;a<s;++a)i.push(t.getInt32());t=i}return t}function n(e){e[e.length-1]=e[e.length-1]+1&4294967295}function a(e){return[e/4294967296|0,4294967295&e]}return t.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},t.ecb.prototype.start=function(e){},t.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},t.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},t.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},t.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},t.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},t.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},t.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]);this._prev=this._outBlock},t.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)},t.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},t.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},t.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=e.util.createBuffer(),this._partialBytes=0},t.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a<this._ints;++a)this._inBlock[a]=e.getInt32()^this._outBlock[a],t.putInt32(this._inBlock[a]);else{var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(a=0;a<this._ints;++a)this._partialBlock[a]=e.getInt32()^this._outBlock[a],this._partialOutput.putInt32(this._partialBlock[a]);if(i>0)e.read-=this.blockSize;else for(a=0;a<this._ints;++a)this._inBlock[a]=this._partialBlock[a];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},t.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a<this._ints;++a)this._inBlock[a]=e.getInt32(),t.putInt32(this._inBlock[a]^this._outBlock[a]);else{var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(a=0;a<this._ints;++a)this._partialBlock[a]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[a]^this._outBlock[a]);if(i>0)e.read-=this.blockSize;else for(a=0;a<this._ints;++a)this._inBlock[a]=this._partialBlock[a];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},t.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=e.util.createBuffer(),this._partialBytes=0},t.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a<this._ints;++a)t.putInt32(e.getInt32()^this._outBlock[a]),this._inBlock[a]=this._outBlock[a];else{var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(a=0;a<this._ints;++a)this._partialOutput.putInt32(e.getInt32()^this._outBlock[a]);if(i>0)e.read-=this.blockSize;else for(a=0;a<this._ints;++a)this._inBlock[a]=this._outBlock[a];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},t.ofb.prototype.decrypt=t.ofb.prototype.encrypt,t.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=e.util.createBuffer(),this._partialBytes=0},t.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.ctr.prototype.encrypt=function(e,t,r){var a=e.length();if(0===a)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&a>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]);else{var s=(this.blockSize-a)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(s>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}n(this._inBlock)},t.ctr.prototype.decrypt=t.ctr.prototype.encrypt,t.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=e.util.createBuffer(),this._partialBytes=0,this._R=3774873600},t.gcm.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");var r,i=e.util.createBuffer(t.iv);if(this._cipherLength=0,r="additionalData"in t?e.util.createBuffer(t.additionalData):e.util.createBuffer(),this._tagLength="tagLength"in t?t.tagLength:128,this._tag=null,t.decrypt&&(this._tag=e.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 s=i.length();if(12===s)this._j0=[i.getInt32(),i.getInt32(),i.getInt32(),1];else{for(this._j0=[0,0,0,0];i.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[i.getInt32(),i.getInt32(),i.getInt32(),i.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(a(8*s)))}this._inBlock=this._j0.slice(0),n(this._inBlock),this._partialBytes=0,r=e.util.createBuffer(r),this._aDataLength=a(8*r.length());var o=r.length()%this.blockSize;for(o&&r.fillWithByte(0,this.blockSize-o),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},t.gcm.prototype.encrypt=function(e,t,r){var a=e.length();if(0===a)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&a>=this.blockSize){for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^=e.getInt32());this._cipherLength+=this.blockSize}else{var s=(this.blockSize-a)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(s<=0||r){if(r){var o=a%this.blockSize;this._cipherLength+=o,this._partialOutput.truncate(this.blockSize-o)}else this._cipherLength+=this.blockSize;for(i=0;i<this._ints;++i)this._outBlock[i]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),n(this._inBlock)},t.gcm.prototype.decrypt=function(e,t,r){var a=e.length();if(a<this.blockSize&&!(r&&a>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),n(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^this._hashBlock[i]);a<this.blockSize?this._cipherLength+=a%this.blockSize:this._cipherLength+=this.blockSize},t.gcm.prototype.afterFinish=function(t,r){var n=!0;r.decrypt&&r.overflow&&t.truncate(this.blockSize-r.overflow),this.tag=e.util.createBuffer();var i=this._aDataLength.concat(a(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,i);var s=[];this.cipher.encrypt(this._j0,s);for(var o=0;o<this._ints;++o)this.tag.putInt32(this._s[o]^s[o]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),r.decrypt&&this.tag.bytes()!==this._tag&&(n=!1),n},t.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],n=t.slice(0),a=0;a<128;++a){e[a/32|0]&1<<31-a%32&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n)}return r},t.gcm.prototype.pow=function(e,t){for(var r=1&e[3],n=3;n>0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},t.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=e[r/8|0]>>>4*(7-r%8)&15,a=this._m[r][n];t[0]^=a[0],t[1]^=a[1],t[2]^=a[2],t[3]^=a[3]}return t},t.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},t.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),s=0;s<a;++s){var o=[0,0,0,0],c=(n-1-s%n)*t;o[s/n|0]=1<<t-1<<c,i[s]=this.generateSubHashTable(this.multiply(o,e),t)}return i},t.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,n=r>>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i<n;){for(var s=1;s<i;++s){var o=a[i],c=a[s];a[i+s]=[o[0]^c[0],o[1]^c[1],o[2]^c[2],o[3]^c[3]]}i*=2}for(a[0]=[0,0,0,0],i=n+1;i<r;++i){var u=a[i^n];a[i]=[e[0]^u[0],e[1]^u[1],e[2]^u[2],e[3]^u[3]]}return a},I.exports}function B(){if(T)return S;T=1;var e=l();function t(t,r){e.cipher.registerAlgorithm(t,(function(){return new e.aes.Algorithm(t,r)}))}C(),A(),m(),S=e.aes=e.aes||{},e.aes.startEncrypting=function(e,t,r,n){var a=h({key:e,output:r,decrypt:!1,mode:n});return a.start(t),a},e.aes.createEncryptionCipher=function(e,t){return h({key:e,output:null,decrypt:!1,mode:t})},e.aes.startDecrypting=function(e,t,r,n){var a=h({key:e,output:r,decrypt:!0,mode:n});return a.start(t),a},e.aes.createDecryptionCipher=function(e,t){return h({key:e,output:null,decrypt:!0,mode:t})},e.aes.Algorithm=function(e,t){o||u();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return f(r._w,e,t,!1)},decrypt:function(e,t){return f(r._w,e,t,!0)}}}),r._init=!1},e.aes.Algorithm.prototype.initialize=function(t){if(!this._init){var r,n=t.key;if("string"!=typeof n||16!==n.length&&24!==n.length&&32!==n.length){if(e.util.isArray(n)&&(16===n.length||24===n.length||32===n.length)){r=n,n=e.util.createBuffer();for(var a=0;a<r.length;++a)n.putByte(r[a])}}else n=e.util.createBuffer(n);if(!e.util.isArray(n)){r=n,n=[];var i=r.length();if(16===i||24===i||32===i){i>>>=2;for(a=0;a<i;++a)n.push(r.getInt32())}}if(!e.util.isArray(n)||4!==n.length&&6!==n.length&&8!==n.length)throw new Error("Invalid key parameter.");var s=this.mode.name,o=-1!==["CFB","OFB","CTR","GCM"].indexOf(s);this._w=p(n,t.decrypt&&!o),this._init=!0}},e.aes._expandKey=function(e,t){return o||u(),p(e,t)},e.aes._updateBlock=f,t("AES-ECB",e.cipher.modes.ecb),t("AES-CBC",e.cipher.modes.cbc),t("AES-CFB",e.cipher.modes.cfb),t("AES-OFB",e.cipher.modes.ofb),t("AES-CTR",e.cipher.modes.ctr),t("AES-GCM",e.cipher.modes.gcm);var r,n,a,i,s,o=!1,c=4;function u(){o=!0,a=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;r=new Array(256),n=new Array(256),i=new Array(4),s=new Array(4);for(t=0;t<4;++t)i[t]=new Array(256),s[t]=new Array(256);var c,u,l,p,f,h,d,y=0,g=0;for(t=0;t<256;++t){p=(p=g^g<<1^g<<2^g<<3^g<<4)>>8^255&p^99,r[y]=p,n[p]=y,h=(f=e[p])<<24^p<<16^p<<8^p^f,d=((c=e[y])^(u=e[c])^(l=e[u]))<<24^(y^l)<<16^(y^u^l)<<8^y^c^l;for(var v=0;v<4;++v)i[v][y]=h,s[v][p]=d,h=h<<24|h>>>8,d=d<<24|d>>>8;0===y?y=g=1:(y=c^e[e[e[c^l]]],g^=e[e[g]])}}function p(e,t){for(var n,i=e.slice(0),o=1,u=i.length,l=c*(u+6+1),p=u;p<l;++p)n=i[p-1],p%u==0?(n=r[n>>>16&255]<<24^r[n>>>8&255]<<16^r[255&n]<<8^r[n>>>24]^a[o]<<24,o++):u>6&&p%u==4&&(n=r[n>>>24]<<24^r[n>>>16&255]<<16^r[n>>>8&255]<<8^r[255&n]),i[p]=i[p-u]^n;if(t){for(var f,h=s[0],d=s[1],y=s[2],g=s[3],v=i.slice(0),m=(p=0,(l=i.length)-c);p<l;p+=c,m-=c)if(0===p||p===l-c)v[p]=i[m],v[p+1]=i[m+3],v[p+2]=i[m+2],v[p+3]=i[m+1];else for(var C=0;C<c;++C)f=i[m+C],v[p+(3&-C)]=h[r[f>>>24]]^d[r[f>>>16&255]]^y[r[f>>>8&255]]^g[r[255&f]];i=v}return i}function f(e,t,a,o){var c,u,l,p,f,h,d,y,g,v,m,C,E=e.length/4-1;o?(c=s[0],u=s[1],l=s[2],p=s[3],f=n):(c=i[0],u=i[1],l=i[2],p=i[3],f=r),h=t[0]^e[0],d=t[o?3:1]^e[1],y=t[2]^e[2],g=t[o?1:3]^e[3];for(var S=3,T=1;T<E;++T)v=c[h>>>24]^u[d>>>16&255]^l[y>>>8&255]^p[255&g]^e[++S],m=c[d>>>24]^u[y>>>16&255]^l[g>>>8&255]^p[255&h]^e[++S],C=c[y>>>24]^u[g>>>16&255]^l[h>>>8&255]^p[255&d]^e[++S],g=c[g>>>24]^u[h>>>16&255]^l[d>>>8&255]^p[255&y]^e[++S],h=v,d=m,y=C;a[0]=f[h>>>24]<<24^f[d>>>16&255]<<16^f[y>>>8&255]<<8^f[255&g]^e[++S],a[o?3:1]=f[d>>>24]<<24^f[y>>>16&255]<<16^f[g>>>8&255]<<8^f[255&h]^e[++S],a[2]=f[y>>>24]<<24^f[g>>>16&255]<<16^f[h>>>8&255]<<8^f[255&d]^e[++S],a[o?1:3]=f[g>>>24]<<24^f[h>>>16&255]<<16^f[d>>>8&255]<<8^f[255&y]^e[++S]}function h(t){var r,n="AES-"+((t=t||{}).mode||"CBC").toUpperCase(),a=(r=t.decrypt?e.cipher.createDecipher(n,t.key):e.cipher.createCipher(n,t.key)).start;return r.start=function(t,n){var i=null;n instanceof e.util.ByteBuffer&&(i=n,n={}),(n=n||{}).output=i,n.iv=t,a.call(r,n)},r}return S}var b,N,R={exports:{}},w={exports:{}},_={exports:{}};function L(){if(b)return _.exports;b=1;var e=l();e.pki=e.pki||{};var t=_.exports=e.pki.oids=e.oids=e.oids||{};function r(e,r){t[e]=r,t[r]=e}function n(e,r){t[e]=r}return r("1.2.840.113549.1.1.1","rsaEncryption"),r("1.2.840.113549.1.1.4","md5WithRSAEncryption"),r("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),r("1.2.840.113549.1.1.7","RSAES-OAEP"),r("1.2.840.113549.1.1.8","mgf1"),r("1.2.840.113549.1.1.9","pSpecified"),r("1.2.840.113549.1.1.10","RSASSA-PSS"),r("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),r("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),r("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),r("1.3.101.112","EdDSA25519"),r("1.2.840.10040.4.3","dsa-with-sha1"),r("1.3.14.3.2.7","desCBC"),r("1.3.14.3.2.26","sha1"),r("1.3.14.3.2.29","sha1WithRSASignature"),r("2.16.840.1.101.3.4.2.1","sha256"),r("2.16.840.1.101.3.4.2.2","sha384"),r("2.16.840.1.101.3.4.2.3","sha512"),r("2.16.840.1.101.3.4.2.4","sha224"),r("2.16.840.1.101.3.4.2.5","sha512-224"),r("2.16.840.1.101.3.4.2.6","sha512-256"),r("1.2.840.113549.2.2","md2"),r("1.2.840.113549.2.5","md5"),r("1.2.840.113549.1.7.1","data"),r("1.2.840.113549.1.7.2","signedData"),r("1.2.840.113549.1.7.3","envelopedData"),r("1.2.840.113549.1.7.4","signedAndEnvelopedData"),r("1.2.840.113549.1.7.5","digestedData"),r("1.2.840.113549.1.7.6","encryptedData"),r("1.2.840.113549.1.9.1","emailAddress"),r("1.2.840.113549.1.9.2","unstructuredName"),r("1.2.840.113549.1.9.3","contentType"),r("1.2.840.113549.1.9.4","messageDigest"),r("1.2.840.113549.1.9.5","signingTime"),r("1.2.840.113549.1.9.6","counterSignature"),r("1.2.840.113549.1.9.7","challengePassword"),r("1.2.840.113549.1.9.8","unstructuredAddress"),r("1.2.840.113549.1.9.14","extensionRequest"),r("1.2.840.113549.1.9.20","friendlyName"),r("1.2.840.113549.1.9.21","localKeyId"),r("1.2.840.113549.1.9.22.1","x509Certificate"),r("1.2.840.113549.1.12.10.1.1","keyBag"),r("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),r("1.2.840.113549.1.12.10.1.3","certBag"),r("1.2.840.113549.1.12.10.1.4","crlBag"),r("1.2.840.113549.1.12.10.1.5","secretBag"),r("1.2.840.113549.1.12.10.1.6","safeContentsBag"),r("1.2.840.113549.1.5.13","pkcs5PBES2"),r("1.2.840.113549.1.5.12","pkcs5PBKDF2"),r("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),r("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),r("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),r("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),r("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),r("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),r("1.2.840.113549.2.7","hmacWithSHA1"),r("1.2.840.113549.2.8","hmacWithSHA224"),r("1.2.840.113549.2.9","hmacWithSHA256"),r("1.2.840.113549.2.10","hmacWithSHA384"),r("1.2.840.113549.2.11","hmacWithSHA512"),r("1.2.840.113549.3.7","des-EDE3-CBC"),r("2.16.840.1.101.3.4.1.2","aes128-CBC"),r("2.16.840.1.101.3.4.1.22","aes192-CBC"),r("2.16.840.1.101.3.4.1.42","aes256-CBC"),r("2.5.4.3","commonName"),r("2.5.4.4","surname"),r("2.5.4.5","serialNumber"),r("2.5.4.6","countryName"),r("2.5.4.7","localityName"),r("2.5.4.8","stateOrProvinceName"),r("2.5.4.9","streetAddress"),r("2.5.4.10","organizationName"),r("2.5.4.11","organizationalUnitName"),r("2.5.4.12","title"),r("2.5.4.13","description"),r("2.5.4.15","businessCategory"),r("2.5.4.17","postalCode"),r("2.5.4.42","givenName"),r("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),r("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),r("2.16.840.1.113730.1.1","nsCertType"),r("2.16.840.1.113730.1.13","nsComment"),n("2.5.29.1","authorityKeyIdentifier"),n("2.5.29.2","keyAttributes"),n("2.5.29.3","certificatePolicies"),n("2.5.29.4","keyUsageRestriction"),n("2.5.29.5","policyMapping"),n("2.5.29.6","subtreesConstraint"),n("2.5.29.7","subjectAltName"),n("2.5.29.8","issuerAltName"),n("2.5.29.9","subjectDirectoryAttributes"),n("2.5.29.10","basicConstraints"),n("2.5.29.11","nameConstraints"),n("2.5.29.12","policyConstraints"),n("2.5.29.13","basicConstraints"),r("2.5.29.14","subjectKeyIdentifier"),r("2.5.29.15","keyUsage"),n("2.5.29.16","privateKeyUsagePeriod"),r("2.5.29.17","subjectAltName"),r("2.5.29.18","issuerAltName"),r("2.5.29.19","basicConstraints"),n("2.5.29.20","cRLNumber"),n("2.5.29.21","cRLReason"),n("2.5.29.22","expirationDate"),n("2.5.29.23","instructionCode"),n("2.5.29.24","invalidityDate"),n("2.5.29.25","cRLDistributionPoints"),n("2.5.29.26","issuingDistributionPoint"),n("2.5.29.27","deltaCRLIndicator"),n("2.5.29.28","issuingDistributionPoint"),n("2.5.29.29","certificateIssuer"),n("2.5.29.30","nameConstraints"),r("2.5.29.31","cRLDistributionPoints"),r("2.5.29.32","certificatePolicies"),n("2.5.29.33","policyMappings"),n("2.5.29.34","policyConstraints"),r("2.5.29.35","authorityKeyIdentifier"),n("2.5.29.36","policyConstraints"),r("2.5.29.37","extKeyUsage"),n("2.5.29.46","freshestCRL"),n("2.5.29.54","inhibitAnyPolicy"),r("1.3.6.1.4.1.11129.2.4.2","timestampList"),r("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),r("1.3.6.1.5.5.7.3.1","serverAuth"),r("1.3.6.1.5.5.7.3.2","clientAuth"),r("1.3.6.1.5.5.7.3.3","codeSigning"),r("1.3.6.1.5.5.7.3.4","emailProtection"),r("1.3.6.1.5.5.7.3.8","timeStamping"),_.exports}function k(){if(N)return w.exports;N=1;var e=l();m(),L();var t=w.exports=e.asn1=e.asn1||{};function r(e,t,r){if(r>t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}t.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},t.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},t.create=function(r,n,a,i,s){if(e.util.isArray(i)){for(var o=[],c=0;c<i.length;++c)void 0!==i[c]&&o.push(i[c]);i=o}var u={tagClass:r,type:n,constructed:a,composed:a||e.util.isArray(i),value:i};return s&&"bitStringContents"in s&&(u.bitStringContents=s.bitStringContents,u.original=t.copy(u)),u},t.copy=function(r,n){var a;if(e.util.isArray(r)){a=[];for(var i=0;i<r.length;++i)a.push(t.copy(r[i],n));return a}return"string"==typeof r?r:(a={tagClass:r.tagClass,type:r.type,constructed:r.constructed,composed:r.composed,value:t.copy(r.value,n)},n&&!n.excludeBitStringContents&&(a.bitStringContents=r.bitStringContents),a)},t.equals=function(r,n,a){if(e.util.isArray(r)){if(!e.util.isArray(n))return!1;if(r.length!==n.length)return!1;for(var i=0;i<r.length;++i)if(!t.equals(r[i],n[i]))return!1;return!0}if(typeof r!=typeof n)return!1;if("string"==typeof r)return r===n;var s=r.tagClass===n.tagClass&&r.type===n.type&&r.constructed===n.constructed&&r.composed===n.composed&&t.equals(r.value,n.value);return a&&a.includeBitStringContents&&(s=s&&r.bitStringContents===n.bitStringContents),s},t.getBerValueLength=function(e){var t=e.getByte();if(128!==t)return 128&t?e.getInt((127&t)<<3):t};function n(e,a,i,s){var o;r(e,a,2);var c=e.getByte();a--;var u=192&c,l=31&c;o=e.length();var p,f,h=function(e,t){var n=e.getByte();if(t--,128!==n){var a;if(128&n){var i=127&n;r(e,t,i),a=e.getInt(i<<3)}else a=n;if(a<0)throw new Error("Negative length: "+a);return a}}(e,a);if(a-=o-e.length(),void 0!==h&&h>a){if(s.strict){var d=new Error("Too few bytes to read ASN.1 value.");throw d.available=e.length(),d.remaining=a,d.requested=h,d}h=a}var y=32==(32&c);if(y)if(p=[],void 0===h)for(;;){if(r(e,a,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),a-=2;break}o=e.length(),p.push(n(e,a,i+1,s)),a-=o-e.length()}else for(;h>0;)o=e.length(),p.push(n(e,h,i+1,s)),a-=o-e.length(),h-=o-e.length();if(void 0===p&&u===t.Class.UNIVERSAL&&l===t.Type.BITSTRING&&(f=e.bytes(h)),void 0===p&&s.decodeBitStrings&&u===t.Class.UNIVERSAL&&l===t.Type.BITSTRING&&h>1){var g=e.read,v=a,m=0;if(l===t.Type.BITSTRING&&(r(e,a,1),m=e.getByte(),a--),0===m)try{o=e.length();var C=n(e,a,i+1,{strict:!0,decodeBitStrings:!0}),E=o-e.length();a-=E,l==t.Type.BITSTRING&&E++;var S=C.tagClass;E!==h||S!==t.Class.UNIVERSAL&&S!==t.Class.CONTEXT_SPECIFIC||(p=[C])}catch(e){}void 0===p&&(e.read=g,a=v)}if(void 0===p){if(void 0===h){if(s.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");h=a}if(l===t.Type.BMPSTRING)for(p="";h>0;h-=2)r(e,a,2),p+=String.fromCharCode(e.getInt16()),a-=2;else p=e.getBytes(h),a-=h}var T=void 0===f?null:{bitStringContents:f};return t.create(u,l,y,p,T)}t.fromDer=function(t,r){void 0===r&&(r={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),"boolean"==typeof r&&(r={strict:r,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in r||(r.strict=!0),"parseAllBytes"in r||(r.parseAllBytes=!0),"decodeBitStrings"in r||(r.decodeBitStrings=!0),"string"==typeof t&&(t=e.util.createBuffer(t));var a=t.length(),i=n(t,t.length(),0,r);if(r.parseAllBytes&&0!==t.length()){var s=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw s.byteCount=a,s.remaining=t.length(),s}return i},t.toDer=function(r){var n=e.util.createBuffer(),a=r.tagClass|r.type,i=e.util.createBuffer(),s=!1;if("bitStringContents"in r&&(s=!0,r.original&&(s=t.equals(r,r.original))),s)i.putBytes(r.bitStringContents);else if(r.composed){r.constructed?a|=32:i.putByte(0);for(var o=0;o<r.value.length;++o)void 0!==r.value[o]&&i.putBuffer(t.toDer(r.value[o]))}else if(r.type===t.Type.BMPSTRING)for(o=0;o<r.value.length;++o)i.putInt16(r.value.charCodeAt(o));else r.type===t.Type.INTEGER&&r.value.length>1&&(0===r.value.charCodeAt(0)&&0==(128&r.value.charCodeAt(1))||255===r.value.charCodeAt(0)&&128==(128&r.value.charCodeAt(1)))?i.putBytes(r.value.substr(1)):i.putBytes(r.value);if(n.putByte(a),i.length()<=127)n.putByte(127&i.length());else{var c=i.length(),u="";do{u+=String.fromCharCode(255&c),c>>>=8}while(c>0);n.putByte(128|u.length);for(o=u.length-1;o>=0;--o)n.putByte(u.charCodeAt(o))}return n.putBuffer(i),n},t.oidToDer=function(t){var r,n,a,i,s=t.split("."),o=e.util.createBuffer();o.putByte(40*parseInt(s[0],10)+parseInt(s[1],10));for(var c=2;c<s.length;++c){r=!0,n=[],a=parseInt(s[c],10);do{i=127&a,a>>>=7,r||(i|=128),n.push(i),r=!1}while(a>0);for(var u=n.length-1;u>=0;--u)o.putByte(n[u])}return o},t.derToOid=function(t){var r;"string"==typeof t&&(t=e.util.createBuffer(t));var n=t.getByte();r=Math.floor(n/40)+"."+n%40;for(var a=0;t.length()>0;)a<<=7,128&(n=t.getByte())?a+=127&n:(r+="."+(a+n),a=0);return r},t.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,a=parseInt(e.substr(4,2),10),i=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),o=0;if(e.length>11){var c=e.charAt(10),u=10;"+"!==c&&"-"!==c&&(o=parseInt(e.substr(10,2),10),u+=2)}if(t.setUTCFullYear(r,n,a),t.setUTCHours(i,s,o,0),u&&("+"===(c=e.charAt(u))||"-"===c)){var l=60*parseInt(e.substr(u+1,2),10)+parseInt(e.substr(u+4,2),10);l*=6e4,"+"===c?t.setTime(+t-l):t.setTime(+t+l)}return t},t.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,a=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),o=parseInt(e.substr(12,2),10),c=0,u=0,l=!1;"Z"===e.charAt(e.length-1)&&(l=!0);var p=e.length-5,f=e.charAt(p);"+"!==f&&"-"!==f||(u=60*parseInt(e.substr(p+1,2),10)+parseInt(e.substr(p+4,2),10),u*=6e4,"+"===f&&(u*=-1),l=!0);return"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),l?(t.setUTCFullYear(r,n,a),t.setUTCHours(i,s,o,c),t.setTime(+t+u)):(t.setFullYear(r,n,a),t.setHours(i,s,o,c)),t},t.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},t.dateToGeneralizedTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},t.integerToDer=function(t){var r=e.util.createBuffer();if(t>=-128&&t<128)return r.putSignedInt(t,8);if(t>=-32768&&t<32768)return r.putSignedInt(t,16);if(t>=-8388608&&t<8388608)return r.putSignedInt(t,24);if(t>=-2147483648&&t<2147483648)return r.putSignedInt(t,32);var n=new Error("Integer too large; max is 32-bits.");throw n.integer=t,n},t.derToInteger=function(t){"string"==typeof t&&(t=e.util.createBuffer(t));var r=8*t.length();if(r>32)throw new Error("Integer too large; max is 32-bits.");return t.getSignedInt(r)},t.validate=function(r,n,a,i){var s=!1;if(r.tagClass!==n.tagClass&&void 0!==n.tagClass||r.type!==n.type&&void 0!==n.type)i&&(r.tagClass!==n.tagClass&&i.push("["+n.name+'] Expected tag class "'+n.tagClass+'", got "'+r.tagClass+'"'),r.type!==n.type&&i.push("["+n.name+'] Expected type "'+n.type+'", got "'+r.type+'"'));else if(r.constructed===n.constructed||void 0===n.constructed){if(s=!0,n.value&&e.util.isArray(n.value))for(var o=0,c=0;s&&c<n.value.length;++c)s=n.value[c].optional||!1,r.value[o]&&((s=t.validate(r.value[o],n.value[c],a,i))?++o:n.value[c].optional&&(s=!0)),!s&&i&&i.push("["+n.name+'] Tag class "'+n.tagClass+'", type "'+n.type+'" expected value length "'+n.value.length+'", got "'+r.value.length+'"');if(s&&a&&(n.capture&&(a[n.capture]=r.value),n.captureAsn1&&(a[n.captureAsn1]=r),n.captureBitStringContents&&"bitStringContents"in r&&(a[n.captureBitStringContents]=r.bitStringContents),n.captureBitStringValue&&"bitStringContents"in r))if(r.bitStringContents.length<2)a[n.captureBitStringValue]="";else{if(0!==r.bitStringContents.charCodeAt(0))throw new Error("captureBitStringValue only supported for zero unused bits");a[n.captureBitStringValue]=r.bitStringContents.slice(1)}}else i&&i.push("["+n.name+'] Expected constructed "'+n.constructed+'", got "'+r.constructed+'"');return s};var a=/[^\\u0000-\\u00ff]/;return t.prettyPrint=function(r,n,i){var s="";i=i||2,(n=n||0)>0&&(s+="\n");for(var o="",c=0;c<n*i;++c)o+=" ";switch(s+=o+"Tag: ",r.tagClass){case t.Class.UNIVERSAL:s+="Universal:";break;case t.Class.APPLICATION:s+="Application:";break;case t.Class.CONTEXT_SPECIFIC:s+="Context-Specific:";break;case t.Class.PRIVATE:s+="Private:"}if(r.tagClass===t.Class.UNIVERSAL)switch(s+=r.type,r.type){case t.Type.NONE:s+=" (None)";break;case t.Type.BOOLEAN:s+=" (Boolean)";break;case t.Type.INTEGER:s+=" (Integer)";break;case t.Type.BITSTRING:s+=" (Bit string)";break;case t.Type.OCTETSTRING:s+=" (Octet string)";break;case t.Type.NULL:s+=" (Null)";break;case t.Type.OID:s+=" (Object Identifier)";break;case t.Type.ODESC:s+=" (Object Descriptor)";break;case t.Type.EXTERNAL:s+=" (External or Instance of)";break;case t.Type.REAL:s+=" (Real)";break;case t.Type.ENUMERATED:s+=" (Enumerated)";break;case t.Type.EMBEDDED:s+=" (Embedded PDV)";break;case t.Type.UTF8:s+=" (UTF8)";break;case t.Type.ROID:s+=" (Relative Object Identifier)";break;case t.Type.SEQUENCE:s+=" (Sequence)";break;case t.Type.SET:s+=" (Set)";break;case t.Type.PRINTABLESTRING:s+=" (Printable String)";break;case t.Type.IA5String:s+=" (IA5String (ASCII))";break;case t.Type.UTCTIME:s+=" (UTC time)";break;case t.Type.GENERALIZEDTIME:s+=" (Generalized time)";break;case t.Type.BMPSTRING:s+=" (BMP String)"}else s+=r.type;if(s+="\n",s+=o+"Constructed: "+r.constructed+"\n",r.composed){var u=0,l="";for(c=0;c<r.value.length;++c)void 0!==r.value[c]&&(u+=1,l+=t.prettyPrint(r.value[c],n+1,i),c+1<r.value.length&&(l+=","));s+=o+"Sub values: "+u+l}else{if(s+=o+"Value: ",r.type===t.Type.OID){var p=t.derToOid(r.value);s+=p,e.pki&&e.pki.oids&&p in e.pki.oids&&(s+=" ("+e.pki.oids[p]+") ")}if(r.type===t.Type.INTEGER)try{s+=t.derToInteger(r.value)}catch(t){s+="0x"+e.util.bytesToHex(r.value)}else if(r.type===t.Type.BITSTRING){if(r.value.length>1?s+="0x"+e.util.bytesToHex(r.value.slice(1)):s+="(none)",r.value.length>0){var f=r.value.charCodeAt(0);1==f?s+=" (1 unused bit shown)":f>1&&(s+=" ("+f+" unused bits shown)")}}else if(r.type===t.Type.OCTETSTRING)a.test(r.value)||(s+="("+r.value+") "),s+="0x"+e.util.bytesToHex(r.value);else if(r.type===t.Type.UTF8)try{s+=e.util.decodeUtf8(r.value)}catch(t){if("URI malformed"!==t.message)throw t;s+="0x"+e.util.bytesToHex(r.value)+" (malformed UTF8)"}else r.type===t.Type.PRINTABLESTRING||r.type===t.Type.IA5String?s+=r.value:a.test(r.value)?s+="0x"+e.util.bytesToHex(r.value):0===r.value.length?s+="[null]":s+=r.value}return s},w.exports}var U,D,P,V={exports:{}};function O(){if(D)return U;D=1;var e=l();return U=e.md=e.md||{},e.md.algorithms=e.md.algorithms||{},U}function x(){if(P)return V.exports;P=1;var e=l();return O(),m(),(V.exports=e.hmac=e.hmac||{}).create=function(){var t=null,r=null,n=null,a=null,i={start:function(i,s){if(null!==i)if("string"==typeof i){if(!((i=i.toLowerCase())in e.md.algorithms))throw new Error('Unknown hash algorithm "'+i+'"');r=e.md.algorithms[i].create()}else r=i;if(null===s)s=t;else{if("string"==typeof s)s=e.util.createBuffer(s);else if(e.util.isArray(s)){var o=s;s=e.util.createBuffer();for(var c=0;c<o.length;++c)s.putByte(o[c])}var u=s.length();u>r.blockLength&&(r.start(),r.update(s.bytes()),s=r.digest()),n=e.util.createBuffer(),a=e.util.createBuffer(),u=s.length();for(c=0;c<u;++c){o=s.at(c);n.putByte(54^o),a.putByte(92^o)}if(u<r.blockLength)for(o=r.blockLength-u,c=0;c<o;++c)n.putByte(54),a.putByte(92);t=s,n=n.bytes(),a=a.bytes()}r.start(),r.update(n)},update:function(e){r.update(e)},getMac:function(){var e=r.digest().bytes();return r.start(),r.update(a),r.update(e),r.digest()}};return i.digest=i.getMac,i},V.exports}var K,M={exports:{}};function F(){if(K)return M.exports;K=1;var e=l();O(),m();var t=M.exports=e.md5=e.md5||{};e.md.md5=e.md.algorithms.md5=t,t.create=function(){s||function(){r=String.fromCharCode(128),r+=e.util.fillString(String.fromCharCode(0),64),n=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],a=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],i=new Array(64);for(var t=0;t<64;++t)i[t]=Math.floor(4294967296*Math.abs(Math.sin(t+1)));s=!0}();var t=null,c=e.util.createBuffer(),u=new Array(16),l={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){l.messageLength=0,l.fullMessageLength=l.messageLength64=[];for(var r=l.messageLengthSize/4,n=0;n<r;++n)l.fullMessageLength.push(0);return c=e.util.createBuffer(),t={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},l}};return l.start(),l.update=function(r,n){"utf8"===n&&(r=e.util.encodeUtf8(r));var a=r.length;l.messageLength+=a,a=[a/4294967296>>>0,a>>>0];for(var i=l.fullMessageLength.length-1;i>=0;--i)l.fullMessageLength[i]+=a[1],a[1]=a[0]+(l.fullMessageLength[i]/4294967296>>>0),l.fullMessageLength[i]=l.fullMessageLength[i]>>>0,a[0]=a[1]/4294967296>>>0;return c.putBytes(r),o(t,u,c),(c.read>2048||0===c.length())&&c.compact(),l},l.digest=function(){var n=e.util.createBuffer();n.putBytes(c.bytes());var a=l.fullMessageLength[l.fullMessageLength.length-1]+l.messageLengthSize&l.blockLength-1;n.putBytes(r.substr(0,l.blockLength-a));for(var i,s=0,p=l.fullMessageLength.length-1;p>=0;--p)s=(i=8*l.fullMessageLength[p]+s)/4294967296>>>0,n.putInt32Le(i>>>0);var f={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3};o(f,u,n);var h=e.util.createBuffer();return h.putInt32Le(f.h0),h.putInt32Le(f.h1),h.putInt32Le(f.h2),h.putInt32Le(f.h3),h},l};var r=null,n=null,a=null,i=null,s=!1;function o(e,t,r){for(var s,o,c,u,l,p,f,h=r.length();h>=64;){for(o=e.h0,c=e.h1,u=e.h2,l=e.h3,f=0;f<16;++f)t[f]=r.getInt32Le(),s=o+(l^c&(u^l))+i[f]+t[f],o=l,l=u,u=c,c+=s<<(p=a[f])|s>>>32-p;for(;f<32;++f)s=o+(u^l&(c^u))+i[f]+t[n[f]],o=l,l=u,u=c,c+=s<<(p=a[f])|s>>>32-p;for(;f<48;++f)s=o+(c^u^l)+i[f]+t[n[f]],o=l,l=u,u=c,c+=s<<(p=a[f])|s>>>32-p;for(;f<64;++f)s=o+(u^(c|~l))+i[f]+t[n[f]],o=l,l=u,u=c,c+=s<<(p=a[f])|s>>>32-p;e.h0=e.h0+o|0,e.h1=e.h1+c|0,e.h2=e.h2+u|0,e.h3=e.h3+l|0,h-=64}}return M.exports}var j,q={exports:{}};function G(){if(j)return q.exports;j=1;var e=l();m();var t=q.exports=e.pem=e.pem||{};function r(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},a=0;a<e.values.length;++a)r.push(e.values[a].replace(/^(\S+\r\n)/,n));t+=r.join(",")+"\r\n";var i=0,s=-1;for(a=0;a<t.length;++a,++i)if(i>65&&-1!==s){var o=t[s];","===o?(++s,t=t.substr(0,s)+"\r\n "+t.substr(s)):t=t.substr(0,s)+"\r\n"+o+t.substr(s+1),i=a-s-1,s=-1,++a}else" "!==t[a]&&"\t"!==t[a]&&","!==t[a]||(s=a);return t}function n(e){return e.replace(/^\s+/,"")}return t.encode=function(t,n){n=n||{};var a,i="-----BEGIN "+t.type+"-----\r\n";if(t.procType&&(i+=r(a={name:"Proc-Type",values:[String(t.procType.version),t.procType.type]})),t.contentDomain&&(i+=r(a={name:"Content-Domain",values:[t.contentDomain]})),t.dekInfo&&(a={name:"DEK-Info",values:[t.dekInfo.algorithm]},t.dekInfo.parameters&&a.values.push(t.dekInfo.parameters),i+=r(a)),t.headers)for(var s=0;s<t.headers.length;++s)i+=r(t.headers[s]);return t.procType&&(i+="\r\n"),i+=e.util.encode64(t.body,n.maxline||64)+"\r\n",i+="-----END "+t.type+"-----\r\n"},t.decode=function(t){for(var r,a=[],i=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,s=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,o=/\r?\n/;r=i.exec(t);){var c=r[1];"NEW CERTIFICATE REQUEST"===c&&(c="CERTIFICATE REQUEST");var u={type:c,procType:null,contentDomain:null,dekInfo:null,headers:[],body:e.util.decode64(r[3])};if(a.push(u),r[2]){for(var l=r[2].split(o),p=0;r&&p<l.length;){for(var f=l[p].replace(/\s+$/,""),h=p+1;h<l.length;++h){var d=l[h];if(!/\s/.test(d[0]))break;f+=d,p=h}if(r=f.match(s)){for(var y={name:r[1],values:[]},g=r[2].split(","),v=0;v<g.length;++v)y.values.push(n(g[v]));if(u.procType)if(u.contentDomain||"Content-Domain"!==y.name)if(u.dekInfo||"DEK-Info"!==y.name)u.headers.push(y);else{if(0===y.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');u.dekInfo={algorithm:g[0],parameters:g[1]||null}}else u.contentDomain=g[0]||"";else{if("Proc-Type"!==y.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==y.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');u.procType={version:g[0],type:g[1]}}}++p}if("ENCRYPTED"===u.procType&&!u.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===a.length)throw new Error("Invalid PEM formatted message.");return a},q.exports}var H,Q,z,Y,X={exports:{}};function W(){if(Q)return H;Q=1;var e=l();function t(t,r){e.cipher.registerAlgorithm(t,(function(){return new e.des.Algorithm(t,r)}))}C(),A(),m(),H=e.des=e.des||{},e.des.startEncrypting=function(e,t,r,n){var a=f({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},e.des.createEncryptionCipher=function(e,t){return f({key:e,output:null,decrypt:!1,mode:t})},e.des.startDecrypting=function(e,t,r,n){var a=f({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return a.start(t),a},e.des.createDecryptionCipher=function(e,t){return f({key:e,output:null,decrypt:!0,mode:t})},e.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return p(r._keys,e,t,!1)},decrypt:function(e,t){return p(r._keys,e,t,!0)}}}),r._init=!1},e.des.Algorithm.prototype.initialize=function(t){if(!this._init){var r=e.util.createBuffer(t.key);if(0===this.name.indexOf("3DES")&&24!==r.length())throw new Error("Invalid Triple-DES key size: "+8*r.length());this._keys=function(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],n=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],a=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],i=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],o=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],c=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],u=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],p=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],f=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],h=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],d=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],g=e.length()>8?3:1,v=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],C=0,E=0;E<g;E++){var S=e.getInt32(),T=e.getInt32();S^=(t=252645135&(S>>>4^T))<<4,S^=t=65535&((T^=t)>>>-16^S),S^=(t=858993459&(S>>>2^(T^=t<<-16)))<<2,S^=t=65535&((T^=t)>>>-16^S),S^=(t=1431655765&(S>>>1^(T^=t<<-16)))<<1,S^=t=16711935&((T^=t)>>>8^S),t=(S^=(t=1431655765&(S>>>1^(T^=t<<8)))<<1)<<8|(T^=t)>>>20&240,S=T<<24|T<<8&16711680|T>>>8&65280|T>>>24&240,T=t;for(var I=0;I<m.length;++I){m[I]?(S=S<<2|S>>>26,T=T<<2|T>>>26):(S=S<<1|S>>>27,T=T<<1|T>>>27),T&=-15;var A=r[(S&=-15)>>>28]|n[S>>>24&15]|a[S>>>20&15]|i[S>>>16&15]|s[S>>>12&15]|o[S>>>8&15]|c[S>>>4&15],B=u[T>>>28]|l[T>>>24&15]|p[T>>>20&15]|f[T>>>16&15]|h[T>>>12&15]|d[T>>>8&15]|y[T>>>4&15];t=65535&(B>>>16^A),v[C++]=A^t,v[C++]=B^t<<16}}return v}(r),this._init=!0}},t("DES-ECB",e.cipher.modes.ecb),t("DES-CBC",e.cipher.modes.cbc),t("DES-CFB",e.cipher.modes.cfb),t("DES-OFB",e.cipher.modes.ofb),t("DES-CTR",e.cipher.modes.ctr),t("3DES-ECB",e.cipher.modes.ecb),t("3DES-CBC",e.cipher.modes.cbc),t("3DES-CFB",e.cipher.modes.cfb),t("3DES-OFB",e.cipher.modes.ofb),t("3DES-CTR",e.cipher.modes.ctr);var r=[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],n=[-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],a=[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],i=[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],s=[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],o=[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],c=[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],u=[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 p(e,t,l,p){var f,h,d=32===e.length?3:9;f=3===d?p?[30,-2,-2]:[0,32,2]:p?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var y=t[0],g=t[1];y^=(h=252645135&(y>>>4^g))<<4,y^=(h=65535&(y>>>16^(g^=h)))<<16,y^=h=858993459&((g^=h)>>>2^y),y^=h=16711935&((g^=h<<2)>>>8^y),y=(y^=(h=1431655765&(y>>>1^(g^=h<<8)))<<1)<<1|y>>>31,g=(g^=h)<<1|g>>>31;for(var v=0;v<d;v+=3){for(var m=f[v+1],C=f[v+2],E=f[v];E!=m;E+=C){var S=g^e[E],T=(g>>>4|g<<28)^e[E+1];h=y,y=g,g=h^(n[S>>>24&63]|i[S>>>16&63]|o[S>>>8&63]|u[63&S]|r[T>>>24&63]|a[T>>>16&63]|s[T>>>8&63]|c[63&T])}h=y,y=g,g=h}g=g>>>1|g<<31,g^=h=1431655765&((y=y>>>1|y<<31)>>>1^g),g^=(h=16711935&(g>>>8^(y^=h<<1)))<<8,g^=(h=858993459&(g>>>2^(y^=h)))<<2,g^=h=65535&((y^=h)>>>16^g),g^=h=252645135&((y^=h<<16)>>>4^g),y^=h<<4,l[0]=y,l[1]=g}function f(t){var r,n="DES-"+((t=t||{}).mode||"CBC").toUpperCase(),a=(r=t.decrypt?e.cipher.createDecipher(n,t.key):e.cipher.createCipher(n,t.key)).start;return r.start=function(t,n){var i=null;n instanceof e.util.ByteBuffer&&(i=n,n={}),(n=n||{}).output=i,n.iv=t,a.call(r,n)},r}return H}function Z(){if(Y)return z;Y=1;var e=l();x(),O(),m();var t,n=e.pkcs5=e.pkcs5||{};return e.util.isNodejs&&!e.options.usePureJavaScript&&(t=r),z=e.pbkdf2=n.pbkdf2=function(r,n,a,i,s,o){if("function"==typeof s&&(o=s,s=null),e.util.isNodejs&&!e.options.usePureJavaScript&&t.pbkdf2&&(null===s||"object"!=typeof s)&&(t.pbkdf2Sync.length>4||!s||"sha1"===s))return"string"!=typeof s&&(s="sha1"),r=Buffer.from(r,"binary"),n=Buffer.from(n,"binary"),o?4===t.pbkdf2Sync.length?t.pbkdf2(r,n,a,i,(function(e,t){if(e)return o(e);o(null,t.toString("binary"))})):t.pbkdf2(r,n,a,i,s,(function(e,t){if(e)return o(e);o(null,t.toString("binary"))})):4===t.pbkdf2Sync.length?t.pbkdf2Sync(r,n,a,i).toString("binary"):t.pbkdf2Sync(r,n,a,i,s).toString("binary");if(null==s&&(s="sha1"),"string"==typeof s){if(!(s in e.md.algorithms))throw new Error("Unknown hash algorithm: "+s);s=e.md[s].create()}var c=s.digestLength;if(i>4294967295*c){var u=new Error("Derived key is too long.");if(o)return o(u);throw u}var l=Math.ceil(i/c),p=i-(l-1)*c,f=e.hmac.create();f.start(s,r);var h,d,y,g="";if(!o){for(var v=1;v<=l;++v){f.start(null,null),f.update(n),f.update(e.util.int32ToBytes(v)),h=y=f.digest().getBytes();for(var m=2;m<=a;++m)f.start(null,null),f.update(y),d=f.digest().getBytes(),h=e.util.xorBytes(h,d,c),y=d;g+=v<l?h:h.substr(0,p)}return g}v=1;function C(){if(v>l)return o(null,g);f.start(null,null),f.update(n),f.update(e.util.int32ToBytes(v)),h=y=f.digest().getBytes(),m=2,E()}function E(){if(m<=a)return f.start(null,null),f.update(y),d=f.digest().getBytes(),h=e.util.xorBytes(h,d,c),y=d,++m,e.util.setImmediate(E);g+=v<l?h:h.substr(0,p),++v,C()}C()},z}var $,J={exports:{}},ee={exports:{}};function te(){if($)return ee.exports;$=1;var e=l();O(),m();var t=ee.exports=e.sha256=e.sha256||{};e.md.sha256=e.md.algorithms.sha256=t,t.create=function(){n||(r=String.fromCharCode(128),r+=e.util.fillString(String.fromCharCode(0),64),a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],n=!0);var t=null,s=e.util.createBuffer(),o=new Array(64),c={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){c.messageLength=0,c.fullMessageLength=c.messageLength64=[];for(var r=c.messageLengthSize/4,n=0;n<r;++n)c.fullMessageLength.push(0);return s=e.util.createBuffer(),t={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},c}};return c.start(),c.update=function(r,n){"utf8"===n&&(r=e.util.encodeUtf8(r));var a=r.length;c.messageLength+=a,a=[a/4294967296>>>0,a>>>0];for(var u=c.fullMessageLength.length-1;u>=0;--u)c.fullMessageLength[u]+=a[1],a[1]=a[0]+(c.fullMessageLength[u]/4294967296>>>0),c.fullMessageLength[u]=c.fullMessageLength[u]>>>0,a[0]=a[1]/4294967296>>>0;return s.putBytes(r),i(t,o,s),(s.read>2048||0===s.length())&&s.compact(),c},c.digest=function(){var n=e.util.createBuffer();n.putBytes(s.bytes());var a,u=c.fullMessageLength[c.fullMessageLength.length-1]+c.messageLengthSize&c.blockLength-1;n.putBytes(r.substr(0,c.blockLength-u));for(var l=8*c.fullMessageLength[0],p=0;p<c.fullMessageLength.length-1;++p)l+=(a=8*c.fullMessageLength[p+1])/4294967296>>>0,n.putInt32(l>>>0),l=a>>>0;n.putInt32(l);var f={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4,h5:t.h5,h6:t.h6,h7:t.h7};i(f,o,n);var h=e.util.createBuffer();return h.putInt32(f.h0),h.putInt32(f.h1),h.putInt32(f.h2),h.putInt32(f.h3),h.putInt32(f.h4),h.putInt32(f.h5),h.putInt32(f.h6),h.putInt32(f.h7),h},c};var r=null,n=!1,a=null;function i(e,t,r){for(var n,i,s,o,c,u,l,p,f,h,d,y,g,v=r.length();v>=64;){for(c=0;c<16;++c)t[c]=r.getInt32();for(;c<64;++c)n=((n=t[c-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=((i=t[c-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[c]=n+t[c-7]+i+t[c-16]|0;for(u=e.h0,l=e.h1,p=e.h2,f=e.h3,h=e.h4,d=e.h5,y=e.h6,g=e.h7,c=0;c<64;++c)s=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),o=u&l|p&(u^l),n=g+((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(y^h&(d^y))+a[c]+t[c],g=y,y=d,d=h,h=f+n>>>0,f=p,p=l,l=u,u=n+(i=s+o)>>>0;e.h0=e.h0+u|0,e.h1=e.h1+l|0,e.h2=e.h2+p|0,e.h3=e.h3+f|0,e.h4=e.h4+h|0,e.h5=e.h5+d|0,e.h6=e.h6+y|0,e.h7=e.h7+g|0,v-=64}}return ee.exports}var re,ne,ae,ie,se,oe,ce={exports:{}};function ue(){if(re)return ce.exports;re=1;var e=l();m();var t=null;return!e.util.isNodejs||e.options.usePureJavaScript||process.versions["node-webkit"]||(t=r),(ce.exports=e.prng=e.prng||{}).create=function(r){for(var n={plugin:r,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},a=r.md,i=new Array(32),s=0;s<32;++s)i[s]=a.create();function o(){if(n.pools[0].messageLength>=32)return c();var e=32-n.pools[0].messageLength<<5;n.collect(n.seedFileSync(e)),c()}function c(){n.reseeds=4294967295===n.reseeds?0:n.reseeds+1;var e=n.plugin.md.create();e.update(n.keyBytes);for(var t=1,r=0;r<32;++r)n.reseeds%t==0&&(e.update(n.pools[r].digest().getBytes()),n.pools[r].start()),t<<=1;n.keyBytes=e.digest().getBytes(),e.start(),e.update(n.keyBytes);var a=e.digest().getBytes();n.key=n.plugin.formatKey(n.keyBytes),n.seed=n.plugin.formatSeed(a),n.generated=0}function u(t){var r=null,n=e.util.globalScope,a=n.crypto||n.msCrypto;a&&a.getRandomValues&&(r=function(e){return a.getRandomValues(e)});var i=e.util.createBuffer();if(r)for(;i.length()<t;){var s=Math.max(1,Math.min(t-i.length(),65536)/4),o=new Uint32Array(Math.floor(s));try{r(o);for(var c=0;c<o.length;++c)i.putInt32(o[c])}catch(e){if(!("undefined"!=typeof QuotaExceededError&&e instanceof QuotaExceededError))throw e}}if(i.length()<t)for(var u,l,p,f=Math.floor(65536*Math.random());i.length()<t;){l=16807*(65535&f),l+=(32767&(u=16807*(f>>16)))<<16,f=4294967295&(l=(2147483647&(l+=u>>15))+(l>>31));for(c=0;c<3;++c)p=f>>>(c<<3),p^=Math.floor(256*Math.random()),i.putByte(255&p)}return i.getBytes(t)}return n.pools=i,n.pool=0,n.generate=function(t,r){if(!r)return n.generateSync(t);var a=n.plugin.cipher,i=n.plugin.increment,s=n.plugin.formatKey,o=n.plugin.formatSeed,u=e.util.createBuffer();n.key=null,function l(p){if(p)return r(p);if(u.length()>=t)return r(null,u.getBytes(t));n.generated>1048575&&(n.key=null);if(null===n.key)return e.util.nextTick((function(){!function(e){if(n.pools[0].messageLength>=32)return c(),e();var t=32-n.pools[0].messageLength<<5;n.seedFile(t,(function(t,r){if(t)return e(t);n.collect(r),c(),e()}))}(l)}));var f=a(n.key,n.seed);n.generated+=f.length,u.putBytes(f),n.key=s(a(n.key,i(n.seed))),n.seed=o(a(n.key,n.seed)),e.util.setImmediate(l)}()},n.generateSync=function(t){var r=n.plugin.cipher,a=n.plugin.increment,i=n.plugin.formatKey,s=n.plugin.formatSeed;n.key=null;for(var c=e.util.createBuffer();c.length()<t;){n.generated>1048575&&(n.key=null),null===n.key&&o();var u=r(n.key,n.seed);n.generated+=u.length,c.putBytes(u),n.key=i(r(n.key,a(n.seed))),n.seed=s(r(n.key,n.seed))}return c.getBytes(t)},t?(n.seedFile=function(e,r){t.randomBytes(e,(function(e,t){if(e)return r(e);r(null,t.toString())}))},n.seedFileSync=function(e){return t.randomBytes(e).toString()}):(n.seedFile=function(e,t){try{t(null,u(e))}catch(e){t(e)}},n.seedFileSync=u),n.collect=function(e){for(var t=e.length,r=0;r<t;++r)n.pools[n.pool].update(e.substr(r,1)),n.pool=31===n.pool?0:n.pool+1},n.collectInt=function(e,t){for(var r="",a=0;a<t;a+=8)r+=String.fromCharCode(e>>a&255);n.collect(r)},n.registerWorker=function(e){if(e===self)n.seedFile=function(e,t){self.addEventListener("message",(function e(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",e),t(n.forge.prng.err,n.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:e}}})};else{e.addEventListener("message",(function(t){var r=t.data;r.forge&&r.forge.prng&&n.seedFile(r.forge.prng.needed,(function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})}))}))}},n},ce.exports}function le(){if(ne)return J.exports;ne=1;var e=l();return B(),te(),ue(),m(),e.random&&e.random.getBytes?J.exports=e.random:function(t){var r={},n=new Array(4),a=e.util.createBuffer();function i(){var t=e.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 r=e.util.createBuffer(t);return(t=new Array(4))[0]=r.getInt32(),t[1]=r.getInt32(),t[2]=r.getInt32(),t[3]=r.getInt32(),e.aes._expandKey(t,!1)},r.formatSeed=function(t){var r=e.util.createBuffer(t);return(t=new Array(4))[0]=r.getInt32(),t[1]=r.getInt32(),t[2]=r.getInt32(),t[3]=r.getInt32(),t},r.cipher=function(t,r){return e.aes._updateBlock(t,r,n,!1),a.putInt32(n[0]),a.putInt32(n[1]),a.putInt32(n[2]),a.putInt32(n[3]),a.getBytes()},r.increment=function(e){return++e[3],e},r.md=e.md.sha256;var s=i(),o=null,c=e.util.globalScope,u=c.crypto||c.msCrypto;if(u&&u.getRandomValues&&(o=function(e){return u.getRandomValues(e)}),e.options.usePureJavaScript||!e.util.isNodejs&&!o){if(s.collectInt(+new Date,32),"undefined"!=typeof navigator){var l="";for(var p in navigator)try{"string"==typeof navigator[p]&&(l+=navigator[p])}catch(e){}s.collect(l),l=null}t&&(t().mousemove((function(e){s.collectInt(e.clientX,16),s.collectInt(e.clientY,16)})),t().keypress((function(e){s.collectInt(e.charCode,8)})))}if(e.random)for(var p in s)e.random[p]=s[p];else e.random=s;e.random.createInstance=i,J.exports=e.random}("undefined"!=typeof jQuery?jQuery:null),J.exports}function pe(){if(ie)return ae;ie=1;var e=l();m();var t=[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],r=[1,2,3,5],n=function(e,t){return e<<t&65535|(65535&e)>>16-t},a=function(e,t){return(65535&e)>>t|e<<16-t&65535};ae=e.rc2=e.rc2||{},e.rc2.expandKey=function(r,n){"string"==typeof r&&(r=e.util.createBuffer(r)),n=n||128;var a,i=r,s=r.length(),o=n,c=Math.ceil(o/8),u=255>>(7&o);for(a=s;a<128;a++)i.putByte(t[i.at(a-1)+i.at(a-s)&255]);for(i.setAt(128-c,t[i.at(128-c)&u]),a=127-c;a>=0;a--)i.setAt(a,t[i.at(a+1)^i.at(a+c)]);return i};var i=function(t,i,s){var o,c,u,l,p=!1,f=null,h=null,d=null,y=[];for(t=e.rc2.expandKey(t,i),u=0;u<64;u++)y.push(t.getInt16Le());s?(o=function(e){for(u=0;u<4;u++)e[u]+=y[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),e[u]=n(e[u],r[u]),l++},c=function(e){for(u=0;u<4;u++)e[u]+=y[63&e[(u+3)%4]]}):(o=function(e){for(u=3;u>=0;u--)e[u]=a(e[u],r[u]),e[u]-=y[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),l--},c=function(e){for(u=3;u>=0;u--)e[u]-=y[63&e[(u+3)%4]]});var g=function(e){var t=[];for(u=0;u<4;u++){var r=f.getInt16Le();null!==d&&(s?r^=d.getInt16Le():d.putInt16Le(r)),t.push(65535&r)}l=s?0:63;for(var n=0;n<e.length;n++)for(var a=0;a<e[n][0];a++)e[n][1](t);for(u=0;u<4;u++)null!==d&&(s?d.putInt16Le(t[u]):t[u]^=d.getInt16Le()),h.putInt16Le(t[u])},v=null;return v={start:function(t,r){t&&"string"==typeof t&&(t=e.util.createBuffer(t)),p=!1,f=e.util.createBuffer(),h=r||new e.util.createBuffer,d=t,v.output=h},update:function(e){for(p||f.putBuffer(e);f.length()>=8;)g([[5,o],[1,c],[6,o],[1,c],[5,o]])},finish:function(e){var t=!0;if(s)if(e)t=e(8,f,!s);else{var r=8===f.length()?8:8-f.length();f.fillWithByte(r,r)}if(t&&(p=!0,v.update()),!s&&(t=0===f.length()))if(e)t=e(8,h,!s);else{var n=h.length(),a=h.at(n-1);a>n?t=!1:h.truncate(a)}return t}}};return e.rc2.startEncrypting=function(t,r,n){var a=e.rc2.createEncryptionCipher(t,128);return a.start(r,n),a},e.rc2.createEncryptionCipher=function(e,t){return i(e,t,!0)},e.rc2.startDecrypting=function(t,r,n){var a=e.rc2.createDecryptionCipher(t,128);return a.start(r,n),a},e.rc2.createDecryptionCipher=function(e,t){return i(e,t,!1)},ae}function fe(){if(oe)return se;oe=1;var e,t=l();function r(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function n(){return new r(null)}function a(e,t,r,n,a,i){for(var s=16383&t,o=t>>14;--i>=0;){var c=16383&this.data[e],u=this.data[e++]>>14,l=o*c+u*s;a=((c=s*c+((16383&l)<<14)+r.data[n]+a)>>28)+(l>>14)+o*u,r.data[n++]=268435455&c}return a}se=t.jsbn=t.jsbn||{},t.jsbn.BigInteger=r,"undefined"==typeof navigator?(r.prototype.am=a,e=28):"Microsoft Internet Explorer"==navigator.appName?(r.prototype.am=function(e,t,r,n,a,i){for(var s=32767&t,o=t>>15;--i>=0;){var c=32767&this.data[e],u=this.data[e++]>>15,l=o*c+u*s;a=((c=s*c+((32767&l)<<15)+r.data[n]+(1073741823&a))>>>30)+(l>>>15)+o*u+(a>>>30),r.data[n++]=1073741823&c}return a},e=30):"Netscape"!=navigator.appName?(r.prototype.am=function(e,t,r,n,a,i){for(;--i>=0;){var s=t*this.data[e++]+r.data[n]+a;a=Math.floor(s/67108864),r.data[n++]=67108863&s}return a},e=26):(r.prototype.am=a,e=28),r.prototype.DB=e,r.prototype.DM=(1<<e)-1,r.prototype.DV=1<<e;r.prototype.FV=Math.pow(2,52),r.prototype.F1=52-e,r.prototype.F2=2*e-52;var i,s,o="0123456789abcdefghijklmnopqrstuvwxyz",c=new Array;for(i="0".charCodeAt(0),s=0;s<=9;++s)c[i++]=s;for(i="a".charCodeAt(0),s=10;s<36;++s)c[i++]=s;for(i="A".charCodeAt(0),s=10;s<36;++s)c[i++]=s;function u(e){return o.charAt(e)}function p(e,t){var r=c[e.charCodeAt(t)];return null==r?-1:r}function f(e){var t=n();return t.fromInt(e),t}function h(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function d(e){this.m=e}function y(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function g(e,t){return e&t}function v(e,t){return e|t}function m(e,t){return e^t}function C(e,t){return e&~t}function E(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function S(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function T(){}function I(e){return e}function A(e){this.r2=n(),this.q3=n(),r.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}d.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},d.prototype.revert=function(e){return e},d.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},d.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},d.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},y.prototype.convert=function(e){var t=n();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(r.ZERO)>0&&this.m.subTo(t,t),t},y.prototype.revert=function(e){var t=n();return e.copyTo(t),this.reduce(t),t},y.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e.data[t],n=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},y.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},y.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},r.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},r.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},r.prototype.fromString=function(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(256==t)n=8;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)return void this.fromRadix(e,t);n=2}this.t=0,this.s=0;for(var a=e.length,i=!1,s=0;--a>=0;){var o=8==n?255&e[a]:p(e,a);o<0?"-"==e.charAt(a)&&(i=!0):(i=!1,0==s?this.data[this.t++]=o:s+n>this.DB?(this.data[this.t-1]|=(o&(1<<this.DB-s)-1)<<s,this.data[this.t++]=o>>this.DB-s):this.data[this.t-1]|=o<<s,(s+=n)>=this.DB&&(s-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),i&&r.ZERO.subTo(this,this)},r.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t},r.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},r.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s},r.prototype.lShiftTo=function(e,t){var r,n=e%this.DB,a=this.DB-n,i=(1<<a)-1,s=Math.floor(e/this.DB),o=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t.data[r+s+1]=this.data[r]>>a|o,o=(this.data[r]&i)<<n;for(r=s-1;r>=0;--r)t.data[r]=0;t.data[s]=o,t.t=this.t+s+1,t.s=this.s,t.clamp()},r.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,a=this.DB-n,i=(1<<n)-1;t.data[0]=this.data[r]>>n;for(var s=r+1;s<this.t;++s)t.data[s-r-1]|=(this.data[s]&i)<<a,t.data[s-r]=this.data[s]>>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<<a),t.t=this.t-r,t.clamp()}},r.prototype.subTo=function(e,t){for(var r=0,n=0,a=Math.min(e.t,this.t);r<a;)n+=this.data[r]-e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()},r.prototype.multiplyTo=function(e,t){var n=this.abs(),a=e.abs(),i=n.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i<a.t;++i)t.data[i+n.t]=n.am(0,a.data[i],t,i,0,n.t);t.s=0,t.clamp(),this.s!=e.s&&r.ZERO.subTo(t,t)},r.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},r.prototype.divRemTo=function(e,t,a){var i=e.abs();if(!(i.t<=0)){var s=this.abs();if(s.t<i.t)return null!=t&&t.fromInt(0),void(null!=a&&this.copyTo(a));null==a&&(a=n());var o=n(),c=this.s,u=e.s,l=this.DB-h(i.data[i.t-1]);l>0?(i.lShiftTo(l,o),s.lShiftTo(l,a)):(i.copyTo(o),s.copyTo(a));var p=o.t,f=o.data[p-1];if(0!=f){var d=f*(1<<this.F1)+(p>1?o.data[p-2]>>this.F2:0),y=this.FV/d,g=(1<<this.F1)/d,v=1<<this.F2,m=a.t,C=m-p,E=null==t?n():t;for(o.dlShiftTo(C,E),a.compareTo(E)>=0&&(a.data[a.t++]=1,a.subTo(E,a)),r.ONE.dlShiftTo(p,E),E.subTo(o,o);o.t<p;)o.data[o.t++]=0;for(;--C>=0;){var S=a.data[--m]==f?this.DM:Math.floor(a.data[m]*y+(a.data[m-1]+v)*g);if((a.data[m]+=o.am(0,S,a,C,0,p))<S)for(o.dlShiftTo(C,E),a.subTo(E,a);a.data[m]<--S;)a.subTo(E,a)}null!=t&&(a.drShiftTo(p,t),c!=u&&r.ZERO.subTo(t,t)),a.t=p,a.clamp(),l>0&&a.rShiftTo(l,a),c<0&&r.ZERO.subTo(a,a)}}},r.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},r.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},r.prototype.exp=function(e,t){if(e>4294967295||e<1)return r.ONE;var a=n(),i=n(),s=t.convert(this),o=h(e)-1;for(s.copyTo(a);--o>=0;)if(t.sqrTo(a,i),(e&1<<o)>0)t.mulTo(i,s,a);else{var c=a;a=i,i=c}return t.revert(a)},r.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,a=!1,i="",s=this.t,o=this.DB-s*this.DB%t;if(s-- >0)for(o<this.DB&&(r=this.data[s]>>o)>0&&(a=!0,i=u(r));s>=0;)o<t?(r=(this.data[s]&(1<<o)-1)<<t-o,r|=this.data[--s]>>(o+=this.DB-t)):(r=this.data[s]>>(o-=t)&n,o<=0&&(o+=this.DB,--s)),r>0&&(a=!0),a&&(i+=u(r));return a?i:"0"},r.prototype.negate=function(){var e=n();return r.ZERO.subTo(this,e),e},r.prototype.abs=function(){return this.s<0?this.negate():this},r.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},r.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+h(this.data[this.t-1]^this.s&this.DM)},r.prototype.mod=function(e){var t=n();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(r.ZERO)>0&&e.subTo(t,t),t},r.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new d(t):new y(t),this.exp(e,r)},r.ZERO=f(0),r.ONE=f(1),T.prototype.convert=I,T.prototype.revert=I,T.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},T.prototype.sqrTo=function(e,t){e.squareTo(t)},A.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=n();return e.copyTo(t),this.reduce(t),t},A.prototype.revert=function(e){return e},A.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},A.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},A.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var B=[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],b=(1<<26)/B[B.length-1];return r.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},r.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),a=f(r),i=n(),s=n(),o="";for(this.divRemTo(a,i,s);i.signum()>0;)o=(r+s.intValue()).toString(e).substr(1)+o,i.divRemTo(a,i,s);return s.intValue().toString(e)+o},r.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var n=this.chunkSize(t),a=Math.pow(t,n),i=!1,s=0,o=0,c=0;c<e.length;++c){var u=p(e,c);u<0?"-"==e.charAt(c)&&0==this.signum()&&(i=!0):(o=t*o+u,++s>=n&&(this.dMultiply(a),this.dAddOffset(o,0),s=0,o=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(o,0)),i&&r.ZERO.subTo(this,this)},r.prototype.fromNumber=function(e,t,n){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,n),this.testBit(e-1)||this.bitwiseTo(r.ONE.shiftLeft(e-1),v,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(r.ONE.shiftLeft(e-1),this);else{var a=new Array,i=7&e;a.length=1+(e>>3),t.nextBytes(a),i>0?a[0]&=(1<<i)-1:a[0]=0,this.fromString(a,256)}},r.prototype.bitwiseTo=function(e,t,r){var n,a,i=Math.min(e.t,this.t);for(n=0;n<i;++n)r.data[n]=t(this.data[n],e.data[n]);if(e.t<this.t){for(a=e.s&this.DM,n=i;n<this.t;++n)r.data[n]=t(this.data[n],a);r.t=this.t}else{for(a=this.s&this.DM,n=i;n<e.t;++n)r.data[n]=t(a,e.data[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()},r.prototype.changeBit=function(e,t){var n=r.ONE.shiftLeft(e);return this.bitwiseTo(n,t,n),n},r.prototype.addTo=function(e,t){for(var r=0,n=0,a=Math.min(e.t,this.t);r<a;)n+=this.data[r]+e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()},r.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},r.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},r.prototype.multiplyLowerTo=function(e,t,r){var n,a=Math.min(this.t+e.t,t);for(r.s=0,r.t=a;a>0;)r.data[--a]=0;for(n=r.t-this.t;a<n;++a)r.data[a+this.t]=this.am(0,e.data[a],r,a,0,this.t);for(n=Math.min(e.t,t);a<n;++a)this.am(0,e.data[a],r,a,0,t-a);r.clamp()},r.prototype.multiplyUpperTo=function(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r.data[this.t+n-t]=this.am(t-n,e.data[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)},r.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r},r.prototype.millerRabin=function(e){var t=this.subtract(r.ONE),n=t.getLowestSetBit();if(n<=0)return!1;for(var a,i=t.shiftRight(n),s={nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}},o=0;o<e;++o){do{a=new r(this.bitLength(),s)}while(a.compareTo(r.ONE)<=0||a.compareTo(t)>=0);var c=a.modPow(i,this);if(0!=c.compareTo(r.ONE)&&0!=c.compareTo(t)){for(var u=1;u++<n&&0!=c.compareTo(t);)if(0==(c=c.modPowInt(2,this)).compareTo(r.ONE))return!1;if(0!=c.compareTo(t))return!1}}return!0},r.prototype.clone=function(){var e=n();return this.copyTo(e),e},r.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]},r.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24},r.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},r.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},r.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,a=0;if(e-- >0)for(n<this.DB&&(r=this.data[e]>>n)!=(this.s&this.DM)>>n&&(t[a++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this.data[e]&(1<<n)-1)<<8-n,r|=this.data[--e]>>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==a&&(128&this.s)!=(128&r)&&++a,(a>0||r!=this.s)&&(t[a++]=r);return t},r.prototype.equals=function(e){return 0==this.compareTo(e)},r.prototype.min=function(e){return this.compareTo(e)<0?this:e},r.prototype.max=function(e){return this.compareTo(e)>0?this:e},r.prototype.and=function(e){var t=n();return this.bitwiseTo(e,g,t),t},r.prototype.or=function(e){var t=n();return this.bitwiseTo(e,v,t),t},r.prototype.xor=function(e){var t=n();return this.bitwiseTo(e,m,t),t},r.prototype.andNot=function(e){var t=n();return this.bitwiseTo(e,C,t),t},r.prototype.not=function(){for(var e=n(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e},r.prototype.shiftLeft=function(e){var t=n();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},r.prototype.shiftRight=function(e){var t=n();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},r.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this.data[e])return e*this.DB+E(this.data[e]);return this.s<0?this.t*this.DB:-1},r.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=S(this.data[r]^t);return e},r.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this.data[t]&1<<e%this.DB)},r.prototype.setBit=function(e){return this.changeBit(e,v)},r.prototype.clearBit=function(e){return this.changeBit(e,C)},r.prototype.flipBit=function(e){return this.changeBit(e,m)},r.prototype.add=function(e){var t=n();return this.addTo(e,t),t},r.prototype.subtract=function(e){var t=n();return this.subTo(e,t),t},r.prototype.multiply=function(e){var t=n();return this.multiplyTo(e,t),t},r.prototype.divide=function(e){var t=n();return this.divRemTo(e,t,null),t},r.prototype.remainder=function(e){var t=n();return this.divRemTo(e,null,t),t},r.prototype.divideAndRemainder=function(e){var t=n(),r=n();return this.divRemTo(e,t,r),new Array(t,r)},r.prototype.modPow=function(e,t){var r,a,i=e.bitLength(),s=f(1);if(i<=0)return s;r=i<18?1:i<48?3:i<144?4:i<768?5:6,a=i<8?new d(t):t.isEven()?new A(t):new y(t);var o=new Array,c=3,u=r-1,l=(1<<r)-1;if(o[1]=a.convert(this),r>1){var p=n();for(a.sqrTo(o[1],p);c<=l;)o[c]=n(),a.mulTo(p,o[c-2],o[c]),c+=2}var g,v,m=e.t-1,C=!0,E=n();for(i=h(e.data[m])-1;m>=0;){for(i>=u?g=e.data[m]>>i-u&l:(g=(e.data[m]&(1<<i+1)-1)<<u-i,m>0&&(g|=e.data[m-1]>>this.DB+i-u)),c=r;0==(1&g);)g>>=1,--c;if((i-=c)<0&&(i+=this.DB,--m),C)o[g].copyTo(s),C=!1;else{for(;c>1;)a.sqrTo(s,E),a.sqrTo(E,s),c-=2;c>0?a.sqrTo(s,E):(v=s,s=E,E=v),a.mulTo(E,o[g],s)}for(;m>=0&&0==(e.data[m]&1<<i);)a.sqrTo(s,E),v=s,s=E,E=v,--i<0&&(i=this.DB-1,--m)}return a.revert(s)},r.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return r.ZERO;for(var n=e.clone(),a=this.clone(),i=f(1),s=f(0),o=f(0),c=f(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),t?(i.isEven()&&s.isEven()||(i.addTo(this,i),s.subTo(e,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;a.isEven();)a.rShiftTo(1,a),t?(o.isEven()&&c.isEven()||(o.addTo(this,o),c.subTo(e,c)),o.rShiftTo(1,o)):c.isEven()||c.subTo(e,c),c.rShiftTo(1,c);n.compareTo(a)>=0?(n.subTo(a,n),t&&i.subTo(o,i),s.subTo(c,s)):(a.subTo(n,a),t&&o.subTo(i,o),c.subTo(s,c))}return 0!=a.compareTo(r.ONE)?r.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},r.prototype.pow=function(e){return this.exp(e,new T)},r.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var a=t.getLowestSetBit(),i=r.getLowestSetBit();if(i<0)return t;for(a<i&&(i=a),i>0&&(t.rShiftTo(i,t),r.rShiftTo(i,r));t.signum()>0;)(a=t.getLowestSetBit())>0&&t.rShiftTo(a,t),(a=r.getLowestSetBit())>0&&r.rShiftTo(a,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return i>0&&r.lShiftTo(i,r),r},r.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=B[B.length-1]){for(t=0;t<B.length;++t)if(r.data[0]==B[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<B.length;){for(var n=B[t],a=t+1;a<B.length&&n<b;)n*=B[a++];for(n=r.modInt(n);t<a;)if(n%B[t++]==0)return!1}return r.millerRabin(e)},se}var he,de,ye={exports:{}},ge={exports:{}};function ve(){if(he)return ge.exports;he=1;var e=l();O(),m();var t=ge.exports=e.sha1=e.sha1||{};e.md.sha1=e.md.algorithms.sha1=t,t.create=function(){n||(r=String.fromCharCode(128),r+=e.util.fillString(String.fromCharCode(0),64),n=!0);var t=null,i=e.util.createBuffer(),s=new Array(80),o={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){o.messageLength=0,o.fullMessageLength=o.messageLength64=[];for(var r=o.messageLengthSize/4,n=0;n<r;++n)o.fullMessageLength.push(0);return i=e.util.createBuffer(),t={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},o}};return o.start(),o.update=function(r,n){"utf8"===n&&(r=e.util.encodeUtf8(r));var c=r.length;o.messageLength+=c,c=[c/4294967296>>>0,c>>>0];for(var u=o.fullMessageLength.length-1;u>=0;--u)o.fullMessageLength[u]+=c[1],c[1]=c[0]+(o.fullMessageLength[u]/4294967296>>>0),o.fullMessageLength[u]=o.fullMessageLength[u]>>>0,c[0]=c[1]/4294967296>>>0;return i.putBytes(r),a(t,s,i),(i.read>2048||0===i.length())&&i.compact(),o},o.digest=function(){var n=e.util.createBuffer();n.putBytes(i.bytes());var c,u=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize&o.blockLength-1;n.putBytes(r.substr(0,o.blockLength-u));for(var l=8*o.fullMessageLength[0],p=0;p<o.fullMessageLength.length-1;++p)l+=(c=8*o.fullMessageLength[p+1])/4294967296>>>0,n.putInt32(l>>>0),l=c>>>0;n.putInt32(l);var f={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4};a(f,s,n);var h=e.util.createBuffer();return h.putInt32(f.h0),h.putInt32(f.h1),h.putInt32(f.h2),h.putInt32(f.h3),h.putInt32(f.h4),h},o};var r=null,n=!1;function a(e,t,r){for(var n,a,i,s,o,c,u,l=r.length();l>=64;){for(a=e.h0,i=e.h1,s=e.h2,o=e.h3,c=e.h4,u=0;u<16;++u)n=r.getInt32(),t[u]=n,n=(a<<5|a>>>27)+(o^i&(s^o))+c+1518500249+n,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=a,a=n;for(;u<20;++u)n=(n=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|n>>>31,t[u]=n,n=(a<<5|a>>>27)+(o^i&(s^o))+c+1518500249+n,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=a,a=n;for(;u<32;++u)n=(n=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|n>>>31,t[u]=n,n=(a<<5|a>>>27)+(i^s^o)+c+1859775393+n,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=a,a=n;for(;u<40;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(a<<5|a>>>27)+(i^s^o)+c+1859775393+n,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=a,a=n;for(;u<60;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(a<<5|a>>>27)+(i&s|o&(i^s))+c+2400959708+n,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=a,a=n;for(;u<80;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(a<<5|a>>>27)+(i^s^o)+c+3395469782+n,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=a,a=n;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+s|0,e.h3=e.h3+o|0,e.h4=e.h4+c|0,l-=64}}return ge.exports}function me(){if(de)return ye.exports;de=1;var e=l();m(),le(),ve();var t=ye.exports=e.pkcs1=e.pkcs1||{};function r(t,r,n){n||(n=e.md.sha1.create());for(var a="",i=Math.ceil(r/n.digestLength),s=0;s<i;++s){var o=String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,255&s);n.start(),n.update(t+o),a+=n.digest().getBytes()}return a.substring(0,r)}return t.encode_rsa_oaep=function(t,n,a){var i,s,o,c;"string"==typeof a?(i=a,s=arguments[3]||void 0,o=arguments[4]||void 0):a&&(i=a.label||void 0,s=a.seed||void 0,o=a.md||void 0,a.mgf1&&a.mgf1.md&&(c=a.mgf1.md)),o?o.start():o=e.md.sha1.create(),c||(c=o);var u=Math.ceil(t.n.bitLength()/8),l=u-2*o.digestLength-2;if(n.length>l)throw(g=new Error("RSAES-OAEP input message length is too long.")).length=n.length,g.maxLength=l,g;i||(i=""),o.update(i,"raw");for(var p=o.digest(),f="",h=l-n.length,d=0;d<h;d++)f+="\0";var y=p.getBytes()+f+""+n;if(s){if(s.length!==o.digestLength){var g;throw(g=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.")).seedLength=s.length,g.digestLength=o.digestLength,g}}else s=e.random.getBytes(o.digestLength);var v=r(s,u-o.digestLength-1,c),m=e.util.xorBytes(y,v,y.length),C=r(m,o.digestLength,c);return"\0"+e.util.xorBytes(s,C,s.length)+m},t.decode_rsa_oaep=function(t,n,a){var i,s,o;"string"==typeof a?(i=a,s=arguments[3]||void 0):a&&(i=a.label||void 0,s=a.md||void 0,a.mgf1&&a.mgf1.md&&(o=a.mgf1.md));var c=Math.ceil(t.n.bitLength()/8);if(n.length!==c)throw(v=new Error("RSAES-OAEP encoded message length is invalid.")).length=n.length,v.expectedLength=c,v;if(void 0===s?s=e.md.sha1.create():s.start(),o||(o=s),c<2*s.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");i||(i=""),s.update(i,"raw");for(var u=s.digest().getBytes(),l=n.charAt(0),p=n.substring(1,s.digestLength+1),f=n.substring(1+s.digestLength),h=r(f,s.digestLength,o),d=r(e.util.xorBytes(p,h,p.length),c-s.digestLength-1,o),y=e.util.xorBytes(f,d,f.length),g=y.substring(0,s.digestLength),v="\0"!==l,m=0;m<s.digestLength;++m)v|=u.charAt(m)!==g.charAt(m);for(var C=1,E=s.digestLength,S=s.digestLength;S<y.length;S++){var T=y.charCodeAt(S);v|=T&(C?65534:0),E+=C&=1&T^1}if(v||1!==y.charCodeAt(E))throw new Error("Invalid RSAES-OAEP padding.");return y.substring(E+1)},ye.exports}var Ce,Ee,Se,Te,Ie,Ae={exports:{}};function Be(){if(Ce)return Ae.exports;Ce=1;var e=l();return m(),fe(),le(),function(){if(e.prime)Ae.exports=e.prime;else{var t=Ae.exports=e.prime=e.prime||{},r=e.jsbn.BigInteger,n=[6,4,2,4,2,4,6,2],a=new r(null);a.fromInt(30);var i=function(e,t){return e|t};t.generateProbablePrime=function(t,n,a){"function"==typeof n&&(a=n,n={});var i=(n=n||{}).algorithm||"PRIMEINC";"string"==typeof i&&(i={name:i}),i.options=i.options||{};var o=n.prng||e.random,u={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}};if("PRIMEINC"===i.name)return function(t,n,a,i){if("workers"in a)return function(t,n,a,i){if("undefined"==typeof Worker)return s(t,n,a,i);var o=c(t,n),u=a.workers,l=a.workLoad||100,p=30*l/8,f=a.workerScript||"forge/prime.worker.js";if(-1===u)return e.util.estimateCores((function(e,t){e&&(t=2),u=t-1,h()}));function h(){u=Math.max(1,u);for(var e=[],a=0;a<u;++a)e[a]=new Worker(f);for(a=0;a<u;++a)e[a].addEventListener("message",h);var s=!1;function h(a){if(!s){var u=a.data;if(u.found){for(var f=0;f<e.length;++f)e[f].terminate();return s=!0,i(null,new r(u.prime,16))}o.bitLength()>t&&(o=c(t,n));var h=o.toString(16);a.target.postMessage({hex:h,workLoad:l}),o.dAddOffset(p,0)}}}h()}(t,n,a,i);return s(t,n,a,i)}(t,u,i.options,a);throw new Error("Invalid prime generation algorithm: "+i.name)}}function s(e,t,r,n){var a=c(e,t),i=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(a.bitLength());"millerRabinTests"in r&&(i=r.millerRabinTests);var s=10;"maxBlockTime"in r&&(s=r.maxBlockTime),o(a,e,t,0,i,s,n)}function o(t,r,a,i,s,u,l){var p=+new Date;do{if(t.bitLength()>r&&(t=c(r,a)),t.isProbablePrime(s))return l(null,t);t.dAddOffset(n[i++%8],0)}while(u<0||+new Date-p<u);e.util.setImmediate((function(){o(t,r,a,i,s,u,l)}))}function c(e,t){var n=new r(e,t),s=e-1;return n.testBit(s)||n.bitwiseTo(r.ONE.shiftLeft(s),i,n),n.dAddOffset(31-n.mod(a).byteValue(),0),n}}(),Ae.exports}function be(){if(Se)return Ee;Se=1;var e=l();if(k(),fe(),L(),me(),Be(),le(),m(),void 0===t)var t=e.jsbn.BigInteger;var n=e.util.isNodejs?r:null,a=e.asn1,i=e.util;e.pki=e.pki||{},Ee=e.pki.rsa=e.rsa=e.rsa||{};var s=e.pki,o=[6,4,2,4,2,4,6,2],c={name:"PrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},u={name:"RSAPrivateKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},p={name:"RSAPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},f=e.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},h={name:"DigestInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:a.Class.UNIVERSAL,type:a.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},d=function(e){var t;if(!(e.algorithm in s.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=s.oids[e.algorithm];var n=a.oidToDer(t).getBytes(),i=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]),o=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]);o.value.push(a.create(a.Class.UNIVERSAL,a.Type.OID,!1,n)),o.value.push(a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,""));var c=a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(o),i.value.push(c),a.toDer(i).getBytes()},y=function(r,n,a){if(a)return r.modPow(n.e,n.n);if(!n.p||!n.q)return r.modPow(n.d,n.n);var i;n.dP||(n.dP=n.d.mod(n.p.subtract(t.ONE))),n.dQ||(n.dQ=n.d.mod(n.q.subtract(t.ONE))),n.qInv||(n.qInv=n.q.modInverse(n.p));do{i=new t(e.util.bytesToHex(e.random.getBytes(n.n.bitLength()/8)),16)}while(i.compareTo(n.n)>=0||!i.gcd(n.n).equals(t.ONE));for(var s=(r=r.multiply(i.modPow(n.e,n.n)).mod(n.n)).mod(n.p).modPow(n.dP,n.p),o=r.mod(n.q).modPow(n.dQ,n.q);s.compareTo(o)<0;)s=s.add(n.p);var c=s.subtract(o).multiply(n.qInv).mod(n.p).multiply(n.q).add(o);return c=c.multiply(i.modInverse(n.n)).mod(n.n)};function g(t,r,n){var a=e.util.createBuffer(),i=Math.ceil(r.n.bitLength()/8);if(t.length>i-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=t.length,s.max=i-11,s}a.putByte(0),a.putByte(n);var o,c=i-3-t.length;if(0===n||1===n){o=0===n?0:255;for(var u=0;u<c;++u)a.putByte(o)}else for(;c>0;){var l=0,p=e.random.getBytes(c);for(u=0;u<c;++u)0===(o=p.charCodeAt(u))?++l:a.putByte(o);c=l}return a.putByte(0),a.putBytes(t),a}function v(t,r,n,a){var i=Math.ceil(r.n.bitLength()/8),s=e.util.createBuffer(t),o=s.getByte(),c=s.getByte();if(0!==o||n&&0!==c&&1!==c||!n&&2!=c||n&&0===c&&void 0===a)throw new Error("Encryption block is invalid.");var u=0;if(0===c){u=i-3-a;for(var l=0;l<u;++l)if(0!==s.getByte())throw new Error("Encryption block is invalid.")}else if(1===c)for(u=0;s.length()>1;){if(255!==s.getByte()){--s.read;break}++u}else if(2===c)for(u=0;s.length()>1;){if(0===s.getByte()){--s.read;break}++u}if(0!==s.getByte()||u!==i-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function C(t){var r=t.toString(16);r[0]>="8"&&(r="00"+r);var n=e.util.hexToBytes(r);return n.length>1&&(0===n.charCodeAt(0)&&0==(128&n.charCodeAt(1))||255===n.charCodeAt(0)&&128==(128&n.charCodeAt(1)))?n.substr(1):n}function E(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function S(t){return e.util.isNodejs&&"function"==typeof n[t]}function T(e){return void 0!==i.globalScope&&"object"==typeof i.globalScope.crypto&&"object"==typeof i.globalScope.crypto.subtle&&"function"==typeof i.globalScope.crypto.subtle[e]}function I(e){return void 0!==i.globalScope&&"object"==typeof i.globalScope.msCrypto&&"object"==typeof i.globalScope.msCrypto.subtle&&"function"==typeof i.globalScope.msCrypto.subtle[e]}function A(t){for(var r=e.util.hexToBytes(t.toString(16)),n=new Uint8Array(r.length),a=0;a<r.length;++a)n[a]=r.charCodeAt(a);return n}return s.rsa.encrypt=function(r,n,a){var i,s=a,o=Math.ceil(n.n.bitLength()/8);!1!==a&&!0!==a?(s=2===a,i=g(r,n,a)):(i=e.util.createBuffer()).putBytes(r);for(var c=new t(i.toHex(),16),u=y(c,n,s).toString(16),l=e.util.createBuffer(),p=o-Math.ceil(u.length/2);p>0;)l.putByte(0),--p;return l.putBytes(e.util.hexToBytes(u)),l.getBytes()},s.rsa.decrypt=function(r,n,a,i){var s=Math.ceil(n.n.bitLength()/8);if(r.length!==s){var o=new Error("Encrypted message length is invalid.");throw o.length=r.length,o.expected=s,o}var c=new t(e.util.createBuffer(r).toHex(),16);if(c.compareTo(n.n)>=0)throw new Error("Encrypted message is invalid.");for(var u=y(c,n,a).toString(16),l=e.util.createBuffer(),p=s-Math.ceil(u.length/2);p>0;)l.putByte(0),--p;return l.putBytes(e.util.hexToBytes(u)),!1!==i?v(l.getBytes(),n,a):l.getBytes()},s.rsa.createKeyPairGenerationState=function(r,n,a){"string"==typeof r&&(r=parseInt(r,10)),r=r||2048;var i,s=(a=a||{}).prng||e.random,o={nextBytes:function(e){for(var t=s.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},c=a.algorithm||"PRIMEINC";if("PRIMEINC"!==c)throw new Error("Invalid key generation algorithm: "+c);return(i={algorithm:c,state:0,bits:r,rng:o,eInt:n||65537,e:new t(null),p:null,q:null,qBits:r>>1,pBits:r-(r>>1),pqState:0,num:null,keys:null}).e.fromInt(i.eInt),i},s.rsa.stepKeyPairGenerationState=function(e,r){"algorithm"in e||(e.algorithm="PRIMEINC");var n=new t(null);n.fromInt(30);for(var a,i=0,c=function(e,t){return e|t},u=+new Date,l=0;null===e.keys&&(r<=0||l<r);){if(0===e.state){var p=null===e.p?e.pBits:e.qBits,f=p-1;0===e.pqState?(e.num=new t(p,e.rng),e.num.testBit(f)||e.num.bitwiseTo(t.ONE.shiftLeft(f),c,e.num),e.num.dAddOffset(31-e.num.mod(n).byteValue(),0),i=0,++e.pqState):1===e.pqState?e.num.bitLength()>p?e.pqState=0:e.num.isProbablePrime(E(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(o[i++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(t.ONE).gcd(e.e).compareTo(t.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(t.ONE),e.q1=e.q.subtract(t.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(t.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var h=e.e.modInverse(e.phi);e.keys={privateKey:s.rsa.setPrivateKey(e.n,e.e,h,e.p,e.q,h.mod(e.p1),h.mod(e.q1),e.q.modInverse(e.p)),publicKey:s.rsa.setPublicKey(e.n,e.e)}}l+=(a=+new Date)-u,u=a}return null!==e.keys},s.rsa.generateKeyPair=function(r,o,c,u){if(1===arguments.length?"object"==typeof r?(c=r,r=void 0):"function"==typeof r&&(u=r,r=void 0):2===arguments.length?"number"==typeof r?"function"==typeof o?(u=o,o=void 0):"number"!=typeof o&&(c=o,o=void 0):(c=r,u=o,r=void 0,o=void 0):3===arguments.length&&("number"==typeof o?"function"==typeof c&&(u=c,c=void 0):(u=c,c=o,o=void 0)),c=c||{},void 0===r&&(r=c.bits||2048),void 0===o&&(o=c.e||65537),!e.options.usePureJavaScript&&!c.prng&&r>=256&&r<=16384&&(65537===o||3===o))if(u){if(S("generateKeyPair"))return n.generateKeyPair("rsa",{modulusLength:r,publicExponent:o,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,r){if(e)return u(e);u(null,{privateKey:s.privateKeyFromPem(r),publicKey:s.publicKeyFromPem(t)})}));if(T("generateKey")&&T("exportKey"))return i.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:r,publicExponent:A(o),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return i.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)})).then(void 0,(function(e){u(e)})).then((function(t){if(t){var r=s.privateKeyFromAsn1(a.fromDer(e.util.createBuffer(t)));u(null,{privateKey:r,publicKey:s.setRsaPublicKey(r.n,r.e)})}}));if(I("generateKey")&&I("exportKey")){var l=i.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:r,publicExponent:A(o),hash:{name:"SHA-256"}},!0,["sign","verify"]);return l.oncomplete=function(t){var r=t.target.result,n=i.globalScope.msCrypto.subtle.exportKey("pkcs8",r.privateKey);n.oncomplete=function(t){var r=t.target.result,n=s.privateKeyFromAsn1(a.fromDer(e.util.createBuffer(r)));u(null,{privateKey:n,publicKey:s.setRsaPublicKey(n.n,n.e)})},n.onerror=function(e){u(e)}},void(l.onerror=function(e){u(e)})}}else if(S("generateKeyPairSync")){var p=n.generateKeyPairSync("rsa",{modulusLength:r,publicExponent:o,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:s.privateKeyFromPem(p.privateKey),publicKey:s.publicKeyFromPem(p.publicKey)}}var f=s.rsa.createKeyPairGenerationState(r,o,c);if(!u)return s.rsa.stepKeyPairGenerationState(f,0),f.keys;!function(r,n,a){"function"==typeof n&&(a=n,n={});n=n||{};var i={algorithm:{name:n.algorithm||"PRIMEINC",options:{workers:n.workers||2,workLoad:n.workLoad||100,workerScript:n.workerScript}}};"prng"in n&&(i.prng=n.prng);function o(){c(r.pBits,(function(e,t){return e?a(e):(r.p=t,null!==r.q?u(e,r.q):void c(r.qBits,u))}))}function c(t,r){e.prime.generateProbablePrime(t,i,r)}function u(e,n){if(e)return a(e);if(r.q=n,r.p.compareTo(r.q)<0){var i=r.p;r.p=r.q,r.q=i}if(0!==r.p.subtract(t.ONE).gcd(r.e).compareTo(t.ONE))return r.p=null,void o();if(0!==r.q.subtract(t.ONE).gcd(r.e).compareTo(t.ONE))return r.q=null,void c(r.qBits,u);if(r.p1=r.p.subtract(t.ONE),r.q1=r.q.subtract(t.ONE),r.phi=r.p1.multiply(r.q1),0!==r.phi.gcd(r.e).compareTo(t.ONE))return r.p=r.q=null,void o();if(r.n=r.p.multiply(r.q),r.n.bitLength()!==r.bits)return r.q=null,void c(r.qBits,u);var l=r.e.modInverse(r.phi);r.keys={privateKey:s.rsa.setPrivateKey(r.n,r.e,l,r.p,r.q,l.mod(r.p1),l.mod(r.q1),r.q.modInverse(r.p)),publicKey:s.rsa.setPublicKey(r.n,r.e)},a(null,r.keys)}o()}(f,c,u)},s.setRsaPublicKey=s.rsa.setPublicKey=function(t,r){var n={n:t,e:r,encrypt:function(t,r,a){if("string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===r)r={encode:function(e,t,r){return g(e,t,2).getBytes()}};else if("RSA-OAEP"===r||"RSAES-OAEP"===r)r={encode:function(t,r){return e.pkcs1.encode_rsa_oaep(r,t,a)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(r))r={encode:function(e){return e}};else if("string"==typeof r)throw new Error('Unsupported encryption scheme: "'+r+'".');var i=r.encode(t,n,!0);return s.rsa.encrypt(i,n,!0)},verify:function(t,r,i,o){"string"==typeof i?i=i.toUpperCase():void 0===i&&(i="RSASSA-PKCS1-V1_5"),void 0===o&&(o={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in o||(o._parseAllDigestBytes=!0),"RSASSA-PKCS1-V1_5"===i?i={verify:function(t,r){r=v(r,n,!0);var i=a.fromDer(r,{parseAllBytes:o._parseAllDigestBytes}),s={},c=[];if(!a.validate(i,h,s,c))throw(u=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.")).errors=c,u;var u,l=a.derToOid(s.algorithmIdentifier);if(l!==e.oids.md2&&l!==e.oids.md5&&l!==e.oids.sha1&&l!==e.oids.sha224&&l!==e.oids.sha256&&l!==e.oids.sha384&&l!==e.oids.sha512&&l!==e.oids["sha512-224"]&&l!==e.oids["sha512-256"])throw(u=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.")).oid=l,u;if((l===e.oids.md2||l===e.oids.md5)&&!("parameters"in s))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return t===s.digest}}:"NONE"!==i&&"NULL"!==i&&null!==i||(i={verify:function(e,t){return e===(t=v(t,n,!0))}});var c=s.rsa.decrypt(r,n,!0,!1);return i.verify(t,c,n.n.bitLength())}};return n},s.setRsaPrivateKey=s.rsa.setPrivateKey=function(t,r,n,a,i,o,c,u){var l={n:t,e:r,d:n,p:a,q:i,dP:o,dQ:c,qInv:u,decrypt:function(t,r,n){"string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSAES-PKCS1-V1_5");var a=s.rsa.decrypt(t,l,!1,!1);if("RSAES-PKCS1-V1_5"===r)r={decode:v};else if("RSA-OAEP"===r||"RSAES-OAEP"===r)r={decode:function(t,r){return e.pkcs1.decode_rsa_oaep(r,t,n)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(r))throw new Error('Unsupported encryption scheme: "'+r+'".');r={decode:function(e){return e}}}return r.decode(a,l,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:d},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,l.n.bitLength());return s.rsa.encrypt(n,l,r)}};return l},s.wrapRsaPrivateKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(0).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(s.oids.rsaEncryption).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]),a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,a.toDer(e).getBytes())])},s.privateKeyFromAsn1=function(r){var n,i,o,l,p,f,h,d,y={},g=[];if(a.validate(r,c,y,g)&&(r=a.fromDer(e.util.createBuffer(y.privateKey))),y={},g=[],!a.validate(r,u,y,g)){var v=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw v.errors=g,v}return n=e.util.createBuffer(y.privateKeyModulus).toHex(),i=e.util.createBuffer(y.privateKeyPublicExponent).toHex(),o=e.util.createBuffer(y.privateKeyPrivateExponent).toHex(),l=e.util.createBuffer(y.privateKeyPrime1).toHex(),p=e.util.createBuffer(y.privateKeyPrime2).toHex(),f=e.util.createBuffer(y.privateKeyExponent1).toHex(),h=e.util.createBuffer(y.privateKeyExponent2).toHex(),d=e.util.createBuffer(y.privateKeyCoefficient).toHex(),s.setRsaPrivateKey(new t(n,16),new t(i,16),new t(o,16),new t(l,16),new t(p,16),new t(f,16),new t(h,16),new t(d,16))},s.privateKeyToAsn1=s.privateKeyToRSAPrivateKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(0).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,C(e.n)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,C(e.e)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,C(e.d)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,C(e.p)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,C(e.q)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,C(e.dP)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,C(e.dQ)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,C(e.qInv))])},s.publicKeyFromAsn1=function(r){var n={},i=[];if(a.validate(r,f,n,i)){var o,c=a.derToOid(n.publicKeyOid);if(c!==s.oids.rsaEncryption)throw(o=new Error("Cannot read public key. Unknown OID.")).oid=c,o;r=n.rsaPublicKey}if(i=[],!a.validate(r,p,n,i))throw(o=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=i,o;var u=e.util.createBuffer(n.publicKeyModulus).toHex(),l=e.util.createBuffer(n.publicKeyExponent).toHex();return s.setRsaPublicKey(new t(u,16),new t(l,16))},s.publicKeyToAsn1=s.publicKeyToSubjectPublicKeyInfo=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(s.oids.rsaEncryption).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]),a.create(a.Class.UNIVERSAL,a.Type.BITSTRING,!1,[s.publicKeyToRSAPublicKey(e)])])},s.publicKeyToRSAPublicKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,C(e.n)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,C(e.e))])},Ee}function Ne(){if(Ie)return Te;Ie=1;var e=l();if(B(),k(),W(),O(),L(),Z(),G(),le(),pe(),be(),m(),void 0===t)var t=e.jsbn.BigInteger;var r=e.asn1,n=e.pki=e.pki||{};Te=n.pbe=e.pbe=e.pbe||{};var a=n.oids,i={name:"EncryptedPrivateKeyInfo",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},s={name:"PBES2Algorithms",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},o={name:"pkcs-12PbeParams",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,capture:"iterations"}]};function c(e,t){return e.start().update(t).digest().getBytes()}function u(e){var t;if(e){if(!(t=n.oids[r.derToOid(e)])){var a=new Error("Unsupported PRF OID.");throw a.oid=e,a.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],a}}else t="hmacWithSHA1";return p(t)}function p(t){var r=e.md;switch(t){case"hmacWithSHA224":r=e.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":t=t.substr(8).toLowerCase();break;default:var n=new Error("Unsupported PRF algorithm.");throw n.algorithm=t,n.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],n}if(!r||!(t in r))throw new Error("Unknown hash algorithm: "+t);return r[t].create()}return n.encryptPrivateKeyInfo=function(t,i,s){(s=s||{}).saltSize=s.saltSize||8,s.count=s.count||2048,s.algorithm=s.algorithm||"aes128",s.prfAlgorithm=s.prfAlgorithm||"sha1";var o,c,u,l=e.random.getBytesSync(s.saltSize),f=s.count,h=r.integerToDer(f);if(0===s.algorithm.indexOf("aes")||"des"===s.algorithm){var d,y,g;switch(s.algorithm){case"aes128":o=16,d=16,y=a["aes128-CBC"],g=e.aes.createEncryptionCipher;break;case"aes192":o=24,d=16,y=a["aes192-CBC"],g=e.aes.createEncryptionCipher;break;case"aes256":o=32,d=16,y=a["aes256-CBC"],g=e.aes.createEncryptionCipher;break;case"des":o=8,d=8,y=a.desCBC,g=e.des.createEncryptionCipher;break;default:throw(T=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=s.algorithm,T}var v="hmacWith"+s.prfAlgorithm.toUpperCase(),m=p(v),C=e.pkcs5.pbkdf2(i,l,f,o,m),E=e.random.getBytesSync(d);(I=g(C)).start(E),I.update(r.toDer(t)),I.finish(),u=I.output.getBytes();var S=function(t,a,i,s){var o=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,t),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,a.getBytes())]);"hmacWithSHA1"!==s&&o.value.push(r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,e.util.hexToBytes(i.toString(16))),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(n.oids[s]).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")]));return o}(l,h,o,v);c=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(a.pkcs5PBES2).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(a.pkcs5PBKDF2).getBytes()),S]),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(y).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,E)])])])}else{var T;if("3des"!==s.algorithm)throw(T=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=s.algorithm,T;o=24;var I,A=new e.util.ByteBuffer(l);C=n.pbe.generatePkcs12Key(i,A,1,f,o),E=n.pbe.generatePkcs12Key(i,A,2,f,o);(I=e.des.createEncryptionCipher(C)).start(E),I.update(r.toDer(t)),I.finish(),u=I.output.getBytes(),c=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(a["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,l),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,h.getBytes())])])}return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[c,r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,u)])},n.decryptPrivateKeyInfo=function(t,a){var s=null,o={},c=[];if(!r.validate(t,i,o,c)){var u=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw u.errors=c,u}var l=r.derToOid(o.encryptionOid),p=n.pbe.getCipher(l,o.encryptionParams,a),f=e.util.createBuffer(o.encryptedData);return p.update(f),p.finish()&&(s=r.fromDer(p.output)),s},n.encryptedPrivateKeyToPem=function(t,n){var a={type:"ENCRYPTED PRIVATE KEY",body:r.toDer(t).getBytes()};return e.pem.encode(a,{maxline:n})},n.encryptedPrivateKeyFromPem=function(t){var n=e.pem.decode(t)[0];if("ENCRYPTED PRIVATE KEY"!==n.type){var a=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw a.headerType=n.type,a}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return r.fromDer(n.body)},n.encryptRsaPrivateKey=function(t,a,i){if(!(i=i||{}).legacy){var s=n.wrapRsaPrivateKey(n.privateKeyToAsn1(t));return s=n.encryptPrivateKeyInfo(s,a,i),n.encryptedPrivateKeyToPem(s)}var o,c,u,l;switch(i.algorithm){case"aes128":o="AES-128-CBC",u=16,c=e.random.getBytesSync(16),l=e.aes.createEncryptionCipher;break;case"aes192":o="AES-192-CBC",u=24,c=e.random.getBytesSync(16),l=e.aes.createEncryptionCipher;break;case"aes256":o="AES-256-CBC",u=32,c=e.random.getBytesSync(16),l=e.aes.createEncryptionCipher;break;case"3des":o="DES-EDE3-CBC",u=24,c=e.random.getBytesSync(8),l=e.des.createEncryptionCipher;break;case"des":o="DES-CBC",u=8,c=e.random.getBytesSync(8),l=e.des.createEncryptionCipher;break;default:var p=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+i.algorithm+'".');throw p.algorithm=i.algorithm,p}var f=l(e.pbe.opensslDeriveBytes(a,c.substr(0,8),u));f.start(c),f.update(r.toDer(n.privateKeyToAsn1(t))),f.finish();var h={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:o,parameters:e.util.bytesToHex(c).toUpperCase()},body:f.output.getBytes()};return e.pem.encode(h)},n.decryptRsaPrivateKey=function(t,a){var i=null,s=e.pem.decode(t)[0];if("ENCRYPTED PRIVATE KEY"!==s.type&&"PRIVATE KEY"!==s.type&&"RSA PRIVATE KEY"!==s.type)throw(u=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=u,u;if(s.procType&&"ENCRYPTED"===s.procType.type){var o,c;switch(s.dekInfo.algorithm){case"DES-CBC":o=8,c=e.des.createDecryptionCipher;break;case"DES-EDE3-CBC":o=24,c=e.des.createDecryptionCipher;break;case"AES-128-CBC":o=16,c=e.aes.createDecryptionCipher;break;case"AES-192-CBC":o=24,c=e.aes.createDecryptionCipher;break;case"AES-256-CBC":o=32,c=e.aes.createDecryptionCipher;break;case"RC2-40-CBC":o=5,c=function(t){return e.rc2.createDecryptionCipher(t,40)};break;case"RC2-64-CBC":o=8,c=function(t){return e.rc2.createDecryptionCipher(t,64)};break;case"RC2-128-CBC":o=16,c=function(t){return e.rc2.createDecryptionCipher(t,128)};break;default:var u;throw(u=new Error('Could not decrypt private key; unsupported encryption algorithm "'+s.dekInfo.algorithm+'".')).algorithm=s.dekInfo.algorithm,u}var l=e.util.hexToBytes(s.dekInfo.parameters),p=c(e.pbe.opensslDeriveBytes(a,l.substr(0,8),o));if(p.start(l),p.update(e.util.createBuffer(s.body)),!p.finish())return i;i=p.output.getBytes()}else i=s.body;return null!==(i="ENCRYPTED PRIVATE KEY"===s.type?n.decryptPrivateKeyInfo(r.fromDer(i),a):r.fromDer(i))&&(i=n.privateKeyFromAsn1(i)),i},n.pbe.generatePkcs12Key=function(t,r,n,a,i,s){var o,c;if(null==s){if(!("sha1"in e.md))throw new Error('"sha1" hash algorithm unavailable.');s=e.md.sha1.create()}var u=s.digestLength,l=s.blockLength,p=new e.util.ByteBuffer,f=new e.util.ByteBuffer;if(null!=t){for(c=0;c<t.length;c++)f.putInt16(t.charCodeAt(c));f.putInt16(0)}var h=f.length(),d=r.length(),y=new e.util.ByteBuffer;y.fillWithByte(n,l);var g=l*Math.ceil(d/l),v=new e.util.ByteBuffer;for(c=0;c<g;c++)v.putByte(r.at(c%d));var m=l*Math.ceil(h/l),C=new e.util.ByteBuffer;for(c=0;c<m;c++)C.putByte(f.at(c%h));var E=v;E.putBuffer(C);for(var S=Math.ceil(i/u),T=1;T<=S;T++){var I=new e.util.ByteBuffer;I.putBytes(y.bytes()),I.putBytes(E.bytes());for(var A=0;A<a;A++)s.start(),s.update(I.getBytes()),I=s.digest();var B=new e.util.ByteBuffer;for(c=0;c<l;c++)B.putByte(I.at(c%u));var b=Math.ceil(d/l)+Math.ceil(h/l),N=new e.util.ByteBuffer;for(o=0;o<b;o++){var R=new e.util.ByteBuffer(E.getBytes(l)),w=511;for(c=B.length()-1;c>=0;c--)w>>=8,w+=B.at(c)+R.at(c),R.setAt(c,255&w);N.putBuffer(R)}E=N,p.putBuffer(I)}return p.truncate(p.length()-i),p},n.pbe.getCipher=function(e,t,r){switch(e){case n.oids.pkcs5PBES2:return n.pbe.getCipherForPBES2(e,t,r);case n.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case n.oids["pbewithSHAAnd40BitRC2-CBC"]:return n.pbe.getCipherForPKCS12PBE(e,t,r);default:var a=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw a.oid=e,a.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],a}},n.pbe.getCipherForPBES2=function(t,a,i){var o,c={},l=[];if(!r.validate(a,s,c,l))throw(o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=l,o;if((t=r.derToOid(c.kdfOid))!==n.oids.pkcs5PBKDF2)throw(o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=t,o.supportedOids=["pkcs5PBKDF2"],o;if((t=r.derToOid(c.encOid))!==n.oids["aes128-CBC"]&&t!==n.oids["aes192-CBC"]&&t!==n.oids["aes256-CBC"]&&t!==n.oids["des-EDE3-CBC"]&&t!==n.oids.desCBC)throw(o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=t,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o;var p,f,h=c.kdfSalt,d=e.util.createBuffer(c.kdfIterationCount);switch(d=d.getInt(d.length()<<3),n.oids[t]){case"aes128-CBC":p=16,f=e.aes.createDecryptionCipher;break;case"aes192-CBC":p=24,f=e.aes.createDecryptionCipher;break;case"aes256-CBC":p=32,f=e.aes.createDecryptionCipher;break;case"des-EDE3-CBC":p=24,f=e.des.createDecryptionCipher;break;case"desCBC":p=8,f=e.des.createDecryptionCipher}var y=u(c.prfOid),g=e.pkcs5.pbkdf2(i,h,d,p,y),v=c.encIv,m=f(g);return m.start(v),m},n.pbe.getCipherForPKCS12PBE=function(t,a,i){var s={},c=[];if(!r.validate(a,o,s,c))throw(y=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=c,y;var l,p,f,h=e.util.createBuffer(s.salt),d=e.util.createBuffer(s.iterations);switch(d=d.getInt(d.length()<<3),t){case n.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:l=24,p=8,f=e.des.startDecrypting;break;case n.oids["pbewithSHAAnd40BitRC2-CBC"]:l=5,p=8,f=function(t,r){var n=e.rc2.createDecryptionCipher(t,40);return n.start(r,null),n};break;default:var y;throw(y=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=t,y}var g=u(s.prfOid),v=n.pbe.generatePkcs12Key(i,h,1,d,l,g);return g.start(),f(v,n.pbe.generatePkcs12Key(i,h,2,d,p,g))},n.pbe.opensslDeriveBytes=function(t,r,n,a){if(null==a){if(!("md5"in e.md))throw new Error('"md5" hash algorithm unavailable.');a=e.md.md5.create()}null===r&&(r="");for(var i=[c(a,t+r)],s=16,o=1;s<n;++o,s+=16)i.push(c(a,i[o-1]+t+r));return i.join("").substr(0,n)},Te}var Re,we={exports:{}},_e={exports:{}};function Le(){if(Re)return _e.exports;Re=1;var e=l();k(),m();var t=e.asn1,r=_e.exports=e.pkcs7asn1=e.pkcs7asn1||{};e.pkcs7=e.pkcs7||{},e.pkcs7.asn1=r;var n={name:"ContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};r.contentInfoValidator=n;var a={name:"EncryptedContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};r.envelopedDataValidator={name:"EnvelopedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(a)},r.encryptedDataValidator={name:"EncryptedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"}].concat(a)};var i={name:"SignerInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};return r.signedDataValidator={name:"SignedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},n,{name:"SignedData.Certificates",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,capture:"signerInfos",optional:!0,value:[i]}]},r.recipientInfoValidator={name:"RecipientInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]},_e.exports}var ke,Ue,De,Pe={exports:{}},Ve={exports:{}};function Oe(){if(ke)return Ve.exports;ke=1;var e=l();return m(),e.mgf=e.mgf||{},(Ve.exports=e.mgf.mgf1=e.mgf1=e.mgf1||{}).create=function(t){return{generate:function(r,n){for(var a=new e.util.ByteBuffer,i=Math.ceil(n/t.digestLength),s=0;s<i;s++){var o=new e.util.ByteBuffer;o.putInt32(s),t.start(),t.update(r+o.getBytes()),a.putBuffer(t.digest())}return a.truncate(a.length()-n),a.getBytes()}}},Ve.exports}var xe,Ke,Me,Fe,je,qe,Ge,He={exports:{}};function Qe(){if(xe)return He.exports;xe=1;var e=l();return le(),m(),(He.exports=e.pss=e.pss||{}).create=function(t){3===arguments.length&&(t={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var r,n=t.md,a=t.mgf,i=n.digestLength,s=t.salt||null;if("string"==typeof s&&(s=e.util.createBuffer(s)),"saltLength"in t)r=t.saltLength;else{if(null===s)throw new Error("Salt length not specified or specific salt not given.");r=s.length()}if(null!==s&&s.length()!==r)throw new Error("Given salt length does not match length of given salt.");var o=t.prng||e.random,c={encode:function(t,c){var u,l,p=c-1,f=Math.ceil(p/8),h=t.digest().getBytes();if(f<i+r+2)throw new Error("Message is too long to encrypt.");l=null===s?o.getBytesSync(r):s.bytes();var d=new e.util.ByteBuffer;d.fillWithByte(0,8),d.putBytes(h),d.putBytes(l),n.start(),n.update(d.getBytes());var y=n.digest().getBytes(),g=new e.util.ByteBuffer;g.fillWithByte(0,f-r-i-2),g.putByte(1),g.putBytes(l);var v=g.getBytes(),m=f-i-1,C=a.generate(y,m),E="";for(u=0;u<m;u++)E+=String.fromCharCode(v.charCodeAt(u)^C.charCodeAt(u));var S=65280>>8*f-p&255;return(E=String.fromCharCode(E.charCodeAt(0)&~S)+E.substr(1))+y+String.fromCharCode(188)},verify:function(t,s,o){var c,u=o-1,l=Math.ceil(u/8);if(s=s.substr(-l),l<i+r+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==s.charCodeAt(l-1))throw new Error("Encoded message does not end in 0xBC.");var p=l-i-1,f=s.substr(0,p),h=s.substr(p,i),d=65280>>8*l-u&255;if(0!=(f.charCodeAt(0)&d))throw new Error("Bits beyond keysize not zero as expected.");var y=a.generate(h,p),g="";for(c=0;c<p;c++)g+=String.fromCharCode(f.charCodeAt(c)^y.charCodeAt(c));g=String.fromCharCode(g.charCodeAt(0)&~d)+g.substr(1);var v=l-i-r-2;for(c=0;c<v;c++)if(0!==g.charCodeAt(c))throw new Error("Leftmost octets not zero as expected");if(1!==g.charCodeAt(v))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var m=g.substr(-r),C=new e.util.ByteBuffer;return C.fillWithByte(0,8),C.putBytes(t),C.putBytes(m),n.start(),n.update(C.getBytes()),h===n.digest().getBytes()}};return c},He.exports}function ze(){if(Ke)return Pe.exports;Ke=1;var e=l();B(),k(),W(),O(),function(){if(De)return Ue;De=1;var e=l();Oe(),Ue=e.mgf=e.mgf||{},e.mgf.mgf1=e.mgf1}(),L(),G(),Qe(),be(),m();var t=e.asn1,r=Pe.exports=e.pki=e.pki||{},n=r.oids,a={};a.CN=n.commonName,a.commonName="CN",a.C=n.countryName,a.countryName="C",a.L=n.localityName,a.localityName="L",a.ST=n.stateOrProvinceName,a.stateOrProvinceName="ST",a.O=n.organizationName,a.organizationName="O",a.OU=n.organizationalUnitName,a.organizationalUnitName="OU",a.E=n.emailAddress,a.emailAddress="E";var i=e.pki.rsa.publicKeyValidator,s={name:"Certificate",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:t.Class.UNIVERSAL,type:t.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:t.Class.UNIVERSAL,type:t.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:t.Class.UNIVERSAL,type:t.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:t.Class.UNIVERSAL,type:t.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},i,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:t.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:t.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},o={name:"rsapss",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:t.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:t.Class.UNIVERSAL,type:t.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:t.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:t.Class.UNIVERSAL,type:t.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},c={name:"CertificationRequestInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},i,{name:"CertificationRequestInfo.attributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0}]}]}]},u={name:"CertificationRequest",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[c,{name:"CertificationRequest.signatureAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function p(e,t){"string"==typeof t&&(t={shortName:t});for(var r,n=null,a=0;null===n&&a<e.attributes.length;++a)r=e.attributes[a],(t.type&&t.type===r.type||t.name&&t.name===r.name||t.shortName&&t.shortName===r.shortName)&&(n=r);return n}r.RDNAttributesAsArray=function(e,r){for(var i,s,o,c=[],u=0;u<e.value.length;++u){i=e.value[u];for(var l=0;l<i.value.length;++l)o={},s=i.value[l],o.type=t.derToOid(s.value[0].value),o.value=s.value[1].value,o.valueTagClass=s.value[1].type,o.type in n&&(o.name=n[o.type],o.name in a&&(o.shortName=a[o.name])),r&&(r.update(o.type),r.update(o.value)),c.push(o)}return c},r.CRIAttributesAsArray=function(e){for(var i=[],s=0;s<e.length;++s)for(var o=e[s],c=t.derToOid(o.value[0].value),u=o.value[1].value,l=0;l<u.length;++l){var p={};if(p.type=c,p.value=u[l].value,p.valueTagClass=u[l].type,p.type in n&&(p.name=n[p.type],p.name in a&&(p.shortName=a[p.name])),p.type===n.extensionRequest){p.extensions=[];for(var f=0;f<p.value.length;++f)p.extensions.push(r.certificateExtensionFromAsn1(p.value[f]))}i.push(p)}return i};var f=function(e,r,a){var i={};if(e!==n["RSASSA-PSS"])return i;a&&(i={hash:{algorithmOid:n.sha1},mgf:{algorithmOid:n.mgf1,hash:{algorithmOid:n.sha1}},saltLength:20});var s={},c=[];if(!t.validate(r,o,s,c)){var u=new Error("Cannot read RSASSA-PSS parameter block.");throw u.errors=c,u}return void 0!==s.hashOid&&(i.hash=i.hash||{},i.hash.algorithmOid=t.derToOid(s.hashOid)),void 0!==s.maskGenOid&&(i.mgf=i.mgf||{},i.mgf.algorithmOid=t.derToOid(s.maskGenOid),i.mgf.hash=i.mgf.hash||{},i.mgf.hash.algorithmOid=t.derToOid(s.maskGenHashOid)),void 0!==s.saltLength&&(i.saltLength=s.saltLength.charCodeAt(0)),i},h=function(t){switch(n[t.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return e.md.sha1.create();case"md5WithRSAEncryption":return e.md.md5.create();case"sha256WithRSAEncryption":case"RSASSA-PSS":return e.md.sha256.create();case"sha384WithRSAEncryption":return e.md.sha384.create();case"sha512WithRSAEncryption":return e.md.sha512.create();default:var r=new Error("Could not compute "+t.type+" digest. Unknown signature OID.");throw r.signatureOid=t.signatureOid,r}},d=function(t){var r,a=t.certificate;switch(a.signatureOid){case n.sha1WithRSAEncryption:case n.sha1WithRSASignature:break;case n["RSASSA-PSS"]:var i,s,o;if(void 0===(i=n[a.signatureParameters.mgf.hash.algorithmOid])||void 0===e.md[i])throw(o=new Error("Unsupported MGF hash function.")).oid=a.signatureParameters.mgf.hash.algorithmOid,o.name=i,o;if(void 0===(s=n[a.signatureParameters.mgf.algorithmOid])||void 0===e.mgf[s])throw(o=new Error("Unsupported MGF function.")).oid=a.signatureParameters.mgf.algorithmOid,o.name=s,o;if(s=e.mgf[s].create(e.md[i].create()),void 0===(i=n[a.signatureParameters.hash.algorithmOid])||void 0===e.md[i])throw(o=new Error("Unsupported RSASSA-PSS hash function.")).oid=a.signatureParameters.hash.algorithmOid,o.name=i,o;r=e.pss.create(e.md[i].create(),s,a.signatureParameters.saltLength)}return a.publicKey.verify(t.md.digest().getBytes(),t.signature,r)};function y(r){for(var n,a,i=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),s=r.attributes,o=0;o<s.length;++o){var c=(n=s[o]).value,u=t.Type.PRINTABLESTRING;"valueTagClass"in n&&(u=n.valueTagClass)===t.Type.UTF8&&(c=e.util.encodeUtf8(c)),a=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(n.type).getBytes()),t.create(t.Class.UNIVERSAL,u,!1,c)])]),i.value.push(a)}return i}function g(e){for(var i,s=0;s<e.length;++s){if(void 0===(i=e[s]).name&&(i.type&&i.type in r.oids?i.name=r.oids[i.type]:i.shortName&&i.shortName in a&&(i.name=r.oids[a[i.shortName]])),void 0===i.type){if(!i.name||!(i.name in r.oids))throw(c=new Error("Attribute type not specified.")).attribute=i,c;i.type=r.oids[i.name]}if(void 0===i.shortName&&i.name&&i.name in a&&(i.shortName=a[i.name]),i.type===n.extensionRequest&&(i.valueConstructed=!0,i.valueTagClass=t.Type.SEQUENCE,!i.value&&i.extensions)){i.value=[];for(var o=0;o<i.extensions.length;++o)i.value.push(r.certificateExtensionToAsn1(v(i.extensions[o])))}var c;if(void 0===i.value)throw(c=new Error("Attribute value not specified.")).attribute=i,c}}function v(a,i){if(i=i||{},void 0===a.name&&a.id&&a.id in r.oids&&(a.name=r.oids[a.id]),void 0===a.id){if(!a.name||!(a.name in r.oids))throw(S=new Error("Extension ID not specified.")).extension=a,S;a.id=r.oids[a.name]}if(void 0!==a.value)return a;if("keyUsage"===a.name){var s=0,o=0,c=0;a.digitalSignature&&(o|=128,s=7),a.nonRepudiation&&(o|=64,s=6),a.keyEncipherment&&(o|=32,s=5),a.dataEncipherment&&(o|=16,s=4),a.keyAgreement&&(o|=8,s=3),a.keyCertSign&&(o|=4,s=2),a.cRLSign&&(o|=2,s=1),a.encipherOnly&&(o|=1,s=0),a.decipherOnly&&(c|=128,s=7);var u=String.fromCharCode(s);0!==c?u+=String.fromCharCode(o)+String.fromCharCode(c):0!==o&&(u+=String.fromCharCode(o)),a.value=t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,u)}else if("basicConstraints"===a.name)a.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),a.cA&&a.value.value.push(t.create(t.Class.UNIVERSAL,t.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in a&&a.value.value.push(t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(a.pathLenConstraint).getBytes()));else if("extKeyUsage"===a.name){a.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);var l=a.value.value;for(var p in a)!0===a[p]&&(p in n?l.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(n[p]).getBytes())):-1!==p.indexOf(".")&&l.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(p).getBytes())))}else if("nsCertType"===a.name){s=0,o=0;a.client&&(o|=128,s=7),a.server&&(o|=64,s=6),a.email&&(o|=32,s=5),a.objsign&&(o|=16,s=4),a.reserved&&(o|=8,s=3),a.sslCA&&(o|=4,s=2),a.emailCA&&(o|=2,s=1),a.objCA&&(o|=1,s=0);u=String.fromCharCode(s);0!==o&&(u+=String.fromCharCode(o)),a.value=t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,u)}else if("subjectAltName"===a.name||"issuerAltName"===a.name){a.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);for(var f=0;f<a.altNames.length;++f){u=(m=a.altNames[f]).value;if(7===m.type&&m.ip){if(null===(u=e.util.bytesFromIP(m.ip)))throw(S=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=a,S}else 8===m.type&&(u=m.oid?t.oidToDer(t.oidToDer(m.oid)):t.oidToDer(u));a.value.value.push(t.create(t.Class.CONTEXT_SPECIFIC,m.type,!1,u))}}else if("nsComment"===a.name&&i.cert){if(!/^[\x00-\x7F]*$/.test(a.comment)||a.comment.length<1||a.comment.length>128)throw new Error('Invalid "nsComment" content.');a.value=t.create(t.Class.UNIVERSAL,t.Type.IA5STRING,!1,a.comment)}else if("subjectKeyIdentifier"===a.name&&i.cert){var h=i.cert.generateSubjectKeyIdentifier();a.subjectKeyIdentifier=h.toHex(),a.value=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,h.getBytes())}else if("authorityKeyIdentifier"===a.name&&i.cert){a.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);l=a.value.value;if(a.keyIdentifier){var d=!0===a.keyIdentifier?i.cert.generateSubjectKeyIdentifier().getBytes():a.keyIdentifier;l.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!1,d))}if(a.authorityCertIssuer){var g=[t.create(t.Class.CONTEXT_SPECIFIC,4,!0,[y(!0===a.authorityCertIssuer?i.cert.issuer:a.authorityCertIssuer)])];l.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,g))}if(a.serialNumber){var v=e.util.hexToBytes(!0===a.serialNumber?i.cert.serialNumber:a.serialNumber);l.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!1,v))}}else if("cRLDistributionPoints"===a.name){a.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);l=a.value.value;var m,C=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),E=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);for(f=0;f<a.altNames.length;++f){u=(m=a.altNames[f]).value;if(7===m.type&&m.ip){if(null===(u=e.util.bytesFromIP(m.ip)))throw(S=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=a,S}else 8===m.type&&(u=m.oid?t.oidToDer(t.oidToDer(m.oid)):t.oidToDer(u));E.value.push(t.create(t.Class.CONTEXT_SPECIFIC,m.type,!1,u))}C.value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[E])),l.push(C)}var S;if(void 0===a.value)throw(S=new Error("Extension value not specified.")).extension=a,S;return a}function C(e,r){if(e===n["RSASSA-PSS"]){var a=[];return void 0!==r.hash.algorithmOid&&a.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.hash.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])])),void 0!==r.mgf.algorithmOid&&a.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.mgf.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.mgf.hash.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])])])),void 0!==r.saltLength&&a.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(r.saltLength).getBytes())])),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,a)}return t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")}function E(r){var n=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===r.attributes.length)return n;for(var a=r.attributes,i=0;i<a.length;++i){var s=a[i],o=s.value,c=t.Type.UTF8;"valueTagClass"in s&&(c=s.valueTagClass),c===t.Type.UTF8&&(o=e.util.encodeUtf8(o));var u=!1;"valueConstructed"in s&&(u=s.valueConstructed);var l=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(s.type).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,c,u,o)])]);n.value.push(l)}return n}r.certificateFromPem=function(n,a,i){var s=e.pem.decode(n)[0];if("CERTIFICATE"!==s.type&&"X509 CERTIFICATE"!==s.type&&"TRUSTED CERTIFICATE"!==s.type){var o=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw o.headerType=s.type,o}if(s.procType&&"ENCRYPTED"===s.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var c=t.fromDer(s.body,i);return r.certificateFromAsn1(c,a)},r.certificateToPem=function(n,a){var i={type:"CERTIFICATE",body:t.toDer(r.certificateToAsn1(n)).getBytes()};return e.pem.encode(i,{maxline:a})},r.publicKeyFromPem=function(n){var a=e.pem.decode(n)[0];if("PUBLIC KEY"!==a.type&&"RSA PUBLIC KEY"!==a.type){var i=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw i.headerType=a.type,i}if(a.procType&&"ENCRYPTED"===a.procType.type)throw new Error("Could not convert public key from PEM; PEM is encrypted.");var s=t.fromDer(a.body);return r.publicKeyFromAsn1(s)},r.publicKeyToPem=function(n,a){var i={type:"PUBLIC KEY",body:t.toDer(r.publicKeyToAsn1(n)).getBytes()};return e.pem.encode(i,{maxline:a})},r.publicKeyToRSAPublicKeyPem=function(n,a){var i={type:"RSA PUBLIC KEY",body:t.toDer(r.publicKeyToRSAPublicKey(n)).getBytes()};return e.pem.encode(i,{maxline:a})},r.getPublicKeyFingerprint=function(n,a){var i,s=(a=a||{}).md||e.md.sha1.create();switch(a.type||"RSAPublicKey"){case"RSAPublicKey":i=t.toDer(r.publicKeyToRSAPublicKey(n)).getBytes();break;case"SubjectPublicKeyInfo":i=t.toDer(r.publicKeyToAsn1(n)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+a.type+'".')}s.start(),s.update(i);var o=s.digest();if("hex"===a.encoding){var c=o.toHex();return a.delimiter?c.match(/.{2}/g).join(a.delimiter):c}if("binary"===a.encoding)return o.getBytes();if(a.encoding)throw new Error('Unknown encoding "'+a.encoding+'".');return o},r.certificationRequestFromPem=function(n,a,i){var s=e.pem.decode(n)[0];if("CERTIFICATE REQUEST"!==s.type){var o=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw o.headerType=s.type,o}if(s.procType&&"ENCRYPTED"===s.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var c=t.fromDer(s.body,i);return r.certificationRequestFromAsn1(c,a)},r.certificationRequestToPem=function(n,a){var i={type:"CERTIFICATE REQUEST",body:t.toDer(r.certificationRequestToAsn1(n)).getBytes()};return e.pem.encode(i,{maxline:a})},r.createCertificate=function(){var a={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};return a.siginfo.algorithmOid=null,a.validity={},a.validity.notBefore=new Date,a.validity.notAfter=new Date,a.issuer={},a.issuer.getField=function(e){return p(a.issuer,e)},a.issuer.addField=function(e){g([e]),a.issuer.attributes.push(e)},a.issuer.attributes=[],a.issuer.hash=null,a.subject={},a.subject.getField=function(e){return p(a.subject,e)},a.subject.addField=function(e){g([e]),a.subject.attributes.push(e)},a.subject.attributes=[],a.subject.hash=null,a.extensions=[],a.publicKey=null,a.md=null,a.setSubject=function(e,t){g(e),a.subject.attributes=e,delete a.subject.uniqueId,t&&(a.subject.uniqueId=t),a.subject.hash=null},a.setIssuer=function(e,t){g(e),a.issuer.attributes=e,delete a.issuer.uniqueId,t&&(a.issuer.uniqueId=t),a.issuer.hash=null},a.setExtensions=function(e){for(var t=0;t<e.length;++t)v(e[t],{cert:a});a.extensions=e},a.getExtension=function(e){"string"==typeof e&&(e={name:e});for(var t,r=null,n=0;null===r&&n<a.extensions.length;++n)t=a.extensions[n],(e.id&&t.id===e.id||e.name&&t.name===e.name)&&(r=t);return r},a.sign=function(i,s){a.md=s||e.md.sha1.create();var o=n[a.md.algorithm+"WithRSAEncryption"];if(!o){var c=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw c.algorithm=a.md.algorithm,c}a.signatureOid=a.siginfo.algorithmOid=o,a.tbsCertificate=r.getTBSCertificate(a);var u=t.toDer(a.tbsCertificate);a.md.update(u.getBytes()),a.signature=i.sign(a.md)},a.verify=function(e){var n=!1;if(!a.issued(e)){var i=e.issuer,s=a.subject,o=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw o.expectedIssuer=s.attributes,o.actualIssuer=i.attributes,o}var c=e.md;if(null===c){c=h({signatureOid:e.signatureOid,type:"certificate"});var u=e.tbsCertificate||r.getTBSCertificate(e),l=t.toDer(u);c.update(l.getBytes())}return null!==c&&(n=d({certificate:a,md:c,signature:e.signature})),n},a.isIssuer=function(e){var t=!1,r=a.issuer,n=e.subject;if(r.hash&&n.hash)t=r.hash===n.hash;else if(r.attributes.length===n.attributes.length){var i,s;t=!0;for(var o=0;t&&o<r.attributes.length;++o)i=r.attributes[o],s=n.attributes[o],i.type===s.type&&i.value===s.value||(t=!1)}return t},a.issued=function(e){return e.isIssuer(a)},a.generateSubjectKeyIdentifier=function(){return r.getPublicKeyFingerprint(a.publicKey,{type:"RSAPublicKey"})},a.verifySubjectKeyIdentifier=function(){for(var t=n.subjectKeyIdentifier,r=0;r<a.extensions.length;++r){var i=a.extensions[r];if(i.id===t){var s=a.generateSubjectKeyIdentifier().getBytes();return e.util.hexToBytes(i.subjectKeyIdentifier)===s}}return!1},a},r.certificateFromAsn1=function(n,a){var i={},o=[];if(!t.validate(n,s,i,o)){var c=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw c.errors=o,c}if(t.derToOid(i.publicKeyOid)!==r.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var u=r.createCertificate();u.version=i.certVersion?i.certVersion.charCodeAt(0):0;var l=e.util.createBuffer(i.certSerialNumber);u.serialNumber=l.toHex(),u.signatureOid=e.asn1.derToOid(i.certSignatureOid),u.signatureParameters=f(u.signatureOid,i.certSignatureParams,!0),u.siginfo.algorithmOid=e.asn1.derToOid(i.certinfoSignatureOid),u.siginfo.parameters=f(u.siginfo.algorithmOid,i.certinfoSignatureParams,!1),u.signature=i.certSignature;var d=[];if(void 0!==i.certValidity1UTCTime&&d.push(t.utcTimeToDate(i.certValidity1UTCTime)),void 0!==i.certValidity2GeneralizedTime&&d.push(t.generalizedTimeToDate(i.certValidity2GeneralizedTime)),void 0!==i.certValidity3UTCTime&&d.push(t.utcTimeToDate(i.certValidity3UTCTime)),void 0!==i.certValidity4GeneralizedTime&&d.push(t.generalizedTimeToDate(i.certValidity4GeneralizedTime)),d.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(d.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(u.validity.notBefore=d[0],u.validity.notAfter=d[1],u.tbsCertificate=i.tbsCertificate,a){u.md=h({signatureOid:u.signatureOid,type:"certificate"});var y=t.toDer(u.tbsCertificate);u.md.update(y.getBytes())}var v=e.md.sha1.create(),m=t.toDer(i.certIssuer);v.update(m.getBytes()),u.issuer.getField=function(e){return p(u.issuer,e)},u.issuer.addField=function(e){g([e]),u.issuer.attributes.push(e)},u.issuer.attributes=r.RDNAttributesAsArray(i.certIssuer),i.certIssuerUniqueId&&(u.issuer.uniqueId=i.certIssuerUniqueId),u.issuer.hash=v.digest().toHex();var C=e.md.sha1.create(),E=t.toDer(i.certSubject);return C.update(E.getBytes()),u.subject.getField=function(e){return p(u.subject,e)},u.subject.addField=function(e){g([e]),u.subject.attributes.push(e)},u.subject.attributes=r.RDNAttributesAsArray(i.certSubject),i.certSubjectUniqueId&&(u.subject.uniqueId=i.certSubjectUniqueId),u.subject.hash=C.digest().toHex(),i.certExtensions?u.extensions=r.certificateExtensionsFromAsn1(i.certExtensions):u.extensions=[],u.publicKey=r.publicKeyFromAsn1(i.subjectPublicKeyInfo),u},r.certificateExtensionsFromAsn1=function(e){for(var t=[],n=0;n<e.value.length;++n)for(var a=e.value[n],i=0;i<a.value.length;++i)t.push(r.certificateExtensionFromAsn1(a.value[i]));return t},r.certificateExtensionFromAsn1=function(r){var a={};if(a.id=t.derToOid(r.value[0].value),a.critical=!1,r.value[1].type===t.Type.BOOLEAN?(a.critical=0!==r.value[1].value.charCodeAt(0),a.value=r.value[2].value):a.value=r.value[1].value,a.id in n)if(a.name=n[a.id],"keyUsage"===a.name){var i=0,s=0;(c=t.fromDer(a.value)).value.length>1&&(i=c.value.charCodeAt(1),s=c.value.length>2?c.value.charCodeAt(2):0),a.digitalSignature=128==(128&i),a.nonRepudiation=64==(64&i),a.keyEncipherment=32==(32&i),a.dataEncipherment=16==(16&i),a.keyAgreement=8==(8&i),a.keyCertSign=4==(4&i),a.cRLSign=2==(2&i),a.encipherOnly=1==(1&i),a.decipherOnly=128==(128&s)}else if("basicConstraints"===a.name){(c=t.fromDer(a.value)).value.length>0&&c.value[0].type===t.Type.BOOLEAN?a.cA=0!==c.value[0].value.charCodeAt(0):a.cA=!1;var o=null;c.value.length>0&&c.value[0].type===t.Type.INTEGER?o=c.value[0].value:c.value.length>1&&(o=c.value[1].value),null!==o&&(a.pathLenConstraint=t.derToInteger(o))}else if("extKeyUsage"===a.name)for(var c=t.fromDer(a.value),u=0;u<c.value.length;++u){var l=t.derToOid(c.value[u].value);l in n?a[n[l]]=!0:a[l]=!0}else if("nsCertType"===a.name){i=0;(c=t.fromDer(a.value)).value.length>1&&(i=c.value.charCodeAt(1)),a.client=128==(128&i),a.server=64==(64&i),a.email=32==(32&i),a.objsign=16==(16&i),a.reserved=8==(8&i),a.sslCA=4==(4&i),a.emailCA=2==(2&i),a.objCA=1==(1&i)}else if("subjectAltName"===a.name||"issuerAltName"===a.name){var p;a.altNames=[];c=t.fromDer(a.value);for(var f=0;f<c.value.length;++f){var h={type:(p=c.value[f]).type,value:p.value};switch(a.altNames.push(h),p.type){case 1:case 2:case 6:break;case 7:h.ip=e.util.bytesToIP(p.value);break;case 8:h.oid=t.derToOid(p.value)}}}else if("subjectKeyIdentifier"===a.name){c=t.fromDer(a.value);a.subjectKeyIdentifier=e.util.bytesToHex(c.value)}return a},r.certificationRequestFromAsn1=function(n,a){var i={},s=[];if(!t.validate(n,u,i,s)){var o=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw o.errors=s,o}if(t.derToOid(i.publicKeyOid)!==r.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var c=r.createCertificationRequest();if(c.version=i.csrVersion?i.csrVersion.charCodeAt(0):0,c.signatureOid=e.asn1.derToOid(i.csrSignatureOid),c.signatureParameters=f(c.signatureOid,i.csrSignatureParams,!0),c.siginfo.algorithmOid=e.asn1.derToOid(i.csrSignatureOid),c.siginfo.parameters=f(c.siginfo.algorithmOid,i.csrSignatureParams,!1),c.signature=i.csrSignature,c.certificationRequestInfo=i.certificationRequestInfo,a){c.md=h({signatureOid:c.signatureOid,type:"certification request"});var l=t.toDer(c.certificationRequestInfo);c.md.update(l.getBytes())}var d=e.md.sha1.create();return c.subject.getField=function(e){return p(c.subject,e)},c.subject.addField=function(e){g([e]),c.subject.attributes.push(e)},c.subject.attributes=r.RDNAttributesAsArray(i.certificationRequestInfoSubject,d),c.subject.hash=d.digest().toHex(),c.publicKey=r.publicKeyFromAsn1(i.subjectPublicKeyInfo),c.getAttribute=function(e){return p(c,e)},c.addAttribute=function(e){g([e]),c.attributes.push(e)},c.attributes=r.CRIAttributesAsArray(i.certificationRequestInfoAttributes||[]),c},r.createCertificationRequest=function(){var a={version:0,signatureOid:null,signature:null,siginfo:{}};return a.siginfo.algorithmOid=null,a.subject={},a.subject.getField=function(e){return p(a.subject,e)},a.subject.addField=function(e){g([e]),a.subject.attributes.push(e)},a.subject.attributes=[],a.subject.hash=null,a.publicKey=null,a.attributes=[],a.getAttribute=function(e){return p(a,e)},a.addAttribute=function(e){g([e]),a.attributes.push(e)},a.md=null,a.setSubject=function(e){g(e),a.subject.attributes=e,a.subject.hash=null},a.setAttributes=function(e){g(e),a.attributes=e},a.sign=function(i,s){a.md=s||e.md.sha1.create();var o=n[a.md.algorithm+"WithRSAEncryption"];if(!o){var c=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw c.algorithm=a.md.algorithm,c}a.signatureOid=a.siginfo.algorithmOid=o,a.certificationRequestInfo=r.getCertificationRequestInfo(a);var u=t.toDer(a.certificationRequestInfo);a.md.update(u.getBytes()),a.signature=i.sign(a.md)},a.verify=function(){var e=!1,n=a.md;if(null===n){n=h({signatureOid:a.signatureOid,type:"certification request"});var i=a.certificationRequestInfo||r.getCertificationRequestInfo(a),s=t.toDer(i);n.update(s.getBytes())}return null!==n&&(e=d({certificate:a,md:n,signature:a.signature})),e},a};var S=new Date("1950-01-01T00:00:00Z"),T=new Date("2050-01-01T00:00:00Z");function I(e){return e>=S&&e<T?t.create(t.Class.UNIVERSAL,t.Type.UTCTIME,!1,t.dateToUtcTime(e)):t.create(t.Class.UNIVERSAL,t.Type.GENERALIZEDTIME,!1,t.dateToGeneralizedTime(e))}return r.getTBSCertificate=function(n){var a=I(n.validity.notBefore),i=I(n.validity.notAfter),s=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(n.version).getBytes())]),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,e.util.hexToBytes(n.serialNumber)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(n.siginfo.algorithmOid).getBytes()),C(n.siginfo.algorithmOid,n.siginfo.parameters)]),y(n.issuer),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[a,i]),y(n.subject),r.publicKeyToAsn1(n.publicKey)]);return n.issuer.uniqueId&&s.value.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+n.issuer.uniqueId)])),n.subject.uniqueId&&s.value.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!0,[t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+n.subject.uniqueId)])),n.extensions.length>0&&s.value.push(r.certificateExtensionsToAsn1(n.extensions)),s},r.getCertificationRequestInfo=function(e){return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes()),y(e.subject),r.publicKeyToAsn1(e.publicKey),E(e)])},r.distinguishedNameToAsn1=function(e){return y(e)},r.certificateToAsn1=function(e){var n=e.tbsCertificate||r.getTBSCertificate(e);return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[n,t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.signatureOid).getBytes()),C(e.signatureOid,e.signatureParameters)]),t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},r.certificateExtensionsToAsn1=function(e){var n=t.create(t.Class.CONTEXT_SPECIFIC,3,!0,[]),a=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);n.value.push(a);for(var i=0;i<e.length;++i)a.value.push(r.certificateExtensionToAsn1(e[i]));return n},r.certificateExtensionToAsn1=function(e){var r=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);r.value.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.id).getBytes())),e.critical&&r.value.push(t.create(t.Class.UNIVERSAL,t.Type.BOOLEAN,!1,String.fromCharCode(255)));var n=e.value;return"string"!=typeof e.value&&(n=t.toDer(n).getBytes()),r.value.push(t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,n)),r},r.certificationRequestToAsn1=function(e){var n=e.certificationRequestInfo||r.getCertificationRequestInfo(e);return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[n,t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.signatureOid).getBytes()),C(e.signatureOid,e.signatureParameters)]),t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},r.createCaStore=function(n){var a={certs:{}};function i(e){return s(e),a.certs[e.hash]||null}function s(t){if(!t.hash){var n=e.md.sha1.create();t.attributes=r.RDNAttributesAsArray(y(t),n),t.hash=n.digest().toHex()}}if(a.getIssuer=function(e){return i(e.issuer)},a.addCertificate=function(t){if("string"==typeof t&&(t=e.pki.certificateFromPem(t)),s(t.subject),!a.hasCertificate(t))if(t.subject.hash in a.certs){var r=a.certs[t.subject.hash];e.util.isArray(r)||(r=[r]),r.push(t),a.certs[t.subject.hash]=r}else a.certs[t.subject.hash]=t},a.hasCertificate=function(n){"string"==typeof n&&(n=e.pki.certificateFromPem(n));var a=i(n.subject);if(!a)return!1;e.util.isArray(a)||(a=[a]);for(var s=t.toDer(r.certificateToAsn1(n)).getBytes(),o=0;o<a.length;++o){if(s===t.toDer(r.certificateToAsn1(a[o])).getBytes())return!0}return!1},a.listAllCertificates=function(){var t=[];for(var r in a.certs)if(a.certs.hasOwnProperty(r)){var n=a.certs[r];if(e.util.isArray(n))for(var i=0;i<n.length;++i)t.push(n[i]);else t.push(n)}return t},a.removeCertificate=function(n){var o;if("string"==typeof n&&(n=e.pki.certificateFromPem(n)),s(n.subject),!a.hasCertificate(n))return null;var c=i(n.subject);if(!e.util.isArray(c))return o=a.certs[n.subject.hash],delete a.certs[n.subject.hash],o;for(var u=t.toDer(r.certificateToAsn1(n)).getBytes(),l=0;l<c.length;++l){u===t.toDer(r.certificateToAsn1(c[l])).getBytes()&&(o=c[l],c.splice(l,1))}return 0===c.length&&delete a.certs[n.subject.hash],o},n)for(var o=0;o<n.length;++o){var c=n[o];a.addCertificate(c)}return a},r.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},r.verifyCertificateChain=function(t,n,a){"function"==typeof a&&(a={verify:a}),a=a||{};var i=(n=n.slice(0)).slice(0),s=a.validityCheckDate;void 0===s&&(s=new Date);var o=!0,c=null,u=0;do{var l=n.shift(),p=null,f=!1;if(s&&(s<l.validity.notBefore||s>l.validity.notAfter)&&(c={message:"Certificate is not valid yet or has expired.",error:r.certificateError.certificate_expired,notBefore:l.validity.notBefore,notAfter:l.validity.notAfter,now:s}),null===c){if(null===(p=n[0]||t.getIssuer(l))&&l.isIssuer(l)&&(f=!0,p=l),p){var h=p;e.util.isArray(h)||(h=[h]);for(var d=!1;!d&&h.length>0;){p=h.shift();try{d=p.verify(l)}catch(e){}}d||(c={message:"Certificate signature is invalid.",error:r.certificateError.bad_certificate})}null!==c||p&&!f||t.hasCertificate(l)||(c={message:"Certificate is not trusted.",error:r.certificateError.unknown_ca})}if(null===c&&p&&!l.isIssuer(p)&&(c={message:"Certificate issuer is invalid.",error:r.certificateError.bad_certificate}),null===c)for(var y={keyUsage:!0,basicConstraints:!0},g=0;null===c&&g<l.extensions.length;++g){var v=l.extensions[g];v.critical&&!(v.name in y)&&(c={message:"Certificate has an unsupported critical extension.",error:r.certificateError.unsupported_certificate})}if(null===c&&(!o||0===n.length&&(!p||f))){var m=l.getExtension("basicConstraints"),C=l.getExtension("keyUsage");if(null!==C&&(C.keyCertSign&&null!==m||(c={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:r.certificateError.bad_certificate})),null!==c||null===m||m.cA||(c={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:r.certificateError.bad_certificate}),null===c&&null!==C&&"pathLenConstraint"in m)u-1>m.pathLenConstraint&&(c={message:"Certificate basicConstraints pathLenConstraint violated.",error:r.certificateError.bad_certificate})}var E=null===c||c.error,S=a.verify?a.verify(E,u,i):E;if(!0!==S)throw!0===E&&(c={message:"The application rejected the certificate.",error:r.certificateError.bad_certificate}),(S||0===S)&&("object"!=typeof S||e.util.isArray(S)?"string"==typeof S&&(c.error=S):(S.message&&(c.message=S.message),S.error&&(c.error=S.error))),c;c=null,o=!1,++u}while(n.length>0);return!0},Pe.exports}function Ye(){if(Me)return we.exports;Me=1;var e=l();k(),x(),L(),Le(),Ne(),le(),be(),ve(),m(),ze();var t=e.asn1,r=e.pki,n=we.exports=e.pkcs12=e.pkcs12||{},a={name:"ContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},i={name:"PFX",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},a,{name:"PFX.macData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:t.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},s={name:"SafeBag",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},o={name:"Attribute",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,capture:"values"}]},c={name:"CertBag",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:t.Class.UNIVERSAL,type:t.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function u(e,t,r,n){for(var a=[],i=0;i<e.length;i++)for(var s=0;s<e[i].safeBags.length;s++){var o=e[i].safeBags[s];void 0!==n&&o.type!==n||(null!==t?void 0!==o.attributes[t]&&o.attributes[t].indexOf(r)>=0&&a.push(o):a.push(o))}return a}function p(t){if(t.composed||t.constructed){for(var r=e.util.createBuffer(),n=0;n<t.value.length;++n)r.putBytes(t.value[n].value);t.composed=t.constructed=!1,t.value=r.getBytes()}return t}function f(n,a){var i={},s=[];if(!t.validate(n,e.pkcs7.asn1.encryptedDataValidator,i,s))throw(o=new Error("Cannot read EncryptedContentInfo.")).errors=s,o;var o,c=t.derToOid(i.contentType);if(c!==r.oids.data)throw(o=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.")).oid=c,o;c=t.derToOid(i.encAlgorithm);var u=r.pbe.getCipher(c,i.encParameter,a),l=p(i.encryptedContentAsn1),f=e.util.createBuffer(l.value);if(u.update(f),!u.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return u.output.getBytes()}function h(e,n,a){if(!n&&0===e.length)return[];if((e=t.fromDer(e,n)).tagClass!==t.Class.UNIVERSAL||e.type!==t.Type.SEQUENCE||!0!==e.constructed)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var i=[],o=0;o<e.value.length;o++){var u=e.value[o],l={},p=[];if(!t.validate(u,s,l,p))throw(v=new Error("Cannot read SafeBag.")).errors=p,v;var f,h,y={type:t.derToOid(l.bagId),attributes:d(l.bagAttributes)};i.push(y);var g=l.bagValue.value[0];switch(y.type){case r.oids.pkcs8ShroudedKeyBag:if(null===(g=r.decryptPrivateKeyInfo(g,a)))throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case r.oids.keyBag:try{y.key=r.privateKeyFromAsn1(g)}catch(e){y.key=null,y.asn1=g}continue;case r.oids.certBag:f=c,h=function(){if(t.derToOid(l.certId)!==r.oids.x509Certificate){var e=new Error("Unsupported certificate type, only X.509 supported.");throw e.oid=t.derToOid(l.certId),e}var a=t.fromDer(l.cert,n);try{y.cert=r.certificateFromAsn1(a,!0)}catch(e){y.cert=null,y.asn1=a}};break;default:var v;throw(v=new Error("Unsupported PKCS#12 SafeBag type.")).oid=y.type,v}if(void 0!==f&&!t.validate(g,f,l,p))throw(v=new Error("Cannot read PKCS#12 "+f.name)).errors=p,v;h()}return i}function d(e){var n={};if(void 0!==e)for(var a=0;a<e.length;++a){var i={},s=[];if(!t.validate(e[a],o,i,s)){var c=new Error("Cannot read PKCS#12 BagAttribute.");throw c.errors=s,c}var u=t.derToOid(i.oid);if(void 0!==r.oids[u]){n[r.oids[u]]=[];for(var l=0;l<i.values.length;++l)n[r.oids[u]].push(i.values[l].value)}}return n}return n.pkcs12FromAsn1=function(s,o,c){"string"==typeof o?(c=o,o=!0):void 0===o&&(o=!0);var l={};if(!t.validate(s,i,l,[]))throw(d=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.")).errors=d,d;var d,y={version:l.version.charCodeAt(0),safeContents:[],getBags:function(t){var r,n={};return"localKeyId"in t?r=t.localKeyId:"localKeyIdHex"in t&&(r=e.util.hexToBytes(t.localKeyIdHex)),void 0===r&&!("friendlyName"in t)&&"bagType"in t&&(n[t.bagType]=u(y.safeContents,null,null,t.bagType)),void 0!==r&&(n.localKeyId=u(y.safeContents,"localKeyId",r,t.bagType)),"friendlyName"in t&&(n.friendlyName=u(y.safeContents,"friendlyName",t.friendlyName,t.bagType)),n},getBagsByFriendlyName:function(e,t){return u(y.safeContents,"friendlyName",e,t)},getBagsByLocalKeyId:function(e,t){return u(y.safeContents,"localKeyId",e,t)}};if(3!==l.version.charCodeAt(0))throw(d=new Error("PKCS#12 PFX of version other than 3 not supported.")).version=l.version.charCodeAt(0),d;if(t.derToOid(l.contentType)!==r.oids.data)throw(d=new Error("Only PKCS#12 PFX in password integrity mode supported.")).oid=t.derToOid(l.contentType),d;var g=l.content.value[0];if(g.tagClass!==t.Class.UNIVERSAL||g.type!==t.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(g=p(g),l.mac){var v=null,m=0,C=t.derToOid(l.macAlgorithm);switch(C){case r.oids.sha1:v=e.md.sha1.create(),m=20;break;case r.oids.sha256:v=e.md.sha256.create(),m=32;break;case r.oids.sha384:v=e.md.sha384.create(),m=48;break;case r.oids.sha512:v=e.md.sha512.create(),m=64;break;case r.oids.md5:v=e.md.md5.create(),m=16}if(null===v)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+C);var E=new e.util.ByteBuffer(l.macSalt),S="macIterations"in l?parseInt(e.util.bytesToHex(l.macIterations),16):1,T=n.generateKey(c,E,3,S,m,v),I=e.hmac.create();if(I.start(v,T),I.update(g.value),I.getMac().getBytes()!==l.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}return function(e,n,i,s){if(n=t.fromDer(n,i),n.tagClass!==t.Class.UNIVERSAL||n.type!==t.Type.SEQUENCE||!0!==n.constructed)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var o=0;o<n.value.length;o++){var c=n.value[o],u={},l=[];if(!t.validate(c,a,u,l))throw(v=new Error("Cannot read ContentInfo.")).errors=l,v;var d={encrypted:!1},y=null,g=u.content.value[0];switch(t.derToOid(u.contentType)){case r.oids.data:if(g.tagClass!==t.Class.UNIVERSAL||g.type!==t.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");y=p(g).value;break;case r.oids.encryptedData:y=f(g,s),d.encrypted=!0;break;default:var v;throw(v=new Error("Unsupported PKCS#12 contentType.")).contentType=t.derToOid(u.contentType),v}d.safeBags=h(y,i,s),e.safeContents.push(d)}}(y,g.value,o,c),y},n.toPkcs12Asn1=function(a,i,s,o){(o=o||{}).saltSize=o.saltSize||8,o.count=o.count||2048,o.algorithm=o.algorithm||o.encAlgorithm||"aes128","useMac"in o||(o.useMac=!0),"localKeyId"in o||(o.localKeyId=null),"generateLocalKeyId"in o||(o.generateLocalKeyId=!0);var c,u=o.localKeyId;if(null!==u)u=e.util.hexToBytes(u);else if(o.generateLocalKeyId)if(i){var l=e.util.isArray(i)?i[0]:i;"string"==typeof l&&(l=r.certificateFromPem(l)),(N=e.md.sha1.create()).update(t.toDer(r.certificateToAsn1(l)).getBytes()),u=N.digest().getBytes()}else u=e.random.getBytes(20);var p=[];null!==u&&p.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.localKeyId).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,u)])])),"friendlyName"in o&&p.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.friendlyName).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.BMPSTRING,!1,o.friendlyName)])])),p.length>0&&(c=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,p));var f=[],h=[];null!==i&&(h=e.util.isArray(i)?i:[i]);for(var d=[],y=0;y<h.length;++y){"string"==typeof(i=h[y])&&(i=r.certificateFromPem(i));var g=0===y?c:void 0,v=r.certificateToAsn1(i),m=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.certBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.x509Certificate).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(v).getBytes())])])]),g]);d.push(m)}if(d.length>0){var C=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,d),E=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(C).getBytes())])]);f.push(E)}var S=null;if(null!==a){var T=r.wrapRsaPrivateKey(r.privateKeyToAsn1(a));S=null===s?t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.keyBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[T]),c]):t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.pkcs8ShroudedKeyBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[r.encryptPrivateKeyInfo(T,s,o)]),c]);var I=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[S]),A=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(I).getBytes())])]);f.push(A)}var B,b=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,f);if(o.useMac){var N=e.md.sha1.create(),R=new e.util.ByteBuffer(e.random.getBytes(o.saltSize)),w=o.count,_=(a=n.generateKey(s,R,3,w,20),e.hmac.create());_.start(N,a),_.update(t.toDer(b).getBytes());var L=_.getMac();B=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.sha1).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,L.getBytes())]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,R.getBytes()),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(w).getBytes())])}return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(3).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(b).getBytes())])]),B])},n.generateKey=e.pbe.generatePkcs12Key,we.exports}function Xe(){if(Fe)return X.exports;Fe=1;var e=l();k(),L(),Ne(),G(),Z(),Ye(),Qe(),be(),m(),ze();var t=e.asn1,r=X.exports=e.pki=e.pki||{};return r.pemToDer=function(t){var r=e.pem.decode(t)[0];if(r.procType&&"ENCRYPTED"===r.procType.type)throw new Error("Could not convert PEM to DER; PEM is encrypted.");return e.util.createBuffer(r.body)},r.privateKeyFromPem=function(n){var a=e.pem.decode(n)[0];if("PRIVATE KEY"!==a.type&&"RSA PRIVATE KEY"!==a.type){var i=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw i.headerType=a.type,i}if(a.procType&&"ENCRYPTED"===a.procType.type)throw new Error("Could not convert private key from PEM; PEM is encrypted.");var s=t.fromDer(a.body);return r.privateKeyFromAsn1(s)},r.privateKeyToPem=function(n,a){var i={type:"RSA PRIVATE KEY",body:t.toDer(r.privateKeyToAsn1(n)).getBytes()};return e.pem.encode(i,{maxline:a})},r.privateKeyInfoToPem=function(r,n){var a={type:"PRIVATE KEY",body:t.toDer(r).getBytes()};return e.pem.encode(a,{maxline:n})},X.exports}function We(){if(qe)return je;qe=1;var e=l();k(),x(),F(),G(),Xe(),le(),ve(),m();var t=function(t,r,n,a){var i=e.util.createBuffer(),s=t.length>>1,o=s+(1&t.length),c=t.substr(0,o),u=t.substr(s,o),l=e.util.createBuffer(),p=e.hmac.create();n=r+n;var f=Math.ceil(a/16),h=Math.ceil(a/20);p.start("MD5",c);var d=e.util.createBuffer();l.putBytes(n);for(var y=0;y<f;++y)p.start(null,null),p.update(l.getBytes()),l.putBuffer(p.digest()),p.start(null,null),p.update(l.bytes()+n),d.putBuffer(p.digest());p.start("SHA1",u);var g=e.util.createBuffer();l.clear(),l.putBytes(n);for(y=0;y<h;++y)p.start(null,null),p.update(l.getBytes()),l.putBuffer(p.digest()),p.start(null,null),p.update(l.bytes()+n),g.putBuffer(p.digest());return i.putBytes(e.util.xorBytes(d.getBytes(),g.getBytes(),a)),i},r=function(t,r,n){var a=!1;try{var i=t.deflate(r.fragment.getBytes());r.fragment=e.util.createBuffer(i),r.length=i.length,a=!0}catch(e){}return a},n=function(t,r,n){var a=!1;try{var i=t.inflate(r.fragment.getBytes());r.fragment=e.util.createBuffer(i),r.length=i.length,a=!0}catch(e){}return a},a=function(t,r){var n=0;switch(r){case 1:n=t.getByte();break;case 2:n=t.getInt16();break;case 3:n=t.getInt24();break;case 4:n=t.getInt32()}return e.util.createBuffer(t.getBytes(n))},i=function(e,t,r){e.putInt(r.length(),t<<3),e.putBuffer(r)},s={Versions:{TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}}};s.SupportedVersions=[s.Versions.TLS_1_1,s.Versions.TLS_1_0],s.Version=s.SupportedVersions[0],s.MaxFragment=15360,s.ConnectionEnd={server:0,client:1},s.PRFAlgorithm={tls_prf_sha256:0},s.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},s.CipherType={stream:0,block:1,aead:2},s.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},s.CompressionMethod={none:0,deflate:1},s.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},s.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20},s.Alert={},s.Alert.Level={warning:1,fatal:2},s.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100},s.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},s.CipherSuites={},s.getCipherSuite=function(e){var t=null;for(var r in s.CipherSuites){var n=s.CipherSuites[r];if(n.id[0]===e.charCodeAt(0)&&n.id[1]===e.charCodeAt(1)){t=n;break}}return t},s.handleUnexpected=function(e,t){!e.open&&e.entity===s.ConnectionEnd.client||e.error(e,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.unexpected_message}})},s.handleHelloRequest=function(e,t,r){!e.handshaking&&e.handshakes>0&&(s.queue(e,s.createAlert(e,{level:s.Alert.Level.warning,description:s.Alert.Description.no_renegotiation})),s.flush(e)),e.process()},s.parseHelloMessage=function(t,r,n){var i=null,o=t.entity===s.ConnectionEnd.client;if(n<38)t.error(t,{message:o?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.illegal_parameter}});else{var c=r.fragment,u=c.length();if(i={version:{major:c.getByte(),minor:c.getByte()},random:e.util.createBuffer(c.getBytes(32)),session_id:a(c,1),extensions:[]},o?(i.cipher_suite=c.getBytes(2),i.compression_method=c.getByte()):(i.cipher_suites=a(c,2),i.compression_methods=a(c,1)),(u=n-(u-c.length()))>0){for(var l=a(c,2);l.length()>0;)i.extensions.push({type:[l.getByte(),l.getByte()],data:a(l,2)});if(!o)for(var p=0;p<i.extensions.length;++p){var f=i.extensions[p];if(0===f.type[0]&&0===f.type[1])for(var h=a(f.data,2);h.length()>0;){if(0!==h.getByte())break;t.session.extensions.server_name.serverNameList.push(a(h,2).getBytes())}}}if(t.session.version&&(i.version.major!==t.session.version.major||i.version.minor!==t.session.version.minor))return t.error(t,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.protocol_version}});if(o)t.session.cipherSuite=s.getCipherSuite(i.cipher_suite);else for(var d=e.util.createBuffer(i.cipher_suites.bytes());d.length()>0&&(t.session.cipherSuite=s.getCipherSuite(d.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:s.Alert.Level.fatal,description:s.Alert.Description.handshake_failure},cipherSuite:e.util.bytesToHex(i.cipher_suite)});t.session.compressionMethod=o?i.compression_method:s.CompressionMethod.none}return i},s.createSecurityParameters=function(e,t){var r=e.entity===s.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:s.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:s.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:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},s.handleServerHello=function(e,t,r){var n=s.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=f,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=o,e.session.resuming=!1,s.createSecurityParameters(e,n)),e.session.id=a,e.process()}},s.handleClientHello=function(t,r,n){var a=s.parseHelloMessage(t,r,n);if(!t.fail){var i=a.session_id.bytes(),o=null;if(t.sessionCache&&(null===(o=t.sessionCache.getSession(i))?i="":(o.version.major!==a.version.major||o.version.minor>a.version.minor)&&(o=null,i="")),0===i.length&&(i=e.random.getBytes(32)),t.session.id=i,t.session.clientHelloVersion=a.version,t.session.sp={},o)t.version=t.session.version=o.version,t.session.sp=o.sp;else{for(var c,u=1;u<s.SupportedVersions.length&&!((c=s.SupportedVersions[u]).minor<=a.version.minor);++u);t.version={major:c.major,minor:c.minor},t.session.version=t.version}null!==o?(t.expect=E,t.session.resuming=!0,t.session.sp.client_random=a.random.bytes()):(t.expect=!1!==t.verifyClient?g:v,t.session.resuming=!1,s.createSecurityParameters(t,a)),t.open=!0,s.queue(t,s.createRecord(t,{type:s.ContentType.handshake,data:s.createServerHello(t)})),t.session.resuming?(s.queue(t,s.createRecord(t,{type:s.ContentType.change_cipher_spec,data:s.createChangeCipherSpec()})),t.state.pending=s.createConnectionState(t),t.state.current.write=t.state.pending.write,s.queue(t,s.createRecord(t,{type:s.ContentType.handshake,data:s.createFinished(t)}))):(s.queue(t,s.createRecord(t,{type:s.ContentType.handshake,data:s.createCertificate(t)})),t.fail||(s.queue(t,s.createRecord(t,{type:s.ContentType.handshake,data:s.createServerKeyExchange(t)})),!1!==t.verifyClient&&s.queue(t,s.createRecord(t,{type:s.ContentType.handshake,data:s.createCertificateRequest(t)})),s.queue(t,s.createRecord(t,{type:s.ContentType.handshake,data:s.createServerHelloDone(t)})))),s.flush(t),t.process()}},s.handleCertificate=function(t,r,n){if(n<3)return t.error(t,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.illegal_parameter}});var i,o,u=r.fragment,l={certificate_list:a(u,3)},p=[];try{for(;l.certificate_list.length()>0;)i=a(l.certificate_list,3),o=e.asn1.fromDer(i),i=e.pki.certificateFromAsn1(o,!0),p.push(i)}catch(e){return t.error(t,{message:"Could not parse certificate list.",cause:e,send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.bad_certificate}})}var f=t.entity===s.ConnectionEnd.client;!f&&!0!==t.verifyClient||0!==p.length?0===p.length?t.expect=f?c:v:(f?t.session.serverCertificate=p[0]:t.session.clientCertificate=p[0],s.verifyCertificateChain(t,p)&&(t.expect=f?c:v)):t.error(t,{message:f?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.illegal_parameter}}),t.process()},s.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.unsupported_certificate}});e.expect=u,e.process()},s.handleClientKeyExchange=function(t,r,n){if(n<48)return t.error(t,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.unsupported_certificate}});var i=r.fragment,o={enc_pre_master_secret:a(i,2).getBytes()},c=null;if(t.getPrivateKey)try{c=t.getPrivateKey(t,t.session.serverCertificate),c=e.pki.privateKeyFromPem(c)}catch(e){t.error(t,{message:"Could not get private key.",cause:e,send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.internal_error}})}if(null===c)return t.error(t,{message:"No private key set.",send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.internal_error}});try{var u=t.session.sp;u.pre_master_secret=c.decrypt(o.enc_pre_master_secret);var l=t.session.clientHelloVersion;if(l.major!==u.pre_master_secret.charCodeAt(0)||l.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(t){u.pre_master_secret=e.random.getBytes(48)}t.expect=E,null!==t.session.clientCertificate&&(t.expect=C),t.process()},s.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.illegal_parameter}});var n=t.fragment,i={certificate_types:a(n,1),certificate_authorities:a(n,2)};e.session.certificateRequest=i,e.expect=p,e.process()},s.handleCertificateVerify=function(t,r,n){if(n<2)return t.error(t,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.illegal_parameter}});var i=r.fragment;i.read-=4;var o=i.bytes();i.read+=4;var c={signature:a(i,2).getBytes()},u=e.util.createBuffer();u.putBuffer(t.session.md5.digest()),u.putBuffer(t.session.sha1.digest()),u=u.getBytes();try{if(!t.session.clientCertificate.publicKey.verify(u,c.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");t.session.md5.update(o),t.session.sha1.update(o)}catch(e){return t.error(t,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.handshake_failure}})}t.expect=E,t.process()},s.handleServerHelloDone=function(t,r,n){if(n>0)return t.error(t,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.record_overflow}});if(null===t.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.insufficient_security}},i=t.verify(t,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||e.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),t.error(t,a)}null!==t.session.certificateRequest&&(r=s.createRecord(t,{type:s.ContentType.handshake,data:s.createCertificate(t)}),s.queue(t,r)),r=s.createRecord(t,{type:s.ContentType.handshake,data:s.createClientKeyExchange(t)}),s.queue(t,r),t.expect=y;var o=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&s.queue(e,s.createRecord(e,{type:s.ContentType.handshake,data:s.createCertificateVerify(e,t)})),s.queue(e,s.createRecord(e,{type:s.ContentType.change_cipher_spec,data:s.createChangeCipherSpec()})),e.state.pending=s.createConnectionState(e),e.state.current.write=e.state.pending.write,s.queue(e,s.createRecord(e,{type:s.ContentType.handshake,data:s.createFinished(e)})),e.expect=f,s.flush(e),e.process()};if(null===t.session.certificateRequest||null===t.session.clientCertificate)return o(t,null);s.getClientSignature(t,o)},s.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.illegal_parameter}});var r=e.entity===s.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=s.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?h:S,e.process()},s.handleFinished=function(r,n,a){var i=n.fragment;i.read-=4;var o=i.bytes();i.read+=4;var c=n.fragment.getBytes();(i=e.util.createBuffer()).putBuffer(r.session.md5.digest()),i.putBuffer(r.session.sha1.digest());var u=r.entity===s.ConnectionEnd.client,l=u?"server finished":"client finished",p=r.session.sp;if((i=t(p.master_secret,l,i.getBytes(),12)).getBytes()!==c)return r.error(r,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.decrypt_error}});r.session.md5.update(o),r.session.sha1.update(o),(r.session.resuming&&u||!r.session.resuming&&!u)&&(s.queue(r,s.createRecord(r,{type:s.ContentType.change_cipher_spec,data:s.createChangeCipherSpec()})),r.state.current.write=r.state.pending.write,r.state.pending=null,s.queue(r,s.createRecord(r,{type:s.ContentType.handshake,data:s.createFinished(r)}))),r.expect=u?d:T,r.handshaking=!1,++r.handshakes,r.peerCertificate=u?r.session.serverCertificate:r.session.clientCertificate,s.flush(r),r.isConnected=!0,r.connected(r),r.process()},s.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case s.Alert.Description.close_notify:r="Connection closed.";break;case s.Alert.Description.unexpected_message:r="Unexpected message.";break;case s.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case s.Alert.Description.decryption_failed:r="Decryption failed.";break;case s.Alert.Description.record_overflow:r="Record overflow.";break;case s.Alert.Description.decompression_failure:r="Decompression failed.";break;case s.Alert.Description.handshake_failure:r="Handshake failure.";break;case s.Alert.Description.bad_certificate:r="Bad certificate.";break;case s.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case s.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case s.Alert.Description.certificate_expired:r="Certificate expired.";break;case s.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case s.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case s.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case s.Alert.Description.access_denied:r="Access denied.";break;case s.Alert.Description.decode_error:r="Decode error.";break;case s.Alert.Description.decrypt_error:r="Decrypt error.";break;case s.Alert.Description.export_restriction:r="Export restriction.";break;case s.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case s.Alert.Description.insufficient_security:r="Insufficient security.";break;case s.Alert.Description.internal_error:r="Internal error.";break;case s.Alert.Description.user_canceled:r="User canceled.";break;case s.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===s.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===s.ConnectionEnd.client?"server":"client",alert:a}),e.process()},s.handleHandshake=function(t,r){var n=r.fragment,a=n.getByte(),i=n.getInt24();if(i>n.length())return t.fragmented=r,r.fragment=e.util.createBuffer(),n.read-=4,t.process();t.fragmented=null,n.read-=4;var o=n.bytes(i+4);n.read+=4,a in K[t.entity][t.expect]?(t.entity!==s.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:e.md.md5.create(),sha1:e.md.sha1.create()}),a!==s.HandshakeType.hello_request&&a!==s.HandshakeType.certificate_verify&&a!==s.HandshakeType.finished&&(t.session.md5.update(o),t.session.sha1.update(o)),K[t.entity][t.expect][a](t,r,i)):s.handleUnexpected(t,r)},s.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},s.handleHeartbeat=function(t,r){var n=r.fragment,a=n.getByte(),i=n.getInt16(),o=n.getBytes(i);if(a===s.HeartbeatMessageType.heartbeat_request){if(t.handshaking||i>o.length)return t.process();s.queue(t,s.createRecord(t,{type:s.ContentType.heartbeat,data:s.createHeartbeat(s.HeartbeatMessageType.heartbeat_response,o)})),s.flush(t)}else if(a===s.HeartbeatMessageType.heartbeat_response){if(o!==t.expectedHeartbeatPayload)return t.process();t.heartbeatReceived&&t.heartbeatReceived(t,e.util.createBuffer(o))}t.process()};var o=1,c=2,u=3,p=4,f=5,h=6,d=7,y=8,g=1,v=2,C=3,E=4,S=5,T=6,I=s.handleUnexpected,A=s.handleChangeCipherSpec,B=s.handleAlert,b=s.handleHandshake,N=s.handleApplicationData,R=s.handleHeartbeat,w=[];w[s.ConnectionEnd.client]=[[I,B,b,I,R],[I,B,b,I,R],[I,B,b,I,R],[I,B,b,I,R],[I,B,b,I,R],[A,B,I,I,R],[I,B,b,I,R],[I,B,b,N,R],[I,B,b,I,R]],w[s.ConnectionEnd.server]=[[I,B,b,I,R],[I,B,b,I,R],[I,B,b,I,R],[I,B,b,I,R],[A,B,I,I,R],[I,B,b,I,R],[I,B,b,N,R],[I,B,b,I,R]];var _=s.handleHelloRequest,L=s.handleServerHello,U=s.handleCertificate,D=s.handleServerKeyExchange,P=s.handleCertificateRequest,V=s.handleServerHelloDone,O=s.handleFinished,K=[];K[s.ConnectionEnd.client]=[[I,I,L,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,U,D,P,V,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,D,P,V,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,P,V,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,V,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,O],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I]];var M=s.handleClientHello,j=s.handleClientKeyExchange,q=s.handleCertificateVerify;K[s.ConnectionEnd.server]=[[I,M,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,j,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,q,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,O],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I]],s.generateKeys=function(e,r){var n=t,a=r.client_random+r.server_random;e.session.resuming||(r.master_secret=n(r.pre_master_secret,"master secret",a,48).bytes(),r.pre_master_secret=null),a=r.server_random+r.client_random;var i=2*r.mac_key_length+2*r.enc_key_length,o=e.version.major===s.Versions.TLS_1_0.major&&e.version.minor===s.Versions.TLS_1_0.minor;o&&(i+=2*r.fixed_iv_length);var c=n(r.master_secret,"key expansion",a,i),u={client_write_MAC_key:c.getBytes(r.mac_key_length),server_write_MAC_key:c.getBytes(r.mac_key_length),client_write_key:c.getBytes(r.enc_key_length),server_write_key:c.getBytes(r.enc_key_length)};return o&&(u.client_write_IV=c.getBytes(r.fixed_iv_length),u.server_write_IV=c.getBytes(r.fixed_iv_length)),u},s.createConnectionState=function(e){var t=e.entity===s.ConnectionEnd.client,a=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},i={read:a(),write:a()};if(i.read.update=function(e,t){return i.read.cipherFunction(t,i.read)?i.read.compressFunction(e,t,i.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.bad_record_mac}}),!e.fail},i.write.update=function(e,t){return i.write.compressFunction(e,t,i.write)?i.write.cipherFunction(t,i.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.internal_error}}),!e.fail},e.session){var o=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(o),o.keys=s.generateKeys(e,o),i.read.macKey=t?o.keys.server_write_MAC_key:o.keys.client_write_MAC_key,i.write.macKey=t?o.keys.client_write_MAC_key:o.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(i,e,o),o.compression_algorithm){case s.CompressionMethod.none:break;case s.CompressionMethod.deflate:i.read.compressFunction=n,i.write.compressFunction=r;break;default:throw new Error("Unsupported compression algorithm.")}}return i},s.createRandom=function(){var t=new Date,r=+t+6e4*t.getTimezoneOffset(),n=e.util.createBuffer();return n.putInt32(r),n.putBytes(e.random.getBytes(28)),n},s.createRecord=function(e,t){return t.data?{type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data}:null},s.createAlert=function(t,r){var n=e.util.createBuffer();return n.putByte(r.level),n.putByte(r.description),s.createRecord(t,{type:s.ContentType.alert,data:n})},s.createClientHello=function(t){t.session.clientHelloVersion={major:t.version.major,minor:t.version.minor};for(var r=e.util.createBuffer(),n=0;n<t.cipherSuites.length;++n){var a=t.cipherSuites[n];r.putByte(a.id[0]),r.putByte(a.id[1])}var o=r.length(),c=e.util.createBuffer();c.putByte(s.CompressionMethod.none);var u=c.length(),l=e.util.createBuffer();if(t.virtualHost){var p=e.util.createBuffer();p.putByte(0),p.putByte(0);var f=e.util.createBuffer();f.putByte(0),i(f,2,e.util.createBuffer(t.virtualHost));var h=e.util.createBuffer();i(h,2,f),i(p,2,h),l.putBuffer(p)}var d=l.length();d>0&&(d+=2);var y=t.session.id,g=y.length+1+2+4+28+2+o+1+u+d,v=e.util.createBuffer();return v.putByte(s.HandshakeType.client_hello),v.putInt24(g),v.putByte(t.version.major),v.putByte(t.version.minor),v.putBytes(t.session.sp.client_random),i(v,1,e.util.createBuffer(y)),i(v,2,r),i(v,1,c),d>0&&i(v,2,l),v},s.createServerHello=function(t){var r=t.session.id,n=r.length+1+2+4+28+2+1,a=e.util.createBuffer();return a.putByte(s.HandshakeType.server_hello),a.putInt24(n),a.putByte(t.version.major),a.putByte(t.version.minor),a.putBytes(t.session.sp.server_random),i(a,1,e.util.createBuffer(r)),a.putByte(t.session.cipherSuite.id[0]),a.putByte(t.session.cipherSuite.id[1]),a.putByte(t.session.compressionMethod),a},s.createCertificate=function(t){var r,n=t.entity===s.ConnectionEnd.client,a=null;t.getCertificate&&(r=n?t.session.certificateRequest:t.session.extensions.server_name.serverNameList,a=t.getCertificate(t,r));var o=e.util.createBuffer();if(null!==a)try{e.util.isArray(a)||(a=[a]);for(var c=null,u=0;u<a.length;++u){var l=e.pem.decode(a[u])[0];if("CERTIFICATE"!==l.type&&"X509 CERTIFICATE"!==l.type&&"TRUSTED CERTIFICATE"!==l.type){var p=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw p.headerType=l.type,p}if(l.procType&&"ENCRYPTED"===l.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var f=e.util.createBuffer(l.body);null===c&&(c=e.asn1.fromDer(f.bytes(),!1));var h=e.util.createBuffer();i(h,3,f),o.putBuffer(h)}a=e.pki.certificateFromAsn1(c),n?t.session.clientCertificate=a:t.session.serverCertificate=a}catch(e){return t.error(t,{message:"Could not send certificate list.",cause:e,send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.bad_certificate}})}var d=3+o.length(),y=e.util.createBuffer();return y.putByte(s.HandshakeType.certificate),y.putInt24(d),i(y,3,o),y},s.createClientKeyExchange=function(t){var r=e.util.createBuffer();r.putByte(t.session.clientHelloVersion.major),r.putByte(t.session.clientHelloVersion.minor),r.putBytes(e.random.getBytes(46));var n=t.session.sp;n.pre_master_secret=r.getBytes();var a=(r=t.session.serverCertificate.publicKey.encrypt(n.pre_master_secret)).length+2,i=e.util.createBuffer();return i.putByte(s.HandshakeType.client_key_exchange),i.putInt24(a),i.putInt16(r.length),i.putBytes(r),i},s.createServerKeyExchange=function(t){return e.util.createBuffer()},s.getClientSignature=function(t,r){var n=e.util.createBuffer();n.putBuffer(t.session.md5.digest()),n.putBuffer(t.session.sha1.digest()),n=n.getBytes(),t.getSignature=t.getSignature||function(t,r,n){var a=null;if(t.getPrivateKey)try{a=t.getPrivateKey(t,t.session.clientCertificate),a=e.pki.privateKeyFromPem(a)}catch(e){t.error(t,{message:"Could not get private key.",cause:e,send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.internal_error}})}null===a?t.error(t,{message:"No private key set.",send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.internal_error}}):r=a.sign(r,null),n(t,r)},t.getSignature(t,n,r)},s.createCertificateVerify=function(t,r){var n=r.length+2,a=e.util.createBuffer();return a.putByte(s.HandshakeType.certificate_verify),a.putInt24(n),a.putInt16(r.length),a.putBytes(r),a},s.createCertificateRequest=function(t){var r=e.util.createBuffer();r.putByte(1);var n=e.util.createBuffer();for(var a in t.caStore.certs){var o=t.caStore.certs[a],c=e.pki.distinguishedNameToAsn1(o.subject),u=e.asn1.toDer(c);n.putInt16(u.length()),n.putBuffer(u)}var l=1+r.length()+2+n.length(),p=e.util.createBuffer();return p.putByte(s.HandshakeType.certificate_request),p.putInt24(l),i(p,1,r),i(p,2,n),p},s.createServerHelloDone=function(t){var r=e.util.createBuffer();return r.putByte(s.HandshakeType.server_hello_done),r.putInt24(0),r},s.createChangeCipherSpec=function(){var t=e.util.createBuffer();return t.putByte(1),t},s.createFinished=function(r){var n=e.util.createBuffer();n.putBuffer(r.session.md5.digest()),n.putBuffer(r.session.sha1.digest());var a=r.entity===s.ConnectionEnd.client,i=r.session.sp,o=a?"client finished":"server finished";n=t(i.master_secret,o,n.getBytes(),12);var c=e.util.createBuffer();return c.putByte(s.HandshakeType.finished),c.putInt24(n.length()),c.putBuffer(n),c},s.createHeartbeat=function(t,r,n){void 0===n&&(n=r.length);var a=e.util.createBuffer();a.putByte(t),a.putInt16(n),a.putBytes(r);var i=a.length(),s=Math.max(16,i-n-3);return a.putBytes(e.random.getBytes(s)),a},s.queue=function(t,r){if(r&&(0!==r.fragment.length()||r.type!==s.ContentType.handshake&&r.type!==s.ContentType.alert&&r.type!==s.ContentType.change_cipher_spec)){if(r.type===s.ContentType.handshake){var n=r.fragment.bytes();t.session.md5.update(n),t.session.sha1.update(n),n=null}var a;if(r.fragment.length()<=s.MaxFragment)a=[r];else{a=[];for(var i=r.fragment.bytes();i.length>s.MaxFragment;)a.push(s.createRecord(t,{type:r.type,data:e.util.createBuffer(i.slice(0,s.MaxFragment))})),i=i.slice(s.MaxFragment);i.length>0&&a.push(s.createRecord(t,{type:r.type,data:e.util.createBuffer(i)}))}for(var o=0;o<a.length&&!t.fail;++o){var c=a[o];t.state.current.write.update(t,c)&&t.records.push(c)}}},s.flush=function(e){for(var t=0;t<e.records.length;++t){var r=e.records[t];e.tlsData.putByte(r.type),e.tlsData.putByte(r.version.major),e.tlsData.putByte(r.version.minor),e.tlsData.putInt16(r.fragment.length()),e.tlsData.putBuffer(e.records[t].fragment)}return e.records=[],e.tlsDataReady(e)};var H=function(t){switch(t){case!0:return!0;case e.pki.certificateError.bad_certificate:return s.Alert.Description.bad_certificate;case e.pki.certificateError.unsupported_certificate:return s.Alert.Description.unsupported_certificate;case e.pki.certificateError.certificate_revoked:return s.Alert.Description.certificate_revoked;case e.pki.certificateError.certificate_expired:return s.Alert.Description.certificate_expired;case e.pki.certificateError.certificate_unknown:return s.Alert.Description.certificate_unknown;case e.pki.certificateError.unknown_ca:return s.Alert.Description.unknown_ca;default:return s.Alert.Description.bad_certificate}};for(var Q in s.verifyCertificateChain=function(t,r){try{var n={};for(var a in t.verifyOptions)n[a]=t.verifyOptions[a];n.verify=function(r,n,a){H(r);var i=t.verify(t,r,n,a);if(!0!==i){if("object"==typeof i&&!e.util.isArray(i)){var o=new Error("The application rejected the certificate.");throw o.send=!0,o.alert={level:s.Alert.Level.fatal,description:s.Alert.Description.bad_certificate},i.message&&(o.message=i.message),i.alert&&(o.alert.description=i.alert),o}i!==r&&(i=function(t){switch(t){case!0:return!0;case s.Alert.Description.bad_certificate:return e.pki.certificateError.bad_certificate;case s.Alert.Description.unsupported_certificate:return e.pki.certificateError.unsupported_certificate;case s.Alert.Description.certificate_revoked:return e.pki.certificateError.certificate_revoked;case s.Alert.Description.certificate_expired:return e.pki.certificateError.certificate_expired;case s.Alert.Description.certificate_unknown:return e.pki.certificateError.certificate_unknown;case s.Alert.Description.unknown_ca:return e.pki.certificateError.unknown_ca;default:return e.pki.certificateError.bad_certificate}}(i))}return i},e.pki.verifyCertificateChain(t.caStore,r,n)}catch(r){var i=r;("object"!=typeof i||e.util.isArray(i))&&(i={send:!0,alert:{level:s.Alert.Level.fatal,description:H(r)}}),"send"in i||(i.send=!0),"alert"in i||(i.alert={level:s.Alert.Level.fatal,description:H(i.error)}),t.error(t,i)}return!t.fail},s.createSessionCache=function(t,r){var n=null;if(t&&t.getSession&&t.setSession&&t.order)n=t;else{for(var a in(n={}).cache=t||{},n.capacity=Math.max(r||100,1),n.order=[],t)n.order.length<=r?n.order.push(a):delete t[a];n.getSession=function(t){var r=null,a=null;if(t?a=e.util.bytesToHex(t):n.order.length>0&&(a=n.order[0]),null!==a&&a in n.cache)for(var i in r=n.cache[a],delete n.cache[a],n.order)if(n.order[i]===a){n.order.splice(i,1);break}return r},n.setSession=function(t,r){if(n.order.length===n.capacity){var a=n.order.shift();delete n.cache[a]}a=e.util.bytesToHex(t);n.order.push(a),n.cache[a]=r}}return n},s.createConnection=function(t){var r=null;r=t.caStore?e.util.isArray(t.caStore)?e.pki.createCaStore(t.caStore):t.caStore:e.pki.createCaStore();var n=t.cipherSuites||null;if(null===n)for(var a in n=[],s.CipherSuites)n.push(s.CipherSuites[a]);var i=t.server?s.ConnectionEnd.server:s.ConnectionEnd.client,o=t.sessionCache?s.createSessionCache(t.sessionCache):null,c={version:{major:s.Version.major,minor:s.Version.minor},entity:i,sessionId:t.sessionId,caStore:r,sessionCache:o,cipherSuites:n,connected:t.connected,virtualHost:t.virtualHost||null,verifyClient:t.verifyClient||!1,verify:t.verify||function(e,t,r,n){return t},verifyOptions:t.verifyOptions||{},getCertificate:t.getCertificate||null,getPrivateKey:t.getPrivateKey||null,getSignature:t.getSignature||null,input:e.util.createBuffer(),tlsData:e.util.createBuffer(),data:e.util.createBuffer(),tlsDataReady:t.tlsDataReady,dataReady:t.dataReady,heartbeatReceived:t.heartbeatReceived,closed:t.closed,error:function(e,r){r.origin=r.origin||(e.entity===s.ConnectionEnd.client?"client":"server"),r.send&&(s.queue(e,s.createAlert(e,r.alert)),s.flush(e));var n=!1!==r.fatal;n&&(e.fail=!0),t.error(e,r),n&&e.close(!1)},deflate:t.deflate||null,inflate:t.inflate||null,reset:function(e){c.version={major:s.Version.major,minor:s.Version.minor},c.record=null,c.session=null,c.peerCertificate=null,c.state={pending:null,current:null},c.expect=(c.entity,s.ConnectionEnd.client,0),c.fragmented=null,c.records=[],c.open=!1,c.handshakes=0,c.handshaking=!1,c.isConnected=!1,c.fail=!(e||void 0===e),c.input.clear(),c.tlsData.clear(),c.data.clear(),c.state.current=s.createConnectionState(c)}};c.reset();return c.handshake=function(t){if(c.entity!==s.ConnectionEnd.client)c.error(c,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(c.handshaking)c.error(c,{message:"Handshake already in progress.",fatal:!1});else{c.fail&&!c.open&&0===c.handshakes&&(c.fail=!1),c.handshaking=!0;var r=null;(t=t||"").length>0&&(c.sessionCache&&(r=c.sessionCache.getSession(t)),null===r&&(t="")),0===t.length&&c.sessionCache&&null!==(r=c.sessionCache.getSession())&&(t=r.id),c.session={id:t,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:e.md.md5.create(),sha1:e.md.sha1.create()},r&&(c.version=r.version,c.session.sp=r.sp),c.session.sp.client_random=s.createRandom().getBytes(),c.open=!0,s.queue(c,s.createRecord(c,{type:s.ContentType.handshake,data:s.createClientHello(c)})),s.flush(c)}},c.process=function(t){var r=0;return t&&c.input.putBytes(t),c.fail||(null!==c.record&&c.record.ready&&c.record.fragment.isEmpty()&&(c.record=null),null===c.record&&(r=function(t){var r=0,n=t.input,a=n.length();if(a<5)r=5-a;else{t.record={type:n.getByte(),version:{major:n.getByte(),minor:n.getByte()},length:n.getInt16(),fragment:e.util.createBuffer(),ready:!1};var i=t.record.version.major===t.version.major;i&&t.session&&t.session.version&&(i=t.record.version.minor===t.version.minor),i||t.error(t,{message:"Incompatible TLS version.",send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.protocol_version}})}return r}(c)),c.fail||null===c.record||c.record.ready||(r=function(e){var t=0,r=e.input,n=r.length();return n<e.record.length?t=e.record.length-n:(e.record.fragment.putBytes(r.getBytes(e.record.length)),r.compact(),e.state.current.read.update(e,e.record)&&(null!==e.fragmented&&(e.fragmented.type===e.record.type?(e.fragmented.fragment.putBuffer(e.record.fragment),e.record=e.fragmented):e.error(e,{message:"Invalid fragmented record.",send:!0,alert:{level:s.Alert.Level.fatal,description:s.Alert.Description.unexpected_message}})),e.record.ready=!0)),t}(c)),!c.fail&&null!==c.record&&c.record.ready&&function(e,t){var r=t.type-s.ContentType.change_cipher_spec,n=w[e.entity][e.expect];r in n?n[r](e,t):s.handleUnexpected(e,t)}(c,c.record)),r},c.prepare=function(t){return s.queue(c,s.createRecord(c,{type:s.ContentType.application_data,data:e.util.createBuffer(t)})),s.flush(c)},c.prepareHeartbeatRequest=function(t,r){return t instanceof e.util.ByteBuffer&&(t=t.bytes()),void 0===r&&(r=t.length),c.expectedHeartbeatPayload=t,s.queue(c,s.createRecord(c,{type:s.ContentType.heartbeat,data:s.createHeartbeat(s.HeartbeatMessageType.heartbeat_request,t,r)})),s.flush(c)},c.close=function(e){if(!c.fail&&c.sessionCache&&c.session){var t={id:c.session.id,version:c.session.version,sp:c.session.sp};t.sp.keys=null,c.sessionCache.setSession(t.id,t)}c.open&&(c.open=!1,c.input.clear(),(c.isConnected||c.handshaking)&&(c.isConnected=c.handshaking=!1,s.queue(c,s.createAlert(c,{level:s.Alert.Level.warning,description:s.Alert.Description.close_notify})),s.flush(c)),c.closed(c)),c.reset(e)},c},je=e.tls=e.tls||{},s)"function"!=typeof s[Q]&&(e.tls[Q]=s[Q]);return e.tls.prf_tls1=t,e.tls.hmac_sha1=function(t,r,n){var a=e.hmac.create();a.start("SHA1",t);var i=e.util.createBuffer();return i.putInt32(r[0]),i.putInt32(r[1]),i.putByte(n.type),i.putByte(n.version.major),i.putByte(n.version.minor),i.putInt16(n.length),i.putBytes(n.fragment.bytes()),a.update(i.getBytes()),a.digest().getBytes()},e.tls.createSessionCache=s.createSessionCache,e.tls.createConnection=s.createConnection,je}function Ze(){if(Ge)return R.exports;Ge=1;var e=l();B(),We();var t=R.exports=e.tls;function r(r,a,i){var o=a.entity===e.tls.ConnectionEnd.client;r.read.cipherState={init:!1,cipher:e.cipher.createDecipher("AES-CBC",o?i.keys.server_write_key:i.keys.client_write_key),iv:o?i.keys.server_write_IV:i.keys.client_write_IV},r.write.cipherState={init:!1,cipher:e.cipher.createCipher("AES-CBC",o?i.keys.client_write_key:i.keys.server_write_key),iv:o?i.keys.client_write_IV:i.keys.server_write_IV},r.read.cipherFunction=s,r.write.cipherFunction=n,r.read.macLength=r.write.macLength=i.mac_length,r.read.macFunction=r.write.macFunction=t.hmac_sha1}function n(r,n){var i,s=!1,o=n.macFunction(n.macKey,n.sequenceNumber,r);r.fragment.putBytes(o),n.updateSequenceNumber(),i=r.version.minor===t.Versions.TLS_1_0.minor?n.cipherState.init?null:n.cipherState.iv:e.random.getBytesSync(16),n.cipherState.init=!0;var c=n.cipherState.cipher;return c.start({iv:i}),r.version.minor>=t.Versions.TLS_1_1.minor&&c.output.putBytes(i),c.update(r.fragment),c.finish(a)&&(r.fragment=c.output,r.length=r.fragment.length(),s=!0),s}function a(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function i(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),s=a-1-i;s<a-1;++s)n=n&&t.at(s)==i;n&&t.truncate(i+1)}return n}function s(r,n){var a,s=!1;a=r.version.minor===t.Versions.TLS_1_0.minor?n.cipherState.init?null:n.cipherState.iv:r.fragment.getBytes(16),n.cipherState.init=!0;var o=n.cipherState.cipher;o.start({iv:a}),o.update(r.fragment),s=o.finish(i);var c=n.macLength,u=e.random.getBytesSync(c),l=o.output.length();l>=c?(r.fragment=o.output.getBytes(l-c),u=o.output.getBytes(c)):r.fragment=o.output.getBytes(),r.fragment=e.util.createBuffer(r.fragment),r.length=r.fragment.length();var p=n.macFunction(n.macKey,n.sequenceNumber,r);return n.updateSequenceNumber(),s=function(t,r,n){var a=e.hmac.create();return a.start("SHA1",t),a.update(r),r=a.digest().getBytes(),a.start(null,null),a.update(n),n=a.digest().getBytes(),r===n}(n.macKey,u,p)&&s,s}return t.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=t.BulkCipherAlgorithm.aes,e.cipher_type=t.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=t.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:r},t.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=t.BulkCipherAlgorithm.aes,e.cipher_type=t.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=t.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:r},R.exports}var $e,Je={exports:{}};function et(){if($e)return Je.exports;$e=1;var e=l();O(),m();var t=Je.exports=e.sha512=e.sha512||{};e.md.sha512=e.md.algorithms.sha512=t;var r=e.sha384=e.sha512.sha384=e.sha512.sha384||{};r.create=function(){return t.create("SHA-384")},e.md.sha384=e.md.algorithms.sha384=r,e.sha512.sha256=e.sha512.sha256||{create:function(){return t.create("SHA-512/256")}},e.md["sha512/256"]=e.md.algorithms["sha512/256"]=e.sha512.sha256,e.sha512.sha224=e.sha512.sha224||{create:function(){return t.create("SHA-512/224")}},e.md["sha512/224"]=e.md.algorithms["sha512/224"]=e.sha512.sha224,t.create=function(t){if(a||(n=String.fromCharCode(128),n+=e.util.fillString(String.fromCharCode(0),128),i=[[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={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],s["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],s["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],s["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],a=!0),void 0===t&&(t="SHA-512"),!(t in s))throw new Error("Invalid SHA-512 algorithm: "+t);for(var r=s[t],c=null,u=e.util.createBuffer(),l=new Array(80),p=0;p<80;++p)l[p]=new Array(2);var f=64;switch(t){case"SHA-384":f=48;break;case"SHA-512/256":f=32;break;case"SHA-512/224":f=28}var h={algorithm:t.replace("-","").toLowerCase(),blockLength:128,digestLength:f,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var t=h.messageLengthSize/4,n=0;n<t;++n)h.fullMessageLength.push(0);u=e.util.createBuffer(),c=new Array(r.length);for(n=0;n<r.length;++n)c[n]=r[n].slice(0);return h}};return h.start(),h.update=function(t,r){"utf8"===r&&(t=e.util.encodeUtf8(t));var n=t.length;h.messageLength+=n,n=[n/4294967296>>>0,n>>>0];for(var a=h.fullMessageLength.length-1;a>=0;--a)h.fullMessageLength[a]+=n[1],n[1]=n[0]+(h.fullMessageLength[a]/4294967296>>>0),h.fullMessageLength[a]=h.fullMessageLength[a]>>>0,n[0]=n[1]/4294967296>>>0;return u.putBytes(t),o(c,l,u),(u.read>2048||0===u.length())&&u.compact(),h},h.digest=function(){var r=e.util.createBuffer();r.putBytes(u.bytes());var a,i=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize&h.blockLength-1;r.putBytes(n.substr(0,h.blockLength-i));for(var s=8*h.fullMessageLength[0],p=0;p<h.fullMessageLength.length-1;++p)s+=(a=8*h.fullMessageLength[p+1])/4294967296>>>0,r.putInt32(s>>>0),s=a>>>0;r.putInt32(s);var f=new Array(c.length);for(p=0;p<c.length;++p)f[p]=c[p].slice(0);o(f,l,r);var d,y=e.util.createBuffer();d="SHA-512"===t?f.length:"SHA-384"===t?f.length-2:f.length-4;for(p=0;p<d;++p)y.putInt32(f[p][0]),p===d-1&&"SHA-512/224"===t||y.putInt32(f[p][1]);return y},h};var n=null,a=!1,i=null,s=null;function o(e,t,r){for(var n,a,s,o,c,u,l,p,f,h,d,y,g,v,m,C,E,S,T,I,A,B,b,N,R,w,_,L,k,U,D,P,V,O=r.length();O>=128;){for(_=0;_<16;++_)t[_][0]=r.getInt32()>>>0,t[_][1]=r.getInt32()>>>0;for(;_<80;++_)n=(((L=(U=t[_-2])[0])>>>19|(k=U[1])<<13)^(k>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|k>>>19)^(k<<3|L>>>29)^(L<<26|k>>>6))>>>0,s=(((L=(P=t[_-15])[0])>>>1|(k=P[1])<<31)^(L>>>8|k<<24)^L>>>7)>>>0,o=((L<<31|k>>>1)^(L<<24|k>>>8)^(L<<25|k>>>7))>>>0,D=t[_-7],V=t[_-16],k=a+D[1]+o+V[1],t[_][0]=n+D[0]+s+V[0]+(k/4294967296>>>0)>>>0,t[_][1]=k>>>0;for(d=e[0][0],y=e[0][1],g=e[1][0],v=e[1][1],m=e[2][0],C=e[2][1],E=e[3][0],S=e[3][1],T=e[4][0],I=e[4][1],A=e[5][0],B=e[5][1],b=e[6][0],N=e[6][1],R=e[7][0],w=e[7][1],_=0;_<80;++_)l=((T>>>14|I<<18)^(T>>>18|I<<14)^(I>>>9|T<<23))>>>0,p=(b^T&(A^b))>>>0,c=((d>>>28|y<<4)^(y>>>2|d<<30)^(y>>>7|d<<25))>>>0,u=((d<<4|y>>>28)^(y<<30|d>>>2)^(y<<25|d>>>7))>>>0,f=(d&g|m&(d^g))>>>0,h=(y&v|C&(y^v))>>>0,k=w+(((T<<18|I>>>14)^(T<<14|I>>>18)^(I<<23|T>>>9))>>>0)+((N^I&(B^N))>>>0)+i[_][1]+t[_][1],n=R+l+p+i[_][0]+t[_][0]+(k/4294967296>>>0)>>>0,a=k>>>0,s=c+f+((k=u+h)/4294967296>>>0)>>>0,o=k>>>0,R=b,w=N,b=A,N=B,A=T,B=I,T=E+n+((k=S+a)/4294967296>>>0)>>>0,I=k>>>0,E=m,S=C,m=g,C=v,g=d,v=y,d=n+s+((k=a+o)/4294967296>>>0)>>>0,y=k>>>0;k=e[0][1]+y,e[0][0]=e[0][0]+d+(k/4294967296>>>0)>>>0,e[0][1]=k>>>0,k=e[1][1]+v,e[1][0]=e[1][0]+g+(k/4294967296>>>0)>>>0,e[1][1]=k>>>0,k=e[2][1]+C,e[2][0]=e[2][0]+m+(k/4294967296>>>0)>>>0,e[2][1]=k>>>0,k=e[3][1]+S,e[3][0]=e[3][0]+E+(k/4294967296>>>0)>>>0,e[3][1]=k>>>0,k=e[4][1]+I,e[4][0]=e[4][0]+T+(k/4294967296>>>0)>>>0,e[4][1]=k>>>0,k=e[5][1]+B,e[5][0]=e[5][0]+A+(k/4294967296>>>0)>>>0,e[5][1]=k>>>0,k=e[6][1]+N,e[6][0]=e[6][0]+b+(k/4294967296>>>0)>>>0,e[6][1]=k>>>0,k=e[7][1]+w,e[7][0]=e[7][0]+R+(k/4294967296>>>0)>>>0,e[7][1]=k>>>0,O-=128}}return Je.exports}var tt,rt,nt,at,it,st,ot,ct,ut={};function lt(){if(tt)return ut;tt=1;var e=l();k();var t=e.asn1;return ut.privateKeyValidator={name:"PrivateKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},ut.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]},ut}function pt(){if(nt)return rt;nt=1;var e=l();fe(),le(),et(),m();var t=lt(),r=t.publicKeyValidator,n=t.privateKeyValidator;if(void 0===a)var a=e.jsbn.BigInteger;var i=e.util.ByteBuffer,s="undefined"==typeof Buffer?Uint8Array:Buffer;e.pki=e.pki||{},rt=e.pki.ed25519=e.ed25519=e.ed25519||{};var o=e.ed25519;function c(e){var t=e.message;if(t instanceof Uint8Array||t instanceof s)return t;var r=e.encoding;if(void 0===t){if(!e.md)throw new TypeError('"options.message" or "options.md" not specified.');t=e.md.digest().getBytes(),r="binary"}if("string"==typeof t&&!r)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof t){if("undefined"!=typeof Buffer)return Buffer.from(t,r);t=new i(t,r)}else if(!(t instanceof i))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 s(t.length()),a=0;a<n.length;++a)n[a]=t.at(a);return n}o.constants={},o.constants.PUBLIC_KEY_BYTE_LENGTH=32,o.constants.PRIVATE_KEY_BYTE_LENGTH=64,o.constants.SEED_BYTE_LENGTH=32,o.constants.SIGN_BYTE_LENGTH=64,o.constants.HASH_BYTE_LENGTH=64,o.generateKeyPair=function(t){var r=(t=t||{}).seed;if(void 0===r)r=e.random.getBytesSync(o.constants.SEED_BYTE_LENGTH);else if("string"==typeof r){if(r.length!==o.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+o.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(r instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');r=c({message:r,encoding:"binary"});for(var n=new s(o.constants.PUBLIC_KEY_BYTE_LENGTH),a=new s(o.constants.PRIVATE_KEY_BYTE_LENGTH),i=0;i<32;++i)a[i]=r[i];return function(e,t){var r,n=[D(),D(),D(),D()],a=C(t,32);for(a[0]&=248,a[31]&=127,a[31]|=64,_(n,a),A(e,n),r=0;r<32;++r)t[r+32]=e[r]}(n,a),{publicKey:n,privateKey:a}},o.privateKeyFromAsn1=function(t){var r={},a=[];if(!e.asn1.validate(t,n,r,a)){var i=new Error("Invalid Key.");throw i.errors=a,i}var s=e.asn1.derToOid(r.privateKeyOid),o=e.oids.EdDSA25519;if(s!==o)throw new Error('Invalid OID "'+s+'"; OID must be "'+o+'".');var u=r.privateKey;return{privateKeyBytes:c({message:e.asn1.fromDer(u).value,encoding:"binary"})}},o.publicKeyFromAsn1=function(t){var n={},a=[];if(!e.asn1.validate(t,r,n,a)){var i=new Error("Invalid Key.");throw i.errors=a,i}var s=e.asn1.derToOid(n.publicKeyOid),u=e.oids.EdDSA25519;if(s!==u)throw new Error('Invalid OID "'+s+'"; OID must be "'+u+'".');var l=n.ed25519PublicKey;if(l.length!==o.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return c({message:l,encoding:"binary"})},o.publicKeyFromPrivateKey=function(e){var t=c({message:(e=e||{}).privateKey,encoding:"binary"});if(t.length!==o.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+o.constants.PRIVATE_KEY_BYTE_LENGTH);for(var r=new s(o.constants.PUBLIC_KEY_BYTE_LENGTH),n=0;n<r.length;++n)r[n]=t[32+n];return r},o.sign=function(e){var t=c(e=e||{}),r=c({message:e.privateKey,encoding:"binary"});if(r.length===o.constants.SEED_BYTE_LENGTH)r=o.generateKeyPair({seed:r}).privateKey;else if(r.length!==o.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+o.constants.SEED_BYTE_LENGTH+" or "+o.constants.PRIVATE_KEY_BYTE_LENGTH);var n=new s(o.constants.SIGN_BYTE_LENGTH+t.length);!function(e,t,r,n){var a,i,s=new Float64Array(64),o=[D(),D(),D(),D()],c=C(n,32);c[0]&=248,c[31]&=127,c[31]|=64;var u=r+64;for(a=0;a<r;++a)e[64+a]=t[a];for(a=0;a<32;++a)e[32+a]=c[32+a];var l=C(e.subarray(32),r+32);for(S(l),_(o,l),A(e,o),a=32;a<64;++a)e[a]=n[a];var p=C(e,r+64);for(S(p),a=32;a<64;++a)s[a]=0;for(a=0;a<32;++a)s[a]=l[a];for(a=0;a<32;++a)for(i=0;i<32;i++)s[a+i]+=p[a]*c[i];E(e.subarray(32),s)}(n,t,t.length,r);for(var a=new s(o.constants.SIGN_BYTE_LENGTH),i=0;i<a.length;++i)a[i]=n[i];return a},o.verify=function(e){var t=c(e=e||{});if(void 0===e.signature)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var r=c({message:e.signature,encoding:"binary"});if(r.length!==o.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+o.constants.SIGN_BYTE_LENGTH);var n=c({message:e.publicKey,encoding:"binary"});if(n.length!==o.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+o.constants.PUBLIC_KEY_BYTE_LENGTH);var a,i=new s(o.constants.SIGN_BYTE_LENGTH+t.length),l=new s(o.constants.SIGN_BYTE_LENGTH+t.length);for(a=0;a<o.constants.SIGN_BYTE_LENGTH;++a)i[a]=r[a];for(a=0;a<t.length;++a)i[a+o.constants.SIGN_BYTE_LENGTH]=t[a];return function(e,t,r,n){var a,i=new s(32),o=[D(),D(),D(),D()],c=[D(),D(),D(),D()];if(-1,r<64)return-1;if(function(e,t){var r=D(),n=D(),a=D(),i=D(),s=D(),o=D(),c=D();L(e[2],p),function(e,t){var r;for(r=0;r<16;++r)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}(e[1],t),O(a,e[1]),x(i,a,f),V(a,a,e[2]),P(i,e[2],i),O(s,i),O(o,s),x(c,o,s),x(r,c,a),x(r,r,i),function(e,t){var r,n=D();for(r=0;r<16;++r)n[r]=t[r];for(r=250;r>=0;--r)O(n,n),1!==r&&x(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}(r,r),x(r,r,a),x(r,r,i),x(r,r,i),x(e[0],r,i),O(n,e[0]),x(n,n,i),b(n,a)&&x(e[0],e[0],v);if(O(n,e[0]),x(n,n,i),b(n,a))return-1;R(e[0])===t[31]>>7&&V(e[0],u,e[0]);return x(e[3],e[0],e[1]),0}(c,n))return-1;for(a=0;a<r;++a)e[a]=t[a];for(a=0;a<32;++a)e[a+32]=n[a];var l=C(e,r);if(S(l),w(o,c,l),_(c,t.subarray(32)),T(o,c),A(i,o),r-=64,N(t,0,i,0)){for(a=0;a<r;++a)e[a]=0;return-1}for(a=0;a<r;++a)e[a]=t[a+64];return r}(l,i,i.length,n)>=0};var u=D(),p=D([1]),f=D([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),h=D([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),d=D([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),y=D([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),g=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]),v=D([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function C(t,r){var n=e.md.sha512.create(),a=new i(t);n.update(a.getBytes(r),"binary");var c=n.digest().getBytes();if("undefined"!=typeof Buffer)return Buffer.from(c,"binary");for(var u=new s(o.constants.HASH_BYTE_LENGTH),l=0;l<64;++l)u[l]=c.charCodeAt(l);return u}function E(e,t){var r,n,a,i;for(n=63;n>=32;--n){for(r=0,a=n-32,i=n-12;a<i;++a)t[a]+=r-16*t[n]*g[a-(n-32)],r=t[a]+128>>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*g[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*g[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function S(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;E(e,t)}function T(e,t){var r=D(),n=D(),a=D(),i=D(),s=D(),o=D(),c=D(),u=D(),l=D();V(r,e[1],e[0]),V(l,t[1],t[0]),x(r,r,l),P(n,e[0],e[1]),P(l,t[0],t[1]),x(n,n,l),x(a,e[3],t[3]),x(a,a,h),x(i,e[2],t[2]),P(i,i,i),V(s,n,r),V(o,i,a),P(c,i,a),P(u,n,r),x(e[0],s,o),x(e[1],u,c),x(e[2],c,o),x(e[3],s,u)}function I(e,t,r){for(var n=0;n<4;++n)U(e[n],t[n],r)}function A(e,t){var r=D(),n=D(),a=D();!function(e,t){var r,n=D();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)O(n,n),2!==r&&4!==r&&x(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}(a,t[2]),x(r,t[0],a),x(n,t[1],a),B(e,n),e[31]^=R(r)<<7}function B(e,t){var r,n,a,i=D(),s=D();for(r=0;r<16;++r)s[r]=t[r];for(k(s),k(s),k(s),n=0;n<2;++n){for(i[0]=s[0]-65517,r=1;r<15;++r)i[r]=s[r]-65535-(i[r-1]>>16&1),i[r-1]&=65535;i[15]=s[15]-32767-(i[14]>>16&1),a=i[15]>>16&1,i[14]&=65535,U(s,i,1-a)}for(r=0;r<16;r++)e[2*r]=255&s[r],e[2*r+1]=s[r]>>8}function b(e,t){var r=new s(32),n=new s(32);return B(r,e),B(n,t),N(r,0,n,0)}function N(e,t,r,n){return function(e,t,r,n,a){var i,s=0;for(i=0;i<a;++i)s|=e[t+i]^r[n+i];return(1&s-1>>>8)-1}(e,t,r,n,32)}function R(e){var t=new s(32);return B(t,e),1&t[0]}function w(e,t,r){var n,a;for(L(e[0],u),L(e[1],p),L(e[2],p),L(e[3],u),a=255;a>=0;--a)I(e,t,n=r[a/8|0]>>(7&a)&1),T(t,e),T(e,e),I(e,t,n)}function _(e,t){var r=[D(),D(),D(),D()];L(r[0],d),L(r[1],y),L(r[2],p),x(r[3],d,y),w(e,r,t)}function L(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function k(e){var t,r,n=1;for(t=0;t<16;++t)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function U(e,t,r){for(var n,a=~(r-1),i=0;i<16;++i)n=a&(e[i]^t[i]),e[i]^=n,t[i]^=n}function D(e){var t,r=new Float64Array(16);if(e)for(t=0;t<e.length;++t)r[t]=e[t];return r}function P(e,t,r){for(var n=0;n<16;++n)e[n]=t[n]+r[n]}function V(e,t,r){for(var n=0;n<16;++n)e[n]=t[n]-r[n]}function O(e,t){x(e,t,t)}function x(e,t,r){var n,a,i=0,s=0,o=0,c=0,u=0,l=0,p=0,f=0,h=0,d=0,y=0,g=0,v=0,m=0,C=0,E=0,S=0,T=0,I=0,A=0,B=0,b=0,N=0,R=0,w=0,_=0,L=0,k=0,U=0,D=0,P=0,V=r[0],O=r[1],x=r[2],K=r[3],M=r[4],F=r[5],j=r[6],q=r[7],G=r[8],H=r[9],Q=r[10],z=r[11],Y=r[12],X=r[13],W=r[14],Z=r[15];i+=(n=t[0])*V,s+=n*O,o+=n*x,c+=n*K,u+=n*M,l+=n*F,p+=n*j,f+=n*q,h+=n*G,d+=n*H,y+=n*Q,g+=n*z,v+=n*Y,m+=n*X,C+=n*W,E+=n*Z,s+=(n=t[1])*V,o+=n*O,c+=n*x,u+=n*K,l+=n*M,p+=n*F,f+=n*j,h+=n*q,d+=n*G,y+=n*H,g+=n*Q,v+=n*z,m+=n*Y,C+=n*X,E+=n*W,S+=n*Z,o+=(n=t[2])*V,c+=n*O,u+=n*x,l+=n*K,p+=n*M,f+=n*F,h+=n*j,d+=n*q,y+=n*G,g+=n*H,v+=n*Q,m+=n*z,C+=n*Y,E+=n*X,S+=n*W,T+=n*Z,c+=(n=t[3])*V,u+=n*O,l+=n*x,p+=n*K,f+=n*M,h+=n*F,d+=n*j,y+=n*q,g+=n*G,v+=n*H,m+=n*Q,C+=n*z,E+=n*Y,S+=n*X,T+=n*W,I+=n*Z,u+=(n=t[4])*V,l+=n*O,p+=n*x,f+=n*K,h+=n*M,d+=n*F,y+=n*j,g+=n*q,v+=n*G,m+=n*H,C+=n*Q,E+=n*z,S+=n*Y,T+=n*X,I+=n*W,A+=n*Z,l+=(n=t[5])*V,p+=n*O,f+=n*x,h+=n*K,d+=n*M,y+=n*F,g+=n*j,v+=n*q,m+=n*G,C+=n*H,E+=n*Q,S+=n*z,T+=n*Y,I+=n*X,A+=n*W,B+=n*Z,p+=(n=t[6])*V,f+=n*O,h+=n*x,d+=n*K,y+=n*M,g+=n*F,v+=n*j,m+=n*q,C+=n*G,E+=n*H,S+=n*Q,T+=n*z,I+=n*Y,A+=n*X,B+=n*W,b+=n*Z,f+=(n=t[7])*V,h+=n*O,d+=n*x,y+=n*K,g+=n*M,v+=n*F,m+=n*j,C+=n*q,E+=n*G,S+=n*H,T+=n*Q,I+=n*z,A+=n*Y,B+=n*X,b+=n*W,N+=n*Z,h+=(n=t[8])*V,d+=n*O,y+=n*x,g+=n*K,v+=n*M,m+=n*F,C+=n*j,E+=n*q,S+=n*G,T+=n*H,I+=n*Q,A+=n*z,B+=n*Y,b+=n*X,N+=n*W,R+=n*Z,d+=(n=t[9])*V,y+=n*O,g+=n*x,v+=n*K,m+=n*M,C+=n*F,E+=n*j,S+=n*q,T+=n*G,I+=n*H,A+=n*Q,B+=n*z,b+=n*Y,N+=n*X,R+=n*W,w+=n*Z,y+=(n=t[10])*V,g+=n*O,v+=n*x,m+=n*K,C+=n*M,E+=n*F,S+=n*j,T+=n*q,I+=n*G,A+=n*H,B+=n*Q,b+=n*z,N+=n*Y,R+=n*X,w+=n*W,_+=n*Z,g+=(n=t[11])*V,v+=n*O,m+=n*x,C+=n*K,E+=n*M,S+=n*F,T+=n*j,I+=n*q,A+=n*G,B+=n*H,b+=n*Q,N+=n*z,R+=n*Y,w+=n*X,_+=n*W,L+=n*Z,v+=(n=t[12])*V,m+=n*O,C+=n*x,E+=n*K,S+=n*M,T+=n*F,I+=n*j,A+=n*q,B+=n*G,b+=n*H,N+=n*Q,R+=n*z,w+=n*Y,_+=n*X,L+=n*W,k+=n*Z,m+=(n=t[13])*V,C+=n*O,E+=n*x,S+=n*K,T+=n*M,I+=n*F,A+=n*j,B+=n*q,b+=n*G,N+=n*H,R+=n*Q,w+=n*z,_+=n*Y,L+=n*X,k+=n*W,U+=n*Z,C+=(n=t[14])*V,E+=n*O,S+=n*x,T+=n*K,I+=n*M,A+=n*F,B+=n*j,b+=n*q,N+=n*G,R+=n*H,w+=n*Q,_+=n*z,L+=n*Y,k+=n*X,U+=n*W,D+=n*Z,E+=(n=t[15])*V,s+=38*(T+=n*x),o+=38*(I+=n*K),c+=38*(A+=n*M),u+=38*(B+=n*F),l+=38*(b+=n*j),p+=38*(N+=n*q),f+=38*(R+=n*G),h+=38*(w+=n*H),d+=38*(_+=n*Q),y+=38*(L+=n*z),g+=38*(k+=n*Y),v+=38*(U+=n*X),m+=38*(D+=n*W),C+=38*(P+=n*Z),i=(n=(i+=38*(S+=n*O))+(a=1)+65535)-65536*(a=Math.floor(n/65536)),s=(n=s+a+65535)-65536*(a=Math.floor(n/65536)),o=(n=o+a+65535)-65536*(a=Math.floor(n/65536)),c=(n=c+a+65535)-65536*(a=Math.floor(n/65536)),u=(n=u+a+65535)-65536*(a=Math.floor(n/65536)),l=(n=l+a+65535)-65536*(a=Math.floor(n/65536)),p=(n=p+a+65535)-65536*(a=Math.floor(n/65536)),f=(n=f+a+65535)-65536*(a=Math.floor(n/65536)),h=(n=h+a+65535)-65536*(a=Math.floor(n/65536)),d=(n=d+a+65535)-65536*(a=Math.floor(n/65536)),y=(n=y+a+65535)-65536*(a=Math.floor(n/65536)),g=(n=g+a+65535)-65536*(a=Math.floor(n/65536)),v=(n=v+a+65535)-65536*(a=Math.floor(n/65536)),m=(n=m+a+65535)-65536*(a=Math.floor(n/65536)),C=(n=C+a+65535)-65536*(a=Math.floor(n/65536)),E=(n=E+a+65535)-65536*(a=Math.floor(n/65536)),i=(n=(i+=a-1+37*(a-1))+(a=1)+65535)-65536*(a=Math.floor(n/65536)),s=(n=s+a+65535)-65536*(a=Math.floor(n/65536)),o=(n=o+a+65535)-65536*(a=Math.floor(n/65536)),c=(n=c+a+65535)-65536*(a=Math.floor(n/65536)),u=(n=u+a+65535)-65536*(a=Math.floor(n/65536)),l=(n=l+a+65535)-65536*(a=Math.floor(n/65536)),p=(n=p+a+65535)-65536*(a=Math.floor(n/65536)),f=(n=f+a+65535)-65536*(a=Math.floor(n/65536)),h=(n=h+a+65535)-65536*(a=Math.floor(n/65536)),d=(n=d+a+65535)-65536*(a=Math.floor(n/65536)),y=(n=y+a+65535)-65536*(a=Math.floor(n/65536)),g=(n=g+a+65535)-65536*(a=Math.floor(n/65536)),v=(n=v+a+65535)-65536*(a=Math.floor(n/65536)),m=(n=m+a+65535)-65536*(a=Math.floor(n/65536)),C=(n=C+a+65535)-65536*(a=Math.floor(n/65536)),E=(n=E+a+65535)-65536*(a=Math.floor(n/65536)),i+=a-1+37*(a-1),e[0]=i,e[1]=s,e[2]=o,e[3]=c,e[4]=u,e[5]=l,e[6]=p,e[7]=f,e[8]=h,e[9]=d,e[10]=y,e[11]=g,e[12]=v,e[13]=m,e[14]=C,e[15]=E}return rt}var ft,ht={exports:{}};function dt(){if(ft)return ht.exports;ft=1;var e=l();B(),k(),W(),L(),G(),Le(),le(),m(),ze();var t=e.asn1,r=ht.exports=e.pkcs7=e.pkcs7||{};function n(n){var a={},i=[];if(!t.validate(n,r.asn1.recipientInfoValidator,a,i)){var s=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw s.errors=i,s}return{version:a.version.charCodeAt(0),issuer:e.pki.RDNAttributesAsArray(a.issuer),serialNumber:e.util.createBuffer(a.serial).toHex(),encryptedContent:{algorithm:t.derToOid(a.encAlgorithm),parameter:a.encParameter?a.encParameter.value:void 0,content:a.encKey}}}function a(r){for(var n,a=[],i=0;i<r.length;++i)a.push((n=r[i],t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(n.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[e.pki.distinguishedNameToAsn1({attributes:n.issuer}),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,e.util.hexToBytes(n.serialNumber))]),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(n.encryptedContent.algorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,n.encryptedContent.content)])));return a}function i(r){var n=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(r.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[e.pki.distinguishedNameToAsn1({attributes:r.issuer}),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,e.util.hexToBytes(r.serialNumber))]),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.digestAlgorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])]);if(r.authenticatedAttributesAsn1&&n.value.push(r.authenticatedAttributesAsn1),n.value.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.signatureAlgorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])),n.value.push(t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.signature)),r.unauthenticatedAttributes.length>0){for(var a=t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[]),i=0;i<r.unauthenticatedAttributes.length;++i){var o=r.unauthenticatedAttributes[i];a.values.push(s(o))}n.value.push(a)}return n}function s(r){var n;if(r.type===e.pki.oids.contentType)n=t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.value).getBytes());else if(r.type===e.pki.oids.messageDigest)n=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.value.bytes());else if(r.type===e.pki.oids.signingTime){var a=new Date("1950-01-01T00:00:00Z"),i=new Date("2050-01-01T00:00:00Z"),s=r.value;if("string"==typeof s){var o=Date.parse(s);s=isNaN(o)?13===s.length?t.utcTimeToDate(s):t.generalizedTimeToDate(s):new Date(o)}n=s>=a&&s<i?t.create(t.Class.UNIVERSAL,t.Type.UTCTIME,!1,t.dateToUtcTime(s)):t.create(t.Class.UNIVERSAL,t.Type.GENERALIZEDTIME,!1,t.dateToGeneralizedTime(s))}return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.type).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[n])])}function o(r,n,a){var i={};if(!t.validate(n,a,i,[])){var s=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw s.errors=s,s}if(t.derToOid(i.contentType)!==e.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(i.encryptedContent){var o="";if(e.util.isArray(i.encryptedContent))for(var c=0;c<i.encryptedContent.length;++c){if(i.encryptedContent[c].type!==t.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");o+=i.encryptedContent[c].value}else o=i.encryptedContent;r.encryptedContent={algorithm:t.derToOid(i.encAlgorithm),parameter:e.util.createBuffer(i.encParameter.value),content:e.util.createBuffer(o)}}if(i.content){o="";if(e.util.isArray(i.content))for(c=0;c<i.content.length;++c){if(i.content[c].type!==t.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");o+=i.content[c].value}else o=i.content;r.content=e.util.createBuffer(o)}return r.version=i.version.charCodeAt(0),r.rawCapture=i,i}function c(t){if(void 0===t.encryptedContent.key)throw new Error("Symmetric key not available.");if(void 0===t.content){var r;switch(t.encryptedContent.algorithm){case e.pki.oids["aes128-CBC"]:case e.pki.oids["aes192-CBC"]:case e.pki.oids["aes256-CBC"]:r=e.aes.createDecryptionCipher(t.encryptedContent.key);break;case e.pki.oids.desCBC:case e.pki.oids["des-EDE3-CBC"]:r=e.des.createDecryptionCipher(t.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+t.encryptedContent.algorithm)}if(r.start(t.encryptedContent.parameter),r.update(t.encryptedContent.content),!r.finish())throw new Error("Symmetric decryption failed.");t.content=r.output}}return r.messageFromPem=function(n){var a=e.pem.decode(n)[0];if("PKCS7"!==a.type){var i=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw i.headerType=a.type,i}if(a.procType&&"ENCRYPTED"===a.procType.type)throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var s=t.fromDer(a.body);return r.messageFromAsn1(s)},r.messageToPem=function(r,n){var a={type:"PKCS7",body:t.toDer(r.toAsn1()).getBytes()};return e.pem.encode(a,{maxline:n})},r.messageFromAsn1=function(n){var a={},i=[];if(!t.validate(n,r.asn1.contentInfoValidator,a,i)){var s=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw s.errors=i,s}var o,c=t.derToOid(a.contentType);switch(c){case e.pki.oids.envelopedData:o=r.createEnvelopedData();break;case e.pki.oids.encryptedData:o=r.createEncryptedData();break;case e.pki.oids.signedData:o=r.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+c+" is not (yet) supported.")}return o.fromAsn1(a.content.value[0]),o},r.createSignedData=function(){var n=null;return n={type:e.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(t){if(o(n,t,r.asn1.signedDataValidator),n.certificates=[],n.crls=[],n.digestAlgorithmIdentifiers=[],n.contentInfo=null,n.signerInfos=[],n.rawCapture.certificates)for(var a=n.rawCapture.certificates.value,i=0;i<a.length;++i)n.certificates.push(e.pki.certificateFromAsn1(a[i]))},toAsn1:function(){n.contentInfo||n.sign();for(var r=[],a=0;a<n.certificates.length;++a)r.push(e.pki.certificateToAsn1(n.certificates[a]));var i=[],s=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(n.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,n.digestAlgorithmIdentifiers),n.contentInfo])]);return r.length>0&&s.value[0].value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,r)),i.length>0&&s.value[0].value.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,i)),s.value[0].value.push(t.create(t.Class.UNIVERSAL,t.Type.SET,!0,n.signerInfos)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(n.type).getBytes()),s])},addSigner:function(t){var r=t.issuer,a=t.serialNumber;if(t.certificate){var i=t.certificate;"string"==typeof i&&(i=e.pki.certificateFromPem(i)),r=i.issuer.attributes,a=i.serialNumber}var s=t.key;if(!s)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof s&&(s=e.pki.privateKeyFromPem(s));var o=t.digestAlgorithm||e.pki.oids.sha1;switch(o){case e.pki.oids.sha1:case e.pki.oids.sha256:case e.pki.oids.sha384:case e.pki.oids.sha512:case e.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+o)}var c=t.authenticatedAttributes||[];if(c.length>0){for(var u=!1,l=!1,p=0;p<c.length;++p){var f=c[p];if(u||f.type!==e.pki.oids.contentType){if(l||f.type!==e.pki.oids.messageDigest);else if(l=!0,u)break}else if(u=!0,l)break}if(!u||!l)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}n.signers.push({key:s,version:1,issuer:r,serialNumber:a,digestAlgorithm:o,signatureAlgorithm:e.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:c,unauthenticatedAttributes:[]})},sign:function(r){var a;(r=r||{},"object"!=typeof n.content||null===n.contentInfo)&&(n.contentInfo=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.pki.oids.data).getBytes())]),"content"in n&&(n.content instanceof e.util.ByteBuffer?a=n.content.bytes():"string"==typeof n.content&&(a=e.util.encodeUtf8(n.content)),r.detached?n.detachedContent=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,a):n.contentInfo.value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,a)]))));0!==n.signers.length&&function(r){var a;a=n.detachedContent?n.detachedContent:(a=n.contentInfo.value[1]).value[0];if(!a)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var o=t.derToOid(n.contentInfo.value[0].value),c=t.toDer(a);for(var u in c.getByte(),t.getBerValueLength(c),c=c.getBytes(),r)r[u].start().update(c);for(var l=new Date,p=0;p<n.signers.length;++p){var f=n.signers[p];if(0===f.authenticatedAttributes.length){if(o!==e.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{f.authenticatedAttributesAsn1=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var h=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[]),d=0;d<f.authenticatedAttributes.length;++d){var y=f.authenticatedAttributes[d];y.type===e.pki.oids.messageDigest?y.value=r[f.digestAlgorithm].digest():y.type===e.pki.oids.signingTime&&(y.value||(y.value=l)),h.value.push(s(y)),f.authenticatedAttributesAsn1.value.push(s(y))}c=t.toDer(h).getBytes(),f.md.start().update(c)}f.signature=f.key.sign(f.md,"RSASSA-PKCS1-V1_5")}n.signerInfos=function(e){for(var t=[],r=0;r<e.length;++r)t.push(i(e[r]));return t}(n.signers)}(function(){for(var r={},a=0;a<n.signers.length;++a){var i=n.signers[a];(s=i.digestAlgorithm)in r||(r[s]=e.md[e.pki.oids[s]].create()),0===i.authenticatedAttributes.length?i.md=r[s]:i.md=e.md[e.pki.oids[s]].create()}for(var s in n.digestAlgorithmIdentifiers=[],r)n.digestAlgorithmIdentifiers.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(s).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]));return r}())},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(t){"string"==typeof t&&(t=e.pki.certificateFromPem(t)),n.certificates.push(t)},addCertificateRevokationList:function(e){throw new Error("PKCS#7 CRL support not yet implemented.")}}},r.createEncryptedData=function(){var t=null;return t={type:e.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:e.pki.oids["aes256-CBC"]},fromAsn1:function(e){o(t,e,r.asn1.encryptedDataValidator)},decrypt:function(e){void 0!==e&&(t.encryptedContent.key=e),c(t)}}},r.createEnvelopedData=function(){var i=null;return i={type:e.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:e.pki.oids["aes256-CBC"]},fromAsn1:function(e){var t=o(i,e,r.asn1.envelopedDataValidator);i.recipients=function(e){for(var t=[],r=0;r<e.length;++r)t.push(n(e[r]));return t}(t.recipientInfos.value)},toAsn1:function(){return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(i.type).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(i.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,a(i.recipients)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,(r=i.encryptedContent,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.pki.oids.data).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.algorithm).getBytes()),r.parameter?t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.parameter.getBytes()):void 0]),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.content.getBytes())])]))])])]);var r},findRecipient:function(e){for(var t=e.issuer.attributes,r=0;r<i.recipients.length;++r){var n=i.recipients[r],a=n.issuer;if(n.serialNumber===e.serialNumber&&a.length===t.length){for(var s=!0,o=0;o<t.length;++o)if(a[o].type!==t[o].type||a[o].value!==t[o].value){s=!1;break}if(s)return n}}return null},decrypt:function(t,r){if(void 0===i.encryptedContent.key&&void 0!==t&&void 0!==r)switch(t.encryptedContent.algorithm){case e.pki.oids.rsaEncryption:case e.pki.oids.desCBC:var n=r.decrypt(t.encryptedContent.content);i.encryptedContent.key=e.util.createBuffer(n);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}c(i)},addRecipient:function(t){i.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:e.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,r){if(void 0===i.encryptedContent.content){var n,a,s;switch(r=r||i.encryptedContent.algorithm,t=t||i.encryptedContent.key,r){case e.pki.oids["aes128-CBC"]:n=16,a=16,s=e.aes.createEncryptionCipher;break;case e.pki.oids["aes192-CBC"]:n=24,a=16,s=e.aes.createEncryptionCipher;break;case e.pki.oids["aes256-CBC"]:n=32,a=16,s=e.aes.createEncryptionCipher;break;case e.pki.oids["des-EDE3-CBC"]:n=24,a=8,s=e.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+r)}if(void 0===t)t=e.util.createBuffer(e.random.getBytes(n));else if(t.length()!=n)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+n+".");i.encryptedContent.algorithm=r,i.encryptedContent.key=t,i.encryptedContent.parameter=e.util.createBuffer(e.random.getBytes(a));var o=s(t);if(o.start(i.encryptedContent.parameter.copy()),o.update(i.content),!o.finish())throw new Error("Symmetric encryption failed.");i.encryptedContent.content=o.output}for(var c=0;c<i.recipients.length;++c){var u=i.recipients[c];if(void 0===u.encryptedContent.content){if(u.encryptedContent.algorithm!==e.pki.oids.rsaEncryption)throw new Error("Unsupported asymmetric cipher, OID "+u.encryptedContent.algorithm);u.encryptedContent.content=u.encryptedContent.key.encrypt(i.encryptedContent.key.data)}}}},i},ht.exports}var yt,gt,vt,mt,Ct,Et,St={exports:{}};function Tt(){return vt||(vt=1,gt=l(),B(),Ze(),k(),C(),W(),pt(),x(),function(){if(it)return at;it=1;var e=l();m(),le(),fe(),at=e.kem=e.kem||{};var t=e.jsbn.BigInteger;function r(t,r,n,a){t.generate=function(t,i){for(var s=new e.util.ByteBuffer,o=Math.ceil(i/a)+n,c=new e.util.ByteBuffer,u=n;u<o;++u){c.putInt32(u),r.start(),r.update(t+c.getBytes());var l=r.digest();s.putBytes(l.getBytes(a))}return s.truncate(s.length()-i),s.getBytes()}}e.kem.rsa={},e.kem.rsa.create=function(r,n){var a=(n=n||{}).prng||e.random;return{encrypt:function(n,i){var s,o=Math.ceil(n.n.bitLength()/8);do{s=new t(e.util.bytesToHex(a.getBytesSync(o)),16).mod(n.n)}while(s.compareTo(t.ONE)<=0);var c=o-(s=e.util.hexToBytes(s.toString(16))).length;return c>0&&(s=e.util.fillString(String.fromCharCode(0),c)+s),{encapsulation:n.encrypt(s,"NONE"),key:r.generate(s,i)}},decrypt:function(e,t,n){var a=e.decrypt(t,"NONE");return r.generate(a,n)}}},e.kem.kdf1=function(e,t){r(this,e,0,t||e.digestLength)},e.kem.kdf2=function(e,t){r(this,e,1,t||e.digestLength)}}(),function(){if(ot)return st;ot=1;var e=l();m(),st=e.log=e.log||{},e.log.levels=["none","error","warning","info","debug","verbose","max"];var t={},r=[],n=null;e.log.LEVEL_LOCKED=2,e.log.NO_LEVEL_CHECK=4,e.log.INTERPOLATE=8;for(var a=0;a<e.log.levels.length;++a){var i=e.log.levels[a];t[i]={index:a,name:i.toUpperCase()}}e.log.logMessage=function(n){for(var a=t[n.level].index,i=0;i<r.length;++i){var s=r[i];s.flags&e.log.NO_LEVEL_CHECK?s.f(n):a<=t[s.level].index&&s.f(s,n)}},e.log.prepareStandard=function(e){"standard"in e||(e.standard=t[e.level].name+" ["+e.category+"] "+e.message)},e.log.prepareFull=function(t){if(!("full"in t)){var r=[t.message];r=r.concat([]||t.arguments),t.full=e.util.format.apply(this,r)}},e.log.prepareStandardFull=function(t){"standardFull"in t||(e.log.prepareStandard(t),t.standardFull=t.standard)};var s=["error","warning","info","debug","verbose"];for(a=0;a<s.length;++a)!function(t){e.log[t]=function(r,n){var a=Array.prototype.slice.call(arguments).slice(2),i={timestamp:new Date,level:t,category:r,message:n,arguments:a};e.log.logMessage(i)}}(s[a]);if(e.log.makeLogger=function(t){var r={flags:0,f:t};return e.log.setLevel(r,"none"),r},e.log.setLevel=function(t,r){var n=!1;if(t&&!(t.flags&e.log.LEVEL_LOCKED))for(var a=0;a<e.log.levels.length;++a)if(r==e.log.levels[a]){t.level=r,n=!0;break}return n},e.log.lock=function(t,r){void 0===r||r?t.flags|=e.log.LEVEL_LOCKED:t.flags&=~e.log.LEVEL_LOCKED},e.log.addLogger=function(e){r.push(e)},"undefined"!=typeof console&&"log"in console){var o;if(console.error&&console.warn&&console.info&&console.debug){var c={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},u=function(t,r){e.log.prepareStandard(r);var n=c[r.level],a=[r.standard];a=a.concat(r.arguments.slice()),n.apply(console,a)};o=e.log.makeLogger(u)}else u=function(t,r){e.log.prepareStandardFull(r),console.log(r.standardFull)},o=e.log.makeLogger(u);e.log.setLevel(o,"debug"),e.log.addLogger(o),n=o}else console={log:function(){}};if(null!==n&&"undefined"!=typeof window&&window.location){var p=new URL(window.location.href).searchParams;p.has("console.level")&&e.log.setLevel(n,p.get("console.level").slice(-1)[0]),p.has("console.lock")&&"true"==p.get("console.lock").slice(-1)[0]&&e.log.lock(n)}e.log.consoleLogger=n}(),ct||(ct=1,O(),F(),ve(),te(),et()),Oe(),Z(),G(),me(),Ye(),dt(),Xe(),Be(),ue(),Qe(),le(),pe(),function(){if(yt)return St.exports;yt=1;var e=l();B(),x(),F(),ve(),m();var t=St.exports=e.ssh=e.ssh||{};function r(t,r){var n=r.toString(16);n[0]>="8"&&(n="00"+n);var a=e.util.hexToBytes(n);t.putInt32(a.length),t.putBytes(a)}function n(e,t){e.putInt32(t.length),e.putString(t)}function a(){for(var t=e.md.sha1.create(),r=arguments.length,n=0;n<r;++n)t.update(arguments[n]);return t.digest()}t.privateKeyToPutty=function(t,i,s){var o="ssh-rsa",c=""===(i=i||"")?"none":"aes256-cbc",u="PuTTY-User-Key-File-2: "+o+"\r\n";u+="Encryption: "+c+"\r\n",u+="Comment: "+(s=s||"")+"\r\n";var l=e.util.createBuffer();n(l,o),r(l,t.e),r(l,t.n);var p=e.util.encode64(l.bytes(),64),f=Math.floor(p.length/66)+1;u+="Public-Lines: "+f+"\r\n",u+=p;var h,d=e.util.createBuffer();if(r(d,t.d),r(d,t.p),r(d,t.q),r(d,t.qInv),i){var y=d.length()+16-1;y-=y%16;var g=a(d.bytes());g.truncate(g.length()-y+d.length()),d.putBuffer(g);var v=e.util.createBuffer();v.putBuffer(a("\0\0\0\0",i)),v.putBuffer(a("\0\0\0",i));var m=e.aes.createEncryptionCipher(v.truncate(8),"CBC");m.start(e.util.createBuffer().fillWithByte(0,16)),m.update(d.copy()),m.finish();var C=m.output;C.truncate(16),h=e.util.encode64(C.bytes(),64)}else h=e.util.encode64(d.bytes(),64);u+="\r\nPrivate-Lines: "+(f=Math.floor(h.length/66)+1)+"\r\n",u+=h;var E=a("putty-private-key-file-mac-key",i),S=e.util.createBuffer();n(S,o),n(S,c),n(S,s),S.putInt32(l.length()),S.putBuffer(l),S.putInt32(d.length()),S.putBuffer(d);var T=e.hmac.create();return T.start("sha1",E),T.update(S.bytes()),u+"\r\nPrivate-MAC: "+T.digest().toHex()+"\r\n"},t.publicKeyToOpenSSH=function(t,a){var i="ssh-rsa";a=a||"";var s=e.util.createBuffer();return n(s,i),r(s,t.e),r(s,t.n),i+" "+e.util.encode64(s.bytes())+" "+a},t.privateKeyToOpenSSH=function(t,r){return r?e.pki.encryptRsaPrivateKey(t,r,{legacy:!0,algorithm:"aes128"}):e.pki.privateKeyToPem(t)},t.getPublicKeyFingerprint=function(t,a){var i=(a=a||{}).md||e.md.md5.create(),s=e.util.createBuffer();n(s,"ssh-rsa"),r(s,t.e),r(s,t.n),i.start(),i.update(s.getBytes());var o=i.digest();if("hex"===a.encoding){var c=o.toHex();return a.delimiter?c.match(/.{2}/g).join(a.delimiter):c}if("binary"===a.encoding)return o.getBytes();if(a.encoding)throw new Error('Unknown encoding "'+a.encoding+'".');return o},St.exports}(),We(),m()),gt}function It(){return Ct?mt:(Ct=1,mt={dc:"0.9.2342.19200300.100.1.25"})}var At,Bt,bt,Nt,Rt,wt,_t,Lt=function(){var e,t,r,n;if(!Et)for(t in e=(Et=Tt()).oids,r=It())n=r[t],null==e[t]&&(e[t]=n),null==e[n]&&(e[n]=t);return Et};var kt,Ut,Dt,Pt,Vt=Ot;for(Nt in At=Lt,bt=[],Bt={der:xt,pem:Kt,txt:function(e){var t;return"Subject\t"+(t=Mt(e)).subject.value.map((function(e){return _t(e.value[0].value[1].value,"binary").toString("utf8")})).join("/")+"\nValid\t"+t.valid.value.map((function(e){return e.value})).join(" - ")+"\n"+Kt(e)},asn1:Mt,x509:function(e){return At().pki.certificateFromAsn1(At().asn1.fromDer(e.toString("binary")))}})Rt=Bt[Nt],Ot[Nt]=bt.length,bt.push(Rt);function Ot(e,t){var r;return r=bt[e]||bt[0],null!=t?r(t):r}function xt(e){return wt(e)?e:_t(e,"binary")}function Kt(e){var t,r,n,a;for(t=["-----BEGIN CERTIFICATE-----"],r=0,n=(e=xt(e).toString("base64")).length;r<n;r+=64)a=r,t.push(e.substr(a,64));return t.push("-----END CERTIFICATE-----",""),t.join("\r\n")}function Mt(e){var t,r,n,a;return t=At().asn1,e=e.toString("binary"),a=(n=(r=t.fromDer(e).value[0].value)[0]).tagClass===t.Class.CONTEXT_SPECIFIC&&0===n.type&&n.constructed,{serial:(r=r.slice(a))[0],valid:r[3],issuer:r[2],subject:r[4]}}function Ft(){if(Ut)return kt;var e,t,n,a,i;function s(t){var r;return r=e.createHash("sha1"),a(t).subject.value.forEach((function(e){var t,a;(t=(e=n.copy(e)).value[0].value[1]).value&&(t.type=n.Type.UTF8,a=(a=i(t.value,"binary").toString("utf8")).trim().replace(/[A-Z]+/g,(function(e){return e.toLowerCase()})).replace(/\s+/g," "),t.value=i(a,"utf8").toString("binary"),r.update(n.toDer(e).getBytes(),"binary"))})),c(r)}function o(t){var r,i;return r=e.createHash("md5"),i=a(t).subject,r.update(n.toDer(i).getBytes(),"binary"),c(r)}function c(e){return(e=e.digest().slice(0,4)).writeUInt32LE(e.readUInt32BE(0),0),e.toString("hex")}return Ut=1,e=r,t=Vt,n=Lt().asn1,a=t(t.asn1),kt=function(e,t){var r;return r=0===e?o:s,null!=t?r(t):r},i=Buffer.from||function(e,t){return new Buffer(e,t)},kt}function jt(){if(Pt)return Dt;var e,t,r,i,s,o,c,u;function l(e){return f(e,[]),p}function p(e){o.push(i(e))}function f(e,r){if(r&&(o.length=0,o.push.apply(o,r)),(e="+"===e?2:e?1:0)!==c){switch(c){case 1:s.ca===o&&delete s.ca;break;case 2:t.createSecureContext===h&&(t.createSecureContext=u,u=void 0)}switch(c=e){case 1:s.ca=o;break;case 2:u||(u=t.createSecureContext,t.createSecureContext=h)}}}function h(e){var t,r,n,a,i;if(t=u.apply(this,arguments),2===c&&(null==e||!e.ca))for(r=0,a=(n=o).length;r<a;++r)i=n[r],t.context.addCACert(i);return t}return Pt=1,e=n,t=a,r=Vt,Dt=l,l.inject=f,i=r(r.pem),s=e.globalAgent.options,o=[],c=0,Dt}Ot.forge=Ot.x509,wt=Buffer.isBuffer,_t=Buffer.from||function(e,t){return new Buffer(e,t)};var qt,Gt={};var Ht,Qt,zt,Yt={};function Xt(){return Ht||(Ht=1,function(t){var r,n=Yt||e;function a(e){var t,n;return n=e.length?0:-1,{next:a,done:function(){null!=t&&t.done();t=void 0,n=e.length},run:function(e){var t;for(;t=a();)e(t);e()}};function a(){for(var a;n<e.length;){if(null==t&&(t=n<0?r():r(e[n])),a=t.next())return a;t.done(),t=void 0,n++}}}r=function(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}("win-ca/lib/crypt32-"+process.arch),n.sync=a,n.async=function(e){var t,r;return t=a(e),r=t.next,t.run=function(e){function t(){return Promise.resolve().then(r).then((function(r){if(r)return e(r),t();e()}))}t()},t}}()),Yt}var Wt,Zt,$t,Jt,er,tr,rr,nr={exports:{}};function ar(){if(Zt)return Wt;Zt=1;const e=(e,t)=>function(){const r=t.promiseModule,n=new Array(arguments.length);for(let e=0;e<arguments.length;e++)n[e]=arguments[e];return new r(((r,a)=>{t.errorFirst?n.push((function(e,n){if(t.multiArgs){const t=new Array(arguments.length-1);for(let e=1;e<arguments.length;e++)t[e-1]=arguments[e];e?(t.unshift(e),a(t)):r(t)}else e?a(e):r(n)})):n.push((function(e){if(t.multiArgs){const e=new Array(arguments.length-1);for(let t=0;t<arguments.length;t++)e[t]=arguments[t];r(e)}else r(e)})),e.apply(this,n)}))};return Wt=(t,r)=>{r=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},r);const n=e=>{const t=t=>"string"==typeof t?e===t:t.test(e);return r.include?r.include.some(t):!r.exclude.some(t)};let a;a="function"==typeof t?function(){return r.excludeMain?t.apply(this,arguments):e(t,r).apply(this,arguments)}:Object.create(Object.getPrototypeOf(t));for(const i in t){const s=t[i];a[i]="function"==typeof s&&n(i)?e(s,r):s}return a},Wt}function ir(){if($t)return nr.exports;$t=1;const e=i,t=o,r=ar(),n={mode:511&~process.umask(),fs:e},a=e=>{if("win32"===process.platform){if(/[<>:"|?*]/.test(e.replace(t.parse(e).root,""))){const t=new Error(`Path contains invalid characters: ${e}`);throw t.code="EINVAL",t}}};return nr.exports=(e,i)=>Promise.resolve().then((()=>{a(e),i=Object.assign({},n,i);const s=r(i.fs.mkdir),o=r(i.fs.stat),c=e=>s(e,i.mode).then((()=>e)).catch((r=>{if("ENOENT"===r.code){if(r.message.includes("null bytes")||t.dirname(e)===e)throw r;return c(t.dirname(e)).then((()=>c(e)))}return o(e).then((t=>t.isDirectory()?e:Promise.reject())).catch((()=>{throw r}))}));return c(t.resolve(e))})),nr.exports.sync=(e,r)=>{a(e),r=Object.assign({},n,r);const i=e=>{try{r.fs.mkdirSync(e,r.mode)}catch(n){if("ENOENT"===n.code){if(n.message.includes("null bytes")||t.dirname(e)===e)throw n;return i(t.dirname(e)),i(e)}try{if(!r.fs.statSync(e).isDirectory())throw new Error("The path is not a directory")}catch(e){throw n}}return e};return i(t.resolve(e))},nr.exports}function sr(){if(er)return Jt;var e,t,r,n,a,c,u,l,p,f,h;function d(e){return function(){var t,r=this;return t=[].slice.call(arguments),new Promise((function(n,a){t.push((function(e,t){e?a(e):n(t)})),e.apply(r,t)}))}}function y(){}return er=1,e=i,t=s,r=o,n=ir(),a=Vt,c=Ft(),Jt=function(a){var i,s,o,c,d;return c={},d=new Set,function(e){return Promise.resolve(e).then(g)};function g(f){f?(s||(s=function(e){var a;"string"==typeof e?e=[e]:Array.isArray(e)||(e=[r.join(__dirname,"../pem"),r.join(t.homedir(),".local/win-ca/pem")]);return a=0,i();function i(){return a<e.length?n(e[a++]).catch(i):Promise.resolve()}}(a.save||a.$ave).then((function(e){return i=e}))),s=s.then((function(){if(i)return function(t){var r,n;return(o||(o=e.createWriteStream(v("roots.pem")))).write(r=u(t)),c[n=l(t)]||(c[n]=0),p(v(n+"."+c[n]++),r).catch(y)}(f)}))):s?s.then(m).then((function(){null!=o&&o.end(),i&&a.$ave&&(process.env.SSL_CERT_DIR=a.rootInstance.path=i),"function"==typeof a.onsave&&a.onsave(i)})):"function"==typeof a.onsave&&a.onsave()}function v(e){return d.add(e),r.join(i,e)}function m(){i&&f(i).then((function(e){return Promise.all(e.filter((function(e){return!d.has(e)})).map((function(e){return r.join(i,e)})).map((function(e){return h(e).catch(y)})))})).catch(y)}},u=a(a.txt),l=c(),p=d(e.writeFile),f=d(e.readdir),h=d(e.unlink),Jt}var or=cr;function cr(t){var n,a,i,s,o,c,u,l,p;if(null==t&&(t={}),t.rootInstance=this,n=tr||t.disabled?(qt||(qt=1,function(t){var r=Gt||e;function n(){return{next:function(){},done:function(){},run:function(e){return e()}}}r.sync=n,r.async=n}()),Gt):Xt(),(a=t.store)?Array.isArray(a)||(a=[a]):a=[],n=n[(i=t.async)?"async":"sync"](a),s=i?function(e){Promise.resolve(e).then(f)}:f,!1!==t.unique&&(o=(zt?Qt:(zt=1,p=r,Qt=function(){var e;return e=new Set,function(t){var r;if(r=p.createHash("sha256").update(t).digest("base64"),!e.has(r))return e.add(r),!0}}))()),c=rr(t.format),Array.isArray(t.ondata)&&(t.ondata=t.ondata.push.bind(t.ondata)),(t.save||t.$ave)&&(u=sr()(t)),t.inject&&(l=jt()(t.inject)),t.generator)return(i?function(){var e,t;return(e={})[null!=(t=Symbol.asyncIterator)?t:"@"]=ur,e.return=d,e.next=g,e}:function(){var e;return(e={})[Symbol.iterator]=ur,e.return=d,e.next=y,e})();function f(e){u&&u(e),e?(l&&l(e),"function"==typeof t.ondata&&t.ondata(c(e))):"function"==typeof t.onend&&t.onend()}function h(e){return s(e),{done:!e,value:null!=e?c(e):e}}function d(e){return n.done(),{done:!0,value:e}}function y(){for(var e;(e=n.next())&&o&&!o(e););return h(e)}function g(){return function e(){return Promise.resolve().then(n.next).then((function(t){return t&&o&&!o(t)?e():h(t)}))}()}n.run((function(e){e&&o&&!o(e)||s(e)}))}function ur(){return this}function lr(){var e;pr(arguments,e={unique:!0,ondata:function(t){"function"==typeof e.$cb&&e.$cb(t)}})}function pr(e,t){var r;r=e[0],null==t.unique&&(t.unique=!1),t.format=null!=r?r:cr.der2.x509,t.$cb=e[1]||r,cr(t)}cr.disabled=tr="win32"!==process.platform,cr.nApi=!1,cr.der2=rr=Vt,cr.hash=function(){return(cr.hash=Ft()).apply(this,arguments)},cr.inject=function(){return(cr.inject=jt().inject).apply(this,arguments)},cr.all=function(){var e;return pr(arguments,{ondata:e=[]}),e},cr.each=lr,lr.async=function(){var e;pr(arguments,e={async:!0,ondata:function(t){"function"==typeof e.$cb&&e.$cb(void 0,t)},onend:function(){"function"==typeof e.$cb&&e.$cb()}})};var fr=t(or),hr=Object.freeze({__proto__:null,default:fr});export{hr as i};