Your IP : 216.73.216.189


Current Path : /proc/thread-self/root/snap/lxd/current/share/lxd-ui/assets/
Upload File :
Current File : //proc/thread-self/root/snap/lxd/current/share/lxd-ui/assets/certificate-RK-UYMpo.js

(function(){"use strict";var xa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sa(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function Ta(i){if(Object.prototype.hasOwnProperty.call(i,"__esModule"))return i;var e=i.default;if(typeof e=="function"){var a=function p(){var N=!1;try{N=this instanceof p}catch{}return N?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};a.prototype=e.prototype}else a={};return Object.defineProperty(a,"__esModule",{value:!0}),Object.keys(i).forEach(function(p){var N=Object.getOwnPropertyDescriptor(i,p);Object.defineProperty(a,p,N.get?N:{enumerable:!0,get:function(){return i[p]}})}),a}var bt,mr;function ue(){return mr||(mr=1,bt={options:{usePureJavaScript:!1}}),bt}var _t={exports:{}},Nt,Er;function Ia(){if(Er)return Nt;Er=1;var i={};Nt=i;var e={};i.encode=function(p,N,S){if(typeof N!="string")throw new TypeError('"alphabet" must be a string.');if(S!==void 0&&typeof S!="number")throw new TypeError('"maxline" must be a number.');var c="";if(!(p instanceof Uint8Array))c=a(p,N);else{var t=0,g=N.length,f=N.charAt(0),x=[0];for(t=0;t<p.length;++t){for(var D=0,E=p[t];D<x.length;++D)E+=x[D]<<8,x[D]=E%g,E=E/g|0;for(;E>0;)x.push(E%g),E=E/g|0}for(t=0;p[t]===0&&t<p.length-1;++t)c+=f;for(t=x.length-1;t>=0;--t)c+=N[x[t]]}if(S){var u=new RegExp(".{1,"+S+"}","g");c=c.match(u).join(`\r
`)}return c},i.decode=function(p,N){if(typeof p!="string")throw new TypeError('"input" must be a string.');if(typeof N!="string")throw new TypeError('"alphabet" must be a string.');var S=e[N];if(!S){S=e[N]=[];for(var c=0;c<N.length;++c)S[N.charCodeAt(c)]=c}p=p.replace(/\s/g,"");for(var t=N.length,g=N.charAt(0),f=[0],c=0;c<p.length;c++){var x=S[p.charCodeAt(c)];if(x===void 0)return;for(var D=0,E=x;D<f.length;++D)E+=f[D]*t,f[D]=E&255,E>>=8;for(;E>0;)f.push(E&255),E>>=8}for(var u=0;p[u]===g&&u<p.length-1;++u)f.push(0);return typeof Buffer<"u"?Buffer.from(f.reverse()):new Uint8Array(f.reverse())};function a(p,N){var S=0,c=N.length,t=N.charAt(0),g=[0];for(S=0;S<p.length();++S){for(var f=0,x=p.at(S);f<g.length;++f)x+=g[f]<<8,g[f]=x%c,x=x/c|0;for(;x>0;)g.push(x%c),x=x/c|0}var D="";for(S=0;p.at(S)===0&&S<p.length()-1;++S)D+=t;for(S=g.length-1;S>=0;--S)D+=N[g[S]];return D}return Nt}var xr;function ce(){if(xr)return _t.exports;xr=1;var i=ue(),e=Ia(),a=_t.exports=i.util=i.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){a.nextTick=process.nextTick,typeof setImmediate=="function"?a.setImmediate=setImmediate:a.setImmediate=a.nextTick;return}if(typeof setImmediate=="function"){a.setImmediate=function(){return setImmediate.apply(void 0,arguments)},a.nextTick=function(n){return setImmediate(n)};return}if(a.setImmediate=function(n){setTimeout(n,0)},typeof window<"u"&&typeof window.postMessage=="function"){let n=function(r){if(r.source===window&&r.data===s){r.stopPropagation();var A=h.slice();h.length=0,A.forEach(function(k){k()})}};var s="forge.setImmediate",h=[];a.setImmediate=function(r){h.push(r),h.length===1&&window.postMessage(s,"*")},window.addEventListener("message",n,!0)}if(typeof MutationObserver<"u"){var d=Date.now(),I=!0,w=document.createElement("div"),h=[];new MutationObserver(function(){var r=h.slice();h.length=0,r.forEach(function(A){A()})}).observe(w,{attributes:!0});var l=a.setImmediate;a.setImmediate=function(r){Date.now()-d>15?(d=Date.now(),l(r)):(h.push(r),h.length===1&&w.setAttribute("a",I=!I))}}a.nextTick=a.setImmediate})(),a.isNodejs=typeof process<"u"&&process.versions&&process.versions.node,a.globalScope=(function(){return a.isNodejs?xa:typeof self>"u"?window:self})(),a.isArray=Array.isArray||function(s){return Object.prototype.toString.call(s)==="[object Array]"},a.isArrayBuffer=function(s){return typeof ArrayBuffer<"u"&&s instanceof ArrayBuffer},a.isArrayBufferView=function(s){return s&&a.isArrayBuffer(s.buffer)&&s.byteLength!==void 0};function p(s){if(!(s===8||s===16||s===24||s===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+s)}a.ByteBuffer=N;function N(s){if(this.data="",this.read=0,typeof s=="string")this.data=s;else if(a.isArrayBuffer(s)||a.isArrayBufferView(s))if(typeof Buffer<"u"&&s instanceof Buffer)this.data=s.toString("binary");else{var h=new Uint8Array(s);try{this.data=String.fromCharCode.apply(null,h)}catch{for(var d=0;d<h.length;++d)this.putByte(h[d])}}else(s instanceof N||typeof s=="object"&&typeof s.data=="string"&&typeof s.read=="number")&&(this.data=s.data,this.read=s.read);this._constructedStringLength=0}a.ByteStringBuffer=N;var S=4096;a.ByteStringBuffer.prototype._optimizeConstructedString=function(s){this._constructedStringLength+=s,this._constructedStringLength>S&&(this.data.substr(0,1),this._constructedStringLength=0)},a.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},a.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},a.ByteStringBuffer.prototype.putByte=function(s){return this.putBytes(String.fromCharCode(s))},a.ByteStringBuffer.prototype.fillWithByte=function(s,h){s=String.fromCharCode(s);for(var d=this.data;h>0;)h&1&&(d+=s),h>>>=1,h>0&&(s+=s);return this.data=d,this._optimizeConstructedString(h),this},a.ByteStringBuffer.prototype.putBytes=function(s){return this.data+=s,this._optimizeConstructedString(s.length),this},a.ByteStringBuffer.prototype.putString=function(s){return this.putBytes(a.encodeUtf8(s))},a.ByteStringBuffer.prototype.putInt16=function(s){return this.putBytes(String.fromCharCode(s>>8&255)+String.fromCharCode(s&255))},a.ByteStringBuffer.prototype.putInt24=function(s){return this.putBytes(String.fromCharCode(s>>16&255)+String.fromCharCode(s>>8&255)+String.fromCharCode(s&255))},a.ByteStringBuffer.prototype.putInt32=function(s){return this.putBytes(String.fromCharCode(s>>24&255)+String.fromCharCode(s>>16&255)+String.fromCharCode(s>>8&255)+String.fromCharCode(s&255))},a.ByteStringBuffer.prototype.putInt16Le=function(s){return this.putBytes(String.fromCharCode(s&255)+String.fromCharCode(s>>8&255))},a.ByteStringBuffer.prototype.putInt24Le=function(s){return this.putBytes(String.fromCharCode(s&255)+String.fromCharCode(s>>8&255)+String.fromCharCode(s>>16&255))},a.ByteStringBuffer.prototype.putInt32Le=function(s){return this.putBytes(String.fromCharCode(s&255)+String.fromCharCode(s>>8&255)+String.fromCharCode(s>>16&255)+String.fromCharCode(s>>24&255))},a.ByteStringBuffer.prototype.putInt=function(s,h){p(h);var d="";do h-=8,d+=String.fromCharCode(s>>h&255);while(h>0);return this.putBytes(d)},a.ByteStringBuffer.prototype.putSignedInt=function(s,h){return s<0&&(s+=2<<h-1),this.putInt(s,h)},a.ByteStringBuffer.prototype.putBuffer=function(s){return this.putBytes(s.getBytes())},a.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},a.ByteStringBuffer.prototype.getInt16=function(){var s=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,s},a.ByteStringBuffer.prototype.getInt24=function(){var s=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,s},a.ByteStringBuffer.prototype.getInt32=function(){var s=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,s},a.ByteStringBuffer.prototype.getInt16Le=function(){var s=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,s},a.ByteStringBuffer.prototype.getInt24Le=function(){var s=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,s},a.ByteStringBuffer.prototype.getInt32Le=function(){var s=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,s},a.ByteStringBuffer.prototype.getInt=function(s){p(s);var h=0;do h=(h<<8)+this.data.charCodeAt(this.read++),s-=8;while(s>0);return h},a.ByteStringBuffer.prototype.getSignedInt=function(s){var h=this.getInt(s),d=2<<s-2;return h>=d&&(h-=d<<1),h},a.ByteStringBuffer.prototype.getBytes=function(s){var h;return s?(s=Math.min(this.length(),s),h=this.data.slice(this.read,this.read+s),this.read+=s):s===0?h="":(h=this.read===0?this.data:this.data.slice(this.read),this.clear()),h},a.ByteStringBuffer.prototype.bytes=function(s){return typeof s>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+s)},a.ByteStringBuffer.prototype.at=function(s){return this.data.charCodeAt(this.read+s)},a.ByteStringBuffer.prototype.setAt=function(s,h){return this.data=this.data.substr(0,this.read+s)+String.fromCharCode(h)+this.data.substr(this.read+s+1),this},a.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},a.ByteStringBuffer.prototype.copy=function(){var s=a.createBuffer(this.data);return s.read=this.read,s},a.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},a.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},a.ByteStringBuffer.prototype.truncate=function(s){var h=Math.max(0,this.length()-s);return this.data=this.data.substr(this.read,h),this.read=0,this},a.ByteStringBuffer.prototype.toHex=function(){for(var s="",h=this.read;h<this.data.length;++h){var d=this.data.charCodeAt(h);d<16&&(s+="0"),s+=d.toString(16)}return s},a.ByteStringBuffer.prototype.toString=function(){return a.decodeUtf8(this.bytes())};function c(s,h){h=h||{},this.read=h.readOffset||0,this.growSize=h.growSize||1024;var d=a.isArrayBuffer(s),I=a.isArrayBufferView(s);if(d||I){d?this.data=new DataView(s):this.data=new DataView(s.buffer,s.byteOffset,s.byteLength),this.write="writeOffset"in h?h.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,s!=null&&this.putBytes(s),"writeOffset"in h&&(this.write=h.writeOffset)}a.DataBuffer=c,a.DataBuffer.prototype.length=function(){return this.write-this.read},a.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},a.DataBuffer.prototype.accommodate=function(s,h){if(this.length()>=s)return this;h=Math.max(h||this.growSize,s);var d=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),I=new Uint8Array(this.length()+h);return I.set(d),this.data=new DataView(I.buffer),this},a.DataBuffer.prototype.putByte=function(s){return this.accommodate(1),this.data.setUint8(this.write++,s),this},a.DataBuffer.prototype.fillWithByte=function(s,h){this.accommodate(h);for(var d=0;d<h;++d)this.data.setUint8(s);return this},a.DataBuffer.prototype.putBytes=function(s,h){if(a.isArrayBufferView(s)){var d=new Uint8Array(s.buffer,s.byteOffset,s.byteLength),I=d.byteLength-d.byteOffset;this.accommodate(I);var w=new Uint8Array(this.data.buffer,this.write);return w.set(d),this.write+=I,this}if(a.isArrayBuffer(s)){var d=new Uint8Array(s);this.accommodate(d.byteLength);var w=new Uint8Array(this.data.buffer);return w.set(d,this.write),this.write+=d.byteLength,this}if(s instanceof a.DataBuffer||typeof s=="object"&&typeof s.read=="number"&&typeof s.write=="number"&&a.isArrayBufferView(s.data)){var d=new Uint8Array(s.data.byteLength,s.read,s.length());this.accommodate(d.byteLength);var w=new Uint8Array(s.data.byteLength,this.write);return w.set(d),this.write+=d.byteLength,this}if(s instanceof a.ByteStringBuffer&&(s=s.data,h="binary"),h=h||"binary",typeof s=="string"){var l;if(h==="hex")return this.accommodate(Math.ceil(s.length/2)),l=new Uint8Array(this.data.buffer,this.write),this.write+=a.binary.hex.decode(s,l,this.write),this;if(h==="base64")return this.accommodate(Math.ceil(s.length/4)*3),l=new Uint8Array(this.data.buffer,this.write),this.write+=a.binary.base64.decode(s,l,this.write),this;if(h==="utf8"&&(s=a.encodeUtf8(s),h="binary"),h==="binary"||h==="raw")return this.accommodate(s.length),l=new Uint8Array(this.data.buffer,this.write),this.write+=a.binary.raw.decode(l),this;if(h==="utf16")return this.accommodate(s.length*2),l=new Uint16Array(this.data.buffer,this.write),this.write+=a.text.utf16.encode(l),this;throw new Error("Invalid encoding: "+h)}throw Error("Invalid parameter: "+s)},a.DataBuffer.prototype.putBuffer=function(s){return this.putBytes(s),s.clear(),this},a.DataBuffer.prototype.putString=function(s){return this.putBytes(s,"utf16")},a.DataBuffer.prototype.putInt16=function(s){return this.accommodate(2),this.data.setInt16(this.write,s),this.write+=2,this},a.DataBuffer.prototype.putInt24=function(s){return this.accommodate(3),this.data.setInt16(this.write,s>>8&65535),this.data.setInt8(this.write,s>>16&255),this.write+=3,this},a.DataBuffer.prototype.putInt32=function(s){return this.accommodate(4),this.data.setInt32(this.write,s),this.write+=4,this},a.DataBuffer.prototype.putInt16Le=function(s){return this.accommodate(2),this.data.setInt16(this.write,s,!0),this.write+=2,this},a.DataBuffer.prototype.putInt24Le=function(s){return this.accommodate(3),this.data.setInt8(this.write,s>>16&255),this.data.setInt16(this.write,s>>8&65535,!0),this.write+=3,this},a.DataBuffer.prototype.putInt32Le=function(s){return this.accommodate(4),this.data.setInt32(this.write,s,!0),this.write+=4,this},a.DataBuffer.prototype.putInt=function(s,h){p(h),this.accommodate(h/8);do h-=8,this.data.setInt8(this.write++,s>>h&255);while(h>0);return this},a.DataBuffer.prototype.putSignedInt=function(s,h){return p(h),this.accommodate(h/8),s<0&&(s+=2<<h-1),this.putInt(s,h)},a.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},a.DataBuffer.prototype.getInt16=function(){var s=this.data.getInt16(this.read);return this.read+=2,s},a.DataBuffer.prototype.getInt24=function(){var s=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,s},a.DataBuffer.prototype.getInt32=function(){var s=this.data.getInt32(this.read);return this.read+=4,s},a.DataBuffer.prototype.getInt16Le=function(){var s=this.data.getInt16(this.read,!0);return this.read+=2,s},a.DataBuffer.prototype.getInt24Le=function(){var s=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,s},a.DataBuffer.prototype.getInt32Le=function(){var s=this.data.getInt32(this.read,!0);return this.read+=4,s},a.DataBuffer.prototype.getInt=function(s){p(s);var h=0;do h=(h<<8)+this.data.getInt8(this.read++),s-=8;while(s>0);return h},a.DataBuffer.prototype.getSignedInt=function(s){var h=this.getInt(s),d=2<<s-2;return h>=d&&(h-=d<<1),h},a.DataBuffer.prototype.getBytes=function(s){var h;return s?(s=Math.min(this.length(),s),h=this.data.slice(this.read,this.read+s),this.read+=s):s===0?h="":(h=this.read===0?this.data:this.data.slice(this.read),this.clear()),h},a.DataBuffer.prototype.bytes=function(s){return typeof s>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+s)},a.DataBuffer.prototype.at=function(s){return this.data.getUint8(this.read+s)},a.DataBuffer.prototype.setAt=function(s,h){return this.data.setUint8(s,h),this},a.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},a.DataBuffer.prototype.copy=function(){return new a.DataBuffer(this)},a.DataBuffer.prototype.compact=function(){if(this.read>0){var s=new Uint8Array(this.data.buffer,this.read),h=new Uint8Array(s.byteLength);h.set(s),this.data=new DataView(h),this.write-=this.read,this.read=0}return this},a.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},a.DataBuffer.prototype.truncate=function(s){return this.write=Math.max(0,this.length()-s),this.read=Math.min(this.read,this.write),this},a.DataBuffer.prototype.toHex=function(){for(var s="",h=this.read;h<this.data.byteLength;++h){var d=this.data.getUint8(h);d<16&&(s+="0"),s+=d.toString(16)}return s},a.DataBuffer.prototype.toString=function(s){var h=new Uint8Array(this.data,this.read,this.length());if(s=s||"utf8",s==="binary"||s==="raw")return a.binary.raw.encode(h);if(s==="hex")return a.binary.hex.encode(h);if(s==="base64")return a.binary.base64.encode(h);if(s==="utf8")return a.text.utf8.decode(h);if(s==="utf16")return a.text.utf16.decode(h);throw new Error("Invalid encoding: "+s)},a.createBuffer=function(s,h){return h=h||"raw",s!==void 0&&h==="utf8"&&(s=a.encodeUtf8(s)),new a.ByteBuffer(s)},a.fillString=function(s,h){for(var d="";h>0;)h&1&&(d+=s),h>>>=1,h>0&&(s+=s);return d},a.xorBytes=function(s,h,d){for(var I="",w="",l="",n=0,r=0;d>0;--d,++n)w=s.charCodeAt(n)^h.charCodeAt(n),r>=10&&(I+=l,l="",r=0),l+=String.fromCharCode(w),++r;return I+=l,I},a.hexToBytes=function(s){var h="",d=0;for(s.length&!0&&(d=1,h+=String.fromCharCode(parseInt(s[0],16)));d<s.length;d+=2)h+=String.fromCharCode(parseInt(s.substr(d,2),16));return h},a.bytesToHex=function(s){return a.createBuffer(s).toHex()},a.int32ToBytes=function(s){return String.fromCharCode(s>>24&255)+String.fromCharCode(s>>16&255)+String.fromCharCode(s>>8&255)+String.fromCharCode(s&255)};var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g=[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],f="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";a.encode64=function(s,h){for(var d="",I="",w,l,n,r=0;r<s.length;)w=s.charCodeAt(r++),l=s.charCodeAt(r++),n=s.charCodeAt(r++),d+=t.charAt(w>>2),d+=t.charAt((w&3)<<4|l>>4),isNaN(l)?d+="==":(d+=t.charAt((l&15)<<2|n>>6),d+=isNaN(n)?"=":t.charAt(n&63)),h&&d.length>h&&(I+=d.substr(0,h)+`\r
`,d=d.substr(h));return I+=d,I},a.decode64=function(s){s=s.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var h="",d,I,w,l,n=0;n<s.length;)d=g[s.charCodeAt(n++)-43],I=g[s.charCodeAt(n++)-43],w=g[s.charCodeAt(n++)-43],l=g[s.charCodeAt(n++)-43],h+=String.fromCharCode(d<<2|I>>4),w!==64&&(h+=String.fromCharCode((I&15)<<4|w>>2),l!==64&&(h+=String.fromCharCode((w&3)<<6|l)));return h},a.encodeUtf8=function(s){return unescape(encodeURIComponent(s))},a.decodeUtf8=function(s){return decodeURIComponent(escape(s))},a.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:e.encode,decode:e.decode}},a.binary.raw.encode=function(s){return String.fromCharCode.apply(null,s)},a.binary.raw.decode=function(s,h,d){var I=h;I||(I=new Uint8Array(s.length)),d=d||0;for(var w=d,l=0;l<s.length;++l)I[w++]=s.charCodeAt(l);return h?w-d:I},a.binary.hex.encode=a.bytesToHex,a.binary.hex.decode=function(s,h,d){var I=h;I||(I=new Uint8Array(Math.ceil(s.length/2))),d=d||0;var w=0,l=d;for(s.length&1&&(w=1,I[l++]=parseInt(s[0],16));w<s.length;w+=2)I[l++]=parseInt(s.substr(w,2),16);return h?l-d:I},a.binary.base64.encode=function(s,h){for(var d="",I="",w,l,n,r=0;r<s.byteLength;)w=s[r++],l=s[r++],n=s[r++],d+=t.charAt(w>>2),d+=t.charAt((w&3)<<4|l>>4),isNaN(l)?d+="==":(d+=t.charAt((l&15)<<2|n>>6),d+=isNaN(n)?"=":t.charAt(n&63)),h&&d.length>h&&(I+=d.substr(0,h)+`\r
`,d=d.substr(h));return I+=d,I},a.binary.base64.decode=function(s,h,d){var I=h;I||(I=new Uint8Array(Math.ceil(s.length/4)*3)),s=s.replace(/[^A-Za-z0-9\+\/\=]/g,""),d=d||0;for(var w,l,n,r,A=0,k=d;A<s.length;)w=g[s.charCodeAt(A++)-43],l=g[s.charCodeAt(A++)-43],n=g[s.charCodeAt(A++)-43],r=g[s.charCodeAt(A++)-43],I[k++]=w<<2|l>>4,n!==64&&(I[k++]=(l&15)<<4|n>>2,r!==64&&(I[k++]=(n&3)<<6|r));return h?k-d:I.subarray(0,k)},a.binary.base58.encode=function(s,h){return a.binary.baseN.encode(s,f,h)},a.binary.base58.decode=function(s,h){return a.binary.baseN.decode(s,f,h)},a.text={utf8:{},utf16:{}},a.text.utf8.encode=function(s,h,d){s=a.encodeUtf8(s);var I=h;I||(I=new Uint8Array(s.length)),d=d||0;for(var w=d,l=0;l<s.length;++l)I[w++]=s.charCodeAt(l);return h?w-d:I},a.text.utf8.decode=function(s){return a.decodeUtf8(String.fromCharCode.apply(null,s))},a.text.utf16.encode=function(s,h,d){var I=h;I||(I=new Uint8Array(s.length*2));var w=new Uint16Array(I.buffer);d=d||0;for(var l=d,n=d,r=0;r<s.length;++r)w[n++]=s.charCodeAt(r),l+=2;return h?l-d:I},a.text.utf16.decode=function(s){return String.fromCharCode.apply(null,new Uint16Array(s.buffer))},a.deflate=function(s,h,d){if(h=a.decode64(s.deflate(a.encode64(h)).rval),d){var I=2,w=h.charCodeAt(1);w&32&&(I=6),h=h.substring(I,h.length-4)}return h},a.inflate=function(s,h,d){var I=s.inflate(a.encode64(h)).rval;return I===null?null:a.decode64(I)};var x=function(s,h,d){if(!s)throw new Error("WebStorage not available.");var I;if(d===null?I=s.removeItem(h):(d=a.encode64(JSON.stringify(d)),I=s.setItem(h,d)),typeof I<"u"&&I.rval!==!0){var w=new Error(I.error.message);throw w.id=I.error.id,w.name=I.error.name,w}},D=function(s,h){if(!s)throw new Error("WebStorage not available.");var d=s.getItem(h);if(s.init)if(d.rval===null){if(d.error){var I=new Error(d.error.message);throw I.id=d.error.id,I.name=d.error.name,I}d=null}else d=d.rval;return d!==null&&(d=JSON.parse(a.decode64(d))),d},E=function(s,h,d,I){var w=D(s,h);w===null&&(w={}),w[d]=I,x(s,h,w)},u=function(s,h,d){var I=D(s,h);return I!==null&&(I=d in I?I[d]:null),I},v=function(s,h,d){var I=D(s,h);if(I!==null&&d in I){delete I[d];var w=!0;for(var l in I){w=!1;break}w&&(I=null),x(s,h,I)}},C=function(s,h){x(s,h,null)},y=function(s,h,d){var I=null;typeof d>"u"&&(d=["web","flash"]);var w,l=!1,n=null;for(var r in d){w=d[r];try{if(w==="flash"||w==="both"){if(h[0]===null)throw new Error("Flash local storage not available.");I=s.apply(this,h),l=w==="flash"}(w==="web"||w==="both")&&(h[0]=localStorage,I=s.apply(this,h),l=!0)}catch(A){n=A}if(l)break}if(!l)throw n;return I};return a.setItem=function(s,h,d,I,w){y(E,arguments,w)},a.getItem=function(s,h,d,I){return y(u,arguments,I)},a.removeItem=function(s,h,d,I){y(v,arguments,I)},a.clearItems=function(s,h,d){y(C,arguments,d)},a.isEmpty=function(s){for(var h in s)if(s.hasOwnProperty(h))return!1;return!0},a.format=function(s){for(var h=/%./g,d,I,w=0,l=[],n=0;d=h.exec(s);){I=s.substring(n,h.lastIndex-2),I.length>0&&l.push(I),n=h.lastIndex;var r=d[0][1];switch(r){case"s":case"o":w<arguments.length?l.push(arguments[w+++1]):l.push("<?>");break;case"%":l.push("%");break;default:l.push("<%"+r+"?>")}}return l.push(s.substring(n)),l.join("")},a.formatNumber=function(s,h,d,I){var w=s,l=isNaN(h=Math.abs(h))?2:h,n=d===void 0?",":d,r=I===void 0?".":I,A=w<0?"-":"",k=parseInt(w=Math.abs(+w||0).toFixed(l),10)+"",O=k.length>3?k.length%3:0;return A+(O?k.substr(0,O)+r:"")+k.substr(O).replace(/(\d{3})(?=\d)/g,"$1"+r)+(l?n+Math.abs(w-k).toFixed(l).slice(2):"")},a.formatSize=function(s){return s>=1073741824?s=a.formatNumber(s/1073741824,2,".","")+" GiB":s>=1048576?s=a.formatNumber(s/1048576,2,".","")+" MiB":s>=1024?s=a.formatNumber(s/1024,0)+" KiB":s=a.formatNumber(s,0)+" bytes",s},a.bytesFromIP=function(s){return s.indexOf(".")!==-1?a.bytesFromIPv4(s):s.indexOf(":")!==-1?a.bytesFromIPv6(s):null},a.bytesFromIPv4=function(s){if(s=s.split("."),s.length!==4)return null;for(var h=a.createBuffer(),d=0;d<s.length;++d){var I=parseInt(s[d],10);if(isNaN(I))return null;h.putByte(I)}return h.getBytes()},a.bytesFromIPv6=function(s){var h=0;s=s.split(":").filter(function(n){return n.length===0&&++h,!0});for(var d=(8-s.length+h)*2,I=a.createBuffer(),w=0;w<8;++w){if(!s[w]||s[w].length===0){I.fillWithByte(0,d),d=0;continue}var l=a.hexToBytes(s[w]);l.length<2&&I.putByte(0),I.putBytes(l)}return I.getBytes()},a.bytesToIP=function(s){return s.length===4?a.bytesToIPv4(s):s.length===16?a.bytesToIPv6(s):null},a.bytesToIPv4=function(s){if(s.length!==4)return null;for(var h=[],d=0;d<s.length;++d)h.push(s.charCodeAt(d));return h.join(".")},a.bytesToIPv6=function(s){if(s.length!==16)return null;for(var h=[],d=[],I=0,w=0;w<s.length;w+=2){for(var l=a.bytesToHex(s[w]+s[w+1]);l[0]==="0"&&l!=="0";)l=l.substr(1);if(l==="0"){var n=d[d.length-1],r=h.length;!n||r!==n.end+1?d.push({start:r,end:r}):(n.end=r,n.end-n.start>d[I].end-d[I].start&&(I=d.length-1))}h.push(l)}if(d.length>0){var A=d[I];A.end-A.start>0&&(h.splice(A.start,A.end-A.start+1,""),A.start===0&&h.unshift(""),A.end===7&&h.push(""))}return h.join(":")},a.estimateCores=function(s,h){if(typeof s=="function"&&(h=s,s={}),s=s||{},"cores"in a&&!s.update)return h(null,a.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return a.cores=navigator.hardwareConcurrency,h(null,a.cores);if(typeof Worker>"u")return a.cores=1,h(null,a.cores);if(typeof Blob>"u")return a.cores=2,h(null,a.cores);var d=URL.createObjectURL(new Blob(["(",(function(){self.addEventListener("message",function(n){var r=Date.now(),A=r+4;self.postMessage({st:r,et:A})})}).toString(),")()"],{type:"application/javascript"}));I([],5,16);function I(n,r,A){if(r===0){var k=Math.floor(n.reduce(function(O,P){return O+P},0)/n.length);return a.cores=Math.max(1,k),URL.revokeObjectURL(d),h(null,a.cores)}w(A,function(O,P){n.push(l(A,P)),I(n,r-1,A)})}function w(n,r){for(var A=[],k=[],O=0;O<n;++O){var P=new Worker(d);P.addEventListener("message",function(K){if(k.push(K.data),k.length===n){for(var q=0;q<n;++q)A[q].terminate();r(null,k)}}),A.push(P)}for(var O=0;O<n;++O)A[O].postMessage(O)}function l(n,r){for(var A=[],k=0;k<n;++k)for(var O=r[k],P=A[k]=[],K=0;K<n;++K)if(k!==K){var q=r[K];(O.st>q.st&&O.st<q.et||q.st>O.st&&q.st<O.et)&&P.push(K)}return A.reduce(function(M,G){return Math.max(M,G.length)},0)}},_t.exports}var Rt,Sr;function wt(){if(Sr)return Rt;Sr=1;var i=ue();ce(),Rt=i.cipher=i.cipher||{},i.cipher.algorithms=i.cipher.algorithms||{},i.cipher.createCipher=function(a,p){var N=a;if(typeof N=="string"&&(N=i.cipher.getAlgorithm(N),N&&(N=N())),!N)throw new Error("Unsupported algorithm: "+a);return new i.cipher.BlockCipher({algorithm:N,key:p,decrypt:!1})},i.cipher.createDecipher=function(a,p){var N=a;if(typeof N=="string"&&(N=i.cipher.getAlgorithm(N),N&&(N=N())),!N)throw new Error("Unsupported algorithm: "+a);return new i.cipher.BlockCipher({algorithm:N,key:p,decrypt:!0})},i.cipher.registerAlgorithm=function(a,p){a=a.toUpperCase(),i.cipher.algorithms[a]=p},i.cipher.getAlgorithm=function(a){return a=a.toUpperCase(),a in i.cipher.algorithms?i.cipher.algorithms[a]:null};var e=i.cipher.BlockCipher=function(a){this.algorithm=a.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=a.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=a.decrypt,this.algorithm.initialize(a)};return e.prototype.start=function(a){a=a||{};var p={};for(var N in a)p[N]=a[N];p.decrypt=this._decrypt,this._finish=!1,this._input=i.util.createBuffer(),this.output=a.output||i.util.createBuffer(),this.mode.start(p)},e.prototype.update=function(a){for(a&&this._input.putBuffer(a);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},e.prototype.finish=function(a){a&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(N){return a(this.blockSize,N,!1)},this.mode.unpad=function(N){return a(this.blockSize,N,!0)});var p={};return p.decrypt=this._decrypt,p.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,p)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,p))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,p))},Rt}var Lt={exports:{}},Tr;function Ir(){if(Tr)return Lt.exports;Tr=1;var i=ue();ce(),i.cipher=i.cipher||{};var e=Lt.exports=i.cipher.modes=i.cipher.modes||{};e.ecb=function(S){S=S||{},this.name="ECB",this.cipher=S.cipher,this.blockSize=S.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},e.ecb.prototype.start=function(S){},e.ecb.prototype.encrypt=function(S,c,t){if(S.length()<this.blockSize&&!(t&&S.length()>0))return!0;for(var g=0;g<this._ints;++g)this._inBlock[g]=S.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var g=0;g<this._ints;++g)c.putInt32(this._outBlock[g])},e.ecb.prototype.decrypt=function(S,c,t){if(S.length()<this.blockSize&&!(t&&S.length()>0))return!0;for(var g=0;g<this._ints;++g)this._inBlock[g]=S.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var g=0;g<this._ints;++g)c.putInt32(this._outBlock[g])},e.ecb.prototype.pad=function(S,c){var t=S.length()===this.blockSize?this.blockSize:this.blockSize-S.length();return S.fillWithByte(t,t),!0},e.ecb.prototype.unpad=function(S,c){if(c.overflow>0)return!1;var t=S.length(),g=S.at(t-1);return g>this.blockSize<<2?!1:(S.truncate(g),!0)},e.cbc=function(S){S=S||{},this.name="CBC",this.cipher=S.cipher,this.blockSize=S.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},e.cbc.prototype.start=function(S){if(S.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in S)this._iv=a(S.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")},e.cbc.prototype.encrypt=function(S,c,t){if(S.length()<this.blockSize&&!(t&&S.length()>0))return!0;for(var g=0;g<this._ints;++g)this._inBlock[g]=this._prev[g]^S.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var g=0;g<this._ints;++g)c.putInt32(this._outBlock[g]);this._prev=this._outBlock},e.cbc.prototype.decrypt=function(S,c,t){if(S.length()<this.blockSize&&!(t&&S.length()>0))return!0;for(var g=0;g<this._ints;++g)this._inBlock[g]=S.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var g=0;g<this._ints;++g)c.putInt32(this._prev[g]^this._outBlock[g]);this._prev=this._inBlock.slice(0)},e.cbc.prototype.pad=function(S,c){var t=S.length()===this.blockSize?this.blockSize:this.blockSize-S.length();return S.fillWithByte(t,t),!0},e.cbc.prototype.unpad=function(S,c){if(c.overflow>0)return!1;var t=S.length(),g=S.at(t-1);return g>this.blockSize<<2?!1:(S.truncate(g),!0)},e.cfb=function(S){S=S||{},this.name="CFB",this.cipher=S.cipher,this.blockSize=S.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0},e.cfb.prototype.start=function(S){if(!("iv"in S))throw new Error("Invalid IV parameter.");this._iv=a(S.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.cfb.prototype.encrypt=function(S,c,t){var g=S.length();if(g===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&g>=this.blockSize){for(var f=0;f<this._ints;++f)this._inBlock[f]=S.getInt32()^this._outBlock[f],c.putInt32(this._inBlock[f]);return}var x=(this.blockSize-g)%this.blockSize;x>0&&(x=this.blockSize-x),this._partialOutput.clear();for(var f=0;f<this._ints;++f)this._partialBlock[f]=S.getInt32()^this._outBlock[f],this._partialOutput.putInt32(this._partialBlock[f]);if(x>0)S.read-=this.blockSize;else for(var f=0;f<this._ints;++f)this._inBlock[f]=this._partialBlock[f];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),x>0&&!t)return c.putBytes(this._partialOutput.getBytes(x-this._partialBytes)),this._partialBytes=x,!0;c.putBytes(this._partialOutput.getBytes(g-this._partialBytes)),this._partialBytes=0},e.cfb.prototype.decrypt=function(S,c,t){var g=S.length();if(g===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&g>=this.blockSize){for(var f=0;f<this._ints;++f)this._inBlock[f]=S.getInt32(),c.putInt32(this._inBlock[f]^this._outBlock[f]);return}var x=(this.blockSize-g)%this.blockSize;x>0&&(x=this.blockSize-x),this._partialOutput.clear();for(var f=0;f<this._ints;++f)this._partialBlock[f]=S.getInt32(),this._partialOutput.putInt32(this._partialBlock[f]^this._outBlock[f]);if(x>0)S.read-=this.blockSize;else for(var f=0;f<this._ints;++f)this._inBlock[f]=this._partialBlock[f];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),x>0&&!t)return c.putBytes(this._partialOutput.getBytes(x-this._partialBytes)),this._partialBytes=x,!0;c.putBytes(this._partialOutput.getBytes(g-this._partialBytes)),this._partialBytes=0},e.ofb=function(S){S=S||{},this.name="OFB",this.cipher=S.cipher,this.blockSize=S.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0},e.ofb.prototype.start=function(S){if(!("iv"in S))throw new Error("Invalid IV parameter.");this._iv=a(S.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.ofb.prototype.encrypt=function(S,c,t){var g=S.length();if(S.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&g>=this.blockSize){for(var f=0;f<this._ints;++f)c.putInt32(S.getInt32()^this._outBlock[f]),this._inBlock[f]=this._outBlock[f];return}var x=(this.blockSize-g)%this.blockSize;x>0&&(x=this.blockSize-x),this._partialOutput.clear();for(var f=0;f<this._ints;++f)this._partialOutput.putInt32(S.getInt32()^this._outBlock[f]);if(x>0)S.read-=this.blockSize;else for(var f=0;f<this._ints;++f)this._inBlock[f]=this._outBlock[f];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),x>0&&!t)return c.putBytes(this._partialOutput.getBytes(x-this._partialBytes)),this._partialBytes=x,!0;c.putBytes(this._partialOutput.getBytes(g-this._partialBytes)),this._partialBytes=0},e.ofb.prototype.decrypt=e.ofb.prototype.encrypt,e.ctr=function(S){S=S||{},this.name="CTR",this.cipher=S.cipher,this.blockSize=S.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0},e.ctr.prototype.start=function(S){if(!("iv"in S))throw new Error("Invalid IV parameter.");this._iv=a(S.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.ctr.prototype.encrypt=function(S,c,t){var g=S.length();if(g===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&g>=this.blockSize)for(var f=0;f<this._ints;++f)c.putInt32(S.getInt32()^this._outBlock[f]);else{var x=(this.blockSize-g)%this.blockSize;x>0&&(x=this.blockSize-x),this._partialOutput.clear();for(var f=0;f<this._ints;++f)this._partialOutput.putInt32(S.getInt32()^this._outBlock[f]);if(x>0&&(S.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),x>0&&!t)return c.putBytes(this._partialOutput.getBytes(x-this._partialBytes)),this._partialBytes=x,!0;c.putBytes(this._partialOutput.getBytes(g-this._partialBytes)),this._partialBytes=0}p(this._inBlock)},e.ctr.prototype.decrypt=e.ctr.prototype.encrypt,e.gcm=function(S){S=S||{},this.name="GCM",this.cipher=S.cipher,this.blockSize=S.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=i.util.createBuffer(),this._partialBytes=0,this._R=3774873600},e.gcm.prototype.start=function(S){if(!("iv"in S))throw new Error("Invalid IV parameter.");var c=i.util.createBuffer(S.iv);this._cipherLength=0;var t;if("additionalData"in S?t=i.util.createBuffer(S.additionalData):t=i.util.createBuffer(),"tagLength"in S?this._tagLength=S.tagLength:this._tagLength=128,this._tag=null,S.decrypt&&(this._tag=i.util.createBuffer(S.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 g=c.length();if(g===12)this._j0=[c.getInt32(),c.getInt32(),c.getInt32(),1];else{for(this._j0=[0,0,0,0];c.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[c.getInt32(),c.getInt32(),c.getInt32(),c.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(N(g*8)))}this._inBlock=this._j0.slice(0),p(this._inBlock),this._partialBytes=0,t=i.util.createBuffer(t),this._aDataLength=N(t.length()*8);var f=t.length()%this.blockSize;for(f&&t.fillWithByte(0,this.blockSize-f),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},e.gcm.prototype.encrypt=function(S,c,t){var g=S.length();if(g===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&g>=this.blockSize){for(var f=0;f<this._ints;++f)c.putInt32(this._outBlock[f]^=S.getInt32());this._cipherLength+=this.blockSize}else{var x=(this.blockSize-g)%this.blockSize;x>0&&(x=this.blockSize-x),this._partialOutput.clear();for(var f=0;f<this._ints;++f)this._partialOutput.putInt32(S.getInt32()^this._outBlock[f]);if(x<=0||t){if(t){var D=g%this.blockSize;this._cipherLength+=D,this._partialOutput.truncate(this.blockSize-D)}else this._cipherLength+=this.blockSize;for(var f=0;f<this._ints;++f)this._outBlock[f]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),x>0&&!t)return S.read-=this.blockSize,c.putBytes(this._partialOutput.getBytes(x-this._partialBytes)),this._partialBytes=x,!0;c.putBytes(this._partialOutput.getBytes(g-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),p(this._inBlock)},e.gcm.prototype.decrypt=function(S,c,t){var g=S.length();if(g<this.blockSize&&!(t&&g>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),p(this._inBlock),this._hashBlock[0]=S.getInt32(),this._hashBlock[1]=S.getInt32(),this._hashBlock[2]=S.getInt32(),this._hashBlock[3]=S.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var f=0;f<this._ints;++f)c.putInt32(this._outBlock[f]^this._hashBlock[f]);g<this.blockSize?this._cipherLength+=g%this.blockSize:this._cipherLength+=this.blockSize},e.gcm.prototype.afterFinish=function(S,c){var t=!0;c.decrypt&&c.overflow&&S.truncate(this.blockSize-c.overflow),this.tag=i.util.createBuffer();var g=this._aDataLength.concat(N(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,g);var f=[];this.cipher.encrypt(this._j0,f);for(var x=0;x<this._ints;++x)this.tag.putInt32(this._s[x]^f[x]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),c.decrypt&&this.tag.bytes()!==this._tag&&(t=!1),t},e.gcm.prototype.multiply=function(S,c){for(var t=[0,0,0,0],g=c.slice(0),f=0;f<128;++f){var x=S[f/32|0]&1<<31-f%32;x&&(t[0]^=g[0],t[1]^=g[1],t[2]^=g[2],t[3]^=g[3]),this.pow(g,g)}return t},e.gcm.prototype.pow=function(S,c){for(var t=S[3]&1,g=3;g>0;--g)c[g]=S[g]>>>1|(S[g-1]&1)<<31;c[0]=S[0]>>>1,t&&(c[0]^=this._R)},e.gcm.prototype.tableMultiply=function(S){for(var c=[0,0,0,0],t=0;t<32;++t){var g=t/8|0,f=S[g]>>>(7-t%8)*4&15,x=this._m[t][f];c[0]^=x[0],c[1]^=x[1],c[2]^=x[2],c[3]^=x[3]}return c},e.gcm.prototype.ghash=function(S,c,t){return c[0]^=t[0],c[1]^=t[1],c[2]^=t[2],c[3]^=t[3],this.tableMultiply(c)},e.gcm.prototype.generateHashTable=function(S,c){for(var t=8/c,g=4*t,f=16*t,x=new Array(f),D=0;D<f;++D){var E=[0,0,0,0],u=D/g|0,v=(g-1-D%g)*c;E[u]=1<<c-1<<v,x[D]=this.generateSubHashTable(this.multiply(E,S),c)}return x},e.gcm.prototype.generateSubHashTable=function(S,c){var t=1<<c,g=t>>>1,f=new Array(t);f[g]=S.slice(0);for(var x=g>>>1;x>0;)this.pow(f[2*x],f[x]=[]),x>>=1;for(x=2;x<g;){for(var D=1;D<x;++D){var E=f[x],u=f[D];f[x+D]=[E[0]^u[0],E[1]^u[1],E[2]^u[2],E[3]^u[3]]}x*=2}for(f[0]=[0,0,0,0],x=g+1;x<t;++x){var v=f[x^g];f[x]=[S[0]^v[0],S[1]^v[1],S[2]^v[2],S[3]^v[3]]}return f};function a(S,c){if(typeof S=="string"&&(S=i.util.createBuffer(S)),i.util.isArray(S)&&S.length>4){var t=S;S=i.util.createBuffer();for(var g=0;g<t.length;++g)S.putByte(t[g])}if(S.length()<c)throw new Error("Invalid IV length; got "+S.length()+" bytes and expected "+c+" bytes.");if(!i.util.isArray(S)){for(var f=[],x=c/4,g=0;g<x;++g)f.push(S.getInt32());S=f}return S}function p(S){S[S.length-1]=S[S.length-1]+1&4294967295}function N(S){return[S/4294967296|0,S&4294967295]}return Lt.exports}var kt,Ar;function ut(){if(Ar)return kt;Ar=1;var i=ue();wt(),Ir(),ce(),kt=i.aes=i.aes||{},i.aes.startEncrypting=function(u,v,C,y){var s=E({key:u,output:C,decrypt:!1,mode:y});return s.start(v),s},i.aes.createEncryptionCipher=function(u,v){return E({key:u,output:null,decrypt:!1,mode:v})},i.aes.startDecrypting=function(u,v,C,y){var s=E({key:u,output:C,decrypt:!0,mode:y});return s.start(v),s},i.aes.createDecryptionCipher=function(u,v){return E({key:u,output:null,decrypt:!0,mode:v})},i.aes.Algorithm=function(u,v){a||f();var C=this;C.name=u,C.mode=new v({blockSize:16,cipher:{encrypt:function(y,s){return D(C._w,y,s,!1)},decrypt:function(y,s){return D(C._w,y,s,!0)}}}),C._init=!1},i.aes.Algorithm.prototype.initialize=function(u){if(!this._init){var v=u.key,C;if(typeof v=="string"&&(v.length===16||v.length===24||v.length===32))v=i.util.createBuffer(v);else if(i.util.isArray(v)&&(v.length===16||v.length===24||v.length===32)){C=v,v=i.util.createBuffer();for(var y=0;y<C.length;++y)v.putByte(C[y])}if(!i.util.isArray(v)){C=v,v=[];var s=C.length();if(s===16||s===24||s===32){s=s>>>2;for(var y=0;y<s;++y)v.push(C.getInt32())}}if(!i.util.isArray(v)||!(v.length===4||v.length===6||v.length===8))throw new Error("Invalid key parameter.");var h=this.mode.name,d=["CFB","OFB","CTR","GCM"].indexOf(h)!==-1;this._w=x(v,u.decrypt&&!d),this._init=!0}},i.aes._expandKey=function(u,v){return a||f(),x(u,v)},i.aes._updateBlock=D,e("AES-ECB",i.cipher.modes.ecb),e("AES-CBC",i.cipher.modes.cbc),e("AES-CFB",i.cipher.modes.cfb),e("AES-OFB",i.cipher.modes.ofb),e("AES-CTR",i.cipher.modes.ctr),e("AES-GCM",i.cipher.modes.gcm);function e(u,v){var C=function(){return new i.aes.Algorithm(u,v)};i.cipher.registerAlgorithm(u,C)}var a=!1,p=4,N,S,c,t,g;function f(){a=!0,c=[0,1,2,4,8,16,32,64,128,27,54];for(var u=new Array(256),v=0;v<128;++v)u[v]=v<<1,u[v+128]=v+128<<1^283;N=new Array(256),S=new Array(256),t=new Array(4),g=new Array(4);for(var v=0;v<4;++v)t[v]=new Array(256),g[v]=new Array(256);for(var C=0,y=0,s,h,d,I,w,l,n,v=0;v<256;++v){I=y^y<<1^y<<2^y<<3^y<<4,I=I>>8^I&255^99,N[C]=I,S[I]=C,w=u[I],s=u[C],h=u[s],d=u[h],l=w<<24^I<<16^I<<8^(I^w),n=(s^h^d)<<24^(C^d)<<16^(C^h^d)<<8^(C^s^d);for(var r=0;r<4;++r)t[r][C]=l,g[r][I]=n,l=l<<24|l>>>8,n=n<<24|n>>>8;C===0?C=y=1:(C=s^u[u[u[s^d]]],y^=u[u[y]])}}function x(u,v){for(var C=u.slice(0),y,s=1,h=C.length,d=h+6+1,I=p*d,w=h;w<I;++w)y=C[w-1],w%h===0?(y=N[y>>>16&255]<<24^N[y>>>8&255]<<16^N[y&255]<<8^N[y>>>24]^c[s]<<24,s++):h>6&&w%h===4&&(y=N[y>>>24]<<24^N[y>>>16&255]<<16^N[y>>>8&255]<<8^N[y&255]),C[w]=C[w-h]^y;if(v){var l,n=g[0],r=g[1],A=g[2],k=g[3],O=C.slice(0);I=C.length;for(var w=0,P=I-p;w<I;w+=p,P-=p)if(w===0||w===I-p)O[w]=C[P],O[w+1]=C[P+3],O[w+2]=C[P+2],O[w+3]=C[P+1];else for(var K=0;K<p;++K)l=C[P+K],O[w+(3&-K)]=n[N[l>>>24]]^r[N[l>>>16&255]]^A[N[l>>>8&255]]^k[N[l&255]];C=O}return C}function D(u,v,C,y){var s=u.length/4-1,h,d,I,w,l;y?(h=g[0],d=g[1],I=g[2],w=g[3],l=S):(h=t[0],d=t[1],I=t[2],w=t[3],l=N);var n,r,A,k,O,P,K;n=v[0]^u[0],r=v[y?3:1]^u[1],A=v[2]^u[2],k=v[y?1:3]^u[3];for(var q=3,M=1;M<s;++M)O=h[n>>>24]^d[r>>>16&255]^I[A>>>8&255]^w[k&255]^u[++q],P=h[r>>>24]^d[A>>>16&255]^I[k>>>8&255]^w[n&255]^u[++q],K=h[A>>>24]^d[k>>>16&255]^I[n>>>8&255]^w[r&255]^u[++q],k=h[k>>>24]^d[n>>>16&255]^I[r>>>8&255]^w[A&255]^u[++q],n=O,r=P,A=K;C[0]=l[n>>>24]<<24^l[r>>>16&255]<<16^l[A>>>8&255]<<8^l[k&255]^u[++q],C[y?3:1]=l[r>>>24]<<24^l[A>>>16&255]<<16^l[k>>>8&255]<<8^l[n&255]^u[++q],C[2]=l[A>>>24]<<24^l[k>>>16&255]<<16^l[n>>>8&255]<<8^l[r&255]^u[++q],C[y?1:3]=l[k>>>24]<<24^l[n>>>16&255]<<16^l[r>>>8&255]<<8^l[A&255]^u[++q]}function E(u){u=u||{};var v=(u.mode||"CBC").toUpperCase(),C="AES-"+v,y;u.decrypt?y=i.cipher.createDecipher(C,u.key):y=i.cipher.createCipher(C,u.key);var s=y.start;return y.start=function(h,d){var I=null;d instanceof i.util.ByteBuffer&&(I=d,d={}),d=d||{},d.output=I,d.iv=h,s.call(y,d)},y}return kt}var Dt={exports:{}},Ut={exports:{}},Pt={exports:{}},Br;function ft(){if(Br)return Pt.exports;Br=1;var i=ue();i.pki=i.pki||{};var e=Pt.exports=i.pki.oids=i.oids=i.oids||{};function a(N,S){e[N]=S,e[S]=N}function p(N,S){e[N]=S}return a("1.2.840.113549.1.1.1","rsaEncryption"),a("1.2.840.113549.1.1.4","md5WithRSAEncryption"),a("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),a("1.2.840.113549.1.1.7","RSAES-OAEP"),a("1.2.840.113549.1.1.8","mgf1"),a("1.2.840.113549.1.1.9","pSpecified"),a("1.2.840.113549.1.1.10","RSASSA-PSS"),a("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),a("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),a("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),a("1.3.101.112","EdDSA25519"),a("1.2.840.10040.4.3","dsa-with-sha1"),a("1.3.14.3.2.7","desCBC"),a("1.3.14.3.2.26","sha1"),a("1.3.14.3.2.29","sha1WithRSASignature"),a("2.16.840.1.101.3.4.2.1","sha256"),a("2.16.840.1.101.3.4.2.2","sha384"),a("2.16.840.1.101.3.4.2.3","sha512"),a("2.16.840.1.101.3.4.2.4","sha224"),a("2.16.840.1.101.3.4.2.5","sha512-224"),a("2.16.840.1.101.3.4.2.6","sha512-256"),a("1.2.840.113549.2.2","md2"),a("1.2.840.113549.2.5","md5"),a("1.2.840.113549.1.7.1","data"),a("1.2.840.113549.1.7.2","signedData"),a("1.2.840.113549.1.7.3","envelopedData"),a("1.2.840.113549.1.7.4","signedAndEnvelopedData"),a("1.2.840.113549.1.7.5","digestedData"),a("1.2.840.113549.1.7.6","encryptedData"),a("1.2.840.113549.1.9.1","emailAddress"),a("1.2.840.113549.1.9.2","unstructuredName"),a("1.2.840.113549.1.9.3","contentType"),a("1.2.840.113549.1.9.4","messageDigest"),a("1.2.840.113549.1.9.5","signingTime"),a("1.2.840.113549.1.9.6","counterSignature"),a("1.2.840.113549.1.9.7","challengePassword"),a("1.2.840.113549.1.9.8","unstructuredAddress"),a("1.2.840.113549.1.9.14","extensionRequest"),a("1.2.840.113549.1.9.20","friendlyName"),a("1.2.840.113549.1.9.21","localKeyId"),a("1.2.840.113549.1.9.22.1","x509Certificate"),a("1.2.840.113549.1.12.10.1.1","keyBag"),a("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),a("1.2.840.113549.1.12.10.1.3","certBag"),a("1.2.840.113549.1.12.10.1.4","crlBag"),a("1.2.840.113549.1.12.10.1.5","secretBag"),a("1.2.840.113549.1.12.10.1.6","safeContentsBag"),a("1.2.840.113549.1.5.13","pkcs5PBES2"),a("1.2.840.113549.1.5.12","pkcs5PBKDF2"),a("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),a("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),a("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),a("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),a("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),a("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),a("1.2.840.113549.2.7","hmacWithSHA1"),a("1.2.840.113549.2.8","hmacWithSHA224"),a("1.2.840.113549.2.9","hmacWithSHA256"),a("1.2.840.113549.2.10","hmacWithSHA384"),a("1.2.840.113549.2.11","hmacWithSHA512"),a("1.2.840.113549.3.7","des-EDE3-CBC"),a("2.16.840.1.101.3.4.1.2","aes128-CBC"),a("2.16.840.1.101.3.4.1.22","aes192-CBC"),a("2.16.840.1.101.3.4.1.42","aes256-CBC"),a("2.5.4.3","commonName"),a("2.5.4.4","surname"),a("2.5.4.5","serialNumber"),a("2.5.4.6","countryName"),a("2.5.4.7","localityName"),a("2.5.4.8","stateOrProvinceName"),a("2.5.4.9","streetAddress"),a("2.5.4.10","organizationName"),a("2.5.4.11","organizationalUnitName"),a("2.5.4.12","title"),a("2.5.4.13","description"),a("2.5.4.15","businessCategory"),a("2.5.4.17","postalCode"),a("2.5.4.42","givenName"),a("2.5.4.65","pseudonym"),a("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),a("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),a("2.16.840.1.113730.1.1","nsCertType"),a("2.16.840.1.113730.1.13","nsComment"),p("2.5.29.1","authorityKeyIdentifier"),p("2.5.29.2","keyAttributes"),p("2.5.29.3","certificatePolicies"),p("2.5.29.4","keyUsageRestriction"),p("2.5.29.5","policyMapping"),p("2.5.29.6","subtreesConstraint"),p("2.5.29.7","subjectAltName"),p("2.5.29.8","issuerAltName"),p("2.5.29.9","subjectDirectoryAttributes"),p("2.5.29.10","basicConstraints"),p("2.5.29.11","nameConstraints"),p("2.5.29.12","policyConstraints"),p("2.5.29.13","basicConstraints"),a("2.5.29.14","subjectKeyIdentifier"),a("2.5.29.15","keyUsage"),p("2.5.29.16","privateKeyUsagePeriod"),a("2.5.29.17","subjectAltName"),a("2.5.29.18","issuerAltName"),a("2.5.29.19","basicConstraints"),p("2.5.29.20","cRLNumber"),p("2.5.29.21","cRLReason"),p("2.5.29.22","expirationDate"),p("2.5.29.23","instructionCode"),p("2.5.29.24","invalidityDate"),p("2.5.29.25","cRLDistributionPoints"),p("2.5.29.26","issuingDistributionPoint"),p("2.5.29.27","deltaCRLIndicator"),p("2.5.29.28","issuingDistributionPoint"),p("2.5.29.29","certificateIssuer"),p("2.5.29.30","nameConstraints"),a("2.5.29.31","cRLDistributionPoints"),a("2.5.29.32","certificatePolicies"),p("2.5.29.33","policyMappings"),p("2.5.29.34","policyConstraints"),a("2.5.29.35","authorityKeyIdentifier"),p("2.5.29.36","policyConstraints"),a("2.5.29.37","extKeyUsage"),p("2.5.29.46","freshestCRL"),p("2.5.29.54","inhibitAnyPolicy"),a("1.3.6.1.4.1.11129.2.4.2","timestampList"),a("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),a("1.3.6.1.5.5.7.3.1","serverAuth"),a("1.3.6.1.5.5.7.3.2","clientAuth"),a("1.3.6.1.5.5.7.3.3","codeSigning"),a("1.3.6.1.5.5.7.3.4","emailProtection"),a("1.3.6.1.5.5.7.3.8","timeStamping"),Pt.exports}var br;function tt(){if(br)return Ut.exports;br=1;var i=ue();ce(),ft();var e=Ut.exports=i.asn1=i.asn1||{};e.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},e.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},e.maxDepth=256,e.create=function(c,t,g,f,x){if(i.util.isArray(f)){for(var D=[],E=0;E<f.length;++E)f[E]!==void 0&&D.push(f[E]);f=D}var u={tagClass:c,type:t,constructed:g,composed:g||i.util.isArray(f),value:f};return x&&"bitStringContents"in x&&(u.bitStringContents=x.bitStringContents,u.original=e.copy(u)),u},e.copy=function(c,t){var g;if(i.util.isArray(c)){g=[];for(var f=0;f<c.length;++f)g.push(e.copy(c[f],t));return g}return typeof c=="string"?c:(g={tagClass:c.tagClass,type:c.type,constructed:c.constructed,composed:c.composed,value:e.copy(c.value,t)},t&&!t.excludeBitStringContents&&(g.bitStringContents=c.bitStringContents),g)},e.equals=function(c,t,g){if(i.util.isArray(c)){if(!i.util.isArray(t)||c.length!==t.length)return!1;for(var f=0;f<c.length;++f)if(!e.equals(c[f],t[f]))return!1;return!0}if(typeof c!=typeof t)return!1;if(typeof c=="string")return c===t;var x=c.tagClass===t.tagClass&&c.type===t.type&&c.constructed===t.constructed&&c.composed===t.composed&&e.equals(c.value,t.value);return g&&g.includeBitStringContents&&(x=x&&c.bitStringContents===t.bitStringContents),x},e.getBerValueLength=function(c){var t=c.getByte();if(t!==128){var g,f=t&128;return f?g=c.getInt((t&127)<<3):g=t,g}};function a(c,t,g){if(g>t){var f=new Error("Too few bytes to parse DER.");throw f.available=c.length(),f.remaining=t,f.requested=g,f}}var p=function(c,t){var g=c.getByte();if(t--,g!==128){var f,x=g&128;if(!x)f=g;else{var D=g&127;a(c,t,D),f=c.getInt(D<<3)}if(f<0)throw new Error("Negative length: "+f);return f}};e.fromDer=function(c,t){t===void 0&&(t={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof t=="boolean"&&(t={strict:t,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"parseAllBytes"in t||(t.parseAllBytes=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"maxDepth"in t||(t.maxDepth=e.maxDepth),typeof c=="string"&&(c=i.util.createBuffer(c));var g=c.length(),f=N(c,c.length(),0,t);if(t.parseAllBytes&&c.length()!==0){var x=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw x.byteCount=g,x.remaining=c.length(),x}return f};function N(c,t,g,f){if(g>=f.maxDepth)throw new Error("ASN.1 parsing error: Max depth exceeded.");var x;a(c,t,2);var D=c.getByte();t--;var E=D&192,u=D&31;x=c.length();var v=p(c,t);if(t-=x-c.length(),v!==void 0&&v>t){if(f.strict){var C=new Error("Too few bytes to read ASN.1 value.");throw C.available=c.length(),C.remaining=t,C.requested=v,C}v=t}var y,s,h=(D&32)===32;if(h)if(y=[],v===void 0)for(;;){if(a(c,t,2),c.bytes(2)==="\0\0"){c.getBytes(2),t-=2;break}x=c.length(),y.push(N(c,t,g+1,f)),t-=x-c.length()}else for(;v>0;)x=c.length(),y.push(N(c,v,g+1,f)),t-=x-c.length(),v-=x-c.length();if(y===void 0&&E===e.Class.UNIVERSAL&&u===e.Type.BITSTRING&&(s=c.bytes(v)),y===void 0&&f.decodeBitStrings&&E===e.Class.UNIVERSAL&&u===e.Type.BITSTRING&&v>1){var d=c.read,I=t,w=0;if(u===e.Type.BITSTRING&&(a(c,t,1),w=c.getByte(),t--),w===0)try{x=c.length();var l={strict:!0,decodeBitStrings:!0},n=N(c,t,g+1,l),r=x-c.length();t-=r,u==e.Type.BITSTRING&&r++;var A=n.tagClass;r===v&&(A===e.Class.UNIVERSAL||A===e.Class.CONTEXT_SPECIFIC)&&(y=[n])}catch{}y===void 0&&(c.read=d,t=I)}if(y===void 0){if(v===void 0){if(f.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");v=t}if(u===e.Type.BMPSTRING)for(y="";v>0;v-=2)a(c,t,2),y+=String.fromCharCode(c.getInt16()),t-=2;else y=c.getBytes(v),t-=v}var k=s===void 0?null:{bitStringContents:s};return e.create(E,u,h,y,k)}e.toDer=function(c){var t=i.util.createBuffer(),g=c.tagClass|c.type,f=i.util.createBuffer(),x=!1;if("bitStringContents"in c&&(x=!0,c.original&&(x=e.equals(c,c.original))),x)f.putBytes(c.bitStringContents);else if(c.composed){c.constructed?g|=32:f.putByte(0);for(var D=0;D<c.value.length;++D)c.value[D]!==void 0&&f.putBuffer(e.toDer(c.value[D]))}else if(c.type===e.Type.BMPSTRING)for(var D=0;D<c.value.length;++D)f.putInt16(c.value.charCodeAt(D));else c.type===e.Type.INTEGER&&c.value.length>1&&(c.value.charCodeAt(0)===0&&(c.value.charCodeAt(1)&128)===0||c.value.charCodeAt(0)===255&&(c.value.charCodeAt(1)&128)===128)?f.putBytes(c.value.substr(1)):f.putBytes(c.value);if(t.putByte(g),f.length()<=127)t.putByte(f.length()&127);else{var E=f.length(),u="";do u+=String.fromCharCode(E&255),E=E>>>8;while(E>0);t.putByte(u.length|128);for(var D=u.length-1;D>=0;--D)t.putByte(u.charCodeAt(D))}return t.putBuffer(f),t},e.oidToDer=function(c){var t=c.split("."),g=i.util.createBuffer();g.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var f,x,D,E,u=2;u<t.length;++u){if(f=!0,x=[],D=parseInt(t[u],10),D>4294967295)throw new Error("OID value too large; max is 32-bits.");do E=D&127,D=D>>>7,f||(E|=128),x.push(E),f=!1;while(D>0);for(var v=x.length-1;v>=0;--v)g.putByte(x[v])}return g},e.derToOid=function(c){var t;typeof c=="string"&&(c=i.util.createBuffer(c));var g=c.getByte();t=Math.floor(g/40)+"."+g%40;for(var f=0;c.length()>0;){if(f>70368744177663)throw new Error("OID value too large; max is 53-bits.");g=c.getByte(),f=f*128,g&128?f+=g&127:(t+="."+(f+g),f=0)}return t},e.utcTimeToDate=function(c){var t=new Date,g=parseInt(c.substr(0,2),10);g=g>=50?1900+g:2e3+g;var f=parseInt(c.substr(2,2),10)-1,x=parseInt(c.substr(4,2),10),D=parseInt(c.substr(6,2),10),E=parseInt(c.substr(8,2),10),u=0;if(c.length>11){var v=c.charAt(10),C=10;v!=="+"&&v!=="-"&&(u=parseInt(c.substr(10,2),10),C+=2)}if(t.setUTCFullYear(g,f,x),t.setUTCHours(D,E,u,0),C&&(v=c.charAt(C),v==="+"||v==="-")){var y=parseInt(c.substr(C+1,2),10),s=parseInt(c.substr(C+4,2),10),h=y*60+s;h*=6e4,v==="+"?t.setTime(+t-h):t.setTime(+t+h)}return t},e.generalizedTimeToDate=function(c){var t=new Date,g=parseInt(c.substr(0,4),10),f=parseInt(c.substr(4,2),10)-1,x=parseInt(c.substr(6,2),10),D=parseInt(c.substr(8,2),10),E=parseInt(c.substr(10,2),10),u=parseInt(c.substr(12,2),10),v=0,C=0,y=!1;c.charAt(c.length-1)==="Z"&&(y=!0);var s=c.length-5,h=c.charAt(s);if(h==="+"||h==="-"){var d=parseInt(c.substr(s+1,2),10),I=parseInt(c.substr(s+4,2),10);C=d*60+I,C*=6e4,h==="+"&&(C*=-1),y=!0}return c.charAt(14)==="."&&(v=parseFloat(c.substr(14),10)*1e3),y?(t.setUTCFullYear(g,f,x),t.setUTCHours(D,E,u,v),t.setTime(+t+C)):(t.setFullYear(g,f,x),t.setHours(D,E,u,v)),t},e.dateToUtcTime=function(c){if(typeof c=="string")return c;var t="",g=[];g.push((""+c.getUTCFullYear()).substr(2)),g.push(""+(c.getUTCMonth()+1)),g.push(""+c.getUTCDate()),g.push(""+c.getUTCHours()),g.push(""+c.getUTCMinutes()),g.push(""+c.getUTCSeconds());for(var f=0;f<g.length;++f)g[f].length<2&&(t+="0"),t+=g[f];return t+="Z",t},e.dateToGeneralizedTime=function(c){if(typeof c=="string")return c;var t="",g=[];g.push(""+c.getUTCFullYear()),g.push(""+(c.getUTCMonth()+1)),g.push(""+c.getUTCDate()),g.push(""+c.getUTCHours()),g.push(""+c.getUTCMinutes()),g.push(""+c.getUTCSeconds());for(var f=0;f<g.length;++f)g[f].length<2&&(t+="0"),t+=g[f];return t+="Z",t},e.integerToDer=function(c){var t=i.util.createBuffer();if(c>=-128&&c<128)return t.putSignedInt(c,8);if(c>=-32768&&c<32768)return t.putSignedInt(c,16);if(c>=-8388608&&c<8388608)return t.putSignedInt(c,24);if(c>=-2147483648&&c<2147483648)return t.putSignedInt(c,32);var g=new Error("Integer too large; max is 32-bits.");throw g.integer=c,g},e.derToInteger=function(c){typeof c=="string"&&(c=i.util.createBuffer(c));var t=c.length()*8;if(t>32)throw new Error("Integer too large; max is 32-bits.");return c.getSignedInt(t)},e.validate=function(c,t,g,f){var x=!1;if((c.tagClass===t.tagClass||typeof t.tagClass>"u")&&(c.type===t.type||typeof t.type>"u"))if(c.constructed===t.constructed||typeof t.constructed>"u"){if(x=!0,t.value&&i.util.isArray(t.value))for(var D=0,E=0;x&&E<t.value.length;++E){var u=t.value[E];x=!!u.optional;var v=c.value[D];if(!v){u.optional||(x=!1,f&&f.push("["+t.name+'] Missing required element. Expected tag class "'+u.tagClass+'", type "'+u.type+'"'));continue}var C=typeof u.tagClass<"u"&&typeof u.type<"u";if(C&&(v.tagClass!==u.tagClass||v.type!==u.type))if(u.optional){x=!0;continue}else{x=!1,f&&f.push("["+t.name+"] Tag mismatch. Expected ("+u.tagClass+","+u.type+"), got ("+v.tagClass+","+v.type+")");break}var y=e.validate(v,u,g,f);if(y)++D,x=!0;else if(u.optional)x=!0;else{x=!1;break}}if(x&&g&&(t.capture&&(g[t.capture]=c.value),t.captureAsn1&&(g[t.captureAsn1]=c),t.captureBitStringContents&&"bitStringContents"in c&&(g[t.captureBitStringContents]=c.bitStringContents),t.captureBitStringValue&&"bitStringContents"in c))if(c.bitStringContents.length<2)g[t.captureBitStringValue]="";else{var s=c.bitStringContents.charCodeAt(0);if(s!==0)throw new Error("captureBitStringValue only supported for zero unused bits");g[t.captureBitStringValue]=c.bitStringContents.slice(1)}}else f&&f.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+c.constructed+'"');else f&&(c.tagClass!==t.tagClass&&f.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+c.tagClass+'"'),c.type!==t.type&&f.push("["+t.name+'] Expected type "'+t.type+'", got "'+c.type+'"'));return x};var S=/[^\\u0000-\\u00ff]/;return e.prettyPrint=function(c,t,g){var f="";t=t||0,g=g||2,t>0&&(f+=`
`);for(var x="",D=0;D<t*g;++D)x+=" ";switch(f+=x+"Tag: ",c.tagClass){case e.Class.UNIVERSAL:f+="Universal:";break;case e.Class.APPLICATION:f+="Application:";break;case e.Class.CONTEXT_SPECIFIC:f+="Context-Specific:";break;case e.Class.PRIVATE:f+="Private:";break}if(c.tagClass===e.Class.UNIVERSAL)switch(f+=c.type,c.type){case e.Type.NONE:f+=" (None)";break;case e.Type.BOOLEAN:f+=" (Boolean)";break;case e.Type.INTEGER:f+=" (Integer)";break;case e.Type.BITSTRING:f+=" (Bit string)";break;case e.Type.OCTETSTRING:f+=" (Octet string)";break;case e.Type.NULL:f+=" (Null)";break;case e.Type.OID:f+=" (Object Identifier)";break;case e.Type.ODESC:f+=" (Object Descriptor)";break;case e.Type.EXTERNAL:f+=" (External or Instance of)";break;case e.Type.REAL:f+=" (Real)";break;case e.Type.ENUMERATED:f+=" (Enumerated)";break;case e.Type.EMBEDDED:f+=" (Embedded PDV)";break;case e.Type.UTF8:f+=" (UTF8)";break;case e.Type.ROID:f+=" (Relative Object Identifier)";break;case e.Type.SEQUENCE:f+=" (Sequence)";break;case e.Type.SET:f+=" (Set)";break;case e.Type.PRINTABLESTRING:f+=" (Printable String)";break;case e.Type.IA5String:f+=" (IA5String (ASCII))";break;case e.Type.UTCTIME:f+=" (UTC time)";break;case e.Type.GENERALIZEDTIME:f+=" (Generalized time)";break;case e.Type.BMPSTRING:f+=" (BMP String)";break}else f+=c.type;if(f+=`
`,f+=x+"Constructed: "+c.constructed+`
`,c.composed){for(var E=0,u="",D=0;D<c.value.length;++D)c.value[D]!==void 0&&(E+=1,u+=e.prettyPrint(c.value[D],t+1,g),D+1<c.value.length&&(u+=","));f+=x+"Sub values: "+E+u}else{if(f+=x+"Value: ",c.type===e.Type.OID){var v=e.derToOid(c.value);f+=v,i.pki&&i.pki.oids&&v in i.pki.oids&&(f+=" ("+i.pki.oids[v]+") ")}if(c.type===e.Type.INTEGER)try{f+=e.derToInteger(c.value)}catch{f+="0x"+i.util.bytesToHex(c.value)}else if(c.type===e.Type.BITSTRING){if(c.value.length>1?f+="0x"+i.util.bytesToHex(c.value.slice(1)):f+="(none)",c.value.length>0){var C=c.value.charCodeAt(0);C==1?f+=" (1 unused bit shown)":C>1&&(f+=" ("+C+" unused bits shown)")}}else if(c.type===e.Type.OCTETSTRING)S.test(c.value)||(f+="("+c.value+") "),f+="0x"+i.util.bytesToHex(c.value);else if(c.type===e.Type.UTF8)try{f+=i.util.decodeUtf8(c.value)}catch(y){if(y.message==="URI malformed")f+="0x"+i.util.bytesToHex(c.value)+" (malformed UTF8)";else throw y}else c.type===e.Type.PRINTABLESTRING||c.type===e.Type.IA5String?f+=c.value:S.test(c.value)?f+="0x"+i.util.bytesToHex(c.value):c.value.length===0?f+="[null]":f+=c.value}return f},Ut.exports}var Vt={exports:{}},Ot,_r;function at(){if(_r)return Ot;_r=1;var i=ue();return Ot=i.md=i.md||{},i.md.algorithms=i.md.algorithms||{},Ot}var Nr;function vt(){if(Nr)return Vt.exports;Nr=1;var i=ue();at(),ce();var e=Vt.exports=i.hmac=i.hmac||{};return e.create=function(){var a=null,p=null,N=null,S=null,c={};return c.start=function(t,g){if(t!==null)if(typeof t=="string")if(t=t.toLowerCase(),t in i.md.algorithms)p=i.md.algorithms[t].create();else throw new Error('Unknown hash algorithm "'+t+'"');else p=t;if(g===null)g=a;else{if(typeof g=="string")g=i.util.createBuffer(g);else if(i.util.isArray(g)){var f=g;g=i.util.createBuffer();for(var x=0;x<f.length;++x)g.putByte(f[x])}var D=g.length();D>p.blockLength&&(p.start(),p.update(g.bytes()),g=p.digest()),N=i.util.createBuffer(),S=i.util.createBuffer(),D=g.length();for(var x=0;x<D;++x){var f=g.at(x);N.putByte(54^f),S.putByte(92^f)}if(D<p.blockLength)for(var f=p.blockLength-D,x=0;x<f;++x)N.putByte(54),S.putByte(92);a=g,N=N.bytes(),S=S.bytes()}p.start(),p.update(N)},c.update=function(t){p.update(t)},c.getMac=function(){var t=p.digest().bytes();return p.start(),p.update(S),p.update(t),p.digest()},c.digest=c.getMac,c},Vt.exports}var Kt={exports:{}},Rr;function Ft(){if(Rr)return Kt.exports;Rr=1;var i=ue();at(),ce();var e=Kt.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=e,e.create=function(){c||t();var f=null,x=i.util.createBuffer(),D=new Array(16),E={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return E.start=function(){E.messageLength=0,E.fullMessageLength=E.messageLength64=[];for(var u=E.messageLengthSize/4,v=0;v<u;++v)E.fullMessageLength.push(0);return x=i.util.createBuffer(),f={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},E},E.start(),E.update=function(u,v){v==="utf8"&&(u=i.util.encodeUtf8(u));var C=u.length;E.messageLength+=C,C=[C/4294967296>>>0,C>>>0];for(var y=E.fullMessageLength.length-1;y>=0;--y)E.fullMessageLength[y]+=C[1],C[1]=C[0]+(E.fullMessageLength[y]/4294967296>>>0),E.fullMessageLength[y]=E.fullMessageLength[y]>>>0,C[0]=C[1]/4294967296>>>0;return x.putBytes(u),g(f,D,x),(x.read>2048||x.length()===0)&&x.compact(),E},E.digest=function(){var u=i.util.createBuffer();u.putBytes(x.bytes());var v=E.fullMessageLength[E.fullMessageLength.length-1]+E.messageLengthSize,C=v&E.blockLength-1;u.putBytes(a.substr(0,E.blockLength-C));for(var y,s=0,h=E.fullMessageLength.length-1;h>=0;--h)y=E.fullMessageLength[h]*8+s,s=y/4294967296>>>0,u.putInt32Le(y>>>0);var d={h0:f.h0,h1:f.h1,h2:f.h2,h3:f.h3};g(d,D,u);var I=i.util.createBuffer();return I.putInt32Le(d.h0),I.putInt32Le(d.h1),I.putInt32Le(d.h2),I.putInt32Le(d.h3),I},E};var a=null,p=null,N=null,S=null,c=!1;function t(){a="€",a+=i.util.fillString("\0",64),p=[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],N=[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],S=new Array(64);for(var f=0;f<64;++f)S[f]=Math.floor(Math.abs(Math.sin(f+1))*4294967296);c=!0}function g(f,x,D){for(var E,u,v,C,y,s,h,d,I=D.length();I>=64;){for(u=f.h0,v=f.h1,C=f.h2,y=f.h3,d=0;d<16;++d)x[d]=D.getInt32Le(),s=y^v&(C^y),E=u+s+S[d]+x[d],h=N[d],u=y,y=C,C=v,v+=E<<h|E>>>32-h;for(;d<32;++d)s=C^y&(v^C),E=u+s+S[d]+x[p[d]],h=N[d],u=y,y=C,C=v,v+=E<<h|E>>>32-h;for(;d<48;++d)s=v^C^y,E=u+s+S[d]+x[p[d]],h=N[d],u=y,y=C,C=v,v+=E<<h|E>>>32-h;for(;d<64;++d)s=C^(v|~y),E=u+s+S[d]+x[p[d]],h=N[d],u=y,y=C,C=v,v+=E<<h|E>>>32-h;f.h0=f.h0+u|0,f.h1=f.h1+v|0,f.h2=f.h2+C|0,f.h3=f.h3+y|0,I-=64}}return Kt.exports}var Mt={exports:{}},wr;function ct(){if(wr)return Mt.exports;wr=1;var i=ue();ce();var e=Mt.exports=i.pem=i.pem||{};e.encode=function(N,S){S=S||{};var c="-----BEGIN "+N.type+`-----\r
`,t;if(N.procType&&(t={name:"Proc-Type",values:[String(N.procType.version),N.procType.type]},c+=a(t)),N.contentDomain&&(t={name:"Content-Domain",values:[N.contentDomain]},c+=a(t)),N.dekInfo&&(t={name:"DEK-Info",values:[N.dekInfo.algorithm]},N.dekInfo.parameters&&t.values.push(N.dekInfo.parameters),c+=a(t)),N.headers)for(var g=0;g<N.headers.length;++g)c+=a(N.headers[g]);return N.procType&&(c+=`\r
`),c+=i.util.encode64(N.body,S.maxline||64)+`\r
`,c+="-----END "+N.type+`-----\r
`,c},e.decode=function(N){for(var S=[],c=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,t=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,g=/\r?\n/,f;f=c.exec(N),!!f;){var x=f[1];x==="NEW CERTIFICATE REQUEST"&&(x="CERTIFICATE REQUEST");var D={type:x,procType:null,contentDomain:null,dekInfo:null,headers:[],body:i.util.decode64(f[3])};if(S.push(D),!!f[2]){for(var E=f[2].split(g),u=0;f&&u<E.length;){for(var v=E[u].replace(/\s+$/,""),C=u+1;C<E.length;++C){var y=E[C];if(!/\s/.test(y[0]))break;v+=y,u=C}if(f=v.match(t),f){for(var s={name:f[1],values:[]},h=f[2].split(","),d=0;d<h.length;++d)s.values.push(p(h[d]));if(D.procType)if(!D.contentDomain&&s.name==="Content-Domain")D.contentDomain=h[0]||"";else if(!D.dekInfo&&s.name==="DEK-Info"){if(s.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');D.dekInfo={algorithm:h[0],parameters:h[1]||null}}else D.headers.push(s);else{if(s.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(s.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');D.procType={version:h[0],type:h[1]}}}++u}if(D.procType==="ENCRYPTED"&&!D.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(S.length===0)throw new Error("Invalid PEM formatted message.");return S};function a(N){for(var S=N.name+": ",c=[],t=function(E,u){return" "+u},g=0;g<N.values.length;++g)c.push(N.values[g].replace(/^(\S+\r\n)/,t));S+=c.join(",")+`\r
`;for(var f=0,x=-1,g=0;g<S.length;++g,++f)if(f>65&&x!==-1){var D=S[x];D===","?(++x,S=S.substr(0,x)+`\r
 `+S.substr(x)):S=S.substr(0,x)+`\r
`+D+S.substr(x+1),f=g-x-1,x=-1,++g}else(S[g]===" "||S[g]==="	"||S[g]===",")&&(x=g);return S}function p(N){return N.replace(/^\s+/,"")}return Mt.exports}var qt={exports:{}},Ht,Lr;function Ct(){if(Lr)return Ht;Lr=1;var i=ue();wt(),Ir(),ce(),Ht=i.des=i.des||{},i.des.startEncrypting=function(u,v,C,y){var s=E({key:u,output:C,decrypt:!1,mode:y||(v===null?"ECB":"CBC")});return s.start(v),s},i.des.createEncryptionCipher=function(u,v){return E({key:u,output:null,decrypt:!1,mode:v})},i.des.startDecrypting=function(u,v,C,y){var s=E({key:u,output:C,decrypt:!0,mode:y||(v===null?"ECB":"CBC")});return s.start(v),s},i.des.createDecryptionCipher=function(u,v){return E({key:u,output:null,decrypt:!0,mode:v})},i.des.Algorithm=function(u,v){var C=this;C.name=u,C.mode=new v({blockSize:8,cipher:{encrypt:function(y,s){return D(C._keys,y,s,!1)},decrypt:function(y,s){return D(C._keys,y,s,!0)}}}),C._init=!1},i.des.Algorithm.prototype.initialize=function(u){if(!this._init){var v=i.util.createBuffer(u.key);if(this.name.indexOf("3DES")===0&&v.length()!==24)throw new Error("Invalid Triple-DES key size: "+v.length()*8);this._keys=x(v),this._init=!0}},e("DES-ECB",i.cipher.modes.ecb),e("DES-CBC",i.cipher.modes.cbc),e("DES-CFB",i.cipher.modes.cfb),e("DES-OFB",i.cipher.modes.ofb),e("DES-CTR",i.cipher.modes.ctr),e("3DES-ECB",i.cipher.modes.ecb),e("3DES-CBC",i.cipher.modes.cbc),e("3DES-CFB",i.cipher.modes.cfb),e("3DES-OFB",i.cipher.modes.ofb),e("3DES-CTR",i.cipher.modes.ctr);function e(u,v){var C=function(){return new i.des.Algorithm(u,v)};i.cipher.registerAlgorithm(u,C)}var a=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],p=[-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],N=[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],S=[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],c=[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],t=[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],g=[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],f=[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 x(u){for(var v=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],C=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],y=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],s=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],h=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],d=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],I=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],w=[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],n=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],r=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],A=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],k=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],O=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],P=u.length()>8?3:1,K=[],q=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],M=0,G,Y=0;Y<P;Y++){var W=u.getInt32(),ee=u.getInt32();G=(W>>>4^ee)&252645135,ee^=G,W^=G<<4,G=(ee>>>-16^W)&65535,W^=G,ee^=G<<-16,G=(W>>>2^ee)&858993459,ee^=G,W^=G<<2,G=(ee>>>-16^W)&65535,W^=G,ee^=G<<-16,G=(W>>>1^ee)&1431655765,ee^=G,W^=G<<1,G=(ee>>>8^W)&16711935,W^=G,ee^=G<<8,G=(W>>>1^ee)&1431655765,ee^=G,W^=G<<1,G=W<<8|ee>>>20&240,W=ee<<24|ee<<8&16711680|ee>>>8&65280|ee>>>24&240,ee=G;for(var ie=0;ie<q.length;++ie){q[ie]?(W=W<<2|W>>>26,ee=ee<<2|ee>>>26):(W=W<<1|W>>>27,ee=ee<<1|ee>>>27),W&=-15,ee&=-15;var ne=v[W>>>28]|C[W>>>24&15]|y[W>>>20&15]|s[W>>>16&15]|h[W>>>12&15]|d[W>>>8&15]|I[W>>>4&15],he=w[ee>>>28]|l[ee>>>24&15]|n[ee>>>20&15]|r[ee>>>16&15]|A[ee>>>12&15]|k[ee>>>8&15]|O[ee>>>4&15];G=(he>>>16^ne)&65535,K[M++]=ne^G,K[M++]=he^G<<16}}return K}function D(u,v,C,y){var s=u.length===32?3:9,h;s===3?h=y?[30,-2,-2]:[0,32,2]:h=y?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var d,I=v[0],w=v[1];d=(I>>>4^w)&252645135,w^=d,I^=d<<4,d=(I>>>16^w)&65535,w^=d,I^=d<<16,d=(w>>>2^I)&858993459,I^=d,w^=d<<2,d=(w>>>8^I)&16711935,I^=d,w^=d<<8,d=(I>>>1^w)&1431655765,w^=d,I^=d<<1,I=I<<1|I>>>31,w=w<<1|w>>>31;for(var l=0;l<s;l+=3){for(var n=h[l+1],r=h[l+2],A=h[l];A!=n;A+=r){var k=w^u[A],O=(w>>>4|w<<28)^u[A+1];d=I,I=w,w=d^(p[k>>>24&63]|S[k>>>16&63]|t[k>>>8&63]|f[k&63]|a[O>>>24&63]|N[O>>>16&63]|c[O>>>8&63]|g[O&63])}d=I,I=w,w=d}I=I>>>1|I<<31,w=w>>>1|w<<31,d=(I>>>1^w)&1431655765,w^=d,I^=d<<1,d=(w>>>8^I)&16711935,I^=d,w^=d<<8,d=(w>>>2^I)&858993459,I^=d,w^=d<<2,d=(I>>>16^w)&65535,w^=d,I^=d<<16,d=(I>>>4^w)&252645135,w^=d,I^=d<<4,C[0]=I,C[1]=w}function E(u){u=u||{};var v=(u.mode||"CBC").toUpperCase(),C="DES-"+v,y;u.decrypt?y=i.cipher.createDecipher(C,u.key):y=i.cipher.createCipher(C,u.key);var s=y.start;return y.start=function(h,d){var I=null;d instanceof i.util.ByteBuffer&&(I=d,d={}),d=d||{},d.output=I,d.iv=h,s.call(y,d)},y}return Ht}var Aa={},Ba=Object.freeze({__proto__:null,default:Aa}),Gt=Ta(Ba),Qt,kr;function zt(){if(kr)return Qt;kr=1;var i=ue();vt(),at(),ce();var e=i.pkcs5=i.pkcs5||{},a;return i.util.isNodejs&&!i.options.usePureJavaScript&&(a=Gt),Qt=i.pbkdf2=e.pbkdf2=function(p,N,S,c,t,g){if(typeof t=="function"&&(g=t,t=null),i.util.isNodejs&&!i.options.usePureJavaScript&&a.pbkdf2&&(t===null||typeof t!="object")&&(a.pbkdf2Sync.length>4||!t||t==="sha1"))return typeof t!="string"&&(t="sha1"),p=Buffer.from(p,"binary"),N=Buffer.from(N,"binary"),g?a.pbkdf2Sync.length===4?a.pbkdf2(p,N,S,c,function(l,n){if(l)return g(l);g(null,n.toString("binary"))}):a.pbkdf2(p,N,S,c,t,function(l,n){if(l)return g(l);g(null,n.toString("binary"))}):a.pbkdf2Sync.length===4?a.pbkdf2Sync(p,N,S,c).toString("binary"):a.pbkdf2Sync(p,N,S,c,t).toString("binary");if((typeof t>"u"||t===null)&&(t="sha1"),typeof t=="string"){if(!(t in i.md.algorithms))throw new Error("Unknown hash algorithm: "+t);t=i.md[t].create()}var f=t.digestLength;if(c>4294967295*f){var x=new Error("Derived key is too long.");if(g)return g(x);throw x}var D=Math.ceil(c/f),E=c-(D-1)*f,u=i.hmac.create();u.start(t,p);var v="",C,y,s;if(!g){for(var h=1;h<=D;++h){u.start(null,null),u.update(N),u.update(i.util.int32ToBytes(h)),C=s=u.digest().getBytes();for(var d=2;d<=S;++d)u.start(null,null),u.update(s),y=u.digest().getBytes(),C=i.util.xorBytes(C,y,f),s=y;v+=h<D?C:C.substr(0,E)}return v}var h=1,d;function I(){if(h>D)return g(null,v);u.start(null,null),u.update(N),u.update(i.util.int32ToBytes(h)),C=s=u.digest().getBytes(),d=2,w()}function w(){if(d<=S)return u.start(null,null),u.update(s),y=u.digest().getBytes(),C=i.util.xorBytes(C,y,f),s=y,++d,i.util.setImmediate(w);v+=h<D?C:C.substr(0,E),++h,I()}I()},Qt}var mt={exports:{}},Yt={exports:{}},Dr;function Ur(){if(Dr)return Yt.exports;Dr=1;var i=ue();at(),ce();var e=Yt.exports=i.sha256=i.sha256||{};i.md.sha256=i.md.algorithms.sha256=e,e.create=function(){p||S();var t=null,g=i.util.createBuffer(),f=new Array(64),x={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return x.start=function(){x.messageLength=0,x.fullMessageLength=x.messageLength64=[];for(var D=x.messageLengthSize/4,E=0;E<D;++E)x.fullMessageLength.push(0);return g=i.util.createBuffer(),t={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},x},x.start(),x.update=function(D,E){E==="utf8"&&(D=i.util.encodeUtf8(D));var u=D.length;x.messageLength+=u,u=[u/4294967296>>>0,u>>>0];for(var v=x.fullMessageLength.length-1;v>=0;--v)x.fullMessageLength[v]+=u[1],u[1]=u[0]+(x.fullMessageLength[v]/4294967296>>>0),x.fullMessageLength[v]=x.fullMessageLength[v]>>>0,u[0]=u[1]/4294967296>>>0;return g.putBytes(D),c(t,f,g),(g.read>2048||g.length()===0)&&g.compact(),x},x.digest=function(){var D=i.util.createBuffer();D.putBytes(g.bytes());var E=x.fullMessageLength[x.fullMessageLength.length-1]+x.messageLengthSize,u=E&x.blockLength-1;D.putBytes(a.substr(0,x.blockLength-u));for(var v,C,y=x.fullMessageLength[0]*8,s=0;s<x.fullMessageLength.length-1;++s)v=x.fullMessageLength[s+1]*8,C=v/4294967296>>>0,y+=C,D.putInt32(y>>>0),y=v>>>0;D.putInt32(y);var h={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4,h5:t.h5,h6:t.h6,h7:t.h7};c(h,f,D);var d=i.util.createBuffer();return d.putInt32(h.h0),d.putInt32(h.h1),d.putInt32(h.h2),d.putInt32(h.h3),d.putInt32(h.h4),d.putInt32(h.h5),d.putInt32(h.h6),d.putInt32(h.h7),d},x};var a=null,p=!1,N=null;function S(){a="€",a+=i.util.fillString("\0",64),N=[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],p=!0}function c(t,g,f){for(var x,D,E,u,v,C,y,s,h,d,I,w,l,n,r,A=f.length();A>=64;){for(y=0;y<16;++y)g[y]=f.getInt32();for(;y<64;++y)x=g[y-2],x=(x>>>17|x<<15)^(x>>>19|x<<13)^x>>>10,D=g[y-15],D=(D>>>7|D<<25)^(D>>>18|D<<14)^D>>>3,g[y]=x+g[y-7]+D+g[y-16]|0;for(s=t.h0,h=t.h1,d=t.h2,I=t.h3,w=t.h4,l=t.h5,n=t.h6,r=t.h7,y=0;y<64;++y)u=(w>>>6|w<<26)^(w>>>11|w<<21)^(w>>>25|w<<7),v=n^w&(l^n),E=(s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10),C=s&h|d&(s^h),x=r+u+v+N[y]+g[y],D=E+C,r=n,n=l,l=w,w=I+x>>>0,I=d,d=h,h=s,s=x+D>>>0;t.h0=t.h0+s|0,t.h1=t.h1+h|0,t.h2=t.h2+d|0,t.h3=t.h3+I|0,t.h4=t.h4+w|0,t.h5=t.h5+l|0,t.h6=t.h6+n|0,t.h7=t.h7+r|0,A-=64}}return Yt.exports}var Xt={exports:{}},Pr;function Vr(){if(Pr)return Xt.exports;Pr=1;var i=ue();ce();var e=null;i.util.isNodejs&&!i.options.usePureJavaScript&&!process.versions["node-webkit"]&&(e=Gt);var a=Xt.exports=i.prng=i.prng||{};return a.create=function(p){for(var N={plugin:p,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},S=p.md,c=new Array(32),t=0;t<32;++t)c[t]=S.create();N.pools=c,N.pool=0,N.generate=function(E,u){if(!u)return N.generateSync(E);var v=N.plugin.cipher,C=N.plugin.increment,y=N.plugin.formatKey,s=N.plugin.formatSeed,h=i.util.createBuffer();N.key=null,d();function d(I){if(I)return u(I);if(h.length()>=E)return u(null,h.getBytes(E));if(N.generated>1048575&&(N.key=null),N.key===null)return i.util.nextTick(function(){g(d)});var w=v(N.key,N.seed);N.generated+=w.length,h.putBytes(w),N.key=y(v(N.key,C(N.seed))),N.seed=s(v(N.key,N.seed)),i.util.setImmediate(d)}},N.generateSync=function(E){var u=N.plugin.cipher,v=N.plugin.increment,C=N.plugin.formatKey,y=N.plugin.formatSeed;N.key=null;for(var s=i.util.createBuffer();s.length()<E;){N.generated>1048575&&(N.key=null),N.key===null&&f();var h=u(N.key,N.seed);N.generated+=h.length,s.putBytes(h),N.key=C(u(N.key,v(N.seed))),N.seed=y(u(N.key,N.seed))}return s.getBytes(E)};function g(E){if(N.pools[0].messageLength>=32)return x(),E();var u=32-N.pools[0].messageLength<<5;N.seedFile(u,function(v,C){if(v)return E(v);N.collect(C),x(),E()})}function f(){if(N.pools[0].messageLength>=32)return x();var E=32-N.pools[0].messageLength<<5;N.collect(N.seedFileSync(E)),x()}function x(){N.reseeds=N.reseeds===4294967295?0:N.reseeds+1;var E=N.plugin.md.create();E.update(N.keyBytes);for(var u=1,v=0;v<32;++v)N.reseeds%u===0&&(E.update(N.pools[v].digest().getBytes()),N.pools[v].start()),u=u<<1;N.keyBytes=E.digest().getBytes(),E.start(),E.update(N.keyBytes);var C=E.digest().getBytes();N.key=N.plugin.formatKey(N.keyBytes),N.seed=N.plugin.formatSeed(C),N.generated=0}function D(E){var u=null,v=i.util.globalScope,C=v.crypto||v.msCrypto;C&&C.getRandomValues&&(u=function(r){return C.getRandomValues(r)});var y=i.util.createBuffer();if(u)for(;y.length()<E;){var s=Math.max(1,Math.min(E-y.length(),65536)/4),h=new Uint32Array(Math.floor(s));try{u(h);for(var d=0;d<h.length;++d)y.putInt32(h[d])}catch(r){if(!(typeof QuotaExceededError<"u"&&r instanceof QuotaExceededError))throw r}}if(y.length()<E)for(var I,w,l,n=Math.floor(Math.random()*65536);y.length()<E;){w=16807*(n&65535),I=16807*(n>>16),w+=(I&32767)<<16,w+=I>>15,w=(w&2147483647)+(w>>31),n=w&4294967295;for(var d=0;d<3;++d)l=n>>>(d<<3),l^=Math.floor(Math.random()*256),y.putByte(l&255)}return y.getBytes(E)}return e?(N.seedFile=function(E,u){e.randomBytes(E,function(v,C){if(v)return u(v);u(null,C.toString())})},N.seedFileSync=function(E){return e.randomBytes(E).toString()}):(N.seedFile=function(E,u){try{u(null,D(E))}catch(v){u(v)}},N.seedFileSync=D),N.collect=function(E){for(var u=E.length,v=0;v<u;++v)N.pools[N.pool].update(E.substr(v,1)),N.pool=N.pool===31?0:N.pool+1},N.collectInt=function(E,u){for(var v="",C=0;C<u;C+=8)v+=String.fromCharCode(E>>C&255);N.collect(v)},N.registerWorker=function(E){if(E===self)N.seedFile=function(v,C){function y(s){var h=s.data;h.forge&&h.forge.prng&&(self.removeEventListener("message",y),C(h.forge.prng.err,h.forge.prng.bytes))}self.addEventListener("message",y),self.postMessage({forge:{prng:{needed:v}}})};else{var u=function(v){var C=v.data;C.forge&&C.forge.prng&&N.seedFile(C.forge.prng.needed,function(y,s){E.postMessage({forge:{prng:{err:y,bytes:s}}})})};E.addEventListener("message",u)}},N},Xt.exports}var Or;function je(){if(Or)return mt.exports;Or=1;var i=ue();return ut(),Ur(),Vr(),ce(),(function(){if(i.random&&i.random.getBytes){mt.exports=i.random;return}(function(e){var a={},p=new Array(4),N=i.util.createBuffer();a.formatKey=function(E){var u=i.util.createBuffer(E);return E=new Array(4),E[0]=u.getInt32(),E[1]=u.getInt32(),E[2]=u.getInt32(),E[3]=u.getInt32(),i.aes._expandKey(E,!1)},a.formatSeed=function(E){var u=i.util.createBuffer(E);return E=new Array(4),E[0]=u.getInt32(),E[1]=u.getInt32(),E[2]=u.getInt32(),E[3]=u.getInt32(),E},a.cipher=function(E,u){return i.aes._updateBlock(E,u,p,!1),N.putInt32(p[0]),N.putInt32(p[1]),N.putInt32(p[2]),N.putInt32(p[3]),N.getBytes()},a.increment=function(E){return++E[3],E},a.md=i.md.sha256;function S(){var E=i.prng.create(a);return E.getBytes=function(u,v){return E.generate(u,v)},E.getBytesSync=function(u){return E.generate(u)},E}var c=S(),t=null,g=i.util.globalScope,f=g.crypto||g.msCrypto;if(f&&f.getRandomValues&&(t=function(E){return f.getRandomValues(E)}),i.options.usePureJavaScript||!i.util.isNodejs&&!t){if(c.collectInt(+new Date,32),typeof navigator<"u"){var x="";for(var D in navigator)try{typeof navigator[D]=="string"&&(x+=navigator[D])}catch{}c.collect(x),x=null}e&&(e().mousemove(function(E){c.collectInt(E.clientX,16),c.collectInt(E.clientY,16)}),e().keypress(function(E){c.collectInt(E.charCode,8)}))}if(!i.random)i.random=c;else for(var D in c)i.random[D]=c[D];i.random.createInstance=S,mt.exports=i.random})(typeof jQuery<"u"?jQuery:null)})(),mt.exports}var Wt,Kr;function Fr(){if(Kr)return Wt;Kr=1;var i=ue();ce();var e=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],a=[1,2,3,5],p=function(c,t){return c<<t&65535|(c&65535)>>16-t},N=function(c,t){return(c&65535)>>t|c<<16-t&65535};Wt=i.rc2=i.rc2||{},i.rc2.expandKey=function(c,t){typeof c=="string"&&(c=i.util.createBuffer(c)),t=t||128;var g=c,f=c.length(),x=t,D=Math.ceil(x/8),E=255>>(x&7),u;for(u=f;u<128;u++)g.putByte(e[g.at(u-1)+g.at(u-f)&255]);for(g.setAt(128-D,e[g.at(128-D)&E]),u=127-D;u>=0;u--)g.setAt(u,e[g.at(u+1)^g.at(u+D)]);return g};var S=function(c,t,g){var f=!1,x=null,D=null,E=null,u,v,C,y,s=[];for(c=i.rc2.expandKey(c,t),C=0;C<64;C++)s.push(c.getInt16Le());g?(u=function(I){for(C=0;C<4;C++)I[C]+=s[y]+(I[(C+3)%4]&I[(C+2)%4])+(~I[(C+3)%4]&I[(C+1)%4]),I[C]=p(I[C],a[C]),y++},v=function(I){for(C=0;C<4;C++)I[C]+=s[I[(C+3)%4]&63]}):(u=function(I){for(C=3;C>=0;C--)I[C]=N(I[C],a[C]),I[C]-=s[y]+(I[(C+3)%4]&I[(C+2)%4])+(~I[(C+3)%4]&I[(C+1)%4]),y--},v=function(I){for(C=3;C>=0;C--)I[C]-=s[I[(C+3)%4]&63]});var h=function(I){var w=[];for(C=0;C<4;C++){var l=x.getInt16Le();E!==null&&(g?l^=E.getInt16Le():E.putInt16Le(l)),w.push(l&65535)}y=g?0:63;for(var n=0;n<I.length;n++)for(var r=0;r<I[n][0];r++)I[n][1](w);for(C=0;C<4;C++)E!==null&&(g?E.putInt16Le(w[C]):w[C]^=E.getInt16Le()),D.putInt16Le(w[C])},d=null;return d={start:function(I,w){I&&typeof I=="string"&&(I=i.util.createBuffer(I)),f=!1,x=i.util.createBuffer(),D=w||new i.util.createBuffer,E=I,d.output=D},update:function(I){for(f||x.putBuffer(I);x.length()>=8;)h([[5,u],[1,v],[6,u],[1,v],[5,u]])},finish:function(I){var w=!0;if(g)if(I)w=I(8,x,!g);else{var l=x.length()===8?8:8-x.length();x.fillWithByte(l,l)}if(w&&(f=!0,d.update()),!g&&(w=x.length()===0,w))if(I)w=I(8,D,!g);else{var n=D.length(),r=D.at(n-1);r>n?w=!1:D.truncate(r)}return w}},d};return i.rc2.startEncrypting=function(c,t,g){var f=i.rc2.createEncryptionCipher(c,128);return f.start(t,g),f},i.rc2.createEncryptionCipher=function(c,t){return S(c,t,!0)},i.rc2.startDecrypting=function(c,t,g){var f=i.rc2.createDecryptionCipher(c,128);return f.start(t,g),f},i.rc2.createDecryptionCipher=function(c,t){return S(c,t,!1)},Wt}var jt,Mr;function Et(){if(Mr)return jt;Mr=1;var i=ue();jt=i.jsbn=i.jsbn||{};var e;function a(T,B,U){this.data=[],T!=null&&(typeof T=="number"?this.fromNumber(T,B,U):B==null&&typeof T!="string"?this.fromString(T,256):this.fromString(T,B))}i.jsbn.BigInteger=a;function p(){return new a(null)}function N(T,B,U,F,z,X){for(;--X>=0;){var re=B*this.data[T++]+U.data[F]+z;z=Math.floor(re/67108864),U.data[F++]=re&67108863}return z}function S(T,B,U,F,z,X){for(var re=B&32767,J=B>>15;--X>=0;){var de=this.data[T]&32767,Fe=this.data[T++]>>15,We=J*de+Fe*re;de=re*de+((We&32767)<<15)+U.data[F]+(z&1073741823),z=(de>>>30)+(We>>>15)+J*Fe+(z>>>30),U.data[F++]=de&1073741823}return z}function c(T,B,U,F,z,X){for(var re=B&16383,J=B>>14;--X>=0;){var de=this.data[T]&16383,Fe=this.data[T++]>>14,We=J*de+Fe*re;de=re*de+((We&16383)<<14)+U.data[F]+z,z=(de>>28)+(We>>14)+J*Fe,U.data[F++]=de&268435455}return z}typeof navigator>"u"?(a.prototype.am=c,e=28):navigator.appName=="Microsoft Internet Explorer"?(a.prototype.am=S,e=30):navigator.appName!="Netscape"?(a.prototype.am=N,e=26):(a.prototype.am=c,e=28),a.prototype.DB=e,a.prototype.DM=(1<<e)-1,a.prototype.DV=1<<e;var t=52;a.prototype.FV=Math.pow(2,t),a.prototype.F1=t-e,a.prototype.F2=2*e-t;var g="0123456789abcdefghijklmnopqrstuvwxyz",f=new Array,x,D;for(x=48,D=0;D<=9;++D)f[x++]=D;for(x=97,D=10;D<36;++D)f[x++]=D;for(x=65,D=10;D<36;++D)f[x++]=D;function E(T){return g.charAt(T)}function u(T,B){var U=f[T.charCodeAt(B)];return U??-1}function v(T){for(var B=this.t-1;B>=0;--B)T.data[B]=this.data[B];T.t=this.t,T.s=this.s}function C(T){this.t=1,this.s=T<0?-1:0,T>0?this.data[0]=T:T<-1?this.data[0]=T+this.DV:this.t=0}function y(T){var B=p();return B.fromInt(T),B}function s(T,B){var U;if(B==16)U=4;else if(B==8)U=3;else if(B==256)U=8;else if(B==2)U=1;else if(B==32)U=5;else if(B==4)U=2;else{this.fromRadix(T,B);return}this.t=0,this.s=0;for(var F=T.length,z=!1,X=0;--F>=0;){var re=U==8?T[F]&255:u(T,F);if(re<0){T.charAt(F)=="-"&&(z=!0);continue}z=!1,X==0?this.data[this.t++]=re:X+U>this.DB?(this.data[this.t-1]|=(re&(1<<this.DB-X)-1)<<X,this.data[this.t++]=re>>this.DB-X):this.data[this.t-1]|=re<<X,X+=U,X>=this.DB&&(X-=this.DB)}U==8&&(T[0]&128)!=0&&(this.s=-1,X>0&&(this.data[this.t-1]|=(1<<this.DB-X)-1<<X)),this.clamp(),z&&a.ZERO.subTo(this,this)}function h(){for(var T=this.s&this.DM;this.t>0&&this.data[this.t-1]==T;)--this.t}function d(T){if(this.s<0)return"-"+this.negate().toString(T);var B;if(T==16)B=4;else if(T==8)B=3;else if(T==2)B=1;else if(T==32)B=5;else if(T==4)B=2;else return this.toRadix(T);var U=(1<<B)-1,F,z=!1,X="",re=this.t,J=this.DB-re*this.DB%B;if(re-- >0)for(J<this.DB&&(F=this.data[re]>>J)>0&&(z=!0,X=E(F));re>=0;)J<B?(F=(this.data[re]&(1<<J)-1)<<B-J,F|=this.data[--re]>>(J+=this.DB-B)):(F=this.data[re]>>(J-=B)&U,J<=0&&(J+=this.DB,--re)),F>0&&(z=!0),z&&(X+=E(F));return z?X:"0"}function I(){var T=p();return a.ZERO.subTo(this,T),T}function w(){return this.s<0?this.negate():this}function l(T){var B=this.s-T.s;if(B!=0)return B;var U=this.t;if(B=U-T.t,B!=0)return this.s<0?-B:B;for(;--U>=0;)if((B=this.data[U]-T.data[U])!=0)return B;return 0}function n(T){var B=1,U;return(U=T>>>16)!=0&&(T=U,B+=16),(U=T>>8)!=0&&(T=U,B+=8),(U=T>>4)!=0&&(T=U,B+=4),(U=T>>2)!=0&&(T=U,B+=2),(U=T>>1)!=0&&(T=U,B+=1),B}function r(){return this.t<=0?0:this.DB*(this.t-1)+n(this.data[this.t-1]^this.s&this.DM)}function A(T,B){var U;for(U=this.t-1;U>=0;--U)B.data[U+T]=this.data[U];for(U=T-1;U>=0;--U)B.data[U]=0;B.t=this.t+T,B.s=this.s}function k(T,B){for(var U=T;U<this.t;++U)B.data[U-T]=this.data[U];B.t=Math.max(this.t-T,0),B.s=this.s}function O(T,B){var U=T%this.DB,F=this.DB-U,z=(1<<F)-1,X=Math.floor(T/this.DB),re=this.s<<U&this.DM,J;for(J=this.t-1;J>=0;--J)B.data[J+X+1]=this.data[J]>>F|re,re=(this.data[J]&z)<<U;for(J=X-1;J>=0;--J)B.data[J]=0;B.data[X]=re,B.t=this.t+X+1,B.s=this.s,B.clamp()}function P(T,B){B.s=this.s;var U=Math.floor(T/this.DB);if(U>=this.t){B.t=0;return}var F=T%this.DB,z=this.DB-F,X=(1<<F)-1;B.data[0]=this.data[U]>>F;for(var re=U+1;re<this.t;++re)B.data[re-U-1]|=(this.data[re]&X)<<z,B.data[re-U]=this.data[re]>>F;F>0&&(B.data[this.t-U-1]|=(this.s&X)<<z),B.t=this.t-U,B.clamp()}function K(T,B){for(var U=0,F=0,z=Math.min(T.t,this.t);U<z;)F+=this.data[U]-T.data[U],B.data[U++]=F&this.DM,F>>=this.DB;if(T.t<this.t){for(F-=T.s;U<this.t;)F+=this.data[U],B.data[U++]=F&this.DM,F>>=this.DB;F+=this.s}else{for(F+=this.s;U<T.t;)F-=T.data[U],B.data[U++]=F&this.DM,F>>=this.DB;F-=T.s}B.s=F<0?-1:0,F<-1?B.data[U++]=this.DV+F:F>0&&(B.data[U++]=F),B.t=U,B.clamp()}function q(T,B){var U=this.abs(),F=T.abs(),z=U.t;for(B.t=z+F.t;--z>=0;)B.data[z]=0;for(z=0;z<F.t;++z)B.data[z+U.t]=U.am(0,F.data[z],B,z,0,U.t);B.s=0,B.clamp(),this.s!=T.s&&a.ZERO.subTo(B,B)}function M(T){for(var B=this.abs(),U=T.t=2*B.t;--U>=0;)T.data[U]=0;for(U=0;U<B.t-1;++U){var F=B.am(U,B.data[U],T,2*U,0,1);(T.data[U+B.t]+=B.am(U+1,2*B.data[U],T,2*U+1,F,B.t-U-1))>=B.DV&&(T.data[U+B.t]-=B.DV,T.data[U+B.t+1]=1)}T.t>0&&(T.data[T.t-1]+=B.am(U,B.data[U],T,2*U,0,1)),T.s=0,T.clamp()}function G(T,B,U){var F=T.abs();if(!(F.t<=0)){var z=this.abs();if(z.t<F.t){B?.fromInt(0),U!=null&&this.copyTo(U);return}U==null&&(U=p());var X=p(),re=this.s,J=T.s,de=this.DB-n(F.data[F.t-1]);de>0?(F.lShiftTo(de,X),z.lShiftTo(de,U)):(F.copyTo(X),z.copyTo(U));var Fe=X.t,We=X.data[Fe-1];if(We!=0){var Ye=We*(1<<this.F1)+(Fe>1?X.data[Fe-2]>>this.F2:0),nt=this.FV/Ye,At=(1<<this.F1)/Ye,Je=1<<this.F2,et=U.t,Bt=et-Fe,ot=B??p();for(X.dlShiftTo(Bt,ot),U.compareTo(ot)>=0&&(U.data[U.t++]=1,U.subTo(ot,U)),a.ONE.dlShiftTo(Fe,ot),ot.subTo(X,X);X.t<Fe;)X.data[X.t++]=0;for(;--Bt>=0;){var Cr=U.data[--et]==We?this.DM:Math.floor(U.data[et]*nt+(U.data[et-1]+Je)*At);if((U.data[et]+=X.am(0,Cr,U,Bt,0,Fe))<Cr)for(X.dlShiftTo(Bt,ot),U.subTo(ot,U);U.data[et]<--Cr;)U.subTo(ot,U)}B!=null&&(U.drShiftTo(Fe,B),re!=J&&a.ZERO.subTo(B,B)),U.t=Fe,U.clamp(),de>0&&U.rShiftTo(de,U),re<0&&a.ZERO.subTo(U,U)}}}function Y(T){var B=p();return this.abs().divRemTo(T,null,B),this.s<0&&B.compareTo(a.ZERO)>0&&T.subTo(B,B),B}function W(T){this.m=T}function ee(T){return T.s<0||T.compareTo(this.m)>=0?T.mod(this.m):T}function ie(T){return T}function ne(T){T.divRemTo(this.m,null,T)}function he(T,B,U){T.multiplyTo(B,U),this.reduce(U)}function ve(T,B){T.squareTo(B),this.reduce(B)}W.prototype.convert=ee,W.prototype.revert=ie,W.prototype.reduce=ne,W.prototype.mulTo=he,W.prototype.sqrTo=ve;function fe(){if(this.t<1)return 0;var T=this.data[0];if((T&1)==0)return 0;var B=T&3;return B=B*(2-(T&15)*B)&15,B=B*(2-(T&255)*B)&255,B=B*(2-((T&65535)*B&65535))&65535,B=B*(2-T*B%this.DV)%this.DV,B>0?this.DV-B:-B}function j(T){this.m=T,this.mp=T.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<T.DB-15)-1,this.mt2=2*T.t}function Z(T){var B=p();return T.abs().dlShiftTo(this.m.t,B),B.divRemTo(this.m,null,B),T.s<0&&B.compareTo(a.ZERO)>0&&this.m.subTo(B,B),B}function Ge(T){var B=p();return T.copyTo(B),this.reduce(B),B}function Me(T){for(;T.t<=this.mt2;)T.data[T.t++]=0;for(var B=0;B<this.m.t;++B){var U=T.data[B]&32767,F=U*this.mpl+((U*this.mph+(T.data[B]>>15)*this.mpl&this.um)<<15)&T.DM;for(U=B+this.m.t,T.data[U]+=this.m.am(0,F,T,B,0,this.m.t);T.data[U]>=T.DV;)T.data[U]-=T.DV,T.data[++U]++}T.clamp(),T.drShiftTo(this.m.t,T),T.compareTo(this.m)>=0&&T.subTo(this.m,T)}function m(T,B){T.squareTo(B),this.reduce(B)}function L(T,B,U){T.multiplyTo(B,U),this.reduce(U)}j.prototype.convert=Z,j.prototype.revert=Ge,j.prototype.reduce=Me,j.prototype.mulTo=L,j.prototype.sqrTo=m;function R(){return(this.t>0?this.data[0]&1:this.s)==0}function _(T,B){if(T>4294967295||T<1)return a.ONE;var U=p(),F=p(),z=B.convert(this),X=n(T)-1;for(z.copyTo(U);--X>=0;)if(B.sqrTo(U,F),(T&1<<X)>0)B.mulTo(F,z,U);else{var re=U;U=F,F=re}return B.revert(U)}function o(T,B){var U;return T<256||B.isEven()?U=new W(B):U=new j(B),this.exp(T,U)}a.prototype.copyTo=v,a.prototype.fromInt=C,a.prototype.fromString=s,a.prototype.clamp=h,a.prototype.dlShiftTo=A,a.prototype.drShiftTo=k,a.prototype.lShiftTo=O,a.prototype.rShiftTo=P,a.prototype.subTo=K,a.prototype.multiplyTo=q,a.prototype.squareTo=M,a.prototype.divRemTo=G,a.prototype.invDigit=fe,a.prototype.isEven=R,a.prototype.exp=_,a.prototype.toString=d,a.prototype.negate=I,a.prototype.abs=w,a.prototype.compareTo=l,a.prototype.bitLength=r,a.prototype.mod=Y,a.prototype.modPowInt=o,a.ZERO=y(0),a.ONE=y(1);function b(){var T=p();return this.copyTo(T),T}function V(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this.data[0];if(this.t==0)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function H(){return this.t==0?this.s:this.data[0]<<24>>24}function ae(){return this.t==0?this.s:this.data[0]<<16>>16}function te(T){return Math.floor(Math.LN2*this.DB/Math.log(T))}function Q(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function $(T){if(T==null&&(T=10),this.signum()==0||T<2||T>36)return"0";var B=this.chunkSize(T),U=Math.pow(T,B),F=y(U),z=p(),X=p(),re="";for(this.divRemTo(F,z,X);z.signum()>0;)re=(U+X.intValue()).toString(T).substr(1)+re,z.divRemTo(F,z,X);return X.intValue().toString(T)+re}function se(T,B){this.fromInt(0),B==null&&(B=10);for(var U=this.chunkSize(B),F=Math.pow(B,U),z=!1,X=0,re=0,J=0;J<T.length;++J){var de=u(T,J);if(de<0){T.charAt(J)=="-"&&this.signum()==0&&(z=!0);continue}re=B*re+de,++X>=U&&(this.dMultiply(F),this.dAddOffset(re,0),X=0,re=0)}X>0&&(this.dMultiply(Math.pow(B,X)),this.dAddOffset(re,0)),z&&a.ZERO.subTo(this,this)}function le(T,B,U){if(typeof B=="number")if(T<2)this.fromInt(1);else for(this.fromNumber(T,U),this.testBit(T-1)||this.bitwiseTo(a.ONE.shiftLeft(T-1),pe,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(B);)this.dAddOffset(2,0),this.bitLength()>T&&this.subTo(a.ONE.shiftLeft(T-1),this);else{var F=new Array,z=T&7;F.length=(T>>3)+1,B.nextBytes(F),z>0?F[0]&=(1<<z)-1:F[0]=0,this.fromString(F,256)}}function oe(){var T=this.t,B=new Array;B[0]=this.s;var U=this.DB-T*this.DB%8,F,z=0;if(T-- >0)for(U<this.DB&&(F=this.data[T]>>U)!=(this.s&this.DM)>>U&&(B[z++]=F|this.s<<this.DB-U);T>=0;)U<8?(F=(this.data[T]&(1<<U)-1)<<8-U,F|=this.data[--T]>>(U+=this.DB-8)):(F=this.data[T]>>(U-=8)&255,U<=0&&(U+=this.DB,--T)),(F&128)!=0&&(F|=-256),z==0&&(this.s&128)!=(F&128)&&++z,(z>0||F!=this.s)&&(B[z++]=F);return B}function me(T){return this.compareTo(T)==0}function Se(T){return this.compareTo(T)<0?this:T}function xe(T){return this.compareTo(T)>0?this:T}function Ee(T,B,U){var F,z,X=Math.min(T.t,this.t);for(F=0;F<X;++F)U.data[F]=B(this.data[F],T.data[F]);if(T.t<this.t){for(z=T.s&this.DM,F=X;F<this.t;++F)U.data[F]=B(this.data[F],z);U.t=this.t}else{for(z=this.s&this.DM,F=X;F<T.t;++F)U.data[F]=B(z,T.data[F]);U.t=T.t}U.s=B(this.s,T.s),U.clamp()}function ge(T,B){return T&B}function ye(T){var B=p();return this.bitwiseTo(T,ge,B),B}function pe(T,B){return T|B}function Ie(T){var B=p();return this.bitwiseTo(T,pe,B),B}function Ae(T,B){return T^B}function qe(T){var B=p();return this.bitwiseTo(T,Ae,B),B}function He(T,B){return T&~B}function Qe(T){var B=p();return this.bitwiseTo(T,He,B),B}function ze(){for(var T=p(),B=0;B<this.t;++B)T.data[B]=this.DM&~this.data[B];return T.t=this.t,T.s=~this.s,T}function Xe(T){var B=p();return T<0?this.rShiftTo(-T,B):this.lShiftTo(T,B),B}function Ze(T){var B=p();return T<0?this.lShiftTo(-T,B):this.rShiftTo(T,B),B}function rt(T){if(T==0)return-1;var B=0;return(T&65535)==0&&(T>>=16,B+=16),(T&255)==0&&(T>>=8,B+=8),(T&15)==0&&(T>>=4,B+=4),(T&3)==0&&(T>>=2,B+=2),(T&1)==0&&++B,B}function it(){for(var T=0;T<this.t;++T)if(this.data[T]!=0)return T*this.DB+rt(this.data[T]);return this.s<0?this.t*this.DB:-1}function st(T){for(var B=0;T!=0;)T&=T-1,++B;return B}function lt(){for(var T=0,B=this.s&this.DM,U=0;U<this.t;++U)T+=st(this.data[U]^B);return T}function dt(T){var B=Math.floor(T/this.DB);return B>=this.t?this.s!=0:(this.data[B]&1<<T%this.DB)!=0}function gt(T,B){var U=a.ONE.shiftLeft(T);return this.bitwiseTo(U,B,U),U}function It(T){return this.changeBit(T,pe)}function Be(T){return this.changeBit(T,He)}function be(T){return this.changeBit(T,Ae)}function _e(T,B){for(var U=0,F=0,z=Math.min(T.t,this.t);U<z;)F+=this.data[U]+T.data[U],B.data[U++]=F&this.DM,F>>=this.DB;if(T.t<this.t){for(F+=T.s;U<this.t;)F+=this.data[U],B.data[U++]=F&this.DM,F>>=this.DB;F+=this.s}else{for(F+=this.s;U<T.t;)F+=T.data[U],B.data[U++]=F&this.DM,F>>=this.DB;F+=T.s}B.s=F<0?-1:0,F>0?B.data[U++]=F:F<-1&&(B.data[U++]=this.DV+F),B.t=U,B.clamp()}function Ne(T){var B=p();return this.addTo(T,B),B}function Re(T){var B=p();return this.subTo(T,B),B}function we(T){var B=p();return this.multiplyTo(T,B),B}function Le(){var T=p();return this.squareTo(T),T}function ke(T){var B=p();return this.divRemTo(T,B,null),B}function De(T){var B=p();return this.divRemTo(T,null,B),B}function Ue(T){var B=p(),U=p();return this.divRemTo(T,B,U),new Array(B,U)}function Pe(T){this.data[this.t]=this.am(0,T-1,this,0,0,this.t),++this.t,this.clamp()}function Ve(T,B){if(T!=0){for(;this.t<=B;)this.data[this.t++]=0;for(this.data[B]+=T;this.data[B]>=this.DV;)this.data[B]-=this.DV,++B>=this.t&&(this.data[this.t++]=0),++this.data[B]}}function Ce(){}function Te(T){return T}function Oe(T,B,U){T.multiplyTo(B,U)}function Ke(T,B){T.squareTo(B)}Ce.prototype.convert=Te,Ce.prototype.revert=Te,Ce.prototype.mulTo=Oe,Ce.prototype.sqrTo=Ke;function Fa(T){return this.exp(T,new Ce)}function Ma(T,B,U){var F=Math.min(this.t+T.t,B);for(U.s=0,U.t=F;F>0;)U.data[--F]=0;var z;for(z=U.t-this.t;F<z;++F)U.data[F+this.t]=this.am(0,T.data[F],U,F,0,this.t);for(z=Math.min(T.t,B);F<z;++F)this.am(0,T.data[F],U,F,0,B-F);U.clamp()}function qa(T,B,U){--B;var F=U.t=this.t+T.t-B;for(U.s=0;--F>=0;)U.data[F]=0;for(F=Math.max(B-this.t,0);F<T.t;++F)U.data[this.t+F-B]=this.am(B-F,T.data[F],U,0,0,this.t+F-B);U.clamp(),U.drShiftTo(1,U)}function pt(T){this.r2=p(),this.q3=p(),a.ONE.dlShiftTo(2*T.t,this.r2),this.mu=this.r2.divide(T),this.m=T}function Ha(T){if(T.s<0||T.t>2*this.m.t)return T.mod(this.m);if(T.compareTo(this.m)<0)return T;var B=p();return T.copyTo(B),this.reduce(B),B}function Ga(T){return T}function Qa(T){for(T.drShiftTo(this.m.t-1,this.r2),T.t>this.m.t+1&&(T.t=this.m.t+1,T.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);T.compareTo(this.r2)<0;)T.dAddOffset(1,this.m.t+1);for(T.subTo(this.r2,T);T.compareTo(this.m)>=0;)T.subTo(this.m,T)}function za(T,B){T.squareTo(B),this.reduce(B)}function Ya(T,B,U){T.multiplyTo(B,U),this.reduce(U)}pt.prototype.convert=Ha,pt.prototype.revert=Ga,pt.prototype.reduce=Qa,pt.prototype.mulTo=Ya,pt.prototype.sqrTo=za;function Xa(T,B){var U=T.bitLength(),F,z=y(1),X;if(U<=0)return z;U<18?F=1:U<48?F=3:U<144?F=4:U<768?F=5:F=6,U<8?X=new W(B):B.isEven()?X=new pt(B):X=new j(B);var re=new Array,J=3,de=F-1,Fe=(1<<F)-1;if(re[1]=X.convert(this),F>1){var We=p();for(X.sqrTo(re[1],We);J<=Fe;)re[J]=p(),X.mulTo(We,re[J-2],re[J]),J+=2}var Ye=T.t-1,nt,At=!0,Je=p(),et;for(U=n(T.data[Ye])-1;Ye>=0;){for(U>=de?nt=T.data[Ye]>>U-de&Fe:(nt=(T.data[Ye]&(1<<U+1)-1)<<de-U,Ye>0&&(nt|=T.data[Ye-1]>>this.DB+U-de)),J=F;(nt&1)==0;)nt>>=1,--J;if((U-=J)<0&&(U+=this.DB,--Ye),At)re[nt].copyTo(z),At=!1;else{for(;J>1;)X.sqrTo(z,Je),X.sqrTo(Je,z),J-=2;J>0?X.sqrTo(z,Je):(et=z,z=Je,Je=et),X.mulTo(Je,re[nt],z)}for(;Ye>=0&&(T.data[Ye]&1<<U)==0;)X.sqrTo(z,Je),et=z,z=Je,Je=et,--U<0&&(U=this.DB-1,--Ye)}return X.revert(z)}function Wa(T){var B=this.s<0?this.negate():this.clone(),U=T.s<0?T.negate():T.clone();if(B.compareTo(U)<0){var F=B;B=U,U=F}var z=B.getLowestSetBit(),X=U.getLowestSetBit();if(X<0)return B;for(z<X&&(X=z),X>0&&(B.rShiftTo(X,B),U.rShiftTo(X,U));B.signum()>0;)(z=B.getLowestSetBit())>0&&B.rShiftTo(z,B),(z=U.getLowestSetBit())>0&&U.rShiftTo(z,U),B.compareTo(U)>=0?(B.subTo(U,B),B.rShiftTo(1,B)):(U.subTo(B,U),U.rShiftTo(1,U));return X>0&&U.lShiftTo(X,U),U}function ja(T){if(T<=0)return 0;var B=this.DV%T,U=this.s<0?T-1:0;if(this.t>0)if(B==0)U=this.data[0]%T;else for(var F=this.t-1;F>=0;--F)U=(B*U+this.data[F])%T;return U}function Za(T){if(this.signum()==0)return a.ZERO;var B=T.isEven();if(this.isEven()&&B||T.signum()==0)return a.ZERO;for(var U=T.clone(),F=this.clone(),z=y(1),X=y(0),re=y(0),J=y(1);U.signum()!=0;){for(;U.isEven();)U.rShiftTo(1,U),B?((!z.isEven()||!X.isEven())&&(z.addTo(this,z),X.subTo(T,X)),z.rShiftTo(1,z)):X.isEven()||X.subTo(T,X),X.rShiftTo(1,X);for(;F.isEven();)F.rShiftTo(1,F),B?((!re.isEven()||!J.isEven())&&(re.addTo(this,re),J.subTo(T,J)),re.rShiftTo(1,re)):J.isEven()||J.subTo(T,J),J.rShiftTo(1,J);U.compareTo(F)>=0?(U.subTo(F,U),B&&z.subTo(re,z),X.subTo(J,X)):(F.subTo(U,F),B&&re.subTo(z,re),J.subTo(X,J))}if(F.compareTo(a.ONE)!=0)return a.ZERO;if(J.compareTo(T)>=0)return J.subtract(T);if(J.signum()<0)J.addTo(T,J);else return J;return J.signum()<0?J.add(T):J}var $e=[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,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],$a=(1<<26)/$e[$e.length-1];function Ja(T){var B,U=this.abs();if(U.t==1&&U.data[0]<=$e[$e.length-1]){for(B=0;B<$e.length;++B)if(U.data[0]==$e[B])return!0;return!1}if(U.isEven())return!1;for(B=1;B<$e.length;){for(var F=$e[B],z=B+1;z<$e.length&&F<$a;)F*=$e[z++];for(F=U.modInt(F);B<z;)if(F%$e[B++]==0)return!1}return U.millerRabin(T)}function ei(T){var B=this.subtract(a.ONE),U=B.getLowestSetBit();if(U<=0)return!1;for(var F=B.shiftRight(U),z=ti(),X,re=0;re<T;++re){do X=new a(this.bitLength(),z);while(X.compareTo(a.ONE)<=0||X.compareTo(B)>=0);var J=X.modPow(F,this);if(J.compareTo(a.ONE)!=0&&J.compareTo(B)!=0){for(var de=1;de++<U&&J.compareTo(B)!=0;)if(J=J.modPowInt(2,this),J.compareTo(a.ONE)==0)return!1;if(J.compareTo(B)!=0)return!1}}return!0}function ti(){return{nextBytes:function(T){for(var B=0;B<T.length;++B)T[B]=Math.floor(Math.random()*256)}}}return a.prototype.chunkSize=te,a.prototype.toRadix=$,a.prototype.fromRadix=se,a.prototype.fromNumber=le,a.prototype.bitwiseTo=Ee,a.prototype.changeBit=gt,a.prototype.addTo=_e,a.prototype.dMultiply=Pe,a.prototype.dAddOffset=Ve,a.prototype.multiplyLowerTo=Ma,a.prototype.multiplyUpperTo=qa,a.prototype.modInt=ja,a.prototype.millerRabin=ei,a.prototype.clone=b,a.prototype.intValue=V,a.prototype.byteValue=H,a.prototype.shortValue=ae,a.prototype.signum=Q,a.prototype.toByteArray=oe,a.prototype.equals=me,a.prototype.min=Se,a.prototype.max=xe,a.prototype.and=ye,a.prototype.or=Ie,a.prototype.xor=qe,a.prototype.andNot=Qe,a.prototype.not=ze,a.prototype.shiftLeft=Xe,a.prototype.shiftRight=Ze,a.prototype.getLowestSetBit=it,a.prototype.bitCount=lt,a.prototype.testBit=dt,a.prototype.setBit=It,a.prototype.clearBit=Be,a.prototype.flipBit=be,a.prototype.add=Ne,a.prototype.subtract=Re,a.prototype.multiply=we,a.prototype.divide=ke,a.prototype.remainder=De,a.prototype.divideAndRemainder=Ue,a.prototype.modPow=Xa,a.prototype.modInverse=Za,a.prototype.pow=Fa,a.prototype.gcd=Wa,a.prototype.isProbablePrime=Ja,a.prototype.square=Le,jt}var Zt={exports:{}},$t={exports:{}},qr;function yt(){if(qr)return $t.exports;qr=1;var i=ue();at(),ce();var e=$t.exports=i.sha1=i.sha1||{};i.md.sha1=i.md.algorithms.sha1=e,e.create=function(){p||N();var c=null,t=i.util.createBuffer(),g=new Array(80),f={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return f.start=function(){f.messageLength=0,f.fullMessageLength=f.messageLength64=[];for(var x=f.messageLengthSize/4,D=0;D<x;++D)f.fullMessageLength.push(0);return t=i.util.createBuffer(),c={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},f},f.start(),f.update=function(x,D){D==="utf8"&&(x=i.util.encodeUtf8(x));var E=x.length;f.messageLength+=E,E=[E/4294967296>>>0,E>>>0];for(var u=f.fullMessageLength.length-1;u>=0;--u)f.fullMessageLength[u]+=E[1],E[1]=E[0]+(f.fullMessageLength[u]/4294967296>>>0),f.fullMessageLength[u]=f.fullMessageLength[u]>>>0,E[0]=E[1]/4294967296>>>0;return t.putBytes(x),S(c,g,t),(t.read>2048||t.length()===0)&&t.compact(),f},f.digest=function(){var x=i.util.createBuffer();x.putBytes(t.bytes());var D=f.fullMessageLength[f.fullMessageLength.length-1]+f.messageLengthSize,E=D&f.blockLength-1;x.putBytes(a.substr(0,f.blockLength-E));for(var u,v,C=f.fullMessageLength[0]*8,y=0;y<f.fullMessageLength.length-1;++y)u=f.fullMessageLength[y+1]*8,v=u/4294967296>>>0,C+=v,x.putInt32(C>>>0),C=u>>>0;x.putInt32(C);var s={h0:c.h0,h1:c.h1,h2:c.h2,h3:c.h3,h4:c.h4};S(s,g,x);var h=i.util.createBuffer();return h.putInt32(s.h0),h.putInt32(s.h1),h.putInt32(s.h2),h.putInt32(s.h3),h.putInt32(s.h4),h},f};var a=null,p=!1;function N(){a="€",a+=i.util.fillString("\0",64),p=!0}function S(c,t,g){for(var f,x,D,E,u,v,C,y,s=g.length();s>=64;){for(x=c.h0,D=c.h1,E=c.h2,u=c.h3,v=c.h4,y=0;y<16;++y)f=g.getInt32(),t[y]=f,C=u^D&(E^u),f=(x<<5|x>>>27)+C+v+1518500249+f,v=u,u=E,E=(D<<30|D>>>2)>>>0,D=x,x=f;for(;y<20;++y)f=t[y-3]^t[y-8]^t[y-14]^t[y-16],f=f<<1|f>>>31,t[y]=f,C=u^D&(E^u),f=(x<<5|x>>>27)+C+v+1518500249+f,v=u,u=E,E=(D<<30|D>>>2)>>>0,D=x,x=f;for(;y<32;++y)f=t[y-3]^t[y-8]^t[y-14]^t[y-16],f=f<<1|f>>>31,t[y]=f,C=D^E^u,f=(x<<5|x>>>27)+C+v+1859775393+f,v=u,u=E,E=(D<<30|D>>>2)>>>0,D=x,x=f;for(;y<40;++y)f=t[y-6]^t[y-16]^t[y-28]^t[y-32],f=f<<2|f>>>30,t[y]=f,C=D^E^u,f=(x<<5|x>>>27)+C+v+1859775393+f,v=u,u=E,E=(D<<30|D>>>2)>>>0,D=x,x=f;for(;y<60;++y)f=t[y-6]^t[y-16]^t[y-28]^t[y-32],f=f<<2|f>>>30,t[y]=f,C=D&E|u&(D^E),f=(x<<5|x>>>27)+C+v+2400959708+f,v=u,u=E,E=(D<<30|D>>>2)>>>0,D=x,x=f;for(;y<80;++y)f=t[y-6]^t[y-16]^t[y-28]^t[y-32],f=f<<2|f>>>30,t[y]=f,C=D^E^u,f=(x<<5|x>>>27)+C+v+3395469782+f,v=u,u=E,E=(D<<30|D>>>2)>>>0,D=x,x=f;c.h0=c.h0+x|0,c.h1=c.h1+D|0,c.h2=c.h2+E|0,c.h3=c.h3+u|0,c.h4=c.h4+v|0,s-=64}}return $t.exports}var Hr;function Gr(){if(Hr)return Zt.exports;Hr=1;var i=ue();ce(),je(),yt();var e=Zt.exports=i.pkcs1=i.pkcs1||{};e.encode_rsa_oaep=function(p,N,S){var c,t,g,f;typeof S=="string"?(c=S,t=arguments[3]||void 0,g=arguments[4]||void 0):S&&(c=S.label||void 0,t=S.seed||void 0,g=S.md||void 0,S.mgf1&&S.mgf1.md&&(f=S.mgf1.md)),g?g.start():g=i.md.sha1.create(),f||(f=g);var x=Math.ceil(p.n.bitLength()/8),D=x-2*g.digestLength-2;if(N.length>D){var E=new Error("RSAES-OAEP input message length is too long.");throw E.length=N.length,E.maxLength=D,E}c||(c=""),g.update(c,"raw");for(var u=g.digest(),v="",C=D-N.length,y=0;y<C;y++)v+="\0";var s=u.getBytes()+v+""+N;if(!t)t=i.random.getBytes(g.digestLength);else if(t.length!==g.digestLength){var E=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw E.seedLength=t.length,E.digestLength=g.digestLength,E}var h=a(t,x-g.digestLength-1,f),d=i.util.xorBytes(s,h,s.length),I=a(d,g.digestLength,f),w=i.util.xorBytes(t,I,t.length);return"\0"+w+d},e.decode_rsa_oaep=function(p,N,S){var c,t,g;typeof S=="string"?(c=S,t=arguments[3]||void 0):S&&(c=S.label||void 0,t=S.md||void 0,S.mgf1&&S.mgf1.md&&(g=S.mgf1.md));var f=Math.ceil(p.n.bitLength()/8);if(N.length!==f){var d=new Error("RSAES-OAEP encoded message length is invalid.");throw d.length=N.length,d.expectedLength=f,d}if(t===void 0?t=i.md.sha1.create():t.start(),g||(g=t),f<2*t.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");c||(c=""),t.update(c,"raw");for(var x=t.digest().getBytes(),D=N.charAt(0),E=N.substring(1,t.digestLength+1),u=N.substring(1+t.digestLength),v=a(u,t.digestLength,g),C=i.util.xorBytes(E,v,E.length),y=a(C,f-t.digestLength-1,g),s=i.util.xorBytes(u,y,u.length),h=s.substring(0,t.digestLength),d=D!=="\0",I=0;I<t.digestLength;++I)d|=x.charAt(I)!==h.charAt(I);for(var w=1,l=t.digestLength,n=t.digestLength;n<s.length;n++){var r=s.charCodeAt(n),A=r&1^1,k=w?65534:0;d|=r&k,w=w&A,l+=w}if(d||s.charCodeAt(l)!==1)throw new Error("Invalid RSAES-OAEP padding.");return s.substring(l+1)};function a(p,N,S){S||(S=i.md.sha1.create());for(var c="",t=Math.ceil(N/S.digestLength),g=0;g<t;++g){var f=String.fromCharCode(g>>24&255,g>>16&255,g>>8&255,g&255);S.start(),S.update(p+f),c+=S.digest().getBytes()}return c.substring(0,N)}return Zt.exports}var xt={exports:{}},Qr;function zr(){if(Qr)return xt.exports;Qr=1;var i=ue();return ce(),Et(),je(),(function(){if(i.prime){xt.exports=i.prime;return}var e=xt.exports=i.prime=i.prime||{},a=i.jsbn.BigInteger,p=[6,4,2,4,2,4,6,2],N=new a(null);N.fromInt(30);var S=function(E,u){return E|u};e.generateProbablePrime=function(E,u,v){typeof u=="function"&&(v=u,u={}),u=u||{};var C=u.algorithm||"PRIMEINC";typeof C=="string"&&(C={name:C}),C.options=C.options||{};var y=u.prng||i.random,s={nextBytes:function(h){for(var d=y.getBytesSync(h.length),I=0;I<h.length;++I)h[I]=d.charCodeAt(I)}};if(C.name==="PRIMEINC")return c(E,s,C.options,v);throw new Error("Invalid prime generation algorithm: "+C.name)};function c(E,u,v,C){return"workers"in v?f(E,u,v,C):t(E,u,v,C)}function t(E,u,v,C){var y=x(E,u),s=0,h=D(y.bitLength());"millerRabinTests"in v&&(h=v.millerRabinTests);var d=10;"maxBlockTime"in v&&(d=v.maxBlockTime),g(y,E,u,s,h,d,C)}function g(E,u,v,C,y,s,h){var d=+new Date;do{if(E.bitLength()>u&&(E=x(u,v)),E.isProbablePrime(y))return h(null,E);E.dAddOffset(p[C++%8],0)}while(s<0||+new Date-d<s);i.util.setImmediate(function(){g(E,u,v,C,y,s,h)})}function f(E,u,v,C){if(typeof Worker>"u")return t(E,u,v,C);var y=x(E,u),s=v.workers,h=v.workLoad||100,d=h*30/8,I=v.workerScript||"forge/prime.worker.js";if(s===-1)return i.util.estimateCores(function(l,n){l&&(n=2),s=n-1,w()});w();function w(){s=Math.max(1,s);for(var l=[],n=0;n<s;++n)l[n]=new Worker(I);for(var n=0;n<s;++n)l[n].addEventListener("message",A);var r=!1;function A(k){if(!r){var O=k.data;if(O.found){for(var P=0;P<l.length;++P)l[P].terminate();return r=!0,C(null,new a(O.prime,16))}y.bitLength()>E&&(y=x(E,u));var K=y.toString(16);k.target.postMessage({hex:K,workLoad:h}),y.dAddOffset(d,0)}}}}function x(E,u){var v=new a(E,u),C=E-1;return v.testBit(C)||v.bitwiseTo(a.ONE.shiftLeft(C),S,v),v.dAddOffset(31-v.mod(N).byteValue(),0),v}function D(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}})(),xt.exports}var Jt,Yr;function St(){if(Yr)return Jt;Yr=1;var i=ue();if(tt(),Et(),ft(),Gr(),zr(),je(),ce(),typeof e>"u")var e=i.jsbn.BigInteger;var a=i.util.isNodejs?Gt:null,p=i.asn1,N=i.util;i.pki=i.pki||{},Jt=i.pki.rsa=i.rsa=i.rsa||{};var S=i.pki,c=[6,4,2,4,2,4,6,2],t={name:"PrivateKeyInfo",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:p.Class.UNIVERSAL,type:p.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:p.Class.UNIVERSAL,type:p.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},g={name:"RSAPrivateKey",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},f={name:"RSAPublicKey",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},x=i.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:p.Class.UNIVERSAL,type:p.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:p.Class.UNIVERSAL,type:p.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},D={name:"DigestInfo",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:p.Class.UNIVERSAL,type:p.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:p.Class.UNIVERSAL,type:p.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:p.Class.UNIVERSAL,type:p.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},E=function(n){var r;if(n.algorithm in S.oids)r=S.oids[n.algorithm];else{var A=new Error("Unknown message digest algorithm.");throw A.algorithm=n.algorithm,A}var k=p.oidToDer(r).getBytes(),O=p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[]),P=p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[]);P.value.push(p.create(p.Class.UNIVERSAL,p.Type.OID,!1,k)),P.value.push(p.create(p.Class.UNIVERSAL,p.Type.NULL,!1,""));var K=p.create(p.Class.UNIVERSAL,p.Type.OCTETSTRING,!1,n.digest().getBytes());return O.value.push(P),O.value.push(K),p.toDer(O).getBytes()},u=function(n,r,A){if(A)return n.modPow(r.e,r.n);if(!r.p||!r.q)return n.modPow(r.d,r.n);r.dP||(r.dP=r.d.mod(r.p.subtract(e.ONE))),r.dQ||(r.dQ=r.d.mod(r.q.subtract(e.ONE))),r.qInv||(r.qInv=r.q.modInverse(r.p));var k;do k=new e(i.util.bytesToHex(i.random.getBytes(r.n.bitLength()/8)),16);while(k.compareTo(r.n)>=0||!k.gcd(r.n).equals(e.ONE));n=n.multiply(k.modPow(r.e,r.n)).mod(r.n);for(var O=n.mod(r.p).modPow(r.dP,r.p),P=n.mod(r.q).modPow(r.dQ,r.q);O.compareTo(P)<0;)O=O.add(r.p);var K=O.subtract(P).multiply(r.qInv).mod(r.p).multiply(r.q).add(P);return K=K.multiply(k.modInverse(r.n)).mod(r.n),K};S.rsa.encrypt=function(n,r,A){var k=A,O,P=Math.ceil(r.n.bitLength()/8);A!==!1&&A!==!0?(k=A===2,O=v(n,r,A)):(O=i.util.createBuffer(),O.putBytes(n));for(var K=new e(O.toHex(),16),q=u(K,r,k),M=q.toString(16),G=i.util.createBuffer(),Y=P-Math.ceil(M.length/2);Y>0;)G.putByte(0),--Y;return G.putBytes(i.util.hexToBytes(M)),G.getBytes()},S.rsa.decrypt=function(n,r,A,k){var O=Math.ceil(r.n.bitLength()/8);if(n.length!==O){var P=new Error("Encrypted message length is invalid.");throw P.length=n.length,P.expected=O,P}var K=new e(i.util.createBuffer(n).toHex(),16);if(K.compareTo(r.n)>=0)throw new Error("Encrypted message is invalid.");for(var q=u(K,r,A),M=q.toString(16),G=i.util.createBuffer(),Y=O-Math.ceil(M.length/2);Y>0;)G.putByte(0),--Y;return G.putBytes(i.util.hexToBytes(M)),k!==!1?C(G.getBytes(),r,A):G.getBytes()},S.rsa.createKeyPairGenerationState=function(n,r,A){typeof n=="string"&&(n=parseInt(n,10)),n=n||2048,A=A||{};var k=A.prng||i.random,O={nextBytes:function(q){for(var M=k.getBytesSync(q.length),G=0;G<q.length;++G)q[G]=M.charCodeAt(G)}},P=A.algorithm||"PRIMEINC",K;if(P==="PRIMEINC")K={algorithm:P,state:0,bits:n,rng:O,eInt:r||65537,e:new e(null),p:null,q:null,qBits:n>>1,pBits:n-(n>>1),pqState:0,num:null,keys:null},K.e.fromInt(K.eInt);else throw new Error("Invalid key generation algorithm: "+P);return K},S.rsa.stepKeyPairGenerationState=function(n,r){"algorithm"in n||(n.algorithm="PRIMEINC");var A=new e(null);A.fromInt(30);for(var k=0,O=function(W,ee){return W|ee},P=+new Date,K,q=0;n.keys===null&&(r<=0||q<r);){if(n.state===0){var M=n.p===null?n.pBits:n.qBits,G=M-1;n.pqState===0?(n.num=new e(M,n.rng),n.num.testBit(G)||n.num.bitwiseTo(e.ONE.shiftLeft(G),O,n.num),n.num.dAddOffset(31-n.num.mod(A).byteValue(),0),k=0,++n.pqState):n.pqState===1?n.num.bitLength()>M?n.pqState=0:n.num.isProbablePrime(h(n.num.bitLength()))?++n.pqState:n.num.dAddOffset(c[k++%8],0):n.pqState===2?n.pqState=n.num.subtract(e.ONE).gcd(n.e).compareTo(e.ONE)===0?3:0:n.pqState===3&&(n.pqState=0,n.p===null?n.p=n.num:n.q=n.num,n.p!==null&&n.q!==null&&++n.state,n.num=null)}else if(n.state===1)n.p.compareTo(n.q)<0&&(n.num=n.p,n.p=n.q,n.q=n.num),++n.state;else if(n.state===2)n.p1=n.p.subtract(e.ONE),n.q1=n.q.subtract(e.ONE),n.phi=n.p1.multiply(n.q1),++n.state;else if(n.state===3)n.phi.gcd(n.e).compareTo(e.ONE)===0?++n.state:(n.p=null,n.q=null,n.state=0);else if(n.state===4)n.n=n.p.multiply(n.q),n.n.bitLength()===n.bits?++n.state:(n.q=null,n.state=0);else if(n.state===5){var Y=n.e.modInverse(n.phi);n.keys={privateKey:S.rsa.setPrivateKey(n.n,n.e,Y,n.p,n.q,Y.mod(n.p1),Y.mod(n.q1),n.q.modInverse(n.p)),publicKey:S.rsa.setPublicKey(n.n,n.e)}}K=+new Date,q+=K-P,P=K}return n.keys!==null},S.rsa.generateKeyPair=function(n,r,A,k){if(arguments.length===1?typeof n=="object"?(A=n,n=void 0):typeof n=="function"&&(k=n,n=void 0):arguments.length===2?typeof n=="number"?typeof r=="function"?(k=r,r=void 0):typeof r!="number"&&(A=r,r=void 0):(A=n,k=r,n=void 0,r=void 0):arguments.length===3&&(typeof r=="number"?typeof A=="function"&&(k=A,A=void 0):(k=A,A=r,r=void 0)),A=A||{},n===void 0&&(n=A.bits||2048),r===void 0&&(r=A.e||65537),!i.options.usePureJavaScript&&!A.prng&&n>=256&&n<=16384&&(r===65537||r===3)){if(k){if(d("generateKeyPair"))return a.generateKeyPair("rsa",{modulusLength:n,publicExponent:r,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(q,M,G){if(q)return k(q);k(null,{privateKey:S.privateKeyFromPem(G),publicKey:S.publicKeyFromPem(M)})});if(I("generateKey")&&I("exportKey"))return N.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:n,publicExponent:l(r),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(q){return N.globalScope.crypto.subtle.exportKey("pkcs8",q.privateKey)}).then(void 0,function(q){k(q)}).then(function(q){if(q){var M=S.privateKeyFromAsn1(p.fromDer(i.util.createBuffer(q)));k(null,{privateKey:M,publicKey:S.setRsaPublicKey(M.n,M.e)})}});if(w("generateKey")&&w("exportKey")){var O=N.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:n,publicExponent:l(r),hash:{name:"SHA-256"}},!0,["sign","verify"]);O.oncomplete=function(q){var M=q.target.result,G=N.globalScope.msCrypto.subtle.exportKey("pkcs8",M.privateKey);G.oncomplete=function(Y){var W=Y.target.result,ee=S.privateKeyFromAsn1(p.fromDer(i.util.createBuffer(W)));k(null,{privateKey:ee,publicKey:S.setRsaPublicKey(ee.n,ee.e)})},G.onerror=function(Y){k(Y)}},O.onerror=function(q){k(q)};return}}else if(d("generateKeyPairSync")){var P=a.generateKeyPairSync("rsa",{modulusLength:n,publicExponent:r,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:S.privateKeyFromPem(P.privateKey),publicKey:S.publicKeyFromPem(P.publicKey)}}}var K=S.rsa.createKeyPairGenerationState(n,r,A);if(!k)return S.rsa.stepKeyPairGenerationState(K,0),K.keys;y(K,A,k)},S.setRsaPublicKey=S.rsa.setPublicKey=function(n,r){var A={n,e:r};return A.encrypt=function(k,O,P){if(typeof O=="string"?O=O.toUpperCase():O===void 0&&(O="RSAES-PKCS1-V1_5"),O==="RSAES-PKCS1-V1_5")O={encode:function(q,M,G){return v(q,M,2).getBytes()}};else if(O==="RSA-OAEP"||O==="RSAES-OAEP")O={encode:function(q,M){return i.pkcs1.encode_rsa_oaep(M,q,P)}};else if(["RAW","NONE","NULL",null].indexOf(O)!==-1)O={encode:function(q){return q}};else if(typeof O=="string")throw new Error('Unsupported encryption scheme: "'+O+'".');var K=O.encode(k,A,!0);return S.rsa.encrypt(K,A,!0)},A.verify=function(k,O,P,K){typeof P=="string"?P=P.toUpperCase():P===void 0&&(P="RSASSA-PKCS1-V1_5"),K===void 0&&(K={_parseAllDigestBytes:!0,_skipPaddingChecks:!1}),"_parseAllDigestBytes"in K||(K._parseAllDigestBytes=!0),"_skipPaddingChecks"in K||(K._skipPaddingChecks=!1),P==="RSASSA-PKCS1-V1_5"?P={verify:function(M,G){G=C(G,A,!0,void 0,K);var Y=p.fromDer(G,{parseAllBytes:K._parseAllDigestBytes}),W={},ee=[];if(!p.validate(Y,D,W,ee)||Y.value.length!==2){var ie=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw ie.errors=ee,ie}var ne=p.derToOid(W.algorithmIdentifier);if(!(ne===i.oids.md2||ne===i.oids.md5||ne===i.oids.sha1||ne===i.oids.sha224||ne===i.oids.sha256||ne===i.oids.sha384||ne===i.oids.sha512||ne===i.oids["sha512-224"]||ne===i.oids["sha512-256"])){var ie=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw ie.oid=ne,ie}if((ne===i.oids.md2||ne===i.oids.md5)&&!("parameters"in W))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifier NULL parameters.");return M===W.digest}}:(P==="NONE"||P==="NULL"||P===null)&&(P={verify:function(M,G){return G=C(G,A,!0,void 0,K),M===G}});var q=S.rsa.decrypt(O,A,!0,!1);return P.verify(k,q,A.n.bitLength())},A},S.setRsaPrivateKey=S.rsa.setPrivateKey=function(n,r,A,k,O,P,K,q){var M={n,e:r,d:A,p:k,q:O,dP:P,dQ:K,qInv:q};return M.decrypt=function(G,Y,W){typeof Y=="string"?Y=Y.toUpperCase():Y===void 0&&(Y="RSAES-PKCS1-V1_5");var ee=S.rsa.decrypt(G,M,!1,!1);if(Y==="RSAES-PKCS1-V1_5")Y={decode:C};else if(Y==="RSA-OAEP"||Y==="RSAES-OAEP")Y={decode:function(ie,ne){return i.pkcs1.decode_rsa_oaep(ne,ie,W)}};else if(["RAW","NONE","NULL",null].indexOf(Y)!==-1)Y={decode:function(ie){return ie}};else throw new Error('Unsupported encryption scheme: "'+Y+'".');return Y.decode(ee,M,!1)},M.sign=function(G,Y){var W=!1;typeof Y=="string"&&(Y=Y.toUpperCase()),Y===void 0||Y==="RSASSA-PKCS1-V1_5"?(Y={encode:E},W=1):(Y==="NONE"||Y==="NULL"||Y===null)&&(Y={encode:function(){return G}},W=1);var ee=Y.encode(G,M.n.bitLength());return S.rsa.encrypt(ee,M,W)},M},S.wrapRsaPrivateKey=function(n){return p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,p.integerToDer(0).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(S.oids.rsaEncryption).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.NULL,!1,"")]),p.create(p.Class.UNIVERSAL,p.Type.OCTETSTRING,!1,p.toDer(n).getBytes())])},S.privateKeyFromAsn1=function(n){var r={},A=[];if(p.validate(n,t,r,A)&&(n=p.fromDer(i.util.createBuffer(r.privateKey))),r={},A=[],!p.validate(n,g,r,A)){var k=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw k.errors=A,k}var O,P,K,q,M,G,Y,W;return O=i.util.createBuffer(r.privateKeyModulus).toHex(),P=i.util.createBuffer(r.privateKeyPublicExponent).toHex(),K=i.util.createBuffer(r.privateKeyPrivateExponent).toHex(),q=i.util.createBuffer(r.privateKeyPrime1).toHex(),M=i.util.createBuffer(r.privateKeyPrime2).toHex(),G=i.util.createBuffer(r.privateKeyExponent1).toHex(),Y=i.util.createBuffer(r.privateKeyExponent2).toHex(),W=i.util.createBuffer(r.privateKeyCoefficient).toHex(),S.setRsaPrivateKey(new e(O,16),new e(P,16),new e(K,16),new e(q,16),new e(M,16),new e(G,16),new e(Y,16),new e(W,16))},S.privateKeyToAsn1=S.privateKeyToRSAPrivateKey=function(n){return p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,p.integerToDer(0).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,s(n.n)),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,s(n.e)),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,s(n.d)),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,s(n.p)),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,s(n.q)),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,s(n.dP)),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,s(n.dQ)),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,s(n.qInv))])},S.publicKeyFromAsn1=function(n){var r={},A=[];if(p.validate(n,x,r,A)){var k=p.derToOid(r.publicKeyOid);if(k!==S.oids.rsaEncryption){var O=new Error("Cannot read public key. Unknown OID.");throw O.oid=k,O}n=r.rsaPublicKey}if(A=[],!p.validate(n,f,r,A)){var O=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw O.errors=A,O}var P=i.util.createBuffer(r.publicKeyModulus).toHex(),K=i.util.createBuffer(r.publicKeyExponent).toHex();return S.setRsaPublicKey(new e(P,16),new e(K,16))},S.publicKeyToAsn1=S.publicKeyToSubjectPublicKeyInfo=function(n){return p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(S.oids.rsaEncryption).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.NULL,!1,"")]),p.create(p.Class.UNIVERSAL,p.Type.BITSTRING,!1,[S.publicKeyToRSAPublicKey(n)])])},S.publicKeyToRSAPublicKey=function(n){return p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,s(n.n)),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,s(n.e))])};function v(n,r,A){var k=i.util.createBuffer(),O=Math.ceil(r.n.bitLength()/8);if(n.length>O-11){var P=new Error("Message is too long for PKCS#1 v1.5 padding.");throw P.length=n.length,P.max=O-11,P}k.putByte(0),k.putByte(A);var K=O-3-n.length,q;if(A===0||A===1){q=A===0?0:255;for(var M=0;M<K;++M)k.putByte(q)}else for(;K>0;){for(var G=0,Y=i.random.getBytes(K),M=0;M<K;++M)q=Y.charCodeAt(M),q===0?++G:k.putByte(q);K=G}return k.putByte(0),k.putBytes(n),k}function C(n,r,A,k,O){var P=Math.ceil(r.n.bitLength()/8),K=i.util.createBuffer(n),q=K.getByte(),M=K.getByte();if(q!==0||A&&M!==0&&M!==1||!A&&M!==2||A&&M===0&&typeof k>"u")throw new Error("Encryption block is invalid.");var G=0;if(M===0){G=P-3-k;for(var Y=0;Y<G;++Y)if(K.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(M===1){for(G=0;K.length()>1;){if(K.getByte()!==255){--K.read;break}++G}if(G<8&&!(O&&O._skipPaddingChecks))throw new Error("Encryption block is invalid.")}else if(M===2){for(G=0;K.length()>1;){if(K.getByte()===0){--K.read;break}++G}if(G<8&&!(O&&O._skipPaddingChecks))throw new Error("Encryption block is invalid.")}var W=K.getByte();if(W!==0||G!==P-3-K.length())throw new Error("Encryption block is invalid.");return K.getBytes()}function y(n,r,A){typeof r=="function"&&(A=r,r={}),r=r||{};var k={algorithm:{name:r.algorithm||"PRIMEINC",options:{workers:r.workers||2,workLoad:r.workLoad||100,workerScript:r.workerScript}}};"prng"in r&&(k.prng=r.prng),O();function O(){P(n.pBits,function(q,M){if(q)return A(q);if(n.p=M,n.q!==null)return K(q,n.q);P(n.qBits,K)})}function P(q,M){i.prime.generateProbablePrime(q,k,M)}function K(q,M){if(q)return A(q);if(n.q=M,n.p.compareTo(n.q)<0){var G=n.p;n.p=n.q,n.q=G}if(n.p.subtract(e.ONE).gcd(n.e).compareTo(e.ONE)!==0){n.p=null,O();return}if(n.q.subtract(e.ONE).gcd(n.e).compareTo(e.ONE)!==0){n.q=null,P(n.qBits,K);return}if(n.p1=n.p.subtract(e.ONE),n.q1=n.q.subtract(e.ONE),n.phi=n.p1.multiply(n.q1),n.phi.gcd(n.e).compareTo(e.ONE)!==0){n.p=n.q=null,O();return}if(n.n=n.p.multiply(n.q),n.n.bitLength()!==n.bits){n.q=null,P(n.qBits,K);return}var Y=n.e.modInverse(n.phi);n.keys={privateKey:S.rsa.setPrivateKey(n.n,n.e,Y,n.p,n.q,Y.mod(n.p1),Y.mod(n.q1),n.q.modInverse(n.p)),publicKey:S.rsa.setPublicKey(n.n,n.e)},A(null,n.keys)}}function s(n){var r=n.toString(16);r[0]>="8"&&(r="00"+r);var A=i.util.hexToBytes(r);return A.length>1&&(A.charCodeAt(0)===0&&(A.charCodeAt(1)&128)===0||A.charCodeAt(0)===255&&(A.charCodeAt(1)&128)===128)?A.substr(1):A}function h(n){return n<=100?27:n<=150?18:n<=200?15:n<=250?12:n<=300?9:n<=350?8:n<=400?7:n<=500?6:n<=600?5:n<=800?4:n<=1250?3:2}function d(n){return i.util.isNodejs&&typeof a[n]=="function"}function I(n){return typeof N.globalScope<"u"&&typeof N.globalScope.crypto=="object"&&typeof N.globalScope.crypto.subtle=="object"&&typeof N.globalScope.crypto.subtle[n]=="function"}function w(n){return typeof N.globalScope<"u"&&typeof N.globalScope.msCrypto=="object"&&typeof N.globalScope.msCrypto.subtle=="object"&&typeof N.globalScope.msCrypto.subtle[n]=="function"}function l(n){for(var r=i.util.hexToBytes(n.toString(16)),A=new Uint8Array(r.length),k=0;k<r.length;++k)A[k]=r.charCodeAt(k);return A}return Jt}var er,Xr;function Wr(){if(Xr)return er;Xr=1;var i=ue();if(ut(),tt(),Ct(),at(),ft(),zt(),ct(),je(),Fr(),St(),ce(),typeof e>"u")var e=i.jsbn.BigInteger;var a=i.asn1,p=i.pki=i.pki||{};er=p.pbe=i.pbe=i.pbe||{};var N=p.oids,S={name:"EncryptedPrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",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:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},c={name:"PBES2Algorithms",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},t={name:"pkcs-12PbeParams",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"iterations"}]};p.encryptPrivateKeyInfo=function(E,u,v){v=v||{},v.saltSize=v.saltSize||8,v.count=v.count||2048,v.algorithm=v.algorithm||"aes128",v.prfAlgorithm=v.prfAlgorithm||"sha1";var C=i.random.getBytesSync(v.saltSize),y=v.count,s=a.integerToDer(y),h,d,I;if(v.algorithm.indexOf("aes")===0||v.algorithm==="des"){var w,l,n;switch(v.algorithm){case"aes128":h=16,w=16,l=N["aes128-CBC"],n=i.aes.createEncryptionCipher;break;case"aes192":h=24,w=16,l=N["aes192-CBC"],n=i.aes.createEncryptionCipher;break;case"aes256":h=32,w=16,l=N["aes256-CBC"],n=i.aes.createEncryptionCipher;break;case"des":h=8,w=8,l=N.desCBC,n=i.des.createEncryptionCipher;break;default:var r=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw r.algorithm=v.algorithm,r}var A="hmacWith"+v.prfAlgorithm.toUpperCase(),k=x(A),O=i.pkcs5.pbkdf2(u,C,y,h,k),P=i.random.getBytesSync(w),K=n(O);K.start(P),K.update(a.toDer(E)),K.finish(),I=K.output.getBytes();var q=D(C,s,h,A);d=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(N.pkcs5PBES2).getBytes()),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(N.pkcs5PBKDF2).getBytes()),q]),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(l).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,P)])])])}else if(v.algorithm==="3des"){h=24;var M=new i.util.ByteBuffer(C),O=p.pbe.generatePkcs12Key(u,M,1,y,h),P=p.pbe.generatePkcs12Key(u,M,2,y,h),K=i.des.createEncryptionCipher(O);K.start(P),K.update(a.toDer(E)),K.finish(),I=K.output.getBytes(),d=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(N["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,C),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,s.getBytes())])])}else{var r=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw r.algorithm=v.algorithm,r}var G=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[d,a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,I)]);return G},p.decryptPrivateKeyInfo=function(E,u){var v=null,C={},y=[];if(!a.validate(E,S,C,y)){var s=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=y,s}var h=a.derToOid(C.encryptionOid),d=p.pbe.getCipher(h,C.encryptionParams,u),I=i.util.createBuffer(C.encryptedData);return d.update(I),d.finish()&&(v=a.fromDer(d.output)),v},p.encryptedPrivateKeyToPem=function(E,u){var v={type:"ENCRYPTED PRIVATE KEY",body:a.toDer(E).getBytes()};return i.pem.encode(v,{maxline:u})},p.encryptedPrivateKeyFromPem=function(E){var u=i.pem.decode(E)[0];if(u.type!=="ENCRYPTED PRIVATE KEY"){var v=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw v.headerType=u.type,v}if(u.procType&&u.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return a.fromDer(u.body)},p.encryptRsaPrivateKey=function(E,u,v){if(v=v||{},!v.legacy){var C=p.wrapRsaPrivateKey(p.privateKeyToAsn1(E));return C=p.encryptPrivateKeyInfo(C,u,v),p.encryptedPrivateKeyToPem(C)}var y,s,h,d;switch(v.algorithm){case"aes128":y="AES-128-CBC",h=16,s=i.random.getBytesSync(16),d=i.aes.createEncryptionCipher;break;case"aes192":y="AES-192-CBC",h=24,s=i.random.getBytesSync(16),d=i.aes.createEncryptionCipher;break;case"aes256":y="AES-256-CBC",h=32,s=i.random.getBytesSync(16),d=i.aes.createEncryptionCipher;break;case"3des":y="DES-EDE3-CBC",h=24,s=i.random.getBytesSync(8),d=i.des.createEncryptionCipher;break;case"des":y="DES-CBC",h=8,s=i.random.getBytesSync(8),d=i.des.createEncryptionCipher;break;default:var I=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+v.algorithm+'".');throw I.algorithm=v.algorithm,I}var w=i.pbe.opensslDeriveBytes(u,s.substr(0,8),h),l=d(w);l.start(s),l.update(a.toDer(p.privateKeyToAsn1(E))),l.finish();var n={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:y,parameters:i.util.bytesToHex(s).toUpperCase()},body:l.output.getBytes()};return i.pem.encode(n)},p.decryptRsaPrivateKey=function(E,u){var v=null,C=i.pem.decode(E)[0];if(C.type!=="ENCRYPTED PRIVATE KEY"&&C.type!=="PRIVATE KEY"&&C.type!=="RSA PRIVATE KEY"){var y=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw y.headerType=y,y}if(C.procType&&C.procType.type==="ENCRYPTED"){var s,h;switch(C.dekInfo.algorithm){case"DES-CBC":s=8,h=i.des.createDecryptionCipher;break;case"DES-EDE3-CBC":s=24,h=i.des.createDecryptionCipher;break;case"AES-128-CBC":s=16,h=i.aes.createDecryptionCipher;break;case"AES-192-CBC":s=24,h=i.aes.createDecryptionCipher;break;case"AES-256-CBC":s=32,h=i.aes.createDecryptionCipher;break;case"RC2-40-CBC":s=5,h=function(n){return i.rc2.createDecryptionCipher(n,40)};break;case"RC2-64-CBC":s=8,h=function(n){return i.rc2.createDecryptionCipher(n,64)};break;case"RC2-128-CBC":s=16,h=function(n){return i.rc2.createDecryptionCipher(n,128)};break;default:var y=new Error('Could not decrypt private key; unsupported encryption algorithm "'+C.dekInfo.algorithm+'".');throw y.algorithm=C.dekInfo.algorithm,y}var d=i.util.hexToBytes(C.dekInfo.parameters),I=i.pbe.opensslDeriveBytes(u,d.substr(0,8),s),w=h(I);if(w.start(d),w.update(i.util.createBuffer(C.body)),w.finish())v=w.output.getBytes();else return v}else v=C.body;return C.type==="ENCRYPTED PRIVATE KEY"?v=p.decryptPrivateKeyInfo(a.fromDer(v),u):v=a.fromDer(v),v!==null&&(v=p.privateKeyFromAsn1(v)),v},p.pbe.generatePkcs12Key=function(E,u,v,C,y,s){var h,d;if(typeof s>"u"||s===null){if(!("sha1"in i.md))throw new Error('"sha1" hash algorithm unavailable.');s=i.md.sha1.create()}var I=s.digestLength,w=s.blockLength,l=new i.util.ByteBuffer,n=new i.util.ByteBuffer;if(E!=null){for(d=0;d<E.length;d++)n.putInt16(E.charCodeAt(d));n.putInt16(0)}var r=n.length(),A=u.length(),k=new i.util.ByteBuffer;k.fillWithByte(v,w);var O=w*Math.ceil(A/w),P=new i.util.ByteBuffer;for(d=0;d<O;d++)P.putByte(u.at(d%A));var K=w*Math.ceil(r/w),q=new i.util.ByteBuffer;for(d=0;d<K;d++)q.putByte(n.at(d%r));var M=P;M.putBuffer(q);for(var G=Math.ceil(y/I),Y=1;Y<=G;Y++){var W=new i.util.ByteBuffer;W.putBytes(k.bytes()),W.putBytes(M.bytes());for(var ee=0;ee<C;ee++)s.start(),s.update(W.getBytes()),W=s.digest();var ie=new i.util.ByteBuffer;for(d=0;d<w;d++)ie.putByte(W.at(d%I));var ne=Math.ceil(A/w)+Math.ceil(r/w),he=new i.util.ByteBuffer;for(h=0;h<ne;h++){var ve=new i.util.ByteBuffer(M.getBytes(w)),fe=511;for(d=ie.length()-1;d>=0;d--)fe=fe>>8,fe+=ie.at(d)+ve.at(d),ve.setAt(d,fe&255);he.putBuffer(ve)}M=he,l.putBuffer(W)}return l.truncate(l.length()-y),l},p.pbe.getCipher=function(E,u,v){switch(E){case p.oids.pkcs5PBES2:return p.pbe.getCipherForPBES2(E,u,v);case p.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case p.oids["pbewithSHAAnd40BitRC2-CBC"]:return p.pbe.getCipherForPKCS12PBE(E,u,v);default:var C=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw C.oid=E,C.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],C}},p.pbe.getCipherForPBES2=function(E,u,v){var C={},y=[];if(!a.validate(u,c,C,y)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=y,s}if(E=a.derToOid(C.kdfOid),E!==p.oids.pkcs5PBKDF2){var s=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw s.oid=E,s.supportedOids=["pkcs5PBKDF2"],s}if(E=a.derToOid(C.encOid),E!==p.oids["aes128-CBC"]&&E!==p.oids["aes192-CBC"]&&E!==p.oids["aes256-CBC"]&&E!==p.oids["des-EDE3-CBC"]&&E!==p.oids.desCBC){var s=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw s.oid=E,s.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],s}var h=C.kdfSalt,d=i.util.createBuffer(C.kdfIterationCount);d=d.getInt(d.length()<<3);var I,w;switch(p.oids[E]){case"aes128-CBC":I=16,w=i.aes.createDecryptionCipher;break;case"aes192-CBC":I=24,w=i.aes.createDecryptionCipher;break;case"aes256-CBC":I=32,w=i.aes.createDecryptionCipher;break;case"des-EDE3-CBC":I=24,w=i.des.createDecryptionCipher;break;case"desCBC":I=8,w=i.des.createDecryptionCipher;break}var l=f(C.prfOid),n=i.pkcs5.pbkdf2(v,h,d,I,l),r=C.encIv,A=w(n);return A.start(r),A},p.pbe.getCipherForPKCS12PBE=function(E,u,v){var C={},y=[];if(!a.validate(u,t,C,y)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=y,s}var h=i.util.createBuffer(C.salt),d=i.util.createBuffer(C.iterations);d=d.getInt(d.length()<<3);var I,w,l;switch(E){case p.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:I=24,w=8,l=i.des.startDecrypting;break;case p.oids["pbewithSHAAnd40BitRC2-CBC"]:I=5,w=8,l=function(O,P){var K=i.rc2.createDecryptionCipher(O,40);return K.start(P,null),K};break;default:var s=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw s.oid=E,s}var n=f(C.prfOid),r=p.pbe.generatePkcs12Key(v,h,1,d,I,n);n.start();var A=p.pbe.generatePkcs12Key(v,h,2,d,w,n);return l(r,A)},p.pbe.opensslDeriveBytes=function(E,u,v,C){if(typeof C>"u"||C===null){if(!("md5"in i.md))throw new Error('"md5" hash algorithm unavailable.');C=i.md.md5.create()}u===null&&(u="");for(var y=[g(C,E+u)],s=16,h=1;s<v;++h,s+=16)y.push(g(C,y[h-1]+E+u));return y.join("").substr(0,v)};function g(E,u){return E.start().update(u).digest().getBytes()}function f(E){var u;if(!E)u="hmacWithSHA1";else if(u=p.oids[a.derToOid(E)],!u){var v=new Error("Unsupported PRF OID.");throw v.oid=E,v.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],v}return x(u)}function x(E){var u=i.md;switch(E){case"hmacWithSHA224":u=i.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":E=E.substr(8).toLowerCase();break;default:var v=new Error("Unsupported PRF algorithm.");throw v.algorithm=E,v.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],v}if(!u||!(E in u))throw new Error("Unknown hash algorithm: "+E);return u[E].create()}function D(E,u,v,C){var y=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,E),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,u.getBytes())]);return C!=="hmacWithSHA1"&&y.value.push(a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,i.util.hexToBytes(v.toString(16))),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(p.oids[C]).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")])),y}return er}var tr={exports:{}},rr={exports:{}},jr;function Zr(){if(jr)return rr.exports;jr=1;var i=ue();tt(),ce();var e=i.asn1,a=rr.exports=i.pkcs7asn1=i.pkcs7asn1||{};i.pkcs7=i.pkcs7||{},i.pkcs7.asn1=a;var p={name:"ContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};a.contentInfoValidator=p;var N={name:"EncryptedContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};a.envelopedDataValidator={name:"EnvelopedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(N)},a.encryptedDataValidator={name:"EncryptedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"}].concat(N)};var S={name:"SignerInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};return a.signedDataValidator={name:"SignedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},p,{name:"SignedData.Certificates",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,capture:"signerInfos",optional:!0,value:[S]}]},a.recipientInfoValidator={name:"RecipientInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]},rr.exports}var ar={exports:{}},ir={exports:{}},$r;function Jr(){if($r)return ir.exports;$r=1;var i=ue();ce(),i.mgf=i.mgf||{};var e=ir.exports=i.mgf.mgf1=i.mgf1=i.mgf1||{};return e.create=function(a){var p={generate:function(N,S){for(var c=new i.util.ByteBuffer,t=Math.ceil(S/a.digestLength),g=0;g<t;g++){var f=new i.util.ByteBuffer;f.putInt32(g),a.start(),a.update(N+f.getBytes()),c.putBuffer(a.digest())}return c.truncate(c.length()-S),c.getBytes()}};return p},ir.exports}var nr,ea;function ba(){if(ea)return nr;ea=1;var i=ue();return Jr(),nr=i.mgf=i.mgf||{},i.mgf.mgf1=i.mgf1,nr}var sr={exports:{}},ta;function or(){if(ta)return sr.exports;ta=1;var i=ue();je(),ce();var e=sr.exports=i.pss=i.pss||{};return e.create=function(a){arguments.length===3&&(a={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var p=a.md,N=a.mgf,S=p.digestLength,c=a.salt||null;typeof c=="string"&&(c=i.util.createBuffer(c));var t;if("saltLength"in a)t=a.saltLength;else if(c!==null)t=c.length();else throw new Error("Salt length not specified or specific salt not given.");if(c!==null&&c.length()!==t)throw new Error("Given salt length does not match length of given salt.");var g=a.prng||i.random,f={};return f.encode=function(x,D){var E,u=D-1,v=Math.ceil(u/8),C=x.digest().getBytes();if(v<S+t+2)throw new Error("Message is too long to encrypt.");var y;c===null?y=g.getBytesSync(t):y=c.bytes();var s=new i.util.ByteBuffer;s.fillWithByte(0,8),s.putBytes(C),s.putBytes(y),p.start(),p.update(s.getBytes());var h=p.digest().getBytes(),d=new i.util.ByteBuffer;d.fillWithByte(0,v-t-S-2),d.putByte(1),d.putBytes(y);var I=d.getBytes(),w=v-S-1,l=N.generate(h,w),n="";for(E=0;E<w;E++)n+=String.fromCharCode(I.charCodeAt(E)^l.charCodeAt(E));var r=65280>>8*v-u&255;return n=String.fromCharCode(n.charCodeAt(0)&~r)+n.substr(1),n+h+"¼"},f.verify=function(x,D,E){var u,v=E-1,C=Math.ceil(v/8);if(D=D.substr(-C),C<S+t+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(D.charCodeAt(C-1)!==188)throw new Error("Encoded message does not end in 0xBC.");var y=C-S-1,s=D.substr(0,y),h=D.substr(y,S),d=65280>>8*C-v&255;if((s.charCodeAt(0)&d)!==0)throw new Error("Bits beyond keysize not zero as expected.");var I=N.generate(h,y),w="";for(u=0;u<y;u++)w+=String.fromCharCode(s.charCodeAt(u)^I.charCodeAt(u));w=String.fromCharCode(w.charCodeAt(0)&~d)+w.substr(1);var l=C-S-t-2;for(u=0;u<l;u++)if(w.charCodeAt(u)!==0)throw new Error("Leftmost octets not zero as expected");if(w.charCodeAt(l)!==1)throw new Error("Inconsistent PSS signature, 0x01 marker not found");var n=w.substr(-t),r=new i.util.ByteBuffer;r.fillWithByte(0,8),r.putBytes(x),r.putBytes(n),p.start(),p.update(r.getBytes());var A=p.digest().getBytes();return h===A},f},sr.exports}var ra;function ur(){if(ra)return ar.exports;ra=1;var i=ue();ut(),tt(),Ct(),at(),ba(),ft(),ct(),or(),St(),ce();var e=i.asn1,a=ar.exports=i.pki=i.pki||{},p=a.oids,N={};N.CN=p.commonName,N.commonName="CN",N.C=p.countryName,N.countryName="C",N.L=p.localityName,N.localityName="L",N.ST=p.stateOrProvinceName,N.stateOrProvinceName="ST",N.O=p.organizationName,N.organizationName="O",N.OU=p.organizationalUnitName,N.organizationalUnitName="OU",N.E=p.emailAddress,N.emailAddress="E";var S=i.pki.rsa.publicKeyValidator,c={name:"Certificate",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:e.Class.UNIVERSAL,type:e.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:e.Class.UNIVERSAL,type:e.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:e.Class.UNIVERSAL,type:e.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:e.Class.UNIVERSAL,type:e.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},S,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:e.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:e.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},t={name:"rsapss",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:e.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:e.Class.UNIVERSAL,type:e.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:e.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:e.Class.UNIVERSAL,type:e.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},g={name:"CertificationRequestInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},S,{name:"CertificationRequestInfo.attributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0}]}]}]},f={name:"CertificationRequest",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[g,{name:"CertificationRequest.signatureAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};a.RDNAttributesAsArray=function(l,n){for(var r=[],A,k,O,P=0;P<l.value.length;++P){A=l.value[P];for(var K=0;K<A.value.length;++K)O={},k=A.value[K],O.type=e.derToOid(k.value[0].value),O.value=k.value[1].value,O.valueTagClass=k.value[1].type,O.type in p&&(O.name=p[O.type],O.name in N&&(O.shortName=N[O.name])),n&&(n.update(O.type),n.update(O.value)),r.push(O)}return r},a.CRIAttributesAsArray=function(l){for(var n=[],r=0;r<l.length;++r)for(var A=l[r],k=e.derToOid(A.value[0].value),O=A.value[1].value,P=0;P<O.length;++P){var K={};if(K.type=k,K.value=O[P].value,K.valueTagClass=O[P].type,K.type in p&&(K.name=p[K.type],K.name in N&&(K.shortName=N[K.name])),K.type===p.extensionRequest){K.extensions=[];for(var q=0;q<K.value.length;++q)K.extensions.push(a.certificateExtensionFromAsn1(K.value[q]))}n.push(K)}return n};function x(l,n){typeof n=="string"&&(n={shortName:n});for(var r=null,A,k=0;r===null&&k<l.attributes.length;++k)A=l.attributes[k],(n.type&&n.type===A.type||n.name&&n.name===A.name||n.shortName&&n.shortName===A.shortName)&&(r=A);return r}var D=function(l,n,r){var A={};if(l!==p["RSASSA-PSS"])return A;r&&(A={hash:{algorithmOid:p.sha1},mgf:{algorithmOid:p.mgf1,hash:{algorithmOid:p.sha1}},saltLength:20});var k={},O=[];if(!e.validate(n,t,k,O)){var P=new Error("Cannot read RSASSA-PSS parameter block.");throw P.errors=O,P}return k.hashOid!==void 0&&(A.hash=A.hash||{},A.hash.algorithmOid=e.derToOid(k.hashOid)),k.maskGenOid!==void 0&&(A.mgf=A.mgf||{},A.mgf.algorithmOid=e.derToOid(k.maskGenOid),A.mgf.hash=A.mgf.hash||{},A.mgf.hash.algorithmOid=e.derToOid(k.maskGenHashOid)),k.saltLength!==void 0&&(A.saltLength=k.saltLength.charCodeAt(0)),A},E=function(l){switch(p[l.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return i.md.sha1.create();case"md5WithRSAEncryption":return i.md.md5.create();case"sha256WithRSAEncryption":return i.md.sha256.create();case"sha384WithRSAEncryption":return i.md.sha384.create();case"sha512WithRSAEncryption":return i.md.sha512.create();case"RSASSA-PSS":return i.md.sha256.create();default:var n=new Error("Could not compute "+l.type+" digest. Unknown signature OID.");throw n.signatureOid=l.signatureOid,n}},u=function(l){var n=l.certificate,r;switch(n.signatureOid){case p.sha1WithRSAEncryption:case p.sha1WithRSASignature:break;case p["RSASSA-PSS"]:var A,k;if(A=p[n.signatureParameters.mgf.hash.algorithmOid],A===void 0||i.md[A]===void 0){var O=new Error("Unsupported MGF hash function.");throw O.oid=n.signatureParameters.mgf.hash.algorithmOid,O.name=A,O}if(k=p[n.signatureParameters.mgf.algorithmOid],k===void 0||i.mgf[k]===void 0){var O=new Error("Unsupported MGF function.");throw O.oid=n.signatureParameters.mgf.algorithmOid,O.name=k,O}if(k=i.mgf[k].create(i.md[A].create()),A=p[n.signatureParameters.hash.algorithmOid],A===void 0||i.md[A]===void 0){var O=new Error("Unsupported RSASSA-PSS hash function.");throw O.oid=n.signatureParameters.hash.algorithmOid,O.name=A,O}r=i.pss.create(i.md[A].create(),k,n.signatureParameters.saltLength);break}return n.publicKey.verify(l.md.digest().getBytes(),l.signature,r)};a.certificateFromPem=function(l,n,r){var A=i.pem.decode(l)[0];if(A.type!=="CERTIFICATE"&&A.type!=="X509 CERTIFICATE"&&A.type!=="TRUSTED CERTIFICATE"){var k=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw k.headerType=A.type,k}if(A.procType&&A.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var O=e.fromDer(A.body,r);return a.certificateFromAsn1(O,n)},a.certificateToPem=function(l,n){var r={type:"CERTIFICATE",body:e.toDer(a.certificateToAsn1(l)).getBytes()};return i.pem.encode(r,{maxline:n})},a.publicKeyFromPem=function(l){var n=i.pem.decode(l)[0];if(n.type!=="PUBLIC KEY"&&n.type!=="RSA PUBLIC KEY"){var r=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw r.headerType=n.type,r}if(n.procType&&n.procType.type==="ENCRYPTED")throw new Error("Could not convert public key from PEM; PEM is encrypted.");var A=e.fromDer(n.body);return a.publicKeyFromAsn1(A)},a.publicKeyToPem=function(l,n){var r={type:"PUBLIC KEY",body:e.toDer(a.publicKeyToAsn1(l)).getBytes()};return i.pem.encode(r,{maxline:n})},a.publicKeyToRSAPublicKeyPem=function(l,n){var r={type:"RSA PUBLIC KEY",body:e.toDer(a.publicKeyToRSAPublicKey(l)).getBytes()};return i.pem.encode(r,{maxline:n})},a.getPublicKeyFingerprint=function(l,n){n=n||{};var r=n.md||i.md.sha1.create(),A=n.type||"RSAPublicKey",k;switch(A){case"RSAPublicKey":k=e.toDer(a.publicKeyToRSAPublicKey(l)).getBytes();break;case"SubjectPublicKeyInfo":k=e.toDer(a.publicKeyToAsn1(l)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+n.type+'".')}r.start(),r.update(k);var O=r.digest();if(n.encoding==="hex"){var P=O.toHex();return n.delimiter?P.match(/.{2}/g).join(n.delimiter):P}else{if(n.encoding==="binary")return O.getBytes();if(n.encoding)throw new Error('Unknown encoding "'+n.encoding+'".')}return O},a.certificationRequestFromPem=function(l,n,r){var A=i.pem.decode(l)[0];if(A.type!=="CERTIFICATE REQUEST"){var k=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw k.headerType=A.type,k}if(A.procType&&A.procType.type==="ENCRYPTED")throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var O=e.fromDer(A.body,r);return a.certificationRequestFromAsn1(O,n)},a.certificationRequestToPem=function(l,n){var r={type:"CERTIFICATE REQUEST",body:e.toDer(a.certificationRequestToAsn1(l)).getBytes()};return i.pem.encode(r,{maxline:n})},a.createCertificate=function(){var l={};return l.version=2,l.serialNumber="00",l.signatureOid=null,l.signature=null,l.siginfo={},l.siginfo.algorithmOid=null,l.validity={},l.validity.notBefore=new Date,l.validity.notAfter=new Date,l.issuer={},l.issuer.getField=function(n){return x(l.issuer,n)},l.issuer.addField=function(n){C([n]),l.issuer.attributes.push(n)},l.issuer.attributes=[],l.issuer.hash=null,l.subject={},l.subject.getField=function(n){return x(l.subject,n)},l.subject.addField=function(n){C([n]),l.subject.attributes.push(n)},l.subject.attributes=[],l.subject.hash=null,l.extensions=[],l.publicKey=null,l.md=null,l.setSubject=function(n,r){C(n),l.subject.attributes=n,delete l.subject.uniqueId,r&&(l.subject.uniqueId=r),l.subject.hash=null},l.setIssuer=function(n,r){C(n),l.issuer.attributes=n,delete l.issuer.uniqueId,r&&(l.issuer.uniqueId=r),l.issuer.hash=null},l.setExtensions=function(n){for(var r=0;r<n.length;++r)y(n[r],{cert:l});l.extensions=n},l.getExtension=function(n){typeof n=="string"&&(n={name:n});for(var r=null,A,k=0;r===null&&k<l.extensions.length;++k)A=l.extensions[k],(n.id&&A.id===n.id||n.name&&A.name===n.name)&&(r=A);return r},l.sign=function(n,r){l.md=r||i.md.sha1.create();var A=p[l.md.algorithm+"WithRSAEncryption"];if(!A){var k=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw k.algorithm=l.md.algorithm,k}l.signatureOid=l.siginfo.algorithmOid=A,l.tbsCertificate=a.getTBSCertificate(l);var O=e.toDer(l.tbsCertificate);l.md.update(O.getBytes()),l.signature=n.sign(l.md)},l.verify=function(n){var r=!1;if(!l.issued(n)){var A=n.issuer,k=l.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=k.attributes,O.actualIssuer=A.attributes,O}var P=n.md;if(P===null){P=E({signatureOid:n.signatureOid,type:"certificate"});var K=n.tbsCertificate||a.getTBSCertificate(n),q=e.toDer(K);P.update(q.getBytes())}return P!==null&&(r=u({certificate:l,md:P,signature:n.signature})),r},l.isIssuer=function(n){var r=!1,A=l.issuer,k=n.subject;if(A.hash&&k.hash)r=A.hash===k.hash;else if(A.attributes.length===k.attributes.length){r=!0;for(var O,P,K=0;r&&K<A.attributes.length;++K)O=A.attributes[K],P=k.attributes[K],(O.type!==P.type||O.value!==P.value)&&(r=!1)}return r},l.issued=function(n){return n.isIssuer(l)},l.generateSubjectKeyIdentifier=function(){return a.getPublicKeyFingerprint(l.publicKey,{type:"RSAPublicKey"})},l.verifySubjectKeyIdentifier=function(){for(var n=p.subjectKeyIdentifier,r=0;r<l.extensions.length;++r){var A=l.extensions[r];if(A.id===n){var k=l.generateSubjectKeyIdentifier().getBytes();return i.util.hexToBytes(A.subjectKeyIdentifier)===k}}return!1},l},a.certificateFromAsn1=function(l,n){var r={},A=[];if(!e.validate(l,c,r,A)){var k=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw k.errors=A,k}var O=e.derToOid(r.publicKeyOid);if(O!==a.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var P=a.createCertificate();P.version=r.certVersion?r.certVersion.charCodeAt(0):0;var K=i.util.createBuffer(r.certSerialNumber);P.serialNumber=K.toHex(),P.signatureOid=i.asn1.derToOid(r.certSignatureOid),P.signatureParameters=D(P.signatureOid,r.certSignatureParams,!0),P.siginfo.algorithmOid=i.asn1.derToOid(r.certinfoSignatureOid),P.siginfo.parameters=D(P.siginfo.algorithmOid,r.certinfoSignatureParams,!1),P.signature=r.certSignature;var q=[];if(r.certValidity1UTCTime!==void 0&&q.push(e.utcTimeToDate(r.certValidity1UTCTime)),r.certValidity2GeneralizedTime!==void 0&&q.push(e.generalizedTimeToDate(r.certValidity2GeneralizedTime)),r.certValidity3UTCTime!==void 0&&q.push(e.utcTimeToDate(r.certValidity3UTCTime)),r.certValidity4GeneralizedTime!==void 0&&q.push(e.generalizedTimeToDate(r.certValidity4GeneralizedTime)),q.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(q.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(P.validity.notBefore=q[0],P.validity.notAfter=q[1],P.tbsCertificate=r.tbsCertificate,n){P.md=E({signatureOid:P.signatureOid,type:"certificate"});var M=e.toDer(P.tbsCertificate);P.md.update(M.getBytes())}var G=i.md.sha1.create(),Y=e.toDer(r.certIssuer);G.update(Y.getBytes()),P.issuer.getField=function(ie){return x(P.issuer,ie)},P.issuer.addField=function(ie){C([ie]),P.issuer.attributes.push(ie)},P.issuer.attributes=a.RDNAttributesAsArray(r.certIssuer),r.certIssuerUniqueId&&(P.issuer.uniqueId=r.certIssuerUniqueId),P.issuer.hash=G.digest().toHex();var W=i.md.sha1.create(),ee=e.toDer(r.certSubject);return W.update(ee.getBytes()),P.subject.getField=function(ie){return x(P.subject,ie)},P.subject.addField=function(ie){C([ie]),P.subject.attributes.push(ie)},P.subject.attributes=a.RDNAttributesAsArray(r.certSubject),r.certSubjectUniqueId&&(P.subject.uniqueId=r.certSubjectUniqueId),P.subject.hash=W.digest().toHex(),r.certExtensions?P.extensions=a.certificateExtensionsFromAsn1(r.certExtensions):P.extensions=[],P.publicKey=a.publicKeyFromAsn1(r.subjectPublicKeyInfo),P},a.certificateExtensionsFromAsn1=function(l){for(var n=[],r=0;r<l.value.length;++r)for(var A=l.value[r],k=0;k<A.value.length;++k)n.push(a.certificateExtensionFromAsn1(A.value[k]));return n},a.certificateExtensionFromAsn1=function(l){var n={};if(n.id=e.derToOid(l.value[0].value),n.critical=!1,l.value[1].type===e.Type.BOOLEAN?(n.critical=l.value[1].value.charCodeAt(0)!==0,n.value=l.value[2].value):n.value=l.value[1].value,n.id in p){if(n.name=p[n.id],n.name==="keyUsage"){var r=e.fromDer(n.value),A=0,k=0;r.value.length>1&&(A=r.value.charCodeAt(1),k=r.value.length>2?r.value.charCodeAt(2):0),n.digitalSignature=(A&128)===128,n.nonRepudiation=(A&64)===64,n.keyEncipherment=(A&32)===32,n.dataEncipherment=(A&16)===16,n.keyAgreement=(A&8)===8,n.keyCertSign=(A&4)===4,n.cRLSign=(A&2)===2,n.encipherOnly=(A&1)===1,n.decipherOnly=(k&128)===128}else if(n.name==="basicConstraints"){var r=e.fromDer(n.value);r.value.length>0&&r.value[0].type===e.Type.BOOLEAN?n.cA=r.value[0].value.charCodeAt(0)!==0:n.cA=!1;var O=null;r.value.length>0&&r.value[0].type===e.Type.INTEGER?O=r.value[0].value:r.value.length>1&&(O=r.value[1].value),O!==null&&(n.pathLenConstraint=e.derToInteger(O))}else if(n.name==="extKeyUsage")for(var r=e.fromDer(n.value),P=0;P<r.value.length;++P){var K=e.derToOid(r.value[P].value);K in p?n[p[K]]=!0:n[K]=!0}else if(n.name==="nsCertType"){var r=e.fromDer(n.value),A=0;r.value.length>1&&(A=r.value.charCodeAt(1)),n.client=(A&128)===128,n.server=(A&64)===64,n.email=(A&32)===32,n.objsign=(A&16)===16,n.reserved=(A&8)===8,n.sslCA=(A&4)===4,n.emailCA=(A&2)===2,n.objCA=(A&1)===1}else if(n.name==="subjectAltName"||n.name==="issuerAltName"){n.altNames=[];for(var q,r=e.fromDer(n.value),M=0;M<r.value.length;++M){q=r.value[M];var G={type:q.type,value:q.value};switch(n.altNames.push(G),q.type){case 1:case 2:case 6:break;case 7:G.ip=i.util.bytesToIP(q.value);break;case 8:G.oid=e.derToOid(q.value);break}}}else if(n.name==="subjectKeyIdentifier"){var r=e.fromDer(n.value);n.subjectKeyIdentifier=i.util.bytesToHex(r.value)}}return n},a.certificationRequestFromAsn1=function(l,n){var r={},A=[];if(!e.validate(l,f,r,A)){var k=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw k.errors=A,k}var O=e.derToOid(r.publicKeyOid);if(O!==a.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var P=a.createCertificationRequest();if(P.version=r.csrVersion?r.csrVersion.charCodeAt(0):0,P.signatureOid=i.asn1.derToOid(r.csrSignatureOid),P.signatureParameters=D(P.signatureOid,r.csrSignatureParams,!0),P.siginfo.algorithmOid=i.asn1.derToOid(r.csrSignatureOid),P.siginfo.parameters=D(P.siginfo.algorithmOid,r.csrSignatureParams,!1),P.signature=r.csrSignature,P.certificationRequestInfo=r.certificationRequestInfo,n){P.md=E({signatureOid:P.signatureOid,type:"certification request"});var K=e.toDer(P.certificationRequestInfo);P.md.update(K.getBytes())}var q=i.md.sha1.create();return P.subject.getField=function(M){return x(P.subject,M)},P.subject.addField=function(M){C([M]),P.subject.attributes.push(M)},P.subject.attributes=a.RDNAttributesAsArray(r.certificationRequestInfoSubject,q),P.subject.hash=q.digest().toHex(),P.publicKey=a.publicKeyFromAsn1(r.subjectPublicKeyInfo),P.getAttribute=function(M){return x(P,M)},P.addAttribute=function(M){C([M]),P.attributes.push(M)},P.attributes=a.CRIAttributesAsArray(r.certificationRequestInfoAttributes||[]),P},a.createCertificationRequest=function(){var l={};return l.version=0,l.signatureOid=null,l.signature=null,l.siginfo={},l.siginfo.algorithmOid=null,l.subject={},l.subject.getField=function(n){return x(l.subject,n)},l.subject.addField=function(n){C([n]),l.subject.attributes.push(n)},l.subject.attributes=[],l.subject.hash=null,l.publicKey=null,l.attributes=[],l.getAttribute=function(n){return x(l,n)},l.addAttribute=function(n){C([n]),l.attributes.push(n)},l.md=null,l.setSubject=function(n){C(n),l.subject.attributes=n,l.subject.hash=null},l.setAttributes=function(n){C(n),l.attributes=n},l.sign=function(n,r){l.md=r||i.md.sha1.create();var A=p[l.md.algorithm+"WithRSAEncryption"];if(!A){var k=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw k.algorithm=l.md.algorithm,k}l.signatureOid=l.siginfo.algorithmOid=A,l.certificationRequestInfo=a.getCertificationRequestInfo(l);var O=e.toDer(l.certificationRequestInfo);l.md.update(O.getBytes()),l.signature=n.sign(l.md)},l.verify=function(){var n=!1,r=l.md;if(r===null){r=E({signatureOid:l.signatureOid,type:"certification request"});var A=l.certificationRequestInfo||a.getCertificationRequestInfo(l),k=e.toDer(A);r.update(k.getBytes())}return r!==null&&(n=u({certificate:l,md:r,signature:l.signature})),n},l};function v(l){for(var n=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),r,A,k=l.attributes,O=0;O<k.length;++O){r=k[O];var P=r.value,K=e.Type.PRINTABLESTRING;"valueTagClass"in r&&(K=r.valueTagClass,K===e.Type.UTF8&&(P=i.util.encodeUtf8(P))),A=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.type).getBytes()),e.create(e.Class.UNIVERSAL,K,!1,P)])]),n.value.push(A)}return n}function C(l){for(var n,r=0;r<l.length;++r){if(n=l[r],typeof n.name>"u"&&(n.type&&n.type in a.oids?n.name=a.oids[n.type]:n.shortName&&n.shortName in N&&(n.name=a.oids[N[n.shortName]])),typeof n.type>"u")if(n.name&&n.name in a.oids)n.type=a.oids[n.name];else{var A=new Error("Attribute type not specified.");throw A.attribute=n,A}if(typeof n.shortName>"u"&&n.name&&n.name in N&&(n.shortName=N[n.name]),n.type===p.extensionRequest&&(n.valueConstructed=!0,n.valueTagClass=e.Type.SEQUENCE,!n.value&&n.extensions)){n.value=[];for(var k=0;k<n.extensions.length;++k)n.value.push(a.certificateExtensionToAsn1(y(n.extensions[k])))}if(typeof n.value>"u"){var A=new Error("Attribute value not specified.");throw A.attribute=n,A}}}function y(l,n){if(n=n||{},typeof l.name>"u"&&l.id&&l.id in a.oids&&(l.name=a.oids[l.id]),typeof l.id>"u")if(l.name&&l.name in a.oids)l.id=a.oids[l.name];else{var r=new Error("Extension ID not specified.");throw r.extension=l,r}if(typeof l.value<"u")return l;if(l.name==="keyUsage"){var A=0,k=0,O=0;l.digitalSignature&&(k|=128,A=7),l.nonRepudiation&&(k|=64,A=6),l.keyEncipherment&&(k|=32,A=5),l.dataEncipherment&&(k|=16,A=4),l.keyAgreement&&(k|=8,A=3),l.keyCertSign&&(k|=4,A=2),l.cRLSign&&(k|=2,A=1),l.encipherOnly&&(k|=1,A=0),l.decipherOnly&&(O|=128,A=7);var P=String.fromCharCode(A);O!==0?P+=String.fromCharCode(k)+String.fromCharCode(O):k!==0&&(P+=String.fromCharCode(k)),l.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,P)}else if(l.name==="basicConstraints")l.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),l.cA&&l.value.value.push(e.create(e.Class.UNIVERSAL,e.Type.BOOLEAN,!1,"ÿ")),"pathLenConstraint"in l&&l.value.value.push(e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(l.pathLenConstraint).getBytes()));else if(l.name==="extKeyUsage"){l.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var K=l.value.value;for(var q in l)l[q]===!0&&(q in p?K.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(p[q]).getBytes())):q.indexOf(".")!==-1&&K.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(q).getBytes())))}else if(l.name==="nsCertType"){var A=0,k=0;l.client&&(k|=128,A=7),l.server&&(k|=64,A=6),l.email&&(k|=32,A=5),l.objsign&&(k|=16,A=4),l.reserved&&(k|=8,A=3),l.sslCA&&(k|=4,A=2),l.emailCA&&(k|=2,A=1),l.objCA&&(k|=1,A=0);var P=String.fromCharCode(A);k!==0&&(P+=String.fromCharCode(k)),l.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,P)}else if(l.name==="subjectAltName"||l.name==="issuerAltName"){l.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);for(var M,G=0;G<l.altNames.length;++G){M=l.altNames[G];var P=M.value;if(M.type===7&&M.ip){if(P=i.util.bytesFromIP(M.ip),P===null){var r=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw r.extension=l,r}}else M.type===8&&(M.oid?P=e.oidToDer(e.oidToDer(M.oid)):P=e.oidToDer(P));l.value.value.push(e.create(e.Class.CONTEXT_SPECIFIC,M.type,!1,P))}}else if(l.name==="nsComment"&&n.cert){if(!/^[\x00-\x7F]*$/.test(l.comment)||l.comment.length<1||l.comment.length>128)throw new Error('Invalid "nsComment" content.');l.value=e.create(e.Class.UNIVERSAL,e.Type.IA5STRING,!1,l.comment)}else if(l.name==="subjectKeyIdentifier"&&n.cert){var Y=n.cert.generateSubjectKeyIdentifier();l.subjectKeyIdentifier=Y.toHex(),l.value=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,Y.getBytes())}else if(l.name==="authorityKeyIdentifier"&&n.cert){l.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var K=l.value.value;if(l.keyIdentifier){var W=l.keyIdentifier===!0?n.cert.generateSubjectKeyIdentifier().getBytes():l.keyIdentifier;K.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!1,W))}if(l.authorityCertIssuer){var ee=[e.create(e.Class.CONTEXT_SPECIFIC,4,!0,[v(l.authorityCertIssuer===!0?n.cert.issuer:l.authorityCertIssuer)])];K.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,ee))}if(l.serialNumber){var ie=i.util.hexToBytes(l.serialNumber===!0?n.cert.serialNumber:l.serialNumber);K.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!1,ie))}}else if(l.name==="cRLDistributionPoints"){l.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);for(var K=l.value.value,ne=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),he=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]),M,G=0;G<l.altNames.length;++G){M=l.altNames[G];var P=M.value;if(M.type===7&&M.ip){if(P=i.util.bytesFromIP(M.ip),P===null){var r=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw r.extension=l,r}}else M.type===8&&(M.oid?P=e.oidToDer(e.oidToDer(M.oid)):P=e.oidToDer(P));he.value.push(e.create(e.Class.CONTEXT_SPECIFIC,M.type,!1,P))}ne.value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[he])),K.push(ne)}if(typeof l.value>"u"){var r=new Error("Extension value not specified.");throw r.extension=l,r}return l}function s(l,n){if(l===p["RSASSA-PSS"]){var r=[];return n.hash.algorithmOid!==void 0&&r.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(n.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])])),n.mgf.algorithmOid!==void 0&&r.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(n.mgf.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(n.mgf.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])])])),n.saltLength!==void 0&&r.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(n.saltLength).getBytes())])),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,r)}else return e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")}function h(l){var n=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]);if(l.attributes.length===0)return n;for(var r=l.attributes,A=0;A<r.length;++A){var k=r[A],O=k.value,P=e.Type.UTF8;"valueTagClass"in k&&(P=k.valueTagClass),P===e.Type.UTF8&&(O=i.util.encodeUtf8(O));var K=!1;"valueConstructed"in k&&(K=k.valueConstructed);var q=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(k.type).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,P,K,O)])]);n.value.push(q)}return n}var d=new Date("1950-01-01T00:00:00Z"),I=new Date("2050-01-01T00:00:00Z");function w(l){return l>=d&&l<I?e.create(e.Class.UNIVERSAL,e.Type.UTCTIME,!1,e.dateToUtcTime(l)):e.create(e.Class.UNIVERSAL,e.Type.GENERALIZEDTIME,!1,e.dateToGeneralizedTime(l))}return a.getTBSCertificate=function(l){var n=w(l.validity.notBefore),r=w(l.validity.notAfter),A=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(l.version).getBytes())]),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,i.util.hexToBytes(l.serialNumber)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(l.siginfo.algorithmOid).getBytes()),s(l.siginfo.algorithmOid,l.siginfo.parameters)]),v(l.issuer),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[n,r]),v(l.subject),a.publicKeyToAsn1(l.publicKey)]);return l.issuer.uniqueId&&A.value.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+l.issuer.uniqueId)])),l.subject.uniqueId&&A.value.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!0,[e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+l.subject.uniqueId)])),l.extensions.length>0&&A.value.push(a.certificateExtensionsToAsn1(l.extensions)),A},a.getCertificationRequestInfo=function(l){var n=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(l.version).getBytes()),v(l.subject),a.publicKeyToAsn1(l.publicKey),h(l)]);return n},a.distinguishedNameToAsn1=function(l){return v(l)},a.certificateToAsn1=function(l){var n=l.tbsCertificate||a.getTBSCertificate(l);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[n,e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(l.signatureOid).getBytes()),s(l.signatureOid,l.signatureParameters)]),e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+l.signature)])},a.certificateExtensionsToAsn1=function(l){var n=e.create(e.Class.CONTEXT_SPECIFIC,3,!0,[]),r=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);n.value.push(r);for(var A=0;A<l.length;++A)r.value.push(a.certificateExtensionToAsn1(l[A]));return n},a.certificateExtensionToAsn1=function(l){var n=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);n.value.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(l.id).getBytes())),l.critical&&n.value.push(e.create(e.Class.UNIVERSAL,e.Type.BOOLEAN,!1,"ÿ"));var r=l.value;return typeof l.value!="string"&&(r=e.toDer(r).getBytes()),n.value.push(e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,r)),n},a.certificationRequestToAsn1=function(l){var n=l.certificationRequestInfo||a.getCertificationRequestInfo(l);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[n,e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(l.signatureOid).getBytes()),s(l.signatureOid,l.signatureParameters)]),e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+l.signature)])},a.createCaStore=function(l){var n={certs:{}};n.getIssuer=function(P){var K=r(P.issuer);return K},n.addCertificate=function(P){if(typeof P=="string"&&(P=i.pki.certificateFromPem(P)),A(P.subject),!n.hasCertificate(P))if(P.subject.hash in n.certs){var K=n.certs[P.subject.hash];i.util.isArray(K)||(K=[K]),K.push(P),n.certs[P.subject.hash]=K}else n.certs[P.subject.hash]=P},n.hasCertificate=function(P){typeof P=="string"&&(P=i.pki.certificateFromPem(P));var K=r(P.subject);if(!K)return!1;i.util.isArray(K)||(K=[K]);for(var q=e.toDer(a.certificateToAsn1(P)).getBytes(),M=0;M<K.length;++M){var G=e.toDer(a.certificateToAsn1(K[M])).getBytes();if(q===G)return!0}return!1},n.listAllCertificates=function(){var P=[];for(var K in n.certs)if(n.certs.hasOwnProperty(K)){var q=n.certs[K];if(!i.util.isArray(q))P.push(q);else for(var M=0;M<q.length;++M)P.push(q[M])}return P},n.removeCertificate=function(P){var K;if(typeof P=="string"&&(P=i.pki.certificateFromPem(P)),A(P.subject),!n.hasCertificate(P))return null;var q=r(P.subject);if(!i.util.isArray(q))return K=n.certs[P.subject.hash],delete n.certs[P.subject.hash],K;for(var M=e.toDer(a.certificateToAsn1(P)).getBytes(),G=0;G<q.length;++G){var Y=e.toDer(a.certificateToAsn1(q[G])).getBytes();M===Y&&(K=q[G],q.splice(G,1))}return q.length===0&&delete n.certs[P.subject.hash],K};function r(P){return A(P),n.certs[P.hash]||null}function A(P){if(!P.hash){var K=i.md.sha1.create();P.attributes=a.RDNAttributesAsArray(v(P),K),P.hash=K.digest().toHex()}}if(l)for(var k=0;k<l.length;++k){var O=l[k];n.addCertificate(O)}return n},a.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"},a.verifyCertificateChain=function(l,n,r){typeof r=="function"&&(r={verify:r}),r=r||{},n=n.slice(0);var A=n.slice(0),k=r.validityCheckDate;typeof k>"u"&&(k=new Date);var O=!0,P=null,K=0;do{var q=n.shift(),M=null,G=!1;if(k&&(k<q.validity.notBefore||k>q.validity.notAfter)&&(P={message:"Certificate is not valid yet or has expired.",error:a.certificateError.certificate_expired,notBefore:q.validity.notBefore,notAfter:q.validity.notAfter,now:k}),P===null){if(M=n[0]||l.getIssuer(q),M===null&&q.isIssuer(q)&&(G=!0,M=q),M){var Y=M;i.util.isArray(Y)||(Y=[Y]);for(var W=!1;!W&&Y.length>0;){M=Y.shift();try{W=M.verify(q)}catch{}}W||(P={message:"Certificate signature is invalid.",error:a.certificateError.bad_certificate})}P===null&&(!M||G)&&!l.hasCertificate(q)&&(P={message:"Certificate is not trusted.",error:a.certificateError.unknown_ca})}if(P===null&&M&&!q.isIssuer(M)&&(P={message:"Certificate issuer is invalid.",error:a.certificateError.bad_certificate}),P===null)for(var ee={keyUsage:!0,basicConstraints:!0},ie=0;P===null&&ie<q.extensions.length;++ie){var ne=q.extensions[ie];ne.critical&&!(ne.name in ee)&&(P={message:"Certificate has an unsupported critical extension.",error:a.certificateError.unsupported_certificate})}if(P===null&&(!O||n.length===0&&(!M||G))){var he=q.getExtension("basicConstraints"),ve=q.getExtension("keyUsage");if(ve!==null&&(!ve.keyCertSign||he===null)&&(P={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:a.certificateError.bad_certificate}),P===null&&he===null&&(P={message:"Certificate is missing basicConstraints extension and cannot be used as a CA.",error:a.certificateError.bad_certificate}),P===null&&he!==null&&!he.cA&&(P={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:a.certificateError.bad_certificate}),P===null&&ve!==null&&"pathLenConstraint"in he){var fe=K-1;fe>he.pathLenConstraint&&(P={message:"Certificate basicConstraints pathLenConstraint violated.",error:a.certificateError.bad_certificate})}}var j=P===null?!0:P.error,Z=r.verify?r.verify(j,K,A):j;if(Z===!0)P=null;else throw j===!0&&(P={message:"The application rejected the certificate.",error:a.certificateError.bad_certificate}),(Z||Z===0)&&(typeof Z=="object"&&!i.util.isArray(Z)?(Z.message&&(P.message=Z.message),Z.error&&(P.error=Z.error)):typeof Z=="string"&&(P.error=Z)),P;O=!1,++K}while(n.length>0);return!0},ar.exports}var aa;function ia(){if(aa)return tr.exports;aa=1;var i=ue();tt(),vt(),ft(),Zr(),Wr(),je(),St(),yt(),ce(),ur();var e=i.asn1,a=i.pki,p=tr.exports=i.pkcs12=i.pkcs12||{},N={name:"ContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},S={name:"PFX",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},N,{name:"PFX.macData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",optional:!0,tagClass:e.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},c={name:"SafeBag",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},t={name:"Attribute",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,capture:"values"}]},g={name:"CertBag",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:e.Class.UNIVERSAL,type:e.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function f(C,y,s,h){for(var d=[],I=0;I<C.length;I++)for(var w=0;w<C[I].safeBags.length;w++){var l=C[I].safeBags[w];if(!(h!==void 0&&l.type!==h)){if(y===null){d.push(l);continue}l.attributes[y]!==void 0&&l.attributes[y].indexOf(s)>=0&&d.push(l)}}return d}p.pkcs12FromAsn1=function(C,y,s){typeof y=="string"?(s=y,y=!0):y===void 0&&(y=!0);var h={},d=[];if(!e.validate(C,S,h,d)){var I=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw I.errors=I,I}var w={version:h.version.charCodeAt(0),safeContents:[],getBags:function(M){var G={},Y;return"localKeyId"in M?Y=M.localKeyId:"localKeyIdHex"in M&&(Y=i.util.hexToBytes(M.localKeyIdHex)),Y===void 0&&!("friendlyName"in M)&&"bagType"in M&&(G[M.bagType]=f(w.safeContents,null,null,M.bagType)),Y!==void 0&&(G.localKeyId=f(w.safeContents,"localKeyId",Y,M.bagType)),"friendlyName"in M&&(G.friendlyName=f(w.safeContents,"friendlyName",M.friendlyName,M.bagType)),G},getBagsByFriendlyName:function(M,G){return f(w.safeContents,"friendlyName",M,G)},getBagsByLocalKeyId:function(M,G){return f(w.safeContents,"localKeyId",M,G)}};if(h.version.charCodeAt(0)!==3){var I=new Error("PKCS#12 PFX of version other than 3 not supported.");throw I.version=h.version.charCodeAt(0),I}if(e.derToOid(h.contentType)!==a.oids.data){var I=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw I.oid=e.derToOid(h.contentType),I}var l=h.content.value[0];if(l.tagClass!==e.Class.UNIVERSAL||l.type!==e.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(l=x(l),h.mac){var n=null,r=0,A=e.derToOid(h.macAlgorithm);switch(A){case a.oids.sha1:n=i.md.sha1.create(),r=20;break;case a.oids.sha256:n=i.md.sha256.create(),r=32;break;case a.oids.sha384:n=i.md.sha384.create(),r=48;break;case a.oids.sha512:n=i.md.sha512.create(),r=64;break;case a.oids.md5:n=i.md.md5.create(),r=16;break}if(n===null)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+A);var k=new i.util.ByteBuffer(h.macSalt),O="macIterations"in h?parseInt(i.util.bytesToHex(h.macIterations),16):1,P=p.generateKey(s,k,3,O,r,n),K=i.hmac.create();K.start(n,P),K.update(l.value);var q=K.getMac();if(q.getBytes()!==h.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}else if(Array.isArray(C.value)&&C.value.length>2)throw new Error("Invalid PKCS#12. macData field present but MAC was not validated.");return D(w,l.value,y,s),w};function x(C){if(C.composed||C.constructed){for(var y=i.util.createBuffer(),s=0;s<C.value.length;++s)y.putBytes(C.value[s].value);C.composed=C.constructed=!1,C.value=y.getBytes()}return C}function D(C,y,s,h){if(y=e.fromDer(y,s),y.tagClass!==e.Class.UNIVERSAL||y.type!==e.Type.SEQUENCE||y.constructed!==!0)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var d=0;d<y.value.length;d++){var I=y.value[d],w={},l=[];if(!e.validate(I,N,w,l)){var n=new Error("Cannot read ContentInfo.");throw n.errors=l,n}var r={encrypted:!1},A=null,k=w.content.value[0];switch(e.derToOid(w.contentType)){case a.oids.data:if(k.tagClass!==e.Class.UNIVERSAL||k.type!==e.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");A=x(k).value;break;case a.oids.encryptedData:A=E(k,h),r.encrypted=!0;break;default:var n=new Error("Unsupported PKCS#12 contentType.");throw n.contentType=e.derToOid(w.contentType),n}r.safeBags=u(A,s,h),C.safeContents.push(r)}}function E(C,y){var s={},h=[];if(!e.validate(C,i.pkcs7.asn1.encryptedDataValidator,s,h)){var d=new Error("Cannot read EncryptedContentInfo.");throw d.errors=h,d}var I=e.derToOid(s.contentType);if(I!==a.oids.data){var d=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw d.oid=I,d}I=e.derToOid(s.encAlgorithm);var w=a.pbe.getCipher(I,s.encParameter,y),l=x(s.encryptedContentAsn1),n=i.util.createBuffer(l.value);if(w.update(n),!w.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return w.output.getBytes()}function u(C,y,s){if(!y&&C.length===0)return[];if(C=e.fromDer(C,y),C.tagClass!==e.Class.UNIVERSAL||C.type!==e.Type.SEQUENCE||C.constructed!==!0)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var h=[],d=0;d<C.value.length;d++){var I=C.value[d],w={},l=[];if(!e.validate(I,c,w,l)){var n=new Error("Cannot read SafeBag.");throw n.errors=l,n}var r={type:e.derToOid(w.bagId),attributes:v(w.bagAttributes)};h.push(r);var A,k,O=w.bagValue.value[0];switch(r.type){case a.oids.pkcs8ShroudedKeyBag:if(O=a.decryptPrivateKeyInfo(O,s),O===null)throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case a.oids.keyBag:try{r.key=a.privateKeyFromAsn1(O)}catch{r.key=null,r.asn1=O}continue;case a.oids.certBag:A=g,k=function(){if(e.derToOid(w.certId)!==a.oids.x509Certificate){var K=new Error("Unsupported certificate type, only X.509 supported.");throw K.oid=e.derToOid(w.certId),K}var q=e.fromDer(w.cert,y);try{r.cert=a.certificateFromAsn1(q,!0)}catch{r.cert=null,r.asn1=q}};break;default:var n=new Error("Unsupported PKCS#12 SafeBag type.");throw n.oid=r.type,n}if(A!==void 0&&!e.validate(O,A,w,l)){var n=new Error("Cannot read PKCS#12 "+A.name);throw n.errors=l,n}k()}return h}function v(C){var y={};if(C!==void 0)for(var s=0;s<C.length;++s){var h={},d=[];if(!e.validate(C[s],t,h,d)){var I=new Error("Cannot read PKCS#12 BagAttribute.");throw I.errors=d,I}var w=e.derToOid(h.oid);if(a.oids[w]!==void 0){y[a.oids[w]]=[];for(var l=0;l<h.values.length;++l)y[a.oids[w]].push(h.values[l].value)}}return y}return p.toPkcs12Asn1=function(C,y,s,h){h=h||{},h.saltSize=h.saltSize||8,h.count=h.count||2048,h.algorithm=h.algorithm||h.encAlgorithm||"aes128","useMac"in h||(h.useMac=!0),"localKeyId"in h||(h.localKeyId=null),"generateLocalKeyId"in h||(h.generateLocalKeyId=!0);var d=h.localKeyId,I;if(d!==null)d=i.util.hexToBytes(d);else if(h.generateLocalKeyId)if(y){var w=i.util.isArray(y)?y[0]:y;typeof w=="string"&&(w=a.certificateFromPem(w));var l=i.md.sha1.create();l.update(e.toDer(a.certificateToAsn1(w)).getBytes()),d=l.digest().getBytes()}else d=i.random.getBytes(20);var n=[];d!==null&&n.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.localKeyId).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,d)])])),"friendlyName"in h&&n.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.friendlyName).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.BMPSTRING,!1,h.friendlyName)])])),n.length>0&&(I=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,n));var r=[],A=[];y!==null&&(i.util.isArray(y)?A=y:A=[y]);for(var k=[],O=0;O<A.length;++O){y=A[O],typeof y=="string"&&(y=a.certificateFromPem(y));var P=O===0?I:void 0,K=a.certificateToAsn1(y),q=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.certBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.x509Certificate).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(K).getBytes())])])]),P]);k.push(q)}if(k.length>0){var M=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,k),G=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(M).getBytes())])]);r.push(G)}var Y=null;if(C!==null){var W=a.wrapRsaPrivateKey(a.privateKeyToAsn1(C));s===null?Y=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.keyBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[W]),I]):Y=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.pkcs8ShroudedKeyBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[a.encryptPrivateKeyInfo(W,s,h)]),I]);var ee=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[Y]),ie=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(ee).getBytes())])]);r.push(ie)}var ne=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,r),he;if(h.useMac){var l=i.md.sha1.create(),ve=new i.util.ByteBuffer(i.random.getBytes(h.saltSize)),fe=h.count,C=p.generateKey(s,ve,3,fe,20),j=i.hmac.create();j.start(l,C),j.update(e.toDer(ne).getBytes());var Z=j.getMac();he=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.sha1).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,Z.getBytes())]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,ve.getBytes()),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(fe).getBytes())])}return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(3).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(ne).getBytes())])]),he])},p.generateKey=i.pbe.generatePkcs12Key,tr.exports}var na;function sa(){if(na)return qt.exports;na=1;var i=ue();tt(),ft(),Wr(),ct(),zt(),ia(),or(),St(),ce(),ur();var e=i.asn1,a=qt.exports=i.pki=i.pki||{};return a.pemToDer=function(p){var N=i.pem.decode(p)[0];if(N.procType&&N.procType.type==="ENCRYPTED")throw new Error("Could not convert PEM to DER; PEM is encrypted.");return i.util.createBuffer(N.body)},a.privateKeyFromPem=function(p){var N=i.pem.decode(p)[0];if(N.type!=="PRIVATE KEY"&&N.type!=="RSA PRIVATE KEY"){var S=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw S.headerType=N.type,S}if(N.procType&&N.procType.type==="ENCRYPTED")throw new Error("Could not convert private key from PEM; PEM is encrypted.");var c=e.fromDer(N.body);return a.privateKeyFromAsn1(c)},a.privateKeyToPem=function(p,N){var S={type:"RSA PRIVATE KEY",body:e.toDer(a.privateKeyToAsn1(p)).getBytes()};return i.pem.encode(S,{maxline:N})},a.privateKeyInfoToPem=function(p,N){var S={type:"PRIVATE KEY",body:e.toDer(p).getBytes()};return i.pem.encode(S,{maxline:N})},qt.exports}var fr,oa;function ua(){if(oa)return fr;oa=1;var i=ue();tt(),vt(),Ft(),ct(),sa(),je(),yt(),ce();var e=function(m,L,R,_){var o=i.util.createBuffer(),b=m.length>>1,V=b+(m.length&1),H=m.substr(0,V),ae=m.substr(b,V),te=i.util.createBuffer(),Q=i.hmac.create();R=L+R;var $=Math.ceil(_/16),se=Math.ceil(_/20);Q.start("MD5",H);var le=i.util.createBuffer();te.putBytes(R);for(var oe=0;oe<$;++oe)Q.start(null,null),Q.update(te.getBytes()),te.putBuffer(Q.digest()),Q.start(null,null),Q.update(te.bytes()+R),le.putBuffer(Q.digest());Q.start("SHA1",ae);var me=i.util.createBuffer();te.clear(),te.putBytes(R);for(var oe=0;oe<se;++oe)Q.start(null,null),Q.update(te.getBytes()),te.putBuffer(Q.digest()),Q.start(null,null),Q.update(te.bytes()+R),me.putBuffer(Q.digest());return o.putBytes(i.util.xorBytes(le.getBytes(),me.getBytes(),_)),o},a=function(m,L,R){var _=i.hmac.create();_.start("SHA1",m);var o=i.util.createBuffer();return o.putInt32(L[0]),o.putInt32(L[1]),o.putByte(R.type),o.putByte(R.version.major),o.putByte(R.version.minor),o.putInt16(R.length),o.putBytes(R.fragment.bytes()),_.update(o.getBytes()),_.digest().getBytes()},p=function(m,L,R){var _=!1;try{var o=m.deflate(L.fragment.getBytes());L.fragment=i.util.createBuffer(o),L.length=o.length,_=!0}catch{}return _},N=function(m,L,R){var _=!1;try{var o=m.inflate(L.fragment.getBytes());L.fragment=i.util.createBuffer(o),L.length=o.length,_=!0}catch{}return _},S=function(m,L){var R=0;switch(L){case 1:R=m.getByte();break;case 2:R=m.getInt16();break;case 3:R=m.getInt24();break;case 4:R=m.getInt32();break}return i.util.createBuffer(m.getBytes(R))},c=function(m,L,R){m.putInt(R.length(),L<<3),m.putBuffer(R)},t={};t.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}},t.SupportedVersions=[t.Versions.TLS_1_1,t.Versions.TLS_1_0],t.Version=t.SupportedVersions[0],t.MaxFragment=15360,t.ConnectionEnd={server:0,client:1},t.PRFAlgorithm={tls_prf_sha256:0},t.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},t.CipherType={stream:0,block:1,aead:2},t.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},t.CompressionMethod={none:0,deflate:1},t.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},t.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},t.Alert={},t.Alert.Level={warning:1,fatal:2},t.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},t.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},t.CipherSuites={},t.getCipherSuite=function(m){var L=null;for(var R in t.CipherSuites){var _=t.CipherSuites[R];if(_.id[0]===m.charCodeAt(0)&&_.id[1]===m.charCodeAt(1)){L=_;break}}return L},t.handleUnexpected=function(m,L){var R=!m.open&&m.entity===t.ConnectionEnd.client;R||m.error(m,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.unexpected_message}})},t.handleHelloRequest=function(m,L,R){!m.handshaking&&m.handshakes>0&&(t.queue(m,t.createAlert(m,{level:t.Alert.Level.warning,description:t.Alert.Description.no_renegotiation})),t.flush(m)),m.process()},t.parseHelloMessage=function(m,L,R){var _=null,o=m.entity===t.ConnectionEnd.client;if(R<38)m.error(m,{message:o?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.illegal_parameter}});else{var b=L.fragment,V=b.length();if(_={version:{major:b.getByte(),minor:b.getByte()},random:i.util.createBuffer(b.getBytes(32)),session_id:S(b,1),extensions:[]},o?(_.cipher_suite=b.getBytes(2),_.compression_method=b.getByte()):(_.cipher_suites=S(b,2),_.compression_methods=S(b,1)),V=R-(V-b.length()),V>0){for(var H=S(b,2);H.length()>0;)_.extensions.push({type:[H.getByte(),H.getByte()],data:S(H,2)});if(!o)for(var ae=0;ae<_.extensions.length;++ae){var te=_.extensions[ae];if(te.type[0]===0&&te.type[1]===0)for(var Q=S(te.data,2);Q.length()>0;){var $=Q.getByte();if($!==0)break;m.session.extensions.server_name.serverNameList.push(S(Q,2).getBytes())}}}if(m.session.version&&(_.version.major!==m.session.version.major||_.version.minor!==m.session.version.minor))return m.error(m,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.protocol_version}});if(o)m.session.cipherSuite=t.getCipherSuite(_.cipher_suite);else for(var se=i.util.createBuffer(_.cipher_suites.bytes());se.length()>0&&(m.session.cipherSuite=t.getCipherSuite(se.getBytes(2)),m.session.cipherSuite===null););if(m.session.cipherSuite===null)return m.error(m,{message:"No cipher suites in common.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.handshake_failure},cipherSuite:i.util.bytesToHex(_.cipher_suite)});o?m.session.compressionMethod=_.compression_method:m.session.compressionMethod=t.CompressionMethod.none}return _},t.createSecurityParameters=function(m,L){var R=m.entity===t.ConnectionEnd.client,_=L.random.bytes(),o=R?m.session.sp.client_random:_,b=R?_:t.createRandom().getBytes();m.session.sp={entity:m.entity,prf_algorithm:t.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:m.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:o,server_random:b}},t.handleServerHello=function(m,L,R){var _=t.parseHelloMessage(m,L,R);if(!m.fail){if(_.version.minor<=m.version.minor)m.version.minor=_.version.minor;else return m.error(m,{message:"Incompatible TLS version.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.protocol_version}});m.session.version=m.version;var o=_.session_id.bytes();o.length>0&&o===m.session.id?(m.expect=u,m.session.resuming=!0,m.session.sp.server_random=_.random.bytes()):(m.expect=f,m.session.resuming=!1,t.createSecurityParameters(m,_)),m.session.id=o,m.process()}},t.handleClientHello=function(m,L,R){var _=t.parseHelloMessage(m,L,R);if(!m.fail){var o=_.session_id.bytes(),b=null;if(m.sessionCache&&(b=m.sessionCache.getSession(o),b===null?o="":(b.version.major!==_.version.major||b.version.minor>_.version.minor)&&(b=null,o="")),o.length===0&&(o=i.random.getBytes(32)),m.session.id=o,m.session.clientHelloVersion=_.version,m.session.sp={},b)m.version=m.session.version=b.version,m.session.sp=b.sp;else{for(var V,H=1;H<t.SupportedVersions.length&&(V=t.SupportedVersions[H],!(V.minor<=_.version.minor));++H);m.version={major:V.major,minor:V.minor},m.session.version=m.version}b!==null?(m.expect=w,m.session.resuming=!0,m.session.sp.client_random=_.random.bytes()):(m.expect=m.verifyClient!==!1?h:d,m.session.resuming=!1,t.createSecurityParameters(m,_)),m.open=!0,t.queue(m,t.createRecord(m,{type:t.ContentType.handshake,data:t.createServerHello(m)})),m.session.resuming?(t.queue(m,t.createRecord(m,{type:t.ContentType.change_cipher_spec,data:t.createChangeCipherSpec()})),m.state.pending=t.createConnectionState(m),m.state.current.write=m.state.pending.write,t.queue(m,t.createRecord(m,{type:t.ContentType.handshake,data:t.createFinished(m)}))):(t.queue(m,t.createRecord(m,{type:t.ContentType.handshake,data:t.createCertificate(m)})),m.fail||(t.queue(m,t.createRecord(m,{type:t.ContentType.handshake,data:t.createServerKeyExchange(m)})),m.verifyClient!==!1&&t.queue(m,t.createRecord(m,{type:t.ContentType.handshake,data:t.createCertificateRequest(m)})),t.queue(m,t.createRecord(m,{type:t.ContentType.handshake,data:t.createServerHelloDone(m)})))),t.flush(m),m.process()}},t.handleCertificate=function(m,L,R){if(R<3)return m.error(m,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.illegal_parameter}});var _=L.fragment,o={certificate_list:S(_,3)},b,V,H=[];try{for(;o.certificate_list.length()>0;)b=S(o.certificate_list,3),V=i.asn1.fromDer(b),b=i.pki.certificateFromAsn1(V,!0),H.push(b)}catch(te){return m.error(m,{message:"Could not parse certificate list.",cause:te,send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.bad_certificate}})}var ae=m.entity===t.ConnectionEnd.client;(ae||m.verifyClient===!0)&&H.length===0?m.error(m,{message:ae?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.illegal_parameter}}):H.length===0?m.expect=ae?x:d:(ae?m.session.serverCertificate=H[0]:m.session.clientCertificate=H[0],t.verifyCertificateChain(m,H)&&(m.expect=ae?x:d)),m.process()},t.handleServerKeyExchange=function(m,L,R){if(R>0)return m.error(m,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.unsupported_certificate}});m.expect=D,m.process()},t.handleClientKeyExchange=function(m,L,R){if(R<48)return m.error(m,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.unsupported_certificate}});var _=L.fragment,o={enc_pre_master_secret:S(_,2).getBytes()},b=null;if(m.getPrivateKey)try{b=m.getPrivateKey(m,m.session.serverCertificate),b=i.pki.privateKeyFromPem(b)}catch(ae){m.error(m,{message:"Could not get private key.",cause:ae,send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.internal_error}})}if(b===null)return m.error(m,{message:"No private key set.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.internal_error}});try{var V=m.session.sp;V.pre_master_secret=b.decrypt(o.enc_pre_master_secret);var H=m.session.clientHelloVersion;if(H.major!==V.pre_master_secret.charCodeAt(0)||H.minor!==V.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch{V.pre_master_secret=i.random.getBytes(48)}m.expect=w,m.session.clientCertificate!==null&&(m.expect=I),m.process()},t.handleCertificateRequest=function(m,L,R){if(R<3)return m.error(m,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.illegal_parameter}});var _=L.fragment,o={certificate_types:S(_,1),certificate_authorities:S(_,2)};m.session.certificateRequest=o,m.expect=E,m.process()},t.handleCertificateVerify=function(m,L,R){if(R<2)return m.error(m,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.illegal_parameter}});var _=L.fragment;_.read-=4;var o=_.bytes();_.read+=4;var b={signature:S(_,2).getBytes()},V=i.util.createBuffer();V.putBuffer(m.session.md5.digest()),V.putBuffer(m.session.sha1.digest()),V=V.getBytes();try{var H=m.session.clientCertificate;if(!H.publicKey.verify(V,b.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");m.session.md5.update(o),m.session.sha1.update(o)}catch{return m.error(m,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.handshake_failure}})}m.expect=w,m.process()},t.handleServerHelloDone=function(m,L,R){if(R>0)return m.error(m,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.record_overflow}});if(m.serverCertificate===null){var _={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.insufficient_security}},o=0,b=m.verify(m,_.alert.description,o,[]);if(b!==!0)return(b||b===0)&&(typeof b=="object"&&!i.util.isArray(b)?(b.message&&(_.message=b.message),b.alert&&(_.alert.description=b.alert)):typeof b=="number"&&(_.alert.description=b)),m.error(m,_)}m.session.certificateRequest!==null&&(L=t.createRecord(m,{type:t.ContentType.handshake,data:t.createCertificate(m)}),t.queue(m,L)),L=t.createRecord(m,{type:t.ContentType.handshake,data:t.createClientKeyExchange(m)}),t.queue(m,L),m.expect=y;var V=function(H,ae){H.session.certificateRequest!==null&&H.session.clientCertificate!==null&&t.queue(H,t.createRecord(H,{type:t.ContentType.handshake,data:t.createCertificateVerify(H,ae)})),t.queue(H,t.createRecord(H,{type:t.ContentType.change_cipher_spec,data:t.createChangeCipherSpec()})),H.state.pending=t.createConnectionState(H),H.state.current.write=H.state.pending.write,t.queue(H,t.createRecord(H,{type:t.ContentType.handshake,data:t.createFinished(H)})),H.expect=u,t.flush(H),H.process()};if(m.session.certificateRequest===null||m.session.clientCertificate===null)return V(m,null);t.getClientSignature(m,V)},t.handleChangeCipherSpec=function(m,L){if(L.fragment.getByte()!==1)return m.error(m,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.illegal_parameter}});var R=m.entity===t.ConnectionEnd.client;(m.session.resuming&&R||!m.session.resuming&&!R)&&(m.state.pending=t.createConnectionState(m)),m.state.current.read=m.state.pending.read,(!m.session.resuming&&R||m.session.resuming&&!R)&&(m.state.pending=null),m.expect=R?v:l,m.process()},t.handleFinished=function(m,L,R){var _=L.fragment;_.read-=4;var o=_.bytes();_.read+=4;var b=L.fragment.getBytes();_=i.util.createBuffer(),_.putBuffer(m.session.md5.digest()),_.putBuffer(m.session.sha1.digest());var V=m.entity===t.ConnectionEnd.client,H=V?"server finished":"client finished",ae=m.session.sp,te=12,Q=e;if(_=Q(ae.master_secret,H,_.getBytes(),te),_.getBytes()!==b)return m.error(m,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.decrypt_error}});m.session.md5.update(o),m.session.sha1.update(o),(m.session.resuming&&V||!m.session.resuming&&!V)&&(t.queue(m,t.createRecord(m,{type:t.ContentType.change_cipher_spec,data:t.createChangeCipherSpec()})),m.state.current.write=m.state.pending.write,m.state.pending=null,t.queue(m,t.createRecord(m,{type:t.ContentType.handshake,data:t.createFinished(m)}))),m.expect=V?C:n,m.handshaking=!1,++m.handshakes,m.peerCertificate=V?m.session.serverCertificate:m.session.clientCertificate,t.flush(m),m.isConnected=!0,m.connected(m),m.process()},t.handleAlert=function(m,L){var R=L.fragment,_={level:R.getByte(),description:R.getByte()},o;switch(_.description){case t.Alert.Description.close_notify:o="Connection closed.";break;case t.Alert.Description.unexpected_message:o="Unexpected message.";break;case t.Alert.Description.bad_record_mac:o="Bad record MAC.";break;case t.Alert.Description.decryption_failed:o="Decryption failed.";break;case t.Alert.Description.record_overflow:o="Record overflow.";break;case t.Alert.Description.decompression_failure:o="Decompression failed.";break;case t.Alert.Description.handshake_failure:o="Handshake failure.";break;case t.Alert.Description.bad_certificate:o="Bad certificate.";break;case t.Alert.Description.unsupported_certificate:o="Unsupported certificate.";break;case t.Alert.Description.certificate_revoked:o="Certificate revoked.";break;case t.Alert.Description.certificate_expired:o="Certificate expired.";break;case t.Alert.Description.certificate_unknown:o="Certificate unknown.";break;case t.Alert.Description.illegal_parameter:o="Illegal parameter.";break;case t.Alert.Description.unknown_ca:o="Unknown certificate authority.";break;case t.Alert.Description.access_denied:o="Access denied.";break;case t.Alert.Description.decode_error:o="Decode error.";break;case t.Alert.Description.decrypt_error:o="Decrypt error.";break;case t.Alert.Description.export_restriction:o="Export restriction.";break;case t.Alert.Description.protocol_version:o="Unsupported protocol version.";break;case t.Alert.Description.insufficient_security:o="Insufficient security.";break;case t.Alert.Description.internal_error:o="Internal error.";break;case t.Alert.Description.user_canceled:o="User canceled.";break;case t.Alert.Description.no_renegotiation:o="Renegotiation not supported.";break;default:o="Unknown error.";break}if(_.description===t.Alert.Description.close_notify)return m.close();m.error(m,{message:o,send:!1,origin:m.entity===t.ConnectionEnd.client?"server":"client",alert:_}),m.process()},t.handleHandshake=function(m,L){var R=L.fragment,_=R.getByte(),o=R.getInt24();if(o>R.length())return m.fragmented=L,L.fragment=i.util.createBuffer(),R.read-=4,m.process();m.fragmented=null,R.read-=4;var b=R.bytes(o+4);R.read+=4,_ in he[m.entity][m.expect]?(m.entity===t.ConnectionEnd.server&&!m.open&&!m.fail&&(m.handshaking=!0,m.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:i.md.md5.create(),sha1:i.md.sha1.create()}),_!==t.HandshakeType.hello_request&&_!==t.HandshakeType.certificate_verify&&_!==t.HandshakeType.finished&&(m.session.md5.update(b),m.session.sha1.update(b)),he[m.entity][m.expect][_](m,L,o)):t.handleUnexpected(m,L)},t.handleApplicationData=function(m,L){m.data.putBuffer(L.fragment),m.dataReady(m),m.process()},t.handleHeartbeat=function(m,L){var R=L.fragment,_=R.getByte(),o=R.getInt16(),b=R.getBytes(o);if(_===t.HeartbeatMessageType.heartbeat_request){if(m.handshaking||o>b.length)return m.process();t.queue(m,t.createRecord(m,{type:t.ContentType.heartbeat,data:t.createHeartbeat(t.HeartbeatMessageType.heartbeat_response,b)})),t.flush(m)}else if(_===t.HeartbeatMessageType.heartbeat_response){if(b!==m.expectedHeartbeatPayload)return m.process();m.heartbeatReceived&&m.heartbeatReceived(m,i.util.createBuffer(b))}m.process()};var g=0,f=1,x=2,D=3,E=4,u=5,v=6,C=7,y=8,s=0,h=1,d=2,I=3,w=4,l=5,n=6,r=t.handleUnexpected,A=t.handleChangeCipherSpec,k=t.handleAlert,O=t.handleHandshake,P=t.handleApplicationData,K=t.handleHeartbeat,q=[];q[t.ConnectionEnd.client]=[[r,k,O,r,K],[r,k,O,r,K],[r,k,O,r,K],[r,k,O,r,K],[r,k,O,r,K],[A,k,r,r,K],[r,k,O,r,K],[r,k,O,P,K],[r,k,O,r,K]],q[t.ConnectionEnd.server]=[[r,k,O,r,K],[r,k,O,r,K],[r,k,O,r,K],[r,k,O,r,K],[A,k,r,r,K],[r,k,O,r,K],[r,k,O,P,K],[r,k,O,r,K]];var M=t.handleHelloRequest,G=t.handleServerHello,Y=t.handleCertificate,W=t.handleServerKeyExchange,ee=t.handleCertificateRequest,ie=t.handleServerHelloDone,ne=t.handleFinished,he=[];he[t.ConnectionEnd.client]=[[r,r,G,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r],[M,r,r,r,r,r,r,r,r,r,r,Y,W,ee,ie,r,r,r,r,r,r],[M,r,r,r,r,r,r,r,r,r,r,r,W,ee,ie,r,r,r,r,r,r],[M,r,r,r,r,r,r,r,r,r,r,r,r,ee,ie,r,r,r,r,r,r],[M,r,r,r,r,r,r,r,r,r,r,r,r,r,ie,r,r,r,r,r,r],[M,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r],[M,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,ne],[M,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r],[M,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r]];var ve=t.handleClientHello,fe=t.handleClientKeyExchange,j=t.handleCertificateVerify;he[t.ConnectionEnd.server]=[[r,ve,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r],[r,r,r,r,r,r,r,r,r,r,r,Y,r,r,r,r,r,r,r,r,r],[r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,fe,r,r,r,r],[r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,j,r,r,r,r,r],[r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r],[r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,ne],[r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r],[r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r]],t.generateKeys=function(m,L){var R=e,_=L.client_random+L.server_random;m.session.resuming||(L.master_secret=R(L.pre_master_secret,"master secret",_,48).bytes(),L.pre_master_secret=null),_=L.server_random+L.client_random;var o=2*L.mac_key_length+2*L.enc_key_length,b=m.version.major===t.Versions.TLS_1_0.major&&m.version.minor===t.Versions.TLS_1_0.minor;b&&(o+=2*L.fixed_iv_length);var V=R(L.master_secret,"key expansion",_,o),H={client_write_MAC_key:V.getBytes(L.mac_key_length),server_write_MAC_key:V.getBytes(L.mac_key_length),client_write_key:V.getBytes(L.enc_key_length),server_write_key:V.getBytes(L.enc_key_length)};return b&&(H.client_write_IV=V.getBytes(L.fixed_iv_length),H.server_write_IV=V.getBytes(L.fixed_iv_length)),H},t.createConnectionState=function(m){var L=m.entity===t.ConnectionEnd.client,R=function(){var b={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(V){return!0},compressionState:null,compressFunction:function(V){return!0},updateSequenceNumber:function(){b.sequenceNumber[1]===4294967295?(b.sequenceNumber[1]=0,++b.sequenceNumber[0]):++b.sequenceNumber[1]}};return b},_={read:R(),write:R()};if(_.read.update=function(b,V){return _.read.cipherFunction(V,_.read)?_.read.compressFunction(b,V,_.read)||b.error(b,{message:"Could not decompress record.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.decompression_failure}}):b.error(b,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.bad_record_mac}}),!b.fail},_.write.update=function(b,V){return _.write.compressFunction(b,V,_.write)?_.write.cipherFunction(V,_.write)||b.error(b,{message:"Could not encrypt record.",send:!1,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.internal_error}}):b.error(b,{message:"Could not compress record.",send:!1,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.internal_error}}),!b.fail},m.session){var o=m.session.sp;switch(m.session.cipherSuite.initSecurityParameters(o),o.keys=t.generateKeys(m,o),_.read.macKey=L?o.keys.server_write_MAC_key:o.keys.client_write_MAC_key,_.write.macKey=L?o.keys.client_write_MAC_key:o.keys.server_write_MAC_key,m.session.cipherSuite.initConnectionState(_,m,o),o.compression_algorithm){case t.CompressionMethod.none:break;case t.CompressionMethod.deflate:_.read.compressFunction=N,_.write.compressFunction=p;break;default:throw new Error("Unsupported compression algorithm.")}}return _},t.createRandom=function(){var m=new Date,L=+m+m.getTimezoneOffset()*6e4,R=i.util.createBuffer();return R.putInt32(L),R.putBytes(i.random.getBytes(28)),R},t.createRecord=function(m,L){if(!L.data)return null;var R={type:L.type,version:{major:m.version.major,minor:m.version.minor},length:L.data.length(),fragment:L.data};return R},t.createAlert=function(m,L){var R=i.util.createBuffer();return R.putByte(L.level),R.putByte(L.description),t.createRecord(m,{type:t.ContentType.alert,data:R})},t.createClientHello=function(m){m.session.clientHelloVersion={major:m.version.major,minor:m.version.minor};for(var L=i.util.createBuffer(),R=0;R<m.cipherSuites.length;++R){var _=m.cipherSuites[R];L.putByte(_.id[0]),L.putByte(_.id[1])}var o=L.length(),b=i.util.createBuffer();b.putByte(t.CompressionMethod.none);var V=b.length(),H=i.util.createBuffer();if(m.virtualHost){var ae=i.util.createBuffer();ae.putByte(0),ae.putByte(0);var te=i.util.createBuffer();te.putByte(0),c(te,2,i.util.createBuffer(m.virtualHost));var Q=i.util.createBuffer();c(Q,2,te),c(ae,2,Q),H.putBuffer(ae)}var $=H.length();$>0&&($+=2);var se=m.session.id,le=se.length+1+2+4+28+2+o+1+V+$,oe=i.util.createBuffer();return oe.putByte(t.HandshakeType.client_hello),oe.putInt24(le),oe.putByte(m.version.major),oe.putByte(m.version.minor),oe.putBytes(m.session.sp.client_random),c(oe,1,i.util.createBuffer(se)),c(oe,2,L),c(oe,1,b),$>0&&c(oe,2,H),oe},t.createServerHello=function(m){var L=m.session.id,R=L.length+1+2+4+28+2+1,_=i.util.createBuffer();return _.putByte(t.HandshakeType.server_hello),_.putInt24(R),_.putByte(m.version.major),_.putByte(m.version.minor),_.putBytes(m.session.sp.server_random),c(_,1,i.util.createBuffer(L)),_.putByte(m.session.cipherSuite.id[0]),_.putByte(m.session.cipherSuite.id[1]),_.putByte(m.session.compressionMethod),_},t.createCertificate=function(m){var L=m.entity===t.ConnectionEnd.client,R=null;if(m.getCertificate){var _;L?_=m.session.certificateRequest:_=m.session.extensions.server_name.serverNameList,R=m.getCertificate(m,_)}var o=i.util.createBuffer();if(R!==null)try{i.util.isArray(R)||(R=[R]);for(var b=null,V=0;V<R.length;++V){var H=i.pem.decode(R[V])[0];if(H.type!=="CERTIFICATE"&&H.type!=="X509 CERTIFICATE"&&H.type!=="TRUSTED CERTIFICATE"){var ae=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw ae.headerType=H.type,ae}if(H.procType&&H.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var te=i.util.createBuffer(H.body);b===null&&(b=i.asn1.fromDer(te.bytes(),!1));var Q=i.util.createBuffer();c(Q,3,te),o.putBuffer(Q)}R=i.pki.certificateFromAsn1(b),L?m.session.clientCertificate=R:m.session.serverCertificate=R}catch(le){return m.error(m,{message:"Could not send certificate list.",cause:le,send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.bad_certificate}})}var $=3+o.length(),se=i.util.createBuffer();return se.putByte(t.HandshakeType.certificate),se.putInt24($),c(se,3,o),se},t.createClientKeyExchange=function(m){var L=i.util.createBuffer();L.putByte(m.session.clientHelloVersion.major),L.putByte(m.session.clientHelloVersion.minor),L.putBytes(i.random.getBytes(46));var R=m.session.sp;R.pre_master_secret=L.getBytes();var _=m.session.serverCertificate.publicKey;L=_.encrypt(R.pre_master_secret);var o=L.length+2,b=i.util.createBuffer();return b.putByte(t.HandshakeType.client_key_exchange),b.putInt24(o),b.putInt16(L.length),b.putBytes(L),b},t.createServerKeyExchange=function(m){var L=i.util.createBuffer();return L},t.getClientSignature=function(m,L){var R=i.util.createBuffer();R.putBuffer(m.session.md5.digest()),R.putBuffer(m.session.sha1.digest()),R=R.getBytes(),m.getSignature=m.getSignature||function(_,o,b){var V=null;if(_.getPrivateKey)try{V=_.getPrivateKey(_,_.session.clientCertificate),V=i.pki.privateKeyFromPem(V)}catch(H){_.error(_,{message:"Could not get private key.",cause:H,send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.internal_error}})}V===null?_.error(_,{message:"No private key set.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.internal_error}}):o=V.sign(o,null),b(_,o)},m.getSignature(m,R,L)},t.createCertificateVerify=function(m,L){var R=L.length+2,_=i.util.createBuffer();return _.putByte(t.HandshakeType.certificate_verify),_.putInt24(R),_.putInt16(L.length),_.putBytes(L),_},t.createCertificateRequest=function(m){var L=i.util.createBuffer();L.putByte(1);var R=i.util.createBuffer();for(var _ in m.caStore.certs){var o=m.caStore.certs[_],b=i.pki.distinguishedNameToAsn1(o.subject),V=i.asn1.toDer(b);R.putInt16(V.length()),R.putBuffer(V)}var H=1+L.length()+2+R.length(),ae=i.util.createBuffer();return ae.putByte(t.HandshakeType.certificate_request),ae.putInt24(H),c(ae,1,L),c(ae,2,R),ae},t.createServerHelloDone=function(m){var L=i.util.createBuffer();return L.putByte(t.HandshakeType.server_hello_done),L.putInt24(0),L},t.createChangeCipherSpec=function(){var m=i.util.createBuffer();return m.putByte(1),m},t.createFinished=function(m){var L=i.util.createBuffer();L.putBuffer(m.session.md5.digest()),L.putBuffer(m.session.sha1.digest());var R=m.entity===t.ConnectionEnd.client,_=m.session.sp,o=12,b=e,V=R?"client finished":"server finished";L=b(_.master_secret,V,L.getBytes(),o);var H=i.util.createBuffer();return H.putByte(t.HandshakeType.finished),H.putInt24(L.length()),H.putBuffer(L),H},t.createHeartbeat=function(m,L,R){typeof R>"u"&&(R=L.length);var _=i.util.createBuffer();_.putByte(m),_.putInt16(R),_.putBytes(L);var o=_.length(),b=Math.max(16,o-R-3);return _.putBytes(i.random.getBytes(b)),_},t.queue=function(m,L){if(L&&!(L.fragment.length()===0&&(L.type===t.ContentType.handshake||L.type===t.ContentType.alert||L.type===t.ContentType.change_cipher_spec))){if(L.type===t.ContentType.handshake){var R=L.fragment.bytes();m.session.md5.update(R),m.session.sha1.update(R),R=null}var _;if(L.fragment.length()<=t.MaxFragment)_=[L];else{_=[];for(var o=L.fragment.bytes();o.length>t.MaxFragment;)_.push(t.createRecord(m,{type:L.type,data:i.util.createBuffer(o.slice(0,t.MaxFragment))})),o=o.slice(t.MaxFragment);o.length>0&&_.push(t.createRecord(m,{type:L.type,data:i.util.createBuffer(o)}))}for(var b=0;b<_.length&&!m.fail;++b){var V=_[b],H=m.state.current.write;H.update(m,V)&&m.records.push(V)}}},t.flush=function(m){for(var L=0;L<m.records.length;++L){var R=m.records[L];m.tlsData.putByte(R.type),m.tlsData.putByte(R.version.major),m.tlsData.putByte(R.version.minor),m.tlsData.putInt16(R.fragment.length()),m.tlsData.putBuffer(m.records[L].fragment)}return m.records=[],m.tlsDataReady(m)};var Z=function(m){switch(m){case!0:return!0;case i.pki.certificateError.bad_certificate:return t.Alert.Description.bad_certificate;case i.pki.certificateError.unsupported_certificate:return t.Alert.Description.unsupported_certificate;case i.pki.certificateError.certificate_revoked:return t.Alert.Description.certificate_revoked;case i.pki.certificateError.certificate_expired:return t.Alert.Description.certificate_expired;case i.pki.certificateError.certificate_unknown:return t.Alert.Description.certificate_unknown;case i.pki.certificateError.unknown_ca:return t.Alert.Description.unknown_ca;default:return t.Alert.Description.bad_certificate}},Ge=function(m){switch(m){case!0:return!0;case t.Alert.Description.bad_certificate:return i.pki.certificateError.bad_certificate;case t.Alert.Description.unsupported_certificate:return i.pki.certificateError.unsupported_certificate;case t.Alert.Description.certificate_revoked:return i.pki.certificateError.certificate_revoked;case t.Alert.Description.certificate_expired:return i.pki.certificateError.certificate_expired;case t.Alert.Description.certificate_unknown:return i.pki.certificateError.certificate_unknown;case t.Alert.Description.unknown_ca:return i.pki.certificateError.unknown_ca;default:return i.pki.certificateError.bad_certificate}};t.verifyCertificateChain=function(m,L){try{var R={};for(var _ in m.verifyOptions)R[_]=m.verifyOptions[_];R.verify=function(b,V,H){var ae=Z(b),te=m.verify(m,b,V,H);if(te!==!0){if(typeof te=="object"&&!i.util.isArray(te)){var Q=new Error("The application rejected the certificate.");throw Q.send=!0,Q.alert={level:t.Alert.Level.fatal,description:t.Alert.Description.bad_certificate},te.message&&(Q.message=te.message),te.alert&&(Q.alert.description=te.alert),Q}te!==b&&(te=Ge(te))}return te},i.pki.verifyCertificateChain(m.caStore,L,R)}catch(b){var o=b;(typeof o!="object"||i.util.isArray(o))&&(o={send:!0,alert:{level:t.Alert.Level.fatal,description:Z(b)}}),"send"in o||(o.send=!0),"alert"in o||(o.alert={level:t.Alert.Level.fatal,description:Z(o.error)}),m.error(m,o)}return!m.fail},t.createSessionCache=function(m,L){var R=null;if(m&&m.getSession&&m.setSession&&m.order)R=m;else{R={},R.cache=m||{},R.capacity=Math.max(L||100,1),R.order=[];for(var _ in m)R.order.length<=L?R.order.push(_):delete m[_];R.getSession=function(o){var b=null,V=null;if(o?V=i.util.bytesToHex(o):R.order.length>0&&(V=R.order[0]),V!==null&&V in R.cache){b=R.cache[V],delete R.cache[V];for(var H in R.order)if(R.order[H]===V){R.order.splice(H,1);break}}return b},R.setSession=function(o,b){if(R.order.length===R.capacity){var V=R.order.shift();delete R.cache[V]}var V=i.util.bytesToHex(o);R.order.push(V),R.cache[V]=b}}return R},t.createConnection=function(m){var L=null;m.caStore?i.util.isArray(m.caStore)?L=i.pki.createCaStore(m.caStore):L=m.caStore:L=i.pki.createCaStore();var R=m.cipherSuites||null;if(R===null){R=[];for(var _ in t.CipherSuites)R.push(t.CipherSuites[_])}var o=m.server?t.ConnectionEnd.server:t.ConnectionEnd.client,b=m.sessionCache?t.createSessionCache(m.sessionCache):null,V={version:{major:t.Version.major,minor:t.Version.minor},entity:o,sessionId:m.sessionId,caStore:L,sessionCache:b,cipherSuites:R,connected:m.connected,virtualHost:m.virtualHost||null,verifyClient:m.verifyClient||!1,verify:m.verify||function(Q,$,se,le){return $},verifyOptions:m.verifyOptions||{},getCertificate:m.getCertificate||null,getPrivateKey:m.getPrivateKey||null,getSignature:m.getSignature||null,input:i.util.createBuffer(),tlsData:i.util.createBuffer(),data:i.util.createBuffer(),tlsDataReady:m.tlsDataReady,dataReady:m.dataReady,heartbeatReceived:m.heartbeatReceived,closed:m.closed,error:function(Q,$){$.origin=$.origin||(Q.entity===t.ConnectionEnd.client?"client":"server"),$.send&&(t.queue(Q,t.createAlert(Q,$.alert)),t.flush(Q));var se=$.fatal!==!1;se&&(Q.fail=!0),m.error(Q,$),se&&Q.close(!1)},deflate:m.deflate||null,inflate:m.inflate||null};V.reset=function(Q){V.version={major:t.Version.major,minor:t.Version.minor},V.record=null,V.session=null,V.peerCertificate=null,V.state={pending:null,current:null},V.expect=V.entity===t.ConnectionEnd.client?g:s,V.fragmented=null,V.records=[],V.open=!1,V.handshakes=0,V.handshaking=!1,V.isConnected=!1,V.fail=!(Q||typeof Q>"u"),V.input.clear(),V.tlsData.clear(),V.data.clear(),V.state.current=t.createConnectionState(V)},V.reset();var H=function(Q,$){var se=$.type-t.ContentType.change_cipher_spec,le=q[Q.entity][Q.expect];se in le?le[se](Q,$):t.handleUnexpected(Q,$)},ae=function(Q){var $=0,se=Q.input,le=se.length();if(le<5)$=5-le;else{Q.record={type:se.getByte(),version:{major:se.getByte(),minor:se.getByte()},length:se.getInt16(),fragment:i.util.createBuffer(),ready:!1};var oe=Q.record.version.major===Q.version.major;oe&&Q.session&&Q.session.version&&(oe=Q.record.version.minor===Q.version.minor),oe||Q.error(Q,{message:"Incompatible TLS version.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.protocol_version}})}return $},te=function(Q){var $=0,se=Q.input,le=se.length();if(le<Q.record.length)$=Q.record.length-le;else{Q.record.fragment.putBytes(se.getBytes(Q.record.length)),se.compact();var oe=Q.state.current.read;oe.update(Q,Q.record)&&(Q.fragmented!==null&&(Q.fragmented.type===Q.record.type?(Q.fragmented.fragment.putBuffer(Q.record.fragment),Q.record=Q.fragmented):Q.error(Q,{message:"Invalid fragmented record.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.unexpected_message}})),Q.record.ready=!0)}return $};return V.handshake=function(Q){if(V.entity!==t.ConnectionEnd.client)V.error(V,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(V.handshaking)V.error(V,{message:"Handshake already in progress.",fatal:!1});else{V.fail&&!V.open&&V.handshakes===0&&(V.fail=!1),V.handshaking=!0,Q=Q||"";var $=null;Q.length>0&&(V.sessionCache&&($=V.sessionCache.getSession(Q)),$===null&&(Q="")),Q.length===0&&V.sessionCache&&($=V.sessionCache.getSession(),$!==null&&(Q=$.id)),V.session={id:Q,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:i.md.md5.create(),sha1:i.md.sha1.create()},$&&(V.version=$.version,V.session.sp=$.sp),V.session.sp.client_random=t.createRandom().getBytes(),V.open=!0,t.queue(V,t.createRecord(V,{type:t.ContentType.handshake,data:t.createClientHello(V)})),t.flush(V)}},V.process=function(Q){var $=0;return Q&&V.input.putBytes(Q),V.fail||(V.record!==null&&V.record.ready&&V.record.fragment.isEmpty()&&(V.record=null),V.record===null&&($=ae(V)),!V.fail&&V.record!==null&&!V.record.ready&&($=te(V)),!V.fail&&V.record!==null&&V.record.ready&&H(V,V.record)),$},V.prepare=function(Q){return t.queue(V,t.createRecord(V,{type:t.ContentType.application_data,data:i.util.createBuffer(Q)})),t.flush(V)},V.prepareHeartbeatRequest=function(Q,$){return Q instanceof i.util.ByteBuffer&&(Q=Q.bytes()),typeof $>"u"&&($=Q.length),V.expectedHeartbeatPayload=Q,t.queue(V,t.createRecord(V,{type:t.ContentType.heartbeat,data:t.createHeartbeat(t.HeartbeatMessageType.heartbeat_request,Q,$)})),t.flush(V)},V.close=function(Q){if(!V.fail&&V.sessionCache&&V.session){var $={id:V.session.id,version:V.session.version,sp:V.session.sp};$.sp.keys=null,V.sessionCache.setSession($.id,$)}V.open&&(V.open=!1,V.input.clear(),(V.isConnected||V.handshaking)&&(V.isConnected=V.handshaking=!1,t.queue(V,t.createAlert(V,{level:t.Alert.Level.warning,description:t.Alert.Description.close_notify})),t.flush(V)),V.closed(V)),V.reset(Q)},V},fr=i.tls=i.tls||{};for(var Me in t)typeof t[Me]!="function"&&(i.tls[Me]=t[Me]);return i.tls.prf_tls1=e,i.tls.hmac_sha1=a,i.tls.createSessionCache=t.createSessionCache,i.tls.createConnection=t.createConnection,fr}var fa;function _a(){if(fa)return Dt.exports;fa=1;var i=ue();ut(),ua();var e=Dt.exports=i.tls;e.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(g){g.bulk_cipher_algorithm=e.BulkCipherAlgorithm.aes,g.cipher_type=e.CipherType.block,g.enc_key_length=16,g.block_length=16,g.fixed_iv_length=16,g.record_iv_length=16,g.mac_algorithm=e.MACAlgorithm.hmac_sha1,g.mac_length=20,g.mac_key_length=20},initConnectionState:a},e.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(g){g.bulk_cipher_algorithm=e.BulkCipherAlgorithm.aes,g.cipher_type=e.CipherType.block,g.enc_key_length=32,g.block_length=16,g.fixed_iv_length=16,g.record_iv_length=16,g.mac_algorithm=e.MACAlgorithm.hmac_sha1,g.mac_length=20,g.mac_key_length=20},initConnectionState:a};function a(g,f,x){var D=f.entity===i.tls.ConnectionEnd.client;g.read.cipherState={init:!1,cipher:i.cipher.createDecipher("AES-CBC",D?x.keys.server_write_key:x.keys.client_write_key),iv:D?x.keys.server_write_IV:x.keys.client_write_IV},g.write.cipherState={init:!1,cipher:i.cipher.createCipher("AES-CBC",D?x.keys.client_write_key:x.keys.server_write_key),iv:D?x.keys.client_write_IV:x.keys.server_write_IV},g.read.cipherFunction=c,g.write.cipherFunction=p,g.read.macLength=g.write.macLength=x.mac_length,g.read.macFunction=g.write.macFunction=e.hmac_sha1}function p(g,f){var x=!1,D=f.macFunction(f.macKey,f.sequenceNumber,g);g.fragment.putBytes(D),f.updateSequenceNumber();var E;g.version.minor===e.Versions.TLS_1_0.minor?E=f.cipherState.init?null:f.cipherState.iv:E=i.random.getBytesSync(16),f.cipherState.init=!0;var u=f.cipherState.cipher;return u.start({iv:E}),g.version.minor>=e.Versions.TLS_1_1.minor&&u.output.putBytes(E),u.update(g.fragment),u.finish(N)&&(g.fragment=u.output,g.length=g.fragment.length(),x=!0),x}function N(g,f,x){if(!x){var D=g-f.length()%g;f.fillWithByte(D-1,D)}return!0}function S(g,f,x){var D=!0;if(x){for(var E=f.length(),u=f.last(),v=E-1-u;v<E-1;++v)D=D&&f.at(v)==u;D&&f.truncate(u+1)}return D}function c(g,f){var x=!1,D;g.version.minor===e.Versions.TLS_1_0.minor?D=f.cipherState.init?null:f.cipherState.iv:D=g.fragment.getBytes(16),f.cipherState.init=!0;var E=f.cipherState.cipher;E.start({iv:D}),E.update(g.fragment),x=E.finish(S);var u=f.macLength,v=i.random.getBytesSync(u),C=E.output.length();C>=u?(g.fragment=E.output.getBytes(C-u),v=E.output.getBytes(u)):g.fragment=E.output.getBytes(),g.fragment=i.util.createBuffer(g.fragment),g.length=g.fragment.length();var y=f.macFunction(f.macKey,f.sequenceNumber,g);return f.updateSequenceNumber(),x=t(f.macKey,v,y)&&x,x}function t(g,f,x){var D=i.hmac.create();return D.start("SHA1",g),D.update(f),f=D.digest().getBytes(),D.start(null,null),D.update(x),x=D.digest().getBytes(),f===x}return Dt.exports}var lr={exports:{}},la;function ca(){if(la)return lr.exports;la=1;var i=ue();at(),ce();var e=lr.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=e;var a=i.sha384=i.sha512.sha384=i.sha512.sha384||{};a.create=function(){return e.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=a,i.sha512.sha256=i.sha512.sha256||{create:function(){return e.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return e.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,e.create=function(f){if(N||t(),typeof f>"u"&&(f="SHA-512"),!(f in c))throw new Error("Invalid SHA-512 algorithm: "+f);for(var x=c[f],D=null,E=i.util.createBuffer(),u=new Array(80),v=0;v<80;++v)u[v]=new Array(2);var C=64;switch(f){case"SHA-384":C=48;break;case"SHA-512/256":C=32;break;case"SHA-512/224":C=28;break}var y={algorithm:f.replace("-","").toLowerCase(),blockLength:128,digestLength:C,messageLength:0,fullMessageLength:null,messageLengthSize:16};return y.start=function(){y.messageLength=0,y.fullMessageLength=y.messageLength128=[];for(var s=y.messageLengthSize/4,h=0;h<s;++h)y.fullMessageLength.push(0);E=i.util.createBuffer(),D=new Array(x.length);for(var h=0;h<x.length;++h)D[h]=x[h].slice(0);return y},y.start(),y.update=function(s,h){h==="utf8"&&(s=i.util.encodeUtf8(s));var d=s.length;y.messageLength+=d,d=[d/4294967296>>>0,d>>>0];for(var I=y.fullMessageLength.length-1;I>=0;--I)y.fullMessageLength[I]+=d[1],d[1]=d[0]+(y.fullMessageLength[I]/4294967296>>>0),y.fullMessageLength[I]=y.fullMessageLength[I]>>>0,d[0]=d[1]/4294967296>>>0;return E.putBytes(s),g(D,u,E),(E.read>2048||E.length()===0)&&E.compact(),y},y.digest=function(){var s=i.util.createBuffer();s.putBytes(E.bytes());var h=y.fullMessageLength[y.fullMessageLength.length-1]+y.messageLengthSize,d=h&y.blockLength-1;s.putBytes(p.substr(0,y.blockLength-d));for(var I,w,l=y.fullMessageLength[0]*8,n=0;n<y.fullMessageLength.length-1;++n)I=y.fullMessageLength[n+1]*8,w=I/4294967296>>>0,l+=w,s.putInt32(l>>>0),l=I>>>0;s.putInt32(l);for(var r=new Array(D.length),n=0;n<D.length;++n)r[n]=D[n].slice(0);g(r,u,s);var A=i.util.createBuffer(),k;f==="SHA-512"?k=r.length:f==="SHA-384"?k=r.length-2:k=r.length-4;for(var n=0;n<k;++n)A.putInt32(r[n][0]),(n!==k-1||f!=="SHA-512/224")&&A.putInt32(r[n][1]);return A},y};var p=null,N=!1,S=null,c=null;function t(){p="€",p+=i.util.fillString("\0",128),S=[[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]],c={},c["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],c["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],c["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],c["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],N=!0}function g(f,x,D){for(var E,u,v,C,y,s,h,d,I,w,l,n,r,A,k,O,P,K,q,M,G,Y,W,ee,ie,ne,he,ve,fe,j,Z,Ge,Me,m,L,R=D.length();R>=128;){for(fe=0;fe<16;++fe)x[fe][0]=D.getInt32()>>>0,x[fe][1]=D.getInt32()>>>0;for(;fe<80;++fe)Ge=x[fe-2],j=Ge[0],Z=Ge[1],E=((j>>>19|Z<<13)^(Z>>>29|j<<3)^j>>>6)>>>0,u=((j<<13|Z>>>19)^(Z<<3|j>>>29)^(j<<26|Z>>>6))>>>0,m=x[fe-15],j=m[0],Z=m[1],v=((j>>>1|Z<<31)^(j>>>8|Z<<24)^j>>>7)>>>0,C=((j<<31|Z>>>1)^(j<<24|Z>>>8)^(j<<25|Z>>>7))>>>0,Me=x[fe-7],L=x[fe-16],Z=u+Me[1]+C+L[1],x[fe][0]=E+Me[0]+v+L[0]+(Z/4294967296>>>0)>>>0,x[fe][1]=Z>>>0;for(r=f[0][0],A=f[0][1],k=f[1][0],O=f[1][1],P=f[2][0],K=f[2][1],q=f[3][0],M=f[3][1],G=f[4][0],Y=f[4][1],W=f[5][0],ee=f[5][1],ie=f[6][0],ne=f[6][1],he=f[7][0],ve=f[7][1],fe=0;fe<80;++fe)h=((G>>>14|Y<<18)^(G>>>18|Y<<14)^(Y>>>9|G<<23))>>>0,d=((G<<18|Y>>>14)^(G<<14|Y>>>18)^(Y<<23|G>>>9))>>>0,I=(ie^G&(W^ie))>>>0,w=(ne^Y&(ee^ne))>>>0,y=((r>>>28|A<<4)^(A>>>2|r<<30)^(A>>>7|r<<25))>>>0,s=((r<<4|A>>>28)^(A<<30|r>>>2)^(A<<25|r>>>7))>>>0,l=(r&k|P&(r^k))>>>0,n=(A&O|K&(A^O))>>>0,Z=ve+d+w+S[fe][1]+x[fe][1],E=he+h+I+S[fe][0]+x[fe][0]+(Z/4294967296>>>0)>>>0,u=Z>>>0,Z=s+n,v=y+l+(Z/4294967296>>>0)>>>0,C=Z>>>0,he=ie,ve=ne,ie=W,ne=ee,W=G,ee=Y,Z=M+u,G=q+E+(Z/4294967296>>>0)>>>0,Y=Z>>>0,q=P,M=K,P=k,K=O,k=r,O=A,Z=u+C,r=E+v+(Z/4294967296>>>0)>>>0,A=Z>>>0;Z=f[0][1]+A,f[0][0]=f[0][0]+r+(Z/4294967296>>>0)>>>0,f[0][1]=Z>>>0,Z=f[1][1]+O,f[1][0]=f[1][0]+k+(Z/4294967296>>>0)>>>0,f[1][1]=Z>>>0,Z=f[2][1]+K,f[2][0]=f[2][0]+P+(Z/4294967296>>>0)>>>0,f[2][1]=Z>>>0,Z=f[3][1]+M,f[3][0]=f[3][0]+q+(Z/4294967296>>>0)>>>0,f[3][1]=Z>>>0,Z=f[4][1]+Y,f[4][0]=f[4][0]+G+(Z/4294967296>>>0)>>>0,f[4][1]=Z>>>0,Z=f[5][1]+ee,f[5][0]=f[5][0]+W+(Z/4294967296>>>0)>>>0,f[5][1]=Z>>>0,Z=f[6][1]+ne,f[6][0]=f[6][0]+ie+(Z/4294967296>>>0)>>>0,f[6][1]=Z>>>0,Z=f[7][1]+ve,f[7][0]=f[7][0]+he+(Z/4294967296>>>0)>>>0,f[7][1]=Z>>>0,R-=128}}return lr.exports}var Tt={},ha;function Na(){if(ha)return Tt;ha=1;var i=ue();tt();var e=i.asn1;return Tt.privateKeyValidator={name:"PrivateKeyInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},Tt.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]},Tt}var cr,da;function Ra(){if(da)return cr;da=1;var i=ue();Et(),je(),ca(),ce();var e=Na(),a=e.publicKeyValidator,p=e.privateKeyValidator;if(typeof N>"u")var N=i.jsbn.BigInteger;var S=i.util.ByteBuffer,c=typeof Buffer>"u"?Uint8Array:Buffer;i.pki=i.pki||{},cr=i.pki.ed25519=i.ed25519=i.ed25519||{};var t=i.ed25519;t.constants={},t.constants.PUBLIC_KEY_BYTE_LENGTH=32,t.constants.PRIVATE_KEY_BYTE_LENGTH=64,t.constants.SEED_BYTE_LENGTH=32,t.constants.SIGN_BYTE_LENGTH=64,t.constants.HASH_BYTE_LENGTH=64,t.generateKeyPair=function(L){L=L||{};var R=L.seed;if(R===void 0)R=i.random.getBytesSync(t.constants.SEED_BYTE_LENGTH);else if(typeof R=="string"){if(R.length!==t.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+t.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=g({message:R,encoding:"binary"});for(var _=new c(t.constants.PUBLIC_KEY_BYTE_LENGTH),o=new c(t.constants.PRIVATE_KEY_BYTE_LENGTH),b=0;b<32;++b)o[b]=R[b];return h(_,o),{publicKey:_,privateKey:o}},t.privateKeyFromAsn1=function(L){var R={},_=[],o=i.asn1.validate(L,p,R,_);if(!o){var b=new Error("Invalid Key.");throw b.errors=_,b}var V=i.asn1.derToOid(R.privateKeyOid),H=i.oids.EdDSA25519;if(V!==H)throw new Error('Invalid OID "'+V+'"; OID must be "'+H+'".');var ae=R.privateKey,te=g({message:i.asn1.fromDer(ae).value,encoding:"binary"});return{privateKeyBytes:te}},t.publicKeyFromAsn1=function(L){var R={},_=[],o=i.asn1.validate(L,a,R,_);if(!o){var b=new Error("Invalid Key.");throw b.errors=_,b}var V=i.asn1.derToOid(R.publicKeyOid),H=i.oids.EdDSA25519;if(V!==H)throw new Error('Invalid OID "'+V+'"; OID must be "'+H+'".');var ae=R.ed25519PublicKey;if(ae.length!==t.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return g({message:ae,encoding:"binary"})},t.publicKeyFromPrivateKey=function(L){L=L||{};var R=g({message:L.privateKey,encoding:"binary"});if(R.length!==t.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+t.constants.PRIVATE_KEY_BYTE_LENGTH);for(var _=new c(t.constants.PUBLIC_KEY_BYTE_LENGTH),o=0;o<_.length;++o)_[o]=R[32+o];return _},t.sign=function(L){L=L||{};var R=g(L),_=g({message:L.privateKey,encoding:"binary"});if(_.length===t.constants.SEED_BYTE_LENGTH){var o=t.generateKeyPair({seed:_});_=o.privateKey}else if(_.length!==t.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+t.constants.SEED_BYTE_LENGTH+" or "+t.constants.PRIVATE_KEY_BYTE_LENGTH);var b=new c(t.constants.SIGN_BYTE_LENGTH+R.length);d(b,R,R.length,_);for(var V=new c(t.constants.SIGN_BYTE_LENGTH),H=0;H<V.length;++H)V[H]=b[H];return V},t.verify=function(L){L=L||{};var R=g(L);if(L.signature===void 0)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var _=g({message:L.signature,encoding:"binary"});if(_.length!==t.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+t.constants.SIGN_BYTE_LENGTH);var o=g({message:L.publicKey,encoding:"binary"});if(o.length!==t.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+t.constants.PUBLIC_KEY_BYTE_LENGTH);var b=new c(t.constants.SIGN_BYTE_LENGTH+R.length),V=new c(t.constants.SIGN_BYTE_LENGTH+R.length),H;for(H=0;H<t.constants.SIGN_BYTE_LENGTH;++H)b[H]=_[H];for(H=0;H<R.length;++H)b[H+t.constants.SIGN_BYTE_LENGTH]=R[H];return I(V,b,b.length,o)>=0};function g(L){var R=L.message;if(R instanceof Uint8Array||R instanceof c)return R;var _=L.encoding;if(R===void 0)if(L.md)R=L.md.digest().getBytes(),_="binary";else throw new TypeError('"options.message" or "options.md" not specified.');if(typeof R=="string"&&!_)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof R=="string"){if(typeof Buffer<"u")return Buffer.from(R,_);R=new S(R,_)}else if(!(R instanceof S))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 o=new c(R.length()),b=0;b<o.length;++b)o[b]=R.at(b);return o}var f=j(),x=j([1]),D=j([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),E=j([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),u=j([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),v=j([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),C=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]),y=j([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function s(L,R){var _=i.md.sha512.create(),o=new S(L);_.update(o.getBytes(R),"binary");var b=_.digest().getBytes();if(typeof Buffer<"u")return Buffer.from(b,"binary");for(var V=new c(t.constants.HASH_BYTE_LENGTH),H=0;H<64;++H)V[H]=b.charCodeAt(H);return V}function h(L,R){var _=[j(),j(),j(),j()],o,b=s(R,32);for(b[0]&=248,b[31]&=127,b[31]|=64,ie(_,b),k(L,_),o=0;o<32;++o)R[o+32]=L[o];return 0}function d(L,R,_,o){var b,V,H=new Float64Array(64),ae=[j(),j(),j(),j()],te=s(o,32);te[0]&=248,te[31]&=127,te[31]|=64;var Q=_+64;for(b=0;b<_;++b)L[64+b]=R[b];for(b=0;b<32;++b)L[32+b]=te[32+b];var $=s(L.subarray(32),_+32);for(n($),ie(ae,$),k(L,ae),b=32;b<64;++b)L[b]=o[b];var se=s(L,_+64);for(n(se),b=32;b<64;++b)H[b]=0;for(b=0;b<32;++b)H[b]=$[b];for(b=0;b<32;++b)for(V=0;V<32;V++)H[b+V]+=se[b]*te[V];return l(L.subarray(32),H),Q}function I(L,R,_,o){var b,V,H=new c(32),ae=[j(),j(),j(),j()],te=[j(),j(),j(),j()];if(V=-1,_<64||P(te,o)||!w(R,32))return-1;for(b=0;b<_;++b)L[b]=R[b];for(b=0;b<32;++b)L[b+32]=o[b];var Q=s(L,_);if(n(Q),ee(ae,te,Q),ie(te,R.subarray(32)),r(ae,te),k(H,ae),_-=64,G(R,0,H,0)){for(b=0;b<_;++b)L[b]=0;return-1}for(b=0;b<_;++b)L[b]=R[b+64];return V=_,V}function w(L,R){var _;for(_=31;_>=0;--_){if(L[R+_]<C[_])return!0;if(L[R+_]>C[_])return!1}return!1}function l(L,R){var _,o,b,V;for(o=63;o>=32;--o){for(_=0,b=o-32,V=o-12;b<V;++b)R[b]+=_-16*R[o]*C[b-(o-32)],_=R[b]+128>>8,R[b]-=_*256;R[b]+=_,R[o]=0}for(_=0,b=0;b<32;++b)R[b]+=_-(R[31]>>4)*C[b],_=R[b]>>8,R[b]&=255;for(b=0;b<32;++b)R[b]-=_*C[b];for(o=0;o<32;++o)R[o+1]+=R[o]>>8,L[o]=R[o]&255}function n(L){for(var R=new Float64Array(64),_=0;_<64;++_)R[_]=L[_],L[_]=0;l(L,R)}function r(L,R){var _=j(),o=j(),b=j(),V=j(),H=j(),ae=j(),te=j(),Q=j(),$=j();Ge(_,L[1],L[0]),Ge($,R[1],R[0]),m(_,_,$),Z(o,L[0],L[1]),Z($,R[0],R[1]),m(o,o,$),m(b,L[3],R[3]),m(b,b,E),m(V,L[2],R[2]),Z(V,V,V),Ge(H,o,_),Ge(ae,V,b),Z(te,V,b),Z(Q,o,_),m(L[0],H,ae),m(L[1],Q,te),m(L[2],te,ae),m(L[3],H,Q)}function A(L,R,_){for(var o=0;o<4;++o)fe(L[o],R[o],_)}function k(L,R){var _=j(),o=j(),b=j();he(b,R[2]),m(_,R[0],b),m(o,R[1],b),O(L,o),L[31]^=W(_)<<7}function O(L,R){var _,o,b,V=j(),H=j();for(_=0;_<16;++_)H[_]=R[_];for(ve(H),ve(H),ve(H),o=0;o<2;++o){for(V[0]=H[0]-65517,_=1;_<15;++_)V[_]=H[_]-65535-(V[_-1]>>16&1),V[_-1]&=65535;V[15]=H[15]-32767-(V[14]>>16&1),b=V[15]>>16&1,V[14]&=65535,fe(H,V,1-b)}for(_=0;_<16;_++)L[2*_]=H[_]&255,L[2*_+1]=H[_]>>8}function P(L,R){var _=j(),o=j(),b=j(),V=j(),H=j(),ae=j(),te=j();return ne(L[2],x),K(L[1],R),Me(b,L[1]),m(V,b,D),Ge(b,b,L[2]),Z(V,L[2],V),Me(H,V),Me(ae,H),m(te,ae,H),m(_,te,b),m(_,_,V),q(_,_),m(_,_,b),m(_,_,V),m(_,_,V),m(L[0],_,V),Me(o,L[0]),m(o,o,V),M(o,b)&&m(L[0],L[0],y),Me(o,L[0]),m(o,o,V),M(o,b)?-1:(W(L[0])===R[31]>>7&&Ge(L[0],f,L[0]),m(L[3],L[0],L[1]),0)}function K(L,R){var _;for(_=0;_<16;++_)L[_]=R[2*_]+(R[2*_+1]<<8);L[15]&=32767}function q(L,R){var _=j(),o;for(o=0;o<16;++o)_[o]=R[o];for(o=250;o>=0;--o)Me(_,_),o!==1&&m(_,_,R);for(o=0;o<16;++o)L[o]=_[o]}function M(L,R){var _=new c(32),o=new c(32);return O(_,L),O(o,R),G(_,0,o,0)}function G(L,R,_,o){return Y(L,R,_,o,32)}function Y(L,R,_,o,b){var V,H=0;for(V=0;V<b;++V)H|=L[R+V]^_[o+V];return(1&H-1>>>8)-1}function W(L){var R=new c(32);return O(R,L),R[0]&1}function ee(L,R,_){var o,b;for(ne(L[0],f),ne(L[1],x),ne(L[2],x),ne(L[3],f),b=255;b>=0;--b)o=_[b/8|0]>>(b&7)&1,A(L,R,o),r(R,L),r(L,L),A(L,R,o)}function ie(L,R){var _=[j(),j(),j(),j()];ne(_[0],u),ne(_[1],v),ne(_[2],x),m(_[3],u,v),ee(L,_,R)}function ne(L,R){var _;for(_=0;_<16;_++)L[_]=R[_]|0}function he(L,R){var _=j(),o;for(o=0;o<16;++o)_[o]=R[o];for(o=253;o>=0;--o)Me(_,_),o!==2&&o!==4&&m(_,_,R);for(o=0;o<16;++o)L[o]=_[o]}function ve(L){var R,_,o=1;for(R=0;R<16;++R)_=L[R]+o+65535,o=Math.floor(_/65536),L[R]=_-o*65536;L[0]+=o-1+37*(o-1)}function fe(L,R,_){for(var o,b=~(_-1),V=0;V<16;++V)o=b&(L[V]^R[V]),L[V]^=o,R[V]^=o}function j(L){var R,_=new Float64Array(16);if(L)for(R=0;R<L.length;++R)_[R]=L[R];return _}function Z(L,R,_){for(var o=0;o<16;++o)L[o]=R[o]+_[o]}function Ge(L,R,_){for(var o=0;o<16;++o)L[o]=R[o]-_[o]}function Me(L,R){m(L,R,R)}function m(L,R,_){var o,b,V=0,H=0,ae=0,te=0,Q=0,$=0,se=0,le=0,oe=0,me=0,Se=0,xe=0,Ee=0,ge=0,ye=0,pe=0,Ie=0,Ae=0,qe=0,He=0,Qe=0,ze=0,Xe=0,Ze=0,rt=0,it=0,st=0,lt=0,dt=0,gt=0,It=0,Be=_[0],be=_[1],_e=_[2],Ne=_[3],Re=_[4],we=_[5],Le=_[6],ke=_[7],De=_[8],Ue=_[9],Pe=_[10],Ve=_[11],Ce=_[12],Te=_[13],Oe=_[14],Ke=_[15];o=R[0],V+=o*Be,H+=o*be,ae+=o*_e,te+=o*Ne,Q+=o*Re,$+=o*we,se+=o*Le,le+=o*ke,oe+=o*De,me+=o*Ue,Se+=o*Pe,xe+=o*Ve,Ee+=o*Ce,ge+=o*Te,ye+=o*Oe,pe+=o*Ke,o=R[1],H+=o*Be,ae+=o*be,te+=o*_e,Q+=o*Ne,$+=o*Re,se+=o*we,le+=o*Le,oe+=o*ke,me+=o*De,Se+=o*Ue,xe+=o*Pe,Ee+=o*Ve,ge+=o*Ce,ye+=o*Te,pe+=o*Oe,Ie+=o*Ke,o=R[2],ae+=o*Be,te+=o*be,Q+=o*_e,$+=o*Ne,se+=o*Re,le+=o*we,oe+=o*Le,me+=o*ke,Se+=o*De,xe+=o*Ue,Ee+=o*Pe,ge+=o*Ve,ye+=o*Ce,pe+=o*Te,Ie+=o*Oe,Ae+=o*Ke,o=R[3],te+=o*Be,Q+=o*be,$+=o*_e,se+=o*Ne,le+=o*Re,oe+=o*we,me+=o*Le,Se+=o*ke,xe+=o*De,Ee+=o*Ue,ge+=o*Pe,ye+=o*Ve,pe+=o*Ce,Ie+=o*Te,Ae+=o*Oe,qe+=o*Ke,o=R[4],Q+=o*Be,$+=o*be,se+=o*_e,le+=o*Ne,oe+=o*Re,me+=o*we,Se+=o*Le,xe+=o*ke,Ee+=o*De,ge+=o*Ue,ye+=o*Pe,pe+=o*Ve,Ie+=o*Ce,Ae+=o*Te,qe+=o*Oe,He+=o*Ke,o=R[5],$+=o*Be,se+=o*be,le+=o*_e,oe+=o*Ne,me+=o*Re,Se+=o*we,xe+=o*Le,Ee+=o*ke,ge+=o*De,ye+=o*Ue,pe+=o*Pe,Ie+=o*Ve,Ae+=o*Ce,qe+=o*Te,He+=o*Oe,Qe+=o*Ke,o=R[6],se+=o*Be,le+=o*be,oe+=o*_e,me+=o*Ne,Se+=o*Re,xe+=o*we,Ee+=o*Le,ge+=o*ke,ye+=o*De,pe+=o*Ue,Ie+=o*Pe,Ae+=o*Ve,qe+=o*Ce,He+=o*Te,Qe+=o*Oe,ze+=o*Ke,o=R[7],le+=o*Be,oe+=o*be,me+=o*_e,Se+=o*Ne,xe+=o*Re,Ee+=o*we,ge+=o*Le,ye+=o*ke,pe+=o*De,Ie+=o*Ue,Ae+=o*Pe,qe+=o*Ve,He+=o*Ce,Qe+=o*Te,ze+=o*Oe,Xe+=o*Ke,o=R[8],oe+=o*Be,me+=o*be,Se+=o*_e,xe+=o*Ne,Ee+=o*Re,ge+=o*we,ye+=o*Le,pe+=o*ke,Ie+=o*De,Ae+=o*Ue,qe+=o*Pe,He+=o*Ve,Qe+=o*Ce,ze+=o*Te,Xe+=o*Oe,Ze+=o*Ke,o=R[9],me+=o*Be,Se+=o*be,xe+=o*_e,Ee+=o*Ne,ge+=o*Re,ye+=o*we,pe+=o*Le,Ie+=o*ke,Ae+=o*De,qe+=o*Ue,He+=o*Pe,Qe+=o*Ve,ze+=o*Ce,Xe+=o*Te,Ze+=o*Oe,rt+=o*Ke,o=R[10],Se+=o*Be,xe+=o*be,Ee+=o*_e,ge+=o*Ne,ye+=o*Re,pe+=o*we,Ie+=o*Le,Ae+=o*ke,qe+=o*De,He+=o*Ue,Qe+=o*Pe,ze+=o*Ve,Xe+=o*Ce,Ze+=o*Te,rt+=o*Oe,it+=o*Ke,o=R[11],xe+=o*Be,Ee+=o*be,ge+=o*_e,ye+=o*Ne,pe+=o*Re,Ie+=o*we,Ae+=o*Le,qe+=o*ke,He+=o*De,Qe+=o*Ue,ze+=o*Pe,Xe+=o*Ve,Ze+=o*Ce,rt+=o*Te,it+=o*Oe,st+=o*Ke,o=R[12],Ee+=o*Be,ge+=o*be,ye+=o*_e,pe+=o*Ne,Ie+=o*Re,Ae+=o*we,qe+=o*Le,He+=o*ke,Qe+=o*De,ze+=o*Ue,Xe+=o*Pe,Ze+=o*Ve,rt+=o*Ce,it+=o*Te,st+=o*Oe,lt+=o*Ke,o=R[13],ge+=o*Be,ye+=o*be,pe+=o*_e,Ie+=o*Ne,Ae+=o*Re,qe+=o*we,He+=o*Le,Qe+=o*ke,ze+=o*De,Xe+=o*Ue,Ze+=o*Pe,rt+=o*Ve,it+=o*Ce,st+=o*Te,lt+=o*Oe,dt+=o*Ke,o=R[14],ye+=o*Be,pe+=o*be,Ie+=o*_e,Ae+=o*Ne,qe+=o*Re,He+=o*we,Qe+=o*Le,ze+=o*ke,Xe+=o*De,Ze+=o*Ue,rt+=o*Pe,it+=o*Ve,st+=o*Ce,lt+=o*Te,dt+=o*Oe,gt+=o*Ke,o=R[15],pe+=o*Be,Ie+=o*be,Ae+=o*_e,qe+=o*Ne,He+=o*Re,Qe+=o*we,ze+=o*Le,Xe+=o*ke,Ze+=o*De,rt+=o*Ue,it+=o*Pe,st+=o*Ve,lt+=o*Ce,dt+=o*Te,gt+=o*Oe,It+=o*Ke,V+=38*Ie,H+=38*Ae,ae+=38*qe,te+=38*He,Q+=38*Qe,$+=38*ze,se+=38*Xe,le+=38*Ze,oe+=38*rt,me+=38*it,Se+=38*st,xe+=38*lt,Ee+=38*dt,ge+=38*gt,ye+=38*It,b=1,o=V+b+65535,b=Math.floor(o/65536),V=o-b*65536,o=H+b+65535,b=Math.floor(o/65536),H=o-b*65536,o=ae+b+65535,b=Math.floor(o/65536),ae=o-b*65536,o=te+b+65535,b=Math.floor(o/65536),te=o-b*65536,o=Q+b+65535,b=Math.floor(o/65536),Q=o-b*65536,o=$+b+65535,b=Math.floor(o/65536),$=o-b*65536,o=se+b+65535,b=Math.floor(o/65536),se=o-b*65536,o=le+b+65535,b=Math.floor(o/65536),le=o-b*65536,o=oe+b+65535,b=Math.floor(o/65536),oe=o-b*65536,o=me+b+65535,b=Math.floor(o/65536),me=o-b*65536,o=Se+b+65535,b=Math.floor(o/65536),Se=o-b*65536,o=xe+b+65535,b=Math.floor(o/65536),xe=o-b*65536,o=Ee+b+65535,b=Math.floor(o/65536),Ee=o-b*65536,o=ge+b+65535,b=Math.floor(o/65536),ge=o-b*65536,o=ye+b+65535,b=Math.floor(o/65536),ye=o-b*65536,o=pe+b+65535,b=Math.floor(o/65536),pe=o-b*65536,V+=b-1+37*(b-1),b=1,o=V+b+65535,b=Math.floor(o/65536),V=o-b*65536,o=H+b+65535,b=Math.floor(o/65536),H=o-b*65536,o=ae+b+65535,b=Math.floor(o/65536),ae=o-b*65536,o=te+b+65535,b=Math.floor(o/65536),te=o-b*65536,o=Q+b+65535,b=Math.floor(o/65536),Q=o-b*65536,o=$+b+65535,b=Math.floor(o/65536),$=o-b*65536,o=se+b+65535,b=Math.floor(o/65536),se=o-b*65536,o=le+b+65535,b=Math.floor(o/65536),le=o-b*65536,o=oe+b+65535,b=Math.floor(o/65536),oe=o-b*65536,o=me+b+65535,b=Math.floor(o/65536),me=o-b*65536,o=Se+b+65535,b=Math.floor(o/65536),Se=o-b*65536,o=xe+b+65535,b=Math.floor(o/65536),xe=o-b*65536,o=Ee+b+65535,b=Math.floor(o/65536),Ee=o-b*65536,o=ge+b+65535,b=Math.floor(o/65536),ge=o-b*65536,o=ye+b+65535,b=Math.floor(o/65536),ye=o-b*65536,o=pe+b+65535,b=Math.floor(o/65536),pe=o-b*65536,V+=b-1+37*(b-1),L[0]=V,L[1]=H,L[2]=ae,L[3]=te,L[4]=Q,L[5]=$,L[6]=se,L[7]=le,L[8]=oe,L[9]=me,L[10]=Se,L[11]=xe,L[12]=Ee,L[13]=ge,L[14]=ye,L[15]=pe}return cr}var hr,pa;function wa(){if(pa)return hr;pa=1;var i=ue();ce(),je(),Et(),hr=i.kem=i.kem||{};var e=i.jsbn.BigInteger;i.kem.rsa={},i.kem.rsa.create=function(p,N){N=N||{};var S=N.prng||i.random,c={};return c.encrypt=function(t,g){var f=Math.ceil(t.n.bitLength()/8),x;do x=new e(i.util.bytesToHex(S.getBytesSync(f)),16).mod(t.n);while(x.compareTo(e.ONE)<=0);x=i.util.hexToBytes(x.toString(16));var D=f-x.length;D>0&&(x=i.util.fillString("\0",D)+x);var E=t.encrypt(x,"NONE"),u=p.generate(x,g);return{encapsulation:E,key:u}},c.decrypt=function(t,g,f){var x=t.decrypt(g,"NONE");return p.generate(x,f)},c},i.kem.kdf1=function(p,N){a(this,p,0,N||p.digestLength)},i.kem.kdf2=function(p,N){a(this,p,1,N||p.digestLength)};function a(p,N,S,c){p.generate=function(t,g){for(var f=new i.util.ByteBuffer,x=Math.ceil(g/c)+S,D=new i.util.ByteBuffer,E=S;E<x;++E){D.putInt32(E),N.start(),N.update(t+D.getBytes());var u=N.digest();f.putBytes(u.getBytes(c))}return f.truncate(f.length()-g),f.getBytes()}}return hr}var dr,va;function La(){if(va)return dr;va=1;var i=ue();ce(),dr=i.log=i.log||{},i.log.levels=["none","error","warning","info","debug","verbose","max"];var e={},a=[],p=null;i.log.LEVEL_LOCKED=2,i.log.NO_LEVEL_CHECK=4,i.log.INTERPOLATE=8;for(var N=0;N<i.log.levels.length;++N){var S=i.log.levels[N];e[S]={index:N,name:S.toUpperCase()}}i.log.logMessage=function(E){for(var u=e[E.level].index,v=0;v<a.length;++v){var C=a[v];if(C.flags&i.log.NO_LEVEL_CHECK)C.f(E);else{var y=e[C.level].index;u<=y&&C.f(C,E)}}},i.log.prepareStandard=function(E){"standard"in E||(E.standard=e[E.level].name+" ["+E.category+"] "+E.message)},i.log.prepareFull=function(E){if(!("full"in E)){var u=[E.message];u=u.concat([]),E.full=i.util.format.apply(this,u)}},i.log.prepareStandardFull=function(E){"standardFull"in E||(i.log.prepareStandard(E),E.standardFull=E.standard)};for(var c=["error","warning","info","debug","verbose"],N=0;N<c.length;++N)(function(u){i.log[u]=function(v,C){var y=Array.prototype.slice.call(arguments).slice(2),s={timestamp:new Date,level:u,category:v,message:C,arguments:y};i.log.logMessage(s)}})(c[N]);if(i.log.makeLogger=function(E){var u={flags:0,f:E};return i.log.setLevel(u,"none"),u},i.log.setLevel=function(E,u){var v=!1;if(E&&!(E.flags&i.log.LEVEL_LOCKED))for(var C=0;C<i.log.levels.length;++C){var y=i.log.levels[C];if(u==y){E.level=u,v=!0;break}}return v},i.log.lock=function(E,u){typeof u>"u"||u?E.flags|=i.log.LEVEL_LOCKED:E.flags&=~i.log.LEVEL_LOCKED},i.log.addLogger=function(E){a.push(E)},typeof console<"u"&&"log"in console){var t;if(console.error&&console.warn&&console.info&&console.debug){var g={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},f=function(E,u){i.log.prepareStandard(u);var v=g[u.level],C=[u.standard];C=C.concat(u.arguments.slice()),v.apply(console,C)};t=i.log.makeLogger(f)}else{var f=function(u,v){i.log.prepareStandardFull(v),console.log(v.standardFull)};t=i.log.makeLogger(f)}i.log.setLevel(t,"debug"),i.log.addLogger(t),p=t}else console={log:function(){}};if(p!==null&&typeof window<"u"&&window.location){var x=new URL(window.location.href).searchParams;if(x.has("console.level")&&i.log.setLevel(p,x.get("console.level").slice(-1)[0]),x.has("console.lock")){var D=x.get("console.lock").slice(-1)[0];D=="true"&&i.log.lock(p)}}return i.log.consoleLogger=p,dr}var pr,ya;function ka(){return ya||(ya=1,pr=at(),Ft(),yt(),Ur(),ca()),pr}var vr={exports:{}},ga;function Da(){if(ga)return vr.exports;ga=1;var i=ue();ut(),tt(),Ct(),ft(),ct(),Zr(),je(),ce(),ur();var e=i.asn1,a=vr.exports=i.pkcs7=i.pkcs7||{};a.messageFromPem=function(u){var v=i.pem.decode(u)[0];if(v.type!=="PKCS7"){var C=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw C.headerType=v.type,C}if(v.procType&&v.procType.type==="ENCRYPTED")throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var y=e.fromDer(v.body);return a.messageFromAsn1(y)},a.messageToPem=function(u,v){var C={type:"PKCS7",body:e.toDer(u.toAsn1()).getBytes()};return i.pem.encode(C,{maxline:v})},a.messageFromAsn1=function(u){var v={},C=[];if(!e.validate(u,a.asn1.contentInfoValidator,v,C)){var y=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw y.errors=C,y}var s=e.derToOid(v.contentType),h;switch(s){case i.pki.oids.envelopedData:h=a.createEnvelopedData();break;case i.pki.oids.encryptedData:h=a.createEncryptedData();break;case i.pki.oids.signedData:h=a.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+s+" is not (yet) supported.")}return h.fromAsn1(v.content.value[0]),h},a.createSignedData=function(){var u=null;return u={type:i.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(y){if(D(u,y,a.asn1.signedDataValidator),u.certificates=[],u.crls=[],u.digestAlgorithmIdentifiers=[],u.contentInfo=null,u.signerInfos=[],u.rawCapture.certificates)for(var s=u.rawCapture.certificates.value,h=0;h<s.length;++h)u.certificates.push(i.pki.certificateFromAsn1(s[h]))},toAsn1:function(){u.contentInfo||u.sign();for(var y=[],s=0;s<u.certificates.length;++s)y.push(i.pki.certificateToAsn1(u.certificates[s]));var h=[],d=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(u.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,u.digestAlgorithmIdentifiers),u.contentInfo])]);return y.length>0&&d.value[0].value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,y)),h.length>0&&d.value[0].value.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,h)),d.value[0].value.push(e.create(e.Class.UNIVERSAL,e.Type.SET,!0,u.signerInfos)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u.type).getBytes()),d])},addSigner:function(y){var s=y.issuer,h=y.serialNumber;if(y.certificate){var d=y.certificate;typeof d=="string"&&(d=i.pki.certificateFromPem(d)),s=d.issuer.attributes,h=d.serialNumber}var I=y.key;if(!I)throw new Error("Could not add PKCS#7 signer; no private key specified.");typeof I=="string"&&(I=i.pki.privateKeyFromPem(I));var w=y.digestAlgorithm||i.pki.oids.sha1;switch(w){case i.pki.oids.sha1:case i.pki.oids.sha256:case i.pki.oids.sha384:case i.pki.oids.sha512:case i.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+w)}var l=y.authenticatedAttributes||[];if(l.length>0){for(var n=!1,r=!1,A=0;A<l.length;++A){var k=l[A];if(!n&&k.type===i.pki.oids.contentType){if(n=!0,r)break;continue}if(!r&&k.type===i.pki.oids.messageDigest){if(r=!0,n)break;continue}}if(!n||!r)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.")}u.signers.push({key:I,version:1,issuer:s,serialNumber:h,digestAlgorithm:w,signatureAlgorithm:i.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:l,unauthenticatedAttributes:[]})},sign:function(y){if(y=y||{},(typeof u.content!="object"||u.contentInfo===null)&&(u.contentInfo=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(i.pki.oids.data).getBytes())]),"content"in u)){var s;u.content instanceof i.util.ByteBuffer?s=u.content.bytes():typeof u.content=="string"&&(s=i.util.encodeUtf8(u.content)),y.detached?u.detachedContent=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,s):u.contentInfo.value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,s)]))}if(u.signers.length!==0){var h=v();C(h)}},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(y){typeof y=="string"&&(y=i.pki.certificateFromPem(y)),u.certificates.push(y)},addCertificateRevokationList:function(y){throw new Error("PKCS#7 CRL support not yet implemented.")}},u;function v(){for(var y={},s=0;s<u.signers.length;++s){var h=u.signers[s],d=h.digestAlgorithm;d in y||(y[d]=i.md[i.pki.oids[d]].create()),h.authenticatedAttributes.length===0?h.md=y[d]:h.md=i.md[i.pki.oids[d]].create()}u.digestAlgorithmIdentifiers=[];for(var d in y)u.digestAlgorithmIdentifiers.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(d).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]));return y}function C(y){var s;if(u.detachedContent?s=u.detachedContent:(s=u.contentInfo.value[1],s=s.value[0]),!s)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var h=e.derToOid(u.contentInfo.value[0].value),d=e.toDer(s);d.getByte(),e.getBerValueLength(d),d=d.getBytes();for(var I in y)y[I].start().update(d);for(var w=new Date,l=0;l<u.signers.length;++l){var n=u.signers[l];if(n.authenticatedAttributes.length===0){if(h!==i.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{n.authenticatedAttributesAsn1=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var r=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[]),A=0;A<n.authenticatedAttributes.length;++A){var k=n.authenticatedAttributes[A];k.type===i.pki.oids.messageDigest?k.value=y[n.digestAlgorithm].digest():k.type===i.pki.oids.signingTime&&(k.value||(k.value=w)),r.value.push(f(k)),n.authenticatedAttributesAsn1.value.push(f(k))}d=e.toDer(r).getBytes(),n.md.start().update(d)}n.signature=n.key.sign(n.md,"RSASSA-PKCS1-V1_5")}u.signerInfos=g(u.signers)}},a.createEncryptedData=function(){var u=null;return u={type:i.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:i.pki.oids["aes256-CBC"]},fromAsn1:function(v){D(u,v,a.asn1.encryptedDataValidator)},decrypt:function(v){v!==void 0&&(u.encryptedContent.key=v),E(u)}},u},a.createEnvelopedData=function(){var u=null;return u={type:i.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:i.pki.oids["aes256-CBC"]},fromAsn1:function(v){var C=D(u,v,a.asn1.envelopedDataValidator);u.recipients=S(C.recipientInfos.value)},toAsn1:function(){return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u.type).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(u.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,c(u.recipients)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,x(u.encryptedContent))])])])},findRecipient:function(v){for(var C=v.issuer.attributes,y=0;y<u.recipients.length;++y){var s=u.recipients[y],h=s.issuer;if(s.serialNumber===v.serialNumber&&h.length===C.length){for(var d=!0,I=0;I<C.length;++I)if(h[I].type!==C[I].type||h[I].value!==C[I].value){d=!1;break}if(d)return s}}return null},decrypt:function(v,C){if(u.encryptedContent.key===void 0&&v!==void 0&&C!==void 0)switch(v.encryptedContent.algorithm){case i.pki.oids.rsaEncryption:case i.pki.oids.desCBC:var y=C.decrypt(v.encryptedContent.content);u.encryptedContent.key=i.util.createBuffer(y);break;default:throw new Error("Unsupported asymmetric cipher, OID "+v.encryptedContent.algorithm)}E(u)},addRecipient:function(v){u.recipients.push({version:0,issuer:v.issuer.attributes,serialNumber:v.serialNumber,encryptedContent:{algorithm:i.pki.oids.rsaEncryption,key:v.publicKey}})},encrypt:function(v,C){if(u.encryptedContent.content===void 0){C=C||u.encryptedContent.algorithm,v=v||u.encryptedContent.key;var y,s,h;switch(C){case i.pki.oids["aes128-CBC"]:y=16,s=16,h=i.aes.createEncryptionCipher;break;case i.pki.oids["aes192-CBC"]:y=24,s=16,h=i.aes.createEncryptionCipher;break;case i.pki.oids["aes256-CBC"]:y=32,s=16,h=i.aes.createEncryptionCipher;break;case i.pki.oids["des-EDE3-CBC"]:y=24,s=8,h=i.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+C)}if(v===void 0)v=i.util.createBuffer(i.random.getBytes(y));else if(v.length()!=y)throw new Error("Symmetric key has wrong length; got "+v.length()+" bytes, expected "+y+".");u.encryptedContent.algorithm=C,u.encryptedContent.key=v,u.encryptedContent.parameter=i.util.createBuffer(i.random.getBytes(s));var d=h(v);if(d.start(u.encryptedContent.parameter.copy()),d.update(u.content),!d.finish())throw new Error("Symmetric encryption failed.");u.encryptedContent.content=d.output}for(var I=0;I<u.recipients.length;++I){var w=u.recipients[I];if(w.encryptedContent.content===void 0)if(w.encryptedContent.algorithm===i.pki.oids.rsaEncryption)w.encryptedContent.content=w.encryptedContent.key.encrypt(u.encryptedContent.key.data);else throw new Error("Unsupported asymmetric cipher, OID "+w.encryptedContent.algorithm)}}},u};function p(u){var v={},C=[];if(!e.validate(u,a.asn1.recipientInfoValidator,v,C)){var y=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw y.errors=C,y}return{version:v.version.charCodeAt(0),issuer:i.pki.RDNAttributesAsArray(v.issuer),serialNumber:i.util.createBuffer(v.serial).toHex(),encryptedContent:{algorithm:e.derToOid(v.encAlgorithm),parameter:v.encParameter?v.encParameter.value:void 0,content:v.encKey}}}function N(u){return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(u.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[i.pki.distinguishedNameToAsn1({attributes:u.issuer}),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,i.util.hexToBytes(u.serialNumber))]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u.encryptedContent.algorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,u.encryptedContent.content)])}function S(u){for(var v=[],C=0;C<u.length;++C)v.push(p(u[C]));return v}function c(u){for(var v=[],C=0;C<u.length;++C)v.push(N(u[C]));return v}function t(u){var v=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(u.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[i.pki.distinguishedNameToAsn1({attributes:u.issuer}),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,i.util.hexToBytes(u.serialNumber))]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u.digestAlgorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])]);if(u.authenticatedAttributesAsn1&&v.value.push(u.authenticatedAttributesAsn1),v.value.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u.signatureAlgorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])),v.value.push(e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,u.signature)),u.unauthenticatedAttributes.length>0){for(var C=e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[]),y=0;y<u.unauthenticatedAttributes.length;++y){var s=u.unauthenticatedAttributes[y];C.values.push(f(s))}v.value.push(C)}return v}function g(u){for(var v=[],C=0;C<u.length;++C)v.push(t(u[C]));return v}function f(u){var v;if(u.type===i.pki.oids.contentType)v=e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u.value).getBytes());else if(u.type===i.pki.oids.messageDigest)v=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,u.value.bytes());else if(u.type===i.pki.oids.signingTime){var C=new Date("1950-01-01T00:00:00Z"),y=new Date("2050-01-01T00:00:00Z"),s=u.value;if(typeof s=="string"){var h=Date.parse(s);isNaN(h)?s.length===13?s=e.utcTimeToDate(s):s=e.generalizedTimeToDate(s):s=new Date(h)}s>=C&&s<y?v=e.create(e.Class.UNIVERSAL,e.Type.UTCTIME,!1,e.dateToUtcTime(s)):v=e.create(e.Class.UNIVERSAL,e.Type.GENERALIZEDTIME,!1,e.dateToGeneralizedTime(s))}return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u.type).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[v])])}function x(u){return[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(i.pki.oids.data).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u.algorithm).getBytes()),u.parameter?e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,u.parameter.getBytes()):void 0]),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,u.content.getBytes())])]}function D(u,v,C){var y={},s=[];if(!e.validate(v,C,y,s)){var h=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw h.errors=h,h}var d=e.derToOid(y.contentType);if(d!==i.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(y.encryptedContent){var I="";if(i.util.isArray(y.encryptedContent))for(var w=0;w<y.encryptedContent.length;++w){if(y.encryptedContent[w].type!==e.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");I+=y.encryptedContent[w].value}else I=y.encryptedContent;u.encryptedContent={algorithm:e.derToOid(y.encAlgorithm),parameter:i.util.createBuffer(y.encParameter.value),content:i.util.createBuffer(I)}}if(y.content){var I="";if(i.util.isArray(y.content))for(var w=0;w<y.content.length;++w){if(y.content[w].type!==e.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");I+=y.content[w].value}else I=y.content;u.content=i.util.createBuffer(I)}return u.version=y.version.charCodeAt(0),u.rawCapture=y,y}function E(u){if(u.encryptedContent.key===void 0)throw new Error("Symmetric key not available.");if(u.content===void 0){var v;switch(u.encryptedContent.algorithm){case i.pki.oids["aes128-CBC"]:case i.pki.oids["aes192-CBC"]:case i.pki.oids["aes256-CBC"]:v=i.aes.createDecryptionCipher(u.encryptedContent.key);break;case i.pki.oids.desCBC:case i.pki.oids["des-EDE3-CBC"]:v=i.des.createDecryptionCipher(u.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+u.encryptedContent.algorithm)}if(v.start(u.encryptedContent.parameter),v.update(u.encryptedContent.content),!v.finish())throw new Error("Symmetric decryption failed.");u.content=v.output}}return vr.exports}var yr={exports:{}},Ca;function Ua(){if(Ca)return yr.exports;Ca=1;var i=ue();ut(),vt(),Ft(),yt(),ce();var e=yr.exports=i.ssh=i.ssh||{};e.privateKeyToPutty=function(S,c,t){t=t||"",c=c||"";var g="ssh-rsa",f=c===""?"none":"aes256-cbc",x="PuTTY-User-Key-File-2: "+g+`\r
`;x+="Encryption: "+f+`\r
`,x+="Comment: "+t+`\r
`;var D=i.util.createBuffer();p(D,g),a(D,S.e),a(D,S.n);var E=i.util.encode64(D.bytes(),64),u=Math.floor(E.length/66)+1;x+="Public-Lines: "+u+`\r
`,x+=E;var v=i.util.createBuffer();a(v,S.d),a(v,S.p),a(v,S.q),a(v,S.qInv);var C;if(!c)C=i.util.encode64(v.bytes(),64);else{var y=v.length()+16-1;y-=y%16;var s=N(v.bytes());s.truncate(s.length()-y+v.length()),v.putBuffer(s);var h=i.util.createBuffer();h.putBuffer(N("\0\0\0\0",c)),h.putBuffer(N("\0\0\0",c));var d=i.aes.createEncryptionCipher(h.truncate(8),"CBC");d.start(i.util.createBuffer().fillWithByte(0,16)),d.update(v.copy()),d.finish();var I=d.output;I.truncate(16),C=i.util.encode64(I.bytes(),64)}u=Math.floor(C.length/66)+1,x+=`\r
Private-Lines: `+u+`\r
`,x+=C;var w=N("putty-private-key-file-mac-key",c),l=i.util.createBuffer();p(l,g),p(l,f),p(l,t),l.putInt32(D.length()),l.putBuffer(D),l.putInt32(v.length()),l.putBuffer(v);var n=i.hmac.create();return n.start("sha1",w),n.update(l.bytes()),x+=`\r
Private-MAC: `+n.digest().toHex()+`\r
`,x},e.publicKeyToOpenSSH=function(S,c){var t="ssh-rsa";c=c||"";var g=i.util.createBuffer();return p(g,t),a(g,S.e),a(g,S.n),t+" "+i.util.encode64(g.bytes())+" "+c},e.privateKeyToOpenSSH=function(S,c){return c?i.pki.encryptRsaPrivateKey(S,c,{legacy:!0,algorithm:"aes128"}):i.pki.privateKeyToPem(S)},e.getPublicKeyFingerprint=function(S,c){c=c||{};var t=c.md||i.md.md5.create(),g="ssh-rsa",f=i.util.createBuffer();p(f,g),a(f,S.e),a(f,S.n),t.start(),t.update(f.getBytes());var x=t.digest();if(c.encoding==="hex"){var D=x.toHex();return c.delimiter?D.match(/.{2}/g).join(c.delimiter):D}else{if(c.encoding==="binary")return x.getBytes();if(c.encoding)throw new Error('Unknown encoding "'+c.encoding+'".')}return x};function a(S,c){var t=c.toString(16);t[0]>="8"&&(t="00"+t);var g=i.util.hexToBytes(t);S.putInt32(g.length),S.putBytes(g)}function p(S,c){S.putInt32(c.length),S.putString(c)}function N(){for(var S=i.md.sha1.create(),c=arguments.length,t=0;t<c;++t)S.update(arguments[t]);return S.digest()}return yr.exports}var gr,ma;function Pa(){return ma||(ma=1,gr=ue(),ut(),_a(),tt(),wt(),Ct(),Ra(),vt(),wa(),La(),ka(),Jr(),zt(),ct(),Gr(),ia(),Da(),sa(),zr(),Vr(),or(),je(),Fr(),Ua(),ua(),ce()),gr}var Va=Pa(),ht=Sa(Va);self.onmessage=i=>{const e=Ka(i.data);self.postMessage(e)};const Oa=i=>{const e=self.crypto,a=65536,p=new Uint8Array(i);for(let N=0;N<i;N+=a)e.getRandomValues(p.subarray(N,N+Math.min(i-N,a)));return p},Ea=[{name:"organizationName",value:(i=>i.replace(/[^a-zA-Z0-9 '()+,-./:=?]/g,""))(`LXD UI ${location.hostname} (Browser Generated)`)}],Ka=i=>{const a=ht.pki.rsa.generateKeyPair(2048),p=ht.pki.createCertificate();p.publicKey=a.publicKey,p.serialNumber="01"+Oa(20).toString().substring(0,30),p.validity.notBefore=new Date,p.validity.notAfter=new Date(Date.now()+1e3*60*60*24*1e3),p.setSubject(Ea),p.setIssuer(Ea),p.sign(a.privateKey);const N=ht.pki.certificateToPem(p),S=ht.pkcs12.toPkcs12Asn1(a.privateKey,[p],i,{algorithm:"3des",generateLocalKeyId:!0,friendlyName:"LXD-UI"}),c=ht.asn1.toDer(S).getBytes(),t=ht.util.encode64(c);return{crt:N,pfx:t}}})();