Files
codeql-action/lib/start-proxy-action.js
T
Mads Navntoft 436aa0401d PoC: switch esbuild bundles to ESM with code splitting + minify
Bundles each entry point as ESM with esbuild's splitting:true so
shared transitive dependencies (Azure storage, undici, octokit, ...)
live in shared chunk files under lib/chunks/ instead of being
duplicated into every entry bundle.

A small banner is injected so bundled CommonJS deps that call
require(), __filename or __dirname at runtime still work. A
lib/package.json with { "type": "module" } is written by the build
so the bundles can keep the .js extension while being loaded as ESM
by Node; this scope avoids touching the tsc output in build/ and the
action.yml entrypoints stay unchanged.

On a measured tar.gz of the working tree this takes the repo from
~9.5 MB to ~2.6 MB compressed (lib/ alone: 8.0 MB -> 0.7 MB).
2026-05-14 14:43:23 +02:00

27 lines
294 KiB
JavaScript
Generated

import { createRequire as __codeqlCreateRequire } from "module";import { fileURLToPath as __codeqlFileURLToPath } from "url";import { dirname as __codeqlDirname } from "path";var require = __codeqlCreateRequire(import.meta.url);var __filename = __codeqlFileURLToPath(import.meta.url);var __dirname = __codeqlDirname(__filename);
import{a as Wi,b as Xi,c as $i}from"./chunks/chunk-GX7WDUZJ.js";import{c as Qi,e as Ea,f as Sa,h as Yi}from"./chunks/chunk-B34OPX2S.js";import{$a as Gi,Ka as Oi,Nb as zi,O as bt,Oa as Fi,Qa as Ki,Ra as qi,Rb as Wo,Sa as Mi,Ta as kr,V as Pi,X as Vi,_a as Hi,a as ya,b as j,c as Bt,ea as Rr,fa as Ye,ga as ma,h as Qo,i as Yo,k as va,kc as Xo,lb as ji,na as xe,q as Li,r as ki,s as Di,sa as Lr,t as qt,ta as Ca,u as Ui,v as ye,w as xt,x as Et,zb as xa}from"./chunks/chunk-V6LGBXSF.js";var Q=j((Hc,xn)=>{xn.exports={options:{usePureJavaScript:!1}}});var Tn=j((Gc,Sn)=>{var _a={};Sn.exports=_a;var En={};_a.encode=function(e,t,a){if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');if(a!==void 0&&typeof a!="number")throw new TypeError('"maxline" must be a number.');var r="";if(!(e instanceof Uint8Array))r=E0(e,t);else{var i=0,s=t.length,n=t.charAt(0),o=[0];for(i=0;i<e.length;++i){for(var f=0,u=e[i];f<o.length;++f)u+=o[f]<<8,o[f]=u%s,u=u/s|0;for(;u>0;)o.push(u%s),u=u/s|0}for(i=0;e[i]===0&&i<e.length-1;++i)r+=n;for(i=o.length-1;i>=0;--i)r+=t[o[i]]}if(a){var l=new RegExp(".{1,"+a+"}","g");r=r.match(l).join(`\r
`)}return r};_a.decode=function(e,t){if(typeof e!="string")throw new TypeError('"input" must be a string.');if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');var a=En[t];if(!a){a=En[t]=[];for(var r=0;r<t.length;++r)a[t.charCodeAt(r)]=r}e=e.replace(/\s/g,"");for(var i=t.length,s=t.charAt(0),n=[0],r=0;r<e.length;r++){var o=a[e.charCodeAt(r)];if(o===void 0)return;for(var f=0,u=o;f<n.length;++f)u+=n[f]*i,n[f]=u&255,u>>=8;for(;u>0;)n.push(u&255),u>>=8}for(var l=0;e[l]===s&&l<e.length-1;++l)n.push(0);return typeof Buffer<"u"?Buffer.from(n.reverse()):new Uint8Array(n.reverse())};function E0(e,t){var a=0,r=t.length,i=t.charAt(0),s=[0];for(a=0;a<e.length();++a){for(var n=0,o=e.at(a);n<s.length;++n)o+=s[n]<<8,s[n]=o%r,o=o/r|0;for(;o>0;)s.push(o%r),o=o/r|0}var f="";for(a=0;e.at(a)===0&&a<e.length()-1;++a)f+=i;for(a=s.length-1;a>=0;--a)f+=t[s[a]];return f}});var re=j((jc,bn)=>{var An=Q(),In=Tn(),x=bn.exports=An.util=An.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){x.nextTick=process.nextTick,typeof setImmediate=="function"?x.setImmediate=setImmediate:x.setImmediate=x.nextTick;return}if(typeof setImmediate=="function"){x.setImmediate=function(){return setImmediate.apply(void 0,arguments)},x.nextTick=function(o){return setImmediate(o)};return}if(x.setImmediate=function(o){setTimeout(o,0)},typeof window<"u"&&typeof window.postMessage=="function"){let o=function(f){if(f.source===window&&f.data===e){f.stopPropagation();var u=t.slice();t.length=0,u.forEach(function(l){l()})}};var n=o,e="forge.setImmediate",t=[];x.setImmediate=function(f){t.push(f),t.length===1&&window.postMessage(e,"*")},window.addEventListener("message",o,!0)}if(typeof MutationObserver<"u"){var a=Date.now(),r=!0,i=document.createElement("div"),t=[];new MutationObserver(function(){var f=t.slice();t.length=0,f.forEach(function(u){u()})}).observe(i,{attributes:!0});var s=x.setImmediate;x.setImmediate=function(f){Date.now()-a>15?(a=Date.now(),s(f)):(t.push(f),t.length===1&&i.setAttribute("a",r=!r))}}x.nextTick=x.setImmediate})();x.isNodejs=typeof process<"u"&&process.versions&&process.versions.node;x.globalScope=(function(){return x.isNodejs?global:typeof self>"u"?window:self})();x.isArray=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};x.isArrayBuffer=function(e){return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer};x.isArrayBufferView=function(e){return e&&x.isArrayBuffer(e.buffer)&&e.byteLength!==void 0};function gr(e){if(!(e===8||e===16||e===24||e===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}x.ByteBuffer=Na;function Na(e){if(this.data="",this.read=0,typeof e=="string")this.data=e;else if(x.isArrayBuffer(e)||x.isArrayBufferView(e))if(typeof Buffer<"u"&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch{for(var a=0;a<t.length;++a)this.putByte(t[a])}}else(e instanceof Na||typeof e=="object"&&typeof e.data=="string"&&typeof e.read=="number")&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}x.ByteStringBuffer=Na;var S0=4096;x.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>S0&&(this.data.substr(0,1),this._constructedStringLength=0)};x.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};x.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0};x.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))};x.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var a=this.data;t>0;)t&1&&(a+=e),t>>>=1,t>0&&(e+=e);return this.data=a,this._optimizeConstructedString(t),this};x.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this};x.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(x.encodeUtf8(e))};x.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))};x.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))};x.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))};x.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255))};x.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))};x.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))};x.ByteStringBuffer.prototype.putInt=function(e,t){gr(t);var a="";do t-=8,a+=String.fromCharCode(e>>t&255);while(t>0);return this.putBytes(a)};x.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)};x.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())};x.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)};x.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e};x.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e};x.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e};x.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e};x.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e};x.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e};x.ByteStringBuffer.prototype.getInt=function(e){gr(e);var t=0;do t=(t<<8)+this.data.charCodeAt(this.read++),e-=8;while(e>0);return t};x.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),a=2<<e-2;return t>=a&&(t-=a<<1),t};x.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):e===0?t="":(t=this.read===0?this.data:this.data.slice(this.read),this.clear()),t};x.ByteStringBuffer.prototype.bytes=function(e){return typeof e>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+e)};x.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)};x.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this};x.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};x.ByteStringBuffer.prototype.copy=function(){var e=x.createBuffer(this.data);return e.read=this.read,e};x.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this};x.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this};x.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this};x.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var a=this.data.charCodeAt(t);a<16&&(e+="0"),e+=a.toString(16)}return e};x.ByteStringBuffer.prototype.toString=function(){return x.decodeUtf8(this.bytes())};function T0(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var a=x.isArrayBuffer(e),r=x.isArrayBufferView(e);if(a||r){a?this.data=new DataView(e):this.data=new DataView(e.buffer,e.byteOffset,e.byteLength),this.write="writeOffset"in t?t.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,e!=null&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)}x.DataBuffer=T0;x.DataBuffer.prototype.length=function(){return this.write-this.read};x.DataBuffer.prototype.isEmpty=function(){return this.length()<=0};x.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var a=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),r=new Uint8Array(this.length()+t);return r.set(a),this.data=new DataView(r.buffer),this};x.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this};x.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var a=0;a<t;++a)this.data.setUint8(e);return this};x.DataBuffer.prototype.putBytes=function(e,t){if(x.isArrayBufferView(e)){var a=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=a.byteLength-a.byteOffset;this.accommodate(r);var i=new Uint8Array(this.data.buffer,this.write);return i.set(a),this.write+=r,this}if(x.isArrayBuffer(e)){var a=new Uint8Array(e);this.accommodate(a.byteLength);var i=new Uint8Array(this.data.buffer);return i.set(a,this.write),this.write+=a.byteLength,this}if(e instanceof x.DataBuffer||typeof e=="object"&&typeof e.read=="number"&&typeof e.write=="number"&&x.isArrayBufferView(e.data)){var a=new Uint8Array(e.data.byteLength,e.read,e.length());this.accommodate(a.byteLength);var i=new Uint8Array(e.data.byteLength,this.write);return i.set(a),this.write+=a.byteLength,this}if(e instanceof x.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary",typeof e=="string"){var s;if(t==="hex")return this.accommodate(Math.ceil(e.length/2)),s=new Uint8Array(this.data.buffer,this.write),this.write+=x.binary.hex.decode(e,s,this.write),this;if(t==="base64")return this.accommodate(Math.ceil(e.length/4)*3),s=new Uint8Array(this.data.buffer,this.write),this.write+=x.binary.base64.decode(e,s,this.write),this;if(t==="utf8"&&(e=x.encodeUtf8(e),t="binary"),t==="binary"||t==="raw")return this.accommodate(e.length),s=new Uint8Array(this.data.buffer,this.write),this.write+=x.binary.raw.decode(s),this;if(t==="utf16")return this.accommodate(e.length*2),s=new Uint16Array(this.data.buffer,this.write),this.write+=x.text.utf16.encode(s),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)};x.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this};x.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")};x.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this};x.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this};x.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this};x.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this};x.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this};x.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this};x.DataBuffer.prototype.putInt=function(e,t){gr(t),this.accommodate(t/8);do t-=8,this.data.setInt8(this.write++,e>>t&255);while(t>0);return this};x.DataBuffer.prototype.putSignedInt=function(e,t){return gr(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)};x.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)};x.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e};x.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e};x.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e};x.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e};x.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e};x.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e};x.DataBuffer.prototype.getInt=function(e){gr(e);var t=0;do t=(t<<8)+this.data.getInt8(this.read++),e-=8;while(e>0);return t};x.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),a=2<<e-2;return t>=a&&(t-=a<<1),t};x.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):e===0?t="":(t=this.read===0?this.data:this.data.slice(this.read),this.clear()),t};x.DataBuffer.prototype.bytes=function(e){return typeof e>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+e)};x.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)};x.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this};x.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};x.DataBuffer.prototype.copy=function(){return new x.DataBuffer(this)};x.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this};x.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this};x.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this};x.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var a=this.data.getUint8(t);a<16&&(e+="0"),e+=a.toString(16)}return e};x.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if(e=e||"utf8",e==="binary"||e==="raw")return x.binary.raw.encode(t);if(e==="hex")return x.binary.hex.encode(t);if(e==="base64")return x.binary.base64.encode(t);if(e==="utf8")return x.text.utf8.decode(t);if(e==="utf16")return x.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)};x.createBuffer=function(e,t){return t=t||"raw",e!==void 0&&t==="utf8"&&(e=x.encodeUtf8(e)),new x.ByteBuffer(e)};x.fillString=function(e,t){for(var a="";t>0;)t&1&&(a+=e),t>>>=1,t>0&&(e+=e);return a};x.xorBytes=function(e,t,a){for(var r="",i="",s="",n=0,o=0;a>0;--a,++n)i=e.charCodeAt(n)^t.charCodeAt(n),o>=10&&(r+=s,s="",o=0),s+=String.fromCharCode(i),++o;return r+=s,r};x.hexToBytes=function(e){var t="",a=0;for(e.length&!0&&(a=1,t+=String.fromCharCode(parseInt(e[0],16)));a<e.length;a+=2)t+=String.fromCharCode(parseInt(e.substr(a,2),16));return t};x.bytesToHex=function(e){return x.createBuffer(e).toHex()};x.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255)};var Nt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",wt=[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],Bn="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";x.encode64=function(e,t){for(var a="",r="",i,s,n,o=0;o<e.length;)i=e.charCodeAt(o++),s=e.charCodeAt(o++),n=e.charCodeAt(o++),a+=Nt.charAt(i>>2),a+=Nt.charAt((i&3)<<4|s>>4),isNaN(s)?a+="==":(a+=Nt.charAt((s&15)<<2|n>>6),a+=isNaN(n)?"=":Nt.charAt(n&63)),t&&a.length>t&&(r+=a.substr(0,t)+`\r
`,a=a.substr(t));return r+=a,r};x.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t="",a,r,i,s,n=0;n<e.length;)a=wt[e.charCodeAt(n++)-43],r=wt[e.charCodeAt(n++)-43],i=wt[e.charCodeAt(n++)-43],s=wt[e.charCodeAt(n++)-43],t+=String.fromCharCode(a<<2|r>>4),i!==64&&(t+=String.fromCharCode((r&15)<<4|i>>2),s!==64&&(t+=String.fromCharCode((i&3)<<6|s)));return t};x.encodeUtf8=function(e){return unescape(encodeURIComponent(e))};x.decodeUtf8=function(e){return decodeURIComponent(escape(e))};x.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:In.encode,decode:In.decode}};x.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)};x.binary.raw.decode=function(e,t,a){var r=t;r||(r=new Uint8Array(e.length)),a=a||0;for(var i=a,s=0;s<e.length;++s)r[i++]=e.charCodeAt(s);return t?i-a:r};x.binary.hex.encode=x.bytesToHex;x.binary.hex.decode=function(e,t,a){var r=t;r||(r=new Uint8Array(Math.ceil(e.length/2))),a=a||0;var i=0,s=a;for(e.length&1&&(i=1,r[s++]=parseInt(e[0],16));i<e.length;i+=2)r[s++]=parseInt(e.substr(i,2),16);return t?s-a:r};x.binary.base64.encode=function(e,t){for(var a="",r="",i,s,n,o=0;o<e.byteLength;)i=e[o++],s=e[o++],n=e[o++],a+=Nt.charAt(i>>2),a+=Nt.charAt((i&3)<<4|s>>4),isNaN(s)?a+="==":(a+=Nt.charAt((s&15)<<2|n>>6),a+=isNaN(n)?"=":Nt.charAt(n&63)),t&&a.length>t&&(r+=a.substr(0,t)+`\r
`,a=a.substr(t));return r+=a,r};x.binary.base64.decode=function(e,t,a){var r=t;r||(r=new Uint8Array(Math.ceil(e.length/4)*3)),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),a=a||0;for(var i,s,n,o,f=0,u=a;f<e.length;)i=wt[e.charCodeAt(f++)-43],s=wt[e.charCodeAt(f++)-43],n=wt[e.charCodeAt(f++)-43],o=wt[e.charCodeAt(f++)-43],r[u++]=i<<2|s>>4,n!==64&&(r[u++]=(s&15)<<4|n>>2,o!==64&&(r[u++]=(n&3)<<6|o));return t?u-a:r.subarray(0,u)};x.binary.base58.encode=function(e,t){return x.binary.baseN.encode(e,Bn,t)};x.binary.base58.decode=function(e,t){return x.binary.baseN.decode(e,Bn,t)};x.text={utf8:{},utf16:{}};x.text.utf8.encode=function(e,t,a){e=x.encodeUtf8(e);var r=t;r||(r=new Uint8Array(e.length)),a=a||0;for(var i=a,s=0;s<e.length;++s)r[i++]=e.charCodeAt(s);return t?i-a:r};x.text.utf8.decode=function(e){return x.decodeUtf8(String.fromCharCode.apply(null,e))};x.text.utf16.encode=function(e,t,a){var r=t;r||(r=new Uint8Array(e.length*2));var i=new Uint16Array(r.buffer);a=a||0;for(var s=a,n=a,o=0;o<e.length;++o)i[n++]=e.charCodeAt(o),s+=2;return t?s-a:r};x.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))};x.deflate=function(e,t,a){if(t=x.decode64(e.deflate(x.encode64(t)).rval),a){var r=2,i=t.charCodeAt(1);i&32&&(r=6),t=t.substring(r,t.length-4)}return t};x.inflate=function(e,t,a){var r=e.inflate(x.encode64(t)).rval;return r===null?null:x.decode64(r)};var wa=function(e,t,a){if(!e)throw new Error("WebStorage not available.");var r;if(a===null?r=e.removeItem(t):(a=x.encode64(JSON.stringify(a)),r=e.setItem(t,a)),typeof r<"u"&&r.rval!==!0){var i=new Error(r.error.message);throw i.id=r.error.id,i.name=r.error.name,i}},Ra=function(e,t){if(!e)throw new Error("WebStorage not available.");var a=e.getItem(t);if(e.init)if(a.rval===null){if(a.error){var r=new Error(a.error.message);throw r.id=a.error.id,r.name=a.error.name,r}a=null}else a=a.rval;return a!==null&&(a=JSON.parse(x.decode64(a))),a},A0=function(e,t,a,r){var i=Ra(e,t);i===null&&(i={}),i[a]=r,wa(e,t,i)},I0=function(e,t,a){var r=Ra(e,t);return r!==null&&(r=a in r?r[a]:null),r},B0=function(e,t,a){var r=Ra(e,t);if(r!==null&&a in r){delete r[a];var i=!0;for(var s in r){i=!1;break}i&&(r=null),wa(e,t,r)}},b0=function(e,t){wa(e,t,null)},Ur=function(e,t,a){var r=null;typeof a>"u"&&(a=["web","flash"]);var i,s=!1,n=null;for(var o in a){i=a[o];try{if(i==="flash"||i==="both"){if(t[0]===null)throw new Error("Flash local storage not available.");r=e.apply(this,t),s=i==="flash"}(i==="web"||i==="both")&&(t[0]=localStorage,r=e.apply(this,t),s=!0)}catch(f){n=f}if(s)break}if(!s)throw n;return r};x.setItem=function(e,t,a,r,i){Ur(A0,arguments,i)};x.getItem=function(e,t,a,r){return Ur(I0,arguments,r)};x.removeItem=function(e,t,a,r){Ur(B0,arguments,r)};x.clearItems=function(e,t,a){Ur(b0,arguments,a)};x.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0};x.format=function(e){for(var t=/%./g,a,r,i=0,s=[],n=0;a=t.exec(e);){r=e.substring(n,t.lastIndex-2),r.length>0&&s.push(r),n=t.lastIndex;var o=a[0][1];switch(o){case"s":case"o":i<arguments.length?s.push(arguments[i+++1]):s.push("<?>");break;case"%":s.push("%");break;default:s.push("<%"+o+"?>")}}return s.push(e.substring(n)),s.join("")};x.formatNumber=function(e,t,a,r){var i=e,s=isNaN(t=Math.abs(t))?2:t,n=a===void 0?",":a,o=r===void 0?".":r,f=i<0?"-":"",u=parseInt(i=Math.abs(+i||0).toFixed(s),10)+"",l=u.length>3?u.length%3:0;return f+(l?u.substr(0,l)+o:"")+u.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+o)+(s?n+Math.abs(i-u).toFixed(s).slice(2):"")};x.formatSize=function(e){return e>=1073741824?e=x.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?e=x.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?e=x.formatNumber(e/1024,0)+" KiB":e=x.formatNumber(e,0)+" bytes",e};x.bytesFromIP=function(e){return e.indexOf(".")!==-1?x.bytesFromIPv4(e):e.indexOf(":")!==-1?x.bytesFromIPv6(e):null};x.bytesFromIPv4=function(e){if(e=e.split("."),e.length!==4)return null;for(var t=x.createBuffer(),a=0;a<e.length;++a){var r=parseInt(e[a],10);if(isNaN(r))return null;t.putByte(r)}return t.getBytes()};x.bytesFromIPv6=function(e){var t=0;e=e.split(":").filter(function(n){return n.length===0&&++t,!0});for(var a=(8-e.length+t)*2,r=x.createBuffer(),i=0;i<8;++i){if(!e[i]||e[i].length===0){r.fillWithByte(0,a),a=0;continue}var s=x.hexToBytes(e[i]);s.length<2&&r.putByte(0),r.putBytes(s)}return r.getBytes()};x.bytesToIP=function(e){return e.length===4?x.bytesToIPv4(e):e.length===16?x.bytesToIPv6(e):null};x.bytesToIPv4=function(e){if(e.length!==4)return null;for(var t=[],a=0;a<e.length;++a)t.push(e.charCodeAt(a));return t.join(".")};x.bytesToIPv6=function(e){if(e.length!==16)return null;for(var t=[],a=[],r=0,i=0;i<e.length;i+=2){for(var s=x.bytesToHex(e[i]+e[i+1]);s[0]==="0"&&s!=="0";)s=s.substr(1);if(s==="0"){var n=a[a.length-1],o=t.length;!n||o!==n.end+1?a.push({start:o,end:o}):(n.end=o,n.end-n.start>a[r].end-a[r].start&&(r=a.length-1))}t.push(s)}if(a.length>0){var f=a[r];f.end-f.start>0&&(t.splice(f.start,f.end-f.start+1,""),f.start===0&&t.unshift(""),f.end===7&&t.push(""))}return t.join(":")};x.estimateCores=function(e,t){if(typeof e=="function"&&(t=e,e={}),e=e||{},"cores"in x&&!e.update)return t(null,x.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return x.cores=navigator.hardwareConcurrency,t(null,x.cores);if(typeof Worker>"u")return x.cores=1,t(null,x.cores);if(typeof Blob>"u")return x.cores=2,t(null,x.cores);var a=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(n){for(var o=Date.now(),f=o+4;Date.now()<f;);self.postMessage({st:o,et:f})})}.toString(),")()"],{type:"application/javascript"}));r([],5,16);function r(n,o,f){if(o===0){var u=Math.floor(n.reduce(function(l,c){return l+c},0)/n.length);return x.cores=Math.max(1,u),URL.revokeObjectURL(a),t(null,x.cores)}i(f,function(l,c){n.push(s(f,c)),r(n,o-1,f)})}function i(n,o){for(var f=[],u=[],l=0;l<n;++l){var c=new Worker(a);c.addEventListener("message",function(g){if(u.push(g.data),u.length===n){for(var m=0;m<n;++m)f[m].terminate();o(null,u)}}),f.push(c)}for(var l=0;l<n;++l)f[l].postMessage(l)}function s(n,o){for(var f=[],u=0;u<n;++u)for(var l=o[u],c=f[u]=[],g=0;g<n;++g)if(u!==g){var m=o[g];(l.st>m.st&&l.st<m.et||m.st>l.st&&m.st<l.et)&&c.push(g)}return f.reduce(function(y,E){return Math.max(y,E.length)},0)}}});var Pr=j((zc,_n)=>{var Te=Q();re();_n.exports=Te.cipher=Te.cipher||{};Te.cipher.algorithms=Te.cipher.algorithms||{};Te.cipher.createCipher=function(e,t){var a=e;if(typeof a=="string"&&(a=Te.cipher.getAlgorithm(a),a&&(a=a())),!a)throw new Error("Unsupported algorithm: "+e);return new Te.cipher.BlockCipher({algorithm:a,key:t,decrypt:!1})};Te.cipher.createDecipher=function(e,t){var a=e;if(typeof a=="string"&&(a=Te.cipher.getAlgorithm(a),a&&(a=a())),!a)throw new Error("Unsupported algorithm: "+e);return new Te.cipher.BlockCipher({algorithm:a,key:t,decrypt:!0})};Te.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),Te.cipher.algorithms[e]=t};Te.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in Te.cipher.algorithms?Te.cipher.algorithms[e]:null};var La=Te.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};La.prototype.start=function(e){e=e||{};var t={};for(var a in e)t[a]=e[a];t.decrypt=this._decrypt,this._finish=!1,this._input=Te.util.createBuffer(),this.output=e.output||Te.util.createBuffer(),this.mode.start(t)};La.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()};La.prototype.finish=function(e){e&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(a){return e(this.blockSize,a,!1)},this.mode.unpad=function(a){return e(this.blockSize,a,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,t))}});var Da=j((Qc,Nn)=>{var Ae=Q();re();Ae.cipher=Ae.cipher||{};var W=Nn.exports=Ae.cipher.modes=Ae.cipher.modes||{};W.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};W.ecb.prototype.start=function(e){};W.ecb.prototype.encrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._outBlock[r])};W.ecb.prototype.decrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._outBlock[r])};W.ecb.prototype.pad=function(e,t){var a=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(a,a),!0};W.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var a=e.length(),r=e.at(a-1);return r>this.blockSize<<2?!1:(e.truncate(r),!0)};W.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};W.cbc.prototype.start=function(e){if(e.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in e)this._iv=Vr(e.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")};W.cbc.prototype.encrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=this._prev[r]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._outBlock[r]);this._prev=this._outBlock};W.cbc.prototype.decrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._prev[r]^this._outBlock[r]);this._prev=this._inBlock.slice(0)};W.cbc.prototype.pad=function(e,t){var a=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(a,a),!0};W.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var a=e.length(),r=e.at(a-1);return r>this.blockSize<<2?!1:(e.truncate(r),!0)};W.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=Ae.util.createBuffer(),this._partialBytes=0};W.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=Vr(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};W.cfb.prototype.encrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32()^this._outBlock[i],t.putInt32(this._inBlock[i]);return}var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32()^this._outBlock[i],this._partialOutput.putInt32(this._partialBlock[i]);if(s>0)e.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0};W.cfb.prototype.decrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32(),t.putInt32(this._inBlock[i]^this._outBlock[i]);return}var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[i]^this._outBlock[i]);if(s>0)e.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0};W.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Ae.util.createBuffer(),this._partialBytes=0};W.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=Vr(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};W.ofb.prototype.encrypt=function(e,t,a){var r=e.length();if(e.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]),this._inBlock[i]=this._outBlock[i];return}var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(s>0)e.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._outBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0};W.ofb.prototype.decrypt=W.ofb.prototype.encrypt;W.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Ae.util.createBuffer(),this._partialBytes=0};W.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=Vr(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};W.ctr.prototype.encrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]);else{var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(s>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}Or(this._inBlock)};W.ctr.prototype.decrypt=W.ctr.prototype.encrypt;W.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=Ae.util.createBuffer(),this._partialBytes=0,this._R=3774873600};W.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=Ae.util.createBuffer(e.iv);this._cipherLength=0;var a;if("additionalData"in e?a=Ae.util.createBuffer(e.additionalData):a=Ae.util.createBuffer(),"tagLength"in e?this._tagLength=e.tagLength:this._tagLength=128,this._tag=null,e.decrypt&&(this._tag=Ae.util.createBuffer(e.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 r=t.length();if(r===12)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(ka(r*8)))}this._inBlock=this._j0.slice(0),Or(this._inBlock),this._partialBytes=0,a=Ae.util.createBuffer(a),this._aDataLength=ka(a.length()*8);var i=a.length()%this.blockSize;for(i&&a.fillWithByte(0,this.blockSize-i),this._s=[0,0,0,0];a.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[a.getInt32(),a.getInt32(),a.getInt32(),a.getInt32()])};W.gcm.prototype.encrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^=e.getInt32());this._cipherLength+=this.blockSize}else{var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(s<=0||a){if(a){var n=r%this.blockSize;this._cipherLength+=n,this._partialOutput.truncate(this.blockSize-n)}else this._cipherLength+=this.blockSize;for(var i=0;i<this._ints;++i)this._outBlock[i]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),Or(this._inBlock)};W.gcm.prototype.decrypt=function(e,t,a){var r=e.length();if(r<this.blockSize&&!(a&&r>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),Or(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^this._hashBlock[i]);r<this.blockSize?this._cipherLength+=r%this.blockSize:this._cipherLength+=this.blockSize};W.gcm.prototype.afterFinish=function(e,t){var a=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=Ae.util.createBuffer();var r=this._aDataLength.concat(ka(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,r);var i=[];this.cipher.encrypt(this._j0,i);for(var s=0;s<this._ints;++s)this.tag.putInt32(this._s[s]^i[s]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(a=!1),a};W.gcm.prototype.multiply=function(e,t){for(var a=[0,0,0,0],r=t.slice(0),i=0;i<128;++i){var s=e[i/32|0]&1<<31-i%32;s&&(a[0]^=r[0],a[1]^=r[1],a[2]^=r[2],a[3]^=r[3]),this.pow(r,r)}return a};W.gcm.prototype.pow=function(e,t){for(var a=e[3]&1,r=3;r>0;--r)t[r]=e[r]>>>1|(e[r-1]&1)<<31;t[0]=e[0]>>>1,a&&(t[0]^=this._R)};W.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],a=0;a<32;++a){var r=a/8|0,i=e[r]>>>(7-a%8)*4&15,s=this._m[a][i];t[0]^=s[0],t[1]^=s[1],t[2]^=s[2],t[3]^=s[3]}return t};W.gcm.prototype.ghash=function(e,t,a){return t[0]^=a[0],t[1]^=a[1],t[2]^=a[2],t[3]^=a[3],this.tableMultiply(t)};W.gcm.prototype.generateHashTable=function(e,t){for(var a=8/t,r=4*a,i=16*a,s=new Array(i),n=0;n<i;++n){var o=[0,0,0,0],f=n/r|0,u=(r-1-n%r)*t;o[f]=1<<t-1<<u,s[n]=this.generateSubHashTable(this.multiply(o,e),t)}return s};W.gcm.prototype.generateSubHashTable=function(e,t){var a=1<<t,r=a>>>1,i=new Array(a);i[r]=e.slice(0);for(var s=r>>>1;s>0;)this.pow(i[2*s],i[s]=[]),s>>=1;for(s=2;s<r;){for(var n=1;n<s;++n){var o=i[s],f=i[n];i[s+n]=[o[0]^f[0],o[1]^f[1],o[2]^f[2],o[3]^f[3]]}s*=2}for(i[0]=[0,0,0,0],s=r+1;s<a;++s){var u=i[s^r];i[s]=[e[0]^u[0],e[1]^u[1],e[2]^u[2],e[3]^u[3]]}return i};function Vr(e,t){if(typeof e=="string"&&(e=Ae.util.createBuffer(e)),Ae.util.isArray(e)&&e.length>4){var a=e;e=Ae.util.createBuffer();for(var r=0;r<a.length;++r)e.putByte(a[r])}if(e.length()<t)throw new Error("Invalid IV length; got "+e.length()+" bytes and expected "+t+" bytes.");if(!Ae.util.isArray(e)){for(var i=[],s=t/4,r=0;r<s;++r)i.push(e.getInt32());e=i}return e}function Or(e){e[e.length-1]=e[e.length-1]+1&4294967295}function ka(e){return[e/4294967296|0,e&4294967295]}});var Rt=j((Yc,kn)=>{var fe=Q();Pr();Da();re();kn.exports=fe.aes=fe.aes||{};fe.aes.startEncrypting=function(e,t,a,r){var i=Fr({key:e,output:a,decrypt:!1,mode:r});return i.start(t),i};fe.aes.createEncryptionCipher=function(e,t){return Fr({key:e,output:null,decrypt:!1,mode:t})};fe.aes.startDecrypting=function(e,t,a,r){var i=Fr({key:e,output:a,decrypt:!0,mode:r});return i.start(t),i};fe.aes.createDecryptionCipher=function(e,t){return Fr({key:e,output:null,decrypt:!0,mode:t})};fe.aes.Algorithm=function(e,t){Va||Rn();var a=this;a.name=e,a.mode=new t({blockSize:16,cipher:{encrypt:function(r,i){return Pa(a._w,r,i,!1)},decrypt:function(r,i){return Pa(a._w,r,i,!0)}}}),a._init=!1};fe.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t=e.key,a;if(typeof t=="string"&&(t.length===16||t.length===24||t.length===32))t=fe.util.createBuffer(t);else if(fe.util.isArray(t)&&(t.length===16||t.length===24||t.length===32)){a=t,t=fe.util.createBuffer();for(var r=0;r<a.length;++r)t.putByte(a[r])}if(!fe.util.isArray(t)){a=t,t=[];var i=a.length();if(i===16||i===24||i===32){i=i>>>2;for(var r=0;r<i;++r)t.push(a.getInt32())}}if(!fe.util.isArray(t)||!(t.length===4||t.length===6||t.length===8))throw new Error("Invalid key parameter.");var s=this.mode.name,n=["CFB","OFB","CTR","GCM"].indexOf(s)!==-1;this._w=Ln(t,e.decrypt&&!n),this._init=!0}};fe.aes._expandKey=function(e,t){return Va||Rn(),Ln(e,t)};fe.aes._updateBlock=Pa;tr("AES-ECB",fe.cipher.modes.ecb);tr("AES-CBC",fe.cipher.modes.cbc);tr("AES-CFB",fe.cipher.modes.cfb);tr("AES-OFB",fe.cipher.modes.ofb);tr("AES-CTR",fe.cipher.modes.ctr);tr("AES-GCM",fe.cipher.modes.gcm);function tr(e,t){var a=function(){return new fe.aes.Algorithm(e,t)};fe.cipher.registerAlgorithm(e,a)}var Va=!1,er=4,Ge,Ua,wn,Mt,ot;function Rn(){Va=!0,wn=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;Ge=new Array(256),Ua=new Array(256),Mt=new Array(4),ot=new Array(4);for(var t=0;t<4;++t)Mt[t]=new Array(256),ot[t]=new Array(256);for(var a=0,r=0,i,s,n,o,f,u,l,t=0;t<256;++t){o=r^r<<1^r<<2^r<<3^r<<4,o=o>>8^o&255^99,Ge[a]=o,Ua[o]=a,f=e[o],i=e[a],s=e[i],n=e[s],u=f<<24^o<<16^o<<8^(o^f),l=(i^s^n)<<24^(a^n)<<16^(a^s^n)<<8^(a^i^n);for(var c=0;c<4;++c)Mt[c][a]=u,ot[c][o]=l,u=u<<24|u>>>8,l=l<<24|l>>>8;a===0?a=r=1:(a=i^e[e[e[i^n]]],r^=e[e[r]])}}function Ln(e,t){for(var a=e.slice(0),r,i=1,s=a.length,n=s+6+1,o=er*n,f=s;f<o;++f)r=a[f-1],f%s===0?(r=Ge[r>>>16&255]<<24^Ge[r>>>8&255]<<16^Ge[r&255]<<8^Ge[r>>>24]^wn[i]<<24,i++):s>6&&f%s===4&&(r=Ge[r>>>24]<<24^Ge[r>>>16&255]<<16^Ge[r>>>8&255]<<8^Ge[r&255]),a[f]=a[f-s]^r;if(t){var u,l=ot[0],c=ot[1],g=ot[2],m=ot[3],y=a.slice(0);o=a.length;for(var f=0,E=o-er;f<o;f+=er,E-=er)if(f===0||f===o-er)y[f]=a[E],y[f+1]=a[E+3],y[f+2]=a[E+2],y[f+3]=a[E+1];else for(var S=0;S<er;++S)u=a[E+S],y[f+(3&-S)]=l[Ge[u>>>24]]^c[Ge[u>>>16&255]]^g[Ge[u>>>8&255]]^m[Ge[u&255]];a=y}return a}function Pa(e,t,a,r){var i=e.length/4-1,s,n,o,f,u;r?(s=ot[0],n=ot[1],o=ot[2],f=ot[3],u=Ua):(s=Mt[0],n=Mt[1],o=Mt[2],f=Mt[3],u=Ge);var l,c,g,m,y,E,S;l=t[0]^e[0],c=t[r?3:1]^e[1],g=t[2]^e[2],m=t[r?1:3]^e[3];for(var A=3,B=1;B<i;++B)y=s[l>>>24]^n[c>>>16&255]^o[g>>>8&255]^f[m&255]^e[++A],E=s[c>>>24]^n[g>>>16&255]^o[m>>>8&255]^f[l&255]^e[++A],S=s[g>>>24]^n[m>>>16&255]^o[l>>>8&255]^f[c&255]^e[++A],m=s[m>>>24]^n[l>>>16&255]^o[c>>>8&255]^f[g&255]^e[++A],l=y,c=E,g=S;a[0]=u[l>>>24]<<24^u[c>>>16&255]<<16^u[g>>>8&255]<<8^u[m&255]^e[++A],a[r?3:1]=u[c>>>24]<<24^u[g>>>16&255]<<16^u[m>>>8&255]<<8^u[l&255]^e[++A],a[2]=u[g>>>24]<<24^u[m>>>16&255]<<16^u[l>>>8&255]<<8^u[c&255]^e[++A],a[r?1:3]=u[m>>>24]<<24^u[l>>>16&255]<<16^u[c>>>8&255]<<8^u[g&255]^e[++A]}function Fr(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),a="AES-"+t,r;e.decrypt?r=fe.cipher.createDecipher(a,e.key):r=fe.cipher.createCipher(a,e.key);var i=r.start;return r.start=function(s,n){var o=null;n instanceof fe.util.ByteBuffer&&(o=n,n={}),n=n||{},n.output=o,n.iv=s,i.call(r,n)},r}});var Lt=j((Wc,Dn)=>{var yr=Q();yr.pki=yr.pki||{};var Oa=Dn.exports=yr.pki.oids=yr.oids=yr.oids||{};function w(e,t){Oa[e]=t,Oa[t]=e}function ae(e,t){Oa[e]=t}w("1.2.840.113549.1.1.1","rsaEncryption");w("1.2.840.113549.1.1.4","md5WithRSAEncryption");w("1.2.840.113549.1.1.5","sha1WithRSAEncryption");w("1.2.840.113549.1.1.7","RSAES-OAEP");w("1.2.840.113549.1.1.8","mgf1");w("1.2.840.113549.1.1.9","pSpecified");w("1.2.840.113549.1.1.10","RSASSA-PSS");w("1.2.840.113549.1.1.11","sha256WithRSAEncryption");w("1.2.840.113549.1.1.12","sha384WithRSAEncryption");w("1.2.840.113549.1.1.13","sha512WithRSAEncryption");w("1.3.101.112","EdDSA25519");w("1.2.840.10040.4.3","dsa-with-sha1");w("1.3.14.3.2.7","desCBC");w("1.3.14.3.2.26","sha1");w("1.3.14.3.2.29","sha1WithRSASignature");w("2.16.840.1.101.3.4.2.1","sha256");w("2.16.840.1.101.3.4.2.2","sha384");w("2.16.840.1.101.3.4.2.3","sha512");w("2.16.840.1.101.3.4.2.4","sha224");w("2.16.840.1.101.3.4.2.5","sha512-224");w("2.16.840.1.101.3.4.2.6","sha512-256");w("1.2.840.113549.2.2","md2");w("1.2.840.113549.2.5","md5");w("1.2.840.113549.1.7.1","data");w("1.2.840.113549.1.7.2","signedData");w("1.2.840.113549.1.7.3","envelopedData");w("1.2.840.113549.1.7.4","signedAndEnvelopedData");w("1.2.840.113549.1.7.5","digestedData");w("1.2.840.113549.1.7.6","encryptedData");w("1.2.840.113549.1.9.1","emailAddress");w("1.2.840.113549.1.9.2","unstructuredName");w("1.2.840.113549.1.9.3","contentType");w("1.2.840.113549.1.9.4","messageDigest");w("1.2.840.113549.1.9.5","signingTime");w("1.2.840.113549.1.9.6","counterSignature");w("1.2.840.113549.1.9.7","challengePassword");w("1.2.840.113549.1.9.8","unstructuredAddress");w("1.2.840.113549.1.9.14","extensionRequest");w("1.2.840.113549.1.9.20","friendlyName");w("1.2.840.113549.1.9.21","localKeyId");w("1.2.840.113549.1.9.22.1","x509Certificate");w("1.2.840.113549.1.12.10.1.1","keyBag");w("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag");w("1.2.840.113549.1.12.10.1.3","certBag");w("1.2.840.113549.1.12.10.1.4","crlBag");w("1.2.840.113549.1.12.10.1.5","secretBag");w("1.2.840.113549.1.12.10.1.6","safeContentsBag");w("1.2.840.113549.1.5.13","pkcs5PBES2");w("1.2.840.113549.1.5.12","pkcs5PBKDF2");w("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4");w("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4");w("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC");w("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC");w("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC");w("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC");w("1.2.840.113549.2.7","hmacWithSHA1");w("1.2.840.113549.2.8","hmacWithSHA224");w("1.2.840.113549.2.9","hmacWithSHA256");w("1.2.840.113549.2.10","hmacWithSHA384");w("1.2.840.113549.2.11","hmacWithSHA512");w("1.2.840.113549.3.7","des-EDE3-CBC");w("2.16.840.1.101.3.4.1.2","aes128-CBC");w("2.16.840.1.101.3.4.1.22","aes192-CBC");w("2.16.840.1.101.3.4.1.42","aes256-CBC");w("2.5.4.3","commonName");w("2.5.4.4","surname");w("2.5.4.5","serialNumber");w("2.5.4.6","countryName");w("2.5.4.7","localityName");w("2.5.4.8","stateOrProvinceName");w("2.5.4.9","streetAddress");w("2.5.4.10","organizationName");w("2.5.4.11","organizationalUnitName");w("2.5.4.12","title");w("2.5.4.13","description");w("2.5.4.15","businessCategory");w("2.5.4.17","postalCode");w("2.5.4.42","givenName");w("2.5.4.65","pseudonym");w("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName");w("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName");w("2.16.840.1.113730.1.1","nsCertType");w("2.16.840.1.113730.1.13","nsComment");ae("2.5.29.1","authorityKeyIdentifier");ae("2.5.29.2","keyAttributes");ae("2.5.29.3","certificatePolicies");ae("2.5.29.4","keyUsageRestriction");ae("2.5.29.5","policyMapping");ae("2.5.29.6","subtreesConstraint");ae("2.5.29.7","subjectAltName");ae("2.5.29.8","issuerAltName");ae("2.5.29.9","subjectDirectoryAttributes");ae("2.5.29.10","basicConstraints");ae("2.5.29.11","nameConstraints");ae("2.5.29.12","policyConstraints");ae("2.5.29.13","basicConstraints");w("2.5.29.14","subjectKeyIdentifier");w("2.5.29.15","keyUsage");ae("2.5.29.16","privateKeyUsagePeriod");w("2.5.29.17","subjectAltName");w("2.5.29.18","issuerAltName");w("2.5.29.19","basicConstraints");ae("2.5.29.20","cRLNumber");ae("2.5.29.21","cRLReason");ae("2.5.29.22","expirationDate");ae("2.5.29.23","instructionCode");ae("2.5.29.24","invalidityDate");ae("2.5.29.25","cRLDistributionPoints");ae("2.5.29.26","issuingDistributionPoint");ae("2.5.29.27","deltaCRLIndicator");ae("2.5.29.28","issuingDistributionPoint");ae("2.5.29.29","certificateIssuer");ae("2.5.29.30","nameConstraints");w("2.5.29.31","cRLDistributionPoints");w("2.5.29.32","certificatePolicies");ae("2.5.29.33","policyMappings");ae("2.5.29.34","policyConstraints");w("2.5.29.35","authorityKeyIdentifier");ae("2.5.29.36","policyConstraints");w("2.5.29.37","extKeyUsage");ae("2.5.29.46","freshestCRL");ae("2.5.29.54","inhibitAnyPolicy");w("1.3.6.1.4.1.11129.2.4.2","timestampList");w("1.3.6.1.5.5.7.1.1","authorityInfoAccess");w("1.3.6.1.5.5.7.3.1","serverAuth");w("1.3.6.1.5.5.7.3.2","clientAuth");w("1.3.6.1.5.5.7.3.3","codeSigning");w("1.3.6.1.5.5.7.3.4","emailProtection");w("1.3.6.1.5.5.7.3.8","timeStamping")});var ut=j((Xc,Pn)=>{var de=Q();re();Lt();var U=Pn.exports=de.asn1=de.asn1||{};U.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};U.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};U.maxDepth=256;U.create=function(e,t,a,r,i){if(de.util.isArray(r)){for(var s=[],n=0;n<r.length;++n)r[n]!==void 0&&s.push(r[n]);r=s}var o={tagClass:e,type:t,constructed:a,composed:a||de.util.isArray(r),value:r};return i&&"bitStringContents"in i&&(o.bitStringContents=i.bitStringContents,o.original=U.copy(o)),o};U.copy=function(e,t){var a;if(de.util.isArray(e)){a=[];for(var r=0;r<e.length;++r)a.push(U.copy(e[r],t));return a}return typeof e=="string"?e:(a={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:U.copy(e.value,t)},t&&!t.excludeBitStringContents&&(a.bitStringContents=e.bitStringContents),a)};U.equals=function(e,t,a){if(de.util.isArray(e)){if(!de.util.isArray(t)||e.length!==t.length)return!1;for(var r=0;r<e.length;++r)if(!U.equals(e[r],t[r]))return!1;return!0}if(typeof e!=typeof t)return!1;if(typeof e=="string")return e===t;var i=e.tagClass===t.tagClass&&e.type===t.type&&e.constructed===t.constructed&&e.composed===t.composed&&U.equals(e.value,t.value);return a&&a.includeBitStringContents&&(i=i&&e.bitStringContents===t.bitStringContents),i};U.getBerValueLength=function(e){var t=e.getByte();if(t!==128){var a,r=t&128;return r?a=e.getInt((t&127)<<3):a=t,a}};function vr(e,t,a){if(a>t){var r=new Error("Too few bytes to parse DER.");throw r.available=e.length(),r.remaining=t,r.requested=a,r}}var _0=function(e,t){var a=e.getByte();if(t--,a!==128){var r,i=a&128;if(!i)r=a;else{var s=a&127;vr(e,t,s),r=e.getInt(s<<3)}if(r<0)throw new Error("Negative length: "+r);return r}};U.fromDer=function(e,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=U.maxDepth),typeof e=="string"&&(e=de.util.createBuffer(e));var a=e.length(),r=Kr(e,e.length(),0,t);if(t.parseAllBytes&&e.length()!==0){var i=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw i.byteCount=a,i.remaining=e.length(),i}return r};function Kr(e,t,a,r){if(a>=r.maxDepth)throw new Error("ASN.1 parsing error: Max depth exceeded.");var i;vr(e,t,2);var s=e.getByte();t--;var n=s&192,o=s&31;i=e.length();var f=_0(e,t);if(t-=i-e.length(),f!==void 0&&f>t){if(r.strict){var u=new Error("Too few bytes to read ASN.1 value.");throw u.available=e.length(),u.remaining=t,u.requested=f,u}f=t}var l,c,g=(s&32)===32;if(g)if(l=[],f===void 0)for(;;){if(vr(e,t,2),e.bytes(2)==="\0\0"){e.getBytes(2),t-=2;break}i=e.length(),l.push(Kr(e,t,a+1,r)),t-=i-e.length()}else for(;f>0;)i=e.length(),l.push(Kr(e,f,a+1,r)),t-=i-e.length(),f-=i-e.length();if(l===void 0&&n===U.Class.UNIVERSAL&&o===U.Type.BITSTRING&&(c=e.bytes(f)),l===void 0&&r.decodeBitStrings&&n===U.Class.UNIVERSAL&&o===U.Type.BITSTRING&&f>1){var m=e.read,y=t,E=0;if(o===U.Type.BITSTRING&&(vr(e,t,1),E=e.getByte(),t--),E===0)try{i=e.length();var S={strict:!0,decodeBitStrings:!0},A=Kr(e,t,a+1,S),B=i-e.length();t-=B,o==U.Type.BITSTRING&&B++;var b=A.tagClass;B===f&&(b===U.Class.UNIVERSAL||b===U.Class.CONTEXT_SPECIFIC)&&(l=[A])}catch{}l===void 0&&(e.read=m,t=y)}if(l===void 0){if(f===void 0){if(r.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");f=t}if(o===U.Type.BMPSTRING)for(l="";f>0;f-=2)vr(e,t,2),l+=String.fromCharCode(e.getInt16()),t-=2;else l=e.getBytes(f),t-=f}var V=c===void 0?null:{bitStringContents:c};return U.create(n,o,g,l,V)}U.toDer=function(e){var t=de.util.createBuffer(),a=e.tagClass|e.type,r=de.util.createBuffer(),i=!1;if("bitStringContents"in e&&(i=!0,e.original&&(i=U.equals(e,e.original))),i)r.putBytes(e.bitStringContents);else if(e.composed){e.constructed?a|=32:r.putByte(0);for(var s=0;s<e.value.length;++s)e.value[s]!==void 0&&r.putBuffer(U.toDer(e.value[s]))}else if(e.type===U.Type.BMPSTRING)for(var s=0;s<e.value.length;++s)r.putInt16(e.value.charCodeAt(s));else e.type===U.Type.INTEGER&&e.value.length>1&&(e.value.charCodeAt(0)===0&&(e.value.charCodeAt(1)&128)===0||e.value.charCodeAt(0)===255&&(e.value.charCodeAt(1)&128)===128)?r.putBytes(e.value.substr(1)):r.putBytes(e.value);if(t.putByte(a),r.length()<=127)t.putByte(r.length()&127);else{var n=r.length(),o="";do o+=String.fromCharCode(n&255),n=n>>>8;while(n>0);t.putByte(o.length|128);for(var s=o.length-1;s>=0;--s)t.putByte(o.charCodeAt(s))}return t.putBuffer(r),t};U.oidToDer=function(e){var t=e.split("."),a=de.util.createBuffer();a.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var r,i,s,n,o=2;o<t.length;++o){if(r=!0,i=[],s=parseInt(t[o],10),s>4294967295)throw new Error("OID value too large; max is 32-bits.");do n=s&127,s=s>>>7,r||(n|=128),i.push(n),r=!1;while(s>0);for(var f=i.length-1;f>=0;--f)a.putByte(i[f])}return a};U.derToOid=function(e){var t;typeof e=="string"&&(e=de.util.createBuffer(e));var a=e.getByte();t=Math.floor(a/40)+"."+a%40;for(var r=0;e.length()>0;){if(r>70368744177663)throw new Error("OID value too large; max is 53-bits.");a=e.getByte(),r=r*128,a&128?r+=a&127:(t+="."+(r+a),r=0)}return t};U.utcTimeToDate=function(e){var t=new Date,a=parseInt(e.substr(0,2),10);a=a>=50?1900+a:2e3+a;var r=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),s=parseInt(e.substr(6,2),10),n=parseInt(e.substr(8,2),10),o=0;if(e.length>11){var f=e.charAt(10),u=10;f!=="+"&&f!=="-"&&(o=parseInt(e.substr(10,2),10),u+=2)}if(t.setUTCFullYear(a,r,i),t.setUTCHours(s,n,o,0),u&&(f=e.charAt(u),f==="+"||f==="-")){var l=parseInt(e.substr(u+1,2),10),c=parseInt(e.substr(u+4,2),10),g=l*60+c;g*=6e4,f==="+"?t.setTime(+t-g):t.setTime(+t+g)}return t};U.generalizedTimeToDate=function(e){var t=new Date,a=parseInt(e.substr(0,4),10),r=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),n=parseInt(e.substr(10,2),10),o=parseInt(e.substr(12,2),10),f=0,u=0,l=!1;e.charAt(e.length-1)==="Z"&&(l=!0);var c=e.length-5,g=e.charAt(c);if(g==="+"||g==="-"){var m=parseInt(e.substr(c+1,2),10),y=parseInt(e.substr(c+4,2),10);u=m*60+y,u*=6e4,g==="+"&&(u*=-1),l=!0}return e.charAt(14)==="."&&(f=parseFloat(e.substr(14),10)*1e3),l?(t.setUTCFullYear(a,r,i),t.setUTCHours(s,n,o,f),t.setTime(+t+u)):(t.setFullYear(a,r,i),t.setHours(s,n,o,f)),t};U.dateToUtcTime=function(e){if(typeof e=="string")return e;var t="",a=[];a.push((""+e.getUTCFullYear()).substr(2)),a.push(""+(e.getUTCMonth()+1)),a.push(""+e.getUTCDate()),a.push(""+e.getUTCHours()),a.push(""+e.getUTCMinutes()),a.push(""+e.getUTCSeconds());for(var r=0;r<a.length;++r)a[r].length<2&&(t+="0"),t+=a[r];return t+="Z",t};U.dateToGeneralizedTime=function(e){if(typeof e=="string")return e;var t="",a=[];a.push(""+e.getUTCFullYear()),a.push(""+(e.getUTCMonth()+1)),a.push(""+e.getUTCDate()),a.push(""+e.getUTCHours()),a.push(""+e.getUTCMinutes()),a.push(""+e.getUTCSeconds());for(var r=0;r<a.length;++r)a[r].length<2&&(t+="0"),t+=a[r];return t+="Z",t};U.integerToDer=function(e){var t=de.util.createBuffer();if(e>=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var a=new Error("Integer too large; max is 32-bits.");throw a.integer=e,a};U.derToInteger=function(e){typeof e=="string"&&(e=de.util.createBuffer(e));var t=e.length()*8;if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)};U.validate=function(e,t,a,r){var i=!1;if((e.tagClass===t.tagClass||typeof t.tagClass>"u")&&(e.type===t.type||typeof t.type>"u"))if(e.constructed===t.constructed||typeof t.constructed>"u"){if(i=!0,t.value&&de.util.isArray(t.value))for(var s=0,n=0;i&&n<t.value.length;++n){var o=t.value[n];i=!!o.optional;var f=e.value[s];if(!f){o.optional||(i=!1,r&&r.push("["+t.name+'] Missing required element. Expected tag class "'+o.tagClass+'", type "'+o.type+'"'));continue}var u=typeof o.tagClass<"u"&&typeof o.type<"u";if(u&&(f.tagClass!==o.tagClass||f.type!==o.type))if(o.optional){i=!0;continue}else{i=!1,r&&r.push("["+t.name+"] Tag mismatch. Expected ("+o.tagClass+","+o.type+"), got ("+f.tagClass+","+f.type+")");break}var l=U.validate(f,o,a,r);if(l)++s,i=!0;else if(o.optional)i=!0;else{i=!1;break}}if(i&&a&&(t.capture&&(a[t.capture]=e.value),t.captureAsn1&&(a[t.captureAsn1]=e),t.captureBitStringContents&&"bitStringContents"in e&&(a[t.captureBitStringContents]=e.bitStringContents),t.captureBitStringValue&&"bitStringContents"in e)){var c;if(e.bitStringContents.length<2)a[t.captureBitStringValue]="";else{var g=e.bitStringContents.charCodeAt(0);if(g!==0)throw new Error("captureBitStringValue only supported for zero unused bits");a[t.captureBitStringValue]=e.bitStringContents.slice(1)}}}else r&&r.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');else r&&(e.tagClass!==t.tagClass&&r.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&r.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));return i};var Un=/[^\\u0000-\\u00ff]/;U.prettyPrint=function(e,t,a){var r="";t=t||0,a=a||2,t>0&&(r+=`
`);for(var i="",s=0;s<t*a;++s)i+=" ";switch(r+=i+"Tag: ",e.tagClass){case U.Class.UNIVERSAL:r+="Universal:";break;case U.Class.APPLICATION:r+="Application:";break;case U.Class.CONTEXT_SPECIFIC:r+="Context-Specific:";break;case U.Class.PRIVATE:r+="Private:";break}if(e.tagClass===U.Class.UNIVERSAL)switch(r+=e.type,e.type){case U.Type.NONE:r+=" (None)";break;case U.Type.BOOLEAN:r+=" (Boolean)";break;case U.Type.INTEGER:r+=" (Integer)";break;case U.Type.BITSTRING:r+=" (Bit string)";break;case U.Type.OCTETSTRING:r+=" (Octet string)";break;case U.Type.NULL:r+=" (Null)";break;case U.Type.OID:r+=" (Object Identifier)";break;case U.Type.ODESC:r+=" (Object Descriptor)";break;case U.Type.EXTERNAL:r+=" (External or Instance of)";break;case U.Type.REAL:r+=" (Real)";break;case U.Type.ENUMERATED:r+=" (Enumerated)";break;case U.Type.EMBEDDED:r+=" (Embedded PDV)";break;case U.Type.UTF8:r+=" (UTF8)";break;case U.Type.ROID:r+=" (Relative Object Identifier)";break;case U.Type.SEQUENCE:r+=" (Sequence)";break;case U.Type.SET:r+=" (Set)";break;case U.Type.PRINTABLESTRING:r+=" (Printable String)";break;case U.Type.IA5String:r+=" (IA5String (ASCII))";break;case U.Type.UTCTIME:r+=" (UTC time)";break;case U.Type.GENERALIZEDTIME:r+=" (Generalized time)";break;case U.Type.BMPSTRING:r+=" (BMP String)";break}else r+=e.type;if(r+=`
`,r+=i+"Constructed: "+e.constructed+`
`,e.composed){for(var n=0,o="",s=0;s<e.value.length;++s)e.value[s]!==void 0&&(n+=1,o+=U.prettyPrint(e.value[s],t+1,a),s+1<e.value.length&&(o+=","));r+=i+"Sub values: "+n+o}else{if(r+=i+"Value: ",e.type===U.Type.OID){var f=U.derToOid(e.value);r+=f,de.pki&&de.pki.oids&&f in de.pki.oids&&(r+=" ("+de.pki.oids[f]+") ")}if(e.type===U.Type.INTEGER)try{r+=U.derToInteger(e.value)}catch{r+="0x"+de.util.bytesToHex(e.value)}else if(e.type===U.Type.BITSTRING){if(e.value.length>1?r+="0x"+de.util.bytesToHex(e.value.slice(1)):r+="(none)",e.value.length>0){var u=e.value.charCodeAt(0);u==1?r+=" (1 unused bit shown)":u>1&&(r+=" ("+u+" unused bits shown)")}}else if(e.type===U.Type.OCTETSTRING)Un.test(e.value)||(r+="("+e.value+") "),r+="0x"+de.util.bytesToHex(e.value);else if(e.type===U.Type.UTF8)try{r+=de.util.decodeUtf8(e.value)}catch(l){if(l.message==="URI malformed")r+="0x"+de.util.bytesToHex(e.value)+" (malformed UTF8)";else throw l}else e.type===U.Type.PRINTABLESTRING||e.type===U.Type.IA5String?r+=e.value:Un.test(e.value)?r+="0x"+de.util.bytesToHex(e.value):e.value.length===0?r+="[null]":r+=e.value}return r}});var lt=j(($c,Vn)=>{var qr=Q();Vn.exports=qr.md=qr.md||{};qr.md.algorithms=qr.md.algorithms||{}});var rr=j((Jc,On)=>{var St=Q();lt();re();var N0=On.exports=St.hmac=St.hmac||{};N0.create=function(){var e=null,t=null,a=null,r=null,i={};return i.start=function(s,n){if(s!==null)if(typeof s=="string")if(s=s.toLowerCase(),s in St.md.algorithms)t=St.md.algorithms[s].create();else throw new Error('Unknown hash algorithm "'+s+'"');else t=s;if(n===null)n=e;else{if(typeof n=="string")n=St.util.createBuffer(n);else if(St.util.isArray(n)){var o=n;n=St.util.createBuffer();for(var f=0;f<o.length;++f)n.putByte(o[f])}var u=n.length();u>t.blockLength&&(t.start(),t.update(n.bytes()),n=t.digest()),a=St.util.createBuffer(),r=St.util.createBuffer(),u=n.length();for(var f=0;f<u;++f){var o=n.at(f);a.putByte(54^o),r.putByte(92^o)}if(u<t.blockLength)for(var o=t.blockLength-u,f=0;f<o;++f)a.putByte(54),r.putByte(92);e=n,a=a.bytes(),r=r.bytes()}t.start(),t.update(a)},i.update=function(s){t.update(s)},i.getMac=function(){var s=t.digest().bytes();return t.start(),t.update(r),t.update(s),t.digest()},i.digest=i.getMac,i}});var Hr=j((Zc,Mn)=>{var ct=Q();lt();re();var Kn=Mn.exports=ct.md5=ct.md5||{};ct.md.md5=ct.md.algorithms.md5=Kn;Kn.create=function(){qn||w0();var e=null,t=ct.util.createBuffer(),a=new Array(16),r={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return r.start=function(){r.messageLength=0,r.fullMessageLength=r.messageLength64=[];for(var i=r.messageLengthSize/4,s=0;s<i;++s)r.fullMessageLength.push(0);return t=ct.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},r},r.start(),r.update=function(i,s){s==="utf8"&&(i=ct.util.encodeUtf8(i));var n=i.length;r.messageLength+=n,n=[n/4294967296>>>0,n>>>0];for(var o=r.fullMessageLength.length-1;o>=0;--o)r.fullMessageLength[o]+=n[1],n[1]=n[0]+(r.fullMessageLength[o]/4294967296>>>0),r.fullMessageLength[o]=r.fullMessageLength[o]>>>0,n[0]=n[1]/4294967296>>>0;return t.putBytes(i),Fn(e,a,t),(t.read>2048||t.length()===0)&&t.compact(),r},r.digest=function(){var i=ct.util.createBuffer();i.putBytes(t.bytes());var s=r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize,n=s&r.blockLength-1;i.putBytes(Fa.substr(0,r.blockLength-n));for(var o,f=0,u=r.fullMessageLength.length-1;u>=0;--u)o=r.fullMessageLength[u]*8+f,f=o/4294967296>>>0,i.putInt32Le(o>>>0);var l={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};Fn(l,a,i);var c=ct.util.createBuffer();return c.putInt32Le(l.h0),c.putInt32Le(l.h1),c.putInt32Le(l.h2),c.putInt32Le(l.h3),c},r};var Fa=null,Mr=null,mr=null,ar=null,qn=!1;function w0(){Fa="\x80",Fa+=ct.util.fillString("\0",64),Mr=[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],mr=[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],ar=new Array(64);for(var e=0;e<64;++e)ar[e]=Math.floor(Math.abs(Math.sin(e+1))*4294967296);qn=!0}function Fn(e,t,a){for(var r,i,s,n,o,f,u,l,c=a.length();c>=64;){for(i=e.h0,s=e.h1,n=e.h2,o=e.h3,l=0;l<16;++l)t[l]=a.getInt32Le(),f=o^s&(n^o),r=i+f+ar[l]+t[l],u=mr[l],i=o,o=n,n=s,s+=r<<u|r>>>32-u;for(;l<32;++l)f=n^o&(s^n),r=i+f+ar[l]+t[Mr[l]],u=mr[l],i=o,o=n,n=s,s+=r<<u|r>>>32-u;for(;l<48;++l)f=s^n^o,r=i+f+ar[l]+t[Mr[l]],u=mr[l],i=o,o=n,n=s,s+=r<<u|r>>>32-u;for(;l<64;++l)f=n^(s|~o),r=i+f+ar[l]+t[Mr[l]],u=mr[l],i=o,o=n,n=s,s+=r<<u|r>>>32-u;e.h0=e.h0+i|0,e.h1=e.h1+s|0,e.h2=e.h2+n|0,e.h3=e.h3+o|0,c-=64}}});var Ht=j((ed,Gn)=>{var jr=Q();re();var Hn=Gn.exports=jr.pem=jr.pem||{};Hn.encode=function(e,t){t=t||{};var a="-----BEGIN "+e.type+`-----\r
`,r;if(e.procType&&(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},a+=Gr(r)),e.contentDomain&&(r={name:"Content-Domain",values:[e.contentDomain]},a+=Gr(r)),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),a+=Gr(r)),e.headers)for(var i=0;i<e.headers.length;++i)a+=Gr(e.headers[i]);return e.procType&&(a+=`\r
`),a+=jr.util.encode64(e.body,t.maxline||64)+`\r
`,a+="-----END "+e.type+`-----\r
`,a};Hn.decode=function(e){for(var t=[],a=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,r=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,i=/\r?\n/,s;s=a.exec(e),!!s;){var n=s[1];n==="NEW CERTIFICATE REQUEST"&&(n="CERTIFICATE REQUEST");var o={type:n,procType:null,contentDomain:null,dekInfo:null,headers:[],body:jr.util.decode64(s[3])};if(t.push(o),!!s[2]){for(var f=s[2].split(i),u=0;s&&u<f.length;){for(var l=f[u].replace(/\s+$/,""),c=u+1;c<f.length;++c){var g=f[c];if(!/\s/.test(g[0]))break;l+=g,u=c}if(s=l.match(r),s){for(var m={name:s[1],values:[]},y=s[2].split(","),E=0;E<y.length;++E)m.values.push(R0(y[E]));if(o.procType)if(!o.contentDomain&&m.name==="Content-Domain")o.contentDomain=y[0]||"";else if(!o.dekInfo&&m.name==="DEK-Info"){if(m.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');o.dekInfo={algorithm:y[0],parameters:y[1]||null}}else o.headers.push(m);else{if(m.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(m.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');o.procType={version:y[0],type:y[1]}}}++u}if(o.procType==="ENCRYPTED"&&!o.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(t.length===0)throw new Error("Invalid PEM formatted message.");return t};function Gr(e){for(var t=e.name+": ",a=[],r=function(f,u){return" "+u},i=0;i<e.values.length;++i)a.push(e.values[i].replace(/^(\S+\r\n)/,r));t+=a.join(",")+`\r
`;for(var s=0,n=-1,i=0;i<t.length;++i,++s)if(s>65&&n!==-1){var o=t[n];o===","?(++n,t=t.substr(0,n)+`\r
`+t.substr(n)):t=t.substr(0,n)+`\r
`+o+t.substr(n+1),s=i-n-1,n=-1,++i}else(t[i]===" "||t[i]===" "||t[i]===",")&&(n=i);return t}function R0(e){return e.replace(/^\s+/,"")}});var Cr=j((td,zn)=>{var he=Q();Pr();Da();re();zn.exports=he.des=he.des||{};he.des.startEncrypting=function(e,t,a,r){var i=zr({key:e,output:a,decrypt:!1,mode:r||(t===null?"ECB":"CBC")});return i.start(t),i};he.des.createEncryptionCipher=function(e,t){return zr({key:e,output:null,decrypt:!1,mode:t})};he.des.startDecrypting=function(e,t,a,r){var i=zr({key:e,output:a,decrypt:!0,mode:r||(t===null?"ECB":"CBC")});return i.start(t),i};he.des.createDecryptionCipher=function(e,t){return zr({key:e,output:null,decrypt:!0,mode:t})};he.des.Algorithm=function(e,t){var a=this;a.name=e,a.mode=new t({blockSize:8,cipher:{encrypt:function(r,i){return jn(a._keys,r,i,!1)},decrypt:function(r,i){return jn(a._keys,r,i,!0)}}}),a._init=!1};he.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=he.util.createBuffer(e.key);if(this.name.indexOf("3DES")===0&&t.length()!==24)throw new Error("Invalid Triple-DES key size: "+t.length()*8);this._keys=K0(t),this._init=!0}};dt("DES-ECB",he.cipher.modes.ecb);dt("DES-CBC",he.cipher.modes.cbc);dt("DES-CFB",he.cipher.modes.cfb);dt("DES-OFB",he.cipher.modes.ofb);dt("DES-CTR",he.cipher.modes.ctr);dt("3DES-ECB",he.cipher.modes.ecb);dt("3DES-CBC",he.cipher.modes.cbc);dt("3DES-CFB",he.cipher.modes.cfb);dt("3DES-OFB",he.cipher.modes.ofb);dt("3DES-CTR",he.cipher.modes.ctr);function dt(e,t){var a=function(){return new he.des.Algorithm(e,t)};he.cipher.registerAlgorithm(e,a)}var L0=[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],k0=[-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],D0=[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],U0=[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],P0=[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],V0=[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],O0=[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],F0=[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 K0(e){for(var t=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],a=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],r=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],i=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],n=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],o=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],f=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],u=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],l=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],c=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],g=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],m=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],E=e.length()>8?3:1,S=[],A=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],B=0,b,V=0;V<E;V++){var k=e.getInt32(),R=e.getInt32();b=(k>>>4^R)&252645135,R^=b,k^=b<<4,b=(R>>>-16^k)&65535,k^=b,R^=b<<-16,b=(k>>>2^R)&858993459,R^=b,k^=b<<2,b=(R>>>-16^k)&65535,k^=b,R^=b<<-16,b=(k>>>1^R)&1431655765,R^=b,k^=b<<1,b=(R>>>8^k)&16711935,k^=b,R^=b<<8,b=(k>>>1^R)&1431655765,R^=b,k^=b<<1,b=k<<8|R>>>20&240,k=R<<24|R<<8&16711680|R>>>8&65280|R>>>24&240,R=b;for(var G=0;G<A.length;++G){A[G]?(k=k<<2|k>>>26,R=R<<2|R>>>26):(k=k<<1|k>>>27,R=R<<1|R>>>27),k&=-15,R&=-15;var Y=t[k>>>28]|a[k>>>24&15]|r[k>>>20&15]|i[k>>>16&15]|s[k>>>12&15]|n[k>>>8&15]|o[k>>>4&15],ie=f[R>>>28]|u[R>>>24&15]|l[R>>>20&15]|c[R>>>16&15]|g[R>>>12&15]|m[R>>>8&15]|y[R>>>4&15];b=(ie>>>16^Y)&65535,S[B++]=Y^b,S[B++]=ie^b<<16}}return S}function jn(e,t,a,r){var i=e.length===32?3:9,s;i===3?s=r?[30,-2,-2]:[0,32,2]:s=r?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var n,o=t[0],f=t[1];n=(o>>>4^f)&252645135,f^=n,o^=n<<4,n=(o>>>16^f)&65535,f^=n,o^=n<<16,n=(f>>>2^o)&858993459,o^=n,f^=n<<2,n=(f>>>8^o)&16711935,o^=n,f^=n<<8,n=(o>>>1^f)&1431655765,f^=n,o^=n<<1,o=o<<1|o>>>31,f=f<<1|f>>>31;for(var u=0;u<i;u+=3){for(var l=s[u+1],c=s[u+2],g=s[u];g!=l;g+=c){var m=f^e[g],y=(f>>>4|f<<28)^e[g+1];n=o,o=f,f=n^(k0[m>>>24&63]|U0[m>>>16&63]|V0[m>>>8&63]|F0[m&63]|L0[y>>>24&63]|D0[y>>>16&63]|P0[y>>>8&63]|O0[y&63])}n=o,o=f,f=n}o=o>>>1|o<<31,f=f>>>1|f<<31,n=(o>>>1^f)&1431655765,f^=n,o^=n<<1,n=(f>>>8^o)&16711935,o^=n,f^=n<<8,n=(f>>>2^o)&858993459,o^=n,f^=n<<2,n=(o>>>16^f)&65535,f^=n,o^=n<<16,n=(o>>>4^f)&252645135,f^=n,o^=n<<4,a[0]=o,a[1]=f}function zr(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),a="DES-"+t,r;e.decrypt?r=he.cipher.createDecipher(a,e.key):r=he.cipher.createCipher(a,e.key);var i=r.start;return r.start=function(s,n){var o=null;n instanceof he.util.ByteBuffer&&(o=n,n={}),n=n||{},n.output=o,n.iv=s,i.call(r,n)},r}});var Qr=j((rd,Qn)=>{var je=Q();rr();lt();re();var q0=je.pkcs5=je.pkcs5||{},Tt;je.util.isNodejs&&!je.options.usePureJavaScript&&(Tt=ya("crypto"));Qn.exports=je.pbkdf2=q0.pbkdf2=function(e,t,a,r,i,s){if(typeof i=="function"&&(s=i,i=null),je.util.isNodejs&&!je.options.usePureJavaScript&&Tt.pbkdf2&&(i===null||typeof i!="object")&&(Tt.pbkdf2Sync.length>4||!i||i==="sha1"))return typeof i!="string"&&(i="sha1"),e=Buffer.from(e,"binary"),t=Buffer.from(t,"binary"),s?Tt.pbkdf2Sync.length===4?Tt.pbkdf2(e,t,a,r,function(b,V){if(b)return s(b);s(null,V.toString("binary"))}):Tt.pbkdf2(e,t,a,r,i,function(b,V){if(b)return s(b);s(null,V.toString("binary"))}):Tt.pbkdf2Sync.length===4?Tt.pbkdf2Sync(e,t,a,r).toString("binary"):Tt.pbkdf2Sync(e,t,a,r,i).toString("binary");if((typeof i>"u"||i===null)&&(i="sha1"),typeof i=="string"){if(!(i in je.md.algorithms))throw new Error("Unknown hash algorithm: "+i);i=je.md[i].create()}var n=i.digestLength;if(r>4294967295*n){var o=new Error("Derived key is too long.");if(s)return s(o);throw o}var f=Math.ceil(r/n),u=r-(f-1)*n,l=je.hmac.create();l.start(i,e);var c="",g,m,y;if(!s){for(var E=1;E<=f;++E){l.start(null,null),l.update(t),l.update(je.util.int32ToBytes(E)),g=y=l.digest().getBytes();for(var S=2;S<=a;++S)l.start(null,null),l.update(y),m=l.digest().getBytes(),g=je.util.xorBytes(g,m,n),y=m;c+=E<f?g:g.substr(0,u)}return c}var E=1,S;function A(){if(E>f)return s(null,c);l.start(null,null),l.update(t),l.update(je.util.int32ToBytes(E)),g=y=l.digest().getBytes(),S=2,B()}function B(){if(S<=a)return l.start(null,null),l.update(y),m=l.digest().getBytes(),g=je.util.xorBytes(g,m,n),y=m,++S,je.util.setImmediate(B);c+=E<f?g:g.substr(0,u),++E,A()}A()}});var qa=j((ad,Jn)=>{var pt=Q();lt();re();var Wn=Jn.exports=pt.sha256=pt.sha256||{};pt.md.sha256=pt.md.algorithms.sha256=Wn;Wn.create=function(){Xn||M0();var e=null,t=pt.util.createBuffer(),a=new Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return r.start=function(){r.messageLength=0,r.fullMessageLength=r.messageLength64=[];for(var i=r.messageLengthSize/4,s=0;s<i;++s)r.fullMessageLength.push(0);return t=pt.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},r},r.start(),r.update=function(i,s){s==="utf8"&&(i=pt.util.encodeUtf8(i));var n=i.length;r.messageLength+=n,n=[n/4294967296>>>0,n>>>0];for(var o=r.fullMessageLength.length-1;o>=0;--o)r.fullMessageLength[o]+=n[1],n[1]=n[0]+(r.fullMessageLength[o]/4294967296>>>0),r.fullMessageLength[o]=r.fullMessageLength[o]>>>0,n[0]=n[1]/4294967296>>>0;return t.putBytes(i),Yn(e,a,t),(t.read>2048||t.length()===0)&&t.compact(),r},r.digest=function(){var i=pt.util.createBuffer();i.putBytes(t.bytes());var s=r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize,n=s&r.blockLength-1;i.putBytes(Ka.substr(0,r.blockLength-n));for(var o,f,u=r.fullMessageLength[0]*8,l=0;l<r.fullMessageLength.length-1;++l)o=r.fullMessageLength[l+1]*8,f=o/4294967296>>>0,u+=f,i.putInt32(u>>>0),u=o>>>0;i.putInt32(u);var c={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};Yn(c,a,i);var g=pt.util.createBuffer();return g.putInt32(c.h0),g.putInt32(c.h1),g.putInt32(c.h2),g.putInt32(c.h3),g.putInt32(c.h4),g.putInt32(c.h5),g.putInt32(c.h6),g.putInt32(c.h7),g},r};var Ka=null,Xn=!1,$n=null;function M0(){Ka="\x80",Ka+=pt.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],Xn=!0}function Yn(e,t,a){for(var r,i,s,n,o,f,u,l,c,g,m,y,E,S,A,B=a.length();B>=64;){for(u=0;u<16;++u)t[u]=a.getInt32();for(;u<64;++u)r=t[u-2],r=(r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10,i=t[u-15],i=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[u]=r+t[u-7]+i+t[u-16]|0;for(l=e.h0,c=e.h1,g=e.h2,m=e.h3,y=e.h4,E=e.h5,S=e.h6,A=e.h7,u=0;u<64;++u)n=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),o=S^y&(E^S),s=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),f=l&c|g&(l^c),r=A+n+o+$n[u]+t[u],i=s+f,A=S,S=E,E=y,y=m+r>>>0,m=g,g=c,c=l,l=r+i>>>0;e.h0=e.h0+l|0,e.h1=e.h1+c|0,e.h2=e.h2+g|0,e.h3=e.h3+m|0,e.h4=e.h4+y|0,e.h5=e.h5+E|0,e.h6=e.h6+S|0,e.h7=e.h7+A|0,B-=64}}});var Ma=j((id,Zn)=>{var ht=Q();re();var Yr=null;ht.util.isNodejs&&!ht.options.usePureJavaScript&&!process.versions["node-webkit"]&&(Yr=ya("crypto"));var H0=Zn.exports=ht.prng=ht.prng||{};H0.create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},a=e.md,r=new Array(32),i=0;i<32;++i)r[i]=a.create();t.pools=r,t.pool=0,t.generate=function(u,l){if(!l)return t.generateSync(u);var c=t.plugin.cipher,g=t.plugin.increment,m=t.plugin.formatKey,y=t.plugin.formatSeed,E=ht.util.createBuffer();t.key=null,S();function S(A){if(A)return l(A);if(E.length()>=u)return l(null,E.getBytes(u));if(t.generated>1048575&&(t.key=null),t.key===null)return ht.util.nextTick(function(){s(S)});var B=c(t.key,t.seed);t.generated+=B.length,E.putBytes(B),t.key=m(c(t.key,g(t.seed))),t.seed=y(c(t.key,t.seed)),ht.util.setImmediate(S)}},t.generateSync=function(u){var l=t.plugin.cipher,c=t.plugin.increment,g=t.plugin.formatKey,m=t.plugin.formatSeed;t.key=null;for(var y=ht.util.createBuffer();y.length()<u;){t.generated>1048575&&(t.key=null),t.key===null&&n();var E=l(t.key,t.seed);t.generated+=E.length,y.putBytes(E),t.key=g(l(t.key,c(t.seed))),t.seed=m(l(t.key,t.seed))}return y.getBytes(u)};function s(u){if(t.pools[0].messageLength>=32)return o(),u();var l=32-t.pools[0].messageLength<<5;t.seedFile(l,function(c,g){if(c)return u(c);t.collect(g),o(),u()})}function n(){if(t.pools[0].messageLength>=32)return o();var u=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(u)),o()}function o(){t.reseeds=t.reseeds===4294967295?0:t.reseeds+1;var u=t.plugin.md.create();u.update(t.keyBytes);for(var l=1,c=0;c<32;++c)t.reseeds%l===0&&(u.update(t.pools[c].digest().getBytes()),t.pools[c].start()),l=l<<1;t.keyBytes=u.digest().getBytes(),u.start(),u.update(t.keyBytes);var g=u.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(g),t.generated=0}function f(u){var l=null,c=ht.util.globalScope,g=c.crypto||c.msCrypto;g&&g.getRandomValues&&(l=function(k){return g.getRandomValues(k)});var m=ht.util.createBuffer();if(l)for(;m.length()<u;){var y=Math.max(1,Math.min(u-m.length(),65536)/4),E=new Uint32Array(Math.floor(y));try{l(E);for(var S=0;S<E.length;++S)m.putInt32(E[S])}catch(k){if(!(typeof QuotaExceededError<"u"&&k instanceof QuotaExceededError))throw k}}if(m.length()<u)for(var A,B,b,V=Math.floor(Math.random()*65536);m.length()<u;){B=16807*(V&65535),A=16807*(V>>16),B+=(A&32767)<<16,B+=A>>15,B=(B&2147483647)+(B>>31),V=B&4294967295;for(var S=0;S<3;++S)b=V>>>(S<<3),b^=Math.floor(Math.random()*256),m.putByte(b&255)}return m.getBytes(u)}return Yr?(t.seedFile=function(u,l){Yr.randomBytes(u,function(c,g){if(c)return l(c);l(null,g.toString())})},t.seedFileSync=function(u){return Yr.randomBytes(u).toString()}):(t.seedFile=function(u,l){try{l(null,f(u))}catch(c){l(c)}},t.seedFileSync=f),t.collect=function(u){for(var l=u.length,c=0;c<l;++c)t.pools[t.pool].update(u.substr(c,1)),t.pool=t.pool===31?0:t.pool+1},t.collectInt=function(u,l){for(var c="",g=0;g<l;g+=8)c+=String.fromCharCode(u>>g&255);t.collect(c)},t.registerWorker=function(u){if(u===self)t.seedFile=function(c,g){function m(y){var E=y.data;E.forge&&E.forge.prng&&(self.removeEventListener("message",m),g(E.forge.prng.err,E.forge.prng.bytes))}self.addEventListener("message",m),self.postMessage({forge:{prng:{needed:c}}})};else{var l=function(c){var g=c.data;g.forge&&g.forge.prng&&t.seedFile(g.forge.prng.needed,function(m,y){u.postMessage({forge:{prng:{err:m,bytes:y}}})})};u.addEventListener("message",l)}},t}});var et=j((nd,Ha)=>{var Ie=Q();Rt();qa();Ma();re();(function(){if(Ie.random&&Ie.random.getBytes){Ha.exports=Ie.random;return}(function(e){var t={},a=new Array(4),r=Ie.util.createBuffer();t.formatKey=function(c){var g=Ie.util.createBuffer(c);return c=new Array(4),c[0]=g.getInt32(),c[1]=g.getInt32(),c[2]=g.getInt32(),c[3]=g.getInt32(),Ie.aes._expandKey(c,!1)},t.formatSeed=function(c){var g=Ie.util.createBuffer(c);return c=new Array(4),c[0]=g.getInt32(),c[1]=g.getInt32(),c[2]=g.getInt32(),c[3]=g.getInt32(),c},t.cipher=function(c,g){return Ie.aes._updateBlock(c,g,a,!1),r.putInt32(a[0]),r.putInt32(a[1]),r.putInt32(a[2]),r.putInt32(a[3]),r.getBytes()},t.increment=function(c){return++c[3],c},t.md=Ie.md.sha256;function i(){var c=Ie.prng.create(t);return c.getBytes=function(g,m){return c.generate(g,m)},c.getBytesSync=function(g){return c.generate(g)},c}var s=i(),n=null,o=Ie.util.globalScope,f=o.crypto||o.msCrypto;if(f&&f.getRandomValues&&(n=function(c){return f.getRandomValues(c)}),Ie.options.usePureJavaScript||!Ie.util.isNodejs&&!n){if(typeof window>"u"||window.document,s.collectInt(+new Date,32),typeof navigator<"u"){var u="";for(var l in navigator)try{typeof navigator[l]=="string"&&(u+=navigator[l])}catch{}s.collect(u),u=null}e&&(e().mousemove(function(c){s.collectInt(c.clientX,16),s.collectInt(c.clientY,16)}),e().keypress(function(c){s.collectInt(c.charCode,8)}))}if(!Ie.random)Ie.random=s;else for(var l in s)Ie.random[l]=s[l];Ie.random.createInstance=i,Ha.exports=Ie.random})(typeof jQuery<"u"?jQuery:null)})()});var ja=j((sd,rs)=>{var We=Q();re();var Ga=[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],es=[1,2,3,5],G0=function(e,t){return e<<t&65535|(e&65535)>>16-t},j0=function(e,t){return(e&65535)>>t|e<<16-t&65535};rs.exports=We.rc2=We.rc2||{};We.rc2.expandKey=function(e,t){typeof e=="string"&&(e=We.util.createBuffer(e)),t=t||128;var a=e,r=e.length(),i=t,s=Math.ceil(i/8),n=255>>(i&7),o;for(o=r;o<128;o++)a.putByte(Ga[a.at(o-1)+a.at(o-r)&255]);for(a.setAt(128-s,Ga[a.at(128-s)&n]),o=127-s;o>=0;o--)a.setAt(o,Ga[a.at(o+1)^a.at(o+s)]);return a};var ts=function(e,t,a){var r=!1,i=null,s=null,n=null,o,f,u,l,c=[];for(e=We.rc2.expandKey(e,t),u=0;u<64;u++)c.push(e.getInt16Le());a?(o=function(y){for(u=0;u<4;u++)y[u]+=c[l]+(y[(u+3)%4]&y[(u+2)%4])+(~y[(u+3)%4]&y[(u+1)%4]),y[u]=G0(y[u],es[u]),l++},f=function(y){for(u=0;u<4;u++)y[u]+=c[y[(u+3)%4]&63]}):(o=function(y){for(u=3;u>=0;u--)y[u]=j0(y[u],es[u]),y[u]-=c[l]+(y[(u+3)%4]&y[(u+2)%4])+(~y[(u+3)%4]&y[(u+1)%4]),l--},f=function(y){for(u=3;u>=0;u--)y[u]-=c[y[(u+3)%4]&63]});var g=function(y){var E=[];for(u=0;u<4;u++){var S=i.getInt16Le();n!==null&&(a?S^=n.getInt16Le():n.putInt16Le(S)),E.push(S&65535)}l=a?0:63;for(var A=0;A<y.length;A++)for(var B=0;B<y[A][0];B++)y[A][1](E);for(u=0;u<4;u++)n!==null&&(a?n.putInt16Le(E[u]):E[u]^=n.getInt16Le()),s.putInt16Le(E[u])},m=null;return m={start:function(y,E){y&&typeof y=="string"&&(y=We.util.createBuffer(y)),r=!1,i=We.util.createBuffer(),s=E||new We.util.createBuffer,n=y,m.output=s},update:function(y){for(r||i.putBuffer(y);i.length()>=8;)g([[5,o],[1,f],[6,o],[1,f],[5,o]])},finish:function(y){var E=!0;if(a)if(y)E=y(8,i,!a);else{var S=i.length()===8?8:8-i.length();i.fillWithByte(S,S)}if(E&&(r=!0,m.update()),!a&&(E=i.length()===0,E))if(y)E=y(8,s,!a);else{var A=s.length(),B=s.at(A-1);B>A?E=!1:s.truncate(B)}return E}},m};We.rc2.startEncrypting=function(e,t,a){var r=We.rc2.createEncryptionCipher(e,128);return r.start(t,a),r};We.rc2.createEncryptionCipher=function(e,t){return ts(e,t,!0)};We.rc2.startDecrypting=function(e,t,a){var r=We.rc2.createDecryptionCipher(e,128);return r.start(t,a),r};We.rc2.createDecryptionCipher=function(e,t){return ts(e,t,!1)}});var Er=j((od,ls)=>{var za=Q();ls.exports=za.jsbn=za.jsbn||{};var At,z0=0xdeadbeefcafe,as=(z0&16777215)==15715070;function _(e,t,a){this.data=[],e!=null&&(typeof e=="number"?this.fromNumber(e,t,a):t==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,t))}za.jsbn.BigInteger=_;function Z(){return new _(null)}function Q0(e,t,a,r,i,s){for(;--s>=0;){var n=t*this.data[e++]+a.data[r]+i;i=Math.floor(n/67108864),a.data[r++]=n&67108863}return i}function Y0(e,t,a,r,i,s){for(var n=t&32767,o=t>>15;--s>=0;){var f=this.data[e]&32767,u=this.data[e++]>>15,l=o*f+u*n;f=n*f+((l&32767)<<15)+a.data[r]+(i&1073741823),i=(f>>>30)+(l>>>15)+o*u+(i>>>30),a.data[r++]=f&1073741823}return i}function is(e,t,a,r,i,s){for(var n=t&16383,o=t>>14;--s>=0;){var f=this.data[e]&16383,u=this.data[e++]>>14,l=o*f+u*n;f=n*f+((l&16383)<<14)+a.data[r]+i,i=(f>>28)+(l>>14)+o*u,a.data[r++]=f&268435455}return i}typeof navigator>"u"?(_.prototype.am=is,At=28):as&&navigator.appName=="Microsoft Internet Explorer"?(_.prototype.am=Y0,At=30):as&&navigator.appName!="Netscape"?(_.prototype.am=Q0,At=26):(_.prototype.am=is,At=28);_.prototype.DB=At;_.prototype.DM=(1<<At)-1;_.prototype.DV=1<<At;var Qa=52;_.prototype.FV=Math.pow(2,Qa);_.prototype.F1=Qa-At;_.prototype.F2=2*At-Qa;var W0="0123456789abcdefghijklmnopqrstuvwxyz",Wr=new Array,ir,tt;ir=48;for(tt=0;tt<=9;++tt)Wr[ir++]=tt;ir=97;for(tt=10;tt<36;++tt)Wr[ir++]=tt;ir=65;for(tt=10;tt<36;++tt)Wr[ir++]=tt;function ns(e){return W0.charAt(e)}function ss(e,t){var a=Wr[e.charCodeAt(t)];return a??-1}function X0(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function $0(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function kt(e){var t=Z();return t.fromInt(e),t}function J0(e,t){var a;if(t==16)a=4;else if(t==8)a=3;else if(t==256)a=8;else if(t==2)a=1;else if(t==32)a=5;else if(t==4)a=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var r=e.length,i=!1,s=0;--r>=0;){var n=a==8?e[r]&255:ss(e,r);if(n<0){e.charAt(r)=="-"&&(i=!0);continue}i=!1,s==0?this.data[this.t++]=n:s+a>this.DB?(this.data[this.t-1]|=(n&(1<<this.DB-s)-1)<<s,this.data[this.t++]=n>>this.DB-s):this.data[this.t-1]|=n<<s,s+=a,s>=this.DB&&(s-=this.DB)}a==8&&(e[0]&128)!=0&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),i&&_.ZERO.subTo(this,this)}function Z0(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t}function eu(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var a=(1<<t)-1,r,i=!1,s="",n=this.t,o=this.DB-n*this.DB%t;if(n-- >0)for(o<this.DB&&(r=this.data[n]>>o)>0&&(i=!0,s=ns(r));n>=0;)o<t?(r=(this.data[n]&(1<<o)-1)<<t-o,r|=this.data[--n]>>(o+=this.DB-t)):(r=this.data[n]>>(o-=t)&a,o<=0&&(o+=this.DB,--n)),r>0&&(i=!0),i&&(s+=ns(r));return i?s:"0"}function tu(){var e=Z();return _.ZERO.subTo(this,e),e}function ru(){return this.s<0?this.negate():this}function au(e){var t=this.s-e.s;if(t!=0)return t;var a=this.t;if(t=a-e.t,t!=0)return this.s<0?-t:t;for(;--a>=0;)if((t=this.data[a]-e.data[a])!=0)return t;return 0}function Xr(e){var t=1,a;return(a=e>>>16)!=0&&(e=a,t+=16),(a=e>>8)!=0&&(e=a,t+=8),(a=e>>4)!=0&&(e=a,t+=4),(a=e>>2)!=0&&(e=a,t+=2),(a=e>>1)!=0&&(e=a,t+=1),t}function iu(){return this.t<=0?0:this.DB*(this.t-1)+Xr(this.data[this.t-1]^this.s&this.DM)}function nu(e,t){var a;for(a=this.t-1;a>=0;--a)t.data[a+e]=this.data[a];for(a=e-1;a>=0;--a)t.data[a]=0;t.t=this.t+e,t.s=this.s}function su(e,t){for(var a=e;a<this.t;++a)t.data[a-e]=this.data[a];t.t=Math.max(this.t-e,0),t.s=this.s}function ou(e,t){var a=e%this.DB,r=this.DB-a,i=(1<<r)-1,s=Math.floor(e/this.DB),n=this.s<<a&this.DM,o;for(o=this.t-1;o>=0;--o)t.data[o+s+1]=this.data[o]>>r|n,n=(this.data[o]&i)<<a;for(o=s-1;o>=0;--o)t.data[o]=0;t.data[s]=n,t.t=this.t+s+1,t.s=this.s,t.clamp()}function uu(e,t){t.s=this.s;var a=Math.floor(e/this.DB);if(a>=this.t){t.t=0;return}var r=e%this.DB,i=this.DB-r,s=(1<<r)-1;t.data[0]=this.data[a]>>r;for(var n=a+1;n<this.t;++n)t.data[n-a-1]|=(this.data[n]&s)<<i,t.data[n-a]=this.data[n]>>r;r>0&&(t.data[this.t-a-1]|=(this.s&s)<<i),t.t=this.t-a,t.clamp()}function fu(e,t){for(var a=0,r=0,i=Math.min(e.t,this.t);a<i;)r+=this.data[a]-e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;a<this.t;)r+=this.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;a<e.t;)r-=e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t.data[a++]=this.DV+r:r>0&&(t.data[a++]=r),t.t=a,t.clamp()}function lu(e,t){var a=this.abs(),r=e.abs(),i=a.t;for(t.t=i+r.t;--i>=0;)t.data[i]=0;for(i=0;i<r.t;++i)t.data[i+a.t]=a.am(0,r.data[i],t,i,0,a.t);t.s=0,t.clamp(),this.s!=e.s&&_.ZERO.subTo(t,t)}function cu(e){for(var t=this.abs(),a=e.t=2*t.t;--a>=0;)e.data[a]=0;for(a=0;a<t.t-1;++a){var r=t.am(a,t.data[a],e,2*a,0,1);(e.data[a+t.t]+=t.am(a+1,2*t.data[a],e,2*a+1,r,t.t-a-1))>=t.DV&&(e.data[a+t.t]-=t.DV,e.data[a+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(a,t.data[a],e,2*a,0,1)),e.s=0,e.clamp()}function du(e,t,a){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t<r.t){t?.fromInt(0),a!=null&&this.copyTo(a);return}a==null&&(a=Z());var s=Z(),n=this.s,o=e.s,f=this.DB-Xr(r.data[r.t-1]);f>0?(r.lShiftTo(f,s),i.lShiftTo(f,a)):(r.copyTo(s),i.copyTo(a));var u=s.t,l=s.data[u-1];if(l!=0){var c=l*(1<<this.F1)+(u>1?s.data[u-2]>>this.F2:0),g=this.FV/c,m=(1<<this.F1)/c,y=1<<this.F2,E=a.t,S=E-u,A=t??Z();for(s.dlShiftTo(S,A),a.compareTo(A)>=0&&(a.data[a.t++]=1,a.subTo(A,a)),_.ONE.dlShiftTo(u,A),A.subTo(s,s);s.t<u;)s.data[s.t++]=0;for(;--S>=0;){var B=a.data[--E]==l?this.DM:Math.floor(a.data[E]*g+(a.data[E-1]+y)*m);if((a.data[E]+=s.am(0,B,a,S,0,u))<B)for(s.dlShiftTo(S,A),a.subTo(A,a);a.data[E]<--B;)a.subTo(A,a)}t!=null&&(a.drShiftTo(u,t),n!=o&&_.ZERO.subTo(t,t)),a.t=u,a.clamp(),f>0&&a.rShiftTo(f,a),n<0&&_.ZERO.subTo(a,a)}}}function pu(e){var t=Z();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(_.ZERO)>0&&e.subTo(t,t),t}function Gt(e){this.m=e}function hu(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function gu(e){return e}function yu(e){e.divRemTo(this.m,null,e)}function vu(e,t,a){e.multiplyTo(t,a),this.reduce(a)}function mu(e,t){e.squareTo(t),this.reduce(t)}Gt.prototype.convert=hu;Gt.prototype.revert=gu;Gt.prototype.reduce=yu;Gt.prototype.mulTo=vu;Gt.prototype.sqrTo=mu;function Cu(){if(this.t<1)return 0;var e=this.data[0];if((e&1)==0)return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function jt(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function xu(e){var t=Z();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(_.ZERO)>0&&this.m.subTo(t,t),t}function Eu(e){var t=Z();return e.copyTo(t),this.reduce(t),t}function Su(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var a=e.data[t]&32767,r=a*this.mpl+((a*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(a=t+this.m.t,e.data[a]+=this.m.am(0,r,e,t,0,this.m.t);e.data[a]>=e.DV;)e.data[a]-=e.DV,e.data[++a]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function Tu(e,t){e.squareTo(t),this.reduce(t)}function Au(e,t,a){e.multiplyTo(t,a),this.reduce(a)}jt.prototype.convert=xu;jt.prototype.revert=Eu;jt.prototype.reduce=Su;jt.prototype.mulTo=Au;jt.prototype.sqrTo=Tu;function Iu(){return(this.t>0?this.data[0]&1:this.s)==0}function Bu(e,t){if(e>4294967295||e<1)return _.ONE;var a=Z(),r=Z(),i=t.convert(this),s=Xr(e)-1;for(i.copyTo(a);--s>=0;)if(t.sqrTo(a,r),(e&1<<s)>0)t.mulTo(r,i,a);else{var n=a;a=r,r=n}return t.revert(a)}function bu(e,t){var a;return e<256||t.isEven()?a=new Gt(t):a=new jt(t),this.exp(e,a)}_.prototype.copyTo=X0;_.prototype.fromInt=$0;_.prototype.fromString=J0;_.prototype.clamp=Z0;_.prototype.dlShiftTo=nu;_.prototype.drShiftTo=su;_.prototype.lShiftTo=ou;_.prototype.rShiftTo=uu;_.prototype.subTo=fu;_.prototype.multiplyTo=lu;_.prototype.squareTo=cu;_.prototype.divRemTo=du;_.prototype.invDigit=Cu;_.prototype.isEven=Iu;_.prototype.exp=Bu;_.prototype.toString=eu;_.prototype.negate=tu;_.prototype.abs=ru;_.prototype.compareTo=au;_.prototype.bitLength=iu;_.prototype.mod=pu;_.prototype.modPowInt=bu;_.ZERO=kt(0);_.ONE=kt(1);function _u(){var e=Z();return this.copyTo(e),e}function Nu(){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 wu(){return this.t==0?this.s:this.data[0]<<24>>24}function Ru(){return this.t==0?this.s:this.data[0]<<16>>16}function Lu(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function ku(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function Du(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var t=this.chunkSize(e),a=Math.pow(e,t),r=kt(a),i=Z(),s=Z(),n="";for(this.divRemTo(r,i,s);i.signum()>0;)n=(a+s.intValue()).toString(e).substr(1)+n,i.divRemTo(r,i,s);return s.intValue().toString(e)+n}function Uu(e,t){this.fromInt(0),t==null&&(t=10);for(var a=this.chunkSize(t),r=Math.pow(t,a),i=!1,s=0,n=0,o=0;o<e.length;++o){var f=ss(e,o);if(f<0){e.charAt(o)=="-"&&this.signum()==0&&(i=!0);continue}n=t*n+f,++s>=a&&(this.dMultiply(r),this.dAddOffset(n,0),s=0,n=0)}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(n,0)),i&&_.ZERO.subTo(this,this)}function Pu(e,t,a){if(typeof t=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,a),this.testBit(e-1)||this.bitwiseTo(_.ONE.shiftLeft(e-1),Ya,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(_.ONE.shiftLeft(e-1),this);else{var r=new Array,i=e&7;r.length=(e>>3)+1,t.nextBytes(r),i>0?r[0]&=(1<<i)-1:r[0]=0,this.fromString(r,256)}}function Vu(){var e=this.t,t=new Array;t[0]=this.s;var a=this.DB-e*this.DB%8,r,i=0;if(e-- >0)for(a<this.DB&&(r=this.data[e]>>a)!=(this.s&this.DM)>>a&&(t[i++]=r|this.s<<this.DB-a);e>=0;)a<8?(r=(this.data[e]&(1<<a)-1)<<8-a,r|=this.data[--e]>>(a+=this.DB-8)):(r=this.data[e]>>(a-=8)&255,a<=0&&(a+=this.DB,--e)),(r&128)!=0&&(r|=-256),i==0&&(this.s&128)!=(r&128)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t}function Ou(e){return this.compareTo(e)==0}function Fu(e){return this.compareTo(e)<0?this:e}function Ku(e){return this.compareTo(e)>0?this:e}function qu(e,t,a){var r,i,s=Math.min(e.t,this.t);for(r=0;r<s;++r)a.data[r]=t(this.data[r],e.data[r]);if(e.t<this.t){for(i=e.s&this.DM,r=s;r<this.t;++r)a.data[r]=t(this.data[r],i);a.t=this.t}else{for(i=this.s&this.DM,r=s;r<e.t;++r)a.data[r]=t(i,e.data[r]);a.t=e.t}a.s=t(this.s,e.s),a.clamp()}function Mu(e,t){return e&t}function Hu(e){var t=Z();return this.bitwiseTo(e,Mu,t),t}function Ya(e,t){return e|t}function Gu(e){var t=Z();return this.bitwiseTo(e,Ya,t),t}function os(e,t){return e^t}function ju(e){var t=Z();return this.bitwiseTo(e,os,t),t}function us(e,t){return e&~t}function zu(e){var t=Z();return this.bitwiseTo(e,us,t),t}function Qu(){for(var e=Z(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e}function Yu(e){var t=Z();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function Wu(e){var t=Z();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function Xu(e){if(e==0)return-1;var t=0;return(e&65535)==0&&(e>>=16,t+=16),(e&255)==0&&(e>>=8,t+=8),(e&15)==0&&(e>>=4,t+=4),(e&3)==0&&(e>>=2,t+=2),(e&1)==0&&++t,t}function $u(){for(var e=0;e<this.t;++e)if(this.data[e]!=0)return e*this.DB+Xu(this.data[e]);return this.s<0?this.t*this.DB:-1}function Ju(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function Zu(){for(var e=0,t=this.s&this.DM,a=0;a<this.t;++a)e+=Ju(this.data[a]^t);return e}function ef(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this.data[t]&1<<e%this.DB)!=0}function tf(e,t){var a=_.ONE.shiftLeft(e);return this.bitwiseTo(a,t,a),a}function rf(e){return this.changeBit(e,Ya)}function af(e){return this.changeBit(e,us)}function nf(e){return this.changeBit(e,os)}function sf(e,t){for(var a=0,r=0,i=Math.min(e.t,this.t);a<i;)r+=this.data[a]+e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;a<this.t;)r+=this.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;a<e.t;)r+=e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t.data[a++]=r:r<-1&&(t.data[a++]=this.DV+r),t.t=a,t.clamp()}function of(e){var t=Z();return this.addTo(e,t),t}function uf(e){var t=Z();return this.subTo(e,t),t}function ff(e){var t=Z();return this.multiplyTo(e,t),t}function lf(){var e=Z();return this.squareTo(e),e}function cf(e){var t=Z();return this.divRemTo(e,t,null),t}function df(e){var t=Z();return this.divRemTo(e,null,t),t}function pf(e){var t=Z(),a=Z();return this.divRemTo(e,t,a),new Array(t,a)}function hf(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function gf(e,t){if(e!=0){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}}function xr(){}function fs(e){return e}function yf(e,t,a){e.multiplyTo(t,a)}function vf(e,t){e.squareTo(t)}xr.prototype.convert=fs;xr.prototype.revert=fs;xr.prototype.mulTo=yf;xr.prototype.sqrTo=vf;function mf(e){return this.exp(e,new xr)}function Cf(e,t,a){var r=Math.min(this.t+e.t,t);for(a.s=0,a.t=r;r>0;)a.data[--r]=0;var i;for(i=a.t-this.t;r<i;++r)a.data[r+this.t]=this.am(0,e.data[r],a,r,0,this.t);for(i=Math.min(e.t,t);r<i;++r)this.am(0,e.data[r],a,r,0,t-r);a.clamp()}function xf(e,t,a){--t;var r=a.t=this.t+e.t-t;for(a.s=0;--r>=0;)a.data[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)a.data[this.t+r-t]=this.am(t-r,e.data[r],a,0,0,this.t+r-t);a.clamp(),a.drShiftTo(1,a)}function nr(e){this.r2=Z(),this.q3=Z(),_.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function Ef(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=Z();return e.copyTo(t),this.reduce(t),t}function Sf(e){return e}function Tf(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function Af(e,t){e.squareTo(t),this.reduce(t)}function If(e,t,a){e.multiplyTo(t,a),this.reduce(a)}nr.prototype.convert=Ef;nr.prototype.revert=Sf;nr.prototype.reduce=Tf;nr.prototype.mulTo=If;nr.prototype.sqrTo=Af;function Bf(e,t){var a=e.bitLength(),r,i=kt(1),s;if(a<=0)return i;a<18?r=1:a<48?r=3:a<144?r=4:a<768?r=5:r=6,a<8?s=new Gt(t):t.isEven()?s=new nr(t):s=new jt(t);var n=new Array,o=3,f=r-1,u=(1<<r)-1;if(n[1]=s.convert(this),r>1){var l=Z();for(s.sqrTo(n[1],l);o<=u;)n[o]=Z(),s.mulTo(l,n[o-2],n[o]),o+=2}var c=e.t-1,g,m=!0,y=Z(),E;for(a=Xr(e.data[c])-1;c>=0;){for(a>=f?g=e.data[c]>>a-f&u:(g=(e.data[c]&(1<<a+1)-1)<<f-a,c>0&&(g|=e.data[c-1]>>this.DB+a-f)),o=r;(g&1)==0;)g>>=1,--o;if((a-=o)<0&&(a+=this.DB,--c),m)n[g].copyTo(i),m=!1;else{for(;o>1;)s.sqrTo(i,y),s.sqrTo(y,i),o-=2;o>0?s.sqrTo(i,y):(E=i,i=y,y=E),s.mulTo(y,n[g],i)}for(;c>=0&&(e.data[c]&1<<a)==0;)s.sqrTo(i,y),E=i,i=y,y=E,--a<0&&(a=this.DB-1,--c)}return s.revert(i)}function bf(e){var t=this.s<0?this.negate():this.clone(),a=e.s<0?e.negate():e.clone();if(t.compareTo(a)<0){var r=t;t=a,a=r}var i=t.getLowestSetBit(),s=a.getLowestSetBit();if(s<0)return t;for(i<s&&(s=i),s>0&&(t.rShiftTo(s,t),a.rShiftTo(s,a));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=a.getLowestSetBit())>0&&a.rShiftTo(i,a),t.compareTo(a)>=0?(t.subTo(a,t),t.rShiftTo(1,t)):(a.subTo(t,a),a.rShiftTo(1,a));return s>0&&a.lShiftTo(s,a),a}function _f(e){if(e<=0)return 0;var t=this.DV%e,a=this.s<0?e-1:0;if(this.t>0)if(t==0)a=this.data[0]%e;else for(var r=this.t-1;r>=0;--r)a=(t*a+this.data[r])%e;return a}function Nf(e){if(this.signum()==0)return _.ZERO;var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return _.ZERO;for(var a=e.clone(),r=this.clone(),i=kt(1),s=kt(0),n=kt(0),o=kt(1);a.signum()!=0;){for(;a.isEven();)a.rShiftTo(1,a),t?((!i.isEven()||!s.isEven())&&(i.addTo(this,i),s.subTo(e,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;r.isEven();)r.rShiftTo(1,r),t?((!n.isEven()||!o.isEven())&&(n.addTo(this,n),o.subTo(e,o)),n.rShiftTo(1,n)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);a.compareTo(r)>=0?(a.subTo(r,a),t&&i.subTo(n,i),s.subTo(o,s)):(r.subTo(a,r),t&&n.subTo(i,n),o.subTo(s,o))}if(r.compareTo(_.ONE)!=0)return _.ZERO;if(o.compareTo(e)>=0)return o.subtract(e);if(o.signum()<0)o.addTo(e,o);else return o;return o.signum()<0?o.add(e):o}var ft=[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],wf=(1<<26)/ft[ft.length-1];function Rf(e){var t,a=this.abs();if(a.t==1&&a.data[0]<=ft[ft.length-1]){for(t=0;t<ft.length;++t)if(a.data[0]==ft[t])return!0;return!1}if(a.isEven())return!1;for(t=1;t<ft.length;){for(var r=ft[t],i=t+1;i<ft.length&&r<wf;)r*=ft[i++];for(r=a.modInt(r);t<i;)if(r%ft[t++]==0)return!1}return a.millerRabin(e)}function Lf(e){var t=this.subtract(_.ONE),a=t.getLowestSetBit();if(a<=0)return!1;for(var r=t.shiftRight(a),i=kf(),s,n=0;n<e;++n){do s=new _(this.bitLength(),i);while(s.compareTo(_.ONE)<=0||s.compareTo(t)>=0);var o=s.modPow(r,this);if(o.compareTo(_.ONE)!=0&&o.compareTo(t)!=0){for(var f=1;f++<a&&o.compareTo(t)!=0;)if(o=o.modPowInt(2,this),o.compareTo(_.ONE)==0)return!1;if(o.compareTo(t)!=0)return!1}}return!0}function kf(){return{nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(Math.random()*256)}}}_.prototype.chunkSize=Lu;_.prototype.toRadix=Du;_.prototype.fromRadix=Uu;_.prototype.fromNumber=Pu;_.prototype.bitwiseTo=qu;_.prototype.changeBit=tf;_.prototype.addTo=sf;_.prototype.dMultiply=hf;_.prototype.dAddOffset=gf;_.prototype.multiplyLowerTo=Cf;_.prototype.multiplyUpperTo=xf;_.prototype.modInt=_f;_.prototype.millerRabin=Lf;_.prototype.clone=_u;_.prototype.intValue=Nu;_.prototype.byteValue=wu;_.prototype.shortValue=Ru;_.prototype.signum=ku;_.prototype.toByteArray=Vu;_.prototype.equals=Ou;_.prototype.min=Fu;_.prototype.max=Ku;_.prototype.and=Hu;_.prototype.or=Gu;_.prototype.xor=ju;_.prototype.andNot=zu;_.prototype.not=Qu;_.prototype.shiftLeft=Yu;_.prototype.shiftRight=Wu;_.prototype.getLowestSetBit=$u;_.prototype.bitCount=Zu;_.prototype.testBit=ef;_.prototype.setBit=rf;_.prototype.clearBit=af;_.prototype.flipBit=nf;_.prototype.add=of;_.prototype.subtract=uf;_.prototype.multiply=ff;_.prototype.divide=cf;_.prototype.remainder=df;_.prototype.divideAndRemainder=pf;_.prototype.modPow=Bf;_.prototype.modInverse=Nf;_.prototype.pow=mf;_.prototype.gcd=bf;_.prototype.isProbablePrime=Rf;_.prototype.square=lf});var sr=j((ud,hs)=>{var gt=Q();lt();re();var ds=hs.exports=gt.sha1=gt.sha1||{};gt.md.sha1=gt.md.algorithms.sha1=ds;ds.create=function(){ps||Df();var e=null,t=gt.util.createBuffer(),a=new Array(80),r={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return r.start=function(){r.messageLength=0,r.fullMessageLength=r.messageLength64=[];for(var i=r.messageLengthSize/4,s=0;s<i;++s)r.fullMessageLength.push(0);return t=gt.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},r},r.start(),r.update=function(i,s){s==="utf8"&&(i=gt.util.encodeUtf8(i));var n=i.length;r.messageLength+=n,n=[n/4294967296>>>0,n>>>0];for(var o=r.fullMessageLength.length-1;o>=0;--o)r.fullMessageLength[o]+=n[1],n[1]=n[0]+(r.fullMessageLength[o]/4294967296>>>0),r.fullMessageLength[o]=r.fullMessageLength[o]>>>0,n[0]=n[1]/4294967296>>>0;return t.putBytes(i),cs(e,a,t),(t.read>2048||t.length()===0)&&t.compact(),r},r.digest=function(){var i=gt.util.createBuffer();i.putBytes(t.bytes());var s=r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize,n=s&r.blockLength-1;i.putBytes(Wa.substr(0,r.blockLength-n));for(var o,f,u=r.fullMessageLength[0]*8,l=0;l<r.fullMessageLength.length-1;++l)o=r.fullMessageLength[l+1]*8,f=o/4294967296>>>0,u+=f,i.putInt32(u>>>0),u=o>>>0;i.putInt32(u);var c={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};cs(c,a,i);var g=gt.util.createBuffer();return g.putInt32(c.h0),g.putInt32(c.h1),g.putInt32(c.h2),g.putInt32(c.h3),g.putInt32(c.h4),g},r};var Wa=null,ps=!1;function Df(){Wa="\x80",Wa+=gt.util.fillString("\0",64),ps=!0}function cs(e,t,a){for(var r,i,s,n,o,f,u,l,c=a.length();c>=64;){for(i=e.h0,s=e.h1,n=e.h2,o=e.h3,f=e.h4,l=0;l<16;++l)r=a.getInt32(),t[l]=r,u=o^s&(n^o),r=(i<<5|i>>>27)+u+f+1518500249+r,f=o,o=n,n=(s<<30|s>>>2)>>>0,s=i,i=r;for(;l<20;++l)r=t[l-3]^t[l-8]^t[l-14]^t[l-16],r=r<<1|r>>>31,t[l]=r,u=o^s&(n^o),r=(i<<5|i>>>27)+u+f+1518500249+r,f=o,o=n,n=(s<<30|s>>>2)>>>0,s=i,i=r;for(;l<32;++l)r=t[l-3]^t[l-8]^t[l-14]^t[l-16],r=r<<1|r>>>31,t[l]=r,u=s^n^o,r=(i<<5|i>>>27)+u+f+1859775393+r,f=o,o=n,n=(s<<30|s>>>2)>>>0,s=i,i=r;for(;l<40;++l)r=t[l-6]^t[l-16]^t[l-28]^t[l-32],r=r<<2|r>>>30,t[l]=r,u=s^n^o,r=(i<<5|i>>>27)+u+f+1859775393+r,f=o,o=n,n=(s<<30|s>>>2)>>>0,s=i,i=r;for(;l<60;++l)r=t[l-6]^t[l-16]^t[l-28]^t[l-32],r=r<<2|r>>>30,t[l]=r,u=s&n|o&(s^n),r=(i<<5|i>>>27)+u+f+2400959708+r,f=o,o=n,n=(s<<30|s>>>2)>>>0,s=i,i=r;for(;l<80;++l)r=t[l-6]^t[l-16]^t[l-28]^t[l-32],r=r<<2|r>>>30,t[l]=r,u=s^n^o,r=(i<<5|i>>>27)+u+f+3395469782+r,f=o,o=n,n=(s<<30|s>>>2)>>>0,s=i,i=r;e.h0=e.h0+i|0,e.h1=e.h1+s|0,e.h2=e.h2+n|0,e.h3=e.h3+o|0,e.h4=e.h4+f|0,c-=64}}});var Xa=j((fd,ys)=>{var yt=Q();re();et();sr();var gs=ys.exports=yt.pkcs1=yt.pkcs1||{};gs.encode_rsa_oaep=function(e,t,a){var r,i,s,n;typeof a=="string"?(r=a,i=arguments[3]||void 0,s=arguments[4]||void 0):a&&(r=a.label||void 0,i=a.seed||void 0,s=a.md||void 0,a.mgf1&&a.mgf1.md&&(n=a.mgf1.md)),s?s.start():s=yt.md.sha1.create(),n||(n=s);var o=Math.ceil(e.n.bitLength()/8),f=o-2*s.digestLength-2;if(t.length>f){var u=new Error("RSAES-OAEP input message length is too long.");throw u.length=t.length,u.maxLength=f,u}r||(r=""),s.update(r,"raw");for(var l=s.digest(),c="",g=f-t.length,m=0;m<g;m++)c+="\0";var y=l.getBytes()+c+""+t;if(!i)i=yt.random.getBytes(s.digestLength);else if(i.length!==s.digestLength){var u=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw u.seedLength=i.length,u.digestLength=s.digestLength,u}var E=$r(i,o-s.digestLength-1,n),S=yt.util.xorBytes(y,E,y.length),A=$r(S,s.digestLength,n),B=yt.util.xorBytes(i,A,i.length);return"\0"+B+S};gs.decode_rsa_oaep=function(e,t,a){var r,i,s;typeof a=="string"?(r=a,i=arguments[3]||void 0):a&&(r=a.label||void 0,i=a.md||void 0,a.mgf1&&a.mgf1.md&&(s=a.mgf1.md));var n=Math.ceil(e.n.bitLength()/8);if(t.length!==n){var S=new Error("RSAES-OAEP encoded message length is invalid.");throw S.length=t.length,S.expectedLength=n,S}if(i===void 0?i=yt.md.sha1.create():i.start(),s||(s=i),n<2*i.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");r||(r=""),i.update(r,"raw");for(var o=i.digest().getBytes(),f=t.charAt(0),u=t.substring(1,i.digestLength+1),l=t.substring(1+i.digestLength),c=$r(l,i.digestLength,s),g=yt.util.xorBytes(u,c,u.length),m=$r(g,n-i.digestLength-1,s),y=yt.util.xorBytes(l,m,l.length),E=y.substring(0,i.digestLength),S=f!=="\0",A=0;A<i.digestLength;++A)S|=o.charAt(A)!==E.charAt(A);for(var B=1,b=i.digestLength,V=i.digestLength;V<y.length;V++){var k=y.charCodeAt(V),R=k&1^1,G=B?65534:0;S|=k&G,B=B&R,b+=B}if(S||y.charCodeAt(b)!==1)throw new Error("Invalid RSAES-OAEP padding.");return y.substring(b+1)};function $r(e,t,a){a||(a=yt.md.sha1.create());for(var r="",i=Math.ceil(t/a.digestLength),s=0;s<i;++s){var n=String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,s&255);a.start(),a.update(e+n),r+=a.digest().getBytes()}return r.substring(0,t)}});var Ja=j((ld,$a)=>{var Dt=Q();re();Er();et();(function(){if(Dt.prime){$a.exports=Dt.prime;return}var e=$a.exports=Dt.prime=Dt.prime||{},t=Dt.jsbn.BigInteger,a=[6,4,2,4,2,4,6,2],r=new t(null);r.fromInt(30);var i=function(c,g){return c|g};e.generateProbablePrime=function(c,g,m){typeof g=="function"&&(m=g,g={}),g=g||{};var y=g.algorithm||"PRIMEINC";typeof y=="string"&&(y={name:y}),y.options=y.options||{};var E=g.prng||Dt.random,S={nextBytes:function(A){for(var B=E.getBytesSync(A.length),b=0;b<A.length;++b)A[b]=B.charCodeAt(b)}};if(y.name==="PRIMEINC")return s(c,S,y.options,m);throw new Error("Invalid prime generation algorithm: "+y.name)};function s(c,g,m,y){return"workers"in m?f(c,g,m,y):n(c,g,m,y)}function n(c,g,m,y){var E=u(c,g),S=0,A=l(E.bitLength());"millerRabinTests"in m&&(A=m.millerRabinTests);var B=10;"maxBlockTime"in m&&(B=m.maxBlockTime),o(E,c,g,S,A,B,y)}function o(c,g,m,y,E,S,A){var B=+new Date;do{if(c.bitLength()>g&&(c=u(g,m)),c.isProbablePrime(E))return A(null,c);c.dAddOffset(a[y++%8],0)}while(S<0||+new Date-B<S);Dt.util.setImmediate(function(){o(c,g,m,y,E,S,A)})}function f(c,g,m,y){if(typeof Worker>"u")return n(c,g,m,y);var E=u(c,g),S=m.workers,A=m.workLoad||100,B=A*30/8,b=m.workerScript||"forge/prime.worker.js";if(S===-1)return Dt.util.estimateCores(function(k,R){k&&(R=2),S=R-1,V()});V();function V(){S=Math.max(1,S);for(var k=[],R=0;R<S;++R)k[R]=new Worker(b);for(var G=S,R=0;R<S;++R)k[R].addEventListener("message",ie);var Y=!1;function ie(ne){if(!Y){--G;var ue=ne.data;if(ue.found){for(var ce=0;ce<k.length;++ce)k[ce].terminate();return Y=!0,y(null,new t(ue.prime,16))}E.bitLength()>c&&(E=u(c,g));var He=E.toString(16);ne.target.postMessage({hex:He,workLoad:A}),E.dAddOffset(B,0)}}}}function u(c,g){var m=new t(c,g),y=c-1;return m.testBit(y)||m.bitwiseTo(t.ONE.shiftLeft(y),i,m),m.dAddOffset(31-m.mod(r).byteValue(),0),m}function l(c){return c<=100?27:c<=150?18:c<=200?15:c<=250?12:c<=300?9:c<=350?8:c<=400?7:c<=500?6:c<=600?5:c<=800?4:c<=1250?3:2}})()});var Sr=j((cd,Ts)=>{var K=Q();ut();Er();Lt();Xa();Ja();et();re();typeof ee>"u"&&(ee=K.jsbn.BigInteger);var ee,Za=K.util.isNodejs?ya("crypto"):null,T=K.asn1,rt=K.util;K.pki=K.pki||{};Ts.exports=K.pki.rsa=K.rsa=K.rsa||{};var H=K.pki,Uf=[6,4,2,4,2,4,6,2],Pf={name:"PrivateKeyInfo",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:T.Class.UNIVERSAL,type:T.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:T.Class.UNIVERSAL,type:T.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},Vf={name:"RSAPrivateKey",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},Of={name:"RSAPublicKey",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:T.Class.UNIVERSAL,type:T.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},Ff=K.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:T.Class.UNIVERSAL,type:T.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:T.Class.UNIVERSAL,type:T.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},Kf={name:"DigestInfo",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:T.Class.UNIVERSAL,type:T.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:T.Class.UNIVERSAL,type:T.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:T.Class.UNIVERSAL,type:T.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:T.Class.UNIVERSAL,type:T.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},qf=function(e){var t;if(e.algorithm in H.oids)t=H.oids[e.algorithm];else{var a=new Error("Unknown message digest algorithm.");throw a.algorithm=e.algorithm,a}var r=T.oidToDer(t).getBytes(),i=T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[]),s=T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[]);s.value.push(T.create(T.Class.UNIVERSAL,T.Type.OID,!1,r)),s.value.push(T.create(T.Class.UNIVERSAL,T.Type.NULL,!1,""));var n=T.create(T.Class.UNIVERSAL,T.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(s),i.value.push(n),T.toDer(i).getBytes()},Es=function(e,t,a){if(a)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);t.dP||(t.dP=t.d.mod(t.p.subtract(ee.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(ee.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));var r;do r=new ee(K.util.bytesToHex(K.random.getBytes(t.n.bitLength()/8)),16);while(r.compareTo(t.n)>=0||!r.gcd(t.n).equals(ee.ONE));e=e.multiply(r.modPow(t.e,t.n)).mod(t.n);for(var i=e.mod(t.p).modPow(t.dP,t.p),s=e.mod(t.q).modPow(t.dQ,t.q);i.compareTo(s)<0;)i=i.add(t.p);var n=i.subtract(s).multiply(t.qInv).mod(t.p).multiply(t.q).add(s);return n=n.multiply(r.modInverse(t.n)).mod(t.n),n};H.rsa.encrypt=function(e,t,a){var r=a,i,s=Math.ceil(t.n.bitLength()/8);a!==!1&&a!==!0?(r=a===2,i=Ss(e,t,a)):(i=K.util.createBuffer(),i.putBytes(e));for(var n=new ee(i.toHex(),16),o=Es(n,t,r),f=o.toString(16),u=K.util.createBuffer(),l=s-Math.ceil(f.length/2);l>0;)u.putByte(0),--l;return u.putBytes(K.util.hexToBytes(f)),u.getBytes()};H.rsa.decrypt=function(e,t,a,r){var i=Math.ceil(t.n.bitLength()/8);if(e.length!==i){var s=new Error("Encrypted message length is invalid.");throw s.length=e.length,s.expected=i,s}var n=new ee(K.util.createBuffer(e).toHex(),16);if(n.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var o=Es(n,t,a),f=o.toString(16),u=K.util.createBuffer(),l=i-Math.ceil(f.length/2);l>0;)u.putByte(0),--l;return u.putBytes(K.util.hexToBytes(f)),r!==!1?Jr(u.getBytes(),t,a):u.getBytes()};H.rsa.createKeyPairGenerationState=function(e,t,a){typeof e=="string"&&(e=parseInt(e,10)),e=e||2048,a=a||{};var r=a.prng||K.random,i={nextBytes:function(o){for(var f=r.getBytesSync(o.length),u=0;u<o.length;++u)o[u]=f.charCodeAt(u)}},s=a.algorithm||"PRIMEINC",n;if(s==="PRIMEINC")n={algorithm:s,state:0,bits:e,rng:i,eInt:t||65537,e:new ee(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},n.e.fromInt(n.eInt);else throw new Error("Invalid key generation algorithm: "+s);return n};H.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var a=new ee(null);a.fromInt(30);for(var r=0,i=function(c,g){return c|g},s=+new Date,n,o=0;e.keys===null&&(t<=0||o<t);){if(e.state===0){var f=e.p===null?e.pBits:e.qBits,u=f-1;e.pqState===0?(e.num=new ee(f,e.rng),e.num.testBit(u)||e.num.bitwiseTo(ee.ONE.shiftLeft(u),i,e.num),e.num.dAddOffset(31-e.num.mod(a).byteValue(),0),r=0,++e.pqState):e.pqState===1?e.num.bitLength()>f?e.pqState=0:e.num.isProbablePrime(Hf(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(Uf[r++%8],0):e.pqState===2?e.pqState=e.num.subtract(ee.ONE).gcd(e.e).compareTo(ee.ONE)===0?3:0:e.pqState===3&&(e.pqState=0,e.p===null?e.p=e.num:e.q=e.num,e.p!==null&&e.q!==null&&++e.state,e.num=null)}else if(e.state===1)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(e.state===2)e.p1=e.p.subtract(ee.ONE),e.q1=e.q.subtract(ee.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(e.state===3)e.phi.gcd(e.e).compareTo(ee.ONE)===0?++e.state:(e.p=null,e.q=null,e.state=0);else if(e.state===4)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(e.state===5){var l=e.e.modInverse(e.phi);e.keys={privateKey:H.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:H.rsa.setPublicKey(e.n,e.e)}}n=+new Date,o+=n-s,s=n}return e.keys!==null};H.rsa.generateKeyPair=function(e,t,a,r){if(arguments.length===1?typeof e=="object"?(a=e,e=void 0):typeof e=="function"&&(r=e,e=void 0):arguments.length===2?typeof e=="number"?typeof t=="function"?(r=t,t=void 0):typeof t!="number"&&(a=t,t=void 0):(a=e,r=t,e=void 0,t=void 0):arguments.length===3&&(typeof t=="number"?typeof a=="function"&&(r=a,a=void 0):(r=a,a=t,t=void 0)),a=a||{},e===void 0&&(e=a.bits||2048),t===void 0&&(t=a.e||65537),!K.options.usePureJavaScript&&!a.prng&&e>=256&&e<=16384&&(t===65537||t===3)){if(r){if(vs("generateKeyPair"))return Za.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(o,f,u){if(o)return r(o);r(null,{privateKey:H.privateKeyFromPem(u),publicKey:H.publicKeyFromPem(f)})});if(ms("generateKey")&&ms("exportKey"))return rt.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:xs(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(o){return rt.globalScope.crypto.subtle.exportKey("pkcs8",o.privateKey)}).then(void 0,function(o){r(o)}).then(function(o){if(o){var f=H.privateKeyFromAsn1(T.fromDer(K.util.createBuffer(o)));r(null,{privateKey:f,publicKey:H.setRsaPublicKey(f.n,f.e)})}});if(Cs("generateKey")&&Cs("exportKey")){var i=rt.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:xs(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);i.oncomplete=function(o){var f=o.target.result,u=rt.globalScope.msCrypto.subtle.exportKey("pkcs8",f.privateKey);u.oncomplete=function(l){var c=l.target.result,g=H.privateKeyFromAsn1(T.fromDer(K.util.createBuffer(c)));r(null,{privateKey:g,publicKey:H.setRsaPublicKey(g.n,g.e)})},u.onerror=function(l){r(l)}},i.onerror=function(o){r(o)};return}}else if(vs("generateKeyPairSync")){var s=Za.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:H.privateKeyFromPem(s.privateKey),publicKey:H.publicKeyFromPem(s.publicKey)}}}var n=H.rsa.createKeyPairGenerationState(e,t,a);if(!r)return H.rsa.stepKeyPairGenerationState(n,0),n.keys;Mf(n,a,r)};H.setRsaPublicKey=H.rsa.setPublicKey=function(e,t){var a={n:e,e:t};return a.encrypt=function(r,i,s){if(typeof i=="string"?i=i.toUpperCase():i===void 0&&(i="RSAES-PKCS1-V1_5"),i==="RSAES-PKCS1-V1_5")i={encode:function(o,f,u){return Ss(o,f,2).getBytes()}};else if(i==="RSA-OAEP"||i==="RSAES-OAEP")i={encode:function(o,f){return K.pkcs1.encode_rsa_oaep(f,o,s)}};else if(["RAW","NONE","NULL",null].indexOf(i)!==-1)i={encode:function(o){return o}};else if(typeof i=="string")throw new Error('Unsupported encryption scheme: "'+i+'".');var n=i.encode(r,a,!0);return H.rsa.encrypt(n,a,!0)},a.verify=function(r,i,s,n){typeof s=="string"?s=s.toUpperCase():s===void 0&&(s="RSASSA-PKCS1-V1_5"),n===void 0&&(n={_parseAllDigestBytes:!0,_skipPaddingChecks:!1}),"_parseAllDigestBytes"in n||(n._parseAllDigestBytes=!0),"_skipPaddingChecks"in n||(n._skipPaddingChecks=!1),s==="RSASSA-PKCS1-V1_5"?s={verify:function(f,u){u=Jr(u,a,!0,void 0,n);var l=T.fromDer(u,{parseAllBytes:n._parseAllDigestBytes}),c={},g=[];if(!T.validate(l,Kf,c,g)||l.value.length!==2){var m=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw m.errors=g,m}var y=T.derToOid(c.algorithmIdentifier);if(!(y===K.oids.md2||y===K.oids.md5||y===K.oids.sha1||y===K.oids.sha224||y===K.oids.sha256||y===K.oids.sha384||y===K.oids.sha512||y===K.oids["sha512-224"]||y===K.oids["sha512-256"])){var m=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw m.oid=y,m}if((y===K.oids.md2||y===K.oids.md5)&&!("parameters"in c))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifier NULL parameters.");return f===c.digest}}:(s==="NONE"||s==="NULL"||s===null)&&(s={verify:function(f,u){return u=Jr(u,a,!0,void 0,n),f===u}});var o=H.rsa.decrypt(i,a,!0,!1);return s.verify(r,o,a.n.bitLength())},a};H.setRsaPrivateKey=H.rsa.setPrivateKey=function(e,t,a,r,i,s,n,o){var f={n:e,e:t,d:a,p:r,q:i,dP:s,dQ:n,qInv:o};return f.decrypt=function(u,l,c){typeof l=="string"?l=l.toUpperCase():l===void 0&&(l="RSAES-PKCS1-V1_5");var g=H.rsa.decrypt(u,f,!1,!1);if(l==="RSAES-PKCS1-V1_5")l={decode:Jr};else if(l==="RSA-OAEP"||l==="RSAES-OAEP")l={decode:function(m,y){return K.pkcs1.decode_rsa_oaep(y,m,c)}};else if(["RAW","NONE","NULL",null].indexOf(l)!==-1)l={decode:function(m){return m}};else throw new Error('Unsupported encryption scheme: "'+l+'".');return l.decode(g,f,!1)},f.sign=function(u,l){var c=!1;typeof l=="string"&&(l=l.toUpperCase()),l===void 0||l==="RSASSA-PKCS1-V1_5"?(l={encode:qf},c=1):(l==="NONE"||l==="NULL"||l===null)&&(l={encode:function(){return u}},c=1);var g=l.encode(u,f.n.bitLength());return H.rsa.encrypt(g,f,c)},f};H.wrapRsaPrivateKey=function(e){return T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,T.integerToDer(0).getBytes()),T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.OID,!1,T.oidToDer(H.oids.rsaEncryption).getBytes()),T.create(T.Class.UNIVERSAL,T.Type.NULL,!1,"")]),T.create(T.Class.UNIVERSAL,T.Type.OCTETSTRING,!1,T.toDer(e).getBytes())])};H.privateKeyFromAsn1=function(e){var t={},a=[];if(T.validate(e,Pf,t,a)&&(e=T.fromDer(K.util.createBuffer(t.privateKey))),t={},a=[],!T.validate(e,Vf,t,a)){var r=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw r.errors=a,r}var i,s,n,o,f,u,l,c;return i=K.util.createBuffer(t.privateKeyModulus).toHex(),s=K.util.createBuffer(t.privateKeyPublicExponent).toHex(),n=K.util.createBuffer(t.privateKeyPrivateExponent).toHex(),o=K.util.createBuffer(t.privateKeyPrime1).toHex(),f=K.util.createBuffer(t.privateKeyPrime2).toHex(),u=K.util.createBuffer(t.privateKeyExponent1).toHex(),l=K.util.createBuffer(t.privateKeyExponent2).toHex(),c=K.util.createBuffer(t.privateKeyCoefficient).toHex(),H.setRsaPrivateKey(new ee(i,16),new ee(s,16),new ee(n,16),new ee(o,16),new ee(f,16),new ee(u,16),new ee(l,16),new ee(c,16))};H.privateKeyToAsn1=H.privateKeyToRSAPrivateKey=function(e){return T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,T.integerToDer(0).getBytes()),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.n)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.e)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.d)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.p)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.q)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.dP)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.dQ)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.qInv))])};H.publicKeyFromAsn1=function(e){var t={},a=[];if(T.validate(e,Ff,t,a)){var r=T.derToOid(t.publicKeyOid);if(r!==H.oids.rsaEncryption){var i=new Error("Cannot read public key. Unknown OID.");throw i.oid=r,i}e=t.rsaPublicKey}if(a=[],!T.validate(e,Of,t,a)){var i=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw i.errors=a,i}var s=K.util.createBuffer(t.publicKeyModulus).toHex(),n=K.util.createBuffer(t.publicKeyExponent).toHex();return H.setRsaPublicKey(new ee(s,16),new ee(n,16))};H.publicKeyToAsn1=H.publicKeyToSubjectPublicKeyInfo=function(e){return T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.OID,!1,T.oidToDer(H.oids.rsaEncryption).getBytes()),T.create(T.Class.UNIVERSAL,T.Type.NULL,!1,"")]),T.create(T.Class.UNIVERSAL,T.Type.BITSTRING,!1,[H.publicKeyToRSAPublicKey(e)])])};H.publicKeyToRSAPublicKey=function(e){return T.create(T.Class.UNIVERSAL,T.Type.SEQUENCE,!0,[T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.n)),T.create(T.Class.UNIVERSAL,T.Type.INTEGER,!1,vt(e.e))])};function Ss(e,t,a){var r=K.util.createBuffer(),i=Math.ceil(t.n.bitLength()/8);if(e.length>i-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=i-11,s}r.putByte(0),r.putByte(a);var n=i-3-e.length,o;if(a===0||a===1){o=a===0?0:255;for(var f=0;f<n;++f)r.putByte(o)}else for(;n>0;){for(var u=0,l=K.random.getBytes(n),f=0;f<n;++f)o=l.charCodeAt(f),o===0?++u:r.putByte(o);n=u}return r.putByte(0),r.putBytes(e),r}function Jr(e,t,a,r,i){var s=Math.ceil(t.n.bitLength()/8),n=K.util.createBuffer(e),o=n.getByte(),f=n.getByte();if(o!==0||a&&f!==0&&f!==1||!a&&f!==2||a&&f===0&&typeof r>"u")throw new Error("Encryption block is invalid.");var u=0;if(f===0){u=s-3-r;for(var l=0;l<u;++l)if(n.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(f===1){for(u=0;n.length()>1;){if(n.getByte()!==255){--n.read;break}++u}if(u<8&&!(i&&i._skipPaddingChecks))throw new Error("Encryption block is invalid.")}else if(f===2){for(u=0;n.length()>1;){if(n.getByte()===0){--n.read;break}++u}if(u<8&&!(i&&i._skipPaddingChecks))throw new Error("Encryption block is invalid.")}var c=n.getByte();if(c!==0||u!==s-3-n.length())throw new Error("Encryption block is invalid.");return n.getBytes()}function Mf(e,t,a){typeof t=="function"&&(a=t,t={}),t=t||{};var r={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};"prng"in t&&(r.prng=t.prng),i();function i(){s(e.pBits,function(o,f){if(o)return a(o);if(e.p=f,e.q!==null)return n(o,e.q);s(e.qBits,n)})}function s(o,f){K.prime.generateProbablePrime(o,r,f)}function n(o,f){if(o)return a(o);if(e.q=f,e.p.compareTo(e.q)<0){var u=e.p;e.p=e.q,e.q=u}if(e.p.subtract(ee.ONE).gcd(e.e).compareTo(ee.ONE)!==0){e.p=null,i();return}if(e.q.subtract(ee.ONE).gcd(e.e).compareTo(ee.ONE)!==0){e.q=null,s(e.qBits,n);return}if(e.p1=e.p.subtract(ee.ONE),e.q1=e.q.subtract(ee.ONE),e.phi=e.p1.multiply(e.q1),e.phi.gcd(e.e).compareTo(ee.ONE)!==0){e.p=e.q=null,i();return}if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits){e.q=null,s(e.qBits,n);return}var l=e.e.modInverse(e.phi);e.keys={privateKey:H.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:H.rsa.setPublicKey(e.n,e.e)},a(null,e.keys)}}function vt(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var a=K.util.hexToBytes(t);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 Hf(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function vs(e){return K.util.isNodejs&&typeof Za[e]=="function"}function ms(e){return typeof rt.globalScope<"u"&&typeof rt.globalScope.crypto=="object"&&typeof rt.globalScope.crypto.subtle=="object"&&typeof rt.globalScope.crypto.subtle[e]=="function"}function Cs(e){return typeof rt.globalScope<"u"&&typeof rt.globalScope.msCrypto=="object"&&typeof rt.globalScope.msCrypto.subtle=="object"&&typeof rt.globalScope.msCrypto.subtle[e]=="function"}function xs(e){for(var t=K.util.hexToBytes(e.toString(16)),a=new Uint8Array(t.length),r=0;r<t.length;++r)a[r]=t.charCodeAt(r);return a}});var ei=j((dd,_s)=>{var O=Q();Rt();ut();Cr();lt();Lt();Qr();Ht();et();ja();Sr();re();typeof As>"u"&&(As=O.jsbn.BigInteger);var As,I=O.asn1,z=O.pki=O.pki||{};_s.exports=z.pbe=O.pbe=O.pbe||{};var zt=z.oids,Gf={name:"EncryptedPrivateKeyInfo",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:I.Class.UNIVERSAL,type:I.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},jf={name:"PBES2Algorithms",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:I.Class.UNIVERSAL,type:I.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:I.Class.UNIVERSAL,type:I.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:I.Class.UNIVERSAL,type:I.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:I.Class.UNIVERSAL,type:I.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},zf={name:"pkcs-12PbeParams",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:I.Class.UNIVERSAL,type:I.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:I.Class.UNIVERSAL,type:I.Type.INTEGER,constructed:!1,capture:"iterations"}]};z.encryptPrivateKeyInfo=function(e,t,a){a=a||{},a.saltSize=a.saltSize||8,a.count=a.count||2048,a.algorithm=a.algorithm||"aes128",a.prfAlgorithm=a.prfAlgorithm||"sha1";var r=O.random.getBytesSync(a.saltSize),i=a.count,s=I.integerToDer(i),n,o,f;if(a.algorithm.indexOf("aes")===0||a.algorithm==="des"){var u,l,c;switch(a.algorithm){case"aes128":n=16,u=16,l=zt["aes128-CBC"],c=O.aes.createEncryptionCipher;break;case"aes192":n=24,u=16,l=zt["aes192-CBC"],c=O.aes.createEncryptionCipher;break;case"aes256":n=32,u=16,l=zt["aes256-CBC"],c=O.aes.createEncryptionCipher;break;case"des":n=8,u=8,l=zt.desCBC,c=O.des.createEncryptionCipher;break;default:var g=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw g.algorithm=a.algorithm,g}var m="hmacWith"+a.prfAlgorithm.toUpperCase(),y=bs(m),E=O.pkcs5.pbkdf2(t,r,i,n,y),S=O.random.getBytesSync(u),A=c(E);A.start(S),A.update(I.toDer(e)),A.finish(),f=A.output.getBytes();var B=Qf(r,s,n,m);o=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(zt.pkcs5PBES2).getBytes()),I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(zt.pkcs5PBKDF2).getBytes()),B]),I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(l).getBytes()),I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,S)])])])}else if(a.algorithm==="3des"){n=24;var b=new O.util.ByteBuffer(r),E=z.pbe.generatePkcs12Key(t,b,1,i,n),S=z.pbe.generatePkcs12Key(t,b,2,i,n),A=O.des.createEncryptionCipher(E);A.start(S),A.update(I.toDer(e)),A.finish(),f=A.output.getBytes(),o=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(zt["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,r),I.create(I.Class.UNIVERSAL,I.Type.INTEGER,!1,s.getBytes())])])}else{var g=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw g.algorithm=a.algorithm,g}var V=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[o,I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,f)]);return V};z.decryptPrivateKeyInfo=function(e,t){var a=null,r={},i=[];if(!I.validate(e,Gf,r,i)){var s=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=i,s}var n=I.derToOid(r.encryptionOid),o=z.pbe.getCipher(n,r.encryptionParams,t),f=O.util.createBuffer(r.encryptedData);return o.update(f),o.finish()&&(a=I.fromDer(o.output)),a};z.encryptedPrivateKeyToPem=function(e,t){var a={type:"ENCRYPTED PRIVATE KEY",body:I.toDer(e).getBytes()};return O.pem.encode(a,{maxline:t})};z.encryptedPrivateKeyFromPem=function(e){var t=O.pem.decode(e)[0];if(t.type!=="ENCRYPTED PRIVATE KEY"){var a=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return I.fromDer(t.body)};z.encryptRsaPrivateKey=function(e,t,a){if(a=a||{},!a.legacy){var r=z.wrapRsaPrivateKey(z.privateKeyToAsn1(e));return r=z.encryptPrivateKeyInfo(r,t,a),z.encryptedPrivateKeyToPem(r)}var i,s,n,o;switch(a.algorithm){case"aes128":i="AES-128-CBC",n=16,s=O.random.getBytesSync(16),o=O.aes.createEncryptionCipher;break;case"aes192":i="AES-192-CBC",n=24,s=O.random.getBytesSync(16),o=O.aes.createEncryptionCipher;break;case"aes256":i="AES-256-CBC",n=32,s=O.random.getBytesSync(16),o=O.aes.createEncryptionCipher;break;case"3des":i="DES-EDE3-CBC",n=24,s=O.random.getBytesSync(8),o=O.des.createEncryptionCipher;break;case"des":i="DES-CBC",n=8,s=O.random.getBytesSync(8),o=O.des.createEncryptionCipher;break;default:var f=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+a.algorithm+'".');throw f.algorithm=a.algorithm,f}var u=O.pbe.opensslDeriveBytes(t,s.substr(0,8),n),l=o(u);l.start(s),l.update(I.toDer(z.privateKeyToAsn1(e))),l.finish();var c={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:i,parameters:O.util.bytesToHex(s).toUpperCase()},body:l.output.getBytes()};return O.pem.encode(c)};z.decryptRsaPrivateKey=function(e,t){var a=null,r=O.pem.decode(e)[0];if(r.type!=="ENCRYPTED PRIVATE KEY"&&r.type!=="PRIVATE KEY"&&r.type!=="RSA PRIVATE KEY"){var i=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw i.headerType=i,i}if(r.procType&&r.procType.type==="ENCRYPTED"){var s,n;switch(r.dekInfo.algorithm){case"DES-CBC":s=8,n=O.des.createDecryptionCipher;break;case"DES-EDE3-CBC":s=24,n=O.des.createDecryptionCipher;break;case"AES-128-CBC":s=16,n=O.aes.createDecryptionCipher;break;case"AES-192-CBC":s=24,n=O.aes.createDecryptionCipher;break;case"AES-256-CBC":s=32,n=O.aes.createDecryptionCipher;break;case"RC2-40-CBC":s=5,n=function(c){return O.rc2.createDecryptionCipher(c,40)};break;case"RC2-64-CBC":s=8,n=function(c){return O.rc2.createDecryptionCipher(c,64)};break;case"RC2-128-CBC":s=16,n=function(c){return O.rc2.createDecryptionCipher(c,128)};break;default:var i=new Error('Could not decrypt private key; unsupported encryption algorithm "'+r.dekInfo.algorithm+'".');throw i.algorithm=r.dekInfo.algorithm,i}var o=O.util.hexToBytes(r.dekInfo.parameters),f=O.pbe.opensslDeriveBytes(t,o.substr(0,8),s),u=n(f);if(u.start(o),u.update(O.util.createBuffer(r.body)),u.finish())a=u.output.getBytes();else return a}else a=r.body;return r.type==="ENCRYPTED PRIVATE KEY"?a=z.decryptPrivateKeyInfo(I.fromDer(a),t):a=I.fromDer(a),a!==null&&(a=z.privateKeyFromAsn1(a)),a};z.pbe.generatePkcs12Key=function(e,t,a,r,i,s){var n,o;if(typeof s>"u"||s===null){if(!("sha1"in O.md))throw new Error('"sha1" hash algorithm unavailable.');s=O.md.sha1.create()}var f=s.digestLength,u=s.blockLength,l=new O.util.ByteBuffer,c=new O.util.ByteBuffer;if(e!=null){for(o=0;o<e.length;o++)c.putInt16(e.charCodeAt(o));c.putInt16(0)}var g=c.length(),m=t.length(),y=new O.util.ByteBuffer;y.fillWithByte(a,u);var E=u*Math.ceil(m/u),S=new O.util.ByteBuffer;for(o=0;o<E;o++)S.putByte(t.at(o%m));var A=u*Math.ceil(g/u),B=new O.util.ByteBuffer;for(o=0;o<A;o++)B.putByte(c.at(o%g));var b=S;b.putBuffer(B);for(var V=Math.ceil(i/f),k=1;k<=V;k++){var R=new O.util.ByteBuffer;R.putBytes(y.bytes()),R.putBytes(b.bytes());for(var G=0;G<r;G++)s.start(),s.update(R.getBytes()),R=s.digest();var Y=new O.util.ByteBuffer;for(o=0;o<u;o++)Y.putByte(R.at(o%f));var ie=Math.ceil(m/u)+Math.ceil(g/u),ne=new O.util.ByteBuffer;for(n=0;n<ie;n++){var ue=new O.util.ByteBuffer(b.getBytes(u)),ce=511;for(o=Y.length()-1;o>=0;o--)ce=ce>>8,ce+=Y.at(o)+ue.at(o),ue.setAt(o,ce&255);ne.putBuffer(ue)}b=ne,l.putBuffer(R)}return l.truncate(l.length()-i),l};z.pbe.getCipher=function(e,t,a){switch(e){case z.oids.pkcs5PBES2:return z.pbe.getCipherForPBES2(e,t,a);case z.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case z.oids["pbewithSHAAnd40BitRC2-CBC"]:return z.pbe.getCipherForPKCS12PBE(e,t,a);default:var r=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw r.oid=e,r.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],r}};z.pbe.getCipherForPBES2=function(e,t,a){var r={},i=[];if(!I.validate(t,jf,r,i)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=i,s}if(e=I.derToOid(r.kdfOid),e!==z.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=I.derToOid(r.encOid),e!==z.oids["aes128-CBC"]&&e!==z.oids["aes192-CBC"]&&e!==z.oids["aes256-CBC"]&&e!==z.oids["des-EDE3-CBC"]&&e!==z.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 n=r.kdfSalt,o=O.util.createBuffer(r.kdfIterationCount);o=o.getInt(o.length()<<3);var f,u;switch(z.oids[e]){case"aes128-CBC":f=16,u=O.aes.createDecryptionCipher;break;case"aes192-CBC":f=24,u=O.aes.createDecryptionCipher;break;case"aes256-CBC":f=32,u=O.aes.createDecryptionCipher;break;case"des-EDE3-CBC":f=24,u=O.des.createDecryptionCipher;break;case"desCBC":f=8,u=O.des.createDecryptionCipher;break}var l=Bs(r.prfOid),c=O.pkcs5.pbkdf2(a,n,o,f,l),g=r.encIv,m=u(c);return m.start(g),m};z.pbe.getCipherForPKCS12PBE=function(e,t,a){var r={},i=[];if(!I.validate(t,zf,r,i)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=i,s}var n=O.util.createBuffer(r.salt),o=O.util.createBuffer(r.iterations);o=o.getInt(o.length()<<3);var f,u,l;switch(e){case z.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:f=24,u=8,l=O.des.startDecrypting;break;case z.oids["pbewithSHAAnd40BitRC2-CBC"]:f=5,u=8,l=function(E,S){var A=O.rc2.createDecryptionCipher(E,40);return A.start(S,null),A};break;default:var s=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw s.oid=e,s}var c=Bs(r.prfOid),g=z.pbe.generatePkcs12Key(a,n,1,o,f,c);c.start();var m=z.pbe.generatePkcs12Key(a,n,2,o,u,c);return l(g,m)};z.pbe.opensslDeriveBytes=function(e,t,a,r){if(typeof r>"u"||r===null){if(!("md5"in O.md))throw new Error('"md5" hash algorithm unavailable.');r=O.md.md5.create()}t===null&&(t="");for(var i=[Is(r,e+t)],s=16,n=1;s<a;++n,s+=16)i.push(Is(r,i[n-1]+e+t));return i.join("").substr(0,a)};function Is(e,t){return e.start().update(t).digest().getBytes()}function Bs(e){var t;if(!e)t="hmacWithSHA1";else if(t=z.oids[I.derToOid(e)],!t){var a=new Error("Unsupported PRF OID.");throw a.oid=e,a.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],a}return bs(t)}function bs(e){var t=O.md;switch(e){case"hmacWithSHA224":t=O.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var a=new Error("Unsupported PRF algorithm.");throw a.algorithm=e,a.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],a}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}function Qf(e,t,a,r){var i=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,e),I.create(I.Class.UNIVERSAL,I.Type.INTEGER,!1,t.getBytes())]);return r!=="hmacWithSHA1"&&i.value.push(I.create(I.Class.UNIVERSAL,I.Type.INTEGER,!1,O.util.hexToBytes(a.toString(16))),I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(z.oids[r]).getBytes()),I.create(I.Class.UNIVERSAL,I.Type.NULL,!1,"")])),i}});var ti=j((pd,Rs)=>{var or=Q();ut();re();var P=or.asn1,ur=Rs.exports=or.pkcs7asn1=or.pkcs7asn1||{};or.pkcs7=or.pkcs7||{};or.pkcs7.asn1=ur;var Ns={name:"ContentInfo",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:P.Class.UNIVERSAL,type:P.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:P.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};ur.contentInfoValidator=Ns;var ws={name:"EncryptedContentInfo",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:P.Class.UNIVERSAL,type:P.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:P.Class.UNIVERSAL,type:P.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:P.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:P.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};ur.envelopedDataValidator={name:"EnvelopedData",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:P.Class.UNIVERSAL,type:P.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:P.Class.UNIVERSAL,type:P.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(ws)};ur.encryptedDataValidator={name:"EncryptedData",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:P.Class.UNIVERSAL,type:P.Type.INTEGER,constructed:!1,capture:"version"}].concat(ws)};var Yf={name:"SignerInfo",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:P.Class.UNIVERSAL,type:P.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:P.Class.UNIVERSAL,type:P.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:P.Class.UNIVERSAL,type:P.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:P.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:P.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:P.Class.UNIVERSAL,type:P.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:P.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};ur.signedDataValidator={name:"SignedData",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:P.Class.UNIVERSAL,type:P.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:P.Class.UNIVERSAL,type:P.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},Ns,{name:"SignedData.Certificates",tagClass:P.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:P.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:P.Class.UNIVERSAL,type:P.Type.SET,capture:"signerInfos",optional:!0,value:[Yf]}]};ur.recipientInfoValidator={name:"RecipientInfo",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:P.Class.UNIVERSAL,type:P.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:P.Class.UNIVERSAL,type:P.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:P.Class.UNIVERSAL,type:P.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:P.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:P.Class.UNIVERSAL,type:P.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}});var ri=j((hd,Ls)=>{var Qt=Q();re();Qt.mgf=Qt.mgf||{};var Wf=Ls.exports=Qt.mgf.mgf1=Qt.mgf1=Qt.mgf1||{};Wf.create=function(e){var t={generate:function(a,r){for(var i=new Qt.util.ByteBuffer,s=Math.ceil(r/e.digestLength),n=0;n<s;n++){var o=new Qt.util.ByteBuffer;o.putInt32(n),e.start(),e.update(a+o.getBytes()),i.putBuffer(e.digest())}return i.truncate(i.length()-r),i.getBytes()}};return t}});var Ds=j((gd,ks)=>{var Zr=Q();ri();ks.exports=Zr.mgf=Zr.mgf||{};Zr.mgf.mgf1=Zr.mgf1});var ea=j((yd,Us)=>{var Yt=Q();et();re();var Xf=Us.exports=Yt.pss=Yt.pss||{};Xf.create=function(e){arguments.length===3&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t=e.md,a=e.mgf,r=t.digestLength,i=e.salt||null;typeof i=="string"&&(i=Yt.util.createBuffer(i));var s;if("saltLength"in e)s=e.saltLength;else if(i!==null)s=i.length();else throw new Error("Salt length not specified or specific salt not given.");if(i!==null&&i.length()!==s)throw new Error("Given salt length does not match length of given salt.");var n=e.prng||Yt.random,o={};return o.encode=function(f,u){var l,c=u-1,g=Math.ceil(c/8),m=f.digest().getBytes();if(g<r+s+2)throw new Error("Message is too long to encrypt.");var y;i===null?y=n.getBytesSync(s):y=i.bytes();var E=new Yt.util.ByteBuffer;E.fillWithByte(0,8),E.putBytes(m),E.putBytes(y),t.start(),t.update(E.getBytes());var S=t.digest().getBytes(),A=new Yt.util.ByteBuffer;A.fillWithByte(0,g-s-r-2),A.putByte(1),A.putBytes(y);var B=A.getBytes(),b=g-r-1,V=a.generate(S,b),k="";for(l=0;l<b;l++)k+=String.fromCharCode(B.charCodeAt(l)^V.charCodeAt(l));var R=65280>>8*g-c&255;return k=String.fromCharCode(k.charCodeAt(0)&~R)+k.substr(1),k+S+"\xBC"},o.verify=function(f,u,l){var c,g=l-1,m=Math.ceil(g/8);if(u=u.substr(-m),m<r+s+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(u.charCodeAt(m-1)!==188)throw new Error("Encoded message does not end in 0xBC.");var y=m-r-1,E=u.substr(0,y),S=u.substr(y,r),A=65280>>8*m-g&255;if((E.charCodeAt(0)&A)!==0)throw new Error("Bits beyond keysize not zero as expected.");var B=a.generate(S,y),b="";for(c=0;c<y;c++)b+=String.fromCharCode(E.charCodeAt(c)^B.charCodeAt(c));b=String.fromCharCode(b.charCodeAt(0)&~A)+b.substr(1);var V=m-r-s-2;for(c=0;c<V;c++)if(b.charCodeAt(c)!==0)throw new Error("Leftmost octets not zero as expected");if(b.charCodeAt(V)!==1)throw new Error("Inconsistent PSS signature, 0x01 marker not found");var k=b.substr(-s),R=new Yt.util.ByteBuffer;R.fillWithByte(0,8),R.putBytes(f),R.putBytes(k),t.start(),t.update(R.getBytes());var G=t.digest().getBytes();return S===G},o}});var aa=j((vd,Ks)=>{var q=Q();Rt();ut();Cr();lt();Ds();Lt();Ht();ea();Sr();re();var d=q.asn1,L=Ks.exports=q.pki=q.pki||{},te=L.oids,ge={};ge.CN=te.commonName;ge.commonName="CN";ge.C=te.countryName;ge.countryName="C";ge.L=te.localityName;ge.localityName="L";ge.ST=te.stateOrProvinceName;ge.stateOrProvinceName="ST";ge.O=te.organizationName;ge.organizationName="O";ge.OU=te.organizationalUnitName;ge.organizationalUnitName="OU";ge.E=te.emailAddress;ge.emailAddress="E";var Vs=q.pki.rsa.publicKeyValidator,$f={name:"Certificate",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:d.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:d.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:d.Class.UNIVERSAL,type:d.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:d.Class.UNIVERSAL,type:d.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:d.Class.UNIVERSAL,type:d.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:d.Class.UNIVERSAL,type:d.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},Vs,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:d.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:d.Class.UNIVERSAL,type:d.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:d.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:d.Class.UNIVERSAL,type:d.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:d.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:d.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:d.Class.UNIVERSAL,type:d.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},Jf={name:"rsapss",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:d.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:d.Class.UNIVERSAL,type:d.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:d.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:d.Class.UNIVERSAL,type:d.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:d.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:d.Class.UNIVERSAL,type:d.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:d.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:d.Class.UNIVERSAL,type:d.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},Zf={name:"CertificationRequestInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},Vs,{name:"CertificationRequestInfo.attributes",tagClass:d.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:d.Class.UNIVERSAL,type:d.Type.SET,constructed:!0}]}]}]},el={name:"CertificationRequest",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[Zf,{name:"CertificationRequest.signatureAlgorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:d.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:d.Class.UNIVERSAL,type:d.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};L.RDNAttributesAsArray=function(e,t){for(var a=[],r,i,s,n=0;n<e.value.length;++n){r=e.value[n];for(var o=0;o<r.value.length;++o)s={},i=r.value[o],s.type=d.derToOid(i.value[0].value),s.value=i.value[1].value,s.valueTagClass=i.value[1].type,s.type in te&&(s.name=te[s.type],s.name in ge&&(s.shortName=ge[s.name])),t&&(t.update(s.type),t.update(s.value)),a.push(s)}return a};L.CRIAttributesAsArray=function(e){for(var t=[],a=0;a<e.length;++a)for(var r=e[a],i=d.derToOid(r.value[0].value),s=r.value[1].value,n=0;n<s.length;++n){var o={};if(o.type=i,o.value=s[n].value,o.valueTagClass=s[n].type,o.type in te&&(o.name=te[o.type],o.name in ge&&(o.shortName=ge[o.name])),o.type===te.extensionRequest){o.extensions=[];for(var f=0;f<o.value.length;++f)o.extensions.push(L.certificateExtensionFromAsn1(o.value[f]))}t.push(o)}return t};function Ut(e,t){typeof t=="string"&&(t={shortName:t});for(var a=null,r,i=0;a===null&&i<e.attributes.length;++i)r=e.attributes[i],(t.type&&t.type===r.type||t.name&&t.name===r.name||t.shortName&&t.shortName===r.shortName)&&(a=r);return a}var ta=function(e,t,a){var r={};if(e!==te["RSASSA-PSS"])return r;a&&(r={hash:{algorithmOid:te.sha1},mgf:{algorithmOid:te.mgf1,hash:{algorithmOid:te.sha1}},saltLength:20});var i={},s=[];if(!d.validate(t,Jf,i,s)){var n=new Error("Cannot read RSASSA-PSS parameter block.");throw n.errors=s,n}return i.hashOid!==void 0&&(r.hash=r.hash||{},r.hash.algorithmOid=d.derToOid(i.hashOid)),i.maskGenOid!==void 0&&(r.mgf=r.mgf||{},r.mgf.algorithmOid=d.derToOid(i.maskGenOid),r.mgf.hash=r.mgf.hash||{},r.mgf.hash.algorithmOid=d.derToOid(i.maskGenHashOid)),i.saltLength!==void 0&&(r.saltLength=i.saltLength.charCodeAt(0)),r},ra=function(e){switch(te[e.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return q.md.sha1.create();case"md5WithRSAEncryption":return q.md.md5.create();case"sha256WithRSAEncryption":return q.md.sha256.create();case"sha384WithRSAEncryption":return q.md.sha384.create();case"sha512WithRSAEncryption":return q.md.sha512.create();case"RSASSA-PSS":return q.md.sha256.create();default:var t=new Error("Could not compute "+e.type+" digest. Unknown signature OID.");throw t.signatureOid=e.signatureOid,t}},Os=function(e){var t=e.certificate,a;switch(t.signatureOid){case te.sha1WithRSAEncryption:case te.sha1WithRSASignature:break;case te["RSASSA-PSS"]:var r,i;if(r=te[t.signatureParameters.mgf.hash.algorithmOid],r===void 0||q.md[r]===void 0){var s=new Error("Unsupported MGF hash function.");throw s.oid=t.signatureParameters.mgf.hash.algorithmOid,s.name=r,s}if(i=te[t.signatureParameters.mgf.algorithmOid],i===void 0||q.mgf[i]===void 0){var s=new Error("Unsupported MGF function.");throw s.oid=t.signatureParameters.mgf.algorithmOid,s.name=i,s}if(i=q.mgf[i].create(q.md[r].create()),r=te[t.signatureParameters.hash.algorithmOid],r===void 0||q.md[r]===void 0){var s=new Error("Unsupported RSASSA-PSS hash function.");throw s.oid=t.signatureParameters.hash.algorithmOid,s.name=r,s}a=q.pss.create(q.md[r].create(),i,t.signatureParameters.saltLength);break}return t.publicKey.verify(e.md.digest().getBytes(),e.signature,a)};L.certificateFromPem=function(e,t,a){var r=q.pem.decode(e)[0];if(r.type!=="CERTIFICATE"&&r.type!=="X509 CERTIFICATE"&&r.type!=="TRUSTED CERTIFICATE"){var i=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw i.headerType=r.type,i}if(r.procType&&r.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var s=d.fromDer(r.body,a);return L.certificateFromAsn1(s,t)};L.certificateToPem=function(e,t){var a={type:"CERTIFICATE",body:d.toDer(L.certificateToAsn1(e)).getBytes()};return q.pem.encode(a,{maxline:t})};L.publicKeyFromPem=function(e){var t=q.pem.decode(e)[0];if(t.type!=="PUBLIC KEY"&&t.type!=="RSA PUBLIC KEY"){var a=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert public key from PEM; PEM is encrypted.");var r=d.fromDer(t.body);return L.publicKeyFromAsn1(r)};L.publicKeyToPem=function(e,t){var a={type:"PUBLIC KEY",body:d.toDer(L.publicKeyToAsn1(e)).getBytes()};return q.pem.encode(a,{maxline:t})};L.publicKeyToRSAPublicKeyPem=function(e,t){var a={type:"RSA PUBLIC KEY",body:d.toDer(L.publicKeyToRSAPublicKey(e)).getBytes()};return q.pem.encode(a,{maxline:t})};L.getPublicKeyFingerprint=function(e,t){t=t||{};var a=t.md||q.md.sha1.create(),r=t.type||"RSAPublicKey",i;switch(r){case"RSAPublicKey":i=d.toDer(L.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":i=d.toDer(L.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+t.type+'".')}a.start(),a.update(i);var s=a.digest();if(t.encoding==="hex"){var n=s.toHex();return t.delimiter?n.match(/.{2}/g).join(t.delimiter):n}else{if(t.encoding==="binary")return s.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".')}return s};L.certificationRequestFromPem=function(e,t,a){var r=q.pem.decode(e)[0];if(r.type!=="CERTIFICATE REQUEST"){var i=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw i.headerType=r.type,i}if(r.procType&&r.procType.type==="ENCRYPTED")throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var s=d.fromDer(r.body,a);return L.certificationRequestFromAsn1(s,t)};L.certificationRequestToPem=function(e,t){var a={type:"CERTIFICATE REQUEST",body:d.toDer(L.certificationRequestToAsn1(e)).getBytes()};return q.pem.encode(a,{maxline:t})};L.createCertificate=function(){var e={};return e.version=2,e.serialNumber="00",e.signatureOid=null,e.signature=null,e.siginfo={},e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return Ut(e.issuer,t)},e.issuer.addField=function(t){at([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return Ut(e.subject,t)},e.subject.addField=function(t){at([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,a){at(t),e.subject.attributes=t,delete e.subject.uniqueId,a&&(e.subject.uniqueId=a),e.subject.hash=null},e.setIssuer=function(t,a){at(t),e.issuer.attributes=t,delete e.issuer.uniqueId,a&&(e.issuer.uniqueId=a),e.issuer.hash=null},e.setExtensions=function(t){for(var a=0;a<t.length;++a)Fs(t[a],{cert:e});e.extensions=t},e.getExtension=function(t){typeof t=="string"&&(t={name:t});for(var a=null,r,i=0;a===null&&i<e.extensions.length;++i)r=e.extensions[i],(t.id&&r.id===t.id||t.name&&r.name===t.name)&&(a=r);return a},e.sign=function(t,a){e.md=a||q.md.sha1.create();var r=te[e.md.algorithm+"WithRSAEncryption"];if(!r){var i=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw i.algorithm=e.md.algorithm,i}e.signatureOid=e.siginfo.algorithmOid=r,e.tbsCertificate=L.getTBSCertificate(e);var s=d.toDer(e.tbsCertificate);e.md.update(s.getBytes()),e.signature=t.sign(e.md)},e.verify=function(t){var a=!1;if(!e.issued(t)){var r=t.issuer,i=e.subject,s=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 s.expectedIssuer=i.attributes,s.actualIssuer=r.attributes,s}var n=t.md;if(n===null){n=ra({signatureOid:t.signatureOid,type:"certificate"});var o=t.tbsCertificate||L.getTBSCertificate(t),f=d.toDer(o);n.update(f.getBytes())}return n!==null&&(a=Os({certificate:e,md:n,signature:t.signature})),a},e.isIssuer=function(t){var a=!1,r=e.issuer,i=t.subject;if(r.hash&&i.hash)a=r.hash===i.hash;else if(r.attributes.length===i.attributes.length){a=!0;for(var s,n,o=0;a&&o<r.attributes.length;++o)s=r.attributes[o],n=i.attributes[o],(s.type!==n.type||s.value!==n.value)&&(a=!1)}return a},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return L.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=te.subjectKeyIdentifier,a=0;a<e.extensions.length;++a){var r=e.extensions[a];if(r.id===t){var i=e.generateSubjectKeyIdentifier().getBytes();return q.util.hexToBytes(r.subjectKeyIdentifier)===i}}return!1},e};L.certificateFromAsn1=function(e,t){var a={},r=[];if(!d.validate(e,$f,a,r)){var i=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw i.errors=r,i}var s=d.derToOid(a.publicKeyOid);if(s!==L.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var n=L.createCertificate();n.version=a.certVersion?a.certVersion.charCodeAt(0):0;var o=q.util.createBuffer(a.certSerialNumber);n.serialNumber=o.toHex(),n.signatureOid=q.asn1.derToOid(a.certSignatureOid),n.signatureParameters=ta(n.signatureOid,a.certSignatureParams,!0),n.siginfo.algorithmOid=q.asn1.derToOid(a.certinfoSignatureOid),n.siginfo.parameters=ta(n.siginfo.algorithmOid,a.certinfoSignatureParams,!1),n.signature=a.certSignature;var f=[];if(a.certValidity1UTCTime!==void 0&&f.push(d.utcTimeToDate(a.certValidity1UTCTime)),a.certValidity2GeneralizedTime!==void 0&&f.push(d.generalizedTimeToDate(a.certValidity2GeneralizedTime)),a.certValidity3UTCTime!==void 0&&f.push(d.utcTimeToDate(a.certValidity3UTCTime)),a.certValidity4GeneralizedTime!==void 0&&f.push(d.generalizedTimeToDate(a.certValidity4GeneralizedTime)),f.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(f.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(n.validity.notBefore=f[0],n.validity.notAfter=f[1],n.tbsCertificate=a.tbsCertificate,t){n.md=ra({signatureOid:n.signatureOid,type:"certificate"});var u=d.toDer(n.tbsCertificate);n.md.update(u.getBytes())}var l=q.md.sha1.create(),c=d.toDer(a.certIssuer);l.update(c.getBytes()),n.issuer.getField=function(y){return Ut(n.issuer,y)},n.issuer.addField=function(y){at([y]),n.issuer.attributes.push(y)},n.issuer.attributes=L.RDNAttributesAsArray(a.certIssuer),a.certIssuerUniqueId&&(n.issuer.uniqueId=a.certIssuerUniqueId),n.issuer.hash=l.digest().toHex();var g=q.md.sha1.create(),m=d.toDer(a.certSubject);return g.update(m.getBytes()),n.subject.getField=function(y){return Ut(n.subject,y)},n.subject.addField=function(y){at([y]),n.subject.attributes.push(y)},n.subject.attributes=L.RDNAttributesAsArray(a.certSubject),a.certSubjectUniqueId&&(n.subject.uniqueId=a.certSubjectUniqueId),n.subject.hash=g.digest().toHex(),a.certExtensions?n.extensions=L.certificateExtensionsFromAsn1(a.certExtensions):n.extensions=[],n.publicKey=L.publicKeyFromAsn1(a.subjectPublicKeyInfo),n};L.certificateExtensionsFromAsn1=function(e){for(var t=[],a=0;a<e.value.length;++a)for(var r=e.value[a],i=0;i<r.value.length;++i)t.push(L.certificateExtensionFromAsn1(r.value[i]));return t};L.certificateExtensionFromAsn1=function(e){var t={};if(t.id=d.derToOid(e.value[0].value),t.critical=!1,e.value[1].type===d.Type.BOOLEAN?(t.critical=e.value[1].value.charCodeAt(0)!==0,t.value=e.value[2].value):t.value=e.value[1].value,t.id in te){if(t.name=te[t.id],t.name==="keyUsage"){var a=d.fromDer(t.value),r=0,i=0;a.value.length>1&&(r=a.value.charCodeAt(1),i=a.value.length>2?a.value.charCodeAt(2):0),t.digitalSignature=(r&128)===128,t.nonRepudiation=(r&64)===64,t.keyEncipherment=(r&32)===32,t.dataEncipherment=(r&16)===16,t.keyAgreement=(r&8)===8,t.keyCertSign=(r&4)===4,t.cRLSign=(r&2)===2,t.encipherOnly=(r&1)===1,t.decipherOnly=(i&128)===128}else if(t.name==="basicConstraints"){var a=d.fromDer(t.value);a.value.length>0&&a.value[0].type===d.Type.BOOLEAN?t.cA=a.value[0].value.charCodeAt(0)!==0:t.cA=!1;var s=null;a.value.length>0&&a.value[0].type===d.Type.INTEGER?s=a.value[0].value:a.value.length>1&&(s=a.value[1].value),s!==null&&(t.pathLenConstraint=d.derToInteger(s))}else if(t.name==="extKeyUsage")for(var a=d.fromDer(t.value),n=0;n<a.value.length;++n){var o=d.derToOid(a.value[n].value);o in te?t[te[o]]=!0:t[o]=!0}else if(t.name==="nsCertType"){var a=d.fromDer(t.value),r=0;a.value.length>1&&(r=a.value.charCodeAt(1)),t.client=(r&128)===128,t.server=(r&64)===64,t.email=(r&32)===32,t.objsign=(r&16)===16,t.reserved=(r&8)===8,t.sslCA=(r&4)===4,t.emailCA=(r&2)===2,t.objCA=(r&1)===1}else if(t.name==="subjectAltName"||t.name==="issuerAltName"){t.altNames=[];for(var f,a=d.fromDer(t.value),u=0;u<a.value.length;++u){f=a.value[u];var l={type:f.type,value:f.value};switch(t.altNames.push(l),f.type){case 1:case 2:case 6:break;case 7:l.ip=q.util.bytesToIP(f.value);break;case 8:l.oid=d.derToOid(f.value);break;default:}}}else if(t.name==="subjectKeyIdentifier"){var a=d.fromDer(t.value);t.subjectKeyIdentifier=q.util.bytesToHex(a.value)}}return t};L.certificationRequestFromAsn1=function(e,t){var a={},r=[];if(!d.validate(e,el,a,r)){var i=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw i.errors=r,i}var s=d.derToOid(a.publicKeyOid);if(s!==L.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var n=L.createCertificationRequest();if(n.version=a.csrVersion?a.csrVersion.charCodeAt(0):0,n.signatureOid=q.asn1.derToOid(a.csrSignatureOid),n.signatureParameters=ta(n.signatureOid,a.csrSignatureParams,!0),n.siginfo.algorithmOid=q.asn1.derToOid(a.csrSignatureOid),n.siginfo.parameters=ta(n.siginfo.algorithmOid,a.csrSignatureParams,!1),n.signature=a.csrSignature,n.certificationRequestInfo=a.certificationRequestInfo,t){n.md=ra({signatureOid:n.signatureOid,type:"certification request"});var o=d.toDer(n.certificationRequestInfo);n.md.update(o.getBytes())}var f=q.md.sha1.create();return n.subject.getField=function(u){return Ut(n.subject,u)},n.subject.addField=function(u){at([u]),n.subject.attributes.push(u)},n.subject.attributes=L.RDNAttributesAsArray(a.certificationRequestInfoSubject,f),n.subject.hash=f.digest().toHex(),n.publicKey=L.publicKeyFromAsn1(a.subjectPublicKeyInfo),n.getAttribute=function(u){return Ut(n,u)},n.addAttribute=function(u){at([u]),n.attributes.push(u)},n.attributes=L.CRIAttributesAsArray(a.certificationRequestInfoAttributes||[]),n};L.createCertificationRequest=function(){var e={};return e.version=0,e.signatureOid=null,e.signature=null,e.siginfo={},e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return Ut(e.subject,t)},e.subject.addField=function(t){at([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return Ut(e,t)},e.addAttribute=function(t){at([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){at(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){at(t),e.attributes=t},e.sign=function(t,a){e.md=a||q.md.sha1.create();var r=te[e.md.algorithm+"WithRSAEncryption"];if(!r){var i=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw i.algorithm=e.md.algorithm,i}e.signatureOid=e.siginfo.algorithmOid=r,e.certificationRequestInfo=L.getCertificationRequestInfo(e);var s=d.toDer(e.certificationRequestInfo);e.md.update(s.getBytes()),e.signature=t.sign(e.md)},e.verify=function(){var t=!1,a=e.md;if(a===null){a=ra({signatureOid:e.signatureOid,type:"certification request"});var r=e.certificationRequestInfo||L.getCertificationRequestInfo(e),i=d.toDer(r);a.update(i.getBytes())}return a!==null&&(t=Os({certificate:e,md:a,signature:e.signature})),t},e};function fr(e){for(var t=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]),a,r,i=e.attributes,s=0;s<i.length;++s){a=i[s];var n=a.value,o=d.Type.PRINTABLESTRING;"valueTagClass"in a&&(o=a.valueTagClass,o===d.Type.UTF8&&(n=q.util.encodeUtf8(n))),r=d.create(d.Class.UNIVERSAL,d.Type.SET,!0,[d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(a.type).getBytes()),d.create(d.Class.UNIVERSAL,o,!1,n)])]),t.value.push(r)}return t}function at(e){for(var t,a=0;a<e.length;++a){if(t=e[a],typeof t.name>"u"&&(t.type&&t.type in L.oids?t.name=L.oids[t.type]:t.shortName&&t.shortName in ge&&(t.name=L.oids[ge[t.shortName]])),typeof t.type>"u")if(t.name&&t.name in L.oids)t.type=L.oids[t.name];else{var r=new Error("Attribute type not specified.");throw r.attribute=t,r}if(typeof t.shortName>"u"&&t.name&&t.name in ge&&(t.shortName=ge[t.name]),t.type===te.extensionRequest&&(t.valueConstructed=!0,t.valueTagClass=d.Type.SEQUENCE,!t.value&&t.extensions)){t.value=[];for(var i=0;i<t.extensions.length;++i)t.value.push(L.certificateExtensionToAsn1(Fs(t.extensions[i])))}if(typeof t.value>"u"){var r=new Error("Attribute value not specified.");throw r.attribute=t,r}}}function Fs(e,t){if(t=t||{},typeof e.name>"u"&&e.id&&e.id in L.oids&&(e.name=L.oids[e.id]),typeof e.id>"u")if(e.name&&e.name in L.oids)e.id=L.oids[e.name];else{var a=new Error("Extension ID not specified.");throw a.extension=e,a}if(typeof e.value<"u")return e;if(e.name==="keyUsage"){var r=0,i=0,s=0;e.digitalSignature&&(i|=128,r=7),e.nonRepudiation&&(i|=64,r=6),e.keyEncipherment&&(i|=32,r=5),e.dataEncipherment&&(i|=16,r=4),e.keyAgreement&&(i|=8,r=3),e.keyCertSign&&(i|=4,r=2),e.cRLSign&&(i|=2,r=1),e.encipherOnly&&(i|=1,r=0),e.decipherOnly&&(s|=128,r=7);var n=String.fromCharCode(r);s!==0?n+=String.fromCharCode(i)+String.fromCharCode(s):i!==0&&(n+=String.fromCharCode(i)),e.value=d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,n)}else if(e.name==="basicConstraints")e.value=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(d.create(d.Class.UNIVERSAL,d.Type.BOOLEAN,!1,"\xFF")),"pathLenConstraint"in e&&e.value.value.push(d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(e.pathLenConstraint).getBytes()));else if(e.name==="extKeyUsage"){e.value=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);var o=e.value.value;for(var f in e)e[f]===!0&&(f in te?o.push(d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(te[f]).getBytes())):f.indexOf(".")!==-1&&o.push(d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(f).getBytes())))}else if(e.name==="nsCertType"){var r=0,i=0;e.client&&(i|=128,r=7),e.server&&(i|=64,r=6),e.email&&(i|=32,r=5),e.objsign&&(i|=16,r=4),e.reserved&&(i|=8,r=3),e.sslCA&&(i|=4,r=2),e.emailCA&&(i|=2,r=1),e.objCA&&(i|=1,r=0);var n=String.fromCharCode(r);i!==0&&(n+=String.fromCharCode(i)),e.value=d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,n)}else if(e.name==="subjectAltName"||e.name==="issuerAltName"){e.value=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);for(var u,l=0;l<e.altNames.length;++l){u=e.altNames[l];var n=u.value;if(u.type===7&&u.ip){if(n=q.util.bytesFromIP(u.ip),n===null){var a=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw a.extension=e,a}}else u.type===8&&(u.oid?n=d.oidToDer(d.oidToDer(u.oid)):n=d.oidToDer(n));e.value.value.push(d.create(d.Class.CONTEXT_SPECIFIC,u.type,!1,n))}}else if(e.name==="nsComment"&&t.cert){if(!/^[\x00-\x7F]*$/.test(e.comment)||e.comment.length<1||e.comment.length>128)throw new Error('Invalid "nsComment" content.');e.value=d.create(d.Class.UNIVERSAL,d.Type.IA5STRING,!1,e.comment)}else if(e.name==="subjectKeyIdentifier"&&t.cert){var c=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=c.toHex(),e.value=d.create(d.Class.UNIVERSAL,d.Type.OCTETSTRING,!1,c.getBytes())}else if(e.name==="authorityKeyIdentifier"&&t.cert){e.value=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);var o=e.value.value;if(e.keyIdentifier){var g=e.keyIdentifier===!0?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;o.push(d.create(d.Class.CONTEXT_SPECIFIC,0,!1,g))}if(e.authorityCertIssuer){var m=[d.create(d.Class.CONTEXT_SPECIFIC,4,!0,[fr(e.authorityCertIssuer===!0?t.cert.issuer:e.authorityCertIssuer)])];o.push(d.create(d.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var y=q.util.hexToBytes(e.serialNumber===!0?t.cert.serialNumber:e.serialNumber);o.push(d.create(d.Class.CONTEXT_SPECIFIC,2,!1,y))}}else if(e.name==="cRLDistributionPoints"){e.value=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);for(var o=e.value.value,E=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]),S=d.create(d.Class.CONTEXT_SPECIFIC,0,!0,[]),u,l=0;l<e.altNames.length;++l){u=e.altNames[l];var n=u.value;if(u.type===7&&u.ip){if(n=q.util.bytesFromIP(u.ip),n===null){var a=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw a.extension=e,a}}else u.type===8&&(u.oid?n=d.oidToDer(d.oidToDer(u.oid)):n=d.oidToDer(n));S.value.push(d.create(d.Class.CONTEXT_SPECIFIC,u.type,!1,n))}E.value.push(d.create(d.Class.CONTEXT_SPECIFIC,0,!0,[S])),o.push(E)}if(typeof e.value>"u"){var a=new Error("Extension value not specified.");throw a.extension=e,a}return e}function ai(e,t){if(e===te["RSASSA-PSS"]){var a=[];return t.hash.algorithmOid!==void 0&&a.push(d.create(d.Class.CONTEXT_SPECIFIC,0,!0,[d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(t.hash.algorithmOid).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,"")])])),t.mgf.algorithmOid!==void 0&&a.push(d.create(d.Class.CONTEXT_SPECIFIC,1,!0,[d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(t.mgf.algorithmOid).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(t.mgf.hash.algorithmOid).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,"")])])])),t.saltLength!==void 0&&a.push(d.create(d.Class.CONTEXT_SPECIFIC,2,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(t.saltLength).getBytes())])),d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,a)}else return d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,"")}function tl(e){var t=d.create(d.Class.CONTEXT_SPECIFIC,0,!0,[]);if(e.attributes.length===0)return t;for(var a=e.attributes,r=0;r<a.length;++r){var i=a[r],s=i.value,n=d.Type.UTF8;"valueTagClass"in i&&(n=i.valueTagClass),n===d.Type.UTF8&&(s=q.util.encodeUtf8(s));var o=!1;"valueConstructed"in i&&(o=i.valueConstructed);var f=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(i.type).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.SET,!0,[d.create(d.Class.UNIVERSAL,n,o,s)])]);t.value.push(f)}return t}var rl=new Date("1950-01-01T00:00:00Z"),al=new Date("2050-01-01T00:00:00Z");function Ps(e){return e>=rl&&e<al?d.create(d.Class.UNIVERSAL,d.Type.UTCTIME,!1,d.dateToUtcTime(e)):d.create(d.Class.UNIVERSAL,d.Type.GENERALIZEDTIME,!1,d.dateToGeneralizedTime(e))}L.getTBSCertificate=function(e){var t=Ps(e.validity.notBefore),a=Ps(e.validity.notAfter),r=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.CONTEXT_SPECIFIC,0,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(e.version).getBytes())]),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,q.util.hexToBytes(e.serialNumber)),d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(e.siginfo.algorithmOid).getBytes()),ai(e.siginfo.algorithmOid,e.siginfo.parameters)]),fr(e.issuer),d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[t,a]),fr(e.subject),L.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&r.value.push(d.create(d.Class.CONTEXT_SPECIFIC,1,!0,[d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,"\0"+e.issuer.uniqueId)])),e.subject.uniqueId&&r.value.push(d.create(d.Class.CONTEXT_SPECIFIC,2,!0,[d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,"\0"+e.subject.uniqueId)])),e.extensions.length>0&&r.value.push(L.certificateExtensionsToAsn1(e.extensions)),r};L.getCertificationRequestInfo=function(e){var t=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(e.version).getBytes()),fr(e.subject),L.publicKeyToAsn1(e.publicKey),tl(e)]);return t};L.distinguishedNameToAsn1=function(e){return fr(e)};L.certificateToAsn1=function(e){var t=e.tbsCertificate||L.getTBSCertificate(e);return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[t,d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(e.signatureOid).getBytes()),ai(e.signatureOid,e.signatureParameters)]),d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,"\0"+e.signature)])};L.certificateExtensionsToAsn1=function(e){var t=d.create(d.Class.CONTEXT_SPECIFIC,3,!0,[]),a=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);t.value.push(a);for(var r=0;r<e.length;++r)a.value.push(L.certificateExtensionToAsn1(e[r]));return t};L.certificateExtensionToAsn1=function(e){var t=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);t.value.push(d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(e.id).getBytes())),e.critical&&t.value.push(d.create(d.Class.UNIVERSAL,d.Type.BOOLEAN,!1,"\xFF"));var a=e.value;return typeof e.value!="string"&&(a=d.toDer(a).getBytes()),t.value.push(d.create(d.Class.UNIVERSAL,d.Type.OCTETSTRING,!1,a)),t};L.certificationRequestToAsn1=function(e){var t=e.certificationRequestInfo||L.getCertificationRequestInfo(e);return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[t,d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(e.signatureOid).getBytes()),ai(e.signatureOid,e.signatureParameters)]),d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,"\0"+e.signature)])};L.createCaStore=function(e){var t={certs:{}};t.getIssuer=function(n){var o=a(n.issuer);return o},t.addCertificate=function(n){if(typeof n=="string"&&(n=q.pki.certificateFromPem(n)),r(n.subject),!t.hasCertificate(n))if(n.subject.hash in t.certs){var o=t.certs[n.subject.hash];q.util.isArray(o)||(o=[o]),o.push(n),t.certs[n.subject.hash]=o}else t.certs[n.subject.hash]=n},t.hasCertificate=function(n){typeof n=="string"&&(n=q.pki.certificateFromPem(n));var o=a(n.subject);if(!o)return!1;q.util.isArray(o)||(o=[o]);for(var f=d.toDer(L.certificateToAsn1(n)).getBytes(),u=0;u<o.length;++u){var l=d.toDer(L.certificateToAsn1(o[u])).getBytes();if(f===l)return!0}return!1},t.listAllCertificates=function(){var n=[];for(var o in t.certs)if(t.certs.hasOwnProperty(o)){var f=t.certs[o];if(!q.util.isArray(f))n.push(f);else for(var u=0;u<f.length;++u)n.push(f[u])}return n},t.removeCertificate=function(n){var o;if(typeof n=="string"&&(n=q.pki.certificateFromPem(n)),r(n.subject),!t.hasCertificate(n))return null;var f=a(n.subject);if(!q.util.isArray(f))return o=t.certs[n.subject.hash],delete t.certs[n.subject.hash],o;for(var u=d.toDer(L.certificateToAsn1(n)).getBytes(),l=0;l<f.length;++l){var c=d.toDer(L.certificateToAsn1(f[l])).getBytes();u===c&&(o=f[l],f.splice(l,1))}return f.length===0&&delete t.certs[n.subject.hash],o};function a(n){return r(n),t.certs[n.hash]||null}function r(n){if(!n.hash){var o=q.md.sha1.create();n.attributes=L.RDNAttributesAsArray(fr(n),o),n.hash=o.digest().toHex()}}if(e)for(var i=0;i<e.length;++i){var s=e[i];t.addCertificate(s)}return t};L.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"};L.verifyCertificateChain=function(e,t,a){typeof a=="function"&&(a={verify:a}),a=a||{},t=t.slice(0);var r=t.slice(0),i=a.validityCheckDate;typeof i>"u"&&(i=new Date);var s=!0,n=null,o=0;do{var f=t.shift(),u=null,l=!1;if(i&&(i<f.validity.notBefore||i>f.validity.notAfter)&&(n={message:"Certificate is not valid yet or has expired.",error:L.certificateError.certificate_expired,notBefore:f.validity.notBefore,notAfter:f.validity.notAfter,now:i}),n===null){if(u=t[0]||e.getIssuer(f),u===null&&f.isIssuer(f)&&(l=!0,u=f),u){var c=u;q.util.isArray(c)||(c=[c]);for(var g=!1;!g&&c.length>0;){u=c.shift();try{g=u.verify(f)}catch{}}g||(n={message:"Certificate signature is invalid.",error:L.certificateError.bad_certificate})}n===null&&(!u||l)&&!e.hasCertificate(f)&&(n={message:"Certificate is not trusted.",error:L.certificateError.unknown_ca})}if(n===null&&u&&!f.isIssuer(u)&&(n={message:"Certificate issuer is invalid.",error:L.certificateError.bad_certificate}),n===null)for(var m={keyUsage:!0,basicConstraints:!0},y=0;n===null&&y<f.extensions.length;++y){var E=f.extensions[y];E.critical&&!(E.name in m)&&(n={message:"Certificate has an unsupported critical extension.",error:L.certificateError.unsupported_certificate})}if(n===null&&(!s||t.length===0&&(!u||l))){var S=f.getExtension("basicConstraints"),A=f.getExtension("keyUsage");if(A!==null&&(!A.keyCertSign||S===null)&&(n={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:L.certificateError.bad_certificate}),n===null&&S===null&&(n={message:"Certificate is missing basicConstraints extension and cannot be used as a CA.",error:L.certificateError.bad_certificate}),n===null&&S!==null&&!S.cA&&(n={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:L.certificateError.bad_certificate}),n===null&&A!==null&&"pathLenConstraint"in S){var B=o-1;B>S.pathLenConstraint&&(n={message:"Certificate basicConstraints pathLenConstraint violated.",error:L.certificateError.bad_certificate})}}var b=n===null?!0:n.error,V=a.verify?a.verify(b,o,r):b;if(V===!0)n=null;else throw b===!0&&(n={message:"The application rejected the certificate.",error:L.certificateError.bad_certificate}),(V||V===0)&&(typeof V=="object"&&!q.util.isArray(V)?(V.message&&(n.message=V.message),V.error&&(n.error=V.error)):typeof V=="string"&&(n.error=V)),n;s=!1,++o}while(t.length>0);return!0}});var ni=j((md,Ms)=>{var le=Q();ut();rr();Lt();ti();ei();et();Sr();sr();re();aa();var v=le.asn1,X=le.pki,Ar=Ms.exports=le.pkcs12=le.pkcs12||{},qs={name:"ContentInfo",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:v.Class.UNIVERSAL,type:v.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:v.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},il={name:"PFX",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"version"},qs,{name:"PFX.macData",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:v.Class.UNIVERSAL,type:v.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",optional:!0,tagClass:v.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:v.Class.UNIVERSAL,type:v.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:v.Class.UNIVERSAL,type:v.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},nl={name:"SafeBag",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:v.Class.UNIVERSAL,type:v.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:v.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:v.Class.UNIVERSAL,type:v.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},sl={name:"Attribute",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:v.Class.UNIVERSAL,type:v.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:v.Class.UNIVERSAL,type:v.Type.SET,constructed:!0,capture:"values"}]},ol={name:"CertBag",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:v.Class.UNIVERSAL,type:v.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:v.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:v.Class.UNIVERSAL,type:v.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function Tr(e,t,a,r){for(var i=[],s=0;s<e.length;s++)for(var n=0;n<e[s].safeBags.length;n++){var o=e[s].safeBags[n];if(!(r!==void 0&&o.type!==r)){if(t===null){i.push(o);continue}o.attributes[t]!==void 0&&o.attributes[t].indexOf(a)>=0&&i.push(o)}}return i}Ar.pkcs12FromAsn1=function(e,t,a){typeof t=="string"?(a=t,t=!0):t===void 0&&(t=!0);var r={},i=[];if(!v.validate(e,il,r,i)){var s=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw s.errors=s,s}var n={version:r.version.charCodeAt(0),safeContents:[],getBags:function(S){var A={},B;return"localKeyId"in S?B=S.localKeyId:"localKeyIdHex"in S&&(B=le.util.hexToBytes(S.localKeyIdHex)),B===void 0&&!("friendlyName"in S)&&"bagType"in S&&(A[S.bagType]=Tr(n.safeContents,null,null,S.bagType)),B!==void 0&&(A.localKeyId=Tr(n.safeContents,"localKeyId",B,S.bagType)),"friendlyName"in S&&(A.friendlyName=Tr(n.safeContents,"friendlyName",S.friendlyName,S.bagType)),A},getBagsByFriendlyName:function(S,A){return Tr(n.safeContents,"friendlyName",S,A)},getBagsByLocalKeyId:function(S,A){return Tr(n.safeContents,"localKeyId",S,A)}};if(r.version.charCodeAt(0)!==3){var s=new Error("PKCS#12 PFX of version other than 3 not supported.");throw s.version=r.version.charCodeAt(0),s}if(v.derToOid(r.contentType)!==X.oids.data){var s=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw s.oid=v.derToOid(r.contentType),s}var o=r.content.value[0];if(o.tagClass!==v.Class.UNIVERSAL||o.type!==v.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(o=ii(o),r.mac){var f=null,u=0,l=v.derToOid(r.macAlgorithm);switch(l){case X.oids.sha1:f=le.md.sha1.create(),u=20;break;case X.oids.sha256:f=le.md.sha256.create(),u=32;break;case X.oids.sha384:f=le.md.sha384.create(),u=48;break;case X.oids.sha512:f=le.md.sha512.create(),u=64;break;case X.oids.md5:f=le.md.md5.create(),u=16;break}if(f===null)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+l);var c=new le.util.ByteBuffer(r.macSalt),g="macIterations"in r?parseInt(le.util.bytesToHex(r.macIterations),16):1,m=Ar.generateKey(a,c,3,g,u,f),y=le.hmac.create();y.start(f,m),y.update(o.value);var E=y.getMac();if(E.getBytes()!==r.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}else if(Array.isArray(e.value)&&e.value.length>2)throw new Error("Invalid PKCS#12. macData field present but MAC was not validated.");return ul(n,o.value,t,a),n};function ii(e){if(e.composed||e.constructed){for(var t=le.util.createBuffer(),a=0;a<e.value.length;++a)t.putBytes(e.value[a].value);e.composed=e.constructed=!1,e.value=t.getBytes()}return e}function ul(e,t,a,r){if(t=v.fromDer(t,a),t.tagClass!==v.Class.UNIVERSAL||t.type!==v.Type.SEQUENCE||t.constructed!==!0)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var i=0;i<t.value.length;i++){var s=t.value[i],n={},o=[];if(!v.validate(s,qs,n,o)){var f=new Error("Cannot read ContentInfo.");throw f.errors=o,f}var u={encrypted:!1},l=null,c=n.content.value[0];switch(v.derToOid(n.contentType)){case X.oids.data:if(c.tagClass!==v.Class.UNIVERSAL||c.type!==v.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");l=ii(c).value;break;case X.oids.encryptedData:l=fl(c,r),u.encrypted=!0;break;default:var f=new Error("Unsupported PKCS#12 contentType.");throw f.contentType=v.derToOid(n.contentType),f}u.safeBags=ll(l,a,r),e.safeContents.push(u)}}function fl(e,t){var a={},r=[];if(!v.validate(e,le.pkcs7.asn1.encryptedDataValidator,a,r)){var i=new Error("Cannot read EncryptedContentInfo.");throw i.errors=r,i}var s=v.derToOid(a.contentType);if(s!==X.oids.data){var i=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw i.oid=s,i}s=v.derToOid(a.encAlgorithm);var n=X.pbe.getCipher(s,a.encParameter,t),o=ii(a.encryptedContentAsn1),f=le.util.createBuffer(o.value);if(n.update(f),!n.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return n.output.getBytes()}function ll(e,t,a){if(!t&&e.length===0)return[];if(e=v.fromDer(e,t),e.tagClass!==v.Class.UNIVERSAL||e.type!==v.Type.SEQUENCE||e.constructed!==!0)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var r=[],i=0;i<e.value.length;i++){var s=e.value[i],n={},o=[];if(!v.validate(s,nl,n,o)){var f=new Error("Cannot read SafeBag.");throw f.errors=o,f}var u={type:v.derToOid(n.bagId),attributes:cl(n.bagAttributes)};r.push(u);var l,c,g=n.bagValue.value[0];switch(u.type){case X.oids.pkcs8ShroudedKeyBag:if(g=X.decryptPrivateKeyInfo(g,a),g===null)throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case X.oids.keyBag:try{u.key=X.privateKeyFromAsn1(g)}catch{u.key=null,u.asn1=g}continue;case X.oids.certBag:l=ol,c=function(){if(v.derToOid(n.certId)!==X.oids.x509Certificate){var y=new Error("Unsupported certificate type, only X.509 supported.");throw y.oid=v.derToOid(n.certId),y}var E=v.fromDer(n.cert,t);try{u.cert=X.certificateFromAsn1(E,!0)}catch{u.cert=null,u.asn1=E}};break;default:var f=new Error("Unsupported PKCS#12 SafeBag type.");throw f.oid=u.type,f}if(l!==void 0&&!v.validate(g,l,n,o)){var f=new Error("Cannot read PKCS#12 "+l.name);throw f.errors=o,f}c()}return r}function cl(e){var t={};if(e!==void 0)for(var a=0;a<e.length;++a){var r={},i=[];if(!v.validate(e[a],sl,r,i)){var s=new Error("Cannot read PKCS#12 BagAttribute.");throw s.errors=i,s}var n=v.derToOid(r.oid);if(X.oids[n]!==void 0){t[X.oids[n]]=[];for(var o=0;o<r.values.length;++o)t[X.oids[n]].push(r.values[o].value)}}return t}Ar.toPkcs12Asn1=function(e,t,a,r){r=r||{},r.saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||r.encAlgorithm||"aes128","useMac"in r||(r.useMac=!0),"localKeyId"in r||(r.localKeyId=null),"generateLocalKeyId"in r||(r.generateLocalKeyId=!0);var i=r.localKeyId,s;if(i!==null)i=le.util.hexToBytes(i);else if(r.generateLocalKeyId)if(t){var n=le.util.isArray(t)?t[0]:t;typeof n=="string"&&(n=X.certificateFromPem(n));var o=le.md.sha1.create();o.update(v.toDer(X.certificateToAsn1(n)).getBytes()),i=o.digest().getBytes()}else i=le.random.getBytes(20);var f=[];i!==null&&f.push(v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.OID,!1,v.oidToDer(X.oids.localKeyId).getBytes()),v.create(v.Class.UNIVERSAL,v.Type.SET,!0,[v.create(v.Class.UNIVERSAL,v.Type.OCTETSTRING,!1,i)])])),"friendlyName"in r&&f.push(v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.OID,!1,v.oidToDer(X.oids.friendlyName).getBytes()),v.create(v.Class.UNIVERSAL,v.Type.SET,!0,[v.create(v.Class.UNIVERSAL,v.Type.BMPSTRING,!1,r.friendlyName)])])),f.length>0&&(s=v.create(v.Class.UNIVERSAL,v.Type.SET,!0,f));var u=[],l=[];t!==null&&(le.util.isArray(t)?l=t:l=[t]);for(var c=[],g=0;g<l.length;++g){t=l[g],typeof t=="string"&&(t=X.certificateFromPem(t));var m=g===0?s:void 0,y=X.certificateToAsn1(t),E=v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.OID,!1,v.oidToDer(X.oids.certBag).getBytes()),v.create(v.Class.CONTEXT_SPECIFIC,0,!0,[v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.OID,!1,v.oidToDer(X.oids.x509Certificate).getBytes()),v.create(v.Class.CONTEXT_SPECIFIC,0,!0,[v.create(v.Class.UNIVERSAL,v.Type.OCTETSTRING,!1,v.toDer(y).getBytes())])])]),m]);c.push(E)}if(c.length>0){var S=v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,c),A=v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.OID,!1,v.oidToDer(X.oids.data).getBytes()),v.create(v.Class.CONTEXT_SPECIFIC,0,!0,[v.create(v.Class.UNIVERSAL,v.Type.OCTETSTRING,!1,v.toDer(S).getBytes())])]);u.push(A)}var B=null;if(e!==null){var b=X.wrapRsaPrivateKey(X.privateKeyToAsn1(e));a===null?B=v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.OID,!1,v.oidToDer(X.oids.keyBag).getBytes()),v.create(v.Class.CONTEXT_SPECIFIC,0,!0,[b]),s]):B=v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.OID,!1,v.oidToDer(X.oids.pkcs8ShroudedKeyBag).getBytes()),v.create(v.Class.CONTEXT_SPECIFIC,0,!0,[X.encryptPrivateKeyInfo(b,a,r)]),s]);var V=v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[B]),k=v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.OID,!1,v.oidToDer(X.oids.data).getBytes()),v.create(v.Class.CONTEXT_SPECIFIC,0,!0,[v.create(v.Class.UNIVERSAL,v.Type.OCTETSTRING,!1,v.toDer(V).getBytes())])]);u.push(k)}var R=v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,u),G;if(r.useMac){var o=le.md.sha1.create(),Y=new le.util.ByteBuffer(le.random.getBytes(r.saltSize)),ie=r.count,e=Ar.generateKey(a,Y,3,ie,20),ne=le.hmac.create();ne.start(o,e),ne.update(v.toDer(R).getBytes());var ue=ne.getMac();G=v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.OID,!1,v.oidToDer(X.oids.sha1).getBytes()),v.create(v.Class.UNIVERSAL,v.Type.NULL,!1,"")]),v.create(v.Class.UNIVERSAL,v.Type.OCTETSTRING,!1,ue.getBytes())]),v.create(v.Class.UNIVERSAL,v.Type.OCTETSTRING,!1,Y.getBytes()),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,v.integerToDer(ie).getBytes())])}return v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,v.integerToDer(3).getBytes()),v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.OID,!1,v.oidToDer(X.oids.data).getBytes()),v.create(v.Class.CONTEXT_SPECIFIC,0,!0,[v.create(v.Class.UNIVERSAL,v.Type.OCTETSTRING,!1,v.toDer(R).getBytes())])]),G])};Ar.generateKey=le.pbe.generatePkcs12Key});var oi=j((Cd,Hs)=>{var Pt=Q();ut();Lt();ei();Ht();Qr();ni();ea();Sr();re();aa();var si=Pt.asn1,lr=Hs.exports=Pt.pki=Pt.pki||{};lr.pemToDer=function(e){var t=Pt.pem.decode(e)[0];if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert PEM to DER; PEM is encrypted.");return Pt.util.createBuffer(t.body)};lr.privateKeyFromPem=function(e){var t=Pt.pem.decode(e)[0];if(t.type!=="PRIVATE KEY"&&t.type!=="RSA PRIVATE KEY"){var a=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert private key from PEM; PEM is encrypted.");var r=si.fromDer(t.body);return lr.privateKeyFromAsn1(r)};lr.privateKeyToPem=function(e,t){var a={type:"RSA PRIVATE KEY",body:si.toDer(lr.privateKeyToAsn1(e)).getBytes()};return Pt.pem.encode(a,{maxline:t})};lr.privateKeyInfoToPem=function(e,t){var a={type:"PRIVATE KEY",body:si.toDer(e).getBytes()};return Pt.pem.encode(a,{maxline:t})}});var pi=j((xd,$s)=>{var N=Q();ut();rr();Hr();Ht();oi();et();sr();re();var oa=function(e,t,a,r){var i=N.util.createBuffer(),s=e.length>>1,n=s+(e.length&1),o=e.substr(0,n),f=e.substr(s,n),u=N.util.createBuffer(),l=N.hmac.create();a=t+a;var c=Math.ceil(r/16),g=Math.ceil(r/20);l.start("MD5",o);var m=N.util.createBuffer();u.putBytes(a);for(var y=0;y<c;++y)l.start(null,null),l.update(u.getBytes()),u.putBuffer(l.digest()),l.start(null,null),l.update(u.bytes()+a),m.putBuffer(l.digest());l.start("SHA1",f);var E=N.util.createBuffer();u.clear(),u.putBytes(a);for(var y=0;y<g;++y)l.start(null,null),l.update(u.getBytes()),u.putBuffer(l.digest()),l.start(null,null),l.update(u.bytes()+a),E.putBuffer(l.digest());return i.putBytes(N.util.xorBytes(m.getBytes(),E.getBytes(),r)),i},dl=function(e,t,a){var r=N.hmac.create();r.start("SHA1",e);var i=N.util.createBuffer();return i.putInt32(t[0]),i.putInt32(t[1]),i.putByte(a.type),i.putByte(a.version.major),i.putByte(a.version.minor),i.putInt16(a.length),i.putBytes(a.fragment.bytes()),r.update(i.getBytes()),r.digest().getBytes()},pl=function(e,t,a){var r=!1;try{var i=e.deflate(t.fragment.getBytes());t.fragment=N.util.createBuffer(i),t.length=i.length,r=!0}catch{}return r},hl=function(e,t,a){var r=!1;try{var i=e.inflate(t.fragment.getBytes());t.fragment=N.util.createBuffer(i),t.length=i.length,r=!0}catch{}return r},$e=function(e,t){var a=0;switch(t){case 1:a=e.getByte();break;case 2:a=e.getInt16();break;case 3:a=e.getInt24();break;case 4:a=e.getInt32();break}return N.util.createBuffer(e.getBytes(a))},it=function(e,t,a){e.putInt(a.length(),t<<3),e.putBuffer(a)},h={};h.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}};h.SupportedVersions=[h.Versions.TLS_1_1,h.Versions.TLS_1_0];h.Version=h.SupportedVersions[0];h.MaxFragment=15360;h.ConnectionEnd={server:0,client:1};h.PRFAlgorithm={tls_prf_sha256:0};h.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2};h.CipherType={stream:0,block:1,aead:2};h.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4};h.CompressionMethod={none:0,deflate:1};h.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24};h.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};h.Alert={};h.Alert.Level={warning:1,fatal:2};h.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};h.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2};h.CipherSuites={};h.getCipherSuite=function(e){var t=null;for(var a in h.CipherSuites){var r=h.CipherSuites[a];if(r.id[0]===e.charCodeAt(0)&&r.id[1]===e.charCodeAt(1)){t=r;break}}return t};h.handleUnexpected=function(e,t){var a=!e.open&&e.entity===h.ConnectionEnd.client;a||e.error(e,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.unexpected_message}})};h.handleHelloRequest=function(e,t,a){!e.handshaking&&e.handshakes>0&&(h.queue(e,h.createAlert(e,{level:h.Alert.Level.warning,description:h.Alert.Description.no_renegotiation})),h.flush(e)),e.process()};h.parseHelloMessage=function(e,t,a){var r=null,i=e.entity===h.ConnectionEnd.client;if(a<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.illegal_parameter}});else{var s=t.fragment,n=s.length();if(r={version:{major:s.getByte(),minor:s.getByte()},random:N.util.createBuffer(s.getBytes(32)),session_id:$e(s,1),extensions:[]},i?(r.cipher_suite=s.getBytes(2),r.compression_method=s.getByte()):(r.cipher_suites=$e(s,2),r.compression_methods=$e(s,1)),n=a-(n-s.length()),n>0){for(var o=$e(s,2);o.length()>0;)r.extensions.push({type:[o.getByte(),o.getByte()],data:$e(o,2)});if(!i)for(var f=0;f<r.extensions.length;++f){var u=r.extensions[f];if(u.type[0]===0&&u.type[1]===0)for(var l=$e(u.data,2);l.length()>0;){var c=l.getByte();if(c!==0)break;e.session.extensions.server_name.serverNameList.push($e(l,2).getBytes())}}}if(e.session.version&&(r.version.major!==e.session.version.major||r.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=h.getCipherSuite(r.cipher_suite);else for(var g=N.util.createBuffer(r.cipher_suites.bytes());g.length()>0&&(e.session.cipherSuite=h.getCipherSuite(g.getBytes(2)),e.session.cipherSuite===null););if(e.session.cipherSuite===null)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.handshake_failure},cipherSuite:N.util.bytesToHex(r.cipher_suite)});i?e.session.compressionMethod=r.compression_method:e.session.compressionMethod=h.CompressionMethod.none}return r};h.createSecurityParameters=function(e,t){var a=e.entity===h.ConnectionEnd.client,r=t.random.bytes(),i=a?e.session.sp.client_random:r,s=a?r:h.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:h.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:i,server_random:s}};h.handleServerHello=function(e,t,a){var r=h.parseHelloMessage(e,t,a);if(!e.fail){if(r.version.minor<=e.version.minor)e.version.minor=r.version.minor;else return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.protocol_version}});e.session.version=e.version;var i=r.session_id.bytes();i.length>0&&i===e.session.id?(e.expect=zs,e.session.resuming=!0,e.session.sp.server_random=r.random.bytes()):(e.expect=yl,e.session.resuming=!1,h.createSecurityParameters(e,r)),e.session.id=i,e.process()}};h.handleClientHello=function(e,t,a){var r=h.parseHelloMessage(e,t,a);if(!e.fail){var i=r.session_id.bytes(),s=null;if(e.sessionCache&&(s=e.sessionCache.getSession(i),s===null?i="":(s.version.major!==r.version.major||s.version.minor>r.version.minor)&&(s=null,i="")),i.length===0&&(i=N.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=r.version,e.session.sp={},s)e.version=e.session.version=s.version,e.session.sp=s.sp;else{for(var n,o=1;o<h.SupportedVersions.length&&(n=h.SupportedVersions[o],!(n.minor<=r.version.minor));++o);e.version={major:n.major,minor:n.minor},e.session.version=e.version}s!==null?(e.expect=ci,e.session.resuming=!0,e.session.sp.client_random=r.random.bytes()):(e.expect=e.verifyClient!==!1?Tl:li,e.session.resuming=!1,h.createSecurityParameters(e,r)),e.open=!0,h.queue(e,h.createRecord(e,{type:h.ContentType.handshake,data:h.createServerHello(e)})),e.session.resuming?(h.queue(e,h.createRecord(e,{type:h.ContentType.change_cipher_spec,data:h.createChangeCipherSpec()})),e.state.pending=h.createConnectionState(e),e.state.current.write=e.state.pending.write,h.queue(e,h.createRecord(e,{type:h.ContentType.handshake,data:h.createFinished(e)}))):(h.queue(e,h.createRecord(e,{type:h.ContentType.handshake,data:h.createCertificate(e)})),e.fail||(h.queue(e,h.createRecord(e,{type:h.ContentType.handshake,data:h.createServerKeyExchange(e)})),e.verifyClient!==!1&&h.queue(e,h.createRecord(e,{type:h.ContentType.handshake,data:h.createCertificateRequest(e)})),h.queue(e,h.createRecord(e,{type:h.ContentType.handshake,data:h.createServerHelloDone(e)})))),h.flush(e),e.process()}};h.handleCertificate=function(e,t,a){if(a<3)return e.error(e,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.illegal_parameter}});var r=t.fragment,i={certificate_list:$e(r,3)},s,n,o=[];try{for(;i.certificate_list.length()>0;)s=$e(i.certificate_list,3),n=N.asn1.fromDer(s),s=N.pki.certificateFromAsn1(n,!0),o.push(s)}catch(u){return e.error(e,{message:"Could not parse certificate list.",cause:u,send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.bad_certificate}})}var f=e.entity===h.ConnectionEnd.client;(f||e.verifyClient===!0)&&o.length===0?e.error(e,{message:f?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.illegal_parameter}}):o.length===0?e.expect=f?Gs:li:(f?e.session.serverCertificate=o[0]:e.session.clientCertificate=o[0],h.verifyCertificateChain(e,o)&&(e.expect=f?Gs:li)),e.process()};h.handleServerKeyExchange=function(e,t,a){if(a>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.unsupported_certificate}});e.expect=vl,e.process()};h.handleClientKeyExchange=function(e,t,a){if(a<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.unsupported_certificate}});var r=t.fragment,i={enc_pre_master_secret:$e(r,2).getBytes()},s=null;if(e.getPrivateKey)try{s=e.getPrivateKey(e,e.session.serverCertificate),s=N.pki.privateKeyFromPem(s)}catch(f){e.error(e,{message:"Could not get private key.",cause:f,send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.internal_error}})}if(s===null)return e.error(e,{message:"No private key set.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.internal_error}});try{var n=e.session.sp;n.pre_master_secret=s.decrypt(i.enc_pre_master_secret);var o=e.session.clientHelloVersion;if(o.major!==n.pre_master_secret.charCodeAt(0)||o.minor!==n.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch{n.pre_master_secret=N.random.getBytes(48)}e.expect=ci,e.session.clientCertificate!==null&&(e.expect=Al),e.process()};h.handleCertificateRequest=function(e,t,a){if(a<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.illegal_parameter}});var r=t.fragment,i={certificate_types:$e(r,1),certificate_authorities:$e(r,2)};e.session.certificateRequest=i,e.expect=ml,e.process()};h.handleCertificateVerify=function(e,t,a){if(a<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.illegal_parameter}});var r=t.fragment;r.read-=4;var i=r.bytes();r.read+=4;var s={signature:$e(r,2).getBytes()},n=N.util.createBuffer();n.putBuffer(e.session.md5.digest()),n.putBuffer(e.session.sha1.digest()),n=n.getBytes();try{var o=e.session.clientCertificate;if(!o.publicKey.verify(n,s.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch{return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.handshake_failure}})}e.expect=ci,e.process()};h.handleServerHelloDone=function(e,t,a){if(a>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.record_overflow}});if(e.serverCertificate===null){var r={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.insufficient_security}},i=0,s=e.verify(e,r.alert.description,i,[]);if(s!==!0)return(s||s===0)&&(typeof s=="object"&&!N.util.isArray(s)?(s.message&&(r.message=s.message),s.alert&&(r.alert.description=s.alert)):typeof s=="number"&&(r.alert.description=s)),e.error(e,r)}e.session.certificateRequest!==null&&(t=h.createRecord(e,{type:h.ContentType.handshake,data:h.createCertificate(e)}),h.queue(e,t)),t=h.createRecord(e,{type:h.ContentType.handshake,data:h.createClientKeyExchange(e)}),h.queue(e,t),e.expect=El;var n=function(o,f){o.session.certificateRequest!==null&&o.session.clientCertificate!==null&&h.queue(o,h.createRecord(o,{type:h.ContentType.handshake,data:h.createCertificateVerify(o,f)})),h.queue(o,h.createRecord(o,{type:h.ContentType.change_cipher_spec,data:h.createChangeCipherSpec()})),o.state.pending=h.createConnectionState(o),o.state.current.write=o.state.pending.write,h.queue(o,h.createRecord(o,{type:h.ContentType.handshake,data:h.createFinished(o)})),o.expect=zs,h.flush(o),o.process()};if(e.session.certificateRequest===null||e.session.clientCertificate===null)return n(e,null);h.getClientSignature(e,n)};h.handleChangeCipherSpec=function(e,t){if(t.fragment.getByte()!==1)return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.illegal_parameter}});var a=e.entity===h.ConnectionEnd.client;(e.session.resuming&&a||!e.session.resuming&&!a)&&(e.state.pending=h.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&a||e.session.resuming&&!a)&&(e.state.pending=null),e.expect=a?Cl:Il,e.process()};h.handleFinished=function(e,t,a){var r=t.fragment;r.read-=4;var i=r.bytes();r.read+=4;var s=t.fragment.getBytes();r=N.util.createBuffer(),r.putBuffer(e.session.md5.digest()),r.putBuffer(e.session.sha1.digest());var n=e.entity===h.ConnectionEnd.client,o=n?"server finished":"client finished",f=e.session.sp,u=12,l=oa;if(r=l(f.master_secret,o,r.getBytes(),u),r.getBytes()!==s)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.decrypt_error}});e.session.md5.update(i),e.session.sha1.update(i),(e.session.resuming&&n||!e.session.resuming&&!n)&&(h.queue(e,h.createRecord(e,{type:h.ContentType.change_cipher_spec,data:h.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,h.queue(e,h.createRecord(e,{type:h.ContentType.handshake,data:h.createFinished(e)}))),e.expect=n?xl:Bl,e.handshaking=!1,++e.handshakes,e.peerCertificate=n?e.session.serverCertificate:e.session.clientCertificate,h.flush(e),e.isConnected=!0,e.connected(e),e.process()};h.handleAlert=function(e,t){var a=t.fragment,r={level:a.getByte(),description:a.getByte()},i;switch(r.description){case h.Alert.Description.close_notify:i="Connection closed.";break;case h.Alert.Description.unexpected_message:i="Unexpected message.";break;case h.Alert.Description.bad_record_mac:i="Bad record MAC.";break;case h.Alert.Description.decryption_failed:i="Decryption failed.";break;case h.Alert.Description.record_overflow:i="Record overflow.";break;case h.Alert.Description.decompression_failure:i="Decompression failed.";break;case h.Alert.Description.handshake_failure:i="Handshake failure.";break;case h.Alert.Description.bad_certificate:i="Bad certificate.";break;case h.Alert.Description.unsupported_certificate:i="Unsupported certificate.";break;case h.Alert.Description.certificate_revoked:i="Certificate revoked.";break;case h.Alert.Description.certificate_expired:i="Certificate expired.";break;case h.Alert.Description.certificate_unknown:i="Certificate unknown.";break;case h.Alert.Description.illegal_parameter:i="Illegal parameter.";break;case h.Alert.Description.unknown_ca:i="Unknown certificate authority.";break;case h.Alert.Description.access_denied:i="Access denied.";break;case h.Alert.Description.decode_error:i="Decode error.";break;case h.Alert.Description.decrypt_error:i="Decrypt error.";break;case h.Alert.Description.export_restriction:i="Export restriction.";break;case h.Alert.Description.protocol_version:i="Unsupported protocol version.";break;case h.Alert.Description.insufficient_security:i="Insufficient security.";break;case h.Alert.Description.internal_error:i="Internal error.";break;case h.Alert.Description.user_canceled:i="User canceled.";break;case h.Alert.Description.no_renegotiation:i="Renegotiation not supported.";break;default:i="Unknown error.";break}if(r.description===h.Alert.Description.close_notify)return e.close();e.error(e,{message:i,send:!1,origin:e.entity===h.ConnectionEnd.client?"server":"client",alert:r}),e.process()};h.handleHandshake=function(e,t){var a=t.fragment,r=a.getByte(),i=a.getInt24();if(i>a.length())return e.fragmented=t,t.fragment=N.util.createBuffer(),a.read-=4,e.process();e.fragmented=null,a.read-=4;var s=a.bytes(i+4);a.read+=4,r in sa[e.entity][e.expect]?(e.entity===h.ConnectionEnd.server&&!e.open&&!e.fail&&(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:N.md.md5.create(),sha1:N.md.sha1.create()}),r!==h.HandshakeType.hello_request&&r!==h.HandshakeType.certificate_verify&&r!==h.HandshakeType.finished&&(e.session.md5.update(s),e.session.sha1.update(s)),sa[e.entity][e.expect][r](e,t,i)):h.handleUnexpected(e,t)};h.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()};h.handleHeartbeat=function(e,t){var a=t.fragment,r=a.getByte(),i=a.getInt16(),s=a.getBytes(i);if(r===h.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>s.length)return e.process();h.queue(e,h.createRecord(e,{type:h.ContentType.heartbeat,data:h.createHeartbeat(h.HeartbeatMessageType.heartbeat_response,s)})),h.flush(e)}else if(r===h.HeartbeatMessageType.heartbeat_response){if(s!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,N.util.createBuffer(s))}e.process()};var gl=0,yl=1,Gs=2,vl=3,ml=4,zs=5,Cl=6,xl=7,El=8,Sl=0,Tl=1,li=2,Al=3,ci=4,Il=5,Bl=6,p=h.handleUnexpected,Qs=h.handleChangeCipherSpec,be=h.handleAlert,ze=h.handleHandshake,Ys=h.handleApplicationData,_e=h.handleHeartbeat,di=[];di[h.ConnectionEnd.client]=[[p,be,ze,p,_e],[p,be,ze,p,_e],[p,be,ze,p,_e],[p,be,ze,p,_e],[p,be,ze,p,_e],[Qs,be,p,p,_e],[p,be,ze,p,_e],[p,be,ze,Ys,_e],[p,be,ze,p,_e]];di[h.ConnectionEnd.server]=[[p,be,ze,p,_e],[p,be,ze,p,_e],[p,be,ze,p,_e],[p,be,ze,p,_e],[Qs,be,p,p,_e],[p,be,ze,p,_e],[p,be,ze,Ys,_e],[p,be,ze,p,_e]];var Vt=h.handleHelloRequest,bl=h.handleServerHello,Ws=h.handleCertificate,js=h.handleServerKeyExchange,ui=h.handleCertificateRequest,ia=h.handleServerHelloDone,Xs=h.handleFinished,sa=[];sa[h.ConnectionEnd.client]=[[p,p,bl,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p],[Vt,p,p,p,p,p,p,p,p,p,p,Ws,js,ui,ia,p,p,p,p,p,p],[Vt,p,p,p,p,p,p,p,p,p,p,p,js,ui,ia,p,p,p,p,p,p],[Vt,p,p,p,p,p,p,p,p,p,p,p,p,ui,ia,p,p,p,p,p,p],[Vt,p,p,p,p,p,p,p,p,p,p,p,p,p,ia,p,p,p,p,p,p],[Vt,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p],[Vt,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,Xs],[Vt,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p],[Vt,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p]];var _l=h.handleClientHello,Nl=h.handleClientKeyExchange,wl=h.handleCertificateVerify;sa[h.ConnectionEnd.server]=[[p,_l,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p],[p,p,p,p,p,p,p,p,p,p,p,Ws,p,p,p,p,p,p,p,p,p],[p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,Nl,p,p,p,p],[p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,wl,p,p,p,p,p],[p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p],[p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,Xs],[p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p],[p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p]];h.generateKeys=function(e,t){var a=oa,r=t.client_random+t.server_random;e.session.resuming||(t.master_secret=a(t.pre_master_secret,"master secret",r,48).bytes(),t.pre_master_secret=null),r=t.server_random+t.client_random;var i=2*t.mac_key_length+2*t.enc_key_length,s=e.version.major===h.Versions.TLS_1_0.major&&e.version.minor===h.Versions.TLS_1_0.minor;s&&(i+=2*t.fixed_iv_length);var n=a(t.master_secret,"key expansion",r,i),o={client_write_MAC_key:n.getBytes(t.mac_key_length),server_write_MAC_key:n.getBytes(t.mac_key_length),client_write_key:n.getBytes(t.enc_key_length),server_write_key:n.getBytes(t.enc_key_length)};return s&&(o.client_write_IV=n.getBytes(t.fixed_iv_length),o.server_write_IV=n.getBytes(t.fixed_iv_length)),o};h.createConnectionState=function(e){var t=e.entity===h.ConnectionEnd.client,a=function(){var s={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(n){return!0},compressionState:null,compressFunction:function(n){return!0},updateSequenceNumber:function(){s.sequenceNumber[1]===4294967295?(s.sequenceNumber[1]=0,++s.sequenceNumber[0]):++s.sequenceNumber[1]}};return s},r={read:a(),write:a()};if(r.read.update=function(s,n){return r.read.cipherFunction(n,r.read)?r.read.compressFunction(s,n,r.read)||s.error(s,{message:"Could not decompress record.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.decompression_failure}}):s.error(s,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.bad_record_mac}}),!s.fail},r.write.update=function(s,n){return r.write.compressFunction(s,n,r.write)?r.write.cipherFunction(n,r.write)||s.error(s,{message:"Could not encrypt record.",send:!1,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.internal_error}}):s.error(s,{message:"Could not compress record.",send:!1,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.internal_error}}),!s.fail},e.session){var i=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(i),i.keys=h.generateKeys(e,i),r.read.macKey=t?i.keys.server_write_MAC_key:i.keys.client_write_MAC_key,r.write.macKey=t?i.keys.client_write_MAC_key:i.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(r,e,i),i.compression_algorithm){case h.CompressionMethod.none:break;case h.CompressionMethod.deflate:r.read.compressFunction=hl,r.write.compressFunction=pl;break;default:throw new Error("Unsupported compression algorithm.")}}return r};h.createRandom=function(){var e=new Date,t=+e+e.getTimezoneOffset()*6e4,a=N.util.createBuffer();return a.putInt32(t),a.putBytes(N.random.getBytes(28)),a};h.createRecord=function(e,t){if(!t.data)return null;var a={type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data};return a};h.createAlert=function(e,t){var a=N.util.createBuffer();return a.putByte(t.level),a.putByte(t.description),h.createRecord(e,{type:h.ContentType.alert,data:a})};h.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=N.util.createBuffer(),a=0;a<e.cipherSuites.length;++a){var r=e.cipherSuites[a];t.putByte(r.id[0]),t.putByte(r.id[1])}var i=t.length(),s=N.util.createBuffer();s.putByte(h.CompressionMethod.none);var n=s.length(),o=N.util.createBuffer();if(e.virtualHost){var f=N.util.createBuffer();f.putByte(0),f.putByte(0);var u=N.util.createBuffer();u.putByte(0),it(u,2,N.util.createBuffer(e.virtualHost));var l=N.util.createBuffer();it(l,2,u),it(f,2,l),o.putBuffer(f)}var c=o.length();c>0&&(c+=2);var g=e.session.id,m=g.length+1+2+4+28+2+i+1+n+c,y=N.util.createBuffer();return y.putByte(h.HandshakeType.client_hello),y.putInt24(m),y.putByte(e.version.major),y.putByte(e.version.minor),y.putBytes(e.session.sp.client_random),it(y,1,N.util.createBuffer(g)),it(y,2,t),it(y,1,s),c>0&&it(y,2,o),y};h.createServerHello=function(e){var t=e.session.id,a=t.length+1+2+4+28+2+1,r=N.util.createBuffer();return r.putByte(h.HandshakeType.server_hello),r.putInt24(a),r.putByte(e.version.major),r.putByte(e.version.minor),r.putBytes(e.session.sp.server_random),it(r,1,N.util.createBuffer(t)),r.putByte(e.session.cipherSuite.id[0]),r.putByte(e.session.cipherSuite.id[1]),r.putByte(e.session.compressionMethod),r};h.createCertificate=function(e){var t=e.entity===h.ConnectionEnd.client,a=null;if(e.getCertificate){var r;t?r=e.session.certificateRequest:r=e.session.extensions.server_name.serverNameList,a=e.getCertificate(e,r)}var i=N.util.createBuffer();if(a!==null)try{N.util.isArray(a)||(a=[a]);for(var s=null,n=0;n<a.length;++n){var o=N.pem.decode(a[n])[0];if(o.type!=="CERTIFICATE"&&o.type!=="X509 CERTIFICATE"&&o.type!=="TRUSTED CERTIFICATE"){var f=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw f.headerType=o.type,f}if(o.procType&&o.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var u=N.util.createBuffer(o.body);s===null&&(s=N.asn1.fromDer(u.bytes(),!1));var l=N.util.createBuffer();it(l,3,u),i.putBuffer(l)}a=N.pki.certificateFromAsn1(s),t?e.session.clientCertificate=a:e.session.serverCertificate=a}catch(m){return e.error(e,{message:"Could not send certificate list.",cause:m,send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.bad_certificate}})}var c=3+i.length(),g=N.util.createBuffer();return g.putByte(h.HandshakeType.certificate),g.putInt24(c),it(g,3,i),g};h.createClientKeyExchange=function(e){var t=N.util.createBuffer();t.putByte(e.session.clientHelloVersion.major),t.putByte(e.session.clientHelloVersion.minor),t.putBytes(N.random.getBytes(46));var a=e.session.sp;a.pre_master_secret=t.getBytes();var r=e.session.serverCertificate.publicKey;t=r.encrypt(a.pre_master_secret);var i=t.length+2,s=N.util.createBuffer();return s.putByte(h.HandshakeType.client_key_exchange),s.putInt24(i),s.putInt16(t.length),s.putBytes(t),s};h.createServerKeyExchange=function(e){var t=0,a=N.util.createBuffer();return t>0&&(a.putByte(h.HandshakeType.server_key_exchange),a.putInt24(t)),a};h.getClientSignature=function(e,t){var a=N.util.createBuffer();a.putBuffer(e.session.md5.digest()),a.putBuffer(e.session.sha1.digest()),a=a.getBytes(),e.getSignature=e.getSignature||function(r,i,s){var n=null;if(r.getPrivateKey)try{n=r.getPrivateKey(r,r.session.clientCertificate),n=N.pki.privateKeyFromPem(n)}catch(o){r.error(r,{message:"Could not get private key.",cause:o,send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.internal_error}})}n===null?r.error(r,{message:"No private key set.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.internal_error}}):i=n.sign(i,null),s(r,i)},e.getSignature(e,a,t)};h.createCertificateVerify=function(e,t){var a=t.length+2,r=N.util.createBuffer();return r.putByte(h.HandshakeType.certificate_verify),r.putInt24(a),r.putInt16(t.length),r.putBytes(t),r};h.createCertificateRequest=function(e){var t=N.util.createBuffer();t.putByte(1);var a=N.util.createBuffer();for(var r in e.caStore.certs){var i=e.caStore.certs[r],s=N.pki.distinguishedNameToAsn1(i.subject),n=N.asn1.toDer(s);a.putInt16(n.length()),a.putBuffer(n)}var o=1+t.length()+2+a.length(),f=N.util.createBuffer();return f.putByte(h.HandshakeType.certificate_request),f.putInt24(o),it(f,1,t),it(f,2,a),f};h.createServerHelloDone=function(e){var t=N.util.createBuffer();return t.putByte(h.HandshakeType.server_hello_done),t.putInt24(0),t};h.createChangeCipherSpec=function(){var e=N.util.createBuffer();return e.putByte(1),e};h.createFinished=function(e){var t=N.util.createBuffer();t.putBuffer(e.session.md5.digest()),t.putBuffer(e.session.sha1.digest());var a=e.entity===h.ConnectionEnd.client,r=e.session.sp,i=12,s=oa,n=a?"client finished":"server finished";t=s(r.master_secret,n,t.getBytes(),i);var o=N.util.createBuffer();return o.putByte(h.HandshakeType.finished),o.putInt24(t.length()),o.putBuffer(t),o};h.createHeartbeat=function(e,t,a){typeof a>"u"&&(a=t.length);var r=N.util.createBuffer();r.putByte(e),r.putInt16(a),r.putBytes(t);var i=r.length(),s=Math.max(16,i-a-3);return r.putBytes(N.random.getBytes(s)),r};h.queue=function(e,t){if(t&&!(t.fragment.length()===0&&(t.type===h.ContentType.handshake||t.type===h.ContentType.alert||t.type===h.ContentType.change_cipher_spec))){if(t.type===h.ContentType.handshake){var a=t.fragment.bytes();e.session.md5.update(a),e.session.sha1.update(a),a=null}var r;if(t.fragment.length()<=h.MaxFragment)r=[t];else{r=[];for(var i=t.fragment.bytes();i.length>h.MaxFragment;)r.push(h.createRecord(e,{type:t.type,data:N.util.createBuffer(i.slice(0,h.MaxFragment))})),i=i.slice(h.MaxFragment);i.length>0&&r.push(h.createRecord(e,{type:t.type,data:N.util.createBuffer(i)}))}for(var s=0;s<r.length&&!e.fail;++s){var n=r[s],o=e.state.current.write;o.update(e,n)&&e.records.push(n)}}};h.flush=function(e){for(var t=0;t<e.records.length;++t){var a=e.records[t];e.tlsData.putByte(a.type),e.tlsData.putByte(a.version.major),e.tlsData.putByte(a.version.minor),e.tlsData.putInt16(a.fragment.length()),e.tlsData.putBuffer(e.records[t].fragment)}return e.records=[],e.tlsDataReady(e)};var fi=function(e){switch(e){case!0:return!0;case N.pki.certificateError.bad_certificate:return h.Alert.Description.bad_certificate;case N.pki.certificateError.unsupported_certificate:return h.Alert.Description.unsupported_certificate;case N.pki.certificateError.certificate_revoked:return h.Alert.Description.certificate_revoked;case N.pki.certificateError.certificate_expired:return h.Alert.Description.certificate_expired;case N.pki.certificateError.certificate_unknown:return h.Alert.Description.certificate_unknown;case N.pki.certificateError.unknown_ca:return h.Alert.Description.unknown_ca;default:return h.Alert.Description.bad_certificate}},Rl=function(e){switch(e){case!0:return!0;case h.Alert.Description.bad_certificate:return N.pki.certificateError.bad_certificate;case h.Alert.Description.unsupported_certificate:return N.pki.certificateError.unsupported_certificate;case h.Alert.Description.certificate_revoked:return N.pki.certificateError.certificate_revoked;case h.Alert.Description.certificate_expired:return N.pki.certificateError.certificate_expired;case h.Alert.Description.certificate_unknown:return N.pki.certificateError.certificate_unknown;case h.Alert.Description.unknown_ca:return N.pki.certificateError.unknown_ca;default:return N.pki.certificateError.bad_certificate}};h.verifyCertificateChain=function(e,t){try{var a={};for(var r in e.verifyOptions)a[r]=e.verifyOptions[r];a.verify=function(s,n,o){var f=fi(s),u=e.verify(e,s,n,o);if(u!==!0){if(typeof u=="object"&&!N.util.isArray(u)){var l=new Error("The application rejected the certificate.");throw l.send=!0,l.alert={level:h.Alert.Level.fatal,description:h.Alert.Description.bad_certificate},u.message&&(l.message=u.message),u.alert&&(l.alert.description=u.alert),l}u!==s&&(u=Rl(u))}return u},N.pki.verifyCertificateChain(e.caStore,t,a)}catch(s){var i=s;(typeof i!="object"||N.util.isArray(i))&&(i={send:!0,alert:{level:h.Alert.Level.fatal,description:fi(s)}}),"send"in i||(i.send=!0),"alert"in i||(i.alert={level:h.Alert.Level.fatal,description:fi(i.error)}),e.error(e,i)}return!e.fail};h.createSessionCache=function(e,t){var a=null;if(e&&e.getSession&&e.setSession&&e.order)a=e;else{a={},a.cache=e||{},a.capacity=Math.max(t||100,1),a.order=[];for(var r in e)a.order.length<=t?a.order.push(r):delete e[r];a.getSession=function(i){var s=null,n=null;if(i?n=N.util.bytesToHex(i):a.order.length>0&&(n=a.order[0]),n!==null&&n in a.cache){s=a.cache[n],delete a.cache[n];for(var o in a.order)if(a.order[o]===n){a.order.splice(o,1);break}}return s},a.setSession=function(i,s){if(a.order.length===a.capacity){var n=a.order.shift();delete a.cache[n]}var n=N.util.bytesToHex(i);a.order.push(n),a.cache[n]=s}}return a};h.createConnection=function(e){var t=null;e.caStore?N.util.isArray(e.caStore)?t=N.pki.createCaStore(e.caStore):t=e.caStore:t=N.pki.createCaStore();var a=e.cipherSuites||null;if(a===null){a=[];for(var r in h.CipherSuites)a.push(h.CipherSuites[r])}var i=e.server?h.ConnectionEnd.server:h.ConnectionEnd.client,s=e.sessionCache?h.createSessionCache(e.sessionCache):null,n={version:{major:h.Version.major,minor:h.Version.minor},entity:i,sessionId:e.sessionId,caStore:t,sessionCache:s,cipherSuites:a,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(l,c,g,m){return c},verifyOptions:e.verifyOptions||{},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:N.util.createBuffer(),tlsData:N.util.createBuffer(),data:N.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(l,c){c.origin=c.origin||(l.entity===h.ConnectionEnd.client?"client":"server"),c.send&&(h.queue(l,h.createAlert(l,c.alert)),h.flush(l));var g=c.fatal!==!1;g&&(l.fail=!0),e.error(l,c),g&&l.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null};n.reset=function(l){n.version={major:h.Version.major,minor:h.Version.minor},n.record=null,n.session=null,n.peerCertificate=null,n.state={pending:null,current:null},n.expect=n.entity===h.ConnectionEnd.client?gl:Sl,n.fragmented=null,n.records=[],n.open=!1,n.handshakes=0,n.handshaking=!1,n.isConnected=!1,n.fail=!(l||typeof l>"u"),n.input.clear(),n.tlsData.clear(),n.data.clear(),n.state.current=h.createConnectionState(n)},n.reset();var o=function(l,c){var g=c.type-h.ContentType.change_cipher_spec,m=di[l.entity][l.expect];g in m?m[g](l,c):h.handleUnexpected(l,c)},f=function(l){var c=0,g=l.input,m=g.length();if(m<5)c=5-m;else{l.record={type:g.getByte(),version:{major:g.getByte(),minor:g.getByte()},length:g.getInt16(),fragment:N.util.createBuffer(),ready:!1};var y=l.record.version.major===l.version.major;y&&l.session&&l.session.version&&(y=l.record.version.minor===l.version.minor),y||l.error(l,{message:"Incompatible TLS version.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.protocol_version}})}return c},u=function(l){var c=0,g=l.input,m=g.length();if(m<l.record.length)c=l.record.length-m;else{l.record.fragment.putBytes(g.getBytes(l.record.length)),g.compact();var y=l.state.current.read;y.update(l,l.record)&&(l.fragmented!==null&&(l.fragmented.type===l.record.type?(l.fragmented.fragment.putBuffer(l.record.fragment),l.record=l.fragmented):l.error(l,{message:"Invalid fragmented record.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.unexpected_message}})),l.record.ready=!0)}return c};return n.handshake=function(l){if(n.entity!==h.ConnectionEnd.client)n.error(n,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(n.handshaking)n.error(n,{message:"Handshake already in progress.",fatal:!1});else{n.fail&&!n.open&&n.handshakes===0&&(n.fail=!1),n.handshaking=!0,l=l||"";var c=null;l.length>0&&(n.sessionCache&&(c=n.sessionCache.getSession(l)),c===null&&(l="")),l.length===0&&n.sessionCache&&(c=n.sessionCache.getSession(),c!==null&&(l=c.id)),n.session={id:l,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:N.md.md5.create(),sha1:N.md.sha1.create()},c&&(n.version=c.version,n.session.sp=c.sp),n.session.sp.client_random=h.createRandom().getBytes(),n.open=!0,h.queue(n,h.createRecord(n,{type:h.ContentType.handshake,data:h.createClientHello(n)})),h.flush(n)}},n.process=function(l){var c=0;return l&&n.input.putBytes(l),n.fail||(n.record!==null&&n.record.ready&&n.record.fragment.isEmpty()&&(n.record=null),n.record===null&&(c=f(n)),!n.fail&&n.record!==null&&!n.record.ready&&(c=u(n)),!n.fail&&n.record!==null&&n.record.ready&&o(n,n.record)),c},n.prepare=function(l){return h.queue(n,h.createRecord(n,{type:h.ContentType.application_data,data:N.util.createBuffer(l)})),h.flush(n)},n.prepareHeartbeatRequest=function(l,c){return l instanceof N.util.ByteBuffer&&(l=l.bytes()),typeof c>"u"&&(c=l.length),n.expectedHeartbeatPayload=l,h.queue(n,h.createRecord(n,{type:h.ContentType.heartbeat,data:h.createHeartbeat(h.HeartbeatMessageType.heartbeat_request,l,c)})),h.flush(n)},n.close=function(l){if(!n.fail&&n.sessionCache&&n.session){var c={id:n.session.id,version:n.session.version,sp:n.session.sp};c.sp.keys=null,n.sessionCache.setSession(c.id,c)}n.open&&(n.open=!1,n.input.clear(),(n.isConnected||n.handshaking)&&(n.isConnected=n.handshaking=!1,h.queue(n,h.createAlert(n,{level:h.Alert.Level.warning,description:h.Alert.Description.close_notify})),h.flush(n)),n.closed(n)),n.reset(l)},n};$s.exports=N.tls=N.tls||{};for(na in h)typeof h[na]!="function"&&(N.tls[na]=h[na]);var na;N.tls.prf_tls1=oa;N.tls.hmac_sha1=dl;N.tls.createSessionCache=h.createSessionCache;N.tls.createConnection=h.createConnection});var eo=j((Ed,Zs)=>{var Ot=Q();Rt();pi();var nt=Zs.exports=Ot.tls;nt.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=nt.BulkCipherAlgorithm.aes,e.cipher_type=nt.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=nt.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:Js};nt.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=nt.BulkCipherAlgorithm.aes,e.cipher_type=nt.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=nt.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:Js};function Js(e,t,a){var r=t.entity===Ot.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:Ot.cipher.createDecipher("AES-CBC",r?a.keys.server_write_key:a.keys.client_write_key),iv:r?a.keys.server_write_IV:a.keys.client_write_IV},e.write.cipherState={init:!1,cipher:Ot.cipher.createCipher("AES-CBC",r?a.keys.client_write_key:a.keys.server_write_key),iv:r?a.keys.client_write_IV:a.keys.server_write_IV},e.read.cipherFunction=Ul,e.write.cipherFunction=Ll,e.read.macLength=e.write.macLength=a.mac_length,e.read.macFunction=e.write.macFunction=nt.hmac_sha1}function Ll(e,t){var a=!1,r=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(r),t.updateSequenceNumber();var i;e.version.minor===nt.Versions.TLS_1_0.minor?i=t.cipherState.init?null:t.cipherState.iv:i=Ot.random.getBytesSync(16),t.cipherState.init=!0;var s=t.cipherState.cipher;return s.start({iv:i}),e.version.minor>=nt.Versions.TLS_1_1.minor&&s.output.putBytes(i),s.update(e.fragment),s.finish(kl)&&(e.fragment=s.output,e.length=e.fragment.length(),a=!0),a}function kl(e,t,a){if(!a){var r=e-t.length()%e;t.fillWithByte(r-1,r)}return!0}function Dl(e,t,a){var r=!0;if(a){for(var i=t.length(),s=t.last(),n=i-1-s;n<i-1;++n)r=r&&t.at(n)==s;r&&t.truncate(s+1)}return r}function Ul(e,t){var a=!1,r;e.version.minor===nt.Versions.TLS_1_0.minor?r=t.cipherState.init?null:t.cipherState.iv:r=e.fragment.getBytes(16),t.cipherState.init=!0;var i=t.cipherState.cipher;i.start({iv:r}),i.update(e.fragment),a=i.finish(Dl);var s=t.macLength,n=Ot.random.getBytesSync(s),o=i.output.length();o>=s?(e.fragment=i.output.getBytes(o-s),n=i.output.getBytes(s)):e.fragment=i.output.getBytes(),e.fragment=Ot.util.createBuffer(e.fragment),e.length=e.fragment.length();var f=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),a=Pl(t.macKey,n,f)&&a,a}function Pl(e,t,a){var r=Ot.hmac.create();return r.start("SHA1",e),r.update(t),t=r.digest().getBytes(),r.start(null,null),r.update(a),a=r.digest().getBytes(),t===a}});var yi=j((Sd,io)=>{var pe=Q();lt();re();var Ir=io.exports=pe.sha512=pe.sha512||{};pe.md.sha512=pe.md.algorithms.sha512=Ir;var ro=pe.sha384=pe.sha512.sha384=pe.sha512.sha384||{};ro.create=function(){return Ir.create("SHA-384")};pe.md.sha384=pe.md.algorithms.sha384=ro;pe.sha512.sha256=pe.sha512.sha256||{create:function(){return Ir.create("SHA-512/256")}};pe.md["sha512/256"]=pe.md.algorithms["sha512/256"]=pe.sha512.sha256;pe.sha512.sha224=pe.sha512.sha224||{create:function(){return Ir.create("SHA-512/224")}};pe.md["sha512/224"]=pe.md.algorithms["sha512/224"]=pe.sha512.sha224;Ir.create=function(e){if(ao||Vl(),typeof e>"u"&&(e="SHA-512"),!(e in Wt))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=Wt[e],a=null,r=pe.util.createBuffer(),i=new Array(80),s=0;s<80;++s)i[s]=new Array(2);var n=64;switch(e){case"SHA-384":n=48;break;case"SHA-512/256":n=32;break;case"SHA-512/224":n=28;break}var o={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:n,messageLength:0,fullMessageLength:null,messageLengthSize:16};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength128=[];for(var f=o.messageLengthSize/4,u=0;u<f;++u)o.fullMessageLength.push(0);r=pe.util.createBuffer(),a=new Array(t.length);for(var u=0;u<t.length;++u)a[u]=t[u].slice(0);return o},o.start(),o.update=function(f,u){u==="utf8"&&(f=pe.util.encodeUtf8(f));var l=f.length;o.messageLength+=l,l=[l/4294967296>>>0,l>>>0];for(var c=o.fullMessageLength.length-1;c>=0;--c)o.fullMessageLength[c]+=l[1],l[1]=l[0]+(o.fullMessageLength[c]/4294967296>>>0),o.fullMessageLength[c]=o.fullMessageLength[c]>>>0,l[0]=l[1]/4294967296>>>0;return r.putBytes(f),to(a,i,r),(r.read>2048||r.length()===0)&&r.compact(),o},o.digest=function(){var f=pe.util.createBuffer();f.putBytes(r.bytes());var u=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,l=u&o.blockLength-1;f.putBytes(hi.substr(0,o.blockLength-l));for(var c,g,m=o.fullMessageLength[0]*8,y=0;y<o.fullMessageLength.length-1;++y)c=o.fullMessageLength[y+1]*8,g=c/4294967296>>>0,m+=g,f.putInt32(m>>>0),m=c>>>0;f.putInt32(m);for(var E=new Array(a.length),y=0;y<a.length;++y)E[y]=a[y].slice(0);to(E,i,f);var S=pe.util.createBuffer(),A;e==="SHA-512"?A=E.length:e==="SHA-384"?A=E.length-2:A=E.length-4;for(var y=0;y<A;++y)S.putInt32(E[y][0]),(y!==A-1||e!=="SHA-512/224")&&S.putInt32(E[y][1]);return S},o};var hi=null,ao=!1,gi=null,Wt=null;function Vl(){hi="\x80",hi+=pe.util.fillString("\0",128),gi=[[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]],Wt={},Wt["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],Wt["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],Wt["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],Wt["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],ao=!0}function to(e,t,a){for(var r,i,s,n,o,f,u,l,c,g,m,y,E,S,A,B,b,V,k,R,G,Y,ie,ne,ue,ce,He,Ze,se,ve,F,Kt,Jt,me,Ce,Se=a.length();Se>=128;){for(se=0;se<16;++se)t[se][0]=a.getInt32()>>>0,t[se][1]=a.getInt32()>>>0;for(;se<80;++se)Kt=t[se-2],ve=Kt[0],F=Kt[1],r=((ve>>>19|F<<13)^(F>>>29|ve<<3)^ve>>>6)>>>0,i=((ve<<13|F>>>19)^(F<<3|ve>>>29)^(ve<<26|F>>>6))>>>0,me=t[se-15],ve=me[0],F=me[1],s=((ve>>>1|F<<31)^(ve>>>8|F<<24)^ve>>>7)>>>0,n=((ve<<31|F>>>1)^(ve<<24|F>>>8)^(ve<<25|F>>>7))>>>0,Jt=t[se-7],Ce=t[se-16],F=i+Jt[1]+n+Ce[1],t[se][0]=r+Jt[0]+s+Ce[0]+(F/4294967296>>>0)>>>0,t[se][1]=F>>>0;for(E=e[0][0],S=e[0][1],A=e[1][0],B=e[1][1],b=e[2][0],V=e[2][1],k=e[3][0],R=e[3][1],G=e[4][0],Y=e[4][1],ie=e[5][0],ne=e[5][1],ue=e[6][0],ce=e[6][1],He=e[7][0],Ze=e[7][1],se=0;se<80;++se)u=((G>>>14|Y<<18)^(G>>>18|Y<<14)^(Y>>>9|G<<23))>>>0,l=((G<<18|Y>>>14)^(G<<14|Y>>>18)^(Y<<23|G>>>9))>>>0,c=(ue^G&(ie^ue))>>>0,g=(ce^Y&(ne^ce))>>>0,o=((E>>>28|S<<4)^(S>>>2|E<<30)^(S>>>7|E<<25))>>>0,f=((E<<4|S>>>28)^(S<<30|E>>>2)^(S<<25|E>>>7))>>>0,m=(E&A|b&(E^A))>>>0,y=(S&B|V&(S^B))>>>0,F=Ze+l+g+gi[se][1]+t[se][1],r=He+u+c+gi[se][0]+t[se][0]+(F/4294967296>>>0)>>>0,i=F>>>0,F=f+y,s=o+m+(F/4294967296>>>0)>>>0,n=F>>>0,He=ue,Ze=ce,ue=ie,ce=ne,ie=G,ne=Y,F=R+i,G=k+r+(F/4294967296>>>0)>>>0,Y=F>>>0,k=b,R=V,b=A,V=B,A=E,B=S,F=i+n,E=r+s+(F/4294967296>>>0)>>>0,S=F>>>0;F=e[0][1]+S,e[0][0]=e[0][0]+E+(F/4294967296>>>0)>>>0,e[0][1]=F>>>0,F=e[1][1]+B,e[1][0]=e[1][0]+A+(F/4294967296>>>0)>>>0,e[1][1]=F>>>0,F=e[2][1]+V,e[2][0]=e[2][0]+b+(F/4294967296>>>0)>>>0,e[2][1]=F>>>0,F=e[3][1]+R,e[3][0]=e[3][0]+k+(F/4294967296>>>0)>>>0,e[3][1]=F>>>0,F=e[4][1]+Y,e[4][0]=e[4][0]+G+(F/4294967296>>>0)>>>0,e[4][1]=F>>>0,F=e[5][1]+ne,e[5][0]=e[5][0]+ie+(F/4294967296>>>0)>>>0,e[5][1]=F>>>0,F=e[6][1]+ce,e[6][0]=e[6][0]+ue+(F/4294967296>>>0)>>>0,e[6][1]=F>>>0,F=e[7][1]+Ze,e[7][0]=e[7][0]+He+(F/4294967296>>>0)>>>0,e[7][1]=F>>>0,Se-=128}}});var no=j(vi=>{var Ol=Q();ut();var Be=Ol.asn1;vi.privateKeyValidator={name:"PrivateKeyInfo",tagClass:Be.Class.UNIVERSAL,type:Be.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:Be.Class.UNIVERSAL,type:Be.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:Be.Class.UNIVERSAL,type:Be.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Be.Class.UNIVERSAL,type:Be.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:Be.Class.UNIVERSAL,type:Be.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]};vi.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:Be.Class.UNIVERSAL,type:Be.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:Be.Class.UNIVERSAL,type:Be.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Be.Class.UNIVERSAL,type:Be.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:Be.Class.UNIVERSAL,type:Be.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}});var Co=j((Ad,mo)=>{var Ne=Q();Er();et();yi();re();var co=no(),Fl=co.publicKeyValidator,Kl=co.privateKeyValidator;typeof so>"u"&&(so=Ne.jsbn.BigInteger);var so,Ci=Ne.util.ByteBuffer,Xe=typeof Buffer>"u"?Uint8Array:Buffer;Ne.pki=Ne.pki||{};mo.exports=Ne.pki.ed25519=Ne.ed25519=Ne.ed25519||{};var $=Ne.ed25519;$.constants={};$.constants.PUBLIC_KEY_BYTE_LENGTH=32;$.constants.PRIVATE_KEY_BYTE_LENGTH=64;$.constants.SEED_BYTE_LENGTH=32;$.constants.SIGN_BYTE_LENGTH=64;$.constants.HASH_BYTE_LENGTH=64;$.generateKeyPair=function(e){e=e||{};var t=e.seed;if(t===void 0)t=Ne.random.getBytesSync($.constants.SEED_BYTE_LENGTH);else if(typeof t=="string"){if(t.length!==$.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+$.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(t instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');t=It({message:t,encoding:"binary"});for(var a=new Xe($.constants.PUBLIC_KEY_BYTE_LENGTH),r=new Xe($.constants.PRIVATE_KEY_BYTE_LENGTH),i=0;i<32;++i)r[i]=t[i];return Gl(a,r),{publicKey:a,privateKey:r}};$.privateKeyFromAsn1=function(e){var t={},a=[],r=Ne.asn1.validate(e,Kl,t,a);if(!r){var i=new Error("Invalid Key.");throw i.errors=a,i}var s=Ne.asn1.derToOid(t.privateKeyOid),n=Ne.oids.EdDSA25519;if(s!==n)throw new Error('Invalid OID "'+s+'"; OID must be "'+n+'".');var o=t.privateKey,f=It({message:Ne.asn1.fromDer(o).value,encoding:"binary"});return{privateKeyBytes:f}};$.publicKeyFromAsn1=function(e){var t={},a=[],r=Ne.asn1.validate(e,Fl,t,a);if(!r){var i=new Error("Invalid Key.");throw i.errors=a,i}var s=Ne.asn1.derToOid(t.publicKeyOid),n=Ne.oids.EdDSA25519;if(s!==n)throw new Error('Invalid OID "'+s+'"; OID must be "'+n+'".');var o=t.ed25519PublicKey;if(o.length!==$.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return It({message:o,encoding:"binary"})};$.publicKeyFromPrivateKey=function(e){e=e||{};var t=It({message:e.privateKey,encoding:"binary"});if(t.length!==$.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+$.constants.PRIVATE_KEY_BYTE_LENGTH);for(var a=new Xe($.constants.PUBLIC_KEY_BYTE_LENGTH),r=0;r<a.length;++r)a[r]=t[32+r];return a};$.sign=function(e){e=e||{};var t=It(e),a=It({message:e.privateKey,encoding:"binary"});if(a.length===$.constants.SEED_BYTE_LENGTH){var r=$.generateKeyPair({seed:a});a=r.privateKey}else if(a.length!==$.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+$.constants.SEED_BYTE_LENGTH+" or "+$.constants.PRIVATE_KEY_BYTE_LENGTH);var i=new Xe($.constants.SIGN_BYTE_LENGTH+t.length);jl(i,t,t.length,a);for(var s=new Xe($.constants.SIGN_BYTE_LENGTH),n=0;n<s.length;++n)s[n]=i[n];return s};$.verify=function(e){e=e||{};var t=It(e);if(e.signature===void 0)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var a=It({message:e.signature,encoding:"binary"});if(a.length!==$.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+$.constants.SIGN_BYTE_LENGTH);var r=It({message:e.publicKey,encoding:"binary"});if(r.length!==$.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+$.constants.PUBLIC_KEY_BYTE_LENGTH);var i=new Xe($.constants.SIGN_BYTE_LENGTH+t.length),s=new Xe($.constants.SIGN_BYTE_LENGTH+t.length),n;for(n=0;n<$.constants.SIGN_BYTE_LENGTH;++n)i[n]=a[n];for(n=0;n<t.length;++n)i[n+$.constants.SIGN_BYTE_LENGTH]=t[n];return zl(s,i,i.length,r)>=0};function It(e){var t=e.message;if(t instanceof Uint8Array||t instanceof Xe)return t;var a=e.encoding;if(t===void 0)if(e.md)t=e.md.digest().getBytes(),a="binary";else throw new TypeError('"options.message" or "options.md" not specified.');if(typeof t=="string"&&!a)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof t=="string"){if(typeof Buffer<"u")return Buffer.from(t,a);t=new Ci(t,a)}else if(!(t instanceof Ci))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 r=new Xe(t.length()),i=0;i<r.length;++i)r[i]=t.at(i);return r}var xi=M(),ua=M([1]),ql=M([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),Ml=M([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),oo=M([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),uo=M([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),Br=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]),Hl=M([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function br(e,t){var a=Ne.md.sha512.create(),r=new Ci(e);a.update(r.getBytes(t),"binary");var i=a.digest().getBytes();if(typeof Buffer<"u")return Buffer.from(i,"binary");for(var s=new Xe($.constants.HASH_BYTE_LENGTH),n=0;n<64;++n)s[n]=i.charCodeAt(n);return s}function Gl(e,t){var a=[M(),M(),M(),M()],r,i=br(t,32);for(i[0]&=248,i[31]&=127,i[31]|=64,Ai(a,i),Ti(e,a),r=0;r<32;++r)t[r+32]=e[r];return 0}function jl(e,t,a,r){var i,s,n=new Float64Array(64),o=[M(),M(),M(),M()],f=br(r,32);f[0]&=248,f[31]&=127,f[31]|=64;var u=a+64;for(i=0;i<a;++i)e[64+i]=t[i];for(i=0;i<32;++i)e[32+i]=f[32+i];var l=br(e.subarray(32),a+32);for(Ei(l),Ai(o,l),Ti(e,o),i=32;i<64;++i)e[i]=r[i];var c=br(e,a+64);for(Ei(c),i=32;i<64;++i)n[i]=0;for(i=0;i<32;++i)n[i]=l[i];for(i=0;i<32;++i)for(s=0;s<32;s++)n[i+s]+=c[i]*f[s];return po(e.subarray(32),n),u}function zl(e,t,a,r){var i,s,n=new Xe(32),o=[M(),M(),M(),M()],f=[M(),M(),M(),M()];if(s=-1,a<64||Yl(f,r)||!Ql(t,32))return-1;for(i=0;i<a;++i)e[i]=t[i];for(i=0;i<32;++i)e[i+32]=r[i];var u=br(e,a);if(Ei(u),yo(o,f,u),Ai(f,t.subarray(32)),Si(o,f),Ti(n,o),a-=64,ho(t,0,n,0)){for(i=0;i<a;++i)e[i]=0;return-1}for(i=0;i<a;++i)e[i]=t[i+64];return s=a,s}function Ql(e,t){var a;for(a=31;a>=0;--a){if(e[t+a]<Br[a])return!0;if(e[t+a]>Br[a])return!1}return!1}function po(e,t){var a,r,i,s;for(r=63;r>=32;--r){for(a=0,i=r-32,s=r-12;i<s;++i)t[i]+=a-16*t[r]*Br[i-(r-32)],a=t[i]+128>>8,t[i]-=a*256;t[i]+=a,t[r]=0}for(a=0,i=0;i<32;++i)t[i]+=a-(t[31]>>4)*Br[i],a=t[i]>>8,t[i]&=255;for(i=0;i<32;++i)t[i]-=a*Br[i];for(r=0;r<32;++r)t[r+1]+=t[r]>>8,e[r]=t[r]&255}function Ei(e){for(var t=new Float64Array(64),a=0;a<64;++a)t[a]=e[a],e[a]=0;po(e,t)}function Si(e,t){var a=M(),r=M(),i=M(),s=M(),n=M(),o=M(),f=M(),u=M(),l=M();dr(a,e[1],e[0]),dr(l,t[1],t[0]),oe(a,a,l),cr(r,e[0],e[1]),cr(l,t[0],t[1]),oe(r,r,l),oe(i,e[3],t[3]),oe(i,i,Ml),oe(s,e[2],t[2]),cr(s,s,s),dr(n,r,a),dr(o,s,i),cr(f,s,i),cr(u,r,a),oe(e[0],n,o),oe(e[1],u,f),oe(e[2],f,o),oe(e[3],n,u)}function fo(e,t,a){for(var r=0;r<4;++r)vo(e[r],t[r],a)}function Ti(e,t){var a=M(),r=M(),i=M();Jl(i,t[2]),oe(a,t[0],i),oe(r,t[1],i),fa(e,r),e[31]^=go(a)<<7}function fa(e,t){var a,r,i,s=M(),n=M();for(a=0;a<16;++a)n[a]=t[a];for(mi(n),mi(n),mi(n),r=0;r<2;++r){for(s[0]=n[0]-65517,a=1;a<15;++a)s[a]=n[a]-65535-(s[a-1]>>16&1),s[a-1]&=65535;s[15]=n[15]-32767-(s[14]>>16&1),i=s[15]>>16&1,s[14]&=65535,vo(n,s,1-i)}for(a=0;a<16;a++)e[2*a]=n[a]&255,e[2*a+1]=n[a]>>8}function Yl(e,t){var a=M(),r=M(),i=M(),s=M(),n=M(),o=M(),f=M();return Ft(e[2],ua),Wl(e[1],t),Xt(i,e[1]),oe(s,i,ql),dr(i,i,e[2]),cr(s,e[2],s),Xt(n,s),Xt(o,n),oe(f,o,n),oe(a,f,i),oe(a,a,s),Xl(a,a),oe(a,a,i),oe(a,a,s),oe(a,a,s),oe(e[0],a,s),Xt(r,e[0]),oe(r,r,s),lo(r,i)&&oe(e[0],e[0],Hl),Xt(r,e[0]),oe(r,r,s),lo(r,i)?-1:(go(e[0])===t[31]>>7&&dr(e[0],xi,e[0]),oe(e[3],e[0],e[1]),0)}function Wl(e,t){var a;for(a=0;a<16;++a)e[a]=t[2*a]+(t[2*a+1]<<8);e[15]&=32767}function Xl(e,t){var a=M(),r;for(r=0;r<16;++r)a[r]=t[r];for(r=250;r>=0;--r)Xt(a,a),r!==1&&oe(a,a,t);for(r=0;r<16;++r)e[r]=a[r]}function lo(e,t){var a=new Xe(32),r=new Xe(32);return fa(a,e),fa(r,t),ho(a,0,r,0)}function ho(e,t,a,r){return $l(e,t,a,r,32)}function $l(e,t,a,r,i){var s,n=0;for(s=0;s<i;++s)n|=e[t+s]^a[r+s];return(1&n-1>>>8)-1}function go(e){var t=new Xe(32);return fa(t,e),t[0]&1}function yo(e,t,a){var r,i;for(Ft(e[0],xi),Ft(e[1],ua),Ft(e[2],ua),Ft(e[3],xi),i=255;i>=0;--i)r=a[i/8|0]>>(i&7)&1,fo(e,t,r),Si(t,e),Si(e,e),fo(e,t,r)}function Ai(e,t){var a=[M(),M(),M(),M()];Ft(a[0],oo),Ft(a[1],uo),Ft(a[2],ua),oe(a[3],oo,uo),yo(e,a,t)}function Ft(e,t){var a;for(a=0;a<16;a++)e[a]=t[a]|0}function Jl(e,t){var a=M(),r;for(r=0;r<16;++r)a[r]=t[r];for(r=253;r>=0;--r)Xt(a,a),r!==2&&r!==4&&oe(a,a,t);for(r=0;r<16;++r)e[r]=a[r]}function mi(e){var t,a,r=1;for(t=0;t<16;++t)a=e[t]+r+65535,r=Math.floor(a/65536),e[t]=a-r*65536;e[0]+=r-1+37*(r-1)}function vo(e,t,a){for(var r,i=~(a-1),s=0;s<16;++s)r=i&(e[s]^t[s]),e[s]^=r,t[s]^=r}function M(e){var t,a=new Float64Array(16);if(e)for(t=0;t<e.length;++t)a[t]=e[t];return a}function cr(e,t,a){for(var r=0;r<16;++r)e[r]=t[r]+a[r]}function dr(e,t,a){for(var r=0;r<16;++r)e[r]=t[r]-a[r]}function Xt(e,t){oe(e,t,t)}function oe(e,t,a){var r,i,s=0,n=0,o=0,f=0,u=0,l=0,c=0,g=0,m=0,y=0,E=0,S=0,A=0,B=0,b=0,V=0,k=0,R=0,G=0,Y=0,ie=0,ne=0,ue=0,ce=0,He=0,Ze=0,se=0,ve=0,F=0,Kt=0,Jt=0,me=a[0],Ce=a[1],Se=a[2],we=a[3],Re=a[4],Le=a[5],ke=a[6],De=a[7],Ue=a[8],Pe=a[9],Ve=a[10],Oe=a[11],Fe=a[12],Ke=a[13],qe=a[14],Me=a[15];r=t[0],s+=r*me,n+=r*Ce,o+=r*Se,f+=r*we,u+=r*Re,l+=r*Le,c+=r*ke,g+=r*De,m+=r*Ue,y+=r*Pe,E+=r*Ve,S+=r*Oe,A+=r*Fe,B+=r*Ke,b+=r*qe,V+=r*Me,r=t[1],n+=r*me,o+=r*Ce,f+=r*Se,u+=r*we,l+=r*Re,c+=r*Le,g+=r*ke,m+=r*De,y+=r*Ue,E+=r*Pe,S+=r*Ve,A+=r*Oe,B+=r*Fe,b+=r*Ke,V+=r*qe,k+=r*Me,r=t[2],o+=r*me,f+=r*Ce,u+=r*Se,l+=r*we,c+=r*Re,g+=r*Le,m+=r*ke,y+=r*De,E+=r*Ue,S+=r*Pe,A+=r*Ve,B+=r*Oe,b+=r*Fe,V+=r*Ke,k+=r*qe,R+=r*Me,r=t[3],f+=r*me,u+=r*Ce,l+=r*Se,c+=r*we,g+=r*Re,m+=r*Le,y+=r*ke,E+=r*De,S+=r*Ue,A+=r*Pe,B+=r*Ve,b+=r*Oe,V+=r*Fe,k+=r*Ke,R+=r*qe,G+=r*Me,r=t[4],u+=r*me,l+=r*Ce,c+=r*Se,g+=r*we,m+=r*Re,y+=r*Le,E+=r*ke,S+=r*De,A+=r*Ue,B+=r*Pe,b+=r*Ve,V+=r*Oe,k+=r*Fe,R+=r*Ke,G+=r*qe,Y+=r*Me,r=t[5],l+=r*me,c+=r*Ce,g+=r*Se,m+=r*we,y+=r*Re,E+=r*Le,S+=r*ke,A+=r*De,B+=r*Ue,b+=r*Pe,V+=r*Ve,k+=r*Oe,R+=r*Fe,G+=r*Ke,Y+=r*qe,ie+=r*Me,r=t[6],c+=r*me,g+=r*Ce,m+=r*Se,y+=r*we,E+=r*Re,S+=r*Le,A+=r*ke,B+=r*De,b+=r*Ue,V+=r*Pe,k+=r*Ve,R+=r*Oe,G+=r*Fe,Y+=r*Ke,ie+=r*qe,ne+=r*Me,r=t[7],g+=r*me,m+=r*Ce,y+=r*Se,E+=r*we,S+=r*Re,A+=r*Le,B+=r*ke,b+=r*De,V+=r*Ue,k+=r*Pe,R+=r*Ve,G+=r*Oe,Y+=r*Fe,ie+=r*Ke,ne+=r*qe,ue+=r*Me,r=t[8],m+=r*me,y+=r*Ce,E+=r*Se,S+=r*we,A+=r*Re,B+=r*Le,b+=r*ke,V+=r*De,k+=r*Ue,R+=r*Pe,G+=r*Ve,Y+=r*Oe,ie+=r*Fe,ne+=r*Ke,ue+=r*qe,ce+=r*Me,r=t[9],y+=r*me,E+=r*Ce,S+=r*Se,A+=r*we,B+=r*Re,b+=r*Le,V+=r*ke,k+=r*De,R+=r*Ue,G+=r*Pe,Y+=r*Ve,ie+=r*Oe,ne+=r*Fe,ue+=r*Ke,ce+=r*qe,He+=r*Me,r=t[10],E+=r*me,S+=r*Ce,A+=r*Se,B+=r*we,b+=r*Re,V+=r*Le,k+=r*ke,R+=r*De,G+=r*Ue,Y+=r*Pe,ie+=r*Ve,ne+=r*Oe,ue+=r*Fe,ce+=r*Ke,He+=r*qe,Ze+=r*Me,r=t[11],S+=r*me,A+=r*Ce,B+=r*Se,b+=r*we,V+=r*Re,k+=r*Le,R+=r*ke,G+=r*De,Y+=r*Ue,ie+=r*Pe,ne+=r*Ve,ue+=r*Oe,ce+=r*Fe,He+=r*Ke,Ze+=r*qe,se+=r*Me,r=t[12],A+=r*me,B+=r*Ce,b+=r*Se,V+=r*we,k+=r*Re,R+=r*Le,G+=r*ke,Y+=r*De,ie+=r*Ue,ne+=r*Pe,ue+=r*Ve,ce+=r*Oe,He+=r*Fe,Ze+=r*Ke,se+=r*qe,ve+=r*Me,r=t[13],B+=r*me,b+=r*Ce,V+=r*Se,k+=r*we,R+=r*Re,G+=r*Le,Y+=r*ke,ie+=r*De,ne+=r*Ue,ue+=r*Pe,ce+=r*Ve,He+=r*Oe,Ze+=r*Fe,se+=r*Ke,ve+=r*qe,F+=r*Me,r=t[14],b+=r*me,V+=r*Ce,k+=r*Se,R+=r*we,G+=r*Re,Y+=r*Le,ie+=r*ke,ne+=r*De,ue+=r*Ue,ce+=r*Pe,He+=r*Ve,Ze+=r*Oe,se+=r*Fe,ve+=r*Ke,F+=r*qe,Kt+=r*Me,r=t[15],V+=r*me,k+=r*Ce,R+=r*Se,G+=r*we,Y+=r*Re,ie+=r*Le,ne+=r*ke,ue+=r*De,ce+=r*Ue,He+=r*Pe,Ze+=r*Ve,se+=r*Oe,ve+=r*Fe,F+=r*Ke,Kt+=r*qe,Jt+=r*Me,s+=38*k,n+=38*R,o+=38*G,f+=38*Y,u+=38*ie,l+=38*ne,c+=38*ue,g+=38*ce,m+=38*He,y+=38*Ze,E+=38*se,S+=38*ve,A+=38*F,B+=38*Kt,b+=38*Jt,i=1,r=s+i+65535,i=Math.floor(r/65536),s=r-i*65536,r=n+i+65535,i=Math.floor(r/65536),n=r-i*65536,r=o+i+65535,i=Math.floor(r/65536),o=r-i*65536,r=f+i+65535,i=Math.floor(r/65536),f=r-i*65536,r=u+i+65535,i=Math.floor(r/65536),u=r-i*65536,r=l+i+65535,i=Math.floor(r/65536),l=r-i*65536,r=c+i+65535,i=Math.floor(r/65536),c=r-i*65536,r=g+i+65535,i=Math.floor(r/65536),g=r-i*65536,r=m+i+65535,i=Math.floor(r/65536),m=r-i*65536,r=y+i+65535,i=Math.floor(r/65536),y=r-i*65536,r=E+i+65535,i=Math.floor(r/65536),E=r-i*65536,r=S+i+65535,i=Math.floor(r/65536),S=r-i*65536,r=A+i+65535,i=Math.floor(r/65536),A=r-i*65536,r=B+i+65535,i=Math.floor(r/65536),B=r-i*65536,r=b+i+65535,i=Math.floor(r/65536),b=r-i*65536,r=V+i+65535,i=Math.floor(r/65536),V=r-i*65536,s+=i-1+37*(i-1),i=1,r=s+i+65535,i=Math.floor(r/65536),s=r-i*65536,r=n+i+65535,i=Math.floor(r/65536),n=r-i*65536,r=o+i+65535,i=Math.floor(r/65536),o=r-i*65536,r=f+i+65535,i=Math.floor(r/65536),f=r-i*65536,r=u+i+65535,i=Math.floor(r/65536),u=r-i*65536,r=l+i+65535,i=Math.floor(r/65536),l=r-i*65536,r=c+i+65535,i=Math.floor(r/65536),c=r-i*65536,r=g+i+65535,i=Math.floor(r/65536),g=r-i*65536,r=m+i+65535,i=Math.floor(r/65536),m=r-i*65536,r=y+i+65535,i=Math.floor(r/65536),y=r-i*65536,r=E+i+65535,i=Math.floor(r/65536),E=r-i*65536,r=S+i+65535,i=Math.floor(r/65536),S=r-i*65536,r=A+i+65535,i=Math.floor(r/65536),A=r-i*65536,r=B+i+65535,i=Math.floor(r/65536),B=r-i*65536,r=b+i+65535,i=Math.floor(r/65536),b=r-i*65536,r=V+i+65535,i=Math.floor(r/65536),V=r-i*65536,s+=i-1+37*(i-1),e[0]=s,e[1]=n,e[2]=o,e[3]=f,e[4]=u,e[5]=l,e[6]=c,e[7]=g,e[8]=m,e[9]=y,e[10]=E,e[11]=S,e[12]=A,e[13]=B,e[14]=b,e[15]=V}});var To=j((Id,So)=>{var Je=Q();re();et();Er();So.exports=Je.kem=Je.kem||{};var xo=Je.jsbn.BigInteger;Je.kem.rsa={};Je.kem.rsa.create=function(e,t){t=t||{};var a=t.prng||Je.random,r={};return r.encrypt=function(i,s){var n=Math.ceil(i.n.bitLength()/8),o;do o=new xo(Je.util.bytesToHex(a.getBytesSync(n)),16).mod(i.n);while(o.compareTo(xo.ONE)<=0);o=Je.util.hexToBytes(o.toString(16));var f=n-o.length;f>0&&(o=Je.util.fillString("\0",f)+o);var u=i.encrypt(o,"NONE"),l=e.generate(o,s);return{encapsulation:u,key:l}},r.decrypt=function(i,s,n){var o=i.decrypt(s,"NONE");return e.generate(o,n)},r};Je.kem.kdf1=function(e,t){Eo(this,e,0,t||e.digestLength)};Je.kem.kdf2=function(e,t){Eo(this,e,1,t||e.digestLength)};function Eo(e,t,a,r){e.generate=function(i,s){for(var n=new Je.util.ByteBuffer,o=Math.ceil(s/r)+a,f=new Je.util.ByteBuffer,u=a;u<o;++u){f.putInt32(u),t.start(),t.update(i+f.getBytes());var l=t.digest();n.putBytes(l.getBytes(r))}return n.truncate(n.length()-s),n.getBytes()}}});var bo=j((Bd,Bo)=>{var J=Q();re();Bo.exports=J.log=J.log||{};J.log.levels=["none","error","warning","info","debug","verbose","max"];var la={},bi=[],Nr=null;J.log.LEVEL_LOCKED=2;J.log.NO_LEVEL_CHECK=4;J.log.INTERPOLATE=8;for(mt=0;mt<J.log.levels.length;++mt)Ii=J.log.levels[mt],la[Ii]={index:mt,name:Ii.toUpperCase()};var Ii,mt;J.log.logMessage=function(e){for(var t=la[e.level].index,a=0;a<bi.length;++a){var r=bi[a];if(r.flags&J.log.NO_LEVEL_CHECK)r.f(e);else{var i=la[r.level].index;t<=i&&r.f(r,e)}}};J.log.prepareStandard=function(e){"standard"in e||(e.standard=la[e.level].name+" ["+e.category+"] "+e.message)};J.log.prepareFull=function(e){if(!("full"in e)){var t=[e.message];t=t.concat([]),e.full=J.util.format.apply(this,t)}};J.log.prepareStandardFull=function(e){"standardFull"in e||(J.log.prepareStandard(e),e.standardFull=e.standard)};for(Bi=["error","warning","info","debug","verbose"],mt=0;mt<Bi.length;++mt)(function(t){J.log[t]=function(a,r){var i=Array.prototype.slice.call(arguments).slice(2),s={timestamp:new Date,level:t,category:a,message:r,arguments:i};J.log.logMessage(s)}})(Bi[mt]);var Bi,mt;J.log.makeLogger=function(e){var t={flags:0,f:e};return J.log.setLevel(t,"none"),t};J.log.setLevel=function(e,t){var a=!1;if(e&&!(e.flags&J.log.LEVEL_LOCKED))for(var r=0;r<J.log.levels.length;++r){var i=J.log.levels[r];if(t==i){e.level=t,a=!0;break}}return a};J.log.lock=function(e,t){typeof t>"u"||t?e.flags|=J.log.LEVEL_LOCKED:e.flags&=~J.log.LEVEL_LOCKED};J.log.addLogger=function(e){bi.push(e)};typeof console<"u"&&"log"in console?(console.error&&console.warn&&console.info&&console.debug?(Ao={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},wr=function(e,t){J.log.prepareStandard(t);var a=Ao[t.level],r=[t.standard];r=r.concat(t.arguments.slice()),a.apply(console,r)},pr=J.log.makeLogger(wr)):(wr=function(t,a){J.log.prepareStandardFull(a),console.log(a.standardFull)},pr=J.log.makeLogger(wr)),J.log.setLevel(pr,"debug"),J.log.addLogger(pr),Nr=pr):console={log:function(){}};var pr,Ao,wr;Nr!==null&&typeof window<"u"&&window.location&&(_r=new URL(window.location.href).searchParams,_r.has("console.level")&&J.log.setLevel(Nr,_r.get("console.level").slice(-1)[0]),_r.has("console.lock")&&(Io=_r.get("console.lock").slice(-1)[0],Io=="true"&&J.log.lock(Nr)));var _r,Io;J.log.consoleLogger=Nr});var No=j((bd,_o)=>{_o.exports=lt();Hr();sr();qa();yi()});var Lo=j((_d,Ro)=>{var D=Q();Rt();ut();Cr();Lt();Ht();ti();et();re();aa();var C=D.asn1,Qe=Ro.exports=D.pkcs7=D.pkcs7||{};Qe.messageFromPem=function(e){var t=D.pem.decode(e)[0];if(t.type!=="PKCS7"){var a=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var r=C.fromDer(t.body);return Qe.messageFromAsn1(r)};Qe.messageToPem=function(e,t){var a={type:"PKCS7",body:C.toDer(e.toAsn1()).getBytes()};return D.pem.encode(a,{maxline:t})};Qe.messageFromAsn1=function(e){var t={},a=[];if(!C.validate(e,Qe.asn1.contentInfoValidator,t,a)){var r=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw r.errors=a,r}var i=C.derToOid(t.contentType),s;switch(i){case D.pki.oids.envelopedData:s=Qe.createEnvelopedData();break;case D.pki.oids.encryptedData:s=Qe.createEncryptedData();break;case D.pki.oids.signedData:s=Qe.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+i+" is not (yet) supported.")}return s.fromAsn1(t.content.value[0]),s};Qe.createSignedData=function(){var e=null;return e={type:D.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(r){if(Ni(e,r,Qe.asn1.signedDataValidator),e.certificates=[],e.crls=[],e.digestAlgorithmIdentifiers=[],e.contentInfo=null,e.signerInfos=[],e.rawCapture.certificates)for(var i=e.rawCapture.certificates.value,s=0;s<i.length;++s)e.certificates.push(D.pki.certificateFromAsn1(i[s]))},toAsn1:function(){e.contentInfo||e.sign();for(var r=[],i=0;i<e.certificates.length;++i)r.push(D.pki.certificateToAsn1(e.certificates[i]));var s=[],n=C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,C.integerToDer(e.version).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SET,!0,e.digestAlgorithmIdentifiers),e.contentInfo])]);return r.length>0&&n.value[0].value.push(C.create(C.Class.CONTEXT_SPECIFIC,0,!0,r)),s.length>0&&n.value[0].value.push(C.create(C.Class.CONTEXT_SPECIFIC,1,!0,s)),n.value[0].value.push(C.create(C.Class.UNIVERSAL,C.Type.SET,!0,e.signerInfos)),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.type).getBytes()),n])},addSigner:function(r){var i=r.issuer,s=r.serialNumber;if(r.certificate){var n=r.certificate;typeof n=="string"&&(n=D.pki.certificateFromPem(n)),i=n.issuer.attributes,s=n.serialNumber}var o=r.key;if(!o)throw new Error("Could not add PKCS#7 signer; no private key specified.");typeof o=="string"&&(o=D.pki.privateKeyFromPem(o));var f=r.digestAlgorithm||D.pki.oids.sha1;switch(f){case D.pki.oids.sha1:case D.pki.oids.sha256:case D.pki.oids.sha384:case D.pki.oids.sha512:case D.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+f)}var u=r.authenticatedAttributes||[];if(u.length>0){for(var l=!1,c=!1,g=0;g<u.length;++g){var m=u[g];if(!l&&m.type===D.pki.oids.contentType){if(l=!0,c)break;continue}if(!c&&m.type===D.pki.oids.messageDigest){if(c=!0,l)break;continue}}if(!l||!c)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.")}e.signers.push({key:o,version:1,issuer:i,serialNumber:s,digestAlgorithm:f,signatureAlgorithm:D.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:u,unauthenticatedAttributes:[]})},sign:function(r){if(r=r||{},(typeof e.content!="object"||e.contentInfo===null)&&(e.contentInfo=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(D.pki.oids.data).getBytes())]),"content"in e)){var i;e.content instanceof D.util.ByteBuffer?i=e.content.bytes():typeof e.content=="string"&&(i=D.util.encodeUtf8(e.content)),r.detached?e.detachedContent=C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,i):e.contentInfo.value.push(C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,i)]))}if(e.signers.length!==0){var s=t();a(s)}},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(r){typeof r=="string"&&(r=D.pki.certificateFromPem(r)),e.certificates.push(r)},addCertificateRevokationList:function(r){throw new Error("PKCS#7 CRL support not yet implemented.")}},e;function t(){for(var r={},i=0;i<e.signers.length;++i){var s=e.signers[i],n=s.digestAlgorithm;n in r||(r[n]=D.md[D.pki.oids[n]].create()),s.authenticatedAttributes.length===0?s.md=r[n]:s.md=D.md[D.pki.oids[n]].create()}e.digestAlgorithmIdentifiers=[];for(var n in r)e.digestAlgorithmIdentifiers.push(C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(n).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.NULL,!1,"")]));return r}function a(r){var i;if(e.detachedContent?i=e.detachedContent:(i=e.contentInfo.value[1],i=i.value[0]),!i)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var s=C.derToOid(e.contentInfo.value[0].value),n=C.toDer(i);n.getByte(),C.getBerValueLength(n),n=n.getBytes();for(var o in r)r[o].start().update(n);for(var f=new Date,u=0;u<e.signers.length;++u){var l=e.signers[u];if(l.authenticatedAttributes.length===0){if(s!==D.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{l.authenticatedAttributesAsn1=C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var c=C.create(C.Class.UNIVERSAL,C.Type.SET,!0,[]),g=0;g<l.authenticatedAttributes.length;++g){var m=l.authenticatedAttributes[g];m.type===D.pki.oids.messageDigest?m.value=r[l.digestAlgorithm].digest():m.type===D.pki.oids.signingTime&&(m.value||(m.value=f)),c.value.push(_i(m)),l.authenticatedAttributesAsn1.value.push(_i(m))}n=C.toDer(c).getBytes(),l.md.start().update(n)}l.signature=l.key.sign(l.md,"RSASSA-PKCS1-V1_5")}e.signerInfos=ic(e.signers)}};Qe.createEncryptedData=function(){var e=null;return e={type:D.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:D.pki.oids["aes256-CBC"]},fromAsn1:function(t){Ni(e,t,Qe.asn1.encryptedDataValidator)},decrypt:function(t){t!==void 0&&(e.encryptedContent.key=t),wo(e)}},e};Qe.createEnvelopedData=function(){var e=null;return e={type:D.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:D.pki.oids["aes256-CBC"]},fromAsn1:function(t){var a=Ni(e,t,Qe.asn1.envelopedDataValidator);e.recipients=tc(a.recipientInfos.value)},toAsn1:function(){return C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.type).getBytes()),C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,C.integerToDer(e.version).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SET,!0,rc(e.recipients)),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,nc(e.encryptedContent))])])])},findRecipient:function(t){for(var a=t.issuer.attributes,r=0;r<e.recipients.length;++r){var i=e.recipients[r],s=i.issuer;if(i.serialNumber===t.serialNumber&&s.length===a.length){for(var n=!0,o=0;o<a.length;++o)if(s[o].type!==a[o].type||s[o].value!==a[o].value){n=!1;break}if(n)return i}}return null},decrypt:function(t,a){if(e.encryptedContent.key===void 0&&t!==void 0&&a!==void 0)switch(t.encryptedContent.algorithm){case D.pki.oids.rsaEncryption:case D.pki.oids.desCBC:var r=a.decrypt(t.encryptedContent.content);e.encryptedContent.key=D.util.createBuffer(r);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}wo(e)},addRecipient:function(t){e.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:D.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,a){if(e.encryptedContent.content===void 0){a=a||e.encryptedContent.algorithm,t=t||e.encryptedContent.key;var r,i,s;switch(a){case D.pki.oids["aes128-CBC"]:r=16,i=16,s=D.aes.createEncryptionCipher;break;case D.pki.oids["aes192-CBC"]:r=24,i=16,s=D.aes.createEncryptionCipher;break;case D.pki.oids["aes256-CBC"]:r=32,i=16,s=D.aes.createEncryptionCipher;break;case D.pki.oids["des-EDE3-CBC"]:r=24,i=8,s=D.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+a)}if(t===void 0)t=D.util.createBuffer(D.random.getBytes(r));else if(t.length()!=r)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+r+".");e.encryptedContent.algorithm=a,e.encryptedContent.key=t,e.encryptedContent.parameter=D.util.createBuffer(D.random.getBytes(i));var n=s(t);if(n.start(e.encryptedContent.parameter.copy()),n.update(e.content),!n.finish())throw new Error("Symmetric encryption failed.");e.encryptedContent.content=n.output}for(var o=0;o<e.recipients.length;++o){var f=e.recipients[o];if(f.encryptedContent.content===void 0)if(f.encryptedContent.algorithm===D.pki.oids.rsaEncryption)f.encryptedContent.content=f.encryptedContent.key.encrypt(e.encryptedContent.key.data);else throw new Error("Unsupported asymmetric cipher, OID "+f.encryptedContent.algorithm)}}},e};function Zl(e){var t={},a=[];if(!C.validate(e,Qe.asn1.recipientInfoValidator,t,a)){var r=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw r.errors=a,r}return{version:t.version.charCodeAt(0),issuer:D.pki.RDNAttributesAsArray(t.issuer),serialNumber:D.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:C.derToOid(t.encAlgorithm),parameter:t.encParameter?t.encParameter.value:void 0,content:t.encKey}}}function ec(e){return C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,C.integerToDer(e.version).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[D.pki.distinguishedNameToAsn1({attributes:e.issuer}),C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,D.util.hexToBytes(e.serialNumber))]),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.encryptedContent.algorithm).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.NULL,!1,"")]),C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,e.encryptedContent.content)])}function tc(e){for(var t=[],a=0;a<e.length;++a)t.push(Zl(e[a]));return t}function rc(e){for(var t=[],a=0;a<e.length;++a)t.push(ec(e[a]));return t}function ac(e){var t=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,C.integerToDer(e.version).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[D.pki.distinguishedNameToAsn1({attributes:e.issuer}),C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,D.util.hexToBytes(e.serialNumber))]),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.digestAlgorithm).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.NULL,!1,"")])]);if(e.authenticatedAttributesAsn1&&t.value.push(e.authenticatedAttributesAsn1),t.value.push(C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.signatureAlgorithm).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.NULL,!1,"")])),t.value.push(C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,e.signature)),e.unauthenticatedAttributes.length>0){for(var a=C.create(C.Class.CONTEXT_SPECIFIC,1,!0,[]),r=0;r<e.unauthenticatedAttributes.length;++r){var i=e.unauthenticatedAttributes[r];a.values.push(_i(i))}t.value.push(a)}return t}function ic(e){for(var t=[],a=0;a<e.length;++a)t.push(ac(e[a]));return t}function _i(e){var t;if(e.type===D.pki.oids.contentType)t=C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.value).getBytes());else if(e.type===D.pki.oids.messageDigest)t=C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,e.value.bytes());else if(e.type===D.pki.oids.signingTime){var a=new Date("1950-01-01T00:00:00Z"),r=new Date("2050-01-01T00:00:00Z"),i=e.value;if(typeof i=="string"){var s=Date.parse(i);isNaN(s)?i.length===13?i=C.utcTimeToDate(i):i=C.generalizedTimeToDate(i):i=new Date(s)}i>=a&&i<r?t=C.create(C.Class.UNIVERSAL,C.Type.UTCTIME,!1,C.dateToUtcTime(i)):t=C.create(C.Class.UNIVERSAL,C.Type.GENERALIZEDTIME,!1,C.dateToGeneralizedTime(i))}return C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.type).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SET,!0,[t])])}function nc(e){return[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(D.pki.oids.data).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(e.algorithm).getBytes()),e.parameter?C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,e.parameter.getBytes()):void 0]),C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,e.content.getBytes())])]}function Ni(e,t,a){var r={},i=[];if(!C.validate(t,a,r,i)){var s=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw s.errors=s,s}var n=C.derToOid(r.contentType);if(n!==D.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(r.encryptedContent){var o="";if(D.util.isArray(r.encryptedContent))for(var f=0;f<r.encryptedContent.length;++f){if(r.encryptedContent[f].type!==C.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");o+=r.encryptedContent[f].value}else o=r.encryptedContent;e.encryptedContent={algorithm:C.derToOid(r.encAlgorithm),parameter:D.util.createBuffer(r.encParameter.value),content:D.util.createBuffer(o)}}if(r.content){var o="";if(D.util.isArray(r.content))for(var f=0;f<r.content.length;++f){if(r.content[f].type!==C.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");o+=r.content[f].value}else o=r.content;e.content=D.util.createBuffer(o)}return e.version=r.version.charCodeAt(0),e.rawCapture=r,r}function wo(e){if(e.encryptedContent.key===void 0)throw new Error("Symmetric key not available.");if(e.content===void 0){var t;switch(e.encryptedContent.algorithm){case D.pki.oids["aes128-CBC"]:case D.pki.oids["aes192-CBC"]:case D.pki.oids["aes256-CBC"]:t=D.aes.createDecryptionCipher(e.encryptedContent.key);break;case D.pki.oids.desCBC:case D.pki.oids["des-EDE3-CBC"]:t=D.des.createDecryptionCipher(e.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+e.encryptedContent.algorithm)}if(t.start(e.encryptedContent.parameter),t.update(e.encryptedContent.content),!t.finish())throw new Error("Symmetric decryption failed.");e.content=t.output}}});var Do=j((Nd,ko)=>{var Ee=Q();Rt();rr();Hr();sr();re();var da=ko.exports=Ee.ssh=Ee.ssh||{};da.privateKeyToPutty=function(e,t,a){a=a||"",t=t||"";var r="ssh-rsa",i=t===""?"none":"aes256-cbc",s="PuTTY-User-Key-File-2: "+r+`\r
`;s+="Encryption: "+i+`\r
`,s+="Comment: "+a+`\r
`;var n=Ee.util.createBuffer();hr(n,r),Ct(n,e.e),Ct(n,e.n);var o=Ee.util.encode64(n.bytes(),64),f=Math.floor(o.length/66)+1;s+="Public-Lines: "+f+`\r
`,s+=o;var u=Ee.util.createBuffer();Ct(u,e.d),Ct(u,e.p),Ct(u,e.q),Ct(u,e.qInv);var l;if(!t)l=Ee.util.encode64(u.bytes(),64);else{var c=u.length()+16-1;c-=c%16;var g=ca(u.bytes());g.truncate(g.length()-c+u.length()),u.putBuffer(g);var m=Ee.util.createBuffer();m.putBuffer(ca("\0\0\0\0",t)),m.putBuffer(ca("\0\0\0",t));var y=Ee.aes.createEncryptionCipher(m.truncate(8),"CBC");y.start(Ee.util.createBuffer().fillWithByte(0,16)),y.update(u.copy()),y.finish();var E=y.output;E.truncate(16),l=Ee.util.encode64(E.bytes(),64)}f=Math.floor(l.length/66)+1,s+=`\r
Private-Lines: `+f+`\r
`,s+=l;var S=ca("putty-private-key-file-mac-key",t),A=Ee.util.createBuffer();hr(A,r),hr(A,i),hr(A,a),A.putInt32(n.length()),A.putBuffer(n),A.putInt32(u.length()),A.putBuffer(u);var B=Ee.hmac.create();return B.start("sha1",S),B.update(A.bytes()),s+=`\r
Private-MAC: `+B.digest().toHex()+`\r
`,s};da.publicKeyToOpenSSH=function(e,t){var a="ssh-rsa";t=t||"";var r=Ee.util.createBuffer();return hr(r,a),Ct(r,e.e),Ct(r,e.n),a+" "+Ee.util.encode64(r.bytes())+" "+t};da.privateKeyToOpenSSH=function(e,t){return t?Ee.pki.encryptRsaPrivateKey(e,t,{legacy:!0,algorithm:"aes128"}):Ee.pki.privateKeyToPem(e)};da.getPublicKeyFingerprint=function(e,t){t=t||{};var a=t.md||Ee.md.md5.create(),r="ssh-rsa",i=Ee.util.createBuffer();hr(i,r),Ct(i,e.e),Ct(i,e.n),a.start(),a.update(i.getBytes());var s=a.digest();if(t.encoding==="hex"){var n=s.toHex();return t.delimiter?n.match(/.{2}/g).join(t.delimiter):n}else{if(t.encoding==="binary")return s.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".')}return s};function Ct(e,t){var a=t.toString(16);a[0]>="8"&&(a="00"+a);var r=Ee.util.hexToBytes(a);e.putInt32(r.length),e.putBytes(r)}function hr(e,t){e.putInt32(t.length),e.putString(t)}function ca(){for(var e=Ee.md.sha1.create(),t=arguments.length,a=0;a<t;++a)e.update(arguments[a]);return e.digest()}});var Po=j((wd,Uo)=>{Uo.exports=Q();Rt();eo();ut();Pr();Cr();Co();rr();To();bo();No();ri();Qr();Ht();Xa();ni();Lo();oi();Ja();Ma();ea();et();ja();Do();pi();re()});var st=Bt(va());import{spawn as mc}from"child_process";import*as zo from"path";var gn=Bt(va()),_t=Bt(Xo());import*as hn from"path";var Zi={username:xt(ye)};function Dr(e){return"username"in e}var Tc={password:xt(ye),...Zi};function en(e){return Dr(e)&&"password"in e}var Ta={token:xt(ye),...Zi};function Aa(e){return"token"in e}function tn(e){return"token"in e&&Et(Ta,e)}var rn={"tenant-id":ye,"client-id":ye};function $o(e){return Et(rn,e)}var an={"aws-region":ye,"account-id":ye,"role-name":ye,domain:ye,"domain-owner":ye,audience:xt(ye)};function Jo(e){return Et(an,e)}var nn={"jfrog-oidc-provider-name":ye,audience:xt(ye),"identity-mapping-name":xt(ye)};function Zo(e){return Et(nn,e)}var sn={namespace:ye,"service-slug":ye,"api-host":ye};function e0(e){return Et(sn,e)}var on={"workload-identity-provider":ye,"service-account":xt(ye),audience:xt(ye)};function t0(e){return Et(on,e)}var un=[{schema:rn,name:"Azure"},{schema:an,name:"AWS"},{schema:nn,name:"JFrog"},{schema:sn,name:"Cloudsmith"},{schema:on,name:"GCP"}];function fn(e){let t=`Type: ${e.type};`,a=(r,i)=>{xe(i)&&(t+=` ${r}: ${i};`)};return a("Url",e.url),a("Host",e.host),Dr(e)&&a("Username",e.username),"password"in e&&a("Password",xe(e.password)?"***":void 0),Aa(e)&&a("Token",xe(e.token)?"***":void 0),$o(e)?(a("Tenant",e["tenant-id"]),a("Client",e["client-id"])):Jo(e)?(a("AWS Region",e["aws-region"]),a("AWS Account",e["account-id"]),a("AWS Role",e["role-name"]),a("AWS Domain",e.domain),a("AWS Domain Owner",e["domain-owner"]),a("AWS Audience",e.audience)):Zo(e)?(a("JFrog Provider",e["jfrog-oidc-provider-name"]),a("JFrog Identity Mapping",e["identity-mapping-name"]),a("JFrog Audience",e.audience)):e0(e)?(a("Cloudsmith Namespace",e.namespace),a("Cloudsmith Service Slug",e["service-slug"]),a("Cloudsmith API Host",e["api-host"])):t0(e)&&(a("GCP Workload Identity Provider",e["workload-identity-provider"]),a("GCP Service Account",e["service-account"]),a("GCP Audience",e.audience)),t}function ln(e){return e.url===void 0?e.host:e.url}var Ia=Bt(va());function cn(e,t){let a={};for(let r of Object.keys(e))xe(t[r])&&(a[r]=t[r]);return a}function dn(e){for(let t of un)if(Et(t.schema,e))return cn(t.schema,e);if(tn(e))return xe(e.token)&&Ia.setSecret(e.token),cn(Ta,e);{let t,a;return"password"in e&&qt(e.password)&&(Ia.setSecret(e.password),a=e.password),"username"in e&&qt(e.username)&&(t=e.username),{username:t,password:a}}}function s0(e){switch(e){case 0:return"Failed to download proxy archive.";case 1:return"Failed to extract proxy archive.";case 2:return"Failed to add proxy to toolcache"}}var Zt=class extends Error{errorType;constructor(t){super(),this.errorType=t}};async function yn(e,t,a,r){let i=await Ea("start-proxy","success",e,t,await ma(r),r);if(i!==void 0){let s={...i,registry_types:a.join(",")};await Sa(s)}}function ba(e){return e instanceof Zt?s0(e.errorType):`Error from start-proxy Action omitted (${e.constructor.name}).`}async function vn(e,t,a,r){let i=Rr(r);gn.setFailed(`start-proxy action failed: ${i.message}`);let s=ba(i),n=await Ea("start-proxy",Qi(i),t,{languages:a===void 0?void 0:[a]},await ma(e),e,s);n!==void 0&&await Sa(n)}var Ba="update-job-proxy",o0="v2.0.20250624110901",u0="https://github.com/github/codeql-action/releases/download/codeql-bundle-v2.22.0/";function pn(e){return $i(e,[Wi,Xi])}var f0={java:["maven_repository"],csharp:["nuget_feed"],javascript:["npm_registry"],python:["python_index"],ruby:["rubygems_server"],rust:["cargo_registry"],go:["goproxy_server","git_source"]},l0={actions:[],cpp:[],java:["maven_repository"],csharp:["nuget_feed"],javascript:[],python:[],ruby:[],rust:[],swift:[],go:["goproxy_server","git_source"]};function c0(e){if(xe(e.url)&&qt(e.url)&&Ui(e.host))return{url:e.url,host:e.host};if(xe(e.host)&&qt(e.host))return{url:void 0,host:e.host};throw new bt("Invalid credentials - must specify host or url")}function mn(e,t,a,r,i=!1){let n=r?(i?l0:f0)[r]:void 0,o;if(a!==void 0)e.info("Using registries_credentials input."),o=Buffer.from(a,"base64").toString();else if(t!==void 0)e.info("Using registry_secrets input."),o=t;else return e.info("No credentials defined."),[];let f;try{f=Li(o)}catch{throw e.error("Failed to parse the credentials data."),new bt("Invalid credentials format.")}if(!Di(f))throw new bt("Expected credentials data to be an array of configurations, but it is not.");let u=[];for(let l of f){if(l===null||!ki(l))throw new bt("Invalid credentials - must be an object");if(!xe(l.type)||!qt(l.type))throw new bt("Invalid credentials - must have a type");let c=dn(l),g=c0(l);if(n&&!n.some(B=>B===l.type))continue;let m=B=>B?/^[\x20-\x7E]*$/.test(B):!0;for(let B of Object.keys(l)){let b=l[B];if(typeof b=="string"&&!m(b))throw new bt("Invalid credentials - fields must contain only printable characters")}let y=!Dr(c)||!xe(c.username),E=en(c)&&xe(c.password)&&pn(c.password),S=Aa(c)&&xe(c.token)&&pn(c.token);y&&(E||S)&&e.warning(`A ${l.type} private registry is configured for ${l.host||l.url} using a GitHub Personal Access Token (PAT), but no username was provided. This may not work correctly. When configuring a private registry using a PAT, select "Username and password" and enter the username of the user who generated the PAT.`);let A={type:l.type};if("replaces-base"in l)if(xe(l["replaces-base"])&&typeof l["replaces-base"]=="boolean")A["replaces-base"]=l["replaces-base"];else throw new bt("Invalid credentials - 'replaces-base' must be a boolean");u.push({...A,...c,...g})}return u}function d0(){let e=process.platform==="win32"?"win64":process.platform==="darwin"?"osx64":"linux64";return`${Ba}-${e}.tar.gz`}function p0(e){return`${u0}${e}`}async function h0(e){return qi().rest.repos.getReleaseByTag({owner:"github",repo:"codeql-action",tag:e})}async function g0(e){let t=await kr();return await e.getEnabledDefaultCliVersions(t.type)}async function y0(e,t){let a=d0();try{let i=await t.getValue("start_proxy_use_features_release")?(await g0(t)).enabledVersions[0]:{cliVersion:Gi,tagName:Hi},s=await h0(i.tagName);for(let n of s.data.assets)if(n.name===a)return e.info(`Found '${a}' in release '${i.tagName}' at '${n.url}'`),{url:n.url,version:i.cliVersion}}catch(r){e.warning(`Failed to retrieve information about the linked release: ${Ye(r)}`)}return e.info(`Did not find '${a}' in the linked release, falling back to hard-coded version.`),{url:p0(a),version:o0}}async function v0(e,t,a){try{return _t.downloadTool(t,void 0,a,{accept:"application/octet-stream"})}catch(r){throw e.error(`Failed to download proxy archive from ${t}: ${Ye(r)}`),new Zt(0)}}async function m0(e,t){try{return await _t.extractTar(t)}catch(a){throw e.error(`Failed to extract proxy archive from ${t}: ${Ye(a)}`),new Zt(1)}}async function C0(e,t,a,r){try{return await _t.cacheDir(t,a,r)}catch(i){throw e.error(`Failed to add proxy archive from ${t} to toolcache: ${Ye(i)}`),new Zt(2)}}function x0(){return process.platform==="win32"?`${Ba}.exe`:Ba}async function Cn(e,t){let a=x0(),r=await y0(e,t),i=_t.find(a,r.version);if(!i){let s=Ki(),n=Mi(e,s,r.url),o=await v0(e,r.url,n),f=await m0(e,o);i=await C0(e,f,a,r.version)}return hn.join(i,a)}var $t=Bt(Po()),sc=2048,oc=2,Vo=[{name:"commonName",value:"Dependabot Internal CA"},{name:"organizationName",value:"GitHub inc."},{shortName:"OU",value:"Dependabot"},{name:"countryName",value:"US"},{shortName:"ST",value:"California"},{name:"localityName",value:"San Francisco"}],uc=[{name:"basicConstraints",cA:!0},{name:"keyUsage",critical:!0,keyCertSign:!0,cRLSign:!0,digitalSignature:!0},{name:"subjectKeyIdentifier"},{name:"authorityKeyIdentifier",keyIdentifier:!0}];function Oo(){let e=$t.pki.rsa.generateKeyPair(sc),t=$t.pki.createCertificate();t.publicKey=e.publicKey,t.serialNumber="01",t.validity.notBefore=new Date,t.validity.notAfter=new Date,t.validity.notAfter.setFullYear(t.validity.notBefore.getFullYear()+oc),t.setSubject(Vo),t.setIssuer(Vo),t.setExtensions(uc),t.sign(e.privateKey,$t.md.sha256.create());let a=$t.pki.certificateToPem(t),r=$t.pki.privateKeyToPem(e.privateKey);return{cert:a,key:r}}var Fo=Bt(Yo()),Ko=Bt(Qo());import*as ha from"fs";import*as pa from"path";function wi(e,t){let a=process.env[t];if(xe(a)){let r=URL.parse(a);return xe(r)?(r.username="",r.password="",e.info(`Environment variable '${t}' is set to '${r}'.`)):e.info(`Environment variable '${t}' is set to '${a}'.`),!0}else return e.debug(`Environment variable '${t}' is not set.`),!1}var fc=["http.proxyHost","http.proxyPort","https.proxyHost","https.proxyPort","http.nonProxyHosts","java.net.useSystemProxies","javax.net.ssl.trustStore","javax.net.ssl.trustStoreType","javax.net.ssl.trustStoreProvider","jdk.tls.client.protocols","jdk.tls.disabledAlgorithms","jdk.security.allowNonCaAnchor","https.protocols","com.sun.net.ssl.enableAIAcaIssuers","com.sun.net.ssl.checkRevocation","com.sun.security.enableCRLDP","ocsp.enable"],lc=["JAVA_TOOL_OPTIONS","JDK_JAVA_OPTIONS","_JAVA_OPTIONS"];function cc(e){for(let t of lc)wi(e,t)}function dc(){let e=new Set,t=process.env.JAVA_HOME;xe(t)&&e.add(t);for(let[a,r]of Object.entries(process.env))xe(r)&&a.match(/^JAVA_HOME_\d+_/)&&e.add(r);return e}function pc(e,t){let a=[pa.join("conf","net.properties"),pa.join("lib","net.properties")];for(let r of a){let i=pa.join(t,r);try{if(ha.existsSync(i)){e.debug(`Found '${i}'.`);let s=String(ha.readFileSync(i)).split(`
`);for(let n of s)for(let o of fc)n.startsWith(`${o}=`)&&e.info(`Found '${n.trimEnd()}' in '${i}'.`)}else e.debug(`'${i}' does not exist.`)}catch(s){e.debug(`Failed to read '${i}': ${Ye(s)}`)}}}async function hc(e){try{let t=await Ko.which("java",!0),a="";await new Fo.ToolRunner(t,["-XshowSettings:all","-XshowSettings:security:all","-version"],{silent:!0,listeners:{stdout:r=>{a+=String(r)},stderr:r=>{a+=String(r)}}}).exec(),e.startGroup("Java settings"),e.info(a),e.endGroup()}catch(t){e.debug(`Failed to query java settings: ${Ye(t)}`)}}var qo=(r=>(r.HTTP_PROXY="HTTP_PROXY",r.HTTPS_PROXY="HTTPS_PROXY",r.ALL_PROXY="ALL_PROXY",r))(qo||{});function gc(e){for(let t of Object.values(qo))wi(e,t),wi(e,t.toLowerCase())}async function Mo(e,t){if(gc(e),t===void 0||t==="java"){cc(e),await hc(e);let a=dc();for(let r of a)pc(e,r)}}var Go=Bt(Wo());import*as Ho from"https";var yc={nuget_feed:{path:"v3/index.json"}};function vc(e,t){return e?.path===void 0||t.pathname.endsWith(e.path)?t:new URL(e.path,t)}var ga=class extends Error{constructor(a){super();this.statusCode=a}statusCode},Ri=class{constructor(t){this.proxy=t;this.agent=new Go.HttpsProxyAgent(`http://${t.host}:${t.port}`)}proxy;agent;async checkConnection(t){return new Promise((a,r)=>{let i=Ho.request(t,{agent:this.agent,method:"GET",ca:this.proxy.cert,timeout:5e3},s=>{s.destroy(),s.statusCode!==void 0&&s.statusCode<400?a(s.statusCode):r(new ga(s.statusCode))});i.on("error",s=>{r(s)}),i.on("timeout",()=>{i.destroy(),r(new Error("Connection timeout."))}),i.end()})}};async function jo(e,t,a){let r=new Set;if(t.registries.length===0)return r;e.startGroup("Testing connections via the proxy"),e.info("The connection tests performed here are best-effort only and failures here may not affect the subsequent analysis. See https://docs.github.com/en/code-security/reference/code-scanning/code-scanning-logs#diagnostic-information-for-private-package-registries for more information.");try{a===void 0&&(a=new Ri(t));for(let i of t.registries){let s=yc[i.type],n=ln(i),o=URL.parse(n);if(o===null){e.info(`Skipping check for ${n} since it is not a valid URL.`);continue}let f=vc(s,o);try{e.debug(`Testing connection to ${o}...`);let u=await a.checkConnection(f);e.info(`Successfully tested connection to ${o} (${u})`),r.add(i)}catch(u){u instanceof ga&&u.statusCode!==void 0?e.info(`Connection test to ${o} failed. (${u.statusCode})`):e.warning(`Connection test to ${o} failed: ${Ye(u)}`)}}e.debug("Finished testing connections to private registries.")}catch(i){e.warning(`Failed to test connections to private registries: ${Ye(i)}`)}return e.endGroup(),r}async function Cc(e){let t=xa(),a,r;try{Oi();let i=Ca(),s=zo.resolve(i,"proxy.log");st.saveState("proxy-log-file",s);let n=Fi(),o=await kr();a=ji(o,n,Ca(),t);let f=Lr("language");r=f?zi(f):void 0;let u=await a.getValue("start_proxy_remove_unused_registries"),l=mn(t,Lr("registry_secrets"),Lr("registries_credentials"),r,u);if(l.length===0){t.info("No credentials found, skipping proxy setup.");return}if(t.info(`Credentials loaded for the following registries:
${l.map(E=>fn(E)).join(`
`)}`),st.isDebug()||Vi())try{await Mo(t,r)}catch(E){t.debug(`Unable to inspect runner environment: ${Ye(E)}`)}let c=Oo(),g={all_credentials:l,ca:c},m=await Cn(t,a),y=await Ec(m,g,s,t);await jo(t,y),await yn(e,{languages:r===void 0?void 0:[r]},g.all_credentials.map(E=>E.type),t)}catch(i){await vn(t,e,r,i)}}async function xc(){let e=new Date,t=xa();try{await Cc(e)}catch(a){st.setFailed(`start-proxy action failed: ${Ye(a)}`),await Yi("start-proxy",e,ba(Rr(a)),t)}}async function Ec(e,t,a,r){let i="127.0.0.1",s=49152,n,o=5,f;for(;o-- >0&&!n&&!f;)n=mc(e,["-addr",`${i}:${s}`,"-config","-","-logfile",a],{detached:!0,stdio:["pipe","ignore","ignore"]}),n.unref(),n.pid&&st.saveState("proxy-process-pid",`${n.pid}`),n.on("error",l=>{f=l}),n.on("exit",l=>{l!==0&&(s=Math.floor(Math.random()*16383+49152),n=void 0)}),n.stdin?.write(JSON.stringify(t)),n.stdin?.end(),await Pi(1e3);if(f)throw f;r.info(`Proxy started on ${i}:${s}`),st.setOutput("proxy_host",i),st.setOutput("proxy_port",s.toString()),st.setOutput("proxy_ca_certificate",t.ca.cert);let u=t.all_credentials.filter(l=>l.url!==void 0).map(l=>({type:l.type,url:l.url,"replaces-base":l["replaces-base"]}));return st.setOutput("proxy_urls",JSON.stringify(u)),{host:i,port:s,cert:t.ca.cert,registries:u}}xc();