nfets 0.0.39 → 0.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,18 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as o,b as Xe,d as Z,f as Zx}from"./chunk-W6MRGYXP.mjs";var $t=Z((Ppe,LO)=>{"use strict";LO.exports={options:{usePureJavaScript:!1}}});var jO=Z((Ope,UO)=>{"use strict";var U2={};UO.exports=U2;var VO={};U2.encode=function(r,e,t){if(typeof e!="string")throw new TypeError('"alphabet" must be a string.');if(t!==void 0&&typeof t!="number")throw new TypeError('"maxline" must be a number.');var n="";if(!(r instanceof Uint8Array))n=Az(r,e);else{var s=0,i=e.length,a=e.charAt(0),u=[0];for(s=0;s<r.length;++s){for(var c=0,f=r[s];c<u.length;++c)f+=u[c]<<8,u[c]=f%i,f=f/i|0;for(;f>0;)u.push(f%i),f=f/i|0}for(s=0;r[s]===0&&s<r.length-1;++s)n+=a;for(s=u.length-1;s>=0;--s)n+=e[u[s]]}if(t){var h=new RegExp(".{1,"+t+"}","g");n=n.match(h).join(`\r
3
- `)}return n};U2.decode=function(r,e){if(typeof r!="string")throw new TypeError('"input" must be a string.');if(typeof e!="string")throw new TypeError('"alphabet" must be a string.');var t=VO[e];if(!t){t=VO[e]=[];for(var n=0;n<e.length;++n)t[e.charCodeAt(n)]=n}r=r.replace(/\s/g,"");for(var s=e.length,i=e.charAt(0),a=[0],n=0;n<r.length;n++){var u=t[r.charCodeAt(n)];if(u===void 0)return;for(var c=0,f=u;c<a.length;++c)f+=a[c]*s,a[c]=f&255,f>>=8;for(;f>0;)a.push(f&255),f>>=8}for(var h=0;r[h]===i&&h<r.length-1;++h)a.push(0);return typeof Buffer<"u"?Buffer.from(a.reverse()):new Uint8Array(a.reverse())};function Az(r,e){var t=0,n=e.length,s=e.charAt(0),i=[0];for(t=0;t<r.length();++t){for(var a=0,u=r.at(t);a<i.length;++a)u+=i[a]<<8,i[a]=u%n,u=u/n|0;for(;u>0;)i.push(u%n),u=u/n|0}var c="";for(t=0;r.at(t)===0&&t<r.length()-1;++t)c+=s;for(t=i.length-1;t>=0;--t)c+=e[i[t]];return c}o(Az,"_encodeWithByteBuffer")});var lr=Z((Lpe,HO)=>{"use strict";var MO=$t(),FO=jO(),ne=HO.exports=MO.util=MO.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){ne.nextTick=process.nextTick,typeof setImmediate=="function"?ne.setImmediate=setImmediate:ne.setImmediate=ne.nextTick;return}if(typeof setImmediate=="function"){ne.setImmediate=function(){return setImmediate.apply(void 0,arguments)},ne.nextTick=function(u){return setImmediate(u)};return}if(ne.setImmediate=function(u){setTimeout(u,0)},typeof window<"u"&&typeof window.postMessage=="function"){let u=function(c){if(c.source===window&&c.data===r){c.stopPropagation();var f=e.slice();e.length=0,f.forEach(function(h){h()})}};var a=u;o(u,"handler");var r="forge.setImmediate",e=[];ne.setImmediate=function(c){e.push(c),e.length===1&&window.postMessage(r,"*")},window.addEventListener("message",u,!0)}if(typeof MutationObserver<"u"){var t=Date.now(),n=!0,s=document.createElement("div"),e=[];new MutationObserver(function(){var c=e.slice();e.length=0,c.forEach(function(f){f()})}).observe(s,{attributes:!0});var i=ne.setImmediate;ne.setImmediate=function(c){Date.now()-t>15?(t=Date.now(),i(c)):(e.push(c),e.length===1&&s.setAttribute("a",n=!n))}}ne.nextTick=ne.setImmediate})();ne.isNodejs=typeof process<"u"&&process.versions&&process.versions.node;ne.globalScope=(function(){return ne.isNodejs?global:typeof self>"u"?window:self})();ne.isArray=Array.isArray||function(r){return Object.prototype.toString.call(r)==="[object Array]"};ne.isArrayBuffer=function(r){return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer};ne.isArrayBufferView=function(r){return r&&ne.isArrayBuffer(r.buffer)&&r.byteLength!==void 0};function X0(r){if(!(r===8||r===16||r===24||r===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+r)}o(X0,"_checkBitsParam");ne.ByteBuffer=j2;function j2(r){if(this.data="",this.read=0,typeof r=="string")this.data=r;else if(ne.isArrayBuffer(r)||ne.isArrayBufferView(r))if(typeof Buffer<"u"&&r instanceof Buffer)this.data=r.toString("binary");else{var e=new Uint8Array(r);try{this.data=String.fromCharCode.apply(null,e)}catch{for(var t=0;t<e.length;++t)this.putByte(e[t])}}else(r instanceof j2||typeof r=="object"&&typeof r.data=="string"&&typeof r.read=="number")&&(this.data=r.data,this.read=r.read);this._constructedStringLength=0}o(j2,"ByteStringBuffer");ne.ByteStringBuffer=j2;var Cz=4096;ne.ByteStringBuffer.prototype._optimizeConstructedString=function(r){this._constructedStringLength+=r,this._constructedStringLength>Cz&&(this.data.substr(0,1),this._constructedStringLength=0)};ne.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};ne.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0};ne.ByteStringBuffer.prototype.putByte=function(r){return this.putBytes(String.fromCharCode(r))};ne.ByteStringBuffer.prototype.fillWithByte=function(r,e){r=String.fromCharCode(r);for(var t=this.data;e>0;)e&1&&(t+=r),e>>>=1,e>0&&(r+=r);return this.data=t,this._optimizeConstructedString(e),this};ne.ByteStringBuffer.prototype.putBytes=function(r){return this.data+=r,this._optimizeConstructedString(r.length),this};ne.ByteStringBuffer.prototype.putString=function(r){return this.putBytes(ne.encodeUtf8(r))};ne.ByteStringBuffer.prototype.putInt16=function(r){return this.putBytes(String.fromCharCode(r>>8&255)+String.fromCharCode(r&255))};ne.ByteStringBuffer.prototype.putInt24=function(r){return this.putBytes(String.fromCharCode(r>>16&255)+String.fromCharCode(r>>8&255)+String.fromCharCode(r&255))};ne.ByteStringBuffer.prototype.putInt32=function(r){return this.putBytes(String.fromCharCode(r>>24&255)+String.fromCharCode(r>>16&255)+String.fromCharCode(r>>8&255)+String.fromCharCode(r&255))};ne.ByteStringBuffer.prototype.putInt16Le=function(r){return this.putBytes(String.fromCharCode(r&255)+String.fromCharCode(r>>8&255))};ne.ByteStringBuffer.prototype.putInt24Le=function(r){return this.putBytes(String.fromCharCode(r&255)+String.fromCharCode(r>>8&255)+String.fromCharCode(r>>16&255))};ne.ByteStringBuffer.prototype.putInt32Le=function(r){return this.putBytes(String.fromCharCode(r&255)+String.fromCharCode(r>>8&255)+String.fromCharCode(r>>16&255)+String.fromCharCode(r>>24&255))};ne.ByteStringBuffer.prototype.putInt=function(r,e){X0(e);var t="";do e-=8,t+=String.fromCharCode(r>>e&255);while(e>0);return this.putBytes(t)};ne.ByteStringBuffer.prototype.putSignedInt=function(r,e){return r<0&&(r+=2<<e-1),this.putInt(r,e)};ne.ByteStringBuffer.prototype.putBuffer=function(r){return this.putBytes(r.getBytes())};ne.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)};ne.ByteStringBuffer.prototype.getInt16=function(){var r=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,r};ne.ByteStringBuffer.prototype.getInt24=function(){var r=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,r};ne.ByteStringBuffer.prototype.getInt32=function(){var r=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,r};ne.ByteStringBuffer.prototype.getInt16Le=function(){var r=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,r};ne.ByteStringBuffer.prototype.getInt24Le=function(){var r=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,r};ne.ByteStringBuffer.prototype.getInt32Le=function(){var r=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,r};ne.ByteStringBuffer.prototype.getInt=function(r){X0(r);var e=0;do e=(e<<8)+this.data.charCodeAt(this.read++),r-=8;while(r>0);return e};ne.ByteStringBuffer.prototype.getSignedInt=function(r){var e=this.getInt(r),t=2<<r-2;return e>=t&&(e-=t<<1),e};ne.ByteStringBuffer.prototype.getBytes=function(r){var e;return r?(r=Math.min(this.length(),r),e=this.data.slice(this.read,this.read+r),this.read+=r):r===0?e="":(e=this.read===0?this.data:this.data.slice(this.read),this.clear()),e};ne.ByteStringBuffer.prototype.bytes=function(r){return typeof r>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+r)};ne.ByteStringBuffer.prototype.at=function(r){return this.data.charCodeAt(this.read+r)};ne.ByteStringBuffer.prototype.setAt=function(r,e){return this.data=this.data.substr(0,this.read+r)+String.fromCharCode(e)+this.data.substr(this.read+r+1),this};ne.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};ne.ByteStringBuffer.prototype.copy=function(){var r=ne.createBuffer(this.data);return r.read=this.read,r};ne.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this};ne.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this};ne.ByteStringBuffer.prototype.truncate=function(r){var e=Math.max(0,this.length()-r);return this.data=this.data.substr(this.read,e),this.read=0,this};ne.ByteStringBuffer.prototype.toHex=function(){for(var r="",e=this.read;e<this.data.length;++e){var t=this.data.charCodeAt(e);t<16&&(r+="0"),r+=t.toString(16)}return r};ne.ByteStringBuffer.prototype.toString=function(){return ne.decodeUtf8(this.bytes())};function Nz(r,e){e=e||{},this.read=e.readOffset||0,this.growSize=e.growSize||1024;var t=ne.isArrayBuffer(r),n=ne.isArrayBufferView(r);if(t||n){t?this.data=new DataView(r):this.data=new DataView(r.buffer,r.byteOffset,r.byteLength),this.write="writeOffset"in e?e.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,r!=null&&this.putBytes(r),"writeOffset"in e&&(this.write=e.writeOffset)}o(Nz,"DataBuffer");ne.DataBuffer=Nz;ne.DataBuffer.prototype.length=function(){return this.write-this.read};ne.DataBuffer.prototype.isEmpty=function(){return this.length()<=0};ne.DataBuffer.prototype.accommodate=function(r,e){if(this.length()>=r)return this;e=Math.max(e||this.growSize,r);var t=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+e);return n.set(t),this.data=new DataView(n.buffer),this};ne.DataBuffer.prototype.putByte=function(r){return this.accommodate(1),this.data.setUint8(this.write++,r),this};ne.DataBuffer.prototype.fillWithByte=function(r,e){this.accommodate(e);for(var t=0;t<e;++t)this.data.setUint8(r);return this};ne.DataBuffer.prototype.putBytes=function(r,e){if(ne.isArrayBufferView(r)){var t=new Uint8Array(r.buffer,r.byteOffset,r.byteLength),n=t.byteLength-t.byteOffset;this.accommodate(n);var s=new Uint8Array(this.data.buffer,this.write);return s.set(t),this.write+=n,this}if(ne.isArrayBuffer(r)){var t=new Uint8Array(r);this.accommodate(t.byteLength);var s=new Uint8Array(this.data.buffer);return s.set(t,this.write),this.write+=t.byteLength,this}if(r instanceof ne.DataBuffer||typeof r=="object"&&typeof r.read=="number"&&typeof r.write=="number"&&ne.isArrayBufferView(r.data)){var t=new Uint8Array(r.data.byteLength,r.read,r.length());this.accommodate(t.byteLength);var s=new Uint8Array(r.data.byteLength,this.write);return s.set(t),this.write+=t.byteLength,this}if(r instanceof ne.ByteStringBuffer&&(r=r.data,e="binary"),e=e||"binary",typeof r=="string"){var i;if(e==="hex")return this.accommodate(Math.ceil(r.length/2)),i=new Uint8Array(this.data.buffer,this.write),this.write+=ne.binary.hex.decode(r,i,this.write),this;if(e==="base64")return this.accommodate(Math.ceil(r.length/4)*3),i=new Uint8Array(this.data.buffer,this.write),this.write+=ne.binary.base64.decode(r,i,this.write),this;if(e==="utf8"&&(r=ne.encodeUtf8(r),e="binary"),e==="binary"||e==="raw")return this.accommodate(r.length),i=new Uint8Array(this.data.buffer,this.write),this.write+=ne.binary.raw.decode(i),this;if(e==="utf16")return this.accommodate(r.length*2),i=new Uint16Array(this.data.buffer,this.write),this.write+=ne.text.utf16.encode(i),this;throw new Error("Invalid encoding: "+e)}throw Error("Invalid parameter: "+r)};ne.DataBuffer.prototype.putBuffer=function(r){return this.putBytes(r),r.clear(),this};ne.DataBuffer.prototype.putString=function(r){return this.putBytes(r,"utf16")};ne.DataBuffer.prototype.putInt16=function(r){return this.accommodate(2),this.data.setInt16(this.write,r),this.write+=2,this};ne.DataBuffer.prototype.putInt24=function(r){return this.accommodate(3),this.data.setInt16(this.write,r>>8&65535),this.data.setInt8(this.write,r>>16&255),this.write+=3,this};ne.DataBuffer.prototype.putInt32=function(r){return this.accommodate(4),this.data.setInt32(this.write,r),this.write+=4,this};ne.DataBuffer.prototype.putInt16Le=function(r){return this.accommodate(2),this.data.setInt16(this.write,r,!0),this.write+=2,this};ne.DataBuffer.prototype.putInt24Le=function(r){return this.accommodate(3),this.data.setInt8(this.write,r>>16&255),this.data.setInt16(this.write,r>>8&65535,!0),this.write+=3,this};ne.DataBuffer.prototype.putInt32Le=function(r){return this.accommodate(4),this.data.setInt32(this.write,r,!0),this.write+=4,this};ne.DataBuffer.prototype.putInt=function(r,e){X0(e),this.accommodate(e/8);do e-=8,this.data.setInt8(this.write++,r>>e&255);while(e>0);return this};ne.DataBuffer.prototype.putSignedInt=function(r,e){return X0(e),this.accommodate(e/8),r<0&&(r+=2<<e-1),this.putInt(r,e)};ne.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)};ne.DataBuffer.prototype.getInt16=function(){var r=this.data.getInt16(this.read);return this.read+=2,r};ne.DataBuffer.prototype.getInt24=function(){var r=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,r};ne.DataBuffer.prototype.getInt32=function(){var r=this.data.getInt32(this.read);return this.read+=4,r};ne.DataBuffer.prototype.getInt16Le=function(){var r=this.data.getInt16(this.read,!0);return this.read+=2,r};ne.DataBuffer.prototype.getInt24Le=function(){var r=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,r};ne.DataBuffer.prototype.getInt32Le=function(){var r=this.data.getInt32(this.read,!0);return this.read+=4,r};ne.DataBuffer.prototype.getInt=function(r){X0(r);var e=0;do e=(e<<8)+this.data.getInt8(this.read++),r-=8;while(r>0);return e};ne.DataBuffer.prototype.getSignedInt=function(r){var e=this.getInt(r),t=2<<r-2;return e>=t&&(e-=t<<1),e};ne.DataBuffer.prototype.getBytes=function(r){var e;return r?(r=Math.min(this.length(),r),e=this.data.slice(this.read,this.read+r),this.read+=r):r===0?e="":(e=this.read===0?this.data:this.data.slice(this.read),this.clear()),e};ne.DataBuffer.prototype.bytes=function(r){return typeof r>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+r)};ne.DataBuffer.prototype.at=function(r){return this.data.getUint8(this.read+r)};ne.DataBuffer.prototype.setAt=function(r,e){return this.data.setUint8(r,e),this};ne.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};ne.DataBuffer.prototype.copy=function(){return new ne.DataBuffer(this)};ne.DataBuffer.prototype.compact=function(){if(this.read>0){var r=new Uint8Array(this.data.buffer,this.read),e=new Uint8Array(r.byteLength);e.set(r),this.data=new DataView(e),this.write-=this.read,this.read=0}return this};ne.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this};ne.DataBuffer.prototype.truncate=function(r){return this.write=Math.max(0,this.length()-r),this.read=Math.min(this.read,this.write),this};ne.DataBuffer.prototype.toHex=function(){for(var r="",e=this.read;e<this.data.byteLength;++e){var t=this.data.getUint8(e);t<16&&(r+="0"),r+=t.toString(16)}return r};ne.DataBuffer.prototype.toString=function(r){var e=new Uint8Array(this.data,this.read,this.length());if(r=r||"utf8",r==="binary"||r==="raw")return ne.binary.raw.encode(e);if(r==="hex")return ne.binary.hex.encode(e);if(r==="base64")return ne.binary.base64.encode(e);if(r==="utf8")return ne.text.utf8.decode(e);if(r==="utf16")return ne.text.utf16.decode(e);throw new Error("Invalid encoding: "+r)};ne.createBuffer=function(r,e){return e=e||"raw",r!==void 0&&e==="utf8"&&(r=ne.encodeUtf8(r)),new ne.ByteBuffer(r)};ne.fillString=function(r,e){for(var t="";e>0;)e&1&&(t+=r),e>>>=1,e>0&&(r+=r);return t};ne.xorBytes=function(r,e,t){for(var n="",s="",i="",a=0,u=0;t>0;--t,++a)s=r.charCodeAt(a)^e.charCodeAt(a),u>=10&&(n+=i,i="",u=0),i+=String.fromCharCode(s),++u;return n+=i,n};ne.hexToBytes=function(r){var e="",t=0;for(r.length&!0&&(t=1,e+=String.fromCharCode(parseInt(r[0],16)));t<r.length;t+=2)e+=String.fromCharCode(parseInt(r.substr(t,2),16));return e};ne.bytesToHex=function(r){return ne.createBuffer(r).toHex()};ne.int32ToBytes=function(r){return String.fromCharCode(r>>24&255)+String.fromCharCode(r>>16&255)+String.fromCharCode(r>>8&255)+String.fromCharCode(r&255)};var Du="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Ru=[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],qO="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";ne.encode64=function(r,e){for(var t="",n="",s,i,a,u=0;u<r.length;)s=r.charCodeAt(u++),i=r.charCodeAt(u++),a=r.charCodeAt(u++),t+=Du.charAt(s>>2),t+=Du.charAt((s&3)<<4|i>>4),isNaN(i)?t+="==":(t+=Du.charAt((i&15)<<2|a>>6),t+=isNaN(a)?"=":Du.charAt(a&63)),e&&t.length>e&&(n+=t.substr(0,e)+`\r
4
- `,t=t.substr(e));return n+=t,n};ne.decode64=function(r){r=r.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var e="",t,n,s,i,a=0;a<r.length;)t=Ru[r.charCodeAt(a++)-43],n=Ru[r.charCodeAt(a++)-43],s=Ru[r.charCodeAt(a++)-43],i=Ru[r.charCodeAt(a++)-43],e+=String.fromCharCode(t<<2|n>>4),s!==64&&(e+=String.fromCharCode((n&15)<<4|s>>2),i!==64&&(e+=String.fromCharCode((s&3)<<6|i)));return e};ne.encodeUtf8=function(r){return unescape(encodeURIComponent(r))};ne.decodeUtf8=function(r){return decodeURIComponent(escape(r))};ne.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:FO.encode,decode:FO.decode}};ne.binary.raw.encode=function(r){return String.fromCharCode.apply(null,r)};ne.binary.raw.decode=function(r,e,t){var n=e;n||(n=new Uint8Array(r.length)),t=t||0;for(var s=t,i=0;i<r.length;++i)n[s++]=r.charCodeAt(i);return e?s-t:n};ne.binary.hex.encode=ne.bytesToHex;ne.binary.hex.decode=function(r,e,t){var n=e;n||(n=new Uint8Array(Math.ceil(r.length/2))),t=t||0;var s=0,i=t;for(r.length&1&&(s=1,n[i++]=parseInt(r[0],16));s<r.length;s+=2)n[i++]=parseInt(r.substr(s,2),16);return e?i-t:n};ne.binary.base64.encode=function(r,e){for(var t="",n="",s,i,a,u=0;u<r.byteLength;)s=r[u++],i=r[u++],a=r[u++],t+=Du.charAt(s>>2),t+=Du.charAt((s&3)<<4|i>>4),isNaN(i)?t+="==":(t+=Du.charAt((i&15)<<2|a>>6),t+=isNaN(a)?"=":Du.charAt(a&63)),e&&t.length>e&&(n+=t.substr(0,e)+`\r
5
- `,t=t.substr(e));return n+=t,n};ne.binary.base64.decode=function(r,e,t){var n=e;n||(n=new Uint8Array(Math.ceil(r.length/4)*3)),r=r.replace(/[^A-Za-z0-9\+\/\=]/g,""),t=t||0;for(var s,i,a,u,c=0,f=t;c<r.length;)s=Ru[r.charCodeAt(c++)-43],i=Ru[r.charCodeAt(c++)-43],a=Ru[r.charCodeAt(c++)-43],u=Ru[r.charCodeAt(c++)-43],n[f++]=s<<2|i>>4,a!==64&&(n[f++]=(i&15)<<4|a>>2,u!==64&&(n[f++]=(a&3)<<6|u));return e?f-t:n.subarray(0,f)};ne.binary.base58.encode=function(r,e){return ne.binary.baseN.encode(r,qO,e)};ne.binary.base58.decode=function(r,e){return ne.binary.baseN.decode(r,qO,e)};ne.text={utf8:{},utf16:{}};ne.text.utf8.encode=function(r,e,t){r=ne.encodeUtf8(r);var n=e;n||(n=new Uint8Array(r.length)),t=t||0;for(var s=t,i=0;i<r.length;++i)n[s++]=r.charCodeAt(i);return e?s-t:n};ne.text.utf8.decode=function(r){return ne.decodeUtf8(String.fromCharCode.apply(null,r))};ne.text.utf16.encode=function(r,e,t){var n=e;n||(n=new Uint8Array(r.length*2));var s=new Uint16Array(n.buffer);t=t||0;for(var i=t,a=t,u=0;u<r.length;++u)s[a++]=r.charCodeAt(u),i+=2;return e?i-t:n};ne.text.utf16.decode=function(r){return String.fromCharCode.apply(null,new Uint16Array(r.buffer))};ne.deflate=function(r,e,t){if(e=ne.decode64(r.deflate(ne.encode64(e)).rval),t){var n=2,s=e.charCodeAt(1);s&32&&(n=6),e=e.substring(n,e.length-4)}return e};ne.inflate=function(r,e,t){var n=r.inflate(ne.encode64(e)).rval;return n===null?null:ne.decode64(n)};var M2=o(function(r,e,t){if(!r)throw new Error("WebStorage not available.");var n;if(t===null?n=r.removeItem(e):(t=ne.encode64(JSON.stringify(t)),n=r.setItem(e,t)),typeof n<"u"&&n.rval!==!0){var s=new Error(n.error.message);throw s.id=n.error.id,s.name=n.error.name,s}},"_setStorageObject"),F2=o(function(r,e){if(!r)throw new Error("WebStorage not available.");var t=r.getItem(e);if(r.init)if(t.rval===null){if(t.error){var n=new Error(t.error.message);throw n.id=t.error.id,n.name=t.error.name,n}t=null}else t=t.rval;return t!==null&&(t=JSON.parse(ne.decode64(t))),t},"_getStorageObject"),Tz=o(function(r,e,t,n){var s=F2(r,e);s===null&&(s={}),s[t]=n,M2(r,e,s)},"_setItem"),Iz=o(function(r,e,t){var n=F2(r,e);return n!==null&&(n=t in n?n[t]:null),n},"_getItem"),_z=o(function(r,e,t){var n=F2(r,e);if(n!==null&&t in n){delete n[t];var s=!0;for(var i in n){s=!1;break}s&&(n=null),M2(r,e,n)}},"_removeItem"),Bz=o(function(r,e){M2(r,e,null)},"_clearItems"),fw=o(function(r,e,t){var n=null;typeof t>"u"&&(t=["web","flash"]);var s,i=!1,a=null;for(var u in t){s=t[u];try{if(s==="flash"||s==="both"){if(e[0]===null)throw new Error("Flash local storage not available.");n=r.apply(this,e),i=s==="flash"}(s==="web"||s==="both")&&(e[0]=localStorage,n=r.apply(this,e),i=!0)}catch(c){a=c}if(i)break}if(!i)throw a;return n},"_callStorageFunction");ne.setItem=function(r,e,t,n,s){fw(Tz,arguments,s)};ne.getItem=function(r,e,t,n){return fw(Iz,arguments,n)};ne.removeItem=function(r,e,t,n){fw(_z,arguments,n)};ne.clearItems=function(r,e,t){fw(Bz,arguments,t)};ne.isEmpty=function(r){for(var e in r)if(r.hasOwnProperty(e))return!1;return!0};ne.format=function(r){for(var e=/%./g,t,n,s=0,i=[],a=0;t=e.exec(r);){n=r.substring(a,e.lastIndex-2),n.length>0&&i.push(n),a=e.lastIndex;var u=t[0][1];switch(u){case"s":case"o":s<arguments.length?i.push(arguments[s+++1]):i.push("<?>");break;case"%":i.push("%");break;default:i.push("<%"+u+"?>")}}return i.push(r.substring(a)),i.join("")};ne.formatNumber=function(r,e,t,n){var s=r,i=isNaN(e=Math.abs(e))?2:e,a=t===void 0?",":t,u=n===void 0?".":n,c=s<0?"-":"",f=parseInt(s=Math.abs(+s||0).toFixed(i),10)+"",h=f.length>3?f.length%3:0;return c+(h?f.substr(0,h)+u:"")+f.substr(h).replace(/(\d{3})(?=\d)/g,"$1"+u)+(i?a+Math.abs(s-f).toFixed(i).slice(2):"")};ne.formatSize=function(r){return r>=1073741824?r=ne.formatNumber(r/1073741824,2,".","")+" GiB":r>=1048576?r=ne.formatNumber(r/1048576,2,".","")+" MiB":r>=1024?r=ne.formatNumber(r/1024,0)+" KiB":r=ne.formatNumber(r,0)+" bytes",r};ne.bytesFromIP=function(r){return r.indexOf(".")!==-1?ne.bytesFromIPv4(r):r.indexOf(":")!==-1?ne.bytesFromIPv6(r):null};ne.bytesFromIPv4=function(r){if(r=r.split("."),r.length!==4)return null;for(var e=ne.createBuffer(),t=0;t<r.length;++t){var n=parseInt(r[t],10);if(isNaN(n))return null;e.putByte(n)}return e.getBytes()};ne.bytesFromIPv6=function(r){var e=0;r=r.split(":").filter(function(a){return a.length===0&&++e,!0});for(var t=(8-r.length+e)*2,n=ne.createBuffer(),s=0;s<8;++s){if(!r[s]||r[s].length===0){n.fillWithByte(0,t),t=0;continue}var i=ne.hexToBytes(r[s]);i.length<2&&n.putByte(0),n.putBytes(i)}return n.getBytes()};ne.bytesToIP=function(r){return r.length===4?ne.bytesToIPv4(r):r.length===16?ne.bytesToIPv6(r):null};ne.bytesToIPv4=function(r){if(r.length!==4)return null;for(var e=[],t=0;t<r.length;++t)e.push(r.charCodeAt(t));return e.join(".")};ne.bytesToIPv6=function(r){if(r.length!==16)return null;for(var e=[],t=[],n=0,s=0;s<r.length;s+=2){for(var i=ne.bytesToHex(r[s]+r[s+1]);i[0]==="0"&&i!=="0";)i=i.substr(1);if(i==="0"){var a=t[t.length-1],u=e.length;!a||u!==a.end+1?t.push({start:u,end:u}):(a.end=u,a.end-a.start>t[n].end-t[n].start&&(n=t.length-1))}e.push(i)}if(t.length>0){var c=t[n];c.end-c.start>0&&(e.splice(c.start,c.end-c.start+1,""),c.start===0&&e.unshift(""),c.end===7&&e.push(""))}return e.join(":")};ne.estimateCores=function(r,e){if(typeof r=="function"&&(e=r,r={}),r=r||{},"cores"in ne&&!r.update)return e(null,ne.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return ne.cores=navigator.hardwareConcurrency,e(null,ne.cores);if(typeof Worker>"u")return ne.cores=1,e(null,ne.cores);if(typeof Blob>"u")return ne.cores=2,e(null,ne.cores);var t=URL.createObjectURL(new Blob(["(",(function(){self.addEventListener("message",function(a){for(var u=Date.now(),c=u+4;Date.now()<c;);self.postMessage({st:u,et:c})})}).toString(),")()"],{type:"application/javascript"}));n([],5,16);function n(a,u,c){if(u===0){var f=Math.floor(a.reduce(function(h,m){return h+m},0)/a.length);return ne.cores=Math.max(1,f),URL.revokeObjectURL(t),e(null,ne.cores)}s(c,function(h,m){a.push(i(c,m)),n(a,u-1,c)})}o(n,"sample");function s(a,u){for(var c=[],f=[],h=0;h<a;++h){var m=new Worker(t);m.addEventListener("message",function(g){if(f.push(g.data),f.length===a){for(var x=0;x<a;++x)c[x].terminate();u(null,f)}}),c.push(m)}for(var h=0;h<a;++h)c[h].postMessage(h)}o(s,"map");function i(a,u){for(var c=[],f=0;f<a;++f)for(var h=u[f],m=c[f]=[],g=0;g<a;++g)if(f!==g){var x=u[g];(h.st>x.st&&h.st<x.et||x.st>h.st&&x.st<h.et)&&m.push(g)}return c.reduce(function(v,w){return Math.max(v,w.length)},0)}o(i,"reduce")}});var hw=Z((Upe,KO)=>{"use strict";var Tn=$t();lr();KO.exports=Tn.cipher=Tn.cipher||{};Tn.cipher.algorithms=Tn.cipher.algorithms||{};Tn.cipher.createCipher=function(r,e){var t=r;if(typeof t=="string"&&(t=Tn.cipher.getAlgorithm(t),t&&(t=t())),!t)throw new Error("Unsupported algorithm: "+r);return new Tn.cipher.BlockCipher({algorithm:t,key:e,decrypt:!1})};Tn.cipher.createDecipher=function(r,e){var t=r;if(typeof t=="string"&&(t=Tn.cipher.getAlgorithm(t),t&&(t=t())),!t)throw new Error("Unsupported algorithm: "+r);return new Tn.cipher.BlockCipher({algorithm:t,key:e,decrypt:!0})};Tn.cipher.registerAlgorithm=function(r,e){r=r.toUpperCase(),Tn.cipher.algorithms[r]=e};Tn.cipher.getAlgorithm=function(r){return r=r.toUpperCase(),r in Tn.cipher.algorithms?Tn.cipher.algorithms[r]:null};var q2=Tn.cipher.BlockCipher=function(r){this.algorithm=r.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=r.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=r.decrypt,this.algorithm.initialize(r)};q2.prototype.start=function(r){r=r||{};var e={};for(var t in r)e[t]=r[t];e.decrypt=this._decrypt,this._finish=!1,this._input=Tn.util.createBuffer(),this.output=r.output||Tn.util.createBuffer(),this.mode.start(e)};q2.prototype.update=function(r){for(r&&this._input.putBuffer(r);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()};q2.prototype.finish=function(r){r&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(t){return r(this.blockSize,t,!1)},this.mode.unpad=function(t){return r(this.blockSize,t,!0)});var e={};return e.decrypt=this._decrypt,e.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,e)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,e))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,e))}});var K2=Z((jpe,$O)=>{"use strict";var In=$t();lr();In.cipher=In.cipher||{};var Jt=$O.exports=In.cipher.modes=In.cipher.modes||{};Jt.ecb=function(r){r=r||{},this.name="ECB",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};Jt.ecb.prototype.start=function(r){};Jt.ecb.prototype.encrypt=function(r,e,t){if(r.length()<this.blockSize&&!(t&&r.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=r.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._outBlock[n])};Jt.ecb.prototype.decrypt=function(r,e,t){if(r.length()<this.blockSize&&!(t&&r.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=r.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._outBlock[n])};Jt.ecb.prototype.pad=function(r,e){var t=r.length()===this.blockSize?this.blockSize:this.blockSize-r.length();return r.fillWithByte(t,t),!0};Jt.ecb.prototype.unpad=function(r,e){if(e.overflow>0)return!1;var t=r.length(),n=r.at(t-1);return n>this.blockSize<<2?!1:(r.truncate(n),!0)};Jt.cbc=function(r){r=r||{},this.name="CBC",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};Jt.cbc.prototype.start=function(r){if(r.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in r)this._iv=pw(r.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")};Jt.cbc.prototype.encrypt=function(r,e,t){if(r.length()<this.blockSize&&!(t&&r.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^r.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._outBlock[n]);this._prev=this._outBlock};Jt.cbc.prototype.decrypt=function(r,e,t){if(r.length()<this.blockSize&&!(t&&r.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=r.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)};Jt.cbc.prototype.pad=function(r,e){var t=r.length()===this.blockSize?this.blockSize:this.blockSize-r.length();return r.fillWithByte(t,t),!0};Jt.cbc.prototype.unpad=function(r,e){if(e.overflow>0)return!1;var t=r.length(),n=r.at(t-1);return n>this.blockSize<<2?!1:(r.truncate(n),!0)};Jt.cfb=function(r){r=r||{},this.name="CFB",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=In.util.createBuffer(),this._partialBytes=0};Jt.cfb.prototype.start=function(r){if(!("iv"in r))throw new Error("Invalid IV parameter.");this._iv=pw(r.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Jt.cfb.prototype.encrypt=function(r,e,t){var n=r.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var s=0;s<this._ints;++s)this._inBlock[s]=r.getInt32()^this._outBlock[s],e.putInt32(this._inBlock[s]);return}var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var s=0;s<this._ints;++s)this._partialBlock[s]=r.getInt32()^this._outBlock[s],this._partialOutput.putInt32(this._partialBlock[s]);if(i>0)r.read-=this.blockSize;else for(var s=0;s<this._ints;++s)this._inBlock[s]=this._partialBlock[s];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!t)return e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};Jt.cfb.prototype.decrypt=function(r,e,t){var n=r.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var s=0;s<this._ints;++s)this._inBlock[s]=r.getInt32(),e.putInt32(this._inBlock[s]^this._outBlock[s]);return}var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var s=0;s<this._ints;++s)this._partialBlock[s]=r.getInt32(),this._partialOutput.putInt32(this._partialBlock[s]^this._outBlock[s]);if(i>0)r.read-=this.blockSize;else for(var s=0;s<this._ints;++s)this._inBlock[s]=this._partialBlock[s];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!t)return e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};Jt.ofb=function(r){r=r||{},this.name="OFB",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=In.util.createBuffer(),this._partialBytes=0};Jt.ofb.prototype.start=function(r){if(!("iv"in r))throw new Error("Invalid IV parameter.");this._iv=pw(r.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Jt.ofb.prototype.encrypt=function(r,e,t){var n=r.length();if(r.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var s=0;s<this._ints;++s)e.putInt32(r.getInt32()^this._outBlock[s]),this._inBlock[s]=this._outBlock[s];return}var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var s=0;s<this._ints;++s)this._partialOutput.putInt32(r.getInt32()^this._outBlock[s]);if(i>0)r.read-=this.blockSize;else for(var s=0;s<this._ints;++s)this._inBlock[s]=this._outBlock[s];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!t)return e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};Jt.ofb.prototype.decrypt=Jt.ofb.prototype.encrypt;Jt.ctr=function(r){r=r||{},this.name="CTR",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=In.util.createBuffer(),this._partialBytes=0};Jt.ctr.prototype.start=function(r){if(!("iv"in r))throw new Error("Invalid IV parameter.");this._iv=pw(r.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Jt.ctr.prototype.encrypt=function(r,e,t){var n=r.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize)for(var s=0;s<this._ints;++s)e.putInt32(r.getInt32()^this._outBlock[s]);else{var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var s=0;s<this._ints;++s)this._partialOutput.putInt32(r.getInt32()^this._outBlock[s]);if(i>0&&(r.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!t)return e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}dw(this._inBlock)};Jt.ctr.prototype.decrypt=Jt.ctr.prototype.encrypt;Jt.gcm=function(r){r=r||{},this.name="GCM",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=In.util.createBuffer(),this._partialBytes=0,this._R=3774873600};Jt.gcm.prototype.start=function(r){if(!("iv"in r))throw new Error("Invalid IV parameter.");var e=In.util.createBuffer(r.iv);this._cipherLength=0;var t;if("additionalData"in r?t=In.util.createBuffer(r.additionalData):t=In.util.createBuffer(),"tagLength"in r?this._tagLength=r.tagLength:this._tagLength=128,this._tag=null,r.decrypt&&(this._tag=In.util.createBuffer(r.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=e.length();if(n===12)this._j0=[e.getInt32(),e.getInt32(),e.getInt32(),1];else{for(this._j0=[0,0,0,0];e.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(H2(n*8)))}this._inBlock=this._j0.slice(0),dw(this._inBlock),this._partialBytes=0,t=In.util.createBuffer(t),this._aDataLength=H2(t.length()*8);var s=t.length()%this.blockSize;for(s&&t.fillWithByte(0,this.blockSize-s),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])};Jt.gcm.prototype.encrypt=function(r,e,t){var n=r.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var s=0;s<this._ints;++s)e.putInt32(this._outBlock[s]^=r.getInt32());this._cipherLength+=this.blockSize}else{var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var s=0;s<this._ints;++s)this._partialOutput.putInt32(r.getInt32()^this._outBlock[s]);if(i<=0||t){if(t){var a=n%this.blockSize;this._cipherLength+=a,this._partialOutput.truncate(this.blockSize-a)}else this._cipherLength+=this.blockSize;for(var s=0;s<this._ints;++s)this._outBlock[s]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!t)return r.read-=this.blockSize,e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),dw(this._inBlock)};Jt.gcm.prototype.decrypt=function(r,e,t){var n=r.length();if(n<this.blockSize&&!(t&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),dw(this._inBlock),this._hashBlock[0]=r.getInt32(),this._hashBlock[1]=r.getInt32(),this._hashBlock[2]=r.getInt32(),this._hashBlock[3]=r.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var s=0;s<this._ints;++s)e.putInt32(this._outBlock[s]^this._hashBlock[s]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize};Jt.gcm.prototype.afterFinish=function(r,e){var t=!0;e.decrypt&&e.overflow&&r.truncate(this.blockSize-e.overflow),this.tag=In.util.createBuffer();var n=this._aDataLength.concat(H2(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,n);var s=[];this.cipher.encrypt(this._j0,s);for(var i=0;i<this._ints;++i)this.tag.putInt32(this._s[i]^s[i]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),e.decrypt&&this.tag.bytes()!==this._tag&&(t=!1),t};Jt.gcm.prototype.multiply=function(r,e){for(var t=[0,0,0,0],n=e.slice(0),s=0;s<128;++s){var i=r[s/32|0]&1<<31-s%32;i&&(t[0]^=n[0],t[1]^=n[1],t[2]^=n[2],t[3]^=n[3]),this.pow(n,n)}return t};Jt.gcm.prototype.pow=function(r,e){for(var t=r[3]&1,n=3;n>0;--n)e[n]=r[n]>>>1|(r[n-1]&1)<<31;e[0]=r[0]>>>1,t&&(e[0]^=this._R)};Jt.gcm.prototype.tableMultiply=function(r){for(var e=[0,0,0,0],t=0;t<32;++t){var n=t/8|0,s=r[n]>>>(7-t%8)*4&15,i=this._m[t][s];e[0]^=i[0],e[1]^=i[1],e[2]^=i[2],e[3]^=i[3]}return e};Jt.gcm.prototype.ghash=function(r,e,t){return e[0]^=t[0],e[1]^=t[1],e[2]^=t[2],e[3]^=t[3],this.tableMultiply(e)};Jt.gcm.prototype.generateHashTable=function(r,e){for(var t=8/e,n=4*t,s=16*t,i=new Array(s),a=0;a<s;++a){var u=[0,0,0,0],c=a/n|0,f=(n-1-a%n)*e;u[c]=1<<e-1<<f,i[a]=this.generateSubHashTable(this.multiply(u,r),e)}return i};Jt.gcm.prototype.generateSubHashTable=function(r,e){var t=1<<e,n=t>>>1,s=new Array(t);s[n]=r.slice(0);for(var i=n>>>1;i>0;)this.pow(s[2*i],s[i]=[]),i>>=1;for(i=2;i<n;){for(var a=1;a<i;++a){var u=s[i],c=s[a];s[i+a]=[u[0]^c[0],u[1]^c[1],u[2]^c[2],u[3]^c[3]]}i*=2}for(s[0]=[0,0,0,0],i=n+1;i<t;++i){var f=s[i^n];s[i]=[r[0]^f[0],r[1]^f[1],r[2]^f[2],r[3]^f[3]]}return s};function pw(r,e){if(typeof r=="string"&&(r=In.util.createBuffer(r)),In.util.isArray(r)&&r.length>4){var t=r;r=In.util.createBuffer();for(var n=0;n<t.length;++n)r.putByte(t[n])}if(r.length()<e)throw new Error("Invalid IV length; got "+r.length()+" bytes and expected "+e+" bytes.");if(!In.util.isArray(r)){for(var s=[],i=e/4,n=0;n<i;++n)s.push(r.getInt32());r=s}return r}o(pw,"transformIV");function dw(r){r[r.length-1]=r[r.length-1]+1&4294967295}o(dw,"inc32");function H2(r){return[r/4294967296|0,r&4294967295]}o(H2,"from64To32")});var Pu=Z((Fpe,zO)=>{"use strict";var Dr=$t();hw();K2();lr();zO.exports=Dr.aes=Dr.aes||{};Dr.aes.startEncrypting=function(r,e,t,n){var s=mw({key:r,output:t,decrypt:!1,mode:n});return s.start(e),s};Dr.aes.createEncryptionCipher=function(r,e){return mw({key:r,output:null,decrypt:!1,mode:e})};Dr.aes.startDecrypting=function(r,e,t,n){var s=mw({key:r,output:t,decrypt:!0,mode:n});return s.start(e),s};Dr.aes.createDecryptionCipher=function(r,e){return mw({key:r,output:null,decrypt:!0,mode:e})};Dr.aes.Algorithm=function(r,e){X2||XO();var t=this;t.name=r,t.mode=new e({blockSize:16,cipher:{encrypt:o(function(n,s){return G2(t._w,n,s,!1)},"encrypt"),decrypt:o(function(n,s){return G2(t._w,n,s,!0)},"decrypt")}}),t._init=!1};Dr.aes.Algorithm.prototype.initialize=function(r){if(!this._init){var e=r.key,t;if(typeof e=="string"&&(e.length===16||e.length===24||e.length===32))e=Dr.util.createBuffer(e);else if(Dr.util.isArray(e)&&(e.length===16||e.length===24||e.length===32)){t=e,e=Dr.util.createBuffer();for(var n=0;n<t.length;++n)e.putByte(t[n])}if(!Dr.util.isArray(e)){t=e,e=[];var s=t.length();if(s===16||s===24||s===32){s=s>>>2;for(var n=0;n<s;++n)e.push(t.getInt32())}}if(!Dr.util.isArray(e)||!(e.length===4||e.length===6||e.length===8))throw new Error("Invalid key parameter.");var i=this.mode.name,a=["CFB","OFB","CTR","GCM"].indexOf(i)!==-1;this._w=WO(e,r.decrypt&&!a),this._init=!0}};Dr.aes._expandKey=function(r,e){return X2||XO(),WO(r,e)};Dr.aes._updateBlock=G2;ip("AES-ECB",Dr.cipher.modes.ecb);ip("AES-CBC",Dr.cipher.modes.cbc);ip("AES-CFB",Dr.cipher.modes.cfb);ip("AES-OFB",Dr.cipher.modes.ofb);ip("AES-CTR",Dr.cipher.modes.ctr);ip("AES-GCM",Dr.cipher.modes.gcm);function ip(r,e){var t=o(function(){return new Dr.aes.Algorithm(r,e)},"factory");Dr.cipher.registerAlgorithm(r,t)}o(ip,"registerAlgorithm");var X2=!1,sp=4,gs,$2,GO,Il,Zi;function XO(){X2=!0,GO=[0,1,2,4,8,16,32,64,128,27,54];for(var r=new Array(256),e=0;e<128;++e)r[e]=e<<1,r[e+128]=e+128<<1^283;gs=new Array(256),$2=new Array(256),Il=new Array(4),Zi=new Array(4);for(var e=0;e<4;++e)Il[e]=new Array(256),Zi[e]=new Array(256);for(var t=0,n=0,s,i,a,u,c,f,h,e=0;e<256;++e){u=n^n<<1^n<<2^n<<3^n<<4,u=u>>8^u&255^99,gs[t]=u,$2[u]=t,c=r[u],s=r[t],i=r[s],a=r[i],f=c<<24^u<<16^u<<8^(u^c),h=(s^i^a)<<24^(t^a)<<16^(t^i^a)<<8^(t^s^a);for(var m=0;m<4;++m)Il[m][t]=f,Zi[m][u]=h,f=f<<24|f>>>8,h=h<<24|h>>>8;t===0?t=n=1:(t=s^r[r[r[s^a]]],n^=r[r[n]])}}o(XO,"initialize");function WO(r,e){for(var t=r.slice(0),n,s=1,i=t.length,a=i+6+1,u=sp*a,c=i;c<u;++c)n=t[c-1],c%i===0?(n=gs[n>>>16&255]<<24^gs[n>>>8&255]<<16^gs[n&255]<<8^gs[n>>>24]^GO[s]<<24,s++):i>6&&c%i===4&&(n=gs[n>>>24]<<24^gs[n>>>16&255]<<16^gs[n>>>8&255]<<8^gs[n&255]),t[c]=t[c-i]^n;if(e){var f,h=Zi[0],m=Zi[1],g=Zi[2],x=Zi[3],v=t.slice(0);u=t.length;for(var c=0,w=u-sp;c<u;c+=sp,w-=sp)if(c===0||c===u-sp)v[c]=t[w],v[c+1]=t[w+3],v[c+2]=t[w+2],v[c+3]=t[w+1];else for(var S=0;S<sp;++S)f=t[w+S],v[c+(3&-S)]=h[gs[f>>>24]]^m[gs[f>>>16&255]]^g[gs[f>>>8&255]]^x[gs[f&255]];t=v}return t}o(WO,"_expandKey");function G2(r,e,t,n){var s=r.length/4-1,i,a,u,c,f;n?(i=Zi[0],a=Zi[1],u=Zi[2],c=Zi[3],f=$2):(i=Il[0],a=Il[1],u=Il[2],c=Il[3],f=gs);var h,m,g,x,v,w,S;h=e[0]^r[0],m=e[n?3:1]^r[1],g=e[2]^r[2],x=e[n?1:3]^r[3];for(var A=3,T=1;T<s;++T)v=i[h>>>24]^a[m>>>16&255]^u[g>>>8&255]^c[x&255]^r[++A],w=i[m>>>24]^a[g>>>16&255]^u[x>>>8&255]^c[h&255]^r[++A],S=i[g>>>24]^a[x>>>16&255]^u[h>>>8&255]^c[m&255]^r[++A],x=i[x>>>24]^a[h>>>16&255]^u[m>>>8&255]^c[g&255]^r[++A],h=v,m=w,g=S;t[0]=f[h>>>24]<<24^f[m>>>16&255]<<16^f[g>>>8&255]<<8^f[x&255]^r[++A],t[n?3:1]=f[m>>>24]<<24^f[g>>>16&255]<<16^f[x>>>8&255]<<8^f[h&255]^r[++A],t[2]=f[g>>>24]<<24^f[x>>>16&255]<<16^f[h>>>8&255]<<8^f[m&255]^r[++A],t[n?1:3]=f[x>>>24]<<24^f[h>>>16&255]<<16^f[m>>>8&255]<<8^f[g&255]^r[++A]}o(G2,"_updateBlock");function mw(r){r=r||{};var e=(r.mode||"CBC").toUpperCase(),t="AES-"+e,n;r.decrypt?n=Dr.cipher.createDecipher(t,r.key):n=Dr.cipher.createCipher(t,r.key);var s=n.start;return n.start=function(i,a){var u=null;a instanceof Dr.util.ByteBuffer&&(u=a,a={}),a=a||{},a.output=u,a.iv=i,s.call(n,a)},n}o(mw,"_createCipher")});var Ou=Z((Hpe,JO)=>{"use strict";var W0=$t();W0.pki=W0.pki||{};var W2=JO.exports=W0.pki.oids=W0.oids=W0.oids||{};function Ue(r,e){W2[r]=e,W2[e]=r}o(Ue,"_IN");function xr(r,e){W2[r]=e}o(xr,"_I_");Ue("1.2.840.113549.1.1.1","rsaEncryption");Ue("1.2.840.113549.1.1.4","md5WithRSAEncryption");Ue("1.2.840.113549.1.1.5","sha1WithRSAEncryption");Ue("1.2.840.113549.1.1.7","RSAES-OAEP");Ue("1.2.840.113549.1.1.8","mgf1");Ue("1.2.840.113549.1.1.9","pSpecified");Ue("1.2.840.113549.1.1.10","RSASSA-PSS");Ue("1.2.840.113549.1.1.11","sha256WithRSAEncryption");Ue("1.2.840.113549.1.1.12","sha384WithRSAEncryption");Ue("1.2.840.113549.1.1.13","sha512WithRSAEncryption");Ue("1.3.101.112","EdDSA25519");Ue("1.2.840.10040.4.3","dsa-with-sha1");Ue("1.3.14.3.2.7","desCBC");Ue("1.3.14.3.2.26","sha1");Ue("1.3.14.3.2.29","sha1WithRSASignature");Ue("2.16.840.1.101.3.4.2.1","sha256");Ue("2.16.840.1.101.3.4.2.2","sha384");Ue("2.16.840.1.101.3.4.2.3","sha512");Ue("2.16.840.1.101.3.4.2.4","sha224");Ue("2.16.840.1.101.3.4.2.5","sha512-224");Ue("2.16.840.1.101.3.4.2.6","sha512-256");Ue("1.2.840.113549.2.2","md2");Ue("1.2.840.113549.2.5","md5");Ue("1.2.840.113549.1.7.1","data");Ue("1.2.840.113549.1.7.2","signedData");Ue("1.2.840.113549.1.7.3","envelopedData");Ue("1.2.840.113549.1.7.4","signedAndEnvelopedData");Ue("1.2.840.113549.1.7.5","digestedData");Ue("1.2.840.113549.1.7.6","encryptedData");Ue("1.2.840.113549.1.9.1","emailAddress");Ue("1.2.840.113549.1.9.2","unstructuredName");Ue("1.2.840.113549.1.9.3","contentType");Ue("1.2.840.113549.1.9.4","messageDigest");Ue("1.2.840.113549.1.9.5","signingTime");Ue("1.2.840.113549.1.9.6","counterSignature");Ue("1.2.840.113549.1.9.7","challengePassword");Ue("1.2.840.113549.1.9.8","unstructuredAddress");Ue("1.2.840.113549.1.9.14","extensionRequest");Ue("1.2.840.113549.1.9.20","friendlyName");Ue("1.2.840.113549.1.9.21","localKeyId");Ue("1.2.840.113549.1.9.22.1","x509Certificate");Ue("1.2.840.113549.1.12.10.1.1","keyBag");Ue("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag");Ue("1.2.840.113549.1.12.10.1.3","certBag");Ue("1.2.840.113549.1.12.10.1.4","crlBag");Ue("1.2.840.113549.1.12.10.1.5","secretBag");Ue("1.2.840.113549.1.12.10.1.6","safeContentsBag");Ue("1.2.840.113549.1.5.13","pkcs5PBES2");Ue("1.2.840.113549.1.5.12","pkcs5PBKDF2");Ue("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4");Ue("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4");Ue("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC");Ue("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC");Ue("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC");Ue("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC");Ue("1.2.840.113549.2.7","hmacWithSHA1");Ue("1.2.840.113549.2.8","hmacWithSHA224");Ue("1.2.840.113549.2.9","hmacWithSHA256");Ue("1.2.840.113549.2.10","hmacWithSHA384");Ue("1.2.840.113549.2.11","hmacWithSHA512");Ue("1.2.840.113549.3.7","des-EDE3-CBC");Ue("2.16.840.1.101.3.4.1.2","aes128-CBC");Ue("2.16.840.1.101.3.4.1.22","aes192-CBC");Ue("2.16.840.1.101.3.4.1.42","aes256-CBC");Ue("2.5.4.3","commonName");Ue("2.5.4.4","surname");Ue("2.5.4.5","serialNumber");Ue("2.5.4.6","countryName");Ue("2.5.4.7","localityName");Ue("2.5.4.8","stateOrProvinceName");Ue("2.5.4.9","streetAddress");Ue("2.5.4.10","organizationName");Ue("2.5.4.11","organizationalUnitName");Ue("2.5.4.12","title");Ue("2.5.4.13","description");Ue("2.5.4.15","businessCategory");Ue("2.5.4.17","postalCode");Ue("2.5.4.42","givenName");Ue("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName");Ue("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName");Ue("2.16.840.1.113730.1.1","nsCertType");Ue("2.16.840.1.113730.1.13","nsComment");xr("2.5.29.1","authorityKeyIdentifier");xr("2.5.29.2","keyAttributes");xr("2.5.29.3","certificatePolicies");xr("2.5.29.4","keyUsageRestriction");xr("2.5.29.5","policyMapping");xr("2.5.29.6","subtreesConstraint");xr("2.5.29.7","subjectAltName");xr("2.5.29.8","issuerAltName");xr("2.5.29.9","subjectDirectoryAttributes");xr("2.5.29.10","basicConstraints");xr("2.5.29.11","nameConstraints");xr("2.5.29.12","policyConstraints");xr("2.5.29.13","basicConstraints");Ue("2.5.29.14","subjectKeyIdentifier");Ue("2.5.29.15","keyUsage");xr("2.5.29.16","privateKeyUsagePeriod");Ue("2.5.29.17","subjectAltName");Ue("2.5.29.18","issuerAltName");Ue("2.5.29.19","basicConstraints");xr("2.5.29.20","cRLNumber");xr("2.5.29.21","cRLReason");xr("2.5.29.22","expirationDate");xr("2.5.29.23","instructionCode");xr("2.5.29.24","invalidityDate");xr("2.5.29.25","cRLDistributionPoints");xr("2.5.29.26","issuingDistributionPoint");xr("2.5.29.27","deltaCRLIndicator");xr("2.5.29.28","issuingDistributionPoint");xr("2.5.29.29","certificateIssuer");xr("2.5.29.30","nameConstraints");Ue("2.5.29.31","cRLDistributionPoints");Ue("2.5.29.32","certificatePolicies");xr("2.5.29.33","policyMappings");xr("2.5.29.34","policyConstraints");Ue("2.5.29.35","authorityKeyIdentifier");xr("2.5.29.36","policyConstraints");Ue("2.5.29.37","extKeyUsage");xr("2.5.29.46","freshestCRL");xr("2.5.29.54","inhibitAnyPolicy");Ue("1.3.6.1.4.1.11129.2.4.2","timestampList");Ue("1.3.6.1.5.5.7.1.1","authorityInfoAccess");Ue("1.3.6.1.5.5.7.3.1","serverAuth");Ue("1.3.6.1.5.5.7.3.2","clientAuth");Ue("1.3.6.1.5.5.7.3.3","codeSigning");Ue("1.3.6.1.5.5.7.3.4","emailProtection");Ue("1.3.6.1.5.5.7.3.8","timeStamping")});var ea=Z(($pe,QO)=>{"use strict";var jr=$t();lr();Ou();var Ze=QO.exports=jr.asn1=jr.asn1||{};Ze.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};Ze.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};Ze.create=function(r,e,t,n,s){if(jr.util.isArray(n)){for(var i=[],a=0;a<n.length;++a)n[a]!==void 0&&i.push(n[a]);n=i}var u={tagClass:r,type:e,constructed:t,composed:t||jr.util.isArray(n),value:n};return s&&"bitStringContents"in s&&(u.bitStringContents=s.bitStringContents,u.original=Ze.copy(u)),u};Ze.copy=function(r,e){var t;if(jr.util.isArray(r)){t=[];for(var n=0;n<r.length;++n)t.push(Ze.copy(r[n],e));return t}return typeof r=="string"?r:(t={tagClass:r.tagClass,type:r.type,constructed:r.constructed,composed:r.composed,value:Ze.copy(r.value,e)},e&&!e.excludeBitStringContents&&(t.bitStringContents=r.bitStringContents),t)};Ze.equals=function(r,e,t){if(jr.util.isArray(r)){if(!jr.util.isArray(e)||r.length!==e.length)return!1;for(var n=0;n<r.length;++n)if(!Ze.equals(r[n],e[n]))return!1;return!0}if(typeof r!=typeof e)return!1;if(typeof r=="string")return r===e;var s=r.tagClass===e.tagClass&&r.type===e.type&&r.constructed===e.constructed&&r.composed===e.composed&&Ze.equals(r.value,e.value);return t&&t.includeBitStringContents&&(s=s&&r.bitStringContents===e.bitStringContents),s};Ze.getBerValueLength=function(r){var e=r.getByte();if(e!==128){var t,n=e&128;return n?t=r.getInt((e&127)<<3):t=e,t}};function z0(r,e,t){if(t>e){var n=new Error("Too few bytes to parse DER.");throw n.available=r.length(),n.remaining=e,n.requested=t,n}}o(z0,"_checkBufferLength");var Dz=o(function(r,e){var t=r.getByte();if(e--,t!==128){var n,s=t&128;if(!s)n=t;else{var i=t&127;z0(r,e,i),n=r.getInt(i<<3)}if(n<0)throw new Error("Negative length: "+n);return n}},"_getValueLength");Ze.fromDer=function(r,e){e===void 0&&(e={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof e=="boolean"&&(e={strict:e,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in e||(e.strict=!0),"parseAllBytes"in e||(e.parseAllBytes=!0),"decodeBitStrings"in e||(e.decodeBitStrings=!0),typeof r=="string"&&(r=jr.util.createBuffer(r));var t=r.length(),n=gw(r,r.length(),0,e);if(e.parseAllBytes&&r.length()!==0){var s=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw s.byteCount=t,s.remaining=r.length(),s}return n};function gw(r,e,t,n){var s;z0(r,e,2);var i=r.getByte();e--;var a=i&192,u=i&31;s=r.length();var c=Dz(r,e);if(e-=s-r.length(),c!==void 0&&c>e){if(n.strict){var f=new Error("Too few bytes to read ASN.1 value.");throw f.available=r.length(),f.remaining=e,f.requested=c,f}c=e}var h,m,g=(i&32)===32;if(g)if(h=[],c===void 0)for(;;){if(z0(r,e,2),r.bytes(2)==="\0\0"){r.getBytes(2),e-=2;break}s=r.length(),h.push(gw(r,e,t+1,n)),e-=s-r.length()}else for(;c>0;)s=r.length(),h.push(gw(r,c,t+1,n)),e-=s-r.length(),c-=s-r.length();if(h===void 0&&a===Ze.Class.UNIVERSAL&&u===Ze.Type.BITSTRING&&(m=r.bytes(c)),h===void 0&&n.decodeBitStrings&&a===Ze.Class.UNIVERSAL&&u===Ze.Type.BITSTRING&&c>1){var x=r.read,v=e,w=0;if(u===Ze.Type.BITSTRING&&(z0(r,e,1),w=r.getByte(),e--),w===0)try{s=r.length();var S={strict:!0,decodeBitStrings:!0},A=gw(r,e,t+1,S),T=s-r.length();e-=T,u==Ze.Type.BITSTRING&&T++;var b=A.tagClass;T===c&&(b===Ze.Class.UNIVERSAL||b===Ze.Class.CONTEXT_SPECIFIC)&&(h=[A])}catch{}h===void 0&&(r.read=x,e=v)}if(h===void 0){if(c===void 0){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");c=e}if(u===Ze.Type.BMPSTRING)for(h="";c>0;c-=2)z0(r,e,2),h+=String.fromCharCode(r.getInt16()),e-=2;else h=r.getBytes(c),e-=c}var E=m===void 0?null:{bitStringContents:m};return Ze.create(a,u,g,h,E)}o(gw,"_fromDer");Ze.toDer=function(r){var e=jr.util.createBuffer(),t=r.tagClass|r.type,n=jr.util.createBuffer(),s=!1;if("bitStringContents"in r&&(s=!0,r.original&&(s=Ze.equals(r,r.original))),s)n.putBytes(r.bitStringContents);else if(r.composed){r.constructed?t|=32:n.putByte(0);for(var i=0;i<r.value.length;++i)r.value[i]!==void 0&&n.putBuffer(Ze.toDer(r.value[i]))}else if(r.type===Ze.Type.BMPSTRING)for(var i=0;i<r.value.length;++i)n.putInt16(r.value.charCodeAt(i));else r.type===Ze.Type.INTEGER&&r.value.length>1&&(r.value.charCodeAt(0)===0&&(r.value.charCodeAt(1)&128)===0||r.value.charCodeAt(0)===255&&(r.value.charCodeAt(1)&128)===128)?n.putBytes(r.value.substr(1)):n.putBytes(r.value);if(e.putByte(t),n.length()<=127)e.putByte(n.length()&127);else{var a=n.length(),u="";do u+=String.fromCharCode(a&255),a=a>>>8;while(a>0);e.putByte(u.length|128);for(var i=u.length-1;i>=0;--i)e.putByte(u.charCodeAt(i))}return e.putBuffer(n),e};Ze.oidToDer=function(r){var e=r.split("."),t=jr.util.createBuffer();t.putByte(40*parseInt(e[0],10)+parseInt(e[1],10));for(var n,s,i,a,u=2;u<e.length;++u){n=!0,s=[],i=parseInt(e[u],10);do a=i&127,i=i>>>7,n||(a|=128),s.push(a),n=!1;while(i>0);for(var c=s.length-1;c>=0;--c)t.putByte(s[c])}return t};Ze.derToOid=function(r){var e;typeof r=="string"&&(r=jr.util.createBuffer(r));var t=r.getByte();e=Math.floor(t/40)+"."+t%40;for(var n=0;r.length()>0;)t=r.getByte(),n=n<<7,t&128?n+=t&127:(e+="."+(n+t),n=0);return e};Ze.utcTimeToDate=function(r){var e=new Date,t=parseInt(r.substr(0,2),10);t=t>=50?1900+t:2e3+t;var n=parseInt(r.substr(2,2),10)-1,s=parseInt(r.substr(4,2),10),i=parseInt(r.substr(6,2),10),a=parseInt(r.substr(8,2),10),u=0;if(r.length>11){var c=r.charAt(10),f=10;c!=="+"&&c!=="-"&&(u=parseInt(r.substr(10,2),10),f+=2)}if(e.setUTCFullYear(t,n,s),e.setUTCHours(i,a,u,0),f&&(c=r.charAt(f),c==="+"||c==="-")){var h=parseInt(r.substr(f+1,2),10),m=parseInt(r.substr(f+4,2),10),g=h*60+m;g*=6e4,c==="+"?e.setTime(+e-g):e.setTime(+e+g)}return e};Ze.generalizedTimeToDate=function(r){var e=new Date,t=parseInt(r.substr(0,4),10),n=parseInt(r.substr(4,2),10)-1,s=parseInt(r.substr(6,2),10),i=parseInt(r.substr(8,2),10),a=parseInt(r.substr(10,2),10),u=parseInt(r.substr(12,2),10),c=0,f=0,h=!1;r.charAt(r.length-1)==="Z"&&(h=!0);var m=r.length-5,g=r.charAt(m);if(g==="+"||g==="-"){var x=parseInt(r.substr(m+1,2),10),v=parseInt(r.substr(m+4,2),10);f=x*60+v,f*=6e4,g==="+"&&(f*=-1),h=!0}return r.charAt(14)==="."&&(c=parseFloat(r.substr(14),10)*1e3),h?(e.setUTCFullYear(t,n,s),e.setUTCHours(i,a,u,c),e.setTime(+e+f)):(e.setFullYear(t,n,s),e.setHours(i,a,u,c)),e};Ze.dateToUtcTime=function(r){if(typeof r=="string")return r;var e="",t=[];t.push((""+r.getUTCFullYear()).substr(2)),t.push(""+(r.getUTCMonth()+1)),t.push(""+r.getUTCDate()),t.push(""+r.getUTCHours()),t.push(""+r.getUTCMinutes()),t.push(""+r.getUTCSeconds());for(var n=0;n<t.length;++n)t[n].length<2&&(e+="0"),e+=t[n];return e+="Z",e};Ze.dateToGeneralizedTime=function(r){if(typeof r=="string")return r;var e="",t=[];t.push(""+r.getUTCFullYear()),t.push(""+(r.getUTCMonth()+1)),t.push(""+r.getUTCDate()),t.push(""+r.getUTCHours()),t.push(""+r.getUTCMinutes()),t.push(""+r.getUTCSeconds());for(var n=0;n<t.length;++n)t[n].length<2&&(e+="0"),e+=t[n];return e+="Z",e};Ze.integerToDer=function(r){var e=jr.util.createBuffer();if(r>=-128&&r<128)return e.putSignedInt(r,8);if(r>=-32768&&r<32768)return e.putSignedInt(r,16);if(r>=-8388608&&r<8388608)return e.putSignedInt(r,24);if(r>=-2147483648&&r<2147483648)return e.putSignedInt(r,32);var t=new Error("Integer too large; max is 32-bits.");throw t.integer=r,t};Ze.derToInteger=function(r){typeof r=="string"&&(r=jr.util.createBuffer(r));var e=r.length()*8;if(e>32)throw new Error("Integer too large; max is 32-bits.");return r.getSignedInt(e)};Ze.validate=function(r,e,t,n){var s=!1;if((r.tagClass===e.tagClass||typeof e.tagClass>"u")&&(r.type===e.type||typeof e.type>"u"))if(r.constructed===e.constructed||typeof e.constructed>"u"){if(s=!0,e.value&&jr.util.isArray(e.value))for(var i=0,a=0;s&&a<e.value.length;++a)s=e.value[a].optional||!1,r.value[i]&&(s=Ze.validate(r.value[i],e.value[a],t,n),s?++i:e.value[a].optional&&(s=!0)),!s&&n&&n.push("["+e.name+'] Tag class "'+e.tagClass+'", type "'+e.type+'" expected value length "'+e.value.length+'", got "'+r.value.length+'"');if(s&&t&&(e.capture&&(t[e.capture]=r.value),e.captureAsn1&&(t[e.captureAsn1]=r),e.captureBitStringContents&&"bitStringContents"in r&&(t[e.captureBitStringContents]=r.bitStringContents),e.captureBitStringValue&&"bitStringContents"in r)){var u;if(r.bitStringContents.length<2)t[e.captureBitStringValue]="";else{var c=r.bitStringContents.charCodeAt(0);if(c!==0)throw new Error("captureBitStringValue only supported for zero unused bits");t[e.captureBitStringValue]=r.bitStringContents.slice(1)}}}else n&&n.push("["+e.name+'] Expected constructed "'+e.constructed+'", got "'+r.constructed+'"');else n&&(r.tagClass!==e.tagClass&&n.push("["+e.name+'] Expected tag class "'+e.tagClass+'", got "'+r.tagClass+'"'),r.type!==e.type&&n.push("["+e.name+'] Expected type "'+e.type+'", got "'+r.type+'"'));return s};var YO=/[^\\u0000-\\u00ff]/;Ze.prettyPrint=function(r,e,t){var n="";e=e||0,t=t||2,e>0&&(n+=`
2
+ import{a as o,b as Xe,d as Z,f as Zx}from"./chunk-W6MRGYXP.mjs";var $t=Z((_pe,LO)=>{"use strict";LO.exports={options:{usePureJavaScript:!1}}});var jO=Z((Bpe,UO)=>{"use strict";var U2={};UO.exports=U2;var VO={};U2.encode=function(r,e,t){if(typeof e!="string")throw new TypeError('"alphabet" must be a string.');if(t!==void 0&&typeof t!="number")throw new TypeError('"maxline" must be a number.');var n="";if(!(r instanceof Uint8Array))n=Ez(r,e);else{var s=0,i=e.length,a=e.charAt(0),u=[0];for(s=0;s<r.length;++s){for(var c=0,f=r[s];c<u.length;++c)f+=u[c]<<8,u[c]=f%i,f=f/i|0;for(;f>0;)u.push(f%i),f=f/i|0}for(s=0;r[s]===0&&s<r.length-1;++s)n+=a;for(s=u.length-1;s>=0;--s)n+=e[u[s]]}if(t){var h=new RegExp(".{1,"+t+"}","g");n=n.match(h).join(`\r
3
+ `)}return n};U2.decode=function(r,e){if(typeof r!="string")throw new TypeError('"input" must be a string.');if(typeof e!="string")throw new TypeError('"alphabet" must be a string.');var t=VO[e];if(!t){t=VO[e]=[];for(var n=0;n<e.length;++n)t[e.charCodeAt(n)]=n}r=r.replace(/\s/g,"");for(var s=e.length,i=e.charAt(0),a=[0],n=0;n<r.length;n++){var u=t[r.charCodeAt(n)];if(u===void 0)return;for(var c=0,f=u;c<a.length;++c)f+=a[c]*s,a[c]=f&255,f>>=8;for(;f>0;)a.push(f&255),f>>=8}for(var h=0;r[h]===i&&h<r.length-1;++h)a.push(0);return typeof Buffer<"u"?Buffer.from(a.reverse()):new Uint8Array(a.reverse())};function Ez(r,e){var t=0,n=e.length,s=e.charAt(0),i=[0];for(t=0;t<r.length();++t){for(var a=0,u=r.at(t);a<i.length;++a)u+=i[a]<<8,i[a]=u%n,u=u/n|0;for(;u>0;)i.push(u%n),u=u/n|0}var c="";for(t=0;r.at(t)===0&&t<r.length()-1;++t)c+=s;for(t=i.length-1;t>=0;--t)c+=e[i[t]];return c}o(Ez,"_encodeWithByteBuffer")});var lr=Z((Rpe,HO)=>{"use strict";var MO=$t(),FO=jO(),ne=HO.exports=MO.util=MO.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){ne.nextTick=process.nextTick,typeof setImmediate=="function"?ne.setImmediate=setImmediate:ne.setImmediate=ne.nextTick;return}if(typeof setImmediate=="function"){ne.setImmediate=function(){return setImmediate.apply(void 0,arguments)},ne.nextTick=function(u){return setImmediate(u)};return}if(ne.setImmediate=function(u){setTimeout(u,0)},typeof window<"u"&&typeof window.postMessage=="function"){let u=function(c){if(c.source===window&&c.data===r){c.stopPropagation();var f=e.slice();e.length=0,f.forEach(function(h){h()})}};var a=u;o(u,"handler");var r="forge.setImmediate",e=[];ne.setImmediate=function(c){e.push(c),e.length===1&&window.postMessage(r,"*")},window.addEventListener("message",u,!0)}if(typeof MutationObserver<"u"){var t=Date.now(),n=!0,s=document.createElement("div"),e=[];new MutationObserver(function(){var c=e.slice();e.length=0,c.forEach(function(f){f()})}).observe(s,{attributes:!0});var i=ne.setImmediate;ne.setImmediate=function(c){Date.now()-t>15?(t=Date.now(),i(c)):(e.push(c),e.length===1&&s.setAttribute("a",n=!n))}}ne.nextTick=ne.setImmediate})();ne.isNodejs=typeof process<"u"&&process.versions&&process.versions.node;ne.globalScope=(function(){return ne.isNodejs?global:typeof self>"u"?window:self})();ne.isArray=Array.isArray||function(r){return Object.prototype.toString.call(r)==="[object Array]"};ne.isArrayBuffer=function(r){return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer};ne.isArrayBufferView=function(r){return r&&ne.isArrayBuffer(r.buffer)&&r.byteLength!==void 0};function X0(r){if(!(r===8||r===16||r===24||r===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+r)}o(X0,"_checkBitsParam");ne.ByteBuffer=j2;function j2(r){if(this.data="",this.read=0,typeof r=="string")this.data=r;else if(ne.isArrayBuffer(r)||ne.isArrayBufferView(r))if(typeof Buffer<"u"&&r instanceof Buffer)this.data=r.toString("binary");else{var e=new Uint8Array(r);try{this.data=String.fromCharCode.apply(null,e)}catch{for(var t=0;t<e.length;++t)this.putByte(e[t])}}else(r instanceof j2||typeof r=="object"&&typeof r.data=="string"&&typeof r.read=="number")&&(this.data=r.data,this.read=r.read);this._constructedStringLength=0}o(j2,"ByteStringBuffer");ne.ByteStringBuffer=j2;var Az=4096;ne.ByteStringBuffer.prototype._optimizeConstructedString=function(r){this._constructedStringLength+=r,this._constructedStringLength>Az&&(this.data.substr(0,1),this._constructedStringLength=0)};ne.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};ne.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0};ne.ByteStringBuffer.prototype.putByte=function(r){return this.putBytes(String.fromCharCode(r))};ne.ByteStringBuffer.prototype.fillWithByte=function(r,e){r=String.fromCharCode(r);for(var t=this.data;e>0;)e&1&&(t+=r),e>>>=1,e>0&&(r+=r);return this.data=t,this._optimizeConstructedString(e),this};ne.ByteStringBuffer.prototype.putBytes=function(r){return this.data+=r,this._optimizeConstructedString(r.length),this};ne.ByteStringBuffer.prototype.putString=function(r){return this.putBytes(ne.encodeUtf8(r))};ne.ByteStringBuffer.prototype.putInt16=function(r){return this.putBytes(String.fromCharCode(r>>8&255)+String.fromCharCode(r&255))};ne.ByteStringBuffer.prototype.putInt24=function(r){return this.putBytes(String.fromCharCode(r>>16&255)+String.fromCharCode(r>>8&255)+String.fromCharCode(r&255))};ne.ByteStringBuffer.prototype.putInt32=function(r){return this.putBytes(String.fromCharCode(r>>24&255)+String.fromCharCode(r>>16&255)+String.fromCharCode(r>>8&255)+String.fromCharCode(r&255))};ne.ByteStringBuffer.prototype.putInt16Le=function(r){return this.putBytes(String.fromCharCode(r&255)+String.fromCharCode(r>>8&255))};ne.ByteStringBuffer.prototype.putInt24Le=function(r){return this.putBytes(String.fromCharCode(r&255)+String.fromCharCode(r>>8&255)+String.fromCharCode(r>>16&255))};ne.ByteStringBuffer.prototype.putInt32Le=function(r){return this.putBytes(String.fromCharCode(r&255)+String.fromCharCode(r>>8&255)+String.fromCharCode(r>>16&255)+String.fromCharCode(r>>24&255))};ne.ByteStringBuffer.prototype.putInt=function(r,e){X0(e);var t="";do e-=8,t+=String.fromCharCode(r>>e&255);while(e>0);return this.putBytes(t)};ne.ByteStringBuffer.prototype.putSignedInt=function(r,e){return r<0&&(r+=2<<e-1),this.putInt(r,e)};ne.ByteStringBuffer.prototype.putBuffer=function(r){return this.putBytes(r.getBytes())};ne.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)};ne.ByteStringBuffer.prototype.getInt16=function(){var r=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,r};ne.ByteStringBuffer.prototype.getInt24=function(){var r=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,r};ne.ByteStringBuffer.prototype.getInt32=function(){var r=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,r};ne.ByteStringBuffer.prototype.getInt16Le=function(){var r=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,r};ne.ByteStringBuffer.prototype.getInt24Le=function(){var r=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,r};ne.ByteStringBuffer.prototype.getInt32Le=function(){var r=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,r};ne.ByteStringBuffer.prototype.getInt=function(r){X0(r);var e=0;do e=(e<<8)+this.data.charCodeAt(this.read++),r-=8;while(r>0);return e};ne.ByteStringBuffer.prototype.getSignedInt=function(r){var e=this.getInt(r),t=2<<r-2;return e>=t&&(e-=t<<1),e};ne.ByteStringBuffer.prototype.getBytes=function(r){var e;return r?(r=Math.min(this.length(),r),e=this.data.slice(this.read,this.read+r),this.read+=r):r===0?e="":(e=this.read===0?this.data:this.data.slice(this.read),this.clear()),e};ne.ByteStringBuffer.prototype.bytes=function(r){return typeof r>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+r)};ne.ByteStringBuffer.prototype.at=function(r){return this.data.charCodeAt(this.read+r)};ne.ByteStringBuffer.prototype.setAt=function(r,e){return this.data=this.data.substr(0,this.read+r)+String.fromCharCode(e)+this.data.substr(this.read+r+1),this};ne.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};ne.ByteStringBuffer.prototype.copy=function(){var r=ne.createBuffer(this.data);return r.read=this.read,r};ne.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this};ne.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this};ne.ByteStringBuffer.prototype.truncate=function(r){var e=Math.max(0,this.length()-r);return this.data=this.data.substr(this.read,e),this.read=0,this};ne.ByteStringBuffer.prototype.toHex=function(){for(var r="",e=this.read;e<this.data.length;++e){var t=this.data.charCodeAt(e);t<16&&(r+="0"),r+=t.toString(16)}return r};ne.ByteStringBuffer.prototype.toString=function(){return ne.decodeUtf8(this.bytes())};function Cz(r,e){e=e||{},this.read=e.readOffset||0,this.growSize=e.growSize||1024;var t=ne.isArrayBuffer(r),n=ne.isArrayBufferView(r);if(t||n){t?this.data=new DataView(r):this.data=new DataView(r.buffer,r.byteOffset,r.byteLength),this.write="writeOffset"in e?e.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,r!=null&&this.putBytes(r),"writeOffset"in e&&(this.write=e.writeOffset)}o(Cz,"DataBuffer");ne.DataBuffer=Cz;ne.DataBuffer.prototype.length=function(){return this.write-this.read};ne.DataBuffer.prototype.isEmpty=function(){return this.length()<=0};ne.DataBuffer.prototype.accommodate=function(r,e){if(this.length()>=r)return this;e=Math.max(e||this.growSize,r);var t=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+e);return n.set(t),this.data=new DataView(n.buffer),this};ne.DataBuffer.prototype.putByte=function(r){return this.accommodate(1),this.data.setUint8(this.write++,r),this};ne.DataBuffer.prototype.fillWithByte=function(r,e){this.accommodate(e);for(var t=0;t<e;++t)this.data.setUint8(r);return this};ne.DataBuffer.prototype.putBytes=function(r,e){if(ne.isArrayBufferView(r)){var t=new Uint8Array(r.buffer,r.byteOffset,r.byteLength),n=t.byteLength-t.byteOffset;this.accommodate(n);var s=new Uint8Array(this.data.buffer,this.write);return s.set(t),this.write+=n,this}if(ne.isArrayBuffer(r)){var t=new Uint8Array(r);this.accommodate(t.byteLength);var s=new Uint8Array(this.data.buffer);return s.set(t,this.write),this.write+=t.byteLength,this}if(r instanceof ne.DataBuffer||typeof r=="object"&&typeof r.read=="number"&&typeof r.write=="number"&&ne.isArrayBufferView(r.data)){var t=new Uint8Array(r.data.byteLength,r.read,r.length());this.accommodate(t.byteLength);var s=new Uint8Array(r.data.byteLength,this.write);return s.set(t),this.write+=t.byteLength,this}if(r instanceof ne.ByteStringBuffer&&(r=r.data,e="binary"),e=e||"binary",typeof r=="string"){var i;if(e==="hex")return this.accommodate(Math.ceil(r.length/2)),i=new Uint8Array(this.data.buffer,this.write),this.write+=ne.binary.hex.decode(r,i,this.write),this;if(e==="base64")return this.accommodate(Math.ceil(r.length/4)*3),i=new Uint8Array(this.data.buffer,this.write),this.write+=ne.binary.base64.decode(r,i,this.write),this;if(e==="utf8"&&(r=ne.encodeUtf8(r),e="binary"),e==="binary"||e==="raw")return this.accommodate(r.length),i=new Uint8Array(this.data.buffer,this.write),this.write+=ne.binary.raw.decode(i),this;if(e==="utf16")return this.accommodate(r.length*2),i=new Uint16Array(this.data.buffer,this.write),this.write+=ne.text.utf16.encode(i),this;throw new Error("Invalid encoding: "+e)}throw Error("Invalid parameter: "+r)};ne.DataBuffer.prototype.putBuffer=function(r){return this.putBytes(r),r.clear(),this};ne.DataBuffer.prototype.putString=function(r){return this.putBytes(r,"utf16")};ne.DataBuffer.prototype.putInt16=function(r){return this.accommodate(2),this.data.setInt16(this.write,r),this.write+=2,this};ne.DataBuffer.prototype.putInt24=function(r){return this.accommodate(3),this.data.setInt16(this.write,r>>8&65535),this.data.setInt8(this.write,r>>16&255),this.write+=3,this};ne.DataBuffer.prototype.putInt32=function(r){return this.accommodate(4),this.data.setInt32(this.write,r),this.write+=4,this};ne.DataBuffer.prototype.putInt16Le=function(r){return this.accommodate(2),this.data.setInt16(this.write,r,!0),this.write+=2,this};ne.DataBuffer.prototype.putInt24Le=function(r){return this.accommodate(3),this.data.setInt8(this.write,r>>16&255),this.data.setInt16(this.write,r>>8&65535,!0),this.write+=3,this};ne.DataBuffer.prototype.putInt32Le=function(r){return this.accommodate(4),this.data.setInt32(this.write,r,!0),this.write+=4,this};ne.DataBuffer.prototype.putInt=function(r,e){X0(e),this.accommodate(e/8);do e-=8,this.data.setInt8(this.write++,r>>e&255);while(e>0);return this};ne.DataBuffer.prototype.putSignedInt=function(r,e){return X0(e),this.accommodate(e/8),r<0&&(r+=2<<e-1),this.putInt(r,e)};ne.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)};ne.DataBuffer.prototype.getInt16=function(){var r=this.data.getInt16(this.read);return this.read+=2,r};ne.DataBuffer.prototype.getInt24=function(){var r=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,r};ne.DataBuffer.prototype.getInt32=function(){var r=this.data.getInt32(this.read);return this.read+=4,r};ne.DataBuffer.prototype.getInt16Le=function(){var r=this.data.getInt16(this.read,!0);return this.read+=2,r};ne.DataBuffer.prototype.getInt24Le=function(){var r=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,r};ne.DataBuffer.prototype.getInt32Le=function(){var r=this.data.getInt32(this.read,!0);return this.read+=4,r};ne.DataBuffer.prototype.getInt=function(r){X0(r);var e=0;do e=(e<<8)+this.data.getInt8(this.read++),r-=8;while(r>0);return e};ne.DataBuffer.prototype.getSignedInt=function(r){var e=this.getInt(r),t=2<<r-2;return e>=t&&(e-=t<<1),e};ne.DataBuffer.prototype.getBytes=function(r){var e;return r?(r=Math.min(this.length(),r),e=this.data.slice(this.read,this.read+r),this.read+=r):r===0?e="":(e=this.read===0?this.data:this.data.slice(this.read),this.clear()),e};ne.DataBuffer.prototype.bytes=function(r){return typeof r>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+r)};ne.DataBuffer.prototype.at=function(r){return this.data.getUint8(this.read+r)};ne.DataBuffer.prototype.setAt=function(r,e){return this.data.setUint8(r,e),this};ne.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};ne.DataBuffer.prototype.copy=function(){return new ne.DataBuffer(this)};ne.DataBuffer.prototype.compact=function(){if(this.read>0){var r=new Uint8Array(this.data.buffer,this.read),e=new Uint8Array(r.byteLength);e.set(r),this.data=new DataView(e),this.write-=this.read,this.read=0}return this};ne.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this};ne.DataBuffer.prototype.truncate=function(r){return this.write=Math.max(0,this.length()-r),this.read=Math.min(this.read,this.write),this};ne.DataBuffer.prototype.toHex=function(){for(var r="",e=this.read;e<this.data.byteLength;++e){var t=this.data.getUint8(e);t<16&&(r+="0"),r+=t.toString(16)}return r};ne.DataBuffer.prototype.toString=function(r){var e=new Uint8Array(this.data,this.read,this.length());if(r=r||"utf8",r==="binary"||r==="raw")return ne.binary.raw.encode(e);if(r==="hex")return ne.binary.hex.encode(e);if(r==="base64")return ne.binary.base64.encode(e);if(r==="utf8")return ne.text.utf8.decode(e);if(r==="utf16")return ne.text.utf16.decode(e);throw new Error("Invalid encoding: "+r)};ne.createBuffer=function(r,e){return e=e||"raw",r!==void 0&&e==="utf8"&&(r=ne.encodeUtf8(r)),new ne.ByteBuffer(r)};ne.fillString=function(r,e){for(var t="";e>0;)e&1&&(t+=r),e>>>=1,e>0&&(r+=r);return t};ne.xorBytes=function(r,e,t){for(var n="",s="",i="",a=0,u=0;t>0;--t,++a)s=r.charCodeAt(a)^e.charCodeAt(a),u>=10&&(n+=i,i="",u=0),i+=String.fromCharCode(s),++u;return n+=i,n};ne.hexToBytes=function(r){var e="",t=0;for(r.length&!0&&(t=1,e+=String.fromCharCode(parseInt(r[0],16)));t<r.length;t+=2)e+=String.fromCharCode(parseInt(r.substr(t,2),16));return e};ne.bytesToHex=function(r){return ne.createBuffer(r).toHex()};ne.int32ToBytes=function(r){return String.fromCharCode(r>>24&255)+String.fromCharCode(r>>16&255)+String.fromCharCode(r>>8&255)+String.fromCharCode(r&255)};var Bu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Du=[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],qO="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";ne.encode64=function(r,e){for(var t="",n="",s,i,a,u=0;u<r.length;)s=r.charCodeAt(u++),i=r.charCodeAt(u++),a=r.charCodeAt(u++),t+=Bu.charAt(s>>2),t+=Bu.charAt((s&3)<<4|i>>4),isNaN(i)?t+="==":(t+=Bu.charAt((i&15)<<2|a>>6),t+=isNaN(a)?"=":Bu.charAt(a&63)),e&&t.length>e&&(n+=t.substr(0,e)+`\r
4
+ `,t=t.substr(e));return n+=t,n};ne.decode64=function(r){r=r.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var e="",t,n,s,i,a=0;a<r.length;)t=Du[r.charCodeAt(a++)-43],n=Du[r.charCodeAt(a++)-43],s=Du[r.charCodeAt(a++)-43],i=Du[r.charCodeAt(a++)-43],e+=String.fromCharCode(t<<2|n>>4),s!==64&&(e+=String.fromCharCode((n&15)<<4|s>>2),i!==64&&(e+=String.fromCharCode((s&3)<<6|i)));return e};ne.encodeUtf8=function(r){return unescape(encodeURIComponent(r))};ne.decodeUtf8=function(r){return decodeURIComponent(escape(r))};ne.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:FO.encode,decode:FO.decode}};ne.binary.raw.encode=function(r){return String.fromCharCode.apply(null,r)};ne.binary.raw.decode=function(r,e,t){var n=e;n||(n=new Uint8Array(r.length)),t=t||0;for(var s=t,i=0;i<r.length;++i)n[s++]=r.charCodeAt(i);return e?s-t:n};ne.binary.hex.encode=ne.bytesToHex;ne.binary.hex.decode=function(r,e,t){var n=e;n||(n=new Uint8Array(Math.ceil(r.length/2))),t=t||0;var s=0,i=t;for(r.length&1&&(s=1,n[i++]=parseInt(r[0],16));s<r.length;s+=2)n[i++]=parseInt(r.substr(s,2),16);return e?i-t:n};ne.binary.base64.encode=function(r,e){for(var t="",n="",s,i,a,u=0;u<r.byteLength;)s=r[u++],i=r[u++],a=r[u++],t+=Bu.charAt(s>>2),t+=Bu.charAt((s&3)<<4|i>>4),isNaN(i)?t+="==":(t+=Bu.charAt((i&15)<<2|a>>6),t+=isNaN(a)?"=":Bu.charAt(a&63)),e&&t.length>e&&(n+=t.substr(0,e)+`\r
5
+ `,t=t.substr(e));return n+=t,n};ne.binary.base64.decode=function(r,e,t){var n=e;n||(n=new Uint8Array(Math.ceil(r.length/4)*3)),r=r.replace(/[^A-Za-z0-9\+\/\=]/g,""),t=t||0;for(var s,i,a,u,c=0,f=t;c<r.length;)s=Du[r.charCodeAt(c++)-43],i=Du[r.charCodeAt(c++)-43],a=Du[r.charCodeAt(c++)-43],u=Du[r.charCodeAt(c++)-43],n[f++]=s<<2|i>>4,a!==64&&(n[f++]=(i&15)<<4|a>>2,u!==64&&(n[f++]=(a&3)<<6|u));return e?f-t:n.subarray(0,f)};ne.binary.base58.encode=function(r,e){return ne.binary.baseN.encode(r,qO,e)};ne.binary.base58.decode=function(r,e){return ne.binary.baseN.decode(r,qO,e)};ne.text={utf8:{},utf16:{}};ne.text.utf8.encode=function(r,e,t){r=ne.encodeUtf8(r);var n=e;n||(n=new Uint8Array(r.length)),t=t||0;for(var s=t,i=0;i<r.length;++i)n[s++]=r.charCodeAt(i);return e?s-t:n};ne.text.utf8.decode=function(r){return ne.decodeUtf8(String.fromCharCode.apply(null,r))};ne.text.utf16.encode=function(r,e,t){var n=e;n||(n=new Uint8Array(r.length*2));var s=new Uint16Array(n.buffer);t=t||0;for(var i=t,a=t,u=0;u<r.length;++u)s[a++]=r.charCodeAt(u),i+=2;return e?i-t:n};ne.text.utf16.decode=function(r){return String.fromCharCode.apply(null,new Uint16Array(r.buffer))};ne.deflate=function(r,e,t){if(e=ne.decode64(r.deflate(ne.encode64(e)).rval),t){var n=2,s=e.charCodeAt(1);s&32&&(n=6),e=e.substring(n,e.length-4)}return e};ne.inflate=function(r,e,t){var n=r.inflate(ne.encode64(e)).rval;return n===null?null:ne.decode64(n)};var M2=o(function(r,e,t){if(!r)throw new Error("WebStorage not available.");var n;if(t===null?n=r.removeItem(e):(t=ne.encode64(JSON.stringify(t)),n=r.setItem(e,t)),typeof n<"u"&&n.rval!==!0){var s=new Error(n.error.message);throw s.id=n.error.id,s.name=n.error.name,s}},"_setStorageObject"),F2=o(function(r,e){if(!r)throw new Error("WebStorage not available.");var t=r.getItem(e);if(r.init)if(t.rval===null){if(t.error){var n=new Error(t.error.message);throw n.id=t.error.id,n.name=t.error.name,n}t=null}else t=t.rval;return t!==null&&(t=JSON.parse(ne.decode64(t))),t},"_getStorageObject"),Nz=o(function(r,e,t,n){var s=F2(r,e);s===null&&(s={}),s[t]=n,M2(r,e,s)},"_setItem"),Tz=o(function(r,e,t){var n=F2(r,e);return n!==null&&(n=t in n?n[t]:null),n},"_getItem"),Iz=o(function(r,e,t){var n=F2(r,e);if(n!==null&&t in n){delete n[t];var s=!0;for(var i in n){s=!1;break}s&&(n=null),M2(r,e,n)}},"_removeItem"),_z=o(function(r,e){M2(r,e,null)},"_clearItems"),fw=o(function(r,e,t){var n=null;typeof t>"u"&&(t=["web","flash"]);var s,i=!1,a=null;for(var u in t){s=t[u];try{if(s==="flash"||s==="both"){if(e[0]===null)throw new Error("Flash local storage not available.");n=r.apply(this,e),i=s==="flash"}(s==="web"||s==="both")&&(e[0]=localStorage,n=r.apply(this,e),i=!0)}catch(c){a=c}if(i)break}if(!i)throw a;return n},"_callStorageFunction");ne.setItem=function(r,e,t,n,s){fw(Nz,arguments,s)};ne.getItem=function(r,e,t,n){return fw(Tz,arguments,n)};ne.removeItem=function(r,e,t,n){fw(Iz,arguments,n)};ne.clearItems=function(r,e,t){fw(_z,arguments,t)};ne.isEmpty=function(r){for(var e in r)if(r.hasOwnProperty(e))return!1;return!0};ne.format=function(r){for(var e=/%./g,t,n,s=0,i=[],a=0;t=e.exec(r);){n=r.substring(a,e.lastIndex-2),n.length>0&&i.push(n),a=e.lastIndex;var u=t[0][1];switch(u){case"s":case"o":s<arguments.length?i.push(arguments[s+++1]):i.push("<?>");break;case"%":i.push("%");break;default:i.push("<%"+u+"?>")}}return i.push(r.substring(a)),i.join("")};ne.formatNumber=function(r,e,t,n){var s=r,i=isNaN(e=Math.abs(e))?2:e,a=t===void 0?",":t,u=n===void 0?".":n,c=s<0?"-":"",f=parseInt(s=Math.abs(+s||0).toFixed(i),10)+"",h=f.length>3?f.length%3:0;return c+(h?f.substr(0,h)+u:"")+f.substr(h).replace(/(\d{3})(?=\d)/g,"$1"+u)+(i?a+Math.abs(s-f).toFixed(i).slice(2):"")};ne.formatSize=function(r){return r>=1073741824?r=ne.formatNumber(r/1073741824,2,".","")+" GiB":r>=1048576?r=ne.formatNumber(r/1048576,2,".","")+" MiB":r>=1024?r=ne.formatNumber(r/1024,0)+" KiB":r=ne.formatNumber(r,0)+" bytes",r};ne.bytesFromIP=function(r){return r.indexOf(".")!==-1?ne.bytesFromIPv4(r):r.indexOf(":")!==-1?ne.bytesFromIPv6(r):null};ne.bytesFromIPv4=function(r){if(r=r.split("."),r.length!==4)return null;for(var e=ne.createBuffer(),t=0;t<r.length;++t){var n=parseInt(r[t],10);if(isNaN(n))return null;e.putByte(n)}return e.getBytes()};ne.bytesFromIPv6=function(r){var e=0;r=r.split(":").filter(function(a){return a.length===0&&++e,!0});for(var t=(8-r.length+e)*2,n=ne.createBuffer(),s=0;s<8;++s){if(!r[s]||r[s].length===0){n.fillWithByte(0,t),t=0;continue}var i=ne.hexToBytes(r[s]);i.length<2&&n.putByte(0),n.putBytes(i)}return n.getBytes()};ne.bytesToIP=function(r){return r.length===4?ne.bytesToIPv4(r):r.length===16?ne.bytesToIPv6(r):null};ne.bytesToIPv4=function(r){if(r.length!==4)return null;for(var e=[],t=0;t<r.length;++t)e.push(r.charCodeAt(t));return e.join(".")};ne.bytesToIPv6=function(r){if(r.length!==16)return null;for(var e=[],t=[],n=0,s=0;s<r.length;s+=2){for(var i=ne.bytesToHex(r[s]+r[s+1]);i[0]==="0"&&i!=="0";)i=i.substr(1);if(i==="0"){var a=t[t.length-1],u=e.length;!a||u!==a.end+1?t.push({start:u,end:u}):(a.end=u,a.end-a.start>t[n].end-t[n].start&&(n=t.length-1))}e.push(i)}if(t.length>0){var c=t[n];c.end-c.start>0&&(e.splice(c.start,c.end-c.start+1,""),c.start===0&&e.unshift(""),c.end===7&&e.push(""))}return e.join(":")};ne.estimateCores=function(r,e){if(typeof r=="function"&&(e=r,r={}),r=r||{},"cores"in ne&&!r.update)return e(null,ne.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return ne.cores=navigator.hardwareConcurrency,e(null,ne.cores);if(typeof Worker>"u")return ne.cores=1,e(null,ne.cores);if(typeof Blob>"u")return ne.cores=2,e(null,ne.cores);var t=URL.createObjectURL(new Blob(["(",(function(){self.addEventListener("message",function(a){for(var u=Date.now(),c=u+4;Date.now()<c;);self.postMessage({st:u,et:c})})}).toString(),")()"],{type:"application/javascript"}));n([],5,16);function n(a,u,c){if(u===0){var f=Math.floor(a.reduce(function(h,m){return h+m},0)/a.length);return ne.cores=Math.max(1,f),URL.revokeObjectURL(t),e(null,ne.cores)}s(c,function(h,m){a.push(i(c,m)),n(a,u-1,c)})}o(n,"sample");function s(a,u){for(var c=[],f=[],h=0;h<a;++h){var m=new Worker(t);m.addEventListener("message",function(g){if(f.push(g.data),f.length===a){for(var x=0;x<a;++x)c[x].terminate();u(null,f)}}),c.push(m)}for(var h=0;h<a;++h)c[h].postMessage(h)}o(s,"map");function i(a,u){for(var c=[],f=0;f<a;++f)for(var h=u[f],m=c[f]=[],g=0;g<a;++g)if(f!==g){var x=u[g];(h.st>x.st&&h.st<x.et||x.st>h.st&&x.st<h.et)&&m.push(g)}return c.reduce(function(v,w){return Math.max(v,w.length)},0)}o(i,"reduce")}});var hw=Z((Ope,KO)=>{"use strict";var Tn=$t();lr();KO.exports=Tn.cipher=Tn.cipher||{};Tn.cipher.algorithms=Tn.cipher.algorithms||{};Tn.cipher.createCipher=function(r,e){var t=r;if(typeof t=="string"&&(t=Tn.cipher.getAlgorithm(t),t&&(t=t())),!t)throw new Error("Unsupported algorithm: "+r);return new Tn.cipher.BlockCipher({algorithm:t,key:e,decrypt:!1})};Tn.cipher.createDecipher=function(r,e){var t=r;if(typeof t=="string"&&(t=Tn.cipher.getAlgorithm(t),t&&(t=t())),!t)throw new Error("Unsupported algorithm: "+r);return new Tn.cipher.BlockCipher({algorithm:t,key:e,decrypt:!0})};Tn.cipher.registerAlgorithm=function(r,e){r=r.toUpperCase(),Tn.cipher.algorithms[r]=e};Tn.cipher.getAlgorithm=function(r){return r=r.toUpperCase(),r in Tn.cipher.algorithms?Tn.cipher.algorithms[r]:null};var q2=Tn.cipher.BlockCipher=function(r){this.algorithm=r.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=r.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=r.decrypt,this.algorithm.initialize(r)};q2.prototype.start=function(r){r=r||{};var e={};for(var t in r)e[t]=r[t];e.decrypt=this._decrypt,this._finish=!1,this._input=Tn.util.createBuffer(),this.output=r.output||Tn.util.createBuffer(),this.mode.start(e)};q2.prototype.update=function(r){for(r&&this._input.putBuffer(r);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()};q2.prototype.finish=function(r){r&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(t){return r(this.blockSize,t,!1)},this.mode.unpad=function(t){return r(this.blockSize,t,!0)});var e={};return e.decrypt=this._decrypt,e.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,e)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,e))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,e))}});var K2=Z((kpe,$O)=>{"use strict";var In=$t();lr();In.cipher=In.cipher||{};var Jt=$O.exports=In.cipher.modes=In.cipher.modes||{};Jt.ecb=function(r){r=r||{},this.name="ECB",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};Jt.ecb.prototype.start=function(r){};Jt.ecb.prototype.encrypt=function(r,e,t){if(r.length()<this.blockSize&&!(t&&r.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=r.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._outBlock[n])};Jt.ecb.prototype.decrypt=function(r,e,t){if(r.length()<this.blockSize&&!(t&&r.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=r.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._outBlock[n])};Jt.ecb.prototype.pad=function(r,e){var t=r.length()===this.blockSize?this.blockSize:this.blockSize-r.length();return r.fillWithByte(t,t),!0};Jt.ecb.prototype.unpad=function(r,e){if(e.overflow>0)return!1;var t=r.length(),n=r.at(t-1);return n>this.blockSize<<2?!1:(r.truncate(n),!0)};Jt.cbc=function(r){r=r||{},this.name="CBC",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};Jt.cbc.prototype.start=function(r){if(r.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in r)this._iv=pw(r.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")};Jt.cbc.prototype.encrypt=function(r,e,t){if(r.length()<this.blockSize&&!(t&&r.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^r.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._outBlock[n]);this._prev=this._outBlock};Jt.cbc.prototype.decrypt=function(r,e,t){if(r.length()<this.blockSize&&!(t&&r.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=r.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)};Jt.cbc.prototype.pad=function(r,e){var t=r.length()===this.blockSize?this.blockSize:this.blockSize-r.length();return r.fillWithByte(t,t),!0};Jt.cbc.prototype.unpad=function(r,e){if(e.overflow>0)return!1;var t=r.length(),n=r.at(t-1);return n>this.blockSize<<2?!1:(r.truncate(n),!0)};Jt.cfb=function(r){r=r||{},this.name="CFB",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=In.util.createBuffer(),this._partialBytes=0};Jt.cfb.prototype.start=function(r){if(!("iv"in r))throw new Error("Invalid IV parameter.");this._iv=pw(r.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Jt.cfb.prototype.encrypt=function(r,e,t){var n=r.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var s=0;s<this._ints;++s)this._inBlock[s]=r.getInt32()^this._outBlock[s],e.putInt32(this._inBlock[s]);return}var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var s=0;s<this._ints;++s)this._partialBlock[s]=r.getInt32()^this._outBlock[s],this._partialOutput.putInt32(this._partialBlock[s]);if(i>0)r.read-=this.blockSize;else for(var s=0;s<this._ints;++s)this._inBlock[s]=this._partialBlock[s];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!t)return e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};Jt.cfb.prototype.decrypt=function(r,e,t){var n=r.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var s=0;s<this._ints;++s)this._inBlock[s]=r.getInt32(),e.putInt32(this._inBlock[s]^this._outBlock[s]);return}var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var s=0;s<this._ints;++s)this._partialBlock[s]=r.getInt32(),this._partialOutput.putInt32(this._partialBlock[s]^this._outBlock[s]);if(i>0)r.read-=this.blockSize;else for(var s=0;s<this._ints;++s)this._inBlock[s]=this._partialBlock[s];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!t)return e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};Jt.ofb=function(r){r=r||{},this.name="OFB",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=In.util.createBuffer(),this._partialBytes=0};Jt.ofb.prototype.start=function(r){if(!("iv"in r))throw new Error("Invalid IV parameter.");this._iv=pw(r.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Jt.ofb.prototype.encrypt=function(r,e,t){var n=r.length();if(r.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var s=0;s<this._ints;++s)e.putInt32(r.getInt32()^this._outBlock[s]),this._inBlock[s]=this._outBlock[s];return}var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var s=0;s<this._ints;++s)this._partialOutput.putInt32(r.getInt32()^this._outBlock[s]);if(i>0)r.read-=this.blockSize;else for(var s=0;s<this._ints;++s)this._inBlock[s]=this._outBlock[s];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!t)return e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};Jt.ofb.prototype.decrypt=Jt.ofb.prototype.encrypt;Jt.ctr=function(r){r=r||{},this.name="CTR",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=In.util.createBuffer(),this._partialBytes=0};Jt.ctr.prototype.start=function(r){if(!("iv"in r))throw new Error("Invalid IV parameter.");this._iv=pw(r.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Jt.ctr.prototype.encrypt=function(r,e,t){var n=r.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize)for(var s=0;s<this._ints;++s)e.putInt32(r.getInt32()^this._outBlock[s]);else{var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var s=0;s<this._ints;++s)this._partialOutput.putInt32(r.getInt32()^this._outBlock[s]);if(i>0&&(r.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!t)return e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}dw(this._inBlock)};Jt.ctr.prototype.decrypt=Jt.ctr.prototype.encrypt;Jt.gcm=function(r){r=r||{},this.name="GCM",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=In.util.createBuffer(),this._partialBytes=0,this._R=3774873600};Jt.gcm.prototype.start=function(r){if(!("iv"in r))throw new Error("Invalid IV parameter.");var e=In.util.createBuffer(r.iv);this._cipherLength=0;var t;if("additionalData"in r?t=In.util.createBuffer(r.additionalData):t=In.util.createBuffer(),"tagLength"in r?this._tagLength=r.tagLength:this._tagLength=128,this._tag=null,r.decrypt&&(this._tag=In.util.createBuffer(r.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=e.length();if(n===12)this._j0=[e.getInt32(),e.getInt32(),e.getInt32(),1];else{for(this._j0=[0,0,0,0];e.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(H2(n*8)))}this._inBlock=this._j0.slice(0),dw(this._inBlock),this._partialBytes=0,t=In.util.createBuffer(t),this._aDataLength=H2(t.length()*8);var s=t.length()%this.blockSize;for(s&&t.fillWithByte(0,this.blockSize-s),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])};Jt.gcm.prototype.encrypt=function(r,e,t){var n=r.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var s=0;s<this._ints;++s)e.putInt32(this._outBlock[s]^=r.getInt32());this._cipherLength+=this.blockSize}else{var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var s=0;s<this._ints;++s)this._partialOutput.putInt32(r.getInt32()^this._outBlock[s]);if(i<=0||t){if(t){var a=n%this.blockSize;this._cipherLength+=a,this._partialOutput.truncate(this.blockSize-a)}else this._cipherLength+=this.blockSize;for(var s=0;s<this._ints;++s)this._outBlock[s]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!t)return r.read-=this.blockSize,e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),dw(this._inBlock)};Jt.gcm.prototype.decrypt=function(r,e,t){var n=r.length();if(n<this.blockSize&&!(t&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),dw(this._inBlock),this._hashBlock[0]=r.getInt32(),this._hashBlock[1]=r.getInt32(),this._hashBlock[2]=r.getInt32(),this._hashBlock[3]=r.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var s=0;s<this._ints;++s)e.putInt32(this._outBlock[s]^this._hashBlock[s]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize};Jt.gcm.prototype.afterFinish=function(r,e){var t=!0;e.decrypt&&e.overflow&&r.truncate(this.blockSize-e.overflow),this.tag=In.util.createBuffer();var n=this._aDataLength.concat(H2(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,n);var s=[];this.cipher.encrypt(this._j0,s);for(var i=0;i<this._ints;++i)this.tag.putInt32(this._s[i]^s[i]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),e.decrypt&&this.tag.bytes()!==this._tag&&(t=!1),t};Jt.gcm.prototype.multiply=function(r,e){for(var t=[0,0,0,0],n=e.slice(0),s=0;s<128;++s){var i=r[s/32|0]&1<<31-s%32;i&&(t[0]^=n[0],t[1]^=n[1],t[2]^=n[2],t[3]^=n[3]),this.pow(n,n)}return t};Jt.gcm.prototype.pow=function(r,e){for(var t=r[3]&1,n=3;n>0;--n)e[n]=r[n]>>>1|(r[n-1]&1)<<31;e[0]=r[0]>>>1,t&&(e[0]^=this._R)};Jt.gcm.prototype.tableMultiply=function(r){for(var e=[0,0,0,0],t=0;t<32;++t){var n=t/8|0,s=r[n]>>>(7-t%8)*4&15,i=this._m[t][s];e[0]^=i[0],e[1]^=i[1],e[2]^=i[2],e[3]^=i[3]}return e};Jt.gcm.prototype.ghash=function(r,e,t){return e[0]^=t[0],e[1]^=t[1],e[2]^=t[2],e[3]^=t[3],this.tableMultiply(e)};Jt.gcm.prototype.generateHashTable=function(r,e){for(var t=8/e,n=4*t,s=16*t,i=new Array(s),a=0;a<s;++a){var u=[0,0,0,0],c=a/n|0,f=(n-1-a%n)*e;u[c]=1<<e-1<<f,i[a]=this.generateSubHashTable(this.multiply(u,r),e)}return i};Jt.gcm.prototype.generateSubHashTable=function(r,e){var t=1<<e,n=t>>>1,s=new Array(t);s[n]=r.slice(0);for(var i=n>>>1;i>0;)this.pow(s[2*i],s[i]=[]),i>>=1;for(i=2;i<n;){for(var a=1;a<i;++a){var u=s[i],c=s[a];s[i+a]=[u[0]^c[0],u[1]^c[1],u[2]^c[2],u[3]^c[3]]}i*=2}for(s[0]=[0,0,0,0],i=n+1;i<t;++i){var f=s[i^n];s[i]=[r[0]^f[0],r[1]^f[1],r[2]^f[2],r[3]^f[3]]}return s};function pw(r,e){if(typeof r=="string"&&(r=In.util.createBuffer(r)),In.util.isArray(r)&&r.length>4){var t=r;r=In.util.createBuffer();for(var n=0;n<t.length;++n)r.putByte(t[n])}if(r.length()<e)throw new Error("Invalid IV length; got "+r.length()+" bytes and expected "+e+" bytes.");if(!In.util.isArray(r)){for(var s=[],i=e/4,n=0;n<i;++n)s.push(r.getInt32());r=s}return r}o(pw,"transformIV");function dw(r){r[r.length-1]=r[r.length-1]+1&4294967295}o(dw,"inc32");function H2(r){return[r/4294967296|0,r&4294967295]}o(H2,"from64To32")});var Ru=Z((Vpe,zO)=>{"use strict";var Dr=$t();hw();K2();lr();zO.exports=Dr.aes=Dr.aes||{};Dr.aes.startEncrypting=function(r,e,t,n){var s=mw({key:r,output:t,decrypt:!1,mode:n});return s.start(e),s};Dr.aes.createEncryptionCipher=function(r,e){return mw({key:r,output:null,decrypt:!1,mode:e})};Dr.aes.startDecrypting=function(r,e,t,n){var s=mw({key:r,output:t,decrypt:!0,mode:n});return s.start(e),s};Dr.aes.createDecryptionCipher=function(r,e){return mw({key:r,output:null,decrypt:!0,mode:e})};Dr.aes.Algorithm=function(r,e){X2||XO();var t=this;t.name=r,t.mode=new e({blockSize:16,cipher:{encrypt:o(function(n,s){return G2(t._w,n,s,!1)},"encrypt"),decrypt:o(function(n,s){return G2(t._w,n,s,!0)},"decrypt")}}),t._init=!1};Dr.aes.Algorithm.prototype.initialize=function(r){if(!this._init){var e=r.key,t;if(typeof e=="string"&&(e.length===16||e.length===24||e.length===32))e=Dr.util.createBuffer(e);else if(Dr.util.isArray(e)&&(e.length===16||e.length===24||e.length===32)){t=e,e=Dr.util.createBuffer();for(var n=0;n<t.length;++n)e.putByte(t[n])}if(!Dr.util.isArray(e)){t=e,e=[];var s=t.length();if(s===16||s===24||s===32){s=s>>>2;for(var n=0;n<s;++n)e.push(t.getInt32())}}if(!Dr.util.isArray(e)||!(e.length===4||e.length===6||e.length===8))throw new Error("Invalid key parameter.");var i=this.mode.name,a=["CFB","OFB","CTR","GCM"].indexOf(i)!==-1;this._w=WO(e,r.decrypt&&!a),this._init=!0}};Dr.aes._expandKey=function(r,e){return X2||XO(),WO(r,e)};Dr.aes._updateBlock=G2;ip("AES-ECB",Dr.cipher.modes.ecb);ip("AES-CBC",Dr.cipher.modes.cbc);ip("AES-CFB",Dr.cipher.modes.cfb);ip("AES-OFB",Dr.cipher.modes.ofb);ip("AES-CTR",Dr.cipher.modes.ctr);ip("AES-GCM",Dr.cipher.modes.gcm);function ip(r,e){var t=o(function(){return new Dr.aes.Algorithm(r,e)},"factory");Dr.cipher.registerAlgorithm(r,t)}o(ip,"registerAlgorithm");var X2=!1,sp=4,gs,$2,GO,Il,Zi;function XO(){X2=!0,GO=[0,1,2,4,8,16,32,64,128,27,54];for(var r=new Array(256),e=0;e<128;++e)r[e]=e<<1,r[e+128]=e+128<<1^283;gs=new Array(256),$2=new Array(256),Il=new Array(4),Zi=new Array(4);for(var e=0;e<4;++e)Il[e]=new Array(256),Zi[e]=new Array(256);for(var t=0,n=0,s,i,a,u,c,f,h,e=0;e<256;++e){u=n^n<<1^n<<2^n<<3^n<<4,u=u>>8^u&255^99,gs[t]=u,$2[u]=t,c=r[u],s=r[t],i=r[s],a=r[i],f=c<<24^u<<16^u<<8^(u^c),h=(s^i^a)<<24^(t^a)<<16^(t^i^a)<<8^(t^s^a);for(var m=0;m<4;++m)Il[m][t]=f,Zi[m][u]=h,f=f<<24|f>>>8,h=h<<24|h>>>8;t===0?t=n=1:(t=s^r[r[r[s^a]]],n^=r[r[n]])}}o(XO,"initialize");function WO(r,e){for(var t=r.slice(0),n,s=1,i=t.length,a=i+6+1,u=sp*a,c=i;c<u;++c)n=t[c-1],c%i===0?(n=gs[n>>>16&255]<<24^gs[n>>>8&255]<<16^gs[n&255]<<8^gs[n>>>24]^GO[s]<<24,s++):i>6&&c%i===4&&(n=gs[n>>>24]<<24^gs[n>>>16&255]<<16^gs[n>>>8&255]<<8^gs[n&255]),t[c]=t[c-i]^n;if(e){var f,h=Zi[0],m=Zi[1],g=Zi[2],x=Zi[3],v=t.slice(0);u=t.length;for(var c=0,w=u-sp;c<u;c+=sp,w-=sp)if(c===0||c===u-sp)v[c]=t[w],v[c+1]=t[w+3],v[c+2]=t[w+2],v[c+3]=t[w+1];else for(var S=0;S<sp;++S)f=t[w+S],v[c+(3&-S)]=h[gs[f>>>24]]^m[gs[f>>>16&255]]^g[gs[f>>>8&255]]^x[gs[f&255]];t=v}return t}o(WO,"_expandKey");function G2(r,e,t,n){var s=r.length/4-1,i,a,u,c,f;n?(i=Zi[0],a=Zi[1],u=Zi[2],c=Zi[3],f=$2):(i=Il[0],a=Il[1],u=Il[2],c=Il[3],f=gs);var h,m,g,x,v,w,S;h=e[0]^r[0],m=e[n?3:1]^r[1],g=e[2]^r[2],x=e[n?1:3]^r[3];for(var A=3,T=1;T<s;++T)v=i[h>>>24]^a[m>>>16&255]^u[g>>>8&255]^c[x&255]^r[++A],w=i[m>>>24]^a[g>>>16&255]^u[x>>>8&255]^c[h&255]^r[++A],S=i[g>>>24]^a[x>>>16&255]^u[h>>>8&255]^c[m&255]^r[++A],x=i[x>>>24]^a[h>>>16&255]^u[m>>>8&255]^c[g&255]^r[++A],h=v,m=w,g=S;t[0]=f[h>>>24]<<24^f[m>>>16&255]<<16^f[g>>>8&255]<<8^f[x&255]^r[++A],t[n?3:1]=f[m>>>24]<<24^f[g>>>16&255]<<16^f[x>>>8&255]<<8^f[h&255]^r[++A],t[2]=f[g>>>24]<<24^f[x>>>16&255]<<16^f[h>>>8&255]<<8^f[m&255]^r[++A],t[n?1:3]=f[x>>>24]<<24^f[h>>>16&255]<<16^f[m>>>8&255]<<8^f[g&255]^r[++A]}o(G2,"_updateBlock");function mw(r){r=r||{};var e=(r.mode||"CBC").toUpperCase(),t="AES-"+e,n;r.decrypt?n=Dr.cipher.createDecipher(t,r.key):n=Dr.cipher.createCipher(t,r.key);var s=n.start;return n.start=function(i,a){var u=null;a instanceof Dr.util.ByteBuffer&&(u=a,a={}),a=a||{},a.output=u,a.iv=i,s.call(n,a)},n}o(mw,"_createCipher")});var Pu=Z((jpe,JO)=>{"use strict";var W0=$t();W0.pki=W0.pki||{};var W2=JO.exports=W0.pki.oids=W0.oids=W0.oids||{};function Ue(r,e){W2[r]=e,W2[e]=r}o(Ue,"_IN");function xr(r,e){W2[r]=e}o(xr,"_I_");Ue("1.2.840.113549.1.1.1","rsaEncryption");Ue("1.2.840.113549.1.1.4","md5WithRSAEncryption");Ue("1.2.840.113549.1.1.5","sha1WithRSAEncryption");Ue("1.2.840.113549.1.1.7","RSAES-OAEP");Ue("1.2.840.113549.1.1.8","mgf1");Ue("1.2.840.113549.1.1.9","pSpecified");Ue("1.2.840.113549.1.1.10","RSASSA-PSS");Ue("1.2.840.113549.1.1.11","sha256WithRSAEncryption");Ue("1.2.840.113549.1.1.12","sha384WithRSAEncryption");Ue("1.2.840.113549.1.1.13","sha512WithRSAEncryption");Ue("1.3.101.112","EdDSA25519");Ue("1.2.840.10040.4.3","dsa-with-sha1");Ue("1.3.14.3.2.7","desCBC");Ue("1.3.14.3.2.26","sha1");Ue("1.3.14.3.2.29","sha1WithRSASignature");Ue("2.16.840.1.101.3.4.2.1","sha256");Ue("2.16.840.1.101.3.4.2.2","sha384");Ue("2.16.840.1.101.3.4.2.3","sha512");Ue("2.16.840.1.101.3.4.2.4","sha224");Ue("2.16.840.1.101.3.4.2.5","sha512-224");Ue("2.16.840.1.101.3.4.2.6","sha512-256");Ue("1.2.840.113549.2.2","md2");Ue("1.2.840.113549.2.5","md5");Ue("1.2.840.113549.1.7.1","data");Ue("1.2.840.113549.1.7.2","signedData");Ue("1.2.840.113549.1.7.3","envelopedData");Ue("1.2.840.113549.1.7.4","signedAndEnvelopedData");Ue("1.2.840.113549.1.7.5","digestedData");Ue("1.2.840.113549.1.7.6","encryptedData");Ue("1.2.840.113549.1.9.1","emailAddress");Ue("1.2.840.113549.1.9.2","unstructuredName");Ue("1.2.840.113549.1.9.3","contentType");Ue("1.2.840.113549.1.9.4","messageDigest");Ue("1.2.840.113549.1.9.5","signingTime");Ue("1.2.840.113549.1.9.6","counterSignature");Ue("1.2.840.113549.1.9.7","challengePassword");Ue("1.2.840.113549.1.9.8","unstructuredAddress");Ue("1.2.840.113549.1.9.14","extensionRequest");Ue("1.2.840.113549.1.9.20","friendlyName");Ue("1.2.840.113549.1.9.21","localKeyId");Ue("1.2.840.113549.1.9.22.1","x509Certificate");Ue("1.2.840.113549.1.12.10.1.1","keyBag");Ue("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag");Ue("1.2.840.113549.1.12.10.1.3","certBag");Ue("1.2.840.113549.1.12.10.1.4","crlBag");Ue("1.2.840.113549.1.12.10.1.5","secretBag");Ue("1.2.840.113549.1.12.10.1.6","safeContentsBag");Ue("1.2.840.113549.1.5.13","pkcs5PBES2");Ue("1.2.840.113549.1.5.12","pkcs5PBKDF2");Ue("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4");Ue("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4");Ue("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC");Ue("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC");Ue("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC");Ue("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC");Ue("1.2.840.113549.2.7","hmacWithSHA1");Ue("1.2.840.113549.2.8","hmacWithSHA224");Ue("1.2.840.113549.2.9","hmacWithSHA256");Ue("1.2.840.113549.2.10","hmacWithSHA384");Ue("1.2.840.113549.2.11","hmacWithSHA512");Ue("1.2.840.113549.3.7","des-EDE3-CBC");Ue("2.16.840.1.101.3.4.1.2","aes128-CBC");Ue("2.16.840.1.101.3.4.1.22","aes192-CBC");Ue("2.16.840.1.101.3.4.1.42","aes256-CBC");Ue("2.5.4.3","commonName");Ue("2.5.4.4","surname");Ue("2.5.4.5","serialNumber");Ue("2.5.4.6","countryName");Ue("2.5.4.7","localityName");Ue("2.5.4.8","stateOrProvinceName");Ue("2.5.4.9","streetAddress");Ue("2.5.4.10","organizationName");Ue("2.5.4.11","organizationalUnitName");Ue("2.5.4.12","title");Ue("2.5.4.13","description");Ue("2.5.4.15","businessCategory");Ue("2.5.4.17","postalCode");Ue("2.5.4.42","givenName");Ue("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName");Ue("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName");Ue("2.16.840.1.113730.1.1","nsCertType");Ue("2.16.840.1.113730.1.13","nsComment");xr("2.5.29.1","authorityKeyIdentifier");xr("2.5.29.2","keyAttributes");xr("2.5.29.3","certificatePolicies");xr("2.5.29.4","keyUsageRestriction");xr("2.5.29.5","policyMapping");xr("2.5.29.6","subtreesConstraint");xr("2.5.29.7","subjectAltName");xr("2.5.29.8","issuerAltName");xr("2.5.29.9","subjectDirectoryAttributes");xr("2.5.29.10","basicConstraints");xr("2.5.29.11","nameConstraints");xr("2.5.29.12","policyConstraints");xr("2.5.29.13","basicConstraints");Ue("2.5.29.14","subjectKeyIdentifier");Ue("2.5.29.15","keyUsage");xr("2.5.29.16","privateKeyUsagePeriod");Ue("2.5.29.17","subjectAltName");Ue("2.5.29.18","issuerAltName");Ue("2.5.29.19","basicConstraints");xr("2.5.29.20","cRLNumber");xr("2.5.29.21","cRLReason");xr("2.5.29.22","expirationDate");xr("2.5.29.23","instructionCode");xr("2.5.29.24","invalidityDate");xr("2.5.29.25","cRLDistributionPoints");xr("2.5.29.26","issuingDistributionPoint");xr("2.5.29.27","deltaCRLIndicator");xr("2.5.29.28","issuingDistributionPoint");xr("2.5.29.29","certificateIssuer");xr("2.5.29.30","nameConstraints");Ue("2.5.29.31","cRLDistributionPoints");Ue("2.5.29.32","certificatePolicies");xr("2.5.29.33","policyMappings");xr("2.5.29.34","policyConstraints");Ue("2.5.29.35","authorityKeyIdentifier");xr("2.5.29.36","policyConstraints");Ue("2.5.29.37","extKeyUsage");xr("2.5.29.46","freshestCRL");xr("2.5.29.54","inhibitAnyPolicy");Ue("1.3.6.1.4.1.11129.2.4.2","timestampList");Ue("1.3.6.1.5.5.7.1.1","authorityInfoAccess");Ue("1.3.6.1.5.5.7.3.1","serverAuth");Ue("1.3.6.1.5.5.7.3.2","clientAuth");Ue("1.3.6.1.5.5.7.3.3","codeSigning");Ue("1.3.6.1.5.5.7.3.4","emailProtection");Ue("1.3.6.1.5.5.7.3.8","timeStamping")});var ea=Z((Fpe,QO)=>{"use strict";var jr=$t();lr();Pu();var Ze=QO.exports=jr.asn1=jr.asn1||{};Ze.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};Ze.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};Ze.create=function(r,e,t,n,s){if(jr.util.isArray(n)){for(var i=[],a=0;a<n.length;++a)n[a]!==void 0&&i.push(n[a]);n=i}var u={tagClass:r,type:e,constructed:t,composed:t||jr.util.isArray(n),value:n};return s&&"bitStringContents"in s&&(u.bitStringContents=s.bitStringContents,u.original=Ze.copy(u)),u};Ze.copy=function(r,e){var t;if(jr.util.isArray(r)){t=[];for(var n=0;n<r.length;++n)t.push(Ze.copy(r[n],e));return t}return typeof r=="string"?r:(t={tagClass:r.tagClass,type:r.type,constructed:r.constructed,composed:r.composed,value:Ze.copy(r.value,e)},e&&!e.excludeBitStringContents&&(t.bitStringContents=r.bitStringContents),t)};Ze.equals=function(r,e,t){if(jr.util.isArray(r)){if(!jr.util.isArray(e)||r.length!==e.length)return!1;for(var n=0;n<r.length;++n)if(!Ze.equals(r[n],e[n]))return!1;return!0}if(typeof r!=typeof e)return!1;if(typeof r=="string")return r===e;var s=r.tagClass===e.tagClass&&r.type===e.type&&r.constructed===e.constructed&&r.composed===e.composed&&Ze.equals(r.value,e.value);return t&&t.includeBitStringContents&&(s=s&&r.bitStringContents===e.bitStringContents),s};Ze.getBerValueLength=function(r){var e=r.getByte();if(e!==128){var t,n=e&128;return n?t=r.getInt((e&127)<<3):t=e,t}};function z0(r,e,t){if(t>e){var n=new Error("Too few bytes to parse DER.");throw n.available=r.length(),n.remaining=e,n.requested=t,n}}o(z0,"_checkBufferLength");var Bz=o(function(r,e){var t=r.getByte();if(e--,t!==128){var n,s=t&128;if(!s)n=t;else{var i=t&127;z0(r,e,i),n=r.getInt(i<<3)}if(n<0)throw new Error("Negative length: "+n);return n}},"_getValueLength");Ze.fromDer=function(r,e){e===void 0&&(e={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof e=="boolean"&&(e={strict:e,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in e||(e.strict=!0),"parseAllBytes"in e||(e.parseAllBytes=!0),"decodeBitStrings"in e||(e.decodeBitStrings=!0),typeof r=="string"&&(r=jr.util.createBuffer(r));var t=r.length(),n=gw(r,r.length(),0,e);if(e.parseAllBytes&&r.length()!==0){var s=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw s.byteCount=t,s.remaining=r.length(),s}return n};function gw(r,e,t,n){var s;z0(r,e,2);var i=r.getByte();e--;var a=i&192,u=i&31;s=r.length();var c=Bz(r,e);if(e-=s-r.length(),c!==void 0&&c>e){if(n.strict){var f=new Error("Too few bytes to read ASN.1 value.");throw f.available=r.length(),f.remaining=e,f.requested=c,f}c=e}var h,m,g=(i&32)===32;if(g)if(h=[],c===void 0)for(;;){if(z0(r,e,2),r.bytes(2)==="\0\0"){r.getBytes(2),e-=2;break}s=r.length(),h.push(gw(r,e,t+1,n)),e-=s-r.length()}else for(;c>0;)s=r.length(),h.push(gw(r,c,t+1,n)),e-=s-r.length(),c-=s-r.length();if(h===void 0&&a===Ze.Class.UNIVERSAL&&u===Ze.Type.BITSTRING&&(m=r.bytes(c)),h===void 0&&n.decodeBitStrings&&a===Ze.Class.UNIVERSAL&&u===Ze.Type.BITSTRING&&c>1){var x=r.read,v=e,w=0;if(u===Ze.Type.BITSTRING&&(z0(r,e,1),w=r.getByte(),e--),w===0)try{s=r.length();var S={strict:!0,decodeBitStrings:!0},A=gw(r,e,t+1,S),T=s-r.length();e-=T,u==Ze.Type.BITSTRING&&T++;var b=A.tagClass;T===c&&(b===Ze.Class.UNIVERSAL||b===Ze.Class.CONTEXT_SPECIFIC)&&(h=[A])}catch{}h===void 0&&(r.read=x,e=v)}if(h===void 0){if(c===void 0){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");c=e}if(u===Ze.Type.BMPSTRING)for(h="";c>0;c-=2)z0(r,e,2),h+=String.fromCharCode(r.getInt16()),e-=2;else h=r.getBytes(c),e-=c}var E=m===void 0?null:{bitStringContents:m};return Ze.create(a,u,g,h,E)}o(gw,"_fromDer");Ze.toDer=function(r){var e=jr.util.createBuffer(),t=r.tagClass|r.type,n=jr.util.createBuffer(),s=!1;if("bitStringContents"in r&&(s=!0,r.original&&(s=Ze.equals(r,r.original))),s)n.putBytes(r.bitStringContents);else if(r.composed){r.constructed?t|=32:n.putByte(0);for(var i=0;i<r.value.length;++i)r.value[i]!==void 0&&n.putBuffer(Ze.toDer(r.value[i]))}else if(r.type===Ze.Type.BMPSTRING)for(var i=0;i<r.value.length;++i)n.putInt16(r.value.charCodeAt(i));else r.type===Ze.Type.INTEGER&&r.value.length>1&&(r.value.charCodeAt(0)===0&&(r.value.charCodeAt(1)&128)===0||r.value.charCodeAt(0)===255&&(r.value.charCodeAt(1)&128)===128)?n.putBytes(r.value.substr(1)):n.putBytes(r.value);if(e.putByte(t),n.length()<=127)e.putByte(n.length()&127);else{var a=n.length(),u="";do u+=String.fromCharCode(a&255),a=a>>>8;while(a>0);e.putByte(u.length|128);for(var i=u.length-1;i>=0;--i)e.putByte(u.charCodeAt(i))}return e.putBuffer(n),e};Ze.oidToDer=function(r){var e=r.split("."),t=jr.util.createBuffer();t.putByte(40*parseInt(e[0],10)+parseInt(e[1],10));for(var n,s,i,a,u=2;u<e.length;++u){n=!0,s=[],i=parseInt(e[u],10);do a=i&127,i=i>>>7,n||(a|=128),s.push(a),n=!1;while(i>0);for(var c=s.length-1;c>=0;--c)t.putByte(s[c])}return t};Ze.derToOid=function(r){var e;typeof r=="string"&&(r=jr.util.createBuffer(r));var t=r.getByte();e=Math.floor(t/40)+"."+t%40;for(var n=0;r.length()>0;)t=r.getByte(),n=n<<7,t&128?n+=t&127:(e+="."+(n+t),n=0);return e};Ze.utcTimeToDate=function(r){var e=new Date,t=parseInt(r.substr(0,2),10);t=t>=50?1900+t:2e3+t;var n=parseInt(r.substr(2,2),10)-1,s=parseInt(r.substr(4,2),10),i=parseInt(r.substr(6,2),10),a=parseInt(r.substr(8,2),10),u=0;if(r.length>11){var c=r.charAt(10),f=10;c!=="+"&&c!=="-"&&(u=parseInt(r.substr(10,2),10),f+=2)}if(e.setUTCFullYear(t,n,s),e.setUTCHours(i,a,u,0),f&&(c=r.charAt(f),c==="+"||c==="-")){var h=parseInt(r.substr(f+1,2),10),m=parseInt(r.substr(f+4,2),10),g=h*60+m;g*=6e4,c==="+"?e.setTime(+e-g):e.setTime(+e+g)}return e};Ze.generalizedTimeToDate=function(r){var e=new Date,t=parseInt(r.substr(0,4),10),n=parseInt(r.substr(4,2),10)-1,s=parseInt(r.substr(6,2),10),i=parseInt(r.substr(8,2),10),a=parseInt(r.substr(10,2),10),u=parseInt(r.substr(12,2),10),c=0,f=0,h=!1;r.charAt(r.length-1)==="Z"&&(h=!0);var m=r.length-5,g=r.charAt(m);if(g==="+"||g==="-"){var x=parseInt(r.substr(m+1,2),10),v=parseInt(r.substr(m+4,2),10);f=x*60+v,f*=6e4,g==="+"&&(f*=-1),h=!0}return r.charAt(14)==="."&&(c=parseFloat(r.substr(14),10)*1e3),h?(e.setUTCFullYear(t,n,s),e.setUTCHours(i,a,u,c),e.setTime(+e+f)):(e.setFullYear(t,n,s),e.setHours(i,a,u,c)),e};Ze.dateToUtcTime=function(r){if(typeof r=="string")return r;var e="",t=[];t.push((""+r.getUTCFullYear()).substr(2)),t.push(""+(r.getUTCMonth()+1)),t.push(""+r.getUTCDate()),t.push(""+r.getUTCHours()),t.push(""+r.getUTCMinutes()),t.push(""+r.getUTCSeconds());for(var n=0;n<t.length;++n)t[n].length<2&&(e+="0"),e+=t[n];return e+="Z",e};Ze.dateToGeneralizedTime=function(r){if(typeof r=="string")return r;var e="",t=[];t.push(""+r.getUTCFullYear()),t.push(""+(r.getUTCMonth()+1)),t.push(""+r.getUTCDate()),t.push(""+r.getUTCHours()),t.push(""+r.getUTCMinutes()),t.push(""+r.getUTCSeconds());for(var n=0;n<t.length;++n)t[n].length<2&&(e+="0"),e+=t[n];return e+="Z",e};Ze.integerToDer=function(r){var e=jr.util.createBuffer();if(r>=-128&&r<128)return e.putSignedInt(r,8);if(r>=-32768&&r<32768)return e.putSignedInt(r,16);if(r>=-8388608&&r<8388608)return e.putSignedInt(r,24);if(r>=-2147483648&&r<2147483648)return e.putSignedInt(r,32);var t=new Error("Integer too large; max is 32-bits.");throw t.integer=r,t};Ze.derToInteger=function(r){typeof r=="string"&&(r=jr.util.createBuffer(r));var e=r.length()*8;if(e>32)throw new Error("Integer too large; max is 32-bits.");return r.getSignedInt(e)};Ze.validate=function(r,e,t,n){var s=!1;if((r.tagClass===e.tagClass||typeof e.tagClass>"u")&&(r.type===e.type||typeof e.type>"u"))if(r.constructed===e.constructed||typeof e.constructed>"u"){if(s=!0,e.value&&jr.util.isArray(e.value))for(var i=0,a=0;s&&a<e.value.length;++a)s=e.value[a].optional||!1,r.value[i]&&(s=Ze.validate(r.value[i],e.value[a],t,n),s?++i:e.value[a].optional&&(s=!0)),!s&&n&&n.push("["+e.name+'] Tag class "'+e.tagClass+'", type "'+e.type+'" expected value length "'+e.value.length+'", got "'+r.value.length+'"');if(s&&t&&(e.capture&&(t[e.capture]=r.value),e.captureAsn1&&(t[e.captureAsn1]=r),e.captureBitStringContents&&"bitStringContents"in r&&(t[e.captureBitStringContents]=r.bitStringContents),e.captureBitStringValue&&"bitStringContents"in r)){var u;if(r.bitStringContents.length<2)t[e.captureBitStringValue]="";else{var c=r.bitStringContents.charCodeAt(0);if(c!==0)throw new Error("captureBitStringValue only supported for zero unused bits");t[e.captureBitStringValue]=r.bitStringContents.slice(1)}}}else n&&n.push("["+e.name+'] Expected constructed "'+e.constructed+'", got "'+r.constructed+'"');else n&&(r.tagClass!==e.tagClass&&n.push("["+e.name+'] Expected tag class "'+e.tagClass+'", got "'+r.tagClass+'"'),r.type!==e.type&&n.push("["+e.name+'] Expected type "'+e.type+'", got "'+r.type+'"'));return s};var YO=/[^\\u0000-\\u00ff]/;Ze.prettyPrint=function(r,e,t){var n="";e=e||0,t=t||2,e>0&&(n+=`
6
6
  `);for(var s="",i=0;i<e*t;++i)s+=" ";switch(n+=s+"Tag: ",r.tagClass){case Ze.Class.UNIVERSAL:n+="Universal:";break;case Ze.Class.APPLICATION:n+="Application:";break;case Ze.Class.CONTEXT_SPECIFIC:n+="Context-Specific:";break;case Ze.Class.PRIVATE:n+="Private:";break}if(r.tagClass===Ze.Class.UNIVERSAL)switch(n+=r.type,r.type){case Ze.Type.NONE:n+=" (None)";break;case Ze.Type.BOOLEAN:n+=" (Boolean)";break;case Ze.Type.INTEGER:n+=" (Integer)";break;case Ze.Type.BITSTRING:n+=" (Bit string)";break;case Ze.Type.OCTETSTRING:n+=" (Octet string)";break;case Ze.Type.NULL:n+=" (Null)";break;case Ze.Type.OID:n+=" (Object Identifier)";break;case Ze.Type.ODESC:n+=" (Object Descriptor)";break;case Ze.Type.EXTERNAL:n+=" (External or Instance of)";break;case Ze.Type.REAL:n+=" (Real)";break;case Ze.Type.ENUMERATED:n+=" (Enumerated)";break;case Ze.Type.EMBEDDED:n+=" (Embedded PDV)";break;case Ze.Type.UTF8:n+=" (UTF8)";break;case Ze.Type.ROID:n+=" (Relative Object Identifier)";break;case Ze.Type.SEQUENCE:n+=" (Sequence)";break;case Ze.Type.SET:n+=" (Set)";break;case Ze.Type.PRINTABLESTRING:n+=" (Printable String)";break;case Ze.Type.IA5String:n+=" (IA5String (ASCII))";break;case Ze.Type.UTCTIME:n+=" (UTC time)";break;case Ze.Type.GENERALIZEDTIME:n+=" (Generalized time)";break;case Ze.Type.BMPSTRING:n+=" (BMP String)";break}else n+=r.type;if(n+=`
7
7
  `,n+=s+"Constructed: "+r.constructed+`
8
- `,r.composed){for(var a=0,u="",i=0;i<r.value.length;++i)r.value[i]!==void 0&&(a+=1,u+=Ze.prettyPrint(r.value[i],e+1,t),i+1<r.value.length&&(u+=","));n+=s+"Sub values: "+a+u}else{if(n+=s+"Value: ",r.type===Ze.Type.OID){var c=Ze.derToOid(r.value);n+=c,jr.pki&&jr.pki.oids&&c in jr.pki.oids&&(n+=" ("+jr.pki.oids[c]+") ")}if(r.type===Ze.Type.INTEGER)try{n+=Ze.derToInteger(r.value)}catch{n+="0x"+jr.util.bytesToHex(r.value)}else if(r.type===Ze.Type.BITSTRING){if(r.value.length>1?n+="0x"+jr.util.bytesToHex(r.value.slice(1)):n+="(none)",r.value.length>0){var f=r.value.charCodeAt(0);f==1?n+=" (1 unused bit shown)":f>1&&(n+=" ("+f+" unused bits shown)")}}else if(r.type===Ze.Type.OCTETSTRING)YO.test(r.value)||(n+="("+r.value+") "),n+="0x"+jr.util.bytesToHex(r.value);else if(r.type===Ze.Type.UTF8)try{n+=jr.util.decodeUtf8(r.value)}catch(h){if(h.message==="URI malformed")n+="0x"+jr.util.bytesToHex(r.value)+" (malformed UTF8)";else throw h}else r.type===Ze.Type.PRINTABLESTRING||r.type===Ze.Type.IA5String?n+=r.value:YO.test(r.value)?n+="0x"+jr.util.bytesToHex(r.value):r.value.length===0?n+="[null]":n+=r.value}return n}});var Ia=Z((Xpe,ZO)=>{"use strict";var vw=$t();ZO.exports=vw.md=vw.md||{};vw.md.algorithms=vw.md.algorithms||{}});var ap=Z((Wpe,e3)=>{"use strict";var Co=$t();Ia();lr();var Rz=e3.exports=Co.hmac=Co.hmac||{};Rz.create=function(){var r=null,e=null,t=null,n=null,s={};return s.start=function(i,a){if(i!==null)if(typeof i=="string")if(i=i.toLowerCase(),i in Co.md.algorithms)e=Co.md.algorithms[i].create();else throw new Error('Unknown hash algorithm "'+i+'"');else e=i;if(a===null)a=r;else{if(typeof a=="string")a=Co.util.createBuffer(a);else if(Co.util.isArray(a)){var u=a;a=Co.util.createBuffer();for(var c=0;c<u.length;++c)a.putByte(u[c])}var f=a.length();f>e.blockLength&&(e.start(),e.update(a.bytes()),a=e.digest()),t=Co.util.createBuffer(),n=Co.util.createBuffer(),f=a.length();for(var c=0;c<f;++c){var u=a.at(c);t.putByte(54^u),n.putByte(92^u)}if(f<e.blockLength)for(var u=e.blockLength-f,c=0;c<u;++c)t.putByte(54),n.putByte(92);r=a,t=t.bytes(),n=n.bytes()}e.start(),e.update(t)},s.update=function(i){e.update(i)},s.getMac=function(){var i=e.digest().bytes();return e.start(),e.update(n),e.update(i),e.digest()},s.digest=s.getMac,s}});var xw=Z((zpe,s3)=>{"use strict";var _a=$t();Ia();lr();var r3=s3.exports=_a.md5=_a.md5||{};_a.md.md5=_a.md.algorithms.md5=r3;r3.create=function(){n3||Pz();var r=null,e=_a.util.createBuffer(),t=new Array(16),n={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var s=n.messageLengthSize/4,i=0;i<s;++i)n.fullMessageLength.push(0);return e=_a.util.createBuffer(),r={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},n},n.start(),n.update=function(s,i){i==="utf8"&&(s=_a.util.encodeUtf8(s));var a=s.length;n.messageLength+=a,a=[a/4294967296>>>0,a>>>0];for(var u=n.fullMessageLength.length-1;u>=0;--u)n.fullMessageLength[u]+=a[1],a[1]=a[0]+(n.fullMessageLength[u]/4294967296>>>0),n.fullMessageLength[u]=n.fullMessageLength[u]>>>0,a[0]=a[1]/4294967296>>>0;return e.putBytes(s),t3(r,t,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var s=_a.util.createBuffer();s.putBytes(e.bytes());var i=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,a=i&n.blockLength-1;s.putBytes(z2.substr(0,n.blockLength-a));for(var u,c=0,f=n.fullMessageLength.length-1;f>=0;--f)u=n.fullMessageLength[f]*8+c,c=u/4294967296>>>0,s.putInt32Le(u>>>0);var h={h0:r.h0,h1:r.h1,h2:r.h2,h3:r.h3};t3(h,t,s);var m=_a.util.createBuffer();return m.putInt32Le(h.h0),m.putInt32Le(h.h1),m.putInt32Le(h.h2),m.putInt32Le(h.h3),m},n};var z2=null,yw=null,J0=null,op=null,n3=!1;function Pz(){z2="\x80",z2+=_a.util.fillString("\0",64),yw=[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],J0=[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],op=new Array(64);for(var r=0;r<64;++r)op[r]=Math.floor(Math.abs(Math.sin(r+1))*4294967296);n3=!0}o(Pz,"_init");function t3(r,e,t){for(var n,s,i,a,u,c,f,h,m=t.length();m>=64;){for(s=r.h0,i=r.h1,a=r.h2,u=r.h3,h=0;h<16;++h)e[h]=t.getInt32Le(),c=u^i&(a^u),n=s+c+op[h]+e[h],f=J0[h],s=u,u=a,a=i,i+=n<<f|n>>>32-f;for(;h<32;++h)c=a^u&(i^a),n=s+c+op[h]+e[yw[h]],f=J0[h],s=u,u=a,a=i,i+=n<<f|n>>>32-f;for(;h<48;++h)c=i^a^u,n=s+c+op[h]+e[yw[h]],f=J0[h],s=u,u=a,a=i,i+=n<<f|n>>>32-f;for(;h<64;++h)c=a^(i|~u),n=s+c+op[h]+e[yw[h]],f=J0[h],s=u,u=a,a=i,i+=n<<f|n>>>32-f;r.h0=r.h0+s|0,r.h1=r.h1+i|0,r.h2=r.h2+a|0,r.h3=r.h3+u|0,m-=64}}o(t3,"_update")});var _l=Z((Ype,a3)=>{"use strict";var Sw=$t();lr();var i3=a3.exports=Sw.pem=Sw.pem||{};i3.encode=function(r,e){e=e||{};var t="-----BEGIN "+r.type+`-----\r
8
+ `,r.composed){for(var a=0,u="",i=0;i<r.value.length;++i)r.value[i]!==void 0&&(a+=1,u+=Ze.prettyPrint(r.value[i],e+1,t),i+1<r.value.length&&(u+=","));n+=s+"Sub values: "+a+u}else{if(n+=s+"Value: ",r.type===Ze.Type.OID){var c=Ze.derToOid(r.value);n+=c,jr.pki&&jr.pki.oids&&c in jr.pki.oids&&(n+=" ("+jr.pki.oids[c]+") ")}if(r.type===Ze.Type.INTEGER)try{n+=Ze.derToInteger(r.value)}catch{n+="0x"+jr.util.bytesToHex(r.value)}else if(r.type===Ze.Type.BITSTRING){if(r.value.length>1?n+="0x"+jr.util.bytesToHex(r.value.slice(1)):n+="(none)",r.value.length>0){var f=r.value.charCodeAt(0);f==1?n+=" (1 unused bit shown)":f>1&&(n+=" ("+f+" unused bits shown)")}}else if(r.type===Ze.Type.OCTETSTRING)YO.test(r.value)||(n+="("+r.value+") "),n+="0x"+jr.util.bytesToHex(r.value);else if(r.type===Ze.Type.UTF8)try{n+=jr.util.decodeUtf8(r.value)}catch(h){if(h.message==="URI malformed")n+="0x"+jr.util.bytesToHex(r.value)+" (malformed UTF8)";else throw h}else r.type===Ze.Type.PRINTABLESTRING||r.type===Ze.Type.IA5String?n+=r.value:YO.test(r.value)?n+="0x"+jr.util.bytesToHex(r.value):r.value.length===0?n+="[null]":n+=r.value}return n}});var Ia=Z((Hpe,ZO)=>{"use strict";var vw=$t();ZO.exports=vw.md=vw.md||{};vw.md.algorithms=vw.md.algorithms||{}});var ap=Z((Kpe,e3)=>{"use strict";var Co=$t();Ia();lr();var Dz=e3.exports=Co.hmac=Co.hmac||{};Dz.create=function(){var r=null,e=null,t=null,n=null,s={};return s.start=function(i,a){if(i!==null)if(typeof i=="string")if(i=i.toLowerCase(),i in Co.md.algorithms)e=Co.md.algorithms[i].create();else throw new Error('Unknown hash algorithm "'+i+'"');else e=i;if(a===null)a=r;else{if(typeof a=="string")a=Co.util.createBuffer(a);else if(Co.util.isArray(a)){var u=a;a=Co.util.createBuffer();for(var c=0;c<u.length;++c)a.putByte(u[c])}var f=a.length();f>e.blockLength&&(e.start(),e.update(a.bytes()),a=e.digest()),t=Co.util.createBuffer(),n=Co.util.createBuffer(),f=a.length();for(var c=0;c<f;++c){var u=a.at(c);t.putByte(54^u),n.putByte(92^u)}if(f<e.blockLength)for(var u=e.blockLength-f,c=0;c<u;++c)t.putByte(54),n.putByte(92);r=a,t=t.bytes(),n=n.bytes()}e.start(),e.update(t)},s.update=function(i){e.update(i)},s.getMac=function(){var i=e.digest().bytes();return e.start(),e.update(n),e.update(i),e.digest()},s.digest=s.getMac,s}});var xw=Z(($pe,s3)=>{"use strict";var _a=$t();Ia();lr();var r3=s3.exports=_a.md5=_a.md5||{};_a.md.md5=_a.md.algorithms.md5=r3;r3.create=function(){n3||Rz();var r=null,e=_a.util.createBuffer(),t=new Array(16),n={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var s=n.messageLengthSize/4,i=0;i<s;++i)n.fullMessageLength.push(0);return e=_a.util.createBuffer(),r={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},n},n.start(),n.update=function(s,i){i==="utf8"&&(s=_a.util.encodeUtf8(s));var a=s.length;n.messageLength+=a,a=[a/4294967296>>>0,a>>>0];for(var u=n.fullMessageLength.length-1;u>=0;--u)n.fullMessageLength[u]+=a[1],a[1]=a[0]+(n.fullMessageLength[u]/4294967296>>>0),n.fullMessageLength[u]=n.fullMessageLength[u]>>>0,a[0]=a[1]/4294967296>>>0;return e.putBytes(s),t3(r,t,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var s=_a.util.createBuffer();s.putBytes(e.bytes());var i=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,a=i&n.blockLength-1;s.putBytes(z2.substr(0,n.blockLength-a));for(var u,c=0,f=n.fullMessageLength.length-1;f>=0;--f)u=n.fullMessageLength[f]*8+c,c=u/4294967296>>>0,s.putInt32Le(u>>>0);var h={h0:r.h0,h1:r.h1,h2:r.h2,h3:r.h3};t3(h,t,s);var m=_a.util.createBuffer();return m.putInt32Le(h.h0),m.putInt32Le(h.h1),m.putInt32Le(h.h2),m.putInt32Le(h.h3),m},n};var z2=null,yw=null,J0=null,op=null,n3=!1;function Rz(){z2="\x80",z2+=_a.util.fillString("\0",64),yw=[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],J0=[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],op=new Array(64);for(var r=0;r<64;++r)op[r]=Math.floor(Math.abs(Math.sin(r+1))*4294967296);n3=!0}o(Rz,"_init");function t3(r,e,t){for(var n,s,i,a,u,c,f,h,m=t.length();m>=64;){for(s=r.h0,i=r.h1,a=r.h2,u=r.h3,h=0;h<16;++h)e[h]=t.getInt32Le(),c=u^i&(a^u),n=s+c+op[h]+e[h],f=J0[h],s=u,u=a,a=i,i+=n<<f|n>>>32-f;for(;h<32;++h)c=a^u&(i^a),n=s+c+op[h]+e[yw[h]],f=J0[h],s=u,u=a,a=i,i+=n<<f|n>>>32-f;for(;h<48;++h)c=i^a^u,n=s+c+op[h]+e[yw[h]],f=J0[h],s=u,u=a,a=i,i+=n<<f|n>>>32-f;for(;h<64;++h)c=a^(i|~u),n=s+c+op[h]+e[yw[h]],f=J0[h],s=u,u=a,a=i,i+=n<<f|n>>>32-f;r.h0=r.h0+s|0,r.h1=r.h1+i|0,r.h2=r.h2+a|0,r.h3=r.h3+u|0,m-=64}}o(t3,"_update")});var _l=Z((Xpe,a3)=>{"use strict";var Sw=$t();lr();var i3=a3.exports=Sw.pem=Sw.pem||{};i3.encode=function(r,e){e=e||{};var t="-----BEGIN "+r.type+`-----\r
9
9
  `,n;if(r.procType&&(n={name:"Proc-Type",values:[String(r.procType.version),r.procType.type]},t+=ww(n)),r.contentDomain&&(n={name:"Content-Domain",values:[r.contentDomain]},t+=ww(n)),r.dekInfo&&(n={name:"DEK-Info",values:[r.dekInfo.algorithm]},r.dekInfo.parameters&&n.values.push(r.dekInfo.parameters),t+=ww(n)),r.headers)for(var s=0;s<r.headers.length;++s)t+=ww(r.headers[s]);return r.procType&&(t+=`\r
10
10
  `),t+=Sw.util.encode64(r.body,e.maxline||64)+`\r
11
11
  `,t+="-----END "+r.type+`-----\r
12
- `,t};i3.decode=function(r){for(var e=[],t=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,n=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,s=/\r?\n/,i;i=t.exec(r),!!i;){var a=i[1];a==="NEW CERTIFICATE REQUEST"&&(a="CERTIFICATE REQUEST");var u={type:a,procType:null,contentDomain:null,dekInfo:null,headers:[],body:Sw.util.decode64(i[3])};if(e.push(u),!!i[2]){for(var c=i[2].split(s),f=0;i&&f<c.length;){for(var h=c[f].replace(/\s+$/,""),m=f+1;m<c.length;++m){var g=c[m];if(!/\s/.test(g[0]))break;h+=g,f=m}if(i=h.match(n),i){for(var x={name:i[1],values:[]},v=i[2].split(","),w=0;w<v.length;++w)x.values.push(Oz(v[w]));if(u.procType)if(!u.contentDomain&&x.name==="Content-Domain")u.contentDomain=v[0]||"";else if(!u.dekInfo&&x.name==="DEK-Info"){if(x.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');u.dekInfo={algorithm:v[0],parameters:v[1]||null}}else u.headers.push(x);else{if(x.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(x.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');u.procType={version:v[0],type:v[1]}}}++f}if(u.procType==="ENCRYPTED"&&!u.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(e.length===0)throw new Error("Invalid PEM formatted message.");return e};function ww(r){for(var e=r.name+": ",t=[],n=o(function(c,f){return" "+f},"insertSpace"),s=0;s<r.values.length;++s)t.push(r.values[s].replace(/^(\S+\r\n)/,n));e+=t.join(",")+`\r
12
+ `,t};i3.decode=function(r){for(var e=[],t=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,n=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,s=/\r?\n/,i;i=t.exec(r),!!i;){var a=i[1];a==="NEW CERTIFICATE REQUEST"&&(a="CERTIFICATE REQUEST");var u={type:a,procType:null,contentDomain:null,dekInfo:null,headers:[],body:Sw.util.decode64(i[3])};if(e.push(u),!!i[2]){for(var c=i[2].split(s),f=0;i&&f<c.length;){for(var h=c[f].replace(/\s+$/,""),m=f+1;m<c.length;++m){var g=c[m];if(!/\s/.test(g[0]))break;h+=g,f=m}if(i=h.match(n),i){for(var x={name:i[1],values:[]},v=i[2].split(","),w=0;w<v.length;++w)x.values.push(Pz(v[w]));if(u.procType)if(!u.contentDomain&&x.name==="Content-Domain")u.contentDomain=v[0]||"";else if(!u.dekInfo&&x.name==="DEK-Info"){if(x.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');u.dekInfo={algorithm:v[0],parameters:v[1]||null}}else u.headers.push(x);else{if(x.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(x.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');u.procType={version:v[0],type:v[1]}}}++f}if(u.procType==="ENCRYPTED"&&!u.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(e.length===0)throw new Error("Invalid PEM formatted message.");return e};function ww(r){for(var e=r.name+": ",t=[],n=o(function(c,f){return" "+f},"insertSpace"),s=0;s<r.values.length;++s)t.push(r.values[s].replace(/^(\S+\r\n)/,n));e+=t.join(",")+`\r
13
13
  `;for(var i=0,a=-1,s=0;s<e.length;++s,++i)if(i>65&&a!==-1){var u=e[a];u===","?(++a,e=e.substr(0,a)+`\r
14
14
  `+e.substr(a)):e=e.substr(0,a)+`\r
15
- `+u+e.substr(a+1),i=s-a-1,a=-1,++s}else(e[s]===" "||e[s]===" "||e[s]===",")&&(a=s);return e}o(ww,"foldHeader");function Oz(r){return r.replace(/^\s+/,"")}o(Oz,"ltrim")});var Y0=Z((Zpe,u3)=>{"use strict";var Hr=$t();hw();K2();lr();u3.exports=Hr.des=Hr.des||{};Hr.des.startEncrypting=function(r,e,t,n){var s=bw({key:r,output:t,decrypt:!1,mode:n||(e===null?"ECB":"CBC")});return s.start(e),s};Hr.des.createEncryptionCipher=function(r,e){return bw({key:r,output:null,decrypt:!1,mode:e})};Hr.des.startDecrypting=function(r,e,t,n){var s=bw({key:r,output:t,decrypt:!0,mode:n||(e===null?"ECB":"CBC")});return s.start(e),s};Hr.des.createDecryptionCipher=function(r,e){return bw({key:r,output:null,decrypt:!0,mode:e})};Hr.des.Algorithm=function(r,e){var t=this;t.name=r,t.mode=new e({blockSize:8,cipher:{encrypt:o(function(n,s){return o3(t._keys,n,s,!1)},"encrypt"),decrypt:o(function(n,s){return o3(t._keys,n,s,!0)},"decrypt")}}),t._init=!1};Hr.des.Algorithm.prototype.initialize=function(r){if(!this._init){var e=Hr.util.createBuffer(r.key);if(this.name.indexOf("3DES")===0&&e.length()!==24)throw new Error("Invalid Triple-DES key size: "+e.length()*8);this._keys=Hz(e),this._init=!0}};Ba("DES-ECB",Hr.cipher.modes.ecb);Ba("DES-CBC",Hr.cipher.modes.cbc);Ba("DES-CFB",Hr.cipher.modes.cfb);Ba("DES-OFB",Hr.cipher.modes.ofb);Ba("DES-CTR",Hr.cipher.modes.ctr);Ba("3DES-ECB",Hr.cipher.modes.ecb);Ba("3DES-CBC",Hr.cipher.modes.cbc);Ba("3DES-CFB",Hr.cipher.modes.cfb);Ba("3DES-OFB",Hr.cipher.modes.ofb);Ba("3DES-CTR",Hr.cipher.modes.ctr);function Ba(r,e){var t=o(function(){return new Hr.des.Algorithm(r,e)},"factory");Hr.cipher.registerAlgorithm(r,t)}o(Ba,"registerAlgorithm");var kz=[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],Lz=[-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],Vz=[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],Uz=[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],jz=[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],Mz=[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],Fz=[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],qz=[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 Hz(r){for(var e=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],t=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],s=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],i=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],a=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],u=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],c=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],f=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],h=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],m=[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],x=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],v=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],w=r.length()>8?3:1,S=[],A=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],T=0,b,E=0;E<w;E++){var C=r.getInt32(),_=r.getInt32();b=(C>>>4^_)&252645135,_^=b,C^=b<<4,b=(_>>>-16^C)&65535,C^=b,_^=b<<-16,b=(C>>>2^_)&858993459,_^=b,C^=b<<2,b=(_>>>-16^C)&65535,C^=b,_^=b<<-16,b=(C>>>1^_)&1431655765,_^=b,C^=b<<1,b=(_>>>8^C)&16711935,C^=b,_^=b<<8,b=(C>>>1^_)&1431655765,_^=b,C^=b<<1,b=C<<8|_>>>20&240,C=_<<24|_<<8&16711680|_>>>8&65280|_>>>24&240,_=b;for(var F=0;F<A.length;++F){A[F]?(C=C<<2|C>>>26,_=_<<2|_>>>26):(C=C<<1|C>>>27,_=_<<1|_>>>27),C&=-15,_&=-15;var R=e[C>>>28]|t[C>>>24&15]|n[C>>>20&15]|s[C>>>16&15]|i[C>>>12&15]|a[C>>>8&15]|u[C>>>4&15],q=c[_>>>28]|f[_>>>24&15]|h[_>>>20&15]|m[_>>>16&15]|g[_>>>12&15]|x[_>>>8&15]|v[_>>>4&15];b=(q>>>16^R)&65535,S[T++]=R^b,S[T++]=q^b<<16}}return S}o(Hz,"_createKeys");function o3(r,e,t,n){var s=r.length===32?3:9,i;s===3?i=n?[30,-2,-2]:[0,32,2]:i=n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var a,u=e[0],c=e[1];a=(u>>>4^c)&252645135,c^=a,u^=a<<4,a=(u>>>16^c)&65535,c^=a,u^=a<<16,a=(c>>>2^u)&858993459,u^=a,c^=a<<2,a=(c>>>8^u)&16711935,u^=a,c^=a<<8,a=(u>>>1^c)&1431655765,c^=a,u^=a<<1,u=u<<1|u>>>31,c=c<<1|c>>>31;for(var f=0;f<s;f+=3){for(var h=i[f+1],m=i[f+2],g=i[f];g!=h;g+=m){var x=c^r[g],v=(c>>>4|c<<28)^r[g+1];a=u,u=c,c=a^(Lz[x>>>24&63]|Uz[x>>>16&63]|Mz[x>>>8&63]|qz[x&63]|kz[v>>>24&63]|Vz[v>>>16&63]|jz[v>>>8&63]|Fz[v&63])}a=u,u=c,c=a}u=u>>>1|u<<31,c=c>>>1|c<<31,a=(u>>>1^c)&1431655765,c^=a,u^=a<<1,a=(c>>>8^u)&16711935,u^=a,c^=a<<8,a=(c>>>2^u)&858993459,u^=a,c^=a<<2,a=(u>>>16^c)&65535,c^=a,u^=a<<16,a=(u>>>4^c)&252645135,c^=a,u^=a<<4,t[0]=u,t[1]=c}o(o3,"_updateBlock");function bw(r){r=r||{};var e=(r.mode||"CBC").toUpperCase(),t="DES-"+e,n;r.decrypt?n=Hr.cipher.createDecipher(t,r.key):n=Hr.cipher.createCipher(t,r.key);var s=n.start;return n.start=function(i,a){var u=null;a instanceof Hr.util.ByteBuffer&&(u=a,a={}),a=a||{},a.output=u,a.iv=i,s.call(n,a)},n}o(bw,"_createCipher")});var Ew=Z((tde,c3)=>{"use strict";var vs=$t();ap();Ia();lr();var Kz=vs.pkcs5=vs.pkcs5||{},No;vs.util.isNodejs&&!vs.options.usePureJavaScript&&(No=Xe("crypto"));c3.exports=vs.pbkdf2=Kz.pbkdf2=function(r,e,t,n,s,i){if(typeof s=="function"&&(i=s,s=null),vs.util.isNodejs&&!vs.options.usePureJavaScript&&No.pbkdf2&&(s===null||typeof s!="object")&&(No.pbkdf2Sync.length>4||!s||s==="sha1"))return typeof s!="string"&&(s="sha1"),r=Buffer.from(r,"binary"),e=Buffer.from(e,"binary"),i?No.pbkdf2Sync.length===4?No.pbkdf2(r,e,t,n,function(b,E){if(b)return i(b);i(null,E.toString("binary"))}):No.pbkdf2(r,e,t,n,s,function(b,E){if(b)return i(b);i(null,E.toString("binary"))}):No.pbkdf2Sync.length===4?No.pbkdf2Sync(r,e,t,n).toString("binary"):No.pbkdf2Sync(r,e,t,n,s).toString("binary");if((typeof s>"u"||s===null)&&(s="sha1"),typeof s=="string"){if(!(s in vs.md.algorithms))throw new Error("Unknown hash algorithm: "+s);s=vs.md[s].create()}var a=s.digestLength;if(n>4294967295*a){var u=new Error("Derived key is too long.");if(i)return i(u);throw u}var c=Math.ceil(n/a),f=n-(c-1)*a,h=vs.hmac.create();h.start(s,r);var m="",g,x,v;if(!i){for(var w=1;w<=c;++w){h.start(null,null),h.update(e),h.update(vs.util.int32ToBytes(w)),g=v=h.digest().getBytes();for(var S=2;S<=t;++S)h.start(null,null),h.update(v),x=h.digest().getBytes(),g=vs.util.xorBytes(g,x,a),v=x;m+=w<c?g:g.substr(0,f)}return m}var w=1,S;function A(){if(w>c)return i(null,m);h.start(null,null),h.update(e),h.update(vs.util.int32ToBytes(w)),g=v=h.digest().getBytes(),S=2,T()}o(A,"outer");function T(){if(S<=t)return h.start(null,null),h.update(v),x=h.digest().getBytes(),g=vs.util.xorBytes(g,x,a),v=x,++S,vs.util.setImmediate(T);m+=w<c?g:g.substr(0,f),++w,A()}o(T,"inner"),A()}});var Y2=Z((nde,d3)=>{"use strict";var Da=$t();Ia();lr();var f3=d3.exports=Da.sha256=Da.sha256||{};Da.md.sha256=Da.md.algorithms.sha256=f3;f3.create=function(){h3||$z();var r=null,e=Da.util.createBuffer(),t=new Array(64),n={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var s=n.messageLengthSize/4,i=0;i<s;++i)n.fullMessageLength.push(0);return e=Da.util.createBuffer(),r={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},n},n.start(),n.update=function(s,i){i==="utf8"&&(s=Da.util.encodeUtf8(s));var a=s.length;n.messageLength+=a,a=[a/4294967296>>>0,a>>>0];for(var u=n.fullMessageLength.length-1;u>=0;--u)n.fullMessageLength[u]+=a[1],a[1]=a[0]+(n.fullMessageLength[u]/4294967296>>>0),n.fullMessageLength[u]=n.fullMessageLength[u]>>>0,a[0]=a[1]/4294967296>>>0;return e.putBytes(s),l3(r,t,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var s=Da.util.createBuffer();s.putBytes(e.bytes());var i=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,a=i&n.blockLength-1;s.putBytes(J2.substr(0,n.blockLength-a));for(var u,c,f=n.fullMessageLength[0]*8,h=0;h<n.fullMessageLength.length-1;++h)u=n.fullMessageLength[h+1]*8,c=u/4294967296>>>0,f+=c,s.putInt32(f>>>0),f=u>>>0;s.putInt32(f);var m={h0:r.h0,h1:r.h1,h2:r.h2,h3:r.h3,h4:r.h4,h5:r.h5,h6:r.h6,h7:r.h7};l3(m,t,s);var g=Da.util.createBuffer();return g.putInt32(m.h0),g.putInt32(m.h1),g.putInt32(m.h2),g.putInt32(m.h3),g.putInt32(m.h4),g.putInt32(m.h5),g.putInt32(m.h6),g.putInt32(m.h7),g},n};var J2=null,h3=!1,p3=null;function $z(){J2="\x80",J2+=Da.util.fillString("\0",64),p3=[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],h3=!0}o($z,"_init");function l3(r,e,t){for(var n,s,i,a,u,c,f,h,m,g,x,v,w,S,A,T=t.length();T>=64;){for(f=0;f<16;++f)e[f]=t.getInt32();for(;f<64;++f)n=e[f-2],n=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,s=e[f-15],s=(s>>>7|s<<25)^(s>>>18|s<<14)^s>>>3,e[f]=n+e[f-7]+s+e[f-16]|0;for(h=r.h0,m=r.h1,g=r.h2,x=r.h3,v=r.h4,w=r.h5,S=r.h6,A=r.h7,f=0;f<64;++f)a=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),u=S^v&(w^S),i=(h>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),c=h&m|g&(h^m),n=A+a+u+p3[f]+e[f],s=i+c,A=S,S=w,w=v,v=x+n>>>0,x=g,g=m,m=h,h=n+s>>>0;r.h0=r.h0+h|0,r.h1=r.h1+m|0,r.h2=r.h2+g|0,r.h3=r.h3+x|0,r.h4=r.h4+v|0,r.h5=r.h5+w|0,r.h6=r.h6+S|0,r.h7=r.h7+A|0,T-=64}}o(l3,"_update")});var Q2=Z((ide,m3)=>{"use strict";var Ra=$t();lr();var Aw=null;Ra.util.isNodejs&&!Ra.options.usePureJavaScript&&!process.versions["node-webkit"]&&(Aw=Xe("crypto"));var Gz=m3.exports=Ra.prng=Ra.prng||{};Gz.create=function(r){for(var e={plugin:r,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},t=r.md,n=new Array(32),s=0;s<32;++s)n[s]=t.create();e.pools=n,e.pool=0,e.generate=function(f,h){if(!h)return e.generateSync(f);var m=e.plugin.cipher,g=e.plugin.increment,x=e.plugin.formatKey,v=e.plugin.formatSeed,w=Ra.util.createBuffer();e.key=null,S();function S(A){if(A)return h(A);if(w.length()>=f)return h(null,w.getBytes(f));if(e.generated>1048575&&(e.key=null),e.key===null)return Ra.util.nextTick(function(){i(S)});var T=m(e.key,e.seed);e.generated+=T.length,w.putBytes(T),e.key=x(m(e.key,g(e.seed))),e.seed=v(m(e.key,e.seed)),Ra.util.setImmediate(S)}o(S,"generate")},e.generateSync=function(f){var h=e.plugin.cipher,m=e.plugin.increment,g=e.plugin.formatKey,x=e.plugin.formatSeed;e.key=null;for(var v=Ra.util.createBuffer();v.length()<f;){e.generated>1048575&&(e.key=null),e.key===null&&a();var w=h(e.key,e.seed);e.generated+=w.length,v.putBytes(w),e.key=g(h(e.key,m(e.seed))),e.seed=x(h(e.key,e.seed))}return v.getBytes(f)};function i(f){if(e.pools[0].messageLength>=32)return u(),f();var h=32-e.pools[0].messageLength<<5;e.seedFile(h,function(m,g){if(m)return f(m);e.collect(g),u(),f()})}o(i,"_reseed");function a(){if(e.pools[0].messageLength>=32)return u();var f=32-e.pools[0].messageLength<<5;e.collect(e.seedFileSync(f)),u()}o(a,"_reseedSync");function u(){e.reseeds=e.reseeds===4294967295?0:e.reseeds+1;var f=e.plugin.md.create();f.update(e.keyBytes);for(var h=1,m=0;m<32;++m)e.reseeds%h===0&&(f.update(e.pools[m].digest().getBytes()),e.pools[m].start()),h=h<<1;e.keyBytes=f.digest().getBytes(),f.start(),f.update(e.keyBytes);var g=f.digest().getBytes();e.key=e.plugin.formatKey(e.keyBytes),e.seed=e.plugin.formatSeed(g),e.generated=0}o(u,"_seed");function c(f){var h=null,m=Ra.util.globalScope,g=m.crypto||m.msCrypto;g&&g.getRandomValues&&(h=o(function(C){return g.getRandomValues(C)},"getRandomValues"));var x=Ra.util.createBuffer();if(h)for(;x.length()<f;){var v=Math.max(1,Math.min(f-x.length(),65536)/4),w=new Uint32Array(Math.floor(v));try{h(w);for(var S=0;S<w.length;++S)x.putInt32(w[S])}catch(C){if(!(typeof QuotaExceededError<"u"&&C instanceof QuotaExceededError))throw C}}if(x.length()<f)for(var A,T,b,E=Math.floor(Math.random()*65536);x.length()<f;){T=16807*(E&65535),A=16807*(E>>16),T+=(A&32767)<<16,T+=A>>15,T=(T&2147483647)+(T>>31),E=T&4294967295;for(var S=0;S<3;++S)b=E>>>(S<<3),b^=Math.floor(Math.random()*256),x.putByte(b&255)}return x.getBytes(f)}return o(c,"defaultSeedFile"),Aw?(e.seedFile=function(f,h){Aw.randomBytes(f,function(m,g){if(m)return h(m);h(null,g.toString())})},e.seedFileSync=function(f){return Aw.randomBytes(f).toString()}):(e.seedFile=function(f,h){try{h(null,c(f))}catch(m){h(m)}},e.seedFileSync=c),e.collect=function(f){for(var h=f.length,m=0;m<h;++m)e.pools[e.pool].update(f.substr(m,1)),e.pool=e.pool===31?0:e.pool+1},e.collectInt=function(f,h){for(var m="",g=0;g<h;g+=8)m+=String.fromCharCode(f>>g&255);e.collect(m)},e.registerWorker=function(f){if(f===self)e.seedFile=function(m,g){function x(v){var w=v.data;w.forge&&w.forge.prng&&(self.removeEventListener("message",x),g(w.forge.prng.err,w.forge.prng.bytes))}o(x,"listener"),self.addEventListener("message",x),self.postMessage({forge:{prng:{needed:m}}})};else{var h=o(function(m){var g=m.data;g.forge&&g.forge.prng&&e.seedFile(g.forge.prng.needed,function(x,v){f.postMessage({forge:{prng:{err:x,bytes:v}}})})},"listener");f.addEventListener("message",h)}},e}});var bi=Z((ode,Z2)=>{"use strict";var _n=$t();Pu();Y2();Q2();lr();(function(){if(_n.random&&_n.random.getBytes){Z2.exports=_n.random;return}(function(r){var e={},t=new Array(4),n=_n.util.createBuffer();e.formatKey=function(m){var g=_n.util.createBuffer(m);return m=new Array(4),m[0]=g.getInt32(),m[1]=g.getInt32(),m[2]=g.getInt32(),m[3]=g.getInt32(),_n.aes._expandKey(m,!1)},e.formatSeed=function(m){var g=_n.util.createBuffer(m);return m=new Array(4),m[0]=g.getInt32(),m[1]=g.getInt32(),m[2]=g.getInt32(),m[3]=g.getInt32(),m},e.cipher=function(m,g){return _n.aes._updateBlock(m,g,t,!1),n.putInt32(t[0]),n.putInt32(t[1]),n.putInt32(t[2]),n.putInt32(t[3]),n.getBytes()},e.increment=function(m){return++m[3],m},e.md=_n.md.sha256;function s(){var m=_n.prng.create(e);return m.getBytes=function(g,x){return m.generate(g,x)},m.getBytesSync=function(g){return m.generate(g)},m}o(s,"spawnPrng");var i=s(),a=null,u=_n.util.globalScope,c=u.crypto||u.msCrypto;if(c&&c.getRandomValues&&(a=o(function(m){return c.getRandomValues(m)},"getRandomValues")),_n.options.usePureJavaScript||!_n.util.isNodejs&&!a){if(typeof window>"u"||window.document,i.collectInt(+new Date,32),typeof navigator<"u"){var f="";for(var h in navigator)try{typeof navigator[h]=="string"&&(f+=navigator[h])}catch{}i.collect(f),f=null}r&&(r().mousemove(function(m){i.collectInt(m.clientX,16),i.collectInt(m.clientY,16)}),r().keypress(function(m){i.collectInt(m.charCode,8)}))}if(!_n.random)_n.random=i;else for(var h in i)_n.random[h]=i[h];_n.random.createInstance=s,Z2.exports=_n.random})(typeof jQuery<"u"?jQuery:null)})()});var tN=Z((cde,y3)=>{"use strict";var _s=$t();lr();var eN=[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],g3=[1,2,3,5],Xz=o(function(r,e){return r<<e&65535|(r&65535)>>16-e},"rol"),Wz=o(function(r,e){return(r&65535)>>e|r<<16-e&65535},"ror");y3.exports=_s.rc2=_s.rc2||{};_s.rc2.expandKey=function(r,e){typeof r=="string"&&(r=_s.util.createBuffer(r)),e=e||128;var t=r,n=r.length(),s=e,i=Math.ceil(s/8),a=255>>(s&7),u;for(u=n;u<128;u++)t.putByte(eN[t.at(u-1)+t.at(u-n)&255]);for(t.setAt(128-i,eN[t.at(128-i)&a]),u=127-i;u>=0;u--)t.setAt(u,eN[t.at(u+1)^t.at(u+i)]);return t};var v3=o(function(r,e,t){var n=!1,s=null,i=null,a=null,u,c,f,h,m=[];for(r=_s.rc2.expandKey(r,e),f=0;f<64;f++)m.push(r.getInt16Le());t?(u=o(function(v){for(f=0;f<4;f++)v[f]+=m[h]+(v[(f+3)%4]&v[(f+2)%4])+(~v[(f+3)%4]&v[(f+1)%4]),v[f]=Xz(v[f],g3[f]),h++},"mixRound"),c=o(function(v){for(f=0;f<4;f++)v[f]+=m[v[(f+3)%4]&63]},"mashRound")):(u=o(function(v){for(f=3;f>=0;f--)v[f]=Wz(v[f],g3[f]),v[f]-=m[h]+(v[(f+3)%4]&v[(f+2)%4])+(~v[(f+3)%4]&v[(f+1)%4]),h--},"mixRound"),c=o(function(v){for(f=3;f>=0;f--)v[f]-=m[v[(f+3)%4]&63]},"mashRound"));var g=o(function(v){var w=[];for(f=0;f<4;f++){var S=s.getInt16Le();a!==null&&(t?S^=a.getInt16Le():a.putInt16Le(S)),w.push(S&65535)}h=t?0:63;for(var A=0;A<v.length;A++)for(var T=0;T<v[A][0];T++)v[A][1](w);for(f=0;f<4;f++)a!==null&&(t?a.putInt16Le(w[f]):w[f]^=a.getInt16Le()),i.putInt16Le(w[f])},"runPlan"),x=null;return x={start:o(function(v,w){v&&typeof v=="string"&&(v=_s.util.createBuffer(v)),n=!1,s=_s.util.createBuffer(),i=w||new _s.util.createBuffer,a=v,x.output=i},"start"),update:o(function(v){for(n||s.putBuffer(v);s.length()>=8;)g([[5,u],[1,c],[6,u],[1,c],[5,u]])},"update"),finish:o(function(v){var w=!0;if(t)if(v)w=v(8,s,!t);else{var S=s.length()===8?8:8-s.length();s.fillWithByte(S,S)}if(w&&(n=!0,x.update()),!t&&(w=s.length()===0,w))if(v)w=v(8,i,!t);else{var A=i.length(),T=i.at(A-1);T>A?w=!1:i.truncate(T)}return w},"finish")},x},"createCipher");_s.rc2.startEncrypting=function(r,e,t){var n=_s.rc2.createEncryptionCipher(r,128);return n.start(e,t),n};_s.rc2.createEncryptionCipher=function(r,e){return v3(r,e,!0)};_s.rc2.startDecrypting=function(r,e,t){var n=_s.rc2.createDecryptionCipher(r,128);return n.start(e,t),n};_s.rc2.createDecryptionCipher=function(r,e){return v3(r,e,!1)}});var Z0=Z((fde,N3)=>{"use strict";var rN=$t();N3.exports=rN.jsbn=rN.jsbn||{};var To,zz=0xdeadbeefcafe,x3=(zz&16777215)==15715070;function Oe(r,e,t){this.data=[],r!=null&&(typeof r=="number"?this.fromNumber(r,e,t):e==null&&typeof r!="string"?this.fromString(r,256):this.fromString(r,e))}o(Oe,"BigInteger");rN.jsbn.BigInteger=Oe;function fr(){return new Oe(null)}o(fr,"nbi");function Jz(r,e,t,n,s,i){for(;--i>=0;){var a=e*this.data[r++]+t.data[n]+s;s=Math.floor(a/67108864),t.data[n++]=a&67108863}return s}o(Jz,"am1");function Yz(r,e,t,n,s,i){for(var a=e&32767,u=e>>15;--i>=0;){var c=this.data[r]&32767,f=this.data[r++]>>15,h=u*c+f*a;c=a*c+((h&32767)<<15)+t.data[n]+(s&1073741823),s=(c>>>30)+(h>>>15)+u*f+(s>>>30),t.data[n++]=c&1073741823}return s}o(Yz,"am2");function w3(r,e,t,n,s,i){for(var a=e&16383,u=e>>14;--i>=0;){var c=this.data[r]&16383,f=this.data[r++]>>14,h=u*c+f*a;c=a*c+((h&16383)<<14)+t.data[n]+s,s=(c>>28)+(h>>14)+u*f,t.data[n++]=c&268435455}return s}o(w3,"am3");typeof navigator>"u"?(Oe.prototype.am=w3,To=28):x3&&navigator.appName=="Microsoft Internet Explorer"?(Oe.prototype.am=Yz,To=30):x3&&navigator.appName!="Netscape"?(Oe.prototype.am=Jz,To=26):(Oe.prototype.am=w3,To=28);Oe.prototype.DB=To;Oe.prototype.DM=(1<<To)-1;Oe.prototype.DV=1<<To;var nN=52;Oe.prototype.FV=Math.pow(2,nN);Oe.prototype.F1=nN-To;Oe.prototype.F2=2*To-nN;var Qz="0123456789abcdefghijklmnopqrstuvwxyz",Cw=new Array,up,Ei;up=48;for(Ei=0;Ei<=9;++Ei)Cw[up++]=Ei;up=97;for(Ei=10;Ei<36;++Ei)Cw[up++]=Ei;up=65;for(Ei=10;Ei<36;++Ei)Cw[up++]=Ei;function S3(r){return Qz.charAt(r)}o(S3,"int2char");function b3(r,e){var t=Cw[r.charCodeAt(e)];return t??-1}o(b3,"intAt");function Zz(r){for(var e=this.t-1;e>=0;--e)r.data[e]=this.data[e];r.t=this.t,r.s=this.s}o(Zz,"bnpCopyTo");function eJ(r){this.t=1,this.s=r<0?-1:0,r>0?this.data[0]=r:r<-1?this.data[0]=r+this.DV:this.t=0}o(eJ,"bnpFromInt");function ku(r){var e=fr();return e.fromInt(r),e}o(ku,"nbv");function tJ(r,e){var t;if(e==16)t=4;else if(e==8)t=3;else if(e==256)t=8;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else{this.fromRadix(r,e);return}this.t=0,this.s=0;for(var n=r.length,s=!1,i=0;--n>=0;){var a=t==8?r[n]&255:b3(r,n);if(a<0){r.charAt(n)=="-"&&(s=!0);continue}s=!1,i==0?this.data[this.t++]=a:i+t>this.DB?(this.data[this.t-1]|=(a&(1<<this.DB-i)-1)<<i,this.data[this.t++]=a>>this.DB-i):this.data[this.t-1]|=a<<i,i+=t,i>=this.DB&&(i-=this.DB)}t==8&&(r[0]&128)!=0&&(this.s=-1,i>0&&(this.data[this.t-1]|=(1<<this.DB-i)-1<<i)),this.clamp(),s&&Oe.ZERO.subTo(this,this)}o(tJ,"bnpFromString");function rJ(){for(var r=this.s&this.DM;this.t>0&&this.data[this.t-1]==r;)--this.t}o(rJ,"bnpClamp");function nJ(r){if(this.s<0)return"-"+this.negate().toString(r);var e;if(r==16)e=4;else if(r==8)e=3;else if(r==2)e=1;else if(r==32)e=5;else if(r==4)e=2;else return this.toRadix(r);var t=(1<<e)-1,n,s=!1,i="",a=this.t,u=this.DB-a*this.DB%e;if(a-- >0)for(u<this.DB&&(n=this.data[a]>>u)>0&&(s=!0,i=S3(n));a>=0;)u<e?(n=(this.data[a]&(1<<u)-1)<<e-u,n|=this.data[--a]>>(u+=this.DB-e)):(n=this.data[a]>>(u-=e)&t,u<=0&&(u+=this.DB,--a)),n>0&&(s=!0),s&&(i+=S3(n));return s?i:"0"}o(nJ,"bnToString");function sJ(){var r=fr();return Oe.ZERO.subTo(this,r),r}o(sJ,"bnNegate");function iJ(){return this.s<0?this.negate():this}o(iJ,"bnAbs");function aJ(r){var e=this.s-r.s;if(e!=0)return e;var t=this.t;if(e=t-r.t,e!=0)return this.s<0?-e:e;for(;--t>=0;)if((e=this.data[t]-r.data[t])!=0)return e;return 0}o(aJ,"bnCompareTo");function Nw(r){var e=1,t;return(t=r>>>16)!=0&&(r=t,e+=16),(t=r>>8)!=0&&(r=t,e+=8),(t=r>>4)!=0&&(r=t,e+=4),(t=r>>2)!=0&&(r=t,e+=2),(t=r>>1)!=0&&(r=t,e+=1),e}o(Nw,"nbits");function oJ(){return this.t<=0?0:this.DB*(this.t-1)+Nw(this.data[this.t-1]^this.s&this.DM)}o(oJ,"bnBitLength");function uJ(r,e){var t;for(t=this.t-1;t>=0;--t)e.data[t+r]=this.data[t];for(t=r-1;t>=0;--t)e.data[t]=0;e.t=this.t+r,e.s=this.s}o(uJ,"bnpDLShiftTo");function cJ(r,e){for(var t=r;t<this.t;++t)e.data[t-r]=this.data[t];e.t=Math.max(this.t-r,0),e.s=this.s}o(cJ,"bnpDRShiftTo");function lJ(r,e){var t=r%this.DB,n=this.DB-t,s=(1<<n)-1,i=Math.floor(r/this.DB),a=this.s<<t&this.DM,u;for(u=this.t-1;u>=0;--u)e.data[u+i+1]=this.data[u]>>n|a,a=(this.data[u]&s)<<t;for(u=i-1;u>=0;--u)e.data[u]=0;e.data[i]=a,e.t=this.t+i+1,e.s=this.s,e.clamp()}o(lJ,"bnpLShiftTo");function fJ(r,e){e.s=this.s;var t=Math.floor(r/this.DB);if(t>=this.t){e.t=0;return}var n=r%this.DB,s=this.DB-n,i=(1<<n)-1;e.data[0]=this.data[t]>>n;for(var a=t+1;a<this.t;++a)e.data[a-t-1]|=(this.data[a]&i)<<s,e.data[a-t]=this.data[a]>>n;n>0&&(e.data[this.t-t-1]|=(this.s&i)<<s),e.t=this.t-t,e.clamp()}o(fJ,"bnpRShiftTo");function hJ(r,e){for(var t=0,n=0,s=Math.min(r.t,this.t);t<s;)n+=this.data[t]-r.data[t],e.data[t++]=n&this.DM,n>>=this.DB;if(r.t<this.t){for(n-=r.s;t<this.t;)n+=this.data[t],e.data[t++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;t<r.t;)n-=r.data[t],e.data[t++]=n&this.DM,n>>=this.DB;n-=r.s}e.s=n<0?-1:0,n<-1?e.data[t++]=this.DV+n:n>0&&(e.data[t++]=n),e.t=t,e.clamp()}o(hJ,"bnpSubTo");function pJ(r,e){var t=this.abs(),n=r.abs(),s=t.t;for(e.t=s+n.t;--s>=0;)e.data[s]=0;for(s=0;s<n.t;++s)e.data[s+t.t]=t.am(0,n.data[s],e,s,0,t.t);e.s=0,e.clamp(),this.s!=r.s&&Oe.ZERO.subTo(e,e)}o(pJ,"bnpMultiplyTo");function dJ(r){for(var e=this.abs(),t=r.t=2*e.t;--t>=0;)r.data[t]=0;for(t=0;t<e.t-1;++t){var n=e.am(t,e.data[t],r,2*t,0,1);(r.data[t+e.t]+=e.am(t+1,2*e.data[t],r,2*t+1,n,e.t-t-1))>=e.DV&&(r.data[t+e.t]-=e.DV,r.data[t+e.t+1]=1)}r.t>0&&(r.data[r.t-1]+=e.am(t,e.data[t],r,2*t,0,1)),r.s=0,r.clamp()}o(dJ,"bnpSquareTo");function mJ(r,e,t){var n=r.abs();if(!(n.t<=0)){var s=this.abs();if(s.t<n.t){e?.fromInt(0),t!=null&&this.copyTo(t);return}t==null&&(t=fr());var i=fr(),a=this.s,u=r.s,c=this.DB-Nw(n.data[n.t-1]);c>0?(n.lShiftTo(c,i),s.lShiftTo(c,t)):(n.copyTo(i),s.copyTo(t));var f=i.t,h=i.data[f-1];if(h!=0){var m=h*(1<<this.F1)+(f>1?i.data[f-2]>>this.F2:0),g=this.FV/m,x=(1<<this.F1)/m,v=1<<this.F2,w=t.t,S=w-f,A=e??fr();for(i.dlShiftTo(S,A),t.compareTo(A)>=0&&(t.data[t.t++]=1,t.subTo(A,t)),Oe.ONE.dlShiftTo(f,A),A.subTo(i,i);i.t<f;)i.data[i.t++]=0;for(;--S>=0;){var T=t.data[--w]==h?this.DM:Math.floor(t.data[w]*g+(t.data[w-1]+v)*x);if((t.data[w]+=i.am(0,T,t,S,0,f))<T)for(i.dlShiftTo(S,A),t.subTo(A,t);t.data[w]<--T;)t.subTo(A,t)}e!=null&&(t.drShiftTo(f,e),a!=u&&Oe.ZERO.subTo(e,e)),t.t=f,t.clamp(),c>0&&t.rShiftTo(c,t),a<0&&Oe.ZERO.subTo(t,t)}}}o(mJ,"bnpDivRemTo");function gJ(r){var e=fr();return this.abs().divRemTo(r,null,e),this.s<0&&e.compareTo(Oe.ZERO)>0&&r.subTo(e,e),e}o(gJ,"bnMod");function Bl(r){this.m=r}o(Bl,"Classic");function vJ(r){return r.s<0||r.compareTo(this.m)>=0?r.mod(this.m):r}o(vJ,"cConvert");function yJ(r){return r}o(yJ,"cRevert");function xJ(r){r.divRemTo(this.m,null,r)}o(xJ,"cReduce");function wJ(r,e,t){r.multiplyTo(e,t),this.reduce(t)}o(wJ,"cMulTo");function SJ(r,e){r.squareTo(e),this.reduce(e)}o(SJ,"cSqrTo");Bl.prototype.convert=vJ;Bl.prototype.revert=yJ;Bl.prototype.reduce=xJ;Bl.prototype.mulTo=wJ;Bl.prototype.sqrTo=SJ;function bJ(){if(this.t<1)return 0;var r=this.data[0];if((r&1)==0)return 0;var e=r&3;return e=e*(2-(r&15)*e)&15,e=e*(2-(r&255)*e)&255,e=e*(2-((r&65535)*e&65535))&65535,e=e*(2-r*e%this.DV)%this.DV,e>0?this.DV-e:-e}o(bJ,"bnpInvDigit");function Dl(r){this.m=r,this.mp=r.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<r.DB-15)-1,this.mt2=2*r.t}o(Dl,"Montgomery");function EJ(r){var e=fr();return r.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),r.s<0&&e.compareTo(Oe.ZERO)>0&&this.m.subTo(e,e),e}o(EJ,"montConvert");function AJ(r){var e=fr();return r.copyTo(e),this.reduce(e),e}o(AJ,"montRevert");function CJ(r){for(;r.t<=this.mt2;)r.data[r.t++]=0;for(var e=0;e<this.m.t;++e){var t=r.data[e]&32767,n=t*this.mpl+((t*this.mph+(r.data[e]>>15)*this.mpl&this.um)<<15)&r.DM;for(t=e+this.m.t,r.data[t]+=this.m.am(0,n,r,e,0,this.m.t);r.data[t]>=r.DV;)r.data[t]-=r.DV,r.data[++t]++}r.clamp(),r.drShiftTo(this.m.t,r),r.compareTo(this.m)>=0&&r.subTo(this.m,r)}o(CJ,"montReduce");function NJ(r,e){r.squareTo(e),this.reduce(e)}o(NJ,"montSqrTo");function TJ(r,e,t){r.multiplyTo(e,t),this.reduce(t)}o(TJ,"montMulTo");Dl.prototype.convert=EJ;Dl.prototype.revert=AJ;Dl.prototype.reduce=CJ;Dl.prototype.mulTo=TJ;Dl.prototype.sqrTo=NJ;function IJ(){return(this.t>0?this.data[0]&1:this.s)==0}o(IJ,"bnpIsEven");function _J(r,e){if(r>4294967295||r<1)return Oe.ONE;var t=fr(),n=fr(),s=e.convert(this),i=Nw(r)-1;for(s.copyTo(t);--i>=0;)if(e.sqrTo(t,n),(r&1<<i)>0)e.mulTo(n,s,t);else{var a=t;t=n,n=a}return e.revert(t)}o(_J,"bnpExp");function BJ(r,e){var t;return r<256||e.isEven()?t=new Bl(e):t=new Dl(e),this.exp(r,t)}o(BJ,"bnModPowInt");Oe.prototype.copyTo=Zz;Oe.prototype.fromInt=eJ;Oe.prototype.fromString=tJ;Oe.prototype.clamp=rJ;Oe.prototype.dlShiftTo=uJ;Oe.prototype.drShiftTo=cJ;Oe.prototype.lShiftTo=lJ;Oe.prototype.rShiftTo=fJ;Oe.prototype.subTo=hJ;Oe.prototype.multiplyTo=pJ;Oe.prototype.squareTo=dJ;Oe.prototype.divRemTo=mJ;Oe.prototype.invDigit=bJ;Oe.prototype.isEven=IJ;Oe.prototype.exp=_J;Oe.prototype.toString=nJ;Oe.prototype.negate=sJ;Oe.prototype.abs=iJ;Oe.prototype.compareTo=aJ;Oe.prototype.bitLength=oJ;Oe.prototype.mod=gJ;Oe.prototype.modPowInt=BJ;Oe.ZERO=ku(0);Oe.ONE=ku(1);function DJ(){var r=fr();return this.copyTo(r),r}o(DJ,"bnClone");function RJ(){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]}o(RJ,"bnIntValue");function PJ(){return this.t==0?this.s:this.data[0]<<24>>24}o(PJ,"bnByteValue");function OJ(){return this.t==0?this.s:this.data[0]<<16>>16}o(OJ,"bnShortValue");function kJ(r){return Math.floor(Math.LN2*this.DB/Math.log(r))}o(kJ,"bnpChunkSize");function LJ(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}o(LJ,"bnSigNum");function VJ(r){if(r==null&&(r=10),this.signum()==0||r<2||r>36)return"0";var e=this.chunkSize(r),t=Math.pow(r,e),n=ku(t),s=fr(),i=fr(),a="";for(this.divRemTo(n,s,i);s.signum()>0;)a=(t+i.intValue()).toString(r).substr(1)+a,s.divRemTo(n,s,i);return i.intValue().toString(r)+a}o(VJ,"bnpToRadix");function UJ(r,e){this.fromInt(0),e==null&&(e=10);for(var t=this.chunkSize(e),n=Math.pow(e,t),s=!1,i=0,a=0,u=0;u<r.length;++u){var c=b3(r,u);if(c<0){r.charAt(u)=="-"&&this.signum()==0&&(s=!0);continue}a=e*a+c,++i>=t&&(this.dMultiply(n),this.dAddOffset(a,0),i=0,a=0)}i>0&&(this.dMultiply(Math.pow(e,i)),this.dAddOffset(a,0)),s&&Oe.ZERO.subTo(this,this)}o(UJ,"bnpFromRadix");function jJ(r,e,t){if(typeof e=="number")if(r<2)this.fromInt(1);else for(this.fromNumber(r,t),this.testBit(r-1)||this.bitwiseTo(Oe.ONE.shiftLeft(r-1),sN,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>r&&this.subTo(Oe.ONE.shiftLeft(r-1),this);else{var n=new Array,s=r&7;n.length=(r>>3)+1,e.nextBytes(n),s>0?n[0]&=(1<<s)-1:n[0]=0,this.fromString(n,256)}}o(jJ,"bnpFromNumber");function MJ(){var r=this.t,e=new Array;e[0]=this.s;var t=this.DB-r*this.DB%8,n,s=0;if(r-- >0)for(t<this.DB&&(n=this.data[r]>>t)!=(this.s&this.DM)>>t&&(e[s++]=n|this.s<<this.DB-t);r>=0;)t<8?(n=(this.data[r]&(1<<t)-1)<<8-t,n|=this.data[--r]>>(t+=this.DB-8)):(n=this.data[r]>>(t-=8)&255,t<=0&&(t+=this.DB,--r)),(n&128)!=0&&(n|=-256),s==0&&(this.s&128)!=(n&128)&&++s,(s>0||n!=this.s)&&(e[s++]=n);return e}o(MJ,"bnToByteArray");function FJ(r){return this.compareTo(r)==0}o(FJ,"bnEquals");function qJ(r){return this.compareTo(r)<0?this:r}o(qJ,"bnMin");function HJ(r){return this.compareTo(r)>0?this:r}o(HJ,"bnMax");function KJ(r,e,t){var n,s,i=Math.min(r.t,this.t);for(n=0;n<i;++n)t.data[n]=e(this.data[n],r.data[n]);if(r.t<this.t){for(s=r.s&this.DM,n=i;n<this.t;++n)t.data[n]=e(this.data[n],s);t.t=this.t}else{for(s=this.s&this.DM,n=i;n<r.t;++n)t.data[n]=e(s,r.data[n]);t.t=r.t}t.s=e(this.s,r.s),t.clamp()}o(KJ,"bnpBitwiseTo");function $J(r,e){return r&e}o($J,"op_and");function GJ(r){var e=fr();return this.bitwiseTo(r,$J,e),e}o(GJ,"bnAnd");function sN(r,e){return r|e}o(sN,"op_or");function XJ(r){var e=fr();return this.bitwiseTo(r,sN,e),e}o(XJ,"bnOr");function E3(r,e){return r^e}o(E3,"op_xor");function WJ(r){var e=fr();return this.bitwiseTo(r,E3,e),e}o(WJ,"bnXor");function A3(r,e){return r&~e}o(A3,"op_andnot");function zJ(r){var e=fr();return this.bitwiseTo(r,A3,e),e}o(zJ,"bnAndNot");function JJ(){for(var r=fr(),e=0;e<this.t;++e)r.data[e]=this.DM&~this.data[e];return r.t=this.t,r.s=~this.s,r}o(JJ,"bnNot");function YJ(r){var e=fr();return r<0?this.rShiftTo(-r,e):this.lShiftTo(r,e),e}o(YJ,"bnShiftLeft");function QJ(r){var e=fr();return r<0?this.lShiftTo(-r,e):this.rShiftTo(r,e),e}o(QJ,"bnShiftRight");function ZJ(r){if(r==0)return-1;var e=0;return(r&65535)==0&&(r>>=16,e+=16),(r&255)==0&&(r>>=8,e+=8),(r&15)==0&&(r>>=4,e+=4),(r&3)==0&&(r>>=2,e+=2),(r&1)==0&&++e,e}o(ZJ,"lbit");function eY(){for(var r=0;r<this.t;++r)if(this.data[r]!=0)return r*this.DB+ZJ(this.data[r]);return this.s<0?this.t*this.DB:-1}o(eY,"bnGetLowestSetBit");function tY(r){for(var e=0;r!=0;)r&=r-1,++e;return e}o(tY,"cbit");function rY(){for(var r=0,e=this.s&this.DM,t=0;t<this.t;++t)r+=tY(this.data[t]^e);return r}o(rY,"bnBitCount");function nY(r){var e=Math.floor(r/this.DB);return e>=this.t?this.s!=0:(this.data[e]&1<<r%this.DB)!=0}o(nY,"bnTestBit");function sY(r,e){var t=Oe.ONE.shiftLeft(r);return this.bitwiseTo(t,e,t),t}o(sY,"bnpChangeBit");function iY(r){return this.changeBit(r,sN)}o(iY,"bnSetBit");function aY(r){return this.changeBit(r,A3)}o(aY,"bnClearBit");function oY(r){return this.changeBit(r,E3)}o(oY,"bnFlipBit");function uY(r,e){for(var t=0,n=0,s=Math.min(r.t,this.t);t<s;)n+=this.data[t]+r.data[t],e.data[t++]=n&this.DM,n>>=this.DB;if(r.t<this.t){for(n+=r.s;t<this.t;)n+=this.data[t],e.data[t++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;t<r.t;)n+=r.data[t],e.data[t++]=n&this.DM,n>>=this.DB;n+=r.s}e.s=n<0?-1:0,n>0?e.data[t++]=n:n<-1&&(e.data[t++]=this.DV+n),e.t=t,e.clamp()}o(uY,"bnpAddTo");function cY(r){var e=fr();return this.addTo(r,e),e}o(cY,"bnAdd");function lY(r){var e=fr();return this.subTo(r,e),e}o(lY,"bnSubtract");function fY(r){var e=fr();return this.multiplyTo(r,e),e}o(fY,"bnMultiply");function hY(r){var e=fr();return this.divRemTo(r,e,null),e}o(hY,"bnDivide");function pY(r){var e=fr();return this.divRemTo(r,null,e),e}o(pY,"bnRemainder");function dY(r){var e=fr(),t=fr();return this.divRemTo(r,e,t),new Array(e,t)}o(dY,"bnDivideAndRemainder");function mY(r){this.data[this.t]=this.am(0,r-1,this,0,0,this.t),++this.t,this.clamp()}o(mY,"bnpDMultiply");function gY(r,e){if(r!=0){for(;this.t<=e;)this.data[this.t++]=0;for(this.data[e]+=r;this.data[e]>=this.DV;)this.data[e]-=this.DV,++e>=this.t&&(this.data[this.t++]=0),++this.data[e]}}o(gY,"bnpDAddOffset");function Q0(){}o(Q0,"NullExp");function C3(r){return r}o(C3,"nNop");function vY(r,e,t){r.multiplyTo(e,t)}o(vY,"nMulTo");function yY(r,e){r.squareTo(e)}o(yY,"nSqrTo");Q0.prototype.convert=C3;Q0.prototype.revert=C3;Q0.prototype.mulTo=vY;Q0.prototype.sqrTo=yY;function xY(r){return this.exp(r,new Q0)}o(xY,"bnPow");function wY(r,e,t){var n=Math.min(this.t+r.t,e);for(t.s=0,t.t=n;n>0;)t.data[--n]=0;var s;for(s=t.t-this.t;n<s;++n)t.data[n+this.t]=this.am(0,r.data[n],t,n,0,this.t);for(s=Math.min(r.t,e);n<s;++n)this.am(0,r.data[n],t,n,0,e-n);t.clamp()}o(wY,"bnpMultiplyLowerTo");function SY(r,e,t){--e;var n=t.t=this.t+r.t-e;for(t.s=0;--n>=0;)t.data[n]=0;for(n=Math.max(e-this.t,0);n<r.t;++n)t.data[this.t+n-e]=this.am(e-n,r.data[n],t,0,0,this.t+n-e);t.clamp(),t.drShiftTo(1,t)}o(SY,"bnpMultiplyUpperTo");function cp(r){this.r2=fr(),this.q3=fr(),Oe.ONE.dlShiftTo(2*r.t,this.r2),this.mu=this.r2.divide(r),this.m=r}o(cp,"Barrett");function bY(r){if(r.s<0||r.t>2*this.m.t)return r.mod(this.m);if(r.compareTo(this.m)<0)return r;var e=fr();return r.copyTo(e),this.reduce(e),e}o(bY,"barrettConvert");function EY(r){return r}o(EY,"barrettRevert");function AY(r){for(r.drShiftTo(this.m.t-1,this.r2),r.t>this.m.t+1&&(r.t=this.m.t+1,r.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);r.compareTo(this.r2)<0;)r.dAddOffset(1,this.m.t+1);for(r.subTo(this.r2,r);r.compareTo(this.m)>=0;)r.subTo(this.m,r)}o(AY,"barrettReduce");function CY(r,e){r.squareTo(e),this.reduce(e)}o(CY,"barrettSqrTo");function NY(r,e,t){r.multiplyTo(e,t),this.reduce(t)}o(NY,"barrettMulTo");cp.prototype.convert=bY;cp.prototype.revert=EY;cp.prototype.reduce=AY;cp.prototype.mulTo=NY;cp.prototype.sqrTo=CY;function TY(r,e){var t=r.bitLength(),n,s=ku(1),i;if(t<=0)return s;t<18?n=1:t<48?n=3:t<144?n=4:t<768?n=5:n=6,t<8?i=new Bl(e):e.isEven()?i=new cp(e):i=new Dl(e);var a=new Array,u=3,c=n-1,f=(1<<n)-1;if(a[1]=i.convert(this),n>1){var h=fr();for(i.sqrTo(a[1],h);u<=f;)a[u]=fr(),i.mulTo(h,a[u-2],a[u]),u+=2}var m=r.t-1,g,x=!0,v=fr(),w;for(t=Nw(r.data[m])-1;m>=0;){for(t>=c?g=r.data[m]>>t-c&f:(g=(r.data[m]&(1<<t+1)-1)<<c-t,m>0&&(g|=r.data[m-1]>>this.DB+t-c)),u=n;(g&1)==0;)g>>=1,--u;if((t-=u)<0&&(t+=this.DB,--m),x)a[g].copyTo(s),x=!1;else{for(;u>1;)i.sqrTo(s,v),i.sqrTo(v,s),u-=2;u>0?i.sqrTo(s,v):(w=s,s=v,v=w),i.mulTo(v,a[g],s)}for(;m>=0&&(r.data[m]&1<<t)==0;)i.sqrTo(s,v),w=s,s=v,v=w,--t<0&&(t=this.DB-1,--m)}return i.revert(s)}o(TY,"bnModPow");function IY(r){var e=this.s<0?this.negate():this.clone(),t=r.s<0?r.negate():r.clone();if(e.compareTo(t)<0){var n=e;e=t,t=n}var s=e.getLowestSetBit(),i=t.getLowestSetBit();if(i<0)return e;for(s<i&&(i=s),i>0&&(e.rShiftTo(i,e),t.rShiftTo(i,t));e.signum()>0;)(s=e.getLowestSetBit())>0&&e.rShiftTo(s,e),(s=t.getLowestSetBit())>0&&t.rShiftTo(s,t),e.compareTo(t)>=0?(e.subTo(t,e),e.rShiftTo(1,e)):(t.subTo(e,t),t.rShiftTo(1,t));return i>0&&t.lShiftTo(i,t),t}o(IY,"bnGCD");function _Y(r){if(r<=0)return 0;var e=this.DV%r,t=this.s<0?r-1:0;if(this.t>0)if(e==0)t=this.data[0]%r;else for(var n=this.t-1;n>=0;--n)t=(e*t+this.data[n])%r;return t}o(_Y,"bnpModInt");function BY(r){var e=r.isEven();if(this.isEven()&&e||r.signum()==0)return Oe.ZERO;for(var t=r.clone(),n=this.clone(),s=ku(1),i=ku(0),a=ku(0),u=ku(1);t.signum()!=0;){for(;t.isEven();)t.rShiftTo(1,t),e?((!s.isEven()||!i.isEven())&&(s.addTo(this,s),i.subTo(r,i)),s.rShiftTo(1,s)):i.isEven()||i.subTo(r,i),i.rShiftTo(1,i);for(;n.isEven();)n.rShiftTo(1,n),e?((!a.isEven()||!u.isEven())&&(a.addTo(this,a),u.subTo(r,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(r,u),u.rShiftTo(1,u);t.compareTo(n)>=0?(t.subTo(n,t),e&&s.subTo(a,s),i.subTo(u,i)):(n.subTo(t,n),e&&a.subTo(s,a),u.subTo(i,u))}if(n.compareTo(Oe.ONE)!=0)return Oe.ZERO;if(u.compareTo(r)>=0)return u.subtract(r);if(u.signum()<0)u.addTo(r,u);else return u;return u.signum()<0?u.add(r):u}o(BY,"bnModInverse");var ta=[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],DY=(1<<26)/ta[ta.length-1];function RY(r){var e,t=this.abs();if(t.t==1&&t.data[0]<=ta[ta.length-1]){for(e=0;e<ta.length;++e)if(t.data[0]==ta[e])return!0;return!1}if(t.isEven())return!1;for(e=1;e<ta.length;){for(var n=ta[e],s=e+1;s<ta.length&&n<DY;)n*=ta[s++];for(n=t.modInt(n);e<s;)if(n%ta[e++]==0)return!1}return t.millerRabin(r)}o(RY,"bnIsProbablePrime");function PY(r){var e=this.subtract(Oe.ONE),t=e.getLowestSetBit();if(t<=0)return!1;for(var n=e.shiftRight(t),s=OY(),i,a=0;a<r;++a){do i=new Oe(this.bitLength(),s);while(i.compareTo(Oe.ONE)<=0||i.compareTo(e)>=0);var u=i.modPow(n,this);if(u.compareTo(Oe.ONE)!=0&&u.compareTo(e)!=0){for(var c=1;c++<t&&u.compareTo(e)!=0;)if(u=u.modPowInt(2,this),u.compareTo(Oe.ONE)==0)return!1;if(u.compareTo(e)!=0)return!1}}return!0}o(PY,"bnpMillerRabin");function OY(){return{nextBytes:o(function(r){for(var e=0;e<r.length;++e)r[e]=Math.floor(Math.random()*256)},"nextBytes")}}o(OY,"bnGetPrng");Oe.prototype.chunkSize=kJ;Oe.prototype.toRadix=VJ;Oe.prototype.fromRadix=UJ;Oe.prototype.fromNumber=jJ;Oe.prototype.bitwiseTo=KJ;Oe.prototype.changeBit=sY;Oe.prototype.addTo=uY;Oe.prototype.dMultiply=mY;Oe.prototype.dAddOffset=gY;Oe.prototype.multiplyLowerTo=wY;Oe.prototype.multiplyUpperTo=SY;Oe.prototype.modInt=_Y;Oe.prototype.millerRabin=PY;Oe.prototype.clone=DJ;Oe.prototype.intValue=RJ;Oe.prototype.byteValue=PJ;Oe.prototype.shortValue=OJ;Oe.prototype.signum=LJ;Oe.prototype.toByteArray=MJ;Oe.prototype.equals=FJ;Oe.prototype.min=qJ;Oe.prototype.max=HJ;Oe.prototype.and=GJ;Oe.prototype.or=XJ;Oe.prototype.xor=WJ;Oe.prototype.andNot=zJ;Oe.prototype.not=JJ;Oe.prototype.shiftLeft=YJ;Oe.prototype.shiftRight=QJ;Oe.prototype.getLowestSetBit=eY;Oe.prototype.bitCount=rY;Oe.prototype.testBit=nY;Oe.prototype.setBit=iY;Oe.prototype.clearBit=aY;Oe.prototype.flipBit=oY;Oe.prototype.add=cY;Oe.prototype.subtract=lY;Oe.prototype.multiply=fY;Oe.prototype.divide=hY;Oe.prototype.remainder=pY;Oe.prototype.divideAndRemainder=dY;Oe.prototype.modPow=TY;Oe.prototype.modInverse=BY;Oe.prototype.pow=xY;Oe.prototype.gcd=IY;Oe.prototype.isProbablePrime=RY});var lp=Z((pde,B3)=>{"use strict";var Pa=$t();Ia();lr();var I3=B3.exports=Pa.sha1=Pa.sha1||{};Pa.md.sha1=Pa.md.algorithms.sha1=I3;I3.create=function(){_3||kY();var r=null,e=Pa.util.createBuffer(),t=new Array(80),n={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var s=n.messageLengthSize/4,i=0;i<s;++i)n.fullMessageLength.push(0);return e=Pa.util.createBuffer(),r={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},n},n.start(),n.update=function(s,i){i==="utf8"&&(s=Pa.util.encodeUtf8(s));var a=s.length;n.messageLength+=a,a=[a/4294967296>>>0,a>>>0];for(var u=n.fullMessageLength.length-1;u>=0;--u)n.fullMessageLength[u]+=a[1],a[1]=a[0]+(n.fullMessageLength[u]/4294967296>>>0),n.fullMessageLength[u]=n.fullMessageLength[u]>>>0,a[0]=a[1]/4294967296>>>0;return e.putBytes(s),T3(r,t,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var s=Pa.util.createBuffer();s.putBytes(e.bytes());var i=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,a=i&n.blockLength-1;s.putBytes(iN.substr(0,n.blockLength-a));for(var u,c,f=n.fullMessageLength[0]*8,h=0;h<n.fullMessageLength.length-1;++h)u=n.fullMessageLength[h+1]*8,c=u/4294967296>>>0,f+=c,s.putInt32(f>>>0),f=u>>>0;s.putInt32(f);var m={h0:r.h0,h1:r.h1,h2:r.h2,h3:r.h3,h4:r.h4};T3(m,t,s);var g=Pa.util.createBuffer();return g.putInt32(m.h0),g.putInt32(m.h1),g.putInt32(m.h2),g.putInt32(m.h3),g.putInt32(m.h4),g},n};var iN=null,_3=!1;function kY(){iN="\x80",iN+=Pa.util.fillString("\0",64),_3=!0}o(kY,"_init");function T3(r,e,t){for(var n,s,i,a,u,c,f,h,m=t.length();m>=64;){for(s=r.h0,i=r.h1,a=r.h2,u=r.h3,c=r.h4,h=0;h<16;++h)n=t.getInt32(),e[h]=n,f=u^i&(a^u),n=(s<<5|s>>>27)+f+c+1518500249+n,c=u,u=a,a=(i<<30|i>>>2)>>>0,i=s,s=n;for(;h<20;++h)n=e[h-3]^e[h-8]^e[h-14]^e[h-16],n=n<<1|n>>>31,e[h]=n,f=u^i&(a^u),n=(s<<5|s>>>27)+f+c+1518500249+n,c=u,u=a,a=(i<<30|i>>>2)>>>0,i=s,s=n;for(;h<32;++h)n=e[h-3]^e[h-8]^e[h-14]^e[h-16],n=n<<1|n>>>31,e[h]=n,f=i^a^u,n=(s<<5|s>>>27)+f+c+1859775393+n,c=u,u=a,a=(i<<30|i>>>2)>>>0,i=s,s=n;for(;h<40;++h)n=e[h-6]^e[h-16]^e[h-28]^e[h-32],n=n<<2|n>>>30,e[h]=n,f=i^a^u,n=(s<<5|s>>>27)+f+c+1859775393+n,c=u,u=a,a=(i<<30|i>>>2)>>>0,i=s,s=n;for(;h<60;++h)n=e[h-6]^e[h-16]^e[h-28]^e[h-32],n=n<<2|n>>>30,e[h]=n,f=i&a|u&(i^a),n=(s<<5|s>>>27)+f+c+2400959708+n,c=u,u=a,a=(i<<30|i>>>2)>>>0,i=s,s=n;for(;h<80;++h)n=e[h-6]^e[h-16]^e[h-28]^e[h-32],n=n<<2|n>>>30,e[h]=n,f=i^a^u,n=(s<<5|s>>>27)+f+c+3395469782+n,c=u,u=a,a=(i<<30|i>>>2)>>>0,i=s,s=n;r.h0=r.h0+s|0,r.h1=r.h1+i|0,r.h2=r.h2+a|0,r.h3=r.h3+u|0,r.h4=r.h4+c|0,m-=64}}o(T3,"_update")});var aN=Z((mde,R3)=>{"use strict";var Oa=$t();lr();bi();lp();var D3=R3.exports=Oa.pkcs1=Oa.pkcs1||{};D3.encode_rsa_oaep=function(r,e,t){var n,s,i,a;typeof t=="string"?(n=t,s=arguments[3]||void 0,i=arguments[4]||void 0):t&&(n=t.label||void 0,s=t.seed||void 0,i=t.md||void 0,t.mgf1&&t.mgf1.md&&(a=t.mgf1.md)),i?i.start():i=Oa.md.sha1.create(),a||(a=i);var u=Math.ceil(r.n.bitLength()/8),c=u-2*i.digestLength-2;if(e.length>c){var f=new Error("RSAES-OAEP input message length is too long.");throw f.length=e.length,f.maxLength=c,f}n||(n=""),i.update(n,"raw");for(var h=i.digest(),m="",g=c-e.length,x=0;x<g;x++)m+="\0";var v=h.getBytes()+m+""+e;if(!s)s=Oa.random.getBytes(i.digestLength);else if(s.length!==i.digestLength){var f=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw f.seedLength=s.length,f.digestLength=i.digestLength,f}var w=Tw(s,u-i.digestLength-1,a),S=Oa.util.xorBytes(v,w,v.length),A=Tw(S,i.digestLength,a),T=Oa.util.xorBytes(s,A,s.length);return"\0"+T+S};D3.decode_rsa_oaep=function(r,e,t){var n,s,i;typeof t=="string"?(n=t,s=arguments[3]||void 0):t&&(n=t.label||void 0,s=t.md||void 0,t.mgf1&&t.mgf1.md&&(i=t.mgf1.md));var a=Math.ceil(r.n.bitLength()/8);if(e.length!==a){var S=new Error("RSAES-OAEP encoded message length is invalid.");throw S.length=e.length,S.expectedLength=a,S}if(s===void 0?s=Oa.md.sha1.create():s.start(),i||(i=s),a<2*s.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");n||(n=""),s.update(n,"raw");for(var u=s.digest().getBytes(),c=e.charAt(0),f=e.substring(1,s.digestLength+1),h=e.substring(1+s.digestLength),m=Tw(h,s.digestLength,i),g=Oa.util.xorBytes(f,m,f.length),x=Tw(g,a-s.digestLength-1,i),v=Oa.util.xorBytes(h,x,h.length),w=v.substring(0,s.digestLength),S=c!=="\0",A=0;A<s.digestLength;++A)S|=u.charAt(A)!==w.charAt(A);for(var T=1,b=s.digestLength,E=s.digestLength;E<v.length;E++){var C=v.charCodeAt(E),_=C&1^1,F=T?65534:0;S|=C&F,T=T&_,b+=T}if(S||v.charCodeAt(b)!==1)throw new Error("Invalid RSAES-OAEP padding.");return v.substring(b+1)};function Tw(r,e,t){t||(t=Oa.md.sha1.create());for(var n="",s=Math.ceil(e/t.digestLength),i=0;i<s;++i){var a=String.fromCharCode(i>>24&255,i>>16&255,i>>8&255,i&255);t.start(),t.update(r+a),n+=t.digest().getBytes()}return n.substring(0,e)}o(Tw,"rsa_mgf1")});var uN=Z((vde,oN)=>{"use strict";var Lu=$t();lr();Z0();bi();(function(){if(Lu.prime){oN.exports=Lu.prime;return}var r=oN.exports=Lu.prime=Lu.prime||{},e=Lu.jsbn.BigInteger,t=[6,4,2,4,2,4,6,2],n=new e(null);n.fromInt(30);var s=o(function(m,g){return m|g},"op_or");r.generateProbablePrime=function(m,g,x){typeof g=="function"&&(x=g,g={}),g=g||{};var v=g.algorithm||"PRIMEINC";typeof v=="string"&&(v={name:v}),v.options=v.options||{};var w=g.prng||Lu.random,S={nextBytes:o(function(A){for(var T=w.getBytesSync(A.length),b=0;b<A.length;++b)A[b]=T.charCodeAt(b)},"nextBytes")};if(v.name==="PRIMEINC")return i(m,S,v.options,x);throw new Error("Invalid prime generation algorithm: "+v.name)};function i(m,g,x,v){return"workers"in x?c(m,g,x,v):a(m,g,x,v)}o(i,"primeincFindPrime");function a(m,g,x,v){var w=f(m,g),S=0,A=h(w.bitLength());"millerRabinTests"in x&&(A=x.millerRabinTests);var T=10;"maxBlockTime"in x&&(T=x.maxBlockTime),u(w,m,g,S,A,T,v)}o(a,"primeincFindPrimeWithoutWorkers");function u(m,g,x,v,w,S,A){var T=+new Date;do{if(m.bitLength()>g&&(m=f(g,x)),m.isProbablePrime(w))return A(null,m);m.dAddOffset(t[v++%8],0)}while(S<0||+new Date-T<S);Lu.util.setImmediate(function(){u(m,g,x,v,w,S,A)})}o(u,"_primeinc");function c(m,g,x,v){if(typeof Worker>"u")return a(m,g,x,v);var w=f(m,g),S=x.workers,A=x.workLoad||100,T=A*30/8,b=x.workerScript||"forge/prime.worker.js";if(S===-1)return Lu.util.estimateCores(function(C,_){C&&(_=2),S=_-1,E()});E();function E(){S=Math.max(1,S);for(var C=[],_=0;_<S;++_)C[_]=new Worker(b);for(var F=S,_=0;_<S;++_)C[_].addEventListener("message",q);var R=!1;function q(H){if(!R){--F;var K=H.data;if(K.found){for(var X=0;X<C.length;++X)C[X].terminate();return R=!0,v(null,new e(K.prime,16))}w.bitLength()>m&&(w=f(m,g));var pe=w.toString(16);H.target.postMessage({hex:pe,workLoad:A}),w.dAddOffset(T,0)}}o(q,"workerMessage")}o(E,"generate")}o(c,"primeincFindPrimeWithWorkers");function f(m,g){var x=new e(m,g),v=m-1;return x.testBit(v)||x.bitwiseTo(e.ONE.shiftLeft(v),s,x),x.dAddOffset(31-x.mod(n).byteValue(),0),x}o(f,"generateRandom");function h(m){return m<=100?27:m<=150?18:m<=200?15:m<=250?12:m<=300?9:m<=350?8:m<=400?7:m<=500?6:m<=600?5:m<=800?4:m<=1250?3:2}o(h,"getMillerRabinTests")})()});var eg=Z((xde,j3)=>{"use strict";var yt=$t();ea();Z0();Ou();aN();uN();bi();lr();typeof ar>"u"&&(ar=yt.jsbn.BigInteger);var ar,cN=yt.util.isNodejs?Xe("crypto"):null,de=yt.asn1,Ai=yt.util;yt.pki=yt.pki||{};j3.exports=yt.pki.rsa=yt.rsa=yt.rsa||{};var Vt=yt.pki,LY=[6,4,2,4,2,4,6,2],VY={name:"PrivateKeyInfo",tagClass:de.Class.UNIVERSAL,type:de.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:de.Class.UNIVERSAL,type:de.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:de.Class.UNIVERSAL,type:de.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:de.Class.UNIVERSAL,type:de.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},UY={name:"RSAPrivateKey",tagClass:de.Class.UNIVERSAL,type:de.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},jY={name:"RSAPublicKey",tagClass:de.Class.UNIVERSAL,type:de.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},MY=yt.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:de.Class.UNIVERSAL,type:de.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:de.Class.UNIVERSAL,type:de.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:de.Class.UNIVERSAL,type:de.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:de.Class.UNIVERSAL,type:de.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:de.Class.UNIVERSAL,type:de.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},FY={name:"DigestInfo",tagClass:de.Class.UNIVERSAL,type:de.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:de.Class.UNIVERSAL,type:de.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:de.Class.UNIVERSAL,type:de.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:de.Class.UNIVERSAL,type:de.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:de.Class.UNIVERSAL,type:de.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},qY=o(function(r){var e;if(r.algorithm in Vt.oids)e=Vt.oids[r.algorithm];else{var t=new Error("Unknown message digest algorithm.");throw t.algorithm=r.algorithm,t}var n=de.oidToDer(e).getBytes(),s=de.create(de.Class.UNIVERSAL,de.Type.SEQUENCE,!0,[]),i=de.create(de.Class.UNIVERSAL,de.Type.SEQUENCE,!0,[]);i.value.push(de.create(de.Class.UNIVERSAL,de.Type.OID,!1,n)),i.value.push(de.create(de.Class.UNIVERSAL,de.Type.NULL,!1,""));var a=de.create(de.Class.UNIVERSAL,de.Type.OCTETSTRING,!1,r.digest().getBytes());return s.value.push(i),s.value.push(a),de.toDer(s).getBytes()},"emsaPkcs1v15encode"),V3=o(function(r,e,t){if(t)return r.modPow(e.e,e.n);if(!e.p||!e.q)return r.modPow(e.d,e.n);e.dP||(e.dP=e.d.mod(e.p.subtract(ar.ONE))),e.dQ||(e.dQ=e.d.mod(e.q.subtract(ar.ONE))),e.qInv||(e.qInv=e.q.modInverse(e.p));var n;do n=new ar(yt.util.bytesToHex(yt.random.getBytes(e.n.bitLength()/8)),16);while(n.compareTo(e.n)>=0||!n.gcd(e.n).equals(ar.ONE));r=r.multiply(n.modPow(e.e,e.n)).mod(e.n);for(var s=r.mod(e.p).modPow(e.dP,e.p),i=r.mod(e.q).modPow(e.dQ,e.q);s.compareTo(i)<0;)s=s.add(e.p);var a=s.subtract(i).multiply(e.qInv).mod(e.p).multiply(e.q).add(i);return a=a.multiply(n.modInverse(e.n)).mod(e.n),a},"_modPow");Vt.rsa.encrypt=function(r,e,t){var n=t,s,i=Math.ceil(e.n.bitLength()/8);t!==!1&&t!==!0?(n=t===2,s=U3(r,e,t)):(s=yt.util.createBuffer(),s.putBytes(r));for(var a=new ar(s.toHex(),16),u=V3(a,e,n),c=u.toString(16),f=yt.util.createBuffer(),h=i-Math.ceil(c.length/2);h>0;)f.putByte(0),--h;return f.putBytes(yt.util.hexToBytes(c)),f.getBytes()};Vt.rsa.decrypt=function(r,e,t,n){var s=Math.ceil(e.n.bitLength()/8);if(r.length!==s){var i=new Error("Encrypted message length is invalid.");throw i.length=r.length,i.expected=s,i}var a=new ar(yt.util.createBuffer(r).toHex(),16);if(a.compareTo(e.n)>=0)throw new Error("Encrypted message is invalid.");for(var u=V3(a,e,t),c=u.toString(16),f=yt.util.createBuffer(),h=s-Math.ceil(c.length/2);h>0;)f.putByte(0),--h;return f.putBytes(yt.util.hexToBytes(c)),n!==!1?Iw(f.getBytes(),e,t):f.getBytes()};Vt.rsa.createKeyPairGenerationState=function(r,e,t){typeof r=="string"&&(r=parseInt(r,10)),r=r||2048,t=t||{};var n=t.prng||yt.random,s={nextBytes:o(function(u){for(var c=n.getBytesSync(u.length),f=0;f<u.length;++f)u[f]=c.charCodeAt(f)},"nextBytes")},i=t.algorithm||"PRIMEINC",a;if(i==="PRIMEINC")a={algorithm:i,state:0,bits:r,rng:s,eInt:e||65537,e:new ar(null),p:null,q:null,qBits:r>>1,pBits:r-(r>>1),pqState:0,num:null,keys:null},a.e.fromInt(a.eInt);else throw new Error("Invalid key generation algorithm: "+i);return a};Vt.rsa.stepKeyPairGenerationState=function(r,e){"algorithm"in r||(r.algorithm="PRIMEINC");var t=new ar(null);t.fromInt(30);for(var n=0,s=o(function(m,g){return m|g},"op_or"),i=+new Date,a,u=0;r.keys===null&&(e<=0||u<e);){if(r.state===0){var c=r.p===null?r.pBits:r.qBits,f=c-1;r.pqState===0?(r.num=new ar(c,r.rng),r.num.testBit(f)||r.num.bitwiseTo(ar.ONE.shiftLeft(f),s,r.num),r.num.dAddOffset(31-r.num.mod(t).byteValue(),0),n=0,++r.pqState):r.pqState===1?r.num.bitLength()>c?r.pqState=0:r.num.isProbablePrime(KY(r.num.bitLength()))?++r.pqState:r.num.dAddOffset(LY[n++%8],0):r.pqState===2?r.pqState=r.num.subtract(ar.ONE).gcd(r.e).compareTo(ar.ONE)===0?3:0:r.pqState===3&&(r.pqState=0,r.p===null?r.p=r.num:r.q=r.num,r.p!==null&&r.q!==null&&++r.state,r.num=null)}else if(r.state===1)r.p.compareTo(r.q)<0&&(r.num=r.p,r.p=r.q,r.q=r.num),++r.state;else if(r.state===2)r.p1=r.p.subtract(ar.ONE),r.q1=r.q.subtract(ar.ONE),r.phi=r.p1.multiply(r.q1),++r.state;else if(r.state===3)r.phi.gcd(r.e).compareTo(ar.ONE)===0?++r.state:(r.p=null,r.q=null,r.state=0);else if(r.state===4)r.n=r.p.multiply(r.q),r.n.bitLength()===r.bits?++r.state:(r.q=null,r.state=0);else if(r.state===5){var h=r.e.modInverse(r.phi);r.keys={privateKey:Vt.rsa.setPrivateKey(r.n,r.e,h,r.p,r.q,h.mod(r.p1),h.mod(r.q1),r.q.modInverse(r.p)),publicKey:Vt.rsa.setPublicKey(r.n,r.e)}}a=+new Date,u+=a-i,i=a}return r.keys!==null};Vt.rsa.generateKeyPair=function(r,e,t,n){if(arguments.length===1?typeof r=="object"?(t=r,r=void 0):typeof r=="function"&&(n=r,r=void 0):arguments.length===2?typeof r=="number"?typeof e=="function"?(n=e,e=void 0):typeof e!="number"&&(t=e,e=void 0):(t=r,n=e,r=void 0,e=void 0):arguments.length===3&&(typeof e=="number"?typeof t=="function"&&(n=t,t=void 0):(n=t,t=e,e=void 0)),t=t||{},r===void 0&&(r=t.bits||2048),e===void 0&&(e=t.e||65537),!yt.options.usePureJavaScript&&!t.prng&&r>=256&&r<=16384&&(e===65537||e===3)){if(n){if(P3("generateKeyPair"))return cN.generateKeyPair("rsa",{modulusLength:r,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(u,c,f){if(u)return n(u);n(null,{privateKey:Vt.privateKeyFromPem(f),publicKey:Vt.publicKeyFromPem(c)})});if(O3("generateKey")&&O3("exportKey"))return Ai.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:r,publicExponent:L3(e),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(u){return Ai.globalScope.crypto.subtle.exportKey("pkcs8",u.privateKey)}).then(void 0,function(u){n(u)}).then(function(u){if(u){var c=Vt.privateKeyFromAsn1(de.fromDer(yt.util.createBuffer(u)));n(null,{privateKey:c,publicKey:Vt.setRsaPublicKey(c.n,c.e)})}});if(k3("generateKey")&&k3("exportKey")){var s=Ai.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:r,publicExponent:L3(e),hash:{name:"SHA-256"}},!0,["sign","verify"]);s.oncomplete=function(u){var c=u.target.result,f=Ai.globalScope.msCrypto.subtle.exportKey("pkcs8",c.privateKey);f.oncomplete=function(h){var m=h.target.result,g=Vt.privateKeyFromAsn1(de.fromDer(yt.util.createBuffer(m)));n(null,{privateKey:g,publicKey:Vt.setRsaPublicKey(g.n,g.e)})},f.onerror=function(h){n(h)}},s.onerror=function(u){n(u)};return}}else if(P3("generateKeyPairSync")){var i=cN.generateKeyPairSync("rsa",{modulusLength:r,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:Vt.privateKeyFromPem(i.privateKey),publicKey:Vt.publicKeyFromPem(i.publicKey)}}}var a=Vt.rsa.createKeyPairGenerationState(r,e,t);if(!n)return Vt.rsa.stepKeyPairGenerationState(a,0),a.keys;HY(a,t,n)};Vt.setRsaPublicKey=Vt.rsa.setPublicKey=function(r,e){var t={n:r,e};return t.encrypt=function(n,s,i){if(typeof s=="string"?s=s.toUpperCase():s===void 0&&(s="RSAES-PKCS1-V1_5"),s==="RSAES-PKCS1-V1_5")s={encode:o(function(u,c,f){return U3(u,c,2).getBytes()},"encode")};else if(s==="RSA-OAEP"||s==="RSAES-OAEP")s={encode:o(function(u,c){return yt.pkcs1.encode_rsa_oaep(c,u,i)},"encode")};else if(["RAW","NONE","NULL",null].indexOf(s)!==-1)s={encode:o(function(u){return u},"encode")};else if(typeof s=="string")throw new Error('Unsupported encryption scheme: "'+s+'".');var a=s.encode(n,t,!0);return Vt.rsa.encrypt(a,t,!0)},t.verify=function(n,s,i,a){typeof i=="string"?i=i.toUpperCase():i===void 0&&(i="RSASSA-PKCS1-V1_5"),a===void 0&&(a={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in a||(a._parseAllDigestBytes=!0),i==="RSASSA-PKCS1-V1_5"?i={verify:o(function(c,f){f=Iw(f,t,!0);var h=de.fromDer(f,{parseAllBytes:a._parseAllDigestBytes}),m={},g=[];if(!de.validate(h,FY,m,g)){var x=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw x.errors=g,x}var v=de.derToOid(m.algorithmIdentifier);if(!(v===yt.oids.md2||v===yt.oids.md5||v===yt.oids.sha1||v===yt.oids.sha224||v===yt.oids.sha256||v===yt.oids.sha384||v===yt.oids.sha512||v===yt.oids["sha512-224"]||v===yt.oids["sha512-256"])){var x=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw x.oid=v,x}if((v===yt.oids.md2||v===yt.oids.md5)&&!("parameters"in m))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return c===m.digest},"verify")}:(i==="NONE"||i==="NULL"||i===null)&&(i={verify:o(function(c,f){return f=Iw(f,t,!0),c===f},"verify")});var u=Vt.rsa.decrypt(s,t,!0,!1);return i.verify(n,u,t.n.bitLength())},t};Vt.setRsaPrivateKey=Vt.rsa.setPrivateKey=function(r,e,t,n,s,i,a,u){var c={n:r,e,d:t,p:n,q:s,dP:i,dQ:a,qInv:u};return c.decrypt=function(f,h,m){typeof h=="string"?h=h.toUpperCase():h===void 0&&(h="RSAES-PKCS1-V1_5");var g=Vt.rsa.decrypt(f,c,!1,!1);if(h==="RSAES-PKCS1-V1_5")h={decode:Iw};else if(h==="RSA-OAEP"||h==="RSAES-OAEP")h={decode:o(function(x,v){return yt.pkcs1.decode_rsa_oaep(v,x,m)},"decode")};else if(["RAW","NONE","NULL",null].indexOf(h)!==-1)h={decode:o(function(x){return x},"decode")};else throw new Error('Unsupported encryption scheme: "'+h+'".');return h.decode(g,c,!1)},c.sign=function(f,h){var m=!1;typeof h=="string"&&(h=h.toUpperCase()),h===void 0||h==="RSASSA-PKCS1-V1_5"?(h={encode:qY},m=1):(h==="NONE"||h==="NULL"||h===null)&&(h={encode:o(function(){return f},"encode")},m=1);var g=h.encode(f,c.n.bitLength());return Vt.rsa.encrypt(g,c,m)},c};Vt.wrapRsaPrivateKey=function(r){return de.create(de.Class.UNIVERSAL,de.Type.SEQUENCE,!0,[de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,de.integerToDer(0).getBytes()),de.create(de.Class.UNIVERSAL,de.Type.SEQUENCE,!0,[de.create(de.Class.UNIVERSAL,de.Type.OID,!1,de.oidToDer(Vt.oids.rsaEncryption).getBytes()),de.create(de.Class.UNIVERSAL,de.Type.NULL,!1,"")]),de.create(de.Class.UNIVERSAL,de.Type.OCTETSTRING,!1,de.toDer(r).getBytes())])};Vt.privateKeyFromAsn1=function(r){var e={},t=[];if(de.validate(r,VY,e,t)&&(r=de.fromDer(yt.util.createBuffer(e.privateKey))),e={},t=[],!de.validate(r,UY,e,t)){var n=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw n.errors=t,n}var s,i,a,u,c,f,h,m;return s=yt.util.createBuffer(e.privateKeyModulus).toHex(),i=yt.util.createBuffer(e.privateKeyPublicExponent).toHex(),a=yt.util.createBuffer(e.privateKeyPrivateExponent).toHex(),u=yt.util.createBuffer(e.privateKeyPrime1).toHex(),c=yt.util.createBuffer(e.privateKeyPrime2).toHex(),f=yt.util.createBuffer(e.privateKeyExponent1).toHex(),h=yt.util.createBuffer(e.privateKeyExponent2).toHex(),m=yt.util.createBuffer(e.privateKeyCoefficient).toHex(),Vt.setRsaPrivateKey(new ar(s,16),new ar(i,16),new ar(a,16),new ar(u,16),new ar(c,16),new ar(f,16),new ar(h,16),new ar(m,16))};Vt.privateKeyToAsn1=Vt.privateKeyToRSAPrivateKey=function(r){return de.create(de.Class.UNIVERSAL,de.Type.SEQUENCE,!0,[de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,de.integerToDer(0).getBytes()),de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,ka(r.n)),de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,ka(r.e)),de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,ka(r.d)),de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,ka(r.p)),de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,ka(r.q)),de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,ka(r.dP)),de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,ka(r.dQ)),de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,ka(r.qInv))])};Vt.publicKeyFromAsn1=function(r){var e={},t=[];if(de.validate(r,MY,e,t)){var n=de.derToOid(e.publicKeyOid);if(n!==Vt.oids.rsaEncryption){var s=new Error("Cannot read public key. Unknown OID.");throw s.oid=n,s}r=e.rsaPublicKey}if(t=[],!de.validate(r,jY,e,t)){var s=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw s.errors=t,s}var i=yt.util.createBuffer(e.publicKeyModulus).toHex(),a=yt.util.createBuffer(e.publicKeyExponent).toHex();return Vt.setRsaPublicKey(new ar(i,16),new ar(a,16))};Vt.publicKeyToAsn1=Vt.publicKeyToSubjectPublicKeyInfo=function(r){return de.create(de.Class.UNIVERSAL,de.Type.SEQUENCE,!0,[de.create(de.Class.UNIVERSAL,de.Type.SEQUENCE,!0,[de.create(de.Class.UNIVERSAL,de.Type.OID,!1,de.oidToDer(Vt.oids.rsaEncryption).getBytes()),de.create(de.Class.UNIVERSAL,de.Type.NULL,!1,"")]),de.create(de.Class.UNIVERSAL,de.Type.BITSTRING,!1,[Vt.publicKeyToRSAPublicKey(r)])])};Vt.publicKeyToRSAPublicKey=function(r){return de.create(de.Class.UNIVERSAL,de.Type.SEQUENCE,!0,[de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,ka(r.n)),de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,ka(r.e))])};function U3(r,e,t){var n=yt.util.createBuffer(),s=Math.ceil(e.n.bitLength()/8);if(r.length>s-11){var i=new Error("Message is too long for PKCS#1 v1.5 padding.");throw i.length=r.length,i.max=s-11,i}n.putByte(0),n.putByte(t);var a=s-3-r.length,u;if(t===0||t===1){u=t===0?0:255;for(var c=0;c<a;++c)n.putByte(u)}else for(;a>0;){for(var f=0,h=yt.random.getBytes(a),c=0;c<a;++c)u=h.charCodeAt(c),u===0?++f:n.putByte(u);a=f}return n.putByte(0),n.putBytes(r),n}o(U3,"_encodePkcs1_v1_5");function Iw(r,e,t,n){var s=Math.ceil(e.n.bitLength()/8),i=yt.util.createBuffer(r),a=i.getByte(),u=i.getByte();if(a!==0||t&&u!==0&&u!==1||!t&&u!=2||t&&u===0&&typeof n>"u")throw new Error("Encryption block is invalid.");var c=0;if(u===0){c=s-3-n;for(var f=0;f<c;++f)if(i.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(u===1)for(c=0;i.length()>1;){if(i.getByte()!==255){--i.read;break}++c}else if(u===2)for(c=0;i.length()>1;){if(i.getByte()===0){--i.read;break}++c}var h=i.getByte();if(h!==0||c!==s-3-i.length())throw new Error("Encryption block is invalid.");return i.getBytes()}o(Iw,"_decodePkcs1_v1_5");function HY(r,e,t){typeof e=="function"&&(t=e,e={}),e=e||{};var n={algorithm:{name:e.algorithm||"PRIMEINC",options:{workers:e.workers||2,workLoad:e.workLoad||100,workerScript:e.workerScript}}};"prng"in e&&(n.prng=e.prng),s();function s(){i(r.pBits,function(u,c){if(u)return t(u);if(r.p=c,r.q!==null)return a(u,r.q);i(r.qBits,a)})}o(s,"generate");function i(u,c){yt.prime.generateProbablePrime(u,n,c)}o(i,"getPrime");function a(u,c){if(u)return t(u);if(r.q=c,r.p.compareTo(r.q)<0){var f=r.p;r.p=r.q,r.q=f}if(r.p.subtract(ar.ONE).gcd(r.e).compareTo(ar.ONE)!==0){r.p=null,s();return}if(r.q.subtract(ar.ONE).gcd(r.e).compareTo(ar.ONE)!==0){r.q=null,i(r.qBits,a);return}if(r.p1=r.p.subtract(ar.ONE),r.q1=r.q.subtract(ar.ONE),r.phi=r.p1.multiply(r.q1),r.phi.gcd(r.e).compareTo(ar.ONE)!==0){r.p=r.q=null,s();return}if(r.n=r.p.multiply(r.q),r.n.bitLength()!==r.bits){r.q=null,i(r.qBits,a);return}var h=r.e.modInverse(r.phi);r.keys={privateKey:Vt.rsa.setPrivateKey(r.n,r.e,h,r.p,r.q,h.mod(r.p1),h.mod(r.q1),r.q.modInverse(r.p)),publicKey:Vt.rsa.setPublicKey(r.n,r.e)},t(null,r.keys)}o(a,"finish")}o(HY,"_generateKeyPair");function ka(r){var e=r.toString(16);e[0]>="8"&&(e="00"+e);var t=yt.util.hexToBytes(e);return t.length>1&&(t.charCodeAt(0)===0&&(t.charCodeAt(1)&128)===0||t.charCodeAt(0)===255&&(t.charCodeAt(1)&128)===128)?t.substr(1):t}o(ka,"_bnToBytes");function KY(r){return r<=100?27:r<=150?18:r<=200?15:r<=250?12:r<=300?9:r<=350?8:r<=400?7:r<=500?6:r<=600?5:r<=800?4:r<=1250?3:2}o(KY,"_getMillerRabinTests");function P3(r){return yt.util.isNodejs&&typeof cN[r]=="function"}o(P3,"_detectNodeCrypto");function O3(r){return typeof Ai.globalScope<"u"&&typeof Ai.globalScope.crypto=="object"&&typeof Ai.globalScope.crypto.subtle=="object"&&typeof Ai.globalScope.crypto.subtle[r]=="function"}o(O3,"_detectSubtleCrypto");function k3(r){return typeof Ai.globalScope<"u"&&typeof Ai.globalScope.msCrypto=="object"&&typeof Ai.globalScope.msCrypto.subtle=="object"&&typeof Ai.globalScope.msCrypto.subtle[r]=="function"}o(k3,"_detectSubtleMsCrypto");function L3(r){for(var e=yt.util.hexToBytes(r.toString(16)),t=new Uint8Array(e.length),n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}o(L3,"_intToUint8Array")});var lN=Z((Sde,K3)=>{"use strict";var it=$t();Pu();ea();Y0();Ia();Ou();Ew();_l();bi();tN();eg();lr();typeof M3>"u"&&(M3=it.jsbn.BigInteger);var M3,Se=it.asn1,Ft=it.pki=it.pki||{};K3.exports=Ft.pbe=it.pbe=it.pbe||{};var Rl=Ft.oids,$Y={name:"EncryptedPrivateKeyInfo",tagClass:Se.Class.UNIVERSAL,type:Se.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:Se.Class.UNIVERSAL,type:Se.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Se.Class.UNIVERSAL,type:Se.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:Se.Class.UNIVERSAL,type:Se.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:Se.Class.UNIVERSAL,type:Se.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},GY={name:"PBES2Algorithms",tagClass:Se.Class.UNIVERSAL,type:Se.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:Se.Class.UNIVERSAL,type:Se.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:Se.Class.UNIVERSAL,type:Se.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:Se.Class.UNIVERSAL,type:Se.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:Se.Class.UNIVERSAL,type:Se.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:Se.Class.UNIVERSAL,type:Se.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:Se.Class.UNIVERSAL,type:Se.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:Se.Class.UNIVERSAL,type:Se.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:Se.Class.UNIVERSAL,type:Se.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:Se.Class.UNIVERSAL,type:Se.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:Se.Class.UNIVERSAL,type:Se.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:Se.Class.UNIVERSAL,type:Se.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},XY={name:"pkcs-12PbeParams",tagClass:Se.Class.UNIVERSAL,type:Se.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:Se.Class.UNIVERSAL,type:Se.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:Se.Class.UNIVERSAL,type:Se.Type.INTEGER,constructed:!1,capture:"iterations"}]};Ft.encryptPrivateKeyInfo=function(r,e,t){t=t||{},t.saltSize=t.saltSize||8,t.count=t.count||2048,t.algorithm=t.algorithm||"aes128",t.prfAlgorithm=t.prfAlgorithm||"sha1";var n=it.random.getBytesSync(t.saltSize),s=t.count,i=Se.integerToDer(s),a,u,c;if(t.algorithm.indexOf("aes")===0||t.algorithm==="des"){var f,h,m;switch(t.algorithm){case"aes128":a=16,f=16,h=Rl["aes128-CBC"],m=it.aes.createEncryptionCipher;break;case"aes192":a=24,f=16,h=Rl["aes192-CBC"],m=it.aes.createEncryptionCipher;break;case"aes256":a=32,f=16,h=Rl["aes256-CBC"],m=it.aes.createEncryptionCipher;break;case"des":a=8,f=8,h=Rl.desCBC,m=it.des.createEncryptionCipher;break;default:var g=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw g.algorithm=t.algorithm,g}var x="hmacWith"+t.prfAlgorithm.toUpperCase(),v=H3(x),w=it.pkcs5.pbkdf2(e,n,s,a,v),S=it.random.getBytesSync(f),A=m(w);A.start(S),A.update(Se.toDer(r)),A.finish(),c=A.output.getBytes();var T=WY(n,i,a,x);u=Se.create(Se.Class.UNIVERSAL,Se.Type.SEQUENCE,!0,[Se.create(Se.Class.UNIVERSAL,Se.Type.OID,!1,Se.oidToDer(Rl.pkcs5PBES2).getBytes()),Se.create(Se.Class.UNIVERSAL,Se.Type.SEQUENCE,!0,[Se.create(Se.Class.UNIVERSAL,Se.Type.SEQUENCE,!0,[Se.create(Se.Class.UNIVERSAL,Se.Type.OID,!1,Se.oidToDer(Rl.pkcs5PBKDF2).getBytes()),T]),Se.create(Se.Class.UNIVERSAL,Se.Type.SEQUENCE,!0,[Se.create(Se.Class.UNIVERSAL,Se.Type.OID,!1,Se.oidToDer(h).getBytes()),Se.create(Se.Class.UNIVERSAL,Se.Type.OCTETSTRING,!1,S)])])])}else if(t.algorithm==="3des"){a=24;var b=new it.util.ByteBuffer(n),w=Ft.pbe.generatePkcs12Key(e,b,1,s,a),S=Ft.pbe.generatePkcs12Key(e,b,2,s,a),A=it.des.createEncryptionCipher(w);A.start(S),A.update(Se.toDer(r)),A.finish(),c=A.output.getBytes(),u=Se.create(Se.Class.UNIVERSAL,Se.Type.SEQUENCE,!0,[Se.create(Se.Class.UNIVERSAL,Se.Type.OID,!1,Se.oidToDer(Rl["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),Se.create(Se.Class.UNIVERSAL,Se.Type.SEQUENCE,!0,[Se.create(Se.Class.UNIVERSAL,Se.Type.OCTETSTRING,!1,n),Se.create(Se.Class.UNIVERSAL,Se.Type.INTEGER,!1,i.getBytes())])])}else{var g=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw g.algorithm=t.algorithm,g}var E=Se.create(Se.Class.UNIVERSAL,Se.Type.SEQUENCE,!0,[u,Se.create(Se.Class.UNIVERSAL,Se.Type.OCTETSTRING,!1,c)]);return E};Ft.decryptPrivateKeyInfo=function(r,e){var t=null,n={},s=[];if(!Se.validate(r,$Y,n,s)){var i=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw i.errors=s,i}var a=Se.derToOid(n.encryptionOid),u=Ft.pbe.getCipher(a,n.encryptionParams,e),c=it.util.createBuffer(n.encryptedData);return u.update(c),u.finish()&&(t=Se.fromDer(u.output)),t};Ft.encryptedPrivateKeyToPem=function(r,e){var t={type:"ENCRYPTED PRIVATE KEY",body:Se.toDer(r).getBytes()};return it.pem.encode(t,{maxline:e})};Ft.encryptedPrivateKeyFromPem=function(r){var e=it.pem.decode(r)[0];if(e.type!=="ENCRYPTED PRIVATE KEY"){var t=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw t.headerType=e.type,t}if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return Se.fromDer(e.body)};Ft.encryptRsaPrivateKey=function(r,e,t){if(t=t||{},!t.legacy){var n=Ft.wrapRsaPrivateKey(Ft.privateKeyToAsn1(r));return n=Ft.encryptPrivateKeyInfo(n,e,t),Ft.encryptedPrivateKeyToPem(n)}var s,i,a,u;switch(t.algorithm){case"aes128":s="AES-128-CBC",a=16,i=it.random.getBytesSync(16),u=it.aes.createEncryptionCipher;break;case"aes192":s="AES-192-CBC",a=24,i=it.random.getBytesSync(16),u=it.aes.createEncryptionCipher;break;case"aes256":s="AES-256-CBC",a=32,i=it.random.getBytesSync(16),u=it.aes.createEncryptionCipher;break;case"3des":s="DES-EDE3-CBC",a=24,i=it.random.getBytesSync(8),u=it.des.createEncryptionCipher;break;case"des":s="DES-CBC",a=8,i=it.random.getBytesSync(8),u=it.des.createEncryptionCipher;break;default:var c=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+t.algorithm+'".');throw c.algorithm=t.algorithm,c}var f=it.pbe.opensslDeriveBytes(e,i.substr(0,8),a),h=u(f);h.start(i),h.update(Se.toDer(Ft.privateKeyToAsn1(r))),h.finish();var m={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:s,parameters:it.util.bytesToHex(i).toUpperCase()},body:h.output.getBytes()};return it.pem.encode(m)};Ft.decryptRsaPrivateKey=function(r,e){var t=null,n=it.pem.decode(r)[0];if(n.type!=="ENCRYPTED PRIVATE KEY"&&n.type!=="PRIVATE KEY"&&n.type!=="RSA PRIVATE KEY"){var s=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw s.headerType=s,s}if(n.procType&&n.procType.type==="ENCRYPTED"){var i,a;switch(n.dekInfo.algorithm){case"DES-CBC":i=8,a=it.des.createDecryptionCipher;break;case"DES-EDE3-CBC":i=24,a=it.des.createDecryptionCipher;break;case"AES-128-CBC":i=16,a=it.aes.createDecryptionCipher;break;case"AES-192-CBC":i=24,a=it.aes.createDecryptionCipher;break;case"AES-256-CBC":i=32,a=it.aes.createDecryptionCipher;break;case"RC2-40-CBC":i=5,a=o(function(m){return it.rc2.createDecryptionCipher(m,40)},"cipherFn");break;case"RC2-64-CBC":i=8,a=o(function(m){return it.rc2.createDecryptionCipher(m,64)},"cipherFn");break;case"RC2-128-CBC":i=16,a=o(function(m){return it.rc2.createDecryptionCipher(m,128)},"cipherFn");break;default:var s=new Error('Could not decrypt private key; unsupported encryption algorithm "'+n.dekInfo.algorithm+'".');throw s.algorithm=n.dekInfo.algorithm,s}var u=it.util.hexToBytes(n.dekInfo.parameters),c=it.pbe.opensslDeriveBytes(e,u.substr(0,8),i),f=a(c);if(f.start(u),f.update(it.util.createBuffer(n.body)),f.finish())t=f.output.getBytes();else return t}else t=n.body;return n.type==="ENCRYPTED PRIVATE KEY"?t=Ft.decryptPrivateKeyInfo(Se.fromDer(t),e):t=Se.fromDer(t),t!==null&&(t=Ft.privateKeyFromAsn1(t)),t};Ft.pbe.generatePkcs12Key=function(r,e,t,n,s,i){var a,u;if(typeof i>"u"||i===null){if(!("sha1"in it.md))throw new Error('"sha1" hash algorithm unavailable.');i=it.md.sha1.create()}var c=i.digestLength,f=i.blockLength,h=new it.util.ByteBuffer,m=new it.util.ByteBuffer;if(r!=null){for(u=0;u<r.length;u++)m.putInt16(r.charCodeAt(u));m.putInt16(0)}var g=m.length(),x=e.length(),v=new it.util.ByteBuffer;v.fillWithByte(t,f);var w=f*Math.ceil(x/f),S=new it.util.ByteBuffer;for(u=0;u<w;u++)S.putByte(e.at(u%x));var A=f*Math.ceil(g/f),T=new it.util.ByteBuffer;for(u=0;u<A;u++)T.putByte(m.at(u%g));var b=S;b.putBuffer(T);for(var E=Math.ceil(s/c),C=1;C<=E;C++){var _=new it.util.ByteBuffer;_.putBytes(v.bytes()),_.putBytes(b.bytes());for(var F=0;F<n;F++)i.start(),i.update(_.getBytes()),_=i.digest();var R=new it.util.ByteBuffer;for(u=0;u<f;u++)R.putByte(_.at(u%c));var q=Math.ceil(x/f)+Math.ceil(g/f),H=new it.util.ByteBuffer;for(a=0;a<q;a++){var K=new it.util.ByteBuffer(b.getBytes(f)),X=511;for(u=R.length()-1;u>=0;u--)X=X>>8,X+=R.at(u)+K.at(u),K.setAt(u,X&255);H.putBuffer(K)}b=H,h.putBuffer(_)}return h.truncate(h.length()-s),h};Ft.pbe.getCipher=function(r,e,t){switch(r){case Ft.oids.pkcs5PBES2:return Ft.pbe.getCipherForPBES2(r,e,t);case Ft.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case Ft.oids["pbewithSHAAnd40BitRC2-CBC"]:return Ft.pbe.getCipherForPKCS12PBE(r,e,t);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=r,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}};Ft.pbe.getCipherForPBES2=function(r,e,t){var n={},s=[];if(!Se.validate(e,GY,n,s)){var i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw i.errors=s,i}if(r=Se.derToOid(n.kdfOid),r!==Ft.oids.pkcs5PBKDF2){var i=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw i.oid=r,i.supportedOids=["pkcs5PBKDF2"],i}if(r=Se.derToOid(n.encOid),r!==Ft.oids["aes128-CBC"]&&r!==Ft.oids["aes192-CBC"]&&r!==Ft.oids["aes256-CBC"]&&r!==Ft.oids["des-EDE3-CBC"]&&r!==Ft.oids.desCBC){var i=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw i.oid=r,i.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],i}var a=n.kdfSalt,u=it.util.createBuffer(n.kdfIterationCount);u=u.getInt(u.length()<<3);var c,f;switch(Ft.oids[r]){case"aes128-CBC":c=16,f=it.aes.createDecryptionCipher;break;case"aes192-CBC":c=24,f=it.aes.createDecryptionCipher;break;case"aes256-CBC":c=32,f=it.aes.createDecryptionCipher;break;case"des-EDE3-CBC":c=24,f=it.des.createDecryptionCipher;break;case"desCBC":c=8,f=it.des.createDecryptionCipher;break}var h=q3(n.prfOid),m=it.pkcs5.pbkdf2(t,a,u,c,h),g=n.encIv,x=f(m);return x.start(g),x};Ft.pbe.getCipherForPKCS12PBE=function(r,e,t){var n={},s=[];if(!Se.validate(e,XY,n,s)){var i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw i.errors=s,i}var a=it.util.createBuffer(n.salt),u=it.util.createBuffer(n.iterations);u=u.getInt(u.length()<<3);var c,f,h;switch(r){case Ft.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,f=8,h=it.des.startDecrypting;break;case Ft.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,f=8,h=o(function(w,S){var A=it.rc2.createDecryptionCipher(w,40);return A.start(S,null),A},"cipherFn");break;default:var i=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw i.oid=r,i}var m=q3(n.prfOid),g=Ft.pbe.generatePkcs12Key(t,a,1,u,c,m);m.start();var x=Ft.pbe.generatePkcs12Key(t,a,2,u,f,m);return h(g,x)};Ft.pbe.opensslDeriveBytes=function(r,e,t,n){if(typeof n>"u"||n===null){if(!("md5"in it.md))throw new Error('"md5" hash algorithm unavailable.');n=it.md.md5.create()}e===null&&(e="");for(var s=[F3(n,r+e)],i=16,a=1;i<t;++a,i+=16)s.push(F3(n,s[a-1]+r+e));return s.join("").substr(0,t)};function F3(r,e){return r.start().update(e).digest().getBytes()}o(F3,"hash");function q3(r){var e;if(!r)e="hmacWithSHA1";else if(e=Ft.oids[Se.derToOid(r)],!e){var t=new Error("Unsupported PRF OID.");throw t.oid=r,t.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],t}return H3(e)}o(q3,"prfOidToMessageDigest");function H3(r){var e=it.md;switch(r){case"hmacWithSHA224":e=it.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":r=r.substr(8).toLowerCase();break;default:var t=new Error("Unsupported PRF algorithm.");throw t.algorithm=r,t.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],t}if(!e||!(r in e))throw new Error("Unknown hash algorithm: "+r);return e[r].create()}o(H3,"prfAlgorithmToMessageDigest");function WY(r,e,t,n){var s=Se.create(Se.Class.UNIVERSAL,Se.Type.SEQUENCE,!0,[Se.create(Se.Class.UNIVERSAL,Se.Type.OCTETSTRING,!1,r),Se.create(Se.Class.UNIVERSAL,Se.Type.INTEGER,!1,e.getBytes())]);return n!=="hmacWithSHA1"&&s.value.push(Se.create(Se.Class.UNIVERSAL,Se.Type.INTEGER,!1,it.util.hexToBytes(t.toString(16))),Se.create(Se.Class.UNIVERSAL,Se.Type.SEQUENCE,!0,[Se.create(Se.Class.UNIVERSAL,Se.Type.OID,!1,Se.oidToDer(Ft.oids[n]).getBytes()),Se.create(Se.Class.UNIVERSAL,Se.Type.NULL,!1,"")])),s}o(WY,"createPbkdf2Params")});var fN=Z((Ede,X3)=>{"use strict";var fp=$t();ea();lr();var rt=fp.asn1,hp=X3.exports=fp.pkcs7asn1=fp.pkcs7asn1||{};fp.pkcs7=fp.pkcs7||{};fp.pkcs7.asn1=hp;var $3={name:"ContentInfo",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:rt.Class.UNIVERSAL,type:rt.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:rt.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};hp.contentInfoValidator=$3;var G3={name:"EncryptedContentInfo",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:rt.Class.UNIVERSAL,type:rt.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:rt.Class.UNIVERSAL,type:rt.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:rt.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:rt.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};hp.envelopedDataValidator={name:"EnvelopedData",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:rt.Class.UNIVERSAL,type:rt.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(G3)};hp.encryptedDataValidator={name:"EncryptedData",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:rt.Class.UNIVERSAL,type:rt.Type.INTEGER,constructed:!1,capture:"version"}].concat(G3)};var zY={name:"SignerInfo",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:rt.Class.UNIVERSAL,type:rt.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:rt.Class.UNIVERSAL,type:rt.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:rt.Class.UNIVERSAL,type:rt.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:rt.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:rt.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:rt.Class.UNIVERSAL,type:rt.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:rt.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};hp.signedDataValidator={name:"SignedData",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:rt.Class.UNIVERSAL,type:rt.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},$3,{name:"SignedData.Certificates",tagClass:rt.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:rt.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SET,capture:"signerInfos",optional:!0,value:[zY]}]};hp.recipientInfoValidator={name:"RecipientInfo",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:rt.Class.UNIVERSAL,type:rt.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:rt.Class.UNIVERSAL,type:rt.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:rt.Class.UNIVERSAL,type:rt.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:rt.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:rt.Class.UNIVERSAL,type:rt.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}});var hN=Z((Ade,W3)=>{"use strict";var Pl=$t();lr();Pl.mgf=Pl.mgf||{};var JY=W3.exports=Pl.mgf.mgf1=Pl.mgf1=Pl.mgf1||{};JY.create=function(r){var e={generate:o(function(t,n){for(var s=new Pl.util.ByteBuffer,i=Math.ceil(n/r.digestLength),a=0;a<i;a++){var u=new Pl.util.ByteBuffer;u.putInt32(a),r.start(),r.update(t+u.getBytes()),s.putBuffer(r.digest())}return s.truncate(s.length()-n),s.getBytes()},"generate")};return e}});var J3=Z((Nde,z3)=>{"use strict";var _w=$t();hN();z3.exports=_w.mgf=_w.mgf||{};_w.mgf.mgf1=_w.mgf1});var Bw=Z((Tde,Y3)=>{"use strict";var Ol=$t();bi();lr();var YY=Y3.exports=Ol.pss=Ol.pss||{};YY.create=function(r){arguments.length===3&&(r={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var e=r.md,t=r.mgf,n=e.digestLength,s=r.salt||null;typeof s=="string"&&(s=Ol.util.createBuffer(s));var i;if("saltLength"in r)i=r.saltLength;else if(s!==null)i=s.length();else throw new Error("Salt length not specified or specific salt not given.");if(s!==null&&s.length()!==i)throw new Error("Given salt length does not match length of given salt.");var a=r.prng||Ol.random,u={};return u.encode=function(c,f){var h,m=f-1,g=Math.ceil(m/8),x=c.digest().getBytes();if(g<n+i+2)throw new Error("Message is too long to encrypt.");var v;s===null?v=a.getBytesSync(i):v=s.bytes();var w=new Ol.util.ByteBuffer;w.fillWithByte(0,8),w.putBytes(x),w.putBytes(v),e.start(),e.update(w.getBytes());var S=e.digest().getBytes(),A=new Ol.util.ByteBuffer;A.fillWithByte(0,g-i-n-2),A.putByte(1),A.putBytes(v);var T=A.getBytes(),b=g-n-1,E=t.generate(S,b),C="";for(h=0;h<b;h++)C+=String.fromCharCode(T.charCodeAt(h)^E.charCodeAt(h));var _=65280>>8*g-m&255;return C=String.fromCharCode(C.charCodeAt(0)&~_)+C.substr(1),C+S+"\xBC"},u.verify=function(c,f,h){var m,g=h-1,x=Math.ceil(g/8);if(f=f.substr(-x),x<n+i+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(f.charCodeAt(x-1)!==188)throw new Error("Encoded message does not end in 0xBC.");var v=x-n-1,w=f.substr(0,v),S=f.substr(v,n),A=65280>>8*x-g&255;if((w.charCodeAt(0)&A)!==0)throw new Error("Bits beyond keysize not zero as expected.");var T=t.generate(S,v),b="";for(m=0;m<v;m++)b+=String.fromCharCode(w.charCodeAt(m)^T.charCodeAt(m));b=String.fromCharCode(b.charCodeAt(0)&~A)+b.substr(1);var E=x-n-i-2;for(m=0;m<E;m++)if(b.charCodeAt(m)!==0)throw new Error("Leftmost octets not zero as expected");if(b.charCodeAt(E)!==1)throw new Error("Inconsistent PSS signature, 0x01 marker not found");var C=b.substr(-i),_=new Ol.util.ByteBuffer;_.fillWithByte(0,8),_.putBytes(c),_.putBytes(C),e.start(),e.update(_.getBytes());var F=e.digest().getBytes();return S===F},u}});var Pw=Z((Ide,rk)=>{"use strict";var xt=$t();Pu();ea();Y0();Ia();J3();Ou();_l();Bw();eg();lr();var k=xt.asn1,$e=rk.exports=xt.pki=xt.pki||{},or=$e.oids,Qr={};Qr.CN=or.commonName;Qr.commonName="CN";Qr.C=or.countryName;Qr.countryName="C";Qr.L=or.localityName;Qr.localityName="L";Qr.ST=or.stateOrProvinceName;Qr.stateOrProvinceName="ST";Qr.O=or.organizationName;Qr.organizationName="O";Qr.OU=or.organizationalUnitName;Qr.organizationalUnitName="OU";Qr.E=or.emailAddress;Qr.emailAddress="E";var Z3=xt.pki.rsa.publicKeyValidator,QY={name:"Certificate",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:k.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:k.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:k.Class.UNIVERSAL,type:k.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:k.Class.UNIVERSAL,type:k.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:k.Class.UNIVERSAL,type:k.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:k.Class.UNIVERSAL,type:k.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},Z3,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:k.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:k.Class.UNIVERSAL,type:k.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:k.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:k.Class.UNIVERSAL,type:k.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:k.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:k.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:k.Class.UNIVERSAL,type:k.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},ZY={name:"rsapss",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:k.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:k.Class.UNIVERSAL,type:k.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:k.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:k.Class.UNIVERSAL,type:k.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:k.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:k.Class.UNIVERSAL,type:k.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:k.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:k.Class.UNIVERSAL,type:k.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},eQ={name:"CertificationRequestInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},Z3,{name:"CertificationRequestInfo.attributes",tagClass:k.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:k.Class.UNIVERSAL,type:k.Type.SET,constructed:!0}]}]}]},tQ={name:"CertificationRequest",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[eQ,{name:"CertificationRequest.signatureAlgorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:k.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:k.Class.UNIVERSAL,type:k.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};$e.RDNAttributesAsArray=function(r,e){for(var t=[],n,s,i,a=0;a<r.value.length;++a){n=r.value[a];for(var u=0;u<n.value.length;++u)i={},s=n.value[u],i.type=k.derToOid(s.value[0].value),i.value=s.value[1].value,i.valueTagClass=s.value[1].type,i.type in or&&(i.name=or[i.type],i.name in Qr&&(i.shortName=Qr[i.name])),e&&(e.update(i.type),e.update(i.value)),t.push(i)}return t};$e.CRIAttributesAsArray=function(r){for(var e=[],t=0;t<r.length;++t)for(var n=r[t],s=k.derToOid(n.value[0].value),i=n.value[1].value,a=0;a<i.length;++a){var u={};if(u.type=s,u.value=i[a].value,u.valueTagClass=i[a].type,u.type in or&&(u.name=or[u.type],u.name in Qr&&(u.shortName=Qr[u.name])),u.type===or.extensionRequest){u.extensions=[];for(var c=0;c<u.value.length;++c)u.extensions.push($e.certificateExtensionFromAsn1(u.value[c]))}e.push(u)}return e};function Vu(r,e){typeof e=="string"&&(e={shortName:e});for(var t=null,n,s=0;t===null&&s<r.attributes.length;++s)n=r.attributes[s],(e.type&&e.type===n.type||e.name&&e.name===n.name||e.shortName&&e.shortName===n.shortName)&&(t=n);return t}o(Vu,"_getAttribute");var Dw=o(function(r,e,t){var n={};if(r!==or["RSASSA-PSS"])return n;t&&(n={hash:{algorithmOid:or.sha1},mgf:{algorithmOid:or.mgf1,hash:{algorithmOid:or.sha1}},saltLength:20});var s={},i=[];if(!k.validate(e,ZY,s,i)){var a=new Error("Cannot read RSASSA-PSS parameter block.");throw a.errors=i,a}return s.hashOid!==void 0&&(n.hash=n.hash||{},n.hash.algorithmOid=k.derToOid(s.hashOid)),s.maskGenOid!==void 0&&(n.mgf=n.mgf||{},n.mgf.algorithmOid=k.derToOid(s.maskGenOid),n.mgf.hash=n.mgf.hash||{},n.mgf.hash.algorithmOid=k.derToOid(s.maskGenHashOid)),s.saltLength!==void 0&&(n.saltLength=s.saltLength.charCodeAt(0)),n},"_readSignatureParameters"),Rw=o(function(r){switch(or[r.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return xt.md.sha1.create();case"md5WithRSAEncryption":return xt.md.md5.create();case"sha256WithRSAEncryption":return xt.md.sha256.create();case"sha384WithRSAEncryption":return xt.md.sha384.create();case"sha512WithRSAEncryption":return xt.md.sha512.create();case"RSASSA-PSS":return xt.md.sha256.create();default:var e=new Error("Could not compute "+r.type+" digest. Unknown signature OID.");throw e.signatureOid=r.signatureOid,e}},"_createSignatureDigest"),ek=o(function(r){var e=r.certificate,t;switch(e.signatureOid){case or.sha1WithRSAEncryption:case or.sha1WithRSASignature:break;case or["RSASSA-PSS"]:var n,s;if(n=or[e.signatureParameters.mgf.hash.algorithmOid],n===void 0||xt.md[n]===void 0){var i=new Error("Unsupported MGF hash function.");throw i.oid=e.signatureParameters.mgf.hash.algorithmOid,i.name=n,i}if(s=or[e.signatureParameters.mgf.algorithmOid],s===void 0||xt.mgf[s]===void 0){var i=new Error("Unsupported MGF function.");throw i.oid=e.signatureParameters.mgf.algorithmOid,i.name=s,i}if(s=xt.mgf[s].create(xt.md[n].create()),n=or[e.signatureParameters.hash.algorithmOid],n===void 0||xt.md[n]===void 0){var i=new Error("Unsupported RSASSA-PSS hash function.");throw i.oid=e.signatureParameters.hash.algorithmOid,i.name=n,i}t=xt.pss.create(xt.md[n].create(),s,e.signatureParameters.saltLength);break}return e.publicKey.verify(r.md.digest().getBytes(),r.signature,t)},"_verifySignature");$e.certificateFromPem=function(r,e,t){var n=xt.pem.decode(r)[0];if(n.type!=="CERTIFICATE"&&n.type!=="X509 CERTIFICATE"&&n.type!=="TRUSTED CERTIFICATE"){var s=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw s.headerType=n.type,s}if(n.procType&&n.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var i=k.fromDer(n.body,t);return $e.certificateFromAsn1(i,e)};$e.certificateToPem=function(r,e){var t={type:"CERTIFICATE",body:k.toDer($e.certificateToAsn1(r)).getBytes()};return xt.pem.encode(t,{maxline:e})};$e.publicKeyFromPem=function(r){var e=xt.pem.decode(r)[0];if(e.type!=="PUBLIC KEY"&&e.type!=="RSA PUBLIC KEY"){var t=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw t.headerType=e.type,t}if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert public key from PEM; PEM is encrypted.");var n=k.fromDer(e.body);return $e.publicKeyFromAsn1(n)};$e.publicKeyToPem=function(r,e){var t={type:"PUBLIC KEY",body:k.toDer($e.publicKeyToAsn1(r)).getBytes()};return xt.pem.encode(t,{maxline:e})};$e.publicKeyToRSAPublicKeyPem=function(r,e){var t={type:"RSA PUBLIC KEY",body:k.toDer($e.publicKeyToRSAPublicKey(r)).getBytes()};return xt.pem.encode(t,{maxline:e})};$e.getPublicKeyFingerprint=function(r,e){e=e||{};var t=e.md||xt.md.sha1.create(),n=e.type||"RSAPublicKey",s;switch(n){case"RSAPublicKey":s=k.toDer($e.publicKeyToRSAPublicKey(r)).getBytes();break;case"SubjectPublicKeyInfo":s=k.toDer($e.publicKeyToAsn1(r)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+e.type+'".')}t.start(),t.update(s);var i=t.digest();if(e.encoding==="hex"){var a=i.toHex();return e.delimiter?a.match(/.{2}/g).join(e.delimiter):a}else{if(e.encoding==="binary")return i.getBytes();if(e.encoding)throw new Error('Unknown encoding "'+e.encoding+'".')}return i};$e.certificationRequestFromPem=function(r,e,t){var n=xt.pem.decode(r)[0];if(n.type!=="CERTIFICATE REQUEST"){var s=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw s.headerType=n.type,s}if(n.procType&&n.procType.type==="ENCRYPTED")throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var i=k.fromDer(n.body,t);return $e.certificationRequestFromAsn1(i,e)};$e.certificationRequestToPem=function(r,e){var t={type:"CERTIFICATE REQUEST",body:k.toDer($e.certificationRequestToAsn1(r)).getBytes()};return xt.pem.encode(t,{maxline:e})};$e.createCertificate=function(){var r={};return r.version=2,r.serialNumber="00",r.signatureOid=null,r.signature=null,r.siginfo={},r.siginfo.algorithmOid=null,r.validity={},r.validity.notBefore=new Date,r.validity.notAfter=new Date,r.issuer={},r.issuer.getField=function(e){return Vu(r.issuer,e)},r.issuer.addField=function(e){Ci([e]),r.issuer.attributes.push(e)},r.issuer.attributes=[],r.issuer.hash=null,r.subject={},r.subject.getField=function(e){return Vu(r.subject,e)},r.subject.addField=function(e){Ci([e]),r.subject.attributes.push(e)},r.subject.attributes=[],r.subject.hash=null,r.extensions=[],r.publicKey=null,r.md=null,r.setSubject=function(e,t){Ci(e),r.subject.attributes=e,delete r.subject.uniqueId,t&&(r.subject.uniqueId=t),r.subject.hash=null},r.setIssuer=function(e,t){Ci(e),r.issuer.attributes=e,delete r.issuer.uniqueId,t&&(r.issuer.uniqueId=t),r.issuer.hash=null},r.setExtensions=function(e){for(var t=0;t<e.length;++t)tk(e[t],{cert:r});r.extensions=e},r.getExtension=function(e){typeof e=="string"&&(e={name:e});for(var t=null,n,s=0;t===null&&s<r.extensions.length;++s)n=r.extensions[s],(e.id&&n.id===e.id||e.name&&n.name===e.name)&&(t=n);return t},r.sign=function(e,t){r.md=t||xt.md.sha1.create();var n=or[r.md.algorithm+"WithRSAEncryption"];if(!n){var s=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw s.algorithm=r.md.algorithm,s}r.signatureOid=r.siginfo.algorithmOid=n,r.tbsCertificate=$e.getTBSCertificate(r);var i=k.toDer(r.tbsCertificate);r.md.update(i.getBytes()),r.signature=e.sign(r.md)},r.verify=function(e){var t=!1;if(!r.issued(e)){var n=e.issuer,s=r.subject,i=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 i.expectedIssuer=s.attributes,i.actualIssuer=n.attributes,i}var a=e.md;if(a===null){a=Rw({signatureOid:e.signatureOid,type:"certificate"});var u=e.tbsCertificate||$e.getTBSCertificate(e),c=k.toDer(u);a.update(c.getBytes())}return a!==null&&(t=ek({certificate:r,md:a,signature:e.signature})),t},r.isIssuer=function(e){var t=!1,n=r.issuer,s=e.subject;if(n.hash&&s.hash)t=n.hash===s.hash;else if(n.attributes.length===s.attributes.length){t=!0;for(var i,a,u=0;t&&u<n.attributes.length;++u)i=n.attributes[u],a=s.attributes[u],(i.type!==a.type||i.value!==a.value)&&(t=!1)}return t},r.issued=function(e){return e.isIssuer(r)},r.generateSubjectKeyIdentifier=function(){return $e.getPublicKeyFingerprint(r.publicKey,{type:"RSAPublicKey"})},r.verifySubjectKeyIdentifier=function(){for(var e=or.subjectKeyIdentifier,t=0;t<r.extensions.length;++t){var n=r.extensions[t];if(n.id===e){var s=r.generateSubjectKeyIdentifier().getBytes();return xt.util.hexToBytes(n.subjectKeyIdentifier)===s}}return!1},r};$e.certificateFromAsn1=function(r,e){var t={},n=[];if(!k.validate(r,QY,t,n)){var s=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw s.errors=n,s}var i=k.derToOid(t.publicKeyOid);if(i!==$e.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var a=$e.createCertificate();a.version=t.certVersion?t.certVersion.charCodeAt(0):0;var u=xt.util.createBuffer(t.certSerialNumber);a.serialNumber=u.toHex(),a.signatureOid=xt.asn1.derToOid(t.certSignatureOid),a.signatureParameters=Dw(a.signatureOid,t.certSignatureParams,!0),a.siginfo.algorithmOid=xt.asn1.derToOid(t.certinfoSignatureOid),a.siginfo.parameters=Dw(a.siginfo.algorithmOid,t.certinfoSignatureParams,!1),a.signature=t.certSignature;var c=[];if(t.certValidity1UTCTime!==void 0&&c.push(k.utcTimeToDate(t.certValidity1UTCTime)),t.certValidity2GeneralizedTime!==void 0&&c.push(k.generalizedTimeToDate(t.certValidity2GeneralizedTime)),t.certValidity3UTCTime!==void 0&&c.push(k.utcTimeToDate(t.certValidity3UTCTime)),t.certValidity4GeneralizedTime!==void 0&&c.push(k.generalizedTimeToDate(t.certValidity4GeneralizedTime)),c.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(c.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(a.validity.notBefore=c[0],a.validity.notAfter=c[1],a.tbsCertificate=t.tbsCertificate,e){a.md=Rw({signatureOid:a.signatureOid,type:"certificate"});var f=k.toDer(a.tbsCertificate);a.md.update(f.getBytes())}var h=xt.md.sha1.create(),m=k.toDer(t.certIssuer);h.update(m.getBytes()),a.issuer.getField=function(v){return Vu(a.issuer,v)},a.issuer.addField=function(v){Ci([v]),a.issuer.attributes.push(v)},a.issuer.attributes=$e.RDNAttributesAsArray(t.certIssuer),t.certIssuerUniqueId&&(a.issuer.uniqueId=t.certIssuerUniqueId),a.issuer.hash=h.digest().toHex();var g=xt.md.sha1.create(),x=k.toDer(t.certSubject);return g.update(x.getBytes()),a.subject.getField=function(v){return Vu(a.subject,v)},a.subject.addField=function(v){Ci([v]),a.subject.attributes.push(v)},a.subject.attributes=$e.RDNAttributesAsArray(t.certSubject),t.certSubjectUniqueId&&(a.subject.uniqueId=t.certSubjectUniqueId),a.subject.hash=g.digest().toHex(),t.certExtensions?a.extensions=$e.certificateExtensionsFromAsn1(t.certExtensions):a.extensions=[],a.publicKey=$e.publicKeyFromAsn1(t.subjectPublicKeyInfo),a};$e.certificateExtensionsFromAsn1=function(r){for(var e=[],t=0;t<r.value.length;++t)for(var n=r.value[t],s=0;s<n.value.length;++s)e.push($e.certificateExtensionFromAsn1(n.value[s]));return e};$e.certificateExtensionFromAsn1=function(r){var e={};if(e.id=k.derToOid(r.value[0].value),e.critical=!1,r.value[1].type===k.Type.BOOLEAN?(e.critical=r.value[1].value.charCodeAt(0)!==0,e.value=r.value[2].value):e.value=r.value[1].value,e.id in or){if(e.name=or[e.id],e.name==="keyUsage"){var t=k.fromDer(e.value),n=0,s=0;t.value.length>1&&(n=t.value.charCodeAt(1),s=t.value.length>2?t.value.charCodeAt(2):0),e.digitalSignature=(n&128)===128,e.nonRepudiation=(n&64)===64,e.keyEncipherment=(n&32)===32,e.dataEncipherment=(n&16)===16,e.keyAgreement=(n&8)===8,e.keyCertSign=(n&4)===4,e.cRLSign=(n&2)===2,e.encipherOnly=(n&1)===1,e.decipherOnly=(s&128)===128}else if(e.name==="basicConstraints"){var t=k.fromDer(e.value);t.value.length>0&&t.value[0].type===k.Type.BOOLEAN?e.cA=t.value[0].value.charCodeAt(0)!==0:e.cA=!1;var i=null;t.value.length>0&&t.value[0].type===k.Type.INTEGER?i=t.value[0].value:t.value.length>1&&(i=t.value[1].value),i!==null&&(e.pathLenConstraint=k.derToInteger(i))}else if(e.name==="extKeyUsage")for(var t=k.fromDer(e.value),a=0;a<t.value.length;++a){var u=k.derToOid(t.value[a].value);u in or?e[or[u]]=!0:e[u]=!0}else if(e.name==="nsCertType"){var t=k.fromDer(e.value),n=0;t.value.length>1&&(n=t.value.charCodeAt(1)),e.client=(n&128)===128,e.server=(n&64)===64,e.email=(n&32)===32,e.objsign=(n&16)===16,e.reserved=(n&8)===8,e.sslCA=(n&4)===4,e.emailCA=(n&2)===2,e.objCA=(n&1)===1}else if(e.name==="subjectAltName"||e.name==="issuerAltName"){e.altNames=[];for(var c,t=k.fromDer(e.value),f=0;f<t.value.length;++f){c=t.value[f];var h={type:c.type,value:c.value};switch(e.altNames.push(h),c.type){case 1:case 2:case 6:break;case 7:h.ip=xt.util.bytesToIP(c.value);break;case 8:h.oid=k.derToOid(c.value);break;default:}}}else if(e.name==="subjectKeyIdentifier"){var t=k.fromDer(e.value);e.subjectKeyIdentifier=xt.util.bytesToHex(t.value)}}return e};$e.certificationRequestFromAsn1=function(r,e){var t={},n=[];if(!k.validate(r,tQ,t,n)){var s=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw s.errors=n,s}var i=k.derToOid(t.publicKeyOid);if(i!==$e.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var a=$e.createCertificationRequest();if(a.version=t.csrVersion?t.csrVersion.charCodeAt(0):0,a.signatureOid=xt.asn1.derToOid(t.csrSignatureOid),a.signatureParameters=Dw(a.signatureOid,t.csrSignatureParams,!0),a.siginfo.algorithmOid=xt.asn1.derToOid(t.csrSignatureOid),a.siginfo.parameters=Dw(a.siginfo.algorithmOid,t.csrSignatureParams,!1),a.signature=t.csrSignature,a.certificationRequestInfo=t.certificationRequestInfo,e){a.md=Rw({signatureOid:a.signatureOid,type:"certification request"});var u=k.toDer(a.certificationRequestInfo);a.md.update(u.getBytes())}var c=xt.md.sha1.create();return a.subject.getField=function(f){return Vu(a.subject,f)},a.subject.addField=function(f){Ci([f]),a.subject.attributes.push(f)},a.subject.attributes=$e.RDNAttributesAsArray(t.certificationRequestInfoSubject,c),a.subject.hash=c.digest().toHex(),a.publicKey=$e.publicKeyFromAsn1(t.subjectPublicKeyInfo),a.getAttribute=function(f){return Vu(a,f)},a.addAttribute=function(f){Ci([f]),a.attributes.push(f)},a.attributes=$e.CRIAttributesAsArray(t.certificationRequestInfoAttributes||[]),a};$e.createCertificationRequest=function(){var r={};return r.version=0,r.signatureOid=null,r.signature=null,r.siginfo={},r.siginfo.algorithmOid=null,r.subject={},r.subject.getField=function(e){return Vu(r.subject,e)},r.subject.addField=function(e){Ci([e]),r.subject.attributes.push(e)},r.subject.attributes=[],r.subject.hash=null,r.publicKey=null,r.attributes=[],r.getAttribute=function(e){return Vu(r,e)},r.addAttribute=function(e){Ci([e]),r.attributes.push(e)},r.md=null,r.setSubject=function(e){Ci(e),r.subject.attributes=e,r.subject.hash=null},r.setAttributes=function(e){Ci(e),r.attributes=e},r.sign=function(e,t){r.md=t||xt.md.sha1.create();var n=or[r.md.algorithm+"WithRSAEncryption"];if(!n){var s=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw s.algorithm=r.md.algorithm,s}r.signatureOid=r.siginfo.algorithmOid=n,r.certificationRequestInfo=$e.getCertificationRequestInfo(r);var i=k.toDer(r.certificationRequestInfo);r.md.update(i.getBytes()),r.signature=e.sign(r.md)},r.verify=function(){var e=!1,t=r.md;if(t===null){t=Rw({signatureOid:r.signatureOid,type:"certification request"});var n=r.certificationRequestInfo||$e.getCertificationRequestInfo(r),s=k.toDer(n);t.update(s.getBytes())}return t!==null&&(e=ek({certificate:r,md:t,signature:r.signature})),e},r};function pp(r){for(var e=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]),t,n,s=r.attributes,i=0;i<s.length;++i){t=s[i];var a=t.value,u=k.Type.PRINTABLESTRING;"valueTagClass"in t&&(u=t.valueTagClass,u===k.Type.UTF8&&(a=xt.util.encodeUtf8(a))),n=k.create(k.Class.UNIVERSAL,k.Type.SET,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(t.type).getBytes()),k.create(k.Class.UNIVERSAL,u,!1,a)])]),e.value.push(n)}return e}o(pp,"_dnToAsn1");function Ci(r){for(var e,t=0;t<r.length;++t){if(e=r[t],typeof e.name>"u"&&(e.type&&e.type in $e.oids?e.name=$e.oids[e.type]:e.shortName&&e.shortName in Qr&&(e.name=$e.oids[Qr[e.shortName]])),typeof e.type>"u")if(e.name&&e.name in $e.oids)e.type=$e.oids[e.name];else{var n=new Error("Attribute type not specified.");throw n.attribute=e,n}if(typeof e.shortName>"u"&&e.name&&e.name in Qr&&(e.shortName=Qr[e.name]),e.type===or.extensionRequest&&(e.valueConstructed=!0,e.valueTagClass=k.Type.SEQUENCE,!e.value&&e.extensions)){e.value=[];for(var s=0;s<e.extensions.length;++s)e.value.push($e.certificateExtensionToAsn1(tk(e.extensions[s])))}if(typeof e.value>"u"){var n=new Error("Attribute value not specified.");throw n.attribute=e,n}}}o(Ci,"_fillMissingFields");function tk(r,e){if(e=e||{},typeof r.name>"u"&&r.id&&r.id in $e.oids&&(r.name=$e.oids[r.id]),typeof r.id>"u")if(r.name&&r.name in $e.oids)r.id=$e.oids[r.name];else{var t=new Error("Extension ID not specified.");throw t.extension=r,t}if(typeof r.value<"u")return r;if(r.name==="keyUsage"){var n=0,s=0,i=0;r.digitalSignature&&(s|=128,n=7),r.nonRepudiation&&(s|=64,n=6),r.keyEncipherment&&(s|=32,n=5),r.dataEncipherment&&(s|=16,n=4),r.keyAgreement&&(s|=8,n=3),r.keyCertSign&&(s|=4,n=2),r.cRLSign&&(s|=2,n=1),r.encipherOnly&&(s|=1,n=0),r.decipherOnly&&(i|=128,n=7);var a=String.fromCharCode(n);i!==0?a+=String.fromCharCode(s)+String.fromCharCode(i):s!==0&&(a+=String.fromCharCode(s)),r.value=k.create(k.Class.UNIVERSAL,k.Type.BITSTRING,!1,a)}else if(r.name==="basicConstraints")r.value=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]),r.cA&&r.value.value.push(k.create(k.Class.UNIVERSAL,k.Type.BOOLEAN,!1,"\xFF")),"pathLenConstraint"in r&&r.value.value.push(k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(r.pathLenConstraint).getBytes()));else if(r.name==="extKeyUsage"){r.value=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);var u=r.value.value;for(var c in r)r[c]===!0&&(c in or?u.push(k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(or[c]).getBytes())):c.indexOf(".")!==-1&&u.push(k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(c).getBytes())))}else if(r.name==="nsCertType"){var n=0,s=0;r.client&&(s|=128,n=7),r.server&&(s|=64,n=6),r.email&&(s|=32,n=5),r.objsign&&(s|=16,n=4),r.reserved&&(s|=8,n=3),r.sslCA&&(s|=4,n=2),r.emailCA&&(s|=2,n=1),r.objCA&&(s|=1,n=0);var a=String.fromCharCode(n);s!==0&&(a+=String.fromCharCode(s)),r.value=k.create(k.Class.UNIVERSAL,k.Type.BITSTRING,!1,a)}else if(r.name==="subjectAltName"||r.name==="issuerAltName"){r.value=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);for(var f,h=0;h<r.altNames.length;++h){f=r.altNames[h];var a=f.value;if(f.type===7&&f.ip){if(a=xt.util.bytesFromIP(f.ip),a===null){var t=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw t.extension=r,t}}else f.type===8&&(f.oid?a=k.oidToDer(k.oidToDer(f.oid)):a=k.oidToDer(a));r.value.value.push(k.create(k.Class.CONTEXT_SPECIFIC,f.type,!1,a))}}else if(r.name==="nsComment"&&e.cert){if(!/^[\x00-\x7F]*$/.test(r.comment)||r.comment.length<1||r.comment.length>128)throw new Error('Invalid "nsComment" content.');r.value=k.create(k.Class.UNIVERSAL,k.Type.IA5STRING,!1,r.comment)}else if(r.name==="subjectKeyIdentifier"&&e.cert){var m=e.cert.generateSubjectKeyIdentifier();r.subjectKeyIdentifier=m.toHex(),r.value=k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,m.getBytes())}else if(r.name==="authorityKeyIdentifier"&&e.cert){r.value=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);var u=r.value.value;if(r.keyIdentifier){var g=r.keyIdentifier===!0?e.cert.generateSubjectKeyIdentifier().getBytes():r.keyIdentifier;u.push(k.create(k.Class.CONTEXT_SPECIFIC,0,!1,g))}if(r.authorityCertIssuer){var x=[k.create(k.Class.CONTEXT_SPECIFIC,4,!0,[pp(r.authorityCertIssuer===!0?e.cert.issuer:r.authorityCertIssuer)])];u.push(k.create(k.Class.CONTEXT_SPECIFIC,1,!0,x))}if(r.serialNumber){var v=xt.util.hexToBytes(r.serialNumber===!0?e.cert.serialNumber:r.serialNumber);u.push(k.create(k.Class.CONTEXT_SPECIFIC,2,!1,v))}}else if(r.name==="cRLDistributionPoints"){r.value=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);for(var u=r.value.value,w=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]),S=k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[]),f,h=0;h<r.altNames.length;++h){f=r.altNames[h];var a=f.value;if(f.type===7&&f.ip){if(a=xt.util.bytesFromIP(f.ip),a===null){var t=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw t.extension=r,t}}else f.type===8&&(f.oid?a=k.oidToDer(k.oidToDer(f.oid)):a=k.oidToDer(a));S.value.push(k.create(k.Class.CONTEXT_SPECIFIC,f.type,!1,a))}w.value.push(k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[S])),u.push(w)}if(typeof r.value>"u"){var t=new Error("Extension value not specified.");throw t.extension=r,t}return r}o(tk,"_fillMissingExtensionFields");function pN(r,e){switch(r){case or["RSASSA-PSS"]:var t=[];return e.hash.algorithmOid!==void 0&&t.push(k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(e.hash.algorithmOid).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")])])),e.mgf.algorithmOid!==void 0&&t.push(k.create(k.Class.CONTEXT_SPECIFIC,1,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(e.mgf.algorithmOid).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(e.mgf.hash.algorithmOid).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")])])])),e.saltLength!==void 0&&t.push(k.create(k.Class.CONTEXT_SPECIFIC,2,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(e.saltLength).getBytes())])),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,t);default:return k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")}}o(pN,"_signatureParametersToAsn1");function rQ(r){var e=k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[]);if(r.attributes.length===0)return e;for(var t=r.attributes,n=0;n<t.length;++n){var s=t[n],i=s.value,a=k.Type.UTF8;"valueTagClass"in s&&(a=s.valueTagClass),a===k.Type.UTF8&&(i=xt.util.encodeUtf8(i));var u=!1;"valueConstructed"in s&&(u=s.valueConstructed);var c=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(s.type).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SET,!0,[k.create(k.Class.UNIVERSAL,a,u,i)])]);e.value.push(c)}return e}o(rQ,"_CRIAttributesToAsn1");var nQ=new Date("1950-01-01T00:00:00Z"),sQ=new Date("2050-01-01T00:00:00Z");function Q3(r){return r>=nQ&&r<sQ?k.create(k.Class.UNIVERSAL,k.Type.UTCTIME,!1,k.dateToUtcTime(r)):k.create(k.Class.UNIVERSAL,k.Type.GENERALIZEDTIME,!1,k.dateToGeneralizedTime(r))}o(Q3,"_dateToAsn1");$e.getTBSCertificate=function(r){var e=Q3(r.validity.notBefore),t=Q3(r.validity.notAfter),n=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(r.version).getBytes())]),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,xt.util.hexToBytes(r.serialNumber)),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(r.siginfo.algorithmOid).getBytes()),pN(r.siginfo.algorithmOid,r.siginfo.parameters)]),pp(r.issuer),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[e,t]),pp(r.subject),$e.publicKeyToAsn1(r.publicKey)]);return r.issuer.uniqueId&&n.value.push(k.create(k.Class.CONTEXT_SPECIFIC,1,!0,[k.create(k.Class.UNIVERSAL,k.Type.BITSTRING,!1,"\0"+r.issuer.uniqueId)])),r.subject.uniqueId&&n.value.push(k.create(k.Class.CONTEXT_SPECIFIC,2,!0,[k.create(k.Class.UNIVERSAL,k.Type.BITSTRING,!1,"\0"+r.subject.uniqueId)])),r.extensions.length>0&&n.value.push($e.certificateExtensionsToAsn1(r.extensions)),n};$e.getCertificationRequestInfo=function(r){var e=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(r.version).getBytes()),pp(r.subject),$e.publicKeyToAsn1(r.publicKey),rQ(r)]);return e};$e.distinguishedNameToAsn1=function(r){return pp(r)};$e.certificateToAsn1=function(r){var e=r.tbsCertificate||$e.getTBSCertificate(r);return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[e,k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(r.signatureOid).getBytes()),pN(r.signatureOid,r.signatureParameters)]),k.create(k.Class.UNIVERSAL,k.Type.BITSTRING,!1,"\0"+r.signature)])};$e.certificateExtensionsToAsn1=function(r){var e=k.create(k.Class.CONTEXT_SPECIFIC,3,!0,[]),t=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);e.value.push(t);for(var n=0;n<r.length;++n)t.value.push($e.certificateExtensionToAsn1(r[n]));return e};$e.certificateExtensionToAsn1=function(r){var e=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);e.value.push(k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(r.id).getBytes())),r.critical&&e.value.push(k.create(k.Class.UNIVERSAL,k.Type.BOOLEAN,!1,"\xFF"));var t=r.value;return typeof r.value!="string"&&(t=k.toDer(t).getBytes()),e.value.push(k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,t)),e};$e.certificationRequestToAsn1=function(r){var e=r.certificationRequestInfo||$e.getCertificationRequestInfo(r);return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[e,k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(r.signatureOid).getBytes()),pN(r.signatureOid,r.signatureParameters)]),k.create(k.Class.UNIVERSAL,k.Type.BITSTRING,!1,"\0"+r.signature)])};$e.createCaStore=function(r){var e={certs:{}};e.getIssuer=function(a){var u=t(a.issuer);return u},e.addCertificate=function(a){if(typeof a=="string"&&(a=xt.pki.certificateFromPem(a)),n(a.subject),!e.hasCertificate(a))if(a.subject.hash in e.certs){var u=e.certs[a.subject.hash];xt.util.isArray(u)||(u=[u]),u.push(a),e.certs[a.subject.hash]=u}else e.certs[a.subject.hash]=a},e.hasCertificate=function(a){typeof a=="string"&&(a=xt.pki.certificateFromPem(a));var u=t(a.subject);if(!u)return!1;xt.util.isArray(u)||(u=[u]);for(var c=k.toDer($e.certificateToAsn1(a)).getBytes(),f=0;f<u.length;++f){var h=k.toDer($e.certificateToAsn1(u[f])).getBytes();if(c===h)return!0}return!1},e.listAllCertificates=function(){var a=[];for(var u in e.certs)if(e.certs.hasOwnProperty(u)){var c=e.certs[u];if(!xt.util.isArray(c))a.push(c);else for(var f=0;f<c.length;++f)a.push(c[f])}return a},e.removeCertificate=function(a){var u;if(typeof a=="string"&&(a=xt.pki.certificateFromPem(a)),n(a.subject),!e.hasCertificate(a))return null;var c=t(a.subject);if(!xt.util.isArray(c))return u=e.certs[a.subject.hash],delete e.certs[a.subject.hash],u;for(var f=k.toDer($e.certificateToAsn1(a)).getBytes(),h=0;h<c.length;++h){var m=k.toDer($e.certificateToAsn1(c[h])).getBytes();f===m&&(u=c[h],c.splice(h,1))}return c.length===0&&delete e.certs[a.subject.hash],u};function t(a){return n(a),e.certs[a.hash]||null}o(t,"getBySubject");function n(a){if(!a.hash){var u=xt.md.sha1.create();a.attributes=$e.RDNAttributesAsArray(pp(a),u),a.hash=u.digest().toHex()}}if(o(n,"ensureSubjectHasHash"),r)for(var s=0;s<r.length;++s){var i=r[s];e.addCertificate(i)}return e};$e.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"};$e.verifyCertificateChain=function(r,e,t){typeof t=="function"&&(t={verify:t}),t=t||{},e=e.slice(0);var n=e.slice(0),s=t.validityCheckDate;typeof s>"u"&&(s=new Date);var i=!0,a=null,u=0;do{var c=e.shift(),f=null,h=!1;if(s&&(s<c.validity.notBefore||s>c.validity.notAfter)&&(a={message:"Certificate is not valid yet or has expired.",error:$e.certificateError.certificate_expired,notBefore:c.validity.notBefore,notAfter:c.validity.notAfter,now:s}),a===null){if(f=e[0]||r.getIssuer(c),f===null&&c.isIssuer(c)&&(h=!0,f=c),f){var m=f;xt.util.isArray(m)||(m=[m]);for(var g=!1;!g&&m.length>0;){f=m.shift();try{g=f.verify(c)}catch{}}g||(a={message:"Certificate signature is invalid.",error:$e.certificateError.bad_certificate})}a===null&&(!f||h)&&!r.hasCertificate(c)&&(a={message:"Certificate is not trusted.",error:$e.certificateError.unknown_ca})}if(a===null&&f&&!c.isIssuer(f)&&(a={message:"Certificate issuer is invalid.",error:$e.certificateError.bad_certificate}),a===null)for(var x={keyUsage:!0,basicConstraints:!0},v=0;a===null&&v<c.extensions.length;++v){var w=c.extensions[v];w.critical&&!(w.name in x)&&(a={message:"Certificate has an unsupported critical extension.",error:$e.certificateError.unsupported_certificate})}if(a===null&&(!i||e.length===0&&(!f||h))){var S=c.getExtension("basicConstraints"),A=c.getExtension("keyUsage");if(A!==null&&(!A.keyCertSign||S===null)&&(a={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:$e.certificateError.bad_certificate}),a===null&&S!==null&&!S.cA&&(a={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:$e.certificateError.bad_certificate}),a===null&&A!==null&&"pathLenConstraint"in S){var T=u-1;T>S.pathLenConstraint&&(a={message:"Certificate basicConstraints pathLenConstraint violated.",error:$e.certificateError.bad_certificate})}}var b=a===null?!0:a.error,E=t.verify?t.verify(b,u,n):b;if(E===!0)a=null;else throw b===!0&&(a={message:"The application rejected the certificate.",error:$e.certificateError.bad_certificate}),(E||E===0)&&(typeof E=="object"&&!xt.util.isArray(E)?(E.message&&(a.message=E.message),E.error&&(a.error=E.error)):typeof E=="string"&&(a.error=E)),a;i=!1,++u}while(e.length>0);return!0}});var mN=Z((Bde,sk)=>{"use strict";var Rr=$t();ea();ap();Ou();fN();lN();bi();eg();lp();lr();Pw();var Y=Rr.asn1,Yt=Rr.pki,rg=sk.exports=Rr.pkcs12=Rr.pkcs12||{},nk={name:"ContentInfo",tagClass:Y.Class.UNIVERSAL,type:Y.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:Y.Class.UNIVERSAL,type:Y.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:Y.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},iQ={name:"PFX",tagClass:Y.Class.UNIVERSAL,type:Y.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:Y.Class.UNIVERSAL,type:Y.Type.INTEGER,constructed:!1,capture:"version"},nk,{name:"PFX.macData",tagClass:Y.Class.UNIVERSAL,type:Y.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:Y.Class.UNIVERSAL,type:Y.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:Y.Class.UNIVERSAL,type:Y.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:Y.Class.UNIVERSAL,type:Y.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:Y.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:Y.Class.UNIVERSAL,type:Y.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:Y.Class.UNIVERSAL,type:Y.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:Y.Class.UNIVERSAL,type:Y.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},aQ={name:"SafeBag",tagClass:Y.Class.UNIVERSAL,type:Y.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:Y.Class.UNIVERSAL,type:Y.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:Y.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:Y.Class.UNIVERSAL,type:Y.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},oQ={name:"Attribute",tagClass:Y.Class.UNIVERSAL,type:Y.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:Y.Class.UNIVERSAL,type:Y.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:Y.Class.UNIVERSAL,type:Y.Type.SET,constructed:!0,capture:"values"}]},uQ={name:"CertBag",tagClass:Y.Class.UNIVERSAL,type:Y.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:Y.Class.UNIVERSAL,type:Y.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:Y.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:Y.Class.UNIVERSAL,type:Y.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function tg(r,e,t,n){for(var s=[],i=0;i<r.length;i++)for(var a=0;a<r[i].safeBags.length;a++){var u=r[i].safeBags[a];if(!(n!==void 0&&u.type!==n)){if(e===null){s.push(u);continue}u.attributes[e]!==void 0&&u.attributes[e].indexOf(t)>=0&&s.push(u)}}return s}o(tg,"_getBagsByAttribute");rg.pkcs12FromAsn1=function(r,e,t){typeof e=="string"?(t=e,e=!0):e===void 0&&(e=!0);var n={},s=[];if(!Y.validate(r,iQ,n,s)){var i=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw i.errors=i,i}var a={version:n.version.charCodeAt(0),safeContents:[],getBags:o(function(S){var A={},T;return"localKeyId"in S?T=S.localKeyId:"localKeyIdHex"in S&&(T=Rr.util.hexToBytes(S.localKeyIdHex)),T===void 0&&!("friendlyName"in S)&&"bagType"in S&&(A[S.bagType]=tg(a.safeContents,null,null,S.bagType)),T!==void 0&&(A.localKeyId=tg(a.safeContents,"localKeyId",T,S.bagType)),"friendlyName"in S&&(A.friendlyName=tg(a.safeContents,"friendlyName",S.friendlyName,S.bagType)),A},"getBags"),getBagsByFriendlyName:o(function(S,A){return tg(a.safeContents,"friendlyName",S,A)},"getBagsByFriendlyName"),getBagsByLocalKeyId:o(function(S,A){return tg(a.safeContents,"localKeyId",S,A)},"getBagsByLocalKeyId")};if(n.version.charCodeAt(0)!==3){var i=new Error("PKCS#12 PFX of version other than 3 not supported.");throw i.version=n.version.charCodeAt(0),i}if(Y.derToOid(n.contentType)!==Yt.oids.data){var i=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw i.oid=Y.derToOid(n.contentType),i}var u=n.content.value[0];if(u.tagClass!==Y.Class.UNIVERSAL||u.type!==Y.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(u=dN(u),n.mac){var c=null,f=0,h=Y.derToOid(n.macAlgorithm);switch(h){case Yt.oids.sha1:c=Rr.md.sha1.create(),f=20;break;case Yt.oids.sha256:c=Rr.md.sha256.create(),f=32;break;case Yt.oids.sha384:c=Rr.md.sha384.create(),f=48;break;case Yt.oids.sha512:c=Rr.md.sha512.create(),f=64;break;case Yt.oids.md5:c=Rr.md.md5.create(),f=16;break}if(c===null)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+h);var m=new Rr.util.ByteBuffer(n.macSalt),g="macIterations"in n?parseInt(Rr.util.bytesToHex(n.macIterations),16):1,x=rg.generateKey(t,m,3,g,f,c),v=Rr.hmac.create();v.start(c,x),v.update(u.value);var w=v.getMac();if(w.getBytes()!==n.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}return cQ(a,u.value,e,t),a};function dN(r){if(r.composed||r.constructed){for(var e=Rr.util.createBuffer(),t=0;t<r.value.length;++t)e.putBytes(r.value[t].value);r.composed=r.constructed=!1,r.value=e.getBytes()}return r}o(dN,"_decodePkcs7Data");function cQ(r,e,t,n){if(e=Y.fromDer(e,t),e.tagClass!==Y.Class.UNIVERSAL||e.type!==Y.Type.SEQUENCE||e.constructed!==!0)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var s=0;s<e.value.length;s++){var i=e.value[s],a={},u=[];if(!Y.validate(i,nk,a,u)){var c=new Error("Cannot read ContentInfo.");throw c.errors=u,c}var f={encrypted:!1},h=null,m=a.content.value[0];switch(Y.derToOid(a.contentType)){case Yt.oids.data:if(m.tagClass!==Y.Class.UNIVERSAL||m.type!==Y.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");h=dN(m).value;break;case Yt.oids.encryptedData:h=lQ(m,n),f.encrypted=!0;break;default:var c=new Error("Unsupported PKCS#12 contentType.");throw c.contentType=Y.derToOid(a.contentType),c}f.safeBags=fQ(h,t,n),r.safeContents.push(f)}}o(cQ,"_decodeAuthenticatedSafe");function lQ(r,e){var t={},n=[];if(!Y.validate(r,Rr.pkcs7.asn1.encryptedDataValidator,t,n)){var s=new Error("Cannot read EncryptedContentInfo.");throw s.errors=n,s}var i=Y.derToOid(t.contentType);if(i!==Yt.oids.data){var s=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw s.oid=i,s}i=Y.derToOid(t.encAlgorithm);var a=Yt.pbe.getCipher(i,t.encParameter,e),u=dN(t.encryptedContentAsn1),c=Rr.util.createBuffer(u.value);if(a.update(c),!a.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return a.output.getBytes()}o(lQ,"_decryptSafeContents");function fQ(r,e,t){if(!e&&r.length===0)return[];if(r=Y.fromDer(r,e),r.tagClass!==Y.Class.UNIVERSAL||r.type!==Y.Type.SEQUENCE||r.constructed!==!0)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var n=[],s=0;s<r.value.length;s++){var i=r.value[s],a={},u=[];if(!Y.validate(i,aQ,a,u)){var c=new Error("Cannot read SafeBag.");throw c.errors=u,c}var f={type:Y.derToOid(a.bagId),attributes:hQ(a.bagAttributes)};n.push(f);var h,m,g=a.bagValue.value[0];switch(f.type){case Yt.oids.pkcs8ShroudedKeyBag:if(g=Yt.decryptPrivateKeyInfo(g,t),g===null)throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case Yt.oids.keyBag:try{f.key=Yt.privateKeyFromAsn1(g)}catch{f.key=null,f.asn1=g}continue;case Yt.oids.certBag:h=uQ,m=o(function(){if(Y.derToOid(a.certId)!==Yt.oids.x509Certificate){var v=new Error("Unsupported certificate type, only X.509 supported.");throw v.oid=Y.derToOid(a.certId),v}var w=Y.fromDer(a.cert,e);try{f.cert=Yt.certificateFromAsn1(w,!0)}catch{f.cert=null,f.asn1=w}},"decoder");break;default:var c=new Error("Unsupported PKCS#12 SafeBag type.");throw c.oid=f.type,c}if(h!==void 0&&!Y.validate(g,h,a,u)){var c=new Error("Cannot read PKCS#12 "+h.name);throw c.errors=u,c}m()}return n}o(fQ,"_decodeSafeContents");function hQ(r){var e={};if(r!==void 0)for(var t=0;t<r.length;++t){var n={},s=[];if(!Y.validate(r[t],oQ,n,s)){var i=new Error("Cannot read PKCS#12 BagAttribute.");throw i.errors=s,i}var a=Y.derToOid(n.oid);if(Yt.oids[a]!==void 0){e[Yt.oids[a]]=[];for(var u=0;u<n.values.length;++u)e[Yt.oids[a]].push(n.values[u].value)}}return e}o(hQ,"_decodeBagAttributes");rg.toPkcs12Asn1=function(r,e,t,n){n=n||{},n.saltSize=n.saltSize||8,n.count=n.count||2048,n.algorithm=n.algorithm||n.encAlgorithm||"aes128","useMac"in n||(n.useMac=!0),"localKeyId"in n||(n.localKeyId=null),"generateLocalKeyId"in n||(n.generateLocalKeyId=!0);var s=n.localKeyId,i;if(s!==null)s=Rr.util.hexToBytes(s);else if(n.generateLocalKeyId)if(e){var a=Rr.util.isArray(e)?e[0]:e;typeof a=="string"&&(a=Yt.certificateFromPem(a));var u=Rr.md.sha1.create();u.update(Y.toDer(Yt.certificateToAsn1(a)).getBytes()),s=u.digest().getBytes()}else s=Rr.random.getBytes(20);var c=[];s!==null&&c.push(Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OID,!1,Y.oidToDer(Yt.oids.localKeyId).getBytes()),Y.create(Y.Class.UNIVERSAL,Y.Type.SET,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OCTETSTRING,!1,s)])])),"friendlyName"in n&&c.push(Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OID,!1,Y.oidToDer(Yt.oids.friendlyName).getBytes()),Y.create(Y.Class.UNIVERSAL,Y.Type.SET,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.BMPSTRING,!1,n.friendlyName)])])),c.length>0&&(i=Y.create(Y.Class.UNIVERSAL,Y.Type.SET,!0,c));var f=[],h=[];e!==null&&(Rr.util.isArray(e)?h=e:h=[e]);for(var m=[],g=0;g<h.length;++g){e=h[g],typeof e=="string"&&(e=Yt.certificateFromPem(e));var x=g===0?i:void 0,v=Yt.certificateToAsn1(e),w=Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OID,!1,Y.oidToDer(Yt.oids.certBag).getBytes()),Y.create(Y.Class.CONTEXT_SPECIFIC,0,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OID,!1,Y.oidToDer(Yt.oids.x509Certificate).getBytes()),Y.create(Y.Class.CONTEXT_SPECIFIC,0,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OCTETSTRING,!1,Y.toDer(v).getBytes())])])]),x]);m.push(w)}if(m.length>0){var S=Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,m),A=Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OID,!1,Y.oidToDer(Yt.oids.data).getBytes()),Y.create(Y.Class.CONTEXT_SPECIFIC,0,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OCTETSTRING,!1,Y.toDer(S).getBytes())])]);f.push(A)}var T=null;if(r!==null){var b=Yt.wrapRsaPrivateKey(Yt.privateKeyToAsn1(r));t===null?T=Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OID,!1,Y.oidToDer(Yt.oids.keyBag).getBytes()),Y.create(Y.Class.CONTEXT_SPECIFIC,0,!0,[b]),i]):T=Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OID,!1,Y.oidToDer(Yt.oids.pkcs8ShroudedKeyBag).getBytes()),Y.create(Y.Class.CONTEXT_SPECIFIC,0,!0,[Yt.encryptPrivateKeyInfo(b,t,n)]),i]);var E=Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[T]),C=Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OID,!1,Y.oidToDer(Yt.oids.data).getBytes()),Y.create(Y.Class.CONTEXT_SPECIFIC,0,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OCTETSTRING,!1,Y.toDer(E).getBytes())])]);f.push(C)}var _=Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,f),F;if(n.useMac){var u=Rr.md.sha1.create(),R=new Rr.util.ByteBuffer(Rr.random.getBytes(n.saltSize)),q=n.count,r=rg.generateKey(t,R,3,q,20),H=Rr.hmac.create();H.start(u,r),H.update(Y.toDer(_).getBytes());var K=H.getMac();F=Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OID,!1,Y.oidToDer(Yt.oids.sha1).getBytes()),Y.create(Y.Class.UNIVERSAL,Y.Type.NULL,!1,"")]),Y.create(Y.Class.UNIVERSAL,Y.Type.OCTETSTRING,!1,K.getBytes())]),Y.create(Y.Class.UNIVERSAL,Y.Type.OCTETSTRING,!1,R.getBytes()),Y.create(Y.Class.UNIVERSAL,Y.Type.INTEGER,!1,Y.integerToDer(q).getBytes())])}return Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.INTEGER,!1,Y.integerToDer(3).getBytes()),Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OID,!1,Y.oidToDer(Yt.oids.data).getBytes()),Y.create(Y.Class.CONTEXT_SPECIFIC,0,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OCTETSTRING,!1,Y.toDer(_).getBytes())])]),F])};rg.generateKey=Rr.pbe.generatePkcs12Key});var vN=Z((Rde,ik)=>{"use strict";var Uu=$t();ea();Ou();lN();_l();Ew();mN();Bw();eg();lr();Pw();var gN=Uu.asn1,dp=ik.exports=Uu.pki=Uu.pki||{};dp.pemToDer=function(r){var e=Uu.pem.decode(r)[0];if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert PEM to DER; PEM is encrypted.");return Uu.util.createBuffer(e.body)};dp.privateKeyFromPem=function(r){var e=Uu.pem.decode(r)[0];if(e.type!=="PRIVATE KEY"&&e.type!=="RSA PRIVATE KEY"){var t=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw t.headerType=e.type,t}if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert private key from PEM; PEM is encrypted.");var n=gN.fromDer(e.body);return dp.privateKeyFromAsn1(n)};dp.privateKeyToPem=function(r,e){var t={type:"RSA PRIVATE KEY",body:gN.toDer(dp.privateKeyToAsn1(r)).getBytes()};return Uu.pem.encode(t,{maxline:e})};dp.privateKeyInfoToPem=function(r,e){var t={type:"PRIVATE KEY",body:gN.toDer(r).getBytes()};return Uu.pem.encode(t,{maxline:e})}});var EN=Z((Pde,pk)=>{"use strict";var ke=$t();ea();ap();xw();_l();vN();bi();lp();lr();var Vw=o(function(r,e,t,n){var s=ke.util.createBuffer(),i=r.length>>1,a=i+(r.length&1),u=r.substr(0,a),c=r.substr(i,a),f=ke.util.createBuffer(),h=ke.hmac.create();t=e+t;var m=Math.ceil(n/16),g=Math.ceil(n/20);h.start("MD5",u);var x=ke.util.createBuffer();f.putBytes(t);for(var v=0;v<m;++v)h.start(null,null),h.update(f.getBytes()),f.putBuffer(h.digest()),h.start(null,null),h.update(f.bytes()+t),x.putBuffer(h.digest());h.start("SHA1",c);var w=ke.util.createBuffer();f.clear(),f.putBytes(t);for(var v=0;v<g;++v)h.start(null,null),h.update(f.getBytes()),f.putBuffer(h.digest()),h.start(null,null),h.update(f.bytes()+t),w.putBuffer(h.digest());return s.putBytes(ke.util.xorBytes(x.getBytes(),w.getBytes(),n)),s},"prf_TLS1"),pQ=o(function(r,e,t){var n=ke.hmac.create();n.start("SHA1",r);var s=ke.util.createBuffer();return s.putInt32(e[0]),s.putInt32(e[1]),s.putByte(t.type),s.putByte(t.version.major),s.putByte(t.version.minor),s.putInt16(t.length),s.putBytes(t.fragment.bytes()),n.update(s.getBytes()),n.digest().getBytes()},"hmac_sha1"),dQ=o(function(r,e,t){var n=!1;try{var s=r.deflate(e.fragment.getBytes());e.fragment=ke.util.createBuffer(s),e.length=s.length,n=!0}catch{}return n},"deflate"),mQ=o(function(r,e,t){var n=!1;try{var s=r.inflate(e.fragment.getBytes());e.fragment=ke.util.createBuffer(s),e.length=s.length,n=!0}catch{}return n},"inflate"),ni=o(function(r,e){var t=0;switch(e){case 1:t=r.getByte();break;case 2:t=r.getInt16();break;case 3:t=r.getInt24();break;case 4:t=r.getInt32();break}return ke.util.createBuffer(r.getBytes(t))},"readVector"),Ni=o(function(r,e,t){r.putInt(t.length(),e<<3),r.putBuffer(t)},"writeVector"),U={};U.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}};U.SupportedVersions=[U.Versions.TLS_1_1,U.Versions.TLS_1_0];U.Version=U.SupportedVersions[0];U.MaxFragment=15360;U.ConnectionEnd={server:0,client:1};U.PRFAlgorithm={tls_prf_sha256:0};U.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2};U.CipherType={stream:0,block:1,aead:2};U.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4};U.CompressionMethod={none:0,deflate:1};U.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24};U.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};U.Alert={};U.Alert.Level={warning:1,fatal:2};U.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};U.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2};U.CipherSuites={};U.getCipherSuite=function(r){var e=null;for(var t in U.CipherSuites){var n=U.CipherSuites[t];if(n.id[0]===r.charCodeAt(0)&&n.id[1]===r.charCodeAt(1)){e=n;break}}return e};U.handleUnexpected=function(r,e){var t=!r.open&&r.entity===U.ConnectionEnd.client;t||r.error(r,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.unexpected_message}})};U.handleHelloRequest=function(r,e,t){!r.handshaking&&r.handshakes>0&&(U.queue(r,U.createAlert(r,{level:U.Alert.Level.warning,description:U.Alert.Description.no_renegotiation})),U.flush(r)),r.process()};U.parseHelloMessage=function(r,e,t){var n=null,s=r.entity===U.ConnectionEnd.client;if(t<38)r.error(r,{message:s?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.illegal_parameter}});else{var i=e.fragment,a=i.length();if(n={version:{major:i.getByte(),minor:i.getByte()},random:ke.util.createBuffer(i.getBytes(32)),session_id:ni(i,1),extensions:[]},s?(n.cipher_suite=i.getBytes(2),n.compression_method=i.getByte()):(n.cipher_suites=ni(i,2),n.compression_methods=ni(i,1)),a=t-(a-i.length()),a>0){for(var u=ni(i,2);u.length()>0;)n.extensions.push({type:[u.getByte(),u.getByte()],data:ni(u,2)});if(!s)for(var c=0;c<n.extensions.length;++c){var f=n.extensions[c];if(f.type[0]===0&&f.type[1]===0)for(var h=ni(f.data,2);h.length()>0;){var m=h.getByte();if(m!==0)break;r.session.extensions.server_name.serverNameList.push(ni(h,2).getBytes())}}}if(r.session.version&&(n.version.major!==r.session.version.major||n.version.minor!==r.session.version.minor))return r.error(r,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.protocol_version}});if(s)r.session.cipherSuite=U.getCipherSuite(n.cipher_suite);else for(var g=ke.util.createBuffer(n.cipher_suites.bytes());g.length()>0&&(r.session.cipherSuite=U.getCipherSuite(g.getBytes(2)),r.session.cipherSuite===null););if(r.session.cipherSuite===null)return r.error(r,{message:"No cipher suites in common.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.handshake_failure},cipherSuite:ke.util.bytesToHex(n.cipher_suite)});s?r.session.compressionMethod=n.compression_method:r.session.compressionMethod=U.CompressionMethod.none}return n};U.createSecurityParameters=function(r,e){var t=r.entity===U.ConnectionEnd.client,n=e.random.bytes(),s=t?r.session.sp.client_random:n,i=t?n:U.createRandom().getBytes();r.session.sp={entity:r.entity,prf_algorithm:U.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:r.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:s,server_random:i}};U.handleServerHello=function(r,e,t){var n=U.parseHelloMessage(r,e,t);if(!r.fail){if(n.version.minor<=r.version.minor)r.version.minor=n.version.minor;else return r.error(r,{message:"Incompatible TLS version.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.protocol_version}});r.session.version=r.version;var s=n.session_id.bytes();s.length>0&&s===r.session.id?(r.expect=uk,r.session.resuming=!0,r.session.sp.server_random=n.random.bytes()):(r.expect=vQ,r.session.resuming=!1,U.createSecurityParameters(r,n)),r.session.id=s,r.process()}};U.handleClientHello=function(r,e,t){var n=U.parseHelloMessage(r,e,t);if(!r.fail){var s=n.session_id.bytes(),i=null;if(r.sessionCache&&(i=r.sessionCache.getSession(s),i===null?s="":(i.version.major!==n.version.major||i.version.minor>n.version.minor)&&(i=null,s="")),s.length===0&&(s=ke.random.getBytes(32)),r.session.id=s,r.session.clientHelloVersion=n.version,r.session.sp={},i)r.version=r.session.version=i.version,r.session.sp=i.sp;else{for(var a,u=1;u<U.SupportedVersions.length&&(a=U.SupportedVersions[u],!(a.minor<=n.version.minor));++u);r.version={major:a.major,minor:a.minor},r.session.version=r.version}i!==null?(r.expect=SN,r.session.resuming=!0,r.session.sp.client_random=n.random.bytes()):(r.expect=r.verifyClient!==!1?AQ:wN,r.session.resuming=!1,U.createSecurityParameters(r,n)),r.open=!0,U.queue(r,U.createRecord(r,{type:U.ContentType.handshake,data:U.createServerHello(r)})),r.session.resuming?(U.queue(r,U.createRecord(r,{type:U.ContentType.change_cipher_spec,data:U.createChangeCipherSpec()})),r.state.pending=U.createConnectionState(r),r.state.current.write=r.state.pending.write,U.queue(r,U.createRecord(r,{type:U.ContentType.handshake,data:U.createFinished(r)}))):(U.queue(r,U.createRecord(r,{type:U.ContentType.handshake,data:U.createCertificate(r)})),r.fail||(U.queue(r,U.createRecord(r,{type:U.ContentType.handshake,data:U.createServerKeyExchange(r)})),r.verifyClient!==!1&&U.queue(r,U.createRecord(r,{type:U.ContentType.handshake,data:U.createCertificateRequest(r)})),U.queue(r,U.createRecord(r,{type:U.ContentType.handshake,data:U.createServerHelloDone(r)})))),U.flush(r),r.process()}};U.handleCertificate=function(r,e,t){if(t<3)return r.error(r,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.illegal_parameter}});var n=e.fragment,s={certificate_list:ni(n,3)},i,a,u=[];try{for(;s.certificate_list.length()>0;)i=ni(s.certificate_list,3),a=ke.asn1.fromDer(i),i=ke.pki.certificateFromAsn1(a,!0),u.push(i)}catch(f){return r.error(r,{message:"Could not parse certificate list.",cause:f,send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.bad_certificate}})}var c=r.entity===U.ConnectionEnd.client;(c||r.verifyClient===!0)&&u.length===0?r.error(r,{message:c?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.illegal_parameter}}):u.length===0?r.expect=c?ak:wN:(c?r.session.serverCertificate=u[0]:r.session.clientCertificate=u[0],U.verifyCertificateChain(r,u)&&(r.expect=c?ak:wN)),r.process()};U.handleServerKeyExchange=function(r,e,t){if(t>0)return r.error(r,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.unsupported_certificate}});r.expect=yQ,r.process()};U.handleClientKeyExchange=function(r,e,t){if(t<48)return r.error(r,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.unsupported_certificate}});var n=e.fragment,s={enc_pre_master_secret:ni(n,2).getBytes()},i=null;if(r.getPrivateKey)try{i=r.getPrivateKey(r,r.session.serverCertificate),i=ke.pki.privateKeyFromPem(i)}catch(c){r.error(r,{message:"Could not get private key.",cause:c,send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.internal_error}})}if(i===null)return r.error(r,{message:"No private key set.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.internal_error}});try{var a=r.session.sp;a.pre_master_secret=i.decrypt(s.enc_pre_master_secret);var u=r.session.clientHelloVersion;if(u.major!==a.pre_master_secret.charCodeAt(0)||u.minor!==a.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch{a.pre_master_secret=ke.random.getBytes(48)}r.expect=SN,r.session.clientCertificate!==null&&(r.expect=CQ),r.process()};U.handleCertificateRequest=function(r,e,t){if(t<3)return r.error(r,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.illegal_parameter}});var n=e.fragment,s={certificate_types:ni(n,1),certificate_authorities:ni(n,2)};r.session.certificateRequest=s,r.expect=xQ,r.process()};U.handleCertificateVerify=function(r,e,t){if(t<2)return r.error(r,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.illegal_parameter}});var n=e.fragment;n.read-=4;var s=n.bytes();n.read+=4;var i={signature:ni(n,2).getBytes()},a=ke.util.createBuffer();a.putBuffer(r.session.md5.digest()),a.putBuffer(r.session.sha1.digest()),a=a.getBytes();try{var u=r.session.clientCertificate;if(!u.publicKey.verify(a,i.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");r.session.md5.update(s),r.session.sha1.update(s)}catch{return r.error(r,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.handshake_failure}})}r.expect=SN,r.process()};U.handleServerHelloDone=function(r,e,t){if(t>0)return r.error(r,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.record_overflow}});if(r.serverCertificate===null){var n={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.insufficient_security}},s=0,i=r.verify(r,n.alert.description,s,[]);if(i!==!0)return(i||i===0)&&(typeof i=="object"&&!ke.util.isArray(i)?(i.message&&(n.message=i.message),i.alert&&(n.alert.description=i.alert)):typeof i=="number"&&(n.alert.description=i)),r.error(r,n)}r.session.certificateRequest!==null&&(e=U.createRecord(r,{type:U.ContentType.handshake,data:U.createCertificate(r)}),U.queue(r,e)),e=U.createRecord(r,{type:U.ContentType.handshake,data:U.createClientKeyExchange(r)}),U.queue(r,e),r.expect=bQ;var a=o(function(u,c){u.session.certificateRequest!==null&&u.session.clientCertificate!==null&&U.queue(u,U.createRecord(u,{type:U.ContentType.handshake,data:U.createCertificateVerify(u,c)})),U.queue(u,U.createRecord(u,{type:U.ContentType.change_cipher_spec,data:U.createChangeCipherSpec()})),u.state.pending=U.createConnectionState(u),u.state.current.write=u.state.pending.write,U.queue(u,U.createRecord(u,{type:U.ContentType.handshake,data:U.createFinished(u)})),u.expect=uk,U.flush(u),u.process()},"callback");if(r.session.certificateRequest===null||r.session.clientCertificate===null)return a(r,null);U.getClientSignature(r,a)};U.handleChangeCipherSpec=function(r,e){if(e.fragment.getByte()!==1)return r.error(r,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.illegal_parameter}});var t=r.entity===U.ConnectionEnd.client;(r.session.resuming&&t||!r.session.resuming&&!t)&&(r.state.pending=U.createConnectionState(r)),r.state.current.read=r.state.pending.read,(!r.session.resuming&&t||r.session.resuming&&!t)&&(r.state.pending=null),r.expect=t?wQ:NQ,r.process()};U.handleFinished=function(r,e,t){var n=e.fragment;n.read-=4;var s=n.bytes();n.read+=4;var i=e.fragment.getBytes();n=ke.util.createBuffer(),n.putBuffer(r.session.md5.digest()),n.putBuffer(r.session.sha1.digest());var a=r.entity===U.ConnectionEnd.client,u=a?"server finished":"client finished",c=r.session.sp,f=12,h=Vw;if(n=h(c.master_secret,u,n.getBytes(),f),n.getBytes()!==i)return r.error(r,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.decrypt_error}});r.session.md5.update(s),r.session.sha1.update(s),(r.session.resuming&&a||!r.session.resuming&&!a)&&(U.queue(r,U.createRecord(r,{type:U.ContentType.change_cipher_spec,data:U.createChangeCipherSpec()})),r.state.current.write=r.state.pending.write,r.state.pending=null,U.queue(r,U.createRecord(r,{type:U.ContentType.handshake,data:U.createFinished(r)}))),r.expect=a?SQ:TQ,r.handshaking=!1,++r.handshakes,r.peerCertificate=a?r.session.serverCertificate:r.session.clientCertificate,U.flush(r),r.isConnected=!0,r.connected(r),r.process()};U.handleAlert=function(r,e){var t=e.fragment,n={level:t.getByte(),description:t.getByte()},s;switch(n.description){case U.Alert.Description.close_notify:s="Connection closed.";break;case U.Alert.Description.unexpected_message:s="Unexpected message.";break;case U.Alert.Description.bad_record_mac:s="Bad record MAC.";break;case U.Alert.Description.decryption_failed:s="Decryption failed.";break;case U.Alert.Description.record_overflow:s="Record overflow.";break;case U.Alert.Description.decompression_failure:s="Decompression failed.";break;case U.Alert.Description.handshake_failure:s="Handshake failure.";break;case U.Alert.Description.bad_certificate:s="Bad certificate.";break;case U.Alert.Description.unsupported_certificate:s="Unsupported certificate.";break;case U.Alert.Description.certificate_revoked:s="Certificate revoked.";break;case U.Alert.Description.certificate_expired:s="Certificate expired.";break;case U.Alert.Description.certificate_unknown:s="Certificate unknown.";break;case U.Alert.Description.illegal_parameter:s="Illegal parameter.";break;case U.Alert.Description.unknown_ca:s="Unknown certificate authority.";break;case U.Alert.Description.access_denied:s="Access denied.";break;case U.Alert.Description.decode_error:s="Decode error.";break;case U.Alert.Description.decrypt_error:s="Decrypt error.";break;case U.Alert.Description.export_restriction:s="Export restriction.";break;case U.Alert.Description.protocol_version:s="Unsupported protocol version.";break;case U.Alert.Description.insufficient_security:s="Insufficient security.";break;case U.Alert.Description.internal_error:s="Internal error.";break;case U.Alert.Description.user_canceled:s="User canceled.";break;case U.Alert.Description.no_renegotiation:s="Renegotiation not supported.";break;default:s="Unknown error.";break}if(n.description===U.Alert.Description.close_notify)return r.close();r.error(r,{message:s,send:!1,origin:r.entity===U.ConnectionEnd.client?"server":"client",alert:n}),r.process()};U.handleHandshake=function(r,e){var t=e.fragment,n=t.getByte(),s=t.getInt24();if(s>t.length())return r.fragmented=e,e.fragment=ke.util.createBuffer(),t.read-=4,r.process();r.fragmented=null,t.read-=4;var i=t.bytes(s+4);t.read+=4,n in Lw[r.entity][r.expect]?(r.entity===U.ConnectionEnd.server&&!r.open&&!r.fail&&(r.handshaking=!0,r.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:ke.md.md5.create(),sha1:ke.md.sha1.create()}),n!==U.HandshakeType.hello_request&&n!==U.HandshakeType.certificate_verify&&n!==U.HandshakeType.finished&&(r.session.md5.update(i),r.session.sha1.update(i)),Lw[r.entity][r.expect][n](r,e,s)):U.handleUnexpected(r,e)};U.handleApplicationData=function(r,e){r.data.putBuffer(e.fragment),r.dataReady(r),r.process()};U.handleHeartbeat=function(r,e){var t=e.fragment,n=t.getByte(),s=t.getInt16(),i=t.getBytes(s);if(n===U.HeartbeatMessageType.heartbeat_request){if(r.handshaking||s>i.length)return r.process();U.queue(r,U.createRecord(r,{type:U.ContentType.heartbeat,data:U.createHeartbeat(U.HeartbeatMessageType.heartbeat_response,i)})),U.flush(r)}else if(n===U.HeartbeatMessageType.heartbeat_response){if(i!==r.expectedHeartbeatPayload)return r.process();r.heartbeatReceived&&r.heartbeatReceived(r,ke.util.createBuffer(i))}r.process()};var gQ=0,vQ=1,ak=2,yQ=3,xQ=4,uk=5,wQ=6,SQ=7,bQ=8,EQ=0,AQ=1,wN=2,CQ=3,SN=4,NQ=5,TQ=6,V=U.handleUnexpected,ck=U.handleChangeCipherSpec,qn=U.handleAlert,ys=U.handleHandshake,lk=U.handleApplicationData,Hn=U.handleHeartbeat,bN=[];bN[U.ConnectionEnd.client]=[[V,qn,ys,V,Hn],[V,qn,ys,V,Hn],[V,qn,ys,V,Hn],[V,qn,ys,V,Hn],[V,qn,ys,V,Hn],[ck,qn,V,V,Hn],[V,qn,ys,V,Hn],[V,qn,ys,lk,Hn],[V,qn,ys,V,Hn]];bN[U.ConnectionEnd.server]=[[V,qn,ys,V,Hn],[V,qn,ys,V,Hn],[V,qn,ys,V,Hn],[V,qn,ys,V,Hn],[ck,qn,V,V,Hn],[V,qn,ys,V,Hn],[V,qn,ys,lk,Hn],[V,qn,ys,V,Hn]];var ju=U.handleHelloRequest,IQ=U.handleServerHello,fk=U.handleCertificate,ok=U.handleServerKeyExchange,yN=U.handleCertificateRequest,Ow=U.handleServerHelloDone,hk=U.handleFinished,Lw=[];Lw[U.ConnectionEnd.client]=[[V,V,IQ,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V],[ju,V,V,V,V,V,V,V,V,V,V,fk,ok,yN,Ow,V,V,V,V,V,V],[ju,V,V,V,V,V,V,V,V,V,V,V,ok,yN,Ow,V,V,V,V,V,V],[ju,V,V,V,V,V,V,V,V,V,V,V,V,yN,Ow,V,V,V,V,V,V],[ju,V,V,V,V,V,V,V,V,V,V,V,V,V,Ow,V,V,V,V,V,V],[ju,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V],[ju,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,hk],[ju,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V],[ju,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V]];var _Q=U.handleClientHello,BQ=U.handleClientKeyExchange,DQ=U.handleCertificateVerify;Lw[U.ConnectionEnd.server]=[[V,_Q,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V],[V,V,V,V,V,V,V,V,V,V,V,fk,V,V,V,V,V,V,V,V,V],[V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,BQ,V,V,V,V],[V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,DQ,V,V,V,V,V],[V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V],[V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,hk],[V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V],[V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V]];U.generateKeys=function(r,e){var t=Vw,n=e.client_random+e.server_random;r.session.resuming||(e.master_secret=t(e.pre_master_secret,"master secret",n,48).bytes(),e.pre_master_secret=null),n=e.server_random+e.client_random;var s=2*e.mac_key_length+2*e.enc_key_length,i=r.version.major===U.Versions.TLS_1_0.major&&r.version.minor===U.Versions.TLS_1_0.minor;i&&(s+=2*e.fixed_iv_length);var a=t(e.master_secret,"key expansion",n,s),u={client_write_MAC_key:a.getBytes(e.mac_key_length),server_write_MAC_key:a.getBytes(e.mac_key_length),client_write_key:a.getBytes(e.enc_key_length),server_write_key:a.getBytes(e.enc_key_length)};return i&&(u.client_write_IV=a.getBytes(e.fixed_iv_length),u.server_write_IV=a.getBytes(e.fixed_iv_length)),u};U.createConnectionState=function(r){var e=r.entity===U.ConnectionEnd.client,t=o(function(){var i={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:o(function(a){return!0},"cipherFunction"),compressionState:null,compressFunction:o(function(a){return!0},"compressFunction"),updateSequenceNumber:o(function(){i.sequenceNumber[1]===4294967295?(i.sequenceNumber[1]=0,++i.sequenceNumber[0]):++i.sequenceNumber[1]},"updateSequenceNumber")};return i},"createMode"),n={read:t(),write:t()};if(n.read.update=function(i,a){return n.read.cipherFunction(a,n.read)?n.read.compressFunction(i,a,n.read)||i.error(i,{message:"Could not decompress record.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.decompression_failure}}):i.error(i,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.bad_record_mac}}),!i.fail},n.write.update=function(i,a){return n.write.compressFunction(i,a,n.write)?n.write.cipherFunction(a,n.write)||i.error(i,{message:"Could not encrypt record.",send:!1,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.internal_error}}):i.error(i,{message:"Could not compress record.",send:!1,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.internal_error}}),!i.fail},r.session){var s=r.session.sp;switch(r.session.cipherSuite.initSecurityParameters(s),s.keys=U.generateKeys(r,s),n.read.macKey=e?s.keys.server_write_MAC_key:s.keys.client_write_MAC_key,n.write.macKey=e?s.keys.client_write_MAC_key:s.keys.server_write_MAC_key,r.session.cipherSuite.initConnectionState(n,r,s),s.compression_algorithm){case U.CompressionMethod.none:break;case U.CompressionMethod.deflate:n.read.compressFunction=mQ,n.write.compressFunction=dQ;break;default:throw new Error("Unsupported compression algorithm.")}}return n};U.createRandom=function(){var r=new Date,e=+r+r.getTimezoneOffset()*6e4,t=ke.util.createBuffer();return t.putInt32(e),t.putBytes(ke.random.getBytes(28)),t};U.createRecord=function(r,e){if(!e.data)return null;var t={type:e.type,version:{major:r.version.major,minor:r.version.minor},length:e.data.length(),fragment:e.data};return t};U.createAlert=function(r,e){var t=ke.util.createBuffer();return t.putByte(e.level),t.putByte(e.description),U.createRecord(r,{type:U.ContentType.alert,data:t})};U.createClientHello=function(r){r.session.clientHelloVersion={major:r.version.major,minor:r.version.minor};for(var e=ke.util.createBuffer(),t=0;t<r.cipherSuites.length;++t){var n=r.cipherSuites[t];e.putByte(n.id[0]),e.putByte(n.id[1])}var s=e.length(),i=ke.util.createBuffer();i.putByte(U.CompressionMethod.none);var a=i.length(),u=ke.util.createBuffer();if(r.virtualHost){var c=ke.util.createBuffer();c.putByte(0),c.putByte(0);var f=ke.util.createBuffer();f.putByte(0),Ni(f,2,ke.util.createBuffer(r.virtualHost));var h=ke.util.createBuffer();Ni(h,2,f),Ni(c,2,h),u.putBuffer(c)}var m=u.length();m>0&&(m+=2);var g=r.session.id,x=g.length+1+2+4+28+2+s+1+a+m,v=ke.util.createBuffer();return v.putByte(U.HandshakeType.client_hello),v.putInt24(x),v.putByte(r.version.major),v.putByte(r.version.minor),v.putBytes(r.session.sp.client_random),Ni(v,1,ke.util.createBuffer(g)),Ni(v,2,e),Ni(v,1,i),m>0&&Ni(v,2,u),v};U.createServerHello=function(r){var e=r.session.id,t=e.length+1+2+4+28+2+1,n=ke.util.createBuffer();return n.putByte(U.HandshakeType.server_hello),n.putInt24(t),n.putByte(r.version.major),n.putByte(r.version.minor),n.putBytes(r.session.sp.server_random),Ni(n,1,ke.util.createBuffer(e)),n.putByte(r.session.cipherSuite.id[0]),n.putByte(r.session.cipherSuite.id[1]),n.putByte(r.session.compressionMethod),n};U.createCertificate=function(r){var e=r.entity===U.ConnectionEnd.client,t=null;if(r.getCertificate){var n;e?n=r.session.certificateRequest:n=r.session.extensions.server_name.serverNameList,t=r.getCertificate(r,n)}var s=ke.util.createBuffer();if(t!==null)try{ke.util.isArray(t)||(t=[t]);for(var i=null,a=0;a<t.length;++a){var u=ke.pem.decode(t[a])[0];if(u.type!=="CERTIFICATE"&&u.type!=="X509 CERTIFICATE"&&u.type!=="TRUSTED CERTIFICATE"){var c=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw c.headerType=u.type,c}if(u.procType&&u.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var f=ke.util.createBuffer(u.body);i===null&&(i=ke.asn1.fromDer(f.bytes(),!1));var h=ke.util.createBuffer();Ni(h,3,f),s.putBuffer(h)}t=ke.pki.certificateFromAsn1(i),e?r.session.clientCertificate=t:r.session.serverCertificate=t}catch(x){return r.error(r,{message:"Could not send certificate list.",cause:x,send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.bad_certificate}})}var m=3+s.length(),g=ke.util.createBuffer();return g.putByte(U.HandshakeType.certificate),g.putInt24(m),Ni(g,3,s),g};U.createClientKeyExchange=function(r){var e=ke.util.createBuffer();e.putByte(r.session.clientHelloVersion.major),e.putByte(r.session.clientHelloVersion.minor),e.putBytes(ke.random.getBytes(46));var t=r.session.sp;t.pre_master_secret=e.getBytes();var n=r.session.serverCertificate.publicKey;e=n.encrypt(t.pre_master_secret);var s=e.length+2,i=ke.util.createBuffer();return i.putByte(U.HandshakeType.client_key_exchange),i.putInt24(s),i.putInt16(e.length),i.putBytes(e),i};U.createServerKeyExchange=function(r){var e=0,t=ke.util.createBuffer();return e>0&&(t.putByte(U.HandshakeType.server_key_exchange),t.putInt24(e)),t};U.getClientSignature=function(r,e){var t=ke.util.createBuffer();t.putBuffer(r.session.md5.digest()),t.putBuffer(r.session.sha1.digest()),t=t.getBytes(),r.getSignature=r.getSignature||function(n,s,i){var a=null;if(n.getPrivateKey)try{a=n.getPrivateKey(n,n.session.clientCertificate),a=ke.pki.privateKeyFromPem(a)}catch(u){n.error(n,{message:"Could not get private key.",cause:u,send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.internal_error}})}a===null?n.error(n,{message:"No private key set.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.internal_error}}):s=a.sign(s,null),i(n,s)},r.getSignature(r,t,e)};U.createCertificateVerify=function(r,e){var t=e.length+2,n=ke.util.createBuffer();return n.putByte(U.HandshakeType.certificate_verify),n.putInt24(t),n.putInt16(e.length),n.putBytes(e),n};U.createCertificateRequest=function(r){var e=ke.util.createBuffer();e.putByte(1);var t=ke.util.createBuffer();for(var n in r.caStore.certs){var s=r.caStore.certs[n],i=ke.pki.distinguishedNameToAsn1(s.subject),a=ke.asn1.toDer(i);t.putInt16(a.length()),t.putBuffer(a)}var u=1+e.length()+2+t.length(),c=ke.util.createBuffer();return c.putByte(U.HandshakeType.certificate_request),c.putInt24(u),Ni(c,1,e),Ni(c,2,t),c};U.createServerHelloDone=function(r){var e=ke.util.createBuffer();return e.putByte(U.HandshakeType.server_hello_done),e.putInt24(0),e};U.createChangeCipherSpec=function(){var r=ke.util.createBuffer();return r.putByte(1),r};U.createFinished=function(r){var e=ke.util.createBuffer();e.putBuffer(r.session.md5.digest()),e.putBuffer(r.session.sha1.digest());var t=r.entity===U.ConnectionEnd.client,n=r.session.sp,s=12,i=Vw,a=t?"client finished":"server finished";e=i(n.master_secret,a,e.getBytes(),s);var u=ke.util.createBuffer();return u.putByte(U.HandshakeType.finished),u.putInt24(e.length()),u.putBuffer(e),u};U.createHeartbeat=function(r,e,t){typeof t>"u"&&(t=e.length);var n=ke.util.createBuffer();n.putByte(r),n.putInt16(t),n.putBytes(e);var s=n.length(),i=Math.max(16,s-t-3);return n.putBytes(ke.random.getBytes(i)),n};U.queue=function(r,e){if(e&&!(e.fragment.length()===0&&(e.type===U.ContentType.handshake||e.type===U.ContentType.alert||e.type===U.ContentType.change_cipher_spec))){if(e.type===U.ContentType.handshake){var t=e.fragment.bytes();r.session.md5.update(t),r.session.sha1.update(t),t=null}var n;if(e.fragment.length()<=U.MaxFragment)n=[e];else{n=[];for(var s=e.fragment.bytes();s.length>U.MaxFragment;)n.push(U.createRecord(r,{type:e.type,data:ke.util.createBuffer(s.slice(0,U.MaxFragment))})),s=s.slice(U.MaxFragment);s.length>0&&n.push(U.createRecord(r,{type:e.type,data:ke.util.createBuffer(s)}))}for(var i=0;i<n.length&&!r.fail;++i){var a=n[i],u=r.state.current.write;u.update(r,a)&&r.records.push(a)}}};U.flush=function(r){for(var e=0;e<r.records.length;++e){var t=r.records[e];r.tlsData.putByte(t.type),r.tlsData.putByte(t.version.major),r.tlsData.putByte(t.version.minor),r.tlsData.putInt16(t.fragment.length()),r.tlsData.putBuffer(r.records[e].fragment)}return r.records=[],r.tlsDataReady(r)};var xN=o(function(r){switch(r){case!0:return!0;case ke.pki.certificateError.bad_certificate:return U.Alert.Description.bad_certificate;case ke.pki.certificateError.unsupported_certificate:return U.Alert.Description.unsupported_certificate;case ke.pki.certificateError.certificate_revoked:return U.Alert.Description.certificate_revoked;case ke.pki.certificateError.certificate_expired:return U.Alert.Description.certificate_expired;case ke.pki.certificateError.certificate_unknown:return U.Alert.Description.certificate_unknown;case ke.pki.certificateError.unknown_ca:return U.Alert.Description.unknown_ca;default:return U.Alert.Description.bad_certificate}},"_certErrorToAlertDesc"),RQ=o(function(r){switch(r){case!0:return!0;case U.Alert.Description.bad_certificate:return ke.pki.certificateError.bad_certificate;case U.Alert.Description.unsupported_certificate:return ke.pki.certificateError.unsupported_certificate;case U.Alert.Description.certificate_revoked:return ke.pki.certificateError.certificate_revoked;case U.Alert.Description.certificate_expired:return ke.pki.certificateError.certificate_expired;case U.Alert.Description.certificate_unknown:return ke.pki.certificateError.certificate_unknown;case U.Alert.Description.unknown_ca:return ke.pki.certificateError.unknown_ca;default:return ke.pki.certificateError.bad_certificate}},"_alertDescToCertError");U.verifyCertificateChain=function(r,e){try{var t={};for(var n in r.verifyOptions)t[n]=r.verifyOptions[n];t.verify=function(i,a,u){var c=xN(i),f=r.verify(r,i,a,u);if(f!==!0){if(typeof f=="object"&&!ke.util.isArray(f)){var h=new Error("The application rejected the certificate.");throw h.send=!0,h.alert={level:U.Alert.Level.fatal,description:U.Alert.Description.bad_certificate},f.message&&(h.message=f.message),f.alert&&(h.alert.description=f.alert),h}f!==i&&(f=RQ(f))}return f},ke.pki.verifyCertificateChain(r.caStore,e,t)}catch(i){var s=i;(typeof s!="object"||ke.util.isArray(s))&&(s={send:!0,alert:{level:U.Alert.Level.fatal,description:xN(i)}}),"send"in s||(s.send=!0),"alert"in s||(s.alert={level:U.Alert.Level.fatal,description:xN(s.error)}),r.error(r,s)}return!r.fail};U.createSessionCache=function(r,e){var t=null;if(r&&r.getSession&&r.setSession&&r.order)t=r;else{t={},t.cache=r||{},t.capacity=Math.max(e||100,1),t.order=[];for(var n in r)t.order.length<=e?t.order.push(n):delete r[n];t.getSession=function(s){var i=null,a=null;if(s?a=ke.util.bytesToHex(s):t.order.length>0&&(a=t.order[0]),a!==null&&a in t.cache){i=t.cache[a],delete t.cache[a];for(var u in t.order)if(t.order[u]===a){t.order.splice(u,1);break}}return i},t.setSession=function(s,i){if(t.order.length===t.capacity){var a=t.order.shift();delete t.cache[a]}var a=ke.util.bytesToHex(s);t.order.push(a),t.cache[a]=i}}return t};U.createConnection=function(r){var e=null;r.caStore?ke.util.isArray(r.caStore)?e=ke.pki.createCaStore(r.caStore):e=r.caStore:e=ke.pki.createCaStore();var t=r.cipherSuites||null;if(t===null){t=[];for(var n in U.CipherSuites)t.push(U.CipherSuites[n])}var s=r.server?U.ConnectionEnd.server:U.ConnectionEnd.client,i=r.sessionCache?U.createSessionCache(r.sessionCache):null,a={version:{major:U.Version.major,minor:U.Version.minor},entity:s,sessionId:r.sessionId,caStore:e,sessionCache:i,cipherSuites:t,connected:r.connected,virtualHost:r.virtualHost||null,verifyClient:r.verifyClient||!1,verify:r.verify||function(h,m,g,x){return m},verifyOptions:r.verifyOptions||{},getCertificate:r.getCertificate||null,getPrivateKey:r.getPrivateKey||null,getSignature:r.getSignature||null,input:ke.util.createBuffer(),tlsData:ke.util.createBuffer(),data:ke.util.createBuffer(),tlsDataReady:r.tlsDataReady,dataReady:r.dataReady,heartbeatReceived:r.heartbeatReceived,closed:r.closed,error:o(function(h,m){m.origin=m.origin||(h.entity===U.ConnectionEnd.client?"client":"server"),m.send&&(U.queue(h,U.createAlert(h,m.alert)),U.flush(h));var g=m.fatal!==!1;g&&(h.fail=!0),r.error(h,m),g&&h.close(!1)},"error"),deflate:r.deflate||null,inflate:r.inflate||null};a.reset=function(h){a.version={major:U.Version.major,minor:U.Version.minor},a.record=null,a.session=null,a.peerCertificate=null,a.state={pending:null,current:null},a.expect=a.entity===U.ConnectionEnd.client?gQ:EQ,a.fragmented=null,a.records=[],a.open=!1,a.handshakes=0,a.handshaking=!1,a.isConnected=!1,a.fail=!(h||typeof h>"u"),a.input.clear(),a.tlsData.clear(),a.data.clear(),a.state.current=U.createConnectionState(a)},a.reset();var u=o(function(h,m){var g=m.type-U.ContentType.change_cipher_spec,x=bN[h.entity][h.expect];g in x?x[g](h,m):U.handleUnexpected(h,m)},"_update"),c=o(function(h){var m=0,g=h.input,x=g.length();if(x<5)m=5-x;else{h.record={type:g.getByte(),version:{major:g.getByte(),minor:g.getByte()},length:g.getInt16(),fragment:ke.util.createBuffer(),ready:!1};var v=h.record.version.major===h.version.major;v&&h.session&&h.session.version&&(v=h.record.version.minor===h.version.minor),v||h.error(h,{message:"Incompatible TLS version.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.protocol_version}})}return m},"_readRecordHeader"),f=o(function(h){var m=0,g=h.input,x=g.length();if(x<h.record.length)m=h.record.length-x;else{h.record.fragment.putBytes(g.getBytes(h.record.length)),g.compact();var v=h.state.current.read;v.update(h,h.record)&&(h.fragmented!==null&&(h.fragmented.type===h.record.type?(h.fragmented.fragment.putBuffer(h.record.fragment),h.record=h.fragmented):h.error(h,{message:"Invalid fragmented record.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.unexpected_message}})),h.record.ready=!0)}return m},"_readRecord");return a.handshake=function(h){if(a.entity!==U.ConnectionEnd.client)a.error(a,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(a.handshaking)a.error(a,{message:"Handshake already in progress.",fatal:!1});else{a.fail&&!a.open&&a.handshakes===0&&(a.fail=!1),a.handshaking=!0,h=h||"";var m=null;h.length>0&&(a.sessionCache&&(m=a.sessionCache.getSession(h)),m===null&&(h="")),h.length===0&&a.sessionCache&&(m=a.sessionCache.getSession(),m!==null&&(h=m.id)),a.session={id:h,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:ke.md.md5.create(),sha1:ke.md.sha1.create()},m&&(a.version=m.version,a.session.sp=m.sp),a.session.sp.client_random=U.createRandom().getBytes(),a.open=!0,U.queue(a,U.createRecord(a,{type:U.ContentType.handshake,data:U.createClientHello(a)})),U.flush(a)}},a.process=function(h){var m=0;return h&&a.input.putBytes(h),a.fail||(a.record!==null&&a.record.ready&&a.record.fragment.isEmpty()&&(a.record=null),a.record===null&&(m=c(a)),!a.fail&&a.record!==null&&!a.record.ready&&(m=f(a)),!a.fail&&a.record!==null&&a.record.ready&&u(a,a.record)),m},a.prepare=function(h){return U.queue(a,U.createRecord(a,{type:U.ContentType.application_data,data:ke.util.createBuffer(h)})),U.flush(a)},a.prepareHeartbeatRequest=function(h,m){return h instanceof ke.util.ByteBuffer&&(h=h.bytes()),typeof m>"u"&&(m=h.length),a.expectedHeartbeatPayload=h,U.queue(a,U.createRecord(a,{type:U.ContentType.heartbeat,data:U.createHeartbeat(U.HeartbeatMessageType.heartbeat_request,h,m)})),U.flush(a)},a.close=function(h){if(!a.fail&&a.sessionCache&&a.session){var m={id:a.session.id,version:a.session.version,sp:a.session.sp};m.sp.keys=null,a.sessionCache.setSession(m.id,m)}a.open&&(a.open=!1,a.input.clear(),(a.isConnected||a.handshaking)&&(a.isConnected=a.handshaking=!1,U.queue(a,U.createAlert(a,{level:U.Alert.Level.warning,description:U.Alert.Description.close_notify})),U.flush(a)),a.closed(a)),a.reset(h)},a};pk.exports=ke.tls=ke.tls||{};for(kw in U)typeof U[kw]!="function"&&(ke.tls[kw]=U[kw]);var kw;ke.tls.prf_tls1=Vw;ke.tls.hmac_sha1=pQ;ke.tls.createSessionCache=U.createSessionCache;ke.tls.createConnection=U.createConnection});var gk=Z((kde,mk)=>{"use strict";var Mu=$t();Pu();EN();var Ti=mk.exports=Mu.tls;Ti.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:o(function(r){r.bulk_cipher_algorithm=Ti.BulkCipherAlgorithm.aes,r.cipher_type=Ti.CipherType.block,r.enc_key_length=16,r.block_length=16,r.fixed_iv_length=16,r.record_iv_length=16,r.mac_algorithm=Ti.MACAlgorithm.hmac_sha1,r.mac_length=20,r.mac_key_length=20},"initSecurityParameters"),initConnectionState:dk};Ti.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:o(function(r){r.bulk_cipher_algorithm=Ti.BulkCipherAlgorithm.aes,r.cipher_type=Ti.CipherType.block,r.enc_key_length=32,r.block_length=16,r.fixed_iv_length=16,r.record_iv_length=16,r.mac_algorithm=Ti.MACAlgorithm.hmac_sha1,r.mac_length=20,r.mac_key_length=20},"initSecurityParameters"),initConnectionState:dk};function dk(r,e,t){var n=e.entity===Mu.tls.ConnectionEnd.client;r.read.cipherState={init:!1,cipher:Mu.cipher.createDecipher("AES-CBC",n?t.keys.server_write_key:t.keys.client_write_key),iv:n?t.keys.server_write_IV:t.keys.client_write_IV},r.write.cipherState={init:!1,cipher:Mu.cipher.createCipher("AES-CBC",n?t.keys.client_write_key:t.keys.server_write_key),iv:n?t.keys.client_write_IV:t.keys.server_write_IV},r.read.cipherFunction=LQ,r.write.cipherFunction=PQ,r.read.macLength=r.write.macLength=t.mac_length,r.read.macFunction=r.write.macFunction=Ti.hmac_sha1}o(dk,"initConnectionState");function PQ(r,e){var t=!1,n=e.macFunction(e.macKey,e.sequenceNumber,r);r.fragment.putBytes(n),e.updateSequenceNumber();var s;r.version.minor===Ti.Versions.TLS_1_0.minor?s=e.cipherState.init?null:e.cipherState.iv:s=Mu.random.getBytesSync(16),e.cipherState.init=!0;var i=e.cipherState.cipher;return i.start({iv:s}),r.version.minor>=Ti.Versions.TLS_1_1.minor&&i.output.putBytes(s),i.update(r.fragment),i.finish(OQ)&&(r.fragment=i.output,r.length=r.fragment.length(),t=!0),t}o(PQ,"encrypt_aes_cbc_sha1");function OQ(r,e,t){if(!t){var n=r-e.length()%r;e.fillWithByte(n-1,n)}return!0}o(OQ,"encrypt_aes_cbc_sha1_padding");function kQ(r,e,t){var n=!0;if(t){for(var s=e.length(),i=e.last(),a=s-1-i;a<s-1;++a)n=n&&e.at(a)==i;n&&e.truncate(i+1)}return n}o(kQ,"decrypt_aes_cbc_sha1_padding");function LQ(r,e){var t=!1,n;r.version.minor===Ti.Versions.TLS_1_0.minor?n=e.cipherState.init?null:e.cipherState.iv:n=r.fragment.getBytes(16),e.cipherState.init=!0;var s=e.cipherState.cipher;s.start({iv:n}),s.update(r.fragment),t=s.finish(kQ);var i=e.macLength,a=Mu.random.getBytesSync(i),u=s.output.length();u>=i?(r.fragment=s.output.getBytes(u-i),a=s.output.getBytes(i)):r.fragment=s.output.getBytes(),r.fragment=Mu.util.createBuffer(r.fragment),r.length=r.fragment.length();var c=e.macFunction(e.macKey,e.sequenceNumber,r);return e.updateSequenceNumber(),t=VQ(e.macKey,a,c)&&t,t}o(LQ,"decrypt_aes_cbc_sha1");function VQ(r,e,t){var n=Mu.hmac.create();return n.start("SHA1",r),n.update(e),e=n.digest().getBytes(),n.start(null,null),n.update(t),t=n.digest().getBytes(),e===t}o(VQ,"compareMacs")});var NN=Z((Vde,wk)=>{"use strict";var Mr=$t();Ia();lr();var ng=wk.exports=Mr.sha512=Mr.sha512||{};Mr.md.sha512=Mr.md.algorithms.sha512=ng;var yk=Mr.sha384=Mr.sha512.sha384=Mr.sha512.sha384||{};yk.create=function(){return ng.create("SHA-384")};Mr.md.sha384=Mr.md.algorithms.sha384=yk;Mr.sha512.sha256=Mr.sha512.sha256||{create:o(function(){return ng.create("SHA-512/256")},"create")};Mr.md["sha512/256"]=Mr.md.algorithms["sha512/256"]=Mr.sha512.sha256;Mr.sha512.sha224=Mr.sha512.sha224||{create:o(function(){return ng.create("SHA-512/224")},"create")};Mr.md["sha512/224"]=Mr.md.algorithms["sha512/224"]=Mr.sha512.sha224;ng.create=function(r){if(xk||UQ(),typeof r>"u"&&(r="SHA-512"),!(r in kl))throw new Error("Invalid SHA-512 algorithm: "+r);for(var e=kl[r],t=null,n=Mr.util.createBuffer(),s=new Array(80),i=0;i<80;++i)s[i]=new Array(2);var a=64;switch(r){case"SHA-384":a=48;break;case"SHA-512/256":a=32;break;case"SHA-512/224":a=28;break}var u={algorithm:r.replace("-","").toLowerCase(),blockLength:128,digestLength:a,messageLength:0,fullMessageLength:null,messageLengthSize:16};return u.start=function(){u.messageLength=0,u.fullMessageLength=u.messageLength128=[];for(var c=u.messageLengthSize/4,f=0;f<c;++f)u.fullMessageLength.push(0);n=Mr.util.createBuffer(),t=new Array(e.length);for(var f=0;f<e.length;++f)t[f]=e[f].slice(0);return u},u.start(),u.update=function(c,f){f==="utf8"&&(c=Mr.util.encodeUtf8(c));var h=c.length;u.messageLength+=h,h=[h/4294967296>>>0,h>>>0];for(var m=u.fullMessageLength.length-1;m>=0;--m)u.fullMessageLength[m]+=h[1],h[1]=h[0]+(u.fullMessageLength[m]/4294967296>>>0),u.fullMessageLength[m]=u.fullMessageLength[m]>>>0,h[0]=h[1]/4294967296>>>0;return n.putBytes(c),vk(t,s,n),(n.read>2048||n.length()===0)&&n.compact(),u},u.digest=function(){var c=Mr.util.createBuffer();c.putBytes(n.bytes());var f=u.fullMessageLength[u.fullMessageLength.length-1]+u.messageLengthSize,h=f&u.blockLength-1;c.putBytes(AN.substr(0,u.blockLength-h));for(var m,g,x=u.fullMessageLength[0]*8,v=0;v<u.fullMessageLength.length-1;++v)m=u.fullMessageLength[v+1]*8,g=m/4294967296>>>0,x+=g,c.putInt32(x>>>0),x=m>>>0;c.putInt32(x);for(var w=new Array(t.length),v=0;v<t.length;++v)w[v]=t[v].slice(0);vk(w,s,c);var S=Mr.util.createBuffer(),A;r==="SHA-512"?A=w.length:r==="SHA-384"?A=w.length-2:A=w.length-4;for(var v=0;v<A;++v)S.putInt32(w[v][0]),(v!==A-1||r!=="SHA-512/224")&&S.putInt32(w[v][1]);return S},u};var AN=null,xk=!1,CN=null,kl=null;function UQ(){AN="\x80",AN+=Mr.util.fillString("\0",128),CN=[[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]],kl={},kl["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],kl["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],kl["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],kl["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],xk=!0}o(UQ,"_init");function vk(r,e,t){for(var n,s,i,a,u,c,f,h,m,g,x,v,w,S,A,T,b,E,C,_,F,R,q,H,K,X,pe,le,ue,ee,he,we,Ke,Ae,xe,je=t.length();je>=128;){for(ue=0;ue<16;++ue)e[ue][0]=t.getInt32()>>>0,e[ue][1]=t.getInt32()>>>0;for(;ue<80;++ue)we=e[ue-2],ee=we[0],he=we[1],n=((ee>>>19|he<<13)^(he>>>29|ee<<3)^ee>>>6)>>>0,s=((ee<<13|he>>>19)^(he<<3|ee>>>29)^(ee<<26|he>>>6))>>>0,Ae=e[ue-15],ee=Ae[0],he=Ae[1],i=((ee>>>1|he<<31)^(ee>>>8|he<<24)^ee>>>7)>>>0,a=((ee<<31|he>>>1)^(ee<<24|he>>>8)^(ee<<25|he>>>7))>>>0,Ke=e[ue-7],xe=e[ue-16],he=s+Ke[1]+a+xe[1],e[ue][0]=n+Ke[0]+i+xe[0]+(he/4294967296>>>0)>>>0,e[ue][1]=he>>>0;for(w=r[0][0],S=r[0][1],A=r[1][0],T=r[1][1],b=r[2][0],E=r[2][1],C=r[3][0],_=r[3][1],F=r[4][0],R=r[4][1],q=r[5][0],H=r[5][1],K=r[6][0],X=r[6][1],pe=r[7][0],le=r[7][1],ue=0;ue<80;++ue)f=((F>>>14|R<<18)^(F>>>18|R<<14)^(R>>>9|F<<23))>>>0,h=((F<<18|R>>>14)^(F<<14|R>>>18)^(R<<23|F>>>9))>>>0,m=(K^F&(q^K))>>>0,g=(X^R&(H^X))>>>0,u=((w>>>28|S<<4)^(S>>>2|w<<30)^(S>>>7|w<<25))>>>0,c=((w<<4|S>>>28)^(S<<30|w>>>2)^(S<<25|w>>>7))>>>0,x=(w&A|b&(w^A))>>>0,v=(S&T|E&(S^T))>>>0,he=le+h+g+CN[ue][1]+e[ue][1],n=pe+f+m+CN[ue][0]+e[ue][0]+(he/4294967296>>>0)>>>0,s=he>>>0,he=c+v,i=u+x+(he/4294967296>>>0)>>>0,a=he>>>0,pe=K,le=X,K=q,X=H,q=F,H=R,he=_+s,F=C+n+(he/4294967296>>>0)>>>0,R=he>>>0,C=b,_=E,b=A,E=T,A=w,T=S,he=s+a,w=n+i+(he/4294967296>>>0)>>>0,S=he>>>0;he=r[0][1]+S,r[0][0]=r[0][0]+w+(he/4294967296>>>0)>>>0,r[0][1]=he>>>0,he=r[1][1]+T,r[1][0]=r[1][0]+A+(he/4294967296>>>0)>>>0,r[1][1]=he>>>0,he=r[2][1]+E,r[2][0]=r[2][0]+b+(he/4294967296>>>0)>>>0,r[2][1]=he>>>0,he=r[3][1]+_,r[3][0]=r[3][0]+C+(he/4294967296>>>0)>>>0,r[3][1]=he>>>0,he=r[4][1]+R,r[4][0]=r[4][0]+F+(he/4294967296>>>0)>>>0,r[4][1]=he>>>0,he=r[5][1]+H,r[5][0]=r[5][0]+q+(he/4294967296>>>0)>>>0,r[5][1]=he>>>0,he=r[6][1]+X,r[6][0]=r[6][0]+K+(he/4294967296>>>0)>>>0,r[6][1]=he>>>0,he=r[7][1]+le,r[7][0]=r[7][0]+pe+(he/4294967296>>>0)>>>0,r[7][1]=he>>>0,je-=128}}o(vk,"_update")});var Sk=Z(TN=>{"use strict";var jQ=$t();ea();var Bn=jQ.asn1;TN.privateKeyValidator={name:"PrivateKeyInfo",tagClass:Bn.Class.UNIVERSAL,type:Bn.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:Bn.Class.UNIVERSAL,type:Bn.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:Bn.Class.UNIVERSAL,type:Bn.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Bn.Class.UNIVERSAL,type:Bn.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:Bn.Class.UNIVERSAL,type:Bn.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]};TN.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:Bn.Class.UNIVERSAL,type:Bn.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:Bn.Class.UNIVERSAL,type:Bn.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Bn.Class.UNIVERSAL,type:Bn.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:Bn.Class.UNIVERSAL,type:Bn.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}});var Ok=Z((Mde,Pk)=>{"use strict";var Kn=$t();Z0();bi();NN();lr();var Tk=Sk(),MQ=Tk.publicKeyValidator,FQ=Tk.privateKeyValidator;typeof bk>"u"&&(bk=Kn.jsbn.BigInteger);var bk,BN=Kn.util.ByteBuffer,Bs=typeof Buffer>"u"?Uint8Array:Buffer;Kn.pki=Kn.pki||{};Pk.exports=Kn.pki.ed25519=Kn.ed25519=Kn.ed25519||{};var Qt=Kn.ed25519;Qt.constants={};Qt.constants.PUBLIC_KEY_BYTE_LENGTH=32;Qt.constants.PRIVATE_KEY_BYTE_LENGTH=64;Qt.constants.SEED_BYTE_LENGTH=32;Qt.constants.SIGN_BYTE_LENGTH=64;Qt.constants.HASH_BYTE_LENGTH=64;Qt.generateKeyPair=function(r){r=r||{};var e=r.seed;if(e===void 0)e=Kn.random.getBytesSync(Qt.constants.SEED_BYTE_LENGTH);else if(typeof e=="string"){if(e.length!==Qt.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+Qt.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(e instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');e=Io({message:e,encoding:"binary"});for(var t=new Bs(Qt.constants.PUBLIC_KEY_BYTE_LENGTH),n=new Bs(Qt.constants.PRIVATE_KEY_BYTE_LENGTH),s=0;s<32;++s)n[s]=e[s];return $Q(t,n),{publicKey:t,privateKey:n}};Qt.privateKeyFromAsn1=function(r){var e={},t=[],n=Kn.asn1.validate(r,FQ,e,t);if(!n){var s=new Error("Invalid Key.");throw s.errors=t,s}var i=Kn.asn1.derToOid(e.privateKeyOid),a=Kn.oids.EdDSA25519;if(i!==a)throw new Error('Invalid OID "'+i+'"; OID must be "'+a+'".');var u=e.privateKey,c=Io({message:Kn.asn1.fromDer(u).value,encoding:"binary"});return{privateKeyBytes:c}};Qt.publicKeyFromAsn1=function(r){var e={},t=[],n=Kn.asn1.validate(r,MQ,e,t);if(!n){var s=new Error("Invalid Key.");throw s.errors=t,s}var i=Kn.asn1.derToOid(e.publicKeyOid),a=Kn.oids.EdDSA25519;if(i!==a)throw new Error('Invalid OID "'+i+'"; OID must be "'+a+'".');var u=e.ed25519PublicKey;if(u.length!==Qt.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return Io({message:u,encoding:"binary"})};Qt.publicKeyFromPrivateKey=function(r){r=r||{};var e=Io({message:r.privateKey,encoding:"binary"});if(e.length!==Qt.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+Qt.constants.PRIVATE_KEY_BYTE_LENGTH);for(var t=new Bs(Qt.constants.PUBLIC_KEY_BYTE_LENGTH),n=0;n<t.length;++n)t[n]=e[32+n];return t};Qt.sign=function(r){r=r||{};var e=Io(r),t=Io({message:r.privateKey,encoding:"binary"});if(t.length===Qt.constants.SEED_BYTE_LENGTH){var n=Qt.generateKeyPair({seed:t});t=n.privateKey}else if(t.length!==Qt.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+Qt.constants.SEED_BYTE_LENGTH+" or "+Qt.constants.PRIVATE_KEY_BYTE_LENGTH);var s=new Bs(Qt.constants.SIGN_BYTE_LENGTH+e.length);GQ(s,e,e.length,t);for(var i=new Bs(Qt.constants.SIGN_BYTE_LENGTH),a=0;a<i.length;++a)i[a]=s[a];return i};Qt.verify=function(r){r=r||{};var e=Io(r);if(r.signature===void 0)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var t=Io({message:r.signature,encoding:"binary"});if(t.length!==Qt.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+Qt.constants.SIGN_BYTE_LENGTH);var n=Io({message:r.publicKey,encoding:"binary"});if(n.length!==Qt.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+Qt.constants.PUBLIC_KEY_BYTE_LENGTH);var s=new Bs(Qt.constants.SIGN_BYTE_LENGTH+e.length),i=new Bs(Qt.constants.SIGN_BYTE_LENGTH+e.length),a;for(a=0;a<Qt.constants.SIGN_BYTE_LENGTH;++a)s[a]=t[a];for(a=0;a<e.length;++a)s[a+Qt.constants.SIGN_BYTE_LENGTH]=e[a];return XQ(i,s,s.length,n)>=0};function Io(r){var e=r.message;if(e instanceof Uint8Array||e instanceof Bs)return e;var t=r.encoding;if(e===void 0)if(r.md)e=r.md.digest().getBytes(),t="binary";else throw new TypeError('"options.message" or "options.md" not specified.');if(typeof e=="string"&&!t)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof e=="string"){if(typeof Buffer<"u")return Buffer.from(e,t);e=new BN(e,t)}else if(!(e instanceof BN))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var n=new Bs(e.length()),s=0;s<n.length;++s)n[s]=e.at(s);return n}o(Io,"messageToNativeBuffer");var DN=Nt(),Uw=Nt([1]),qQ=Nt([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),HQ=Nt([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),Ek=Nt([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),Ak=Nt([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),IN=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]),KQ=Nt([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function sg(r,e){var t=Kn.md.sha512.create(),n=new BN(r);t.update(n.getBytes(e),"binary");var s=t.digest().getBytes();if(typeof Buffer<"u")return Buffer.from(s,"binary");for(var i=new Bs(Qt.constants.HASH_BYTE_LENGTH),a=0;a<64;++a)i[a]=s.charCodeAt(a);return i}o(sg,"sha512");function $Q(r,e){var t=[Nt(),Nt(),Nt(),Nt()],n,s=sg(e,32);for(s[0]&=248,s[31]&=127,s[31]|=64,kN(t,s),ON(r,t),n=0;n<32;++n)e[n+32]=r[n];return 0}o($Q,"crypto_sign_keypair");function GQ(r,e,t,n){var s,i,a=new Float64Array(64),u=[Nt(),Nt(),Nt(),Nt()],c=sg(n,32);c[0]&=248,c[31]&=127,c[31]|=64;var f=t+64;for(s=0;s<t;++s)r[64+s]=e[s];for(s=0;s<32;++s)r[32+s]=c[32+s];var h=sg(r.subarray(32),t+32);for(RN(h),kN(u,h),ON(r,u),s=32;s<64;++s)r[s]=n[s];var m=sg(r,t+64);for(RN(m),s=32;s<64;++s)a[s]=0;for(s=0;s<32;++s)a[s]=h[s];for(s=0;s<32;++s)for(i=0;i<32;i++)a[s+i]+=m[s]*c[i];return Ik(r.subarray(32),a),f}o(GQ,"crypto_sign");function XQ(r,e,t,n){var s,i,a=new Bs(32),u=[Nt(),Nt(),Nt(),Nt()],c=[Nt(),Nt(),Nt(),Nt()];if(i=-1,t<64||WQ(c,n))return-1;for(s=0;s<t;++s)r[s]=e[s];for(s=0;s<32;++s)r[s+32]=n[s];var f=sg(r,t);if(RN(f),Dk(u,c,f),kN(c,e.subarray(32)),PN(u,c),ON(a,u),t-=64,_k(e,0,a,0)){for(s=0;s<t;++s)r[s]=0;return-1}for(s=0;s<t;++s)r[s]=e[s+64];return i=t,i}o(XQ,"crypto_sign_open");function Ik(r,e){var t,n,s,i;for(n=63;n>=32;--n){for(t=0,s=n-32,i=n-12;s<i;++s)e[s]+=t-16*e[n]*IN[s-(n-32)],t=e[s]+128>>8,e[s]-=t*256;e[s]+=t,e[n]=0}for(t=0,s=0;s<32;++s)e[s]+=t-(e[31]>>4)*IN[s],t=e[s]>>8,e[s]&=255;for(s=0;s<32;++s)e[s]-=t*IN[s];for(n=0;n<32;++n)e[n+1]+=e[n]>>8,r[n]=e[n]&255}o(Ik,"modL");function RN(r){for(var e=new Float64Array(64),t=0;t<64;++t)e[t]=r[t],r[t]=0;Ik(r,e)}o(RN,"reduce");function PN(r,e){var t=Nt(),n=Nt(),s=Nt(),i=Nt(),a=Nt(),u=Nt(),c=Nt(),f=Nt(),h=Nt();gp(t,r[1],r[0]),gp(h,e[1],e[0]),Ir(t,t,h),mp(n,r[0],r[1]),mp(h,e[0],e[1]),Ir(n,n,h),Ir(s,r[3],e[3]),Ir(s,s,HQ),Ir(i,r[2],e[2]),mp(i,i,i),gp(a,n,t),gp(u,i,s),mp(c,i,s),mp(f,n,t),Ir(r[0],a,u),Ir(r[1],f,c),Ir(r[2],c,u),Ir(r[3],a,f)}o(PN,"add");function Ck(r,e,t){for(var n=0;n<4;++n)Rk(r[n],e[n],t)}o(Ck,"cswap");function ON(r,e){var t=Nt(),n=Nt(),s=Nt();QQ(s,e[2]),Ir(t,e[0],s),Ir(n,e[1],s),jw(r,n),r[31]^=Bk(t)<<7}o(ON,"pack");function jw(r,e){var t,n,s,i=Nt(),a=Nt();for(t=0;t<16;++t)a[t]=e[t];for(_N(a),_N(a),_N(a),n=0;n<2;++n){for(i[0]=a[0]-65517,t=1;t<15;++t)i[t]=a[t]-65535-(i[t-1]>>16&1),i[t-1]&=65535;i[15]=a[15]-32767-(i[14]>>16&1),s=i[15]>>16&1,i[14]&=65535,Rk(a,i,1-s)}for(t=0;t<16;t++)r[2*t]=a[t]&255,r[2*t+1]=a[t]>>8}o(jw,"pack25519");function WQ(r,e){var t=Nt(),n=Nt(),s=Nt(),i=Nt(),a=Nt(),u=Nt(),c=Nt();return Fu(r[2],Uw),zQ(r[1],e),Ll(s,r[1]),Ir(i,s,qQ),gp(s,s,r[2]),mp(i,r[2],i),Ll(a,i),Ll(u,a),Ir(c,u,a),Ir(t,c,s),Ir(t,t,i),JQ(t,t),Ir(t,t,s),Ir(t,t,i),Ir(t,t,i),Ir(r[0],t,i),Ll(n,r[0]),Ir(n,n,i),Nk(n,s)&&Ir(r[0],r[0],KQ),Ll(n,r[0]),Ir(n,n,i),Nk(n,s)?-1:(Bk(r[0])===e[31]>>7&&gp(r[0],DN,r[0]),Ir(r[3],r[0],r[1]),0)}o(WQ,"unpackneg");function zQ(r,e){var t;for(t=0;t<16;++t)r[t]=e[2*t]+(e[2*t+1]<<8);r[15]&=32767}o(zQ,"unpack25519");function JQ(r,e){var t=Nt(),n;for(n=0;n<16;++n)t[n]=e[n];for(n=250;n>=0;--n)Ll(t,t),n!==1&&Ir(t,t,e);for(n=0;n<16;++n)r[n]=t[n]}o(JQ,"pow2523");function Nk(r,e){var t=new Bs(32),n=new Bs(32);return jw(t,r),jw(n,e),_k(t,0,n,0)}o(Nk,"neq25519");function _k(r,e,t,n){return YQ(r,e,t,n,32)}o(_k,"crypto_verify_32");function YQ(r,e,t,n,s){var i,a=0;for(i=0;i<s;++i)a|=r[e+i]^t[n+i];return(1&a-1>>>8)-1}o(YQ,"vn");function Bk(r){var e=new Bs(32);return jw(e,r),e[0]&1}o(Bk,"par25519");function Dk(r,e,t){var n,s;for(Fu(r[0],DN),Fu(r[1],Uw),Fu(r[2],Uw),Fu(r[3],DN),s=255;s>=0;--s)n=t[s/8|0]>>(s&7)&1,Ck(r,e,n),PN(e,r),PN(r,r),Ck(r,e,n)}o(Dk,"scalarmult");function kN(r,e){var t=[Nt(),Nt(),Nt(),Nt()];Fu(t[0],Ek),Fu(t[1],Ak),Fu(t[2],Uw),Ir(t[3],Ek,Ak),Dk(r,t,e)}o(kN,"scalarbase");function Fu(r,e){var t;for(t=0;t<16;t++)r[t]=e[t]|0}o(Fu,"set25519");function QQ(r,e){var t=Nt(),n;for(n=0;n<16;++n)t[n]=e[n];for(n=253;n>=0;--n)Ll(t,t),n!==2&&n!==4&&Ir(t,t,e);for(n=0;n<16;++n)r[n]=t[n]}o(QQ,"inv25519");function _N(r){var e,t,n=1;for(e=0;e<16;++e)t=r[e]+n+65535,n=Math.floor(t/65536),r[e]=t-n*65536;r[0]+=n-1+37*(n-1)}o(_N,"car25519");function Rk(r,e,t){for(var n,s=~(t-1),i=0;i<16;++i)n=s&(r[i]^e[i]),r[i]^=n,e[i]^=n}o(Rk,"sel25519");function Nt(r){var e,t=new Float64Array(16);if(r)for(e=0;e<r.length;++e)t[e]=r[e];return t}o(Nt,"gf");function mp(r,e,t){for(var n=0;n<16;++n)r[n]=e[n]+t[n]}o(mp,"A");function gp(r,e,t){for(var n=0;n<16;++n)r[n]=e[n]-t[n]}o(gp,"Z");function Ll(r,e){Ir(r,e,e)}o(Ll,"S");function Ir(r,e,t){var n,s,i=0,a=0,u=0,c=0,f=0,h=0,m=0,g=0,x=0,v=0,w=0,S=0,A=0,T=0,b=0,E=0,C=0,_=0,F=0,R=0,q=0,H=0,K=0,X=0,pe=0,le=0,ue=0,ee=0,he=0,we=0,Ke=0,Ae=t[0],xe=t[1],je=t[2],Je=t[3],Qe=t[4],lt=t[5],O=t[6],D=t[7],se=t[8],z=t[9],Ge=t[10],Re=t[11],Ce=t[12],ft=t[13],nr=t[14],Me=t[15];n=e[0],i+=n*Ae,a+=n*xe,u+=n*je,c+=n*Je,f+=n*Qe,h+=n*lt,m+=n*O,g+=n*D,x+=n*se,v+=n*z,w+=n*Ge,S+=n*Re,A+=n*Ce,T+=n*ft,b+=n*nr,E+=n*Me,n=e[1],a+=n*Ae,u+=n*xe,c+=n*je,f+=n*Je,h+=n*Qe,m+=n*lt,g+=n*O,x+=n*D,v+=n*se,w+=n*z,S+=n*Ge,A+=n*Re,T+=n*Ce,b+=n*ft,E+=n*nr,C+=n*Me,n=e[2],u+=n*Ae,c+=n*xe,f+=n*je,h+=n*Je,m+=n*Qe,g+=n*lt,x+=n*O,v+=n*D,w+=n*se,S+=n*z,A+=n*Ge,T+=n*Re,b+=n*Ce,E+=n*ft,C+=n*nr,_+=n*Me,n=e[3],c+=n*Ae,f+=n*xe,h+=n*je,m+=n*Je,g+=n*Qe,x+=n*lt,v+=n*O,w+=n*D,S+=n*se,A+=n*z,T+=n*Ge,b+=n*Re,E+=n*Ce,C+=n*ft,_+=n*nr,F+=n*Me,n=e[4],f+=n*Ae,h+=n*xe,m+=n*je,g+=n*Je,x+=n*Qe,v+=n*lt,w+=n*O,S+=n*D,A+=n*se,T+=n*z,b+=n*Ge,E+=n*Re,C+=n*Ce,_+=n*ft,F+=n*nr,R+=n*Me,n=e[5],h+=n*Ae,m+=n*xe,g+=n*je,x+=n*Je,v+=n*Qe,w+=n*lt,S+=n*O,A+=n*D,T+=n*se,b+=n*z,E+=n*Ge,C+=n*Re,_+=n*Ce,F+=n*ft,R+=n*nr,q+=n*Me,n=e[6],m+=n*Ae,g+=n*xe,x+=n*je,v+=n*Je,w+=n*Qe,S+=n*lt,A+=n*O,T+=n*D,b+=n*se,E+=n*z,C+=n*Ge,_+=n*Re,F+=n*Ce,R+=n*ft,q+=n*nr,H+=n*Me,n=e[7],g+=n*Ae,x+=n*xe,v+=n*je,w+=n*Je,S+=n*Qe,A+=n*lt,T+=n*O,b+=n*D,E+=n*se,C+=n*z,_+=n*Ge,F+=n*Re,R+=n*Ce,q+=n*ft,H+=n*nr,K+=n*Me,n=e[8],x+=n*Ae,v+=n*xe,w+=n*je,S+=n*Je,A+=n*Qe,T+=n*lt,b+=n*O,E+=n*D,C+=n*se,_+=n*z,F+=n*Ge,R+=n*Re,q+=n*Ce,H+=n*ft,K+=n*nr,X+=n*Me,n=e[9],v+=n*Ae,w+=n*xe,S+=n*je,A+=n*Je,T+=n*Qe,b+=n*lt,E+=n*O,C+=n*D,_+=n*se,F+=n*z,R+=n*Ge,q+=n*Re,H+=n*Ce,K+=n*ft,X+=n*nr,pe+=n*Me,n=e[10],w+=n*Ae,S+=n*xe,A+=n*je,T+=n*Je,b+=n*Qe,E+=n*lt,C+=n*O,_+=n*D,F+=n*se,R+=n*z,q+=n*Ge,H+=n*Re,K+=n*Ce,X+=n*ft,pe+=n*nr,le+=n*Me,n=e[11],S+=n*Ae,A+=n*xe,T+=n*je,b+=n*Je,E+=n*Qe,C+=n*lt,_+=n*O,F+=n*D,R+=n*se,q+=n*z,H+=n*Ge,K+=n*Re,X+=n*Ce,pe+=n*ft,le+=n*nr,ue+=n*Me,n=e[12],A+=n*Ae,T+=n*xe,b+=n*je,E+=n*Je,C+=n*Qe,_+=n*lt,F+=n*O,R+=n*D,q+=n*se,H+=n*z,K+=n*Ge,X+=n*Re,pe+=n*Ce,le+=n*ft,ue+=n*nr,ee+=n*Me,n=e[13],T+=n*Ae,b+=n*xe,E+=n*je,C+=n*Je,_+=n*Qe,F+=n*lt,R+=n*O,q+=n*D,H+=n*se,K+=n*z,X+=n*Ge,pe+=n*Re,le+=n*Ce,ue+=n*ft,ee+=n*nr,he+=n*Me,n=e[14],b+=n*Ae,E+=n*xe,C+=n*je,_+=n*Je,F+=n*Qe,R+=n*lt,q+=n*O,H+=n*D,K+=n*se,X+=n*z,pe+=n*Ge,le+=n*Re,ue+=n*Ce,ee+=n*ft,he+=n*nr,we+=n*Me,n=e[15],E+=n*Ae,C+=n*xe,_+=n*je,F+=n*Je,R+=n*Qe,q+=n*lt,H+=n*O,K+=n*D,X+=n*se,pe+=n*z,le+=n*Ge,ue+=n*Re,ee+=n*Ce,he+=n*ft,we+=n*nr,Ke+=n*Me,i+=38*C,a+=38*_,u+=38*F,c+=38*R,f+=38*q,h+=38*H,m+=38*K,g+=38*X,x+=38*pe,v+=38*le,w+=38*ue,S+=38*ee,A+=38*he,T+=38*we,b+=38*Ke,s=1,n=i+s+65535,s=Math.floor(n/65536),i=n-s*65536,n=a+s+65535,s=Math.floor(n/65536),a=n-s*65536,n=u+s+65535,s=Math.floor(n/65536),u=n-s*65536,n=c+s+65535,s=Math.floor(n/65536),c=n-s*65536,n=f+s+65535,s=Math.floor(n/65536),f=n-s*65536,n=h+s+65535,s=Math.floor(n/65536),h=n-s*65536,n=m+s+65535,s=Math.floor(n/65536),m=n-s*65536,n=g+s+65535,s=Math.floor(n/65536),g=n-s*65536,n=x+s+65535,s=Math.floor(n/65536),x=n-s*65536,n=v+s+65535,s=Math.floor(n/65536),v=n-s*65536,n=w+s+65535,s=Math.floor(n/65536),w=n-s*65536,n=S+s+65535,s=Math.floor(n/65536),S=n-s*65536,n=A+s+65535,s=Math.floor(n/65536),A=n-s*65536,n=T+s+65535,s=Math.floor(n/65536),T=n-s*65536,n=b+s+65535,s=Math.floor(n/65536),b=n-s*65536,n=E+s+65535,s=Math.floor(n/65536),E=n-s*65536,i+=s-1+37*(s-1),s=1,n=i+s+65535,s=Math.floor(n/65536),i=n-s*65536,n=a+s+65535,s=Math.floor(n/65536),a=n-s*65536,n=u+s+65535,s=Math.floor(n/65536),u=n-s*65536,n=c+s+65535,s=Math.floor(n/65536),c=n-s*65536,n=f+s+65535,s=Math.floor(n/65536),f=n-s*65536,n=h+s+65535,s=Math.floor(n/65536),h=n-s*65536,n=m+s+65535,s=Math.floor(n/65536),m=n-s*65536,n=g+s+65535,s=Math.floor(n/65536),g=n-s*65536,n=x+s+65535,s=Math.floor(n/65536),x=n-s*65536,n=v+s+65535,s=Math.floor(n/65536),v=n-s*65536,n=w+s+65535,s=Math.floor(n/65536),w=n-s*65536,n=S+s+65535,s=Math.floor(n/65536),S=n-s*65536,n=A+s+65535,s=Math.floor(n/65536),A=n-s*65536,n=T+s+65535,s=Math.floor(n/65536),T=n-s*65536,n=b+s+65535,s=Math.floor(n/65536),b=n-s*65536,n=E+s+65535,s=Math.floor(n/65536),E=n-s*65536,i+=s-1+37*(s-1),r[0]=i,r[1]=a,r[2]=u,r[3]=c,r[4]=f,r[5]=h,r[6]=m,r[7]=g,r[8]=x,r[9]=v,r[10]=w,r[11]=S,r[12]=A,r[13]=T,r[14]=b,r[15]=E}o(Ir,"M")});var Uk=Z((qde,Vk)=>{"use strict";var si=$t();lr();bi();Z0();Vk.exports=si.kem=si.kem||{};var kk=si.jsbn.BigInteger;si.kem.rsa={};si.kem.rsa.create=function(r,e){e=e||{};var t=e.prng||si.random,n={};return n.encrypt=function(s,i){var a=Math.ceil(s.n.bitLength()/8),u;do u=new kk(si.util.bytesToHex(t.getBytesSync(a)),16).mod(s.n);while(u.compareTo(kk.ONE)<=0);u=si.util.hexToBytes(u.toString(16));var c=a-u.length;c>0&&(u=si.util.fillString("\0",c)+u);var f=s.encrypt(u,"NONE"),h=r.generate(u,i);return{encapsulation:f,key:h}},n.decrypt=function(s,i,a){var u=s.decrypt(i,"NONE");return r.generate(u,a)},n};si.kem.kdf1=function(r,e){Lk(this,r,0,e||r.digestLength)};si.kem.kdf2=function(r,e){Lk(this,r,1,e||r.digestLength)};function Lk(r,e,t,n){r.generate=function(s,i){for(var a=new si.util.ByteBuffer,u=Math.ceil(i/n)+t,c=new si.util.ByteBuffer,f=t;f<u;++f){c.putInt32(f),e.start(),e.update(s+c.getBytes());var h=e.digest();a.putBytes(h.getBytes(n))}return a.truncate(a.length()-i),a.getBytes()}}o(Lk,"_createKDF")});var qk=Z((Kde,Fk)=>{"use strict";var rr=$t();lr();Fk.exports=rr.log=rr.log||{};rr.log.levels=["none","error","warning","info","debug","verbose","max"];var Mw={},UN=[],ag=null;rr.log.LEVEL_LOCKED=2;rr.log.NO_LEVEL_CHECK=4;rr.log.INTERPOLATE=8;for(La=0;La<rr.log.levels.length;++La)LN=rr.log.levels[La],Mw[LN]={index:La,name:LN.toUpperCase()};var LN,La;rr.log.logMessage=function(r){for(var e=Mw[r.level].index,t=0;t<UN.length;++t){var n=UN[t];if(n.flags&rr.log.NO_LEVEL_CHECK)n.f(r);else{var s=Mw[n.level].index;e<=s&&n.f(n,r)}}};rr.log.prepareStandard=function(r){"standard"in r||(r.standard=Mw[r.level].name+" ["+r.category+"] "+r.message)};rr.log.prepareFull=function(r){if(!("full"in r)){var e=[r.message];e=e.concat([]),r.full=rr.util.format.apply(this,e)}};rr.log.prepareStandardFull=function(r){"standardFull"in r||(rr.log.prepareStandard(r),r.standardFull=r.standard)};for(VN=["error","warning","info","debug","verbose"],La=0;La<VN.length;++La)(function(e){rr.log[e]=function(t,n){var s=Array.prototype.slice.call(arguments).slice(2),i={timestamp:new Date,level:e,category:t,message:n,arguments:s};rr.log.logMessage(i)}})(VN[La]);var VN,La;rr.log.makeLogger=function(r){var e={flags:0,f:r};return rr.log.setLevel(e,"none"),e};rr.log.setLevel=function(r,e){var t=!1;if(r&&!(r.flags&rr.log.LEVEL_LOCKED))for(var n=0;n<rr.log.levels.length;++n){var s=rr.log.levels[n];if(e==s){r.level=e,t=!0;break}}return t};rr.log.lock=function(r,e){typeof e>"u"||e?r.flags|=rr.log.LEVEL_LOCKED:r.flags&=~rr.log.LEVEL_LOCKED};rr.log.addLogger=function(r){UN.push(r)};typeof console<"u"&&"log"in console?(console.error&&console.warn&&console.info&&console.debug?(jk={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},og=o(function(r,e){rr.log.prepareStandard(e);var t=jk[e.level],n=[e.standard];n=n.concat(e.arguments.slice()),t.apply(console,n)},"f"),vp=rr.log.makeLogger(og)):(og=o(function(e,t){rr.log.prepareStandardFull(t),console.log(t.standardFull)},"f"),vp=rr.log.makeLogger(og)),rr.log.setLevel(vp,"debug"),rr.log.addLogger(vp),ag=vp):console={log:o(function(){},"log")};var vp,jk,og;ag!==null&&typeof window<"u"&&window.location&&(ig=new URL(window.location.href).searchParams,ig.has("console.level")&&rr.log.setLevel(ag,ig.get("console.level").slice(-1)[0]),ig.has("console.lock")&&(Mk=ig.get("console.lock").slice(-1)[0],Mk=="true"&&rr.log.lock(ag)));var ig,Mk;rr.log.consoleLogger=ag});var Kk=Z((Gde,Hk)=>{"use strict";Hk.exports=Ia();xw();lp();Y2();NN()});var Xk=Z((Xde,Gk)=>{"use strict";var ze=$t();Pu();ea();Y0();Ou();_l();fN();bi();lr();Pw();var te=ze.asn1,xs=Gk.exports=ze.pkcs7=ze.pkcs7||{};xs.messageFromPem=function(r){var e=ze.pem.decode(r)[0];if(e.type!=="PKCS7"){var t=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw t.headerType=e.type,t}if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var n=te.fromDer(e.body);return xs.messageFromAsn1(n)};xs.messageToPem=function(r,e){var t={type:"PKCS7",body:te.toDer(r.toAsn1()).getBytes()};return ze.pem.encode(t,{maxline:e})};xs.messageFromAsn1=function(r){var e={},t=[];if(!te.validate(r,xs.asn1.contentInfoValidator,e,t)){var n=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw n.errors=t,n}var s=te.derToOid(e.contentType),i;switch(s){case ze.pki.oids.envelopedData:i=xs.createEnvelopedData();break;case ze.pki.oids.encryptedData:i=xs.createEncryptedData();break;case ze.pki.oids.signedData:i=xs.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+s+" is not (yet) supported.")}return i.fromAsn1(e.content.value[0]),i};xs.createSignedData=function(){var r=null;return r={type:ze.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:o(function(n){if(MN(r,n,xs.asn1.signedDataValidator),r.certificates=[],r.crls=[],r.digestAlgorithmIdentifiers=[],r.contentInfo=null,r.signerInfos=[],r.rawCapture.certificates)for(var s=r.rawCapture.certificates.value,i=0;i<s.length;++i)r.certificates.push(ze.pki.certificateFromAsn1(s[i]))},"fromAsn1"),toAsn1:o(function(){r.contentInfo||r.sign();for(var n=[],s=0;s<r.certificates.length;++s)n.push(ze.pki.certificateToAsn1(r.certificates[s]));var i=[],a=te.create(te.Class.CONTEXT_SPECIFIC,0,!0,[te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.INTEGER,!1,te.integerToDer(r.version).getBytes()),te.create(te.Class.UNIVERSAL,te.Type.SET,!0,r.digestAlgorithmIdentifiers),r.contentInfo])]);return n.length>0&&a.value[0].value.push(te.create(te.Class.CONTEXT_SPECIFIC,0,!0,n)),i.length>0&&a.value[0].value.push(te.create(te.Class.CONTEXT_SPECIFIC,1,!0,i)),a.value[0].value.push(te.create(te.Class.UNIVERSAL,te.Type.SET,!0,r.signerInfos)),te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.OID,!1,te.oidToDer(r.type).getBytes()),a])},"toAsn1"),addSigner:o(function(n){var s=n.issuer,i=n.serialNumber;if(n.certificate){var a=n.certificate;typeof a=="string"&&(a=ze.pki.certificateFromPem(a)),s=a.issuer.attributes,i=a.serialNumber}var u=n.key;if(!u)throw new Error("Could not add PKCS#7 signer; no private key specified.");typeof u=="string"&&(u=ze.pki.privateKeyFromPem(u));var c=n.digestAlgorithm||ze.pki.oids.sha1;switch(c){case ze.pki.oids.sha1:case ze.pki.oids.sha256:case ze.pki.oids.sha384:case ze.pki.oids.sha512:case ze.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+c)}var f=n.authenticatedAttributes||[];if(f.length>0){for(var h=!1,m=!1,g=0;g<f.length;++g){var x=f[g];if(!h&&x.type===ze.pki.oids.contentType){if(h=!0,m)break;continue}if(!m&&x.type===ze.pki.oids.messageDigest){if(m=!0,h)break;continue}}if(!h||!m)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.")}r.signers.push({key:u,version:1,issuer:s,serialNumber:i,digestAlgorithm:c,signatureAlgorithm:ze.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:f,unauthenticatedAttributes:[]})},"addSigner"),sign:o(function(n){if(n=n||{},(typeof r.content!="object"||r.contentInfo===null)&&(r.contentInfo=te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.OID,!1,te.oidToDer(ze.pki.oids.data).getBytes())]),"content"in r)){var s;r.content instanceof ze.util.ByteBuffer?s=r.content.bytes():typeof r.content=="string"&&(s=ze.util.encodeUtf8(r.content)),n.detached?r.detachedContent=te.create(te.Class.UNIVERSAL,te.Type.OCTETSTRING,!1,s):r.contentInfo.value.push(te.create(te.Class.CONTEXT_SPECIFIC,0,!0,[te.create(te.Class.UNIVERSAL,te.Type.OCTETSTRING,!1,s)]))}if(r.signers.length!==0){var i=e();t(i)}},"sign"),verify:o(function(){throw new Error("PKCS#7 signature verification not yet implemented.")},"verify"),addCertificate:o(function(n){typeof n=="string"&&(n=ze.pki.certificateFromPem(n)),r.certificates.push(n)},"addCertificate"),addCertificateRevokationList:o(function(n){throw new Error("PKCS#7 CRL support not yet implemented.")},"addCertificateRevokationList")},r;function e(){for(var n={},s=0;s<r.signers.length;++s){var i=r.signers[s],a=i.digestAlgorithm;a in n||(n[a]=ze.md[ze.pki.oids[a]].create()),i.authenticatedAttributes.length===0?i.md=n[a]:i.md=ze.md[ze.pki.oids[a]].create()}r.digestAlgorithmIdentifiers=[];for(var a in n)r.digestAlgorithmIdentifiers.push(te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.OID,!1,te.oidToDer(a).getBytes()),te.create(te.Class.UNIVERSAL,te.Type.NULL,!1,"")]));return n}o(e,"addDigestAlgorithmIds");function t(n){var s;if(r.detachedContent?s=r.detachedContent:(s=r.contentInfo.value[1],s=s.value[0]),!s)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var i=te.derToOid(r.contentInfo.value[0].value),a=te.toDer(s);a.getByte(),te.getBerValueLength(a),a=a.getBytes();for(var u in n)n[u].start().update(a);for(var c=new Date,f=0;f<r.signers.length;++f){var h=r.signers[f];if(h.authenticatedAttributes.length===0){if(i!==ze.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{h.authenticatedAttributesAsn1=te.create(te.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var m=te.create(te.Class.UNIVERSAL,te.Type.SET,!0,[]),g=0;g<h.authenticatedAttributes.length;++g){var x=h.authenticatedAttributes[g];x.type===ze.pki.oids.messageDigest?x.value=n[h.digestAlgorithm].digest():x.type===ze.pki.oids.signingTime&&(x.value||(x.value=c)),m.value.push(jN(x)),h.authenticatedAttributesAsn1.value.push(jN(x))}a=te.toDer(m).getBytes(),h.md.start().update(a)}h.signature=h.key.sign(h.md,"RSASSA-PKCS1-V1_5")}r.signerInfos=sZ(r.signers)}o(t,"addSignerInfos")};xs.createEncryptedData=function(){var r=null;return r={type:ze.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:ze.pki.oids["aes256-CBC"]},fromAsn1:o(function(e){MN(r,e,xs.asn1.encryptedDataValidator)},"fromAsn1"),decrypt:o(function(e){e!==void 0&&(r.encryptedContent.key=e),$k(r)},"decrypt")},r};xs.createEnvelopedData=function(){var r=null;return r={type:ze.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:ze.pki.oids["aes256-CBC"]},fromAsn1:o(function(e){var t=MN(r,e,xs.asn1.envelopedDataValidator);r.recipients=tZ(t.recipientInfos.value)},"fromAsn1"),toAsn1:o(function(){return te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.OID,!1,te.oidToDer(r.type).getBytes()),te.create(te.Class.CONTEXT_SPECIFIC,0,!0,[te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.INTEGER,!1,te.integerToDer(r.version).getBytes()),te.create(te.Class.UNIVERSAL,te.Type.SET,!0,rZ(r.recipients)),te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,iZ(r.encryptedContent))])])])},"toAsn1"),findRecipient:o(function(e){for(var t=e.issuer.attributes,n=0;n<r.recipients.length;++n){var s=r.recipients[n],i=s.issuer;if(s.serialNumber===e.serialNumber&&i.length===t.length){for(var a=!0,u=0;u<t.length;++u)if(i[u].type!==t[u].type||i[u].value!==t[u].value){a=!1;break}if(a)return s}}return null},"findRecipient"),decrypt:o(function(e,t){if(r.encryptedContent.key===void 0&&e!==void 0&&t!==void 0)switch(e.encryptedContent.algorithm){case ze.pki.oids.rsaEncryption:case ze.pki.oids.desCBC:var n=t.decrypt(e.encryptedContent.content);r.encryptedContent.key=ze.util.createBuffer(n);break;default:throw new Error("Unsupported asymmetric cipher, OID "+e.encryptedContent.algorithm)}$k(r)},"decrypt"),addRecipient:o(function(e){r.recipients.push({version:0,issuer:e.issuer.attributes,serialNumber:e.serialNumber,encryptedContent:{algorithm:ze.pki.oids.rsaEncryption,key:e.publicKey}})},"addRecipient"),encrypt:o(function(e,t){if(r.encryptedContent.content===void 0){t=t||r.encryptedContent.algorithm,e=e||r.encryptedContent.key;var n,s,i;switch(t){case ze.pki.oids["aes128-CBC"]:n=16,s=16,i=ze.aes.createEncryptionCipher;break;case ze.pki.oids["aes192-CBC"]:n=24,s=16,i=ze.aes.createEncryptionCipher;break;case ze.pki.oids["aes256-CBC"]:n=32,s=16,i=ze.aes.createEncryptionCipher;break;case ze.pki.oids["des-EDE3-CBC"]:n=24,s=8,i=ze.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+t)}if(e===void 0)e=ze.util.createBuffer(ze.random.getBytes(n));else if(e.length()!=n)throw new Error("Symmetric key has wrong length; got "+e.length()+" bytes, expected "+n+".");r.encryptedContent.algorithm=t,r.encryptedContent.key=e,r.encryptedContent.parameter=ze.util.createBuffer(ze.random.getBytes(s));var a=i(e);if(a.start(r.encryptedContent.parameter.copy()),a.update(r.content),!a.finish())throw new Error("Symmetric encryption failed.");r.encryptedContent.content=a.output}for(var u=0;u<r.recipients.length;++u){var c=r.recipients[u];if(c.encryptedContent.content===void 0)switch(c.encryptedContent.algorithm){case ze.pki.oids.rsaEncryption:c.encryptedContent.content=c.encryptedContent.key.encrypt(r.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+c.encryptedContent.algorithm)}}},"encrypt")},r};function ZQ(r){var e={},t=[];if(!te.validate(r,xs.asn1.recipientInfoValidator,e,t)){var n=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw n.errors=t,n}return{version:e.version.charCodeAt(0),issuer:ze.pki.RDNAttributesAsArray(e.issuer),serialNumber:ze.util.createBuffer(e.serial).toHex(),encryptedContent:{algorithm:te.derToOid(e.encAlgorithm),parameter:e.encParameter?e.encParameter.value:void 0,content:e.encKey}}}o(ZQ,"_recipientFromAsn1");function eZ(r){return te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.INTEGER,!1,te.integerToDer(r.version).getBytes()),te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[ze.pki.distinguishedNameToAsn1({attributes:r.issuer}),te.create(te.Class.UNIVERSAL,te.Type.INTEGER,!1,ze.util.hexToBytes(r.serialNumber))]),te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.OID,!1,te.oidToDer(r.encryptedContent.algorithm).getBytes()),te.create(te.Class.UNIVERSAL,te.Type.NULL,!1,"")]),te.create(te.Class.UNIVERSAL,te.Type.OCTETSTRING,!1,r.encryptedContent.content)])}o(eZ,"_recipientToAsn1");function tZ(r){for(var e=[],t=0;t<r.length;++t)e.push(ZQ(r[t]));return e}o(tZ,"_recipientsFromAsn1");function rZ(r){for(var e=[],t=0;t<r.length;++t)e.push(eZ(r[t]));return e}o(rZ,"_recipientsToAsn1");function nZ(r){var e=te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.INTEGER,!1,te.integerToDer(r.version).getBytes()),te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[ze.pki.distinguishedNameToAsn1({attributes:r.issuer}),te.create(te.Class.UNIVERSAL,te.Type.INTEGER,!1,ze.util.hexToBytes(r.serialNumber))]),te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.OID,!1,te.oidToDer(r.digestAlgorithm).getBytes()),te.create(te.Class.UNIVERSAL,te.Type.NULL,!1,"")])]);if(r.authenticatedAttributesAsn1&&e.value.push(r.authenticatedAttributesAsn1),e.value.push(te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.OID,!1,te.oidToDer(r.signatureAlgorithm).getBytes()),te.create(te.Class.UNIVERSAL,te.Type.NULL,!1,"")])),e.value.push(te.create(te.Class.UNIVERSAL,te.Type.OCTETSTRING,!1,r.signature)),r.unauthenticatedAttributes.length>0){for(var t=te.create(te.Class.CONTEXT_SPECIFIC,1,!0,[]),n=0;n<r.unauthenticatedAttributes.length;++n){var s=r.unauthenticatedAttributes[n];t.values.push(jN(s))}e.value.push(t)}return e}o(nZ,"_signerToAsn1");function sZ(r){for(var e=[],t=0;t<r.length;++t)e.push(nZ(r[t]));return e}o(sZ,"_signersToAsn1");function jN(r){var e;if(r.type===ze.pki.oids.contentType)e=te.create(te.Class.UNIVERSAL,te.Type.OID,!1,te.oidToDer(r.value).getBytes());else if(r.type===ze.pki.oids.messageDigest)e=te.create(te.Class.UNIVERSAL,te.Type.OCTETSTRING,!1,r.value.bytes());else if(r.type===ze.pki.oids.signingTime){var t=new Date("1950-01-01T00:00:00Z"),n=new Date("2050-01-01T00:00:00Z"),s=r.value;if(typeof s=="string"){var i=Date.parse(s);isNaN(i)?s.length===13?s=te.utcTimeToDate(s):s=te.generalizedTimeToDate(s):s=new Date(i)}s>=t&&s<n?e=te.create(te.Class.UNIVERSAL,te.Type.UTCTIME,!1,te.dateToUtcTime(s)):e=te.create(te.Class.UNIVERSAL,te.Type.GENERALIZEDTIME,!1,te.dateToGeneralizedTime(s))}return te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.OID,!1,te.oidToDer(r.type).getBytes()),te.create(te.Class.UNIVERSAL,te.Type.SET,!0,[e])])}o(jN,"_attributeToAsn1");function iZ(r){return[te.create(te.Class.UNIVERSAL,te.Type.OID,!1,te.oidToDer(ze.pki.oids.data).getBytes()),te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.OID,!1,te.oidToDer(r.algorithm).getBytes()),r.parameter?te.create(te.Class.UNIVERSAL,te.Type.OCTETSTRING,!1,r.parameter.getBytes()):void 0]),te.create(te.Class.CONTEXT_SPECIFIC,0,!0,[te.create(te.Class.UNIVERSAL,te.Type.OCTETSTRING,!1,r.content.getBytes())])]}o(iZ,"_encryptedContentToAsn1");function MN(r,e,t){var n={},s=[];if(!te.validate(e,t,n,s)){var i=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw i.errors=i,i}var a=te.derToOid(n.contentType);if(a!==ze.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(n.encryptedContent){var u="";if(ze.util.isArray(n.encryptedContent))for(var c=0;c<n.encryptedContent.length;++c){if(n.encryptedContent[c].type!==te.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");u+=n.encryptedContent[c].value}else u=n.encryptedContent;r.encryptedContent={algorithm:te.derToOid(n.encAlgorithm),parameter:ze.util.createBuffer(n.encParameter.value),content:ze.util.createBuffer(u)}}if(n.content){var u="";if(ze.util.isArray(n.content))for(var c=0;c<n.content.length;++c){if(n.content[c].type!==te.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");u+=n.content[c].value}else u=n.content;r.content=ze.util.createBuffer(u)}return r.version=n.version.charCodeAt(0),r.rawCapture=n,n}o(MN,"_fromAsn1");function $k(r){if(r.encryptedContent.key===void 0)throw new Error("Symmetric key not available.");if(r.content===void 0){var e;switch(r.encryptedContent.algorithm){case ze.pki.oids["aes128-CBC"]:case ze.pki.oids["aes192-CBC"]:case ze.pki.oids["aes256-CBC"]:e=ze.aes.createDecryptionCipher(r.encryptedContent.key);break;case ze.pki.oids.desCBC:case ze.pki.oids["des-EDE3-CBC"]:e=ze.des.createDecryptionCipher(r.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+r.encryptedContent.algorithm)}if(e.start(r.encryptedContent.parameter),e.update(r.encryptedContent.content),!e.finish())throw new Error("Symmetric decryption failed.");r.content=e.output}}o($k,"_decryptContent")});var zk=Z((zde,Wk)=>{"use strict";var dn=$t();Pu();ap();xw();lp();lr();var qw=Wk.exports=dn.ssh=dn.ssh||{};qw.privateKeyToPutty=function(r,e,t){t=t||"",e=e||"";var n="ssh-rsa",s=e===""?"none":"aes256-cbc",i="PuTTY-User-Key-File-2: "+n+`\r
15
+ `+u+e.substr(a+1),i=s-a-1,a=-1,++s}else(e[s]===" "||e[s]===" "||e[s]===",")&&(a=s);return e}o(ww,"foldHeader");function Pz(r){return r.replace(/^\s+/,"")}o(Pz,"ltrim")});var Y0=Z((zpe,u3)=>{"use strict";var Hr=$t();hw();K2();lr();u3.exports=Hr.des=Hr.des||{};Hr.des.startEncrypting=function(r,e,t,n){var s=bw({key:r,output:t,decrypt:!1,mode:n||(e===null?"ECB":"CBC")});return s.start(e),s};Hr.des.createEncryptionCipher=function(r,e){return bw({key:r,output:null,decrypt:!1,mode:e})};Hr.des.startDecrypting=function(r,e,t,n){var s=bw({key:r,output:t,decrypt:!0,mode:n||(e===null?"ECB":"CBC")});return s.start(e),s};Hr.des.createDecryptionCipher=function(r,e){return bw({key:r,output:null,decrypt:!0,mode:e})};Hr.des.Algorithm=function(r,e){var t=this;t.name=r,t.mode=new e({blockSize:8,cipher:{encrypt:o(function(n,s){return o3(t._keys,n,s,!1)},"encrypt"),decrypt:o(function(n,s){return o3(t._keys,n,s,!0)},"decrypt")}}),t._init=!1};Hr.des.Algorithm.prototype.initialize=function(r){if(!this._init){var e=Hr.util.createBuffer(r.key);if(this.name.indexOf("3DES")===0&&e.length()!==24)throw new Error("Invalid Triple-DES key size: "+e.length()*8);this._keys=qz(e),this._init=!0}};Ba("DES-ECB",Hr.cipher.modes.ecb);Ba("DES-CBC",Hr.cipher.modes.cbc);Ba("DES-CFB",Hr.cipher.modes.cfb);Ba("DES-OFB",Hr.cipher.modes.ofb);Ba("DES-CTR",Hr.cipher.modes.ctr);Ba("3DES-ECB",Hr.cipher.modes.ecb);Ba("3DES-CBC",Hr.cipher.modes.cbc);Ba("3DES-CFB",Hr.cipher.modes.cfb);Ba("3DES-OFB",Hr.cipher.modes.ofb);Ba("3DES-CTR",Hr.cipher.modes.ctr);function Ba(r,e){var t=o(function(){return new Hr.des.Algorithm(r,e)},"factory");Hr.cipher.registerAlgorithm(r,t)}o(Ba,"registerAlgorithm");var Oz=[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],kz=[-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],Lz=[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],Vz=[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],Uz=[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],jz=[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],Mz=[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],Fz=[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 qz(r){for(var e=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],t=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],s=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],i=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],a=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],u=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],c=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],f=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],h=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],m=[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],x=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],v=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],w=r.length()>8?3:1,S=[],A=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],T=0,b,E=0;E<w;E++){var C=r.getInt32(),_=r.getInt32();b=(C>>>4^_)&252645135,_^=b,C^=b<<4,b=(_>>>-16^C)&65535,C^=b,_^=b<<-16,b=(C>>>2^_)&858993459,_^=b,C^=b<<2,b=(_>>>-16^C)&65535,C^=b,_^=b<<-16,b=(C>>>1^_)&1431655765,_^=b,C^=b<<1,b=(_>>>8^C)&16711935,C^=b,_^=b<<8,b=(C>>>1^_)&1431655765,_^=b,C^=b<<1,b=C<<8|_>>>20&240,C=_<<24|_<<8&16711680|_>>>8&65280|_>>>24&240,_=b;for(var F=0;F<A.length;++F){A[F]?(C=C<<2|C>>>26,_=_<<2|_>>>26):(C=C<<1|C>>>27,_=_<<1|_>>>27),C&=-15,_&=-15;var R=e[C>>>28]|t[C>>>24&15]|n[C>>>20&15]|s[C>>>16&15]|i[C>>>12&15]|a[C>>>8&15]|u[C>>>4&15],q=c[_>>>28]|f[_>>>24&15]|h[_>>>20&15]|m[_>>>16&15]|g[_>>>12&15]|x[_>>>8&15]|v[_>>>4&15];b=(q>>>16^R)&65535,S[T++]=R^b,S[T++]=q^b<<16}}return S}o(qz,"_createKeys");function o3(r,e,t,n){var s=r.length===32?3:9,i;s===3?i=n?[30,-2,-2]:[0,32,2]:i=n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var a,u=e[0],c=e[1];a=(u>>>4^c)&252645135,c^=a,u^=a<<4,a=(u>>>16^c)&65535,c^=a,u^=a<<16,a=(c>>>2^u)&858993459,u^=a,c^=a<<2,a=(c>>>8^u)&16711935,u^=a,c^=a<<8,a=(u>>>1^c)&1431655765,c^=a,u^=a<<1,u=u<<1|u>>>31,c=c<<1|c>>>31;for(var f=0;f<s;f+=3){for(var h=i[f+1],m=i[f+2],g=i[f];g!=h;g+=m){var x=c^r[g],v=(c>>>4|c<<28)^r[g+1];a=u,u=c,c=a^(kz[x>>>24&63]|Vz[x>>>16&63]|jz[x>>>8&63]|Fz[x&63]|Oz[v>>>24&63]|Lz[v>>>16&63]|Uz[v>>>8&63]|Mz[v&63])}a=u,u=c,c=a}u=u>>>1|u<<31,c=c>>>1|c<<31,a=(u>>>1^c)&1431655765,c^=a,u^=a<<1,a=(c>>>8^u)&16711935,u^=a,c^=a<<8,a=(c>>>2^u)&858993459,u^=a,c^=a<<2,a=(u>>>16^c)&65535,c^=a,u^=a<<16,a=(u>>>4^c)&252645135,c^=a,u^=a<<4,t[0]=u,t[1]=c}o(o3,"_updateBlock");function bw(r){r=r||{};var e=(r.mode||"CBC").toUpperCase(),t="DES-"+e,n;r.decrypt?n=Hr.cipher.createDecipher(t,r.key):n=Hr.cipher.createCipher(t,r.key);var s=n.start;return n.start=function(i,a){var u=null;a instanceof Hr.util.ByteBuffer&&(u=a,a={}),a=a||{},a.output=u,a.iv=i,s.call(n,a)},n}o(bw,"_createCipher")});var Ew=Z((Ype,c3)=>{"use strict";var vs=$t();ap();Ia();lr();var Hz=vs.pkcs5=vs.pkcs5||{},No;vs.util.isNodejs&&!vs.options.usePureJavaScript&&(No=Xe("crypto"));c3.exports=vs.pbkdf2=Hz.pbkdf2=function(r,e,t,n,s,i){if(typeof s=="function"&&(i=s,s=null),vs.util.isNodejs&&!vs.options.usePureJavaScript&&No.pbkdf2&&(s===null||typeof s!="object")&&(No.pbkdf2Sync.length>4||!s||s==="sha1"))return typeof s!="string"&&(s="sha1"),r=Buffer.from(r,"binary"),e=Buffer.from(e,"binary"),i?No.pbkdf2Sync.length===4?No.pbkdf2(r,e,t,n,function(b,E){if(b)return i(b);i(null,E.toString("binary"))}):No.pbkdf2(r,e,t,n,s,function(b,E){if(b)return i(b);i(null,E.toString("binary"))}):No.pbkdf2Sync.length===4?No.pbkdf2Sync(r,e,t,n).toString("binary"):No.pbkdf2Sync(r,e,t,n,s).toString("binary");if((typeof s>"u"||s===null)&&(s="sha1"),typeof s=="string"){if(!(s in vs.md.algorithms))throw new Error("Unknown hash algorithm: "+s);s=vs.md[s].create()}var a=s.digestLength;if(n>4294967295*a){var u=new Error("Derived key is too long.");if(i)return i(u);throw u}var c=Math.ceil(n/a),f=n-(c-1)*a,h=vs.hmac.create();h.start(s,r);var m="",g,x,v;if(!i){for(var w=1;w<=c;++w){h.start(null,null),h.update(e),h.update(vs.util.int32ToBytes(w)),g=v=h.digest().getBytes();for(var S=2;S<=t;++S)h.start(null,null),h.update(v),x=h.digest().getBytes(),g=vs.util.xorBytes(g,x,a),v=x;m+=w<c?g:g.substr(0,f)}return m}var w=1,S;function A(){if(w>c)return i(null,m);h.start(null,null),h.update(e),h.update(vs.util.int32ToBytes(w)),g=v=h.digest().getBytes(),S=2,T()}o(A,"outer");function T(){if(S<=t)return h.start(null,null),h.update(v),x=h.digest().getBytes(),g=vs.util.xorBytes(g,x,a),v=x,++S,vs.util.setImmediate(T);m+=w<c?g:g.substr(0,f),++w,A()}o(T,"inner"),A()}});var Y2=Z((Zpe,d3)=>{"use strict";var Da=$t();Ia();lr();var f3=d3.exports=Da.sha256=Da.sha256||{};Da.md.sha256=Da.md.algorithms.sha256=f3;f3.create=function(){h3||Kz();var r=null,e=Da.util.createBuffer(),t=new Array(64),n={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var s=n.messageLengthSize/4,i=0;i<s;++i)n.fullMessageLength.push(0);return e=Da.util.createBuffer(),r={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},n},n.start(),n.update=function(s,i){i==="utf8"&&(s=Da.util.encodeUtf8(s));var a=s.length;n.messageLength+=a,a=[a/4294967296>>>0,a>>>0];for(var u=n.fullMessageLength.length-1;u>=0;--u)n.fullMessageLength[u]+=a[1],a[1]=a[0]+(n.fullMessageLength[u]/4294967296>>>0),n.fullMessageLength[u]=n.fullMessageLength[u]>>>0,a[0]=a[1]/4294967296>>>0;return e.putBytes(s),l3(r,t,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var s=Da.util.createBuffer();s.putBytes(e.bytes());var i=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,a=i&n.blockLength-1;s.putBytes(J2.substr(0,n.blockLength-a));for(var u,c,f=n.fullMessageLength[0]*8,h=0;h<n.fullMessageLength.length-1;++h)u=n.fullMessageLength[h+1]*8,c=u/4294967296>>>0,f+=c,s.putInt32(f>>>0),f=u>>>0;s.putInt32(f);var m={h0:r.h0,h1:r.h1,h2:r.h2,h3:r.h3,h4:r.h4,h5:r.h5,h6:r.h6,h7:r.h7};l3(m,t,s);var g=Da.util.createBuffer();return g.putInt32(m.h0),g.putInt32(m.h1),g.putInt32(m.h2),g.putInt32(m.h3),g.putInt32(m.h4),g.putInt32(m.h5),g.putInt32(m.h6),g.putInt32(m.h7),g},n};var J2=null,h3=!1,p3=null;function Kz(){J2="\x80",J2+=Da.util.fillString("\0",64),p3=[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],h3=!0}o(Kz,"_init");function l3(r,e,t){for(var n,s,i,a,u,c,f,h,m,g,x,v,w,S,A,T=t.length();T>=64;){for(f=0;f<16;++f)e[f]=t.getInt32();for(;f<64;++f)n=e[f-2],n=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,s=e[f-15],s=(s>>>7|s<<25)^(s>>>18|s<<14)^s>>>3,e[f]=n+e[f-7]+s+e[f-16]|0;for(h=r.h0,m=r.h1,g=r.h2,x=r.h3,v=r.h4,w=r.h5,S=r.h6,A=r.h7,f=0;f<64;++f)a=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),u=S^v&(w^S),i=(h>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),c=h&m|g&(h^m),n=A+a+u+p3[f]+e[f],s=i+c,A=S,S=w,w=v,v=x+n>>>0,x=g,g=m,m=h,h=n+s>>>0;r.h0=r.h0+h|0,r.h1=r.h1+m|0,r.h2=r.h2+g|0,r.h3=r.h3+x|0,r.h4=r.h4+v|0,r.h5=r.h5+w|0,r.h6=r.h6+S|0,r.h7=r.h7+A|0,T-=64}}o(l3,"_update")});var Q2=Z((tde,m3)=>{"use strict";var Ra=$t();lr();var Aw=null;Ra.util.isNodejs&&!Ra.options.usePureJavaScript&&!process.versions["node-webkit"]&&(Aw=Xe("crypto"));var $z=m3.exports=Ra.prng=Ra.prng||{};$z.create=function(r){for(var e={plugin:r,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},t=r.md,n=new Array(32),s=0;s<32;++s)n[s]=t.create();e.pools=n,e.pool=0,e.generate=function(f,h){if(!h)return e.generateSync(f);var m=e.plugin.cipher,g=e.plugin.increment,x=e.plugin.formatKey,v=e.plugin.formatSeed,w=Ra.util.createBuffer();e.key=null,S();function S(A){if(A)return h(A);if(w.length()>=f)return h(null,w.getBytes(f));if(e.generated>1048575&&(e.key=null),e.key===null)return Ra.util.nextTick(function(){i(S)});var T=m(e.key,e.seed);e.generated+=T.length,w.putBytes(T),e.key=x(m(e.key,g(e.seed))),e.seed=v(m(e.key,e.seed)),Ra.util.setImmediate(S)}o(S,"generate")},e.generateSync=function(f){var h=e.plugin.cipher,m=e.plugin.increment,g=e.plugin.formatKey,x=e.plugin.formatSeed;e.key=null;for(var v=Ra.util.createBuffer();v.length()<f;){e.generated>1048575&&(e.key=null),e.key===null&&a();var w=h(e.key,e.seed);e.generated+=w.length,v.putBytes(w),e.key=g(h(e.key,m(e.seed))),e.seed=x(h(e.key,e.seed))}return v.getBytes(f)};function i(f){if(e.pools[0].messageLength>=32)return u(),f();var h=32-e.pools[0].messageLength<<5;e.seedFile(h,function(m,g){if(m)return f(m);e.collect(g),u(),f()})}o(i,"_reseed");function a(){if(e.pools[0].messageLength>=32)return u();var f=32-e.pools[0].messageLength<<5;e.collect(e.seedFileSync(f)),u()}o(a,"_reseedSync");function u(){e.reseeds=e.reseeds===4294967295?0:e.reseeds+1;var f=e.plugin.md.create();f.update(e.keyBytes);for(var h=1,m=0;m<32;++m)e.reseeds%h===0&&(f.update(e.pools[m].digest().getBytes()),e.pools[m].start()),h=h<<1;e.keyBytes=f.digest().getBytes(),f.start(),f.update(e.keyBytes);var g=f.digest().getBytes();e.key=e.plugin.formatKey(e.keyBytes),e.seed=e.plugin.formatSeed(g),e.generated=0}o(u,"_seed");function c(f){var h=null,m=Ra.util.globalScope,g=m.crypto||m.msCrypto;g&&g.getRandomValues&&(h=o(function(C){return g.getRandomValues(C)},"getRandomValues"));var x=Ra.util.createBuffer();if(h)for(;x.length()<f;){var v=Math.max(1,Math.min(f-x.length(),65536)/4),w=new Uint32Array(Math.floor(v));try{h(w);for(var S=0;S<w.length;++S)x.putInt32(w[S])}catch(C){if(!(typeof QuotaExceededError<"u"&&C instanceof QuotaExceededError))throw C}}if(x.length()<f)for(var A,T,b,E=Math.floor(Math.random()*65536);x.length()<f;){T=16807*(E&65535),A=16807*(E>>16),T+=(A&32767)<<16,T+=A>>15,T=(T&2147483647)+(T>>31),E=T&4294967295;for(var S=0;S<3;++S)b=E>>>(S<<3),b^=Math.floor(Math.random()*256),x.putByte(b&255)}return x.getBytes(f)}return o(c,"defaultSeedFile"),Aw?(e.seedFile=function(f,h){Aw.randomBytes(f,function(m,g){if(m)return h(m);h(null,g.toString())})},e.seedFileSync=function(f){return Aw.randomBytes(f).toString()}):(e.seedFile=function(f,h){try{h(null,c(f))}catch(m){h(m)}},e.seedFileSync=c),e.collect=function(f){for(var h=f.length,m=0;m<h;++m)e.pools[e.pool].update(f.substr(m,1)),e.pool=e.pool===31?0:e.pool+1},e.collectInt=function(f,h){for(var m="",g=0;g<h;g+=8)m+=String.fromCharCode(f>>g&255);e.collect(m)},e.registerWorker=function(f){if(f===self)e.seedFile=function(m,g){function x(v){var w=v.data;w.forge&&w.forge.prng&&(self.removeEventListener("message",x),g(w.forge.prng.err,w.forge.prng.bytes))}o(x,"listener"),self.addEventListener("message",x),self.postMessage({forge:{prng:{needed:m}}})};else{var h=o(function(m){var g=m.data;g.forge&&g.forge.prng&&e.seedFile(g.forge.prng.needed,function(x,v){f.postMessage({forge:{prng:{err:x,bytes:v}}})})},"listener");f.addEventListener("message",h)}},e}});var bi=Z((nde,Z2)=>{"use strict";var _n=$t();Ru();Y2();Q2();lr();(function(){if(_n.random&&_n.random.getBytes){Z2.exports=_n.random;return}(function(r){var e={},t=new Array(4),n=_n.util.createBuffer();e.formatKey=function(m){var g=_n.util.createBuffer(m);return m=new Array(4),m[0]=g.getInt32(),m[1]=g.getInt32(),m[2]=g.getInt32(),m[3]=g.getInt32(),_n.aes._expandKey(m,!1)},e.formatSeed=function(m){var g=_n.util.createBuffer(m);return m=new Array(4),m[0]=g.getInt32(),m[1]=g.getInt32(),m[2]=g.getInt32(),m[3]=g.getInt32(),m},e.cipher=function(m,g){return _n.aes._updateBlock(m,g,t,!1),n.putInt32(t[0]),n.putInt32(t[1]),n.putInt32(t[2]),n.putInt32(t[3]),n.getBytes()},e.increment=function(m){return++m[3],m},e.md=_n.md.sha256;function s(){var m=_n.prng.create(e);return m.getBytes=function(g,x){return m.generate(g,x)},m.getBytesSync=function(g){return m.generate(g)},m}o(s,"spawnPrng");var i=s(),a=null,u=_n.util.globalScope,c=u.crypto||u.msCrypto;if(c&&c.getRandomValues&&(a=o(function(m){return c.getRandomValues(m)},"getRandomValues")),_n.options.usePureJavaScript||!_n.util.isNodejs&&!a){if(typeof window>"u"||window.document,i.collectInt(+new Date,32),typeof navigator<"u"){var f="";for(var h in navigator)try{typeof navigator[h]=="string"&&(f+=navigator[h])}catch{}i.collect(f),f=null}r&&(r().mousemove(function(m){i.collectInt(m.clientX,16),i.collectInt(m.clientY,16)}),r().keypress(function(m){i.collectInt(m.charCode,8)}))}if(!_n.random)_n.random=i;else for(var h in i)_n.random[h]=i[h];_n.random.createInstance=s,Z2.exports=_n.random})(typeof jQuery<"u"?jQuery:null)})()});var tN=Z((ide,y3)=>{"use strict";var _s=$t();lr();var eN=[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],g3=[1,2,3,5],Gz=o(function(r,e){return r<<e&65535|(r&65535)>>16-e},"rol"),Xz=o(function(r,e){return(r&65535)>>e|r<<16-e&65535},"ror");y3.exports=_s.rc2=_s.rc2||{};_s.rc2.expandKey=function(r,e){typeof r=="string"&&(r=_s.util.createBuffer(r)),e=e||128;var t=r,n=r.length(),s=e,i=Math.ceil(s/8),a=255>>(s&7),u;for(u=n;u<128;u++)t.putByte(eN[t.at(u-1)+t.at(u-n)&255]);for(t.setAt(128-i,eN[t.at(128-i)&a]),u=127-i;u>=0;u--)t.setAt(u,eN[t.at(u+1)^t.at(u+i)]);return t};var v3=o(function(r,e,t){var n=!1,s=null,i=null,a=null,u,c,f,h,m=[];for(r=_s.rc2.expandKey(r,e),f=0;f<64;f++)m.push(r.getInt16Le());t?(u=o(function(v){for(f=0;f<4;f++)v[f]+=m[h]+(v[(f+3)%4]&v[(f+2)%4])+(~v[(f+3)%4]&v[(f+1)%4]),v[f]=Gz(v[f],g3[f]),h++},"mixRound"),c=o(function(v){for(f=0;f<4;f++)v[f]+=m[v[(f+3)%4]&63]},"mashRound")):(u=o(function(v){for(f=3;f>=0;f--)v[f]=Xz(v[f],g3[f]),v[f]-=m[h]+(v[(f+3)%4]&v[(f+2)%4])+(~v[(f+3)%4]&v[(f+1)%4]),h--},"mixRound"),c=o(function(v){for(f=3;f>=0;f--)v[f]-=m[v[(f+3)%4]&63]},"mashRound"));var g=o(function(v){var w=[];for(f=0;f<4;f++){var S=s.getInt16Le();a!==null&&(t?S^=a.getInt16Le():a.putInt16Le(S)),w.push(S&65535)}h=t?0:63;for(var A=0;A<v.length;A++)for(var T=0;T<v[A][0];T++)v[A][1](w);for(f=0;f<4;f++)a!==null&&(t?a.putInt16Le(w[f]):w[f]^=a.getInt16Le()),i.putInt16Le(w[f])},"runPlan"),x=null;return x={start:o(function(v,w){v&&typeof v=="string"&&(v=_s.util.createBuffer(v)),n=!1,s=_s.util.createBuffer(),i=w||new _s.util.createBuffer,a=v,x.output=i},"start"),update:o(function(v){for(n||s.putBuffer(v);s.length()>=8;)g([[5,u],[1,c],[6,u],[1,c],[5,u]])},"update"),finish:o(function(v){var w=!0;if(t)if(v)w=v(8,s,!t);else{var S=s.length()===8?8:8-s.length();s.fillWithByte(S,S)}if(w&&(n=!0,x.update()),!t&&(w=s.length()===0,w))if(v)w=v(8,i,!t);else{var A=i.length(),T=i.at(A-1);T>A?w=!1:i.truncate(T)}return w},"finish")},x},"createCipher");_s.rc2.startEncrypting=function(r,e,t){var n=_s.rc2.createEncryptionCipher(r,128);return n.start(e,t),n};_s.rc2.createEncryptionCipher=function(r,e){return v3(r,e,!0)};_s.rc2.startDecrypting=function(r,e,t){var n=_s.rc2.createDecryptionCipher(r,128);return n.start(e,t),n};_s.rc2.createDecryptionCipher=function(r,e){return v3(r,e,!1)}});var Z0=Z((ode,N3)=>{"use strict";var rN=$t();N3.exports=rN.jsbn=rN.jsbn||{};var To,Wz=0xdeadbeefcafe,x3=(Wz&16777215)==15715070;function Oe(r,e,t){this.data=[],r!=null&&(typeof r=="number"?this.fromNumber(r,e,t):e==null&&typeof r!="string"?this.fromString(r,256):this.fromString(r,e))}o(Oe,"BigInteger");rN.jsbn.BigInteger=Oe;function fr(){return new Oe(null)}o(fr,"nbi");function zz(r,e,t,n,s,i){for(;--i>=0;){var a=e*this.data[r++]+t.data[n]+s;s=Math.floor(a/67108864),t.data[n++]=a&67108863}return s}o(zz,"am1");function Jz(r,e,t,n,s,i){for(var a=e&32767,u=e>>15;--i>=0;){var c=this.data[r]&32767,f=this.data[r++]>>15,h=u*c+f*a;c=a*c+((h&32767)<<15)+t.data[n]+(s&1073741823),s=(c>>>30)+(h>>>15)+u*f+(s>>>30),t.data[n++]=c&1073741823}return s}o(Jz,"am2");function w3(r,e,t,n,s,i){for(var a=e&16383,u=e>>14;--i>=0;){var c=this.data[r]&16383,f=this.data[r++]>>14,h=u*c+f*a;c=a*c+((h&16383)<<14)+t.data[n]+s,s=(c>>28)+(h>>14)+u*f,t.data[n++]=c&268435455}return s}o(w3,"am3");typeof navigator>"u"?(Oe.prototype.am=w3,To=28):x3&&navigator.appName=="Microsoft Internet Explorer"?(Oe.prototype.am=Jz,To=30):x3&&navigator.appName!="Netscape"?(Oe.prototype.am=zz,To=26):(Oe.prototype.am=w3,To=28);Oe.prototype.DB=To;Oe.prototype.DM=(1<<To)-1;Oe.prototype.DV=1<<To;var nN=52;Oe.prototype.FV=Math.pow(2,nN);Oe.prototype.F1=nN-To;Oe.prototype.F2=2*To-nN;var Yz="0123456789abcdefghijklmnopqrstuvwxyz",Cw=new Array,up,Ei;up=48;for(Ei=0;Ei<=9;++Ei)Cw[up++]=Ei;up=97;for(Ei=10;Ei<36;++Ei)Cw[up++]=Ei;up=65;for(Ei=10;Ei<36;++Ei)Cw[up++]=Ei;function S3(r){return Yz.charAt(r)}o(S3,"int2char");function b3(r,e){var t=Cw[r.charCodeAt(e)];return t??-1}o(b3,"intAt");function Qz(r){for(var e=this.t-1;e>=0;--e)r.data[e]=this.data[e];r.t=this.t,r.s=this.s}o(Qz,"bnpCopyTo");function Zz(r){this.t=1,this.s=r<0?-1:0,r>0?this.data[0]=r:r<-1?this.data[0]=r+this.DV:this.t=0}o(Zz,"bnpFromInt");function Ou(r){var e=fr();return e.fromInt(r),e}o(Ou,"nbv");function eJ(r,e){var t;if(e==16)t=4;else if(e==8)t=3;else if(e==256)t=8;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else{this.fromRadix(r,e);return}this.t=0,this.s=0;for(var n=r.length,s=!1,i=0;--n>=0;){var a=t==8?r[n]&255:b3(r,n);if(a<0){r.charAt(n)=="-"&&(s=!0);continue}s=!1,i==0?this.data[this.t++]=a:i+t>this.DB?(this.data[this.t-1]|=(a&(1<<this.DB-i)-1)<<i,this.data[this.t++]=a>>this.DB-i):this.data[this.t-1]|=a<<i,i+=t,i>=this.DB&&(i-=this.DB)}t==8&&(r[0]&128)!=0&&(this.s=-1,i>0&&(this.data[this.t-1]|=(1<<this.DB-i)-1<<i)),this.clamp(),s&&Oe.ZERO.subTo(this,this)}o(eJ,"bnpFromString");function tJ(){for(var r=this.s&this.DM;this.t>0&&this.data[this.t-1]==r;)--this.t}o(tJ,"bnpClamp");function rJ(r){if(this.s<0)return"-"+this.negate().toString(r);var e;if(r==16)e=4;else if(r==8)e=3;else if(r==2)e=1;else if(r==32)e=5;else if(r==4)e=2;else return this.toRadix(r);var t=(1<<e)-1,n,s=!1,i="",a=this.t,u=this.DB-a*this.DB%e;if(a-- >0)for(u<this.DB&&(n=this.data[a]>>u)>0&&(s=!0,i=S3(n));a>=0;)u<e?(n=(this.data[a]&(1<<u)-1)<<e-u,n|=this.data[--a]>>(u+=this.DB-e)):(n=this.data[a]>>(u-=e)&t,u<=0&&(u+=this.DB,--a)),n>0&&(s=!0),s&&(i+=S3(n));return s?i:"0"}o(rJ,"bnToString");function nJ(){var r=fr();return Oe.ZERO.subTo(this,r),r}o(nJ,"bnNegate");function sJ(){return this.s<0?this.negate():this}o(sJ,"bnAbs");function iJ(r){var e=this.s-r.s;if(e!=0)return e;var t=this.t;if(e=t-r.t,e!=0)return this.s<0?-e:e;for(;--t>=0;)if((e=this.data[t]-r.data[t])!=0)return e;return 0}o(iJ,"bnCompareTo");function Nw(r){var e=1,t;return(t=r>>>16)!=0&&(r=t,e+=16),(t=r>>8)!=0&&(r=t,e+=8),(t=r>>4)!=0&&(r=t,e+=4),(t=r>>2)!=0&&(r=t,e+=2),(t=r>>1)!=0&&(r=t,e+=1),e}o(Nw,"nbits");function aJ(){return this.t<=0?0:this.DB*(this.t-1)+Nw(this.data[this.t-1]^this.s&this.DM)}o(aJ,"bnBitLength");function oJ(r,e){var t;for(t=this.t-1;t>=0;--t)e.data[t+r]=this.data[t];for(t=r-1;t>=0;--t)e.data[t]=0;e.t=this.t+r,e.s=this.s}o(oJ,"bnpDLShiftTo");function uJ(r,e){for(var t=r;t<this.t;++t)e.data[t-r]=this.data[t];e.t=Math.max(this.t-r,0),e.s=this.s}o(uJ,"bnpDRShiftTo");function cJ(r,e){var t=r%this.DB,n=this.DB-t,s=(1<<n)-1,i=Math.floor(r/this.DB),a=this.s<<t&this.DM,u;for(u=this.t-1;u>=0;--u)e.data[u+i+1]=this.data[u]>>n|a,a=(this.data[u]&s)<<t;for(u=i-1;u>=0;--u)e.data[u]=0;e.data[i]=a,e.t=this.t+i+1,e.s=this.s,e.clamp()}o(cJ,"bnpLShiftTo");function lJ(r,e){e.s=this.s;var t=Math.floor(r/this.DB);if(t>=this.t){e.t=0;return}var n=r%this.DB,s=this.DB-n,i=(1<<n)-1;e.data[0]=this.data[t]>>n;for(var a=t+1;a<this.t;++a)e.data[a-t-1]|=(this.data[a]&i)<<s,e.data[a-t]=this.data[a]>>n;n>0&&(e.data[this.t-t-1]|=(this.s&i)<<s),e.t=this.t-t,e.clamp()}o(lJ,"bnpRShiftTo");function fJ(r,e){for(var t=0,n=0,s=Math.min(r.t,this.t);t<s;)n+=this.data[t]-r.data[t],e.data[t++]=n&this.DM,n>>=this.DB;if(r.t<this.t){for(n-=r.s;t<this.t;)n+=this.data[t],e.data[t++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;t<r.t;)n-=r.data[t],e.data[t++]=n&this.DM,n>>=this.DB;n-=r.s}e.s=n<0?-1:0,n<-1?e.data[t++]=this.DV+n:n>0&&(e.data[t++]=n),e.t=t,e.clamp()}o(fJ,"bnpSubTo");function hJ(r,e){var t=this.abs(),n=r.abs(),s=t.t;for(e.t=s+n.t;--s>=0;)e.data[s]=0;for(s=0;s<n.t;++s)e.data[s+t.t]=t.am(0,n.data[s],e,s,0,t.t);e.s=0,e.clamp(),this.s!=r.s&&Oe.ZERO.subTo(e,e)}o(hJ,"bnpMultiplyTo");function pJ(r){for(var e=this.abs(),t=r.t=2*e.t;--t>=0;)r.data[t]=0;for(t=0;t<e.t-1;++t){var n=e.am(t,e.data[t],r,2*t,0,1);(r.data[t+e.t]+=e.am(t+1,2*e.data[t],r,2*t+1,n,e.t-t-1))>=e.DV&&(r.data[t+e.t]-=e.DV,r.data[t+e.t+1]=1)}r.t>0&&(r.data[r.t-1]+=e.am(t,e.data[t],r,2*t,0,1)),r.s=0,r.clamp()}o(pJ,"bnpSquareTo");function dJ(r,e,t){var n=r.abs();if(!(n.t<=0)){var s=this.abs();if(s.t<n.t){e?.fromInt(0),t!=null&&this.copyTo(t);return}t==null&&(t=fr());var i=fr(),a=this.s,u=r.s,c=this.DB-Nw(n.data[n.t-1]);c>0?(n.lShiftTo(c,i),s.lShiftTo(c,t)):(n.copyTo(i),s.copyTo(t));var f=i.t,h=i.data[f-1];if(h!=0){var m=h*(1<<this.F1)+(f>1?i.data[f-2]>>this.F2:0),g=this.FV/m,x=(1<<this.F1)/m,v=1<<this.F2,w=t.t,S=w-f,A=e??fr();for(i.dlShiftTo(S,A),t.compareTo(A)>=0&&(t.data[t.t++]=1,t.subTo(A,t)),Oe.ONE.dlShiftTo(f,A),A.subTo(i,i);i.t<f;)i.data[i.t++]=0;for(;--S>=0;){var T=t.data[--w]==h?this.DM:Math.floor(t.data[w]*g+(t.data[w-1]+v)*x);if((t.data[w]+=i.am(0,T,t,S,0,f))<T)for(i.dlShiftTo(S,A),t.subTo(A,t);t.data[w]<--T;)t.subTo(A,t)}e!=null&&(t.drShiftTo(f,e),a!=u&&Oe.ZERO.subTo(e,e)),t.t=f,t.clamp(),c>0&&t.rShiftTo(c,t),a<0&&Oe.ZERO.subTo(t,t)}}}o(dJ,"bnpDivRemTo");function mJ(r){var e=fr();return this.abs().divRemTo(r,null,e),this.s<0&&e.compareTo(Oe.ZERO)>0&&r.subTo(e,e),e}o(mJ,"bnMod");function Bl(r){this.m=r}o(Bl,"Classic");function gJ(r){return r.s<0||r.compareTo(this.m)>=0?r.mod(this.m):r}o(gJ,"cConvert");function vJ(r){return r}o(vJ,"cRevert");function yJ(r){r.divRemTo(this.m,null,r)}o(yJ,"cReduce");function xJ(r,e,t){r.multiplyTo(e,t),this.reduce(t)}o(xJ,"cMulTo");function wJ(r,e){r.squareTo(e),this.reduce(e)}o(wJ,"cSqrTo");Bl.prototype.convert=gJ;Bl.prototype.revert=vJ;Bl.prototype.reduce=yJ;Bl.prototype.mulTo=xJ;Bl.prototype.sqrTo=wJ;function SJ(){if(this.t<1)return 0;var r=this.data[0];if((r&1)==0)return 0;var e=r&3;return e=e*(2-(r&15)*e)&15,e=e*(2-(r&255)*e)&255,e=e*(2-((r&65535)*e&65535))&65535,e=e*(2-r*e%this.DV)%this.DV,e>0?this.DV-e:-e}o(SJ,"bnpInvDigit");function Dl(r){this.m=r,this.mp=r.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<r.DB-15)-1,this.mt2=2*r.t}o(Dl,"Montgomery");function bJ(r){var e=fr();return r.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),r.s<0&&e.compareTo(Oe.ZERO)>0&&this.m.subTo(e,e),e}o(bJ,"montConvert");function EJ(r){var e=fr();return r.copyTo(e),this.reduce(e),e}o(EJ,"montRevert");function AJ(r){for(;r.t<=this.mt2;)r.data[r.t++]=0;for(var e=0;e<this.m.t;++e){var t=r.data[e]&32767,n=t*this.mpl+((t*this.mph+(r.data[e]>>15)*this.mpl&this.um)<<15)&r.DM;for(t=e+this.m.t,r.data[t]+=this.m.am(0,n,r,e,0,this.m.t);r.data[t]>=r.DV;)r.data[t]-=r.DV,r.data[++t]++}r.clamp(),r.drShiftTo(this.m.t,r),r.compareTo(this.m)>=0&&r.subTo(this.m,r)}o(AJ,"montReduce");function CJ(r,e){r.squareTo(e),this.reduce(e)}o(CJ,"montSqrTo");function NJ(r,e,t){r.multiplyTo(e,t),this.reduce(t)}o(NJ,"montMulTo");Dl.prototype.convert=bJ;Dl.prototype.revert=EJ;Dl.prototype.reduce=AJ;Dl.prototype.mulTo=NJ;Dl.prototype.sqrTo=CJ;function TJ(){return(this.t>0?this.data[0]&1:this.s)==0}o(TJ,"bnpIsEven");function IJ(r,e){if(r>4294967295||r<1)return Oe.ONE;var t=fr(),n=fr(),s=e.convert(this),i=Nw(r)-1;for(s.copyTo(t);--i>=0;)if(e.sqrTo(t,n),(r&1<<i)>0)e.mulTo(n,s,t);else{var a=t;t=n,n=a}return e.revert(t)}o(IJ,"bnpExp");function _J(r,e){var t;return r<256||e.isEven()?t=new Bl(e):t=new Dl(e),this.exp(r,t)}o(_J,"bnModPowInt");Oe.prototype.copyTo=Qz;Oe.prototype.fromInt=Zz;Oe.prototype.fromString=eJ;Oe.prototype.clamp=tJ;Oe.prototype.dlShiftTo=oJ;Oe.prototype.drShiftTo=uJ;Oe.prototype.lShiftTo=cJ;Oe.prototype.rShiftTo=lJ;Oe.prototype.subTo=fJ;Oe.prototype.multiplyTo=hJ;Oe.prototype.squareTo=pJ;Oe.prototype.divRemTo=dJ;Oe.prototype.invDigit=SJ;Oe.prototype.isEven=TJ;Oe.prototype.exp=IJ;Oe.prototype.toString=rJ;Oe.prototype.negate=nJ;Oe.prototype.abs=sJ;Oe.prototype.compareTo=iJ;Oe.prototype.bitLength=aJ;Oe.prototype.mod=mJ;Oe.prototype.modPowInt=_J;Oe.ZERO=Ou(0);Oe.ONE=Ou(1);function BJ(){var r=fr();return this.copyTo(r),r}o(BJ,"bnClone");function DJ(){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]}o(DJ,"bnIntValue");function RJ(){return this.t==0?this.s:this.data[0]<<24>>24}o(RJ,"bnByteValue");function PJ(){return this.t==0?this.s:this.data[0]<<16>>16}o(PJ,"bnShortValue");function OJ(r){return Math.floor(Math.LN2*this.DB/Math.log(r))}o(OJ,"bnpChunkSize");function kJ(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}o(kJ,"bnSigNum");function LJ(r){if(r==null&&(r=10),this.signum()==0||r<2||r>36)return"0";var e=this.chunkSize(r),t=Math.pow(r,e),n=Ou(t),s=fr(),i=fr(),a="";for(this.divRemTo(n,s,i);s.signum()>0;)a=(t+i.intValue()).toString(r).substr(1)+a,s.divRemTo(n,s,i);return i.intValue().toString(r)+a}o(LJ,"bnpToRadix");function VJ(r,e){this.fromInt(0),e==null&&(e=10);for(var t=this.chunkSize(e),n=Math.pow(e,t),s=!1,i=0,a=0,u=0;u<r.length;++u){var c=b3(r,u);if(c<0){r.charAt(u)=="-"&&this.signum()==0&&(s=!0);continue}a=e*a+c,++i>=t&&(this.dMultiply(n),this.dAddOffset(a,0),i=0,a=0)}i>0&&(this.dMultiply(Math.pow(e,i)),this.dAddOffset(a,0)),s&&Oe.ZERO.subTo(this,this)}o(VJ,"bnpFromRadix");function UJ(r,e,t){if(typeof e=="number")if(r<2)this.fromInt(1);else for(this.fromNumber(r,t),this.testBit(r-1)||this.bitwiseTo(Oe.ONE.shiftLeft(r-1),sN,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>r&&this.subTo(Oe.ONE.shiftLeft(r-1),this);else{var n=new Array,s=r&7;n.length=(r>>3)+1,e.nextBytes(n),s>0?n[0]&=(1<<s)-1:n[0]=0,this.fromString(n,256)}}o(UJ,"bnpFromNumber");function jJ(){var r=this.t,e=new Array;e[0]=this.s;var t=this.DB-r*this.DB%8,n,s=0;if(r-- >0)for(t<this.DB&&(n=this.data[r]>>t)!=(this.s&this.DM)>>t&&(e[s++]=n|this.s<<this.DB-t);r>=0;)t<8?(n=(this.data[r]&(1<<t)-1)<<8-t,n|=this.data[--r]>>(t+=this.DB-8)):(n=this.data[r]>>(t-=8)&255,t<=0&&(t+=this.DB,--r)),(n&128)!=0&&(n|=-256),s==0&&(this.s&128)!=(n&128)&&++s,(s>0||n!=this.s)&&(e[s++]=n);return e}o(jJ,"bnToByteArray");function MJ(r){return this.compareTo(r)==0}o(MJ,"bnEquals");function FJ(r){return this.compareTo(r)<0?this:r}o(FJ,"bnMin");function qJ(r){return this.compareTo(r)>0?this:r}o(qJ,"bnMax");function HJ(r,e,t){var n,s,i=Math.min(r.t,this.t);for(n=0;n<i;++n)t.data[n]=e(this.data[n],r.data[n]);if(r.t<this.t){for(s=r.s&this.DM,n=i;n<this.t;++n)t.data[n]=e(this.data[n],s);t.t=this.t}else{for(s=this.s&this.DM,n=i;n<r.t;++n)t.data[n]=e(s,r.data[n]);t.t=r.t}t.s=e(this.s,r.s),t.clamp()}o(HJ,"bnpBitwiseTo");function KJ(r,e){return r&e}o(KJ,"op_and");function $J(r){var e=fr();return this.bitwiseTo(r,KJ,e),e}o($J,"bnAnd");function sN(r,e){return r|e}o(sN,"op_or");function GJ(r){var e=fr();return this.bitwiseTo(r,sN,e),e}o(GJ,"bnOr");function E3(r,e){return r^e}o(E3,"op_xor");function XJ(r){var e=fr();return this.bitwiseTo(r,E3,e),e}o(XJ,"bnXor");function A3(r,e){return r&~e}o(A3,"op_andnot");function WJ(r){var e=fr();return this.bitwiseTo(r,A3,e),e}o(WJ,"bnAndNot");function zJ(){for(var r=fr(),e=0;e<this.t;++e)r.data[e]=this.DM&~this.data[e];return r.t=this.t,r.s=~this.s,r}o(zJ,"bnNot");function JJ(r){var e=fr();return r<0?this.rShiftTo(-r,e):this.lShiftTo(r,e),e}o(JJ,"bnShiftLeft");function YJ(r){var e=fr();return r<0?this.lShiftTo(-r,e):this.rShiftTo(r,e),e}o(YJ,"bnShiftRight");function QJ(r){if(r==0)return-1;var e=0;return(r&65535)==0&&(r>>=16,e+=16),(r&255)==0&&(r>>=8,e+=8),(r&15)==0&&(r>>=4,e+=4),(r&3)==0&&(r>>=2,e+=2),(r&1)==0&&++e,e}o(QJ,"lbit");function ZJ(){for(var r=0;r<this.t;++r)if(this.data[r]!=0)return r*this.DB+QJ(this.data[r]);return this.s<0?this.t*this.DB:-1}o(ZJ,"bnGetLowestSetBit");function eY(r){for(var e=0;r!=0;)r&=r-1,++e;return e}o(eY,"cbit");function tY(){for(var r=0,e=this.s&this.DM,t=0;t<this.t;++t)r+=eY(this.data[t]^e);return r}o(tY,"bnBitCount");function rY(r){var e=Math.floor(r/this.DB);return e>=this.t?this.s!=0:(this.data[e]&1<<r%this.DB)!=0}o(rY,"bnTestBit");function nY(r,e){var t=Oe.ONE.shiftLeft(r);return this.bitwiseTo(t,e,t),t}o(nY,"bnpChangeBit");function sY(r){return this.changeBit(r,sN)}o(sY,"bnSetBit");function iY(r){return this.changeBit(r,A3)}o(iY,"bnClearBit");function aY(r){return this.changeBit(r,E3)}o(aY,"bnFlipBit");function oY(r,e){for(var t=0,n=0,s=Math.min(r.t,this.t);t<s;)n+=this.data[t]+r.data[t],e.data[t++]=n&this.DM,n>>=this.DB;if(r.t<this.t){for(n+=r.s;t<this.t;)n+=this.data[t],e.data[t++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;t<r.t;)n+=r.data[t],e.data[t++]=n&this.DM,n>>=this.DB;n+=r.s}e.s=n<0?-1:0,n>0?e.data[t++]=n:n<-1&&(e.data[t++]=this.DV+n),e.t=t,e.clamp()}o(oY,"bnpAddTo");function uY(r){var e=fr();return this.addTo(r,e),e}o(uY,"bnAdd");function cY(r){var e=fr();return this.subTo(r,e),e}o(cY,"bnSubtract");function lY(r){var e=fr();return this.multiplyTo(r,e),e}o(lY,"bnMultiply");function fY(r){var e=fr();return this.divRemTo(r,e,null),e}o(fY,"bnDivide");function hY(r){var e=fr();return this.divRemTo(r,null,e),e}o(hY,"bnRemainder");function pY(r){var e=fr(),t=fr();return this.divRemTo(r,e,t),new Array(e,t)}o(pY,"bnDivideAndRemainder");function dY(r){this.data[this.t]=this.am(0,r-1,this,0,0,this.t),++this.t,this.clamp()}o(dY,"bnpDMultiply");function mY(r,e){if(r!=0){for(;this.t<=e;)this.data[this.t++]=0;for(this.data[e]+=r;this.data[e]>=this.DV;)this.data[e]-=this.DV,++e>=this.t&&(this.data[this.t++]=0),++this.data[e]}}o(mY,"bnpDAddOffset");function Q0(){}o(Q0,"NullExp");function C3(r){return r}o(C3,"nNop");function gY(r,e,t){r.multiplyTo(e,t)}o(gY,"nMulTo");function vY(r,e){r.squareTo(e)}o(vY,"nSqrTo");Q0.prototype.convert=C3;Q0.prototype.revert=C3;Q0.prototype.mulTo=gY;Q0.prototype.sqrTo=vY;function yY(r){return this.exp(r,new Q0)}o(yY,"bnPow");function xY(r,e,t){var n=Math.min(this.t+r.t,e);for(t.s=0,t.t=n;n>0;)t.data[--n]=0;var s;for(s=t.t-this.t;n<s;++n)t.data[n+this.t]=this.am(0,r.data[n],t,n,0,this.t);for(s=Math.min(r.t,e);n<s;++n)this.am(0,r.data[n],t,n,0,e-n);t.clamp()}o(xY,"bnpMultiplyLowerTo");function wY(r,e,t){--e;var n=t.t=this.t+r.t-e;for(t.s=0;--n>=0;)t.data[n]=0;for(n=Math.max(e-this.t,0);n<r.t;++n)t.data[this.t+n-e]=this.am(e-n,r.data[n],t,0,0,this.t+n-e);t.clamp(),t.drShiftTo(1,t)}o(wY,"bnpMultiplyUpperTo");function cp(r){this.r2=fr(),this.q3=fr(),Oe.ONE.dlShiftTo(2*r.t,this.r2),this.mu=this.r2.divide(r),this.m=r}o(cp,"Barrett");function SY(r){if(r.s<0||r.t>2*this.m.t)return r.mod(this.m);if(r.compareTo(this.m)<0)return r;var e=fr();return r.copyTo(e),this.reduce(e),e}o(SY,"barrettConvert");function bY(r){return r}o(bY,"barrettRevert");function EY(r){for(r.drShiftTo(this.m.t-1,this.r2),r.t>this.m.t+1&&(r.t=this.m.t+1,r.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);r.compareTo(this.r2)<0;)r.dAddOffset(1,this.m.t+1);for(r.subTo(this.r2,r);r.compareTo(this.m)>=0;)r.subTo(this.m,r)}o(EY,"barrettReduce");function AY(r,e){r.squareTo(e),this.reduce(e)}o(AY,"barrettSqrTo");function CY(r,e,t){r.multiplyTo(e,t),this.reduce(t)}o(CY,"barrettMulTo");cp.prototype.convert=SY;cp.prototype.revert=bY;cp.prototype.reduce=EY;cp.prototype.mulTo=CY;cp.prototype.sqrTo=AY;function NY(r,e){var t=r.bitLength(),n,s=Ou(1),i;if(t<=0)return s;t<18?n=1:t<48?n=3:t<144?n=4:t<768?n=5:n=6,t<8?i=new Bl(e):e.isEven()?i=new cp(e):i=new Dl(e);var a=new Array,u=3,c=n-1,f=(1<<n)-1;if(a[1]=i.convert(this),n>1){var h=fr();for(i.sqrTo(a[1],h);u<=f;)a[u]=fr(),i.mulTo(h,a[u-2],a[u]),u+=2}var m=r.t-1,g,x=!0,v=fr(),w;for(t=Nw(r.data[m])-1;m>=0;){for(t>=c?g=r.data[m]>>t-c&f:(g=(r.data[m]&(1<<t+1)-1)<<c-t,m>0&&(g|=r.data[m-1]>>this.DB+t-c)),u=n;(g&1)==0;)g>>=1,--u;if((t-=u)<0&&(t+=this.DB,--m),x)a[g].copyTo(s),x=!1;else{for(;u>1;)i.sqrTo(s,v),i.sqrTo(v,s),u-=2;u>0?i.sqrTo(s,v):(w=s,s=v,v=w),i.mulTo(v,a[g],s)}for(;m>=0&&(r.data[m]&1<<t)==0;)i.sqrTo(s,v),w=s,s=v,v=w,--t<0&&(t=this.DB-1,--m)}return i.revert(s)}o(NY,"bnModPow");function TY(r){var e=this.s<0?this.negate():this.clone(),t=r.s<0?r.negate():r.clone();if(e.compareTo(t)<0){var n=e;e=t,t=n}var s=e.getLowestSetBit(),i=t.getLowestSetBit();if(i<0)return e;for(s<i&&(i=s),i>0&&(e.rShiftTo(i,e),t.rShiftTo(i,t));e.signum()>0;)(s=e.getLowestSetBit())>0&&e.rShiftTo(s,e),(s=t.getLowestSetBit())>0&&t.rShiftTo(s,t),e.compareTo(t)>=0?(e.subTo(t,e),e.rShiftTo(1,e)):(t.subTo(e,t),t.rShiftTo(1,t));return i>0&&t.lShiftTo(i,t),t}o(TY,"bnGCD");function IY(r){if(r<=0)return 0;var e=this.DV%r,t=this.s<0?r-1:0;if(this.t>0)if(e==0)t=this.data[0]%r;else for(var n=this.t-1;n>=0;--n)t=(e*t+this.data[n])%r;return t}o(IY,"bnpModInt");function _Y(r){var e=r.isEven();if(this.isEven()&&e||r.signum()==0)return Oe.ZERO;for(var t=r.clone(),n=this.clone(),s=Ou(1),i=Ou(0),a=Ou(0),u=Ou(1);t.signum()!=0;){for(;t.isEven();)t.rShiftTo(1,t),e?((!s.isEven()||!i.isEven())&&(s.addTo(this,s),i.subTo(r,i)),s.rShiftTo(1,s)):i.isEven()||i.subTo(r,i),i.rShiftTo(1,i);for(;n.isEven();)n.rShiftTo(1,n),e?((!a.isEven()||!u.isEven())&&(a.addTo(this,a),u.subTo(r,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(r,u),u.rShiftTo(1,u);t.compareTo(n)>=0?(t.subTo(n,t),e&&s.subTo(a,s),i.subTo(u,i)):(n.subTo(t,n),e&&a.subTo(s,a),u.subTo(i,u))}if(n.compareTo(Oe.ONE)!=0)return Oe.ZERO;if(u.compareTo(r)>=0)return u.subtract(r);if(u.signum()<0)u.addTo(r,u);else return u;return u.signum()<0?u.add(r):u}o(_Y,"bnModInverse");var ta=[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],BY=(1<<26)/ta[ta.length-1];function DY(r){var e,t=this.abs();if(t.t==1&&t.data[0]<=ta[ta.length-1]){for(e=0;e<ta.length;++e)if(t.data[0]==ta[e])return!0;return!1}if(t.isEven())return!1;for(e=1;e<ta.length;){for(var n=ta[e],s=e+1;s<ta.length&&n<BY;)n*=ta[s++];for(n=t.modInt(n);e<s;)if(n%ta[e++]==0)return!1}return t.millerRabin(r)}o(DY,"bnIsProbablePrime");function RY(r){var e=this.subtract(Oe.ONE),t=e.getLowestSetBit();if(t<=0)return!1;for(var n=e.shiftRight(t),s=PY(),i,a=0;a<r;++a){do i=new Oe(this.bitLength(),s);while(i.compareTo(Oe.ONE)<=0||i.compareTo(e)>=0);var u=i.modPow(n,this);if(u.compareTo(Oe.ONE)!=0&&u.compareTo(e)!=0){for(var c=1;c++<t&&u.compareTo(e)!=0;)if(u=u.modPowInt(2,this),u.compareTo(Oe.ONE)==0)return!1;if(u.compareTo(e)!=0)return!1}}return!0}o(RY,"bnpMillerRabin");function PY(){return{nextBytes:o(function(r){for(var e=0;e<r.length;++e)r[e]=Math.floor(Math.random()*256)},"nextBytes")}}o(PY,"bnGetPrng");Oe.prototype.chunkSize=OJ;Oe.prototype.toRadix=LJ;Oe.prototype.fromRadix=VJ;Oe.prototype.fromNumber=UJ;Oe.prototype.bitwiseTo=HJ;Oe.prototype.changeBit=nY;Oe.prototype.addTo=oY;Oe.prototype.dMultiply=dY;Oe.prototype.dAddOffset=mY;Oe.prototype.multiplyLowerTo=xY;Oe.prototype.multiplyUpperTo=wY;Oe.prototype.modInt=IY;Oe.prototype.millerRabin=RY;Oe.prototype.clone=BJ;Oe.prototype.intValue=DJ;Oe.prototype.byteValue=RJ;Oe.prototype.shortValue=PJ;Oe.prototype.signum=kJ;Oe.prototype.toByteArray=jJ;Oe.prototype.equals=MJ;Oe.prototype.min=FJ;Oe.prototype.max=qJ;Oe.prototype.and=$J;Oe.prototype.or=GJ;Oe.prototype.xor=XJ;Oe.prototype.andNot=WJ;Oe.prototype.not=zJ;Oe.prototype.shiftLeft=JJ;Oe.prototype.shiftRight=YJ;Oe.prototype.getLowestSetBit=ZJ;Oe.prototype.bitCount=tY;Oe.prototype.testBit=rY;Oe.prototype.setBit=sY;Oe.prototype.clearBit=iY;Oe.prototype.flipBit=aY;Oe.prototype.add=uY;Oe.prototype.subtract=cY;Oe.prototype.multiply=lY;Oe.prototype.divide=fY;Oe.prototype.remainder=hY;Oe.prototype.divideAndRemainder=pY;Oe.prototype.modPow=NY;Oe.prototype.modInverse=_Y;Oe.prototype.pow=yY;Oe.prototype.gcd=TY;Oe.prototype.isProbablePrime=DY});var lp=Z((cde,B3)=>{"use strict";var Pa=$t();Ia();lr();var I3=B3.exports=Pa.sha1=Pa.sha1||{};Pa.md.sha1=Pa.md.algorithms.sha1=I3;I3.create=function(){_3||OY();var r=null,e=Pa.util.createBuffer(),t=new Array(80),n={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var s=n.messageLengthSize/4,i=0;i<s;++i)n.fullMessageLength.push(0);return e=Pa.util.createBuffer(),r={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},n},n.start(),n.update=function(s,i){i==="utf8"&&(s=Pa.util.encodeUtf8(s));var a=s.length;n.messageLength+=a,a=[a/4294967296>>>0,a>>>0];for(var u=n.fullMessageLength.length-1;u>=0;--u)n.fullMessageLength[u]+=a[1],a[1]=a[0]+(n.fullMessageLength[u]/4294967296>>>0),n.fullMessageLength[u]=n.fullMessageLength[u]>>>0,a[0]=a[1]/4294967296>>>0;return e.putBytes(s),T3(r,t,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var s=Pa.util.createBuffer();s.putBytes(e.bytes());var i=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,a=i&n.blockLength-1;s.putBytes(iN.substr(0,n.blockLength-a));for(var u,c,f=n.fullMessageLength[0]*8,h=0;h<n.fullMessageLength.length-1;++h)u=n.fullMessageLength[h+1]*8,c=u/4294967296>>>0,f+=c,s.putInt32(f>>>0),f=u>>>0;s.putInt32(f);var m={h0:r.h0,h1:r.h1,h2:r.h2,h3:r.h3,h4:r.h4};T3(m,t,s);var g=Pa.util.createBuffer();return g.putInt32(m.h0),g.putInt32(m.h1),g.putInt32(m.h2),g.putInt32(m.h3),g.putInt32(m.h4),g},n};var iN=null,_3=!1;function OY(){iN="\x80",iN+=Pa.util.fillString("\0",64),_3=!0}o(OY,"_init");function T3(r,e,t){for(var n,s,i,a,u,c,f,h,m=t.length();m>=64;){for(s=r.h0,i=r.h1,a=r.h2,u=r.h3,c=r.h4,h=0;h<16;++h)n=t.getInt32(),e[h]=n,f=u^i&(a^u),n=(s<<5|s>>>27)+f+c+1518500249+n,c=u,u=a,a=(i<<30|i>>>2)>>>0,i=s,s=n;for(;h<20;++h)n=e[h-3]^e[h-8]^e[h-14]^e[h-16],n=n<<1|n>>>31,e[h]=n,f=u^i&(a^u),n=(s<<5|s>>>27)+f+c+1518500249+n,c=u,u=a,a=(i<<30|i>>>2)>>>0,i=s,s=n;for(;h<32;++h)n=e[h-3]^e[h-8]^e[h-14]^e[h-16],n=n<<1|n>>>31,e[h]=n,f=i^a^u,n=(s<<5|s>>>27)+f+c+1859775393+n,c=u,u=a,a=(i<<30|i>>>2)>>>0,i=s,s=n;for(;h<40;++h)n=e[h-6]^e[h-16]^e[h-28]^e[h-32],n=n<<2|n>>>30,e[h]=n,f=i^a^u,n=(s<<5|s>>>27)+f+c+1859775393+n,c=u,u=a,a=(i<<30|i>>>2)>>>0,i=s,s=n;for(;h<60;++h)n=e[h-6]^e[h-16]^e[h-28]^e[h-32],n=n<<2|n>>>30,e[h]=n,f=i&a|u&(i^a),n=(s<<5|s>>>27)+f+c+2400959708+n,c=u,u=a,a=(i<<30|i>>>2)>>>0,i=s,s=n;for(;h<80;++h)n=e[h-6]^e[h-16]^e[h-28]^e[h-32],n=n<<2|n>>>30,e[h]=n,f=i^a^u,n=(s<<5|s>>>27)+f+c+3395469782+n,c=u,u=a,a=(i<<30|i>>>2)>>>0,i=s,s=n;r.h0=r.h0+s|0,r.h1=r.h1+i|0,r.h2=r.h2+a|0,r.h3=r.h3+u|0,r.h4=r.h4+c|0,m-=64}}o(T3,"_update")});var aN=Z((fde,R3)=>{"use strict";var Oa=$t();lr();bi();lp();var D3=R3.exports=Oa.pkcs1=Oa.pkcs1||{};D3.encode_rsa_oaep=function(r,e,t){var n,s,i,a;typeof t=="string"?(n=t,s=arguments[3]||void 0,i=arguments[4]||void 0):t&&(n=t.label||void 0,s=t.seed||void 0,i=t.md||void 0,t.mgf1&&t.mgf1.md&&(a=t.mgf1.md)),i?i.start():i=Oa.md.sha1.create(),a||(a=i);var u=Math.ceil(r.n.bitLength()/8),c=u-2*i.digestLength-2;if(e.length>c){var f=new Error("RSAES-OAEP input message length is too long.");throw f.length=e.length,f.maxLength=c,f}n||(n=""),i.update(n,"raw");for(var h=i.digest(),m="",g=c-e.length,x=0;x<g;x++)m+="\0";var v=h.getBytes()+m+""+e;if(!s)s=Oa.random.getBytes(i.digestLength);else if(s.length!==i.digestLength){var f=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw f.seedLength=s.length,f.digestLength=i.digestLength,f}var w=Tw(s,u-i.digestLength-1,a),S=Oa.util.xorBytes(v,w,v.length),A=Tw(S,i.digestLength,a),T=Oa.util.xorBytes(s,A,s.length);return"\0"+T+S};D3.decode_rsa_oaep=function(r,e,t){var n,s,i;typeof t=="string"?(n=t,s=arguments[3]||void 0):t&&(n=t.label||void 0,s=t.md||void 0,t.mgf1&&t.mgf1.md&&(i=t.mgf1.md));var a=Math.ceil(r.n.bitLength()/8);if(e.length!==a){var S=new Error("RSAES-OAEP encoded message length is invalid.");throw S.length=e.length,S.expectedLength=a,S}if(s===void 0?s=Oa.md.sha1.create():s.start(),i||(i=s),a<2*s.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");n||(n=""),s.update(n,"raw");for(var u=s.digest().getBytes(),c=e.charAt(0),f=e.substring(1,s.digestLength+1),h=e.substring(1+s.digestLength),m=Tw(h,s.digestLength,i),g=Oa.util.xorBytes(f,m,f.length),x=Tw(g,a-s.digestLength-1,i),v=Oa.util.xorBytes(h,x,h.length),w=v.substring(0,s.digestLength),S=c!=="\0",A=0;A<s.digestLength;++A)S|=u.charAt(A)!==w.charAt(A);for(var T=1,b=s.digestLength,E=s.digestLength;E<v.length;E++){var C=v.charCodeAt(E),_=C&1^1,F=T?65534:0;S|=C&F,T=T&_,b+=T}if(S||v.charCodeAt(b)!==1)throw new Error("Invalid RSAES-OAEP padding.");return v.substring(b+1)};function Tw(r,e,t){t||(t=Oa.md.sha1.create());for(var n="",s=Math.ceil(e/t.digestLength),i=0;i<s;++i){var a=String.fromCharCode(i>>24&255,i>>16&255,i>>8&255,i&255);t.start(),t.update(r+a),n+=t.digest().getBytes()}return n.substring(0,e)}o(Tw,"rsa_mgf1")});var uN=Z((pde,oN)=>{"use strict";var ku=$t();lr();Z0();bi();(function(){if(ku.prime){oN.exports=ku.prime;return}var r=oN.exports=ku.prime=ku.prime||{},e=ku.jsbn.BigInteger,t=[6,4,2,4,2,4,6,2],n=new e(null);n.fromInt(30);var s=o(function(m,g){return m|g},"op_or");r.generateProbablePrime=function(m,g,x){typeof g=="function"&&(x=g,g={}),g=g||{};var v=g.algorithm||"PRIMEINC";typeof v=="string"&&(v={name:v}),v.options=v.options||{};var w=g.prng||ku.random,S={nextBytes:o(function(A){for(var T=w.getBytesSync(A.length),b=0;b<A.length;++b)A[b]=T.charCodeAt(b)},"nextBytes")};if(v.name==="PRIMEINC")return i(m,S,v.options,x);throw new Error("Invalid prime generation algorithm: "+v.name)};function i(m,g,x,v){return"workers"in x?c(m,g,x,v):a(m,g,x,v)}o(i,"primeincFindPrime");function a(m,g,x,v){var w=f(m,g),S=0,A=h(w.bitLength());"millerRabinTests"in x&&(A=x.millerRabinTests);var T=10;"maxBlockTime"in x&&(T=x.maxBlockTime),u(w,m,g,S,A,T,v)}o(a,"primeincFindPrimeWithoutWorkers");function u(m,g,x,v,w,S,A){var T=+new Date;do{if(m.bitLength()>g&&(m=f(g,x)),m.isProbablePrime(w))return A(null,m);m.dAddOffset(t[v++%8],0)}while(S<0||+new Date-T<S);ku.util.setImmediate(function(){u(m,g,x,v,w,S,A)})}o(u,"_primeinc");function c(m,g,x,v){if(typeof Worker>"u")return a(m,g,x,v);var w=f(m,g),S=x.workers,A=x.workLoad||100,T=A*30/8,b=x.workerScript||"forge/prime.worker.js";if(S===-1)return ku.util.estimateCores(function(C,_){C&&(_=2),S=_-1,E()});E();function E(){S=Math.max(1,S);for(var C=[],_=0;_<S;++_)C[_]=new Worker(b);for(var F=S,_=0;_<S;++_)C[_].addEventListener("message",q);var R=!1;function q(H){if(!R){--F;var K=H.data;if(K.found){for(var X=0;X<C.length;++X)C[X].terminate();return R=!0,v(null,new e(K.prime,16))}w.bitLength()>m&&(w=f(m,g));var pe=w.toString(16);H.target.postMessage({hex:pe,workLoad:A}),w.dAddOffset(T,0)}}o(q,"workerMessage")}o(E,"generate")}o(c,"primeincFindPrimeWithWorkers");function f(m,g){var x=new e(m,g),v=m-1;return x.testBit(v)||x.bitwiseTo(e.ONE.shiftLeft(v),s,x),x.dAddOffset(31-x.mod(n).byteValue(),0),x}o(f,"generateRandom");function h(m){return m<=100?27:m<=150?18:m<=200?15:m<=250?12:m<=300?9:m<=350?8:m<=400?7:m<=500?6:m<=600?5:m<=800?4:m<=1250?3:2}o(h,"getMillerRabinTests")})()});var eg=Z((mde,j3)=>{"use strict";var yt=$t();ea();Z0();Pu();aN();uN();bi();lr();typeof ar>"u"&&(ar=yt.jsbn.BigInteger);var ar,cN=yt.util.isNodejs?Xe("crypto"):null,de=yt.asn1,Ai=yt.util;yt.pki=yt.pki||{};j3.exports=yt.pki.rsa=yt.rsa=yt.rsa||{};var Vt=yt.pki,kY=[6,4,2,4,2,4,6,2],LY={name:"PrivateKeyInfo",tagClass:de.Class.UNIVERSAL,type:de.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:de.Class.UNIVERSAL,type:de.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:de.Class.UNIVERSAL,type:de.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:de.Class.UNIVERSAL,type:de.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},VY={name:"RSAPrivateKey",tagClass:de.Class.UNIVERSAL,type:de.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},UY={name:"RSAPublicKey",tagClass:de.Class.UNIVERSAL,type:de.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:de.Class.UNIVERSAL,type:de.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},jY=yt.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:de.Class.UNIVERSAL,type:de.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:de.Class.UNIVERSAL,type:de.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:de.Class.UNIVERSAL,type:de.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:de.Class.UNIVERSAL,type:de.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:de.Class.UNIVERSAL,type:de.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},MY={name:"DigestInfo",tagClass:de.Class.UNIVERSAL,type:de.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:de.Class.UNIVERSAL,type:de.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:de.Class.UNIVERSAL,type:de.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:de.Class.UNIVERSAL,type:de.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:de.Class.UNIVERSAL,type:de.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},FY=o(function(r){var e;if(r.algorithm in Vt.oids)e=Vt.oids[r.algorithm];else{var t=new Error("Unknown message digest algorithm.");throw t.algorithm=r.algorithm,t}var n=de.oidToDer(e).getBytes(),s=de.create(de.Class.UNIVERSAL,de.Type.SEQUENCE,!0,[]),i=de.create(de.Class.UNIVERSAL,de.Type.SEQUENCE,!0,[]);i.value.push(de.create(de.Class.UNIVERSAL,de.Type.OID,!1,n)),i.value.push(de.create(de.Class.UNIVERSAL,de.Type.NULL,!1,""));var a=de.create(de.Class.UNIVERSAL,de.Type.OCTETSTRING,!1,r.digest().getBytes());return s.value.push(i),s.value.push(a),de.toDer(s).getBytes()},"emsaPkcs1v15encode"),V3=o(function(r,e,t){if(t)return r.modPow(e.e,e.n);if(!e.p||!e.q)return r.modPow(e.d,e.n);e.dP||(e.dP=e.d.mod(e.p.subtract(ar.ONE))),e.dQ||(e.dQ=e.d.mod(e.q.subtract(ar.ONE))),e.qInv||(e.qInv=e.q.modInverse(e.p));var n;do n=new ar(yt.util.bytesToHex(yt.random.getBytes(e.n.bitLength()/8)),16);while(n.compareTo(e.n)>=0||!n.gcd(e.n).equals(ar.ONE));r=r.multiply(n.modPow(e.e,e.n)).mod(e.n);for(var s=r.mod(e.p).modPow(e.dP,e.p),i=r.mod(e.q).modPow(e.dQ,e.q);s.compareTo(i)<0;)s=s.add(e.p);var a=s.subtract(i).multiply(e.qInv).mod(e.p).multiply(e.q).add(i);return a=a.multiply(n.modInverse(e.n)).mod(e.n),a},"_modPow");Vt.rsa.encrypt=function(r,e,t){var n=t,s,i=Math.ceil(e.n.bitLength()/8);t!==!1&&t!==!0?(n=t===2,s=U3(r,e,t)):(s=yt.util.createBuffer(),s.putBytes(r));for(var a=new ar(s.toHex(),16),u=V3(a,e,n),c=u.toString(16),f=yt.util.createBuffer(),h=i-Math.ceil(c.length/2);h>0;)f.putByte(0),--h;return f.putBytes(yt.util.hexToBytes(c)),f.getBytes()};Vt.rsa.decrypt=function(r,e,t,n){var s=Math.ceil(e.n.bitLength()/8);if(r.length!==s){var i=new Error("Encrypted message length is invalid.");throw i.length=r.length,i.expected=s,i}var a=new ar(yt.util.createBuffer(r).toHex(),16);if(a.compareTo(e.n)>=0)throw new Error("Encrypted message is invalid.");for(var u=V3(a,e,t),c=u.toString(16),f=yt.util.createBuffer(),h=s-Math.ceil(c.length/2);h>0;)f.putByte(0),--h;return f.putBytes(yt.util.hexToBytes(c)),n!==!1?Iw(f.getBytes(),e,t):f.getBytes()};Vt.rsa.createKeyPairGenerationState=function(r,e,t){typeof r=="string"&&(r=parseInt(r,10)),r=r||2048,t=t||{};var n=t.prng||yt.random,s={nextBytes:o(function(u){for(var c=n.getBytesSync(u.length),f=0;f<u.length;++f)u[f]=c.charCodeAt(f)},"nextBytes")},i=t.algorithm||"PRIMEINC",a;if(i==="PRIMEINC")a={algorithm:i,state:0,bits:r,rng:s,eInt:e||65537,e:new ar(null),p:null,q:null,qBits:r>>1,pBits:r-(r>>1),pqState:0,num:null,keys:null},a.e.fromInt(a.eInt);else throw new Error("Invalid key generation algorithm: "+i);return a};Vt.rsa.stepKeyPairGenerationState=function(r,e){"algorithm"in r||(r.algorithm="PRIMEINC");var t=new ar(null);t.fromInt(30);for(var n=0,s=o(function(m,g){return m|g},"op_or"),i=+new Date,a,u=0;r.keys===null&&(e<=0||u<e);){if(r.state===0){var c=r.p===null?r.pBits:r.qBits,f=c-1;r.pqState===0?(r.num=new ar(c,r.rng),r.num.testBit(f)||r.num.bitwiseTo(ar.ONE.shiftLeft(f),s,r.num),r.num.dAddOffset(31-r.num.mod(t).byteValue(),0),n=0,++r.pqState):r.pqState===1?r.num.bitLength()>c?r.pqState=0:r.num.isProbablePrime(HY(r.num.bitLength()))?++r.pqState:r.num.dAddOffset(kY[n++%8],0):r.pqState===2?r.pqState=r.num.subtract(ar.ONE).gcd(r.e).compareTo(ar.ONE)===0?3:0:r.pqState===3&&(r.pqState=0,r.p===null?r.p=r.num:r.q=r.num,r.p!==null&&r.q!==null&&++r.state,r.num=null)}else if(r.state===1)r.p.compareTo(r.q)<0&&(r.num=r.p,r.p=r.q,r.q=r.num),++r.state;else if(r.state===2)r.p1=r.p.subtract(ar.ONE),r.q1=r.q.subtract(ar.ONE),r.phi=r.p1.multiply(r.q1),++r.state;else if(r.state===3)r.phi.gcd(r.e).compareTo(ar.ONE)===0?++r.state:(r.p=null,r.q=null,r.state=0);else if(r.state===4)r.n=r.p.multiply(r.q),r.n.bitLength()===r.bits?++r.state:(r.q=null,r.state=0);else if(r.state===5){var h=r.e.modInverse(r.phi);r.keys={privateKey:Vt.rsa.setPrivateKey(r.n,r.e,h,r.p,r.q,h.mod(r.p1),h.mod(r.q1),r.q.modInverse(r.p)),publicKey:Vt.rsa.setPublicKey(r.n,r.e)}}a=+new Date,u+=a-i,i=a}return r.keys!==null};Vt.rsa.generateKeyPair=function(r,e,t,n){if(arguments.length===1?typeof r=="object"?(t=r,r=void 0):typeof r=="function"&&(n=r,r=void 0):arguments.length===2?typeof r=="number"?typeof e=="function"?(n=e,e=void 0):typeof e!="number"&&(t=e,e=void 0):(t=r,n=e,r=void 0,e=void 0):arguments.length===3&&(typeof e=="number"?typeof t=="function"&&(n=t,t=void 0):(n=t,t=e,e=void 0)),t=t||{},r===void 0&&(r=t.bits||2048),e===void 0&&(e=t.e||65537),!yt.options.usePureJavaScript&&!t.prng&&r>=256&&r<=16384&&(e===65537||e===3)){if(n){if(P3("generateKeyPair"))return cN.generateKeyPair("rsa",{modulusLength:r,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(u,c,f){if(u)return n(u);n(null,{privateKey:Vt.privateKeyFromPem(f),publicKey:Vt.publicKeyFromPem(c)})});if(O3("generateKey")&&O3("exportKey"))return Ai.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:r,publicExponent:L3(e),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(u){return Ai.globalScope.crypto.subtle.exportKey("pkcs8",u.privateKey)}).then(void 0,function(u){n(u)}).then(function(u){if(u){var c=Vt.privateKeyFromAsn1(de.fromDer(yt.util.createBuffer(u)));n(null,{privateKey:c,publicKey:Vt.setRsaPublicKey(c.n,c.e)})}});if(k3("generateKey")&&k3("exportKey")){var s=Ai.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:r,publicExponent:L3(e),hash:{name:"SHA-256"}},!0,["sign","verify"]);s.oncomplete=function(u){var c=u.target.result,f=Ai.globalScope.msCrypto.subtle.exportKey("pkcs8",c.privateKey);f.oncomplete=function(h){var m=h.target.result,g=Vt.privateKeyFromAsn1(de.fromDer(yt.util.createBuffer(m)));n(null,{privateKey:g,publicKey:Vt.setRsaPublicKey(g.n,g.e)})},f.onerror=function(h){n(h)}},s.onerror=function(u){n(u)};return}}else if(P3("generateKeyPairSync")){var i=cN.generateKeyPairSync("rsa",{modulusLength:r,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:Vt.privateKeyFromPem(i.privateKey),publicKey:Vt.publicKeyFromPem(i.publicKey)}}}var a=Vt.rsa.createKeyPairGenerationState(r,e,t);if(!n)return Vt.rsa.stepKeyPairGenerationState(a,0),a.keys;qY(a,t,n)};Vt.setRsaPublicKey=Vt.rsa.setPublicKey=function(r,e){var t={n:r,e};return t.encrypt=function(n,s,i){if(typeof s=="string"?s=s.toUpperCase():s===void 0&&(s="RSAES-PKCS1-V1_5"),s==="RSAES-PKCS1-V1_5")s={encode:o(function(u,c,f){return U3(u,c,2).getBytes()},"encode")};else if(s==="RSA-OAEP"||s==="RSAES-OAEP")s={encode:o(function(u,c){return yt.pkcs1.encode_rsa_oaep(c,u,i)},"encode")};else if(["RAW","NONE","NULL",null].indexOf(s)!==-1)s={encode:o(function(u){return u},"encode")};else if(typeof s=="string")throw new Error('Unsupported encryption scheme: "'+s+'".');var a=s.encode(n,t,!0);return Vt.rsa.encrypt(a,t,!0)},t.verify=function(n,s,i,a){typeof i=="string"?i=i.toUpperCase():i===void 0&&(i="RSASSA-PKCS1-V1_5"),a===void 0&&(a={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in a||(a._parseAllDigestBytes=!0),i==="RSASSA-PKCS1-V1_5"?i={verify:o(function(c,f){f=Iw(f,t,!0);var h=de.fromDer(f,{parseAllBytes:a._parseAllDigestBytes}),m={},g=[];if(!de.validate(h,MY,m,g)){var x=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw x.errors=g,x}var v=de.derToOid(m.algorithmIdentifier);if(!(v===yt.oids.md2||v===yt.oids.md5||v===yt.oids.sha1||v===yt.oids.sha224||v===yt.oids.sha256||v===yt.oids.sha384||v===yt.oids.sha512||v===yt.oids["sha512-224"]||v===yt.oids["sha512-256"])){var x=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw x.oid=v,x}if((v===yt.oids.md2||v===yt.oids.md5)&&!("parameters"in m))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return c===m.digest},"verify")}:(i==="NONE"||i==="NULL"||i===null)&&(i={verify:o(function(c,f){return f=Iw(f,t,!0),c===f},"verify")});var u=Vt.rsa.decrypt(s,t,!0,!1);return i.verify(n,u,t.n.bitLength())},t};Vt.setRsaPrivateKey=Vt.rsa.setPrivateKey=function(r,e,t,n,s,i,a,u){var c={n:r,e,d:t,p:n,q:s,dP:i,dQ:a,qInv:u};return c.decrypt=function(f,h,m){typeof h=="string"?h=h.toUpperCase():h===void 0&&(h="RSAES-PKCS1-V1_5");var g=Vt.rsa.decrypt(f,c,!1,!1);if(h==="RSAES-PKCS1-V1_5")h={decode:Iw};else if(h==="RSA-OAEP"||h==="RSAES-OAEP")h={decode:o(function(x,v){return yt.pkcs1.decode_rsa_oaep(v,x,m)},"decode")};else if(["RAW","NONE","NULL",null].indexOf(h)!==-1)h={decode:o(function(x){return x},"decode")};else throw new Error('Unsupported encryption scheme: "'+h+'".');return h.decode(g,c,!1)},c.sign=function(f,h){var m=!1;typeof h=="string"&&(h=h.toUpperCase()),h===void 0||h==="RSASSA-PKCS1-V1_5"?(h={encode:FY},m=1):(h==="NONE"||h==="NULL"||h===null)&&(h={encode:o(function(){return f},"encode")},m=1);var g=h.encode(f,c.n.bitLength());return Vt.rsa.encrypt(g,c,m)},c};Vt.wrapRsaPrivateKey=function(r){return de.create(de.Class.UNIVERSAL,de.Type.SEQUENCE,!0,[de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,de.integerToDer(0).getBytes()),de.create(de.Class.UNIVERSAL,de.Type.SEQUENCE,!0,[de.create(de.Class.UNIVERSAL,de.Type.OID,!1,de.oidToDer(Vt.oids.rsaEncryption).getBytes()),de.create(de.Class.UNIVERSAL,de.Type.NULL,!1,"")]),de.create(de.Class.UNIVERSAL,de.Type.OCTETSTRING,!1,de.toDer(r).getBytes())])};Vt.privateKeyFromAsn1=function(r){var e={},t=[];if(de.validate(r,LY,e,t)&&(r=de.fromDer(yt.util.createBuffer(e.privateKey))),e={},t=[],!de.validate(r,VY,e,t)){var n=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw n.errors=t,n}var s,i,a,u,c,f,h,m;return s=yt.util.createBuffer(e.privateKeyModulus).toHex(),i=yt.util.createBuffer(e.privateKeyPublicExponent).toHex(),a=yt.util.createBuffer(e.privateKeyPrivateExponent).toHex(),u=yt.util.createBuffer(e.privateKeyPrime1).toHex(),c=yt.util.createBuffer(e.privateKeyPrime2).toHex(),f=yt.util.createBuffer(e.privateKeyExponent1).toHex(),h=yt.util.createBuffer(e.privateKeyExponent2).toHex(),m=yt.util.createBuffer(e.privateKeyCoefficient).toHex(),Vt.setRsaPrivateKey(new ar(s,16),new ar(i,16),new ar(a,16),new ar(u,16),new ar(c,16),new ar(f,16),new ar(h,16),new ar(m,16))};Vt.privateKeyToAsn1=Vt.privateKeyToRSAPrivateKey=function(r){return de.create(de.Class.UNIVERSAL,de.Type.SEQUENCE,!0,[de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,de.integerToDer(0).getBytes()),de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,ka(r.n)),de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,ka(r.e)),de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,ka(r.d)),de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,ka(r.p)),de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,ka(r.q)),de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,ka(r.dP)),de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,ka(r.dQ)),de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,ka(r.qInv))])};Vt.publicKeyFromAsn1=function(r){var e={},t=[];if(de.validate(r,jY,e,t)){var n=de.derToOid(e.publicKeyOid);if(n!==Vt.oids.rsaEncryption){var s=new Error("Cannot read public key. Unknown OID.");throw s.oid=n,s}r=e.rsaPublicKey}if(t=[],!de.validate(r,UY,e,t)){var s=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw s.errors=t,s}var i=yt.util.createBuffer(e.publicKeyModulus).toHex(),a=yt.util.createBuffer(e.publicKeyExponent).toHex();return Vt.setRsaPublicKey(new ar(i,16),new ar(a,16))};Vt.publicKeyToAsn1=Vt.publicKeyToSubjectPublicKeyInfo=function(r){return de.create(de.Class.UNIVERSAL,de.Type.SEQUENCE,!0,[de.create(de.Class.UNIVERSAL,de.Type.SEQUENCE,!0,[de.create(de.Class.UNIVERSAL,de.Type.OID,!1,de.oidToDer(Vt.oids.rsaEncryption).getBytes()),de.create(de.Class.UNIVERSAL,de.Type.NULL,!1,"")]),de.create(de.Class.UNIVERSAL,de.Type.BITSTRING,!1,[Vt.publicKeyToRSAPublicKey(r)])])};Vt.publicKeyToRSAPublicKey=function(r){return de.create(de.Class.UNIVERSAL,de.Type.SEQUENCE,!0,[de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,ka(r.n)),de.create(de.Class.UNIVERSAL,de.Type.INTEGER,!1,ka(r.e))])};function U3(r,e,t){var n=yt.util.createBuffer(),s=Math.ceil(e.n.bitLength()/8);if(r.length>s-11){var i=new Error("Message is too long for PKCS#1 v1.5 padding.");throw i.length=r.length,i.max=s-11,i}n.putByte(0),n.putByte(t);var a=s-3-r.length,u;if(t===0||t===1){u=t===0?0:255;for(var c=0;c<a;++c)n.putByte(u)}else for(;a>0;){for(var f=0,h=yt.random.getBytes(a),c=0;c<a;++c)u=h.charCodeAt(c),u===0?++f:n.putByte(u);a=f}return n.putByte(0),n.putBytes(r),n}o(U3,"_encodePkcs1_v1_5");function Iw(r,e,t,n){var s=Math.ceil(e.n.bitLength()/8),i=yt.util.createBuffer(r),a=i.getByte(),u=i.getByte();if(a!==0||t&&u!==0&&u!==1||!t&&u!=2||t&&u===0&&typeof n>"u")throw new Error("Encryption block is invalid.");var c=0;if(u===0){c=s-3-n;for(var f=0;f<c;++f)if(i.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(u===1)for(c=0;i.length()>1;){if(i.getByte()!==255){--i.read;break}++c}else if(u===2)for(c=0;i.length()>1;){if(i.getByte()===0){--i.read;break}++c}var h=i.getByte();if(h!==0||c!==s-3-i.length())throw new Error("Encryption block is invalid.");return i.getBytes()}o(Iw,"_decodePkcs1_v1_5");function qY(r,e,t){typeof e=="function"&&(t=e,e={}),e=e||{};var n={algorithm:{name:e.algorithm||"PRIMEINC",options:{workers:e.workers||2,workLoad:e.workLoad||100,workerScript:e.workerScript}}};"prng"in e&&(n.prng=e.prng),s();function s(){i(r.pBits,function(u,c){if(u)return t(u);if(r.p=c,r.q!==null)return a(u,r.q);i(r.qBits,a)})}o(s,"generate");function i(u,c){yt.prime.generateProbablePrime(u,n,c)}o(i,"getPrime");function a(u,c){if(u)return t(u);if(r.q=c,r.p.compareTo(r.q)<0){var f=r.p;r.p=r.q,r.q=f}if(r.p.subtract(ar.ONE).gcd(r.e).compareTo(ar.ONE)!==0){r.p=null,s();return}if(r.q.subtract(ar.ONE).gcd(r.e).compareTo(ar.ONE)!==0){r.q=null,i(r.qBits,a);return}if(r.p1=r.p.subtract(ar.ONE),r.q1=r.q.subtract(ar.ONE),r.phi=r.p1.multiply(r.q1),r.phi.gcd(r.e).compareTo(ar.ONE)!==0){r.p=r.q=null,s();return}if(r.n=r.p.multiply(r.q),r.n.bitLength()!==r.bits){r.q=null,i(r.qBits,a);return}var h=r.e.modInverse(r.phi);r.keys={privateKey:Vt.rsa.setPrivateKey(r.n,r.e,h,r.p,r.q,h.mod(r.p1),h.mod(r.q1),r.q.modInverse(r.p)),publicKey:Vt.rsa.setPublicKey(r.n,r.e)},t(null,r.keys)}o(a,"finish")}o(qY,"_generateKeyPair");function ka(r){var e=r.toString(16);e[0]>="8"&&(e="00"+e);var t=yt.util.hexToBytes(e);return t.length>1&&(t.charCodeAt(0)===0&&(t.charCodeAt(1)&128)===0||t.charCodeAt(0)===255&&(t.charCodeAt(1)&128)===128)?t.substr(1):t}o(ka,"_bnToBytes");function HY(r){return r<=100?27:r<=150?18:r<=200?15:r<=250?12:r<=300?9:r<=350?8:r<=400?7:r<=500?6:r<=600?5:r<=800?4:r<=1250?3:2}o(HY,"_getMillerRabinTests");function P3(r){return yt.util.isNodejs&&typeof cN[r]=="function"}o(P3,"_detectNodeCrypto");function O3(r){return typeof Ai.globalScope<"u"&&typeof Ai.globalScope.crypto=="object"&&typeof Ai.globalScope.crypto.subtle=="object"&&typeof Ai.globalScope.crypto.subtle[r]=="function"}o(O3,"_detectSubtleCrypto");function k3(r){return typeof Ai.globalScope<"u"&&typeof Ai.globalScope.msCrypto=="object"&&typeof Ai.globalScope.msCrypto.subtle=="object"&&typeof Ai.globalScope.msCrypto.subtle[r]=="function"}o(k3,"_detectSubtleMsCrypto");function L3(r){for(var e=yt.util.hexToBytes(r.toString(16)),t=new Uint8Array(e.length),n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}o(L3,"_intToUint8Array")});var lN=Z((vde,K3)=>{"use strict";var it=$t();Ru();ea();Y0();Ia();Pu();Ew();_l();bi();tN();eg();lr();typeof M3>"u"&&(M3=it.jsbn.BigInteger);var M3,Se=it.asn1,Ft=it.pki=it.pki||{};K3.exports=Ft.pbe=it.pbe=it.pbe||{};var Rl=Ft.oids,KY={name:"EncryptedPrivateKeyInfo",tagClass:Se.Class.UNIVERSAL,type:Se.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:Se.Class.UNIVERSAL,type:Se.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Se.Class.UNIVERSAL,type:Se.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:Se.Class.UNIVERSAL,type:Se.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:Se.Class.UNIVERSAL,type:Se.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},$Y={name:"PBES2Algorithms",tagClass:Se.Class.UNIVERSAL,type:Se.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:Se.Class.UNIVERSAL,type:Se.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:Se.Class.UNIVERSAL,type:Se.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:Se.Class.UNIVERSAL,type:Se.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:Se.Class.UNIVERSAL,type:Se.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:Se.Class.UNIVERSAL,type:Se.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:Se.Class.UNIVERSAL,type:Se.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:Se.Class.UNIVERSAL,type:Se.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:Se.Class.UNIVERSAL,type:Se.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:Se.Class.UNIVERSAL,type:Se.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:Se.Class.UNIVERSAL,type:Se.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:Se.Class.UNIVERSAL,type:Se.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},GY={name:"pkcs-12PbeParams",tagClass:Se.Class.UNIVERSAL,type:Se.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:Se.Class.UNIVERSAL,type:Se.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:Se.Class.UNIVERSAL,type:Se.Type.INTEGER,constructed:!1,capture:"iterations"}]};Ft.encryptPrivateKeyInfo=function(r,e,t){t=t||{},t.saltSize=t.saltSize||8,t.count=t.count||2048,t.algorithm=t.algorithm||"aes128",t.prfAlgorithm=t.prfAlgorithm||"sha1";var n=it.random.getBytesSync(t.saltSize),s=t.count,i=Se.integerToDer(s),a,u,c;if(t.algorithm.indexOf("aes")===0||t.algorithm==="des"){var f,h,m;switch(t.algorithm){case"aes128":a=16,f=16,h=Rl["aes128-CBC"],m=it.aes.createEncryptionCipher;break;case"aes192":a=24,f=16,h=Rl["aes192-CBC"],m=it.aes.createEncryptionCipher;break;case"aes256":a=32,f=16,h=Rl["aes256-CBC"],m=it.aes.createEncryptionCipher;break;case"des":a=8,f=8,h=Rl.desCBC,m=it.des.createEncryptionCipher;break;default:var g=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw g.algorithm=t.algorithm,g}var x="hmacWith"+t.prfAlgorithm.toUpperCase(),v=H3(x),w=it.pkcs5.pbkdf2(e,n,s,a,v),S=it.random.getBytesSync(f),A=m(w);A.start(S),A.update(Se.toDer(r)),A.finish(),c=A.output.getBytes();var T=XY(n,i,a,x);u=Se.create(Se.Class.UNIVERSAL,Se.Type.SEQUENCE,!0,[Se.create(Se.Class.UNIVERSAL,Se.Type.OID,!1,Se.oidToDer(Rl.pkcs5PBES2).getBytes()),Se.create(Se.Class.UNIVERSAL,Se.Type.SEQUENCE,!0,[Se.create(Se.Class.UNIVERSAL,Se.Type.SEQUENCE,!0,[Se.create(Se.Class.UNIVERSAL,Se.Type.OID,!1,Se.oidToDer(Rl.pkcs5PBKDF2).getBytes()),T]),Se.create(Se.Class.UNIVERSAL,Se.Type.SEQUENCE,!0,[Se.create(Se.Class.UNIVERSAL,Se.Type.OID,!1,Se.oidToDer(h).getBytes()),Se.create(Se.Class.UNIVERSAL,Se.Type.OCTETSTRING,!1,S)])])])}else if(t.algorithm==="3des"){a=24;var b=new it.util.ByteBuffer(n),w=Ft.pbe.generatePkcs12Key(e,b,1,s,a),S=Ft.pbe.generatePkcs12Key(e,b,2,s,a),A=it.des.createEncryptionCipher(w);A.start(S),A.update(Se.toDer(r)),A.finish(),c=A.output.getBytes(),u=Se.create(Se.Class.UNIVERSAL,Se.Type.SEQUENCE,!0,[Se.create(Se.Class.UNIVERSAL,Se.Type.OID,!1,Se.oidToDer(Rl["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),Se.create(Se.Class.UNIVERSAL,Se.Type.SEQUENCE,!0,[Se.create(Se.Class.UNIVERSAL,Se.Type.OCTETSTRING,!1,n),Se.create(Se.Class.UNIVERSAL,Se.Type.INTEGER,!1,i.getBytes())])])}else{var g=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw g.algorithm=t.algorithm,g}var E=Se.create(Se.Class.UNIVERSAL,Se.Type.SEQUENCE,!0,[u,Se.create(Se.Class.UNIVERSAL,Se.Type.OCTETSTRING,!1,c)]);return E};Ft.decryptPrivateKeyInfo=function(r,e){var t=null,n={},s=[];if(!Se.validate(r,KY,n,s)){var i=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw i.errors=s,i}var a=Se.derToOid(n.encryptionOid),u=Ft.pbe.getCipher(a,n.encryptionParams,e),c=it.util.createBuffer(n.encryptedData);return u.update(c),u.finish()&&(t=Se.fromDer(u.output)),t};Ft.encryptedPrivateKeyToPem=function(r,e){var t={type:"ENCRYPTED PRIVATE KEY",body:Se.toDer(r).getBytes()};return it.pem.encode(t,{maxline:e})};Ft.encryptedPrivateKeyFromPem=function(r){var e=it.pem.decode(r)[0];if(e.type!=="ENCRYPTED PRIVATE KEY"){var t=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw t.headerType=e.type,t}if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return Se.fromDer(e.body)};Ft.encryptRsaPrivateKey=function(r,e,t){if(t=t||{},!t.legacy){var n=Ft.wrapRsaPrivateKey(Ft.privateKeyToAsn1(r));return n=Ft.encryptPrivateKeyInfo(n,e,t),Ft.encryptedPrivateKeyToPem(n)}var s,i,a,u;switch(t.algorithm){case"aes128":s="AES-128-CBC",a=16,i=it.random.getBytesSync(16),u=it.aes.createEncryptionCipher;break;case"aes192":s="AES-192-CBC",a=24,i=it.random.getBytesSync(16),u=it.aes.createEncryptionCipher;break;case"aes256":s="AES-256-CBC",a=32,i=it.random.getBytesSync(16),u=it.aes.createEncryptionCipher;break;case"3des":s="DES-EDE3-CBC",a=24,i=it.random.getBytesSync(8),u=it.des.createEncryptionCipher;break;case"des":s="DES-CBC",a=8,i=it.random.getBytesSync(8),u=it.des.createEncryptionCipher;break;default:var c=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+t.algorithm+'".');throw c.algorithm=t.algorithm,c}var f=it.pbe.opensslDeriveBytes(e,i.substr(0,8),a),h=u(f);h.start(i),h.update(Se.toDer(Ft.privateKeyToAsn1(r))),h.finish();var m={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:s,parameters:it.util.bytesToHex(i).toUpperCase()},body:h.output.getBytes()};return it.pem.encode(m)};Ft.decryptRsaPrivateKey=function(r,e){var t=null,n=it.pem.decode(r)[0];if(n.type!=="ENCRYPTED PRIVATE KEY"&&n.type!=="PRIVATE KEY"&&n.type!=="RSA PRIVATE KEY"){var s=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw s.headerType=s,s}if(n.procType&&n.procType.type==="ENCRYPTED"){var i,a;switch(n.dekInfo.algorithm){case"DES-CBC":i=8,a=it.des.createDecryptionCipher;break;case"DES-EDE3-CBC":i=24,a=it.des.createDecryptionCipher;break;case"AES-128-CBC":i=16,a=it.aes.createDecryptionCipher;break;case"AES-192-CBC":i=24,a=it.aes.createDecryptionCipher;break;case"AES-256-CBC":i=32,a=it.aes.createDecryptionCipher;break;case"RC2-40-CBC":i=5,a=o(function(m){return it.rc2.createDecryptionCipher(m,40)},"cipherFn");break;case"RC2-64-CBC":i=8,a=o(function(m){return it.rc2.createDecryptionCipher(m,64)},"cipherFn");break;case"RC2-128-CBC":i=16,a=o(function(m){return it.rc2.createDecryptionCipher(m,128)},"cipherFn");break;default:var s=new Error('Could not decrypt private key; unsupported encryption algorithm "'+n.dekInfo.algorithm+'".');throw s.algorithm=n.dekInfo.algorithm,s}var u=it.util.hexToBytes(n.dekInfo.parameters),c=it.pbe.opensslDeriveBytes(e,u.substr(0,8),i),f=a(c);if(f.start(u),f.update(it.util.createBuffer(n.body)),f.finish())t=f.output.getBytes();else return t}else t=n.body;return n.type==="ENCRYPTED PRIVATE KEY"?t=Ft.decryptPrivateKeyInfo(Se.fromDer(t),e):t=Se.fromDer(t),t!==null&&(t=Ft.privateKeyFromAsn1(t)),t};Ft.pbe.generatePkcs12Key=function(r,e,t,n,s,i){var a,u;if(typeof i>"u"||i===null){if(!("sha1"in it.md))throw new Error('"sha1" hash algorithm unavailable.');i=it.md.sha1.create()}var c=i.digestLength,f=i.blockLength,h=new it.util.ByteBuffer,m=new it.util.ByteBuffer;if(r!=null){for(u=0;u<r.length;u++)m.putInt16(r.charCodeAt(u));m.putInt16(0)}var g=m.length(),x=e.length(),v=new it.util.ByteBuffer;v.fillWithByte(t,f);var w=f*Math.ceil(x/f),S=new it.util.ByteBuffer;for(u=0;u<w;u++)S.putByte(e.at(u%x));var A=f*Math.ceil(g/f),T=new it.util.ByteBuffer;for(u=0;u<A;u++)T.putByte(m.at(u%g));var b=S;b.putBuffer(T);for(var E=Math.ceil(s/c),C=1;C<=E;C++){var _=new it.util.ByteBuffer;_.putBytes(v.bytes()),_.putBytes(b.bytes());for(var F=0;F<n;F++)i.start(),i.update(_.getBytes()),_=i.digest();var R=new it.util.ByteBuffer;for(u=0;u<f;u++)R.putByte(_.at(u%c));var q=Math.ceil(x/f)+Math.ceil(g/f),H=new it.util.ByteBuffer;for(a=0;a<q;a++){var K=new it.util.ByteBuffer(b.getBytes(f)),X=511;for(u=R.length()-1;u>=0;u--)X=X>>8,X+=R.at(u)+K.at(u),K.setAt(u,X&255);H.putBuffer(K)}b=H,h.putBuffer(_)}return h.truncate(h.length()-s),h};Ft.pbe.getCipher=function(r,e,t){switch(r){case Ft.oids.pkcs5PBES2:return Ft.pbe.getCipherForPBES2(r,e,t);case Ft.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case Ft.oids["pbewithSHAAnd40BitRC2-CBC"]:return Ft.pbe.getCipherForPKCS12PBE(r,e,t);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=r,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}};Ft.pbe.getCipherForPBES2=function(r,e,t){var n={},s=[];if(!Se.validate(e,$Y,n,s)){var i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw i.errors=s,i}if(r=Se.derToOid(n.kdfOid),r!==Ft.oids.pkcs5PBKDF2){var i=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw i.oid=r,i.supportedOids=["pkcs5PBKDF2"],i}if(r=Se.derToOid(n.encOid),r!==Ft.oids["aes128-CBC"]&&r!==Ft.oids["aes192-CBC"]&&r!==Ft.oids["aes256-CBC"]&&r!==Ft.oids["des-EDE3-CBC"]&&r!==Ft.oids.desCBC){var i=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw i.oid=r,i.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],i}var a=n.kdfSalt,u=it.util.createBuffer(n.kdfIterationCount);u=u.getInt(u.length()<<3);var c,f;switch(Ft.oids[r]){case"aes128-CBC":c=16,f=it.aes.createDecryptionCipher;break;case"aes192-CBC":c=24,f=it.aes.createDecryptionCipher;break;case"aes256-CBC":c=32,f=it.aes.createDecryptionCipher;break;case"des-EDE3-CBC":c=24,f=it.des.createDecryptionCipher;break;case"desCBC":c=8,f=it.des.createDecryptionCipher;break}var h=q3(n.prfOid),m=it.pkcs5.pbkdf2(t,a,u,c,h),g=n.encIv,x=f(m);return x.start(g),x};Ft.pbe.getCipherForPKCS12PBE=function(r,e,t){var n={},s=[];if(!Se.validate(e,GY,n,s)){var i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw i.errors=s,i}var a=it.util.createBuffer(n.salt),u=it.util.createBuffer(n.iterations);u=u.getInt(u.length()<<3);var c,f,h;switch(r){case Ft.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,f=8,h=it.des.startDecrypting;break;case Ft.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,f=8,h=o(function(w,S){var A=it.rc2.createDecryptionCipher(w,40);return A.start(S,null),A},"cipherFn");break;default:var i=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw i.oid=r,i}var m=q3(n.prfOid),g=Ft.pbe.generatePkcs12Key(t,a,1,u,c,m);m.start();var x=Ft.pbe.generatePkcs12Key(t,a,2,u,f,m);return h(g,x)};Ft.pbe.opensslDeriveBytes=function(r,e,t,n){if(typeof n>"u"||n===null){if(!("md5"in it.md))throw new Error('"md5" hash algorithm unavailable.');n=it.md.md5.create()}e===null&&(e="");for(var s=[F3(n,r+e)],i=16,a=1;i<t;++a,i+=16)s.push(F3(n,s[a-1]+r+e));return s.join("").substr(0,t)};function F3(r,e){return r.start().update(e).digest().getBytes()}o(F3,"hash");function q3(r){var e;if(!r)e="hmacWithSHA1";else if(e=Ft.oids[Se.derToOid(r)],!e){var t=new Error("Unsupported PRF OID.");throw t.oid=r,t.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],t}return H3(e)}o(q3,"prfOidToMessageDigest");function H3(r){var e=it.md;switch(r){case"hmacWithSHA224":e=it.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":r=r.substr(8).toLowerCase();break;default:var t=new Error("Unsupported PRF algorithm.");throw t.algorithm=r,t.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],t}if(!e||!(r in e))throw new Error("Unknown hash algorithm: "+r);return e[r].create()}o(H3,"prfAlgorithmToMessageDigest");function XY(r,e,t,n){var s=Se.create(Se.Class.UNIVERSAL,Se.Type.SEQUENCE,!0,[Se.create(Se.Class.UNIVERSAL,Se.Type.OCTETSTRING,!1,r),Se.create(Se.Class.UNIVERSAL,Se.Type.INTEGER,!1,e.getBytes())]);return n!=="hmacWithSHA1"&&s.value.push(Se.create(Se.Class.UNIVERSAL,Se.Type.INTEGER,!1,it.util.hexToBytes(t.toString(16))),Se.create(Se.Class.UNIVERSAL,Se.Type.SEQUENCE,!0,[Se.create(Se.Class.UNIVERSAL,Se.Type.OID,!1,Se.oidToDer(Ft.oids[n]).getBytes()),Se.create(Se.Class.UNIVERSAL,Se.Type.NULL,!1,"")])),s}o(XY,"createPbkdf2Params")});var fN=Z((xde,X3)=>{"use strict";var fp=$t();ea();lr();var rt=fp.asn1,hp=X3.exports=fp.pkcs7asn1=fp.pkcs7asn1||{};fp.pkcs7=fp.pkcs7||{};fp.pkcs7.asn1=hp;var $3={name:"ContentInfo",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:rt.Class.UNIVERSAL,type:rt.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:rt.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};hp.contentInfoValidator=$3;var G3={name:"EncryptedContentInfo",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:rt.Class.UNIVERSAL,type:rt.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:rt.Class.UNIVERSAL,type:rt.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:rt.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:rt.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};hp.envelopedDataValidator={name:"EnvelopedData",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:rt.Class.UNIVERSAL,type:rt.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(G3)};hp.encryptedDataValidator={name:"EncryptedData",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:rt.Class.UNIVERSAL,type:rt.Type.INTEGER,constructed:!1,capture:"version"}].concat(G3)};var WY={name:"SignerInfo",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:rt.Class.UNIVERSAL,type:rt.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:rt.Class.UNIVERSAL,type:rt.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:rt.Class.UNIVERSAL,type:rt.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:rt.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:rt.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:rt.Class.UNIVERSAL,type:rt.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:rt.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};hp.signedDataValidator={name:"SignedData",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:rt.Class.UNIVERSAL,type:rt.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},$3,{name:"SignedData.Certificates",tagClass:rt.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:rt.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SET,capture:"signerInfos",optional:!0,value:[WY]}]};hp.recipientInfoValidator={name:"RecipientInfo",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:rt.Class.UNIVERSAL,type:rt.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:rt.Class.UNIVERSAL,type:rt.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:rt.Class.UNIVERSAL,type:rt.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:rt.Class.UNIVERSAL,type:rt.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:rt.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:rt.Class.UNIVERSAL,type:rt.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}});var hN=Z((wde,W3)=>{"use strict";var Pl=$t();lr();Pl.mgf=Pl.mgf||{};var zY=W3.exports=Pl.mgf.mgf1=Pl.mgf1=Pl.mgf1||{};zY.create=function(r){var e={generate:o(function(t,n){for(var s=new Pl.util.ByteBuffer,i=Math.ceil(n/r.digestLength),a=0;a<i;a++){var u=new Pl.util.ByteBuffer;u.putInt32(a),r.start(),r.update(t+u.getBytes()),s.putBuffer(r.digest())}return s.truncate(s.length()-n),s.getBytes()},"generate")};return e}});var J3=Z((bde,z3)=>{"use strict";var _w=$t();hN();z3.exports=_w.mgf=_w.mgf||{};_w.mgf.mgf1=_w.mgf1});var Bw=Z((Ede,Y3)=>{"use strict";var Ol=$t();bi();lr();var JY=Y3.exports=Ol.pss=Ol.pss||{};JY.create=function(r){arguments.length===3&&(r={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var e=r.md,t=r.mgf,n=e.digestLength,s=r.salt||null;typeof s=="string"&&(s=Ol.util.createBuffer(s));var i;if("saltLength"in r)i=r.saltLength;else if(s!==null)i=s.length();else throw new Error("Salt length not specified or specific salt not given.");if(s!==null&&s.length()!==i)throw new Error("Given salt length does not match length of given salt.");var a=r.prng||Ol.random,u={};return u.encode=function(c,f){var h,m=f-1,g=Math.ceil(m/8),x=c.digest().getBytes();if(g<n+i+2)throw new Error("Message is too long to encrypt.");var v;s===null?v=a.getBytesSync(i):v=s.bytes();var w=new Ol.util.ByteBuffer;w.fillWithByte(0,8),w.putBytes(x),w.putBytes(v),e.start(),e.update(w.getBytes());var S=e.digest().getBytes(),A=new Ol.util.ByteBuffer;A.fillWithByte(0,g-i-n-2),A.putByte(1),A.putBytes(v);var T=A.getBytes(),b=g-n-1,E=t.generate(S,b),C="";for(h=0;h<b;h++)C+=String.fromCharCode(T.charCodeAt(h)^E.charCodeAt(h));var _=65280>>8*g-m&255;return C=String.fromCharCode(C.charCodeAt(0)&~_)+C.substr(1),C+S+"\xBC"},u.verify=function(c,f,h){var m,g=h-1,x=Math.ceil(g/8);if(f=f.substr(-x),x<n+i+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(f.charCodeAt(x-1)!==188)throw new Error("Encoded message does not end in 0xBC.");var v=x-n-1,w=f.substr(0,v),S=f.substr(v,n),A=65280>>8*x-g&255;if((w.charCodeAt(0)&A)!==0)throw new Error("Bits beyond keysize not zero as expected.");var T=t.generate(S,v),b="";for(m=0;m<v;m++)b+=String.fromCharCode(w.charCodeAt(m)^T.charCodeAt(m));b=String.fromCharCode(b.charCodeAt(0)&~A)+b.substr(1);var E=x-n-i-2;for(m=0;m<E;m++)if(b.charCodeAt(m)!==0)throw new Error("Leftmost octets not zero as expected");if(b.charCodeAt(E)!==1)throw new Error("Inconsistent PSS signature, 0x01 marker not found");var C=b.substr(-i),_=new Ol.util.ByteBuffer;_.fillWithByte(0,8),_.putBytes(c),_.putBytes(C),e.start(),e.update(_.getBytes());var F=e.digest().getBytes();return S===F},u}});var Pw=Z((Ade,rk)=>{"use strict";var xt=$t();Ru();ea();Y0();Ia();J3();Pu();_l();Bw();eg();lr();var k=xt.asn1,$e=rk.exports=xt.pki=xt.pki||{},or=$e.oids,Qr={};Qr.CN=or.commonName;Qr.commonName="CN";Qr.C=or.countryName;Qr.countryName="C";Qr.L=or.localityName;Qr.localityName="L";Qr.ST=or.stateOrProvinceName;Qr.stateOrProvinceName="ST";Qr.O=or.organizationName;Qr.organizationName="O";Qr.OU=or.organizationalUnitName;Qr.organizationalUnitName="OU";Qr.E=or.emailAddress;Qr.emailAddress="E";var Z3=xt.pki.rsa.publicKeyValidator,YY={name:"Certificate",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:k.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:k.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:k.Class.UNIVERSAL,type:k.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:k.Class.UNIVERSAL,type:k.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:k.Class.UNIVERSAL,type:k.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:k.Class.UNIVERSAL,type:k.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},Z3,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:k.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:k.Class.UNIVERSAL,type:k.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:k.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:k.Class.UNIVERSAL,type:k.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:k.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:k.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:k.Class.UNIVERSAL,type:k.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},QY={name:"rsapss",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:k.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:k.Class.UNIVERSAL,type:k.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:k.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:k.Class.UNIVERSAL,type:k.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:k.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:k.Class.UNIVERSAL,type:k.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:k.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:k.Class.UNIVERSAL,type:k.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},ZY={name:"CertificationRequestInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},Z3,{name:"CertificationRequestInfo.attributes",tagClass:k.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:k.Class.UNIVERSAL,type:k.Type.SET,constructed:!0}]}]}]},eQ={name:"CertificationRequest",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[ZY,{name:"CertificationRequest.signatureAlgorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:k.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:k.Class.UNIVERSAL,type:k.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};$e.RDNAttributesAsArray=function(r,e){for(var t=[],n,s,i,a=0;a<r.value.length;++a){n=r.value[a];for(var u=0;u<n.value.length;++u)i={},s=n.value[u],i.type=k.derToOid(s.value[0].value),i.value=s.value[1].value,i.valueTagClass=s.value[1].type,i.type in or&&(i.name=or[i.type],i.name in Qr&&(i.shortName=Qr[i.name])),e&&(e.update(i.type),e.update(i.value)),t.push(i)}return t};$e.CRIAttributesAsArray=function(r){for(var e=[],t=0;t<r.length;++t)for(var n=r[t],s=k.derToOid(n.value[0].value),i=n.value[1].value,a=0;a<i.length;++a){var u={};if(u.type=s,u.value=i[a].value,u.valueTagClass=i[a].type,u.type in or&&(u.name=or[u.type],u.name in Qr&&(u.shortName=Qr[u.name])),u.type===or.extensionRequest){u.extensions=[];for(var c=0;c<u.value.length;++c)u.extensions.push($e.certificateExtensionFromAsn1(u.value[c]))}e.push(u)}return e};function Lu(r,e){typeof e=="string"&&(e={shortName:e});for(var t=null,n,s=0;t===null&&s<r.attributes.length;++s)n=r.attributes[s],(e.type&&e.type===n.type||e.name&&e.name===n.name||e.shortName&&e.shortName===n.shortName)&&(t=n);return t}o(Lu,"_getAttribute");var Dw=o(function(r,e,t){var n={};if(r!==or["RSASSA-PSS"])return n;t&&(n={hash:{algorithmOid:or.sha1},mgf:{algorithmOid:or.mgf1,hash:{algorithmOid:or.sha1}},saltLength:20});var s={},i=[];if(!k.validate(e,QY,s,i)){var a=new Error("Cannot read RSASSA-PSS parameter block.");throw a.errors=i,a}return s.hashOid!==void 0&&(n.hash=n.hash||{},n.hash.algorithmOid=k.derToOid(s.hashOid)),s.maskGenOid!==void 0&&(n.mgf=n.mgf||{},n.mgf.algorithmOid=k.derToOid(s.maskGenOid),n.mgf.hash=n.mgf.hash||{},n.mgf.hash.algorithmOid=k.derToOid(s.maskGenHashOid)),s.saltLength!==void 0&&(n.saltLength=s.saltLength.charCodeAt(0)),n},"_readSignatureParameters"),Rw=o(function(r){switch(or[r.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return xt.md.sha1.create();case"md5WithRSAEncryption":return xt.md.md5.create();case"sha256WithRSAEncryption":return xt.md.sha256.create();case"sha384WithRSAEncryption":return xt.md.sha384.create();case"sha512WithRSAEncryption":return xt.md.sha512.create();case"RSASSA-PSS":return xt.md.sha256.create();default:var e=new Error("Could not compute "+r.type+" digest. Unknown signature OID.");throw e.signatureOid=r.signatureOid,e}},"_createSignatureDigest"),ek=o(function(r){var e=r.certificate,t;switch(e.signatureOid){case or.sha1WithRSAEncryption:case or.sha1WithRSASignature:break;case or["RSASSA-PSS"]:var n,s;if(n=or[e.signatureParameters.mgf.hash.algorithmOid],n===void 0||xt.md[n]===void 0){var i=new Error("Unsupported MGF hash function.");throw i.oid=e.signatureParameters.mgf.hash.algorithmOid,i.name=n,i}if(s=or[e.signatureParameters.mgf.algorithmOid],s===void 0||xt.mgf[s]===void 0){var i=new Error("Unsupported MGF function.");throw i.oid=e.signatureParameters.mgf.algorithmOid,i.name=s,i}if(s=xt.mgf[s].create(xt.md[n].create()),n=or[e.signatureParameters.hash.algorithmOid],n===void 0||xt.md[n]===void 0){var i=new Error("Unsupported RSASSA-PSS hash function.");throw i.oid=e.signatureParameters.hash.algorithmOid,i.name=n,i}t=xt.pss.create(xt.md[n].create(),s,e.signatureParameters.saltLength);break}return e.publicKey.verify(r.md.digest().getBytes(),r.signature,t)},"_verifySignature");$e.certificateFromPem=function(r,e,t){var n=xt.pem.decode(r)[0];if(n.type!=="CERTIFICATE"&&n.type!=="X509 CERTIFICATE"&&n.type!=="TRUSTED CERTIFICATE"){var s=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw s.headerType=n.type,s}if(n.procType&&n.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var i=k.fromDer(n.body,t);return $e.certificateFromAsn1(i,e)};$e.certificateToPem=function(r,e){var t={type:"CERTIFICATE",body:k.toDer($e.certificateToAsn1(r)).getBytes()};return xt.pem.encode(t,{maxline:e})};$e.publicKeyFromPem=function(r){var e=xt.pem.decode(r)[0];if(e.type!=="PUBLIC KEY"&&e.type!=="RSA PUBLIC KEY"){var t=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw t.headerType=e.type,t}if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert public key from PEM; PEM is encrypted.");var n=k.fromDer(e.body);return $e.publicKeyFromAsn1(n)};$e.publicKeyToPem=function(r,e){var t={type:"PUBLIC KEY",body:k.toDer($e.publicKeyToAsn1(r)).getBytes()};return xt.pem.encode(t,{maxline:e})};$e.publicKeyToRSAPublicKeyPem=function(r,e){var t={type:"RSA PUBLIC KEY",body:k.toDer($e.publicKeyToRSAPublicKey(r)).getBytes()};return xt.pem.encode(t,{maxline:e})};$e.getPublicKeyFingerprint=function(r,e){e=e||{};var t=e.md||xt.md.sha1.create(),n=e.type||"RSAPublicKey",s;switch(n){case"RSAPublicKey":s=k.toDer($e.publicKeyToRSAPublicKey(r)).getBytes();break;case"SubjectPublicKeyInfo":s=k.toDer($e.publicKeyToAsn1(r)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+e.type+'".')}t.start(),t.update(s);var i=t.digest();if(e.encoding==="hex"){var a=i.toHex();return e.delimiter?a.match(/.{2}/g).join(e.delimiter):a}else{if(e.encoding==="binary")return i.getBytes();if(e.encoding)throw new Error('Unknown encoding "'+e.encoding+'".')}return i};$e.certificationRequestFromPem=function(r,e,t){var n=xt.pem.decode(r)[0];if(n.type!=="CERTIFICATE REQUEST"){var s=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw s.headerType=n.type,s}if(n.procType&&n.procType.type==="ENCRYPTED")throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var i=k.fromDer(n.body,t);return $e.certificationRequestFromAsn1(i,e)};$e.certificationRequestToPem=function(r,e){var t={type:"CERTIFICATE REQUEST",body:k.toDer($e.certificationRequestToAsn1(r)).getBytes()};return xt.pem.encode(t,{maxline:e})};$e.createCertificate=function(){var r={};return r.version=2,r.serialNumber="00",r.signatureOid=null,r.signature=null,r.siginfo={},r.siginfo.algorithmOid=null,r.validity={},r.validity.notBefore=new Date,r.validity.notAfter=new Date,r.issuer={},r.issuer.getField=function(e){return Lu(r.issuer,e)},r.issuer.addField=function(e){Ci([e]),r.issuer.attributes.push(e)},r.issuer.attributes=[],r.issuer.hash=null,r.subject={},r.subject.getField=function(e){return Lu(r.subject,e)},r.subject.addField=function(e){Ci([e]),r.subject.attributes.push(e)},r.subject.attributes=[],r.subject.hash=null,r.extensions=[],r.publicKey=null,r.md=null,r.setSubject=function(e,t){Ci(e),r.subject.attributes=e,delete r.subject.uniqueId,t&&(r.subject.uniqueId=t),r.subject.hash=null},r.setIssuer=function(e,t){Ci(e),r.issuer.attributes=e,delete r.issuer.uniqueId,t&&(r.issuer.uniqueId=t),r.issuer.hash=null},r.setExtensions=function(e){for(var t=0;t<e.length;++t)tk(e[t],{cert:r});r.extensions=e},r.getExtension=function(e){typeof e=="string"&&(e={name:e});for(var t=null,n,s=0;t===null&&s<r.extensions.length;++s)n=r.extensions[s],(e.id&&n.id===e.id||e.name&&n.name===e.name)&&(t=n);return t},r.sign=function(e,t){r.md=t||xt.md.sha1.create();var n=or[r.md.algorithm+"WithRSAEncryption"];if(!n){var s=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw s.algorithm=r.md.algorithm,s}r.signatureOid=r.siginfo.algorithmOid=n,r.tbsCertificate=$e.getTBSCertificate(r);var i=k.toDer(r.tbsCertificate);r.md.update(i.getBytes()),r.signature=e.sign(r.md)},r.verify=function(e){var t=!1;if(!r.issued(e)){var n=e.issuer,s=r.subject,i=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 i.expectedIssuer=s.attributes,i.actualIssuer=n.attributes,i}var a=e.md;if(a===null){a=Rw({signatureOid:e.signatureOid,type:"certificate"});var u=e.tbsCertificate||$e.getTBSCertificate(e),c=k.toDer(u);a.update(c.getBytes())}return a!==null&&(t=ek({certificate:r,md:a,signature:e.signature})),t},r.isIssuer=function(e){var t=!1,n=r.issuer,s=e.subject;if(n.hash&&s.hash)t=n.hash===s.hash;else if(n.attributes.length===s.attributes.length){t=!0;for(var i,a,u=0;t&&u<n.attributes.length;++u)i=n.attributes[u],a=s.attributes[u],(i.type!==a.type||i.value!==a.value)&&(t=!1)}return t},r.issued=function(e){return e.isIssuer(r)},r.generateSubjectKeyIdentifier=function(){return $e.getPublicKeyFingerprint(r.publicKey,{type:"RSAPublicKey"})},r.verifySubjectKeyIdentifier=function(){for(var e=or.subjectKeyIdentifier,t=0;t<r.extensions.length;++t){var n=r.extensions[t];if(n.id===e){var s=r.generateSubjectKeyIdentifier().getBytes();return xt.util.hexToBytes(n.subjectKeyIdentifier)===s}}return!1},r};$e.certificateFromAsn1=function(r,e){var t={},n=[];if(!k.validate(r,YY,t,n)){var s=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw s.errors=n,s}var i=k.derToOid(t.publicKeyOid);if(i!==$e.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var a=$e.createCertificate();a.version=t.certVersion?t.certVersion.charCodeAt(0):0;var u=xt.util.createBuffer(t.certSerialNumber);a.serialNumber=u.toHex(),a.signatureOid=xt.asn1.derToOid(t.certSignatureOid),a.signatureParameters=Dw(a.signatureOid,t.certSignatureParams,!0),a.siginfo.algorithmOid=xt.asn1.derToOid(t.certinfoSignatureOid),a.siginfo.parameters=Dw(a.siginfo.algorithmOid,t.certinfoSignatureParams,!1),a.signature=t.certSignature;var c=[];if(t.certValidity1UTCTime!==void 0&&c.push(k.utcTimeToDate(t.certValidity1UTCTime)),t.certValidity2GeneralizedTime!==void 0&&c.push(k.generalizedTimeToDate(t.certValidity2GeneralizedTime)),t.certValidity3UTCTime!==void 0&&c.push(k.utcTimeToDate(t.certValidity3UTCTime)),t.certValidity4GeneralizedTime!==void 0&&c.push(k.generalizedTimeToDate(t.certValidity4GeneralizedTime)),c.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(c.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(a.validity.notBefore=c[0],a.validity.notAfter=c[1],a.tbsCertificate=t.tbsCertificate,e){a.md=Rw({signatureOid:a.signatureOid,type:"certificate"});var f=k.toDer(a.tbsCertificate);a.md.update(f.getBytes())}var h=xt.md.sha1.create(),m=k.toDer(t.certIssuer);h.update(m.getBytes()),a.issuer.getField=function(v){return Lu(a.issuer,v)},a.issuer.addField=function(v){Ci([v]),a.issuer.attributes.push(v)},a.issuer.attributes=$e.RDNAttributesAsArray(t.certIssuer),t.certIssuerUniqueId&&(a.issuer.uniqueId=t.certIssuerUniqueId),a.issuer.hash=h.digest().toHex();var g=xt.md.sha1.create(),x=k.toDer(t.certSubject);return g.update(x.getBytes()),a.subject.getField=function(v){return Lu(a.subject,v)},a.subject.addField=function(v){Ci([v]),a.subject.attributes.push(v)},a.subject.attributes=$e.RDNAttributesAsArray(t.certSubject),t.certSubjectUniqueId&&(a.subject.uniqueId=t.certSubjectUniqueId),a.subject.hash=g.digest().toHex(),t.certExtensions?a.extensions=$e.certificateExtensionsFromAsn1(t.certExtensions):a.extensions=[],a.publicKey=$e.publicKeyFromAsn1(t.subjectPublicKeyInfo),a};$e.certificateExtensionsFromAsn1=function(r){for(var e=[],t=0;t<r.value.length;++t)for(var n=r.value[t],s=0;s<n.value.length;++s)e.push($e.certificateExtensionFromAsn1(n.value[s]));return e};$e.certificateExtensionFromAsn1=function(r){var e={};if(e.id=k.derToOid(r.value[0].value),e.critical=!1,r.value[1].type===k.Type.BOOLEAN?(e.critical=r.value[1].value.charCodeAt(0)!==0,e.value=r.value[2].value):e.value=r.value[1].value,e.id in or){if(e.name=or[e.id],e.name==="keyUsage"){var t=k.fromDer(e.value),n=0,s=0;t.value.length>1&&(n=t.value.charCodeAt(1),s=t.value.length>2?t.value.charCodeAt(2):0),e.digitalSignature=(n&128)===128,e.nonRepudiation=(n&64)===64,e.keyEncipherment=(n&32)===32,e.dataEncipherment=(n&16)===16,e.keyAgreement=(n&8)===8,e.keyCertSign=(n&4)===4,e.cRLSign=(n&2)===2,e.encipherOnly=(n&1)===1,e.decipherOnly=(s&128)===128}else if(e.name==="basicConstraints"){var t=k.fromDer(e.value);t.value.length>0&&t.value[0].type===k.Type.BOOLEAN?e.cA=t.value[0].value.charCodeAt(0)!==0:e.cA=!1;var i=null;t.value.length>0&&t.value[0].type===k.Type.INTEGER?i=t.value[0].value:t.value.length>1&&(i=t.value[1].value),i!==null&&(e.pathLenConstraint=k.derToInteger(i))}else if(e.name==="extKeyUsage")for(var t=k.fromDer(e.value),a=0;a<t.value.length;++a){var u=k.derToOid(t.value[a].value);u in or?e[or[u]]=!0:e[u]=!0}else if(e.name==="nsCertType"){var t=k.fromDer(e.value),n=0;t.value.length>1&&(n=t.value.charCodeAt(1)),e.client=(n&128)===128,e.server=(n&64)===64,e.email=(n&32)===32,e.objsign=(n&16)===16,e.reserved=(n&8)===8,e.sslCA=(n&4)===4,e.emailCA=(n&2)===2,e.objCA=(n&1)===1}else if(e.name==="subjectAltName"||e.name==="issuerAltName"){e.altNames=[];for(var c,t=k.fromDer(e.value),f=0;f<t.value.length;++f){c=t.value[f];var h={type:c.type,value:c.value};switch(e.altNames.push(h),c.type){case 1:case 2:case 6:break;case 7:h.ip=xt.util.bytesToIP(c.value);break;case 8:h.oid=k.derToOid(c.value);break;default:}}}else if(e.name==="subjectKeyIdentifier"){var t=k.fromDer(e.value);e.subjectKeyIdentifier=xt.util.bytesToHex(t.value)}}return e};$e.certificationRequestFromAsn1=function(r,e){var t={},n=[];if(!k.validate(r,eQ,t,n)){var s=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw s.errors=n,s}var i=k.derToOid(t.publicKeyOid);if(i!==$e.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var a=$e.createCertificationRequest();if(a.version=t.csrVersion?t.csrVersion.charCodeAt(0):0,a.signatureOid=xt.asn1.derToOid(t.csrSignatureOid),a.signatureParameters=Dw(a.signatureOid,t.csrSignatureParams,!0),a.siginfo.algorithmOid=xt.asn1.derToOid(t.csrSignatureOid),a.siginfo.parameters=Dw(a.siginfo.algorithmOid,t.csrSignatureParams,!1),a.signature=t.csrSignature,a.certificationRequestInfo=t.certificationRequestInfo,e){a.md=Rw({signatureOid:a.signatureOid,type:"certification request"});var u=k.toDer(a.certificationRequestInfo);a.md.update(u.getBytes())}var c=xt.md.sha1.create();return a.subject.getField=function(f){return Lu(a.subject,f)},a.subject.addField=function(f){Ci([f]),a.subject.attributes.push(f)},a.subject.attributes=$e.RDNAttributesAsArray(t.certificationRequestInfoSubject,c),a.subject.hash=c.digest().toHex(),a.publicKey=$e.publicKeyFromAsn1(t.subjectPublicKeyInfo),a.getAttribute=function(f){return Lu(a,f)},a.addAttribute=function(f){Ci([f]),a.attributes.push(f)},a.attributes=$e.CRIAttributesAsArray(t.certificationRequestInfoAttributes||[]),a};$e.createCertificationRequest=function(){var r={};return r.version=0,r.signatureOid=null,r.signature=null,r.siginfo={},r.siginfo.algorithmOid=null,r.subject={},r.subject.getField=function(e){return Lu(r.subject,e)},r.subject.addField=function(e){Ci([e]),r.subject.attributes.push(e)},r.subject.attributes=[],r.subject.hash=null,r.publicKey=null,r.attributes=[],r.getAttribute=function(e){return Lu(r,e)},r.addAttribute=function(e){Ci([e]),r.attributes.push(e)},r.md=null,r.setSubject=function(e){Ci(e),r.subject.attributes=e,r.subject.hash=null},r.setAttributes=function(e){Ci(e),r.attributes=e},r.sign=function(e,t){r.md=t||xt.md.sha1.create();var n=or[r.md.algorithm+"WithRSAEncryption"];if(!n){var s=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw s.algorithm=r.md.algorithm,s}r.signatureOid=r.siginfo.algorithmOid=n,r.certificationRequestInfo=$e.getCertificationRequestInfo(r);var i=k.toDer(r.certificationRequestInfo);r.md.update(i.getBytes()),r.signature=e.sign(r.md)},r.verify=function(){var e=!1,t=r.md;if(t===null){t=Rw({signatureOid:r.signatureOid,type:"certification request"});var n=r.certificationRequestInfo||$e.getCertificationRequestInfo(r),s=k.toDer(n);t.update(s.getBytes())}return t!==null&&(e=ek({certificate:r,md:t,signature:r.signature})),e},r};function pp(r){for(var e=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]),t,n,s=r.attributes,i=0;i<s.length;++i){t=s[i];var a=t.value,u=k.Type.PRINTABLESTRING;"valueTagClass"in t&&(u=t.valueTagClass,u===k.Type.UTF8&&(a=xt.util.encodeUtf8(a))),n=k.create(k.Class.UNIVERSAL,k.Type.SET,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(t.type).getBytes()),k.create(k.Class.UNIVERSAL,u,!1,a)])]),e.value.push(n)}return e}o(pp,"_dnToAsn1");function Ci(r){for(var e,t=0;t<r.length;++t){if(e=r[t],typeof e.name>"u"&&(e.type&&e.type in $e.oids?e.name=$e.oids[e.type]:e.shortName&&e.shortName in Qr&&(e.name=$e.oids[Qr[e.shortName]])),typeof e.type>"u")if(e.name&&e.name in $e.oids)e.type=$e.oids[e.name];else{var n=new Error("Attribute type not specified.");throw n.attribute=e,n}if(typeof e.shortName>"u"&&e.name&&e.name in Qr&&(e.shortName=Qr[e.name]),e.type===or.extensionRequest&&(e.valueConstructed=!0,e.valueTagClass=k.Type.SEQUENCE,!e.value&&e.extensions)){e.value=[];for(var s=0;s<e.extensions.length;++s)e.value.push($e.certificateExtensionToAsn1(tk(e.extensions[s])))}if(typeof e.value>"u"){var n=new Error("Attribute value not specified.");throw n.attribute=e,n}}}o(Ci,"_fillMissingFields");function tk(r,e){if(e=e||{},typeof r.name>"u"&&r.id&&r.id in $e.oids&&(r.name=$e.oids[r.id]),typeof r.id>"u")if(r.name&&r.name in $e.oids)r.id=$e.oids[r.name];else{var t=new Error("Extension ID not specified.");throw t.extension=r,t}if(typeof r.value<"u")return r;if(r.name==="keyUsage"){var n=0,s=0,i=0;r.digitalSignature&&(s|=128,n=7),r.nonRepudiation&&(s|=64,n=6),r.keyEncipherment&&(s|=32,n=5),r.dataEncipherment&&(s|=16,n=4),r.keyAgreement&&(s|=8,n=3),r.keyCertSign&&(s|=4,n=2),r.cRLSign&&(s|=2,n=1),r.encipherOnly&&(s|=1,n=0),r.decipherOnly&&(i|=128,n=7);var a=String.fromCharCode(n);i!==0?a+=String.fromCharCode(s)+String.fromCharCode(i):s!==0&&(a+=String.fromCharCode(s)),r.value=k.create(k.Class.UNIVERSAL,k.Type.BITSTRING,!1,a)}else if(r.name==="basicConstraints")r.value=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]),r.cA&&r.value.value.push(k.create(k.Class.UNIVERSAL,k.Type.BOOLEAN,!1,"\xFF")),"pathLenConstraint"in r&&r.value.value.push(k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(r.pathLenConstraint).getBytes()));else if(r.name==="extKeyUsage"){r.value=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);var u=r.value.value;for(var c in r)r[c]===!0&&(c in or?u.push(k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(or[c]).getBytes())):c.indexOf(".")!==-1&&u.push(k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(c).getBytes())))}else if(r.name==="nsCertType"){var n=0,s=0;r.client&&(s|=128,n=7),r.server&&(s|=64,n=6),r.email&&(s|=32,n=5),r.objsign&&(s|=16,n=4),r.reserved&&(s|=8,n=3),r.sslCA&&(s|=4,n=2),r.emailCA&&(s|=2,n=1),r.objCA&&(s|=1,n=0);var a=String.fromCharCode(n);s!==0&&(a+=String.fromCharCode(s)),r.value=k.create(k.Class.UNIVERSAL,k.Type.BITSTRING,!1,a)}else if(r.name==="subjectAltName"||r.name==="issuerAltName"){r.value=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);for(var f,h=0;h<r.altNames.length;++h){f=r.altNames[h];var a=f.value;if(f.type===7&&f.ip){if(a=xt.util.bytesFromIP(f.ip),a===null){var t=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw t.extension=r,t}}else f.type===8&&(f.oid?a=k.oidToDer(k.oidToDer(f.oid)):a=k.oidToDer(a));r.value.value.push(k.create(k.Class.CONTEXT_SPECIFIC,f.type,!1,a))}}else if(r.name==="nsComment"&&e.cert){if(!/^[\x00-\x7F]*$/.test(r.comment)||r.comment.length<1||r.comment.length>128)throw new Error('Invalid "nsComment" content.');r.value=k.create(k.Class.UNIVERSAL,k.Type.IA5STRING,!1,r.comment)}else if(r.name==="subjectKeyIdentifier"&&e.cert){var m=e.cert.generateSubjectKeyIdentifier();r.subjectKeyIdentifier=m.toHex(),r.value=k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,m.getBytes())}else if(r.name==="authorityKeyIdentifier"&&e.cert){r.value=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);var u=r.value.value;if(r.keyIdentifier){var g=r.keyIdentifier===!0?e.cert.generateSubjectKeyIdentifier().getBytes():r.keyIdentifier;u.push(k.create(k.Class.CONTEXT_SPECIFIC,0,!1,g))}if(r.authorityCertIssuer){var x=[k.create(k.Class.CONTEXT_SPECIFIC,4,!0,[pp(r.authorityCertIssuer===!0?e.cert.issuer:r.authorityCertIssuer)])];u.push(k.create(k.Class.CONTEXT_SPECIFIC,1,!0,x))}if(r.serialNumber){var v=xt.util.hexToBytes(r.serialNumber===!0?e.cert.serialNumber:r.serialNumber);u.push(k.create(k.Class.CONTEXT_SPECIFIC,2,!1,v))}}else if(r.name==="cRLDistributionPoints"){r.value=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);for(var u=r.value.value,w=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]),S=k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[]),f,h=0;h<r.altNames.length;++h){f=r.altNames[h];var a=f.value;if(f.type===7&&f.ip){if(a=xt.util.bytesFromIP(f.ip),a===null){var t=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw t.extension=r,t}}else f.type===8&&(f.oid?a=k.oidToDer(k.oidToDer(f.oid)):a=k.oidToDer(a));S.value.push(k.create(k.Class.CONTEXT_SPECIFIC,f.type,!1,a))}w.value.push(k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[S])),u.push(w)}if(typeof r.value>"u"){var t=new Error("Extension value not specified.");throw t.extension=r,t}return r}o(tk,"_fillMissingExtensionFields");function pN(r,e){switch(r){case or["RSASSA-PSS"]:var t=[];return e.hash.algorithmOid!==void 0&&t.push(k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(e.hash.algorithmOid).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")])])),e.mgf.algorithmOid!==void 0&&t.push(k.create(k.Class.CONTEXT_SPECIFIC,1,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(e.mgf.algorithmOid).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(e.mgf.hash.algorithmOid).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")])])])),e.saltLength!==void 0&&t.push(k.create(k.Class.CONTEXT_SPECIFIC,2,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(e.saltLength).getBytes())])),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,t);default:return k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")}}o(pN,"_signatureParametersToAsn1");function tQ(r){var e=k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[]);if(r.attributes.length===0)return e;for(var t=r.attributes,n=0;n<t.length;++n){var s=t[n],i=s.value,a=k.Type.UTF8;"valueTagClass"in s&&(a=s.valueTagClass),a===k.Type.UTF8&&(i=xt.util.encodeUtf8(i));var u=!1;"valueConstructed"in s&&(u=s.valueConstructed);var c=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(s.type).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SET,!0,[k.create(k.Class.UNIVERSAL,a,u,i)])]);e.value.push(c)}return e}o(tQ,"_CRIAttributesToAsn1");var rQ=new Date("1950-01-01T00:00:00Z"),nQ=new Date("2050-01-01T00:00:00Z");function Q3(r){return r>=rQ&&r<nQ?k.create(k.Class.UNIVERSAL,k.Type.UTCTIME,!1,k.dateToUtcTime(r)):k.create(k.Class.UNIVERSAL,k.Type.GENERALIZEDTIME,!1,k.dateToGeneralizedTime(r))}o(Q3,"_dateToAsn1");$e.getTBSCertificate=function(r){var e=Q3(r.validity.notBefore),t=Q3(r.validity.notAfter),n=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(r.version).getBytes())]),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,xt.util.hexToBytes(r.serialNumber)),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(r.siginfo.algorithmOid).getBytes()),pN(r.siginfo.algorithmOid,r.siginfo.parameters)]),pp(r.issuer),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[e,t]),pp(r.subject),$e.publicKeyToAsn1(r.publicKey)]);return r.issuer.uniqueId&&n.value.push(k.create(k.Class.CONTEXT_SPECIFIC,1,!0,[k.create(k.Class.UNIVERSAL,k.Type.BITSTRING,!1,"\0"+r.issuer.uniqueId)])),r.subject.uniqueId&&n.value.push(k.create(k.Class.CONTEXT_SPECIFIC,2,!0,[k.create(k.Class.UNIVERSAL,k.Type.BITSTRING,!1,"\0"+r.subject.uniqueId)])),r.extensions.length>0&&n.value.push($e.certificateExtensionsToAsn1(r.extensions)),n};$e.getCertificationRequestInfo=function(r){var e=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(r.version).getBytes()),pp(r.subject),$e.publicKeyToAsn1(r.publicKey),tQ(r)]);return e};$e.distinguishedNameToAsn1=function(r){return pp(r)};$e.certificateToAsn1=function(r){var e=r.tbsCertificate||$e.getTBSCertificate(r);return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[e,k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(r.signatureOid).getBytes()),pN(r.signatureOid,r.signatureParameters)]),k.create(k.Class.UNIVERSAL,k.Type.BITSTRING,!1,"\0"+r.signature)])};$e.certificateExtensionsToAsn1=function(r){var e=k.create(k.Class.CONTEXT_SPECIFIC,3,!0,[]),t=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);e.value.push(t);for(var n=0;n<r.length;++n)t.value.push($e.certificateExtensionToAsn1(r[n]));return e};$e.certificateExtensionToAsn1=function(r){var e=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[]);e.value.push(k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(r.id).getBytes())),r.critical&&e.value.push(k.create(k.Class.UNIVERSAL,k.Type.BOOLEAN,!1,"\xFF"));var t=r.value;return typeof r.value!="string"&&(t=k.toDer(t).getBytes()),e.value.push(k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,t)),e};$e.certificationRequestToAsn1=function(r){var e=r.certificationRequestInfo||$e.getCertificationRequestInfo(r);return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[e,k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(r.signatureOid).getBytes()),pN(r.signatureOid,r.signatureParameters)]),k.create(k.Class.UNIVERSAL,k.Type.BITSTRING,!1,"\0"+r.signature)])};$e.createCaStore=function(r){var e={certs:{}};e.getIssuer=function(a){var u=t(a.issuer);return u},e.addCertificate=function(a){if(typeof a=="string"&&(a=xt.pki.certificateFromPem(a)),n(a.subject),!e.hasCertificate(a))if(a.subject.hash in e.certs){var u=e.certs[a.subject.hash];xt.util.isArray(u)||(u=[u]),u.push(a),e.certs[a.subject.hash]=u}else e.certs[a.subject.hash]=a},e.hasCertificate=function(a){typeof a=="string"&&(a=xt.pki.certificateFromPem(a));var u=t(a.subject);if(!u)return!1;xt.util.isArray(u)||(u=[u]);for(var c=k.toDer($e.certificateToAsn1(a)).getBytes(),f=0;f<u.length;++f){var h=k.toDer($e.certificateToAsn1(u[f])).getBytes();if(c===h)return!0}return!1},e.listAllCertificates=function(){var a=[];for(var u in e.certs)if(e.certs.hasOwnProperty(u)){var c=e.certs[u];if(!xt.util.isArray(c))a.push(c);else for(var f=0;f<c.length;++f)a.push(c[f])}return a},e.removeCertificate=function(a){var u;if(typeof a=="string"&&(a=xt.pki.certificateFromPem(a)),n(a.subject),!e.hasCertificate(a))return null;var c=t(a.subject);if(!xt.util.isArray(c))return u=e.certs[a.subject.hash],delete e.certs[a.subject.hash],u;for(var f=k.toDer($e.certificateToAsn1(a)).getBytes(),h=0;h<c.length;++h){var m=k.toDer($e.certificateToAsn1(c[h])).getBytes();f===m&&(u=c[h],c.splice(h,1))}return c.length===0&&delete e.certs[a.subject.hash],u};function t(a){return n(a),e.certs[a.hash]||null}o(t,"getBySubject");function n(a){if(!a.hash){var u=xt.md.sha1.create();a.attributes=$e.RDNAttributesAsArray(pp(a),u),a.hash=u.digest().toHex()}}if(o(n,"ensureSubjectHasHash"),r)for(var s=0;s<r.length;++s){var i=r[s];e.addCertificate(i)}return e};$e.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"};$e.verifyCertificateChain=function(r,e,t){typeof t=="function"&&(t={verify:t}),t=t||{},e=e.slice(0);var n=e.slice(0),s=t.validityCheckDate;typeof s>"u"&&(s=new Date);var i=!0,a=null,u=0;do{var c=e.shift(),f=null,h=!1;if(s&&(s<c.validity.notBefore||s>c.validity.notAfter)&&(a={message:"Certificate is not valid yet or has expired.",error:$e.certificateError.certificate_expired,notBefore:c.validity.notBefore,notAfter:c.validity.notAfter,now:s}),a===null){if(f=e[0]||r.getIssuer(c),f===null&&c.isIssuer(c)&&(h=!0,f=c),f){var m=f;xt.util.isArray(m)||(m=[m]);for(var g=!1;!g&&m.length>0;){f=m.shift();try{g=f.verify(c)}catch{}}g||(a={message:"Certificate signature is invalid.",error:$e.certificateError.bad_certificate})}a===null&&(!f||h)&&!r.hasCertificate(c)&&(a={message:"Certificate is not trusted.",error:$e.certificateError.unknown_ca})}if(a===null&&f&&!c.isIssuer(f)&&(a={message:"Certificate issuer is invalid.",error:$e.certificateError.bad_certificate}),a===null)for(var x={keyUsage:!0,basicConstraints:!0},v=0;a===null&&v<c.extensions.length;++v){var w=c.extensions[v];w.critical&&!(w.name in x)&&(a={message:"Certificate has an unsupported critical extension.",error:$e.certificateError.unsupported_certificate})}if(a===null&&(!i||e.length===0&&(!f||h))){var S=c.getExtension("basicConstraints"),A=c.getExtension("keyUsage");if(A!==null&&(!A.keyCertSign||S===null)&&(a={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:$e.certificateError.bad_certificate}),a===null&&S!==null&&!S.cA&&(a={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:$e.certificateError.bad_certificate}),a===null&&A!==null&&"pathLenConstraint"in S){var T=u-1;T>S.pathLenConstraint&&(a={message:"Certificate basicConstraints pathLenConstraint violated.",error:$e.certificateError.bad_certificate})}}var b=a===null?!0:a.error,E=t.verify?t.verify(b,u,n):b;if(E===!0)a=null;else throw b===!0&&(a={message:"The application rejected the certificate.",error:$e.certificateError.bad_certificate}),(E||E===0)&&(typeof E=="object"&&!xt.util.isArray(E)?(E.message&&(a.message=E.message),E.error&&(a.error=E.error)):typeof E=="string"&&(a.error=E)),a;i=!1,++u}while(e.length>0);return!0}});var mN=Z((Nde,sk)=>{"use strict";var Rr=$t();ea();ap();Pu();fN();lN();bi();eg();lp();lr();Pw();var Y=Rr.asn1,Yt=Rr.pki,rg=sk.exports=Rr.pkcs12=Rr.pkcs12||{},nk={name:"ContentInfo",tagClass:Y.Class.UNIVERSAL,type:Y.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:Y.Class.UNIVERSAL,type:Y.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:Y.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},sQ={name:"PFX",tagClass:Y.Class.UNIVERSAL,type:Y.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:Y.Class.UNIVERSAL,type:Y.Type.INTEGER,constructed:!1,capture:"version"},nk,{name:"PFX.macData",tagClass:Y.Class.UNIVERSAL,type:Y.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:Y.Class.UNIVERSAL,type:Y.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:Y.Class.UNIVERSAL,type:Y.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:Y.Class.UNIVERSAL,type:Y.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:Y.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:Y.Class.UNIVERSAL,type:Y.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:Y.Class.UNIVERSAL,type:Y.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:Y.Class.UNIVERSAL,type:Y.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},iQ={name:"SafeBag",tagClass:Y.Class.UNIVERSAL,type:Y.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:Y.Class.UNIVERSAL,type:Y.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:Y.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:Y.Class.UNIVERSAL,type:Y.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},aQ={name:"Attribute",tagClass:Y.Class.UNIVERSAL,type:Y.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:Y.Class.UNIVERSAL,type:Y.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:Y.Class.UNIVERSAL,type:Y.Type.SET,constructed:!0,capture:"values"}]},oQ={name:"CertBag",tagClass:Y.Class.UNIVERSAL,type:Y.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:Y.Class.UNIVERSAL,type:Y.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:Y.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:Y.Class.UNIVERSAL,type:Y.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function tg(r,e,t,n){for(var s=[],i=0;i<r.length;i++)for(var a=0;a<r[i].safeBags.length;a++){var u=r[i].safeBags[a];if(!(n!==void 0&&u.type!==n)){if(e===null){s.push(u);continue}u.attributes[e]!==void 0&&u.attributes[e].indexOf(t)>=0&&s.push(u)}}return s}o(tg,"_getBagsByAttribute");rg.pkcs12FromAsn1=function(r,e,t){typeof e=="string"?(t=e,e=!0):e===void 0&&(e=!0);var n={},s=[];if(!Y.validate(r,sQ,n,s)){var i=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw i.errors=i,i}var a={version:n.version.charCodeAt(0),safeContents:[],getBags:o(function(S){var A={},T;return"localKeyId"in S?T=S.localKeyId:"localKeyIdHex"in S&&(T=Rr.util.hexToBytes(S.localKeyIdHex)),T===void 0&&!("friendlyName"in S)&&"bagType"in S&&(A[S.bagType]=tg(a.safeContents,null,null,S.bagType)),T!==void 0&&(A.localKeyId=tg(a.safeContents,"localKeyId",T,S.bagType)),"friendlyName"in S&&(A.friendlyName=tg(a.safeContents,"friendlyName",S.friendlyName,S.bagType)),A},"getBags"),getBagsByFriendlyName:o(function(S,A){return tg(a.safeContents,"friendlyName",S,A)},"getBagsByFriendlyName"),getBagsByLocalKeyId:o(function(S,A){return tg(a.safeContents,"localKeyId",S,A)},"getBagsByLocalKeyId")};if(n.version.charCodeAt(0)!==3){var i=new Error("PKCS#12 PFX of version other than 3 not supported.");throw i.version=n.version.charCodeAt(0),i}if(Y.derToOid(n.contentType)!==Yt.oids.data){var i=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw i.oid=Y.derToOid(n.contentType),i}var u=n.content.value[0];if(u.tagClass!==Y.Class.UNIVERSAL||u.type!==Y.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(u=dN(u),n.mac){var c=null,f=0,h=Y.derToOid(n.macAlgorithm);switch(h){case Yt.oids.sha1:c=Rr.md.sha1.create(),f=20;break;case Yt.oids.sha256:c=Rr.md.sha256.create(),f=32;break;case Yt.oids.sha384:c=Rr.md.sha384.create(),f=48;break;case Yt.oids.sha512:c=Rr.md.sha512.create(),f=64;break;case Yt.oids.md5:c=Rr.md.md5.create(),f=16;break}if(c===null)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+h);var m=new Rr.util.ByteBuffer(n.macSalt),g="macIterations"in n?parseInt(Rr.util.bytesToHex(n.macIterations),16):1,x=rg.generateKey(t,m,3,g,f,c),v=Rr.hmac.create();v.start(c,x),v.update(u.value);var w=v.getMac();if(w.getBytes()!==n.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}return uQ(a,u.value,e,t),a};function dN(r){if(r.composed||r.constructed){for(var e=Rr.util.createBuffer(),t=0;t<r.value.length;++t)e.putBytes(r.value[t].value);r.composed=r.constructed=!1,r.value=e.getBytes()}return r}o(dN,"_decodePkcs7Data");function uQ(r,e,t,n){if(e=Y.fromDer(e,t),e.tagClass!==Y.Class.UNIVERSAL||e.type!==Y.Type.SEQUENCE||e.constructed!==!0)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var s=0;s<e.value.length;s++){var i=e.value[s],a={},u=[];if(!Y.validate(i,nk,a,u)){var c=new Error("Cannot read ContentInfo.");throw c.errors=u,c}var f={encrypted:!1},h=null,m=a.content.value[0];switch(Y.derToOid(a.contentType)){case Yt.oids.data:if(m.tagClass!==Y.Class.UNIVERSAL||m.type!==Y.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");h=dN(m).value;break;case Yt.oids.encryptedData:h=cQ(m,n),f.encrypted=!0;break;default:var c=new Error("Unsupported PKCS#12 contentType.");throw c.contentType=Y.derToOid(a.contentType),c}f.safeBags=lQ(h,t,n),r.safeContents.push(f)}}o(uQ,"_decodeAuthenticatedSafe");function cQ(r,e){var t={},n=[];if(!Y.validate(r,Rr.pkcs7.asn1.encryptedDataValidator,t,n)){var s=new Error("Cannot read EncryptedContentInfo.");throw s.errors=n,s}var i=Y.derToOid(t.contentType);if(i!==Yt.oids.data){var s=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw s.oid=i,s}i=Y.derToOid(t.encAlgorithm);var a=Yt.pbe.getCipher(i,t.encParameter,e),u=dN(t.encryptedContentAsn1),c=Rr.util.createBuffer(u.value);if(a.update(c),!a.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return a.output.getBytes()}o(cQ,"_decryptSafeContents");function lQ(r,e,t){if(!e&&r.length===0)return[];if(r=Y.fromDer(r,e),r.tagClass!==Y.Class.UNIVERSAL||r.type!==Y.Type.SEQUENCE||r.constructed!==!0)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var n=[],s=0;s<r.value.length;s++){var i=r.value[s],a={},u=[];if(!Y.validate(i,iQ,a,u)){var c=new Error("Cannot read SafeBag.");throw c.errors=u,c}var f={type:Y.derToOid(a.bagId),attributes:fQ(a.bagAttributes)};n.push(f);var h,m,g=a.bagValue.value[0];switch(f.type){case Yt.oids.pkcs8ShroudedKeyBag:if(g=Yt.decryptPrivateKeyInfo(g,t),g===null)throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case Yt.oids.keyBag:try{f.key=Yt.privateKeyFromAsn1(g)}catch{f.key=null,f.asn1=g}continue;case Yt.oids.certBag:h=oQ,m=o(function(){if(Y.derToOid(a.certId)!==Yt.oids.x509Certificate){var v=new Error("Unsupported certificate type, only X.509 supported.");throw v.oid=Y.derToOid(a.certId),v}var w=Y.fromDer(a.cert,e);try{f.cert=Yt.certificateFromAsn1(w,!0)}catch{f.cert=null,f.asn1=w}},"decoder");break;default:var c=new Error("Unsupported PKCS#12 SafeBag type.");throw c.oid=f.type,c}if(h!==void 0&&!Y.validate(g,h,a,u)){var c=new Error("Cannot read PKCS#12 "+h.name);throw c.errors=u,c}m()}return n}o(lQ,"_decodeSafeContents");function fQ(r){var e={};if(r!==void 0)for(var t=0;t<r.length;++t){var n={},s=[];if(!Y.validate(r[t],aQ,n,s)){var i=new Error("Cannot read PKCS#12 BagAttribute.");throw i.errors=s,i}var a=Y.derToOid(n.oid);if(Yt.oids[a]!==void 0){e[Yt.oids[a]]=[];for(var u=0;u<n.values.length;++u)e[Yt.oids[a]].push(n.values[u].value)}}return e}o(fQ,"_decodeBagAttributes");rg.toPkcs12Asn1=function(r,e,t,n){n=n||{},n.saltSize=n.saltSize||8,n.count=n.count||2048,n.algorithm=n.algorithm||n.encAlgorithm||"aes128","useMac"in n||(n.useMac=!0),"localKeyId"in n||(n.localKeyId=null),"generateLocalKeyId"in n||(n.generateLocalKeyId=!0);var s=n.localKeyId,i;if(s!==null)s=Rr.util.hexToBytes(s);else if(n.generateLocalKeyId)if(e){var a=Rr.util.isArray(e)?e[0]:e;typeof a=="string"&&(a=Yt.certificateFromPem(a));var u=Rr.md.sha1.create();u.update(Y.toDer(Yt.certificateToAsn1(a)).getBytes()),s=u.digest().getBytes()}else s=Rr.random.getBytes(20);var c=[];s!==null&&c.push(Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OID,!1,Y.oidToDer(Yt.oids.localKeyId).getBytes()),Y.create(Y.Class.UNIVERSAL,Y.Type.SET,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OCTETSTRING,!1,s)])])),"friendlyName"in n&&c.push(Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OID,!1,Y.oidToDer(Yt.oids.friendlyName).getBytes()),Y.create(Y.Class.UNIVERSAL,Y.Type.SET,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.BMPSTRING,!1,n.friendlyName)])])),c.length>0&&(i=Y.create(Y.Class.UNIVERSAL,Y.Type.SET,!0,c));var f=[],h=[];e!==null&&(Rr.util.isArray(e)?h=e:h=[e]);for(var m=[],g=0;g<h.length;++g){e=h[g],typeof e=="string"&&(e=Yt.certificateFromPem(e));var x=g===0?i:void 0,v=Yt.certificateToAsn1(e),w=Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OID,!1,Y.oidToDer(Yt.oids.certBag).getBytes()),Y.create(Y.Class.CONTEXT_SPECIFIC,0,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OID,!1,Y.oidToDer(Yt.oids.x509Certificate).getBytes()),Y.create(Y.Class.CONTEXT_SPECIFIC,0,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OCTETSTRING,!1,Y.toDer(v).getBytes())])])]),x]);m.push(w)}if(m.length>0){var S=Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,m),A=Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OID,!1,Y.oidToDer(Yt.oids.data).getBytes()),Y.create(Y.Class.CONTEXT_SPECIFIC,0,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OCTETSTRING,!1,Y.toDer(S).getBytes())])]);f.push(A)}var T=null;if(r!==null){var b=Yt.wrapRsaPrivateKey(Yt.privateKeyToAsn1(r));t===null?T=Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OID,!1,Y.oidToDer(Yt.oids.keyBag).getBytes()),Y.create(Y.Class.CONTEXT_SPECIFIC,0,!0,[b]),i]):T=Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OID,!1,Y.oidToDer(Yt.oids.pkcs8ShroudedKeyBag).getBytes()),Y.create(Y.Class.CONTEXT_SPECIFIC,0,!0,[Yt.encryptPrivateKeyInfo(b,t,n)]),i]);var E=Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[T]),C=Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OID,!1,Y.oidToDer(Yt.oids.data).getBytes()),Y.create(Y.Class.CONTEXT_SPECIFIC,0,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OCTETSTRING,!1,Y.toDer(E).getBytes())])]);f.push(C)}var _=Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,f),F;if(n.useMac){var u=Rr.md.sha1.create(),R=new Rr.util.ByteBuffer(Rr.random.getBytes(n.saltSize)),q=n.count,r=rg.generateKey(t,R,3,q,20),H=Rr.hmac.create();H.start(u,r),H.update(Y.toDer(_).getBytes());var K=H.getMac();F=Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OID,!1,Y.oidToDer(Yt.oids.sha1).getBytes()),Y.create(Y.Class.UNIVERSAL,Y.Type.NULL,!1,"")]),Y.create(Y.Class.UNIVERSAL,Y.Type.OCTETSTRING,!1,K.getBytes())]),Y.create(Y.Class.UNIVERSAL,Y.Type.OCTETSTRING,!1,R.getBytes()),Y.create(Y.Class.UNIVERSAL,Y.Type.INTEGER,!1,Y.integerToDer(q).getBytes())])}return Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.INTEGER,!1,Y.integerToDer(3).getBytes()),Y.create(Y.Class.UNIVERSAL,Y.Type.SEQUENCE,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OID,!1,Y.oidToDer(Yt.oids.data).getBytes()),Y.create(Y.Class.CONTEXT_SPECIFIC,0,!0,[Y.create(Y.Class.UNIVERSAL,Y.Type.OCTETSTRING,!1,Y.toDer(_).getBytes())])]),F])};rg.generateKey=Rr.pbe.generatePkcs12Key});var vN=Z((Ide,ik)=>{"use strict";var Vu=$t();ea();Pu();lN();_l();Ew();mN();Bw();eg();lr();Pw();var gN=Vu.asn1,dp=ik.exports=Vu.pki=Vu.pki||{};dp.pemToDer=function(r){var e=Vu.pem.decode(r)[0];if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert PEM to DER; PEM is encrypted.");return Vu.util.createBuffer(e.body)};dp.privateKeyFromPem=function(r){var e=Vu.pem.decode(r)[0];if(e.type!=="PRIVATE KEY"&&e.type!=="RSA PRIVATE KEY"){var t=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw t.headerType=e.type,t}if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert private key from PEM; PEM is encrypted.");var n=gN.fromDer(e.body);return dp.privateKeyFromAsn1(n)};dp.privateKeyToPem=function(r,e){var t={type:"RSA PRIVATE KEY",body:gN.toDer(dp.privateKeyToAsn1(r)).getBytes()};return Vu.pem.encode(t,{maxline:e})};dp.privateKeyInfoToPem=function(r,e){var t={type:"PRIVATE KEY",body:gN.toDer(r).getBytes()};return Vu.pem.encode(t,{maxline:e})}});var EN=Z((_de,pk)=>{"use strict";var ke=$t();ea();ap();xw();_l();vN();bi();lp();lr();var Vw=o(function(r,e,t,n){var s=ke.util.createBuffer(),i=r.length>>1,a=i+(r.length&1),u=r.substr(0,a),c=r.substr(i,a),f=ke.util.createBuffer(),h=ke.hmac.create();t=e+t;var m=Math.ceil(n/16),g=Math.ceil(n/20);h.start("MD5",u);var x=ke.util.createBuffer();f.putBytes(t);for(var v=0;v<m;++v)h.start(null,null),h.update(f.getBytes()),f.putBuffer(h.digest()),h.start(null,null),h.update(f.bytes()+t),x.putBuffer(h.digest());h.start("SHA1",c);var w=ke.util.createBuffer();f.clear(),f.putBytes(t);for(var v=0;v<g;++v)h.start(null,null),h.update(f.getBytes()),f.putBuffer(h.digest()),h.start(null,null),h.update(f.bytes()+t),w.putBuffer(h.digest());return s.putBytes(ke.util.xorBytes(x.getBytes(),w.getBytes(),n)),s},"prf_TLS1"),hQ=o(function(r,e,t){var n=ke.hmac.create();n.start("SHA1",r);var s=ke.util.createBuffer();return s.putInt32(e[0]),s.putInt32(e[1]),s.putByte(t.type),s.putByte(t.version.major),s.putByte(t.version.minor),s.putInt16(t.length),s.putBytes(t.fragment.bytes()),n.update(s.getBytes()),n.digest().getBytes()},"hmac_sha1"),pQ=o(function(r,e,t){var n=!1;try{var s=r.deflate(e.fragment.getBytes());e.fragment=ke.util.createBuffer(s),e.length=s.length,n=!0}catch{}return n},"deflate"),dQ=o(function(r,e,t){var n=!1;try{var s=r.inflate(e.fragment.getBytes());e.fragment=ke.util.createBuffer(s),e.length=s.length,n=!0}catch{}return n},"inflate"),ni=o(function(r,e){var t=0;switch(e){case 1:t=r.getByte();break;case 2:t=r.getInt16();break;case 3:t=r.getInt24();break;case 4:t=r.getInt32();break}return ke.util.createBuffer(r.getBytes(t))},"readVector"),Ni=o(function(r,e,t){r.putInt(t.length(),e<<3),r.putBuffer(t)},"writeVector"),U={};U.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}};U.SupportedVersions=[U.Versions.TLS_1_1,U.Versions.TLS_1_0];U.Version=U.SupportedVersions[0];U.MaxFragment=15360;U.ConnectionEnd={server:0,client:1};U.PRFAlgorithm={tls_prf_sha256:0};U.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2};U.CipherType={stream:0,block:1,aead:2};U.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4};U.CompressionMethod={none:0,deflate:1};U.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24};U.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};U.Alert={};U.Alert.Level={warning:1,fatal:2};U.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};U.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2};U.CipherSuites={};U.getCipherSuite=function(r){var e=null;for(var t in U.CipherSuites){var n=U.CipherSuites[t];if(n.id[0]===r.charCodeAt(0)&&n.id[1]===r.charCodeAt(1)){e=n;break}}return e};U.handleUnexpected=function(r,e){var t=!r.open&&r.entity===U.ConnectionEnd.client;t||r.error(r,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.unexpected_message}})};U.handleHelloRequest=function(r,e,t){!r.handshaking&&r.handshakes>0&&(U.queue(r,U.createAlert(r,{level:U.Alert.Level.warning,description:U.Alert.Description.no_renegotiation})),U.flush(r)),r.process()};U.parseHelloMessage=function(r,e,t){var n=null,s=r.entity===U.ConnectionEnd.client;if(t<38)r.error(r,{message:s?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.illegal_parameter}});else{var i=e.fragment,a=i.length();if(n={version:{major:i.getByte(),minor:i.getByte()},random:ke.util.createBuffer(i.getBytes(32)),session_id:ni(i,1),extensions:[]},s?(n.cipher_suite=i.getBytes(2),n.compression_method=i.getByte()):(n.cipher_suites=ni(i,2),n.compression_methods=ni(i,1)),a=t-(a-i.length()),a>0){for(var u=ni(i,2);u.length()>0;)n.extensions.push({type:[u.getByte(),u.getByte()],data:ni(u,2)});if(!s)for(var c=0;c<n.extensions.length;++c){var f=n.extensions[c];if(f.type[0]===0&&f.type[1]===0)for(var h=ni(f.data,2);h.length()>0;){var m=h.getByte();if(m!==0)break;r.session.extensions.server_name.serverNameList.push(ni(h,2).getBytes())}}}if(r.session.version&&(n.version.major!==r.session.version.major||n.version.minor!==r.session.version.minor))return r.error(r,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.protocol_version}});if(s)r.session.cipherSuite=U.getCipherSuite(n.cipher_suite);else for(var g=ke.util.createBuffer(n.cipher_suites.bytes());g.length()>0&&(r.session.cipherSuite=U.getCipherSuite(g.getBytes(2)),r.session.cipherSuite===null););if(r.session.cipherSuite===null)return r.error(r,{message:"No cipher suites in common.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.handshake_failure},cipherSuite:ke.util.bytesToHex(n.cipher_suite)});s?r.session.compressionMethod=n.compression_method:r.session.compressionMethod=U.CompressionMethod.none}return n};U.createSecurityParameters=function(r,e){var t=r.entity===U.ConnectionEnd.client,n=e.random.bytes(),s=t?r.session.sp.client_random:n,i=t?n:U.createRandom().getBytes();r.session.sp={entity:r.entity,prf_algorithm:U.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:r.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:s,server_random:i}};U.handleServerHello=function(r,e,t){var n=U.parseHelloMessage(r,e,t);if(!r.fail){if(n.version.minor<=r.version.minor)r.version.minor=n.version.minor;else return r.error(r,{message:"Incompatible TLS version.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.protocol_version}});r.session.version=r.version;var s=n.session_id.bytes();s.length>0&&s===r.session.id?(r.expect=uk,r.session.resuming=!0,r.session.sp.server_random=n.random.bytes()):(r.expect=gQ,r.session.resuming=!1,U.createSecurityParameters(r,n)),r.session.id=s,r.process()}};U.handleClientHello=function(r,e,t){var n=U.parseHelloMessage(r,e,t);if(!r.fail){var s=n.session_id.bytes(),i=null;if(r.sessionCache&&(i=r.sessionCache.getSession(s),i===null?s="":(i.version.major!==n.version.major||i.version.minor>n.version.minor)&&(i=null,s="")),s.length===0&&(s=ke.random.getBytes(32)),r.session.id=s,r.session.clientHelloVersion=n.version,r.session.sp={},i)r.version=r.session.version=i.version,r.session.sp=i.sp;else{for(var a,u=1;u<U.SupportedVersions.length&&(a=U.SupportedVersions[u],!(a.minor<=n.version.minor));++u);r.version={major:a.major,minor:a.minor},r.session.version=r.version}i!==null?(r.expect=SN,r.session.resuming=!0,r.session.sp.client_random=n.random.bytes()):(r.expect=r.verifyClient!==!1?EQ:wN,r.session.resuming=!1,U.createSecurityParameters(r,n)),r.open=!0,U.queue(r,U.createRecord(r,{type:U.ContentType.handshake,data:U.createServerHello(r)})),r.session.resuming?(U.queue(r,U.createRecord(r,{type:U.ContentType.change_cipher_spec,data:U.createChangeCipherSpec()})),r.state.pending=U.createConnectionState(r),r.state.current.write=r.state.pending.write,U.queue(r,U.createRecord(r,{type:U.ContentType.handshake,data:U.createFinished(r)}))):(U.queue(r,U.createRecord(r,{type:U.ContentType.handshake,data:U.createCertificate(r)})),r.fail||(U.queue(r,U.createRecord(r,{type:U.ContentType.handshake,data:U.createServerKeyExchange(r)})),r.verifyClient!==!1&&U.queue(r,U.createRecord(r,{type:U.ContentType.handshake,data:U.createCertificateRequest(r)})),U.queue(r,U.createRecord(r,{type:U.ContentType.handshake,data:U.createServerHelloDone(r)})))),U.flush(r),r.process()}};U.handleCertificate=function(r,e,t){if(t<3)return r.error(r,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.illegal_parameter}});var n=e.fragment,s={certificate_list:ni(n,3)},i,a,u=[];try{for(;s.certificate_list.length()>0;)i=ni(s.certificate_list,3),a=ke.asn1.fromDer(i),i=ke.pki.certificateFromAsn1(a,!0),u.push(i)}catch(f){return r.error(r,{message:"Could not parse certificate list.",cause:f,send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.bad_certificate}})}var c=r.entity===U.ConnectionEnd.client;(c||r.verifyClient===!0)&&u.length===0?r.error(r,{message:c?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.illegal_parameter}}):u.length===0?r.expect=c?ak:wN:(c?r.session.serverCertificate=u[0]:r.session.clientCertificate=u[0],U.verifyCertificateChain(r,u)&&(r.expect=c?ak:wN)),r.process()};U.handleServerKeyExchange=function(r,e,t){if(t>0)return r.error(r,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.unsupported_certificate}});r.expect=vQ,r.process()};U.handleClientKeyExchange=function(r,e,t){if(t<48)return r.error(r,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.unsupported_certificate}});var n=e.fragment,s={enc_pre_master_secret:ni(n,2).getBytes()},i=null;if(r.getPrivateKey)try{i=r.getPrivateKey(r,r.session.serverCertificate),i=ke.pki.privateKeyFromPem(i)}catch(c){r.error(r,{message:"Could not get private key.",cause:c,send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.internal_error}})}if(i===null)return r.error(r,{message:"No private key set.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.internal_error}});try{var a=r.session.sp;a.pre_master_secret=i.decrypt(s.enc_pre_master_secret);var u=r.session.clientHelloVersion;if(u.major!==a.pre_master_secret.charCodeAt(0)||u.minor!==a.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch{a.pre_master_secret=ke.random.getBytes(48)}r.expect=SN,r.session.clientCertificate!==null&&(r.expect=AQ),r.process()};U.handleCertificateRequest=function(r,e,t){if(t<3)return r.error(r,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.illegal_parameter}});var n=e.fragment,s={certificate_types:ni(n,1),certificate_authorities:ni(n,2)};r.session.certificateRequest=s,r.expect=yQ,r.process()};U.handleCertificateVerify=function(r,e,t){if(t<2)return r.error(r,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.illegal_parameter}});var n=e.fragment;n.read-=4;var s=n.bytes();n.read+=4;var i={signature:ni(n,2).getBytes()},a=ke.util.createBuffer();a.putBuffer(r.session.md5.digest()),a.putBuffer(r.session.sha1.digest()),a=a.getBytes();try{var u=r.session.clientCertificate;if(!u.publicKey.verify(a,i.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");r.session.md5.update(s),r.session.sha1.update(s)}catch{return r.error(r,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.handshake_failure}})}r.expect=SN,r.process()};U.handleServerHelloDone=function(r,e,t){if(t>0)return r.error(r,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.record_overflow}});if(r.serverCertificate===null){var n={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.insufficient_security}},s=0,i=r.verify(r,n.alert.description,s,[]);if(i!==!0)return(i||i===0)&&(typeof i=="object"&&!ke.util.isArray(i)?(i.message&&(n.message=i.message),i.alert&&(n.alert.description=i.alert)):typeof i=="number"&&(n.alert.description=i)),r.error(r,n)}r.session.certificateRequest!==null&&(e=U.createRecord(r,{type:U.ContentType.handshake,data:U.createCertificate(r)}),U.queue(r,e)),e=U.createRecord(r,{type:U.ContentType.handshake,data:U.createClientKeyExchange(r)}),U.queue(r,e),r.expect=SQ;var a=o(function(u,c){u.session.certificateRequest!==null&&u.session.clientCertificate!==null&&U.queue(u,U.createRecord(u,{type:U.ContentType.handshake,data:U.createCertificateVerify(u,c)})),U.queue(u,U.createRecord(u,{type:U.ContentType.change_cipher_spec,data:U.createChangeCipherSpec()})),u.state.pending=U.createConnectionState(u),u.state.current.write=u.state.pending.write,U.queue(u,U.createRecord(u,{type:U.ContentType.handshake,data:U.createFinished(u)})),u.expect=uk,U.flush(u),u.process()},"callback");if(r.session.certificateRequest===null||r.session.clientCertificate===null)return a(r,null);U.getClientSignature(r,a)};U.handleChangeCipherSpec=function(r,e){if(e.fragment.getByte()!==1)return r.error(r,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.illegal_parameter}});var t=r.entity===U.ConnectionEnd.client;(r.session.resuming&&t||!r.session.resuming&&!t)&&(r.state.pending=U.createConnectionState(r)),r.state.current.read=r.state.pending.read,(!r.session.resuming&&t||r.session.resuming&&!t)&&(r.state.pending=null),r.expect=t?xQ:CQ,r.process()};U.handleFinished=function(r,e,t){var n=e.fragment;n.read-=4;var s=n.bytes();n.read+=4;var i=e.fragment.getBytes();n=ke.util.createBuffer(),n.putBuffer(r.session.md5.digest()),n.putBuffer(r.session.sha1.digest());var a=r.entity===U.ConnectionEnd.client,u=a?"server finished":"client finished",c=r.session.sp,f=12,h=Vw;if(n=h(c.master_secret,u,n.getBytes(),f),n.getBytes()!==i)return r.error(r,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.decrypt_error}});r.session.md5.update(s),r.session.sha1.update(s),(r.session.resuming&&a||!r.session.resuming&&!a)&&(U.queue(r,U.createRecord(r,{type:U.ContentType.change_cipher_spec,data:U.createChangeCipherSpec()})),r.state.current.write=r.state.pending.write,r.state.pending=null,U.queue(r,U.createRecord(r,{type:U.ContentType.handshake,data:U.createFinished(r)}))),r.expect=a?wQ:NQ,r.handshaking=!1,++r.handshakes,r.peerCertificate=a?r.session.serverCertificate:r.session.clientCertificate,U.flush(r),r.isConnected=!0,r.connected(r),r.process()};U.handleAlert=function(r,e){var t=e.fragment,n={level:t.getByte(),description:t.getByte()},s;switch(n.description){case U.Alert.Description.close_notify:s="Connection closed.";break;case U.Alert.Description.unexpected_message:s="Unexpected message.";break;case U.Alert.Description.bad_record_mac:s="Bad record MAC.";break;case U.Alert.Description.decryption_failed:s="Decryption failed.";break;case U.Alert.Description.record_overflow:s="Record overflow.";break;case U.Alert.Description.decompression_failure:s="Decompression failed.";break;case U.Alert.Description.handshake_failure:s="Handshake failure.";break;case U.Alert.Description.bad_certificate:s="Bad certificate.";break;case U.Alert.Description.unsupported_certificate:s="Unsupported certificate.";break;case U.Alert.Description.certificate_revoked:s="Certificate revoked.";break;case U.Alert.Description.certificate_expired:s="Certificate expired.";break;case U.Alert.Description.certificate_unknown:s="Certificate unknown.";break;case U.Alert.Description.illegal_parameter:s="Illegal parameter.";break;case U.Alert.Description.unknown_ca:s="Unknown certificate authority.";break;case U.Alert.Description.access_denied:s="Access denied.";break;case U.Alert.Description.decode_error:s="Decode error.";break;case U.Alert.Description.decrypt_error:s="Decrypt error.";break;case U.Alert.Description.export_restriction:s="Export restriction.";break;case U.Alert.Description.protocol_version:s="Unsupported protocol version.";break;case U.Alert.Description.insufficient_security:s="Insufficient security.";break;case U.Alert.Description.internal_error:s="Internal error.";break;case U.Alert.Description.user_canceled:s="User canceled.";break;case U.Alert.Description.no_renegotiation:s="Renegotiation not supported.";break;default:s="Unknown error.";break}if(n.description===U.Alert.Description.close_notify)return r.close();r.error(r,{message:s,send:!1,origin:r.entity===U.ConnectionEnd.client?"server":"client",alert:n}),r.process()};U.handleHandshake=function(r,e){var t=e.fragment,n=t.getByte(),s=t.getInt24();if(s>t.length())return r.fragmented=e,e.fragment=ke.util.createBuffer(),t.read-=4,r.process();r.fragmented=null,t.read-=4;var i=t.bytes(s+4);t.read+=4,n in Lw[r.entity][r.expect]?(r.entity===U.ConnectionEnd.server&&!r.open&&!r.fail&&(r.handshaking=!0,r.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:ke.md.md5.create(),sha1:ke.md.sha1.create()}),n!==U.HandshakeType.hello_request&&n!==U.HandshakeType.certificate_verify&&n!==U.HandshakeType.finished&&(r.session.md5.update(i),r.session.sha1.update(i)),Lw[r.entity][r.expect][n](r,e,s)):U.handleUnexpected(r,e)};U.handleApplicationData=function(r,e){r.data.putBuffer(e.fragment),r.dataReady(r),r.process()};U.handleHeartbeat=function(r,e){var t=e.fragment,n=t.getByte(),s=t.getInt16(),i=t.getBytes(s);if(n===U.HeartbeatMessageType.heartbeat_request){if(r.handshaking||s>i.length)return r.process();U.queue(r,U.createRecord(r,{type:U.ContentType.heartbeat,data:U.createHeartbeat(U.HeartbeatMessageType.heartbeat_response,i)})),U.flush(r)}else if(n===U.HeartbeatMessageType.heartbeat_response){if(i!==r.expectedHeartbeatPayload)return r.process();r.heartbeatReceived&&r.heartbeatReceived(r,ke.util.createBuffer(i))}r.process()};var mQ=0,gQ=1,ak=2,vQ=3,yQ=4,uk=5,xQ=6,wQ=7,SQ=8,bQ=0,EQ=1,wN=2,AQ=3,SN=4,CQ=5,NQ=6,V=U.handleUnexpected,ck=U.handleChangeCipherSpec,qn=U.handleAlert,ys=U.handleHandshake,lk=U.handleApplicationData,Hn=U.handleHeartbeat,bN=[];bN[U.ConnectionEnd.client]=[[V,qn,ys,V,Hn],[V,qn,ys,V,Hn],[V,qn,ys,V,Hn],[V,qn,ys,V,Hn],[V,qn,ys,V,Hn],[ck,qn,V,V,Hn],[V,qn,ys,V,Hn],[V,qn,ys,lk,Hn],[V,qn,ys,V,Hn]];bN[U.ConnectionEnd.server]=[[V,qn,ys,V,Hn],[V,qn,ys,V,Hn],[V,qn,ys,V,Hn],[V,qn,ys,V,Hn],[ck,qn,V,V,Hn],[V,qn,ys,V,Hn],[V,qn,ys,lk,Hn],[V,qn,ys,V,Hn]];var Uu=U.handleHelloRequest,TQ=U.handleServerHello,fk=U.handleCertificate,ok=U.handleServerKeyExchange,yN=U.handleCertificateRequest,Ow=U.handleServerHelloDone,hk=U.handleFinished,Lw=[];Lw[U.ConnectionEnd.client]=[[V,V,TQ,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V],[Uu,V,V,V,V,V,V,V,V,V,V,fk,ok,yN,Ow,V,V,V,V,V,V],[Uu,V,V,V,V,V,V,V,V,V,V,V,ok,yN,Ow,V,V,V,V,V,V],[Uu,V,V,V,V,V,V,V,V,V,V,V,V,yN,Ow,V,V,V,V,V,V],[Uu,V,V,V,V,V,V,V,V,V,V,V,V,V,Ow,V,V,V,V,V,V],[Uu,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V],[Uu,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,hk],[Uu,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V],[Uu,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V]];var IQ=U.handleClientHello,_Q=U.handleClientKeyExchange,BQ=U.handleCertificateVerify;Lw[U.ConnectionEnd.server]=[[V,IQ,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V],[V,V,V,V,V,V,V,V,V,V,V,fk,V,V,V,V,V,V,V,V,V],[V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,_Q,V,V,V,V],[V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,BQ,V,V,V,V,V],[V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V],[V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,hk],[V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V],[V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V,V]];U.generateKeys=function(r,e){var t=Vw,n=e.client_random+e.server_random;r.session.resuming||(e.master_secret=t(e.pre_master_secret,"master secret",n,48).bytes(),e.pre_master_secret=null),n=e.server_random+e.client_random;var s=2*e.mac_key_length+2*e.enc_key_length,i=r.version.major===U.Versions.TLS_1_0.major&&r.version.minor===U.Versions.TLS_1_0.minor;i&&(s+=2*e.fixed_iv_length);var a=t(e.master_secret,"key expansion",n,s),u={client_write_MAC_key:a.getBytes(e.mac_key_length),server_write_MAC_key:a.getBytes(e.mac_key_length),client_write_key:a.getBytes(e.enc_key_length),server_write_key:a.getBytes(e.enc_key_length)};return i&&(u.client_write_IV=a.getBytes(e.fixed_iv_length),u.server_write_IV=a.getBytes(e.fixed_iv_length)),u};U.createConnectionState=function(r){var e=r.entity===U.ConnectionEnd.client,t=o(function(){var i={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:o(function(a){return!0},"cipherFunction"),compressionState:null,compressFunction:o(function(a){return!0},"compressFunction"),updateSequenceNumber:o(function(){i.sequenceNumber[1]===4294967295?(i.sequenceNumber[1]=0,++i.sequenceNumber[0]):++i.sequenceNumber[1]},"updateSequenceNumber")};return i},"createMode"),n={read:t(),write:t()};if(n.read.update=function(i,a){return n.read.cipherFunction(a,n.read)?n.read.compressFunction(i,a,n.read)||i.error(i,{message:"Could not decompress record.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.decompression_failure}}):i.error(i,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.bad_record_mac}}),!i.fail},n.write.update=function(i,a){return n.write.compressFunction(i,a,n.write)?n.write.cipherFunction(a,n.write)||i.error(i,{message:"Could not encrypt record.",send:!1,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.internal_error}}):i.error(i,{message:"Could not compress record.",send:!1,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.internal_error}}),!i.fail},r.session){var s=r.session.sp;switch(r.session.cipherSuite.initSecurityParameters(s),s.keys=U.generateKeys(r,s),n.read.macKey=e?s.keys.server_write_MAC_key:s.keys.client_write_MAC_key,n.write.macKey=e?s.keys.client_write_MAC_key:s.keys.server_write_MAC_key,r.session.cipherSuite.initConnectionState(n,r,s),s.compression_algorithm){case U.CompressionMethod.none:break;case U.CompressionMethod.deflate:n.read.compressFunction=dQ,n.write.compressFunction=pQ;break;default:throw new Error("Unsupported compression algorithm.")}}return n};U.createRandom=function(){var r=new Date,e=+r+r.getTimezoneOffset()*6e4,t=ke.util.createBuffer();return t.putInt32(e),t.putBytes(ke.random.getBytes(28)),t};U.createRecord=function(r,e){if(!e.data)return null;var t={type:e.type,version:{major:r.version.major,minor:r.version.minor},length:e.data.length(),fragment:e.data};return t};U.createAlert=function(r,e){var t=ke.util.createBuffer();return t.putByte(e.level),t.putByte(e.description),U.createRecord(r,{type:U.ContentType.alert,data:t})};U.createClientHello=function(r){r.session.clientHelloVersion={major:r.version.major,minor:r.version.minor};for(var e=ke.util.createBuffer(),t=0;t<r.cipherSuites.length;++t){var n=r.cipherSuites[t];e.putByte(n.id[0]),e.putByte(n.id[1])}var s=e.length(),i=ke.util.createBuffer();i.putByte(U.CompressionMethod.none);var a=i.length(),u=ke.util.createBuffer();if(r.virtualHost){var c=ke.util.createBuffer();c.putByte(0),c.putByte(0);var f=ke.util.createBuffer();f.putByte(0),Ni(f,2,ke.util.createBuffer(r.virtualHost));var h=ke.util.createBuffer();Ni(h,2,f),Ni(c,2,h),u.putBuffer(c)}var m=u.length();m>0&&(m+=2);var g=r.session.id,x=g.length+1+2+4+28+2+s+1+a+m,v=ke.util.createBuffer();return v.putByte(U.HandshakeType.client_hello),v.putInt24(x),v.putByte(r.version.major),v.putByte(r.version.minor),v.putBytes(r.session.sp.client_random),Ni(v,1,ke.util.createBuffer(g)),Ni(v,2,e),Ni(v,1,i),m>0&&Ni(v,2,u),v};U.createServerHello=function(r){var e=r.session.id,t=e.length+1+2+4+28+2+1,n=ke.util.createBuffer();return n.putByte(U.HandshakeType.server_hello),n.putInt24(t),n.putByte(r.version.major),n.putByte(r.version.minor),n.putBytes(r.session.sp.server_random),Ni(n,1,ke.util.createBuffer(e)),n.putByte(r.session.cipherSuite.id[0]),n.putByte(r.session.cipherSuite.id[1]),n.putByte(r.session.compressionMethod),n};U.createCertificate=function(r){var e=r.entity===U.ConnectionEnd.client,t=null;if(r.getCertificate){var n;e?n=r.session.certificateRequest:n=r.session.extensions.server_name.serverNameList,t=r.getCertificate(r,n)}var s=ke.util.createBuffer();if(t!==null)try{ke.util.isArray(t)||(t=[t]);for(var i=null,a=0;a<t.length;++a){var u=ke.pem.decode(t[a])[0];if(u.type!=="CERTIFICATE"&&u.type!=="X509 CERTIFICATE"&&u.type!=="TRUSTED CERTIFICATE"){var c=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw c.headerType=u.type,c}if(u.procType&&u.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var f=ke.util.createBuffer(u.body);i===null&&(i=ke.asn1.fromDer(f.bytes(),!1));var h=ke.util.createBuffer();Ni(h,3,f),s.putBuffer(h)}t=ke.pki.certificateFromAsn1(i),e?r.session.clientCertificate=t:r.session.serverCertificate=t}catch(x){return r.error(r,{message:"Could not send certificate list.",cause:x,send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.bad_certificate}})}var m=3+s.length(),g=ke.util.createBuffer();return g.putByte(U.HandshakeType.certificate),g.putInt24(m),Ni(g,3,s),g};U.createClientKeyExchange=function(r){var e=ke.util.createBuffer();e.putByte(r.session.clientHelloVersion.major),e.putByte(r.session.clientHelloVersion.minor),e.putBytes(ke.random.getBytes(46));var t=r.session.sp;t.pre_master_secret=e.getBytes();var n=r.session.serverCertificate.publicKey;e=n.encrypt(t.pre_master_secret);var s=e.length+2,i=ke.util.createBuffer();return i.putByte(U.HandshakeType.client_key_exchange),i.putInt24(s),i.putInt16(e.length),i.putBytes(e),i};U.createServerKeyExchange=function(r){var e=0,t=ke.util.createBuffer();return e>0&&(t.putByte(U.HandshakeType.server_key_exchange),t.putInt24(e)),t};U.getClientSignature=function(r,e){var t=ke.util.createBuffer();t.putBuffer(r.session.md5.digest()),t.putBuffer(r.session.sha1.digest()),t=t.getBytes(),r.getSignature=r.getSignature||function(n,s,i){var a=null;if(n.getPrivateKey)try{a=n.getPrivateKey(n,n.session.clientCertificate),a=ke.pki.privateKeyFromPem(a)}catch(u){n.error(n,{message:"Could not get private key.",cause:u,send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.internal_error}})}a===null?n.error(n,{message:"No private key set.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.internal_error}}):s=a.sign(s,null),i(n,s)},r.getSignature(r,t,e)};U.createCertificateVerify=function(r,e){var t=e.length+2,n=ke.util.createBuffer();return n.putByte(U.HandshakeType.certificate_verify),n.putInt24(t),n.putInt16(e.length),n.putBytes(e),n};U.createCertificateRequest=function(r){var e=ke.util.createBuffer();e.putByte(1);var t=ke.util.createBuffer();for(var n in r.caStore.certs){var s=r.caStore.certs[n],i=ke.pki.distinguishedNameToAsn1(s.subject),a=ke.asn1.toDer(i);t.putInt16(a.length()),t.putBuffer(a)}var u=1+e.length()+2+t.length(),c=ke.util.createBuffer();return c.putByte(U.HandshakeType.certificate_request),c.putInt24(u),Ni(c,1,e),Ni(c,2,t),c};U.createServerHelloDone=function(r){var e=ke.util.createBuffer();return e.putByte(U.HandshakeType.server_hello_done),e.putInt24(0),e};U.createChangeCipherSpec=function(){var r=ke.util.createBuffer();return r.putByte(1),r};U.createFinished=function(r){var e=ke.util.createBuffer();e.putBuffer(r.session.md5.digest()),e.putBuffer(r.session.sha1.digest());var t=r.entity===U.ConnectionEnd.client,n=r.session.sp,s=12,i=Vw,a=t?"client finished":"server finished";e=i(n.master_secret,a,e.getBytes(),s);var u=ke.util.createBuffer();return u.putByte(U.HandshakeType.finished),u.putInt24(e.length()),u.putBuffer(e),u};U.createHeartbeat=function(r,e,t){typeof t>"u"&&(t=e.length);var n=ke.util.createBuffer();n.putByte(r),n.putInt16(t),n.putBytes(e);var s=n.length(),i=Math.max(16,s-t-3);return n.putBytes(ke.random.getBytes(i)),n};U.queue=function(r,e){if(e&&!(e.fragment.length()===0&&(e.type===U.ContentType.handshake||e.type===U.ContentType.alert||e.type===U.ContentType.change_cipher_spec))){if(e.type===U.ContentType.handshake){var t=e.fragment.bytes();r.session.md5.update(t),r.session.sha1.update(t),t=null}var n;if(e.fragment.length()<=U.MaxFragment)n=[e];else{n=[];for(var s=e.fragment.bytes();s.length>U.MaxFragment;)n.push(U.createRecord(r,{type:e.type,data:ke.util.createBuffer(s.slice(0,U.MaxFragment))})),s=s.slice(U.MaxFragment);s.length>0&&n.push(U.createRecord(r,{type:e.type,data:ke.util.createBuffer(s)}))}for(var i=0;i<n.length&&!r.fail;++i){var a=n[i],u=r.state.current.write;u.update(r,a)&&r.records.push(a)}}};U.flush=function(r){for(var e=0;e<r.records.length;++e){var t=r.records[e];r.tlsData.putByte(t.type),r.tlsData.putByte(t.version.major),r.tlsData.putByte(t.version.minor),r.tlsData.putInt16(t.fragment.length()),r.tlsData.putBuffer(r.records[e].fragment)}return r.records=[],r.tlsDataReady(r)};var xN=o(function(r){switch(r){case!0:return!0;case ke.pki.certificateError.bad_certificate:return U.Alert.Description.bad_certificate;case ke.pki.certificateError.unsupported_certificate:return U.Alert.Description.unsupported_certificate;case ke.pki.certificateError.certificate_revoked:return U.Alert.Description.certificate_revoked;case ke.pki.certificateError.certificate_expired:return U.Alert.Description.certificate_expired;case ke.pki.certificateError.certificate_unknown:return U.Alert.Description.certificate_unknown;case ke.pki.certificateError.unknown_ca:return U.Alert.Description.unknown_ca;default:return U.Alert.Description.bad_certificate}},"_certErrorToAlertDesc"),DQ=o(function(r){switch(r){case!0:return!0;case U.Alert.Description.bad_certificate:return ke.pki.certificateError.bad_certificate;case U.Alert.Description.unsupported_certificate:return ke.pki.certificateError.unsupported_certificate;case U.Alert.Description.certificate_revoked:return ke.pki.certificateError.certificate_revoked;case U.Alert.Description.certificate_expired:return ke.pki.certificateError.certificate_expired;case U.Alert.Description.certificate_unknown:return ke.pki.certificateError.certificate_unknown;case U.Alert.Description.unknown_ca:return ke.pki.certificateError.unknown_ca;default:return ke.pki.certificateError.bad_certificate}},"_alertDescToCertError");U.verifyCertificateChain=function(r,e){try{var t={};for(var n in r.verifyOptions)t[n]=r.verifyOptions[n];t.verify=function(i,a,u){var c=xN(i),f=r.verify(r,i,a,u);if(f!==!0){if(typeof f=="object"&&!ke.util.isArray(f)){var h=new Error("The application rejected the certificate.");throw h.send=!0,h.alert={level:U.Alert.Level.fatal,description:U.Alert.Description.bad_certificate},f.message&&(h.message=f.message),f.alert&&(h.alert.description=f.alert),h}f!==i&&(f=DQ(f))}return f},ke.pki.verifyCertificateChain(r.caStore,e,t)}catch(i){var s=i;(typeof s!="object"||ke.util.isArray(s))&&(s={send:!0,alert:{level:U.Alert.Level.fatal,description:xN(i)}}),"send"in s||(s.send=!0),"alert"in s||(s.alert={level:U.Alert.Level.fatal,description:xN(s.error)}),r.error(r,s)}return!r.fail};U.createSessionCache=function(r,e){var t=null;if(r&&r.getSession&&r.setSession&&r.order)t=r;else{t={},t.cache=r||{},t.capacity=Math.max(e||100,1),t.order=[];for(var n in r)t.order.length<=e?t.order.push(n):delete r[n];t.getSession=function(s){var i=null,a=null;if(s?a=ke.util.bytesToHex(s):t.order.length>0&&(a=t.order[0]),a!==null&&a in t.cache){i=t.cache[a],delete t.cache[a];for(var u in t.order)if(t.order[u]===a){t.order.splice(u,1);break}}return i},t.setSession=function(s,i){if(t.order.length===t.capacity){var a=t.order.shift();delete t.cache[a]}var a=ke.util.bytesToHex(s);t.order.push(a),t.cache[a]=i}}return t};U.createConnection=function(r){var e=null;r.caStore?ke.util.isArray(r.caStore)?e=ke.pki.createCaStore(r.caStore):e=r.caStore:e=ke.pki.createCaStore();var t=r.cipherSuites||null;if(t===null){t=[];for(var n in U.CipherSuites)t.push(U.CipherSuites[n])}var s=r.server?U.ConnectionEnd.server:U.ConnectionEnd.client,i=r.sessionCache?U.createSessionCache(r.sessionCache):null,a={version:{major:U.Version.major,minor:U.Version.minor},entity:s,sessionId:r.sessionId,caStore:e,sessionCache:i,cipherSuites:t,connected:r.connected,virtualHost:r.virtualHost||null,verifyClient:r.verifyClient||!1,verify:r.verify||function(h,m,g,x){return m},verifyOptions:r.verifyOptions||{},getCertificate:r.getCertificate||null,getPrivateKey:r.getPrivateKey||null,getSignature:r.getSignature||null,input:ke.util.createBuffer(),tlsData:ke.util.createBuffer(),data:ke.util.createBuffer(),tlsDataReady:r.tlsDataReady,dataReady:r.dataReady,heartbeatReceived:r.heartbeatReceived,closed:r.closed,error:o(function(h,m){m.origin=m.origin||(h.entity===U.ConnectionEnd.client?"client":"server"),m.send&&(U.queue(h,U.createAlert(h,m.alert)),U.flush(h));var g=m.fatal!==!1;g&&(h.fail=!0),r.error(h,m),g&&h.close(!1)},"error"),deflate:r.deflate||null,inflate:r.inflate||null};a.reset=function(h){a.version={major:U.Version.major,minor:U.Version.minor},a.record=null,a.session=null,a.peerCertificate=null,a.state={pending:null,current:null},a.expect=a.entity===U.ConnectionEnd.client?mQ:bQ,a.fragmented=null,a.records=[],a.open=!1,a.handshakes=0,a.handshaking=!1,a.isConnected=!1,a.fail=!(h||typeof h>"u"),a.input.clear(),a.tlsData.clear(),a.data.clear(),a.state.current=U.createConnectionState(a)},a.reset();var u=o(function(h,m){var g=m.type-U.ContentType.change_cipher_spec,x=bN[h.entity][h.expect];g in x?x[g](h,m):U.handleUnexpected(h,m)},"_update"),c=o(function(h){var m=0,g=h.input,x=g.length();if(x<5)m=5-x;else{h.record={type:g.getByte(),version:{major:g.getByte(),minor:g.getByte()},length:g.getInt16(),fragment:ke.util.createBuffer(),ready:!1};var v=h.record.version.major===h.version.major;v&&h.session&&h.session.version&&(v=h.record.version.minor===h.version.minor),v||h.error(h,{message:"Incompatible TLS version.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.protocol_version}})}return m},"_readRecordHeader"),f=o(function(h){var m=0,g=h.input,x=g.length();if(x<h.record.length)m=h.record.length-x;else{h.record.fragment.putBytes(g.getBytes(h.record.length)),g.compact();var v=h.state.current.read;v.update(h,h.record)&&(h.fragmented!==null&&(h.fragmented.type===h.record.type?(h.fragmented.fragment.putBuffer(h.record.fragment),h.record=h.fragmented):h.error(h,{message:"Invalid fragmented record.",send:!0,alert:{level:U.Alert.Level.fatal,description:U.Alert.Description.unexpected_message}})),h.record.ready=!0)}return m},"_readRecord");return a.handshake=function(h){if(a.entity!==U.ConnectionEnd.client)a.error(a,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(a.handshaking)a.error(a,{message:"Handshake already in progress.",fatal:!1});else{a.fail&&!a.open&&a.handshakes===0&&(a.fail=!1),a.handshaking=!0,h=h||"";var m=null;h.length>0&&(a.sessionCache&&(m=a.sessionCache.getSession(h)),m===null&&(h="")),h.length===0&&a.sessionCache&&(m=a.sessionCache.getSession(),m!==null&&(h=m.id)),a.session={id:h,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:ke.md.md5.create(),sha1:ke.md.sha1.create()},m&&(a.version=m.version,a.session.sp=m.sp),a.session.sp.client_random=U.createRandom().getBytes(),a.open=!0,U.queue(a,U.createRecord(a,{type:U.ContentType.handshake,data:U.createClientHello(a)})),U.flush(a)}},a.process=function(h){var m=0;return h&&a.input.putBytes(h),a.fail||(a.record!==null&&a.record.ready&&a.record.fragment.isEmpty()&&(a.record=null),a.record===null&&(m=c(a)),!a.fail&&a.record!==null&&!a.record.ready&&(m=f(a)),!a.fail&&a.record!==null&&a.record.ready&&u(a,a.record)),m},a.prepare=function(h){return U.queue(a,U.createRecord(a,{type:U.ContentType.application_data,data:ke.util.createBuffer(h)})),U.flush(a)},a.prepareHeartbeatRequest=function(h,m){return h instanceof ke.util.ByteBuffer&&(h=h.bytes()),typeof m>"u"&&(m=h.length),a.expectedHeartbeatPayload=h,U.queue(a,U.createRecord(a,{type:U.ContentType.heartbeat,data:U.createHeartbeat(U.HeartbeatMessageType.heartbeat_request,h,m)})),U.flush(a)},a.close=function(h){if(!a.fail&&a.sessionCache&&a.session){var m={id:a.session.id,version:a.session.version,sp:a.session.sp};m.sp.keys=null,a.sessionCache.setSession(m.id,m)}a.open&&(a.open=!1,a.input.clear(),(a.isConnected||a.handshaking)&&(a.isConnected=a.handshaking=!1,U.queue(a,U.createAlert(a,{level:U.Alert.Level.warning,description:U.Alert.Description.close_notify})),U.flush(a)),a.closed(a)),a.reset(h)},a};pk.exports=ke.tls=ke.tls||{};for(kw in U)typeof U[kw]!="function"&&(ke.tls[kw]=U[kw]);var kw;ke.tls.prf_tls1=Vw;ke.tls.hmac_sha1=hQ;ke.tls.createSessionCache=U.createSessionCache;ke.tls.createConnection=U.createConnection});var gk=Z((Dde,mk)=>{"use strict";var ju=$t();Ru();EN();var Ti=mk.exports=ju.tls;Ti.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:o(function(r){r.bulk_cipher_algorithm=Ti.BulkCipherAlgorithm.aes,r.cipher_type=Ti.CipherType.block,r.enc_key_length=16,r.block_length=16,r.fixed_iv_length=16,r.record_iv_length=16,r.mac_algorithm=Ti.MACAlgorithm.hmac_sha1,r.mac_length=20,r.mac_key_length=20},"initSecurityParameters"),initConnectionState:dk};Ti.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:o(function(r){r.bulk_cipher_algorithm=Ti.BulkCipherAlgorithm.aes,r.cipher_type=Ti.CipherType.block,r.enc_key_length=32,r.block_length=16,r.fixed_iv_length=16,r.record_iv_length=16,r.mac_algorithm=Ti.MACAlgorithm.hmac_sha1,r.mac_length=20,r.mac_key_length=20},"initSecurityParameters"),initConnectionState:dk};function dk(r,e,t){var n=e.entity===ju.tls.ConnectionEnd.client;r.read.cipherState={init:!1,cipher:ju.cipher.createDecipher("AES-CBC",n?t.keys.server_write_key:t.keys.client_write_key),iv:n?t.keys.server_write_IV:t.keys.client_write_IV},r.write.cipherState={init:!1,cipher:ju.cipher.createCipher("AES-CBC",n?t.keys.client_write_key:t.keys.server_write_key),iv:n?t.keys.client_write_IV:t.keys.server_write_IV},r.read.cipherFunction=kQ,r.write.cipherFunction=RQ,r.read.macLength=r.write.macLength=t.mac_length,r.read.macFunction=r.write.macFunction=Ti.hmac_sha1}o(dk,"initConnectionState");function RQ(r,e){var t=!1,n=e.macFunction(e.macKey,e.sequenceNumber,r);r.fragment.putBytes(n),e.updateSequenceNumber();var s;r.version.minor===Ti.Versions.TLS_1_0.minor?s=e.cipherState.init?null:e.cipherState.iv:s=ju.random.getBytesSync(16),e.cipherState.init=!0;var i=e.cipherState.cipher;return i.start({iv:s}),r.version.minor>=Ti.Versions.TLS_1_1.minor&&i.output.putBytes(s),i.update(r.fragment),i.finish(PQ)&&(r.fragment=i.output,r.length=r.fragment.length(),t=!0),t}o(RQ,"encrypt_aes_cbc_sha1");function PQ(r,e,t){if(!t){var n=r-e.length()%r;e.fillWithByte(n-1,n)}return!0}o(PQ,"encrypt_aes_cbc_sha1_padding");function OQ(r,e,t){var n=!0;if(t){for(var s=e.length(),i=e.last(),a=s-1-i;a<s-1;++a)n=n&&e.at(a)==i;n&&e.truncate(i+1)}return n}o(OQ,"decrypt_aes_cbc_sha1_padding");function kQ(r,e){var t=!1,n;r.version.minor===Ti.Versions.TLS_1_0.minor?n=e.cipherState.init?null:e.cipherState.iv:n=r.fragment.getBytes(16),e.cipherState.init=!0;var s=e.cipherState.cipher;s.start({iv:n}),s.update(r.fragment),t=s.finish(OQ);var i=e.macLength,a=ju.random.getBytesSync(i),u=s.output.length();u>=i?(r.fragment=s.output.getBytes(u-i),a=s.output.getBytes(i)):r.fragment=s.output.getBytes(),r.fragment=ju.util.createBuffer(r.fragment),r.length=r.fragment.length();var c=e.macFunction(e.macKey,e.sequenceNumber,r);return e.updateSequenceNumber(),t=LQ(e.macKey,a,c)&&t,t}o(kQ,"decrypt_aes_cbc_sha1");function LQ(r,e,t){var n=ju.hmac.create();return n.start("SHA1",r),n.update(e),e=n.digest().getBytes(),n.start(null,null),n.update(t),t=n.digest().getBytes(),e===t}o(LQ,"compareMacs")});var NN=Z((Pde,wk)=>{"use strict";var Mr=$t();Ia();lr();var ng=wk.exports=Mr.sha512=Mr.sha512||{};Mr.md.sha512=Mr.md.algorithms.sha512=ng;var yk=Mr.sha384=Mr.sha512.sha384=Mr.sha512.sha384||{};yk.create=function(){return ng.create("SHA-384")};Mr.md.sha384=Mr.md.algorithms.sha384=yk;Mr.sha512.sha256=Mr.sha512.sha256||{create:o(function(){return ng.create("SHA-512/256")},"create")};Mr.md["sha512/256"]=Mr.md.algorithms["sha512/256"]=Mr.sha512.sha256;Mr.sha512.sha224=Mr.sha512.sha224||{create:o(function(){return ng.create("SHA-512/224")},"create")};Mr.md["sha512/224"]=Mr.md.algorithms["sha512/224"]=Mr.sha512.sha224;ng.create=function(r){if(xk||VQ(),typeof r>"u"&&(r="SHA-512"),!(r in kl))throw new Error("Invalid SHA-512 algorithm: "+r);for(var e=kl[r],t=null,n=Mr.util.createBuffer(),s=new Array(80),i=0;i<80;++i)s[i]=new Array(2);var a=64;switch(r){case"SHA-384":a=48;break;case"SHA-512/256":a=32;break;case"SHA-512/224":a=28;break}var u={algorithm:r.replace("-","").toLowerCase(),blockLength:128,digestLength:a,messageLength:0,fullMessageLength:null,messageLengthSize:16};return u.start=function(){u.messageLength=0,u.fullMessageLength=u.messageLength128=[];for(var c=u.messageLengthSize/4,f=0;f<c;++f)u.fullMessageLength.push(0);n=Mr.util.createBuffer(),t=new Array(e.length);for(var f=0;f<e.length;++f)t[f]=e[f].slice(0);return u},u.start(),u.update=function(c,f){f==="utf8"&&(c=Mr.util.encodeUtf8(c));var h=c.length;u.messageLength+=h,h=[h/4294967296>>>0,h>>>0];for(var m=u.fullMessageLength.length-1;m>=0;--m)u.fullMessageLength[m]+=h[1],h[1]=h[0]+(u.fullMessageLength[m]/4294967296>>>0),u.fullMessageLength[m]=u.fullMessageLength[m]>>>0,h[0]=h[1]/4294967296>>>0;return n.putBytes(c),vk(t,s,n),(n.read>2048||n.length()===0)&&n.compact(),u},u.digest=function(){var c=Mr.util.createBuffer();c.putBytes(n.bytes());var f=u.fullMessageLength[u.fullMessageLength.length-1]+u.messageLengthSize,h=f&u.blockLength-1;c.putBytes(AN.substr(0,u.blockLength-h));for(var m,g,x=u.fullMessageLength[0]*8,v=0;v<u.fullMessageLength.length-1;++v)m=u.fullMessageLength[v+1]*8,g=m/4294967296>>>0,x+=g,c.putInt32(x>>>0),x=m>>>0;c.putInt32(x);for(var w=new Array(t.length),v=0;v<t.length;++v)w[v]=t[v].slice(0);vk(w,s,c);var S=Mr.util.createBuffer(),A;r==="SHA-512"?A=w.length:r==="SHA-384"?A=w.length-2:A=w.length-4;for(var v=0;v<A;++v)S.putInt32(w[v][0]),(v!==A-1||r!=="SHA-512/224")&&S.putInt32(w[v][1]);return S},u};var AN=null,xk=!1,CN=null,kl=null;function VQ(){AN="\x80",AN+=Mr.util.fillString("\0",128),CN=[[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]],kl={},kl["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],kl["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],kl["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],kl["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],xk=!0}o(VQ,"_init");function vk(r,e,t){for(var n,s,i,a,u,c,f,h,m,g,x,v,w,S,A,T,b,E,C,_,F,R,q,H,K,X,pe,le,ue,ee,he,we,Ke,Ae,xe,je=t.length();je>=128;){for(ue=0;ue<16;++ue)e[ue][0]=t.getInt32()>>>0,e[ue][1]=t.getInt32()>>>0;for(;ue<80;++ue)we=e[ue-2],ee=we[0],he=we[1],n=((ee>>>19|he<<13)^(he>>>29|ee<<3)^ee>>>6)>>>0,s=((ee<<13|he>>>19)^(he<<3|ee>>>29)^(ee<<26|he>>>6))>>>0,Ae=e[ue-15],ee=Ae[0],he=Ae[1],i=((ee>>>1|he<<31)^(ee>>>8|he<<24)^ee>>>7)>>>0,a=((ee<<31|he>>>1)^(ee<<24|he>>>8)^(ee<<25|he>>>7))>>>0,Ke=e[ue-7],xe=e[ue-16],he=s+Ke[1]+a+xe[1],e[ue][0]=n+Ke[0]+i+xe[0]+(he/4294967296>>>0)>>>0,e[ue][1]=he>>>0;for(w=r[0][0],S=r[0][1],A=r[1][0],T=r[1][1],b=r[2][0],E=r[2][1],C=r[3][0],_=r[3][1],F=r[4][0],R=r[4][1],q=r[5][0],H=r[5][1],K=r[6][0],X=r[6][1],pe=r[7][0],le=r[7][1],ue=0;ue<80;++ue)f=((F>>>14|R<<18)^(F>>>18|R<<14)^(R>>>9|F<<23))>>>0,h=((F<<18|R>>>14)^(F<<14|R>>>18)^(R<<23|F>>>9))>>>0,m=(K^F&(q^K))>>>0,g=(X^R&(H^X))>>>0,u=((w>>>28|S<<4)^(S>>>2|w<<30)^(S>>>7|w<<25))>>>0,c=((w<<4|S>>>28)^(S<<30|w>>>2)^(S<<25|w>>>7))>>>0,x=(w&A|b&(w^A))>>>0,v=(S&T|E&(S^T))>>>0,he=le+h+g+CN[ue][1]+e[ue][1],n=pe+f+m+CN[ue][0]+e[ue][0]+(he/4294967296>>>0)>>>0,s=he>>>0,he=c+v,i=u+x+(he/4294967296>>>0)>>>0,a=he>>>0,pe=K,le=X,K=q,X=H,q=F,H=R,he=_+s,F=C+n+(he/4294967296>>>0)>>>0,R=he>>>0,C=b,_=E,b=A,E=T,A=w,T=S,he=s+a,w=n+i+(he/4294967296>>>0)>>>0,S=he>>>0;he=r[0][1]+S,r[0][0]=r[0][0]+w+(he/4294967296>>>0)>>>0,r[0][1]=he>>>0,he=r[1][1]+T,r[1][0]=r[1][0]+A+(he/4294967296>>>0)>>>0,r[1][1]=he>>>0,he=r[2][1]+E,r[2][0]=r[2][0]+b+(he/4294967296>>>0)>>>0,r[2][1]=he>>>0,he=r[3][1]+_,r[3][0]=r[3][0]+C+(he/4294967296>>>0)>>>0,r[3][1]=he>>>0,he=r[4][1]+R,r[4][0]=r[4][0]+F+(he/4294967296>>>0)>>>0,r[4][1]=he>>>0,he=r[5][1]+H,r[5][0]=r[5][0]+q+(he/4294967296>>>0)>>>0,r[5][1]=he>>>0,he=r[6][1]+X,r[6][0]=r[6][0]+K+(he/4294967296>>>0)>>>0,r[6][1]=he>>>0,he=r[7][1]+le,r[7][0]=r[7][0]+pe+(he/4294967296>>>0)>>>0,r[7][1]=he>>>0,je-=128}}o(vk,"_update")});var Sk=Z(TN=>{"use strict";var UQ=$t();ea();var Bn=UQ.asn1;TN.privateKeyValidator={name:"PrivateKeyInfo",tagClass:Bn.Class.UNIVERSAL,type:Bn.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:Bn.Class.UNIVERSAL,type:Bn.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:Bn.Class.UNIVERSAL,type:Bn.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Bn.Class.UNIVERSAL,type:Bn.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:Bn.Class.UNIVERSAL,type:Bn.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]};TN.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:Bn.Class.UNIVERSAL,type:Bn.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:Bn.Class.UNIVERSAL,type:Bn.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Bn.Class.UNIVERSAL,type:Bn.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:Bn.Class.UNIVERSAL,type:Bn.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}});var Ok=Z((Lde,Pk)=>{"use strict";var Kn=$t();Z0();bi();NN();lr();var Tk=Sk(),jQ=Tk.publicKeyValidator,MQ=Tk.privateKeyValidator;typeof bk>"u"&&(bk=Kn.jsbn.BigInteger);var bk,BN=Kn.util.ByteBuffer,Bs=typeof Buffer>"u"?Uint8Array:Buffer;Kn.pki=Kn.pki||{};Pk.exports=Kn.pki.ed25519=Kn.ed25519=Kn.ed25519||{};var Qt=Kn.ed25519;Qt.constants={};Qt.constants.PUBLIC_KEY_BYTE_LENGTH=32;Qt.constants.PRIVATE_KEY_BYTE_LENGTH=64;Qt.constants.SEED_BYTE_LENGTH=32;Qt.constants.SIGN_BYTE_LENGTH=64;Qt.constants.HASH_BYTE_LENGTH=64;Qt.generateKeyPair=function(r){r=r||{};var e=r.seed;if(e===void 0)e=Kn.random.getBytesSync(Qt.constants.SEED_BYTE_LENGTH);else if(typeof e=="string"){if(e.length!==Qt.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+Qt.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(e instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');e=Io({message:e,encoding:"binary"});for(var t=new Bs(Qt.constants.PUBLIC_KEY_BYTE_LENGTH),n=new Bs(Qt.constants.PRIVATE_KEY_BYTE_LENGTH),s=0;s<32;++s)n[s]=e[s];return KQ(t,n),{publicKey:t,privateKey:n}};Qt.privateKeyFromAsn1=function(r){var e={},t=[],n=Kn.asn1.validate(r,MQ,e,t);if(!n){var s=new Error("Invalid Key.");throw s.errors=t,s}var i=Kn.asn1.derToOid(e.privateKeyOid),a=Kn.oids.EdDSA25519;if(i!==a)throw new Error('Invalid OID "'+i+'"; OID must be "'+a+'".');var u=e.privateKey,c=Io({message:Kn.asn1.fromDer(u).value,encoding:"binary"});return{privateKeyBytes:c}};Qt.publicKeyFromAsn1=function(r){var e={},t=[],n=Kn.asn1.validate(r,jQ,e,t);if(!n){var s=new Error("Invalid Key.");throw s.errors=t,s}var i=Kn.asn1.derToOid(e.publicKeyOid),a=Kn.oids.EdDSA25519;if(i!==a)throw new Error('Invalid OID "'+i+'"; OID must be "'+a+'".');var u=e.ed25519PublicKey;if(u.length!==Qt.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return Io({message:u,encoding:"binary"})};Qt.publicKeyFromPrivateKey=function(r){r=r||{};var e=Io({message:r.privateKey,encoding:"binary"});if(e.length!==Qt.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+Qt.constants.PRIVATE_KEY_BYTE_LENGTH);for(var t=new Bs(Qt.constants.PUBLIC_KEY_BYTE_LENGTH),n=0;n<t.length;++n)t[n]=e[32+n];return t};Qt.sign=function(r){r=r||{};var e=Io(r),t=Io({message:r.privateKey,encoding:"binary"});if(t.length===Qt.constants.SEED_BYTE_LENGTH){var n=Qt.generateKeyPair({seed:t});t=n.privateKey}else if(t.length!==Qt.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+Qt.constants.SEED_BYTE_LENGTH+" or "+Qt.constants.PRIVATE_KEY_BYTE_LENGTH);var s=new Bs(Qt.constants.SIGN_BYTE_LENGTH+e.length);$Q(s,e,e.length,t);for(var i=new Bs(Qt.constants.SIGN_BYTE_LENGTH),a=0;a<i.length;++a)i[a]=s[a];return i};Qt.verify=function(r){r=r||{};var e=Io(r);if(r.signature===void 0)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var t=Io({message:r.signature,encoding:"binary"});if(t.length!==Qt.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+Qt.constants.SIGN_BYTE_LENGTH);var n=Io({message:r.publicKey,encoding:"binary"});if(n.length!==Qt.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+Qt.constants.PUBLIC_KEY_BYTE_LENGTH);var s=new Bs(Qt.constants.SIGN_BYTE_LENGTH+e.length),i=new Bs(Qt.constants.SIGN_BYTE_LENGTH+e.length),a;for(a=0;a<Qt.constants.SIGN_BYTE_LENGTH;++a)s[a]=t[a];for(a=0;a<e.length;++a)s[a+Qt.constants.SIGN_BYTE_LENGTH]=e[a];return GQ(i,s,s.length,n)>=0};function Io(r){var e=r.message;if(e instanceof Uint8Array||e instanceof Bs)return e;var t=r.encoding;if(e===void 0)if(r.md)e=r.md.digest().getBytes(),t="binary";else throw new TypeError('"options.message" or "options.md" not specified.');if(typeof e=="string"&&!t)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof e=="string"){if(typeof Buffer<"u")return Buffer.from(e,t);e=new BN(e,t)}else if(!(e instanceof BN))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var n=new Bs(e.length()),s=0;s<n.length;++s)n[s]=e.at(s);return n}o(Io,"messageToNativeBuffer");var DN=Nt(),Uw=Nt([1]),FQ=Nt([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),qQ=Nt([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),Ek=Nt([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),Ak=Nt([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),IN=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]),HQ=Nt([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function sg(r,e){var t=Kn.md.sha512.create(),n=new BN(r);t.update(n.getBytes(e),"binary");var s=t.digest().getBytes();if(typeof Buffer<"u")return Buffer.from(s,"binary");for(var i=new Bs(Qt.constants.HASH_BYTE_LENGTH),a=0;a<64;++a)i[a]=s.charCodeAt(a);return i}o(sg,"sha512");function KQ(r,e){var t=[Nt(),Nt(),Nt(),Nt()],n,s=sg(e,32);for(s[0]&=248,s[31]&=127,s[31]|=64,kN(t,s),ON(r,t),n=0;n<32;++n)e[n+32]=r[n];return 0}o(KQ,"crypto_sign_keypair");function $Q(r,e,t,n){var s,i,a=new Float64Array(64),u=[Nt(),Nt(),Nt(),Nt()],c=sg(n,32);c[0]&=248,c[31]&=127,c[31]|=64;var f=t+64;for(s=0;s<t;++s)r[64+s]=e[s];for(s=0;s<32;++s)r[32+s]=c[32+s];var h=sg(r.subarray(32),t+32);for(RN(h),kN(u,h),ON(r,u),s=32;s<64;++s)r[s]=n[s];var m=sg(r,t+64);for(RN(m),s=32;s<64;++s)a[s]=0;for(s=0;s<32;++s)a[s]=h[s];for(s=0;s<32;++s)for(i=0;i<32;i++)a[s+i]+=m[s]*c[i];return Ik(r.subarray(32),a),f}o($Q,"crypto_sign");function GQ(r,e,t,n){var s,i,a=new Bs(32),u=[Nt(),Nt(),Nt(),Nt()],c=[Nt(),Nt(),Nt(),Nt()];if(i=-1,t<64||XQ(c,n))return-1;for(s=0;s<t;++s)r[s]=e[s];for(s=0;s<32;++s)r[s+32]=n[s];var f=sg(r,t);if(RN(f),Dk(u,c,f),kN(c,e.subarray(32)),PN(u,c),ON(a,u),t-=64,_k(e,0,a,0)){for(s=0;s<t;++s)r[s]=0;return-1}for(s=0;s<t;++s)r[s]=e[s+64];return i=t,i}o(GQ,"crypto_sign_open");function Ik(r,e){var t,n,s,i;for(n=63;n>=32;--n){for(t=0,s=n-32,i=n-12;s<i;++s)e[s]+=t-16*e[n]*IN[s-(n-32)],t=e[s]+128>>8,e[s]-=t*256;e[s]+=t,e[n]=0}for(t=0,s=0;s<32;++s)e[s]+=t-(e[31]>>4)*IN[s],t=e[s]>>8,e[s]&=255;for(s=0;s<32;++s)e[s]-=t*IN[s];for(n=0;n<32;++n)e[n+1]+=e[n]>>8,r[n]=e[n]&255}o(Ik,"modL");function RN(r){for(var e=new Float64Array(64),t=0;t<64;++t)e[t]=r[t],r[t]=0;Ik(r,e)}o(RN,"reduce");function PN(r,e){var t=Nt(),n=Nt(),s=Nt(),i=Nt(),a=Nt(),u=Nt(),c=Nt(),f=Nt(),h=Nt();gp(t,r[1],r[0]),gp(h,e[1],e[0]),Ir(t,t,h),mp(n,r[0],r[1]),mp(h,e[0],e[1]),Ir(n,n,h),Ir(s,r[3],e[3]),Ir(s,s,qQ),Ir(i,r[2],e[2]),mp(i,i,i),gp(a,n,t),gp(u,i,s),mp(c,i,s),mp(f,n,t),Ir(r[0],a,u),Ir(r[1],f,c),Ir(r[2],c,u),Ir(r[3],a,f)}o(PN,"add");function Ck(r,e,t){for(var n=0;n<4;++n)Rk(r[n],e[n],t)}o(Ck,"cswap");function ON(r,e){var t=Nt(),n=Nt(),s=Nt();YQ(s,e[2]),Ir(t,e[0],s),Ir(n,e[1],s),jw(r,n),r[31]^=Bk(t)<<7}o(ON,"pack");function jw(r,e){var t,n,s,i=Nt(),a=Nt();for(t=0;t<16;++t)a[t]=e[t];for(_N(a),_N(a),_N(a),n=0;n<2;++n){for(i[0]=a[0]-65517,t=1;t<15;++t)i[t]=a[t]-65535-(i[t-1]>>16&1),i[t-1]&=65535;i[15]=a[15]-32767-(i[14]>>16&1),s=i[15]>>16&1,i[14]&=65535,Rk(a,i,1-s)}for(t=0;t<16;t++)r[2*t]=a[t]&255,r[2*t+1]=a[t]>>8}o(jw,"pack25519");function XQ(r,e){var t=Nt(),n=Nt(),s=Nt(),i=Nt(),a=Nt(),u=Nt(),c=Nt();return Mu(r[2],Uw),WQ(r[1],e),Ll(s,r[1]),Ir(i,s,FQ),gp(s,s,r[2]),mp(i,r[2],i),Ll(a,i),Ll(u,a),Ir(c,u,a),Ir(t,c,s),Ir(t,t,i),zQ(t,t),Ir(t,t,s),Ir(t,t,i),Ir(t,t,i),Ir(r[0],t,i),Ll(n,r[0]),Ir(n,n,i),Nk(n,s)&&Ir(r[0],r[0],HQ),Ll(n,r[0]),Ir(n,n,i),Nk(n,s)?-1:(Bk(r[0])===e[31]>>7&&gp(r[0],DN,r[0]),Ir(r[3],r[0],r[1]),0)}o(XQ,"unpackneg");function WQ(r,e){var t;for(t=0;t<16;++t)r[t]=e[2*t]+(e[2*t+1]<<8);r[15]&=32767}o(WQ,"unpack25519");function zQ(r,e){var t=Nt(),n;for(n=0;n<16;++n)t[n]=e[n];for(n=250;n>=0;--n)Ll(t,t),n!==1&&Ir(t,t,e);for(n=0;n<16;++n)r[n]=t[n]}o(zQ,"pow2523");function Nk(r,e){var t=new Bs(32),n=new Bs(32);return jw(t,r),jw(n,e),_k(t,0,n,0)}o(Nk,"neq25519");function _k(r,e,t,n){return JQ(r,e,t,n,32)}o(_k,"crypto_verify_32");function JQ(r,e,t,n,s){var i,a=0;for(i=0;i<s;++i)a|=r[e+i]^t[n+i];return(1&a-1>>>8)-1}o(JQ,"vn");function Bk(r){var e=new Bs(32);return jw(e,r),e[0]&1}o(Bk,"par25519");function Dk(r,e,t){var n,s;for(Mu(r[0],DN),Mu(r[1],Uw),Mu(r[2],Uw),Mu(r[3],DN),s=255;s>=0;--s)n=t[s/8|0]>>(s&7)&1,Ck(r,e,n),PN(e,r),PN(r,r),Ck(r,e,n)}o(Dk,"scalarmult");function kN(r,e){var t=[Nt(),Nt(),Nt(),Nt()];Mu(t[0],Ek),Mu(t[1],Ak),Mu(t[2],Uw),Ir(t[3],Ek,Ak),Dk(r,t,e)}o(kN,"scalarbase");function Mu(r,e){var t;for(t=0;t<16;t++)r[t]=e[t]|0}o(Mu,"set25519");function YQ(r,e){var t=Nt(),n;for(n=0;n<16;++n)t[n]=e[n];for(n=253;n>=0;--n)Ll(t,t),n!==2&&n!==4&&Ir(t,t,e);for(n=0;n<16;++n)r[n]=t[n]}o(YQ,"inv25519");function _N(r){var e,t,n=1;for(e=0;e<16;++e)t=r[e]+n+65535,n=Math.floor(t/65536),r[e]=t-n*65536;r[0]+=n-1+37*(n-1)}o(_N,"car25519");function Rk(r,e,t){for(var n,s=~(t-1),i=0;i<16;++i)n=s&(r[i]^e[i]),r[i]^=n,e[i]^=n}o(Rk,"sel25519");function Nt(r){var e,t=new Float64Array(16);if(r)for(e=0;e<r.length;++e)t[e]=r[e];return t}o(Nt,"gf");function mp(r,e,t){for(var n=0;n<16;++n)r[n]=e[n]+t[n]}o(mp,"A");function gp(r,e,t){for(var n=0;n<16;++n)r[n]=e[n]-t[n]}o(gp,"Z");function Ll(r,e){Ir(r,e,e)}o(Ll,"S");function Ir(r,e,t){var n,s,i=0,a=0,u=0,c=0,f=0,h=0,m=0,g=0,x=0,v=0,w=0,S=0,A=0,T=0,b=0,E=0,C=0,_=0,F=0,R=0,q=0,H=0,K=0,X=0,pe=0,le=0,ue=0,ee=0,he=0,we=0,Ke=0,Ae=t[0],xe=t[1],je=t[2],Je=t[3],Qe=t[4],lt=t[5],O=t[6],D=t[7],se=t[8],z=t[9],Ge=t[10],Re=t[11],Ce=t[12],ft=t[13],nr=t[14],Me=t[15];n=e[0],i+=n*Ae,a+=n*xe,u+=n*je,c+=n*Je,f+=n*Qe,h+=n*lt,m+=n*O,g+=n*D,x+=n*se,v+=n*z,w+=n*Ge,S+=n*Re,A+=n*Ce,T+=n*ft,b+=n*nr,E+=n*Me,n=e[1],a+=n*Ae,u+=n*xe,c+=n*je,f+=n*Je,h+=n*Qe,m+=n*lt,g+=n*O,x+=n*D,v+=n*se,w+=n*z,S+=n*Ge,A+=n*Re,T+=n*Ce,b+=n*ft,E+=n*nr,C+=n*Me,n=e[2],u+=n*Ae,c+=n*xe,f+=n*je,h+=n*Je,m+=n*Qe,g+=n*lt,x+=n*O,v+=n*D,w+=n*se,S+=n*z,A+=n*Ge,T+=n*Re,b+=n*Ce,E+=n*ft,C+=n*nr,_+=n*Me,n=e[3],c+=n*Ae,f+=n*xe,h+=n*je,m+=n*Je,g+=n*Qe,x+=n*lt,v+=n*O,w+=n*D,S+=n*se,A+=n*z,T+=n*Ge,b+=n*Re,E+=n*Ce,C+=n*ft,_+=n*nr,F+=n*Me,n=e[4],f+=n*Ae,h+=n*xe,m+=n*je,g+=n*Je,x+=n*Qe,v+=n*lt,w+=n*O,S+=n*D,A+=n*se,T+=n*z,b+=n*Ge,E+=n*Re,C+=n*Ce,_+=n*ft,F+=n*nr,R+=n*Me,n=e[5],h+=n*Ae,m+=n*xe,g+=n*je,x+=n*Je,v+=n*Qe,w+=n*lt,S+=n*O,A+=n*D,T+=n*se,b+=n*z,E+=n*Ge,C+=n*Re,_+=n*Ce,F+=n*ft,R+=n*nr,q+=n*Me,n=e[6],m+=n*Ae,g+=n*xe,x+=n*je,v+=n*Je,w+=n*Qe,S+=n*lt,A+=n*O,T+=n*D,b+=n*se,E+=n*z,C+=n*Ge,_+=n*Re,F+=n*Ce,R+=n*ft,q+=n*nr,H+=n*Me,n=e[7],g+=n*Ae,x+=n*xe,v+=n*je,w+=n*Je,S+=n*Qe,A+=n*lt,T+=n*O,b+=n*D,E+=n*se,C+=n*z,_+=n*Ge,F+=n*Re,R+=n*Ce,q+=n*ft,H+=n*nr,K+=n*Me,n=e[8],x+=n*Ae,v+=n*xe,w+=n*je,S+=n*Je,A+=n*Qe,T+=n*lt,b+=n*O,E+=n*D,C+=n*se,_+=n*z,F+=n*Ge,R+=n*Re,q+=n*Ce,H+=n*ft,K+=n*nr,X+=n*Me,n=e[9],v+=n*Ae,w+=n*xe,S+=n*je,A+=n*Je,T+=n*Qe,b+=n*lt,E+=n*O,C+=n*D,_+=n*se,F+=n*z,R+=n*Ge,q+=n*Re,H+=n*Ce,K+=n*ft,X+=n*nr,pe+=n*Me,n=e[10],w+=n*Ae,S+=n*xe,A+=n*je,T+=n*Je,b+=n*Qe,E+=n*lt,C+=n*O,_+=n*D,F+=n*se,R+=n*z,q+=n*Ge,H+=n*Re,K+=n*Ce,X+=n*ft,pe+=n*nr,le+=n*Me,n=e[11],S+=n*Ae,A+=n*xe,T+=n*je,b+=n*Je,E+=n*Qe,C+=n*lt,_+=n*O,F+=n*D,R+=n*se,q+=n*z,H+=n*Ge,K+=n*Re,X+=n*Ce,pe+=n*ft,le+=n*nr,ue+=n*Me,n=e[12],A+=n*Ae,T+=n*xe,b+=n*je,E+=n*Je,C+=n*Qe,_+=n*lt,F+=n*O,R+=n*D,q+=n*se,H+=n*z,K+=n*Ge,X+=n*Re,pe+=n*Ce,le+=n*ft,ue+=n*nr,ee+=n*Me,n=e[13],T+=n*Ae,b+=n*xe,E+=n*je,C+=n*Je,_+=n*Qe,F+=n*lt,R+=n*O,q+=n*D,H+=n*se,K+=n*z,X+=n*Ge,pe+=n*Re,le+=n*Ce,ue+=n*ft,ee+=n*nr,he+=n*Me,n=e[14],b+=n*Ae,E+=n*xe,C+=n*je,_+=n*Je,F+=n*Qe,R+=n*lt,q+=n*O,H+=n*D,K+=n*se,X+=n*z,pe+=n*Ge,le+=n*Re,ue+=n*Ce,ee+=n*ft,he+=n*nr,we+=n*Me,n=e[15],E+=n*Ae,C+=n*xe,_+=n*je,F+=n*Je,R+=n*Qe,q+=n*lt,H+=n*O,K+=n*D,X+=n*se,pe+=n*z,le+=n*Ge,ue+=n*Re,ee+=n*Ce,he+=n*ft,we+=n*nr,Ke+=n*Me,i+=38*C,a+=38*_,u+=38*F,c+=38*R,f+=38*q,h+=38*H,m+=38*K,g+=38*X,x+=38*pe,v+=38*le,w+=38*ue,S+=38*ee,A+=38*he,T+=38*we,b+=38*Ke,s=1,n=i+s+65535,s=Math.floor(n/65536),i=n-s*65536,n=a+s+65535,s=Math.floor(n/65536),a=n-s*65536,n=u+s+65535,s=Math.floor(n/65536),u=n-s*65536,n=c+s+65535,s=Math.floor(n/65536),c=n-s*65536,n=f+s+65535,s=Math.floor(n/65536),f=n-s*65536,n=h+s+65535,s=Math.floor(n/65536),h=n-s*65536,n=m+s+65535,s=Math.floor(n/65536),m=n-s*65536,n=g+s+65535,s=Math.floor(n/65536),g=n-s*65536,n=x+s+65535,s=Math.floor(n/65536),x=n-s*65536,n=v+s+65535,s=Math.floor(n/65536),v=n-s*65536,n=w+s+65535,s=Math.floor(n/65536),w=n-s*65536,n=S+s+65535,s=Math.floor(n/65536),S=n-s*65536,n=A+s+65535,s=Math.floor(n/65536),A=n-s*65536,n=T+s+65535,s=Math.floor(n/65536),T=n-s*65536,n=b+s+65535,s=Math.floor(n/65536),b=n-s*65536,n=E+s+65535,s=Math.floor(n/65536),E=n-s*65536,i+=s-1+37*(s-1),s=1,n=i+s+65535,s=Math.floor(n/65536),i=n-s*65536,n=a+s+65535,s=Math.floor(n/65536),a=n-s*65536,n=u+s+65535,s=Math.floor(n/65536),u=n-s*65536,n=c+s+65535,s=Math.floor(n/65536),c=n-s*65536,n=f+s+65535,s=Math.floor(n/65536),f=n-s*65536,n=h+s+65535,s=Math.floor(n/65536),h=n-s*65536,n=m+s+65535,s=Math.floor(n/65536),m=n-s*65536,n=g+s+65535,s=Math.floor(n/65536),g=n-s*65536,n=x+s+65535,s=Math.floor(n/65536),x=n-s*65536,n=v+s+65535,s=Math.floor(n/65536),v=n-s*65536,n=w+s+65535,s=Math.floor(n/65536),w=n-s*65536,n=S+s+65535,s=Math.floor(n/65536),S=n-s*65536,n=A+s+65535,s=Math.floor(n/65536),A=n-s*65536,n=T+s+65535,s=Math.floor(n/65536),T=n-s*65536,n=b+s+65535,s=Math.floor(n/65536),b=n-s*65536,n=E+s+65535,s=Math.floor(n/65536),E=n-s*65536,i+=s-1+37*(s-1),r[0]=i,r[1]=a,r[2]=u,r[3]=c,r[4]=f,r[5]=h,r[6]=m,r[7]=g,r[8]=x,r[9]=v,r[10]=w,r[11]=S,r[12]=A,r[13]=T,r[14]=b,r[15]=E}o(Ir,"M")});var Uk=Z((Ude,Vk)=>{"use strict";var si=$t();lr();bi();Z0();Vk.exports=si.kem=si.kem||{};var kk=si.jsbn.BigInteger;si.kem.rsa={};si.kem.rsa.create=function(r,e){e=e||{};var t=e.prng||si.random,n={};return n.encrypt=function(s,i){var a=Math.ceil(s.n.bitLength()/8),u;do u=new kk(si.util.bytesToHex(t.getBytesSync(a)),16).mod(s.n);while(u.compareTo(kk.ONE)<=0);u=si.util.hexToBytes(u.toString(16));var c=a-u.length;c>0&&(u=si.util.fillString("\0",c)+u);var f=s.encrypt(u,"NONE"),h=r.generate(u,i);return{encapsulation:f,key:h}},n.decrypt=function(s,i,a){var u=s.decrypt(i,"NONE");return r.generate(u,a)},n};si.kem.kdf1=function(r,e){Lk(this,r,0,e||r.digestLength)};si.kem.kdf2=function(r,e){Lk(this,r,1,e||r.digestLength)};function Lk(r,e,t,n){r.generate=function(s,i){for(var a=new si.util.ByteBuffer,u=Math.ceil(i/n)+t,c=new si.util.ByteBuffer,f=t;f<u;++f){c.putInt32(f),e.start(),e.update(s+c.getBytes());var h=e.digest();a.putBytes(h.getBytes(n))}return a.truncate(a.length()-i),a.getBytes()}}o(Lk,"_createKDF")});var qk=Z((Mde,Fk)=>{"use strict";var rr=$t();lr();Fk.exports=rr.log=rr.log||{};rr.log.levels=["none","error","warning","info","debug","verbose","max"];var Mw={},UN=[],ag=null;rr.log.LEVEL_LOCKED=2;rr.log.NO_LEVEL_CHECK=4;rr.log.INTERPOLATE=8;for(La=0;La<rr.log.levels.length;++La)LN=rr.log.levels[La],Mw[LN]={index:La,name:LN.toUpperCase()};var LN,La;rr.log.logMessage=function(r){for(var e=Mw[r.level].index,t=0;t<UN.length;++t){var n=UN[t];if(n.flags&rr.log.NO_LEVEL_CHECK)n.f(r);else{var s=Mw[n.level].index;e<=s&&n.f(n,r)}}};rr.log.prepareStandard=function(r){"standard"in r||(r.standard=Mw[r.level].name+" ["+r.category+"] "+r.message)};rr.log.prepareFull=function(r){if(!("full"in r)){var e=[r.message];e=e.concat([]),r.full=rr.util.format.apply(this,e)}};rr.log.prepareStandardFull=function(r){"standardFull"in r||(rr.log.prepareStandard(r),r.standardFull=r.standard)};for(VN=["error","warning","info","debug","verbose"],La=0;La<VN.length;++La)(function(e){rr.log[e]=function(t,n){var s=Array.prototype.slice.call(arguments).slice(2),i={timestamp:new Date,level:e,category:t,message:n,arguments:s};rr.log.logMessage(i)}})(VN[La]);var VN,La;rr.log.makeLogger=function(r){var e={flags:0,f:r};return rr.log.setLevel(e,"none"),e};rr.log.setLevel=function(r,e){var t=!1;if(r&&!(r.flags&rr.log.LEVEL_LOCKED))for(var n=0;n<rr.log.levels.length;++n){var s=rr.log.levels[n];if(e==s){r.level=e,t=!0;break}}return t};rr.log.lock=function(r,e){typeof e>"u"||e?r.flags|=rr.log.LEVEL_LOCKED:r.flags&=~rr.log.LEVEL_LOCKED};rr.log.addLogger=function(r){UN.push(r)};typeof console<"u"&&"log"in console?(console.error&&console.warn&&console.info&&console.debug?(jk={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},og=o(function(r,e){rr.log.prepareStandard(e);var t=jk[e.level],n=[e.standard];n=n.concat(e.arguments.slice()),t.apply(console,n)},"f"),vp=rr.log.makeLogger(og)):(og=o(function(e,t){rr.log.prepareStandardFull(t),console.log(t.standardFull)},"f"),vp=rr.log.makeLogger(og)),rr.log.setLevel(vp,"debug"),rr.log.addLogger(vp),ag=vp):console={log:o(function(){},"log")};var vp,jk,og;ag!==null&&typeof window<"u"&&window.location&&(ig=new URL(window.location.href).searchParams,ig.has("console.level")&&rr.log.setLevel(ag,ig.get("console.level").slice(-1)[0]),ig.has("console.lock")&&(Mk=ig.get("console.lock").slice(-1)[0],Mk=="true"&&rr.log.lock(ag)));var ig,Mk;rr.log.consoleLogger=ag});var Kk=Z((qde,Hk)=>{"use strict";Hk.exports=Ia();xw();lp();Y2();NN()});var Xk=Z((Hde,Gk)=>{"use strict";var ze=$t();Ru();ea();Y0();Pu();_l();fN();bi();lr();Pw();var te=ze.asn1,xs=Gk.exports=ze.pkcs7=ze.pkcs7||{};xs.messageFromPem=function(r){var e=ze.pem.decode(r)[0];if(e.type!=="PKCS7"){var t=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw t.headerType=e.type,t}if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var n=te.fromDer(e.body);return xs.messageFromAsn1(n)};xs.messageToPem=function(r,e){var t={type:"PKCS7",body:te.toDer(r.toAsn1()).getBytes()};return ze.pem.encode(t,{maxline:e})};xs.messageFromAsn1=function(r){var e={},t=[];if(!te.validate(r,xs.asn1.contentInfoValidator,e,t)){var n=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw n.errors=t,n}var s=te.derToOid(e.contentType),i;switch(s){case ze.pki.oids.envelopedData:i=xs.createEnvelopedData();break;case ze.pki.oids.encryptedData:i=xs.createEncryptedData();break;case ze.pki.oids.signedData:i=xs.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+s+" is not (yet) supported.")}return i.fromAsn1(e.content.value[0]),i};xs.createSignedData=function(){var r=null;return r={type:ze.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:o(function(n){if(MN(r,n,xs.asn1.signedDataValidator),r.certificates=[],r.crls=[],r.digestAlgorithmIdentifiers=[],r.contentInfo=null,r.signerInfos=[],r.rawCapture.certificates)for(var s=r.rawCapture.certificates.value,i=0;i<s.length;++i)r.certificates.push(ze.pki.certificateFromAsn1(s[i]))},"fromAsn1"),toAsn1:o(function(){r.contentInfo||r.sign();for(var n=[],s=0;s<r.certificates.length;++s)n.push(ze.pki.certificateToAsn1(r.certificates[s]));var i=[],a=te.create(te.Class.CONTEXT_SPECIFIC,0,!0,[te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.INTEGER,!1,te.integerToDer(r.version).getBytes()),te.create(te.Class.UNIVERSAL,te.Type.SET,!0,r.digestAlgorithmIdentifiers),r.contentInfo])]);return n.length>0&&a.value[0].value.push(te.create(te.Class.CONTEXT_SPECIFIC,0,!0,n)),i.length>0&&a.value[0].value.push(te.create(te.Class.CONTEXT_SPECIFIC,1,!0,i)),a.value[0].value.push(te.create(te.Class.UNIVERSAL,te.Type.SET,!0,r.signerInfos)),te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.OID,!1,te.oidToDer(r.type).getBytes()),a])},"toAsn1"),addSigner:o(function(n){var s=n.issuer,i=n.serialNumber;if(n.certificate){var a=n.certificate;typeof a=="string"&&(a=ze.pki.certificateFromPem(a)),s=a.issuer.attributes,i=a.serialNumber}var u=n.key;if(!u)throw new Error("Could not add PKCS#7 signer; no private key specified.");typeof u=="string"&&(u=ze.pki.privateKeyFromPem(u));var c=n.digestAlgorithm||ze.pki.oids.sha1;switch(c){case ze.pki.oids.sha1:case ze.pki.oids.sha256:case ze.pki.oids.sha384:case ze.pki.oids.sha512:case ze.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+c)}var f=n.authenticatedAttributes||[];if(f.length>0){for(var h=!1,m=!1,g=0;g<f.length;++g){var x=f[g];if(!h&&x.type===ze.pki.oids.contentType){if(h=!0,m)break;continue}if(!m&&x.type===ze.pki.oids.messageDigest){if(m=!0,h)break;continue}}if(!h||!m)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.")}r.signers.push({key:u,version:1,issuer:s,serialNumber:i,digestAlgorithm:c,signatureAlgorithm:ze.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:f,unauthenticatedAttributes:[]})},"addSigner"),sign:o(function(n){if(n=n||{},(typeof r.content!="object"||r.contentInfo===null)&&(r.contentInfo=te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.OID,!1,te.oidToDer(ze.pki.oids.data).getBytes())]),"content"in r)){var s;r.content instanceof ze.util.ByteBuffer?s=r.content.bytes():typeof r.content=="string"&&(s=ze.util.encodeUtf8(r.content)),n.detached?r.detachedContent=te.create(te.Class.UNIVERSAL,te.Type.OCTETSTRING,!1,s):r.contentInfo.value.push(te.create(te.Class.CONTEXT_SPECIFIC,0,!0,[te.create(te.Class.UNIVERSAL,te.Type.OCTETSTRING,!1,s)]))}if(r.signers.length!==0){var i=e();t(i)}},"sign"),verify:o(function(){throw new Error("PKCS#7 signature verification not yet implemented.")},"verify"),addCertificate:o(function(n){typeof n=="string"&&(n=ze.pki.certificateFromPem(n)),r.certificates.push(n)},"addCertificate"),addCertificateRevokationList:o(function(n){throw new Error("PKCS#7 CRL support not yet implemented.")},"addCertificateRevokationList")},r;function e(){for(var n={},s=0;s<r.signers.length;++s){var i=r.signers[s],a=i.digestAlgorithm;a in n||(n[a]=ze.md[ze.pki.oids[a]].create()),i.authenticatedAttributes.length===0?i.md=n[a]:i.md=ze.md[ze.pki.oids[a]].create()}r.digestAlgorithmIdentifiers=[];for(var a in n)r.digestAlgorithmIdentifiers.push(te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.OID,!1,te.oidToDer(a).getBytes()),te.create(te.Class.UNIVERSAL,te.Type.NULL,!1,"")]));return n}o(e,"addDigestAlgorithmIds");function t(n){var s;if(r.detachedContent?s=r.detachedContent:(s=r.contentInfo.value[1],s=s.value[0]),!s)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var i=te.derToOid(r.contentInfo.value[0].value),a=te.toDer(s);a.getByte(),te.getBerValueLength(a),a=a.getBytes();for(var u in n)n[u].start().update(a);for(var c=new Date,f=0;f<r.signers.length;++f){var h=r.signers[f];if(h.authenticatedAttributes.length===0){if(i!==ze.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{h.authenticatedAttributesAsn1=te.create(te.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var m=te.create(te.Class.UNIVERSAL,te.Type.SET,!0,[]),g=0;g<h.authenticatedAttributes.length;++g){var x=h.authenticatedAttributes[g];x.type===ze.pki.oids.messageDigest?x.value=n[h.digestAlgorithm].digest():x.type===ze.pki.oids.signingTime&&(x.value||(x.value=c)),m.value.push(jN(x)),h.authenticatedAttributesAsn1.value.push(jN(x))}a=te.toDer(m).getBytes(),h.md.start().update(a)}h.signature=h.key.sign(h.md,"RSASSA-PKCS1-V1_5")}r.signerInfos=nZ(r.signers)}o(t,"addSignerInfos")};xs.createEncryptedData=function(){var r=null;return r={type:ze.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:ze.pki.oids["aes256-CBC"]},fromAsn1:o(function(e){MN(r,e,xs.asn1.encryptedDataValidator)},"fromAsn1"),decrypt:o(function(e){e!==void 0&&(r.encryptedContent.key=e),$k(r)},"decrypt")},r};xs.createEnvelopedData=function(){var r=null;return r={type:ze.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:ze.pki.oids["aes256-CBC"]},fromAsn1:o(function(e){var t=MN(r,e,xs.asn1.envelopedDataValidator);r.recipients=eZ(t.recipientInfos.value)},"fromAsn1"),toAsn1:o(function(){return te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.OID,!1,te.oidToDer(r.type).getBytes()),te.create(te.Class.CONTEXT_SPECIFIC,0,!0,[te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.INTEGER,!1,te.integerToDer(r.version).getBytes()),te.create(te.Class.UNIVERSAL,te.Type.SET,!0,tZ(r.recipients)),te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,sZ(r.encryptedContent))])])])},"toAsn1"),findRecipient:o(function(e){for(var t=e.issuer.attributes,n=0;n<r.recipients.length;++n){var s=r.recipients[n],i=s.issuer;if(s.serialNumber===e.serialNumber&&i.length===t.length){for(var a=!0,u=0;u<t.length;++u)if(i[u].type!==t[u].type||i[u].value!==t[u].value){a=!1;break}if(a)return s}}return null},"findRecipient"),decrypt:o(function(e,t){if(r.encryptedContent.key===void 0&&e!==void 0&&t!==void 0)switch(e.encryptedContent.algorithm){case ze.pki.oids.rsaEncryption:case ze.pki.oids.desCBC:var n=t.decrypt(e.encryptedContent.content);r.encryptedContent.key=ze.util.createBuffer(n);break;default:throw new Error("Unsupported asymmetric cipher, OID "+e.encryptedContent.algorithm)}$k(r)},"decrypt"),addRecipient:o(function(e){r.recipients.push({version:0,issuer:e.issuer.attributes,serialNumber:e.serialNumber,encryptedContent:{algorithm:ze.pki.oids.rsaEncryption,key:e.publicKey}})},"addRecipient"),encrypt:o(function(e,t){if(r.encryptedContent.content===void 0){t=t||r.encryptedContent.algorithm,e=e||r.encryptedContent.key;var n,s,i;switch(t){case ze.pki.oids["aes128-CBC"]:n=16,s=16,i=ze.aes.createEncryptionCipher;break;case ze.pki.oids["aes192-CBC"]:n=24,s=16,i=ze.aes.createEncryptionCipher;break;case ze.pki.oids["aes256-CBC"]:n=32,s=16,i=ze.aes.createEncryptionCipher;break;case ze.pki.oids["des-EDE3-CBC"]:n=24,s=8,i=ze.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+t)}if(e===void 0)e=ze.util.createBuffer(ze.random.getBytes(n));else if(e.length()!=n)throw new Error("Symmetric key has wrong length; got "+e.length()+" bytes, expected "+n+".");r.encryptedContent.algorithm=t,r.encryptedContent.key=e,r.encryptedContent.parameter=ze.util.createBuffer(ze.random.getBytes(s));var a=i(e);if(a.start(r.encryptedContent.parameter.copy()),a.update(r.content),!a.finish())throw new Error("Symmetric encryption failed.");r.encryptedContent.content=a.output}for(var u=0;u<r.recipients.length;++u){var c=r.recipients[u];if(c.encryptedContent.content===void 0)switch(c.encryptedContent.algorithm){case ze.pki.oids.rsaEncryption:c.encryptedContent.content=c.encryptedContent.key.encrypt(r.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+c.encryptedContent.algorithm)}}},"encrypt")},r};function QQ(r){var e={},t=[];if(!te.validate(r,xs.asn1.recipientInfoValidator,e,t)){var n=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw n.errors=t,n}return{version:e.version.charCodeAt(0),issuer:ze.pki.RDNAttributesAsArray(e.issuer),serialNumber:ze.util.createBuffer(e.serial).toHex(),encryptedContent:{algorithm:te.derToOid(e.encAlgorithm),parameter:e.encParameter?e.encParameter.value:void 0,content:e.encKey}}}o(QQ,"_recipientFromAsn1");function ZQ(r){return te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.INTEGER,!1,te.integerToDer(r.version).getBytes()),te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[ze.pki.distinguishedNameToAsn1({attributes:r.issuer}),te.create(te.Class.UNIVERSAL,te.Type.INTEGER,!1,ze.util.hexToBytes(r.serialNumber))]),te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.OID,!1,te.oidToDer(r.encryptedContent.algorithm).getBytes()),te.create(te.Class.UNIVERSAL,te.Type.NULL,!1,"")]),te.create(te.Class.UNIVERSAL,te.Type.OCTETSTRING,!1,r.encryptedContent.content)])}o(ZQ,"_recipientToAsn1");function eZ(r){for(var e=[],t=0;t<r.length;++t)e.push(QQ(r[t]));return e}o(eZ,"_recipientsFromAsn1");function tZ(r){for(var e=[],t=0;t<r.length;++t)e.push(ZQ(r[t]));return e}o(tZ,"_recipientsToAsn1");function rZ(r){var e=te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.INTEGER,!1,te.integerToDer(r.version).getBytes()),te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[ze.pki.distinguishedNameToAsn1({attributes:r.issuer}),te.create(te.Class.UNIVERSAL,te.Type.INTEGER,!1,ze.util.hexToBytes(r.serialNumber))]),te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.OID,!1,te.oidToDer(r.digestAlgorithm).getBytes()),te.create(te.Class.UNIVERSAL,te.Type.NULL,!1,"")])]);if(r.authenticatedAttributesAsn1&&e.value.push(r.authenticatedAttributesAsn1),e.value.push(te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.OID,!1,te.oidToDer(r.signatureAlgorithm).getBytes()),te.create(te.Class.UNIVERSAL,te.Type.NULL,!1,"")])),e.value.push(te.create(te.Class.UNIVERSAL,te.Type.OCTETSTRING,!1,r.signature)),r.unauthenticatedAttributes.length>0){for(var t=te.create(te.Class.CONTEXT_SPECIFIC,1,!0,[]),n=0;n<r.unauthenticatedAttributes.length;++n){var s=r.unauthenticatedAttributes[n];t.values.push(jN(s))}e.value.push(t)}return e}o(rZ,"_signerToAsn1");function nZ(r){for(var e=[],t=0;t<r.length;++t)e.push(rZ(r[t]));return e}o(nZ,"_signersToAsn1");function jN(r){var e;if(r.type===ze.pki.oids.contentType)e=te.create(te.Class.UNIVERSAL,te.Type.OID,!1,te.oidToDer(r.value).getBytes());else if(r.type===ze.pki.oids.messageDigest)e=te.create(te.Class.UNIVERSAL,te.Type.OCTETSTRING,!1,r.value.bytes());else if(r.type===ze.pki.oids.signingTime){var t=new Date("1950-01-01T00:00:00Z"),n=new Date("2050-01-01T00:00:00Z"),s=r.value;if(typeof s=="string"){var i=Date.parse(s);isNaN(i)?s.length===13?s=te.utcTimeToDate(s):s=te.generalizedTimeToDate(s):s=new Date(i)}s>=t&&s<n?e=te.create(te.Class.UNIVERSAL,te.Type.UTCTIME,!1,te.dateToUtcTime(s)):e=te.create(te.Class.UNIVERSAL,te.Type.GENERALIZEDTIME,!1,te.dateToGeneralizedTime(s))}return te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.OID,!1,te.oidToDer(r.type).getBytes()),te.create(te.Class.UNIVERSAL,te.Type.SET,!0,[e])])}o(jN,"_attributeToAsn1");function sZ(r){return[te.create(te.Class.UNIVERSAL,te.Type.OID,!1,te.oidToDer(ze.pki.oids.data).getBytes()),te.create(te.Class.UNIVERSAL,te.Type.SEQUENCE,!0,[te.create(te.Class.UNIVERSAL,te.Type.OID,!1,te.oidToDer(r.algorithm).getBytes()),r.parameter?te.create(te.Class.UNIVERSAL,te.Type.OCTETSTRING,!1,r.parameter.getBytes()):void 0]),te.create(te.Class.CONTEXT_SPECIFIC,0,!0,[te.create(te.Class.UNIVERSAL,te.Type.OCTETSTRING,!1,r.content.getBytes())])]}o(sZ,"_encryptedContentToAsn1");function MN(r,e,t){var n={},s=[];if(!te.validate(e,t,n,s)){var i=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw i.errors=i,i}var a=te.derToOid(n.contentType);if(a!==ze.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(n.encryptedContent){var u="";if(ze.util.isArray(n.encryptedContent))for(var c=0;c<n.encryptedContent.length;++c){if(n.encryptedContent[c].type!==te.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");u+=n.encryptedContent[c].value}else u=n.encryptedContent;r.encryptedContent={algorithm:te.derToOid(n.encAlgorithm),parameter:ze.util.createBuffer(n.encParameter.value),content:ze.util.createBuffer(u)}}if(n.content){var u="";if(ze.util.isArray(n.content))for(var c=0;c<n.content.length;++c){if(n.content[c].type!==te.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");u+=n.content[c].value}else u=n.content;r.content=ze.util.createBuffer(u)}return r.version=n.version.charCodeAt(0),r.rawCapture=n,n}o(MN,"_fromAsn1");function $k(r){if(r.encryptedContent.key===void 0)throw new Error("Symmetric key not available.");if(r.content===void 0){var e;switch(r.encryptedContent.algorithm){case ze.pki.oids["aes128-CBC"]:case ze.pki.oids["aes192-CBC"]:case ze.pki.oids["aes256-CBC"]:e=ze.aes.createDecryptionCipher(r.encryptedContent.key);break;case ze.pki.oids.desCBC:case ze.pki.oids["des-EDE3-CBC"]:e=ze.des.createDecryptionCipher(r.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+r.encryptedContent.algorithm)}if(e.start(r.encryptedContent.parameter),e.update(r.encryptedContent.content),!e.finish())throw new Error("Symmetric decryption failed.");r.content=e.output}}o($k,"_decryptContent")});var zk=Z(($de,Wk)=>{"use strict";var dn=$t();Ru();ap();xw();lp();lr();var qw=Wk.exports=dn.ssh=dn.ssh||{};qw.privateKeyToPutty=function(r,e,t){t=t||"",e=e||"";var n="ssh-rsa",s=e===""?"none":"aes256-cbc",i="PuTTY-User-Key-File-2: "+n+`\r
16
16
  `;i+="Encryption: "+s+`\r
17
17
  `,i+="Comment: "+t+`\r
18
18
  `;var a=dn.util.createBuffer();yp(a,n),Va(a,r.e),Va(a,r.n);var u=dn.util.encode64(a.bytes(),64),c=Math.floor(u.length/66)+1;i+="Public-Lines: "+c+`\r
@@ -20,7 +20,7 @@ import{a as o,b as Xe,d as Z,f as Zx}from"./chunk-W6MRGYXP.mjs";var $t=Z((Ppe,LO
20
20
  Private-Lines: `+c+`\r
21
21
  `,i+=h;var S=Fw("putty-private-key-file-mac-key",e),A=dn.util.createBuffer();yp(A,n),yp(A,s),yp(A,t),A.putInt32(a.length()),A.putBuffer(a),A.putInt32(f.length()),A.putBuffer(f);var T=dn.hmac.create();return T.start("sha1",S),T.update(A.bytes()),i+=`\r
22
22
  Private-MAC: `+T.digest().toHex()+`\r
23
- `,i};qw.publicKeyToOpenSSH=function(r,e){var t="ssh-rsa";e=e||"";var n=dn.util.createBuffer();return yp(n,t),Va(n,r.e),Va(n,r.n),t+" "+dn.util.encode64(n.bytes())+" "+e};qw.privateKeyToOpenSSH=function(r,e){return e?dn.pki.encryptRsaPrivateKey(r,e,{legacy:!0,algorithm:"aes128"}):dn.pki.privateKeyToPem(r)};qw.getPublicKeyFingerprint=function(r,e){e=e||{};var t=e.md||dn.md.md5.create(),n="ssh-rsa",s=dn.util.createBuffer();yp(s,n),Va(s,r.e),Va(s,r.n),t.start(),t.update(s.getBytes());var i=t.digest();if(e.encoding==="hex"){var a=i.toHex();return e.delimiter?a.match(/.{2}/g).join(e.delimiter):a}else{if(e.encoding==="binary")return i.getBytes();if(e.encoding)throw new Error('Unknown encoding "'+e.encoding+'".')}return i};function Va(r,e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var n=dn.util.hexToBytes(t);r.putInt32(n.length),r.putBytes(n)}o(Va,"_addBigIntegerToBuffer");function yp(r,e){r.putInt32(e.length),r.putString(e)}o(yp,"_addStringToBuffer");function Fw(){for(var r=dn.md.sha1.create(),e=arguments.length,t=0;t<e;++t)r.update(arguments[t]);return r.digest()}o(Fw,"_sha1")});var Yk=Z((Yde,Jk)=>{"use strict";Jk.exports=$t();Pu();gk();ea();hw();Y0();Ok();ap();Uk();qk();Kk();hN();Ew();_l();aN();mN();Xk();vN();uN();Q2();Bw();bi();tN();zk();EN();lr()});var Zk=Z((Qde,Qk)=>{"use strict";var xp=1e3,wp=xp*60,Sp=wp*60,Vl=Sp*24,aZ=Vl*7,oZ=Vl*365.25;Qk.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return uZ(r);if(t==="number"&&isFinite(r))return e.long?lZ(r):cZ(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function uZ(r){if(r=String(r),!(r.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(e){var t=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*oZ;case"weeks":case"week":case"w":return t*aZ;case"days":case"day":case"d":return t*Vl;case"hours":case"hour":case"hrs":case"hr":case"h":return t*Sp;case"minutes":case"minute":case"mins":case"min":case"m":return t*wp;case"seconds":case"second":case"secs":case"sec":case"s":return t*xp;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}o(uZ,"parse");function cZ(r){var e=Math.abs(r);return e>=Vl?Math.round(r/Vl)+"d":e>=Sp?Math.round(r/Sp)+"h":e>=wp?Math.round(r/wp)+"m":e>=xp?Math.round(r/xp)+"s":r+"ms"}o(cZ,"fmtShort");function lZ(r){var e=Math.abs(r);return e>=Vl?Hw(r,e,Vl,"day"):e>=Sp?Hw(r,e,Sp,"hour"):e>=wp?Hw(r,e,wp,"minute"):e>=xp?Hw(r,e,xp,"second"):r+" ms"}o(lZ,"fmtLong");function Hw(r,e,t,n){var s=e>=t*1.5;return Math.round(r/t)+" "+n+(s?"s":"")}o(Hw,"plural")});var FN=Z((eme,e4)=>{"use strict";function fZ(r){t.debug=t,t.default=t,t.coerce=c,t.disable=a,t.enable=s,t.enabled=u,t.humanize=Zk(),t.destroy=f,Object.keys(r).forEach(h=>{t[h]=r[h]}),t.names=[],t.skips=[],t.formatters={};function e(h){let m=0;for(let g=0;g<h.length;g++)m=(m<<5)-m+h.charCodeAt(g),m|=0;return t.colors[Math.abs(m)%t.colors.length]}o(e,"selectColor"),t.selectColor=e;function t(h){let m,g=null,x,v;function w(...S){if(!w.enabled)return;let A=w,T=Number(new Date),b=T-(m||T);A.diff=b,A.prev=m,A.curr=T,m=T,S[0]=t.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");let E=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,(_,F)=>{if(_==="%%")return"%";E++;let R=t.formatters[F];if(typeof R=="function"){let q=S[E];_=R.call(A,q),S.splice(E,1),E--}return _}),t.formatArgs.call(A,S),(A.log||t.log).apply(A,S)}return o(w,"debug"),w.namespace=h,w.useColors=t.useColors(),w.color=t.selectColor(h),w.extend=n,w.destroy=t.destroy,Object.defineProperty(w,"enabled",{enumerable:!0,configurable:!1,get:o(()=>g!==null?g:(x!==t.namespaces&&(x=t.namespaces,v=t.enabled(h)),v),"get"),set:o(S=>{g=S},"set")}),typeof t.init=="function"&&t.init(w),w}o(t,"createDebug");function n(h,m){let g=t(this.namespace+(typeof m>"u"?":":m)+h);return g.log=this.log,g}o(n,"extend");function s(h){t.save(h),t.namespaces=h,t.names=[],t.skips=[];let m=(typeof h=="string"?h:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let g of m)g[0]==="-"?t.skips.push(g.slice(1)):t.names.push(g)}o(s,"enable");function i(h,m){let g=0,x=0,v=-1,w=0;for(;g<h.length;)if(x<m.length&&(m[x]===h[g]||m[x]==="*"))m[x]==="*"?(v=x,w=g,x++):(g++,x++);else if(v!==-1)x=v+1,w++,g=w;else return!1;for(;x<m.length&&m[x]==="*";)x++;return x===m.length}o(i,"matchesTemplate");function a(){let h=[...t.names,...t.skips.map(m=>"-"+m)].join(",");return t.enable(""),h}o(a,"disable");function u(h){for(let m of t.skips)if(i(h,m))return!1;for(let m of t.names)if(i(h,m))return!0;return!1}o(u,"enabled");function c(h){return h instanceof Error?h.stack||h.message:h}o(c,"coerce");function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return o(f,"destroy"),t.enable(t.load()),t}o(fZ,"setup");e4.exports=fZ});var t4=Z((Ds,Kw)=>{"use strict";Ds.formatArgs=pZ;Ds.save=dZ;Ds.load=mZ;Ds.useColors=hZ;Ds.storage=gZ();Ds.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Ds.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function hZ(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let r;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(r=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(r[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}o(hZ,"useColors");function pZ(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+Kw.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let t=0,n=0;r[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(t++,s==="%c"&&(n=t))}),r.splice(n,0,e)}o(pZ,"formatArgs");Ds.log=console.debug||console.log||(()=>{});function dZ(r){try{r?Ds.storage.setItem("debug",r):Ds.storage.removeItem("debug")}catch{}}o(dZ,"save");function mZ(){let r;try{r=Ds.storage.getItem("debug")||Ds.storage.getItem("DEBUG")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}o(mZ,"load");function gZ(){try{return localStorage}catch{}}o(gZ,"localstorage");Kw.exports=FN()(Ds);var{formatters:vZ}=Kw.exports;vZ.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var n4=Z((nme,r4)=>{"use strict";r4.exports=(r,e=process.argv)=>{let t=r.startsWith("-")?"":r.length===1?"-":"--",n=e.indexOf(t+r),s=e.indexOf("--");return n!==-1&&(s===-1||n<s)}});var a4=Z((sme,i4)=>{"use strict";var yZ=Xe("os"),s4=Xe("tty"),Ii=n4(),{env:Dn}=process,qu;Ii("no-color")||Ii("no-colors")||Ii("color=false")||Ii("color=never")?qu=0:(Ii("color")||Ii("colors")||Ii("color=true")||Ii("color=always"))&&(qu=1);"FORCE_COLOR"in Dn&&(Dn.FORCE_COLOR==="true"?qu=1:Dn.FORCE_COLOR==="false"?qu=0:qu=Dn.FORCE_COLOR.length===0?1:Math.min(parseInt(Dn.FORCE_COLOR,10),3));function qN(r){return r===0?!1:{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}o(qN,"translateLevel");function HN(r,e){if(qu===0)return 0;if(Ii("color=16m")||Ii("color=full")||Ii("color=truecolor"))return 3;if(Ii("color=256"))return 2;if(r&&!e&&qu===void 0)return 0;let t=qu||0;if(Dn.TERM==="dumb")return t;if(process.platform==="win32"){let n=yZ.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in Dn)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in Dn)||Dn.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in Dn)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Dn.TEAMCITY_VERSION)?1:0;if(Dn.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Dn){let n=parseInt((Dn.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Dn.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Dn.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Dn.TERM)||"COLORTERM"in Dn?1:t}o(HN,"supportsColor");function xZ(r){let e=HN(r,r&&r.isTTY);return qN(e)}o(xZ,"getSupportLevel");i4.exports={supportsColor:xZ,stdout:qN(HN(!0,s4.isatty(1))),stderr:qN(HN(!0,s4.isatty(2)))}});var u4=Z((Rn,Gw)=>{"use strict";var wZ=Xe("tty"),$w=Xe("util");Rn.init=TZ;Rn.log=AZ;Rn.formatArgs=bZ;Rn.save=CZ;Rn.load=NZ;Rn.useColors=SZ;Rn.destroy=$w.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");Rn.colors=[6,2,3,4,5,1];try{let r=a4();r&&(r.stderr||r).level>=2&&(Rn.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}Rn.inspectOpts=Object.keys(process.env).filter(r=>/^debug_/i.test(r)).reduce((r,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(s,i)=>i.toUpperCase()),n=process.env[e];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),r[t]=n,r},{});function SZ(){return"colors"in Rn.inspectOpts?!!Rn.inspectOpts.colors:wZ.isatty(process.stderr.fd)}o(SZ,"useColors");function bZ(r){let{namespace:e,useColors:t}=this;if(t){let n=this.color,s="\x1B[3"+(n<8?n:"8;5;"+n),i=` ${s};1m${e} \x1B[0m`;r[0]=i+r[0].split(`
23
+ `,i};qw.publicKeyToOpenSSH=function(r,e){var t="ssh-rsa";e=e||"";var n=dn.util.createBuffer();return yp(n,t),Va(n,r.e),Va(n,r.n),t+" "+dn.util.encode64(n.bytes())+" "+e};qw.privateKeyToOpenSSH=function(r,e){return e?dn.pki.encryptRsaPrivateKey(r,e,{legacy:!0,algorithm:"aes128"}):dn.pki.privateKeyToPem(r)};qw.getPublicKeyFingerprint=function(r,e){e=e||{};var t=e.md||dn.md.md5.create(),n="ssh-rsa",s=dn.util.createBuffer();yp(s,n),Va(s,r.e),Va(s,r.n),t.start(),t.update(s.getBytes());var i=t.digest();if(e.encoding==="hex"){var a=i.toHex();return e.delimiter?a.match(/.{2}/g).join(e.delimiter):a}else{if(e.encoding==="binary")return i.getBytes();if(e.encoding)throw new Error('Unknown encoding "'+e.encoding+'".')}return i};function Va(r,e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var n=dn.util.hexToBytes(t);r.putInt32(n.length),r.putBytes(n)}o(Va,"_addBigIntegerToBuffer");function yp(r,e){r.putInt32(e.length),r.putString(e)}o(yp,"_addStringToBuffer");function Fw(){for(var r=dn.md.sha1.create(),e=arguments.length,t=0;t<e;++t)r.update(arguments[t]);return r.digest()}o(Fw,"_sha1")});var Yk=Z((Xde,Jk)=>{"use strict";Jk.exports=$t();Ru();gk();ea();hw();Y0();Ok();ap();Uk();qk();Kk();hN();Ew();_l();aN();mN();Xk();vN();uN();Q2();Bw();bi();tN();zk();EN();lr()});var Zk=Z((Qde,Qk)=>{"use strict";var xp=1e3,wp=xp*60,Sp=wp*60,Vl=Sp*24,aZ=Vl*7,oZ=Vl*365.25;Qk.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return uZ(r);if(t==="number"&&isFinite(r))return e.long?lZ(r):cZ(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function uZ(r){if(r=String(r),!(r.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(e){var t=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*oZ;case"weeks":case"week":case"w":return t*aZ;case"days":case"day":case"d":return t*Vl;case"hours":case"hour":case"hrs":case"hr":case"h":return t*Sp;case"minutes":case"minute":case"mins":case"min":case"m":return t*wp;case"seconds":case"second":case"secs":case"sec":case"s":return t*xp;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}o(uZ,"parse");function cZ(r){var e=Math.abs(r);return e>=Vl?Math.round(r/Vl)+"d":e>=Sp?Math.round(r/Sp)+"h":e>=wp?Math.round(r/wp)+"m":e>=xp?Math.round(r/xp)+"s":r+"ms"}o(cZ,"fmtShort");function lZ(r){var e=Math.abs(r);return e>=Vl?Hw(r,e,Vl,"day"):e>=Sp?Hw(r,e,Sp,"hour"):e>=wp?Hw(r,e,wp,"minute"):e>=xp?Hw(r,e,xp,"second"):r+" ms"}o(lZ,"fmtLong");function Hw(r,e,t,n){var s=e>=t*1.5;return Math.round(r/t)+" "+n+(s?"s":"")}o(Hw,"plural")});var FN=Z((eme,e4)=>{"use strict";function fZ(r){t.debug=t,t.default=t,t.coerce=c,t.disable=a,t.enable=s,t.enabled=u,t.humanize=Zk(),t.destroy=f,Object.keys(r).forEach(h=>{t[h]=r[h]}),t.names=[],t.skips=[],t.formatters={};function e(h){let m=0;for(let g=0;g<h.length;g++)m=(m<<5)-m+h.charCodeAt(g),m|=0;return t.colors[Math.abs(m)%t.colors.length]}o(e,"selectColor"),t.selectColor=e;function t(h){let m,g=null,x,v;function w(...S){if(!w.enabled)return;let A=w,T=Number(new Date),b=T-(m||T);A.diff=b,A.prev=m,A.curr=T,m=T,S[0]=t.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");let E=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,(_,F)=>{if(_==="%%")return"%";E++;let R=t.formatters[F];if(typeof R=="function"){let q=S[E];_=R.call(A,q),S.splice(E,1),E--}return _}),t.formatArgs.call(A,S),(A.log||t.log).apply(A,S)}return o(w,"debug"),w.namespace=h,w.useColors=t.useColors(),w.color=t.selectColor(h),w.extend=n,w.destroy=t.destroy,Object.defineProperty(w,"enabled",{enumerable:!0,configurable:!1,get:o(()=>g!==null?g:(x!==t.namespaces&&(x=t.namespaces,v=t.enabled(h)),v),"get"),set:o(S=>{g=S},"set")}),typeof t.init=="function"&&t.init(w),w}o(t,"createDebug");function n(h,m){let g=t(this.namespace+(typeof m>"u"?":":m)+h);return g.log=this.log,g}o(n,"extend");function s(h){t.save(h),t.namespaces=h,t.names=[],t.skips=[];let m=(typeof h=="string"?h:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let g of m)g[0]==="-"?t.skips.push(g.slice(1)):t.names.push(g)}o(s,"enable");function i(h,m){let g=0,x=0,v=-1,w=0;for(;g<h.length;)if(x<m.length&&(m[x]===h[g]||m[x]==="*"))m[x]==="*"?(v=x,w=g,x++):(g++,x++);else if(v!==-1)x=v+1,w++,g=w;else return!1;for(;x<m.length&&m[x]==="*";)x++;return x===m.length}o(i,"matchesTemplate");function a(){let h=[...t.names,...t.skips.map(m=>"-"+m)].join(",");return t.enable(""),h}o(a,"disable");function u(h){for(let m of t.skips)if(i(h,m))return!1;for(let m of t.names)if(i(h,m))return!0;return!1}o(u,"enabled");function c(h){return h instanceof Error?h.stack||h.message:h}o(c,"coerce");function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return o(f,"destroy"),t.enable(t.load()),t}o(fZ,"setup");e4.exports=fZ});var t4=Z((Ds,Kw)=>{"use strict";Ds.formatArgs=pZ;Ds.save=dZ;Ds.load=mZ;Ds.useColors=hZ;Ds.storage=gZ();Ds.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Ds.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function hZ(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let r;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(r=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(r[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}o(hZ,"useColors");function pZ(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+Kw.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let t=0,n=0;r[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(t++,s==="%c"&&(n=t))}),r.splice(n,0,e)}o(pZ,"formatArgs");Ds.log=console.debug||console.log||(()=>{});function dZ(r){try{r?Ds.storage.setItem("debug",r):Ds.storage.removeItem("debug")}catch{}}o(dZ,"save");function mZ(){let r;try{r=Ds.storage.getItem("debug")||Ds.storage.getItem("DEBUG")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}o(mZ,"load");function gZ(){try{return localStorage}catch{}}o(gZ,"localstorage");Kw.exports=FN()(Ds);var{formatters:vZ}=Kw.exports;vZ.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var n4=Z((nme,r4)=>{"use strict";r4.exports=(r,e=process.argv)=>{let t=r.startsWith("-")?"":r.length===1?"-":"--",n=e.indexOf(t+r),s=e.indexOf("--");return n!==-1&&(s===-1||n<s)}});var a4=Z((sme,i4)=>{"use strict";var yZ=Xe("os"),s4=Xe("tty"),Ii=n4(),{env:Dn}=process,qu;Ii("no-color")||Ii("no-colors")||Ii("color=false")||Ii("color=never")?qu=0:(Ii("color")||Ii("colors")||Ii("color=true")||Ii("color=always"))&&(qu=1);"FORCE_COLOR"in Dn&&(Dn.FORCE_COLOR==="true"?qu=1:Dn.FORCE_COLOR==="false"?qu=0:qu=Dn.FORCE_COLOR.length===0?1:Math.min(parseInt(Dn.FORCE_COLOR,10),3));function qN(r){return r===0?!1:{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}o(qN,"translateLevel");function HN(r,e){if(qu===0)return 0;if(Ii("color=16m")||Ii("color=full")||Ii("color=truecolor"))return 3;if(Ii("color=256"))return 2;if(r&&!e&&qu===void 0)return 0;let t=qu||0;if(Dn.TERM==="dumb")return t;if(process.platform==="win32"){let n=yZ.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in Dn)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in Dn)||Dn.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in Dn)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Dn.TEAMCITY_VERSION)?1:0;if(Dn.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Dn){let n=parseInt((Dn.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Dn.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Dn.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Dn.TERM)||"COLORTERM"in Dn?1:t}o(HN,"supportsColor");function xZ(r){let e=HN(r,r&&r.isTTY);return qN(e)}o(xZ,"getSupportLevel");i4.exports={supportsColor:xZ,stdout:qN(HN(!0,s4.isatty(1))),stderr:qN(HN(!0,s4.isatty(2)))}});var u4=Z((Rn,Gw)=>{"use strict";var wZ=Xe("tty"),$w=Xe("util");Rn.init=TZ;Rn.log=AZ;Rn.formatArgs=bZ;Rn.save=CZ;Rn.load=NZ;Rn.useColors=SZ;Rn.destroy=$w.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");Rn.colors=[6,2,3,4,5,1];try{let r=a4();r&&(r.stderr||r).level>=2&&(Rn.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}Rn.inspectOpts=Object.keys(process.env).filter(r=>/^debug_/i.test(r)).reduce((r,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(s,i)=>i.toUpperCase()),n=process.env[e];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),r[t]=n,r},{});function SZ(){return"colors"in Rn.inspectOpts?!!Rn.inspectOpts.colors:wZ.isatty(process.stderr.fd)}o(SZ,"useColors");function bZ(r){let{namespace:e,useColors:t}=this;if(t){let n=this.color,s="\x1B[3"+(n<8?n:"8;5;"+n),i=` ${s};1m${e} \x1B[0m`;r[0]=i+r[0].split(`
24
24
  `).join(`
25
25
  `+i),r.push(s+"m+"+Gw.exports.humanize(this.diff)+"\x1B[0m")}else r[0]=EZ()+e+" "+r[0]}o(bZ,"formatArgs");function EZ(){return Rn.inspectOpts.hideDate?"":new Date().toISOString()+" "}o(EZ,"getDate");function AZ(...r){return process.stderr.write($w.formatWithOptions(Rn.inspectOpts,...r)+`
26
26
  `)}o(AZ,"log");function CZ(r){r?process.env.DEBUG=r:delete process.env.DEBUG}o(CZ,"save");function NZ(){return process.env.DEBUG}o(NZ,"load");function TZ(r){r.inspectOpts={};let e=Object.keys(Rn.inspectOpts);for(let t=0;t<e.length;t++)r.inspectOpts[e[t]]=Rn.inspectOpts[e[t]]}o(TZ,"init");Gw.exports=FN()(Rn);var{formatters:o4}=Gw.exports;o4.o=function(r){return this.inspectOpts.colors=this.useColors,$w.inspect(r,this.inspectOpts).split(`
@@ -86,7 +86,7 @@ Actual: `+O.attribValue);else{var Ge=O.tag,Re=O.tags[O.tags.length-1]||O;Ge.ns==
86
86
 
87
87
  \r Response Body: `+m.data))},a,u)):(aU("Reading file: %s",r),Woe.readFile(r,"utf8",(f,h)=>{f?s(f):(c=new sb(h,r,n),i[r]=c,c.WSDL_CACHE=i,c.onReady(s))})),c}o(cU,"open_wsdl")});var fU=Z(lU=>{"use strict";Object.defineProperty(lU,"__esModule",{value:!0})});var mU=Z(Ot=>{"use strict";var hU=Ot&&Ot.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:o(function(){return e[t]},"get")}),Object.defineProperty(r,n,s)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),tue=Ot&&Ot.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),rue=Ot&&Ot.__importStar||(function(){var r=o(function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[n.length]=s);return n},r(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),s=0;s<n.length;s++)n[s]!=="default"&&hU(t,e,n[s]);return tue(t,e),t}})(),nue=Ot&&Ot.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&hU(e,r,t)};Object.defineProperty(Ot,"__esModule",{value:!0});Ot.WSDL=Ot.passwordDigest=Ot.Server=Ot.WSSecurityCertWithToken=Ot.WSSecurityPlusCert=Ot.WSSecurityCert=Ot.WSSecurity=Ot.NTLMSecurity=Ot.ClientSSLSecurityPFX=Ot.ClientSSLSecurity=Ot.BearerSecurity=Ot.BasicAuthSecurity=Ot.HttpClient=Ot.Client=Ot.security=void 0;Ot.createClient=dU;Ot.createClientAsync=mue;Ot.listen=gue;var sue=rI(),iue=rue(VI()),aue=UI(),oue=Zu(),pU=t_();Ot.security=iue;var uue=rI();Object.defineProperty(Ot,"Client",{enumerable:!0,get:o(function(){return uue.Client},"get")});var cue=ES();Object.defineProperty(Ot,"HttpClient",{enumerable:!0,get:o(function(){return cue.HttpClient},"get")});var ko=VI();Object.defineProperty(Ot,"BasicAuthSecurity",{enumerable:!0,get:o(function(){return ko.BasicAuthSecurity},"get")});Object.defineProperty(Ot,"BearerSecurity",{enumerable:!0,get:o(function(){return ko.BearerSecurity},"get")});Object.defineProperty(Ot,"ClientSSLSecurity",{enumerable:!0,get:o(function(){return ko.ClientSSLSecurity},"get")});Object.defineProperty(Ot,"ClientSSLSecurityPFX",{enumerable:!0,get:o(function(){return ko.ClientSSLSecurityPFX},"get")});Object.defineProperty(Ot,"NTLMSecurity",{enumerable:!0,get:o(function(){return ko.NTLMSecurity},"get")});Object.defineProperty(Ot,"WSSecurity",{enumerable:!0,get:o(function(){return ko.WSSecurity},"get")});Object.defineProperty(Ot,"WSSecurityCert",{enumerable:!0,get:o(function(){return ko.WSSecurityCert},"get")});Object.defineProperty(Ot,"WSSecurityPlusCert",{enumerable:!0,get:o(function(){return ko.WSSecurityPlusCert},"get")});Object.defineProperty(Ot,"WSSecurityCertWithToken",{enumerable:!0,get:o(function(){return ko.WSSecurityCertWithToken},"get")});var lue=UI();Object.defineProperty(Ot,"Server",{enumerable:!0,get:o(function(){return lue.Server},"get")});var fue=Zu();Object.defineProperty(Ot,"passwordDigest",{enumerable:!0,get:o(function(){return fue.passwordDigest},"get")});nue(fU(),Ot);var hue=t_();Object.defineProperty(Ot,"WSDL",{enumerable:!0,get:o(function(){return hue.WSDL},"get")});function pue(r,e,t,n){e.has(r)?process.nextTick(()=>{n(null,e.get(r))}):t((s,i)=>{if(s)return n(s);e.set(r,i),n(null,i)})}o(pue,"getFromCache");function due(r,e,t){typeof e=="function"&&(t=e,e={});let n=o(s=>{(0,pU.open_wsdl)(r,e,s)},"openWsdl");if(e.disableCache===!0)n(t);else{let s;e.wsdlCache?s=e.wsdlCache:s=oue.wsdlCacheSingleton,pue(r,s,n,t)}}o(due,"_requestWSDL");function dU(r,e,t,n){let s=n,i,a;typeof e=="function"?(i=e,s=t,a={}):typeof t=="function"&&(a=e,i=t,s=n),s=a.endpoint||s,due(r,a,(u,c)=>{i(u,c&&new sue.Client(c,s,a))})}o(dU,"createClient");function mue(r,e,t){return typeof e>"u"&&(e={}),new Promise((n,s)=>{dU(r,e,(i,a)=>{i&&s(i),n(a)},t)})}o(mue,"createClientAsync");function gue(r,e,t,n,s){let i,a,u="";typeof e=="object"&&!(e instanceof RegExp)?(i=e,a=i.path,t=i.services,n=i.xml,u=i.uri):(a=e,i={path:e,services:t,callback:s});let c=new pU.WSDL(n||t,u,i);return new aue.Server(r,a,t,c,i)}o(gue,"listen")});var ab=Z(n_=>{"use strict";(function(){n_.defaults={"0.1":{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},"0.2":{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:`
88
88
  `},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}).call(n_)});var Ya=Z((NU,uc)=>{"use strict";(function(){var r,e,t,n,s,i,a,u=[].slice,c={}.hasOwnProperty;r=o(function(){var f,h,m,g,x,v;if(v=arguments[0],x=2<=arguments.length?u.call(arguments,1):[],s(Object.assign))Object.assign.apply(null,arguments);else for(f=0,m=x.length;f<m;f++)if(g=x[f],g!=null)for(h in g)c.call(g,h)&&(v[h]=g[h]);return v},"assign"),s=o(function(f){return!!f&&Object.prototype.toString.call(f)==="[object Function]"},"isFunction"),i=o(function(f){var h;return!!f&&((h=typeof f)=="function"||h==="object")},"isObject"),t=o(function(f){return s(Array.isArray)?Array.isArray(f):Object.prototype.toString.call(f)==="[object Array]"},"isArray"),n=o(function(f){var h;if(t(f))return!f.length;for(h in f)if(c.call(f,h))return!1;return!0},"isEmpty"),a=o(function(f){var h,m;return i(f)&&(m=Object.getPrototypeOf(f))&&(h=m.constructor)&&typeof h=="function"&&h instanceof h&&Function.prototype.toString.call(h)===Function.prototype.toString.call(Object)},"isPlainObject"),e=o(function(f){return s(f.valueOf)?f.valueOf():f},"getValue"),uc.exports.assign=r,uc.exports.isFunction=s,uc.exports.isObject=i,uc.exports.isArray=t,uc.exports.isEmpty=n,uc.exports.isPlainObject=a,uc.exports.getValue=e}).call(NU)});var s_=Z((TU,IU)=>{"use strict";(function(){var r;IU.exports=r=(function(){function e(){}return o(e,"XMLDOMImplementation"),e.prototype.hasFeature=function(t,n){return!0},e.prototype.createDocumentType=function(t,n,s){throw new Error("This DOM method is not implemented.")},e.prototype.createDocument=function(t,n,s){throw new Error("This DOM method is not implemented.")},e.prototype.createHTMLDocument=function(t){throw new Error("This DOM method is not implemented.")},e.prototype.getFeature=function(t,n){throw new Error("This DOM method is not implemented.")},e})()}).call(TU)});var DU=Z((_U,BU)=>{"use strict";(function(){var r;BU.exports=r=(function(){function e(){}return o(e,"XMLDOMErrorHandler"),e.prototype.handleError=function(t){throw new Error(t)},e})()}).call(_U)});var OU=Z((RU,PU)=>{"use strict";(function(){var r;PU.exports=r=(function(){function e(t){this.arr=t||[]}return o(e,"XMLDOMStringList"),Object.defineProperty(e.prototype,"length",{get:o(function(){return this.arr.length},"get")}),e.prototype.item=function(t){return this.arr[t]||null},e.prototype.contains=function(t){return this.arr.indexOf(t)!==-1},e})()}).call(RU)});var VU=Z((kU,LU)=>{"use strict";(function(){var r,e,t;e=DU(),t=OU(),LU.exports=r=(function(){function n(){var s;this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new e,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=s=Object.create(this.defaultParams)}return o(n,"XMLDOMConfiguration"),Object.defineProperty(n.prototype,"parameterNames",{get:o(function(){return new t(Object.keys(this.defaultParams))},"get")}),n.prototype.getParameter=function(s){return this.params.hasOwnProperty(s)?this.params[s]:null},n.prototype.canSetParameter=function(s,i){return!0},n.prototype.setParameter=function(s,i){return i!=null?this.params[s]=i:delete this.params[s]},n})()}).call(kU)});var cn=Z((UU,jU)=>{"use strict";(function(){jU.exports={Element:1,Attribute:2,Text:3,CData:4,EntityReference:5,EntityDeclaration:6,ProcessingInstruction:7,Comment:8,Document:9,DocType:10,DocumentFragment:11,NotationDeclaration:12,Declaration:201,Raw:202,AttributeDeclaration:203,ElementDeclaration:204,Dummy:205}}).call(UU)});var i_=Z((MU,FU)=>{"use strict";(function(){var r,e,t;r=cn(),t=ai(),FU.exports=e=(function(){function n(s,i,a){if(this.parent=s,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),i==null)throw new Error("Missing attribute name. "+this.debugInfo(i));this.name=this.stringify.name(i),this.value=this.stringify.attValue(a),this.type=r.Attribute,this.isId=!1,this.schemaTypeInfo=null}return o(n,"XMLAttribute"),Object.defineProperty(n.prototype,"nodeType",{get:o(function(){return this.type},"get")}),Object.defineProperty(n.prototype,"ownerElement",{get:o(function(){return this.parent},"get")}),Object.defineProperty(n.prototype,"textContent",{get:o(function(){return this.value},"get"),set:o(function(s){return this.value=s||""},"set")}),Object.defineProperty(n.prototype,"namespaceURI",{get:o(function(){return""},"get")}),Object.defineProperty(n.prototype,"prefix",{get:o(function(){return""},"get")}),Object.defineProperty(n.prototype,"localName",{get:o(function(){return this.name},"get")}),Object.defineProperty(n.prototype,"specified",{get:o(function(){return!0},"get")}),n.prototype.clone=function(){return Object.create(this)},n.prototype.toString=function(s){return this.options.writer.attribute(this,this.options.writer.filterOptions(s))},n.prototype.debugInfo=function(s){return s=s||this.name,s==null?"parent: <"+this.parent.name+">":"attribute: {"+s+"}, parent: <"+this.parent.name+">"},n.prototype.isEqualNode=function(s){return!(s.namespaceURI!==this.namespaceURI||s.prefix!==this.prefix||s.localName!==this.localName||s.value!==this.value)},n})()}).call(MU)});var ob=Z((qU,HU)=>{"use strict";(function(){var r;HU.exports=r=(function(){function e(t){this.nodes=t}return o(e,"XMLNamedNodeMap"),Object.defineProperty(e.prototype,"length",{get:o(function(){return Object.keys(this.nodes).length||0},"get")}),e.prototype.clone=function(){return this.nodes=null},e.prototype.getNamedItem=function(t){return this.nodes[t]},e.prototype.setNamedItem=function(t){var n;return n=this.nodes[t.nodeName],this.nodes[t.nodeName]=t,n||null},e.prototype.removeNamedItem=function(t){var n;return n=this.nodes[t],delete this.nodes[t],n||null},e.prototype.item=function(t){return this.nodes[Object.keys(this.nodes)[t]]||null},e.prototype.getNamedItemNS=function(t,n){throw new Error("This DOM method is not implemented.")},e.prototype.setNamedItemNS=function(t){throw new Error("This DOM method is not implemented.")},e.prototype.removeNamedItemNS=function(t,n){throw new Error("This DOM method is not implemented.")},e})()}).call(qU)});var ub=Z((KU,$U)=>{"use strict";(function(){var r,e,t,n,s,i,a,u,c,f=o(function(m,g){for(var x in g)h.call(g,x)&&(m[x]=g[x]);function v(){this.constructor=m}return o(v,"ctor"),v.prototype=g.prototype,m.prototype=new v,m.__super__=g.prototype,m},"extend"),h={}.hasOwnProperty;c=Ya(),u=c.isObject,a=c.isFunction,i=c.getValue,s=ai(),r=cn(),e=i_(),n=ob(),$U.exports=t=(function(m){f(g,m);function g(x,v,w){var S,A,T,b;if(g.__super__.constructor.call(this,x),v==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(v),this.type=r.Element,this.attribs={},this.schemaTypeInfo=null,w!=null&&this.attribute(w),x.type===r.Document&&(this.isRoot=!0,this.documentObject=x,x.rootObject=this,x.children)){for(b=x.children,A=0,T=b.length;A<T;A++)if(S=b[A],S.type===r.DocType){S.name=this.name;break}}}return o(g,"XMLElement"),Object.defineProperty(g.prototype,"tagName",{get:o(function(){return this.name},"get")}),Object.defineProperty(g.prototype,"namespaceURI",{get:o(function(){return""},"get")}),Object.defineProperty(g.prototype,"prefix",{get:o(function(){return""},"get")}),Object.defineProperty(g.prototype,"localName",{get:o(function(){return this.name},"get")}),Object.defineProperty(g.prototype,"id",{get:o(function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},"get")}),Object.defineProperty(g.prototype,"className",{get:o(function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},"get")}),Object.defineProperty(g.prototype,"classList",{get:o(function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},"get")}),Object.defineProperty(g.prototype,"attributes",{get:o(function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new n(this.attribs)),this.attributeMap},"get")}),g.prototype.clone=function(){var x,v,w,S;w=Object.create(this),w.isRoot&&(w.documentObject=null),w.attribs={},S=this.attribs;for(v in S)h.call(S,v)&&(x=S[v],w.attribs[v]=x.clone());return w.children=[],this.children.forEach(function(A){var T;return T=A.clone(),T.parent=w,w.children.push(T)}),w},g.prototype.attribute=function(x,v){var w,S;if(x!=null&&(x=i(x)),u(x))for(w in x)h.call(x,w)&&(S=x[w],this.attribute(w,S));else a(v)&&(v=v.apply()),this.options.keepNullAttributes&&v==null?this.attribs[x]=new e(this,x,""):v!=null&&(this.attribs[x]=new e(this,x,v));return this},g.prototype.removeAttribute=function(x){var v,w,S;if(x==null)throw new Error("Missing attribute name. "+this.debugInfo());if(x=i(x),Array.isArray(x))for(w=0,S=x.length;w<S;w++)v=x[w],delete this.attribs[v];else delete this.attribs[x];return this},g.prototype.toString=function(x){return this.options.writer.element(this,this.options.writer.filterOptions(x))},g.prototype.att=function(x,v){return this.attribute(x,v)},g.prototype.a=function(x,v){return this.attribute(x,v)},g.prototype.getAttribute=function(x){return this.attribs.hasOwnProperty(x)?this.attribs[x].value:null},g.prototype.setAttribute=function(x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getAttributeNode=function(x){return this.attribs.hasOwnProperty(x)?this.attribs[x]:null},g.prototype.setAttributeNode=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.removeAttributeNode=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByTagName=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getAttributeNS=function(x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.setAttributeNS=function(x,v,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.removeAttributeNS=function(x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getAttributeNodeNS=function(x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.setAttributeNodeNS=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByTagNameNS=function(x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.hasAttribute=function(x){return this.attribs.hasOwnProperty(x)},g.prototype.hasAttributeNS=function(x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.setIdAttribute=function(x,v){return this.attribs.hasOwnProperty(x)?this.attribs[x].isId:v},g.prototype.setIdAttributeNS=function(x,v,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.setIdAttributeNode=function(x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByTagName=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByTagNameNS=function(x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByClassName=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.isEqualNode=function(x){var v,w,S;if(!g.__super__.isEqualNode.apply(this,arguments).isEqualNode(x)||x.namespaceURI!==this.namespaceURI||x.prefix!==this.prefix||x.localName!==this.localName||x.attribs.length!==this.attribs.length)return!1;for(v=w=0,S=this.attribs.length-1;0<=S?w<=S:w>=S;v=0<=S?++w:--w)if(!this.attribs[v].isEqualNode(x.attribs[v]))return!1;return!0},g})(s)}).call(KU)});var Gg=Z((GU,XU)=>{"use strict";(function(){var r,e,t=o(function(s,i){for(var a in i)n.call(i,a)&&(s[a]=i[a]);function u(){this.constructor=s}return o(u,"ctor"),u.prototype=i.prototype,s.prototype=new u,s.__super__=i.prototype,s},"extend"),n={}.hasOwnProperty;e=ai(),XU.exports=r=(function(s){t(i,s);function i(a){i.__super__.constructor.call(this,a),this.value=""}return o(i,"XMLCharacterData"),Object.defineProperty(i.prototype,"data",{get:o(function(){return this.value},"get"),set:o(function(a){return this.value=a||""},"set")}),Object.defineProperty(i.prototype,"length",{get:o(function(){return this.value.length},"get")}),Object.defineProperty(i.prototype,"textContent",{get:o(function(){return this.value},"get"),set:o(function(a){return this.value=a||""},"set")}),i.prototype.clone=function(){return Object.create(this)},i.prototype.substringData=function(a,u){throw new Error("This DOM method is not implemented."+this.debugInfo())},i.prototype.appendData=function(a){throw new Error("This DOM method is not implemented."+this.debugInfo())},i.prototype.insertData=function(a,u){throw new Error("This DOM method is not implemented."+this.debugInfo())},i.prototype.deleteData=function(a,u){throw new Error("This DOM method is not implemented."+this.debugInfo())},i.prototype.replaceData=function(a,u,c){throw new Error("This DOM method is not implemented."+this.debugInfo())},i.prototype.isEqualNode=function(a){return!(!i.__super__.isEqualNode.apply(this,arguments).isEqualNode(a)||a.data!==this.data)},i})(e)}).call(GU)});var cb=Z((WU,zU)=>{"use strict";(function(){var r,e,t,n=o(function(i,a){for(var u in a)s.call(a,u)&&(i[u]=a[u]);function c(){this.constructor=i}return o(c,"ctor"),c.prototype=a.prototype,i.prototype=new c,i.__super__=a.prototype,i},"extend"),s={}.hasOwnProperty;r=cn(),t=Gg(),zU.exports=e=(function(i){n(a,i);function a(u,c){if(a.__super__.constructor.call(this,u),c==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=r.CData,this.value=this.stringify.cdata(c)}return o(a,"XMLCData"),a.prototype.clone=function(){return Object.create(this)},a.prototype.toString=function(u){return this.options.writer.cdata(this,this.options.writer.filterOptions(u))},a})(t)}).call(WU)});var lb=Z((JU,YU)=>{"use strict";(function(){var r,e,t,n=o(function(i,a){for(var u in a)s.call(a,u)&&(i[u]=a[u]);function c(){this.constructor=i}return o(c,"ctor"),c.prototype=a.prototype,i.prototype=new c,i.__super__=a.prototype,i},"extend"),s={}.hasOwnProperty;r=cn(),e=Gg(),YU.exports=t=(function(i){n(a,i);function a(u,c){if(a.__super__.constructor.call(this,u),c==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=r.Comment,this.value=this.stringify.comment(c)}return o(a,"XMLComment"),a.prototype.clone=function(){return Object.create(this)},a.prototype.toString=function(u){return this.options.writer.comment(this,this.options.writer.filterOptions(u))},a})(e)}).call(JU)});var fb=Z((QU,ZU)=>{"use strict";(function(){var r,e,t,n,s=o(function(a,u){for(var c in u)i.call(u,c)&&(a[c]=u[c]);function f(){this.constructor=a}return o(f,"ctor"),f.prototype=u.prototype,a.prototype=new f,a.__super__=u.prototype,a},"extend"),i={}.hasOwnProperty;n=Ya().isObject,t=ai(),r=cn(),ZU.exports=e=(function(a){s(u,a);function u(c,f,h,m){var g;u.__super__.constructor.call(this,c),n(f)&&(g=f,f=g.version,h=g.encoding,m=g.standalone),f||(f="1.0"),this.type=r.Declaration,this.version=this.stringify.xmlVersion(f),h!=null&&(this.encoding=this.stringify.xmlEncoding(h)),m!=null&&(this.standalone=this.stringify.xmlStandalone(m))}return o(u,"XMLDeclaration"),u.prototype.toString=function(c){return this.options.writer.declaration(this,this.options.writer.filterOptions(c))},u})(t)}).call(QU)});var hb=Z((ej,tj)=>{"use strict";(function(){var r,e,t,n=o(function(i,a){for(var u in a)s.call(a,u)&&(i[u]=a[u]);function c(){this.constructor=i}return o(c,"ctor"),c.prototype=a.prototype,i.prototype=new c,i.__super__=a.prototype,i},"extend"),s={}.hasOwnProperty;t=ai(),r=cn(),tj.exports=e=(function(i){n(a,i);function a(u,c,f,h,m,g){if(a.__super__.constructor.call(this,u),c==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(f==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(c));if(!h)throw new Error("Missing DTD attribute type. "+this.debugInfo(c));if(!m)throw new Error("Missing DTD attribute default. "+this.debugInfo(c));if(m.indexOf("#")!==0&&(m="#"+m),!m.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(c));if(g&&!m.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(c));this.elementName=this.stringify.name(c),this.type=r.AttributeDeclaration,this.attributeName=this.stringify.name(f),this.attributeType=this.stringify.dtdAttType(h),g&&(this.defaultValue=this.stringify.dtdAttDefault(g)),this.defaultValueType=m}return o(a,"XMLDTDAttList"),a.prototype.toString=function(u){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(u))},a})(t)}).call(ej)});var pb=Z((rj,nj)=>{"use strict";(function(){var r,e,t,n,s=o(function(a,u){for(var c in u)i.call(u,c)&&(a[c]=u[c]);function f(){this.constructor=a}return o(f,"ctor"),f.prototype=u.prototype,a.prototype=new f,a.__super__=u.prototype,a},"extend"),i={}.hasOwnProperty;n=Ya().isObject,t=ai(),r=cn(),nj.exports=e=(function(a){s(u,a);function u(c,f,h,m){if(u.__super__.constructor.call(this,c),h==null)throw new Error("Missing DTD entity name. "+this.debugInfo(h));if(m==null)throw new Error("Missing DTD entity value. "+this.debugInfo(h));if(this.pe=!!f,this.name=this.stringify.name(h),this.type=r.EntityDeclaration,!n(m))this.value=this.stringify.dtdEntityValue(m),this.internal=!0;else{if(!m.pubID&&!m.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(h));if(m.pubID&&!m.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(h));if(this.internal=!1,m.pubID!=null&&(this.pubID=this.stringify.dtdPubID(m.pubID)),m.sysID!=null&&(this.sysID=this.stringify.dtdSysID(m.sysID)),m.nData!=null&&(this.nData=this.stringify.dtdNData(m.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(h))}}return o(u,"XMLDTDEntity"),Object.defineProperty(u.prototype,"publicId",{get:o(function(){return this.pubID},"get")}),Object.defineProperty(u.prototype,"systemId",{get:o(function(){return this.sysID},"get")}),Object.defineProperty(u.prototype,"notationName",{get:o(function(){return this.nData||null},"get")}),Object.defineProperty(u.prototype,"inputEncoding",{get:o(function(){return null},"get")}),Object.defineProperty(u.prototype,"xmlEncoding",{get:o(function(){return null},"get")}),Object.defineProperty(u.prototype,"xmlVersion",{get:o(function(){return null},"get")}),u.prototype.toString=function(c){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(c))},u})(t)}).call(rj)});var db=Z((sj,ij)=>{"use strict";(function(){var r,e,t,n=o(function(i,a){for(var u in a)s.call(a,u)&&(i[u]=a[u]);function c(){this.constructor=i}return o(c,"ctor"),c.prototype=a.prototype,i.prototype=new c,i.__super__=a.prototype,i},"extend"),s={}.hasOwnProperty;t=ai(),r=cn(),ij.exports=e=(function(i){n(a,i);function a(u,c,f){if(a.__super__.constructor.call(this,u),c==null)throw new Error("Missing DTD element name. "+this.debugInfo());f||(f="(#PCDATA)"),Array.isArray(f)&&(f="("+f.join(",")+")"),this.name=this.stringify.name(c),this.type=r.ElementDeclaration,this.value=this.stringify.dtdElementValue(f)}return o(a,"XMLDTDElement"),a.prototype.toString=function(u){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(u))},a})(t)}).call(sj)});var mb=Z((aj,oj)=>{"use strict";(function(){var r,e,t,n=o(function(i,a){for(var u in a)s.call(a,u)&&(i[u]=a[u]);function c(){this.constructor=i}return o(c,"ctor"),c.prototype=a.prototype,i.prototype=new c,i.__super__=a.prototype,i},"extend"),s={}.hasOwnProperty;t=ai(),r=cn(),oj.exports=e=(function(i){n(a,i);function a(u,c,f){if(a.__super__.constructor.call(this,u),c==null)throw new Error("Missing DTD notation name. "+this.debugInfo(c));if(!f.pubID&&!f.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(c));this.name=this.stringify.name(c),this.type=r.NotationDeclaration,f.pubID!=null&&(this.pubID=this.stringify.dtdPubID(f.pubID)),f.sysID!=null&&(this.sysID=this.stringify.dtdSysID(f.sysID))}return o(a,"XMLDTDNotation"),Object.defineProperty(a.prototype,"publicId",{get:o(function(){return this.pubID},"get")}),Object.defineProperty(a.prototype,"systemId",{get:o(function(){return this.sysID},"get")}),a.prototype.toString=function(u){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(u))},a})(t)}).call(aj)});var gb=Z((uj,cj)=>{"use strict";(function(){var r,e,t,n,s,i,a,u,c,f=o(function(m,g){for(var x in g)h.call(g,x)&&(m[x]=g[x]);function v(){this.constructor=m}return o(v,"ctor"),v.prototype=g.prototype,m.prototype=new v,m.__super__=g.prototype,m},"extend"),h={}.hasOwnProperty;c=Ya().isObject,u=ai(),r=cn(),e=hb(),n=pb(),t=db(),s=mb(),a=ob(),cj.exports=i=(function(m){f(g,m);function g(x,v,w){var S,A,T,b,E,C;if(g.__super__.constructor.call(this,x),this.type=r.DocType,x.children){for(b=x.children,A=0,T=b.length;A<T;A++)if(S=b[A],S.type===r.Element){this.name=S.name;break}}this.documentObject=x,c(v)&&(E=v,v=E.pubID,w=E.sysID),w==null&&(C=[v,w],w=C[0],v=C[1]),v!=null&&(this.pubID=this.stringify.dtdPubID(v)),w!=null&&(this.sysID=this.stringify.dtdSysID(w))}return o(g,"XMLDocType"),Object.defineProperty(g.prototype,"entities",{get:o(function(){var x,v,w,S,A;for(S={},A=this.children,v=0,w=A.length;v<w;v++)x=A[v],x.type===r.EntityDeclaration&&!x.pe&&(S[x.name]=x);return new a(S)},"get")}),Object.defineProperty(g.prototype,"notations",{get:o(function(){var x,v,w,S,A;for(S={},A=this.children,v=0,w=A.length;v<w;v++)x=A[v],x.type===r.NotationDeclaration&&(S[x.name]=x);return new a(S)},"get")}),Object.defineProperty(g.prototype,"publicId",{get:o(function(){return this.pubID},"get")}),Object.defineProperty(g.prototype,"systemId",{get:o(function(){return this.sysID},"get")}),Object.defineProperty(g.prototype,"internalSubset",{get:o(function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},"get")}),g.prototype.element=function(x,v){var w;return w=new t(this,x,v),this.children.push(w),this},g.prototype.attList=function(x,v,w,S,A){var T;return T=new e(this,x,v,w,S,A),this.children.push(T),this},g.prototype.entity=function(x,v){var w;return w=new n(this,!1,x,v),this.children.push(w),this},g.prototype.pEntity=function(x,v){var w;return w=new n(this,!0,x,v),this.children.push(w),this},g.prototype.notation=function(x,v){var w;return w=new s(this,x,v),this.children.push(w),this},g.prototype.toString=function(x){return this.options.writer.docType(this,this.options.writer.filterOptions(x))},g.prototype.ele=function(x,v){return this.element(x,v)},g.prototype.att=function(x,v,w,S,A){return this.attList(x,v,w,S,A)},g.prototype.ent=function(x,v){return this.entity(x,v)},g.prototype.pent=function(x,v){return this.pEntity(x,v)},g.prototype.not=function(x,v){return this.notation(x,v)},g.prototype.up=function(){return this.root()||this.documentObject},g.prototype.isEqualNode=function(x){return!(!g.__super__.isEqualNode.apply(this,arguments).isEqualNode(x)||x.name!==this.name||x.publicId!==this.publicId||x.systemId!==this.systemId)},g})(u)}).call(uj)});var vb=Z((lj,fj)=>{"use strict";(function(){var r,e,t,n=o(function(i,a){for(var u in a)s.call(a,u)&&(i[u]=a[u]);function c(){this.constructor=i}return o(c,"ctor"),c.prototype=a.prototype,i.prototype=new c,i.__super__=a.prototype,i},"extend"),s={}.hasOwnProperty;r=cn(),e=ai(),fj.exports=t=(function(i){n(a,i);function a(u,c){if(a.__super__.constructor.call(this,u),c==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=r.Raw,this.value=this.stringify.raw(c)}return o(a,"XMLRaw"),a.prototype.clone=function(){return Object.create(this)},a.prototype.toString=function(u){return this.options.writer.raw(this,this.options.writer.filterOptions(u))},a})(e)}).call(lj)});var yb=Z((hj,pj)=>{"use strict";(function(){var r,e,t,n=o(function(i,a){for(var u in a)s.call(a,u)&&(i[u]=a[u]);function c(){this.constructor=i}return o(c,"ctor"),c.prototype=a.prototype,i.prototype=new c,i.__super__=a.prototype,i},"extend"),s={}.hasOwnProperty;r=cn(),e=Gg(),pj.exports=t=(function(i){n(a,i);function a(u,c){if(a.__super__.constructor.call(this,u),c==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=r.Text,this.value=this.stringify.text(c)}return o(a,"XMLText"),Object.defineProperty(a.prototype,"isElementContentWhitespace",{get:o(function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},"get")}),Object.defineProperty(a.prototype,"wholeText",{get:o(function(){var u,c,f;for(f="",c=this.previousSibling;c;)f=c.data+f,c=c.previousSibling;for(f+=this.data,u=this.nextSibling;u;)f=f+u.data,u=u.nextSibling;return f},"get")}),a.prototype.clone=function(){return Object.create(this)},a.prototype.toString=function(u){return this.options.writer.text(this,this.options.writer.filterOptions(u))},a.prototype.splitText=function(u){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.replaceWholeText=function(u){throw new Error("This DOM method is not implemented."+this.debugInfo())},a})(e)}).call(hj)});var xb=Z((dj,mj)=>{"use strict";(function(){var r,e,t,n=o(function(i,a){for(var u in a)s.call(a,u)&&(i[u]=a[u]);function c(){this.constructor=i}return o(c,"ctor"),c.prototype=a.prototype,i.prototype=new c,i.__super__=a.prototype,i},"extend"),s={}.hasOwnProperty;r=cn(),e=Gg(),mj.exports=t=(function(i){n(a,i);function a(u,c,f){if(a.__super__.constructor.call(this,u),c==null)throw new Error("Missing instruction target. "+this.debugInfo());this.type=r.ProcessingInstruction,this.target=this.stringify.insTarget(c),this.name=this.target,f&&(this.value=this.stringify.insValue(f))}return o(a,"XMLProcessingInstruction"),a.prototype.clone=function(){return Object.create(this)},a.prototype.toString=function(u){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(u))},a.prototype.isEqualNode=function(u){return!(!a.__super__.isEqualNode.apply(this,arguments).isEqualNode(u)||u.target!==this.target)},a})(e)}).call(dj)});var a_=Z((gj,vj)=>{"use strict";(function(){var r,e,t,n=o(function(i,a){for(var u in a)s.call(a,u)&&(i[u]=a[u]);function c(){this.constructor=i}return o(c,"ctor"),c.prototype=a.prototype,i.prototype=new c,i.__super__=a.prototype,i},"extend"),s={}.hasOwnProperty;t=ai(),r=cn(),vj.exports=e=(function(i){n(a,i);function a(u){a.__super__.constructor.call(this,u),this.type=r.Dummy}return o(a,"XMLDummy"),a.prototype.clone=function(){return Object.create(this)},a.prototype.toString=function(u){return""},a})(t)}).call(gj)});var wj=Z((yj,xj)=>{"use strict";(function(){var r;xj.exports=r=(function(){function e(t){this.nodes=t}return o(e,"XMLNodeList"),Object.defineProperty(e.prototype,"length",{get:o(function(){return this.nodes.length||0},"get")}),e.prototype.clone=function(){return this.nodes=null},e.prototype.item=function(t){return this.nodes[t]||null},e})()}).call(yj)});var Ej=Z((Sj,bj)=>{"use strict";(function(){bj.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(Sj)});var ai=Z((Aj,Cj)=>{"use strict";(function(){var r,e,t,n,s,i,a,u,c,f,h,m,g,x,v,w,S,A,T,b={}.hasOwnProperty;T=Ya(),A=T.isObject,S=T.isFunction,w=T.isEmpty,v=T.getValue,u=null,t=null,n=null,s=null,i=null,g=null,x=null,m=null,a=null,e=null,h=null,c=null,r=null,Cj.exports=f=(function(){function E(C){this.parent=C,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,u||(u=ub(),t=cb(),n=lb(),s=fb(),i=gb(),g=vb(),x=yb(),m=xb(),a=a_(),e=cn(),h=wj(),c=ob(),r=Ej())}return o(E,"XMLNode"),Object.defineProperty(E.prototype,"nodeName",{get:o(function(){return this.name},"get")}),Object.defineProperty(E.prototype,"nodeType",{get:o(function(){return this.type},"get")}),Object.defineProperty(E.prototype,"nodeValue",{get:o(function(){return this.value},"get")}),Object.defineProperty(E.prototype,"parentNode",{get:o(function(){return this.parent},"get")}),Object.defineProperty(E.prototype,"childNodes",{get:o(function(){return(!this.childNodeList||!this.childNodeList.nodes)&&(this.childNodeList=new h(this.children)),this.childNodeList},"get")}),Object.defineProperty(E.prototype,"firstChild",{get:o(function(){return this.children[0]||null},"get")}),Object.defineProperty(E.prototype,"lastChild",{get:o(function(){return this.children[this.children.length-1]||null},"get")}),Object.defineProperty(E.prototype,"previousSibling",{get:o(function(){var C;return C=this.parent.children.indexOf(this),this.parent.children[C-1]||null},"get")}),Object.defineProperty(E.prototype,"nextSibling",{get:o(function(){var C;return C=this.parent.children.indexOf(this),this.parent.children[C+1]||null},"get")}),Object.defineProperty(E.prototype,"ownerDocument",{get:o(function(){return this.document()||null},"get")}),Object.defineProperty(E.prototype,"textContent",{get:o(function(){var C,_,F,R,q;if(this.nodeType===e.Element||this.nodeType===e.DocumentFragment){for(q="",R=this.children,_=0,F=R.length;_<F;_++)C=R[_],C.textContent&&(q+=C.textContent);return q}else return null},"get"),set:o(function(C){throw new Error("This DOM method is not implemented."+this.debugInfo())},"set")}),E.prototype.setParent=function(C){var _,F,R,q,H;for(this.parent=C,C&&(this.options=C.options,this.stringify=C.stringify),q=this.children,H=[],F=0,R=q.length;F<R;F++)_=q[F],H.push(_.setParent(this));return H},E.prototype.element=function(C,_,F){var R,q,H,K,X,pe,le,ue,ee,he,we;if(pe=null,_===null&&F==null&&(ee=[{},null],_=ee[0],F=ee[1]),_==null&&(_={}),_=v(_),A(_)||(he=[_,F],F=he[0],_=he[1]),C!=null&&(C=v(C)),Array.isArray(C))for(H=0,le=C.length;H<le;H++)q=C[H],pe=this.element(q);else if(S(C))pe=this.element(C.apply());else if(A(C)){for(X in C)if(b.call(C,X))if(we=C[X],S(we)&&(we=we.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&X.indexOf(this.stringify.convertAttKey)===0)pe=this.attribute(X.substr(this.stringify.convertAttKey.length),we);else if(!this.options.separateArrayItems&&Array.isArray(we)&&w(we))pe=this.dummy();else if(A(we)&&w(we))pe=this.element(X);else if(!this.options.keepNullNodes&&we==null)pe=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(we))for(K=0,ue=we.length;K<ue;K++)q=we[K],R={},R[X]=q,pe=this.element(R);else A(we)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&X.indexOf(this.stringify.convertTextKey)===0?pe=this.element(we):(pe=this.element(X),pe.element(we)):pe=this.element(X,we)}else!this.options.keepNullNodes&&F===null?pe=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&C.indexOf(this.stringify.convertTextKey)===0?pe=this.text(F):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&C.indexOf(this.stringify.convertCDataKey)===0?pe=this.cdata(F):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&C.indexOf(this.stringify.convertCommentKey)===0?pe=this.comment(F):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&C.indexOf(this.stringify.convertRawKey)===0?pe=this.raw(F):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&C.indexOf(this.stringify.convertPIKey)===0?pe=this.instruction(C.substr(this.stringify.convertPIKey.length),F):pe=this.node(C,_,F);if(pe==null)throw new Error("Could not create any elements with: "+C+". "+this.debugInfo());return pe},E.prototype.insertBefore=function(C,_,F){var R,q,H,K,X;if(C?.type)return H=C,K=_,H.setParent(this),K?(q=children.indexOf(K),X=children.splice(q),children.push(H),Array.prototype.push.apply(children,X)):children.push(H),H;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(C));return q=this.parent.children.indexOf(this),X=this.parent.children.splice(q),R=this.parent.element(C,_,F),Array.prototype.push.apply(this.parent.children,X),R},E.prototype.insertAfter=function(C,_,F){var R,q,H;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(C));return q=this.parent.children.indexOf(this),H=this.parent.children.splice(q+1),R=this.parent.element(C,_,F),Array.prototype.push.apply(this.parent.children,H),R},E.prototype.remove=function(){var C,_;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return C=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[C,C-C+1].concat(_=[])),this.parent},E.prototype.node=function(C,_,F){var R,q;return C!=null&&(C=v(C)),_||(_={}),_=v(_),A(_)||(q=[_,F],F=q[0],_=q[1]),R=new u(this,C,_),F!=null&&R.text(F),this.children.push(R),R},E.prototype.text=function(C){var _;return A(C)&&this.element(C),_=new x(this,C),this.children.push(_),this},E.prototype.cdata=function(C){var _;return _=new t(this,C),this.children.push(_),this},E.prototype.comment=function(C){var _;return _=new n(this,C),this.children.push(_),this},E.prototype.commentBefore=function(C){var _,F,R;return F=this.parent.children.indexOf(this),R=this.parent.children.splice(F),_=this.parent.comment(C),Array.prototype.push.apply(this.parent.children,R),this},E.prototype.commentAfter=function(C){var _,F,R;return F=this.parent.children.indexOf(this),R=this.parent.children.splice(F+1),_=this.parent.comment(C),Array.prototype.push.apply(this.parent.children,R),this},E.prototype.raw=function(C){var _;return _=new g(this,C),this.children.push(_),this},E.prototype.dummy=function(){var C;return C=new a(this),C},E.prototype.instruction=function(C,_){var F,R,q,H,K;if(C!=null&&(C=v(C)),_!=null&&(_=v(_)),Array.isArray(C))for(H=0,K=C.length;H<K;H++)F=C[H],this.instruction(F);else if(A(C))for(F in C)b.call(C,F)&&(R=C[F],this.instruction(F,R));else S(_)&&(_=_.apply()),q=new m(this,C,_),this.children.push(q);return this},E.prototype.instructionBefore=function(C,_){var F,R,q;return R=this.parent.children.indexOf(this),q=this.parent.children.splice(R),F=this.parent.instruction(C,_),Array.prototype.push.apply(this.parent.children,q),this},E.prototype.instructionAfter=function(C,_){var F,R,q;return R=this.parent.children.indexOf(this),q=this.parent.children.splice(R+1),F=this.parent.instruction(C,_),Array.prototype.push.apply(this.parent.children,q),this},E.prototype.declaration=function(C,_,F){var R,q;return R=this.document(),q=new s(R,C,_,F),R.children.length===0?R.children.unshift(q):R.children[0].type===e.Declaration?R.children[0]=q:R.children.unshift(q),R.root()||R},E.prototype.dtd=function(C,_){var F,R,q,H,K,X,pe,le,ue,ee;for(R=this.document(),q=new i(R,C,_),ue=R.children,H=K=0,pe=ue.length;K<pe;H=++K)if(F=ue[H],F.type===e.DocType)return R.children[H]=q,q;for(ee=R.children,H=X=0,le=ee.length;X<le;H=++X)if(F=ee[H],F.isRoot)return R.children.splice(H,0,q),q;return R.children.push(q),q},E.prototype.up=function(){if(this.isRoot)throw new Error("The root node has no parent. Use doc() if you need to get the document object.");return this.parent},E.prototype.root=function(){var C;for(C=this;C;){if(C.type===e.Document)return C.rootObject;if(C.isRoot)return C;C=C.parent}},E.prototype.document=function(){var C;for(C=this;C;){if(C.type===e.Document)return C;C=C.parent}},E.prototype.end=function(C){return this.document().end(C)},E.prototype.prev=function(){var C;if(C=this.parent.children.indexOf(this),C<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[C-1]},E.prototype.next=function(){var C;if(C=this.parent.children.indexOf(this),C===-1||C===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[C+1]},E.prototype.importDocument=function(C){var _;return _=C.root().clone(),_.parent=this,_.isRoot=!1,this.children.push(_),this},E.prototype.debugInfo=function(C){var _,F;return C=C||this.name,C==null&&!((_=this.parent)!=null&&_.name)?"":C==null?"parent: <"+this.parent.name+">":(F=this.parent)!=null&&F.name?"node: <"+C+">, parent: <"+this.parent.name+">":"node: <"+C+">"},E.prototype.ele=function(C,_,F){return this.element(C,_,F)},E.prototype.nod=function(C,_,F){return this.node(C,_,F)},E.prototype.txt=function(C){return this.text(C)},E.prototype.dat=function(C){return this.cdata(C)},E.prototype.com=function(C){return this.comment(C)},E.prototype.ins=function(C,_){return this.instruction(C,_)},E.prototype.doc=function(){return this.document()},E.prototype.dec=function(C,_,F){return this.declaration(C,_,F)},E.prototype.e=function(C,_,F){return this.element(C,_,F)},E.prototype.n=function(C,_,F){return this.node(C,_,F)},E.prototype.t=function(C){return this.text(C)},E.prototype.d=function(C){return this.cdata(C)},E.prototype.c=function(C){return this.comment(C)},E.prototype.r=function(C){return this.raw(C)},E.prototype.i=function(C,_){return this.instruction(C,_)},E.prototype.u=function(){return this.up()},E.prototype.importXMLBuilder=function(C){return this.importDocument(C)},E.prototype.replaceChild=function(C,_){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.removeChild=function(C){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.appendChild=function(C){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.hasChildNodes=function(){return this.children.length!==0},E.prototype.cloneNode=function(C){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.isSupported=function(C,_){return!0},E.prototype.hasAttributes=function(){return this.attribs.length!==0},E.prototype.compareDocumentPosition=function(C){var _,F;return _=this,_===C?0:this.document()!==C.document()?(F=r.Disconnected|r.ImplementationSpecific,Math.random()<.5?F|=r.Preceding:F|=r.Following,F):_.isAncestor(C)?r.Contains|r.Preceding:_.isDescendant(C)?r.Contains|r.Following:_.isPreceding(C)?r.Preceding:r.Following},E.prototype.isSameNode=function(C){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.lookupPrefix=function(C){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.isDefaultNamespace=function(C){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.lookupNamespaceURI=function(C){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.isEqualNode=function(C){var _,F,R;if(C.nodeType!==this.nodeType||C.children.length!==this.children.length)return!1;for(_=F=0,R=this.children.length-1;0<=R?F<=R:F>=R;_=0<=R?++F:--F)if(!this.children[_].isEqualNode(C.children[_]))return!1;return!0},E.prototype.getFeature=function(C,_){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.setUserData=function(C,_,F){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.getUserData=function(C){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.contains=function(C){return C?C===this||this.isDescendant(C):!1},E.prototype.isDescendant=function(C){var _,F,R,q,H;for(H=this.children,R=0,q=H.length;R<q;R++)if(_=H[R],C===_||(F=_.isDescendant(C),F))return!0;return!1},E.prototype.isAncestor=function(C){return C.isDescendant(this)},E.prototype.isPreceding=function(C){var _,F;return _=this.treePosition(C),F=this.treePosition(this),_===-1||F===-1?!1:_<F},E.prototype.isFollowing=function(C){var _,F;return _=this.treePosition(C),F=this.treePosition(this),_===-1||F===-1?!1:_>F},E.prototype.treePosition=function(C){var _,F;return F=0,_=!1,this.foreachTreeNode(this.document(),function(R){if(F++,!_&&R===C)return _=!0}),_?F:-1},E.prototype.foreachTreeNode=function(C,_){var F,R,q,H,K;for(C||(C=this.document()),H=C.children,R=0,q=H.length;R<q;R++){if(F=H[R],K=_(F))return K;if(K=this.foreachTreeNode(F,_),K)return K}},E})()}).call(Aj)});var o_=Z((Nj,Tj)=>{"use strict";(function(){var r,e=o(function(n,s){return function(){return n.apply(s,arguments)}},"bind"),t={}.hasOwnProperty;Tj.exports=r=(function(){function n(s){this.assertLegalName=e(this.assertLegalName,this),this.assertLegalChar=e(this.assertLegalChar,this);var i,a,u;s||(s={}),this.options=s,this.options.version||(this.options.version="1.0"),a=s.stringify||{};for(i in a)t.call(a,i)&&(u=a[i],this[i]=u)}return o(n,"XMLStringifier"),n.prototype.name=function(s){return this.options.noValidation?s:this.assertLegalName(""+s||"")},n.prototype.text=function(s){return this.options.noValidation?s:this.assertLegalChar(this.textEscape(""+s||""))},n.prototype.cdata=function(s){return this.options.noValidation?s:(s=""+s||"",s=s.replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(s))},n.prototype.comment=function(s){if(this.options.noValidation)return s;if(s=""+s||"",s.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+s);return this.assertLegalChar(s)},n.prototype.raw=function(s){return this.options.noValidation?s:""+s||""},n.prototype.attValue=function(s){return this.options.noValidation?s:this.assertLegalChar(this.attEscape(s=""+s||""))},n.prototype.insTarget=function(s){return this.options.noValidation?s:this.assertLegalChar(""+s||"")},n.prototype.insValue=function(s){if(this.options.noValidation)return s;if(s=""+s||"",s.match(/\?>/))throw new Error("Invalid processing instruction value: "+s);return this.assertLegalChar(s)},n.prototype.xmlVersion=function(s){if(this.options.noValidation)return s;if(s=""+s||"",!s.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+s);return s},n.prototype.xmlEncoding=function(s){if(this.options.noValidation)return s;if(s=""+s||"",!s.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+s);return this.assertLegalChar(s)},n.prototype.xmlStandalone=function(s){return this.options.noValidation?s:s?"yes":"no"},n.prototype.dtdPubID=function(s){return this.options.noValidation?s:this.assertLegalChar(""+s||"")},n.prototype.dtdSysID=function(s){return this.options.noValidation?s:this.assertLegalChar(""+s||"")},n.prototype.dtdElementValue=function(s){return this.options.noValidation?s:this.assertLegalChar(""+s||"")},n.prototype.dtdAttType=function(s){return this.options.noValidation?s:this.assertLegalChar(""+s||"")},n.prototype.dtdAttDefault=function(s){return this.options.noValidation?s:this.assertLegalChar(""+s||"")},n.prototype.dtdEntityValue=function(s){return this.options.noValidation?s:this.assertLegalChar(""+s||"")},n.prototype.dtdNData=function(s){return this.options.noValidation?s:this.assertLegalChar(""+s||"")},n.prototype.convertAttKey="@",n.prototype.convertPIKey="?",n.prototype.convertTextKey="#text",n.prototype.convertCDataKey="#cdata",n.prototype.convertCommentKey="#comment",n.prototype.convertRawKey="#raw",n.prototype.assertLegalChar=function(s){var i,a;if(this.options.noValidation)return s;if(i="",this.options.version==="1.0"){if(i=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,a=s.match(i))throw new Error("Invalid character in string: "+s+" at index "+a.index)}else if(this.options.version==="1.1"&&(i=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,a=s.match(i)))throw new Error("Invalid character in string: "+s+" at index "+a.index);return s},n.prototype.assertLegalName=function(s){var i;if(this.options.noValidation)return s;if(this.assertLegalChar(s),i=/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/,!s.match(i))throw new Error("Invalid character in name");return s},n.prototype.textEscape=function(s){var i;return this.options.noValidation?s:(i=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,s.replace(i,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r/g,"&#xD;"))},n.prototype.attEscape=function(s){var i;return this.options.noValidation?s:(i=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,s.replace(i,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;"))},n})()}).call(Nj)});var Xg=Z((Ij,_j)=>{"use strict";(function(){_j.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}).call(Ij)});var u_=Z((Bj,Dj)=>{"use strict";(function(){var r,e,t,n,s,i,a,u,c,f,h,m,g,x,v,w,S,A={}.hasOwnProperty;S=Ya().assign,r=cn(),c=fb(),f=gb(),t=cb(),n=lb(),m=ub(),x=vb(),v=yb(),g=xb(),h=a_(),s=hb(),i=db(),a=pb(),u=mb(),e=Xg(),Dj.exports=w=(function(){function T(b){var E,C,_;b||(b={}),this.options=b,C=b.writer||{};for(E in C)A.call(C,E)&&(_=C[E],this["_"+E]=this[E],this[E]=_)}return o(T,"XMLWriterBase"),T.prototype.filterOptions=function(b){var E,C,_,F,R,q,H,K;return b||(b={}),b=S({},this.options,b),E={writer:this},E.pretty=b.pretty||!1,E.allowEmpty=b.allowEmpty||!1,E.indent=(C=b.indent)!=null?C:" ",E.newline=(_=b.newline)!=null?_:`
89
- `,E.offset=(F=b.offset)!=null?F:0,E.dontPrettyTextNodes=(R=(q=b.dontPrettyTextNodes)!=null?q:b.dontprettytextnodes)!=null?R:0,E.spaceBeforeSlash=(H=(K=b.spaceBeforeSlash)!=null?K:b.spacebeforeslash)!=null?H:"",E.spaceBeforeSlash===!0&&(E.spaceBeforeSlash=" "),E.suppressPrettyCount=0,E.user={},E.state=e.None,E},T.prototype.indent=function(b,E,C){var _;return!E.pretty||E.suppressPrettyCount?"":E.pretty&&(_=(C||0)+E.offset+1,_>0)?new Array(_).join(E.indent):""},T.prototype.endline=function(b,E,C){return!E.pretty||E.suppressPrettyCount?"":E.newline},T.prototype.attribute=function(b,E,C){var _;return this.openAttribute(b,E,C),_=" "+b.name+'="'+b.value+'"',this.closeAttribute(b,E,C),_},T.prototype.cdata=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<![CDATA[",E.state=e.InsideTag,_+=b.value,E.state=e.CloseTag,_+="]]>"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},T.prototype.comment=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<!-- ",E.state=e.InsideTag,_+=b.value,E.state=e.CloseTag,_+=" -->"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},T.prototype.declaration=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<?xml",E.state=e.InsideTag,_+=' version="'+b.version+'"',b.encoding!=null&&(_+=' encoding="'+b.encoding+'"'),b.standalone!=null&&(_+=' standalone="'+b.standalone+'"'),E.state=e.CloseTag,_+=E.spaceBeforeSlash+"?>",_+=this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},T.prototype.docType=function(b,E,C){var _,F,R,q,H;if(C||(C=0),this.openNode(b,E,C),E.state=e.OpenTag,q=this.indent(b,E,C),q+="<!DOCTYPE "+b.root().name,b.pubID&&b.sysID?q+=' PUBLIC "'+b.pubID+'" "'+b.sysID+'"':b.sysID&&(q+=' SYSTEM "'+b.sysID+'"'),b.children.length>0){for(q+=" [",q+=this.endline(b,E,C),E.state=e.InsideTag,H=b.children,F=0,R=H.length;F<R;F++)_=H[F],q+=this.writeChildNode(_,E,C+1);E.state=e.CloseTag,q+="]"}return E.state=e.CloseTag,q+=E.spaceBeforeSlash+">",q+=this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),q},T.prototype.element=function(b,E,C){var _,F,R,q,H,K,X,pe,le,ue,ee,he,we,Ke;C||(C=0),ue=!1,ee="",this.openNode(b,E,C),E.state=e.OpenTag,ee+=this.indent(b,E,C)+"<"+b.name,he=b.attribs;for(le in he)A.call(he,le)&&(_=he[le],ee+=this.attribute(_,E,C));if(R=b.children.length,q=R===0?null:b.children[0],R===0||b.children.every(function(Ae){return(Ae.type===r.Text||Ae.type===r.Raw)&&Ae.value===""}))E.allowEmpty?(ee+=">",E.state=e.CloseTag,ee+="</"+b.name+">"+this.endline(b,E,C)):(E.state=e.CloseTag,ee+=E.spaceBeforeSlash+"/>"+this.endline(b,E,C));else if(E.pretty&&R===1&&(q.type===r.Text||q.type===r.Raw)&&q.value!=null)ee+=">",E.state=e.InsideTag,E.suppressPrettyCount++,ue=!0,ee+=this.writeChildNode(q,E,C+1),E.suppressPrettyCount--,ue=!1,E.state=e.CloseTag,ee+="</"+b.name+">"+this.endline(b,E,C);else{if(E.dontPrettyTextNodes){for(we=b.children,H=0,X=we.length;H<X;H++)if(F=we[H],(F.type===r.Text||F.type===r.Raw)&&F.value!=null){E.suppressPrettyCount++,ue=!0;break}}for(ee+=">"+this.endline(b,E,C),E.state=e.InsideTag,Ke=b.children,K=0,pe=Ke.length;K<pe;K++)F=Ke[K],ee+=this.writeChildNode(F,E,C+1);E.state=e.CloseTag,ee+=this.indent(b,E,C)+"</"+b.name+">",ue&&E.suppressPrettyCount--,ee+=this.endline(b,E,C),E.state=e.None}return this.closeNode(b,E,C),ee},T.prototype.writeChildNode=function(b,E,C){switch(b.type){case r.CData:return this.cdata(b,E,C);case r.Comment:return this.comment(b,E,C);case r.Element:return this.element(b,E,C);case r.Raw:return this.raw(b,E,C);case r.Text:return this.text(b,E,C);case r.ProcessingInstruction:return this.processingInstruction(b,E,C);case r.Dummy:return"";case r.Declaration:return this.declaration(b,E,C);case r.DocType:return this.docType(b,E,C);case r.AttributeDeclaration:return this.dtdAttList(b,E,C);case r.ElementDeclaration:return this.dtdElement(b,E,C);case r.EntityDeclaration:return this.dtdEntity(b,E,C);case r.NotationDeclaration:return this.dtdNotation(b,E,C);default:throw new Error("Unknown XML node type: "+b.constructor.name)}},T.prototype.processingInstruction=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<?",E.state=e.InsideTag,_+=b.target,b.value&&(_+=" "+b.value),E.state=e.CloseTag,_+=E.spaceBeforeSlash+"?>",_+=this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},T.prototype.raw=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C),E.state=e.InsideTag,_+=b.value,E.state=e.CloseTag,_+=this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},T.prototype.text=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C),E.state=e.InsideTag,_+=b.value,E.state=e.CloseTag,_+=this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},T.prototype.dtdAttList=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<!ATTLIST",E.state=e.InsideTag,_+=" "+b.elementName+" "+b.attributeName+" "+b.attributeType,b.defaultValueType!=="#DEFAULT"&&(_+=" "+b.defaultValueType),b.defaultValue&&(_+=' "'+b.defaultValue+'"'),E.state=e.CloseTag,_+=E.spaceBeforeSlash+">"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},T.prototype.dtdElement=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<!ELEMENT",E.state=e.InsideTag,_+=" "+b.name+" "+b.value,E.state=e.CloseTag,_+=E.spaceBeforeSlash+">"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},T.prototype.dtdEntity=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<!ENTITY",E.state=e.InsideTag,b.pe&&(_+=" %"),_+=" "+b.name,b.value?_+=' "'+b.value+'"':(b.pubID&&b.sysID?_+=' PUBLIC "'+b.pubID+'" "'+b.sysID+'"':b.sysID&&(_+=' SYSTEM "'+b.sysID+'"'),b.nData&&(_+=" NDATA "+b.nData)),E.state=e.CloseTag,_+=E.spaceBeforeSlash+">"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},T.prototype.dtdNotation=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<!NOTATION",E.state=e.InsideTag,_+=" "+b.name,b.pubID&&b.sysID?_+=' PUBLIC "'+b.pubID+'" "'+b.sysID+'"':b.pubID?_+=' PUBLIC "'+b.pubID+'"':b.sysID&&(_+=' SYSTEM "'+b.sysID+'"'),E.state=e.CloseTag,_+=E.spaceBeforeSlash+">"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},T.prototype.openNode=function(b,E,C){},T.prototype.closeNode=function(b,E,C){},T.prototype.openAttribute=function(b,E,C){},T.prototype.closeAttribute=function(b,E,C){},T})()}).call(Bj)});var wb=Z((Rj,Pj)=>{"use strict";(function(){var r,e,t=o(function(s,i){for(var a in i)n.call(i,a)&&(s[a]=i[a]);function u(){this.constructor=s}return o(u,"ctor"),u.prototype=i.prototype,s.prototype=new u,s.__super__=i.prototype,s},"extend"),n={}.hasOwnProperty;e=u_(),Pj.exports=r=(function(s){t(i,s);function i(a){i.__super__.constructor.call(this,a)}return o(i,"XMLStringWriter"),i.prototype.document=function(a,u){var c,f,h,m,g;for(u=this.filterOptions(u),m="",g=a.children,f=0,h=g.length;f<h;f++)c=g[f],m+=this.writeChildNode(c,u,0);return u.pretty&&m.slice(-u.newline.length)===u.newline&&(m=m.slice(0,-u.newline.length)),m},i})(e)}).call(Rj)});var c_=Z((Oj,kj)=>{"use strict";(function(){var r,e,t,n,s,i,a,u,c=o(function(h,m){for(var g in m)f.call(m,g)&&(h[g]=m[g]);function x(){this.constructor=h}return o(x,"ctor"),x.prototype=m.prototype,h.prototype=new x,h.__super__=m.prototype,h},"extend"),f={}.hasOwnProperty;u=Ya().isPlainObject,t=s_(),e=VU(),s=ai(),r=cn(),a=o_(),i=wb(),kj.exports=n=(function(h){c(m,h);function m(g){m.__super__.constructor.call(this,null),this.name="#document",this.type=r.Document,this.documentURI=null,this.domConfig=new e,g||(g={}),g.writer||(g.writer=new i),this.options=g,this.stringify=new a(g)}return o(m,"XMLDocument"),Object.defineProperty(m.prototype,"implementation",{value:new t}),Object.defineProperty(m.prototype,"doctype",{get:o(function(){var g,x,v,w;for(w=this.children,x=0,v=w.length;x<v;x++)if(g=w[x],g.type===r.DocType)return g;return null},"get")}),Object.defineProperty(m.prototype,"documentElement",{get:o(function(){return this.rootObject||null},"get")}),Object.defineProperty(m.prototype,"inputEncoding",{get:o(function(){return null},"get")}),Object.defineProperty(m.prototype,"strictErrorChecking",{get:o(function(){return!1},"get")}),Object.defineProperty(m.prototype,"xmlEncoding",{get:o(function(){return this.children.length!==0&&this.children[0].type===r.Declaration?this.children[0].encoding:null},"get")}),Object.defineProperty(m.prototype,"xmlStandalone",{get:o(function(){return this.children.length!==0&&this.children[0].type===r.Declaration?this.children[0].standalone==="yes":!1},"get")}),Object.defineProperty(m.prototype,"xmlVersion",{get:o(function(){return this.children.length!==0&&this.children[0].type===r.Declaration?this.children[0].version:"1.0"},"get")}),Object.defineProperty(m.prototype,"URL",{get:o(function(){return this.documentURI},"get")}),Object.defineProperty(m.prototype,"origin",{get:o(function(){return null},"get")}),Object.defineProperty(m.prototype,"compatMode",{get:o(function(){return null},"get")}),Object.defineProperty(m.prototype,"characterSet",{get:o(function(){return null},"get")}),Object.defineProperty(m.prototype,"contentType",{get:o(function(){return null},"get")}),m.prototype.end=function(g){var x;return x={},g?u(g)&&(x=g,g=this.options.writer):g=this.options.writer,g.document(this,g.filterOptions(x))},m.prototype.toString=function(g){return this.options.writer.document(this,this.options.writer.filterOptions(g))},m.prototype.createElement=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createTextNode=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createComment=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createCDATASection=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createProcessingInstruction=function(g,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createAttribute=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createEntityReference=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByTagName=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.importNode=function(g,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createElementNS=function(g,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createAttributeNS=function(g,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByTagNameNS=function(g,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementById=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.adoptNode=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.renameNode=function(g,x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByClassName=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createEvent=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createNodeIterator=function(g,x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createTreeWalker=function(g,x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},m})(s)}).call(Oj)});var Uj=Z((Lj,Vj)=>{"use strict";(function(){var r,e,t,n,s,i,a,u,c,f,h,m,g,x,v,w,S,A,T,b,E,C,_,F,R={}.hasOwnProperty;F=Ya(),C=F.isObject,E=F.isFunction,_=F.isPlainObject,b=F.getValue,r=cn(),m=c_(),x=ub(),n=cb(),s=lb(),w=vb(),T=yb(),v=xb(),f=fb(),h=gb(),i=hb(),u=pb(),a=db(),c=mb(),t=i_(),A=o_(),S=wb(),e=Xg(),Vj.exports=g=(function(){function q(H,K,X){var pe;this.name="?xml",this.type=r.Document,H||(H={}),pe={},H.writer?_(H.writer)&&(pe=H.writer,H.writer=new S):H.writer=new S,this.options=H,this.writer=H.writer,this.writerOptions=this.writer.filterOptions(pe),this.stringify=new A(H),this.onDataCallback=K||function(){},this.onEndCallback=X||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return o(q,"XMLDocumentCB"),q.prototype.createChildNode=function(H){var K,X,pe,le,ue,ee,he,we;switch(H.type){case r.CData:this.cdata(H.value);break;case r.Comment:this.comment(H.value);break;case r.Element:pe={},he=H.attribs;for(X in he)R.call(he,X)&&(K=he[X],pe[X]=K.value);this.node(H.name,pe);break;case r.Dummy:this.dummy();break;case r.Raw:this.raw(H.value);break;case r.Text:this.text(H.value);break;case r.ProcessingInstruction:this.instruction(H.target,H.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+H.constructor.name)}for(we=H.children,ue=0,ee=we.length;ue<ee;ue++)le=we[ue],this.createChildNode(le),le.type===r.Element&&this.up();return this},q.prototype.dummy=function(){return this},q.prototype.node=function(H,K,X){var pe;if(H==null)throw new Error("Missing node name.");if(this.root&&this.currentLevel===-1)throw new Error("Document can only have one root node. "+this.debugInfo(H));return this.openCurrent(),H=b(H),K==null&&(K={}),K=b(K),C(K)||(pe=[K,X],X=pe[0],K=pe[1]),this.currentNode=new x(this,H,K),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,X!=null&&this.text(X),this},q.prototype.element=function(H,K,X){var pe,le,ue,ee,he,we;if(this.currentNode&&this.currentNode.type===r.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(H)||C(H)||E(H))for(ee=this.options.noValidation,this.options.noValidation=!0,we=new m(this.options).element("TEMP_ROOT"),we.element(H),this.options.noValidation=ee,he=we.children,le=0,ue=he.length;le<ue;le++)pe=he[le],this.createChildNode(pe),pe.type===r.Element&&this.up();else this.node(H,K,X);return this},q.prototype.attribute=function(H,K){var X,pe;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(H));if(H!=null&&(H=b(H)),C(H))for(X in H)R.call(H,X)&&(pe=H[X],this.attribute(X,pe));else E(K)&&(K=K.apply()),this.options.keepNullAttributes&&K==null?this.currentNode.attribs[H]=new t(this,H,""):K!=null&&(this.currentNode.attribs[H]=new t(this,H,K));return this},q.prototype.text=function(H){var K;return this.openCurrent(),K=new T(this,H),this.onData(this.writer.text(K,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.cdata=function(H){var K;return this.openCurrent(),K=new n(this,H),this.onData(this.writer.cdata(K,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.comment=function(H){var K;return this.openCurrent(),K=new s(this,H),this.onData(this.writer.comment(K,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.raw=function(H){var K;return this.openCurrent(),K=new w(this,H),this.onData(this.writer.raw(K,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.instruction=function(H,K){var X,pe,le,ue,ee;if(this.openCurrent(),H!=null&&(H=b(H)),K!=null&&(K=b(K)),Array.isArray(H))for(X=0,ue=H.length;X<ue;X++)pe=H[X],this.instruction(pe);else if(C(H))for(pe in H)R.call(H,pe)&&(le=H[pe],this.instruction(pe,le));else E(K)&&(K=K.apply()),ee=new v(this,H,K),this.onData(this.writer.processingInstruction(ee,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},q.prototype.declaration=function(H,K,X){var pe;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return pe=new f(this,H,K,X),this.onData(this.writer.declaration(pe,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.doctype=function(H,K,X){if(this.openCurrent(),H==null)throw new Error("Missing root node name.");if(this.root)throw new Error("dtd() must come before the root node.");return this.currentNode=new h(this,K,X),this.currentNode.rootNodeName=H,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},q.prototype.dtdElement=function(H,K){var X;return this.openCurrent(),X=new a(this,H,K),this.onData(this.writer.dtdElement(X,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.attList=function(H,K,X,pe,le){var ue;return this.openCurrent(),ue=new i(this,H,K,X,pe,le),this.onData(this.writer.dtdAttList(ue,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.entity=function(H,K){var X;return this.openCurrent(),X=new u(this,!1,H,K),this.onData(this.writer.dtdEntity(X,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.pEntity=function(H,K){var X;return this.openCurrent(),X=new u(this,!0,H,K),this.onData(this.writer.dtdEntity(X,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.notation=function(H,K){var X;return this.openCurrent(),X=new c(this,H,K),this.onData(this.writer.dtdNotation(X,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.up=function(){if(this.currentLevel<0)throw new Error("The document node has no parent.");return this.currentNode?(this.currentNode.children?this.closeNode(this.currentNode):this.openNode(this.currentNode),this.currentNode=null):this.closeNode(this.openTags[this.currentLevel]),delete this.openTags[this.currentLevel],this.currentLevel--,this},q.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},q.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},q.prototype.openNode=function(H){var K,X,pe,le;if(!H.isOpen){if(!this.root&&this.currentLevel===0&&H.type===r.Element&&(this.root=H),X="",H.type===r.Element){this.writerOptions.state=e.OpenTag,X=this.writer.indent(H,this.writerOptions,this.currentLevel)+"<"+H.name,le=H.attribs;for(pe in le)R.call(le,pe)&&(K=le[pe],X+=this.writer.attribute(K,this.writerOptions,this.currentLevel));X+=(H.children?">":"/>")+this.writer.endline(H,this.writerOptions,this.currentLevel),this.writerOptions.state=e.InsideTag}else this.writerOptions.state=e.OpenTag,X=this.writer.indent(H,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+H.rootNodeName,H.pubID&&H.sysID?X+=' PUBLIC "'+H.pubID+'" "'+H.sysID+'"':H.sysID&&(X+=' SYSTEM "'+H.sysID+'"'),H.children?(X+=" [",this.writerOptions.state=e.InsideTag):(this.writerOptions.state=e.CloseTag,X+=">"),X+=this.writer.endline(H,this.writerOptions,this.currentLevel);return this.onData(X,this.currentLevel),H.isOpen=!0}},q.prototype.closeNode=function(H){var K;if(!H.isClosed)return K="",this.writerOptions.state=e.CloseTag,H.type===r.Element?K=this.writer.indent(H,this.writerOptions,this.currentLevel)+"</"+H.name+">"+this.writer.endline(H,this.writerOptions,this.currentLevel):K=this.writer.indent(H,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(H,this.writerOptions,this.currentLevel),this.writerOptions.state=e.None,this.onData(K,this.currentLevel),H.isClosed=!0},q.prototype.onData=function(H,K){return this.documentStarted=!0,this.onDataCallback(H,K+1)},q.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},q.prototype.debugInfo=function(H){return H==null?"":"node: <"+H+">"},q.prototype.ele=function(){return this.element.apply(this,arguments)},q.prototype.nod=function(H,K,X){return this.node(H,K,X)},q.prototype.txt=function(H){return this.text(H)},q.prototype.dat=function(H){return this.cdata(H)},q.prototype.com=function(H){return this.comment(H)},q.prototype.ins=function(H,K){return this.instruction(H,K)},q.prototype.dec=function(H,K,X){return this.declaration(H,K,X)},q.prototype.dtd=function(H,K,X){return this.doctype(H,K,X)},q.prototype.e=function(H,K,X){return this.element(H,K,X)},q.prototype.n=function(H,K,X){return this.node(H,K,X)},q.prototype.t=function(H){return this.text(H)},q.prototype.d=function(H){return this.cdata(H)},q.prototype.c=function(H){return this.comment(H)},q.prototype.r=function(H){return this.raw(H)},q.prototype.i=function(H,K){return this.instruction(H,K)},q.prototype.att=function(){return this.currentNode&&this.currentNode.type===r.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},q.prototype.a=function(){return this.currentNode&&this.currentNode.type===r.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},q.prototype.ent=function(H,K){return this.entity(H,K)},q.prototype.pent=function(H,K){return this.pEntity(H,K)},q.prototype.not=function(H,K){return this.notation(H,K)},q})()}).call(Lj)});var Fj=Z((jj,Mj)=>{"use strict";(function(){var r,e,t,n,s=o(function(a,u){for(var c in u)i.call(u,c)&&(a[c]=u[c]);function f(){this.constructor=a}return o(f,"ctor"),f.prototype=u.prototype,a.prototype=new f,a.__super__=u.prototype,a},"extend"),i={}.hasOwnProperty;r=cn(),n=u_(),e=Xg(),Mj.exports=t=(function(a){s(u,a);function u(c,f){this.stream=c,u.__super__.constructor.call(this,f)}return o(u,"XMLStreamWriter"),u.prototype.endline=function(c,f,h){return c.isLastRootNode&&f.state===e.CloseTag?"":u.__super__.endline.call(this,c,f,h)},u.prototype.document=function(c,f){var h,m,g,x,v,w,S,A,T;for(S=c.children,m=g=0,v=S.length;g<v;m=++g)h=S[m],h.isLastRootNode=m===c.children.length-1;for(f=this.filterOptions(f),A=c.children,T=[],x=0,w=A.length;x<w;x++)h=A[x],T.push(this.writeChildNode(h,f,0));return T},u.prototype.attribute=function(c,f,h){return this.stream.write(u.__super__.attribute.call(this,c,f,h))},u.prototype.cdata=function(c,f,h){return this.stream.write(u.__super__.cdata.call(this,c,f,h))},u.prototype.comment=function(c,f,h){return this.stream.write(u.__super__.comment.call(this,c,f,h))},u.prototype.declaration=function(c,f,h){return this.stream.write(u.__super__.declaration.call(this,c,f,h))},u.prototype.docType=function(c,f,h){var m,g,x,v;if(h||(h=0),this.openNode(c,f,h),f.state=e.OpenTag,this.stream.write(this.indent(c,f,h)),this.stream.write("<!DOCTYPE "+c.root().name),c.pubID&&c.sysID?this.stream.write(' PUBLIC "'+c.pubID+'" "'+c.sysID+'"'):c.sysID&&this.stream.write(' SYSTEM "'+c.sysID+'"'),c.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(c,f,h)),f.state=e.InsideTag,v=c.children,g=0,x=v.length;g<x;g++)m=v[g],this.writeChildNode(m,f,h+1);f.state=e.CloseTag,this.stream.write("]")}return f.state=e.CloseTag,this.stream.write(f.spaceBeforeSlash+">"),this.stream.write(this.endline(c,f,h)),f.state=e.None,this.closeNode(c,f,h)},u.prototype.element=function(c,f,h){var m,g,x,v,w,S,A,T,b,E;h||(h=0),this.openNode(c,f,h),f.state=e.OpenTag,this.stream.write(this.indent(c,f,h)+"<"+c.name),b=c.attribs;for(A in b)i.call(b,A)&&(m=b[A],this.attribute(m,f,h));if(x=c.children.length,v=x===0?null:c.children[0],x===0||c.children.every(function(C){return(C.type===r.Text||C.type===r.Raw)&&C.value===""}))f.allowEmpty?(this.stream.write(">"),f.state=e.CloseTag,this.stream.write("</"+c.name+">")):(f.state=e.CloseTag,this.stream.write(f.spaceBeforeSlash+"/>"));else if(f.pretty&&x===1&&(v.type===r.Text||v.type===r.Raw)&&v.value!=null)this.stream.write(">"),f.state=e.InsideTag,f.suppressPrettyCount++,T=!0,this.writeChildNode(v,f,h+1),f.suppressPrettyCount--,T=!1,f.state=e.CloseTag,this.stream.write("</"+c.name+">");else{for(this.stream.write(">"+this.endline(c,f,h)),f.state=e.InsideTag,E=c.children,w=0,S=E.length;w<S;w++)g=E[w],this.writeChildNode(g,f,h+1);f.state=e.CloseTag,this.stream.write(this.indent(c,f,h)+"</"+c.name+">")}return this.stream.write(this.endline(c,f,h)),f.state=e.None,this.closeNode(c,f,h)},u.prototype.processingInstruction=function(c,f,h){return this.stream.write(u.__super__.processingInstruction.call(this,c,f,h))},u.prototype.raw=function(c,f,h){return this.stream.write(u.__super__.raw.call(this,c,f,h))},u.prototype.text=function(c,f,h){return this.stream.write(u.__super__.text.call(this,c,f,h))},u.prototype.dtdAttList=function(c,f,h){return this.stream.write(u.__super__.dtdAttList.call(this,c,f,h))},u.prototype.dtdElement=function(c,f,h){return this.stream.write(u.__super__.dtdElement.call(this,c,f,h))},u.prototype.dtdEntity=function(c,f,h){return this.stream.write(u.__super__.dtdEntity.call(this,c,f,h))},u.prototype.dtdNotation=function(c,f,h){return this.stream.write(u.__super__.dtdNotation.call(this,c,f,h))},u})(n)}).call(jj)});var Hj=Z((qj,cc)=>{"use strict";(function(){var r,e,t,n,s,i,a,u,c,f;f=Ya(),u=f.assign,c=f.isFunction,t=s_(),n=c_(),s=Uj(),a=wb(),i=Fj(),r=cn(),e=Xg(),cc.exports.create=function(h,m,g,x){var v,w;if(h==null)throw new Error("Root element needs a name.");return x=u({},m,g,x),v=new n(x),w=v.element(h),x.headless||(v.declaration(x),(x.pubID!=null||x.sysID!=null)&&v.dtd(x)),w},cc.exports.begin=function(h,m,g){var x;return c(h)&&(x=[h,m],m=x[0],g=x[1],h={}),m?new s(h,m,g):new n(h)},cc.exports.stringWriter=function(h){return new a(h)},cc.exports.streamWriter=function(h,m){return new i(h,m)},cc.exports.implementation=new t,cc.exports.nodeType=r,cc.exports.writerState=e}).call(qj)});var Kj=Z(l_=>{"use strict";(function(){"use strict";var r,e,t,n,s,i={}.hasOwnProperty;r=Hj(),e=ab().defaults,n=o(function(a){return typeof a=="string"&&(a.indexOf("&")>=0||a.indexOf(">")>=0||a.indexOf("<")>=0)},"requiresCDATA"),s=o(function(a){return"<![CDATA["+t(a)+"]]>"},"wrapCDATA"),t=o(function(a){return a.replace("]]>","]]]]><![CDATA[>")},"escapeCDATA"),l_.Builder=(function(){function a(u){var c,f,h;this.options={},f=e["0.2"];for(c in f)i.call(f,c)&&(h=f[c],this.options[c]=h);for(c in u)i.call(u,c)&&(h=u[c],this.options[c]=h)}return o(a,"Builder"),a.prototype.buildObject=function(u){var c,f,h,m,g;return c=this.options.attrkey,f=this.options.charkey,Object.keys(u).length===1&&this.options.rootName===e["0.2"].rootName?(g=Object.keys(u)[0],u=u[g]):g=this.options.rootName,h=(function(x){return function(v,w){var S,A,T,b,E,C;if(typeof w!="object")x.options.cdata&&n(w)?v.raw(s(w)):v.txt(w);else if(Array.isArray(w)){for(b in w)if(i.call(w,b)){A=w[b];for(E in A)T=A[E],v=h(v.ele(E),T).up()}}else for(E in w)if(i.call(w,E))if(A=w[E],E===c){if(typeof A=="object")for(S in A)C=A[S],v=v.att(S,C)}else if(E===f)x.options.cdata&&n(A)?v=v.raw(s(A)):v=v.txt(A);else if(Array.isArray(A))for(b in A)i.call(A,b)&&(T=A[b],typeof T=="string"?x.options.cdata&&n(T)?v=v.ele(E).raw(s(T)).up():v=v.ele(E,T).up():v=h(v.ele(E),T).up());else typeof A=="object"?v=h(v.ele(E),A).up():typeof A=="string"&&x.options.cdata&&n(A)?v=v.ele(E).raw(s(A)).up():(A==null&&(A=""),v=v.ele(E,A.toString()).up());return v}})(this),m=r.create(g,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),h(m,u).end(this.options.renderOpts)},a})()}).call(l_)});var $j=Z(f_=>{"use strict";(function(){"use strict";f_.stripBOM=function(r){return r[0]==="\uFEFF"?r.substring(1):r}}).call(f_)});var h_=Z(zl=>{"use strict";(function(){"use strict";var r;r=new RegExp(/(?!xmlns)^.*:/),zl.normalize=function(e){return e.toLowerCase()},zl.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},zl.stripPrefix=function(e){return e.replace(r,"")},zl.parseNumbers=function(e){return isNaN(e)||(e=e%1===0?parseInt(e,10):parseFloat(e)),e},zl.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}).call(zl)});var Gj=Z(Lo=>{"use strict";(function(){"use strict";var r,e,t,n,s,i,a,u,c,f=o(function(g,x){return function(){return g.apply(x,arguments)}},"bind"),h=o(function(g,x){for(var v in x)m.call(x,v)&&(g[v]=x[v]);function w(){this.constructor=g}return o(w,"ctor"),w.prototype=x.prototype,g.prototype=new w,g.__super__=x.prototype,g},"extend"),m={}.hasOwnProperty;u=jI(),n=Xe("events"),r=$j(),a=h_(),c=Xe("timers").setImmediate,e=ab().defaults,s=o(function(g){return typeof g=="object"&&g!=null&&Object.keys(g).length===0},"isEmpty"),i=o(function(g,x,v){var w,S,A;for(w=0,S=g.length;w<S;w++)A=g[w],x=A(x,v);return x},"processItem"),t=o(function(g,x,v){var w;return w=Object.create(null),w.value=v,w.writable=!0,w.enumerable=!0,w.configurable=!0,Object.defineProperty(g,x,w)},"defineProperty"),Lo.Parser=(function(g){h(x,g);function x(v){this.parseStringPromise=f(this.parseStringPromise,this),this.parseString=f(this.parseString,this),this.reset=f(this.reset,this),this.assignOrPush=f(this.assignOrPush,this),this.processAsync=f(this.processAsync,this);var w,S,A;if(!(this instanceof Lo.Parser))return new Lo.Parser(v);this.options={},S=e["0.2"];for(w in S)m.call(S,w)&&(A=S[w],this.options[w]=A);for(w in v)m.call(v,w)&&(A=v[w],this.options[w]=A);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(a.normalize)),this.reset()}return o(x,"Parser"),x.prototype.processAsync=function(){var v,w;try{return this.remaining.length<=this.options.chunkSize?(v=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(v),this.saxParser.close()):(v=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(v),c(this.processAsync))}catch(S){if(w=S,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(w)}},x.prototype.assignOrPush=function(v,w,S){return w in v?(v[w]instanceof Array||t(v,w,[v[w]]),v[w].push(S)):this.options.explicitArray?t(v,w,[S]):t(v,w,S)},x.prototype.reset=function(){var v,w,S,A;return this.removeAllListeners(),this.saxParser=u.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=(function(T){return function(b){if(T.saxParser.resume(),!T.saxParser.errThrown)return T.saxParser.errThrown=!0,T.emit("error",b)}})(this),this.saxParser.onend=(function(T){return function(){if(!T.saxParser.ended)return T.saxParser.ended=!0,T.emit("end",T.resultObject)}})(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,A=[],v=this.options.attrkey,w=this.options.charkey,this.saxParser.onopentag=(function(T){return function(b){var E,C,_,F,R;if(_={},_[w]="",!T.options.ignoreAttrs){R=b.attributes;for(E in R)m.call(R,E)&&(!(v in _)&&!T.options.mergeAttrs&&(_[v]={}),C=T.options.attrValueProcessors?i(T.options.attrValueProcessors,b.attributes[E],E):b.attributes[E],F=T.options.attrNameProcessors?i(T.options.attrNameProcessors,E):E,T.options.mergeAttrs?T.assignOrPush(_,F,C):t(_[v],F,C))}return _["#name"]=T.options.tagNameProcessors?i(T.options.tagNameProcessors,b.name):b.name,T.options.xmlns&&(_[T.options.xmlnskey]={uri:b.uri,local:b.local}),A.push(_)}})(this),this.saxParser.onclosetag=(function(T){return function(){var b,E,C,_,F,R,q,H,K,X;if(R=A.pop(),F=R["#name"],(!T.options.explicitChildren||!T.options.preserveChildrenOrder)&&delete R["#name"],R.cdata===!0&&(b=R.cdata,delete R.cdata),K=A[A.length-1],R[w].match(/^\s*$/)&&!b?(E=R[w],delete R[w]):(T.options.trim&&(R[w]=R[w].trim()),T.options.normalize&&(R[w]=R[w].replace(/\s{2,}/g," ").trim()),R[w]=T.options.valueProcessors?i(T.options.valueProcessors,R[w],F):R[w],Object.keys(R).length===1&&w in R&&!T.EXPLICIT_CHARKEY&&(R=R[w])),s(R)&&(typeof T.options.emptyTag=="function"?R=T.options.emptyTag():R=T.options.emptyTag!==""?T.options.emptyTag:E),T.options.validator!=null&&(X="/"+(function(){var pe,le,ue;for(ue=[],pe=0,le=A.length;pe<le;pe++)_=A[pe],ue.push(_["#name"]);return ue})().concat(F).join("/"),(function(){var pe;try{return R=T.options.validator(X,K&&K[F],R)}catch(le){return pe=le,T.emit("error",pe)}})()),T.options.explicitChildren&&!T.options.mergeAttrs&&typeof R=="object"){if(!T.options.preserveChildrenOrder)_={},T.options.attrkey in R&&(_[T.options.attrkey]=R[T.options.attrkey],delete R[T.options.attrkey]),!T.options.charsAsChildren&&T.options.charkey in R&&(_[T.options.charkey]=R[T.options.charkey],delete R[T.options.charkey]),Object.getOwnPropertyNames(R).length>0&&(_[T.options.childkey]=R),R=_;else if(K){K[T.options.childkey]=K[T.options.childkey]||[],q={};for(C in R)m.call(R,C)&&t(q,C,R[C]);K[T.options.childkey].push(q),delete R["#name"],Object.keys(R).length===1&&w in R&&!T.EXPLICIT_CHARKEY&&(R=R[w])}}return A.length>0?T.assignOrPush(K,F,R):(T.options.explicitRoot&&(H=R,R={},t(R,F,H)),T.resultObject=R,T.saxParser.ended=!0,T.emit("end",T.resultObject))}})(this),S=(function(T){return function(b){var E,C;if(C=A[A.length-1],C)return C[w]+=b,T.options.explicitChildren&&T.options.preserveChildrenOrder&&T.options.charsAsChildren&&(T.options.includeWhiteChars||b.replace(/\\n/g,"").trim()!=="")&&(C[T.options.childkey]=C[T.options.childkey]||[],E={"#name":"__text__"},E[w]=b,T.options.normalize&&(E[w]=E[w].replace(/\s{2,}/g," ").trim()),C[T.options.childkey].push(E)),C}})(this),this.saxParser.ontext=S,this.saxParser.oncdata=(function(T){return function(b){var E;if(E=S(b),E)return E.cdata=!0}})(this)},x.prototype.parseString=function(v,w){var S;w!=null&&typeof w=="function"&&(this.on("end",function(A){return this.reset(),w(null,A)}),this.on("error",function(A){return this.reset(),w(A)}));try{return v=v.toString(),v.trim()===""?(this.emit("end",null),!0):(v=r.stripBOM(v),this.options.async?(this.remaining=v,c(this.processAsync),this.saxParser):this.saxParser.write(v).close())}catch(A){if(S=A,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw S}else return this.emit("error",S),this.saxParser.errThrown=!0}},x.prototype.parseStringPromise=function(v){return new Promise((function(w){return function(S,A){return w.parseString(v,function(T,b){return T?A(T):S(b)})}})(this))},x})(n),Lo.parseString=function(g,x,v){var w,S,A;return v!=null?(typeof v=="function"&&(w=v),typeof x=="object"&&(S=x)):(typeof x=="function"&&(w=x),S={}),A=new Lo.Parser(S),A.parseString(g,w)},Lo.parseStringPromise=function(g,x){var v,w;return typeof x=="object"&&(v=x),w=new Lo.Parser(v),w.parseStringPromise(g)}}).call(Lo)});var Xj=Z(Vo=>{"use strict";(function(){"use strict";var r,e,t,n,s=o(function(a,u){for(var c in u)i.call(u,c)&&(a[c]=u[c]);function f(){this.constructor=a}return o(f,"ctor"),f.prototype=u.prototype,a.prototype=new f,a.__super__=u.prototype,a},"extend"),i={}.hasOwnProperty;e=ab(),r=Kj(),t=Gj(),n=h_(),Vo.defaults=e.defaults,Vo.processors=n,Vo.ValidationError=(function(a){s(u,a);function u(c){this.message=c}return o(u,"ValidationError"),u})(Error),Vo.Builder=r.Builder,Vo.Parser=t.Parser,Vo.parseString=t.parseString,Vo.parseStringPromise=t.parseStringPromise}).call(Vo)});var I2="http://www.w3.org/2000/09/xmldsig#",dO="http://www.w3.org/TR/2001/REC-xml-c14n-20010315",_2=(function(r){return r.RSA_SHA1="http://www.w3.org/2000/09/xmldsig#rsa-sha1",r.RSA_SHA256="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",r})({}),Cu=(function(r){return r.SHA1="sha1",r.SHA256="sha256",r})({}),B2=(function(r){return r.SHA1="http://www.w3.org/2000/09/xmldsig#sha1",r.SHA256="http://www.w3.org/2001/04/xmlenc#sha256",r})({});var br={AC:"12",AL:"27",AM:"13",AP:"16",BA:"29",CE:"23",DF:"53",ES:"32",GO:"52",MA:"21",MG:"31",MS:"50",MT:"51",PA:"15",PB:"25",PE:"26",PI:"22",PR:"41",RJ:"33",RN:"24",RO:"11",RR:"14",RS:"43",SC:"42",SE:"28",SP:"35",TO:"17"},_he=Object.keys(br);var Dhe={Production:"1",Homolog:"2"};var pn=class extends Error{static{o(this,"NFeTsError")}};var mO=class extends pn{static{o(this,"ValidationError")}};var D2=o(r=>{throw new pn("Didn't expect to get here")},"unreachable");var K0={includeComments:!1,exclusive:!0};var Zh=class{static{o(this,"Signer")}toolkit;certificateRepository;algorithm;canonical;constructor(e,t,n=Cu.SHA1,s=K0){this.toolkit=e,this.certificateRepository=t,this.algorithm=n,this.canonical=s}assemble(e,t,n){let s=this.certificateRepository.getStringCertificate(n);return{$:{xmlns:I2},SignedInfo:e,SignatureValue:t,KeyInfo:{X509Data:{X509Certificate:s}}}}signedInfo(e,t){return{CanonicalizationMethod:{$:{Algorithm:dO}},SignatureMethod:{$:{Algorithm:this.signatureMethod}},Reference:{$:{URI:`#${this.toolkit.getAttribute(e,t)}`},Transforms:this.transforms,DigestMethod:{$:{Algorithm:this.digestAlgorithm}},DigestValue:this.digest(e)}}}digest(e){return this.toolkit.digest(e,this.algorithm,this.canonical)}async signOrLeft(e,t){let n=this.toolkit.canonicalize(await this.toolkit.build({$:{xmlns:I2},...e},{rootName:"SignedInfo"}),this.canonical);return await this.certificateRepository.sign(n,t,this.algorithm)}get transforms(){return{Transform:[{$:{Algorithm:"http://www.w3.org/2000/09/xmldsig#enveloped-signature"}},{$:{Algorithm:"http://www.w3.org/TR/2001/REC-xml-c14n-20010315"}}]}}get digestAlgorithm(){switch(this.algorithm){case Cu.SHA256:return B2.SHA256;case Cu.SHA1:return B2.SHA1;default:return D2(this.algorithm)}}get signatureMethod(){switch(this.algorithm){case Cu.SHA256:return _2.RSA_SHA256;case Cu.SHA1:return _2.RSA_SHA1;default:return D2(this.algorithm)}}};var R2=class{static{o(this,"Left")}value;constructor(e){this.value=e}isLeft(){return!0}isRight(){return!1}},ew=class{static{o(this,"Right")}value;constructor(e){this.value=e}isLeft(){return!1}isRight(){return!0}},ti=o(r=>new R2(r),"left"),ri=o(r=>r===void 0?new ew(void 0):new ew(r),"right");var gO=class extends Zh{static{o(this,"EntitySigner")}async sign(e,t,n){let{tag:s,mark:i}=t,{privateKey:a,certificate:u}=n;if(!e[s])return ti(new pn(`Node ${String(s)} not found`));let c=await this.toolkit.build(this.ns(e,s),{headless:!0,rootName:String(s),renderOpts:{pretty:!1}}),f=this.signedInfo(c,i),h=await this.signOrLeft(f,a);if(h.isLeft())return h;let m=e;return m.Signature=this.assemble(f,h.value,u),ri(m)}ns(e,t){let n=e.$?.xmlns,{$:s,...i}=e[t],{xmlns:a,...u}=s??{};return{$:{xmlns:n,...u},...i}}};var vO=class extends Zh{static{o(this,"XmlSigner")}async sign(e,t,n){let{tag:s,mark:i}=t,{privateKey:a,certificate:u}=n,c=this.toolkit.getNode(e,s);if(!c)return ti(new pn(`Node ${s} not found`));let f=this.signedInfo(c,i),h=await this.signOrLeft(f,a);if(h.isLeft())return h;let m=await this.toolkit.build(this.assemble(f,h.value,u),{rootName:"Signature"});return ri(this.toolkit.appendNode(e,m))}};import"reflect-metadata";var $0="__SkipValidation__",ape=o(()=>(r,e)=>{Reflect.defineMetadata($0,!0,r,e.toString())},"SkipValidation"),ope=o(()=>r=>{Reflect.defineMetadata($0,!0,r)},"SkipAllValidations");import{plainToInstance as IW}from"class-transformer";var tw=o(r=>{for(let[e,t]of Object.entries(r))typeof t>"u"&&delete r[e],t===""&&delete r[e],t&&typeof t=="object"&&tw(t)},"clearEmptyValues"),yO=o((r,e,t={})=>{let n=IW(e,r);return t.clearEmptyValues&&tw(n),n},"plainToInstance");import"reflect-metadata";import{validateSync as _W}from"class-validator";var xO="__ValidateErrors__",wO=o((r,e)=>r.reduce((t,n)=>{if(n.children?.length)return t.concat(wO(n.children,e?`${e}.${n.property}`:n.property));let s=Object.values(n.constraints??{}).map(i=>e?`${e}.${i}`:i).join(", ");return s?t.concat(s):t},[]),"mapConstraintsToErrors"),vpe=o(r=>(e,t,n)=>{let s=n.value;n.value=function(...i){let a=Reflect.getMetadata($0,this.constructor);if(Reflect.getMetadata($0,this.constructor.prototype,t.toString())===!0||a===!0)return s?.apply(this,i);let[c,...f]=i,h=yO(c,r),m=_W(h,{whitelist:!0});if(tw(h),m.length){let g=Reflect.getMetadata(xO,this)??[];Reflect.defineMetadata(xO,g.concat(wO(m,s?.name)),this)}return s?.apply(this,[h,...f])}},"Validates");var ep=9e15,_u=1e9,P2="0123456789abcdef",sw="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",iw="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",O2={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-ep,maxE:ep,crypto:!1},AO,Ao,_t=!0,ow="[DecimalError] ",Iu=ow+"Invalid argument: ",CO=ow+"Precision limit exceeded",NO=ow+"crypto unavailable",TO="[object Decimal]",ns=Math.floor,Sn=Math.pow,BW=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,DW=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,RW=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,IO=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Qi=1e7,bt=7,PW=9007199254740991,OW=sw.length-1,k2=iw.length-1,Pe={toStringTag:TO};Pe.absoluteValue=Pe.abs=function(){var r=new this.constructor(this);return r.s<0&&(r.s=1),gt(r)};Pe.ceil=function(){return gt(new this.constructor(this),this.e+1,2)};Pe.clampedTo=Pe.clamp=function(r,e){var t,n=this,s=n.constructor;if(r=new s(r),e=new s(e),!r.s||!e.s)return new s(NaN);if(r.gt(e))throw Error(Iu+e);return t=n.cmp(r),t<0?r:n.cmp(e)>0?e:new s(n)};Pe.comparedTo=Pe.cmp=function(r){var e,t,n,s,i=this,a=i.d,u=(r=new i.constructor(r)).d,c=i.s,f=r.s;if(!a||!u)return!c||!f?NaN:c!==f?c:a===u?0:!a^c<0?1:-1;if(!a[0]||!u[0])return a[0]?c:u[0]?-f:0;if(c!==f)return c;if(i.e!==r.e)return i.e>r.e^c<0?1:-1;for(n=a.length,s=u.length,e=0,t=n<s?n:s;e<t;++e)if(a[e]!==u[e])return a[e]>u[e]^c<0?1:-1;return n===s?0:n>s^c<0?1:-1};Pe.cosine=Pe.cos=function(){var r,e,t=this,n=t.constructor;return t.d?t.d[0]?(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+bt,n.rounding=1,t=kW(n,PO(n,t)),n.precision=r,n.rounding=e,gt(Ao==2||Ao==3?t.neg():t,r,e,!0)):new n(1):new n(NaN)};Pe.cubeRoot=Pe.cbrt=function(){var r,e,t,n,s,i,a,u,c,f,h=this,m=h.constructor;if(!h.isFinite()||h.isZero())return new m(h);for(_t=!1,i=h.s*Sn(h.s*h,1/3),!i||Math.abs(i)==1/0?(t=Fn(h.d),r=h.e,(i=(r-t.length+1)%3)&&(t+=i==1||i==-2?"0":"00"),i=Sn(t,1/3),r=ns((r+1)/3)-(r%3==(r<0?-1:2)),i==1/0?t="5e"+r:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+r),n=new m(t),n.s=h.s):n=new m(i.toString()),a=(r=m.precision)+3;;)if(u=n,c=u.times(u).times(u),f=c.plus(h),n=Tr(f.plus(h).times(u),f.plus(c),a+2,1),Fn(u.d).slice(0,a)===(t=Fn(n.d)).slice(0,a))if(t=t.slice(a-3,a+1),t=="9999"||!s&&t=="4999"){if(!s&&(gt(u,r+1,0),u.times(u).times(u).eq(h))){n=u;break}a+=4,s=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(gt(n,r+1,1),e=!n.times(n).times(n).eq(h));break}return _t=!0,gt(n,r,m.rounding,e)};Pe.decimalPlaces=Pe.dp=function(){var r,e=this.d,t=NaN;if(e){if(r=e.length-1,t=(r-ns(this.e/bt))*bt,r=e[r],r)for(;r%10==0;r/=10)t--;t<0&&(t=0)}return t};Pe.dividedBy=Pe.div=function(r){return Tr(this,new this.constructor(r))};Pe.dividedToIntegerBy=Pe.divToInt=function(r){var e=this,t=e.constructor;return gt(Tr(e,new t(r),0,1,1),t.precision,t.rounding)};Pe.equals=Pe.eq=function(r){return this.cmp(r)===0};Pe.floor=function(){return gt(new this.constructor(this),this.e+1,3)};Pe.greaterThan=Pe.gt=function(r){return this.cmp(r)>0};Pe.greaterThanOrEqualTo=Pe.gte=function(r){var e=this.cmp(r);return e==1||e===0};Pe.hyperbolicCosine=Pe.cosh=function(){var r,e,t,n,s,i=this,a=i.constructor,u=new a(1);if(!i.isFinite())return new a(i.s?1/0:NaN);if(i.isZero())return u;t=a.precision,n=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,s=i.d.length,s<32?(r=Math.ceil(s/3),e=(1/cw(4,r)).toString()):(r=16,e="2.3283064365386962890625e-10"),i=tp(a,1,i.times(e),new a(1),!0);for(var c,f=r,h=new a(8);f--;)c=i.times(i),i=u.minus(c.times(h.minus(c.times(h))));return gt(i,a.precision=t,a.rounding=n,!0)};Pe.hyperbolicSine=Pe.sinh=function(){var r,e,t,n,s=this,i=s.constructor;if(!s.isFinite()||s.isZero())return new i(s);if(e=i.precision,t=i.rounding,i.precision=e+Math.max(s.e,s.sd())+4,i.rounding=1,n=s.d.length,n<3)s=tp(i,2,s,s,!0);else{r=1.4*Math.sqrt(n),r=r>16?16:r|0,s=s.times(1/cw(5,r)),s=tp(i,2,s,s,!0);for(var a,u=new i(5),c=new i(16),f=new i(20);r--;)a=s.times(s),s=s.times(u.plus(a.times(c.times(a).plus(f))))}return i.precision=e,i.rounding=t,gt(s,e,t,!0)};Pe.hyperbolicTangent=Pe.tanh=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+7,n.rounding=1,Tr(t.sinh(),t.cosh(),n.precision=r,n.rounding=e)):new n(t.s)};Pe.inverseCosine=Pe.acos=function(){var r=this,e=r.constructor,t=r.abs().cmp(1),n=e.precision,s=e.rounding;return t!==-1?t===0?r.isNeg()?Na(e,n,s):new e(0):new e(NaN):r.isZero()?Na(e,n+4,s).times(.5):(e.precision=n+6,e.rounding=1,r=new e(1).minus(r).div(r.plus(1)).sqrt().atan(),e.precision=n,e.rounding=s,r.times(2))};Pe.inverseHyperbolicCosine=Pe.acosh=function(){var r,e,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(r=n.precision,e=n.rounding,n.precision=r+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,_t=!1,t=t.times(t).minus(1).sqrt().plus(t),_t=!0,n.precision=r,n.rounding=e,t.ln()):new n(t)};Pe.inverseHyperbolicSine=Pe.asinh=function(){var r,e,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,_t=!1,t=t.times(t).plus(1).sqrt().plus(t),_t=!0,n.precision=r,n.rounding=e,t.ln())};Pe.inverseHyperbolicTangent=Pe.atanh=function(){var r,e,t,n,s=this,i=s.constructor;return s.isFinite()?s.e>=0?new i(s.abs().eq(1)?s.s/0:s.isZero()?s:NaN):(r=i.precision,e=i.rounding,n=s.sd(),Math.max(n,r)<2*-s.e-1?gt(new i(s),r,e,!0):(i.precision=t=n-s.e,s=Tr(s.plus(1),new i(1).minus(s),t+r,1),i.precision=r+4,i.rounding=1,s=s.ln(),i.precision=r,i.rounding=e,s.times(.5))):new i(NaN)};Pe.inverseSine=Pe.asin=function(){var r,e,t,n,s=this,i=s.constructor;return s.isZero()?new i(s):(e=s.abs().cmp(1),t=i.precision,n=i.rounding,e!==-1?e===0?(r=Na(i,t+4,n).times(.5),r.s=s.s,r):new i(NaN):(i.precision=t+6,i.rounding=1,s=s.div(new i(1).minus(s.times(s)).sqrt().plus(1)).atan(),i.precision=t,i.rounding=n,s.times(2)))};Pe.inverseTangent=Pe.atan=function(){var r,e,t,n,s,i,a,u,c,f=this,h=f.constructor,m=h.precision,g=h.rounding;if(f.isFinite()){if(f.isZero())return new h(f);if(f.abs().eq(1)&&m+4<=k2)return a=Na(h,m+4,g).times(.25),a.s=f.s,a}else{if(!f.s)return new h(NaN);if(m+4<=k2)return a=Na(h,m+4,g).times(.5),a.s=f.s,a}for(h.precision=u=m+10,h.rounding=1,t=Math.min(28,u/bt+2|0),r=t;r;--r)f=f.div(f.times(f).plus(1).sqrt().plus(1));for(_t=!1,e=Math.ceil(u/bt),n=1,c=f.times(f),a=new h(f),s=f;r!==-1;)if(s=s.times(c),i=a.minus(s.div(n+=2)),s=s.times(c),a=i.plus(s.div(n+=2)),a.d[e]!==void 0)for(r=e;a.d[r]===i.d[r]&&r--;);return t&&(a=a.times(2<<t-1)),_t=!0,gt(a,h.precision=m,h.rounding=g,!0)};Pe.isFinite=function(){return!!this.d};Pe.isInteger=Pe.isInt=function(){return!!this.d&&ns(this.e/bt)>this.d.length-2};Pe.isNaN=function(){return!this.s};Pe.isNegative=Pe.isNeg=function(){return this.s<0};Pe.isPositive=Pe.isPos=function(){return this.s>0};Pe.isZero=function(){return!!this.d&&this.d[0]===0};Pe.lessThan=Pe.lt=function(r){return this.cmp(r)<0};Pe.lessThanOrEqualTo=Pe.lte=function(r){return this.cmp(r)<1};Pe.logarithm=Pe.log=function(r){var e,t,n,s,i,a,u,c,f=this,h=f.constructor,m=h.precision,g=h.rounding,x=5;if(r==null)r=new h(10),e=!0;else{if(r=new h(r),t=r.d,r.s<0||!t||!t[0]||r.eq(1))return new h(NaN);e=r.eq(10)}if(t=f.d,f.s<0||!t||!t[0]||f.eq(1))return new h(t&&!t[0]?-1/0:f.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)i=!0;else{for(s=t[0];s%10===0;)s/=10;i=s!==1}if(_t=!1,u=m+x,a=Tu(f,u),n=e?aw(h,u+10):Tu(r,u),c=Tr(a,n,u,1),G0(c.d,s=m,g))do if(u+=10,a=Tu(f,u),n=e?aw(h,u+10):Tu(r,u),c=Tr(a,n,u,1),!i){+Fn(c.d).slice(s+1,s+15)+1==1e14&&(c=gt(c,m+1,0));break}while(G0(c.d,s+=10,g));return _t=!0,gt(c,m,g)};Pe.minus=Pe.sub=function(r){var e,t,n,s,i,a,u,c,f,h,m,g,x=this,v=x.constructor;if(r=new v(r),!x.d||!r.d)return!x.s||!r.s?r=new v(NaN):x.d?r.s=-r.s:r=new v(r.d||x.s!==r.s?x:NaN),r;if(x.s!=r.s)return r.s=-r.s,x.plus(r);if(f=x.d,g=r.d,u=v.precision,c=v.rounding,!f[0]||!g[0]){if(g[0])r.s=-r.s;else if(f[0])r=new v(x);else return new v(c===3?-0:0);return _t?gt(r,u,c):r}if(t=ns(r.e/bt),h=ns(x.e/bt),f=f.slice(),i=h-t,i){for(m=i<0,m?(e=f,i=-i,a=g.length):(e=g,t=h,a=f.length),n=Math.max(Math.ceil(u/bt),a)+2,i>n&&(i=n,e.length=1),e.reverse(),n=i;n--;)e.push(0);e.reverse()}else{for(n=f.length,a=g.length,m=n<a,m&&(a=n),n=0;n<a;n++)if(f[n]!=g[n]){m=f[n]<g[n];break}i=0}for(m&&(e=f,f=g,g=e,r.s=-r.s),a=f.length,n=g.length-a;n>0;--n)f[a++]=0;for(n=g.length;n>i;){if(f[--n]<g[n]){for(s=n;s&&f[--s]===0;)f[s]=Qi-1;--f[s],f[n]+=Qi}f[n]-=g[n]}for(;f[--a]===0;)f.pop();for(;f[0]===0;f.shift())--t;return f[0]?(r.d=f,r.e=uw(f,t),_t?gt(r,u,c):r):new v(c===3?-0:0)};Pe.modulo=Pe.mod=function(r){var e,t=this,n=t.constructor;return r=new n(r),!t.d||!r.s||r.d&&!r.d[0]?new n(NaN):!r.d||t.d&&!t.d[0]?gt(new n(t),n.precision,n.rounding):(_t=!1,n.modulo==9?(e=Tr(t,r.abs(),0,3,1),e.s*=r.s):e=Tr(t,r,0,n.modulo,1),e=e.times(r),_t=!0,t.minus(e))};Pe.naturalExponential=Pe.exp=function(){return L2(this)};Pe.naturalLogarithm=Pe.ln=function(){return Tu(this)};Pe.negated=Pe.neg=function(){var r=new this.constructor(this);return r.s=-r.s,gt(r)};Pe.plus=Pe.add=function(r){var e,t,n,s,i,a,u,c,f,h,m=this,g=m.constructor;if(r=new g(r),!m.d||!r.d)return!m.s||!r.s?r=new g(NaN):m.d||(r=new g(r.d||m.s===r.s?m:NaN)),r;if(m.s!=r.s)return r.s=-r.s,m.minus(r);if(f=m.d,h=r.d,u=g.precision,c=g.rounding,!f[0]||!h[0])return h[0]||(r=new g(m)),_t?gt(r,u,c):r;if(i=ns(m.e/bt),n=ns(r.e/bt),f=f.slice(),s=i-n,s){for(s<0?(t=f,s=-s,a=h.length):(t=h,n=i,a=f.length),i=Math.ceil(u/bt),a=i>a?i+1:a+1,s>a&&(s=a,t.length=1),t.reverse();s--;)t.push(0);t.reverse()}for(a=f.length,s=h.length,a-s<0&&(s=a,t=h,h=f,f=t),e=0;s;)e=(f[--s]=f[s]+h[s]+e)/Qi|0,f[s]%=Qi;for(e&&(f.unshift(e),++n),a=f.length;f[--a]==0;)f.pop();return r.d=f,r.e=uw(f,n),_t?gt(r,u,c):r};Pe.precision=Pe.sd=function(r){var e,t=this;if(r!==void 0&&r!==!!r&&r!==1&&r!==0)throw Error(Iu+r);return t.d?(e=_O(t.d),r&&t.e+1>e&&(e=t.e+1)):e=NaN,e};Pe.round=function(){var r=this,e=r.constructor;return gt(new e(r),r.e+1,e.rounding)};Pe.sine=Pe.sin=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+bt,n.rounding=1,t=VW(n,PO(n,t)),n.precision=r,n.rounding=e,gt(Ao>2?t.neg():t,r,e,!0)):new n(NaN)};Pe.squareRoot=Pe.sqrt=function(){var r,e,t,n,s,i,a=this,u=a.d,c=a.e,f=a.s,h=a.constructor;if(f!==1||!u||!u[0])return new h(!f||f<0&&(!u||u[0])?NaN:u?a:1/0);for(_t=!1,f=Math.sqrt(+a),f==0||f==1/0?(e=Fn(u),(e.length+c)%2==0&&(e+="0"),f=Math.sqrt(e),c=ns((c+1)/2)-(c<0||c%2),f==1/0?e="5e"+c:(e=f.toExponential(),e=e.slice(0,e.indexOf("e")+1)+c),n=new h(e)):n=new h(f.toString()),t=(c=h.precision)+3;;)if(i=n,n=i.plus(Tr(a,i,t+2,1)).times(.5),Fn(i.d).slice(0,t)===(e=Fn(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!s&&e=="4999"){if(!s&&(gt(i,c+1,0),i.times(i).eq(a))){n=i;break}t+=4,s=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(gt(n,c+1,1),r=!n.times(n).eq(a));break}return _t=!0,gt(n,c,h.rounding,r)};Pe.tangent=Pe.tan=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+10,n.rounding=1,t=t.sin(),t.s=1,t=Tr(t,new n(1).minus(t.times(t)).sqrt(),r+10,0),n.precision=r,n.rounding=e,gt(Ao==2||Ao==4?t.neg():t,r,e,!0)):new n(NaN)};Pe.times=Pe.mul=function(r){var e,t,n,s,i,a,u,c,f,h=this,m=h.constructor,g=h.d,x=(r=new m(r)).d;if(r.s*=h.s,!g||!g[0]||!x||!x[0])return new m(!r.s||g&&!g[0]&&!x||x&&!x[0]&&!g?NaN:!g||!x?r.s/0:r.s*0);for(t=ns(h.e/bt)+ns(r.e/bt),c=g.length,f=x.length,c<f&&(i=g,g=x,x=i,a=c,c=f,f=a),i=[],a=c+f,n=a;n--;)i.push(0);for(n=f;--n>=0;){for(e=0,s=c+n;s>n;)u=i[s]+x[n]*g[s-n-1]+e,i[s--]=u%Qi|0,e=u/Qi|0;i[s]=(i[s]+e)%Qi|0}for(;!i[--a];)i.pop();return e?++t:i.shift(),r.d=i,r.e=uw(i,t),_t?gt(r,m.precision,m.rounding):r};Pe.toBinary=function(r,e){return V2(this,2,r,e)};Pe.toDecimalPlaces=Pe.toDP=function(r,e){var t=this,n=t.constructor;return t=new n(t),r===void 0?t:(Is(r,0,_u),e===void 0?e=n.rounding:Is(e,0,8),gt(t,r+t.e+1,e))};Pe.toExponential=function(r,e){var t,n=this,s=n.constructor;return r===void 0?t=Ta(n,!0):(Is(r,0,_u),e===void 0?e=s.rounding:Is(e,0,8),n=gt(new s(n),r+1,e),t=Ta(n,!0,r+1)),n.isNeg()&&!n.isZero()?"-"+t:t};Pe.toFixed=function(r,e){var t,n,s=this,i=s.constructor;return r===void 0?t=Ta(s):(Is(r,0,_u),e===void 0?e=i.rounding:Is(e,0,8),n=gt(new i(s),r+s.e+1,e),t=Ta(n,!1,r+n.e+1)),s.isNeg()&&!s.isZero()?"-"+t:t};Pe.toFraction=function(r){var e,t,n,s,i,a,u,c,f,h,m,g,x=this,v=x.d,w=x.constructor;if(!v)return new w(x);if(f=t=new w(1),n=c=new w(0),e=new w(n),i=e.e=_O(v)-x.e-1,a=i%bt,e.d[0]=Sn(10,a<0?bt+a:a),r==null)r=i>0?e:f;else{if(u=new w(r),!u.isInt()||u.lt(f))throw Error(Iu+u);r=u.gt(e)?i>0?e:f:u}for(_t=!1,u=new w(Fn(v)),h=w.precision,w.precision=i=v.length*bt*2;m=Tr(u,e,0,1,1),s=t.plus(m.times(n)),s.cmp(r)!=1;)t=n,n=s,s=f,f=c.plus(m.times(s)),c=s,s=e,e=u.minus(m.times(s)),u=s;return s=Tr(r.minus(t),n,0,1,1),c=c.plus(s.times(f)),t=t.plus(s.times(n)),c.s=f.s=x.s,g=Tr(f,n,i,1).minus(x).abs().cmp(Tr(c,t,i,1).minus(x).abs())<1?[f,n]:[c,t],w.precision=h,_t=!0,g};Pe.toHexadecimal=Pe.toHex=function(r,e){return V2(this,16,r,e)};Pe.toNearest=function(r,e){var t=this,n=t.constructor;if(t=new n(t),r==null){if(!t.d)return t;r=new n(1),e=n.rounding}else{if(r=new n(r),e===void 0?e=n.rounding:Is(e,0,8),!t.d)return r.s?t:r;if(!r.d)return r.s&&(r.s=t.s),r}return r.d[0]?(_t=!1,t=Tr(t,r,0,e,1).times(r),_t=!0,gt(t)):(r.s=t.s,t=r),t};Pe.toNumber=function(){return+this};Pe.toOctal=function(r,e){return V2(this,8,r,e)};Pe.toPower=Pe.pow=function(r){var e,t,n,s,i,a,u=this,c=u.constructor,f=+(r=new c(r));if(!u.d||!r.d||!u.d[0]||!r.d[0])return new c(Sn(+u,f));if(u=new c(u),u.eq(1))return u;if(n=c.precision,i=c.rounding,r.eq(1))return gt(u,n,i);if(e=ns(r.e/bt),e>=r.d.length-1&&(t=f<0?-f:f)<=PW)return s=BO(c,u,t,n),r.s<0?new c(1).div(s):gt(s,n,i);if(a=u.s,a<0){if(e<r.d.length-1)return new c(NaN);if((r.d[e]&1)==0&&(a=1),u.e==0&&u.d[0]==1&&u.d.length==1)return u.s=a,u}return t=Sn(+u,f),e=t==0||!isFinite(t)?ns(f*(Math.log("0."+Fn(u.d))/Math.LN10+u.e+1)):new c(t+"").e,e>c.maxE+1||e<c.minE-1?new c(e>0?a/0:0):(_t=!1,c.rounding=u.s=1,t=Math.min(12,(e+"").length),s=L2(r.times(Tu(u,n+t)),n),s.d&&(s=gt(s,n+5,1),G0(s.d,n,i)&&(e=n+10,s=gt(L2(r.times(Tu(u,e+t)),e),e+5,1),+Fn(s.d).slice(n+1,n+15)+1==1e14&&(s=gt(s,n+1,0)))),s.s=a,_t=!0,c.rounding=i,gt(s,n,i))};Pe.toPrecision=function(r,e){var t,n=this,s=n.constructor;return r===void 0?t=Ta(n,n.e<=s.toExpNeg||n.e>=s.toExpPos):(Is(r,1,_u),e===void 0?e=s.rounding:Is(e,0,8),n=gt(new s(n),r,e),t=Ta(n,r<=n.e||n.e<=s.toExpNeg,r)),n.isNeg()&&!n.isZero()?"-"+t:t};Pe.toSignificantDigits=Pe.toSD=function(r,e){var t=this,n=t.constructor;return r===void 0?(r=n.precision,e=n.rounding):(Is(r,1,_u),e===void 0?e=n.rounding:Is(e,0,8)),gt(new n(t),r,e)};Pe.toString=function(){var r=this,e=r.constructor,t=Ta(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()&&!r.isZero()?"-"+t:t};Pe.truncated=Pe.trunc=function(){return gt(new this.constructor(this),this.e+1,1)};Pe.valueOf=Pe.toJSON=function(){var r=this,e=r.constructor,t=Ta(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()?"-"+t:t};function Fn(r){var e,t,n,s=r.length-1,i="",a=r[0];if(s>0){for(i+=a,e=1;e<s;e++)n=r[e]+"",t=bt-n.length,t&&(i+=Nu(t)),i+=n;a=r[e],n=a+"",t=bt-n.length,t&&(i+=Nu(t))}else if(a===0)return"0";for(;a%10===0;)a/=10;return i+a}o(Fn,"digitsToString");function Is(r,e,t){if(r!==~~r||r<e||r>t)throw Error(Iu+r)}o(Is,"checkInt32");function G0(r,e,t,n){var s,i,a,u;for(i=r[0];i>=10;i/=10)--e;return--e<0?(e+=bt,s=0):(s=Math.ceil((e+1)/bt),e%=bt),i=Sn(10,bt-e),u=r[s]%i|0,n==null?e<3?(e==0?u=u/100|0:e==1&&(u=u/10|0),a=t<4&&u==99999||t>3&&u==49999||u==5e4||u==0):a=(t<4&&u+1==i||t>3&&u+1==i/2)&&(r[s+1]/i/100|0)==Sn(10,e-2)-1||(u==i/2||u==0)&&(r[s+1]/i/100|0)==0:e<4?(e==0?u=u/1e3|0:e==1?u=u/100|0:e==2&&(u=u/10|0),a=(n||t<4)&&u==9999||!n&&t>3&&u==4999):a=((n||t<4)&&u+1==i||!n&&t>3&&u+1==i/2)&&(r[s+1]/i/1e3|0)==Sn(10,e-3)-1,a}o(G0,"checkRoundingDigits");function rw(r,e,t){for(var n,s=[0],i,a=0,u=r.length;a<u;){for(i=s.length;i--;)s[i]*=e;for(s[0]+=P2.indexOf(r.charAt(a++)),n=0;n<s.length;n++)s[n]>t-1&&(s[n+1]===void 0&&(s[n+1]=0),s[n+1]+=s[n]/t|0,s[n]%=t)}return s.reverse()}o(rw,"convertBase");function kW(r,e){var t,n,s;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),s=(1/cw(4,t)).toString()):(t=16,s="2.3283064365386962890625e-10"),r.precision+=t,e=tp(r,1,e.times(s),new r(1));for(var i=t;i--;){var a=e.times(e);e=a.times(a).minus(a).times(8).plus(1)}return r.precision-=t,e}o(kW,"cosine");var Tr=(function(){function r(n,s,i){var a,u=0,c=n.length;for(n=n.slice();c--;)a=n[c]*s+u,n[c]=a%i|0,u=a/i|0;return u&&n.unshift(u),n}o(r,"multiplyInteger");function e(n,s,i,a){var u,c;if(i!=a)c=i>a?1:-1;else for(u=c=0;u<i;u++)if(n[u]!=s[u]){c=n[u]>s[u]?1:-1;break}return c}o(e,"compare");function t(n,s,i,a){for(var u=0;i--;)n[i]-=u,u=n[i]<s[i]?1:0,n[i]=u*a+n[i]-s[i];for(;!n[0]&&n.length>1;)n.shift()}return o(t,"subtract"),function(n,s,i,a,u,c){var f,h,m,g,x,v,w,S,A,T,b,E,C,_,F,R,q,H,K,X,pe=n.constructor,le=n.s==s.s?1:-1,ue=n.d,ee=s.d;if(!ue||!ue[0]||!ee||!ee[0])return new pe(!n.s||!s.s||(ue?ee&&ue[0]==ee[0]:!ee)?NaN:ue&&ue[0]==0||!ee?le*0:le/0);for(c?(x=1,h=n.e-s.e):(c=Qi,x=bt,h=ns(n.e/x)-ns(s.e/x)),K=ee.length,q=ue.length,A=new pe(le),T=A.d=[],m=0;ee[m]==(ue[m]||0);m++);if(ee[m]>(ue[m]||0)&&h--,i==null?(_=i=pe.precision,a=pe.rounding):u?_=i+(n.e-s.e)+1:_=i,_<0)T.push(1),v=!0;else{if(_=_/x+2|0,m=0,K==1){for(g=0,ee=ee[0],_++;(m<q||g)&&_--;m++)F=g*c+(ue[m]||0),T[m]=F/ee|0,g=F%ee|0;v=g||m<q}else{for(g=c/(ee[0]+1)|0,g>1&&(ee=r(ee,g,c),ue=r(ue,g,c),K=ee.length,q=ue.length),R=K,b=ue.slice(0,K),E=b.length;E<K;)b[E++]=0;X=ee.slice(),X.unshift(0),H=ee[0],ee[1]>=c/2&&++H;do g=0,f=e(ee,b,K,E),f<0?(C=b[0],K!=E&&(C=C*c+(b[1]||0)),g=C/H|0,g>1?(g>=c&&(g=c-1),w=r(ee,g,c),S=w.length,E=b.length,f=e(w,b,S,E),f==1&&(g--,t(w,K<S?X:ee,S,c))):(g==0&&(f=g=1),w=ee.slice()),S=w.length,S<E&&w.unshift(0),t(b,w,E,c),f==-1&&(E=b.length,f=e(ee,b,K,E),f<1&&(g++,t(b,K<E?X:ee,E,c))),E=b.length):f===0&&(g++,b=[0]),T[m++]=g,f&&b[0]?b[E++]=ue[R]||0:(b=[ue[R]],E=1);while((R++<q||b[0]!==void 0)&&_--);v=b[0]!==void 0}T[0]||T.shift()}if(x==1)A.e=h,AO=v;else{for(m=1,g=T[0];g>=10;g/=10)m++;A.e=m+h*x-1,gt(A,u?i+A.e+1:i,a,v)}return A}})();function gt(r,e,t,n){var s,i,a,u,c,f,h,m,g,x=r.constructor;e:if(e!=null){if(m=r.d,!m)return r;for(s=1,u=m[0];u>=10;u/=10)s++;if(i=e-s,i<0)i+=bt,a=e,h=m[g=0],c=h/Sn(10,s-a-1)%10|0;else if(g=Math.ceil((i+1)/bt),u=m.length,g>=u)if(n){for(;u++<=g;)m.push(0);h=c=0,s=1,i%=bt,a=i-bt+1}else break e;else{for(h=u=m[g],s=1;u>=10;u/=10)s++;i%=bt,a=i-bt+s,c=a<0?0:h/Sn(10,s-a-1)%10|0}if(n=n||e<0||m[g+1]!==void 0||(a<0?h:h%Sn(10,s-a-1)),f=t<4?(c||n)&&(t==0||t==(r.s<0?3:2)):c>5||c==5&&(t==4||n||t==6&&(i>0?a>0?h/Sn(10,s-a):0:m[g-1])%10&1||t==(r.s<0?8:7)),e<1||!m[0])return m.length=0,f?(e-=r.e+1,m[0]=Sn(10,(bt-e%bt)%bt),r.e=-e||0):m[0]=r.e=0,r;if(i==0?(m.length=g,u=1,g--):(m.length=g+1,u=Sn(10,bt-i),m[g]=a>0?(h/Sn(10,s-a)%Sn(10,a)|0)*u:0),f)for(;;)if(g==0){for(i=1,a=m[0];a>=10;a/=10)i++;for(a=m[0]+=u,u=1;a>=10;a/=10)u++;i!=u&&(r.e++,m[0]==Qi&&(m[0]=1));break}else{if(m[g]+=u,m[g]!=Qi)break;m[g--]=0,u=1}for(i=m.length;m[--i]===0;)m.pop()}return _t&&(r.e>x.maxE?(r.d=null,r.e=NaN):r.e<x.minE&&(r.e=0,r.d=[0])),r}o(gt,"finalise");function Ta(r,e,t){if(!r.isFinite())return RO(r);var n,s=r.e,i=Fn(r.d),a=i.length;return e?(t&&(n=t-a)>0?i=i.charAt(0)+"."+i.slice(1)+Nu(n):a>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(r.e<0?"e":"e+")+r.e):s<0?(i="0."+Nu(-s-1)+i,t&&(n=t-a)>0&&(i+=Nu(n))):s>=a?(i+=Nu(s+1-a),t&&(n=t-s-1)>0&&(i=i+"."+Nu(n))):((n=s+1)<a&&(i=i.slice(0,n)+"."+i.slice(n)),t&&(n=t-a)>0&&(s+1===a&&(i+="."),i+=Nu(n))),i}o(Ta,"finiteToString");function uw(r,e){var t=r[0];for(e*=bt;t>=10;t/=10)e++;return e}o(uw,"getBase10Exponent");function aw(r,e,t){if(e>OW)throw _t=!0,t&&(r.precision=t),Error(CO);return gt(new r(sw),e,1,!0)}o(aw,"getLn10");function Na(r,e,t){if(e>k2)throw Error(CO);return gt(new r(iw),e,t,!0)}o(Na,"getPi");function _O(r){var e=r.length-1,t=e*bt+1;if(e=r[e],e){for(;e%10==0;e/=10)t--;for(e=r[0];e>=10;e/=10)t++}return t}o(_O,"getPrecision");function Nu(r){for(var e="";r--;)e+="0";return e}o(Nu,"getZeroString");function BO(r,e,t,n){var s,i=new r(1),a=Math.ceil(n/bt+4);for(_t=!1;;){if(t%2&&(i=i.times(e),bO(i.d,a)&&(s=!0)),t=ns(t/2),t===0){t=i.d.length-1,s&&i.d[t]===0&&++i.d[t];break}e=e.times(e),bO(e.d,a)}return _t=!0,i}o(BO,"intPow");function SO(r){return r.d[r.d.length-1]&1}o(SO,"isOdd");function DO(r,e,t){for(var n,s,i=new r(e[0]),a=0;++a<e.length;){if(s=new r(e[a]),!s.s){i=s;break}n=i.cmp(s),(n===t||n===0&&i.s===t)&&(i=s)}return i}o(DO,"maxOrMin");function L2(r,e){var t,n,s,i,a,u,c,f=0,h=0,m=0,g=r.constructor,x=g.rounding,v=g.precision;if(!r.d||!r.d[0]||r.e>17)return new g(r.d?r.d[0]?r.s<0?0:1/0:1:r.s?r.s<0?0:r:NaN);for(e==null?(_t=!1,c=v):c=e,u=new g(.03125);r.e>-2;)r=r.times(u),m+=5;for(n=Math.log(Sn(2,m))/Math.LN10*2+5|0,c+=n,t=i=a=new g(1),g.precision=c;;){if(i=gt(i.times(r),c,1),t=t.times(++h),u=a.plus(Tr(i,t,c,1)),Fn(u.d).slice(0,c)===Fn(a.d).slice(0,c)){for(s=m;s--;)a=gt(a.times(a),c,1);if(e==null)if(f<3&&G0(a.d,c-n,x,f))g.precision=c+=10,t=i=u=new g(1),h=0,f++;else return gt(a,g.precision=v,x,_t=!0);else return g.precision=v,a}a=u}}o(L2,"naturalExponential");function Tu(r,e){var t,n,s,i,a,u,c,f,h,m,g,x=1,v=10,w=r,S=w.d,A=w.constructor,T=A.rounding,b=A.precision;if(w.s<0||!S||!S[0]||!w.e&&S[0]==1&&S.length==1)return new A(S&&!S[0]?-1/0:w.s!=1?NaN:S?0:w);if(e==null?(_t=!1,h=b):h=e,A.precision=h+=v,t=Fn(S),n=t.charAt(0),Math.abs(i=w.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)w=w.times(r),t=Fn(w.d),n=t.charAt(0),x++;i=w.e,n>1?(w=new A("0."+t),i++):w=new A(n+"."+t.slice(1))}else return f=aw(A,h+2,b).times(i+""),w=Tu(new A(n+"."+t.slice(1)),h-v).plus(f),A.precision=b,e==null?gt(w,b,T,_t=!0):w;for(m=w,c=a=w=Tr(w.minus(1),w.plus(1),h,1),g=gt(w.times(w),h,1),s=3;;){if(a=gt(a.times(g),h,1),f=c.plus(Tr(a,new A(s),h,1)),Fn(f.d).slice(0,h)===Fn(c.d).slice(0,h))if(c=c.times(2),i!==0&&(c=c.plus(aw(A,h+2,b).times(i+""))),c=Tr(c,new A(x),h,1),e==null)if(G0(c.d,h-v,T,u))A.precision=h+=v,f=a=w=Tr(m.minus(1),m.plus(1),h,1),g=gt(w.times(w),h,1),s=u=1;else return gt(c,A.precision=b,T,_t=!0);else return A.precision=b,c;c=f,s+=2}}o(Tu,"naturalLogarithm");function RO(r){return String(r.s*r.s/0)}o(RO,"nonFiniteToString");function nw(r,e){var t,n,s;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(t<0&&(t=n),t+=+e.slice(n+1),e=e.substring(0,n)):t<0&&(t=e.length),n=0;e.charCodeAt(n)===48;n++);for(s=e.length;e.charCodeAt(s-1)===48;--s);if(e=e.slice(n,s),e){if(s-=n,r.e=t=t-n-1,r.d=[],n=(t+1)%bt,t<0&&(n+=bt),n<s){for(n&&r.d.push(+e.slice(0,n)),s-=bt;n<s;)r.d.push(+e.slice(n,n+=bt));e=e.slice(n),n=bt-e.length}else n-=s;for(;n--;)e+="0";r.d.push(+e),_t&&(r.e>r.constructor.maxE?(r.d=null,r.e=NaN):r.e<r.constructor.minE&&(r.e=0,r.d=[0]))}else r.e=0,r.d=[0];return r}o(nw,"parseDecimal");function LW(r,e){var t,n,s,i,a,u,c,f,h;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),IO.test(e))return nw(r,e)}else if(e==="Infinity"||e==="NaN")return+e||(r.s=NaN),r.e=NaN,r.d=null,r;if(DW.test(e))t=16,e=e.toLowerCase();else if(BW.test(e))t=2;else if(RW.test(e))t=8;else throw Error(Iu+e);for(i=e.search(/p/i),i>0?(c=+e.slice(i+1),e=e.substring(2,i)):e=e.slice(2),i=e.indexOf("."),a=i>=0,n=r.constructor,a&&(e=e.replace(".",""),u=e.length,i=u-i,s=BO(n,new n(t),i,i*2)),f=rw(e,t,Qi),h=f.length-1,i=h;f[i]===0;--i)f.pop();return i<0?new n(r.s*0):(r.e=uw(f,h),r.d=f,_t=!1,a&&(r=Tr(r,s,u*4)),c&&(r=r.times(Math.abs(c)<54?Sn(2,c):rp.pow(2,c))),_t=!0,r)}o(LW,"parseOther");function VW(r,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:tp(r,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/cw(5,t)),e=tp(r,2,e,e);for(var s,i=new r(5),a=new r(16),u=new r(20);t--;)s=e.times(e),e=e.times(i.plus(s.times(a.times(s).minus(u))));return e}o(VW,"sine");function tp(r,e,t,n,s){var i,a,u,c,f=1,h=r.precision,m=Math.ceil(h/bt);for(_t=!1,c=t.times(t),u=new r(n);;){if(a=Tr(u.times(c),new r(e++*e++),h,1),u=s?n.plus(a):n.minus(a),n=Tr(a.times(c),new r(e++*e++),h,1),a=u.plus(n),a.d[m]!==void 0){for(i=m;a.d[i]===u.d[i]&&i--;);if(i==-1)break}i=u,u=n,n=a,a=i,f++}return _t=!0,a.d.length=m+1,a}o(tp,"taylorSeries");function cw(r,e){for(var t=r;--e;)t*=r;return t}o(cw,"tinyPow");function PO(r,e){var t,n=e.s<0,s=Na(r,r.precision,1),i=s.times(.5);if(e=e.abs(),e.lte(i))return Ao=n?4:1,e;if(t=e.divToInt(s),t.isZero())Ao=n?3:2;else{if(e=e.minus(t.times(s)),e.lte(i))return Ao=SO(t)?n?2:3:n?4:1,e;Ao=SO(t)?n?1:4:n?3:2}return e.minus(s).abs()}o(PO,"toLessThanHalfPi");function V2(r,e,t,n){var s,i,a,u,c,f,h,m,g,x=r.constructor,v=t!==void 0;if(v?(Is(t,1,_u),n===void 0?n=x.rounding:Is(n,0,8)):(t=x.precision,n=x.rounding),!r.isFinite())h=RO(r);else{for(h=Ta(r),a=h.indexOf("."),v?(s=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):s=e,a>=0&&(h=h.replace(".",""),g=new x(1),g.e=h.length-a,g.d=rw(Ta(g),10,s),g.e=g.d.length),m=rw(h,10,s),i=c=m.length;m[--c]==0;)m.pop();if(!m[0])h=v?"0p+0":"0";else{if(a<0?i--:(r=new x(r),r.d=m,r.e=i,r=Tr(r,g,t,n,0,s),m=r.d,i=r.e,f=AO),a=m[t],u=s/2,f=f||m[t+1]!==void 0,f=n<4?(a!==void 0||f)&&(n===0||n===(r.s<0?3:2)):a>u||a===u&&(n===4||f||n===6&&m[t-1]&1||n===(r.s<0?8:7)),m.length=t,f)for(;++m[--t]>s-1;)m[t]=0,t||(++i,m.unshift(1));for(c=m.length;!m[c-1];--c);for(a=0,h="";a<c;a++)h+=P2.charAt(m[a]);if(v){if(c>1)if(e==16||e==8){for(a=e==16?4:3,--c;c%a;c++)h+="0";for(m=rw(h,s,e),c=m.length;!m[c-1];--c);for(a=1,h="1.";a<c;a++)h+=P2.charAt(m[a])}else h=h.charAt(0)+"."+h.slice(1);h=h+(i<0?"p":"p+")+i}else if(i<0){for(;++i;)h="0"+h;h="0."+h}else if(++i>c)for(i-=c;i--;)h+="0";else i<c&&(h=h.slice(0,i)+"."+h.slice(i))}h=(e==16?"0x":e==2?"0b":e==8?"0o":"")+h}return r.s<0?"-"+h:h}o(V2,"toStringBinary");function bO(r,e){if(r.length>e)return r.length=e,!0}o(bO,"truncate");function UW(r){return new this(r).abs()}o(UW,"abs");function jW(r){return new this(r).acos()}o(jW,"acos");function MW(r){return new this(r).acosh()}o(MW,"acosh");function FW(r,e){return new this(r).plus(e)}o(FW,"add");function qW(r){return new this(r).asin()}o(qW,"asin");function HW(r){return new this(r).asinh()}o(HW,"asinh");function KW(r){return new this(r).atan()}o(KW,"atan");function $W(r){return new this(r).atanh()}o($W,"atanh");function GW(r,e){r=new this(r),e=new this(e);var t,n=this.precision,s=this.rounding,i=n+4;return!r.s||!e.s?t=new this(NaN):!r.d&&!e.d?(t=Na(this,i,1).times(e.s>0?.25:.75),t.s=r.s):!e.d||r.isZero()?(t=e.s<0?Na(this,n,s):new this(0),t.s=r.s):!r.d||e.isZero()?(t=Na(this,i,1).times(.5),t.s=r.s):e.s<0?(this.precision=i,this.rounding=1,t=this.atan(Tr(r,e,i,1)),e=Na(this,i,1),this.precision=n,this.rounding=s,t=r.s<0?t.minus(e):t.plus(e)):t=this.atan(Tr(r,e,i,1)),t}o(GW,"atan2");function XW(r){return new this(r).cbrt()}o(XW,"cbrt");function WW(r){return gt(r=new this(r),r.e+1,2)}o(WW,"ceil");function zW(r,e,t){return new this(r).clamp(e,t)}o(zW,"clamp");function JW(r){if(!r||typeof r!="object")throw Error(ow+"Object expected");var e,t,n,s=r.defaults===!0,i=["precision",1,_u,"rounding",0,8,"toExpNeg",-ep,0,"toExpPos",0,ep,"maxE",0,ep,"minE",-ep,0,"modulo",0,9];for(e=0;e<i.length;e+=3)if(t=i[e],s&&(this[t]=O2[t]),(n=r[t])!==void 0)if(ns(n)===n&&n>=i[e+1]&&n<=i[e+2])this[t]=n;else throw Error(Iu+t+": "+n);if(t="crypto",s&&(this[t]=O2[t]),(n=r[t])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(NO);else this[t]=!1;else throw Error(Iu+t+": "+n);return this}o(JW,"config");function YW(r){return new this(r).cos()}o(YW,"cos");function QW(r){return new this(r).cosh()}o(QW,"cosh");function OO(r){var e,t,n;function s(i){var a,u,c,f=this;if(!(f instanceof s))return new s(i);if(f.constructor=s,EO(i)){f.s=i.s,_t?!i.d||i.e>s.maxE?(f.e=NaN,f.d=null):i.e<s.minE?(f.e=0,f.d=[0]):(f.e=i.e,f.d=i.d.slice()):(f.e=i.e,f.d=i.d?i.d.slice():i.d);return}if(c=typeof i,c==="number"){if(i===0){f.s=1/i<0?-1:1,f.e=0,f.d=[0];return}if(i<0?(i=-i,f.s=-1):f.s=1,i===~~i&&i<1e7){for(a=0,u=i;u>=10;u/=10)a++;_t?a>s.maxE?(f.e=NaN,f.d=null):a<s.minE?(f.e=0,f.d=[0]):(f.e=a,f.d=[i]):(f.e=a,f.d=[i]);return}if(i*0!==0){i||(f.s=NaN),f.e=NaN,f.d=null;return}return nw(f,i.toString())}if(c==="string")return(u=i.charCodeAt(0))===45?(i=i.slice(1),f.s=-1):(u===43&&(i=i.slice(1)),f.s=1),IO.test(i)?nw(f,i):LW(f,i);if(c==="bigint")return i<0?(i=-i,f.s=-1):f.s=1,nw(f,i.toString());throw Error(Iu+i)}if(o(s,"Decimal"),s.prototype=Pe,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.EUCLID=9,s.config=s.set=JW,s.clone=OO,s.isDecimal=EO,s.abs=UW,s.acos=jW,s.acosh=MW,s.add=FW,s.asin=qW,s.asinh=HW,s.atan=KW,s.atanh=$W,s.atan2=GW,s.cbrt=XW,s.ceil=WW,s.clamp=zW,s.cos=YW,s.cosh=QW,s.div=ZW,s.exp=ez,s.floor=tz,s.hypot=rz,s.ln=nz,s.log=sz,s.log10=az,s.log2=iz,s.max=oz,s.min=uz,s.mod=cz,s.mul=lz,s.pow=fz,s.random=hz,s.round=pz,s.sign=dz,s.sin=mz,s.sinh=gz,s.sqrt=vz,s.sub=yz,s.sum=xz,s.tan=wz,s.tanh=Sz,s.trunc=bz,r===void 0&&(r={}),r&&r.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)r.hasOwnProperty(t=n[e++])||(r[t]=this[t]);return s.config(r),s}o(OO,"clone");function ZW(r,e){return new this(r).div(e)}o(ZW,"div");function ez(r){return new this(r).exp()}o(ez,"exp");function tz(r){return gt(r=new this(r),r.e+1,3)}o(tz,"floor");function rz(){var r,e,t=new this(0);for(_t=!1,r=0;r<arguments.length;)if(e=new this(arguments[r++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return _t=!0,new this(1/0);t=e}return _t=!0,t.sqrt()}o(rz,"hypot");function EO(r){return r instanceof rp||r&&r.toStringTag===TO||!1}o(EO,"isDecimalInstance");function nz(r){return new this(r).ln()}o(nz,"ln");function sz(r,e){return new this(r).log(e)}o(sz,"log");function iz(r){return new this(r).log(2)}o(iz,"log2");function az(r){return new this(r).log(10)}o(az,"log10");function oz(){return DO(this,arguments,-1)}o(oz,"max");function uz(){return DO(this,arguments,1)}o(uz,"min");function cz(r,e){return new this(r).mod(e)}o(cz,"mod");function lz(r,e){return new this(r).mul(e)}o(lz,"mul");function fz(r,e){return new this(r).pow(e)}o(fz,"pow");function hz(r){var e,t,n,s,i=0,a=new this(1),u=[];if(r===void 0?r=this.precision:Is(r,1,_u),n=Math.ceil(r/bt),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));i<n;)s=e[i],s>=429e7?e[i]=crypto.getRandomValues(new Uint32Array(1))[0]:u[i++]=s%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);i<n;)s=e[i]+(e[i+1]<<8)+(e[i+2]<<16)+((e[i+3]&127)<<24),s>=214e7?crypto.randomBytes(4).copy(e,i):(u.push(s%1e7),i+=4);i=n/4}else throw Error(NO);else for(;i<n;)u[i++]=Math.random()*1e7|0;for(n=u[--i],r%=bt,n&&r&&(s=Sn(10,bt-r),u[i]=(n/s|0)*s);u[i]===0;i--)u.pop();if(i<0)t=0,u=[0];else{for(t=-1;u[0]===0;t-=bt)u.shift();for(n=1,s=u[0];s>=10;s/=10)n++;n<bt&&(t-=bt-n)}return a.e=t,a.d=u,a}o(hz,"random");function pz(r){return gt(r=new this(r),r.e+1,this.rounding)}o(pz,"round");function dz(r){return r=new this(r),r.d?r.d[0]?r.s:0*r.s:r.s||NaN}o(dz,"sign");function mz(r){return new this(r).sin()}o(mz,"sin");function gz(r){return new this(r).sinh()}o(gz,"sinh");function vz(r){return new this(r).sqrt()}o(vz,"sqrt");function yz(r,e){return new this(r).sub(e)}o(yz,"sub");function xz(){var r=0,e=arguments,t=new this(e[r]);for(_t=!1;t.s&&++r<e.length;)t=t.plus(e[r]);return _t=!0,gt(t,this.precision,this.rounding)}o(xz,"sum");function wz(r){return new this(r).tan()}o(wz,"tan");function Sz(r){return new this(r).tanh()}o(Sz,"tanh");function bz(r){return gt(r=new this(r),r.e+1,1)}o(bz,"trunc");Pe[Symbol.for("nodejs.util.inspect.custom")]=Pe.toString;Pe[Symbol.toStringTag]="Decimal";var rp=Pe.constructor=OO(O2);sw=new rp(sw);iw=new rp(iw);var np=class r extends rp{static{o(this,"Decimal")}static from(e){return new r(e)}static newOrZero(e){return e===void 0?r.from(0):r.from(e)}static newOrUndefined(e){if(e!==void 0)return r.from(e)}};var kO=class{static{o(this,"MemoryCacheAdapter")}cache=new Map;async get(e){return Promise.resolve(this.cache.get(e)??null)}has(e){return Promise.resolve(this.cache.has(e))}set(e,t){return this.cache.set(e,t),Promise.resolve(!0)}};var Ez=o(r=>!!r&&typeof r=="object"&&"message"in r,"hasMessageInRecord"),Bu=o(r=>typeof r=="string"?ti(new pn(r)):r instanceof Error?ti(new pn(r.message,{cause:r.cause})):Ez(r)?ti(new pn(r.message)):ti(new pn("unexpected error")),"leftFromError");var lw=class{static{o(this,"NullCacheAdapter")}async get(e){return Promise.resolve(null)}has(e){return Promise.resolve(!1)}set(e,t){return Promise.resolve(!0)}};var Vh=Zx(Yk(),1);import pq from"fs";import The from"path";import N0 from"crypto";import"reflect-metadata";var yU=Zx(mU(),1);import{constants as vue}from"crypto";import{Agent as gU}from"https";var vU=class{static{o(this,"SoapRemoteTransmissionRepository")}toolkit;certificateRepository;constructor(e,t){this.toolkit=e,this.certificateRepository=t}setCertificate(e){return this.certificate=e,this}get httpsAgent(){let e={rejectUnauthorized:!1,secureOptions:vue.SSL_OP_LEGACY_SERVER_CONNECT};if(!this.certificate)return new gU({...e});let{ca:t,password:n,certificate:s,privateKey:i}=this.certificate;return new gU({passphrase:n,cert:s.toString(),ca:t.map(a=>a.toString()),key:this.certificateRepository.getStringPrivateKey(i),...e})}get defaultSoapHeaders(){return{"Content-Type":"application/soap+xml; charset=utf-8"}}async send(e){try{let t=this.httpsAgent,n=await(0,yU.createClientAsync)(`${e.url}?wsdl`,{attributesKey:"$",wsdl_options:{httpsAgent:t}});e.payload.$={xmlns:n.wsdl.definitions.$targetNamespace,...e.payload.$};let s=await this.toolkit.build(e.payload,{headless:!0,renderOpts:{pretty:!1},rootName:e.root}),i=this.toolkit.getFirstNode(s)??"",a=e.xsd,u=await this.toolkit.validate(i,a);if(u.isLeft())return u;let[c]=await n[`${e.method}Async`]({_xml:s},{httpsAgent:t});return ri(c)}catch(t){return Bu(t)}}};import{arch as Sue,platform as bue}from"os";import{join as Kg,dirname as r_,resolve as Eue}from"path";import{existsSync as ib}from"fs";import{resolve as wU}from"path";import{createRequire as xU}from"module";import{fileURLToPath as yue,pathToFileURL as xue}from"url";var wue=typeof jest<"u"||process.env.JEST_WORKER_ID!==void 0,Jp,SU=o(()=>{if(Jp!==void 0)return Jp;if(wue){Jp=void 0;return}try{Jp=new Function("try { return import.meta.url; } catch { return undefined; }")()}catch{Jp=void 0}return Jp},"getImportMetaUrl"),bU=o(()=>{if(typeof Xe<"u")return Xe;let r=SU();if(r)return xU(r);let e=xue(wU(process.cwd(),"package.json")).href;return xU(e)},"getRequireFn"),EU=o(()=>{if(typeof __filename<"u")return __filename;let r=SU();return r?yue(r):wU(process.cwd())},"getCurrentFile");var $g=o(r=>bU()(r),"exportRequireModule"),AU=o(r=>{r=`${r}.node`;let e=`${bue()}-${Sue()}`;if(process.env.NFETS_ADDONS_DIR)return $g(Kg(process.env.NFETS_ADDONS_DIR,r));let t=EU(),n=Eue(t,"../../../../"),s=Kg(n,"build","addons",e,r);if(ib(s))return $g(s);let i=t;for(let a=0;a<5;a++){let u=Kg(i,"build","addons",e,r);if(ib(u))return $g(u);let c=r_(i);if(c===i)break;i=c}i=t;for(let a=0;a<5;a++){let u=Kg(i,"node_modules","nfets","build","addons",e,r);if(ib(u))return $g(u);let c=r_(i);if(c===i)break;i=c}i=t;for(let a=0;a<5;a++){let u=Kg(i,"build","Release",r);if(ib(u))return $g(u);let c=r_(i);if(c===i)break;i=c}throw new Error(`Addon ${e}/${r} not found`)},"addon");var Aue=AU("xml_validator"),CU=Aue;var whe=Zx(Xj(),1);import xhe from"crypto";var Wj="application/xml";var Ut;(function(r){r[r.None=0]="None",r[r.Element=1]="Element",r[r.Attribute=2]="Attribute",r[r.Text=3]="Text",r[r.CDATA=4]="CDATA",r[r.EntityReference=5]="EntityReference",r[r.Entity=6]="Entity",r[r.ProcessingInstruction=7]="ProcessingInstruction",r[r.Comment=8]="Comment",r[r.Document=9]="Document",r[r.DocumentType=10]="DocumentType",r[r.DocumentFragment=11]="DocumentFragment",r[r.Notation=12]="Notation",r[r.Whitespace=13]="Whitespace",r[r.SignificantWhitespace=14]="SignificantWhitespace",r[r.EndElement=15]="EndElement",r[r.EndEntity=16]="EndEntity",r[r.XmlDeclaration=17]="XmlDeclaration"})(Ut||(Ut={}));function Cue(r,e){let t=r.ownerDocument==null?r:r.ownerDocument,n=document.createNSResolver(r.ownerDocument==null?r.documentElement:r.ownerDocument.documentElement),s=t.evaluate(e,r,n,XPathResult.ANY_TYPE,null),i=[],a;for(;a=s.iterateNext();)i.push(a);return i}o(Cue,"SelectNodesEx");function Nue(r,e){let t=Yp("xpath").select;return t(e,r)}o(Nue,"SelectNodesNode");var zj=typeof self<"u"?Cue:Nue;function Li(r){r=r.replace(/\r\n/g,`
89
+ `,E.offset=(F=b.offset)!=null?F:0,E.dontPrettyTextNodes=(R=(q=b.dontPrettyTextNodes)!=null?q:b.dontprettytextnodes)!=null?R:0,E.spaceBeforeSlash=(H=(K=b.spaceBeforeSlash)!=null?K:b.spacebeforeslash)!=null?H:"",E.spaceBeforeSlash===!0&&(E.spaceBeforeSlash=" "),E.suppressPrettyCount=0,E.user={},E.state=e.None,E},T.prototype.indent=function(b,E,C){var _;return!E.pretty||E.suppressPrettyCount?"":E.pretty&&(_=(C||0)+E.offset+1,_>0)?new Array(_).join(E.indent):""},T.prototype.endline=function(b,E,C){return!E.pretty||E.suppressPrettyCount?"":E.newline},T.prototype.attribute=function(b,E,C){var _;return this.openAttribute(b,E,C),_=" "+b.name+'="'+b.value+'"',this.closeAttribute(b,E,C),_},T.prototype.cdata=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<![CDATA[",E.state=e.InsideTag,_+=b.value,E.state=e.CloseTag,_+="]]>"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},T.prototype.comment=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<!-- ",E.state=e.InsideTag,_+=b.value,E.state=e.CloseTag,_+=" -->"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},T.prototype.declaration=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<?xml",E.state=e.InsideTag,_+=' version="'+b.version+'"',b.encoding!=null&&(_+=' encoding="'+b.encoding+'"'),b.standalone!=null&&(_+=' standalone="'+b.standalone+'"'),E.state=e.CloseTag,_+=E.spaceBeforeSlash+"?>",_+=this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},T.prototype.docType=function(b,E,C){var _,F,R,q,H;if(C||(C=0),this.openNode(b,E,C),E.state=e.OpenTag,q=this.indent(b,E,C),q+="<!DOCTYPE "+b.root().name,b.pubID&&b.sysID?q+=' PUBLIC "'+b.pubID+'" "'+b.sysID+'"':b.sysID&&(q+=' SYSTEM "'+b.sysID+'"'),b.children.length>0){for(q+=" [",q+=this.endline(b,E,C),E.state=e.InsideTag,H=b.children,F=0,R=H.length;F<R;F++)_=H[F],q+=this.writeChildNode(_,E,C+1);E.state=e.CloseTag,q+="]"}return E.state=e.CloseTag,q+=E.spaceBeforeSlash+">",q+=this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),q},T.prototype.element=function(b,E,C){var _,F,R,q,H,K,X,pe,le,ue,ee,he,we,Ke;C||(C=0),ue=!1,ee="",this.openNode(b,E,C),E.state=e.OpenTag,ee+=this.indent(b,E,C)+"<"+b.name,he=b.attribs;for(le in he)A.call(he,le)&&(_=he[le],ee+=this.attribute(_,E,C));if(R=b.children.length,q=R===0?null:b.children[0],R===0||b.children.every(function(Ae){return(Ae.type===r.Text||Ae.type===r.Raw)&&Ae.value===""}))E.allowEmpty?(ee+=">",E.state=e.CloseTag,ee+="</"+b.name+">"+this.endline(b,E,C)):(E.state=e.CloseTag,ee+=E.spaceBeforeSlash+"/>"+this.endline(b,E,C));else if(E.pretty&&R===1&&(q.type===r.Text||q.type===r.Raw)&&q.value!=null)ee+=">",E.state=e.InsideTag,E.suppressPrettyCount++,ue=!0,ee+=this.writeChildNode(q,E,C+1),E.suppressPrettyCount--,ue=!1,E.state=e.CloseTag,ee+="</"+b.name+">"+this.endline(b,E,C);else{if(E.dontPrettyTextNodes){for(we=b.children,H=0,X=we.length;H<X;H++)if(F=we[H],(F.type===r.Text||F.type===r.Raw)&&F.value!=null){E.suppressPrettyCount++,ue=!0;break}}for(ee+=">"+this.endline(b,E,C),E.state=e.InsideTag,Ke=b.children,K=0,pe=Ke.length;K<pe;K++)F=Ke[K],ee+=this.writeChildNode(F,E,C+1);E.state=e.CloseTag,ee+=this.indent(b,E,C)+"</"+b.name+">",ue&&E.suppressPrettyCount--,ee+=this.endline(b,E,C),E.state=e.None}return this.closeNode(b,E,C),ee},T.prototype.writeChildNode=function(b,E,C){switch(b.type){case r.CData:return this.cdata(b,E,C);case r.Comment:return this.comment(b,E,C);case r.Element:return this.element(b,E,C);case r.Raw:return this.raw(b,E,C);case r.Text:return this.text(b,E,C);case r.ProcessingInstruction:return this.processingInstruction(b,E,C);case r.Dummy:return"";case r.Declaration:return this.declaration(b,E,C);case r.DocType:return this.docType(b,E,C);case r.AttributeDeclaration:return this.dtdAttList(b,E,C);case r.ElementDeclaration:return this.dtdElement(b,E,C);case r.EntityDeclaration:return this.dtdEntity(b,E,C);case r.NotationDeclaration:return this.dtdNotation(b,E,C);default:throw new Error("Unknown XML node type: "+b.constructor.name)}},T.prototype.processingInstruction=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<?",E.state=e.InsideTag,_+=b.target,b.value&&(_+=" "+b.value),E.state=e.CloseTag,_+=E.spaceBeforeSlash+"?>",_+=this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},T.prototype.raw=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C),E.state=e.InsideTag,_+=b.value,E.state=e.CloseTag,_+=this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},T.prototype.text=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C),E.state=e.InsideTag,_+=b.value,E.state=e.CloseTag,_+=this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},T.prototype.dtdAttList=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<!ATTLIST",E.state=e.InsideTag,_+=" "+b.elementName+" "+b.attributeName+" "+b.attributeType,b.defaultValueType!=="#DEFAULT"&&(_+=" "+b.defaultValueType),b.defaultValue&&(_+=' "'+b.defaultValue+'"'),E.state=e.CloseTag,_+=E.spaceBeforeSlash+">"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},T.prototype.dtdElement=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<!ELEMENT",E.state=e.InsideTag,_+=" "+b.name+" "+b.value,E.state=e.CloseTag,_+=E.spaceBeforeSlash+">"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},T.prototype.dtdEntity=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<!ENTITY",E.state=e.InsideTag,b.pe&&(_+=" %"),_+=" "+b.name,b.value?_+=' "'+b.value+'"':(b.pubID&&b.sysID?_+=' PUBLIC "'+b.pubID+'" "'+b.sysID+'"':b.sysID&&(_+=' SYSTEM "'+b.sysID+'"'),b.nData&&(_+=" NDATA "+b.nData)),E.state=e.CloseTag,_+=E.spaceBeforeSlash+">"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},T.prototype.dtdNotation=function(b,E,C){var _;return this.openNode(b,E,C),E.state=e.OpenTag,_=this.indent(b,E,C)+"<!NOTATION",E.state=e.InsideTag,_+=" "+b.name,b.pubID&&b.sysID?_+=' PUBLIC "'+b.pubID+'" "'+b.sysID+'"':b.pubID?_+=' PUBLIC "'+b.pubID+'"':b.sysID&&(_+=' SYSTEM "'+b.sysID+'"'),E.state=e.CloseTag,_+=E.spaceBeforeSlash+">"+this.endline(b,E,C),E.state=e.None,this.closeNode(b,E,C),_},T.prototype.openNode=function(b,E,C){},T.prototype.closeNode=function(b,E,C){},T.prototype.openAttribute=function(b,E,C){},T.prototype.closeAttribute=function(b,E,C){},T})()}).call(Bj)});var wb=Z((Rj,Pj)=>{"use strict";(function(){var r,e,t=o(function(s,i){for(var a in i)n.call(i,a)&&(s[a]=i[a]);function u(){this.constructor=s}return o(u,"ctor"),u.prototype=i.prototype,s.prototype=new u,s.__super__=i.prototype,s},"extend"),n={}.hasOwnProperty;e=u_(),Pj.exports=r=(function(s){t(i,s);function i(a){i.__super__.constructor.call(this,a)}return o(i,"XMLStringWriter"),i.prototype.document=function(a,u){var c,f,h,m,g;for(u=this.filterOptions(u),m="",g=a.children,f=0,h=g.length;f<h;f++)c=g[f],m+=this.writeChildNode(c,u,0);return u.pretty&&m.slice(-u.newline.length)===u.newline&&(m=m.slice(0,-u.newline.length)),m},i})(e)}).call(Rj)});var c_=Z((Oj,kj)=>{"use strict";(function(){var r,e,t,n,s,i,a,u,c=o(function(h,m){for(var g in m)f.call(m,g)&&(h[g]=m[g]);function x(){this.constructor=h}return o(x,"ctor"),x.prototype=m.prototype,h.prototype=new x,h.__super__=m.prototype,h},"extend"),f={}.hasOwnProperty;u=Ya().isPlainObject,t=s_(),e=VU(),s=ai(),r=cn(),a=o_(),i=wb(),kj.exports=n=(function(h){c(m,h);function m(g){m.__super__.constructor.call(this,null),this.name="#document",this.type=r.Document,this.documentURI=null,this.domConfig=new e,g||(g={}),g.writer||(g.writer=new i),this.options=g,this.stringify=new a(g)}return o(m,"XMLDocument"),Object.defineProperty(m.prototype,"implementation",{value:new t}),Object.defineProperty(m.prototype,"doctype",{get:o(function(){var g,x,v,w;for(w=this.children,x=0,v=w.length;x<v;x++)if(g=w[x],g.type===r.DocType)return g;return null},"get")}),Object.defineProperty(m.prototype,"documentElement",{get:o(function(){return this.rootObject||null},"get")}),Object.defineProperty(m.prototype,"inputEncoding",{get:o(function(){return null},"get")}),Object.defineProperty(m.prototype,"strictErrorChecking",{get:o(function(){return!1},"get")}),Object.defineProperty(m.prototype,"xmlEncoding",{get:o(function(){return this.children.length!==0&&this.children[0].type===r.Declaration?this.children[0].encoding:null},"get")}),Object.defineProperty(m.prototype,"xmlStandalone",{get:o(function(){return this.children.length!==0&&this.children[0].type===r.Declaration?this.children[0].standalone==="yes":!1},"get")}),Object.defineProperty(m.prototype,"xmlVersion",{get:o(function(){return this.children.length!==0&&this.children[0].type===r.Declaration?this.children[0].version:"1.0"},"get")}),Object.defineProperty(m.prototype,"URL",{get:o(function(){return this.documentURI},"get")}),Object.defineProperty(m.prototype,"origin",{get:o(function(){return null},"get")}),Object.defineProperty(m.prototype,"compatMode",{get:o(function(){return null},"get")}),Object.defineProperty(m.prototype,"characterSet",{get:o(function(){return null},"get")}),Object.defineProperty(m.prototype,"contentType",{get:o(function(){return null},"get")}),m.prototype.end=function(g){var x;return x={},g?u(g)&&(x=g,g=this.options.writer):g=this.options.writer,g.document(this,g.filterOptions(x))},m.prototype.toString=function(g){return this.options.writer.document(this,this.options.writer.filterOptions(g))},m.prototype.createElement=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createTextNode=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createComment=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createCDATASection=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createProcessingInstruction=function(g,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createAttribute=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createEntityReference=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByTagName=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.importNode=function(g,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createElementNS=function(g,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createAttributeNS=function(g,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByTagNameNS=function(g,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementById=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.adoptNode=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.renameNode=function(g,x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByClassName=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createEvent=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createNodeIterator=function(g,x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createTreeWalker=function(g,x,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},m})(s)}).call(Oj)});var Uj=Z((Lj,Vj)=>{"use strict";(function(){var r,e,t,n,s,i,a,u,c,f,h,m,g,x,v,w,S,A,T,b,E,C,_,F,R={}.hasOwnProperty;F=Ya(),C=F.isObject,E=F.isFunction,_=F.isPlainObject,b=F.getValue,r=cn(),m=c_(),x=ub(),n=cb(),s=lb(),w=vb(),T=yb(),v=xb(),f=fb(),h=gb(),i=hb(),u=pb(),a=db(),c=mb(),t=i_(),A=o_(),S=wb(),e=Xg(),Vj.exports=g=(function(){function q(H,K,X){var pe;this.name="?xml",this.type=r.Document,H||(H={}),pe={},H.writer?_(H.writer)&&(pe=H.writer,H.writer=new S):H.writer=new S,this.options=H,this.writer=H.writer,this.writerOptions=this.writer.filterOptions(pe),this.stringify=new A(H),this.onDataCallback=K||function(){},this.onEndCallback=X||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return o(q,"XMLDocumentCB"),q.prototype.createChildNode=function(H){var K,X,pe,le,ue,ee,he,we;switch(H.type){case r.CData:this.cdata(H.value);break;case r.Comment:this.comment(H.value);break;case r.Element:pe={},he=H.attribs;for(X in he)R.call(he,X)&&(K=he[X],pe[X]=K.value);this.node(H.name,pe);break;case r.Dummy:this.dummy();break;case r.Raw:this.raw(H.value);break;case r.Text:this.text(H.value);break;case r.ProcessingInstruction:this.instruction(H.target,H.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+H.constructor.name)}for(we=H.children,ue=0,ee=we.length;ue<ee;ue++)le=we[ue],this.createChildNode(le),le.type===r.Element&&this.up();return this},q.prototype.dummy=function(){return this},q.prototype.node=function(H,K,X){var pe;if(H==null)throw new Error("Missing node name.");if(this.root&&this.currentLevel===-1)throw new Error("Document can only have one root node. "+this.debugInfo(H));return this.openCurrent(),H=b(H),K==null&&(K={}),K=b(K),C(K)||(pe=[K,X],X=pe[0],K=pe[1]),this.currentNode=new x(this,H,K),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,X!=null&&this.text(X),this},q.prototype.element=function(H,K,X){var pe,le,ue,ee,he,we;if(this.currentNode&&this.currentNode.type===r.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(H)||C(H)||E(H))for(ee=this.options.noValidation,this.options.noValidation=!0,we=new m(this.options).element("TEMP_ROOT"),we.element(H),this.options.noValidation=ee,he=we.children,le=0,ue=he.length;le<ue;le++)pe=he[le],this.createChildNode(pe),pe.type===r.Element&&this.up();else this.node(H,K,X);return this},q.prototype.attribute=function(H,K){var X,pe;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(H));if(H!=null&&(H=b(H)),C(H))for(X in H)R.call(H,X)&&(pe=H[X],this.attribute(X,pe));else E(K)&&(K=K.apply()),this.options.keepNullAttributes&&K==null?this.currentNode.attribs[H]=new t(this,H,""):K!=null&&(this.currentNode.attribs[H]=new t(this,H,K));return this},q.prototype.text=function(H){var K;return this.openCurrent(),K=new T(this,H),this.onData(this.writer.text(K,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.cdata=function(H){var K;return this.openCurrent(),K=new n(this,H),this.onData(this.writer.cdata(K,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.comment=function(H){var K;return this.openCurrent(),K=new s(this,H),this.onData(this.writer.comment(K,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.raw=function(H){var K;return this.openCurrent(),K=new w(this,H),this.onData(this.writer.raw(K,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.instruction=function(H,K){var X,pe,le,ue,ee;if(this.openCurrent(),H!=null&&(H=b(H)),K!=null&&(K=b(K)),Array.isArray(H))for(X=0,ue=H.length;X<ue;X++)pe=H[X],this.instruction(pe);else if(C(H))for(pe in H)R.call(H,pe)&&(le=H[pe],this.instruction(pe,le));else E(K)&&(K=K.apply()),ee=new v(this,H,K),this.onData(this.writer.processingInstruction(ee,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},q.prototype.declaration=function(H,K,X){var pe;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return pe=new f(this,H,K,X),this.onData(this.writer.declaration(pe,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.doctype=function(H,K,X){if(this.openCurrent(),H==null)throw new Error("Missing root node name.");if(this.root)throw new Error("dtd() must come before the root node.");return this.currentNode=new h(this,K,X),this.currentNode.rootNodeName=H,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},q.prototype.dtdElement=function(H,K){var X;return this.openCurrent(),X=new a(this,H,K),this.onData(this.writer.dtdElement(X,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.attList=function(H,K,X,pe,le){var ue;return this.openCurrent(),ue=new i(this,H,K,X,pe,le),this.onData(this.writer.dtdAttList(ue,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.entity=function(H,K){var X;return this.openCurrent(),X=new u(this,!1,H,K),this.onData(this.writer.dtdEntity(X,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.pEntity=function(H,K){var X;return this.openCurrent(),X=new u(this,!0,H,K),this.onData(this.writer.dtdEntity(X,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.notation=function(H,K){var X;return this.openCurrent(),X=new c(this,H,K),this.onData(this.writer.dtdNotation(X,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},q.prototype.up=function(){if(this.currentLevel<0)throw new Error("The document node has no parent.");return this.currentNode?(this.currentNode.children?this.closeNode(this.currentNode):this.openNode(this.currentNode),this.currentNode=null):this.closeNode(this.openTags[this.currentLevel]),delete this.openTags[this.currentLevel],this.currentLevel--,this},q.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},q.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},q.prototype.openNode=function(H){var K,X,pe,le;if(!H.isOpen){if(!this.root&&this.currentLevel===0&&H.type===r.Element&&(this.root=H),X="",H.type===r.Element){this.writerOptions.state=e.OpenTag,X=this.writer.indent(H,this.writerOptions,this.currentLevel)+"<"+H.name,le=H.attribs;for(pe in le)R.call(le,pe)&&(K=le[pe],X+=this.writer.attribute(K,this.writerOptions,this.currentLevel));X+=(H.children?">":"/>")+this.writer.endline(H,this.writerOptions,this.currentLevel),this.writerOptions.state=e.InsideTag}else this.writerOptions.state=e.OpenTag,X=this.writer.indent(H,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+H.rootNodeName,H.pubID&&H.sysID?X+=' PUBLIC "'+H.pubID+'" "'+H.sysID+'"':H.sysID&&(X+=' SYSTEM "'+H.sysID+'"'),H.children?(X+=" [",this.writerOptions.state=e.InsideTag):(this.writerOptions.state=e.CloseTag,X+=">"),X+=this.writer.endline(H,this.writerOptions,this.currentLevel);return this.onData(X,this.currentLevel),H.isOpen=!0}},q.prototype.closeNode=function(H){var K;if(!H.isClosed)return K="",this.writerOptions.state=e.CloseTag,H.type===r.Element?K=this.writer.indent(H,this.writerOptions,this.currentLevel)+"</"+H.name+">"+this.writer.endline(H,this.writerOptions,this.currentLevel):K=this.writer.indent(H,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(H,this.writerOptions,this.currentLevel),this.writerOptions.state=e.None,this.onData(K,this.currentLevel),H.isClosed=!0},q.prototype.onData=function(H,K){return this.documentStarted=!0,this.onDataCallback(H,K+1)},q.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},q.prototype.debugInfo=function(H){return H==null?"":"node: <"+H+">"},q.prototype.ele=function(){return this.element.apply(this,arguments)},q.prototype.nod=function(H,K,X){return this.node(H,K,X)},q.prototype.txt=function(H){return this.text(H)},q.prototype.dat=function(H){return this.cdata(H)},q.prototype.com=function(H){return this.comment(H)},q.prototype.ins=function(H,K){return this.instruction(H,K)},q.prototype.dec=function(H,K,X){return this.declaration(H,K,X)},q.prototype.dtd=function(H,K,X){return this.doctype(H,K,X)},q.prototype.e=function(H,K,X){return this.element(H,K,X)},q.prototype.n=function(H,K,X){return this.node(H,K,X)},q.prototype.t=function(H){return this.text(H)},q.prototype.d=function(H){return this.cdata(H)},q.prototype.c=function(H){return this.comment(H)},q.prototype.r=function(H){return this.raw(H)},q.prototype.i=function(H,K){return this.instruction(H,K)},q.prototype.att=function(){return this.currentNode&&this.currentNode.type===r.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},q.prototype.a=function(){return this.currentNode&&this.currentNode.type===r.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},q.prototype.ent=function(H,K){return this.entity(H,K)},q.prototype.pent=function(H,K){return this.pEntity(H,K)},q.prototype.not=function(H,K){return this.notation(H,K)},q})()}).call(Lj)});var Fj=Z((jj,Mj)=>{"use strict";(function(){var r,e,t,n,s=o(function(a,u){for(var c in u)i.call(u,c)&&(a[c]=u[c]);function f(){this.constructor=a}return o(f,"ctor"),f.prototype=u.prototype,a.prototype=new f,a.__super__=u.prototype,a},"extend"),i={}.hasOwnProperty;r=cn(),n=u_(),e=Xg(),Mj.exports=t=(function(a){s(u,a);function u(c,f){this.stream=c,u.__super__.constructor.call(this,f)}return o(u,"XMLStreamWriter"),u.prototype.endline=function(c,f,h){return c.isLastRootNode&&f.state===e.CloseTag?"":u.__super__.endline.call(this,c,f,h)},u.prototype.document=function(c,f){var h,m,g,x,v,w,S,A,T;for(S=c.children,m=g=0,v=S.length;g<v;m=++g)h=S[m],h.isLastRootNode=m===c.children.length-1;for(f=this.filterOptions(f),A=c.children,T=[],x=0,w=A.length;x<w;x++)h=A[x],T.push(this.writeChildNode(h,f,0));return T},u.prototype.attribute=function(c,f,h){return this.stream.write(u.__super__.attribute.call(this,c,f,h))},u.prototype.cdata=function(c,f,h){return this.stream.write(u.__super__.cdata.call(this,c,f,h))},u.prototype.comment=function(c,f,h){return this.stream.write(u.__super__.comment.call(this,c,f,h))},u.prototype.declaration=function(c,f,h){return this.stream.write(u.__super__.declaration.call(this,c,f,h))},u.prototype.docType=function(c,f,h){var m,g,x,v;if(h||(h=0),this.openNode(c,f,h),f.state=e.OpenTag,this.stream.write(this.indent(c,f,h)),this.stream.write("<!DOCTYPE "+c.root().name),c.pubID&&c.sysID?this.stream.write(' PUBLIC "'+c.pubID+'" "'+c.sysID+'"'):c.sysID&&this.stream.write(' SYSTEM "'+c.sysID+'"'),c.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(c,f,h)),f.state=e.InsideTag,v=c.children,g=0,x=v.length;g<x;g++)m=v[g],this.writeChildNode(m,f,h+1);f.state=e.CloseTag,this.stream.write("]")}return f.state=e.CloseTag,this.stream.write(f.spaceBeforeSlash+">"),this.stream.write(this.endline(c,f,h)),f.state=e.None,this.closeNode(c,f,h)},u.prototype.element=function(c,f,h){var m,g,x,v,w,S,A,T,b,E;h||(h=0),this.openNode(c,f,h),f.state=e.OpenTag,this.stream.write(this.indent(c,f,h)+"<"+c.name),b=c.attribs;for(A in b)i.call(b,A)&&(m=b[A],this.attribute(m,f,h));if(x=c.children.length,v=x===0?null:c.children[0],x===0||c.children.every(function(C){return(C.type===r.Text||C.type===r.Raw)&&C.value===""}))f.allowEmpty?(this.stream.write(">"),f.state=e.CloseTag,this.stream.write("</"+c.name+">")):(f.state=e.CloseTag,this.stream.write(f.spaceBeforeSlash+"/>"));else if(f.pretty&&x===1&&(v.type===r.Text||v.type===r.Raw)&&v.value!=null)this.stream.write(">"),f.state=e.InsideTag,f.suppressPrettyCount++,T=!0,this.writeChildNode(v,f,h+1),f.suppressPrettyCount--,T=!1,f.state=e.CloseTag,this.stream.write("</"+c.name+">");else{for(this.stream.write(">"+this.endline(c,f,h)),f.state=e.InsideTag,E=c.children,w=0,S=E.length;w<S;w++)g=E[w],this.writeChildNode(g,f,h+1);f.state=e.CloseTag,this.stream.write(this.indent(c,f,h)+"</"+c.name+">")}return this.stream.write(this.endline(c,f,h)),f.state=e.None,this.closeNode(c,f,h)},u.prototype.processingInstruction=function(c,f,h){return this.stream.write(u.__super__.processingInstruction.call(this,c,f,h))},u.prototype.raw=function(c,f,h){return this.stream.write(u.__super__.raw.call(this,c,f,h))},u.prototype.text=function(c,f,h){return this.stream.write(u.__super__.text.call(this,c,f,h))},u.prototype.dtdAttList=function(c,f,h){return this.stream.write(u.__super__.dtdAttList.call(this,c,f,h))},u.prototype.dtdElement=function(c,f,h){return this.stream.write(u.__super__.dtdElement.call(this,c,f,h))},u.prototype.dtdEntity=function(c,f,h){return this.stream.write(u.__super__.dtdEntity.call(this,c,f,h))},u.prototype.dtdNotation=function(c,f,h){return this.stream.write(u.__super__.dtdNotation.call(this,c,f,h))},u})(n)}).call(jj)});var Hj=Z((qj,cc)=>{"use strict";(function(){var r,e,t,n,s,i,a,u,c,f;f=Ya(),u=f.assign,c=f.isFunction,t=s_(),n=c_(),s=Uj(),a=wb(),i=Fj(),r=cn(),e=Xg(),cc.exports.create=function(h,m,g,x){var v,w;if(h==null)throw new Error("Root element needs a name.");return x=u({},m,g,x),v=new n(x),w=v.element(h),x.headless||(v.declaration(x),(x.pubID!=null||x.sysID!=null)&&v.dtd(x)),w},cc.exports.begin=function(h,m,g){var x;return c(h)&&(x=[h,m],m=x[0],g=x[1],h={}),m?new s(h,m,g):new n(h)},cc.exports.stringWriter=function(h){return new a(h)},cc.exports.streamWriter=function(h,m){return new i(h,m)},cc.exports.implementation=new t,cc.exports.nodeType=r,cc.exports.writerState=e}).call(qj)});var Kj=Z(l_=>{"use strict";(function(){"use strict";var r,e,t,n,s,i={}.hasOwnProperty;r=Hj(),e=ab().defaults,n=o(function(a){return typeof a=="string"&&(a.indexOf("&")>=0||a.indexOf(">")>=0||a.indexOf("<")>=0)},"requiresCDATA"),s=o(function(a){return"<![CDATA["+t(a)+"]]>"},"wrapCDATA"),t=o(function(a){return a.replace("]]>","]]]]><![CDATA[>")},"escapeCDATA"),l_.Builder=(function(){function a(u){var c,f,h;this.options={},f=e["0.2"];for(c in f)i.call(f,c)&&(h=f[c],this.options[c]=h);for(c in u)i.call(u,c)&&(h=u[c],this.options[c]=h)}return o(a,"Builder"),a.prototype.buildObject=function(u){var c,f,h,m,g;return c=this.options.attrkey,f=this.options.charkey,Object.keys(u).length===1&&this.options.rootName===e["0.2"].rootName?(g=Object.keys(u)[0],u=u[g]):g=this.options.rootName,h=(function(x){return function(v,w){var S,A,T,b,E,C;if(typeof w!="object")x.options.cdata&&n(w)?v.raw(s(w)):v.txt(w);else if(Array.isArray(w)){for(b in w)if(i.call(w,b)){A=w[b];for(E in A)T=A[E],v=h(v.ele(E),T).up()}}else for(E in w)if(i.call(w,E))if(A=w[E],E===c){if(typeof A=="object")for(S in A)C=A[S],v=v.att(S,C)}else if(E===f)x.options.cdata&&n(A)?v=v.raw(s(A)):v=v.txt(A);else if(Array.isArray(A))for(b in A)i.call(A,b)&&(T=A[b],typeof T=="string"?x.options.cdata&&n(T)?v=v.ele(E).raw(s(T)).up():v=v.ele(E,T).up():v=h(v.ele(E),T).up());else typeof A=="object"?v=h(v.ele(E),A).up():typeof A=="string"&&x.options.cdata&&n(A)?v=v.ele(E).raw(s(A)).up():(A==null&&(A=""),v=v.ele(E,A.toString()).up());return v}})(this),m=r.create(g,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),h(m,u).end(this.options.renderOpts)},a})()}).call(l_)});var $j=Z(f_=>{"use strict";(function(){"use strict";f_.stripBOM=function(r){return r[0]==="\uFEFF"?r.substring(1):r}}).call(f_)});var h_=Z(zl=>{"use strict";(function(){"use strict";var r;r=new RegExp(/(?!xmlns)^.*:/),zl.normalize=function(e){return e.toLowerCase()},zl.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},zl.stripPrefix=function(e){return e.replace(r,"")},zl.parseNumbers=function(e){return isNaN(e)||(e=e%1===0?parseInt(e,10):parseFloat(e)),e},zl.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}).call(zl)});var Gj=Z(Lo=>{"use strict";(function(){"use strict";var r,e,t,n,s,i,a,u,c,f=o(function(g,x){return function(){return g.apply(x,arguments)}},"bind"),h=o(function(g,x){for(var v in x)m.call(x,v)&&(g[v]=x[v]);function w(){this.constructor=g}return o(w,"ctor"),w.prototype=x.prototype,g.prototype=new w,g.__super__=x.prototype,g},"extend"),m={}.hasOwnProperty;u=jI(),n=Xe("events"),r=$j(),a=h_(),c=Xe("timers").setImmediate,e=ab().defaults,s=o(function(g){return typeof g=="object"&&g!=null&&Object.keys(g).length===0},"isEmpty"),i=o(function(g,x,v){var w,S,A;for(w=0,S=g.length;w<S;w++)A=g[w],x=A(x,v);return x},"processItem"),t=o(function(g,x,v){var w;return w=Object.create(null),w.value=v,w.writable=!0,w.enumerable=!0,w.configurable=!0,Object.defineProperty(g,x,w)},"defineProperty"),Lo.Parser=(function(g){h(x,g);function x(v){this.parseStringPromise=f(this.parseStringPromise,this),this.parseString=f(this.parseString,this),this.reset=f(this.reset,this),this.assignOrPush=f(this.assignOrPush,this),this.processAsync=f(this.processAsync,this);var w,S,A;if(!(this instanceof Lo.Parser))return new Lo.Parser(v);this.options={},S=e["0.2"];for(w in S)m.call(S,w)&&(A=S[w],this.options[w]=A);for(w in v)m.call(v,w)&&(A=v[w],this.options[w]=A);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(a.normalize)),this.reset()}return o(x,"Parser"),x.prototype.processAsync=function(){var v,w;try{return this.remaining.length<=this.options.chunkSize?(v=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(v),this.saxParser.close()):(v=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(v),c(this.processAsync))}catch(S){if(w=S,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(w)}},x.prototype.assignOrPush=function(v,w,S){return w in v?(v[w]instanceof Array||t(v,w,[v[w]]),v[w].push(S)):this.options.explicitArray?t(v,w,[S]):t(v,w,S)},x.prototype.reset=function(){var v,w,S,A;return this.removeAllListeners(),this.saxParser=u.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=(function(T){return function(b){if(T.saxParser.resume(),!T.saxParser.errThrown)return T.saxParser.errThrown=!0,T.emit("error",b)}})(this),this.saxParser.onend=(function(T){return function(){if(!T.saxParser.ended)return T.saxParser.ended=!0,T.emit("end",T.resultObject)}})(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,A=[],v=this.options.attrkey,w=this.options.charkey,this.saxParser.onopentag=(function(T){return function(b){var E,C,_,F,R;if(_={},_[w]="",!T.options.ignoreAttrs){R=b.attributes;for(E in R)m.call(R,E)&&(!(v in _)&&!T.options.mergeAttrs&&(_[v]={}),C=T.options.attrValueProcessors?i(T.options.attrValueProcessors,b.attributes[E],E):b.attributes[E],F=T.options.attrNameProcessors?i(T.options.attrNameProcessors,E):E,T.options.mergeAttrs?T.assignOrPush(_,F,C):t(_[v],F,C))}return _["#name"]=T.options.tagNameProcessors?i(T.options.tagNameProcessors,b.name):b.name,T.options.xmlns&&(_[T.options.xmlnskey]={uri:b.uri,local:b.local}),A.push(_)}})(this),this.saxParser.onclosetag=(function(T){return function(){var b,E,C,_,F,R,q,H,K,X;if(R=A.pop(),F=R["#name"],(!T.options.explicitChildren||!T.options.preserveChildrenOrder)&&delete R["#name"],R.cdata===!0&&(b=R.cdata,delete R.cdata),K=A[A.length-1],R[w].match(/^\s*$/)&&!b?(E=R[w],delete R[w]):(T.options.trim&&(R[w]=R[w].trim()),T.options.normalize&&(R[w]=R[w].replace(/\s{2,}/g," ").trim()),R[w]=T.options.valueProcessors?i(T.options.valueProcessors,R[w],F):R[w],Object.keys(R).length===1&&w in R&&!T.EXPLICIT_CHARKEY&&(R=R[w])),s(R)&&(typeof T.options.emptyTag=="function"?R=T.options.emptyTag():R=T.options.emptyTag!==""?T.options.emptyTag:E),T.options.validator!=null&&(X="/"+(function(){var pe,le,ue;for(ue=[],pe=0,le=A.length;pe<le;pe++)_=A[pe],ue.push(_["#name"]);return ue})().concat(F).join("/"),(function(){var pe;try{return R=T.options.validator(X,K&&K[F],R)}catch(le){return pe=le,T.emit("error",pe)}})()),T.options.explicitChildren&&!T.options.mergeAttrs&&typeof R=="object"){if(!T.options.preserveChildrenOrder)_={},T.options.attrkey in R&&(_[T.options.attrkey]=R[T.options.attrkey],delete R[T.options.attrkey]),!T.options.charsAsChildren&&T.options.charkey in R&&(_[T.options.charkey]=R[T.options.charkey],delete R[T.options.charkey]),Object.getOwnPropertyNames(R).length>0&&(_[T.options.childkey]=R),R=_;else if(K){K[T.options.childkey]=K[T.options.childkey]||[],q={};for(C in R)m.call(R,C)&&t(q,C,R[C]);K[T.options.childkey].push(q),delete R["#name"],Object.keys(R).length===1&&w in R&&!T.EXPLICIT_CHARKEY&&(R=R[w])}}return A.length>0?T.assignOrPush(K,F,R):(T.options.explicitRoot&&(H=R,R={},t(R,F,H)),T.resultObject=R,T.saxParser.ended=!0,T.emit("end",T.resultObject))}})(this),S=(function(T){return function(b){var E,C;if(C=A[A.length-1],C)return C[w]+=b,T.options.explicitChildren&&T.options.preserveChildrenOrder&&T.options.charsAsChildren&&(T.options.includeWhiteChars||b.replace(/\\n/g,"").trim()!=="")&&(C[T.options.childkey]=C[T.options.childkey]||[],E={"#name":"__text__"},E[w]=b,T.options.normalize&&(E[w]=E[w].replace(/\s{2,}/g," ").trim()),C[T.options.childkey].push(E)),C}})(this),this.saxParser.ontext=S,this.saxParser.oncdata=(function(T){return function(b){var E;if(E=S(b),E)return E.cdata=!0}})(this)},x.prototype.parseString=function(v,w){var S;w!=null&&typeof w=="function"&&(this.on("end",function(A){return this.reset(),w(null,A)}),this.on("error",function(A){return this.reset(),w(A)}));try{return v=v.toString(),v.trim()===""?(this.emit("end",null),!0):(v=r.stripBOM(v),this.options.async?(this.remaining=v,c(this.processAsync),this.saxParser):this.saxParser.write(v).close())}catch(A){if(S=A,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw S}else return this.emit("error",S),this.saxParser.errThrown=!0}},x.prototype.parseStringPromise=function(v){return new Promise((function(w){return function(S,A){return w.parseString(v,function(T,b){return T?A(T):S(b)})}})(this))},x})(n),Lo.parseString=function(g,x,v){var w,S,A;return v!=null?(typeof v=="function"&&(w=v),typeof x=="object"&&(S=x)):(typeof x=="function"&&(w=x),S={}),A=new Lo.Parser(S),A.parseString(g,w)},Lo.parseStringPromise=function(g,x){var v,w;return typeof x=="object"&&(v=x),w=new Lo.Parser(v),w.parseStringPromise(g)}}).call(Lo)});var Xj=Z(Vo=>{"use strict";(function(){"use strict";var r,e,t,n,s=o(function(a,u){for(var c in u)i.call(u,c)&&(a[c]=u[c]);function f(){this.constructor=a}return o(f,"ctor"),f.prototype=u.prototype,a.prototype=new f,a.__super__=u.prototype,a},"extend"),i={}.hasOwnProperty;e=ab(),r=Kj(),t=Gj(),n=h_(),Vo.defaults=e.defaults,Vo.processors=n,Vo.ValidationError=(function(a){s(u,a);function u(c){this.message=c}return o(u,"ValidationError"),u})(Error),Vo.Builder=r.Builder,Vo.Parser=t.Parser,Vo.parseString=t.parseString,Vo.parseStringPromise=t.parseStringPromise}).call(Vo)});var I2="http://www.w3.org/2000/09/xmldsig#",dO="http://www.w3.org/TR/2001/REC-xml-c14n-20010315",_2=(function(r){return r.RSA_SHA1="http://www.w3.org/2000/09/xmldsig#rsa-sha1",r.RSA_SHA256="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",r})({}),Cu=(function(r){return r.SHA1="sha1",r.SHA256="sha256",r})({}),B2=(function(r){return r.SHA1="http://www.w3.org/2000/09/xmldsig#sha1",r.SHA256="http://www.w3.org/2001/04/xmlenc#sha256",r})({});var br={AC:"12",AL:"27",AM:"13",AP:"16",BA:"29",CE:"23",DF:"53",ES:"32",GO:"52",MA:"21",MG:"31",MS:"50",MT:"51",PA:"15",PB:"25",PE:"26",PI:"22",PR:"41",RJ:"33",RN:"24",RO:"11",RR:"14",RS:"43",SC:"42",SE:"28",SP:"35",TO:"17"},_he=Object.keys(br);var Dhe={Production:"1",Homolog:"2"};var pn=class extends Error{static{o(this,"NFeTsError")}};var mO=class extends pn{static{o(this,"ValidationError")}};var K0={includeComments:!1,exclusive:!0};var D2=o(r=>{throw new pn("Didn't expect to get here")},"unreachable");var Zh=class{static{o(this,"Signer")}toolkit;certificateRepository;algorithm;canonical;constructor(e,t,n=Cu.SHA1,s=K0){this.toolkit=e,this.certificateRepository=t,this.algorithm=n,this.canonical=s}assemble(e,t,n){let s=this.certificateRepository.getStringCertificate(n);return{$:{xmlns:I2},SignedInfo:e,SignatureValue:t,KeyInfo:{X509Data:{X509Certificate:s}}}}signedInfo(e,t){return{CanonicalizationMethod:{$:{Algorithm:dO}},SignatureMethod:{$:{Algorithm:this.signatureMethod}},Reference:{$:{URI:`#${this.toolkit.getAttribute(e,t)}`},Transforms:this.transforms,DigestMethod:{$:{Algorithm:this.digestAlgorithm}},DigestValue:this.digest(e)}}}digest(e){return this.toolkit.digest(e,this.algorithm,this.canonical)}async signOrLeft(e,t){let n=this.toolkit.canonicalize(await this.toolkit.build({$:{xmlns:I2},...e},{rootName:"SignedInfo"}),this.canonical);return await this.certificateRepository.sign(n,t,this.algorithm)}get transforms(){return{Transform:[{$:{Algorithm:"http://www.w3.org/2000/09/xmldsig#enveloped-signature"}},{$:{Algorithm:"http://www.w3.org/TR/2001/REC-xml-c14n-20010315"}}]}}get digestAlgorithm(){switch(this.algorithm){case Cu.SHA256:return B2.SHA256;case Cu.SHA1:return B2.SHA1;default:return D2(this.algorithm)}}get signatureMethod(){switch(this.algorithm){case Cu.SHA256:return _2.RSA_SHA256;case Cu.SHA1:return _2.RSA_SHA1;default:return D2(this.algorithm)}}};var R2=class{static{o(this,"Left")}value;constructor(e){this.value=e}isLeft(){return!0}isRight(){return!1}},ew=class{static{o(this,"Right")}value;constructor(e){this.value=e}isLeft(){return!1}isRight(){return!0}},ti=o(r=>new R2(r),"left"),ri=o(r=>r===void 0?new ew(void 0):new ew(r),"right");var gO=class extends Zh{static{o(this,"EntitySigner")}async sign(e,t,n){let{tag:s,mark:i}=t,{privateKey:a,certificate:u}=n;if(!e[s])return ti(new pn(`Node ${String(s)} not found`));let c=await this.toolkit.build(this.ns(e,s),{headless:!0,rootName:String(s),renderOpts:{pretty:!1}}),f=this.signedInfo(c,i),h=await this.signOrLeft(f,a);if(h.isLeft())return h;let m=e;return m.Signature=this.assemble(f,h.value,u),ri(m)}ns(e,t){let n=e.$?.xmlns,{$:s,...i}=e[t],{xmlns:a,...u}=s??{};return{$:{xmlns:n,...u},...i}}};var vO=class extends Zh{static{o(this,"XmlSigner")}async sign(e,t,n){let{tag:s,mark:i}=t,{privateKey:a,certificate:u}=n,c=this.toolkit.getNode(e,s);if(!c)return ti(new pn(`Node ${s} not found`));let f=this.signedInfo(c,i),h=await this.signOrLeft(f,a);if(h.isLeft())return h;let m=await this.toolkit.build(this.assemble(f,h.value,u),{rootName:"Signature"});return ri(this.toolkit.appendNode(e,m))}};import"reflect-metadata";var $0="__SkipValidation__",ape=o(()=>(r,e)=>{Reflect.defineMetadata($0,!0,r,e.toString())},"SkipValidation"),ope=o(()=>r=>{Reflect.defineMetadata($0,!0,r)},"SkipAllValidations");import{plainToInstance as IW}from"class-transformer";var tw=o(r=>{for(let[e,t]of Object.entries(r))typeof t>"u"&&delete r[e],t===""&&delete r[e],t&&typeof t=="object"&&tw(t)},"clearEmptyValues"),yO=o((r,e,t={})=>{let n=IW(e,r);return t.clearEmptyValues&&tw(n),n},"plainToInstance");import"reflect-metadata";import{validateSync as _W}from"class-validator";var xO="__ValidateErrors__",wO=o((r,e)=>r.reduce((t,n)=>{if(n.children?.length)return t.concat(wO(n.children,e?`${e}.${n.property}`:n.property));let s=Object.values(n.constraints??{}).map(i=>e?`${e}.${i}`:i).join(", ");return s?t.concat(s):t},[]),"mapConstraintsToErrors"),vpe=o(r=>(e,t,n)=>{let s=n.value;n.value=function(...i){let a=Reflect.getMetadata($0,this.constructor);if(Reflect.getMetadata($0,this.constructor.prototype,t.toString())===!0||a===!0)return s?.apply(this,i);let[c,...f]=i,h=yO(c,r),m=_W(h,{whitelist:!0});if(tw(h),m.length){let g=Reflect.getMetadata(xO,this)??[];Reflect.defineMetadata(xO,g.concat(wO(m,s?.name)),this)}return s?.apply(this,[h,...f])}},"Validates");var ep=9e15,_u=1e9,P2="0123456789abcdef",sw="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",iw="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",O2={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-ep,maxE:ep,crypto:!1},AO,Ao,_t=!0,ow="[DecimalError] ",Iu=ow+"Invalid argument: ",CO=ow+"Precision limit exceeded",NO=ow+"crypto unavailable",TO="[object Decimal]",ns=Math.floor,Sn=Math.pow,BW=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,DW=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,RW=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,IO=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Qi=1e7,bt=7,PW=9007199254740991,OW=sw.length-1,k2=iw.length-1,Pe={toStringTag:TO};Pe.absoluteValue=Pe.abs=function(){var r=new this.constructor(this);return r.s<0&&(r.s=1),gt(r)};Pe.ceil=function(){return gt(new this.constructor(this),this.e+1,2)};Pe.clampedTo=Pe.clamp=function(r,e){var t,n=this,s=n.constructor;if(r=new s(r),e=new s(e),!r.s||!e.s)return new s(NaN);if(r.gt(e))throw Error(Iu+e);return t=n.cmp(r),t<0?r:n.cmp(e)>0?e:new s(n)};Pe.comparedTo=Pe.cmp=function(r){var e,t,n,s,i=this,a=i.d,u=(r=new i.constructor(r)).d,c=i.s,f=r.s;if(!a||!u)return!c||!f?NaN:c!==f?c:a===u?0:!a^c<0?1:-1;if(!a[0]||!u[0])return a[0]?c:u[0]?-f:0;if(c!==f)return c;if(i.e!==r.e)return i.e>r.e^c<0?1:-1;for(n=a.length,s=u.length,e=0,t=n<s?n:s;e<t;++e)if(a[e]!==u[e])return a[e]>u[e]^c<0?1:-1;return n===s?0:n>s^c<0?1:-1};Pe.cosine=Pe.cos=function(){var r,e,t=this,n=t.constructor;return t.d?t.d[0]?(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+bt,n.rounding=1,t=kW(n,PO(n,t)),n.precision=r,n.rounding=e,gt(Ao==2||Ao==3?t.neg():t,r,e,!0)):new n(1):new n(NaN)};Pe.cubeRoot=Pe.cbrt=function(){var r,e,t,n,s,i,a,u,c,f,h=this,m=h.constructor;if(!h.isFinite()||h.isZero())return new m(h);for(_t=!1,i=h.s*Sn(h.s*h,1/3),!i||Math.abs(i)==1/0?(t=Fn(h.d),r=h.e,(i=(r-t.length+1)%3)&&(t+=i==1||i==-2?"0":"00"),i=Sn(t,1/3),r=ns((r+1)/3)-(r%3==(r<0?-1:2)),i==1/0?t="5e"+r:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+r),n=new m(t),n.s=h.s):n=new m(i.toString()),a=(r=m.precision)+3;;)if(u=n,c=u.times(u).times(u),f=c.plus(h),n=Tr(f.plus(h).times(u),f.plus(c),a+2,1),Fn(u.d).slice(0,a)===(t=Fn(n.d)).slice(0,a))if(t=t.slice(a-3,a+1),t=="9999"||!s&&t=="4999"){if(!s&&(gt(u,r+1,0),u.times(u).times(u).eq(h))){n=u;break}a+=4,s=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(gt(n,r+1,1),e=!n.times(n).times(n).eq(h));break}return _t=!0,gt(n,r,m.rounding,e)};Pe.decimalPlaces=Pe.dp=function(){var r,e=this.d,t=NaN;if(e){if(r=e.length-1,t=(r-ns(this.e/bt))*bt,r=e[r],r)for(;r%10==0;r/=10)t--;t<0&&(t=0)}return t};Pe.dividedBy=Pe.div=function(r){return Tr(this,new this.constructor(r))};Pe.dividedToIntegerBy=Pe.divToInt=function(r){var e=this,t=e.constructor;return gt(Tr(e,new t(r),0,1,1),t.precision,t.rounding)};Pe.equals=Pe.eq=function(r){return this.cmp(r)===0};Pe.floor=function(){return gt(new this.constructor(this),this.e+1,3)};Pe.greaterThan=Pe.gt=function(r){return this.cmp(r)>0};Pe.greaterThanOrEqualTo=Pe.gte=function(r){var e=this.cmp(r);return e==1||e===0};Pe.hyperbolicCosine=Pe.cosh=function(){var r,e,t,n,s,i=this,a=i.constructor,u=new a(1);if(!i.isFinite())return new a(i.s?1/0:NaN);if(i.isZero())return u;t=a.precision,n=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,s=i.d.length,s<32?(r=Math.ceil(s/3),e=(1/cw(4,r)).toString()):(r=16,e="2.3283064365386962890625e-10"),i=tp(a,1,i.times(e),new a(1),!0);for(var c,f=r,h=new a(8);f--;)c=i.times(i),i=u.minus(c.times(h.minus(c.times(h))));return gt(i,a.precision=t,a.rounding=n,!0)};Pe.hyperbolicSine=Pe.sinh=function(){var r,e,t,n,s=this,i=s.constructor;if(!s.isFinite()||s.isZero())return new i(s);if(e=i.precision,t=i.rounding,i.precision=e+Math.max(s.e,s.sd())+4,i.rounding=1,n=s.d.length,n<3)s=tp(i,2,s,s,!0);else{r=1.4*Math.sqrt(n),r=r>16?16:r|0,s=s.times(1/cw(5,r)),s=tp(i,2,s,s,!0);for(var a,u=new i(5),c=new i(16),f=new i(20);r--;)a=s.times(s),s=s.times(u.plus(a.times(c.times(a).plus(f))))}return i.precision=e,i.rounding=t,gt(s,e,t,!0)};Pe.hyperbolicTangent=Pe.tanh=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+7,n.rounding=1,Tr(t.sinh(),t.cosh(),n.precision=r,n.rounding=e)):new n(t.s)};Pe.inverseCosine=Pe.acos=function(){var r=this,e=r.constructor,t=r.abs().cmp(1),n=e.precision,s=e.rounding;return t!==-1?t===0?r.isNeg()?Na(e,n,s):new e(0):new e(NaN):r.isZero()?Na(e,n+4,s).times(.5):(e.precision=n+6,e.rounding=1,r=new e(1).minus(r).div(r.plus(1)).sqrt().atan(),e.precision=n,e.rounding=s,r.times(2))};Pe.inverseHyperbolicCosine=Pe.acosh=function(){var r,e,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(r=n.precision,e=n.rounding,n.precision=r+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,_t=!1,t=t.times(t).minus(1).sqrt().plus(t),_t=!0,n.precision=r,n.rounding=e,t.ln()):new n(t)};Pe.inverseHyperbolicSine=Pe.asinh=function(){var r,e,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,_t=!1,t=t.times(t).plus(1).sqrt().plus(t),_t=!0,n.precision=r,n.rounding=e,t.ln())};Pe.inverseHyperbolicTangent=Pe.atanh=function(){var r,e,t,n,s=this,i=s.constructor;return s.isFinite()?s.e>=0?new i(s.abs().eq(1)?s.s/0:s.isZero()?s:NaN):(r=i.precision,e=i.rounding,n=s.sd(),Math.max(n,r)<2*-s.e-1?gt(new i(s),r,e,!0):(i.precision=t=n-s.e,s=Tr(s.plus(1),new i(1).minus(s),t+r,1),i.precision=r+4,i.rounding=1,s=s.ln(),i.precision=r,i.rounding=e,s.times(.5))):new i(NaN)};Pe.inverseSine=Pe.asin=function(){var r,e,t,n,s=this,i=s.constructor;return s.isZero()?new i(s):(e=s.abs().cmp(1),t=i.precision,n=i.rounding,e!==-1?e===0?(r=Na(i,t+4,n).times(.5),r.s=s.s,r):new i(NaN):(i.precision=t+6,i.rounding=1,s=s.div(new i(1).minus(s.times(s)).sqrt().plus(1)).atan(),i.precision=t,i.rounding=n,s.times(2)))};Pe.inverseTangent=Pe.atan=function(){var r,e,t,n,s,i,a,u,c,f=this,h=f.constructor,m=h.precision,g=h.rounding;if(f.isFinite()){if(f.isZero())return new h(f);if(f.abs().eq(1)&&m+4<=k2)return a=Na(h,m+4,g).times(.25),a.s=f.s,a}else{if(!f.s)return new h(NaN);if(m+4<=k2)return a=Na(h,m+4,g).times(.5),a.s=f.s,a}for(h.precision=u=m+10,h.rounding=1,t=Math.min(28,u/bt+2|0),r=t;r;--r)f=f.div(f.times(f).plus(1).sqrt().plus(1));for(_t=!1,e=Math.ceil(u/bt),n=1,c=f.times(f),a=new h(f),s=f;r!==-1;)if(s=s.times(c),i=a.minus(s.div(n+=2)),s=s.times(c),a=i.plus(s.div(n+=2)),a.d[e]!==void 0)for(r=e;a.d[r]===i.d[r]&&r--;);return t&&(a=a.times(2<<t-1)),_t=!0,gt(a,h.precision=m,h.rounding=g,!0)};Pe.isFinite=function(){return!!this.d};Pe.isInteger=Pe.isInt=function(){return!!this.d&&ns(this.e/bt)>this.d.length-2};Pe.isNaN=function(){return!this.s};Pe.isNegative=Pe.isNeg=function(){return this.s<0};Pe.isPositive=Pe.isPos=function(){return this.s>0};Pe.isZero=function(){return!!this.d&&this.d[0]===0};Pe.lessThan=Pe.lt=function(r){return this.cmp(r)<0};Pe.lessThanOrEqualTo=Pe.lte=function(r){return this.cmp(r)<1};Pe.logarithm=Pe.log=function(r){var e,t,n,s,i,a,u,c,f=this,h=f.constructor,m=h.precision,g=h.rounding,x=5;if(r==null)r=new h(10),e=!0;else{if(r=new h(r),t=r.d,r.s<0||!t||!t[0]||r.eq(1))return new h(NaN);e=r.eq(10)}if(t=f.d,f.s<0||!t||!t[0]||f.eq(1))return new h(t&&!t[0]?-1/0:f.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)i=!0;else{for(s=t[0];s%10===0;)s/=10;i=s!==1}if(_t=!1,u=m+x,a=Tu(f,u),n=e?aw(h,u+10):Tu(r,u),c=Tr(a,n,u,1),G0(c.d,s=m,g))do if(u+=10,a=Tu(f,u),n=e?aw(h,u+10):Tu(r,u),c=Tr(a,n,u,1),!i){+Fn(c.d).slice(s+1,s+15)+1==1e14&&(c=gt(c,m+1,0));break}while(G0(c.d,s+=10,g));return _t=!0,gt(c,m,g)};Pe.minus=Pe.sub=function(r){var e,t,n,s,i,a,u,c,f,h,m,g,x=this,v=x.constructor;if(r=new v(r),!x.d||!r.d)return!x.s||!r.s?r=new v(NaN):x.d?r.s=-r.s:r=new v(r.d||x.s!==r.s?x:NaN),r;if(x.s!=r.s)return r.s=-r.s,x.plus(r);if(f=x.d,g=r.d,u=v.precision,c=v.rounding,!f[0]||!g[0]){if(g[0])r.s=-r.s;else if(f[0])r=new v(x);else return new v(c===3?-0:0);return _t?gt(r,u,c):r}if(t=ns(r.e/bt),h=ns(x.e/bt),f=f.slice(),i=h-t,i){for(m=i<0,m?(e=f,i=-i,a=g.length):(e=g,t=h,a=f.length),n=Math.max(Math.ceil(u/bt),a)+2,i>n&&(i=n,e.length=1),e.reverse(),n=i;n--;)e.push(0);e.reverse()}else{for(n=f.length,a=g.length,m=n<a,m&&(a=n),n=0;n<a;n++)if(f[n]!=g[n]){m=f[n]<g[n];break}i=0}for(m&&(e=f,f=g,g=e,r.s=-r.s),a=f.length,n=g.length-a;n>0;--n)f[a++]=0;for(n=g.length;n>i;){if(f[--n]<g[n]){for(s=n;s&&f[--s]===0;)f[s]=Qi-1;--f[s],f[n]+=Qi}f[n]-=g[n]}for(;f[--a]===0;)f.pop();for(;f[0]===0;f.shift())--t;return f[0]?(r.d=f,r.e=uw(f,t),_t?gt(r,u,c):r):new v(c===3?-0:0)};Pe.modulo=Pe.mod=function(r){var e,t=this,n=t.constructor;return r=new n(r),!t.d||!r.s||r.d&&!r.d[0]?new n(NaN):!r.d||t.d&&!t.d[0]?gt(new n(t),n.precision,n.rounding):(_t=!1,n.modulo==9?(e=Tr(t,r.abs(),0,3,1),e.s*=r.s):e=Tr(t,r,0,n.modulo,1),e=e.times(r),_t=!0,t.minus(e))};Pe.naturalExponential=Pe.exp=function(){return L2(this)};Pe.naturalLogarithm=Pe.ln=function(){return Tu(this)};Pe.negated=Pe.neg=function(){var r=new this.constructor(this);return r.s=-r.s,gt(r)};Pe.plus=Pe.add=function(r){var e,t,n,s,i,a,u,c,f,h,m=this,g=m.constructor;if(r=new g(r),!m.d||!r.d)return!m.s||!r.s?r=new g(NaN):m.d||(r=new g(r.d||m.s===r.s?m:NaN)),r;if(m.s!=r.s)return r.s=-r.s,m.minus(r);if(f=m.d,h=r.d,u=g.precision,c=g.rounding,!f[0]||!h[0])return h[0]||(r=new g(m)),_t?gt(r,u,c):r;if(i=ns(m.e/bt),n=ns(r.e/bt),f=f.slice(),s=i-n,s){for(s<0?(t=f,s=-s,a=h.length):(t=h,n=i,a=f.length),i=Math.ceil(u/bt),a=i>a?i+1:a+1,s>a&&(s=a,t.length=1),t.reverse();s--;)t.push(0);t.reverse()}for(a=f.length,s=h.length,a-s<0&&(s=a,t=h,h=f,f=t),e=0;s;)e=(f[--s]=f[s]+h[s]+e)/Qi|0,f[s]%=Qi;for(e&&(f.unshift(e),++n),a=f.length;f[--a]==0;)f.pop();return r.d=f,r.e=uw(f,n),_t?gt(r,u,c):r};Pe.precision=Pe.sd=function(r){var e,t=this;if(r!==void 0&&r!==!!r&&r!==1&&r!==0)throw Error(Iu+r);return t.d?(e=_O(t.d),r&&t.e+1>e&&(e=t.e+1)):e=NaN,e};Pe.round=function(){var r=this,e=r.constructor;return gt(new e(r),r.e+1,e.rounding)};Pe.sine=Pe.sin=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+bt,n.rounding=1,t=VW(n,PO(n,t)),n.precision=r,n.rounding=e,gt(Ao>2?t.neg():t,r,e,!0)):new n(NaN)};Pe.squareRoot=Pe.sqrt=function(){var r,e,t,n,s,i,a=this,u=a.d,c=a.e,f=a.s,h=a.constructor;if(f!==1||!u||!u[0])return new h(!f||f<0&&(!u||u[0])?NaN:u?a:1/0);for(_t=!1,f=Math.sqrt(+a),f==0||f==1/0?(e=Fn(u),(e.length+c)%2==0&&(e+="0"),f=Math.sqrt(e),c=ns((c+1)/2)-(c<0||c%2),f==1/0?e="5e"+c:(e=f.toExponential(),e=e.slice(0,e.indexOf("e")+1)+c),n=new h(e)):n=new h(f.toString()),t=(c=h.precision)+3;;)if(i=n,n=i.plus(Tr(a,i,t+2,1)).times(.5),Fn(i.d).slice(0,t)===(e=Fn(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!s&&e=="4999"){if(!s&&(gt(i,c+1,0),i.times(i).eq(a))){n=i;break}t+=4,s=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(gt(n,c+1,1),r=!n.times(n).eq(a));break}return _t=!0,gt(n,c,h.rounding,r)};Pe.tangent=Pe.tan=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+10,n.rounding=1,t=t.sin(),t.s=1,t=Tr(t,new n(1).minus(t.times(t)).sqrt(),r+10,0),n.precision=r,n.rounding=e,gt(Ao==2||Ao==4?t.neg():t,r,e,!0)):new n(NaN)};Pe.times=Pe.mul=function(r){var e,t,n,s,i,a,u,c,f,h=this,m=h.constructor,g=h.d,x=(r=new m(r)).d;if(r.s*=h.s,!g||!g[0]||!x||!x[0])return new m(!r.s||g&&!g[0]&&!x||x&&!x[0]&&!g?NaN:!g||!x?r.s/0:r.s*0);for(t=ns(h.e/bt)+ns(r.e/bt),c=g.length,f=x.length,c<f&&(i=g,g=x,x=i,a=c,c=f,f=a),i=[],a=c+f,n=a;n--;)i.push(0);for(n=f;--n>=0;){for(e=0,s=c+n;s>n;)u=i[s]+x[n]*g[s-n-1]+e,i[s--]=u%Qi|0,e=u/Qi|0;i[s]=(i[s]+e)%Qi|0}for(;!i[--a];)i.pop();return e?++t:i.shift(),r.d=i,r.e=uw(i,t),_t?gt(r,m.precision,m.rounding):r};Pe.toBinary=function(r,e){return V2(this,2,r,e)};Pe.toDecimalPlaces=Pe.toDP=function(r,e){var t=this,n=t.constructor;return t=new n(t),r===void 0?t:(Is(r,0,_u),e===void 0?e=n.rounding:Is(e,0,8),gt(t,r+t.e+1,e))};Pe.toExponential=function(r,e){var t,n=this,s=n.constructor;return r===void 0?t=Ta(n,!0):(Is(r,0,_u),e===void 0?e=s.rounding:Is(e,0,8),n=gt(new s(n),r+1,e),t=Ta(n,!0,r+1)),n.isNeg()&&!n.isZero()?"-"+t:t};Pe.toFixed=function(r,e){var t,n,s=this,i=s.constructor;return r===void 0?t=Ta(s):(Is(r,0,_u),e===void 0?e=i.rounding:Is(e,0,8),n=gt(new i(s),r+s.e+1,e),t=Ta(n,!1,r+n.e+1)),s.isNeg()&&!s.isZero()?"-"+t:t};Pe.toFraction=function(r){var e,t,n,s,i,a,u,c,f,h,m,g,x=this,v=x.d,w=x.constructor;if(!v)return new w(x);if(f=t=new w(1),n=c=new w(0),e=new w(n),i=e.e=_O(v)-x.e-1,a=i%bt,e.d[0]=Sn(10,a<0?bt+a:a),r==null)r=i>0?e:f;else{if(u=new w(r),!u.isInt()||u.lt(f))throw Error(Iu+u);r=u.gt(e)?i>0?e:f:u}for(_t=!1,u=new w(Fn(v)),h=w.precision,w.precision=i=v.length*bt*2;m=Tr(u,e,0,1,1),s=t.plus(m.times(n)),s.cmp(r)!=1;)t=n,n=s,s=f,f=c.plus(m.times(s)),c=s,s=e,e=u.minus(m.times(s)),u=s;return s=Tr(r.minus(t),n,0,1,1),c=c.plus(s.times(f)),t=t.plus(s.times(n)),c.s=f.s=x.s,g=Tr(f,n,i,1).minus(x).abs().cmp(Tr(c,t,i,1).minus(x).abs())<1?[f,n]:[c,t],w.precision=h,_t=!0,g};Pe.toHexadecimal=Pe.toHex=function(r,e){return V2(this,16,r,e)};Pe.toNearest=function(r,e){var t=this,n=t.constructor;if(t=new n(t),r==null){if(!t.d)return t;r=new n(1),e=n.rounding}else{if(r=new n(r),e===void 0?e=n.rounding:Is(e,0,8),!t.d)return r.s?t:r;if(!r.d)return r.s&&(r.s=t.s),r}return r.d[0]?(_t=!1,t=Tr(t,r,0,e,1).times(r),_t=!0,gt(t)):(r.s=t.s,t=r),t};Pe.toNumber=function(){return+this};Pe.toOctal=function(r,e){return V2(this,8,r,e)};Pe.toPower=Pe.pow=function(r){var e,t,n,s,i,a,u=this,c=u.constructor,f=+(r=new c(r));if(!u.d||!r.d||!u.d[0]||!r.d[0])return new c(Sn(+u,f));if(u=new c(u),u.eq(1))return u;if(n=c.precision,i=c.rounding,r.eq(1))return gt(u,n,i);if(e=ns(r.e/bt),e>=r.d.length-1&&(t=f<0?-f:f)<=PW)return s=BO(c,u,t,n),r.s<0?new c(1).div(s):gt(s,n,i);if(a=u.s,a<0){if(e<r.d.length-1)return new c(NaN);if((r.d[e]&1)==0&&(a=1),u.e==0&&u.d[0]==1&&u.d.length==1)return u.s=a,u}return t=Sn(+u,f),e=t==0||!isFinite(t)?ns(f*(Math.log("0."+Fn(u.d))/Math.LN10+u.e+1)):new c(t+"").e,e>c.maxE+1||e<c.minE-1?new c(e>0?a/0:0):(_t=!1,c.rounding=u.s=1,t=Math.min(12,(e+"").length),s=L2(r.times(Tu(u,n+t)),n),s.d&&(s=gt(s,n+5,1),G0(s.d,n,i)&&(e=n+10,s=gt(L2(r.times(Tu(u,e+t)),e),e+5,1),+Fn(s.d).slice(n+1,n+15)+1==1e14&&(s=gt(s,n+1,0)))),s.s=a,_t=!0,c.rounding=i,gt(s,n,i))};Pe.toPrecision=function(r,e){var t,n=this,s=n.constructor;return r===void 0?t=Ta(n,n.e<=s.toExpNeg||n.e>=s.toExpPos):(Is(r,1,_u),e===void 0?e=s.rounding:Is(e,0,8),n=gt(new s(n),r,e),t=Ta(n,r<=n.e||n.e<=s.toExpNeg,r)),n.isNeg()&&!n.isZero()?"-"+t:t};Pe.toSignificantDigits=Pe.toSD=function(r,e){var t=this,n=t.constructor;return r===void 0?(r=n.precision,e=n.rounding):(Is(r,1,_u),e===void 0?e=n.rounding:Is(e,0,8)),gt(new n(t),r,e)};Pe.toString=function(){var r=this,e=r.constructor,t=Ta(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()&&!r.isZero()?"-"+t:t};Pe.truncated=Pe.trunc=function(){return gt(new this.constructor(this),this.e+1,1)};Pe.valueOf=Pe.toJSON=function(){var r=this,e=r.constructor,t=Ta(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()?"-"+t:t};function Fn(r){var e,t,n,s=r.length-1,i="",a=r[0];if(s>0){for(i+=a,e=1;e<s;e++)n=r[e]+"",t=bt-n.length,t&&(i+=Nu(t)),i+=n;a=r[e],n=a+"",t=bt-n.length,t&&(i+=Nu(t))}else if(a===0)return"0";for(;a%10===0;)a/=10;return i+a}o(Fn,"digitsToString");function Is(r,e,t){if(r!==~~r||r<e||r>t)throw Error(Iu+r)}o(Is,"checkInt32");function G0(r,e,t,n){var s,i,a,u;for(i=r[0];i>=10;i/=10)--e;return--e<0?(e+=bt,s=0):(s=Math.ceil((e+1)/bt),e%=bt),i=Sn(10,bt-e),u=r[s]%i|0,n==null?e<3?(e==0?u=u/100|0:e==1&&(u=u/10|0),a=t<4&&u==99999||t>3&&u==49999||u==5e4||u==0):a=(t<4&&u+1==i||t>3&&u+1==i/2)&&(r[s+1]/i/100|0)==Sn(10,e-2)-1||(u==i/2||u==0)&&(r[s+1]/i/100|0)==0:e<4?(e==0?u=u/1e3|0:e==1?u=u/100|0:e==2&&(u=u/10|0),a=(n||t<4)&&u==9999||!n&&t>3&&u==4999):a=((n||t<4)&&u+1==i||!n&&t>3&&u+1==i/2)&&(r[s+1]/i/1e3|0)==Sn(10,e-3)-1,a}o(G0,"checkRoundingDigits");function rw(r,e,t){for(var n,s=[0],i,a=0,u=r.length;a<u;){for(i=s.length;i--;)s[i]*=e;for(s[0]+=P2.indexOf(r.charAt(a++)),n=0;n<s.length;n++)s[n]>t-1&&(s[n+1]===void 0&&(s[n+1]=0),s[n+1]+=s[n]/t|0,s[n]%=t)}return s.reverse()}o(rw,"convertBase");function kW(r,e){var t,n,s;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),s=(1/cw(4,t)).toString()):(t=16,s="2.3283064365386962890625e-10"),r.precision+=t,e=tp(r,1,e.times(s),new r(1));for(var i=t;i--;){var a=e.times(e);e=a.times(a).minus(a).times(8).plus(1)}return r.precision-=t,e}o(kW,"cosine");var Tr=(function(){function r(n,s,i){var a,u=0,c=n.length;for(n=n.slice();c--;)a=n[c]*s+u,n[c]=a%i|0,u=a/i|0;return u&&n.unshift(u),n}o(r,"multiplyInteger");function e(n,s,i,a){var u,c;if(i!=a)c=i>a?1:-1;else for(u=c=0;u<i;u++)if(n[u]!=s[u]){c=n[u]>s[u]?1:-1;break}return c}o(e,"compare");function t(n,s,i,a){for(var u=0;i--;)n[i]-=u,u=n[i]<s[i]?1:0,n[i]=u*a+n[i]-s[i];for(;!n[0]&&n.length>1;)n.shift()}return o(t,"subtract"),function(n,s,i,a,u,c){var f,h,m,g,x,v,w,S,A,T,b,E,C,_,F,R,q,H,K,X,pe=n.constructor,le=n.s==s.s?1:-1,ue=n.d,ee=s.d;if(!ue||!ue[0]||!ee||!ee[0])return new pe(!n.s||!s.s||(ue?ee&&ue[0]==ee[0]:!ee)?NaN:ue&&ue[0]==0||!ee?le*0:le/0);for(c?(x=1,h=n.e-s.e):(c=Qi,x=bt,h=ns(n.e/x)-ns(s.e/x)),K=ee.length,q=ue.length,A=new pe(le),T=A.d=[],m=0;ee[m]==(ue[m]||0);m++);if(ee[m]>(ue[m]||0)&&h--,i==null?(_=i=pe.precision,a=pe.rounding):u?_=i+(n.e-s.e)+1:_=i,_<0)T.push(1),v=!0;else{if(_=_/x+2|0,m=0,K==1){for(g=0,ee=ee[0],_++;(m<q||g)&&_--;m++)F=g*c+(ue[m]||0),T[m]=F/ee|0,g=F%ee|0;v=g||m<q}else{for(g=c/(ee[0]+1)|0,g>1&&(ee=r(ee,g,c),ue=r(ue,g,c),K=ee.length,q=ue.length),R=K,b=ue.slice(0,K),E=b.length;E<K;)b[E++]=0;X=ee.slice(),X.unshift(0),H=ee[0],ee[1]>=c/2&&++H;do g=0,f=e(ee,b,K,E),f<0?(C=b[0],K!=E&&(C=C*c+(b[1]||0)),g=C/H|0,g>1?(g>=c&&(g=c-1),w=r(ee,g,c),S=w.length,E=b.length,f=e(w,b,S,E),f==1&&(g--,t(w,K<S?X:ee,S,c))):(g==0&&(f=g=1),w=ee.slice()),S=w.length,S<E&&w.unshift(0),t(b,w,E,c),f==-1&&(E=b.length,f=e(ee,b,K,E),f<1&&(g++,t(b,K<E?X:ee,E,c))),E=b.length):f===0&&(g++,b=[0]),T[m++]=g,f&&b[0]?b[E++]=ue[R]||0:(b=[ue[R]],E=1);while((R++<q||b[0]!==void 0)&&_--);v=b[0]!==void 0}T[0]||T.shift()}if(x==1)A.e=h,AO=v;else{for(m=1,g=T[0];g>=10;g/=10)m++;A.e=m+h*x-1,gt(A,u?i+A.e+1:i,a,v)}return A}})();function gt(r,e,t,n){var s,i,a,u,c,f,h,m,g,x=r.constructor;e:if(e!=null){if(m=r.d,!m)return r;for(s=1,u=m[0];u>=10;u/=10)s++;if(i=e-s,i<0)i+=bt,a=e,h=m[g=0],c=h/Sn(10,s-a-1)%10|0;else if(g=Math.ceil((i+1)/bt),u=m.length,g>=u)if(n){for(;u++<=g;)m.push(0);h=c=0,s=1,i%=bt,a=i-bt+1}else break e;else{for(h=u=m[g],s=1;u>=10;u/=10)s++;i%=bt,a=i-bt+s,c=a<0?0:h/Sn(10,s-a-1)%10|0}if(n=n||e<0||m[g+1]!==void 0||(a<0?h:h%Sn(10,s-a-1)),f=t<4?(c||n)&&(t==0||t==(r.s<0?3:2)):c>5||c==5&&(t==4||n||t==6&&(i>0?a>0?h/Sn(10,s-a):0:m[g-1])%10&1||t==(r.s<0?8:7)),e<1||!m[0])return m.length=0,f?(e-=r.e+1,m[0]=Sn(10,(bt-e%bt)%bt),r.e=-e||0):m[0]=r.e=0,r;if(i==0?(m.length=g,u=1,g--):(m.length=g+1,u=Sn(10,bt-i),m[g]=a>0?(h/Sn(10,s-a)%Sn(10,a)|0)*u:0),f)for(;;)if(g==0){for(i=1,a=m[0];a>=10;a/=10)i++;for(a=m[0]+=u,u=1;a>=10;a/=10)u++;i!=u&&(r.e++,m[0]==Qi&&(m[0]=1));break}else{if(m[g]+=u,m[g]!=Qi)break;m[g--]=0,u=1}for(i=m.length;m[--i]===0;)m.pop()}return _t&&(r.e>x.maxE?(r.d=null,r.e=NaN):r.e<x.minE&&(r.e=0,r.d=[0])),r}o(gt,"finalise");function Ta(r,e,t){if(!r.isFinite())return RO(r);var n,s=r.e,i=Fn(r.d),a=i.length;return e?(t&&(n=t-a)>0?i=i.charAt(0)+"."+i.slice(1)+Nu(n):a>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(r.e<0?"e":"e+")+r.e):s<0?(i="0."+Nu(-s-1)+i,t&&(n=t-a)>0&&(i+=Nu(n))):s>=a?(i+=Nu(s+1-a),t&&(n=t-s-1)>0&&(i=i+"."+Nu(n))):((n=s+1)<a&&(i=i.slice(0,n)+"."+i.slice(n)),t&&(n=t-a)>0&&(s+1===a&&(i+="."),i+=Nu(n))),i}o(Ta,"finiteToString");function uw(r,e){var t=r[0];for(e*=bt;t>=10;t/=10)e++;return e}o(uw,"getBase10Exponent");function aw(r,e,t){if(e>OW)throw _t=!0,t&&(r.precision=t),Error(CO);return gt(new r(sw),e,1,!0)}o(aw,"getLn10");function Na(r,e,t){if(e>k2)throw Error(CO);return gt(new r(iw),e,t,!0)}o(Na,"getPi");function _O(r){var e=r.length-1,t=e*bt+1;if(e=r[e],e){for(;e%10==0;e/=10)t--;for(e=r[0];e>=10;e/=10)t++}return t}o(_O,"getPrecision");function Nu(r){for(var e="";r--;)e+="0";return e}o(Nu,"getZeroString");function BO(r,e,t,n){var s,i=new r(1),a=Math.ceil(n/bt+4);for(_t=!1;;){if(t%2&&(i=i.times(e),bO(i.d,a)&&(s=!0)),t=ns(t/2),t===0){t=i.d.length-1,s&&i.d[t]===0&&++i.d[t];break}e=e.times(e),bO(e.d,a)}return _t=!0,i}o(BO,"intPow");function SO(r){return r.d[r.d.length-1]&1}o(SO,"isOdd");function DO(r,e,t){for(var n,s,i=new r(e[0]),a=0;++a<e.length;){if(s=new r(e[a]),!s.s){i=s;break}n=i.cmp(s),(n===t||n===0&&i.s===t)&&(i=s)}return i}o(DO,"maxOrMin");function L2(r,e){var t,n,s,i,a,u,c,f=0,h=0,m=0,g=r.constructor,x=g.rounding,v=g.precision;if(!r.d||!r.d[0]||r.e>17)return new g(r.d?r.d[0]?r.s<0?0:1/0:1:r.s?r.s<0?0:r:NaN);for(e==null?(_t=!1,c=v):c=e,u=new g(.03125);r.e>-2;)r=r.times(u),m+=5;for(n=Math.log(Sn(2,m))/Math.LN10*2+5|0,c+=n,t=i=a=new g(1),g.precision=c;;){if(i=gt(i.times(r),c,1),t=t.times(++h),u=a.plus(Tr(i,t,c,1)),Fn(u.d).slice(0,c)===Fn(a.d).slice(0,c)){for(s=m;s--;)a=gt(a.times(a),c,1);if(e==null)if(f<3&&G0(a.d,c-n,x,f))g.precision=c+=10,t=i=u=new g(1),h=0,f++;else return gt(a,g.precision=v,x,_t=!0);else return g.precision=v,a}a=u}}o(L2,"naturalExponential");function Tu(r,e){var t,n,s,i,a,u,c,f,h,m,g,x=1,v=10,w=r,S=w.d,A=w.constructor,T=A.rounding,b=A.precision;if(w.s<0||!S||!S[0]||!w.e&&S[0]==1&&S.length==1)return new A(S&&!S[0]?-1/0:w.s!=1?NaN:S?0:w);if(e==null?(_t=!1,h=b):h=e,A.precision=h+=v,t=Fn(S),n=t.charAt(0),Math.abs(i=w.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)w=w.times(r),t=Fn(w.d),n=t.charAt(0),x++;i=w.e,n>1?(w=new A("0."+t),i++):w=new A(n+"."+t.slice(1))}else return f=aw(A,h+2,b).times(i+""),w=Tu(new A(n+"."+t.slice(1)),h-v).plus(f),A.precision=b,e==null?gt(w,b,T,_t=!0):w;for(m=w,c=a=w=Tr(w.minus(1),w.plus(1),h,1),g=gt(w.times(w),h,1),s=3;;){if(a=gt(a.times(g),h,1),f=c.plus(Tr(a,new A(s),h,1)),Fn(f.d).slice(0,h)===Fn(c.d).slice(0,h))if(c=c.times(2),i!==0&&(c=c.plus(aw(A,h+2,b).times(i+""))),c=Tr(c,new A(x),h,1),e==null)if(G0(c.d,h-v,T,u))A.precision=h+=v,f=a=w=Tr(m.minus(1),m.plus(1),h,1),g=gt(w.times(w),h,1),s=u=1;else return gt(c,A.precision=b,T,_t=!0);else return A.precision=b,c;c=f,s+=2}}o(Tu,"naturalLogarithm");function RO(r){return String(r.s*r.s/0)}o(RO,"nonFiniteToString");function nw(r,e){var t,n,s;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(t<0&&(t=n),t+=+e.slice(n+1),e=e.substring(0,n)):t<0&&(t=e.length),n=0;e.charCodeAt(n)===48;n++);for(s=e.length;e.charCodeAt(s-1)===48;--s);if(e=e.slice(n,s),e){if(s-=n,r.e=t=t-n-1,r.d=[],n=(t+1)%bt,t<0&&(n+=bt),n<s){for(n&&r.d.push(+e.slice(0,n)),s-=bt;n<s;)r.d.push(+e.slice(n,n+=bt));e=e.slice(n),n=bt-e.length}else n-=s;for(;n--;)e+="0";r.d.push(+e),_t&&(r.e>r.constructor.maxE?(r.d=null,r.e=NaN):r.e<r.constructor.minE&&(r.e=0,r.d=[0]))}else r.e=0,r.d=[0];return r}o(nw,"parseDecimal");function LW(r,e){var t,n,s,i,a,u,c,f,h;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),IO.test(e))return nw(r,e)}else if(e==="Infinity"||e==="NaN")return+e||(r.s=NaN),r.e=NaN,r.d=null,r;if(DW.test(e))t=16,e=e.toLowerCase();else if(BW.test(e))t=2;else if(RW.test(e))t=8;else throw Error(Iu+e);for(i=e.search(/p/i),i>0?(c=+e.slice(i+1),e=e.substring(2,i)):e=e.slice(2),i=e.indexOf("."),a=i>=0,n=r.constructor,a&&(e=e.replace(".",""),u=e.length,i=u-i,s=BO(n,new n(t),i,i*2)),f=rw(e,t,Qi),h=f.length-1,i=h;f[i]===0;--i)f.pop();return i<0?new n(r.s*0):(r.e=uw(f,h),r.d=f,_t=!1,a&&(r=Tr(r,s,u*4)),c&&(r=r.times(Math.abs(c)<54?Sn(2,c):rp.pow(2,c))),_t=!0,r)}o(LW,"parseOther");function VW(r,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:tp(r,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/cw(5,t)),e=tp(r,2,e,e);for(var s,i=new r(5),a=new r(16),u=new r(20);t--;)s=e.times(e),e=e.times(i.plus(s.times(a.times(s).minus(u))));return e}o(VW,"sine");function tp(r,e,t,n,s){var i,a,u,c,f=1,h=r.precision,m=Math.ceil(h/bt);for(_t=!1,c=t.times(t),u=new r(n);;){if(a=Tr(u.times(c),new r(e++*e++),h,1),u=s?n.plus(a):n.minus(a),n=Tr(a.times(c),new r(e++*e++),h,1),a=u.plus(n),a.d[m]!==void 0){for(i=m;a.d[i]===u.d[i]&&i--;);if(i==-1)break}i=u,u=n,n=a,a=i,f++}return _t=!0,a.d.length=m+1,a}o(tp,"taylorSeries");function cw(r,e){for(var t=r;--e;)t*=r;return t}o(cw,"tinyPow");function PO(r,e){var t,n=e.s<0,s=Na(r,r.precision,1),i=s.times(.5);if(e=e.abs(),e.lte(i))return Ao=n?4:1,e;if(t=e.divToInt(s),t.isZero())Ao=n?3:2;else{if(e=e.minus(t.times(s)),e.lte(i))return Ao=SO(t)?n?2:3:n?4:1,e;Ao=SO(t)?n?1:4:n?3:2}return e.minus(s).abs()}o(PO,"toLessThanHalfPi");function V2(r,e,t,n){var s,i,a,u,c,f,h,m,g,x=r.constructor,v=t!==void 0;if(v?(Is(t,1,_u),n===void 0?n=x.rounding:Is(n,0,8)):(t=x.precision,n=x.rounding),!r.isFinite())h=RO(r);else{for(h=Ta(r),a=h.indexOf("."),v?(s=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):s=e,a>=0&&(h=h.replace(".",""),g=new x(1),g.e=h.length-a,g.d=rw(Ta(g),10,s),g.e=g.d.length),m=rw(h,10,s),i=c=m.length;m[--c]==0;)m.pop();if(!m[0])h=v?"0p+0":"0";else{if(a<0?i--:(r=new x(r),r.d=m,r.e=i,r=Tr(r,g,t,n,0,s),m=r.d,i=r.e,f=AO),a=m[t],u=s/2,f=f||m[t+1]!==void 0,f=n<4?(a!==void 0||f)&&(n===0||n===(r.s<0?3:2)):a>u||a===u&&(n===4||f||n===6&&m[t-1]&1||n===(r.s<0?8:7)),m.length=t,f)for(;++m[--t]>s-1;)m[t]=0,t||(++i,m.unshift(1));for(c=m.length;!m[c-1];--c);for(a=0,h="";a<c;a++)h+=P2.charAt(m[a]);if(v){if(c>1)if(e==16||e==8){for(a=e==16?4:3,--c;c%a;c++)h+="0";for(m=rw(h,s,e),c=m.length;!m[c-1];--c);for(a=1,h="1.";a<c;a++)h+=P2.charAt(m[a])}else h=h.charAt(0)+"."+h.slice(1);h=h+(i<0?"p":"p+")+i}else if(i<0){for(;++i;)h="0"+h;h="0."+h}else if(++i>c)for(i-=c;i--;)h+="0";else i<c&&(h=h.slice(0,i)+"."+h.slice(i))}h=(e==16?"0x":e==2?"0b":e==8?"0o":"")+h}return r.s<0?"-"+h:h}o(V2,"toStringBinary");function bO(r,e){if(r.length>e)return r.length=e,!0}o(bO,"truncate");function UW(r){return new this(r).abs()}o(UW,"abs");function jW(r){return new this(r).acos()}o(jW,"acos");function MW(r){return new this(r).acosh()}o(MW,"acosh");function FW(r,e){return new this(r).plus(e)}o(FW,"add");function qW(r){return new this(r).asin()}o(qW,"asin");function HW(r){return new this(r).asinh()}o(HW,"asinh");function KW(r){return new this(r).atan()}o(KW,"atan");function $W(r){return new this(r).atanh()}o($W,"atanh");function GW(r,e){r=new this(r),e=new this(e);var t,n=this.precision,s=this.rounding,i=n+4;return!r.s||!e.s?t=new this(NaN):!r.d&&!e.d?(t=Na(this,i,1).times(e.s>0?.25:.75),t.s=r.s):!e.d||r.isZero()?(t=e.s<0?Na(this,n,s):new this(0),t.s=r.s):!r.d||e.isZero()?(t=Na(this,i,1).times(.5),t.s=r.s):e.s<0?(this.precision=i,this.rounding=1,t=this.atan(Tr(r,e,i,1)),e=Na(this,i,1),this.precision=n,this.rounding=s,t=r.s<0?t.minus(e):t.plus(e)):t=this.atan(Tr(r,e,i,1)),t}o(GW,"atan2");function XW(r){return new this(r).cbrt()}o(XW,"cbrt");function WW(r){return gt(r=new this(r),r.e+1,2)}o(WW,"ceil");function zW(r,e,t){return new this(r).clamp(e,t)}o(zW,"clamp");function JW(r){if(!r||typeof r!="object")throw Error(ow+"Object expected");var e,t,n,s=r.defaults===!0,i=["precision",1,_u,"rounding",0,8,"toExpNeg",-ep,0,"toExpPos",0,ep,"maxE",0,ep,"minE",-ep,0,"modulo",0,9];for(e=0;e<i.length;e+=3)if(t=i[e],s&&(this[t]=O2[t]),(n=r[t])!==void 0)if(ns(n)===n&&n>=i[e+1]&&n<=i[e+2])this[t]=n;else throw Error(Iu+t+": "+n);if(t="crypto",s&&(this[t]=O2[t]),(n=r[t])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(NO);else this[t]=!1;else throw Error(Iu+t+": "+n);return this}o(JW,"config");function YW(r){return new this(r).cos()}o(YW,"cos");function QW(r){return new this(r).cosh()}o(QW,"cosh");function OO(r){var e,t,n;function s(i){var a,u,c,f=this;if(!(f instanceof s))return new s(i);if(f.constructor=s,EO(i)){f.s=i.s,_t?!i.d||i.e>s.maxE?(f.e=NaN,f.d=null):i.e<s.minE?(f.e=0,f.d=[0]):(f.e=i.e,f.d=i.d.slice()):(f.e=i.e,f.d=i.d?i.d.slice():i.d);return}if(c=typeof i,c==="number"){if(i===0){f.s=1/i<0?-1:1,f.e=0,f.d=[0];return}if(i<0?(i=-i,f.s=-1):f.s=1,i===~~i&&i<1e7){for(a=0,u=i;u>=10;u/=10)a++;_t?a>s.maxE?(f.e=NaN,f.d=null):a<s.minE?(f.e=0,f.d=[0]):(f.e=a,f.d=[i]):(f.e=a,f.d=[i]);return}if(i*0!==0){i||(f.s=NaN),f.e=NaN,f.d=null;return}return nw(f,i.toString())}if(c==="string")return(u=i.charCodeAt(0))===45?(i=i.slice(1),f.s=-1):(u===43&&(i=i.slice(1)),f.s=1),IO.test(i)?nw(f,i):LW(f,i);if(c==="bigint")return i<0?(i=-i,f.s=-1):f.s=1,nw(f,i.toString());throw Error(Iu+i)}if(o(s,"Decimal"),s.prototype=Pe,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.EUCLID=9,s.config=s.set=JW,s.clone=OO,s.isDecimal=EO,s.abs=UW,s.acos=jW,s.acosh=MW,s.add=FW,s.asin=qW,s.asinh=HW,s.atan=KW,s.atanh=$W,s.atan2=GW,s.cbrt=XW,s.ceil=WW,s.clamp=zW,s.cos=YW,s.cosh=QW,s.div=ZW,s.exp=ez,s.floor=tz,s.hypot=rz,s.ln=nz,s.log=sz,s.log10=az,s.log2=iz,s.max=oz,s.min=uz,s.mod=cz,s.mul=lz,s.pow=fz,s.random=hz,s.round=pz,s.sign=dz,s.sin=mz,s.sinh=gz,s.sqrt=vz,s.sub=yz,s.sum=xz,s.tan=wz,s.tanh=Sz,s.trunc=bz,r===void 0&&(r={}),r&&r.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)r.hasOwnProperty(t=n[e++])||(r[t]=this[t]);return s.config(r),s}o(OO,"clone");function ZW(r,e){return new this(r).div(e)}o(ZW,"div");function ez(r){return new this(r).exp()}o(ez,"exp");function tz(r){return gt(r=new this(r),r.e+1,3)}o(tz,"floor");function rz(){var r,e,t=new this(0);for(_t=!1,r=0;r<arguments.length;)if(e=new this(arguments[r++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return _t=!0,new this(1/0);t=e}return _t=!0,t.sqrt()}o(rz,"hypot");function EO(r){return r instanceof rp||r&&r.toStringTag===TO||!1}o(EO,"isDecimalInstance");function nz(r){return new this(r).ln()}o(nz,"ln");function sz(r,e){return new this(r).log(e)}o(sz,"log");function iz(r){return new this(r).log(2)}o(iz,"log2");function az(r){return new this(r).log(10)}o(az,"log10");function oz(){return DO(this,arguments,-1)}o(oz,"max");function uz(){return DO(this,arguments,1)}o(uz,"min");function cz(r,e){return new this(r).mod(e)}o(cz,"mod");function lz(r,e){return new this(r).mul(e)}o(lz,"mul");function fz(r,e){return new this(r).pow(e)}o(fz,"pow");function hz(r){var e,t,n,s,i=0,a=new this(1),u=[];if(r===void 0?r=this.precision:Is(r,1,_u),n=Math.ceil(r/bt),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));i<n;)s=e[i],s>=429e7?e[i]=crypto.getRandomValues(new Uint32Array(1))[0]:u[i++]=s%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);i<n;)s=e[i]+(e[i+1]<<8)+(e[i+2]<<16)+((e[i+3]&127)<<24),s>=214e7?crypto.randomBytes(4).copy(e,i):(u.push(s%1e7),i+=4);i=n/4}else throw Error(NO);else for(;i<n;)u[i++]=Math.random()*1e7|0;for(n=u[--i],r%=bt,n&&r&&(s=Sn(10,bt-r),u[i]=(n/s|0)*s);u[i]===0;i--)u.pop();if(i<0)t=0,u=[0];else{for(t=-1;u[0]===0;t-=bt)u.shift();for(n=1,s=u[0];s>=10;s/=10)n++;n<bt&&(t-=bt-n)}return a.e=t,a.d=u,a}o(hz,"random");function pz(r){return gt(r=new this(r),r.e+1,this.rounding)}o(pz,"round");function dz(r){return r=new this(r),r.d?r.d[0]?r.s:0*r.s:r.s||NaN}o(dz,"sign");function mz(r){return new this(r).sin()}o(mz,"sin");function gz(r){return new this(r).sinh()}o(gz,"sinh");function vz(r){return new this(r).sqrt()}o(vz,"sqrt");function yz(r,e){return new this(r).sub(e)}o(yz,"sub");function xz(){var r=0,e=arguments,t=new this(e[r]);for(_t=!1;t.s&&++r<e.length;)t=t.plus(e[r]);return _t=!0,gt(t,this.precision,this.rounding)}o(xz,"sum");function wz(r){return new this(r).tan()}o(wz,"tan");function Sz(r){return new this(r).tanh()}o(Sz,"tanh");function bz(r){return gt(r=new this(r),r.e+1,1)}o(bz,"trunc");Pe[Symbol.for("nodejs.util.inspect.custom")]=Pe.toString;Pe[Symbol.toStringTag]="Decimal";var rp=Pe.constructor=OO(O2);sw=new rp(sw);iw=new rp(iw);var np=class r extends rp{static{o(this,"Decimal")}static from(e){return new r(e)}static newOrZero(e){return e===void 0?r.from(0):r.from(e)}static newOrUndefined(e){if(e!==void 0)return r.from(e)}};var kO=class{static{o(this,"MemoryCacheAdapter")}cache=new Map;async get(e){return Promise.resolve(this.cache.get(e)??null)}has(e){return Promise.resolve(this.cache.has(e))}set(e,t){return this.cache.set(e,t),Promise.resolve(!0)}};var lw=class{static{o(this,"NullCacheAdapter")}async get(e){return Promise.resolve(null)}has(e){return Promise.resolve(!1)}set(e,t){return Promise.resolve(!0)}};var Vh=Zx(Yk(),1);import pq from"fs";import The from"path";import N0 from"crypto";var iZ=o(r=>!!r&&typeof r=="object"&&"message"in r,"hasMessageInRecord"),Fu=o(r=>typeof r=="string"?ti(new pn(r)):r instanceof Error?ti(new pn(r.message,{cause:r.cause})):iZ(r)?ti(new pn(r.message)):ti(new pn("unexpected error")),"leftFromError");import"reflect-metadata";var yU=Zx(mU(),1);import{constants as vue}from"crypto";import{Agent as gU}from"https";var vU=class{static{o(this,"SoapRemoteTransmissionRepository")}toolkit;certificateRepository;constructor(e,t){this.toolkit=e,this.certificateRepository=t}setCertificate(e){return this.certificate=e,this}get httpsAgent(){let e={rejectUnauthorized:!1,secureOptions:vue.SSL_OP_LEGACY_SERVER_CONNECT};if(!this.certificate)return new gU({...e});let{ca:t,password:n,certificate:s,privateKey:i}=this.certificate;return new gU({passphrase:n,cert:s.toString(),ca:t.map(a=>a.toString()),key:this.certificateRepository.getStringPrivateKey(i),...e})}get defaultSoapHeaders(){return{"Content-Type":"application/soap+xml; charset=utf-8"}}async send(e){try{let t=this.httpsAgent,n=await(0,yU.createClientAsync)(`${e.url}?wsdl`,{attributesKey:"$",wsdl_options:{httpsAgent:t}});e.payload.$={xmlns:n.wsdl.definitions.$targetNamespace,...e.payload.$};let s=await this.toolkit.build(e.payload,{headless:!0,renderOpts:{pretty:!1},rootName:e.root}),i=this.toolkit.getFirstNode(s)??"",a=e.xsd,u=await this.toolkit.validate(i,a);if(u.isLeft())return u;let[c]=await n[`${e.method}Async`]({_xml:s},{httpsAgent:t});return ri(c)}catch(t){return Fu(t)}}};import{arch as Sue,platform as bue}from"os";import{join as Kg,dirname as r_,resolve as Eue}from"path";import{existsSync as ib}from"fs";import{resolve as wU}from"path";import{createRequire as xU}from"module";import{fileURLToPath as yue,pathToFileURL as xue}from"url";var wue=typeof jest<"u"||process.env.JEST_WORKER_ID!==void 0,Jp,SU=o(()=>{if(Jp!==void 0)return Jp;if(wue){Jp=void 0;return}try{Jp=new Function("try { return import.meta.url; } catch { return undefined; }")()}catch{Jp=void 0}return Jp},"getImportMetaUrl"),bU=o(()=>{if(typeof Xe<"u")return Xe;let r=SU();if(r)return xU(r);let e=xue(wU(process.cwd(),"package.json")).href;return xU(e)},"getRequireFn"),EU=o(()=>{if(typeof __filename<"u")return __filename;let r=SU();return r?yue(r):wU(process.cwd())},"getCurrentFile");var $g=o(r=>bU()(r),"exportRequireModule"),AU=o(r=>{r=`${r}.node`;let e=`${bue()}-${Sue()}`;if(process.env.NFETS_ADDONS_DIR)return $g(Kg(process.env.NFETS_ADDONS_DIR,r));let t=EU(),n=Eue(t,"../../../../"),s=Kg(n,"build","addons",e,r);if(ib(s))return $g(s);let i=t;for(let a=0;a<5;a++){let u=Kg(i,"build","addons",e,r);if(ib(u))return $g(u);let c=r_(i);if(c===i)break;i=c}i=t;for(let a=0;a<5;a++){let u=Kg(i,"node_modules","nfets","build","addons",e,r);if(ib(u))return $g(u);let c=r_(i);if(c===i)break;i=c}i=t;for(let a=0;a<5;a++){let u=Kg(i,"build","Release",r);if(ib(u))return $g(u);let c=r_(i);if(c===i)break;i=c}throw new Error(`Addon ${e}/${r} not found`)},"addon");var Aue=AU("xml_validator"),CU=Aue;var whe=Zx(Xj(),1);import xhe from"crypto";var Wj="application/xml";var Ut;(function(r){r[r.None=0]="None",r[r.Element=1]="Element",r[r.Attribute=2]="Attribute",r[r.Text=3]="Text",r[r.CDATA=4]="CDATA",r[r.EntityReference=5]="EntityReference",r[r.Entity=6]="Entity",r[r.ProcessingInstruction=7]="ProcessingInstruction",r[r.Comment=8]="Comment",r[r.Document=9]="Document",r[r.DocumentType=10]="DocumentType",r[r.DocumentFragment=11]="DocumentFragment",r[r.Notation=12]="Notation",r[r.Whitespace=13]="Whitespace",r[r.SignificantWhitespace=14]="SignificantWhitespace",r[r.EndElement=15]="EndElement",r[r.EndEntity=16]="EndEntity",r[r.XmlDeclaration=17]="XmlDeclaration"})(Ut||(Ut={}));function Cue(r,e){let t=r.ownerDocument==null?r:r.ownerDocument,n=document.createNSResolver(r.ownerDocument==null?r.documentElement:r.ownerDocument.documentElement),s=t.evaluate(e,r,n,XPathResult.ANY_TYPE,null),i=[],a;for(;a=s.iterateNext();)i.push(a);return i}o(Cue,"SelectNodesEx");function Nue(r,e){let t=Yp("xpath").select;return t(e,r)}o(Nue,"SelectNodesNode");var zj=typeof self<"u"?Cue:Nue;function Li(r){r=r.replace(/\r\n/g,`
90
90
  `).replace(/\r/g,`
91
91
  `);let e;return typeof DOMParser<"u"?e=DOMParser:e=Yp("DOMParser"),new e().parseFromString(r,Wj)}o(Li,"Parse");function Qa(r){let e;return typeof XMLSerializer<"u"?e=XMLSerializer:e=Yp("XMLSerializer"),new e().serializeToString(r)}o(Qa,"Stringify");function Sb(r,e){let t=zj(r,e);return t&&t.length>0?t[0]:null}o(Sb,"SelectSingleNode");function Jj(r,e){return r&&r.nodeType===e}o(Jj,"isNodeType");function oi(r){return Jj(r,Ut.Element)}o(oi,"isElement");function Jl(r){return Jj(r,Ut.Document)}o(Jl,"isDocument");var Yj=new Map;function Qj(r){for(let e in r)Yj.set(e,r[e])}o(Qj,"setNodeDependencies");function Yp(r){let e=Yj.get(r);if(!e)throw new Error(`Node dependency not found: ${r}. Please use 'setNodeDependencies' to register it.`);return e}o(Yp,"getNodeDependency");var Wg="element",zg="attribute",bb="content";var Tue=1e9;function p_(r,...e){let t=r;for(let n=0;n<e.length;n++){let s=e[n];for(let i in s)Object.prototype.hasOwnProperty.call(s,i)&&(t[i]=s[i])}return t}o(p_,"assign");function jt(r){return e=>{let t=e;t.localName=r.localName||t.name,t.namespaceURI=r.namespaceURI||t.namespaceURI||null,t.prefix=r.prefix||t.prefix||null,t.parser=r.parser||t.parser,t.target!==t&&(t.items=p_({},t.items)),t.target=e}}o(jt,"XmlElement");function Gt(r={}){return(e,t)=>{let n=e.constructor,s=t;n.items||(n.items={}),n.target!==n&&(n.items=p_({},n.items)),n.target=e;let i;r.parser?i={parser:r.parser,required:r.required||!1,maxOccurs:r.maxOccurs||Tue,minOccurs:r.minOccurs===void 0?0:r.minOccurs,noRoot:r.noRoot||!1}:i={namespaceURI:r.namespaceURI||null,required:r.required||!1,prefix:r.prefix||null,defaultValue:r.defaultValue,converter:r.converter,noRoot:r.noRoot||!1},r.localName=r.localName||r.parser&&r.parser.localName||s;let a=n.items,u=r.parser&&r.parser.namespaceURI;a[s]={...i,namespaceURI:r.namespaceURI||u||null,prefix:r.prefix||r.parser&&r.parser.prefix||null,localName:r.localName,type:Wg},eM(e,s,r)}}o(Gt,"XmlChildElement");function Or(r={required:!1,namespaceURI:null}){return(e,t)=>{let n=e.constructor,s=t;r.localName||(r.localName=t),n.items||(n.items={}),n.target!==n&&(n.items=p_({},n.items)),n.target=e;let i=n.items;i[t]=r,i[t].type=zg,eM(e,s,r)}}o(Or,"XmlAttribute");function eM(r,e,t){let n=`_${e}`,s={set:o(function(i){this[n]!==i&&(this.element=null,this[n]=i)},"set"),get:o(function(){if(this[n]===void 0){let i=t.defaultValue;t.parser&&(i=new t.parser,i.localName=t.localName),this[n]=i}return this[n]},"get")};Object.defineProperty(r,n,{writable:!0,enumerable:!1}),Object.defineProperty(r,e,s)}o(eM,"defineProperty");var lc=class r{static{o(this,"Collection")}constructor(e){this.items=[],e&&(this.items=e)}get Count(){return this.items.length}Item(e){return this.items[e]||null}Add(e){this.items.push(e)}Pop(){return this.items.pop()}RemoveAt(e){this.items=this.items.filter((t,n)=>n!==e)}Clear(){this.items=[]}GetIterator(){return this.items}ForEach(e){this.GetIterator().forEach(e)}Map(e){return new r(this.GetIterator().map(e))}Filter(e){return new r(this.GetIterator().filter(e))}Sort(e){return new r(this.GetIterator().sort(e))}Every(e){return this.GetIterator().every(e)}Some(e){return this.GetIterator().some(e)}IsEmpty(){return this.Count===0}};function Iue(r,...e){let t=r.replace(/%([1-9]\d*)/g,(n,s)=>{let i=parseInt(s,10)-1;return e[i]!==void 0?e[i]:""});return t=t.replace(/%%/g,"%"),t}o(Iue,"printf");function _ue(r,e){let t=r+"";for(;t.length<e;)t="0"+t;return t}o(_ue,"padNum");var Fe=class{static{o(this,"XmlError")}constructor(e,...t){this.prefix="XMLJS",this.code=e,this.name=this.constructor.name;let n=Iue(ln[e],...t);this.message=`${this.prefix}${_ue(e,4)}: ${n}`,this.stack=new Error(this.message).stack}},Te;(function(r){r[r.NONE=0]="NONE",r[r.NULL_REFERENCE=1]="NULL_REFERENCE",r[r.NULL_PARAM=2]="NULL_PARAM",r[r.DECORATOR_NULL_PARAM=3]="DECORATOR_NULL_PARAM",r[r.COLLECTION_LIMIT=4]="COLLECTION_LIMIT",r[r.METHOD_NOT_IMPLEMENTED=5]="METHOD_NOT_IMPLEMENTED",r[r.METHOD_NOT_SUPPORTED=6]="METHOD_NOT_SUPPORTED",r[r.PARAM_REQUIRED=7]="PARAM_REQUIRED",r[r.CONVERTER_UNSUPPORTED=8]="CONVERTER_UNSUPPORTED",r[r.ELEMENT_MALFORMED=9]="ELEMENT_MALFORMED",r[r.ELEMENT_MISSING=10]="ELEMENT_MISSING",r[r.ATTRIBUTE_MISSING=11]="ATTRIBUTE_MISSING",r[r.CONTENT_MISSING=12]="CONTENT_MISSING",r[r.CRYPTOGRAPHIC=13]="CRYPTOGRAPHIC",r[r.CRYPTOGRAPHIC_NO_MODULE=14]="CRYPTOGRAPHIC_NO_MODULE",r[r.CRYPTOGRAPHIC_UNKNOWN_TRANSFORM=15]="CRYPTOGRAPHIC_UNKNOWN_TRANSFORM",r[r.ALGORITHM_NOT_SUPPORTED=16]="ALGORITHM_NOT_SUPPORTED",r[r.ALGORITHM_WRONG_NAME=17]="ALGORITHM_WRONG_NAME",r[r.XML_EXCEPTION=18]="XML_EXCEPTION",r[r.KEY_INFO_CLAUSE_NOT_SUPPORTED=19]="KEY_INFO_CLAUSE_NOT_SUPPORTED"})(Te||(Te={}));var ln={};ln[Te.NONE]="No description";ln[Te.NULL_REFERENCE]="Null reference";ln[Te.NULL_PARAM]="'%1' has empty '%2' object";ln[Te.DECORATOR_NULL_PARAM]="Decorator '%1' has empty '%2' parameter";ln[Te.COLLECTION_LIMIT]="Collection of '%1' in element '%2' has wrong amount of items";ln[Te.METHOD_NOT_IMPLEMENTED]="Method is not implemented";ln[Te.METHOD_NOT_SUPPORTED]="Method is not supported";ln[Te.PARAM_REQUIRED]="Required parameter is missing '%1'";ln[Te.CONVERTER_UNSUPPORTED]="Converter is not supported";ln[Te.ELEMENT_MALFORMED]="Malformed element '%1'";ln[Te.ELEMENT_MISSING]="Element '%1' is missing in '%2'";ln[Te.ATTRIBUTE_MISSING]="Attribute '%1' is missing in '%2'";ln[Te.CONTENT_MISSING]="Content is missing in '%1'";ln[Te.CRYPTOGRAPHIC]="Cryptographic error: %1";ln[Te.CRYPTOGRAPHIC_NO_MODULE]="WebCrypto module is not found";ln[Te.CRYPTOGRAPHIC_UNKNOWN_TRANSFORM]="Unknown transform %1";ln[Te.ALGORITHM_NOT_SUPPORTED]="Algorithm is not supported '%1'";ln[Te.ALGORITHM_WRONG_NAME]="Algorithm wrong name in use '%1'";ln[Te.XML_EXCEPTION]="XML exception: %1";ln[Te.KEY_INFO_CLAUSE_NOT_SUPPORTED]="KeyInfoClause type '%1' is not supported";var wr=class{static{o(this,"Convert")}static ToString(e,t="utf8"){let n=new Uint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(n);case"binary":return this.ToBinary(n);case"hex":return this.ToHex(n);case"base64":return this.ToBase64(n);case"base64url":return this.ToBase64Url(n);default:throw new Fe(Te.CONVERTER_UNSUPPORTED)}}static FromString(e,t="utf8"){switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);default:throw new Fe(Te.CONVERTER_UNSUPPORTED)}}static ToBase64(e){if(typeof btoa<"u"){let t=this.ToString(e,"binary");return btoa(t)}else{if(typeof Buffer<"u")return Buffer.from(e).toString("base64");throw new Fe(Te.CONVERTER_UNSUPPORTED)}}static FromBase64(e){if(e=e.replace(/\n/g,"").replace(/\r/g,"").replace(/\t/g,"").replace(/\s/g,""),typeof atob<"u")return this.FromBinary(atob(e));if(typeof Buffer<"u")return new Uint8Array(Buffer.from(e,"base64"));throw new Fe(Te.CONVERTER_UNSUPPORTED)}static FromBase64Url(e){return this.FromBase64(this.Base64Padding(e.replace(/-/g,"+").replace(/_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}static FromUtf8String(e){let t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length);for(let s=0;s<t.length;s++)n[s]=t.charCodeAt(s);return n}static ToUtf8String(e){let t=String.fromCharCode.apply(null,e);return decodeURIComponent(escape(t))}static FromBinary(e){let t=e.length,n=new Uint8Array(t);for(let s=0;s<t;s++)n[s]=e.charCodeAt(s);return n}static ToBinary(e){let t="";for(let n=0;n<e.length;n++)t=t+String.fromCharCode(e[n]);return t}static ToHex(e){let n=[];for(let s=0;s<e.length;s++){let i=e[s].toString(16);n.push(i.length===1?"0"+i:i)}return n.join("")}static FromHex(e){let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n=n+2){let s=e.slice(n,n+2);t[n/2]=parseInt(s,16)}return t}static ToDateTime(e){return new Date(e)}static FromDateTime(e){return e.toISOString()}static Base64Padding(e){let t=4-e.length%4;if(t<4)for(let n=0;n<t;n++)e+="=";return e}};var Vi={get:o(r=>{if(r)return wr.ToBase64(r)},"get"),set:o(r=>wr.FromBase64(r),"set")},Jg={get:o(r=>r?r.toString():"0","get"),set:o(r=>Number(r),"set")};var Bue="xml_root",Ms=class r{static{o(this,"XmlObject")}static LoadXml(e){let t=new this;return t.LoadXml(e),t}static GetElement(e,t,n=!0){let s=e.getElementsByTagName(t);if(n&&s.length===0)throw new Fe(Te.ELEMENT_MISSING,t,e.localName);return s[0]||null}static GetAttribute(e,t,n,s=!0){if(e.hasAttribute(t))return e.getAttribute(t);if(s)throw new Fe(Te.ATTRIBUTE_MISSING,t,e.localName);return n}static GetElementById(e,t){if(e==null||t==null)return null;let n=null;return Jl(e)&&(n=e.getElementById(t)),n==null&&(n=Sb(e,`//*[@*[local-name()='Id']='${t}']`),n==null&&(n=Sb(e,`//*[@*[local-name()='ID']='${t}']`),n==null&&(n=Sb(e,`//*[@*[local-name()='id']='${t}']`)))),n}static CreateDocument(e=Bue,t=null,n=null){if(n&&!t)throw new Fe(Te.PARAM_REQUIRED,"namespaceUri",`Prefix '${n}' requires namespaceUri`);let s="",i="",a="";n&&(s=n+":",i=":"+n),t&&(a=` xmlns${i}="${t}"`);let u=`${s}${e}`;return Li(`<${u}${a}></${u}>`)}static GetChildren(e,t,n){e=Jl(e)?e.documentElement:e;let s=[];for(let i=0;i<e.childNodes.length;i++){let a=e.childNodes[i];oi(a)&&a.localName===t&&(a.namespaceURI===n||!n)&&s.push(a)}return s}static GetFirstChild(e,t,n){e=Jl(e)?e.documentElement:e;for(let s=0;s<e.childNodes.length;s++){let i=e.childNodes[s];if(oi(i)&&i.localName===t&&(i.namespaceURI===n||!n))return i}return null}static GetChild(e,t,n,s=!0){for(let i=0;i<e.childNodes.length;i++){let a=e.childNodes[i];if(oi(a)&&a.localName===t&&(a.namespaceURI===n||!n))return a}if(s)throw new Fe(Te.ELEMENT_MISSING,t,e.localName);return null}constructor(e={}){if(this.prefix=this.GetStatic().prefix||null,this.localName=this.GetStatic().localName,this.namespaceURI=this.GetStatic().namespaceURI,e)for(let[t,n]of Object.entries(e))n!==void 0&&(this[t]=n)}get Element(){return this.element}get Prefix(){return this.prefix}set Prefix(e){this.prefix=e}get LocalName(){return this.localName||""}get NamespaceURI(){return this.namespaceURI||null}HasChanged(){let e=this.GetStatic();if(e.items)for(let t in e.items){if(!Object.prototype.hasOwnProperty.call(e.items,t))continue;let n=e.items[t],s=this[t];if(n.parser&&s&&s.HasChanged())return!0}return this.element===null}GetXml(e){if(!(e||this.HasChanged()))return this.element||null;let t=this,n=this.CreateDocument(),s=this.CreateElement(),i=this.GetStatic(),a=this.localName||"";if(i.items)for(let u in i.items){if(!Object.prototype.hasOwnProperty.call(i.items,u))continue;let c=t[u],f=i.items[u];switch(f.type){case bb:{let h=f,m=h.converter?h.converter.get(c):c;if(h.required&&m==null)throw new Fe(Te.CONTENT_MISSING,a);(h.defaultValue!==c||h.required)&&(s.textContent=m);break}case zg:{let h=f,m=h.converter?h.converter.get(c):c;if(h.required&&m==null)throw new Fe(Te.ATTRIBUTE_MISSING,h.localName,a);(h.defaultValue!==c||h.required)&&(h.namespaceURI?s.setAttributeNS(h.namespaceURI,h.localName||"",m):s.setAttribute(h.localName||"",m));break}case Wg:{let h=f,m=null;if(h.parser){if(h.required&&!c||h.minOccurs&&!c.Count){let g=c?.localName||h.localName;throw new Fe(Te.ELEMENT_MISSING,g,a)}c&&(m=c.GetXml(c.element===void 0&&(h.required||c.Count)))}else{let g=h.converter?h.converter.get(c):c;if(h.required&&g===void 0)throw new Fe(Te.ELEMENT_MISSING,h.localName,a);if(c!==h.defaultValue||h.required)if(h.namespaceURI?m=n.createElementNS(h.namespaceURI,`${h.prefix?h.prefix+":":""}${h.localName}`):m=n.createElement(`${h.prefix?h.prefix+":":""}${h.localName}`),Array.isArray(g))for(let x of g){let v=x instanceof r?x.GetXml(!0):x;v!==null&&m&&m.appendChild(v)}else if(g instanceof r){let x=g.GetXml(!0);x&&m&&m.appendChild(x)}else m&&(m.textContent=g)}if(m)if(h.noRoot){let g=[];for(let w=0;w<m.childNodes.length;w++){let S=m.childNodes.item(w);oi(S)&&g.push(S)}let x=h.minOccurs||0,v=h.maxOccurs||1/0;if(g.length<x||g.length>v)throw new Fe(Te.COLLECTION_LIMIT,c.localName,i.localName);g.forEach(w=>s.appendChild(w.cloneNode(!0)))}else{if(m.childNodes.length<(h.minOccurs||0)||m.childNodes.length>(h.maxOccurs||1/0))throw new Fe(Te.COLLECTION_LIMIT,c.localName,i.localName);s.appendChild(m)}break}}}return this.OnGetXml(s),this.element=s,s}LoadXml(e){let t,n=this;if(typeof e=="string"?t=Li(e).documentElement:t=e,!t)throw new Fe(Te.PARAM_REQUIRED,"element");let s=this.GetStatic(),i=this.localName||"";if(!(t.localName===i&&t.namespaceURI==this.NamespaceURI))throw new Fe(Te.ELEMENT_MALFORMED,i);if(s.items)for(let a in s.items){if(!Object.prototype.hasOwnProperty.call(s.items,a))continue;let u=s.items[a];switch(u.type){case bb:{let c=u;if(c.required&&!t.textContent)throw new Fe(Te.CONTENT_MISSING,i);if(!t.textContent)n[a]=c.defaultValue;else{let f=c.converter?c.converter.set(t.textContent):t.textContent;n[a]=f}break}case zg:{let c=u,f,h;if(!c.localName)throw new Fe(Te.PARAM_REQUIRED,"localName");if(c.namespaceURI?(f=t.hasAttributeNS.bind(t,c.namespaceURI,c.localName),h=t.getAttributeNS.bind(t,c.namespaceURI,c.localName)):(f=t.hasAttribute.bind(t,c.localName),h=t.getAttribute.bind(t,c.localName)),c.required&&!f())throw new Fe(Te.ATTRIBUTE_MISSING,c.localName,i);if(!f())n[a]=c.defaultValue;else{let m=h(),g=c.converter&&m?c.converter.set(m):m;n[a]=g}break}case Wg:{let c=u;if(c.noRoot){if(!c.parser)throw new Fe(Te.XML_EXCEPTION,`Schema for '${c.localName}' with flag noRoot must have 'parser'`);let h=new c.parser;if(!(h instanceof Qp))throw new Fe(Te.XML_EXCEPTION,`Schema for '${c.localName}' with flag noRoot must have 'parser' like instance of XmlCollection`);h.OnLoadXml(t),delete h.element;let m=c.minOccurs||0,g=c.maxOccurs||1/0;if(h.Count<m||h.Count>g)throw new Fe(Te.COLLECTION_LIMIT,c.parser.localName,i);n[a]=h;continue}let f=null;for(let h=0;h<t.childNodes.length;h++){let m=t.childNodes.item(h);if(!oi(m))continue;let g=m;if(g.localName===c.localName&&g.namespaceURI==c.namespaceURI){f=g;break}}if(c.required&&!f)throw new Fe(Te.ELEMENT_MISSING,c.parser?c.parser.localName:c.localName,i);if(c.parser){if(f){let h=new c.parser;h.localName=c.localName,h.namespaceURI=c.namespaceURI,n[a]=h,h.LoadXml(f)}}else if(!f)n[a]=c.defaultValue;else{let h=f.textContent||"",m=c.converter?c.converter.set(h):h;n[a]=m}break}}}this.OnLoadXml(t),this.prefix=t.prefix||"",this.element=t}toString(){let e=this.GetXml();return e?Qa(e):""}GetElement(e,t=!0){if(!this.element)throw new Fe(Te.NULL_PARAM,this.localName);return r.GetElement(this.element,e,t)}GetChildren(e,t){if(!this.element)throw new Fe(Te.NULL_PARAM,this.localName);return r.GetChildren(this.element,e,t||this.NamespaceURI||void 0)}GetChild(e,t=!0){if(!this.element)throw new Fe(Te.NULL_PARAM,this.localName);return r.GetChild(this.element,e,this.NamespaceURI||void 0,t)}GetFirstChild(e,t){if(!this.element)throw new Fe(Te.NULL_PARAM,this.localName);return r.GetFirstChild(this.element,e,t)}GetAttribute(e,t,n=!0){if(!this.element)throw new Fe(Te.NULL_PARAM,this.localName);return r.GetAttribute(this.element,e,t,n)}IsEmpty(){return this.Element===void 0}OnLoadXml(e){}GetStatic(){return this.constructor}GetPrefix(){return this.Prefix?this.prefix+":":""}OnGetXml(e){}CreateElement(e,t,n=null,s=null){if(!e){let u=this.CreateDocument();if(u)e=u;else throw new Fe(Te.XML_EXCEPTION,"Document not created")}t=t||this.localName,n=n||this.NamespaceURI,s=s||this.prefix;let i=(s?`${s}:`:"")+t,a=n&&e?e.createElementNS(n,i):e?.createElement(i);return e&&a&&e.importNode(a,!0),a}CreateDocument(){return r.CreateDocument(this.localName,this.NamespaceURI,this.Prefix)}};var Qp=class extends Ms{static{o(this,"XmlCollection")}constructor(){super(...arguments),this.MaxOccurs=Number.MAX_VALUE,this.MinOccurs=0,this.items=[]}HasChanged(){let e=super.HasChanged(),t=this.Some(n=>n.HasChanged());return e||t}get Count(){return this.items.length}Item(e){return this.items[e]||null}Add(e){this.items.push(e),this.element=null}Pop(){return this.element=null,this.items.pop()}RemoveAt(e){this.items=this.items.filter((t,n)=>n!==e),this.element=null}Clear(){this.items=[],this.element=null}GetIterator(){return this.items}ForEach(e){this.GetIterator().forEach(e)}Map(e){return new lc(this.GetIterator().map(e))}Filter(e){return new lc(this.GetIterator().filter(e))}Sort(e){return new lc(this.GetIterator().sort(e))}Every(e){return this.GetIterator().every(e)}Some(e){return this.GetIterator().some(e)}IsEmpty(){return this.Count===0}OnGetXml(e){for(let t of this.GetIterator()){let n=t.GetXml();n&&e.appendChild(n)}}OnLoadXml(e){let t=this.GetStatic();if(!t.parser)throw new Fe(Te.XML_EXCEPTION,`${t.localName} doesn't have required 'parser' in @XmlElement`);for(let n=0;n<e.childNodes.length;n++){let s=e.childNodes.item(n);if(!(oi(s)&&s.localName===t.parser.localName&&s.namespaceURI==t.namespaceURI))continue;let i=s,a=new t.parser;a.LoadXml(i),this.Add(a)}}};var Zp=class extends lc{static{o(this,"NamespaceManager")}Add(e){e.prefix=e.prefix||"",e.namespace=e.namespace||"",super.Add(e)}GetPrefix(e,t=this.Count-1){let n=this.Count-1;e=e||"",t>n&&(t=n);for(let s=t;s>=0;s--){let i=this.items[s];if(i.prefix===e)return i}return null}GetNamespace(e,t=this.Count-1){let n=this.Count-1;e=e||"",t>n&&(t=n);for(let s=t;s>=0;s--){let i=this.items[s];if(i.namespace===e)return i}return null}};var Due="[object ArrayBuffer]",mt=class g_{static{o(this,"BufferSourceConverter")}static isArrayBuffer(e){return Object.prototype.toString.call(e)===Due}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength||e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e.buffer).slice(e.byteOffset,e.byteOffset+e.byteLength).buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,t){let n=g_.toUint8Array(e),s=g_.toUint8Array(t);if(n.length!==s.byteLength)return!1;for(let i=0;i<n.length;i++)if(n[i]!==s[i])return!1;return!0}static concat(...e){let t;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?t=e[0]:e[e.length-1]instanceof Function?t=e.slice(0,e.length-1):t=e;let n=0;for(let a of t)n+=a.byteLength;let s=new Uint8Array(n),i=0;for(let a of t){let u=this.toUint8Array(a);s.set(u,i),i+=u.length}return e[e.length-1]instanceof Function?this.toView(s,e[e.length-1]):s.buffer}},m_="string",Rue=/^[0-9a-f\s]+$/i,Pue=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,Oue=/^[a-zA-Z0-9-_]+$/,tM=class{static{o(this,"Utf8Converter")}static fromString(e){let t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length);for(let s=0;s<t.length;s++)n[s]=t.charCodeAt(s);return n.buffer}static toString(e){let t=mt.toUint8Array(e),n="";for(let i=0;i<t.length;i++)n+=String.fromCharCode(t[i]);return decodeURIComponent(escape(n))}},Za=class{static{o(this,"Utf16Converter")}static toString(e,t=!1){let n=mt.toArrayBuffer(e),s=new DataView(n),i="";for(let a=0;a<n.byteLength;a+=2){let u=s.getUint16(a,t);i+=String.fromCharCode(u)}return i}static fromString(e,t=!1){let n=new ArrayBuffer(e.length*2),s=new DataView(n);for(let i=0;i<e.length;i++)s.setUint16(i*2,e.charCodeAt(i),t);return n}},Et=class ed{static{o(this,"Convert")}static isHex(e){return typeof e===m_&&Rue.test(e)}static isBase64(e){return typeof e===m_&&Pue.test(e)}static isBase64Url(e){return typeof e===m_&&Oue.test(e)}static ToString(e,t="utf8"){let n=mt.toUint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(n);case"binary":return this.ToBinary(n);case"hex":return this.ToHex(n);case"base64":return this.ToBase64(n);case"base64url":return this.ToBase64Url(n);case"utf16le":return Za.toString(n,!0);case"utf16":case"utf16be":return Za.toString(n);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return Za.fromString(e,!0);case"utf16":case"utf16be":return Za.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){let t=mt.toUint8Array(e);if(typeof btoa<"u"){let n=this.ToString(t,"binary");return btoa(n)}else return Buffer.from(t).toString("base64")}static FromBase64(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!ed.isBase64(t))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(t)):new Uint8Array(Buffer.from(t,"base64")).buffer}static FromBase64Url(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!ed.isBase64Url(t))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(t.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e,t=ed.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return tM.fromString(e);case"utf16":case"utf16be":return Za.fromString(e);case"utf16le":case"usc2":return Za.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=ed.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return tM.toString(e);case"utf16":case"utf16be":return Za.toString(e);case"utf16le":case"usc2":return Za.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){let t=e.length,n=new Uint8Array(t);for(let s=0;s<t;s++)n[s]=e.charCodeAt(s);return n.buffer}static ToBinary(e){let t=mt.toUint8Array(e),n="";for(let s=0;s<t.length;s++)n+=String.fromCharCode(t[s]);return n}static ToHex(e){let t=mt.toUint8Array(e),n="",s=t.length;for(let i=0;i<s;i++){let a=t[i];a<16&&(n+="0"),n+=a.toString(16)}return n}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!ed.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t=`0${t}`);let n=new Uint8Array(t.length/2);for(let s=0;s<t.length;s=s+2){let i=t.slice(s,s+2);n[s/2]=parseInt(i,16)}return n.buffer}static ToUtf16String(e,t=!1){return Za.toString(e,t)}static FromUtf16String(e,t=!1){return Za.fromString(e,t)}static Base64Padding(e){let t=4-e.length%4;if(t<4)for(let n=0;n<t;n++)e+="=";return e}static formatString(e){return e?.replace(/[\n\r\t ]/g,"")||""}};Et.DEFAULT_UTF8_ENCODING="utf8";function B(r,e,t){var n;return r instanceof Object&&(n=r[e])!==null&&n!==void 0?n:t}o(B,"getParametersValue");function Eb(r,e=0,t=r.byteLength-e,n=!1){let s="";for(let i of new Uint8Array(r,e,t)){let a=i.toString(16).toUpperCase();a.length===1&&(s+="0"),s+=a,n&&(s+=" ")}return s.trim()}o(Eb,"bufferToHexCodes");function Uo(r,e){let t=0;if(r.length===1)return r[0];for(let n=r.length-1;n>=0;n--)t+=r[r.length-1-n]*Math.pow(2,e*n);return t}o(Uo,"utilFromBase");function aa(r,e,t=-1){let n=t,s=r,i=0,a=Math.pow(2,e);for(let u=1;u<8;u++){if(r<a){let c;if(n<0)c=new ArrayBuffer(u),i=u;else{if(n<u)return new ArrayBuffer(0);c=new ArrayBuffer(n),i=n}let f=new Uint8Array(c);for(let h=u-1;h>=0;h--){let m=Math.pow(2,h*e);f[i-h-1]=Math.floor(s/m),s-=f[i-h-1]*m}return c}a*=Math.pow(2,e)}return new ArrayBuffer(0)}o(aa,"utilToBase");function Yl(...r){let e=0,t=0;for(let i of r)e+=i.byteLength;let n=new ArrayBuffer(e),s=new Uint8Array(n);for(let i of r)s.set(new Uint8Array(i),t),t+=i.byteLength;return n}o(Yl,"utilConcatBuf");function Ab(...r){let e=0,t=0;for(let i of r)e+=i.length;let n=new ArrayBuffer(e),s=new Uint8Array(n);for(let i of r)s.set(i,t),t+=i.length;return s}o(Ab,"utilConcatView");function v_(){let r=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){let u=r[0]===255&&r[1]&128,c=r[0]===0&&(r[1]&128)===0;(u||c)&&this.warnings.push("Needlessly long format")}let e=new ArrayBuffer(this.valueHex.byteLength),t=new Uint8Array(e);for(let u=0;u<this.valueHex.byteLength;u++)t[u]=0;t[0]=r[0]&128;let n=Uo(t,8),s=new ArrayBuffer(this.valueHex.byteLength),i=new Uint8Array(s);for(let u=0;u<this.valueHex.byteLength;u++)i[u]=r[u];return i[0]&=127,Uo(i,8)-n}o(v_,"utilDecodeTC");function nM(r){let e=r<0?r*-1:r,t=128;for(let n=1;n<8;n++){if(e<=t){if(r<0){let a=t-e,u=aa(a,8,n),c=new Uint8Array(u);return c[0]|=128,u}let s=aa(e,8,n),i=new Uint8Array(s);if(i[0]&128){let a=s.slice(0),u=new Uint8Array(a);s=new ArrayBuffer(s.byteLength+1),i=new Uint8Array(s);for(let c=0;c<a.byteLength;c++)i[c+1]=u[c];i[0]=0}return s}t*=Math.pow(2,8)}return new ArrayBuffer(0)}o(nM,"utilEncodeTC");function fc(r,e){if(r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let s=0;s<t.length;s++)if(t[s]!==n[s])return!1;return!0}o(fc,"isEqualBuffer");function Fs(r,e){let t=r.toString(10);if(e<t.length)return"";let n=e-t.length,s=new Array(n);for(let a=0;a<n;a++)s[a]="0";return s.join("").concat(t)}o(Fs,"padNumber");var sM="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",iM="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=";function Cb(r,e=!1,t=!1,n=!1){let s=0,i=0,a=0,u="",c=e?iM:sM;if(n){let f=0;for(let h=0;h<r.length;h++)if(r.charCodeAt(h)!==0){f=h;break}r=r.slice(f)}for(;s<r.length;){let f=r.charCodeAt(s++);s>=r.length&&(i=1);let h=r.charCodeAt(s++);s>=r.length&&(a=1);let m=r.charCodeAt(s++),g=f>>2,x=(f&3)<<4|h>>4,v=(h&15)<<2|m>>6,w=m&63;i===1?v=w=64:a===1&&(w=64),t?v===64?u+=`${c.charAt(g)}${c.charAt(x)}`:w===64?u+=`${c.charAt(g)}${c.charAt(x)}${c.charAt(v)}`:u+=`${c.charAt(g)}${c.charAt(x)}${c.charAt(v)}${c.charAt(w)}`:u+=`${c.charAt(g)}${c.charAt(x)}${c.charAt(v)}${c.charAt(w)}`}return u}o(Cb,"toBase64");function td(r,e=!1,t=!1){let n=e?iM:sM;function s(c){for(let f=0;f<64;f++)if(n.charAt(f)===c)return f;return 64}o(s,"indexOf");function i(c){return c===64?0:c}o(i,"test");let a=0,u="";for(;a<r.length;){let c=s(r.charAt(a++)),f=a>=r.length?0:s(r.charAt(a++)),h=a>=r.length?0:s(r.charAt(a++)),m=a>=r.length?0:s(r.charAt(a++)),g=i(c)<<2|i(f)>>4,x=(i(f)&15)<<4|i(h)>>2,v=(i(h)&3)<<6|i(m);u+=String.fromCharCode(g),h!==64&&(u+=String.fromCharCode(x)),m!==64&&(u+=String.fromCharCode(v))}if(t){let c=u.length,f=-1;for(let h=c-1;h>=0;h--)if(u.charCodeAt(h)!==0){f=h;break}f!==-1?u=u.slice(0,f+1):u=""}return u}o(td,"fromBase64");function Yg(r){let e="",t=new Uint8Array(r);for(let n of t)e+=String.fromCharCode(n);return e}o(Yg,"arrayBufferToString");function Ql(r){let e=r.length,t=new ArrayBuffer(e),n=new Uint8Array(t);for(let s=0;s<e;s++)n[s]=r.charCodeAt(s);return t}o(Ql,"stringToArrayBuffer");var kue=Math.log(2);function aM(r){let e=Math.log(r)/kue,t=Math.floor(e),n=Math.round(e);return t===n?t:n}o(aM,"nearestPowerOf2");function De(r,e){for(let t of e)delete r[t]}o(De,"clearProps");function Nb(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}o(Nb,"assertBigInt");function S_(r){let e=0,t=0;for(let s=0;s<r.length;s++){let i=r[s];e+=i.byteLength}let n=new Uint8Array(e);for(let s=0;s<r.length;s++){let i=r[s];n.set(new Uint8Array(i),t),t+=i.byteLength}return n.buffer}o(S_,"concat");function jo(r,e,t,n){return e instanceof Uint8Array?e.byteLength?t<0?(r.error="Wrong parameter: inputOffset less than zero",!1):n<0?(r.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-n<0?(r.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(r.error="Wrong parameter: inputBuffer has zero length",!1):(r.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}o(jo,"checkBufferParams");var b_=class{static{o(this,"ViewWriter")}constructor(){this.items=[]}write(e){this.items.push(e)}final(){return S_(this.items)}},Qg=[new Uint8Array([1])],uM="0123456789",y_="name",cM="valueHexView",Lue="isHexOnly",Vue="idBlock",Uue="tagClass",jue="tagNumber",Mue="isConstructed",Fue="fromBER",que="toBER",Hue="local",qs="",oa=new ArrayBuffer(0),Tb=new Uint8Array(0),ev="EndOfContent",fM="OCTET STRING",hM="BIT STRING";function Mo(r){var e;return e=class extends r{static{o(this,"Some")}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(n){this.valueHexView=new Uint8Array(n)}constructor(...n){var s;super(...n);let i=n[0]||{};this.isHexOnly=(s=i.isHexOnly)!==null&&s!==void 0?s:!1,this.valueHexView=i.valueHex?mt.toUint8Array(i.valueHex):Tb}fromBER(n,s,i){let a=n instanceof ArrayBuffer?new Uint8Array(n):n;if(!jo(this,a,s,i))return-1;let u=s+i;return this.valueHexView=a.subarray(s,u),this.valueHexView.length?(this.blockLength=i,u):(this.warnings.push("Zero buffer length"),s)}toBER(n=!1){return this.isHexOnly?n?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",oa)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:Et.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}o(Mo,"HexBlock");var Zl=class{static{o(this,"LocalBaseBlock")}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}constructor({blockLength:e=0,error:t=qs,warnings:n=[],valueBeforeDecode:s=Tb}={}){this.blockLength=e,this.error=t,this.warnings=n,this.valueBeforeDecodeView=mt.toUint8Array(s)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:Et.ToHex(this.valueBeforeDecodeView)}}};Zl.NAME="baseBlock";var Hs=class extends Zl{static{o(this,"ValueBlock")}fromBER(e,t,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}};Hs.NAME="valueBlock";var pM=class extends Mo(Zl){static{o(this,"LocalIdentificationBlock")}constructor({idBlock:e={}}={}){var t,n,s,i;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?mt.toUint8Array(e.valueHex):Tb,this.tagClass=(n=e.tagClass)!==null&&n!==void 0?n:-1,this.tagNumber=(s=e.tagNumber)!==null&&s!==void 0?s:-1,this.isConstructed=(i=e.isConstructed)!==null&&i!==void 0?i:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:return this.error="Unknown tag class",oa}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){let s=new Uint8Array(1);if(!e){let i=this.tagNumber;i&=31,t|=i,s[0]=t}return s.buffer}if(!this.isHexOnly){let s=aa(this.tagNumber,7),i=new Uint8Array(s),a=s.byteLength,u=new Uint8Array(a+1);if(u[0]=t|31,!e){for(let c=0;c<a-1;c++)u[c+1]=i[c]|128;u[a]=i[a-1]}return u.buffer}let n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=t|31,!e){let s=this.valueHexView;for(let i=0;i<s.length-1;i++)n[i+1]=s[i]|128;n[this.valueHexView.byteLength]=s[s.length-1]}return n.buffer}fromBER(e,t,n){let s=mt.toUint8Array(e);if(!jo(this,s,t,n))return-1;let i=s.subarray(t,t+n);if(i.length===0)return this.error="Zero buffer length",-1;switch(i[0]&192){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(i[0]&32)===32,this.isHexOnly=!1;let u=i[0]&31;if(u!==31)this.tagNumber=u,this.blockLength=1;else{let c=1,f=this.valueHexView=new Uint8Array(255),h=255;for(;i[c]&128;){if(f[c-1]=i[c]&127,c++,c>=i.length)return this.error="End of input reached before message was fully decoded",-1;if(c===h){h+=255;let g=new Uint8Array(h);for(let x=0;x<f.length;x++)g[x]=f[x];f=this.valueHexView=new Uint8Array(h)}}this.blockLength=c+1,f[c-1]=i[c]&127;let m=new Uint8Array(c);for(let g=0;g<c;g++)m[g]=f[g];f=this.valueHexView=new Uint8Array(c),f.set(m),this.blockLength<=9?this.tagNumber=Uo(f,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(this.tagClass===1&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return t+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}};pM.NAME="identificationBlock";var dM=class extends Zl{static{o(this,"LocalLengthBlock")}constructor({lenBlock:e={}}={}){var t,n,s;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(n=e.longFormUsed)!==null&&n!==void 0?n:!1,this.length=(s=e.length)!==null&&s!==void 0?s:0}fromBER(e,t,n){let s=mt.toUint8Array(e);if(!jo(this,s,t,n))return-1;let i=s.subarray(t,t+n);if(i.length===0)return this.error="Zero buffer length",-1;if(i[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=i[0]===128,this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(i[0]&128),this.longFormUsed===!1)return this.length=i[0],this.blockLength=1,t+this.blockLength;let a=i[0]&127;if(a>8)return this.error="Too big integer",-1;if(a+1>i.length)return this.error="End of input reached before message was fully decoded",-1;let u=t+1,c=s.subarray(u,u+a);return c[a-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=Uo(c,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=a+1,t+this.blockLength}toBER(e=!1){let t,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=128),t;if(this.longFormUsed){let s=aa(this.length,8);if(s.byteLength>127)return this.error="Too big length",oa;if(t=new ArrayBuffer(s.byteLength+1),e)return t;let i=new Uint8Array(s);n=new Uint8Array(t),n[0]=s.byteLength|128;for(let a=0;a<s.byteLength;a++)n[a+1]=i[a];return t}return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}};dM.NAME="lengthBlock";var ut={},Ss=class extends Zl{static{o(this,"BaseBlock")}constructor({name:e=qs,optional:t=!1,primitiveSchema:n,...s}={},i){super(s),this.name=e,this.optional=t,n&&(this.primitiveSchema=n),this.idBlock=new pM(s),this.lenBlock=new dM(s),this.valueBlock=i?new i(s):new Hs(s)}fromBER(e,t,n){let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),s)}toBER(e,t){let n=t||new b_;t||mM(this);let s=this.idBlock.toBER(e);if(n.write(s),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,n),n.write(new ArrayBuffer(2));else{let i=this.valueBlock.toBER(e);this.lenBlock.length=i.byteLength;let a=this.lenBlock.toBER(e);n.write(a),n.write(i)}return t?oa:n.final()}toJSON(){let e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return e==="ascii"?this.onAsciiEncoding():Et.ToHex(this.toBER())}onAsciiEncoding(){let e=this.constructor.NAME,t=Et.ToHex(this.valueBlock.valueBeforeDecodeView);return`${e} : ${t}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;let t=this.toBER(),n=e.toBER();return fc(t,n)}};Ss.NAME="BaseBlock";function mM(r){var e;if(r instanceof ut.Constructed)for(let t of r.valueBlock.value)mM(t)&&(r.lenBlock.isIndefiniteForm=!0);return!!(!((e=r.lenBlock)===null||e===void 0)&&e.isIndefiniteForm)}o(mM,"prepareIndefiniteForm");var gM=class extends Ss{static{o(this,"BaseStringBlock")}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor({value:e=qs,...t}={},n){super(t,n),e&&this.fromString(e)}fromBER(e,t,n){let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),s)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}};gM.NAME="BaseStringBlock";var vM=class extends Mo(Hs){static{o(this,"LocalPrimitiveValueBlock")}constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}};vM.NAME="PrimitiveValueBlock";var yM,vt=class extends Ss{static{o(this,"Primitive")}constructor(e={}){super(e,vM),this.idBlock.isConstructed=!1}};yM=vt;ut.Primitive=yM;vt.NAME="PRIMITIVE";function Kue(r,e){if(r instanceof e)return r;let t=new e;return t.idBlock=r.idBlock,t.lenBlock=r.lenBlock,t.warnings=r.warnings,t.valueBeforeDecodeView=r.valueBeforeDecodeView,t}o(Kue,"localChangeType");function tv(r,e=0,t=r.length){let n=e,s=new Ss({},Hs),i=new Zl;if(!jo(i,r,e,t))return s.error=i.error,{offset:-1,result:s};if(!r.subarray(e,e+t).length)return s.error="Zero buffer length",{offset:-1,result:s};let u=s.idBlock.fromBER(r,e,t);if(s.idBlock.warnings.length&&s.warnings.concat(s.idBlock.warnings),u===-1)return s.error=s.idBlock.error,{offset:-1,result:s};if(e=u,t-=s.idBlock.blockLength,u=s.lenBlock.fromBER(r,e,t),s.lenBlock.warnings.length&&s.warnings.concat(s.lenBlock.warnings),u===-1)return s.error=s.lenBlock.error,{offset:-1,result:s};if(e=u,t-=s.lenBlock.blockLength,!s.idBlock.isConstructed&&s.lenBlock.isIndefiniteForm)return s.error="Indefinite length form used for primitive encoding form",{offset:-1,result:s};let c=Ss;switch(s.idBlock.tagClass){case 1:if(s.idBlock.tagNumber>=37&&s.idBlock.isHexOnly===!1)return s.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:s};switch(s.idBlock.tagNumber){case 0:if(s.idBlock.isConstructed&&s.lenBlock.length>0)return s.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:s};c=ut.EndOfContent;break;case 1:c=ut.Boolean;break;case 2:c=ut.Integer;break;case 3:c=ut.BitString;break;case 4:c=ut.OctetString;break;case 5:c=ut.Null;break;case 6:c=ut.ObjectIdentifier;break;case 10:c=ut.Enumerated;break;case 12:c=ut.Utf8String;break;case 13:c=ut.RelativeObjectIdentifier;break;case 14:c=ut.TIME;break;case 15:return s.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:s};case 16:c=ut.Sequence;break;case 17:c=ut.Set;break;case 18:c=ut.NumericString;break;case 19:c=ut.PrintableString;break;case 20:c=ut.TeletexString;break;case 21:c=ut.VideotexString;break;case 22:c=ut.IA5String;break;case 23:c=ut.UTCTime;break;case 24:c=ut.GeneralizedTime;break;case 25:c=ut.GraphicString;break;case 26:c=ut.VisibleString;break;case 27:c=ut.GeneralString;break;case 28:c=ut.UniversalString;break;case 29:c=ut.CharacterString;break;case 30:c=ut.BmpString;break;case 31:c=ut.DATE;break;case 32:c=ut.TimeOfDay;break;case 33:c=ut.DateTime;break;case 34:c=ut.Duration;break;default:{let f=s.idBlock.isConstructed?new ut.Constructed:new ut.Primitive;f.idBlock=s.idBlock,f.lenBlock=s.lenBlock,f.warnings=s.warnings,s=f}}break;case 2:case 3:case 4:default:c=s.idBlock.isConstructed?ut.Constructed:ut.Primitive}return s=Kue(s,c),u=s.fromBER(r,e,s.lenBlock.isIndefiniteForm?t:s.lenBlock.length),s.valueBeforeDecodeView=r.subarray(n,n+s.blockLength),{offset:u,result:s}}o(tv,"localFromBER");function Gr(r){if(!r.byteLength){let e=new Ss({},Hs);return e.error="Input buffer has zero length",{offset:-1,result:e}}return tv(mt.toUint8Array(r).slice(),0,r.byteLength)}o(Gr,"fromBER");function $ue(r,e){return r?1:e}o($ue,"checkLen");var hc=class extends Hs{static{o(this,"LocalConstructedValueBlock")}constructor({value:e=[],isIndefiniteForm:t=!1,...n}={}){super(n),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,n){let s=mt.toUint8Array(e);if(!jo(this,s,t,n))return-1;if(this.valueBeforeDecodeView=s.subarray(t,t+n),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let i=t;for(;$ue(this.isIndefiniteForm,n)>0;){let a=tv(s,i,n);if(a.offset===-1)return this.error=a.result.error,this.warnings.concat(a.result.warnings),-1;if(i=a.offset,this.blockLength+=a.result.blockLength,n-=a.result.blockLength,this.value.push(a.result),this.isIndefiniteForm&&a.result.constructor.NAME===ev)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===ev?this.value.pop():this.warnings.push("No EndOfContent block encoded")),i}toBER(e,t){let n=t||new b_;for(let s=0;s<this.value.length;s++)this.value[s].toBER(e,n);return t?oa:n.final()}toJSON(){let e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(let t of this.value)e.value.push(t.toJSON());return e}};hc.NAME="ConstructedValueBlock";var xM,oe=class extends Ss{static{o(this,"Constructed")}constructor(e={}){super(e,hc),this.idBlock.isConstructed=!0}fromBER(e,t,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),s)}onAsciiEncoding(){let e=[];for(let n of this.valueBlock.value)e.push(n.toString("ascii").split(`
92
92
  `).map(s=>` ${s}`).join(`
@@ -97,9 +97,9 @@ ${e.join(`
97
97
  `):this.result.push("-->"))}WriteTextNode(e){this.result.push(this.NormalizeString(e.nodeValue,e.nodeType))}WriteProcessingInstructionNode(e){let t=e.nodeName||e.tagName;t!=="xml"&&(this.state===hi.AfterDocElement?this.result.push(`
98
98
  <?`):this.result.push("<?"),this.result.push(t),e.nodeValue&&(this.result.push(" "),this.result.push(this.NormalizeString(e.nodeValue,Ut.ProcessingInstruction))),this.state===hi.BeforeDocElement?this.result.push(`?>
99
99
  `):this.result.push("?>"))}WriteElementNode(e){let t=this.state;this.state===hi.BeforeDocElement&&(this.state=hi.InsideDocElement),this.result.push("<"),this.result.push(e.nodeName);let n=this.WriteNamespacesAxis(e);this.WriteAttributesAxis(e),this.result.push(">");for(let s=e.firstChild;s!=null;s=s.nextSibling)this.WriteNode(s);for(this.result.push("</"),this.result.push(e.nodeName),this.result.push(">"),t===hi.BeforeDocElement&&(this.state=hi.AfterDocElement);n--;)this.visibleNamespaces.Pop()}WriteNamespacesAxis(e){let t=[],n=0;for(let i=0;i<e.attributes.length;i++){let a=e.attributes[i];if(!FD(a)){if(a.prefix&&!this.IsNamespaceRendered(a.prefix,a.namespaceURI)){let h={prefix:a.prefix,namespace:a.namespaceURI};t.push(h),this.visibleNamespaces.Add(h),n++}continue}if(a.localName==="xmlns"&&!a.prefix&&!a.nodeValue){let h={prefix:a.prefix,namespace:a.nodeValue};t.push(h),this.visibleNamespaces.Add(h),n++}let u=null,c;(c=/xmlns:([\w.-]+)/.exec(a.nodeName))&&(u=c[1]);let f=!0;if(this.exclusive&&!this.IsNamespaceInclusive(e,u)){let h=B9(e,u);if(h>1)f=!1;else if(h===0)continue}if(!this.IsNamespaceRendered(u,a.nodeValue)&&f){let h={prefix:u,namespace:a.nodeValue};t.push(h),this.visibleNamespaces.Add(h),n++}}if(!this.IsNamespaceRendered(e.prefix,e.namespaceURI)&&e.namespaceURI!=="http://www.w3.org/2000/xmlns/"){let i={prefix:e.prefix,namespace:e.namespaceURI};t.push(i),this.visibleNamespaces.Add(i),n++}t.sort(lhe);let s=null;return t.forEach(i=>{i.prefix!==s&&(s=i.prefix,this.result.push(" xmlns"),i.prefix&&this.result.push(":"+i.prefix),this.result.push('="'),this.result.push(i.namespace||""),this.result.push('"'))}),n}WriteAttributesAxis(e){let t=[];for(let n=0;n<e.attributes.length;n++){let s=e.attributes[n];FD(s)||t.push(s)}t.sort(fhe),t.forEach(n=>{n!=null&&(this.result.push(" "),this.result.push(n.nodeName),this.result.push('="'),this.result.push(this.NormalizeString(n.nodeValue,Ut.Attribute)),this.result.push('"'))})}NormalizeString(e,t){let n=[];if(e)for(let s=0;s<e.length;s++){let i=e[s];i==="<"&&(t===Ut.Attribute||this.IsTextNode(t))?n.push("&lt;"):i===">"&&this.IsTextNode(t)?n.push("&gt;"):i==="&"&&(t===Ut.Attribute||this.IsTextNode(t))?n.push("&amp;"):i==='"'&&t===Ut.Attribute?n.push("&quot;"):i===" "&&t===Ut.Attribute?n.push("&#x9;"):i===`
100
- `&&t===Ut.Attribute?n.push("&#xA;"):i==="\r"?n.push("&#xD;"):n.push(i)}return n.join("")}IsTextNode(e){switch(e){case Ut.Text:case Ut.CDATA:case Ut.SignificantWhitespace:case Ut.Whitespace:return!0}return!1}IsNamespaceInclusive(e,t){let n=t||null;return e.prefix===n?!1:this.inclusiveNamespacesPrefixList.indexOf(n||"")!==-1}IsNamespaceRendered(e,t){if(e=e||"",t=t||"",!e&&!t||e==="xml"&&t==="http://www.w3.org/XML/1998/namespace")return!0;let n=this.visibleNamespaces.GetPrefix(e);return n?n.namespace===t:!1}};function lhe(r,e){return r==e?0:r?e?r.prefix?e.prefix?r.prefix<e.prefix?-1:r.prefix>e.prefix?1:0:1:-1:1:-1}o(lhe,"XmlDsigC14NTransformNamespacesComparer");function fhe(r,e){if(!r.namespaceURI&&e.namespaceURI)return-1;if(!e.namespaceURI&&r.namespaceURI)return 1;let t=(r.namespaceURI||"")+r.localName,n=(e.namespaceURI||"")+e.localName;return t===n?0:t<n?-1:1}o(fhe,"XmlDsigC14NTransformAttributesComparer");function B9(r,e,t=0){let n=e||null;if(r.prefix===n)return++t;if(r.attributes)for(let s=0;s<r.attributes.length;s++){let i=r.attributes[s];if(!FD(i)&&e&&r.attributes[s].prefix===e)return++t}for(let s=r.firstChild;s;s=s.nextSibling)if(s.nodeType===Ut.Element){let a=B9(s,e,t);if(s.nodeType===Ut.Element&&a)return++t+a}return t}o(B9,"IsNamespaceUsed");function FD(r){let e=/xmlns:/;return!!(r!==null&&r.nodeType===Ut.Attribute&&(r.nodeName==="xmlns"||e.test(r.nodeName)))}o(FD,"IsNamespaceNode");var uC=class extends $i{static{o(this,"SignatureMethodOther")}OnLoadXml(e){for(let t=0;t<e.childNodes.length;t++){let n=e.childNodes.item(t);if(n.nodeType!==Ut.Element||n.nodeName===me.ElementNames.HMACOutputLength)continue;let s;switch(n.localName){case me.ElementNames.RSAPSSParams:s=xa;break;default:break}if(s){let i=new s;i.LoadXml(n),this.Add(i)}}}};uC=He([jt({localName:"Other"})],uC);var uo=class extends Kr{static{o(this,"SignatureMethod")}};He([Or({localName:me.AttributeNames.Algorithm,required:!0,defaultValue:""}),ht("design:type",String)],uo.prototype,"Algorithm",void 0);He([Gt({localName:me.ElementNames.HMACOutputLength,namespaceURI:me.NamespaceURI,prefix:me.DefaultPrefix,converter:Jg}),ht("design:type",Number)],uo.prototype,"HMACOutputLength",void 0);He([Gt({parser:uC,noRoot:!0,minOccurs:0}),ht("design:type",uC)],uo.prototype,"Any",void 0);uo=He([jt({localName:me.ElementNames.SignatureMethod})],uo);var h0=class extends Kr{static{o(this,"CanonicalizationMethod")}};He([Or({localName:me.AttributeNames.Algorithm,required:!0,defaultValue:me.DefaultCanonMethod}),ht("design:type",String)],h0.prototype,"Algorithm",void 0);h0=He([jt({localName:me.ElementNames.CanonicalizationMethod})],h0);var p0=class extends Kr{static{o(this,"DataObject")}};He([Or({localName:me.AttributeNames.Id,defaultValue:""}),ht("design:type",String)],p0.prototype,"Id",void 0);He([Or({localName:me.AttributeNames.MimeType,defaultValue:""}),ht("design:type",String)],p0.prototype,"MimeType",void 0);He([Or({localName:me.AttributeNames.Encoding,defaultValue:""}),ht("design:type",String)],p0.prototype,"Encoding",void 0);p0=He([jt({localName:me.ElementNames.Object})],p0);var ax=class extends $i{static{o(this,"DataObjects")}};ax=He([jt({localName:"xmldsig_objects",parser:p0})],ax);var ls=class extends Kr{static{o(this,"Transform")}constructor(){super(...arguments),this.innerXml=null}GetOutput(){throw new Fe(Te.METHOD_NOT_IMPLEMENTED)}LoadInnerXml(e){if(!e)throw new Fe(Te.PARAM_REQUIRED,"node");this.innerXml=e}GetInnerXml(){return this.innerXml}};He([Or({localName:me.AttributeNames.Algorithm,defaultValue:""}),ht("design:type",String)],ls.prototype,"Algorithm",void 0);He([Gt({localName:me.ElementNames.XPath,defaultValue:""}),ht("design:type",String)],ls.prototype,"XPath",void 0);ls=He([jt({localName:me.ElementNames.Transform})],ls);var fu=class extends ls{static{o(this,"XmlDsigBase64Transform")}constructor(){super(...arguments),this.Algorithm=me.AlgorithmNamespaces.XmlDsigBase64Transform}GetOutput(){if(!this.innerXml)throw new Fe(Te.PARAM_REQUIRED,"innerXml");return wr.FromString(this.innerXml.textContent||"","base64")}};var co=class extends ls{static{o(this,"XmlDsigC14NTransform")}constructor(){super(...arguments),this.Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315",this.xmlCanonicalizer=new oo(!1,!1)}GetOutput(){if(!this.innerXml)throw new Fe(Te.PARAM_REQUIRED,"innerXml");return this.xmlCanonicalizer.Canonicalize(this.innerXml)}},lo=class extends co{static{o(this,"XmlDsigC14NWithCommentsTransform")}constructor(){super(...arguments),this.Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments",this.xmlCanonicalizer=new oo(!0,!1)}};var hu=class extends ls{static{o(this,"XmlDsigEnvelopedSignatureTransform")}constructor(){super(...arguments),this.Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"}GetOutput(){if(!this.innerXml)throw new Fe(Te.PARAM_REQUIRED,"innerXml");let e=this.innerXml.firstChild,t=[];for(;e;)oi(e)&&e.localName===me.ElementNames.Signature&&e.namespaceURI===me.NamespaceURI&&t.push(e),e=e.nextSibling;for(let n of t)n.parentNode?.removeChild(n);return this.innerXml}};var fo=class extends ls{static{o(this,"XmlDsigExcC14NTransform")}constructor(){super(...arguments),this.Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#",this.xmlCanonicalizer=new oo(!1,!0)}get InclusiveNamespacesPrefixList(){return this.xmlCanonicalizer.InclusiveNamespacesPrefixList}set InclusiveNamespacesPrefixList(e){this.xmlCanonicalizer.InclusiveNamespacesPrefixList=e}LoadXml(e){if(super.LoadXml(e),this.Element&&this.Element.childNodes)for(let t=0;t<this.Element.childNodes.length;t++){let n=this.Element.childNodes[t];if(n&&n.nodeType===1)switch(n.localName){case"InclusiveNamespaces":this.setInclusiveNamespacesElement(n);break}}}GetOutput(){if(!this.innerXml)throw new Fe(Te.PARAM_REQUIRED,"innerXml");return this.xmlCanonicalizer.Canonicalize(this.innerXml)}setInclusiveNamespacesElement(e){let t=e.getAttribute("PrefixList");t&&t.length>0&&(this.xmlCanonicalizer.InclusiveNamespacesPrefixList=t)}},ho=class extends fo{static{o(this,"XmlDsigExcC14NWithCommentsTransform")}constructor(){super(...arguments),this.Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments",this.xmlCanonicalizer=new oo(!0,!0)}};function D9(r){return r.parentNode?D9(r.parentNode):r}o(D9,"lookupParentNode");var d0=class extends ls{static{o(this,"XmlDsigXPathTransform")}constructor(){super(...arguments),this.Algorithm=me.AlgorithmNamespaces.XmlDsigXPathTransform}GetOutput(){if(!this.innerXml)throw new Fe(Te.PARAM_REQUIRED,"innerXml");this.Filter(D9(this.innerXml),this.XPath)}Filter(e,t){let n=e.childNodes,s=[];for(let i=0;n&&i<n.length;i++){let a=n.item(i);s.push(a)}s.forEach(i=>{this.Evaluate(i,t)?i.parentNode&&i.parentNode.removeChild(i):this.Filter(i,t)})}GetEvaluator(e){return typeof self<"u"?e.ownerDocument==null?e:e.ownerDocument:Yp("xpath")}Evaluate(e,t){try{let n=this.GetEvaluator(e),s=this.GetXml();if(!s||!s.firstChild)throw new Error("XML element or firstChild is not defined");let i=s.firstChild,a=`boolean(${t})`,u=typeof self>"u"?Yp("xpath"):self;return!n.evaluate(a,e,{lookupNamespaceURI:o(f=>i.lookupNamespaceURI(f),"lookupNamespaceURI")},u.XPathResult.ANY_TYPE,null).booleanValue}catch{return!1}}};He([Gt({localName:me.ElementNames.XPath,namespaceURI:me.NamespaceURI,prefix:me.DefaultPrefix,required:!0}),ht("design:type",String)],d0.prototype,"XPath",void 0);var m0=class extends $i{static{o(this,"Transforms")}OnLoadXml(e){super.OnLoadXml(e),this.items=this.GetIterator().map(t=>{switch(t.Algorithm){case me.AlgorithmNamespaces.XmlDsigEnvelopedSignatureTransform:return Rh(t,hu);case me.AlgorithmNamespaces.XmlDsigC14NTransform:return Rh(t,co);case me.AlgorithmNamespaces.XmlDsigC14NWithCommentsTransform:return Rh(t,lo);case me.AlgorithmNamespaces.XmlDsigExcC14NTransform:return Rh(t,fo);case me.AlgorithmNamespaces.XmlDsigExcC14NWithCommentsTransform:return Rh(t,ho);case me.AlgorithmNamespaces.XmlDsigBase64Transform:return Rh(t,fu);case me.AlgorithmNamespaces.XmlDsigXPathTransform:return Rh(t,d0);default:try{let n=ox.CreateFromName(t.Algorithm);if(!t.Element)throw new Error("Transform element is not defined");return n.LoadXml(t.Element),n}catch{throw new Fe(Te.CRYPTOGRAPHIC_UNKNOWN_TRANSFORM,t.Algorithm)}}})}};m0=He([jt({localName:me.ElementNames.Transforms,parser:ls})],m0);function Rh(r,e){let t=new e;if(!r.Element)throw new Error("Transform element is not defined");return t.LoadXml(r.Element),t}o(Rh,"ChangeTransform");var po=class extends Kr{static{o(this,"Reference")}constructor(e){super(),this.DigestMethod=new Gi,e&&(this.Uri=e)}};He([Or({defaultValue:""}),ht("design:type",String)],po.prototype,"Id",void 0);He([Or({localName:me.AttributeNames.URI}),ht("design:type",String)],po.prototype,"Uri",void 0);He([Or({localName:me.AttributeNames.Type,defaultValue:""}),ht("design:type",String)],po.prototype,"Type",void 0);He([Gt({parser:m0}),ht("design:type",m0)],po.prototype,"Transforms",void 0);He([Gt({required:!0,parser:Gi}),ht("design:type",Gi)],po.prototype,"DigestMethod",void 0);He([Gt({required:!0,localName:me.ElementNames.DigestValue,namespaceURI:me.NamespaceURI,prefix:me.DefaultPrefix,converter:Vi}),ht("design:type",Uint8Array)],po.prototype,"DigestValue",void 0);po=He([jt({localName:me.ElementNames.Reference}),ht("design:paramtypes",[String])],po);var g0=class extends $i{static{o(this,"References")}};g0=He([jt({localName:"References",parser:po})],g0);var pu=class extends Kr{static{o(this,"SignedInfo")}};He([Or({localName:me.AttributeNames.Id,defaultValue:""}),ht("design:type",String)],pu.prototype,"Id",void 0);He([Gt({parser:h0,required:!0}),ht("design:type",h0)],pu.prototype,"CanonicalizationMethod",void 0);He([Gt({parser:uo,required:!0}),ht("design:type",uo)],pu.prototype,"SignatureMethod",void 0);He([Gt({parser:g0,minOccurs:1,noRoot:!0}),ht("design:type",g0)],pu.prototype,"References",void 0);pu=He([jt({localName:me.ElementNames.SignedInfo})],pu);var w0="http://www.w3.org/2001/04/xmldsig-more#",S0="ecdsa",Ph=class extends Ms{static{o(this,"EcdsaPublicKey")}};He([Gt({localName:me.ElementNames.X,namespaceURI:w0,prefix:S0,required:!0,converter:Vi}),ht("design:type",Uint8Array)],Ph.prototype,"X",void 0);He([Gt({localName:me.ElementNames.Y,namespaceURI:w0,prefix:S0,required:!0,converter:Vi}),ht("design:type",Uint8Array)],Ph.prototype,"Y",void 0);Ph=He([jt({localName:me.ElementNames.PublicKey,namespaceURI:w0,prefix:S0})],Ph);var v0=class extends Ms{static{o(this,"NamedCurve")}};He([Or({localName:me.AttributeNames.URI,required:!0}),ht("design:type",String)],v0.prototype,"Uri",void 0);v0=He([jt({localName:me.ElementNames.NamedCurve,namespaceURI:w0,prefix:S0})],v0);var y0=class extends Ms{static{o(this,"DomainParameters")}};He([Gt({parser:v0}),ht("design:type",v0)],y0.prototype,"NamedCurve",void 0);y0=He([jt({localName:me.ElementNames.DomainParameters,namespaceURI:w0,prefix:S0})],y0);var x0=class extends fi{static{o(this,"EcdsaKeyValue")}constructor(){super(...arguments),this.name=me.ElementNames.ECDSAKeyValue,this.key=null,this.jwk=null,this.keyUsage=null}static canImportCryptoKey(e){return e.algorithm.name.toUpperCase()===cu.toUpperCase()}get NamedCurve(){return P9(this.DomainParameters.NamedCurve.Uri)}async importKey(e){if(!e.algorithm.name||e.algorithm.name.toUpperCase()!=="ECDSA")throw new Fe(Te.ALGORITHM_WRONG_NAME,e.algorithm.name);let t=await vn.crypto.subtle.exportKey("jwk",e);return this.key=e,this.jwk=t,this.PublicKey=new Ph,this.PublicKey.X=wr.FromString(t.x||"","base64url"),this.PublicKey.Y=wr.FromString(t.y||"","base64url"),this.DomainParameters||(this.DomainParameters=new y0),this.DomainParameters.NamedCurve||(this.DomainParameters.NamedCurve=new v0),this.DomainParameters.NamedCurve.Uri=P9(t.crv||""),this.keyUsage=e.usages,this}async exportKey(e){if(this.key)return this.key;let t=wr.ToBase64Url(this.PublicKey.X),n=wr.ToBase64Url(this.PublicKey.Y),s=hhe(this.DomainParameters.NamedCurve.Uri),i={kty:"EC",crv:s,x:t,y:n,ext:!0};this.keyUsage=["verify"];let a=await vn.crypto.subtle.importKey("jwk",i,{name:"ECDSA",namedCurve:s},!0,this.keyUsage);return this.key=a,this.key}};He([Gt({parser:y0}),ht("design:type",y0)],x0.prototype,"DomainParameters",void 0);He([Gt({parser:Ph,required:!0}),ht("design:type",Ph)],x0.prototype,"PublicKey",void 0);x0=He([jt({localName:me.ElementNames.ECDSAKeyValue,namespaceURI:w0,prefix:S0})],x0);function P9(r){switch(r){case"P-256":return"urn:oid:1.2.840.10045.3.1.7";case"P-384":return"urn:oid:1.3.132.0.34";case"P-521":return"urn:oid:1.3.132.0.35"}throw new Fe(Te.CRYPTOGRAPHIC,"Unknown NamedCurve")}o(P9,"GetNamedCurveOid");function hhe(r){switch(r){case"urn:oid:1.2.840.10045.3.1.7":return"P-256";case"urn:oid:1.3.132.0.34":return"P-384";case"urn:oid:1.3.132.0.35":return"P-521"}throw new Fe(Te.CRYPTOGRAPHIC,"Unknown NamedCurve OID")}o(hhe,"GetNamedCurveFromOid");var phe=class extends Map{static{o(this,"KeyInfoClauseRegistry")}},gl=new phe;gl.set(me.ElementNames.RSAKeyValue,l0);gl.set(me.ElementNames.ECDSAKeyValue,x0);var cC=class{static{o(this,"KeyInfoClauseFactory")}static create(e){let t=gl.get(e);if(!t)throw new Fe(Te.KEY_INFO_CLAUSE_NOT_SUPPORTED,e);return new t}};var ux=class extends fi{static{o(this,"KeyValue")}set Value(e){this.element=null,this.value=e}get Value(){return this.value}constructor(e){super(),e&&(this.Value=e)}async importKey(e){for(let[,t]of gl)if(t.canImportCryptoKey(e)){let n=new t;return await n.importKey(e),this.Value=n,this}throw new Fe(Te.ALGORITHM_NOT_SUPPORTED,e.algorithm.name)}async exportKey(e){if(!this.Value)throw new Fe(Te.NULL_REFERENCE);return this.Value.exportKey(e)}OnGetXml(e){if(!this.Value)throw new Fe(Te.CRYPTOGRAPHIC,"KeyValue has empty value");let t=this.Value.GetXml();t&&e.appendChild(t)}OnLoadXml(e){for(let t=0;t<e.childNodes.length;t++){let n=e.childNodes.item(t);if(oi(n))try{let s=n.localName,i=cC.create(s);i.LoadXml(n),this.value=i;return}catch{}}throw new Fe(Te.CRYPTOGRAPHIC,"Unsupported KeyValue in use")}};ux=He([jt({localName:me.ElementNames.KeyValue}),ht("design:paramtypes",[fi])],ux);var dhe={"2.5.4.3":{short:"CN",long:"CommonName"},"2.5.4.6":{short:"C",long:"Country"},"2.5.4.5":{long:"DeviceSerialNumber"},"0.9.2342.19200300.100.1.25":{short:"DC",long:"DomainComponent"},"1.2.840.113549.1.9.1":{short:"E",long:"EMail"},"2.5.4.42":{short:"G",long:"GivenName"},"2.5.4.43":{short:"I",long:"Initials"},"2.5.4.7":{short:"L",long:"Locality"},"2.5.4.10":{short:"O",long:"Organization"},"2.5.4.11":{short:"OU",long:"OrganizationUnit"},"2.5.4.8":{short:"ST",long:"State"},"2.5.4.9":{short:"Street",long:"StreetAddress"},"2.5.4.4":{short:"SN",long:"SurName"},"2.5.4.12":{short:"T",long:"Title"},"1.2.840.113549.1.9.8":{long:"UnstructuredAddress"},"1.2.840.113549.1.9.2":{long:"UnstructuredName"}},b0=class{static{o(this,"X509Certificate")}constructor(e){if(this.publicKey=null,e){let t=new Uint8Array(e);this.LoadRaw(t),this.raw=t}}get SerialNumber(){return this.simpl.serialNumber.valueBlock.toString()}get Issuer(){return this.NameToString(this.simpl.issuer)}get Subject(){return this.NameToString(this.simpl.subject)}async Thumbprint(e="SHA-1"){return vn.crypto.subtle.digest(e,this.raw)}get PublicKey(){return this.publicKey}GetRaw(){return this.raw}async exportKey(e){if(e){let t={algorithm:e,usages:["verify"]};if(t.algorithm.name.toUpperCase()===cu){let s=this.simpl.subjectPublicKeyInfo.toJSON();if("crv"in s&&s.crv)t.algorithm.namedCurve=s.crv;else throw new Error("Cannot get Curved name from the ECDSA public key")}this.isHashedAlgorithm(t.algorithm)&&typeof t.algorithm.hash=="string"&&(t.algorithm.hash={name:t.algorithm.hash});let n=await this.simpl.getPublicKey({algorithm:t});return this.publicKey=n,n}return this.simpl.subjectPublicKeyInfo.algorithm.algorithmId==="1.2.840.113549.1.1.1"?this.publicKey=await this.simpl.getPublicKey({algorithm:{algorithm:{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},usages:["verify"]}}):this.publicKey=await this.simpl.getPublicKey(),this.publicKey}NameToString(e,t=","){let n=[];return e.typesAndValues.forEach(s=>{let i=s.type,a=dhe[i.toString()],u=a?a.short:null;n.push(`${u||i}=${s.value.valueBlock.value}`)}),n.join(t+" ")}LoadRaw(e){this.raw=new Uint8Array(e);let t=Gr(this.raw.buffer);this.simpl=new cs({schema:t.result})}isHashedAlgorithm(e){return!!e.hash}};var lC=class extends Kr{static{o(this,"X509IssuerSerial")}};He([Gt({localName:me.ElementNames.X509IssuerName,namespaceURI:me.NamespaceURI,prefix:me.DefaultPrefix,required:!0}),ht("design:type",String)],lC.prototype,"X509IssuerName",void 0);He([Gt({localName:me.ElementNames.X509SerialNumber,namespaceURI:me.NamespaceURI,prefix:me.DefaultPrefix,required:!0}),ht("design:type",String)],lC.prototype,"X509SerialNumber",void 0);lC=He([jt({localName:me.ElementNames.X509IssuerSerial})],lC);var Oh;(function(r){r[r.None=0]="None",r[r.EndCertOnly=1]="EndCertOnly",r[r.ExcludeRoot=2]="ExcludeRoot",r[r.WholeChain=3]="WholeChain"})(Oh||(Oh={}));var E0=class extends fi{static{o(this,"KeyInfoX509Data")}constructor(e,t=Oh.None){if(super(),this.x509crl=null,this.SubjectKeyIdList=[],e){if(e instanceof Uint8Array)this.AddCertificate(new b0(e));else if(e instanceof b0)switch(t){case Oh.None:case Oh.EndCertOnly:this.AddCertificate(e);break;case Oh.ExcludeRoot:this.AddCertificatesChainFrom(e,!1);break;case Oh.WholeChain:this.AddCertificatesChainFrom(e,!0);break}}}async importKey(e){throw new Fe(Te.METHOD_NOT_SUPPORTED)}async exportKey(e){if(!this.Certificates.length)throw new Fe(Te.NULL_REFERENCE);return this.Key=await this.Certificates[0].exportKey(e),this.Key}get Certificates(){return this.X509CertificateList}get CRL(){return this.x509crl}set CRL(e){this.x509crl=e}get IssuerSerials(){return this.IssuerSerialList}get SubjectKeyIds(){return this.SubjectKeyIdList}get SubjectNames(){return this.SubjectNameList}AddCertificate(e){if(!e)throw new Fe(Te.PARAM_REQUIRED,"certificate");this.X509CertificateList||(this.X509CertificateList=[]),this.X509CertificateList.push(e)}AddIssuerSerial(e,t){if(e==null)throw new Fe(Te.PARAM_REQUIRED,"issuerName");this.IssuerSerialList==null&&(this.IssuerSerialList=[]);let n={issuerName:e,serialNumber:t};this.IssuerSerialList.push(n)}AddSubjectKeyId(e){if(this.SubjectKeyIdList&&(this.SubjectKeyIdList=[]),typeof e=="string"){if(e!=null){let t=wr.FromBase64(e);this.SubjectKeyIdList.push(t)}}else this.SubjectKeyIdList.push(e)}AddSubjectName(e){this.SubjectNameList==null&&(this.SubjectNameList=[]),this.SubjectNameList.push(e)}GetXml(){let e=this.CreateDocument(),t=this.CreateElement(e),n=this.GetPrefix();if(this.IssuerSerialList!=null&&this.IssuerSerialList.length>0&&this.IssuerSerialList.forEach(s=>{let i=e.createElementNS(me.NamespaceURI,n+me.ElementNames.X509IssuerSerial),a=e.createElementNS(me.NamespaceURI,n+me.ElementNames.X509IssuerName);a.textContent=s.issuerName,i.appendChild(a);let u=e.createElementNS(me.NamespaceURI,n+me.ElementNames.X509SerialNumber);u.textContent=s.serialNumber,i.appendChild(u),t.appendChild(i)}),this.SubjectKeyIdList!=null&&this.SubjectKeyIdList.length>0&&this.SubjectKeyIdList.forEach(s=>{let i=e.createElementNS(me.NamespaceURI,n+me.ElementNames.X509SKI);i.textContent=wr.ToBase64(s),t.appendChild(i)}),this.SubjectNameList!=null&&this.SubjectNameList.length>0&&this.SubjectNameList.forEach(s=>{let i=e.createElementNS(me.NamespaceURI,n+me.ElementNames.X509SubjectName);i.textContent=s,t.appendChild(i)}),this.X509CertificateList!=null&&this.X509CertificateList.length>0&&this.X509CertificateList.forEach(s=>{let i=e.createElementNS(me.NamespaceURI,n+me.ElementNames.X509Certificate);i.textContent=wr.ToBase64(s.GetRaw()),t.appendChild(i)}),this.x509crl!=null){let s=e.createElementNS(me.NamespaceURI,n+me.ElementNames.X509CRL);s.textContent=wr.ToBase64(this.x509crl),t.appendChild(s)}return t}LoadXml(e){super.LoadXml(e),this.IssuerSerialList&&(this.IssuerSerialList=[]),this.SubjectKeyIdList&&(this.SubjectKeyIdList=[]),this.SubjectNameList&&(this.SubjectNameList=[]),this.X509CertificateList&&(this.X509CertificateList=[]),this.x509crl=null;let t=this.GetChildren(me.ElementNames.X509IssuerSerial);t&&t.forEach(s=>{let i=Kr.GetChild(s,me.ElementNames.X509IssuerName,me.NamespaceURI,!0),a=Kr.GetChild(s,me.ElementNames.X509SerialNumber,me.NamespaceURI,!0);i&&i.textContent&&a&&a.textContent&&this.AddIssuerSerial(i.textContent,a.textContent)}),t=this.GetChildren(me.ElementNames.X509SKI),t&&t.forEach(s=>{if(s.textContent){let i=wr.FromBase64(s.textContent);this.AddSubjectKeyId(i)}}),t=this.GetChildren(me.ElementNames.X509SubjectName),t?.forEach(s=>{s.textContent&&this.AddSubjectName(s.textContent)}),t=this.GetChildren(me.ElementNames.X509Certificate),t&&t.forEach(s=>{if(s.textContent){let i=wr.FromBase64(s.textContent);this.AddCertificate(new b0(i))}});let n=this.GetChild(me.ElementNames.X509CRL,!1);n&&n.textContent&&(this.x509crl=wr.FromBase64(n.textContent))}AddCertificatesChainFrom(e,t){}};E0=He([jt({localName:me.ElementNames.X509Data}),ht("design:paramtypes",[Object,Object])],E0);var cx=class extends fi{static{o(this,"SPKIData")}async importKey(e){let t=await vn.crypto.subtle.exportKey("spki",e);return this.SPKIexp=new Uint8Array(t),this.Key=e,this}async exportKey(e){if(!this.SPKIexp)throw new Error("SPKI data is not defined");let t=await vn.crypto.subtle.importKey("spki",this.SPKIexp,e,!0,["verify"]);return this.Key=t,t}};He([Gt({localName:me.ElementNames.SPKIexp,namespaceURI:me.NamespaceURI,prefix:me.DefaultPrefix,required:!0,converter:Vi}),ht("design:type",Object)],cx.prototype,"SPKIexp",void 0);cx=He([jt({localName:me.ElementNames.SPKIData})],cx);var kh=class extends $i{static{o(this,"KeyInfo")}OnLoadXml(e){for(let t=0;t<e.childNodes.length;t++){let n=e.childNodes.item(t);if(n.nodeType!==Ut.Element)continue;let s=null;switch(n.localName){case me.ElementNames.KeyValue:s=ux;break;case me.ElementNames.X509Data:s=E0;break;case me.ElementNames.SPKIData:s=cx;break;case me.ElementNames.KeyName:case me.ElementNames.RetrievalMethod:case me.ElementNames.PGPData:case me.ElementNames.MgmtData:}if(s){let i=new s;i.LoadXml(n),this.Add(i)}}}};He([Or({localName:me.AttributeNames.Id,defaultValue:""}),ht("design:type",String)],kh.prototype,"Id",void 0);kh=He([jt({localName:me.ElementNames.KeyInfo})],kh);var vl=class extends Kr{static{o(this,"Signature")}};He([Or({localName:me.AttributeNames.Id,defaultValue:""}),ht("design:type",String)],vl.prototype,"Id",void 0);He([Gt({parser:pu,required:!0}),ht("design:type",pu)],vl.prototype,"SignedInfo",void 0);He([Gt({localName:me.ElementNames.SignatureValue,namespaceURI:me.NamespaceURI,prefix:me.DefaultPrefix,required:!0,converter:Vi,defaultValue:null}),ht("design:type",Object)],vl.prototype,"SignatureValue",void 0);He([Gt({parser:kh}),ht("design:type",kh)],vl.prototype,"KeyInfo",void 0);He([Gt({parser:ax,noRoot:!0}),ht("design:type",ax)],vl.prototype,"ObjectList",void 0);vl=He([jt({localName:me.ElementNames.Signature})],vl);var ghe=class extends Map{static{o(this,"AlgorithmRegistry")}},dr=new ghe;dr.set(rC,{type:"signature",algorithm:a0});dr.set(nC,{type:"signature",algorithm:o0});dr.set(sC,{type:"signature",algorithm:u0});dr.set(iC,{type:"signature",algorithm:c0});dr.set(rC,{type:"signature",algorithm:a0});dr.set(nC,{type:"signature",algorithm:o0});dr.set(sC,{type:"signature",algorithm:u0});dr.set(iC,{type:"signature",algorithm:c0});dr.set(MD,{type:"signature",algorithm:oC});dr.set(JA,{type:"signature",algorithm:t0});dr.set(YA,{type:"signature",algorithm:r0});dr.set(QA,{type:"signature",algorithm:n0});dr.set(ZA,{type:"signature",algorithm:s0});dr.set(JA.toUpperCase(),{type:"signature",algorithm:t0});dr.set(YA.toUpperCase(),{type:"signature",algorithm:r0});dr.set(QA.toUpperCase(),{type:"signature",algorithm:n0});dr.set(ZA.toUpperCase(),{type:"signature",algorithm:s0});dr.set(OD,{type:"signature",algorithm:rx});dr.set(kD,{type:"signature",algorithm:nx});dr.set(LD,{type:"signature",algorithm:sx});dr.set(VD,{type:"signature",algorithm:ix});dr.set(Ym,{type:"hash",algorithm:XA});dr.set(Qm,{type:"hash",algorithm:tx});dr.set(Zm,{type:"hash",algorithm:WA});dr.set(e0,{type:"hash",algorithm:zA});var Lh=class{static{o(this,"AlgorithmFactory")}static createHashAlgorithmFromNamespace(e){for(let[t,{type:n,algorithm:s}]of dr)if(n==="hash"&&t===e)return new s;throw new Fe(Te.ALGORITHM_NOT_SUPPORTED,e)}static createSignatureAlgorithmFromMethod(e){for(let[t,{type:n,algorithm:s}]of dr)if(n==="signature"&&e.Algorithm===t){let i=new s;return i.fromMethod&&i.fromMethod(e),i}throw new Fe(Te.ALGORITHM_NOT_SUPPORTED,e.Algorithm)}static createHashAlgorithmFromAlgorithm(e){for(let[,{type:t,algorithm:n}]of dr)if(t==="hash"){let s=new n;if(s.algorithm.name.toUpperCase()===e.name.toUpperCase())return s}throw new Fe(Te.ALGORITHM_NOT_SUPPORTED,e.name)}static createSignatureAlgorithmFromAlgorithm(e){for(let[,{type:t,algorithm:n}]of dr)if(t==="signature"){let s=n.fromAlgorithm(e);if(s)return s}throw new Fe(Te.ALGORITHM_NOT_SUPPORTED,e.name)}};var vhe=class extends Map{static{o(this,"TransformRegistry")}},du=new vhe;du.set(me.AlgorithmNamespaces.XmlDsigBase64Transform,fu);du.set(me.AlgorithmNamespaces.XmlDsigC14NTransform,co);du.set(me.AlgorithmNamespaces.XmlDsigC14NWithCommentsTransform,lo);du.set(me.AlgorithmNamespaces.XmlDsigEnvelopedSignatureTransform,hu);du.set(me.AlgorithmNamespaces.XmlDsigExcC14NTransform,fo);du.set(me.AlgorithmNamespaces.XmlDsigExcC14NWithCommentsTransform,ho);var ox=class{static{o(this,"CryptoConfig")}static CreateFromName(e){if(!e)throw new Fe(Te.PARAM_REQUIRED,"name");let t=du.get(e);if(t)return new t;let n;switch(e){case me.AlgorithmNamespaces.XmlDsigBase64Transform:n=new fu;break;case me.AlgorithmNamespaces.XmlDsigC14NTransform:n=new co;break;case me.AlgorithmNamespaces.XmlDsigC14NWithCommentsTransform:n=new lo;break;case me.AlgorithmNamespaces.XmlDsigEnvelopedSignatureTransform:n=new hu;break;case me.AlgorithmNamespaces.XmlDsigXPathTransform:throw new Fe(Te.ALGORITHM_NOT_SUPPORTED,e);case me.AlgorithmNamespaces.XmlDsigXsltTransform:throw new Fe(Te.ALGORITHM_NOT_SUPPORTED,e);case me.AlgorithmNamespaces.XmlDsigExcC14NTransform:n=new fo;break;case me.AlgorithmNamespaces.XmlDsigExcC14NWithCommentsTransform:n=new ho;break;case me.AlgorithmNamespaces.XmlDecryptionTransform:throw new Fe(Te.ALGORITHM_NOT_SUPPORTED,e);default:throw new Fe(Te.ALGORITHM_NOT_SUPPORTED,e)}return n}static CreateSignatureAlgorithm(e){return Lh.createSignatureAlgorithmFromMethod(e)}static CreateHashAlgorithm(e){return Lh.createHashAlgorithmFromNamespace(e)}static GetHashAlgorithm(e){let t=typeof e=="string"?{name:e}:e;return Lh.createHashAlgorithmFromAlgorithm(t)}static GetSignatureAlgorithm(e){let t=typeof e=="string"?{name:e}:e;return"hash"in t&&typeof t.hash=="string"&&(t.hash={name:t.hash}),Lh.createSignatureAlgorithmFromAlgorithm(t)}static CreateSignatureMethod(e){let t=new uo;return t.Algorithm=e.namespaceURI,e.toMethod&&e.toMethod(t),t}static RegisterSignatureAlgorithm(e,t){dr.set(e,{type:"signature",algorithm:t})}static RegisterHashAlgorithm(e,t){dr.set(e,{type:"hash",algorithm:t})}static RegisterKeyInfoClause(e,t){gl.set(e,t)}static RegisterTransform(e,t){du.set(e,t)}};var fC=Zx(BI(),1);var O9={xmldec:{version:"1.0",encoding:"UTF-8",standalone:void 0}};var k9={explicitArray:!1,explicitRoot:!1,preserveChildrenOrder:!0};var L9=class{static{o(this,"Xml2JsToolkit")}xml2js;constructor(e=whe){this.xml2js=e,Qj({XMLSerializer:fC.default.XMLSerializer,DOMParser:fC.default.DOMParser,DOMImplementation:fC.default.DOMImplementation})}async validate(e,t){try{return await CU.validate(e,t),ri()}catch(n){return Bu(n)}}parse(e,t){return new Promise((n,s)=>new this.xml2js.Parser({...k9,...t}).parseString(e,(i,a)=>i?s(i):n(a)))}build(e,t){return Promise.resolve(new this.xml2js.Builder({...O9,...t}).buildObject(e))}digest(e,t,n=K0){return this.hash(this.canonicalize(e,n),t)}canonicalize(e,t=K0){let n=Li(this.clear(e));return new oo(t.includeComments,t.exclusive).Canonicalize(n)}getNode(e,t){let s=Li(e).documentElement.getElementsByTagName(t).item(0);return s?this.clear(Qa(s)):null}getFirstNode(e){let n=Li(e).documentElement.firstChild;return n?this.clear(Qa(n)):null}getAttribute(e,t){return Li(e).documentElement.getAttribute(t)}appendNode(e,t){let n=Li(e),{documentElement:s}=Li(t);return n.documentElement.appendChild(s),this.clear(Qa(n))}hash(e,t){return xhe.createHash(t).update(e,"utf8").digest().toString("base64")}clear(e){return['xmlns:default="http://www.w3.org/2000/09/xmldsig#"',' standalone="no"',"default:",":default",`
100
+ `&&t===Ut.Attribute?n.push("&#xA;"):i==="\r"?n.push("&#xD;"):n.push(i)}return n.join("")}IsTextNode(e){switch(e){case Ut.Text:case Ut.CDATA:case Ut.SignificantWhitespace:case Ut.Whitespace:return!0}return!1}IsNamespaceInclusive(e,t){let n=t||null;return e.prefix===n?!1:this.inclusiveNamespacesPrefixList.indexOf(n||"")!==-1}IsNamespaceRendered(e,t){if(e=e||"",t=t||"",!e&&!t||e==="xml"&&t==="http://www.w3.org/XML/1998/namespace")return!0;let n=this.visibleNamespaces.GetPrefix(e);return n?n.namespace===t:!1}};function lhe(r,e){return r==e?0:r?e?r.prefix?e.prefix?r.prefix<e.prefix?-1:r.prefix>e.prefix?1:0:1:-1:1:-1}o(lhe,"XmlDsigC14NTransformNamespacesComparer");function fhe(r,e){if(!r.namespaceURI&&e.namespaceURI)return-1;if(!e.namespaceURI&&r.namespaceURI)return 1;let t=(r.namespaceURI||"")+r.localName,n=(e.namespaceURI||"")+e.localName;return t===n?0:t<n?-1:1}o(fhe,"XmlDsigC14NTransformAttributesComparer");function B9(r,e,t=0){let n=e||null;if(r.prefix===n)return++t;if(r.attributes)for(let s=0;s<r.attributes.length;s++){let i=r.attributes[s];if(!FD(i)&&e&&r.attributes[s].prefix===e)return++t}for(let s=r.firstChild;s;s=s.nextSibling)if(s.nodeType===Ut.Element){let a=B9(s,e,t);if(s.nodeType===Ut.Element&&a)return++t+a}return t}o(B9,"IsNamespaceUsed");function FD(r){let e=/xmlns:/;return!!(r!==null&&r.nodeType===Ut.Attribute&&(r.nodeName==="xmlns"||e.test(r.nodeName)))}o(FD,"IsNamespaceNode");var uC=class extends $i{static{o(this,"SignatureMethodOther")}OnLoadXml(e){for(let t=0;t<e.childNodes.length;t++){let n=e.childNodes.item(t);if(n.nodeType!==Ut.Element||n.nodeName===me.ElementNames.HMACOutputLength)continue;let s;switch(n.localName){case me.ElementNames.RSAPSSParams:s=xa;break;default:break}if(s){let i=new s;i.LoadXml(n),this.Add(i)}}}};uC=He([jt({localName:"Other"})],uC);var uo=class extends Kr{static{o(this,"SignatureMethod")}};He([Or({localName:me.AttributeNames.Algorithm,required:!0,defaultValue:""}),ht("design:type",String)],uo.prototype,"Algorithm",void 0);He([Gt({localName:me.ElementNames.HMACOutputLength,namespaceURI:me.NamespaceURI,prefix:me.DefaultPrefix,converter:Jg}),ht("design:type",Number)],uo.prototype,"HMACOutputLength",void 0);He([Gt({parser:uC,noRoot:!0,minOccurs:0}),ht("design:type",uC)],uo.prototype,"Any",void 0);uo=He([jt({localName:me.ElementNames.SignatureMethod})],uo);var h0=class extends Kr{static{o(this,"CanonicalizationMethod")}};He([Or({localName:me.AttributeNames.Algorithm,required:!0,defaultValue:me.DefaultCanonMethod}),ht("design:type",String)],h0.prototype,"Algorithm",void 0);h0=He([jt({localName:me.ElementNames.CanonicalizationMethod})],h0);var p0=class extends Kr{static{o(this,"DataObject")}};He([Or({localName:me.AttributeNames.Id,defaultValue:""}),ht("design:type",String)],p0.prototype,"Id",void 0);He([Or({localName:me.AttributeNames.MimeType,defaultValue:""}),ht("design:type",String)],p0.prototype,"MimeType",void 0);He([Or({localName:me.AttributeNames.Encoding,defaultValue:""}),ht("design:type",String)],p0.prototype,"Encoding",void 0);p0=He([jt({localName:me.ElementNames.Object})],p0);var ax=class extends $i{static{o(this,"DataObjects")}};ax=He([jt({localName:"xmldsig_objects",parser:p0})],ax);var ls=class extends Kr{static{o(this,"Transform")}constructor(){super(...arguments),this.innerXml=null}GetOutput(){throw new Fe(Te.METHOD_NOT_IMPLEMENTED)}LoadInnerXml(e){if(!e)throw new Fe(Te.PARAM_REQUIRED,"node");this.innerXml=e}GetInnerXml(){return this.innerXml}};He([Or({localName:me.AttributeNames.Algorithm,defaultValue:""}),ht("design:type",String)],ls.prototype,"Algorithm",void 0);He([Gt({localName:me.ElementNames.XPath,defaultValue:""}),ht("design:type",String)],ls.prototype,"XPath",void 0);ls=He([jt({localName:me.ElementNames.Transform})],ls);var fu=class extends ls{static{o(this,"XmlDsigBase64Transform")}constructor(){super(...arguments),this.Algorithm=me.AlgorithmNamespaces.XmlDsigBase64Transform}GetOutput(){if(!this.innerXml)throw new Fe(Te.PARAM_REQUIRED,"innerXml");return wr.FromString(this.innerXml.textContent||"","base64")}};var co=class extends ls{static{o(this,"XmlDsigC14NTransform")}constructor(){super(...arguments),this.Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315",this.xmlCanonicalizer=new oo(!1,!1)}GetOutput(){if(!this.innerXml)throw new Fe(Te.PARAM_REQUIRED,"innerXml");return this.xmlCanonicalizer.Canonicalize(this.innerXml)}},lo=class extends co{static{o(this,"XmlDsigC14NWithCommentsTransform")}constructor(){super(...arguments),this.Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments",this.xmlCanonicalizer=new oo(!0,!1)}};var hu=class extends ls{static{o(this,"XmlDsigEnvelopedSignatureTransform")}constructor(){super(...arguments),this.Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"}GetOutput(){if(!this.innerXml)throw new Fe(Te.PARAM_REQUIRED,"innerXml");let e=this.innerXml.firstChild,t=[];for(;e;)oi(e)&&e.localName===me.ElementNames.Signature&&e.namespaceURI===me.NamespaceURI&&t.push(e),e=e.nextSibling;for(let n of t)n.parentNode?.removeChild(n);return this.innerXml}};var fo=class extends ls{static{o(this,"XmlDsigExcC14NTransform")}constructor(){super(...arguments),this.Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#",this.xmlCanonicalizer=new oo(!1,!0)}get InclusiveNamespacesPrefixList(){return this.xmlCanonicalizer.InclusiveNamespacesPrefixList}set InclusiveNamespacesPrefixList(e){this.xmlCanonicalizer.InclusiveNamespacesPrefixList=e}LoadXml(e){if(super.LoadXml(e),this.Element&&this.Element.childNodes)for(let t=0;t<this.Element.childNodes.length;t++){let n=this.Element.childNodes[t];if(n&&n.nodeType===1)switch(n.localName){case"InclusiveNamespaces":this.setInclusiveNamespacesElement(n);break}}}GetOutput(){if(!this.innerXml)throw new Fe(Te.PARAM_REQUIRED,"innerXml");return this.xmlCanonicalizer.Canonicalize(this.innerXml)}setInclusiveNamespacesElement(e){let t=e.getAttribute("PrefixList");t&&t.length>0&&(this.xmlCanonicalizer.InclusiveNamespacesPrefixList=t)}},ho=class extends fo{static{o(this,"XmlDsigExcC14NWithCommentsTransform")}constructor(){super(...arguments),this.Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments",this.xmlCanonicalizer=new oo(!0,!0)}};function D9(r){return r.parentNode?D9(r.parentNode):r}o(D9,"lookupParentNode");var d0=class extends ls{static{o(this,"XmlDsigXPathTransform")}constructor(){super(...arguments),this.Algorithm=me.AlgorithmNamespaces.XmlDsigXPathTransform}GetOutput(){if(!this.innerXml)throw new Fe(Te.PARAM_REQUIRED,"innerXml");this.Filter(D9(this.innerXml),this.XPath)}Filter(e,t){let n=e.childNodes,s=[];for(let i=0;n&&i<n.length;i++){let a=n.item(i);s.push(a)}s.forEach(i=>{this.Evaluate(i,t)?i.parentNode&&i.parentNode.removeChild(i):this.Filter(i,t)})}GetEvaluator(e){return typeof self<"u"?e.ownerDocument==null?e:e.ownerDocument:Yp("xpath")}Evaluate(e,t){try{let n=this.GetEvaluator(e),s=this.GetXml();if(!s||!s.firstChild)throw new Error("XML element or firstChild is not defined");let i=s.firstChild,a=`boolean(${t})`,u=typeof self>"u"?Yp("xpath"):self;return!n.evaluate(a,e,{lookupNamespaceURI:o(f=>i.lookupNamespaceURI(f),"lookupNamespaceURI")},u.XPathResult.ANY_TYPE,null).booleanValue}catch{return!1}}};He([Gt({localName:me.ElementNames.XPath,namespaceURI:me.NamespaceURI,prefix:me.DefaultPrefix,required:!0}),ht("design:type",String)],d0.prototype,"XPath",void 0);var m0=class extends $i{static{o(this,"Transforms")}OnLoadXml(e){super.OnLoadXml(e),this.items=this.GetIterator().map(t=>{switch(t.Algorithm){case me.AlgorithmNamespaces.XmlDsigEnvelopedSignatureTransform:return Rh(t,hu);case me.AlgorithmNamespaces.XmlDsigC14NTransform:return Rh(t,co);case me.AlgorithmNamespaces.XmlDsigC14NWithCommentsTransform:return Rh(t,lo);case me.AlgorithmNamespaces.XmlDsigExcC14NTransform:return Rh(t,fo);case me.AlgorithmNamespaces.XmlDsigExcC14NWithCommentsTransform:return Rh(t,ho);case me.AlgorithmNamespaces.XmlDsigBase64Transform:return Rh(t,fu);case me.AlgorithmNamespaces.XmlDsigXPathTransform:return Rh(t,d0);default:try{let n=ox.CreateFromName(t.Algorithm);if(!t.Element)throw new Error("Transform element is not defined");return n.LoadXml(t.Element),n}catch{throw new Fe(Te.CRYPTOGRAPHIC_UNKNOWN_TRANSFORM,t.Algorithm)}}})}};m0=He([jt({localName:me.ElementNames.Transforms,parser:ls})],m0);function Rh(r,e){let t=new e;if(!r.Element)throw new Error("Transform element is not defined");return t.LoadXml(r.Element),t}o(Rh,"ChangeTransform");var po=class extends Kr{static{o(this,"Reference")}constructor(e){super(),this.DigestMethod=new Gi,e&&(this.Uri=e)}};He([Or({defaultValue:""}),ht("design:type",String)],po.prototype,"Id",void 0);He([Or({localName:me.AttributeNames.URI}),ht("design:type",String)],po.prototype,"Uri",void 0);He([Or({localName:me.AttributeNames.Type,defaultValue:""}),ht("design:type",String)],po.prototype,"Type",void 0);He([Gt({parser:m0}),ht("design:type",m0)],po.prototype,"Transforms",void 0);He([Gt({required:!0,parser:Gi}),ht("design:type",Gi)],po.prototype,"DigestMethod",void 0);He([Gt({required:!0,localName:me.ElementNames.DigestValue,namespaceURI:me.NamespaceURI,prefix:me.DefaultPrefix,converter:Vi}),ht("design:type",Uint8Array)],po.prototype,"DigestValue",void 0);po=He([jt({localName:me.ElementNames.Reference}),ht("design:paramtypes",[String])],po);var g0=class extends $i{static{o(this,"References")}};g0=He([jt({localName:"References",parser:po})],g0);var pu=class extends Kr{static{o(this,"SignedInfo")}};He([Or({localName:me.AttributeNames.Id,defaultValue:""}),ht("design:type",String)],pu.prototype,"Id",void 0);He([Gt({parser:h0,required:!0}),ht("design:type",h0)],pu.prototype,"CanonicalizationMethod",void 0);He([Gt({parser:uo,required:!0}),ht("design:type",uo)],pu.prototype,"SignatureMethod",void 0);He([Gt({parser:g0,minOccurs:1,noRoot:!0}),ht("design:type",g0)],pu.prototype,"References",void 0);pu=He([jt({localName:me.ElementNames.SignedInfo})],pu);var w0="http://www.w3.org/2001/04/xmldsig-more#",S0="ecdsa",Ph=class extends Ms{static{o(this,"EcdsaPublicKey")}};He([Gt({localName:me.ElementNames.X,namespaceURI:w0,prefix:S0,required:!0,converter:Vi}),ht("design:type",Uint8Array)],Ph.prototype,"X",void 0);He([Gt({localName:me.ElementNames.Y,namespaceURI:w0,prefix:S0,required:!0,converter:Vi}),ht("design:type",Uint8Array)],Ph.prototype,"Y",void 0);Ph=He([jt({localName:me.ElementNames.PublicKey,namespaceURI:w0,prefix:S0})],Ph);var v0=class extends Ms{static{o(this,"NamedCurve")}};He([Or({localName:me.AttributeNames.URI,required:!0}),ht("design:type",String)],v0.prototype,"Uri",void 0);v0=He([jt({localName:me.ElementNames.NamedCurve,namespaceURI:w0,prefix:S0})],v0);var y0=class extends Ms{static{o(this,"DomainParameters")}};He([Gt({parser:v0}),ht("design:type",v0)],y0.prototype,"NamedCurve",void 0);y0=He([jt({localName:me.ElementNames.DomainParameters,namespaceURI:w0,prefix:S0})],y0);var x0=class extends fi{static{o(this,"EcdsaKeyValue")}constructor(){super(...arguments),this.name=me.ElementNames.ECDSAKeyValue,this.key=null,this.jwk=null,this.keyUsage=null}static canImportCryptoKey(e){return e.algorithm.name.toUpperCase()===cu.toUpperCase()}get NamedCurve(){return P9(this.DomainParameters.NamedCurve.Uri)}async importKey(e){if(!e.algorithm.name||e.algorithm.name.toUpperCase()!=="ECDSA")throw new Fe(Te.ALGORITHM_WRONG_NAME,e.algorithm.name);let t=await vn.crypto.subtle.exportKey("jwk",e);return this.key=e,this.jwk=t,this.PublicKey=new Ph,this.PublicKey.X=wr.FromString(t.x||"","base64url"),this.PublicKey.Y=wr.FromString(t.y||"","base64url"),this.DomainParameters||(this.DomainParameters=new y0),this.DomainParameters.NamedCurve||(this.DomainParameters.NamedCurve=new v0),this.DomainParameters.NamedCurve.Uri=P9(t.crv||""),this.keyUsage=e.usages,this}async exportKey(e){if(this.key)return this.key;let t=wr.ToBase64Url(this.PublicKey.X),n=wr.ToBase64Url(this.PublicKey.Y),s=hhe(this.DomainParameters.NamedCurve.Uri),i={kty:"EC",crv:s,x:t,y:n,ext:!0};this.keyUsage=["verify"];let a=await vn.crypto.subtle.importKey("jwk",i,{name:"ECDSA",namedCurve:s},!0,this.keyUsage);return this.key=a,this.key}};He([Gt({parser:y0}),ht("design:type",y0)],x0.prototype,"DomainParameters",void 0);He([Gt({parser:Ph,required:!0}),ht("design:type",Ph)],x0.prototype,"PublicKey",void 0);x0=He([jt({localName:me.ElementNames.ECDSAKeyValue,namespaceURI:w0,prefix:S0})],x0);function P9(r){switch(r){case"P-256":return"urn:oid:1.2.840.10045.3.1.7";case"P-384":return"urn:oid:1.3.132.0.34";case"P-521":return"urn:oid:1.3.132.0.35"}throw new Fe(Te.CRYPTOGRAPHIC,"Unknown NamedCurve")}o(P9,"GetNamedCurveOid");function hhe(r){switch(r){case"urn:oid:1.2.840.10045.3.1.7":return"P-256";case"urn:oid:1.3.132.0.34":return"P-384";case"urn:oid:1.3.132.0.35":return"P-521"}throw new Fe(Te.CRYPTOGRAPHIC,"Unknown NamedCurve OID")}o(hhe,"GetNamedCurveFromOid");var phe=class extends Map{static{o(this,"KeyInfoClauseRegistry")}},gl=new phe;gl.set(me.ElementNames.RSAKeyValue,l0);gl.set(me.ElementNames.ECDSAKeyValue,x0);var cC=class{static{o(this,"KeyInfoClauseFactory")}static create(e){let t=gl.get(e);if(!t)throw new Fe(Te.KEY_INFO_CLAUSE_NOT_SUPPORTED,e);return new t}};var ux=class extends fi{static{o(this,"KeyValue")}set Value(e){this.element=null,this.value=e}get Value(){return this.value}constructor(e){super(),e&&(this.Value=e)}async importKey(e){for(let[,t]of gl)if(t.canImportCryptoKey(e)){let n=new t;return await n.importKey(e),this.Value=n,this}throw new Fe(Te.ALGORITHM_NOT_SUPPORTED,e.algorithm.name)}async exportKey(e){if(!this.Value)throw new Fe(Te.NULL_REFERENCE);return this.Value.exportKey(e)}OnGetXml(e){if(!this.Value)throw new Fe(Te.CRYPTOGRAPHIC,"KeyValue has empty value");let t=this.Value.GetXml();t&&e.appendChild(t)}OnLoadXml(e){for(let t=0;t<e.childNodes.length;t++){let n=e.childNodes.item(t);if(oi(n))try{let s=n.localName,i=cC.create(s);i.LoadXml(n),this.value=i;return}catch{}}throw new Fe(Te.CRYPTOGRAPHIC,"Unsupported KeyValue in use")}};ux=He([jt({localName:me.ElementNames.KeyValue}),ht("design:paramtypes",[fi])],ux);var dhe={"2.5.4.3":{short:"CN",long:"CommonName"},"2.5.4.6":{short:"C",long:"Country"},"2.5.4.5":{long:"DeviceSerialNumber"},"0.9.2342.19200300.100.1.25":{short:"DC",long:"DomainComponent"},"1.2.840.113549.1.9.1":{short:"E",long:"EMail"},"2.5.4.42":{short:"G",long:"GivenName"},"2.5.4.43":{short:"I",long:"Initials"},"2.5.4.7":{short:"L",long:"Locality"},"2.5.4.10":{short:"O",long:"Organization"},"2.5.4.11":{short:"OU",long:"OrganizationUnit"},"2.5.4.8":{short:"ST",long:"State"},"2.5.4.9":{short:"Street",long:"StreetAddress"},"2.5.4.4":{short:"SN",long:"SurName"},"2.5.4.12":{short:"T",long:"Title"},"1.2.840.113549.1.9.8":{long:"UnstructuredAddress"},"1.2.840.113549.1.9.2":{long:"UnstructuredName"}},b0=class{static{o(this,"X509Certificate")}constructor(e){if(this.publicKey=null,e){let t=new Uint8Array(e);this.LoadRaw(t),this.raw=t}}get SerialNumber(){return this.simpl.serialNumber.valueBlock.toString()}get Issuer(){return this.NameToString(this.simpl.issuer)}get Subject(){return this.NameToString(this.simpl.subject)}async Thumbprint(e="SHA-1"){return vn.crypto.subtle.digest(e,this.raw)}get PublicKey(){return this.publicKey}GetRaw(){return this.raw}async exportKey(e){if(e){let t={algorithm:e,usages:["verify"]};if(t.algorithm.name.toUpperCase()===cu){let s=this.simpl.subjectPublicKeyInfo.toJSON();if("crv"in s&&s.crv)t.algorithm.namedCurve=s.crv;else throw new Error("Cannot get Curved name from the ECDSA public key")}this.isHashedAlgorithm(t.algorithm)&&typeof t.algorithm.hash=="string"&&(t.algorithm.hash={name:t.algorithm.hash});let n=await this.simpl.getPublicKey({algorithm:t});return this.publicKey=n,n}return this.simpl.subjectPublicKeyInfo.algorithm.algorithmId==="1.2.840.113549.1.1.1"?this.publicKey=await this.simpl.getPublicKey({algorithm:{algorithm:{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},usages:["verify"]}}):this.publicKey=await this.simpl.getPublicKey(),this.publicKey}NameToString(e,t=","){let n=[];return e.typesAndValues.forEach(s=>{let i=s.type,a=dhe[i.toString()],u=a?a.short:null;n.push(`${u||i}=${s.value.valueBlock.value}`)}),n.join(t+" ")}LoadRaw(e){this.raw=new Uint8Array(e);let t=Gr(this.raw.buffer);this.simpl=new cs({schema:t.result})}isHashedAlgorithm(e){return!!e.hash}};var lC=class extends Kr{static{o(this,"X509IssuerSerial")}};He([Gt({localName:me.ElementNames.X509IssuerName,namespaceURI:me.NamespaceURI,prefix:me.DefaultPrefix,required:!0}),ht("design:type",String)],lC.prototype,"X509IssuerName",void 0);He([Gt({localName:me.ElementNames.X509SerialNumber,namespaceURI:me.NamespaceURI,prefix:me.DefaultPrefix,required:!0}),ht("design:type",String)],lC.prototype,"X509SerialNumber",void 0);lC=He([jt({localName:me.ElementNames.X509IssuerSerial})],lC);var Oh;(function(r){r[r.None=0]="None",r[r.EndCertOnly=1]="EndCertOnly",r[r.ExcludeRoot=2]="ExcludeRoot",r[r.WholeChain=3]="WholeChain"})(Oh||(Oh={}));var E0=class extends fi{static{o(this,"KeyInfoX509Data")}constructor(e,t=Oh.None){if(super(),this.x509crl=null,this.SubjectKeyIdList=[],e){if(e instanceof Uint8Array)this.AddCertificate(new b0(e));else if(e instanceof b0)switch(t){case Oh.None:case Oh.EndCertOnly:this.AddCertificate(e);break;case Oh.ExcludeRoot:this.AddCertificatesChainFrom(e,!1);break;case Oh.WholeChain:this.AddCertificatesChainFrom(e,!0);break}}}async importKey(e){throw new Fe(Te.METHOD_NOT_SUPPORTED)}async exportKey(e){if(!this.Certificates.length)throw new Fe(Te.NULL_REFERENCE);return this.Key=await this.Certificates[0].exportKey(e),this.Key}get Certificates(){return this.X509CertificateList}get CRL(){return this.x509crl}set CRL(e){this.x509crl=e}get IssuerSerials(){return this.IssuerSerialList}get SubjectKeyIds(){return this.SubjectKeyIdList}get SubjectNames(){return this.SubjectNameList}AddCertificate(e){if(!e)throw new Fe(Te.PARAM_REQUIRED,"certificate");this.X509CertificateList||(this.X509CertificateList=[]),this.X509CertificateList.push(e)}AddIssuerSerial(e,t){if(e==null)throw new Fe(Te.PARAM_REQUIRED,"issuerName");this.IssuerSerialList==null&&(this.IssuerSerialList=[]);let n={issuerName:e,serialNumber:t};this.IssuerSerialList.push(n)}AddSubjectKeyId(e){if(this.SubjectKeyIdList&&(this.SubjectKeyIdList=[]),typeof e=="string"){if(e!=null){let t=wr.FromBase64(e);this.SubjectKeyIdList.push(t)}}else this.SubjectKeyIdList.push(e)}AddSubjectName(e){this.SubjectNameList==null&&(this.SubjectNameList=[]),this.SubjectNameList.push(e)}GetXml(){let e=this.CreateDocument(),t=this.CreateElement(e),n=this.GetPrefix();if(this.IssuerSerialList!=null&&this.IssuerSerialList.length>0&&this.IssuerSerialList.forEach(s=>{let i=e.createElementNS(me.NamespaceURI,n+me.ElementNames.X509IssuerSerial),a=e.createElementNS(me.NamespaceURI,n+me.ElementNames.X509IssuerName);a.textContent=s.issuerName,i.appendChild(a);let u=e.createElementNS(me.NamespaceURI,n+me.ElementNames.X509SerialNumber);u.textContent=s.serialNumber,i.appendChild(u),t.appendChild(i)}),this.SubjectKeyIdList!=null&&this.SubjectKeyIdList.length>0&&this.SubjectKeyIdList.forEach(s=>{let i=e.createElementNS(me.NamespaceURI,n+me.ElementNames.X509SKI);i.textContent=wr.ToBase64(s),t.appendChild(i)}),this.SubjectNameList!=null&&this.SubjectNameList.length>0&&this.SubjectNameList.forEach(s=>{let i=e.createElementNS(me.NamespaceURI,n+me.ElementNames.X509SubjectName);i.textContent=s,t.appendChild(i)}),this.X509CertificateList!=null&&this.X509CertificateList.length>0&&this.X509CertificateList.forEach(s=>{let i=e.createElementNS(me.NamespaceURI,n+me.ElementNames.X509Certificate);i.textContent=wr.ToBase64(s.GetRaw()),t.appendChild(i)}),this.x509crl!=null){let s=e.createElementNS(me.NamespaceURI,n+me.ElementNames.X509CRL);s.textContent=wr.ToBase64(this.x509crl),t.appendChild(s)}return t}LoadXml(e){super.LoadXml(e),this.IssuerSerialList&&(this.IssuerSerialList=[]),this.SubjectKeyIdList&&(this.SubjectKeyIdList=[]),this.SubjectNameList&&(this.SubjectNameList=[]),this.X509CertificateList&&(this.X509CertificateList=[]),this.x509crl=null;let t=this.GetChildren(me.ElementNames.X509IssuerSerial);t&&t.forEach(s=>{let i=Kr.GetChild(s,me.ElementNames.X509IssuerName,me.NamespaceURI,!0),a=Kr.GetChild(s,me.ElementNames.X509SerialNumber,me.NamespaceURI,!0);i&&i.textContent&&a&&a.textContent&&this.AddIssuerSerial(i.textContent,a.textContent)}),t=this.GetChildren(me.ElementNames.X509SKI),t&&t.forEach(s=>{if(s.textContent){let i=wr.FromBase64(s.textContent);this.AddSubjectKeyId(i)}}),t=this.GetChildren(me.ElementNames.X509SubjectName),t?.forEach(s=>{s.textContent&&this.AddSubjectName(s.textContent)}),t=this.GetChildren(me.ElementNames.X509Certificate),t&&t.forEach(s=>{if(s.textContent){let i=wr.FromBase64(s.textContent);this.AddCertificate(new b0(i))}});let n=this.GetChild(me.ElementNames.X509CRL,!1);n&&n.textContent&&(this.x509crl=wr.FromBase64(n.textContent))}AddCertificatesChainFrom(e,t){}};E0=He([jt({localName:me.ElementNames.X509Data}),ht("design:paramtypes",[Object,Object])],E0);var cx=class extends fi{static{o(this,"SPKIData")}async importKey(e){let t=await vn.crypto.subtle.exportKey("spki",e);return this.SPKIexp=new Uint8Array(t),this.Key=e,this}async exportKey(e){if(!this.SPKIexp)throw new Error("SPKI data is not defined");let t=await vn.crypto.subtle.importKey("spki",this.SPKIexp,e,!0,["verify"]);return this.Key=t,t}};He([Gt({localName:me.ElementNames.SPKIexp,namespaceURI:me.NamespaceURI,prefix:me.DefaultPrefix,required:!0,converter:Vi}),ht("design:type",Object)],cx.prototype,"SPKIexp",void 0);cx=He([jt({localName:me.ElementNames.SPKIData})],cx);var kh=class extends $i{static{o(this,"KeyInfo")}OnLoadXml(e){for(let t=0;t<e.childNodes.length;t++){let n=e.childNodes.item(t);if(n.nodeType!==Ut.Element)continue;let s=null;switch(n.localName){case me.ElementNames.KeyValue:s=ux;break;case me.ElementNames.X509Data:s=E0;break;case me.ElementNames.SPKIData:s=cx;break;case me.ElementNames.KeyName:case me.ElementNames.RetrievalMethod:case me.ElementNames.PGPData:case me.ElementNames.MgmtData:}if(s){let i=new s;i.LoadXml(n),this.Add(i)}}}};He([Or({localName:me.AttributeNames.Id,defaultValue:""}),ht("design:type",String)],kh.prototype,"Id",void 0);kh=He([jt({localName:me.ElementNames.KeyInfo})],kh);var vl=class extends Kr{static{o(this,"Signature")}};He([Or({localName:me.AttributeNames.Id,defaultValue:""}),ht("design:type",String)],vl.prototype,"Id",void 0);He([Gt({parser:pu,required:!0}),ht("design:type",pu)],vl.prototype,"SignedInfo",void 0);He([Gt({localName:me.ElementNames.SignatureValue,namespaceURI:me.NamespaceURI,prefix:me.DefaultPrefix,required:!0,converter:Vi,defaultValue:null}),ht("design:type",Object)],vl.prototype,"SignatureValue",void 0);He([Gt({parser:kh}),ht("design:type",kh)],vl.prototype,"KeyInfo",void 0);He([Gt({parser:ax,noRoot:!0}),ht("design:type",ax)],vl.prototype,"ObjectList",void 0);vl=He([jt({localName:me.ElementNames.Signature})],vl);var ghe=class extends Map{static{o(this,"AlgorithmRegistry")}},dr=new ghe;dr.set(rC,{type:"signature",algorithm:a0});dr.set(nC,{type:"signature",algorithm:o0});dr.set(sC,{type:"signature",algorithm:u0});dr.set(iC,{type:"signature",algorithm:c0});dr.set(rC,{type:"signature",algorithm:a0});dr.set(nC,{type:"signature",algorithm:o0});dr.set(sC,{type:"signature",algorithm:u0});dr.set(iC,{type:"signature",algorithm:c0});dr.set(MD,{type:"signature",algorithm:oC});dr.set(JA,{type:"signature",algorithm:t0});dr.set(YA,{type:"signature",algorithm:r0});dr.set(QA,{type:"signature",algorithm:n0});dr.set(ZA,{type:"signature",algorithm:s0});dr.set(JA.toUpperCase(),{type:"signature",algorithm:t0});dr.set(YA.toUpperCase(),{type:"signature",algorithm:r0});dr.set(QA.toUpperCase(),{type:"signature",algorithm:n0});dr.set(ZA.toUpperCase(),{type:"signature",algorithm:s0});dr.set(OD,{type:"signature",algorithm:rx});dr.set(kD,{type:"signature",algorithm:nx});dr.set(LD,{type:"signature",algorithm:sx});dr.set(VD,{type:"signature",algorithm:ix});dr.set(Ym,{type:"hash",algorithm:XA});dr.set(Qm,{type:"hash",algorithm:tx});dr.set(Zm,{type:"hash",algorithm:WA});dr.set(e0,{type:"hash",algorithm:zA});var Lh=class{static{o(this,"AlgorithmFactory")}static createHashAlgorithmFromNamespace(e){for(let[t,{type:n,algorithm:s}]of dr)if(n==="hash"&&t===e)return new s;throw new Fe(Te.ALGORITHM_NOT_SUPPORTED,e)}static createSignatureAlgorithmFromMethod(e){for(let[t,{type:n,algorithm:s}]of dr)if(n==="signature"&&e.Algorithm===t){let i=new s;return i.fromMethod&&i.fromMethod(e),i}throw new Fe(Te.ALGORITHM_NOT_SUPPORTED,e.Algorithm)}static createHashAlgorithmFromAlgorithm(e){for(let[,{type:t,algorithm:n}]of dr)if(t==="hash"){let s=new n;if(s.algorithm.name.toUpperCase()===e.name.toUpperCase())return s}throw new Fe(Te.ALGORITHM_NOT_SUPPORTED,e.name)}static createSignatureAlgorithmFromAlgorithm(e){for(let[,{type:t,algorithm:n}]of dr)if(t==="signature"){let s=n.fromAlgorithm(e);if(s)return s}throw new Fe(Te.ALGORITHM_NOT_SUPPORTED,e.name)}};var vhe=class extends Map{static{o(this,"TransformRegistry")}},du=new vhe;du.set(me.AlgorithmNamespaces.XmlDsigBase64Transform,fu);du.set(me.AlgorithmNamespaces.XmlDsigC14NTransform,co);du.set(me.AlgorithmNamespaces.XmlDsigC14NWithCommentsTransform,lo);du.set(me.AlgorithmNamespaces.XmlDsigEnvelopedSignatureTransform,hu);du.set(me.AlgorithmNamespaces.XmlDsigExcC14NTransform,fo);du.set(me.AlgorithmNamespaces.XmlDsigExcC14NWithCommentsTransform,ho);var ox=class{static{o(this,"CryptoConfig")}static CreateFromName(e){if(!e)throw new Fe(Te.PARAM_REQUIRED,"name");let t=du.get(e);if(t)return new t;let n;switch(e){case me.AlgorithmNamespaces.XmlDsigBase64Transform:n=new fu;break;case me.AlgorithmNamespaces.XmlDsigC14NTransform:n=new co;break;case me.AlgorithmNamespaces.XmlDsigC14NWithCommentsTransform:n=new lo;break;case me.AlgorithmNamespaces.XmlDsigEnvelopedSignatureTransform:n=new hu;break;case me.AlgorithmNamespaces.XmlDsigXPathTransform:throw new Fe(Te.ALGORITHM_NOT_SUPPORTED,e);case me.AlgorithmNamespaces.XmlDsigXsltTransform:throw new Fe(Te.ALGORITHM_NOT_SUPPORTED,e);case me.AlgorithmNamespaces.XmlDsigExcC14NTransform:n=new fo;break;case me.AlgorithmNamespaces.XmlDsigExcC14NWithCommentsTransform:n=new ho;break;case me.AlgorithmNamespaces.XmlDecryptionTransform:throw new Fe(Te.ALGORITHM_NOT_SUPPORTED,e);default:throw new Fe(Te.ALGORITHM_NOT_SUPPORTED,e)}return n}static CreateSignatureAlgorithm(e){return Lh.createSignatureAlgorithmFromMethod(e)}static CreateHashAlgorithm(e){return Lh.createHashAlgorithmFromNamespace(e)}static GetHashAlgorithm(e){let t=typeof e=="string"?{name:e}:e;return Lh.createHashAlgorithmFromAlgorithm(t)}static GetSignatureAlgorithm(e){let t=typeof e=="string"?{name:e}:e;return"hash"in t&&typeof t.hash=="string"&&(t.hash={name:t.hash}),Lh.createSignatureAlgorithmFromAlgorithm(t)}static CreateSignatureMethod(e){let t=new uo;return t.Algorithm=e.namespaceURI,e.toMethod&&e.toMethod(t),t}static RegisterSignatureAlgorithm(e,t){dr.set(e,{type:"signature",algorithm:t})}static RegisterHashAlgorithm(e,t){dr.set(e,{type:"hash",algorithm:t})}static RegisterKeyInfoClause(e,t){gl.set(e,t)}static RegisterTransform(e,t){du.set(e,t)}};var fC=Zx(BI(),1);var O9={xmldec:{version:"1.0",encoding:"UTF-8",standalone:void 0}};var k9={explicitArray:!1,explicitRoot:!1,preserveChildrenOrder:!0};var L9=class{static{o(this,"Xml2JsToolkit")}xml2js;constructor(e=whe){this.xml2js=e,Qj({XMLSerializer:fC.default.XMLSerializer,DOMParser:fC.default.DOMParser,DOMImplementation:fC.default.DOMImplementation})}async validate(e,t){try{return await CU.validate(e,t),ri()}catch(n){return Fu(n)}}parse(e,t){return new Promise((n,s)=>new this.xml2js.Parser({...k9,...t}).parseString(e,(i,a)=>i?s(i):n(a)))}build(e,t){return Promise.resolve(new this.xml2js.Builder({...O9,...t}).buildObject(e))}digest(e,t,n=K0){return this.hash(this.canonicalize(e,n),t)}canonicalize(e,t=K0){let n=Li(this.clear(e));return new oo(t.includeComments,t.exclusive).Canonicalize(n)}getNode(e,t){let s=Li(e).documentElement.getElementsByTagName(t).item(0);return s?this.clear(Qa(s)):null}getFirstNode(e){let n=Li(e).documentElement.firstChild;return n?this.clear(Qa(n)):null}getAttribute(e,t){return Li(e).documentElement.getAttribute(t)}appendNode(e,t){let n=Li(e),{documentElement:s}=Li(t);return n.documentElement.appendChild(s),this.clear(Qa(n))}hash(e,t){return xhe.createHash(t).update(e,"utf8").digest().toString("base64")}clear(e){return['xmlns:default="http://www.w3.org/2000/09/xmldsig#"',' standalone="no"',"default:",":default",`
101
101
  `,"\r"," "].reduce((n,s)=>n.replace(s,""),e.replace(/(>)\s*(<)/gm,"$1$2"))}};import{registerDecorator as She}from"class-validator";var V9=o(r=>(e,t)=>{She({name:"isDecimal",target:e.constructor,propertyName:t,options:r,validator:{validate(n){return n instanceof np?!0:typeof n=="string"||typeof n=="number"||typeof n=="bigint"},defaultMessage(n){return`${n.property} is not a valid Decimal value`}}})},"IsDecimal");import"reflect-metadata";import{registerDecorator as U9}from"class-validator";var A0=Symbol("choice"),C0=o(r=>r==null||r==="","isEmpty"),TTe=o(r=>e=>{let{properties:t,required:n=!1,...s}=r,i=Reflect.getMetadata(A0,e)??[],a={properties:t,required:n};i.push(a),Reflect.defineMetadata(A0,i,e);for(let u of t)U9({name:"choice",target:e,propertyName:u,options:s,validator:{validate(c,f){let h=f.object,m=f.property,g=Reflect.getMetadata(A0,e);if(!g)return!0;let x=g.find(v=>v.properties.includes(m));if(!x||C0(c))return!0;for(let v of x.properties){if(v===m)continue;let w=h[v];if(!C0(w))return!1}for(let v of g)if(v!==x)for(let w of v.properties){let S=h[w];if(!C0(S))return!1}return!0},defaultMessage(c){let f=Reflect.getMetadata(A0,e);if(!f)return`${c.property} validation error`;let h=f.find(g=>g.properties.includes(c.property));if(!h)return`${c.property} validation error`;let m=c.object;for(let g of h.properties){let x=m[g];if(!C0(x)&&g!==c.property)return`${c.property} cannot be set because ${g} is already set. Only one property from this choice group is allowed.`}for(let g of f)if(g!==h)for(let x of g.properties){let v=m[x];if(!C0(v))return`${c.property} cannot be set because ${x} from a different choice group is already set.`}return`${c.property} validation error`}}});if(n)for(let u of t)U9({name:"choiceGroupRequired",target:e,propertyName:u,options:{...s,always:!0},validator:{validate(c,f){let h=f.object,m=Reflect.getMetadata(A0,e);if(!m)return!0;let g=m.find(x=>x.properties.includes(f.property));if(!g?.required)return!0;for(let x of g.properties){let v=h[x];if(!C0(v))return!0}return f.property!==g.properties[0]},defaultMessage(c){let f=Reflect.getMetadata(A0,e);if(!f)return"At least one property from a choice group must be provided";let h=f.find(m=>m.properties.includes(c.property));return h?`You must provide a value for one of the following properties: ${h.properties.join(", ")}`:"At least one property from a choice group must be provided"}}})},"Choice");import"reflect-metadata";import{Transform as bhe}from"class-transformer";var OTe=o(({fixed:r,...e}={fixed:2})=>(t,n)=>{V9(e)(t,n),bhe(({value:s})=>np.newOrUndefined(s)?.toFixed(r))(t,n)},"TransformDecimal");import{Transform as Che}from"class-transformer";import{IsDateString as Nhe}from"class-validator";import qD from"dayjs";import Ehe from"dayjs/plugin/utc.js";import Ahe from"dayjs/plugin/timezone.js";qD.extend(Ehe);qD.extend(Ahe);var j9=qD;var KTe=o((r={})=>(e,t)=>{Che(({value:n})=>{let s=n instanceof Date?n.toISOString():n;return s?j9(s).tz("America/Sao_Paulo").format(r.format):void 0})(e,t),Nhe()(e,t)},"TransformDateString");var M9=class{static{o(this,"StateCodeAcValidator")}execute(e){if(e=e.replace(/\D/g,""),!/^01\d{11}$/.test(e))return!1;let t=e.split("").map(Number),n=t.slice(0,11),s=t[11],i=t[12],a=[4,3,2,9,8,7,6,5,4,3,2],c=n.reduce((v,w,S)=>v+w*a[S],0)%11,f=c===0||c===1?0:11-c,h=[5,4,3,2,9,8,7,6,5,4,3,2],g=[...n,f].reduce((v,w,S)=>v+w*h[S],0)%11,x=g===0||g===1?0:11-g;return s===f&&i===x}};var F9=class{static{o(this,"StateCodeAlValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9||!t.startsWith("24"))return!1;let n=[9,8,7,6,5,4,3,2],s=0;for(let c=0;c<8;c++)s+=parseInt(t[c],10)*n[c];let a=s*10%11;return(a===10?0:a)===parseInt(t[8],10)}};var q9=class{static{o(this,"StateCodeAmValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9)return!1;let n=[9,8,7,6,5,4,3,2],s=0;for(let a=0;a<8;a++)s+=parseInt(t[a],10)*n[a];let i;if(s<11)i=11-s;else{let a=s%11;i=a<=1?0:11-a}return i===parseInt(t[8],10)}};var H9=class{static{o(this,"StateCodeApValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9||!t.startsWith("03"))return!1;let n=t.substring(0,8),s=parseInt(n,10),i,a;s>=3017001&&s<=3019022?(i=9,a=1):s>=3000001&&s<=3017e3?(i=5,a=0):(i=0,a=0);let u=[9,8,7,6,5,4,3,2],c=i;for(let m=0;m<8;m++)c+=parseInt(t[m],10)*u[m];let h=11-c%11;return h===10?h=0:h===11&&(h=a),h===parseInt(t[8],10)}};var K9=class{static{o(this,"StateCodeBaValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==8&&t.length!==9)return!1;let n=t.split("").map(w=>parseInt(w,10)),s=(t.length===8?n[0]:n[1])<=5||n[0]===8?10:11,i=t.length===8?[7,6,5,4,3,2]:[8,7,6,5,4,3,2],a=0;for(let w=0;w<i.length;w++)a+=n[w]*i[w];let u=a%s,c=s-u;(s===11&&u<=1||s===10&&u===0)&&(c=0);let h=(t.slice(0,t.length-2)+c.toString()).split("").map(w=>parseInt(w,10)),m=t.length===8?[8,7,6,5,4,3,2]:[9,8,7,6,5,4,3,2],g=0;for(let w=0;w<m.length;w++)g+=h[w]*m[w];let x=g%s,v=s-x;return(s===11&&x<=1||s===10&&x===0)&&(v=0),v===n[t.length-2]&&c===n[t.length-1]}};var $9=class{static{o(this,"StateCodeCeValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9)return!1;let n=[9,8,7,6,5,4,3,2],s=0;for(let u=0;u<8;u++)s+=parseInt(t[u],10)*n[u];let a=11-s%11;return(a===10||a===11)&&(a=0),a===parseInt(t[8],10)}};var G9=class{static{o(this,"StateCodeDfValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==13||!t.startsWith("07"))return!1;let n=t.slice(0,11).split("").map(Number),s=t.slice(11).split("").map(Number),i=[2,3,4,5,6,7,8,9],a=0;for(let m=10,g=0;m>=0;m--,g=(g+1)%i.length)a+=n[m]*i[g];let u=11-a%11;(u===10||u===11)&&(u=0);let c=n.concat([u]),f=0;for(let m=11,g=0;m>=0;m--,g=(g+1)%i.length)f+=c[m]*i[g];let h=11-f%11;return(h===10||h===11)&&(h=0),u===s[0]&&h===s[1]}};var X9=class{static{o(this,"StateCodeEsValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9)return!1;let n=[9,8,7,6,5,4,3,2],s=0;for(let u=0;u<8;u++)s+=parseInt(t[u],10)*n[u];let i=s%11;return(i<2?0:11-i)===parseInt(t[8],10)}};var W9=class{static{o(this,"StateCodeGoValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9)return!1;let n=parseInt(t.substring(0,2));if(!(n===10||n===11||n>=20&&n<=29))return!1;let s=[9,8,7,6,5,4,3,2],i=0;for(let c=0;c<8;c++)i+=parseInt(t[c],10)*s[c];let a=i%11;return(a===0||a===1?0:11-a)===parseInt(t[8],10)}};var z9=class{static{o(this,"StateCodeMaValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9||!t.startsWith("12"))return!1;let n=[9,8,7,6,5,4,3,2],s=0;for(let u=0;u<8;u++)s+=parseInt(t[u],10)*n[u];let i=s%11;return(i===0||i===1?0:11-i)===parseInt(t[8],10)}};var J9=class{static{o(this,"StateCodeMgValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==13)return!1;let n=t.slice(0,11),s=n.slice(0,3)+"0"+n.slice(3),i=0;for(let x=0;x<12;x++){let v=x%2===0?1:2,w=(parseInt(s[x])*v).toString();i+=w.split("").reduce((S,A)=>S+parseInt(A),0)}let u=Math.ceil(i/10)*10-i,c=n+u.toString(),f=[3,2,11,10,9,8,7,6,5,4,3,2],h=0;for(let x=0;x<12;x++)h+=parseInt(c[x])*f[x];let m=h%11,g=m<2?0:11-m;return parseInt(t[11])===u&&parseInt(t[12])===g}};var Y9=class{static{o(this,"StateCodeMsValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9||!(t.startsWith("28")||t.startsWith("50")))return!1;let n=[9,8,7,6,5,4,3,2],s=0;for(let c=0;c<8;c++)s+=parseInt(t[c],10)*n[c];let i=s%11,a=11-i;return(i===0||a>9?0:a)===parseInt(t[8],10)}};var Q9=class{static{o(this,"StateCodeMtValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==11)return!1;let n=[3,2,9,8,7,6,5,4,3,2],s=0;for(let u=0;u<10;u++)s+=parseInt(t[u],10)*n[u];let i=s%11;return(i===0||i===1?0:11-i)===parseInt(t[10],10)}};var Z9=class{static{o(this,"StateCodePaValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9)return!1;let n=[9,8,7,6,5,4,3,2],s=0;for(let u=0;u<8;u++)s+=parseInt(t[u])*n[u];let i=s%11;return(i===0||i===1?0:11-i)===parseInt(t[8])}};var eq=class{static{o(this,"StateCodePbValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9)return!1;let n=[9,8,7,6,5,4,3,2],s=0;for(let u=0;u<8;u++)s+=parseInt(t[u])*n[u];let a=11-s%11;return(a===10||a===11)&&(a=0),a===parseInt(t[8])}};var tq=class{static{o(this,"StateCodePeValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9)return!1;let n=t.slice(0,7).split("").map(Number),s=[8,7,6,5,4,3,2],i=0;for(let x=0;x<7;x++)i+=n[x]*s[x];let a=i%11,u=a===0||a===1?0:11-a,c=[...n,u],f=[9,8,7,6,5,4,3,2],h=0;for(let x=0;x<8;x++)h+=c[x]*f[x];let m=h%11,g=m===0||m===1?0:11-m;return u===parseInt(t[7])&&g===parseInt(t[8])}};var rq=class{static{o(this,"StateCodePiValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9)return!1;let n=[9,8,7,6,5,4,3,2],s=0;for(let u=0;u<8;u++)s+=parseInt(t[u],10)*n[u];let a=11-s%11;return(a===10||a===11)&&(a=0),a===parseInt(t[8],10)}};var nq=class{static{o(this,"StateCodePrValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==10)return!1;let n=t.slice(0,8).split("").map(Number),s=[3,2,7,6,5,4,3,2],i=[4,3,2,7,6,5,4,3,2],a=0;for(let m=0;m<8;m++)a+=n[m]*s[m];let u=11-a%11;u>=10&&(u=0);let c=[...n,u],f=0;for(let m=0;m<9;m++)f+=c[m]*i[m];let h=11-f%11;return h>=10&&(h=0),u===parseInt(t[8])&&h===parseInt(t[9])}};var sq=class{static{o(this,"StateCodeRjValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==8)return!1;let n=[2,7,6,5,4,3,2],s=0;for(let u=0;u<7;u++)s+=parseInt(t[u],10)*n[u];let i=s%11;return(i<=1?0:11-i)===parseInt(t[7],10)}};var iq=class{static{o(this,"StateCodeRnValidator")}execute(e){let t=e.replace(/\D/g,"");if(!(t.length===9||t.length===10)||!t.startsWith("20"))return!1;let n=t.length===9?[9,8,7,6,5,4,3,2]:[10,9,8,7,6,5,4,3,2],s=t.slice(0,n.length).split("").map(Number),i=0;for(let f=0;f<n.length;f++)i+=s[f]*n[f];let u=i*10%11;return(u===10?0:u)===parseInt(t[t.length-1])}};var aq=class{static{o(this,"StateCodeRoValidator")}execute(e){let t=e.replace(/\D/g,""),n,s;if(t.length===9)n=t.slice(3,8).split("").map(Number),s=[6,5,4,3,2];else if(t.length===14)n=t.slice(0,13).split("").map(Number),s=[6,5,4,3,2,9,8,7,6,5,4,3,2];else return!1;let i=0;for(let c=0;c<s.length;c++)i+=n[c]*s[c];let u=11-i%11;return(u===10||u===11)&&(u-=10),u===parseInt(t[t.length-1])}};var oq=class{static{o(this,"StateCodeRrValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9||!t.startsWith("24"))return!1;let n=0;for(let i=0;i<8;i++)n+=(i+1)*parseInt(t[i],10);return n%9===parseInt(t[8],10)}};var uq=class{static{o(this,"StateCodeRsValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==10)return!1;let n=[2,9,8,7,6,5,4,3,2],s=0;for(let a=0;a<9;a++)s+=parseInt(t[a],10)*n[a];let i=11-s%11;return(i===10||i===11)&&(i=0),i===parseInt(t[9],10)}};var cq=class{static{o(this,"StateCodeScValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9)return!1;let n=[9,8,7,6,5,4,3,2],s=0;for(let u=0;u<8;u++)s+=parseInt(t[u],10)*n[u];let a=11-s%11;return(a===10||a===11)&&(a=0),a===parseInt(t[8],10)}};var lq=class{static{o(this,"StateCodeSeValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9)return!1;let n=[9,8,7,6,5,4,3,2],s=0;for(let u=0;u<8;u++)s+=parseInt(t[u])*n[u];let a=11-s%11;return(a===10||a===11)&&(a=0),a===parseInt(t[8],10)}};var fq=class{static{o(this,"StateCodeSpValidator")}execute(e){let t=e;if(t.length!==12)return!1;let n=t.split("").map(Number),s=[1,3,4,5,6,7,8,10],i=0;for(let h=0;h<8;h++)i+=n[h]*s[h];let a=i%11%10,u=[3,2,10,9,8,7,6,5,4,3,2],c=0;for(let h=0;h<11;h++)c+=n[h]*u[h];let f=c%11%10;return a===n[8]&&f===n[11]}};var hq=class{static{o(this,"StateCodeToValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==11)return!1;let n=t.split(""),s=n.slice(0,2).concat(n.slice(4,10)).map(Number),i=[9,8,7,6,5,4,3,2],a=0;for(let f=0;f<i.length;f++)a+=s[f]*i[f];let u=a%11;return(u<2?0:11-u)===parseInt(t[10])}};var hC=class{static{o(this,"ASN1")}extractCertificateInfo(e){let n=e.subject.split(`
102
- `).reduce((i,a)=>{let[u,c]=a.split("=").map(f=>f.trim());return!u||!c?i:i.set(u,c)},new Map),s=this.oid("2.16.76.1.3.1",e.raw);return{CNPJ:this.oid("2.16.76.1.3.3",e.raw),CPF:s,CN:n.get("CN")?.replace(/:.*$/g,""),O:n.get("O"),OU:n.get("OU"),ST:n.get("ST"),L:n.get("L"),C:n.get("C")}}oid(e,t){let n=this.marker(e),s=t.indexOf(n);if(s===-1)return;let i=[t.subarray(0,s),t.subarray(s)];if(i.length<=1)return;let u=i[0].subarray(-4),c=u.subarray(-2);u[0]===48?c=u:u[1]===48&&(c=u.subarray(-3));let f=Buffer.concat([c,n,i[1]]),h=this.length(f),m=n.length,g=f.subarray(2+m,2+m+h),x=g.length-c.length-2;if(x<=0||x>g.length)return;let w=g.subarray(-x).toString("utf8");return w.substring(Buffer.from(w).findIndex((S,A)=>w.charCodeAt(A)>=32&&w.charCodeAt(A)<=126))}length(e){return e.length<2?0:e[1]<=127?e[1]:Buffer.from([e[1]&15]).reduce((t,n)=>t<<8|n,0)}marker(e){let t=e.split("."),n=t.slice(2).reduce((s,i)=>{let a=this.base128(s,Number.parseInt(i,10),!0);return s.length=0,s.push(...a),s},[]);return Buffer.from([6,n.length+1,40*Number.parseInt(t[0],10)+Number.parseInt(t[1],10),...n])}base128(e,t,n){let s=[...e];if(t>127){let a=this.base128(e,Math.floor(t/128),!1);a.length=0,s.push(...a)}let i=t%128;return n?s.push(i):s.push(128|i),s}};var dq=class{static{o(this,"NativeCertificateRepository")}httpClient;cache;constructor(e,t=new lw){this.httpClient=e,this.cache=t}async read(e){try{let{password:t}=e,n=await this.getPfxBuffer(e);if(n.isLeft())return n;let s=Vh.default.asn1.fromDer(n.value.toString("binary")),i=Vh.default.pkcs12.pkcs12FromAsn1(s,t),{certBag:a,pkcs8ShroudedKeyBag:u}=Vh.default.pki.oids,c=i.getBags({bagType:a}),f=i.getBags({bagType:u}),h=c[a];if(!h?.length)return ti(new pn("Cannot read certificate"));let[{cert:m},...g]=h;if(!m)return ti(new pn("Issuer Certificate not found"));let x=f[u]?.[0].key;if(!x)return ti(new pn("Certificate Private Key not found"));let v=g.reduce((b,{cert:E})=>(E&&b.push(new N0.X509Certificate(Vh.default.pki.certificateToPem(E))),b),[]),w=Vh.default.pki.privateKeyToPem(x),S=Vh.default.pki.certificateToPem(m),A=N0.createPrivateKey(w),T=new N0.X509Certificate(S);return ri({ca:v,password:t,privateKey:A,certificate:T})}catch(t){return Bu(t)}}async sign(e,t,n=Cu.SHA1){try{let i=N0.sign(n,Buffer.from(e),{key:t,padding:N0.constants.RSA_PKCS1_PADDING}).toString("base64");return await Promise.resolve(ri(i))}catch(s){return Promise.resolve(Bu(s))}}getCertificateInfo(e){return new hC().extractCertificateInfo(e)}getStringCertificate(e){return e.raw.toString("base64")}getStringPrivateKey(e){try{return e.export({type:"pkcs8",format:"pem"}).toString()}catch{throw new pn("Cannot extract private key")}}async getPfxBuffer(e){let{pfxPathOrBase64:t,password:n}=e,s=this.getCacheKey(t,n),i=await this.cache.get(s);if(i)return ri(i);if(The.isAbsolute(t)||pq.existsSync(t))return this.hitBufferOnCache(s,pq.readFileSync(t));if(this.isValidRemoteUrl(t))try{let a=await this.httpClient.get(t,{responseType:"arraybuffer"});return await this.hitBufferOnCache(s,Buffer.from(a.data))}catch(a){return Bu(a)}return this.hitBufferOnCache(s,Buffer.from(t,"base64"))}getCacheKey(e,t){return N0.createHash("sha256").update(`${e}.${t}`).digest("hex")}async hitBufferOnCache(e,t){return await this.cache.set(e,t),ri(t)}isValidRemoteUrl(e){try{return new URL(e),!0}catch{return!1}}};var J_e={[br.AC]:"America/Rio_Branco",[br.AL]:"America/Maceio",[br.AM]:"America/Manaus",[br.AP]:"America/Belem",[br.BA]:"America/Bahia",[br.CE]:"America/Fortaleza",[br.DF]:"America/Sao_Paulo",[br.ES]:"America/Sao_Paulo",[br.GO]:"America/Sao_Paulo",[br.MA]:"America/Fortaleza",[br.MG]:"America/Sao_Paulo",[br.MS]:"America/Campo_Grande",[br.MT]:"America/Cuiaba",[br.PA]:"America/Belem",[br.PB]:"America/Fortaleza",[br.PE]:"America/Recife",[br.PI]:"America/Fortaleza",[br.PR]:"America/Sao_Paulo",[br.RJ]:"America/Sao_Paulo",[br.RN]:"America/Fortaleza",[br.RO]:"America/Porto_Velho",[br.RR]:"America/Boa_Vista",[br.RS]:"America/Sao_Paulo",[br.SC]:"America/Sao_Paulo",[br.SE]:"America/Maceio",[br.SP]:"America/Sao_Paulo",[br.TO]:"America/Araguaina"};export{I2 as a,dO as b,_2 as c,Cu as d,B2 as e,br as f,_he as g,Dhe as h,pn as i,mO as j,D2 as k,Zh as l,R2 as m,ew as n,ti as o,ri as p,gO as q,vO as r,$0 as s,ape as t,ope as u,tw as v,yO as w,xO as x,wO as y,vpe as z,np as A,kO as B,Bu as C,lw as D,dq as E,bp as F,m8 as G,v8 as H,vU as I,L9 as J,V9 as K,TTe as L,OTe as M,KTe as N,M9 as O,F9 as P,q9 as Q,H9 as R,K9 as S,$9 as T,G9 as U,X9 as V,W9 as W,z9 as X,J9 as Y,Y9 as Z,Q9 as _,Z9 as $,eq as aa,tq as ba,rq as ca,nq as da,sq as ea,iq as fa,aq as ga,oq as ha,uq as ia,cq as ja,lq as ka,fq as la,hq as ma,hC as na};
102
+ `).reduce((i,a)=>{let[u,c]=a.split("=").map(f=>f.trim());return!u||!c?i:i.set(u,c)},new Map),s=this.oid("2.16.76.1.3.1",e.raw);return{CNPJ:this.oid("2.16.76.1.3.3",e.raw),CPF:s,CN:n.get("CN")?.replace(/:.*$/g,""),O:n.get("O"),OU:n.get("OU"),ST:n.get("ST"),L:n.get("L"),C:n.get("C")}}oid(e,t){let n=this.marker(e),s=t.indexOf(n);if(s===-1)return;let i=[t.subarray(0,s),t.subarray(s)];if(i.length<=1)return;let u=i[0].subarray(-4),c=u.subarray(-2);u[0]===48?c=u:u[1]===48&&(c=u.subarray(-3));let f=Buffer.concat([c,n,i[1]]),h=this.length(f),m=n.length,g=f.subarray(2+m,2+m+h),x=g.length-c.length-2;if(x<=0||x>g.length)return;let w=g.subarray(-x).toString("utf8");return w.substring(Buffer.from(w).findIndex((S,A)=>w.charCodeAt(A)>=32&&w.charCodeAt(A)<=126))}length(e){return e.length<2?0:e[1]<=127?e[1]:Buffer.from([e[1]&15]).reduce((t,n)=>t<<8|n,0)}marker(e){let t=e.split("."),n=t.slice(2).reduce((s,i)=>{let a=this.base128(s,Number.parseInt(i,10),!0);return s.length=0,s.push(...a),s},[]);return Buffer.from([6,n.length+1,40*Number.parseInt(t[0],10)+Number.parseInt(t[1],10),...n])}base128(e,t,n){let s=[...e];if(t>127){let a=this.base128(e,Math.floor(t/128),!1);a.length=0,s.push(...a)}let i=t%128;return n?s.push(i):s.push(128|i),s}};var dq=class{static{o(this,"NativeCertificateRepository")}httpClient;cache;constructor(e,t=new lw){this.httpClient=e,this.cache=t}async read(e){try{let{password:t}=e,n=await this.getPfxBuffer(e);if(n.isLeft())return n;let s=Vh.default.asn1.fromDer(n.value.toString("binary")),i=Vh.default.pkcs12.pkcs12FromAsn1(s,t),{certBag:a,pkcs8ShroudedKeyBag:u}=Vh.default.pki.oids,c=i.getBags({bagType:a}),f=i.getBags({bagType:u}),h=c[a];if(!h?.length)return ti(new pn("Cannot read certificate"));let[{cert:m},...g]=h;if(!m)return ti(new pn("Issuer Certificate not found"));let x=f[u]?.[0].key;if(!x)return ti(new pn("Certificate Private Key not found"));let v=g.reduce((b,{cert:E})=>(E&&b.push(new N0.X509Certificate(Vh.default.pki.certificateToPem(E))),b),[]),w=Vh.default.pki.privateKeyToPem(x),S=Vh.default.pki.certificateToPem(m),A=N0.createPrivateKey(w),T=new N0.X509Certificate(S);return ri({ca:v,password:t,privateKey:A,certificate:T})}catch(t){return Fu(t)}}async sign(e,t,n=Cu.SHA1){try{let i=N0.sign(n,Buffer.from(e),{key:t,padding:N0.constants.RSA_PKCS1_PADDING}).toString("base64");return await Promise.resolve(ri(i))}catch(s){return Promise.resolve(Fu(s))}}getCertificateInfo(e){return new hC().extractCertificateInfo(e)}getStringCertificate(e){return e.raw.toString("base64")}getStringPrivateKey(e){try{return e.export({type:"pkcs8",format:"pem"}).toString()}catch{throw new pn("Cannot extract private key")}}async getPfxBuffer(e){let{pfxPathOrBase64:t,password:n}=e,s=this.getCacheKey(t,n),i=await this.cache.get(s);if(i)return ri(i);if(The.isAbsolute(t)||pq.existsSync(t))return this.hitBufferOnCache(s,pq.readFileSync(t));if(this.isValidRemoteUrl(t))try{let a=await this.httpClient.get(t,{responseType:"arraybuffer"});return await this.hitBufferOnCache(s,Buffer.from(a.data))}catch(a){return Fu(a)}return this.hitBufferOnCache(s,Buffer.from(t,"base64"))}getCacheKey(e,t){return N0.createHash("sha256").update(`${e}.${t}`).digest("hex")}async hitBufferOnCache(e,t){return await this.cache.set(e,t),ri(t)}isValidRemoteUrl(e){try{return new URL(e),!0}catch{return!1}}};var J_e={[br.AC]:"America/Rio_Branco",[br.AL]:"America/Maceio",[br.AM]:"America/Manaus",[br.AP]:"America/Belem",[br.BA]:"America/Bahia",[br.CE]:"America/Fortaleza",[br.DF]:"America/Sao_Paulo",[br.ES]:"America/Sao_Paulo",[br.GO]:"America/Sao_Paulo",[br.MA]:"America/Fortaleza",[br.MG]:"America/Sao_Paulo",[br.MS]:"America/Campo_Grande",[br.MT]:"America/Cuiaba",[br.PA]:"America/Belem",[br.PB]:"America/Fortaleza",[br.PE]:"America/Recife",[br.PI]:"America/Fortaleza",[br.PR]:"America/Sao_Paulo",[br.RJ]:"America/Sao_Paulo",[br.RN]:"America/Fortaleza",[br.RO]:"America/Porto_Velho",[br.RR]:"America/Boa_Vista",[br.RS]:"America/Sao_Paulo",[br.SC]:"America/Sao_Paulo",[br.SE]:"America/Maceio",[br.SP]:"America/Sao_Paulo",[br.TO]:"America/Araguaina"};export{I2 as a,dO as b,_2 as c,Cu as d,B2 as e,br as f,_he as g,Dhe as h,pn as i,mO as j,D2 as k,Zh as l,ti as m,ri as n,gO as o,vO as p,$0 as q,ape as r,ope as s,tw as t,yO as u,xO as v,wO as w,vpe as x,np as y,kO as z,lw as A,dq as B,bp as C,m8 as D,v8 as E,vU as F,L9 as G,V9 as H,TTe as I,OTe as J,KTe as K,M9 as L,F9 as M,q9 as N,H9 as O,K9 as P,$9 as Q,G9 as R,X9 as S,W9 as T,z9 as U,J9 as V,Y9 as W,Q9 as X,Z9 as Y,eq as Z,tq as _,rq as $,nq as aa,sq as ba,iq as ca,aq as da,oq as ea,uq as fa,cq as ga,lq as ha,fq as ia,hq as ja,hC as ka};
103
103
  /*! Bundled license information:
104
104
 
105
105
  lodash/lodash.js: